]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
i40e: don't panic on VSI allocation failure
authorMitch Williams <mitch.a.williams@intel.com>
Mon, 31 Aug 2015 23:54:48 +0000 (19:54 -0400)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 10 Mar 2016 16:32:35 +0000 (08:32 -0800)
Orabug: 22342532

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>
(cherry picked from commit 21be99ec4ed366e24d4735d230aa3086ff2bc6ed)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

index 21022801a7899efaf562c7ae9b9a93519f5a7a7c..ae7548a5286eae6095d76f222d73c71c11c8f29b 100644 (file)
@@ -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);