All of lore.kernel.org
 help / color / mirror / Atom feed
From: Or Gerlitz <ogerlitz@mellanox.com>
To: unlisted-recipients:; (no To-header on input)
Cc: roland@kernel.org, netdev@vger.kernel.org, yevgenyp@mellanox.com,
	Jack Morgenstein <jackm@dev.mellanox.co.il>,
	Or Gerlitz <ogerlitz@mellanox.com>
Subject: [PATCH net-next V2 5/8] net/mlx4_core: Do not reset module-parameter num_vfs when fail to enable sriov
Date: Tue, 15 May 2012 23:35:01 +0300	[thread overview]
Message-ID: <1337114104-26094-6-git-send-email-ogerlitz@mellanox.com> (raw)
In-Reply-To: <1337114104-26094-1-git-send-email-ogerlitz@mellanox.com>

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

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>
---
 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 8bb05b4..8eed1f2 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)
 				mlx4_err(dev, "Failed to enable sriov,"
 					 "continuing without sriov enabled"
 					 " (err = %d).\n", err);
-				num_vfs = 0;
 				err = 0;
 			} else {
 				mlx4_warn(dev, "Running in master mode\n");
@@ -2022,7 +2021,7 @@ err_cmd:
 	mlx4_cmd_cleanup(dev);
 
 err_sriov:
-	if (num_vfs && (dev->flags & MLX4_FLAG_SRIOV))
+	if (dev->flags & MLX4_FLAG_SRIOV)
 		pci_disable_sriov(pdev);
 
 err_rel_own:
@@ -2099,7 +2098,7 @@ static void mlx4_remove_one(struct pci_dev *pdev)
 
 		if (dev->flags & MLX4_FLAG_MSI_X)
 			pci_disable_msix(pdev);
-		if (num_vfs && (dev->flags & MLX4_FLAG_SRIOV)) {
+		if (dev->flags & MLX4_FLAG_SRIOV) {
 			mlx4_warn(dev, "Disabling sriov\n");
 			pci_disable_sriov(pdev);
 		}
-- 
1.7.1

  parent reply	other threads:[~2012-05-15 20:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 20:34 [PATCH net-next V2 0/8] batch of mlx4 driver fixes Or Gerlitz
2012-05-15 20:34 ` [PATCH net-next V2 1/8] net/mlx4: Address build warnings on set but not used variables Or Gerlitz
2012-05-15 20:34 ` [PATCH net-next V2 2/8] net/mlx4_core: Fix init_port mask state for slaves Or Gerlitz
2012-05-15 20:34 ` [PATCH net-next V2 3/8] net/mlx4_core: Change SYNC_TPT to be native (not wrapped) Or Gerlitz
2012-05-15 20:35 ` [PATCH net-next V2 4/8] net/mlx4_core: Remove unused *_str functions from the resource tracker Or Gerlitz
2012-05-15 20:35 ` Or Gerlitz [this message]
2012-05-15 20:35 ` [PATCH net-next V2 6/8] net/mlx4_core: Fix potential kernel Oops in res tracker during Dom0 driver unload Or Gerlitz
2012-05-15 20:35 ` [PATCH net-next V2 7/8] net/mlx4_core: Add XRC domains and counters to resource tracker Or Gerlitz
2012-05-15 20:35 ` [PATCH net-next V2 8/8] net/mlx4_core: Fixed error flow in rem_slave_eqs Or Gerlitz
2012-05-16  4:57 ` [PATCH net-next V2 0/8] batch of mlx4 driver fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337114104-26094-6-git-send-email-ogerlitz@mellanox.com \
    --to=ogerlitz@mellanox.com \
    --cc=jackm@dev.mellanox.co.il \
    --cc=netdev@vger.kernel.org \
    --cc=roland@kernel.org \
    --cc=yevgenyp@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.