Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen bump send queue to 2*NET_TX_RING_SIZE to ma...



details:   https://anonhg.NetBSD.org/src/rev/9f3a90c154e1
branches:  trunk
changeset: 931316:9f3a90c154e1
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Apr 26 13:09:52 2020 +0000

description:
bump send queue to 2*NET_TX_RING_SIZE to make it less likely packets
are dropped on load

m_defrag() short packets before calling bus_dmamap_load_mbuf() -
if it's fragmented load_mbuf would fail anyway, and even with
eventual feature-sg support it's way faster to pass the short packet
in single fragment

diffstat:

 sys/arch/xen/xen/xennetback_xenbus.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r d5ea37752810 -r 9f3a90c154e1 sys/arch/xen/xen/xennetback_xenbus.c
--- a/sys/arch/xen/xen/xennetback_xenbus.c      Sun Apr 26 12:58:28 2020 +0000
+++ b/sys/arch/xen/xen/xennetback_xenbus.c      Sun Apr 26 13:09:52 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xennetback_xenbus.c,v 1.97 2020/04/25 11:33:28 jdolecek Exp $      */
+/*      $NetBSD: xennetback_xenbus.c,v 1.98 2020/04/26 13:09:52 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.97 2020/04/25 11:33:28 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.98 2020/04/26 13:09:52 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -269,6 +269,7 @@
        ifp->if_init = xennetback_ifinit;
        ifp->if_stop = xennetback_ifstop;
        ifp->if_timer = 0;
+       IFQ_SET_MAXLEN(&ifp->if_snd, uimax(2 * NET_TX_RING_SIZE, IFQ_MAXLEN));
        IFQ_SET_READY(&ifp->if_snd);
        if_attach(ifp);
        if_deferred_start_init(ifp, NULL);
@@ -912,6 +913,15 @@
 
                        xst = &xneti->xni_xstate[i];
 
+                       /*
+                        * For short packets it's always way faster passing
+                        * single defragmented packet, even with feature-sg.
+                        * Try to defragment first if the result is likely
+                        * to fit into a single mbuf.
+                        */
+                       if (m->m_pkthdr.len < MCLBYTES && m->m_next)
+                               (void)m_defrag(m, M_DONTWAIT);
+
                        if (bus_dmamap_load_mbuf(
                            xneti->xni_xbusd->xbusd_dmat,
                            xst->xs_dmamap, m, BUS_DMA_NOWAIT) != 0) {



Home | Main Index | Thread Index | Old Index