aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@intel.com>2014-11-13 03:23:19 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-12-09 15:57:03 -0500
commitc509c1decbba1ac1f94fd683a879bc19cffb4b24 (patch)
tree25e995067e63b9b784b491671b35957e096d2f93 /drivers/net/ethernet/intel
parent2a6d8c2f016c164e8c5174c1099c3a56f9336e91 (diff)
i40e: set max limit for access polling
Don't bother trying to set a smaller timeout on the polling, just simplify the code and always use the max limit. Also, rename a variable for clarity and fix a comment. Change-ID: I0300c3562ccc4fd5fa3088f8ae52db0c1eb33af5 Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Acked-by: Michal Kosiarz <michal.kosiarz@intel.com> Tested-by: Jim Young <jamesx.m.young@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_nvm.c21
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_type.h2
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_type.h2
3 files changed, 10 insertions, 15 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 37f0f5f950d8..f55e52b2a003 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -80,45 +80,40 @@ i40e_status i40e_acquire_nvm(struct i40e_hw *hw,
80{ 80{
81 i40e_status ret_code = 0; 81 i40e_status ret_code = 0;
82 u64 gtime, timeout; 82 u64 gtime, timeout;
83 u64 time = 0; 83 u64 time_left = 0;
84 84
85 if (hw->nvm.blank_nvm_mode) 85 if (hw->nvm.blank_nvm_mode)
86 goto i40e_i40e_acquire_nvm_exit; 86 goto i40e_i40e_acquire_nvm_exit;
87 87
88 ret_code = i40e_aq_request_resource(hw, I40E_NVM_RESOURCE_ID, access, 88 ret_code = i40e_aq_request_resource(hw, I40E_NVM_RESOURCE_ID, access,
89 0, &time, NULL); 89 0, &time_left, NULL);
90 /* Reading the Global Device Timer */ 90 /* Reading the Global Device Timer */
91 gtime = rd32(hw, I40E_GLVFGEN_TIMER); 91 gtime = rd32(hw, I40E_GLVFGEN_TIMER);
92 92
93 /* Store the timeout */ 93 /* Store the timeout */
94 hw->nvm.hw_semaphore_timeout = I40E_MS_TO_GTIME(time) + gtime; 94 hw->nvm.hw_semaphore_timeout = I40E_MS_TO_GTIME(time_left) + gtime;
95 95
96 if (ret_code) { 96 if (ret_code) {
97 /* Set the polling timeout */
98 if (time > I40E_MAX_NVM_TIMEOUT)
99 timeout = I40E_MS_TO_GTIME(I40E_MAX_NVM_TIMEOUT)
100 + gtime;
101 else
102 timeout = hw->nvm.hw_semaphore_timeout;
103 /* Poll until the current NVM owner timeouts */ 97 /* Poll until the current NVM owner timeouts */
98 timeout = I40E_MS_TO_GTIME(I40E_MAX_NVM_TIMEOUT) + gtime;
104 while (gtime < timeout) { 99 while (gtime < timeout) {
105 usleep_range(10000, 20000); 100 usleep_range(10000, 20000);
101 gtime = rd32(hw, I40E_GLVFGEN_TIMER);
106 ret_code = i40e_aq_request_resource(hw, 102 ret_code = i40e_aq_request_resource(hw,
107 I40E_NVM_RESOURCE_ID, 103 I40E_NVM_RESOURCE_ID,
108 access, 0, &time, 104 access, 0, &time_left,
109 NULL); 105 NULL);
110 if (!ret_code) { 106 if (!ret_code) {
111 hw->nvm.hw_semaphore_timeout = 107 hw->nvm.hw_semaphore_timeout =
112 I40E_MS_TO_GTIME(time) + gtime; 108 I40E_MS_TO_GTIME(time_left) + gtime;
113 break; 109 break;
114 } 110 }
115 gtime = rd32(hw, I40E_GLVFGEN_TIMER);
116 } 111 }
117 if (ret_code) { 112 if (ret_code) {
118 hw->nvm.hw_semaphore_timeout = 0; 113 hw->nvm.hw_semaphore_timeout = 0;
119 i40e_debug(hw, I40E_DEBUG_NVM, 114 i40e_debug(hw, I40E_DEBUG_NVM,
120 "NVM acquire timed out, wait %llu ms before trying again.\n", 115 "NVM acquire timed out, wait %llu ms before trying again.\n",
121 time); 116 time_left);
122 } 117 }
123 } 118 }
124 119
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 306a23a489b1..844421fba958 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -261,7 +261,7 @@ enum i40e_aq_resource_access_type {
261}; 261};
262 262
263struct i40e_nvm_info { 263struct i40e_nvm_info {
264 u64 hw_semaphore_timeout; /* 2usec global time (GTIME resolution) */ 264 u64 hw_semaphore_timeout; /* usec global time (GTIME resolution) */
265 u32 timeout; /* [ms] */ 265 u32 timeout; /* [ms] */
266 u16 sr_size; /* Shadow RAM size in words */ 266 u16 sr_size; /* Shadow RAM size in words */
267 bool blank_nvm_mode; /* is NVM empty (no FW present)*/ 267 bool blank_nvm_mode; /* is NVM empty (no FW present)*/
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index 9d472d6b28bd..d8175cddd683 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -260,7 +260,7 @@ enum i40e_aq_resource_access_type {
260}; 260};
261 261
262struct i40e_nvm_info { 262struct i40e_nvm_info {
263 u64 hw_semaphore_timeout; /* 2usec global time (GTIME resolution) */ 263 u64 hw_semaphore_timeout; /* usec global time (GTIME resolution) */
264 u32 timeout; /* [ms] */ 264 u32 timeout; /* [ms] */
265 u16 sr_size; /* Shadow RAM size in words */ 265 u16 sr_size; /* Shadow RAM size in words */
266 bool blank_nvm_mode; /* is NVM empty (no FW present)*/ 266 bool blank_nvm_mode; /* is NVM empty (no FW present)*/