[3/9] net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in progress
Checks
Commit Message
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
FW returns HWRM_ERR_CODE_HOT_RESET_PROGRESS(0xa) when it is
unable to process a specific cmd while hot reset is in progress.
Host driver is expected to keep retrying the cmd for 2s with
a gap of 50ms between each retrial.
Also, fixed to fail port start if the HWRM_FUNC_DRV_IF_CHANGE
still returns error after 2 seconds.
Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 5 +++++
drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++++++++--------
drivers/net/bnxt/bnxt_hwrm.c | 4 ++++
3 files changed, 26 insertions(+), 8 deletions(-)
@@ -480,6 +480,11 @@ struct bnxt_error_recovery_info {
uint32_t last_reset_counter;
};
+/* Frequency for the FUNC_DRV_IF_CHANGE retry in milliseconds */
+#define BNXT_IF_CHANGE_RETRY_INTERVAL 50
+/* Maximum retry count for FUNC_DRV_IF_CHANGE */
+#define BNXT_IF_CHANGE_RETRY_COUNT 40
+
struct bnxt_mark_info {
uint32_t mark_id;
bool valid;
@@ -1051,7 +1051,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
struct bnxt *bp = eth_dev->data->dev_private;
uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
int vlan_mask = 0;
- int rc;
+ int rc, retry_cnt = BNXT_IF_CHANGE_RETRY_COUNT;
if (!eth_dev->data->nb_tx_queues || !eth_dev->data->nb_rx_queues) {
PMD_DRV_LOG(ERR, "Queues are not configured yet!\n");
@@ -1064,14 +1064,23 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
}
- rc = bnxt_hwrm_if_change(bp, 1);
- if (!rc) {
- if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
- rc = bnxt_handle_if_change_status(bp);
- if (rc)
- return rc;
- }
+ do {
+ rc = bnxt_hwrm_if_change(bp, 1);
+ if (rc == 0 || rc != -EAGAIN)
+ break;
+
+ rte_delay_ms(BNXT_IF_CHANGE_RETRY_INTERVAL);
+ } while (retry_cnt--);
+
+ if (rc)
+ return rc;
+
+ if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
+ rc = bnxt_handle_if_change_status(bp);
+ if (rc)
+ return rc;
}
+
bnxt_enable_int(bp);
rc = bnxt_init_chip(bp);
@@ -221,6 +221,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
rc = -EINVAL; \
else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
rc = -ENOTSUP; \
+ else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+ rc = -EAGAIN; \
else if (rc > 0) \
rc = -EIO; \
return rc; \
@@ -249,6 +251,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
rc = -EINVAL; \
else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
rc = -ENOTSUP; \
+ else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+ rc = -EAGAIN; \
else if (rc > 0) \
rc = -EIO; \
return rc; \