All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net/mlx4_core: Defer VF initialization till PF is fully initialized
@ 2014-04-13 15:17 Amir Vadai
  2014-04-14  3:16 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Amir Vadai @ 2014-04-13 15:17 UTC (permalink / raw
  To: David S. Miller
  Cc: netdev, Yevgeny Petrilin, Or Gerlitz, Amir Vadai, Stuart Hayes

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>
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index f0ae95f..da62866 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2374,10 +2374,10 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data)
 			} else {
 				atomic_inc(&pf_loading);
 				err = pci_enable_sriov(pdev, total_vfs);
-				atomic_dec(&pf_loading);
 				if (err) {
 					mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n",
 						 err);
+					atomic_dec(&pf_loading);
 					err = 0;
 				} else {
 					mlx4_warn(dev, "Running in master mode\n");
@@ -2538,6 +2538,9 @@ slave_start:
 	priv->pci_dev_data = pci_dev_data;
 	pci_set_drvdata(pdev, dev);
 
+	if (mlx4_is_master(dev) && dev->num_vfs)
+		atomic_dec(&pf_loading);
+
 	return 0;
 
 err_port:
@@ -2588,6 +2591,9 @@ err_rel_own:
 	if (!mlx4_is_slave(dev))
 		mlx4_free_ownership(dev);
 
+	if (mlx4_is_master(dev) && dev->num_vfs)
+		atomic_dec(&pf_loading);
+
 	kfree(priv->dev.dev_vfs);
 
 err_free_dev:
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net/mlx4_core: Defer VF initialization till PF is fully initialized
  2014-04-13 15:17 [PATCH net] net/mlx4_core: Defer VF initialization till PF is fully initialized Amir Vadai
@ 2014-04-14  3:16 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-04-14  3:16 UTC (permalink / raw
  To: amirv; +Cc: netdev, yevgenyp, ogerlitz, Stuart_Hayes

From: Amir Vadai <amirv@mellanox.com>
Date: Sun, 13 Apr 2014 18:17:35 +0300

> 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>

This patch does not apply to the current 'net' tree, please resubmit.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-14  3:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-13 15:17 [PATCH net] net/mlx4_core: Defer VF initialization till PF is fully initialized Amir Vadai
2014-04-14  3:16 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.