lkml.org 
[lkml]   [2018]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.18 001/135] bnxt_en: Fix TX timeout during netpoll.
    Date
    4.18-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Michael Chan <michael.chan@broadcom.com>

    [ Upstream commit 73f21c653f930f438d53eed29b5e4c65c8a0f906 ]

    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: Song Liu <songliubraving@fb.com>
    Reviewed-by: Song Liu <songliubraving@fb.com>
    Tested-by: Song Liu <songliubraving@fb.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 ++++++++++---
    1 file changed, 10 insertions(+), 3 deletions(-)

    --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
    +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
    @@ -1882,8 +1882,11 @@ static int bnxt_poll_work(struct bnxt *b
    if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
    tx_pkts++;
    /* 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;
    + raw_cons = NEXT_RAW_CMP(raw_cons);
    + break;
    + }
    } else if ((TX_CMP_TYPE(txcmp) & 0x30) == 0x10) {
    if (likely(budget))
    rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &event);
    @@ -1911,7 +1914,7 @@ static int bnxt_poll_work(struct bnxt *b
    }
    raw_cons = NEXT_RAW_CMP(raw_cons);

    - if (rx_pkts == budget)
    + if (rx_pkts && rx_pkts == budget)
    break;
    }

    @@ -2025,8 +2028,12 @@ static int bnxt_poll(struct napi_struct
    while (1) {
    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;
    + }

    if (!bnxt_has_work(bp, cpr)) {
    if (napi_complete_done(napi, work_done))

    \
     
     \ /
      Last update: 2018-10-16 19:10    [W:5.332 / U:0.104 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site