From 3cefa904cb30201736ca7b139bb5ec896e966c4f Mon Sep 17 00:00:00 2001 From: Christopher Pascoe Date: Sun, 16 Apr 2006 00:46:33 +0000 Subject: Convert the last remaining net-driver users of ether_input to ether_input_mbuf. sgec ok martin@ if_ie ok miod@ if_de, if_hp not in GENERIC ok brad@ --- sys/arch/mvme68k/dev/if_ie.c | 26 +++++++------------------- sys/arch/mvme88k/dev/if_ie.c | 24 +++++++----------------- sys/arch/sparc/dev/if_ie.c | 24 +++++++----------------- sys/arch/vax/if/if_de.c | 20 ++++++++++++-------- sys/arch/vax/if/if_qe.c | 10 ++++------ sys/arch/vax/if/sgec.c | 6 ++---- 6 files changed, 39 insertions(+), 71 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index 763f798b8b5..e878731c6e1 100644 --- a/sys/arch/mvme68k/dev/if_ie.c +++ b/sys/arch/mvme68k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.34 2006/03/25 22:41:41 djm Exp $ */ +/* $OpenBSD: if_ie.c,v 1.35 2006/04/16 00:46:32 pascoe Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. @@ -249,8 +249,6 @@ int command_and_wait(struct ie_softc *, int, void volatile *, int); void ierint(struct ie_softc *); void ietint(struct ie_softc *); -int ieget(struct ie_softc *, struct mbuf **, - struct ether_header *, int *); void setup_bufs(struct ie_softc *); int mc_setup(struct ie_softc *, void *); void mc_reset(struct ie_softc *); @@ -976,7 +974,7 @@ ieget(sc, mp, ehp, to_bpf) { struct mbuf *m, *top, **mymp; int i; - int offset; + int offset = 0; int totlen, resid; int thismboff; int head; @@ -1004,7 +1002,6 @@ ieget(sc, mp, ehp, to_bpf) sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */ return -1; } - totlen -= (offset = sizeof *ehp); MGETHDR(*mp, M_DONTWAIT, MT_DATA); if (!*mp) { @@ -1191,19 +1188,10 @@ ie_readframe(sc, num) } #if NBPFILTER > 0 - /* - * Check for a BPF filter; if so, hand it up. - * Note that we have to stick an extra mbuf up front, because bpf_mtap - * expects to have the ether header at the front. - * It doesn't matter that this results in an ill-formatted mbuf chain, - * since BPF just looks at the data. (It doesn't try to free the mbuf, - * tho' it will make a copy for tcpdump.) - */ - if (bpf_gets_it) { - /* Pass it up. */ - bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh, - sizeof(eh), m, BPF_DIRECTION_IN); - } + /* Check for a BPF filter; if so, hand it up. */ + if (bpf_gets_it) + bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN); + /* * A signal passed up from the filtering code indicating that the * packet is intended for BPF but not for the protocol machinery. @@ -1226,7 +1214,7 @@ ie_readframe(sc, num) /* * Finally pass this packet up to higher layers. */ - ether_input(&sc->sc_arpcom.ac_if, &eh, m); + ether_input_mbuf(&sc->sc_arpcom.ac_if, m); } void diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c index db1f9a63ae0..8d305d75a1b 100644 --- a/sys/arch/mvme88k/dev/if_ie.c +++ b/sys/arch/mvme88k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.38 2006/03/25 22:41:41 djm Exp $ */ +/* $OpenBSD: if_ie.c,v 1.39 2006/04/16 00:46:32 pascoe Exp $ */ /*- * Copyright (c) 1998 Steve Murphree, Jr. @@ -940,7 +940,7 @@ ieget(sc, mp, ehp, to_bpf) { struct mbuf *m, *top, **mymp; int i; - int offset; + int offset = 0; int totlen, resid; int thismboff; int head; @@ -968,7 +968,6 @@ ieget(sc, mp, ehp, to_bpf) sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */ return -1; } - totlen -= (offset = sizeof *ehp); MGETHDR(*mp, M_DONTWAIT, MT_DATA); if (!*mp) { @@ -1155,19 +1154,10 @@ ie_readframe(sc, num) } #if NBPFILTER > 0 - /* - * Check for a BPF filter; if so, hand it up. - * Note that we have to stick an extra mbuf up front, because bpf_mtap - * expects to have the ether header at the front. - * It doesn't matter that this results in an ill-formatted mbuf chain, - * since BPF just looks at the data. (It doesn't try to free the mbuf, - * tho' it will make a copy for tcpdump.) - */ - if (bpf_gets_it) { - /* Pass it up. */ - bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh, - sizeof(eh), m, BPF_DIRECTION_IN); - } + /* Check for a BPF filter; if so, hand it up. */ + if (bpf_gets_it) + bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN); + /* * A signal passed up from the filtering code indicating that the * packet is intended for BPF but not for the protocol machinery. @@ -1190,7 +1180,7 @@ ie_readframe(sc, num) /* * Finally pass this packet up to higher layers. */ - ether_input(&sc->sc_arpcom.ac_if, &eh, m); + ether_input_mbuf(&sc->sc_arpcom.ac_if, m); } void diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c index 8e254a13a70..b0472a0cde1 100644 --- a/sys/arch/sparc/dev/if_ie.c +++ b/sys/arch/sparc/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.34 2006/03/25 22:41:41 djm Exp $ */ +/* $OpenBSD: if_ie.c,v 1.35 2006/04/16 00:46:32 pascoe Exp $ */ /* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */ /*- @@ -1114,7 +1114,7 @@ ieget(sc, mp, ehp, to_bpf) { struct mbuf *m, *top, **mymp; int i; - int offset; + int offset = 0; int totlen, resid; int thismboff; int head; @@ -1142,7 +1142,6 @@ ieget(sc, mp, ehp, to_bpf) sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */ return -1; } - totlen -= (offset = sizeof *ehp); MGETHDR(*mp, M_DONTWAIT, MT_DATA); if (!*mp) { @@ -1329,19 +1328,10 @@ ie_readframe(sc, num) } #if NBPFILTER > 0 - /* - * Check for a BPF filter; if so, hand it up. - * Note that we have to stick an extra mbuf up front, because bpf_mtap - * expects to have the ether header at the front. - * It doesn't matter that this results in an ill-formatted mbuf chain, - * since BPF just looks at the data. (It doesn't try to free the mbuf, - * tho' it will make a copy for tcpdump.) - */ - if (bpf_gets_it) { - /* Pass it up. */ - bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh, - sizeof(eh), m, BPF_DIRECTION_IN); - } + /* Check for a BPF filter; if so, hand it up. */ + if (bpf_gets_it) + bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN); + /* * A signal passed up from the filtering code indicating that the * packet is intended for BPF but not for the protocol machinery. @@ -1364,7 +1354,7 @@ ie_readframe(sc, num) /* * Finally pass this packet up to higher layers. */ - ether_input(&sc->sc_arpcom.ac_if, &eh, m); + ether_input_mbuf(&sc->sc_arpcom.ac_if, m); } static void diff --git a/sys/arch/vax/if/if_de.c b/sys/arch/vax/if/if_de.c index bfbd73839ca..9071bb95413 100644 --- a/sys/arch/vax/if/if_de.c +++ b/sys/arch/vax/if/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.18 2005/12/10 11:45:43 miod Exp $ */ +/* $OpenBSD: if_de.c,v 1.19 2006/04/16 00:46:32 pascoe Exp $ */ /* $NetBSD: if_de.c,v 1.27 1997/04/19 15:02:29 ragge Exp $ */ /* @@ -542,11 +542,6 @@ deread(ds, ifrw, len) struct ether_header *eh; struct mbuf *m; - /* - * Deal with trailer protocol: if type is trailer type - * get true type from first 16-bit word past data. - * Remember that type was trailer by setting off. - */ eh = (struct ether_header *)ifrw->ifrw_addr; if (len == 0) return; @@ -557,8 +552,17 @@ deread(ds, ifrw, len) * information to be at the front. */ m = if_ubaget(&ds->ds_deuba, ifrw, len, &ds->ds_if); - if (m) - ether_input(&ds->ds_if, eh, m); + if (m) { + /* + * XXX not exactly sure what if_ubaget does. Manually + * add the ethernet header to the start of the mbuf chain. + */ + M_PREPEND(m, sizeof(*eh), M_DONTWAIT); + if (m) { + *mtod(m, struct ether_header *) = *eh; + ether_input_mbuf(&ds->ds_if, m); + } + } } /* * Process an ioctl request. diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index 37214187496..dc9027a8c15 100644 --- a/sys/arch/vax/if/if_qe.c +++ b/sys/arch/vax/if/if_qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qe.c,v 1.19 2006/03/25 22:41:42 djm Exp $ */ +/* $OpenBSD: if_qe.c,v 1.20 2006/04/16 00:46:32 pascoe Exp $ */ /* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -581,11 +581,9 @@ qeintr(void *arg) continue; } - if ((status1 & QE_ESETUP) == 0) { - /* m_adj() the ethernet header out of the way and pass up */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); - } else + if ((status1 & QE_ESETUP) == 0) + ether_input_mbuf(ifp, m); + else m_freem(m); } diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c index e47923cc0fd..3cea80f7648 100644 --- a/sys/arch/vax/if/sgec.c +++ b/sys/arch/vax/if/sgec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sgec.c,v 1.10 2006/03/25 22:41:42 djm Exp $ */ +/* $OpenBSD: sgec.c,v 1.11 2006/04/16 00:46:32 pascoe Exp $ */ /* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -449,9 +449,7 @@ sgec_intr(sc) continue; } - /* m_adj() the ethernet header out of the way and pass up */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + ether_input_mbuf(ifp, m); } if (csr & ZE_NICSR5_TI) { -- cgit v1.2.3