[v1,34/35] net/ionic: retry init commands up to five times
Checks
Commit Message
In some configurations, the FW may return EAGAIN if it is not able
to respond to commands immediately. Retry the init commands in this
case to prevent errors from reaching the client.
Fix up some return-code stuff while here, for clarity.
Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
---
drivers/net/ionic/ionic_dev.h | 1 +
drivers/net/ionic/ionic_lif.c | 14 ++++++++++++++
drivers/net/ionic/ionic_main.c | 4 ++--
3 files changed, 17 insertions(+), 2 deletions(-)
@@ -24,6 +24,7 @@
#define IONIC_DEVCMD_TIMEOUT 5 /* devcmd_timeout */
#define IONIC_DEVCMD_CHECK_PERIOD_US 10 /* devcmd status chk period */
+#define IONIC_DEVCMD_RETRY_WAIT_US 20000
#define IONIC_ALIGN 4096
@@ -1423,10 +1423,17 @@ ionic_lif_adminq_init(struct ionic_lif *lif)
struct ionic_admin_qcq *aqcq = lif->adminqcq;
struct ionic_queue *q = &aqcq->qcq.q;
struct ionic_q_init_comp comp;
+ uint32_t retries = 5;
int err;
+retry_adminq_init:
ionic_dev_cmd_adminq_init(idev, &aqcq->qcq);
err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+ if (err == -EAGAIN && retries > 0) {
+ retries--;
+ rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US);
+ goto retry_adminq_init;
+ }
if (err)
return err;
@@ -1713,12 +1720,19 @@ ionic_lif_init(struct ionic_lif *lif)
{
struct ionic_dev *idev = &lif->adapter->idev;
struct ionic_lif_init_comp comp;
+ uint32_t retries = 5;
int err;
memset(&lif->stats_base, 0, sizeof(lif->stats_base));
+retry_lif_init:
ionic_dev_cmd_lif_init(idev, lif->info_pa);
err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+ if (err == -EAGAIN && retries > 0) {
+ retries--;
+ rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US);
+ goto retry_lif_init;
+ }
if (err)
return err;
@@ -313,10 +313,10 @@ ionic_dev_cmd_check_error(struct ionic_dev *idev)
uint8_t status;
status = ionic_dev_cmd_status(idev);
- if (status == 0)
+ if (status == IONIC_RC_SUCCESS)
return 0;
- return -EIO;
+ return (status == IONIC_RC_EAGAIN) ? -EAGAIN : -EIO;
}
int