diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2012-05-15 06:35:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-16 00:56:58 -0400 |
commit | 681372a7a37d4226261e2be2faf3aec5b9e022c2 (patch) | |
tree | a0e407d16a38fd655e5a76c47e63eb0153ca9bfb | |
parent | b9985f410a3b3922a44692566671d7b164b55e71 (diff) |
net/mlx4_core: Do not reset module-parameter num_vfs when fail to enable sriov
Consider the following scenario: 2 HCAs, where only one of which can run SRIOV.
If we reset the module parameter, all the VFs of the SRIOV HCA will be
claimed by the PPF host (-- the code relies on num_vfs being non-zero
to avoid this claiming, and num_vfs was reset when pci_enable_sriov failed
for the non-SRIOV HCA).
The solution is not to touch the num_vfs parameter.
Also, eliminate the unneeded check of num_vfs when disabling sriov
(the dev flag bit is sufficient).
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 8bb05b46db86..8eed1f269323 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1865,7 +1865,6 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1865 | mlx4_err(dev, "Failed to enable sriov," | 1865 | mlx4_err(dev, "Failed to enable sriov," |
1866 | "continuing without sriov enabled" | 1866 | "continuing without sriov enabled" |
1867 | " (err = %d).\n", err); | 1867 | " (err = %d).\n", err); |
1868 | num_vfs = 0; | ||
1869 | err = 0; | 1868 | err = 0; |
1870 | } else { | 1869 | } else { |
1871 | mlx4_warn(dev, "Running in master mode\n"); | 1870 | mlx4_warn(dev, "Running in master mode\n"); |
@@ -2022,7 +2021,7 @@ err_cmd: | |||
2022 | mlx4_cmd_cleanup(dev); | 2021 | mlx4_cmd_cleanup(dev); |
2023 | 2022 | ||
2024 | err_sriov: | 2023 | err_sriov: |
2025 | if (num_vfs && (dev->flags & MLX4_FLAG_SRIOV)) | 2024 | if (dev->flags & MLX4_FLAG_SRIOV) |
2026 | pci_disable_sriov(pdev); | 2025 | pci_disable_sriov(pdev); |
2027 | 2026 | ||
2028 | err_rel_own: | 2027 | err_rel_own: |
@@ -2099,7 +2098,7 @@ static void mlx4_remove_one(struct pci_dev *pdev) | |||
2099 | 2098 | ||
2100 | if (dev->flags & MLX4_FLAG_MSI_X) | 2099 | if (dev->flags & MLX4_FLAG_MSI_X) |
2101 | pci_disable_msix(pdev); | 2100 | pci_disable_msix(pdev); |
2102 | if (num_vfs && (dev->flags & MLX4_FLAG_SRIOV)) { | 2101 | if (dev->flags & MLX4_FLAG_SRIOV) { |
2103 | mlx4_warn(dev, "Disabling sriov\n"); | 2102 | mlx4_warn(dev, "Disabling sriov\n"); |
2104 | pci_disable_sriov(pdev); | 2103 | pci_disable_sriov(pdev); |
2105 | } | 2104 | } |