i40e: Acquire NVM lock before reads on all devices
authorAaron Salter <aaron.k.salter@intel.com>
Fri, 2 Dec 2016 20:33:02 +0000 (12:33 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 15 Mar 2017 00:52:32 +0000 (17:52 -0700)
Acquire NVM lock before reads on all devices.  Previously, locks were
only used for X722 and later.  Fixes an issue where simultaneous X710
NVM accesses were interfering with each other.

Change-ID: If570bb7acf958cef58725ec2a2011cead6f80638
Signed-off-by: Aaron Salter <aaron.k.salter@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_nvm.c

index 38ee18f1112444df1ad753f845d1dd1b1fd6ddcc..800bd55d0159c083c3d2267c5eda0289b1d6435c 100644 (file)
@@ -292,14 +292,14 @@ i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 {
        enum i40e_status_code ret_code = 0;
 
-       if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) {
-               ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
-               if (!ret_code) {
+       ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
+       if (!ret_code) {
+               if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) {
                        ret_code = i40e_read_nvm_word_aq(hw, offset, data);
-                       i40e_release_nvm(hw);
+               } else {
+                       ret_code = i40e_read_nvm_word_srctl(hw, offset, data);
                }
-       } else {
-               ret_code = i40e_read_nvm_word_srctl(hw, offset, data);
+               i40e_release_nvm(hw);
        }
        return ret_code;
 }