aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2017-10-27 11:06:55 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2017-11-22 02:25:17 -0500
commit3d72aebfc61b025a2478c9d2bbc3c8c4036a1c05 (patch)
tree488dcd5abb85384f2397dac9e4cd0cb9cd164ab3
parent0c86a6bd85ff0629cd2c5141027fc1c8bb6cde9c (diff)
i40e: Fix for NUP NVM image downgrade failure
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>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_adminq.c6
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_common.c3
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_nvm.c8
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_type.h1
4 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
index 9dcb2a961197..9af74253c3f7 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
@@ -613,6 +613,12 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw)
613 hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE; 613 hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
614 } 614 }
615 615
616 /* Newer versions of firmware require lock when reading the NVM */
617 if (hw->aq.api_maj_ver > 1 ||
618 (hw->aq.api_maj_ver == 1 &&
619 hw->aq.api_min_ver >= 5))
620 hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
621
616 /* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */ 622 /* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
617 if (hw->aq.api_maj_ver > 1 || 623 if (hw->aq.api_maj_ver > 1 ||
618 (hw->aq.api_maj_ver == 1 && 624 (hw->aq.api_maj_ver == 1 &&
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index 0203665cb53c..13c79468a6da 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -948,7 +948,8 @@ i40e_status i40e_init_shared_code(struct i40e_hw *hw)
948 hw->pf_id = (u8)(func_rid & 0x7); 948 hw->pf_id = (u8)(func_rid & 0x7);
949 949
950 if (hw->mac.type == I40E_MAC_X722) 950 if (hw->mac.type == I40E_MAC_X722)
951 hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE; 951 hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE |
952 I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK;
952 953
953 status = i40e_init_nvm(hw); 954 status = i40e_init_nvm(hw);
954 return status; 955 return status;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 0ccab0a5d717..7689c2ee0d46 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -328,15 +328,17 @@ static i40e_status __i40e_read_nvm_word(struct i40e_hw *hw,
328i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset, 328i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
329 u16 *data) 329 u16 *data)
330{ 330{
331 i40e_status ret_code; 331 i40e_status ret_code = 0;
332 332
333 ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); 333 if (hw->flags & I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK)
334 ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
334 if (ret_code) 335 if (ret_code)
335 return ret_code; 336 return ret_code;
336 337
337 ret_code = __i40e_read_nvm_word(hw, offset, data); 338 ret_code = __i40e_read_nvm_word(hw, offset, data);
338 339
339 i40e_release_nvm(hw); 340 if (hw->flags & I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK)
341 i40e_release_nvm(hw);
340 342
341 return ret_code; 343 return ret_code;
342} 344}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 00d4833e9925..0e8568719b4e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -629,6 +629,7 @@ struct i40e_hw {
629#define I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE BIT_ULL(0) 629#define I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE BIT_ULL(0)
630#define I40E_HW_FLAG_802_1AD_CAPABLE BIT_ULL(1) 630#define I40E_HW_FLAG_802_1AD_CAPABLE BIT_ULL(1)
631#define I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE BIT_ULL(2) 631#define I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE BIT_ULL(2)
632#define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
632 u64 flags; 633 u64 flags;
633 634
634 /* Used in set switch config AQ command */ 635 /* Used in set switch config AQ command */