diff options
author | Amir Vadai <amirv@mellanox.com> | 2014-04-14 04:17:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-14 13:24:42 -0400 |
commit | e1a5ddc5069a0c7589a139e0422200672d965581 (patch) | |
tree | eb7e2d071aa67347acd0b5891c241c9ec9213aeb | |
parent | 77d149c4eb8964b6bd4a929b102a867505add612 (diff) |
net/mlx4_core: Defer VF initialization till PF is fully initialized
Fix in commit [1] is not sufficient since a deferred VF initialization
could happen after pci_enable_sriov() is finished, but before the PF is
fully initialized.
Need to prevent VFs from initializing till the PF is fully ready and
comm channel is operational.
[1] - 9798935 "net/mlx4_core: mlx4_init_slave() shouldn't access comm
channel before PF is ready"
CC: Stuart Hayes <Stuart_Hayes@Dell.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 4b86c7af2a7a..cef267e24f9c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2369,10 +2369,10 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data) | |||
2369 | } else { | 2369 | } else { |
2370 | atomic_inc(&pf_loading); | 2370 | atomic_inc(&pf_loading); |
2371 | err = pci_enable_sriov(pdev, total_vfs); | 2371 | err = pci_enable_sriov(pdev, total_vfs); |
2372 | atomic_dec(&pf_loading); | ||
2373 | if (err) { | 2372 | if (err) { |
2374 | mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n", | 2373 | mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n", |
2375 | err); | 2374 | err); |
2375 | atomic_dec(&pf_loading); | ||
2376 | err = 0; | 2376 | err = 0; |
2377 | } else { | 2377 | } else { |
2378 | mlx4_warn(dev, "Running in master mode\n"); | 2378 | mlx4_warn(dev, "Running in master mode\n"); |
@@ -2532,6 +2532,9 @@ slave_start: | |||
2532 | 2532 | ||
2533 | priv->removed = 0; | 2533 | priv->removed = 0; |
2534 | 2534 | ||
2535 | if (mlx4_is_master(dev) && dev->num_vfs) | ||
2536 | atomic_dec(&pf_loading); | ||
2537 | |||
2535 | return 0; | 2538 | return 0; |
2536 | 2539 | ||
2537 | err_port: | 2540 | err_port: |
@@ -2582,6 +2585,9 @@ err_rel_own: | |||
2582 | if (!mlx4_is_slave(dev)) | 2585 | if (!mlx4_is_slave(dev)) |
2583 | mlx4_free_ownership(dev); | 2586 | mlx4_free_ownership(dev); |
2584 | 2587 | ||
2588 | if (mlx4_is_master(dev) && dev->num_vfs) | ||
2589 | atomic_dec(&pf_loading); | ||
2590 | |||
2585 | kfree(priv->dev.dev_vfs); | 2591 | kfree(priv->dev.dev_vfs); |
2586 | 2592 | ||
2587 | err_free_dev: | 2593 | err_free_dev: |
@@ -2675,6 +2681,7 @@ static void __mlx4_remove_one(struct pci_dev *pdev) | |||
2675 | if (dev->flags & MLX4_FLAG_SRIOV) { | 2681 | if (dev->flags & MLX4_FLAG_SRIOV) { |
2676 | mlx4_warn(dev, "Disabling SR-IOV\n"); | 2682 | mlx4_warn(dev, "Disabling SR-IOV\n"); |
2677 | pci_disable_sriov(pdev); | 2683 | pci_disable_sriov(pdev); |
2684 | dev->num_vfs = 0; | ||
2678 | } | 2685 | } |
2679 | 2686 | ||
2680 | if (!mlx4_is_slave(dev)) | 2687 | if (!mlx4_is_slave(dev)) |