Skip to content

Commit b891106

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Increase firmware message response DMA wait time
When polling for the firmware message response, we first poll for the response message header. Once the valid length is detected in the header, we poll for the valid bit at the end of the message which signals DMA completion. Normally, this poll time for DMA completion is extremely short (0 to a few usec). But on some devices under some rare conditions, it can be up to about 20 msec. Increase this delay to 50 msec and use udelay() for the first 10 usec for the common case, and usleep_range() beyond that. Also, change the error message to include the above delay time when printing the timeout value. Fixes: 3c8c20d ("bnxt_en: move HWRM API implementation into separate file") Reviewed-by: Vladimir Olovyannikov <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0e0e3c5 commit b891106

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,17 +644,23 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
644644

645645
/* Last byte of resp contains valid bit */
646646
valid = ((u8 *)ctx->resp) + len - 1;
647-
for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) {
647+
for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; ) {
648648
/* make sure we read from updated DMA memory */
649649
dma_rmb();
650650
if (*valid)
651651
break;
652-
usleep_range(1, 5);
652+
if (j < 10) {
653+
udelay(1);
654+
j++;
655+
} else {
656+
usleep_range(20, 30);
657+
j += 20;
658+
}
653659
}
654660

655661
if (j >= HWRM_VALID_BIT_DELAY_USEC) {
656662
hwrm_err(bp, ctx, "Error (timeout: %u) msg {0x%x 0x%x} len:%d v:%d\n",
657-
hwrm_total_timeout(i), req_type,
663+
hwrm_total_timeout(i) + j, req_type,
658664
le16_to_cpu(ctx->req->seq_id), len, *valid);
659665
goto exit;
660666
}

drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static inline unsigned int hwrm_total_timeout(unsigned int n)
9090
}
9191

9292

93-
#define HWRM_VALID_BIT_DELAY_USEC 150
93+
#define HWRM_VALID_BIT_DELAY_USEC 50000
9494

9595
static inline bool bnxt_cfa_hwrm_message(u16 req_type)
9696
{

0 commit comments

Comments
 (0)