Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Apr 2015 21:55:04 +0000 (UTC)
From:      David C Somayajulu <davidcs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281006 - head/sys/dev/bxe
Message-ID:  <201504022155.t32Lt4dY017453@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davidcs
Date: Thu Apr  2 21:55:03 2015
New Revision: 281006
URL: https://svnweb.freebsd.org/changeset/base/281006

Log:
  When an mbuf allocation fails in the receive path, the mbuf containing the received packet is not sent to the host net
  work stack and is reused again on the receive ring.  Remaining received packets in the ring are not processed in that
  invocation of bxe_rxeof() and defered to the task thread.
  
  MFC after: 5 days

Modified:
  head/sys/dev/bxe/bxe.c

Modified: head/sys/dev/bxe/bxe.c
==============================================================================
--- head/sys/dev/bxe/bxe.c	Thu Apr  2 21:35:36 2015	(r281005)
+++ head/sys/dev/bxe/bxe.c	Thu Apr  2 21:55:03 2015	(r281006)
@@ -3246,7 +3246,7 @@ bxe_rxeof(struct bxe_softc    *sc,
     uint16_t bd_cons, bd_prod, bd_prod_fw, comp_ring_cons;
     uint16_t hw_cq_cons, sw_cq_cons, sw_cq_prod;
     int rx_pkts = 0;
-    int rc;
+    int rc = 0;
 
     BXE_FP_RX_LOCK(fp);
 
@@ -3388,6 +3388,10 @@ bxe_rxeof(struct bxe_softc    *sc,
                                   (sc->max_rx_bufs != RX_BD_USABLE) ?
                                       bd_prod : bd_cons);
         if (rc != 0) {
+
+            /* we simply reuse the received mbuf and don't post it to the stack */
+            m = NULL;
+
             BLOGE(sc, "mbuf alloc fail for fp[%02d] rx chain (%d)\n",
                   fp->index, rc);
             fp->eth_q_stats.rx_soft_errors++;
@@ -3476,6 +3480,9 @@ next_cqe:
         sw_cq_cons = RCQ_NEXT(sw_cq_cons);
 
         /* limit spinning on the queue */
+        if (rc != 0)
+            break;
+
         if (rx_pkts == sc->rx_budget) {
             fp->eth_q_stats.rx_budget_reached++;
             break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504022155.t32Lt4dY017453>