Author: shurd
Date: Sat Sep 23 01:35:14 2017
New Revision: 323942
URL: https://svnweb.freebsd.org/changeset/base/323942

Log:
  Chain mbufs before passing to if_input()
  
  Build a list of mbufs to pass to if_input() after LRO. Results in
  12% small packet forwarding rate improvement.
  
  Reviewed by:  sbruno
  Approved by:  sbruno (mentor)
  Sponsored by: Limelight Networks
  Differential Revision:        https://reviews.freebsd.org/D12444

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c        Sat Sep 23 01:33:20 2017        (r323941)
+++ head/sys/net/iflib.c        Sat Sep 23 01:35:14 2017        (r323942)
@@ -2470,7 +2470,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
         * XXX early demux data packets so that if_input processing only handles
         * acks in interrupt context
         */
-       struct mbuf *m, *mh, *mt;
+       struct mbuf *m, *mh, *mt, *mf;
 
        ifp = ctx->ifc_ifp;
        mh = mt = NULL;
@@ -2541,8 +2541,11 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
                __iflib_fl_refill_lt(ctx, fl, budget + 8);
 
        lro_enabled = (if_getcapenable(ifp) & IFCAP_LRO);
+       mt = mf = NULL;
        while (mh != NULL) {
                m = mh;
+               if (mf == NULL)
+                       mf = m;
                mh = mh->m_nextpkt;
                m->m_nextpkt = NULL;
 #ifndef __NO_STRICT_ALIGNMENT
@@ -2552,11 +2555,19 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
                rx_bytes += m->m_pkthdr.len;
                rx_pkts++;
 #if defined(INET6) || defined(INET)
-               if (lro_enabled && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0)
+               if (lro_enabled && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0) {
+                       if (mf == m)
+                               mf = NULL;
                        continue;
+               }
 #endif
+               if (mt != NULL)
+                       mt->m_nextpkt = m;
+               mt = m;
+       }
+       if (mf != NULL) {
+               ifp->if_input(ifp, mf);
                DBG_COUNTER_INC(rx_if_input);
-               ifp->if_input(ifp, m);
        }
 
        if_inc_counter(ifp, IFCOUNTER_IBYTES, rx_bytes);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to