From: Andrew Boyer Date: Thu, 10 Dec 2020 02:57:32 +0000 (-0800) Subject: net/ionic: check for command completion more frequently X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=47dc2bd39f6d67983f0f8dec218934c16e802a7d;p=dpdk.git net/ionic: check for command completion more frequently This reduces the startup time a bit. Signed-off-by: Neel Patel Signed-off-by: Andrew Boyer Reviewed-by: Ferruh Yigit --- diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 532255a603..dc64a6d28e 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -20,7 +20,9 @@ #define IONIC_LIFS_MAX 1024 -#define IONIC_DEVCMD_TIMEOUT 30 /* devcmd_timeout */ +#define IONIC_DEVCMD_TIMEOUT 5 /* devcmd_timeout */ +#define IONIC_DEVCMD_CHECK_PERIOD_US 10 /* devcmd status chk period */ + #define IONIC_ALIGN 4096 struct ionic_adapter; diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 2ade213d2d..f77bddaa4d 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -144,12 +144,12 @@ static int ionic_wait_ctx_for_completion(struct ionic_lif *lif, struct ionic_qcq *qcq, struct ionic_admin_ctx *ctx, unsigned long max_wait) { - unsigned long step_msec = 1; - unsigned int max_wait_msec = max_wait * 1000; - unsigned long elapsed_msec = 0; + unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US; + unsigned long max_wait_usec = max_wait * 1000000L; + unsigned long elapsed_usec = 0; int budget = 8; - while (ctx->pending_work && elapsed_msec < max_wait_msec) { + while (ctx->pending_work && elapsed_usec < max_wait_usec) { /* * Locking here as adminq is served inline (this could be called * from multiple places) @@ -160,8 +160,8 @@ ionic_wait_ctx_for_completion(struct ionic_lif *lif, struct ionic_qcq *qcq, rte_spinlock_unlock(&lif->adminq_service_lock); - msec_delay(step_msec); - elapsed_msec += step_msec; + rte_delay_us_block(step_usec); + elapsed_usec += step_usec; } return (!ctx->pending_work); @@ -195,9 +195,9 @@ ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) static int ionic_dev_cmd_wait(struct ionic_dev *idev, unsigned long max_wait) { - unsigned long step_msec = 100; - unsigned int max_wait_msec = max_wait * 1000; - unsigned long elapsed_msec = 0; + unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US; + unsigned long max_wait_usec = max_wait * 1000000L; + unsigned long elapsed_usec = 0; int done; /* Wait for dev cmd to complete.. but no more than max_wait sec */ @@ -205,20 +205,20 @@ ionic_dev_cmd_wait(struct ionic_dev *idev, unsigned long max_wait) do { done = ionic_dev_cmd_done(idev); if (done) { - IONIC_PRINT(DEBUG, "DEVCMD %d done took %ld msecs", - idev->dev_cmd->cmd.cmd.opcode, - elapsed_msec); + IONIC_PRINT(DEBUG, "DEVCMD %d done took %ld usecs", + ioread8(&idev->dev_cmd->cmd.cmd.opcode), + elapsed_usec); return 0; } - msec_delay(step_msec); + rte_delay_us_block(step_usec); - elapsed_msec += step_msec; - } while (elapsed_msec < max_wait_msec); + elapsed_usec += step_usec; + } while (elapsed_usec < max_wait_usec); - IONIC_PRINT(DEBUG, "DEVCMD %d timeout after %ld msecs", - idev->dev_cmd->cmd.cmd.opcode, - elapsed_msec); + IONIC_PRINT(ERR, "DEVCMD %d timeout after %ld usecs", + ioread8(&idev->dev_cmd->cmd.cmd.opcode), + elapsed_usec); return -ETIMEDOUT; } diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h index e04bb8f658..a55d599184 100644 --- a/drivers/net/ionic/ionic_osdep.h +++ b/drivers/net/ionic/ionic_osdep.h @@ -20,13 +20,8 @@ #include "ionic_logs.h" -#define DELAY(x) rte_delay_us(x) -#define usec_delay(x) DELAY(x) -#define msec_delay(x) DELAY(1000 * (x)) - #define BIT(nr) (1UL << (nr)) #define BIT_ULL(nr) (1ULL << (nr)) -#define BITS_TO_LONGS(nr) div_round_up(nr, 8 * sizeof(long)) #ifndef PAGE_SHIFT #define PAGE_SHIFT 12 @@ -44,11 +39,6 @@ typedef uint16_t __le16; typedef uint32_t __le32; typedef uint64_t __le64; -static inline uint32_t div_round_up(uint32_t n, uint32_t d) -{ - return (n + d - 1) / d; -} - #define ioread8(reg) rte_read8(reg) #define ioread32(reg) rte_read32(reg) #define iowrite8(value, reg) rte_write8(value, reg)