summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-06-23 23:17:36 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-06-23 23:17:36 +0000
commitf139277161f7fed7cfbee0d4f2f2e8176d57e063 (patch)
tree02caa9747dc8ddc4078e082c659aff63c2c07579 /sys/dev
parent5cbca6f215a52337972ce82ec925fd7bfa799e31 (diff)
ether_input_mbuf().
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/am7990.c15
-rw-r--r--sys/dev/ic/dc.c9
-rw-r--r--sys/dev/ic/fxp.c15
-rw-r--r--sys/dev/ic/rln.c8
-rw-r--r--sys/dev/ic/rtl81x9.c8
-rw-r--r--sys/dev/ic/smc91cxx.c12
-rw-r--r--sys/dev/ic/xl.c12
7 files changed, 22 insertions, 57 deletions
diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c
index b5c24362d31..bc917ed8c89 100644
--- a/sys/dev/ic/am7990.c
+++ b/sys/dev/ic/am7990.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: am7990.c,v 1.21 2001/03/01 07:37:17 bjc Exp $ */
+/* $OpenBSD: am7990.c,v 1.22 2001/06/23 23:17:35 fgsch Exp $ */
/* $NetBSD: am7990.c,v 1.22 1996/10/13 01:37:19 christos Exp $ */
/*-
@@ -446,7 +446,6 @@ am7990_read(sc, boff, len)
int boff, len;
{
struct mbuf *m;
- struct ether_header *eh;
if (len <= sizeof(struct ether_header) ||
len > ETHERMTU + sizeof(struct ether_header)) {
@@ -467,9 +466,6 @@ am7990_read(sc, boff, len)
ifp->if_ipackets++;
- /* We assume that the header fit entirely in one mbuf. */
- eh = mtod(m, struct ether_header *);
-
#if NBPFILTER > 0
/*
* Check if there's a BPF listener on this interface.
@@ -480,6 +476,10 @@ am7990_read(sc, boff, len)
#endif
#ifdef LANCE_REVC_BUG
+ {
+ struct ether_header *eh;
+ eh = mtod(m, struct ether_header *);
+
/*
* The old LANCE (Rev. C) chips have a bug which causes
* garbage to be inserted in front of the received packet.
@@ -492,11 +492,10 @@ am7990_read(sc, boff, len)
m_freem(m);
return;
}
+ }
#endif
- /* Pass the packet up, with the ether header sort-of removed. */
- m_adj(m, sizeof(struct ether_header));
- ether_input(ifp, eh, m);
+ ether_input_mbuf(ifp, m);
}
integrate void
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c
index cf1ae9d4506..56df1a1f368 100644
--- a/sys/dev/ic/dc.c
+++ b/sys/dev/ic/dc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dc.c,v 1.27 2001/04/13 15:56:10 aaron Exp $ */
+/* $OpenBSD: dc.c,v 1.28 2001/06/23 23:17:35 fgsch Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -2020,7 +2020,6 @@ int dc_rx_resync(sc)
void dc_rxeof(sc)
struct dc_softc *sc;
{
- struct ether_header *eh;
struct mbuf *m;
struct ifnet *ifp;
struct dc_desc *cur_rx;
@@ -2099,16 +2098,12 @@ void dc_rxeof(sc)
m = m0;
ifp->if_ipackets++;
- eh = mtod(m, struct ether_header *);
#if NBPFILTER > 0
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m);
#endif
-
- /* Remove header from mbuf and pass it on. */
- m_adj(m, sizeof(struct ether_header));
- ether_input(ifp, eh, m);
+ ether_input_mbuf(ifp, m);
}
sc->dc_cdata.dc_rx_prod = i;
diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c
index 81bd01421b2..098228bc1bb 100644
--- a/sys/dev/ic/fxp.c
+++ b/sys/dev/ic/fxp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fxp.c,v 1.18 2001/06/13 23:19:17 jason Exp $ */
+/* $OpenBSD: fxp.c,v 1.19 2001/06/23 23:17:35 fgsch Exp $ */
/* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */
/*
@@ -838,7 +838,6 @@ rcvloop:
* instead.
*/
if (fxp_add_rfabuf(sc, m) == 0) {
- struct ether_header *eh;
u_int16_t total_len;
total_len = *(u_int16_t *)(rfap +
@@ -854,18 +853,12 @@ rcvloop:
}
m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = m->m_len =
- total_len -
- sizeof(struct ether_header);
- eh = mtod(m, struct ether_header *);
+ total_len;
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_tap(ifp->if_bpf,
- mtod(m, caddr_t),
- total_len);
+ bpf_mtap(ifp->if_bpf, m);
#endif /* NBPFILTER > 0 */
- m->m_data +=
- sizeof(struct ether_header);
- ether_input(ifp, eh, m);
+ ether_input_mbuf(ifp, m);
}
goto rcvloop;
}
diff --git a/sys/dev/ic/rln.c b/sys/dev/ic/rln.c
index 376983970c7..c1509effe85 100644
--- a/sys/dev/ic/rln.c
+++ b/sys/dev/ic/rln.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rln.c,v 1.9 2001/02/20 19:39:37 mickey Exp $ */
+/* $OpenBSD: rln.c,v 1.10 2001/06/23 23:17:35 fgsch Exp $ */
/*
* David Leonard <d@openbsd.org>, 1999. Public Domain.
*
@@ -497,7 +497,6 @@ rlnread(sc, hdr, len)
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *m;
- struct ether_header *eh;
u_int8_t data[1538];
u_int8_t *buf;
size_t buflen;
@@ -593,11 +592,8 @@ rlnread(sc, hdr, len)
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m);
#endif
- /* Split the ether header from the mbuf */
- eh = mtod(m, struct ether_header *);
- m_adj(m, sizeof *eh);
- ether_input(ifp, eh, m);
+ ether_input_mbuf(ifp, m);
return;
}
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c
index 2363116cf7b..6fad174afd8 100644
--- a/sys/dev/ic/rtl81x9.c
+++ b/sys/dev/ic/rtl81x9.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtl81x9.c,v 1.3 2001/05/22 11:35:16 mickey Exp $ */
+/* $OpenBSD: rtl81x9.c,v 1.4 2001/06/23 23:17:35 fgsch Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -626,7 +626,6 @@ int rl_list_tx_init(sc)
void rl_rxeof(sc)
struct rl_softc *sc;
{
- struct ether_header *eh;
struct mbuf *m;
struct ifnet *ifp;
int total_len = 0;
@@ -731,7 +730,6 @@ void rl_rxeof(sc)
if (m == NULL)
continue;
- eh = mtod(m, struct ether_header *);
ifp->if_ipackets++;
#if NBPFILTER > 0
@@ -741,9 +739,7 @@ void rl_rxeof(sc)
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m);
#endif
- /* Remove header from mbuf and pass it on. */
- m_adj(m, sizeof(struct ether_header));
- ether_input(ifp, eh, m);
+ ether_input_mbuf(ifp, m);
}
return;
diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c
index 478aef8597a..986156b765c 100644
--- a/sys/dev/ic/smc91cxx.c
+++ b/sys/dev/ic/smc91cxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc91cxx.c,v 1.9 2001/06/23 21:54:46 fgsch Exp $ */
+/* $OpenBSD: smc91cxx.c,v 1.10 2001/06/23 23:17:35 fgsch Exp $ */
/* $NetBSD: smc91cxx.c,v 1.11 1998/08/08 23:51:41 mycroft Exp $ */
/*-
@@ -846,7 +846,6 @@ 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 ether_header *eh;
struct mbuf *m;
u_int16_t status, packetno, packetlen;
u_int8_t *data;
@@ -912,7 +911,6 @@ smc91cxx_read(sc)
/*
* Pull the packet off the interface.
*/
- eh = mtod(m, struct ether_header *);
data = mtod(m, u_int8_t *);
bus_space_read_multi_2(bst, bsh, DATA_REG_W, (u_int16_t *)data,
packetlen >> 1);
@@ -932,13 +930,7 @@ smc91cxx_read(sc)
bpf_mtap(ifp->if_bpf, m);
#endif
- /*
- * Strip the ethernet header.
- */
- m->m_pkthdr.len = m->m_len = packetlen - sizeof(struct ether_header);
- m->m_data += sizeof(struct ether_header);
-
- ether_input(ifp, eh, m);
+ ether_input_mbuf(ifp, m);
out:
/*
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c
index c41f7556712..6c9726b702b 100644
--- a/sys/dev/ic/xl.c
+++ b/sys/dev/ic/xl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xl.c,v 1.23 2001/04/08 01:05:12 aaron Exp $ */
+/* $OpenBSD: xl.c,v 1.24 2001/06/23 23:17:35 fgsch Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1188,7 +1188,6 @@ int xl_rx_resync(sc)
void xl_rxeof(sc)
struct xl_softc *sc;
{
- struct ether_header *eh;
struct mbuf *m;
struct ifnet *ifp;
struct xl_chain_onefrag *cur_rx;
@@ -1246,22 +1245,17 @@ again:
}
ifp->if_ipackets++;
- eh = mtod(m, struct ether_header *);
m->m_pkthdr.rcvif = ifp;
+ m->m_pkthdr.len = m->m_len = total_len;
#if NBPFILTER > 0
/*
* Handle BPF listeners. Let the BPF user see the packet.
*/
if (ifp->if_bpf) {
- m->m_pkthdr.len = m->m_len = total_len;
bpf_mtap(ifp->if_bpf, m);
}
#endif
- /* Remove header from mbuf and pass it on. */
- m->m_pkthdr.len = m->m_len =
- total_len - sizeof(struct ether_header);
- m->m_data += sizeof(struct ether_header);
- ether_input(ifp, eh, m);
+ ether_input_mbuf(ifp, m);
}
/*