Fixes for SRIOV in mlx5core.

- call pci_iov_detach() on detaching from PCI device to take care of hang
  on destroying VFs after PF is down.

- disable eswitch SRIOV support right after pci_iov_detach(),
  else the eswitch cleanup sometimes occur while the SRIOV flow table
  is still present.

Submitted by: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2021-01-08 12:06:11 +01:00
parent 98140747ca
commit 480570dbb3

View File

@ -1664,6 +1664,11 @@ static void remove_one(struct pci_dev *pdev)
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
struct mlx5_priv *priv = &dev->priv;
#ifdef PCI_IOV
pci_iov_detach(pdev->dev.bsddev);
mlx5_eswitch_disable_sriov(priv->eswitch);
#endif
if (mlx5_unload_one(dev, priv, true)) {
mlx5_core_err(dev, "mlx5_unload_one() failed, leaked %lld bytes\n",
(long long)(dev->priv.fw_pages * MLX5_ADAPTER_PAGE_SIZE));