On Wed, 2020-05-27 at 07:36 +0000, Dexuan Cui wrote: > > From: Saeed Mahameed <sae...@mellanox.com> > > Sent: Tuesday, May 26, 2020 6:49 PM > > To: David S. Miller <da...@davemloft.net>; k...@kernel.org > > Cc: netdev@vger.kernel.org; Mark Bloch <ma...@mellanox.com>; Dexuan > > Cui > > <de...@microsoft.com>; Moshe Shemesh <mo...@mellanox.com>; Saeed > > Mahameed <sae...@mellanox.com> > > Subject: [net-next 12/16] net/mlx5: Add basic suspend/resume > > support > > > > From: Mark Bloch <ma...@mellanox.com> > > > > Add callbacks so the NIC could be suspended and resumed. > > > > Tested-by: Dexuan Cui <de...@microsoft.com> > > Signed-off-by: Mark Bloch <ma...@mellanox.com> > > Reviewed-by: Moshe Shemesh <mo...@mellanox.com> > > Signed-off-by: Saeed Mahameed <sae...@mellanox.com> > > --- > > drivers/net/ethernet/mellanox/mlx5/core/main.c | 18 > > ++++++++++++++++++ > > 1 file changed, 18 insertions(+) > > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c > > b/drivers/net/ethernet/mellanox/mlx5/core/main.c > > index 30de3bf35c6d..408ee64aa33b 100644 > > --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c > > @@ -1539,6 +1539,22 @@ static void shutdown(struct pci_dev *pdev) > > mlx5_pci_disable_device(dev); > > } > > > > +static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state) > > +{ > > + struct mlx5_core_dev *dev = pci_get_drvdata(pdev); > > + > > + mlx5_unload_one(dev, false); > > + > > + return 0; > > +} > > + > > +static int mlx5_resume(struct pci_dev *pdev) > > +{ > > + struct mlx5_core_dev *dev = pci_get_drvdata(pdev); > > + > > + return mlx5_load_one(dev, false); > > +} > > + > > static const struct pci_device_id mlx5_core_pci_table[] = { > > { PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTIB) }, > > { PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* > > Connect-IB VF */ > > @@ -1582,6 +1598,8 @@ static struct pci_driver mlx5_core_driver = { > > .id_table = mlx5_core_pci_table, > > .probe = init_one, > > .remove = remove_one, > > + .suspend = mlx5_suspend, > > + .resume = mlx5_resume, > > .shutdown = shutdown, > > .err_handler = &mlx5_err_handler, > > .sriov_configure = mlx5_core_sriov_configure, > > -- > > 2.26.2 > > Hi David, > Can you please consider this patch for v5.7 and the stable tree > v5.6.y? >
Hi Dexuan, I will re-spin and do this for you, with a proper commit message and Fixes tag this can go to net and -stable. > I understand it's already v5.7-rc7 now, but IHMO applying this patch > to v5.7 and v5.6.y can bring an immediate benefit and can not break > anything existing: currently a Linux system with the mlx5 NIC always > crashes upon hibernation. With this patch, hibernation works fine > with > the NIC in my tests. > > Some users who are trying to hiberante their VMs (which run on Hyper- > V > and Azure) have reported the crash to me for several months, so IMHO > it would be really great if the patch can land in v5.7 and v5.6.y > rather > than land in v5.8 in ~2 months and is backported to v5.6.y and > v5.7.y. > > Thanks, > -- Dexuan