Commit 97f775c5 authored by Michael Chan's avatar Michael Chan Committed by Khalid Elmously

bnxt_en: Fix TX timeout during netpoll.

BugLink: https://bugs.launchpad.net/bugs/1801900

[ Upstream commit 73f21c65 ]

The current netpoll implementation in the bnxt_en driver has problems
that may miss TX completion events.  bnxt_poll_work() in effect is
only handling at most 1 TX packet before exiting.  In addition,
there may be in flight TX completions that ->poll() may miss even
after we fix bnxt_poll_work() to handle all visible TX completions.
netpoll may not call ->poll() again and HW may not generate IRQ
because the driver does not ARM the IRQ when the budget (0 for netpoll)
is reached.

We fix it by handling all TX completions and to always ARM the IRQ
when we exit ->poll() with 0 budget.

Also, the logic to ACK the completion ring in case it is almost filled
with TX completions need to be adjusted to take care of the 0 budget
case, as discussed with Eric Dumazet <edumazet@google.com>
Reported-by: default avatarSong Liu <songliubraving@fb.com>
Reviewed-by: default avatarSong Liu <songliubraving@fb.com>
Tested-by: default avatarSong Liu <songliubraving@fb.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 1dbed6fe
...@@ -1343,8 +1343,11 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) ...@@ -1343,8 +1343,11 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
tx_pkts++; tx_pkts++;
/* return full budget so NAPI will complete. */ /* return full budget so NAPI will complete. */
if (unlikely(tx_pkts > bp->tx_wake_thresh)) if (unlikely(tx_pkts > bp->tx_wake_thresh)) {
rx_pkts = budget; rx_pkts = budget;
raw_cons = NEXT_RAW_CMP(raw_cons);
break;
}
} else if ((TX_CMP_TYPE(txcmp) & 0x30) == 0x10) { } else if ((TX_CMP_TYPE(txcmp) & 0x30) == 0x10) {
rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &agg_event); rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &agg_event);
if (likely(rc >= 0)) if (likely(rc >= 0))
...@@ -1362,7 +1365,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) ...@@ -1362,7 +1365,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
} }
raw_cons = NEXT_RAW_CMP(raw_cons); raw_cons = NEXT_RAW_CMP(raw_cons);
if (rx_pkts == budget) if (rx_pkts && rx_pkts == budget)
break; break;
} }
...@@ -1404,8 +1407,12 @@ static int bnxt_poll(struct napi_struct *napi, int budget) ...@@ -1404,8 +1407,12 @@ static int bnxt_poll(struct napi_struct *napi, int budget)
while (1) { while (1) {
work_done += bnxt_poll_work(bp, bnapi, budget - work_done); work_done += bnxt_poll_work(bp, bnapi, budget - work_done);
if (work_done >= budget) if (work_done >= budget) {
if (!budget)
BNXT_CP_DB_REARM(cpr->cp_doorbell,
cpr->cp_raw_cons);
break; break;
}
if (!bnxt_has_work(bp, cpr)) { if (!bnxt_has_work(bp, cpr)) {
napi_complete(napi); napi_complete(napi);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment