Module Name: src
Committed By: jmcneill
Date: Fri Jul 7 21:40:56 UTC 2017
Modified Files:
src/sys/arch/arm/sunxi: sunxi_emac.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sunxi_emac.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/sunxi/sunxi_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.3 src/sys/arch/arm/sunxi/sunxi_emac.c:1.4
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.3 Fri Jul 7 21:21:52 2017
+++ src/sys/arch/arm/sunxi/sunxi_emac.c Fri Jul 7 21:40:56 2017
@@ -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 <[email protected]>
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c
#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 @@ static int sunxi_emac_pause_time = PAUSE
/* 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 @@ static int
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 @@ sunxi_emac_rxintr(struct sunxi_emac_soft
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 @@ sunxi_emac_rxintr(struct sunxi_emac_soft
}
}
- 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 @@ sunxi_emac_rxintr(struct sunxi_emac_soft
sc->rx.cur = index;
- if (mh != NULL)
- if_percpuq_enqueue(ifp->if_percpuq, mh);
-
return npkt;
}