Commit a3f0b381 authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: poll on NVM semaphore only if not other error

Only poll on the NVM semaphore if there's time left on a previous
reservation.  Also, add a little more info to debug messages.

Change-ID: I2439bf870b95a28b810dcb5cca1c06440463cf8a
Signed-off-by: default avatarShannon Nelson <shannon.nelson@intel.com>
Acked-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarJim Young <jamesx.m.young@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 0fdd052c
...@@ -93,10 +93,15 @@ i40e_status i40e_acquire_nvm(struct i40e_hw *hw, ...@@ -93,10 +93,15 @@ i40e_status i40e_acquire_nvm(struct i40e_hw *hw,
/* Store the timeout */ /* Store the timeout */
hw->nvm.hw_semaphore_timeout = I40E_MS_TO_GTIME(time_left) + gtime; hw->nvm.hw_semaphore_timeout = I40E_MS_TO_GTIME(time_left) + gtime;
if (ret_code) { if (ret_code)
i40e_debug(hw, I40E_DEBUG_NVM,
"NVM acquire type %d failed time_left=%llu ret=%d aq_err=%d\n",
access, time_left, ret_code, hw->aq.asq_last_status);
if (ret_code && time_left) {
/* Poll until the current NVM owner timeouts */ /* Poll until the current NVM owner timeouts */
timeout = I40E_MS_TO_GTIME(I40E_MAX_NVM_TIMEOUT) + gtime; timeout = I40E_MS_TO_GTIME(I40E_MAX_NVM_TIMEOUT) + gtime;
while (gtime < timeout) { while ((gtime < timeout) && time_left) {
usleep_range(10000, 20000); usleep_range(10000, 20000);
gtime = rd32(hw, I40E_GLVFGEN_TIMER); gtime = rd32(hw, I40E_GLVFGEN_TIMER);
ret_code = i40e_aq_request_resource(hw, ret_code = i40e_aq_request_resource(hw,
...@@ -112,8 +117,8 @@ i40e_status i40e_acquire_nvm(struct i40e_hw *hw, ...@@ -112,8 +117,8 @@ i40e_status i40e_acquire_nvm(struct i40e_hw *hw,
if (ret_code) { if (ret_code) {
hw->nvm.hw_semaphore_timeout = 0; hw->nvm.hw_semaphore_timeout = 0;
i40e_debug(hw, I40E_DEBUG_NVM, i40e_debug(hw, I40E_DEBUG_NVM,
"NVM acquire timed out, wait %llu ms before trying again.\n", "NVM acquire timed out, wait %llu ms before trying again. status=%d aq_err=%d\n",
time_left); time_left, ret_code, hw->aq.asq_last_status);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment