Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/sunxi Drop the sunxi_emac_rx_batch feature. It ...



details:   https://anonhg.NetBSD.org/src/rev/62feaade2c07
branches:  trunk
changeset: 354993:62feaade2c07
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jul 07 21:40:56 2017 +0000

description:
Drop the sunxi_emac_rx_batch feature. It was originally designed to
reduce the amount of mutex unlock/lock cycles during the RX path on
FreeBSD and if_input, but it is not required to drop the lock before
calling if_percpuq_enqueue on NetBSD.

diffstat:

 sys/arch/arm/sunxi/sunxi_emac.c |  31 ++++++-------------------------
 1 files changed, 6 insertions(+), 25 deletions(-)

diffs (91 lines):

diff -r 203256201409 -r 62feaade2c07 sys/arch/arm/sunxi/sunxi_emac.c
--- a/sys/arch/arm/sunxi/sunxi_emac.c   Fri Jul 07 21:21:52 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_emac.c   Fri Jul 07 21:40:56 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.3 2017/07/07 21:21:52 jmcneill Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.4 2017/07/07 21:40:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.3 2017/07/07 21:21:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.4 2017/07/07 21:40:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -96,7 +96,6 @@
 #define        RX_TX_PRI_DEFAULT       0
 #define        PAUSE_TIME_DEFAULT      0x400
 #define        TX_INTERVAL_DEFAULT     64
-#define        RX_BATCH_DEFAULT        1
 
 /* syscon EMAC clock register */
 #define        EMAC_CLK_EPHY_ADDR      (0x1f << 20)    /* H3 */
@@ -129,9 +128,6 @@
 /* Request a TX interrupt every <n> descriptors */
 static int sunxi_emac_tx_interval = TX_INTERVAL_DEFAULT;
 
-/* Maximum number of mbufs to send to if_input */
-static int sunxi_emac_rx_batch = RX_BATCH_DEFAULT;
-
 enum sunxi_emac_type {
        EMAC_A83T = 1,
        EMAC_H3,
@@ -709,12 +705,10 @@
 sunxi_emac_rxintr(struct sunxi_emac_softc *sc)
 {
        struct ifnet *ifp = &sc->ec.ec_if;
-       struct mbuf *m, *m0, *mh, *mt;
-       int error, index, len, cnt, npkt;
+       int error, index, len, npkt;
+       struct mbuf *m, *m0;
        uint32_t status;
 
-       mh = mt = NULL;
-       cnt = 0;
        npkt = 0;
 
        for (index = sc->rx.cur; ; index = RX_NEXT(index)) {
@@ -738,6 +732,7 @@
                        m->m_flags |= M_HASFCS;
                        m->m_pkthdr.len = len;
                        m->m_len = len;
+                       m->m_nextpkt = NULL;
 
                        if ((ifp->if_capenable & IFCAP_CSUM_IPv4_Rx) != 0 &&
                            (status & RX_FRM_TYPE) != 0) {
@@ -752,20 +747,9 @@
                                }
                        }
 
-                       m->m_nextpkt = NULL;
-                       if (mh == NULL)
-                               mh = m;
-                       else
-                               mt->m_nextpkt = m;
-                       mt = m;
-                       ++cnt;
                        ++npkt;
 
-                       if (cnt == sunxi_emac_rx_batch) {
-                               if_percpuq_enqueue(ifp->if_percpuq, mh);
-                               mh = mt = NULL;
-                               cnt = 0;
-                       }
+                       if_percpuq_enqueue(ifp->if_percpuq, m);
                }
 
                if ((m0 = sunxi_emac_alloc_mbufcl(sc)) != NULL) {
@@ -783,9 +767,6 @@
 
        sc->rx.cur = index;
 
-       if (mh != NULL)
-               if_percpuq_enqueue(ifp->if_percpuq, mh);
-
        return npkt;
 }
 



Home | Main Index | Thread Index | Old Index