netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuval Mintz <Yuval.Mintz@qlogic.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <Ariel.Elior@qlogic.com>, Yuval Mintz <Yuval.Mintz@qlogic.com>
Subject: [PATCH net-next 7/9] bnx2x: Prevent pci_disable_sriov with assigned VFs
Date: Sun, 17 Aug 2014 16:47:49 +0300	[thread overview]
Message-ID: <1408283271-16176-8-git-send-email-Yuval.Mintz@qlogic.com> (raw)
In-Reply-To: <1408283271-16176-1-git-send-email-Yuval.Mintz@qlogic.com>

Trying to disable sriov when VFs are assigned may lead to all kinds of problems.
This patch unifies the call in the driver to pci_disable_sriov() and prevents
them if some of the PF's child VFs are marked as assigned.

[Notice this is a bad scenario either way; User should not reach a point where
the OS tries to disable SRIOV when a VF is assigned - but currently there's no
way of preventing the user from doing so, and the ill-effect for the driver is
smaller this way]

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 45ae68d..c88b20a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -1352,9 +1352,7 @@ void bnx2x_iov_remove_one(struct bnx2x *bp)
 	if (!IS_SRIOV(bp))
 		return;
 
-	DP(BNX2X_MSG_IOV, "about to call disable sriov\n");
-	pci_disable_sriov(bp->pdev);
-	DP(BNX2X_MSG_IOV, "sriov disabled\n");
+	bnx2x_disable_sriov(bp);
 
 	/* disable access to all VFs */
 	for (vf_idx = 0; vf_idx < bp->vfdb->sriov.total; vf_idx++) {
@@ -2483,7 +2481,7 @@ int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs_param)
 	bp->requested_nr_virtfn = num_vfs_param;
 	if (num_vfs_param == 0) {
 		bnx2x_set_pf_tx_switching(bp, false);
-		pci_disable_sriov(dev);
+		bnx2x_disable_sriov(bp);
 		return 0;
 	} else {
 		return bnx2x_enable_sriov(bp);
@@ -2596,6 +2594,12 @@ void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp)
 
 void bnx2x_disable_sriov(struct bnx2x *bp)
 {
+	if (pci_vfs_assigned(bp->pdev)) {
+		DP(BNX2X_MSG_IOV,
+		   "Unloading driver while VFs are assigned - VFs will not be deallocated\n");
+		return;
+	}
+
 	pci_disable_sriov(bp->pdev);
 }
 
-- 
1.7.1

  parent reply	other threads:[~2014-08-17 13:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-17 13:47 [PATCH net-next 0/9] bnx2x: Start utilizing 7.10.51 Yuval Mintz
2014-08-17 13:47 ` [PATCH net-next 1/9] bnx2x: Utilize FW 7.10.51 Yuval Mintz
2014-08-17 13:47 ` [PATCH net-next 2/9] bnx2x: Add timestamping and PTP hardware clock support Yuval Mintz
2014-08-17 13:47 ` [PATCH net-next 3/9] bnx2x: Code cleanup Yuval Mintz
2014-08-17 13:47 ` [PATCH net-next 4/9] bnx2x: Update driver version to 1.710.51 Yuval Mintz
2014-08-17 13:47 ` [PATCH net-next 5/9] bnx2x: Safe bnx2x_panic_dump() Yuval Mintz
2014-08-17 13:47 ` [PATCH net-next 6/9] bnx2x: Prevent IOV if no entries in CAM Yuval Mintz
2014-08-17 13:47 ` Yuval Mintz [this message]
2014-08-17 13:47 ` [PATCH net-next 8/9] bnx2x: Make BP_VF more robust Yuval Mintz
2014-08-17 13:47 ` [PATCH net-next 9/9] bnx2x: FW assertion changes Yuval Mintz
2014-08-22 19:31 ` [PATCH net-next 0/9] bnx2x: Start utilizing 7.10.51 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=1408283271-16176-8-git-send-email-Yuval.Mintz@qlogic.com \
    --to=yuval.mintz@qlogic.com \
    --cc=Ariel.Elior@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).