summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-05-19 11:24:01 +0000
committermpi <mpi@openbsd.org>2015-05-19 11:24:01 +0000
commitcdea9bebb25e29ddabda3dedf960fe7c56d14f38 (patch)
treebf321bec82340e8352752537f2dcca753fe9023c
parentWe cannot check for M_BCAST or M_MCAST now that vlan_input() is ran (diff)
downloadwireguard-openbsd-cdea9bebb25e29ddabda3dedf960fe7c56d14f38.tar.xz
wireguard-openbsd-cdea9bebb25e29ddabda3dedf960fe7c56d14f38.zip
Convert to if_input().
ok dlg@
-rw-r--r--sys/dev/ic/aic6915.c21
-rw-r--r--sys/dev/ic/smc83c170.c24
-rw-r--r--sys/dev/ic/smc91cxx.c16
-rw-r--r--sys/dev/ic/ti.c16
-rw-r--r--sys/dev/isa/if_ef_isapnp.c13
-rw-r--r--sys/dev/isa/if_eg.c19
-rw-r--r--sys/dev/isa/if_el.c17
-rw-r--r--sys/dev/isa/if_ex.c13
-rw-r--r--sys/dev/pcmcia/if_cnw.c31
-rw-r--r--sys/dev/pcmcia/if_xe.c16
10 files changed, 53 insertions, 133 deletions
diff --git a/sys/dev/ic/aic6915.c b/sys/dev/ic/aic6915.c
index 729312fa9d2..e28f14ee777 100644
--- a/sys/dev/ic/aic6915.c
+++ b/sys/dev/ic/aic6915.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic6915.c,v 1.15 2015/04/28 14:07:47 jsg Exp $ */
+/* $OpenBSD: aic6915.c,v 1.16 2015/05/19 11:24:01 mpi Exp $ */
/* $NetBSD: aic6915.c,v 1.15 2005/12/24 20:27:29 perry Exp $ */
/*-
@@ -715,11 +715,11 @@ sf_rxintr(struct sf_softc *sc)
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct sf_descsoft *ds;
struct sf_rcd_full *rcd;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
uint32_t cqci, word0;
int consumer, producer, bufproducer, rxidx, len;
- try_again:
cqci = sf_funcreg_read(sc, SF_CompletionQueueConsumerIndex);
consumer = CQCI_RxCompletionQ1ConsumerIndex_get(cqci);
@@ -812,31 +812,20 @@ sf_rxintr(struct sf_softc *sc)
ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
#endif /* __STRICT_ALIGNMENT */
- m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = m->m_len = len;
-#if NBPFILTER > 0
- /*
- * Pass this up to any BPF listeners.
- */
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif /* NBPFILTER > 0 */
-
- /* Pass it on. */
- ether_input_mbuf(ifp, m);
+ ml_enqueue(&ml, m);
ifp->if_ipackets++;
}
+ if_input(ifp, &ml);
+
/* Update the chip's pointers. */
sf_funcreg_write(sc, SF_CompletionQueueConsumerIndex,
(cqci & ~CQCI_RxCompletionQ1ConsumerIndex(0x7ff)) |
CQCI_RxCompletionQ1ConsumerIndex(consumer));
sf_funcreg_write(sc, SF_RxDescQueue1Ptrs,
RXQ1P_RxDescQ1Producer(bufproducer));
-
- /* Double-check for any new completions. */
- goto try_again;
}
/*
diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c
index 04ad52a9b0a..3cdd049dd94 100644
--- a/sys/dev/ic/smc83c170.c
+++ b/sys/dev/ic/smc83c170.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc83c170.c,v 1.19 2015/03/14 03:38:47 jsg Exp $ */
+/* $OpenBSD: smc83c170.c,v 1.20 2015/05/19 11:24:01 mpi Exp $ */
/* $NetBSD: smc83c170.c,v 1.59 2005/02/27 00:27:02 perry Exp $ */
/*-
@@ -588,12 +588,12 @@ epic_intr(void *arg)
struct epic_rxdesc *rxd;
struct epic_txdesc *txd;
struct epic_descsoft *ds;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
u_int32_t intstat, rxstatus, txstatus;
int i, claimed = 0;
u_int len;
- top:
/*
* Get the interrupt status from the EPIC.
*/
@@ -703,20 +703,9 @@ epic_intr(void *arg)
}
}
- m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = m->m_len = len;
-#if NBPFILTER > 0
- /*
- * Pass this up to any BPF listeners, but only
- * pass it up the stack if its for us.
- */
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
- /* Pass it on. */
- ether_input_mbuf(ifp, m);
+ ml_enqueue(&ml, m);
ifp->if_ipackets++;
}
@@ -740,6 +729,8 @@ epic_intr(void *arg)
}
}
+ if_input(ifp, &ml);
+
/*
* Check for transmission complete interrupts.
*/
@@ -830,10 +821,7 @@ epic_intr(void *arg)
(void) epic_init(ifp);
}
- /*
- * Check for more interrupts.
- */
- goto top;
+ return (claimed);
}
/*
diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c
index 989bc780e2d..d6e5ec558e4 100644
--- a/sys/dev/ic/smc91cxx.c
+++ b/sys/dev/ic/smc91cxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc91cxx.c,v 1.38 2015/03/14 03:38:47 jsg Exp $ */
+/* $OpenBSD: smc91cxx.c,v 1.39 2015/05/19 11:24:01 mpi Exp $ */
/* $NetBSD: smc91cxx.c,v 1.11 1998/08/08 23:51:41 mycroft Exp $ */
/*-
@@ -913,6 +913,7 @@ smc91cxx_read(sc)
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
u_int16_t status, packetno, packetlen;
u_int8_t *data;
@@ -958,7 +959,6 @@ smc91cxx_read(sc)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
goto out;
- m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = packetlen;
/*
@@ -991,14 +991,8 @@ smc91cxx_read(sc)
}
ifp->if_ipackets++;
-
-#if NBPFILTER > 0
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
m->m_pkthdr.len = m->m_len = packetlen;
- ether_input_mbuf(ifp, m);
+ ml_enqueue(&ml, m);
out:
/*
@@ -1012,8 +1006,10 @@ smc91cxx_read(sc)
* Check for another packet.
*/
packetno = bus_space_read_2(bst, bsh, FIFO_PORTS_REG_W);
- if (packetno & FIFO_REMPTY)
+ if (packetno & FIFO_REMPTY) {
+ if_input(ifp, &ml);
return;
+ }
goto again;
}
diff --git a/sys/dev/ic/ti.c b/sys/dev/ic/ti.c
index dbcc1f9bdca..008ef34a26f 100644
--- a/sys/dev/ic/ti.c
+++ b/sys/dev/ic/ti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ti.c,v 1.13 2015/03/14 03:38:47 jsg Exp $ */
+/* $OpenBSD: ti.c,v 1.14 2015/05/19 11:24:01 mpi Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1529,6 +1529,7 @@ void
ti_rxeof(struct ti_softc *sc)
{
struct ifnet *ifp;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct ti_cmd_desc cmd;
ifp = &sc->arpcom.ac_if;
@@ -1602,7 +1603,6 @@ ti_rxeof(struct ti_softc *sc)
m->m_pkthdr.len = m->m_len = cur_rx->ti_len;
ifp->if_ipackets++;
- m->m_pkthdr.rcvif = ifp;
#if NVLAN > 0
if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) {
@@ -1611,18 +1611,10 @@ ti_rxeof(struct ti_softc *sc)
}
#endif
-#if NBPFILTER > 0
- /*
- * Handle BPF listeners. Let the BPF user see the packet.
- */
- if (ifp->if_bpf)
- bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0)
m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK;
- ether_input_mbuf(ifp, m);
+ ml_enqueue(&ml, m);
}
/* Only necessary on the Tigon 1. */
@@ -1633,6 +1625,8 @@ ti_rxeof(struct ti_softc *sc)
TI_UPDATE_STDPROD(sc, sc->ti_std);
TI_UPDATE_MINIPROD(sc, sc->ti_mini);
TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo);
+
+ if_input(ifp, &ml);
}
void
diff --git a/sys/dev/isa/if_ef_isapnp.c b/sys/dev/isa/if_ef_isapnp.c
index b4f8851d055..18508c38fa2 100644
--- a/sys/dev/isa/if_ef_isapnp.c
+++ b/sys/dev/isa/if_ef_isapnp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ef_isapnp.c,v 1.27 2014/12/22 02:28:51 tedu Exp $ */
+/* $OpenBSD: if_ef_isapnp.c,v 1.28 2015/05/19 11:24:01 mpi Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -671,6 +671,7 @@ efread(sc)
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
int len;
@@ -719,13 +720,9 @@ efread(sc)
}
ifp->if_ipackets++;
+ ml_enqueue(&ml, m);
-#if NBPFILTER > 0
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
- ether_input_mbuf(ifp, m);
+ if_input(ifp, &ml);
}
struct mbuf *
@@ -735,14 +732,12 @@ efget(sc, totlen)
{
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *top, **mp, *m;
int len, pad, s;
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (NULL);
- m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = totlen;
pad = ALIGN(sizeof(struct ether_header)) - sizeof(struct ether_header);
m->m_data += pad;
diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c
index 71e4fbea36d..45ee45cea6a 100644
--- a/sys/dev/isa/if_eg.c
+++ b/sys/dev/isa/if_eg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_eg.c,v 1.37 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: if_eg.c,v 1.38 2015/05/19 11:24:01 mpi Exp $ */
/* $NetBSD: if_eg.c,v 1.26 1996/05/12 23:52:27 mycroft Exp $ */
/*
@@ -670,8 +670,9 @@ void
egread(struct eg_softc *sc, caddr_t buf, int len)
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
-
+
if (len <= sizeof(struct ether_header) ||
len > ETHER_MAX_LEN) {
printf("%s: invalid packet size %d; dropping\n",
@@ -688,17 +689,9 @@ egread(struct eg_softc *sc, caddr_t buf, int len)
}
ifp->if_ipackets++;
+ ml_enqueue(&ml, m);
-#if NBPFILTER > 0
- /*
- * Check if there's a BPF listener on this interface.
- * If so, hand off the raw packet to BPF.
- */
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
- ether_input_mbuf(ifp, m);
+ if_input(ifp, &ml);
}
/*
@@ -707,14 +700,12 @@ egread(struct eg_softc *sc, caddr_t buf, int len)
struct mbuf *
egget(struct eg_softc *sc, caddr_t buf, int totlen)
{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *top, **mp, *m;
int len;
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (0);
- m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = totlen;
len = MHLEN;
top = 0;
diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c
index ac2d81dad2c..744ece69ad9 100644
--- a/sys/dev/isa/if_el.c
+++ b/sys/dev/isa/if_el.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_el.c,v 1.25 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: if_el.c,v 1.26 2015/05/19 11:24:01 mpi Exp $ */
/* $NetBSD: if_el.c,v 1.39 1996/05/12 23:52:32 mycroft Exp $ */
/*
@@ -490,6 +490,7 @@ elread(sc, len)
int len;
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
if (len <= sizeof(struct ether_header) ||
@@ -508,17 +509,9 @@ elread(sc, len)
}
ifp->if_ipackets++;
+ ml_enqueue(&ml, m);
-#if NBPFILTER > 0
- /*
- * Check if there's a BPF listener on this interface.
- * If so, hand off the raw packet to BPF.
- */
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
- ether_input_mbuf(ifp, m);
+ if_input(ifp, &ml);
}
/*
@@ -531,7 +524,6 @@ elget(sc, totlen)
struct el_softc *sc;
int totlen;
{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
int iobase = sc->sc_iobase;
struct mbuf *top, **mp, *m;
int len;
@@ -539,7 +531,6 @@ elget(sc, totlen)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return 0;
- m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = totlen;
len = MHLEN;
top = 0;
diff --git a/sys/dev/isa/if_ex.c b/sys/dev/isa/if_ex.c
index 0c8f883616e..3366ffe80d9 100644
--- a/sys/dev/isa/if_ex.c
+++ b/sys/dev/isa/if_ex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ex.c,v 1.37 2014/12/22 02:28:51 tedu Exp $ */
+/* $OpenBSD: if_ex.c,v 1.38 2015/05/19 11:24:01 mpi Exp $ */
/*
* Copyright (c) 1997, Donald A. Schmidt
* Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es)
@@ -639,6 +639,7 @@ void
ex_rx_intr(struct ex_softc *sc)
{
struct ifnet *ifp = &sc->arpcom.ac_if;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
int rx_status, pkt_len, QQQ;
struct mbuf *m, *ipkt;
@@ -661,7 +662,6 @@ ex_rx_intr(struct ex_softc *sc)
if (ipkt == NULL)
ifp->if_iqdrops++;
else {
- ipkt->m_pkthdr.rcvif = ifp;
ipkt->m_pkthdr.len = pkt_len;
ipkt->m_len = MHLEN;
while (pkt_len > 0) {
@@ -710,13 +710,8 @@ ex_rx_intr(struct ex_softc *sc)
} /* QQQ */
}
#endif
-#if NBPFILTER > 0
- if (ifp->if_bpf != NULL)
- bpf_mtap(ifp->if_bpf, ipkt,
- BPF_DIRECTION_IN);
-#endif
- ether_input_mbuf(ifp, ipkt);
ifp->if_ipackets++;
+ ml_enqueue(&ml, ipkt);
}
} else
ifp->if_ierrors++;
@@ -728,6 +723,8 @@ ex_rx_intr(struct ex_softc *sc)
else
CSR_WRITE_2(sc, RCV_STOP_REG, sc->rx_head - 2);
+ if_input(ifp, &ml);
+
DODEBUG(Start_End, printf("ex_rx_intr: finish\n"););
}
diff --git a/sys/dev/pcmcia/if_cnw.c b/sys/dev/pcmcia/if_cnw.c
index ffdb6712cb9..1c710c2c530 100644
--- a/sys/dev/pcmcia/if_cnw.c
+++ b/sys/dev/pcmcia/if_cnw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cnw.c,v 1.28 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: if_cnw.c,v 1.29 2015/05/19 11:24:01 mpi Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -632,15 +632,15 @@ cnw_recv(sc)
{
int rser;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
- struct ether_header *eh;
for (;;) {
WAIT_WOC(sc);
rser = bus_space_read_1(sc->sc_memt, sc->sc_memh,
sc->sc_memoff + CNW_EREG_RSER);
if (!(rser & CNW_RSER_RXAVAIL))
- return;
+ break;
/* Pull packet off card */
m = cnw_read(sc);
@@ -651,30 +651,13 @@ cnw_recv(sc)
/* Did we manage to get the packet from the interface? */
if (m == NULL) {
++ifp->if_ierrors;
- return;
+ break;
}
++ifp->if_ipackets;
-
-#if NBPFILTER > 0
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
- /*
- * Check that the packet is for us or {multi,broad}cast. Maybe
- * there's a fool-poof hardware check for this, but I don't
- * really know...
- */
- eh = mtod(m, struct ether_header *);
- if ((eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
- bcmp(sc->sc_arpcom.ac_enaddr, eh->ether_dhost,
- sizeof(eh->ether_dhost)) != 0) {
- m_freem(m);
- continue;
- }
-
- ether_input_mbuf(ifp, m);
+ ml_enqueue(&ml, m);
}
+
+ if_input(ifp, &ml);
}
diff --git a/sys/dev/pcmcia/if_xe.c b/sys/dev/pcmcia/if_xe.c
index c98bff5c62b..ef2c8e37f72 100644
--- a/sys/dev/pcmcia/if_xe.c
+++ b/sys/dev/pcmcia/if_xe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xe.c,v 1.48 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: if_xe.c,v 1.49 2015/05/19 11:24:01 mpi Exp $ */
/*
* Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas
@@ -751,6 +751,7 @@ xe_get(sc)
{
u_int8_t rsr;
struct mbuf *top, **mp, *m;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
u_int16_t pktlen, len, recvcount = 0;
u_int8_t *data;
@@ -773,7 +774,6 @@ xe_get(sc)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (recvcount);
- m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = pktlen;
len = MHLEN;
top = 0;
@@ -823,15 +823,11 @@ xe_get(sc)
/* Skip Rx packet. */
bus_space_write_2(sc->sc_bst, sc->sc_bsh, sc->sc_offset + DO0,
DO_SKIP_RX_PKT);
-
+
ifp->if_ipackets++;
-
-#if NBPFILTER > 0
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, top, BPF_DIRECTION_IN);
-#endif
-
- ether_input_mbuf(ifp, top);
+ ml_enqueue(&ml, top);
+ if_input(ifp, &ml);
+
return (recvcount);
}