]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
i40e: Fix for NUP NVM image downgrade failure
authorJacob Keller <jacob.e.keller@intel.com>
Fri, 27 Oct 2017 15:06:55 +0000 (11:06 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 22 Nov 2017 07:25:17 +0000 (23:25 -0800)
Since commit 96a39aed25e6 ("i40e: Acquire NVM lock before
reads on all devices") we've used the NVM lock
to synchronize NVM reads even on devices which don't strictly
need the lock.

Doing so can cause a regression on older firmware prior to 1.5,
especially when downgrading the firmware.

Fix this by only grabbing the lock if we're running on an X722
device (which requires the lock as it uses the AdminQ to read
the NVM), or if we're currently running 1.5 or newer firmware.

Signed-off-by: Jacob Keller <jacob.e.keller@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_adminq.c
drivers/net/ethernet/intel/i40e/i40e_common.c
drivers/net/ethernet/intel/i40e/i40e_nvm.c
drivers/net/ethernet/intel/i40e/i40e_type.h

index 9dcb2a961197b1f5c8919959d9661c432f03ad13..9af74253c3f7203bb00caac106e99b798f7b658b 100644 (file)
@@ -613,6 +613,12 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw)
                hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
        }
 
+       /* Newer versions of firmware require lock when reading the NVM */
+       if (hw->aq.api_maj_ver > 1 ||
+           (hw->aq.api_maj_ver == 1 &&
+            hw->aq.api_min_ver >= 5))
+               hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
+
        /* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
        if (hw->aq.api_maj_ver > 1 ||
            (hw->aq.api_maj_ver == 1 &&
index 0203665cb53c105329fbe56d86b6ea16273b26e3..13c79468a6daf1cd5ccfd81fbb6323471c8faae4 100644 (file)
@@ -948,7 +948,8 @@ i40e_status i40e_init_shared_code(struct i40e_hw *hw)
                hw->pf_id = (u8)(func_rid & 0x7);
 
        if (hw->mac.type == I40E_MAC_X722)
-               hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE;
+               hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
+                            I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
 
        status = i40e_init_nvm(hw);
        return status;
index 0ccab0a5d717564d5773fb303d7c7f04ddcc0809..7689c2ee0d463650a4c4757c1210751767cad1aa 100644 (file)
@@ -328,15 +328,17 @@ static i40e_status __i40e_read_nvm_word(struct i40e_hw *hw,
 i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
                               u16 *data)
 {
-       i40e_status ret_code;
+       i40e_status ret_code = 0;
 
-       ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
+       if (hw->flags & I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK)
+               ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
        if (ret_code)
                return ret_code;
 
        ret_code = __i40e_read_nvm_word(hw, offset, data);
 
-       i40e_release_nvm(hw);
+       if (hw->flags & I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK)
+               i40e_release_nvm(hw);
 
        return ret_code;
 }
index 00d4833e992515b026c87c6dcf9dad91b1f84a46..0e8568719b4e65f924ead244da35b7e4a6a07b1e 100644 (file)
@@ -629,6 +629,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE BIT_ULL(0)
 #define I40E_HW_FLAG_802_1AD_CAPABLE        BIT_ULL(1)
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE  BIT_ULL(2)
+#define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
        u64 flags;
 
        /* Used in set switch config AQ command */