netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Mitch A Williams <mitch.a.williams@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 01/15] i40e: disable IOV before freeing resources
Date: Tue, 13 Jan 2015 03:33:17 -0800	[thread overview]
Message-ID: <1421148811-9763-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1421148811-9763-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Mitch A Williams <mitch.a.williams@intel.com>

If VF drivers are loaded in the host OS, the call to pci_disable_sriov()
will cause these drivers' remove routines to be called. If the PF driver
has already freed VF resources before this happens, then the VF remove
routine can't properly communicate with the PF driver causing all sorts
of mayhem and error messages and hurt feelings.

To fix this, we move the call to pci_disable_sriov() up to the top of
the function and let it complete before freeing any VF resources.

Change-ID: I397c3997a00f6408e32b7735273911e499600236
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Acked-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <james.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 5bae895..044019b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -791,10 +791,18 @@ void i40e_free_vfs(struct i40e_pf *pf)
 	if (!pf->vf)
 		return;
 
+	/* Disable IOV before freeing resources. This lets any VF drivers
+	 * running in the host get themselves cleaned up before we yank
+	 * the carpet out from underneath their feet.
+	 */
+	if (!pci_vfs_assigned(pf->pdev))
+		pci_disable_sriov(pf->pdev);
+
+	msleep(20); /* let any messages in transit get finished up */
+
 	/* Disable interrupt 0 so we don't try to handle the VFLR. */
 	i40e_irq_dynamic_disable_icr0(pf);
 
-	mdelay(10); /* let any messages in transit get finished up */
 	/* free up vf resources */
 	tmp = pf->num_alloc_vfs;
 	pf->num_alloc_vfs = 0;
@@ -813,7 +821,6 @@ void i40e_free_vfs(struct i40e_pf *pf)
 	 * before this function ever gets called.
 	 */
 	if (!pci_vfs_assigned(pf->pdev)) {
-		pci_disable_sriov(pf->pdev);
 		/* Acknowledge VFLR for all VFS. Without this, VFs will fail to
 		 * work correctly when SR-IOV gets re-enabled.
 		 */
-- 
1.9.3

  reply	other threads:[~2015-01-13 11:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 11:33 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-01-13 Jeff Kirsher
2015-01-13 11:33 ` Jeff Kirsher [this message]
2015-01-13 11:33 ` [net-next 02/15] i40evf: remove redundant code Jeff Kirsher
2015-01-13 11:33 ` [net-next 03/15] i40evf: Remove some scary log messages Jeff Kirsher
2015-01-13 14:22   ` Sergei Shtylyov
2015-01-13 11:33 ` [net-next 04/15] i40evf: refactor shutdown code Jeff Kirsher
2015-01-13 11:33 ` [net-next 05/15] i40evf: remove leftover VLAN filters Jeff Kirsher
2015-01-13 11:33 ` [net-next 06/15] i40evf: don't fire traffic IRQs when the interface is down Jeff Kirsher
2015-01-13 11:33 ` [net-next 07/15] i40evf: enable interrupt 0 appropriately Jeff Kirsher
2015-01-13 11:33 ` [net-next 08/15] i40evf: kick a stalled admin queue Jeff Kirsher
2015-01-13 11:33 ` [net-next 09/15] i40e: Add warning for NPAR partitions with link speed less than 10Gbps Jeff Kirsher
2015-01-13 11:33 ` [net-next 10/15] i40e: remove VN2VN related mac filters Jeff Kirsher
2015-01-13 11:33 ` [net-next 11/15] i40e/i40evf: find partition_id in npar mode Jeff Kirsher
2015-01-13 11:33 ` [net-next 12/15] i40e: Adding function for reading PBA String Jeff Kirsher
2015-01-13 11:33 ` [net-next 13/15] i40e: limit WoL and link settings to partition 1 Jeff Kirsher
2015-01-13 11:33 ` [net-next 14/15] i40e: Don't exit link event early if link speed has changed Jeff Kirsher
2015-01-13 11:33 ` [net-next 15/15] i40e: limit sriov to partition 1 of NPAR configurations Jeff Kirsher
2015-01-13 18:57 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-01-13 David Miller
2015-01-13 19:01   ` Jeff Kirsher

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=1421148811-9763-2-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=jogreene@redhat.com \
    --cc=mitch.a.williams@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.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 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).