summaryrefslogtreecommitdiffstats
path: root/sys/dev/ic
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-06-24 09:40:53 +0000
committermpi <mpi@openbsd.org>2015-06-24 09:40:53 +0000
commitdb4dc9aafbed936e879d4362ca141e998a6e925c (patch)
treedf98e73a3cab3c7738c665fd003541280cfc7446 /sys/dev/ic
parentIntroduce Linux work queue APIs and use them. As a side-effect, this will (diff)
downloadwireguard-openbsd-db4dc9aafbed936e879d4362ca141e998a6e925c.tar.xz
wireguard-openbsd-db4dc9aafbed936e879d4362ca141e998a6e925c.zip
Increment if_ipackets in if_input().
Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/aic6915.c5
-rw-r--r--sys/dev/ic/dc.c24
-rw-r--r--sys/dev/ic/dp8390.c3
-rw-r--r--sys/dev/ic/elink3.c4
-rw-r--r--sys/dev/ic/fxp.c3
-rw-r--r--sys/dev/ic/gem.c4
-rw-r--r--sys/dev/ic/hme.c4
-rw-r--r--sys/dev/ic/i82596.c4
-rw-r--r--sys/dev/ic/if_wi.c4
-rw-r--r--sys/dev/ic/lance.c4
-rw-r--r--sys/dev/ic/lemac.c3
-rw-r--r--sys/dev/ic/mtd8xx.c18
-rw-r--r--sys/dev/ic/re.c4
-rw-r--r--sys/dev/ic/rtl81x9.c4
-rw-r--r--sys/dev/ic/smc83c170.c3
-rw-r--r--sys/dev/ic/smc91cxx.c3
-rw-r--r--sys/dev/ic/ti.c3
-rw-r--r--sys/dev/ic/xl.c3
18 files changed, 34 insertions, 66 deletions
diff --git a/sys/dev/ic/aic6915.c b/sys/dev/ic/aic6915.c
index e28f14ee777..4bdfec419fc 100644
--- a/sys/dev/ic/aic6915.c
+++ b/sys/dev/ic/aic6915.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic6915.c,v 1.16 2015/05/19 11:24:01 mpi Exp $ */
+/* $OpenBSD: aic6915.c,v 1.17 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: aic6915.c,v 1.15 2005/12/24 20:27:29 perry Exp $ */
/*-
@@ -815,7 +815,6 @@ sf_rxintr(struct sf_softc *sc)
m->m_pkthdr.len = m->m_len = len;
ml_enqueue(&ml, m);
- ifp->if_ipackets++;
}
if_input(ifp, &ml);
@@ -876,8 +875,6 @@ sf_stats_update(struct sf_softc *sc)
stats.TransmitAbortDueToExcessingDeferral +
stats.FramesLostDueToInternalTransmitErrors;
- ifp->if_ipackets += stats.ReceiveOKFrames;
-
ifp->if_ierrors += stats.ReceiveCRCErrors + stats.AlignmentErrors +
stats.ReceiveFramesTooLong + stats.ReceiveFramesTooShort +
stats.ReceiveFramesJabbersError +
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c
index 5a398cd7ca4..ac2dbe30e7d 100644
--- a/sys/dev/ic/dc.c
+++ b/sys/dev/ic/dc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dc.c,v 1.140 2015/04/13 08:45:48 mpi Exp $ */
+/* $OpenBSD: dc.c,v 1.141 2015/06/24 09:40:54 mpi Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -131,7 +131,7 @@ int dc_coal(struct dc_softc *, struct mbuf **);
void dc_pnic_rx_bug_war(struct dc_softc *, int);
int dc_rx_resync(struct dc_softc *);
-void dc_rxeof(struct dc_softc *);
+int dc_rxeof(struct dc_softc *);
void dc_txeof(struct dc_softc *);
void dc_tick(void *);
void dc_tx_underrun(struct dc_softc *);
@@ -2065,14 +2065,14 @@ dc_rx_resync(struct dc_softc *sc)
* A frame has been uploaded: pass the resulting mbuf chain up to
* the higher level protocols.
*/
-void
+int
dc_rxeof(struct dc_softc *sc)
{
struct mbuf *m;
struct ifnet *ifp;
struct dc_desc *cur_rx;
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
- int i, offset, total_len = 0;
+ int i, offset, total_len = 0, consumed = 0;
u_int32_t rxstat;
ifp = &sc->sc_arpcom.ac_if;
@@ -2135,7 +2135,7 @@ dc_rxeof(struct dc_softc *sc)
continue;
} else {
dc_init(sc);
- return;
+ break;
}
}
}
@@ -2152,13 +2152,15 @@ dc_rxeof(struct dc_softc *sc)
}
m = m0;
- ifp->if_ipackets++;
+ consumed++;
ml_enqueue(&ml, m);
}
sc->dc_cdata.dc_rx_prod = i;
if_input(ifp, &ml);
+
+ return (consumed);
}
/*
@@ -2443,10 +2445,7 @@ dc_intr(void *arg)
CSR_WRITE_4(sc, DC_ISR, status);
if (status & DC_ISR_RX_OK) {
- int curpkts;
- curpkts = ifp->if_ipackets;
- dc_rxeof(sc);
- if (curpkts == ifp->if_ipackets) {
+ if (dc_rxeof(sc) == 0) {
while(dc_rx_resync(sc))
dc_rxeof(sc);
}
@@ -2468,10 +2467,7 @@ dc_intr(void *arg)
if ((status & DC_ISR_RX_WATDOGTIMEO)
|| (status & DC_ISR_RX_NOBUF)) {
- int curpkts;
- curpkts = ifp->if_ipackets;
- dc_rxeof(sc);
- if (curpkts == ifp->if_ipackets) {
+ if (dc_rxeof(sc) == 0) {
while(dc_rx_resync(sc))
dc_rxeof(sc);
}
diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c
index 85487004587..fb1f3d28c51 100644
--- a/sys/dev/ic/dp8390.c
+++ b/sys/dev/ic/dp8390.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dp8390.c,v 1.54 2015/05/21 09:44:32 mpi Exp $ */
+/* $OpenBSD: dp8390.c,v 1.55 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */
/*
@@ -578,7 +578,6 @@ loop:
ifp->if_ierrors++;
goto exit;
}
- ifp->if_ipackets++;
ml_enqueue(&ml, m);
} else {
/* Really BAD. The ring pointers are corrupted. */
diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c
index 838d7cfe9fa..9df535f2022 100644
--- a/sys/dev/ic/elink3.c
+++ b/sys/dev/ic/elink3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elink3.c,v 1.84 2015/03/30 10:04:11 mpi Exp $ */
+/* $OpenBSD: elink3.c,v 1.85 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */
/*
@@ -1294,8 +1294,6 @@ again:
goto done;
}
- ++ifp->if_ipackets;
-
ml_enqueue(&ml, m);
/*
diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c
index 6b28de0c4b2..60f95db8ae2 100644
--- a/sys/dev/ic/fxp.c
+++ b/sys/dev/ic/fxp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fxp.c,v 1.120 2015/03/14 03:38:47 jsg Exp $ */
+/* $OpenBSD: fxp.c,v 1.121 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */
/*
@@ -957,7 +957,6 @@ fxp_stats_update(void *arg)
ifp->if_opackets += letoh32(sp->tx_good);
ifp->if_collisions += letoh32(sp->tx_total_collisions);
if (sp->rx_good) {
- ifp->if_ipackets += letoh32(sp->rx_good);
sc->rx_idle_secs = 0;
} else if (sc->sc_flags & FXPF_RECV_WORKAROUND)
sc->rx_idle_secs++;
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index bdfad8e66ce..57b1a68ea38 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gem.c,v 1.111 2015/03/14 03:38:47 jsg Exp $ */
+/* $OpenBSD: gem.c,v 1.112 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */
/*
@@ -996,8 +996,6 @@ gem_rint(struct gem_softc *sc)
len = GEM_RD_BUFLEN(rxstat);
m->m_data += 2; /* We're already off by two */
-
- ifp->if_ipackets++;
m->m_pkthdr.len = m->m_len = len;
ml_enqueue(&ml, m);
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c
index f9245cc04d0..98f8091300c 100644
--- a/sys/dev/ic/hme.c
+++ b/sys/dev/ic/hme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hme.c,v 1.72 2015/03/30 09:47:05 mpi Exp $ */
+/* $OpenBSD: hme.c,v 1.73 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */
/*-
@@ -843,8 +843,6 @@ hme_rint(struct hme_softc *sc)
len = HME_XD_DECODE_RSIZE(flags);
m->m_pkthdr.len = m->m_len = len;
- ifp->if_ipackets++;
-
ml_enqueue(&ml, m);
}
diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c
index 907ea78ecc3..80d70017e85 100644
--- a/sys/dev/ic/i82596.c
+++ b/sys/dev/ic/i82596.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i82596.c,v 1.42 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: i82596.c,v 1.43 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */
/*-
@@ -1115,8 +1115,6 @@ i82596_readframe(sc, num)
#endif
ml_enqueue(&ml, m);
- ifp->if_ipackets++;
-
if_input(ifp, &ml);
return (0);
}
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index c83a62f0c9f..b224c99ff13 100644
--- a/sys/dev/ic/if_wi.c
+++ b/sys/dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.161 2015/05/19 11:34:30 mpi Exp $ */
+/* $OpenBSD: if_wi.c,v 1.162 2015/06/24 09:40:54 mpi Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -760,8 +760,6 @@ wi_rxeof(struct wi_softc *sc)
break;
}
- ifp->if_ipackets++;
-
if (sc->wi_use_wep &&
rx_frame.wi_frame_ctl & htole16(WI_FCTL_WEP)) {
int len;
diff --git a/sys/dev/ic/lance.c b/sys/dev/ic/lance.c
index 1eb8d7ad5ca..287c61f87fa 100644
--- a/sys/dev/ic/lance.c
+++ b/sys/dev/ic/lance.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lance.c,v 1.6 2015/05/01 14:56:18 mpi Exp $ */
+/* $OpenBSD: lance.c,v 1.7 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */
/*-
@@ -427,8 +427,6 @@ lance_read(struct lance_softc *sc, int boff, int len)
return (NULL);
}
- ifp->if_ipackets++;
-
eh = mtod(m, struct ether_header *);
#ifdef LANCE_REVC_BUG
diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c
index d9c16ccac71..d82155d8975 100644
--- a/sys/dev/ic/lemac.c
+++ b/sys/dev/ic/lemac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lemac.c,v 1.19 2015/04/06 09:13:55 miod Exp $ */
+/* $OpenBSD: lemac.c,v 1.20 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: lemac.c,v 1.20 2001/06/13 10:46:02 wiz Exp $ */
/*-
@@ -312,7 +312,6 @@ lemac_rne_intr(struct lemac_softc *sc)
unsigned rxpg = LEMAC_INB(sc, LEMAC_REG_RQ);
u_int32_t rxlen;
- ifp->if_ipackets++;
if (LEMAC_USE_PIO_MODE(sc)) {
LEMAC_OUTB(sc, LEMAC_REG_IOP, rxpg);
LEMAC_OUTB(sc, LEMAC_REG_PI1, 0);
diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c
index 954f22570e4..085e0d37217 100644
--- a/sys/dev/ic/mtd8xx.c
+++ b/sys/dev/ic/mtd8xx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtd8xx.c,v 1.26 2015/04/13 08:45:48 mpi Exp $ */
+/* $OpenBSD: mtd8xx.c,v 1.27 2015/06/24 09:40:54 mpi Exp $ */
/*
* Copyright (c) 2003 Oleg Safiullin <form@pdp11.org.ru>
@@ -79,7 +79,7 @@ static void mtd_start(struct ifnet *);
static void mtd_stop(struct ifnet *);
static void mtd_watchdog(struct ifnet *);
-static void mtd_rxeof(struct mtd_softc *);
+static int mtd_rxeof(struct mtd_softc *);
static int mtd_rx_resync(struct mtd_softc *);
static void mtd_txeof(struct mtd_softc *);
@@ -834,10 +834,7 @@ mtd_intr(void *xsc)
/* RX interrupt. */
if (status & ISR_RI) {
- int curpkts = ifp->if_ipackets;
-
- mtd_rxeof(sc);
- if (curpkts == ifp->if_ipackets)
+ if (mtd_rxeof(sc) == 0)
while(mtd_rx_resync(sc))
mtd_rxeof(sc);
}
@@ -871,14 +868,14 @@ mtd_intr(void *xsc)
* A frame has been uploaded: pass the resulting mbuf chain up to
* the higher level protocols.
*/
-static void
+static int
mtd_rxeof(struct mtd_softc *sc)
{
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
struct ifnet *ifp;
struct mtd_rx_desc *cur_rx;
- int i, total_len = 0;
+ int i, total_len = 0, consumed = 0;
u_int32_t rxstat;
ifp = &sc->sc_arpcom.ac_if;
@@ -933,14 +930,15 @@ mtd_rxeof(struct mtd_softc *sc)
}
m = m0;
- ifp->if_ipackets++;
-
+ consumed++;
ml_enqueue(&ml, m);
}
if_input(ifp, &ml);
sc->mtd_cdata.mtd_rx_prod = i;
+
+ return (consumed);
}
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index c7099caa114..3b96306adb1 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.178 2015/04/13 20:45:49 sthen Exp $ */
+/* $OpenBSD: re.c,v 1.179 2015/06/24 09:40:54 mpi Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -1398,8 +1398,6 @@ re_rxeof(struct rl_softc *sc)
m->m_pkthdr.len = m->m_len =
(total_len - ETHER_CRC_LEN);
- ifp->if_ipackets++;
-
/* Do RX checksumming */
if (sc->rl_flags & RL_FLAG_DESCV2) {
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c
index 23c5204a5a5..3a9d0161a50 100644
--- a/sys/dev/ic/rtl81x9.c
+++ b/sys/dev/ic/rtl81x9.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtl81x9.c,v 1.90 2015/04/13 08:45:48 mpi Exp $ */
+/* $OpenBSD: rtl81x9.c,v 1.91 2015/06/24 09:40:54 mpi Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -672,8 +672,6 @@ rl_rxeof(struct rl_softc *sc)
continue;
}
- ifp->if_ipackets++;
-
ml_enqueue(&ml, m);
bus_dmamap_sync(sc->sc_dmat, sc->sc_rx_dmamap,
diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c
index 3cdd049dd94..e6258492ddc 100644
--- a/sys/dev/ic/smc83c170.c
+++ b/sys/dev/ic/smc83c170.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc83c170.c,v 1.20 2015/05/19 11:24:01 mpi Exp $ */
+/* $OpenBSD: smc83c170.c,v 1.21 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: smc83c170.c,v 1.59 2005/02/27 00:27:02 perry Exp $ */
/*-
@@ -706,7 +706,6 @@ epic_intr(void *arg)
m->m_pkthdr.len = m->m_len = len;
ml_enqueue(&ml, m);
- ifp->if_ipackets++;
}
/* Update the receive pointer. */
diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c
index d6e5ec558e4..d3abd0d7fde 100644
--- a/sys/dev/ic/smc91cxx.c
+++ b/sys/dev/ic/smc91cxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc91cxx.c,v 1.39 2015/05/19 11:24:01 mpi Exp $ */
+/* $OpenBSD: smc91cxx.c,v 1.40 2015/06/24 09:40:54 mpi Exp $ */
/* $NetBSD: smc91cxx.c,v 1.11 1998/08/08 23:51:41 mycroft Exp $ */
/*-
@@ -990,7 +990,6 @@ smc91cxx_read(sc)
*data = bus_space_read_1(bst, bsh, DATA_REG_B);
}
- ifp->if_ipackets++;
m->m_pkthdr.len = m->m_len = packetlen;
ml_enqueue(&ml, m);
diff --git a/sys/dev/ic/ti.c b/sys/dev/ic/ti.c
index 008ef34a26f..f7d4147327c 100644
--- a/sys/dev/ic/ti.c
+++ b/sys/dev/ic/ti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ti.c,v 1.14 2015/05/19 11:24:01 mpi Exp $ */
+/* $OpenBSD: ti.c,v 1.15 2015/06/24 09:40:54 mpi Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1602,7 +1602,6 @@ ti_rxeof(struct ti_softc *sc)
panic("%s: couldn't get mbuf", sc->sc_dv.dv_xname);
m->m_pkthdr.len = m->m_len = cur_rx->ti_len;
- ifp->if_ipackets++;
#if NVLAN > 0
if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) {
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c
index 2ac64111f74..a0af31e0ba3 100644
--- a/sys/dev/ic/xl.c
+++ b/sys/dev/ic/xl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xl.c,v 1.124 2015/05/21 09:25:18 mpi Exp $ */
+/* $OpenBSD: xl.c,v 1.125 2015/06/24 09:40:54 mpi Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1194,7 +1194,6 @@ again:
continue;
}
- ifp->if_ipackets++;
m->m_pkthdr.len = m->m_len = total_len;
if (sc->xl_type == XL_TYPE_905B) {