All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Mitch 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 v2 08/16] i40e: don't panic on VSI allocation failure
Date: Tue, 13 Oct 2015 23:59:48 -0700	[thread overview]
Message-ID: <1444805996-3877-9-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1444805996-3877-1-git-send-email-jeffrey.t.kirsher@intel.com>

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

In some circumstances, the firmware may fail to allocate a VSI for a VF.
When this happens, the driver does not react well to the bad news and
has a panic attack.

To fix this problem, check the return value from i40e_alloc_vf_res and
don't try to configure the device further if it failed. Additionally,
explicitly clear the INIT bit when we free VF resources, so that this
bit will be in the proper state in the failure case, and won't blow up
elsewhere.

Change-ID: I6a20ce2b59c3458fd832032e88fa28cd42500189
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@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, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 2102280..ae7548a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -703,6 +703,7 @@ static void i40e_free_vf_res(struct i40e_vf *vf)
 	 */
 	vf->num_queue_pairs = 0;
 	vf->vf_states = 0;
+	clear_bit(I40E_VF_STAT_INIT, &vf->vf_states);
 }
 
 /**
@@ -841,11 +842,11 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr)
 complete_reset:
 	/* reallocate VF resources to reset the VSI state */
 	i40e_free_vf_res(vf);
-	i40e_alloc_vf_res(vf);
-	i40e_enable_vf_mappings(vf);
-	set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
-	clear_bit(I40E_VF_STAT_DISABLED, &vf->vf_states);
-
+	if (!i40e_alloc_vf_res(vf)) {
+		i40e_enable_vf_mappings(vf);
+		set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
+		clear_bit(I40E_VF_STAT_DISABLED, &vf->vf_states);
+	}
 	/* tell the VF the reset is done */
 	wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE);
 	i40e_flush(hw);
-- 
2.4.3

  parent reply	other threads:[~2015-10-14  7:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14  6:59 [net-next v2 00/16][pull request] Intel Wired LAN Driver Updates 2015-10-13 Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 01/16] i40e/i40evf: Add new link status defines Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 02/16] i40e: Make it clear a parameter is never used Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 03/16] i40e: Use BIT() macro for priority map parsing Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 04/16] i40evf: properly handle ndo_set_mac_address calls Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 05/16] i40e/i40evf: Add info to nvm info struct for OEM version data Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 06/16] i40e: Convert CEE App TLV selector to IEEE selector Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 07/16] i40e: remove redundant call Jeff Kirsher
2015-10-14  6:59 ` Jeff Kirsher [this message]
2015-10-14  6:59 ` [net-next v2 09/16] i40e: update fw version text string per previous product formats Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 10/16] i40e/i40evf: split device ids into a separate file Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 11/16] i40e/i40evf: Add module_types and update_link_info Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 12/16] i40e/i40evf: Refactor PHY structure and add phy_capabilities enum Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 13/16] i40e/i40evf: Bump i40e version to 1.3.25 and i40evf to 1.3.17 Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 14/16] ixgbe: add flow control ethertype to the anti-spoofing filter Jeff Kirsher
2015-10-14  6:59 ` [net-next v2 15/16] fm10k: use snprintf() instead of sprintf() to avoid buffer overflow Jeff Kirsher
2015-10-14  8:09   ` [PATCH] ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings Joe Perches
2015-10-14 20:36     ` Ben Hutchings
2015-10-15  2:01     ` David Miller
2015-10-14  6:59 ` [net-next v2 16/16] fm10k: do not use enum as boolean Jeff Kirsher
2015-10-14 12:54 ` [net-next v2 00/16][pull request] Intel Wired LAN Driver Updates 2015-10-13 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=1444805996-3877-9-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 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.