diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-05-01 14:56:19 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-05-01 14:56:19 +0000 |
commit | f3bd8ae2f67589b1d9eeaf21402768d1203c1ae8 (patch) | |
tree | 15453e2978f8d9ac5215265b538a13cb8202cf0a /sys/dev/ic | |
parent | 862db6b1f27ef456ccced532e02426ae48ae46c6 (diff) |
Convert to if_input(), ok miod@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/am7990.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/am79900.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/lance.c | 29 | ||||
-rw-r--r-- | sys/dev/ic/lancevar.h | 4 |
4 files changed, 25 insertions, 28 deletions
diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c index 542e328d915..2957d8ca6c6 100644 --- a/sys/dev/ic/am7990.c +++ b/sys/dev/ic/am7990.c @@ -1,4 +1,4 @@ -/* $OpenBSD: am7990.c,v 1.49 2014/12/22 02:28:51 tedu Exp $ */ +/* $OpenBSD: am7990.c,v 1.50 2015/05/01 14:56:18 mpi Exp $ */ /* $NetBSD: am7990.c,v 1.74 2012/02/02 19:43:02 tls Exp $ */ /*- @@ -213,6 +213,8 @@ void am7990_rint(struct lance_softc *sc) { struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct mbuf *m; + struct mbuf_list ml = MBUF_LIST_INITIALIZER(); int bix; int rp; struct lermd rmd; @@ -258,8 +260,10 @@ am7990_rint(struct lance_softc *sc) if (sc->sc_debug > 1) am7990_recv_print(sc, sc->sc_last_rd); #endif - lance_read(sc, LE_RBUFADDR(sc, bix), + m = lance_read(sc, LE_RBUFADDR(sc, bix), (int)rmd.rmd3 - 4); + if (m != NULL) + ml_enqueue(&ml, m); } rmd.rmd1_bits = LE_R1_OWN; @@ -282,6 +286,8 @@ am7990_rint(struct lance_softc *sc) } sc->sc_last_rd = bix; + + if_input(ifp, &ml); } void diff --git a/sys/dev/ic/am79900.c b/sys/dev/ic/am79900.c index a77f2516aec..feb473c6957 100644 --- a/sys/dev/ic/am79900.c +++ b/sys/dev/ic/am79900.c @@ -1,4 +1,4 @@ -/* $OpenBSD: am79900.c,v 1.3 2014/12/22 02:28:51 tedu Exp $ */ +/* $OpenBSD: am79900.c,v 1.4 2015/05/01 14:56:18 mpi Exp $ */ /* $NetBSD: am79900.c,v 1.23 2012/02/02 19:43:02 tls Exp $ */ /*- @@ -245,6 +245,8 @@ void am79900_rint(struct lance_softc *sc) { struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct mbuf *m; + struct mbuf_list ml = MBUF_LIST_INITIALIZER(); int bix; int rp; struct lermd rmd; @@ -290,8 +292,10 @@ am79900_rint(struct lance_softc *sc) if (sc->sc_debug > 1) am79900_recv_print(sc, sc->sc_last_rd); #endif - lance_read(sc, LE_RBUFADDR(sc, bix), + m = lance_read(sc, LE_RBUFADDR(sc, bix), (rmd.rmd2 & 0xfff) - 4); + if (m != NULL) + ml_enqueue(&ml, m); } rmd.rmd1 = LE_R1_OWN | LE_R1_ONES | (-LEBLEN & 0xfff); @@ -312,6 +316,8 @@ am79900_rint(struct lance_softc *sc) } sc->sc_last_rd = bix; + + if_input(ifp, &ml); } void diff --git a/sys/dev/ic/lance.c b/sys/dev/ic/lance.c index 317e085b5f8..1eb8d7ad5ca 100644 --- a/sys/dev/ic/lance.c +++ b/sys/dev/ic/lance.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lance.c,v 1.5 2014/12/22 02:28:51 tedu Exp $ */ +/* $OpenBSD: lance.c,v 1.6 2015/05/01 14:56:18 mpi Exp $ */ /* $NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */ /*- @@ -358,14 +358,12 @@ lance_put(struct lance_softc *sc, int boff, struct mbuf *m) integrate struct mbuf * lance_get(struct lance_softc *sc, int boff, int totlen) { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; struct mbuf *m, *top, **mp; int len, pad; 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; @@ -403,10 +401,7 @@ lance_get(struct lance_softc *sc, int boff, int totlen) return (top); } -/* - * Pass a packet to the higher levels. - */ -void +struct mbuf * lance_read(struct lance_softc *sc, int boff, int len) { struct mbuf *m; @@ -422,14 +417,14 @@ lance_read(struct lance_softc *sc, int boff, int len) sc->sc_dev.dv_xnam, len); #endif ifp->if_ierrors++; - return; + return (NULL); } /* Pull packet off interface. */ m = lance_get(sc, boff, len); if (m == NULL) { ifp->if_ierrors++; - return; + return (NULL); } ifp->if_ipackets++; @@ -447,7 +442,7 @@ lance_read(struct lance_softc *sc, int boff, int len) if (ETHER_CMP(eh->ether_dhost, sc->sc_arpcom.ac_enaddr) && ETHER_CMP(eh->ether_dhost, bcast_enaddr)) { m_freem(m); - return; + return (NULL); } #endif @@ -457,20 +452,10 @@ lance_read(struct lance_softc *sc, int boff, int len) */ if (!ETHER_CMP(eh->ether_shost, sc->sc_arpcom.ac_enaddr)) { m_freem(m); - return; + return (NULL); } -#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 - - /* Pass the packet up. */ - ether_input_mbuf(ifp, m); + return (m); } void diff --git a/sys/dev/ic/lancevar.h b/sys/dev/ic/lancevar.h index 3cf4c373e60..39c8bd55a71 100644 --- a/sys/dev/ic/lancevar.h +++ b/sys/dev/ic/lancevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lancevar.h,v 1.1 2013/09/24 20:10:58 miod Exp $ */ +/* $OpenBSD: lancevar.h,v 1.2 2015/05/01 14:56:18 mpi Exp $ */ /* $NetBSD: lancevar.h,v 1.15 2012/02/02 19:43:03 tls Exp $ */ /*- @@ -113,7 +113,7 @@ void lance_config(struct lance_softc *); void lance_reset(struct lance_softc *); int lance_init(struct lance_softc *); int lance_put(struct lance_softc *, int, struct mbuf *); -void lance_read(struct lance_softc *, int, int); +struct mbuf *lance_read(struct lance_softc *, int, int); void lance_setladrf(struct arpcom *, uint16_t *); /* |