]> Git Repo - linux.git/commitdiff
bnxt_en: Improve -ENOMEM logic in NAPI poll loop.
authorMichael Chan <[email protected]>
Mon, 28 Aug 2017 17:40:30 +0000 (13:40 -0400)
committerDavid S. Miller <[email protected]>
Mon, 28 Aug 2017 23:57:10 +0000 (16:57 -0700)
If we cannot allocate RX buffers in the NAPI poll loop when processing
an RX event, the current code does not count that event towards the NAPI
budget.  This can cause us to potentially loop forever in NAPI if we
consistently cannot allocate new buffers.  Improve it by counting
-ENOMEM event as 1 towards the NAPI budget.

Cc: Martin KaFai Lau <[email protected]>
Signed-off-by: Michael Chan <[email protected]>
Reported-by: Martin KaFai Lau <[email protected]>
Acked-by: Martin KaFai Lau <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 1afb408798d1a242dce11202ad8ab7266c70e1f3..a34fcddbd14ccc4e70e21976fb07d6ad0b540484 100644 (file)
@@ -1850,6 +1850,13 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
                                                           &event);
                        if (likely(rc >= 0))
                                rx_pkts += rc;
+                       /* Increment rx_pkts when rc is -ENOMEM to count towards
+                        * the NAPI budget.  Otherwise, we may potentially loop
+                        * here forever if we consistently cannot allocate
+                        * buffers.
+                        */
+                       else if (rc == -ENOMEM)
+                               rx_pkts++;
                        else if (rc == -EBUSY)  /* partial completion */
                                break;
                } else if (unlikely((TX_CMP_TYPE(txcmp) ==
This page took 0.07102 seconds and 4 git commands to generate.