From: Xiaolong Ye Date: Mon, 13 Jan 2020 02:39:37 +0000 (+0800) Subject: net/i40e/base: fix retrying logic X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=50126939c66692d5b74922e12a9bf0dacfb6618b;p=dpdk.git net/i40e/base: fix retrying logic Fixed a bug where driver was breaking out of the loop and reporting an error without retrying first. Fixes: 466eec7d6b1a ("net/i40e/base: retry AQC to overcome IRCRead hangs") Signed-off-by: Marcin Formela Signed-off-by: Xiaolong Ye Acked-by: Qi Zhang Acked-by: Beilei Xing --- diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 4f87ec9fad..a37e70599d 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -1714,19 +1714,22 @@ enum i40e_status_code i40e_aq_get_phy_capabilities(struct i40e_hw *hw, status = i40e_asq_send_command(hw, &desc, abilities, abilities_size, cmd_details); - if (status != I40E_SUCCESS) - break; - - if (hw->aq.asq_last_status == I40E_AQ_RC_EIO) { + switch (hw->aq.asq_last_status) { + case I40E_AQ_RC_EIO: status = I40E_ERR_UNKNOWN_PHY; break; - } else if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) { + case I40E_AQ_RC_EAGAIN: i40e_msec_delay(1); total_delay++; status = I40E_ERR_TIMEOUT; + break; + /* also covers I40E_AQ_RC_OK */ + default: + break; } - } while ((hw->aq.asq_last_status != I40E_AQ_RC_OK) && - (total_delay < max_delay)); + + } while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) && + (total_delay < max_delay)); if (status != I40E_SUCCESS) return status;