From 3013ac0eb439f3fd0de7634e6f09e40f695f05ac Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Fri, 23 Jul 2004 07:16:31 +0000 Subject: [PATCH] Unify the input handling of the low-level network stack by introducing a new field if_input in struct ifnet. Initialize if_input and if_output in the low-level _ifattach routines. Make the _output and _input routines static, they are now called via (*ifp->if_input) and (*ifp->if_output) accordingly. The exception is ether_input which is still used with the second argument, the pointer to the Ethernet header instead of always taking it from the mbuf. Move the if_attach and bpfattach from the devices into fddi_ifattach, atm_ifattach. Remove the first argument to VLAN_INPUT_TAG, the pointer to the Ethernet header. Expect it at the beginning of the mbuf. Adjust the network for the changed API. Exceptions are wl(4), le(4), ie(4), el(4), ed(4) and de(4), because they use a on-stack Ethernet header. Another exception is the ATM stack, which uses a fourth argument to atm_input. Inspired-by: NetBSd net/if.h, rev 1.36 --- sys/bus/usb/usb_ethersubr.c | 8 +--- sys/bus/usb/usb_port.h | 10 +---- sys/contrib/dev/oltr/if_oltr.c | 25 ++----------- sys/dev/atm/en/midway.c | 8 +--- sys/dev/netif/an/if_an.c | 46 +++++++---------------- sys/dev/netif/aue/if_aue.c | 3 +- sys/dev/netif/awi/awi.c | 12 +----- sys/dev/netif/axe/if_axe.c | 3 +- sys/dev/netif/bfe/if_bfe.c | 13 +++---- sys/dev/netif/bge/if_bge.c | 12 ++---- sys/dev/netif/cm/smc90cx6.c | 5 +-- sys/dev/netif/cs/if_cs.c | 13 +------ sys/dev/netif/cue/if_cue.c | 3 +- sys/dev/netif/dc/if_dc.c | 10 +---- sys/dev/netif/de/if_de.c | 3 +- sys/dev/netif/ed/if_ed.c | 11 ++---- sys/dev/netif/el/if_el.c | 3 +- sys/dev/netif/em/if_em.c | 13 ++----- sys/dev/netif/ep/if_ep.c | 8 +--- sys/dev/netif/ex/if_ex.c | 16 +------- sys/dev/netif/fe/if_fe.c | 10 +---- sys/dev/netif/fwe/if_fwe.c | 14 +------ sys/dev/netif/fxp/if_fxp.c | 5 +-- sys/dev/netif/gx/if_gx.c | 17 +++------ sys/dev/netif/ie/if_ie.c | 3 +- sys/dev/netif/kue/if_kue.c | 3 +- sys/dev/netif/le/if_le.c | 3 +- sys/dev/netif/lge/if_lge.c | 10 +---- sys/dev/netif/lnc/if_lnc.c | 33 +++++++---------- sys/dev/netif/my/if_my.c | 7 +--- sys/dev/netif/nge/if_nge.c | 18 +++------ sys/dev/netif/pcn/if_pcn.c | 9 +---- sys/dev/netif/pdq_layer/pdq_ifsubr.c | 14 ++----- sys/dev/netif/ray/if_ray.c | 7 +--- sys/dev/netif/rdp/if_rdp.c | 18 +++------ sys/dev/netif/re/if_re.c | 12 ++---- sys/dev/netif/rl/if_rl.c | 9 +---- sys/dev/netif/sbni/if_sbni.c | 12 ++---- sys/dev/netif/sbsh/if_sbsh.c | 13 +++---- sys/dev/netif/sf/if_sf.c | 9 +---- sys/dev/netif/sis/if_sis.c | 5 +-- sys/dev/netif/sk/if_sk.c | 10 +---- sys/dev/netif/sn/if_sn.c | 23 ++++-------- sys/dev/netif/snc/dp83932.c | 21 +---------- sys/dev/netif/ste/if_ste.c | 9 +---- sys/dev/netif/ti/if_ti.c | 14 ++----- sys/dev/netif/tl/if_tl.c | 9 +---- sys/dev/netif/tx/if_tx.c | 18 +++------ sys/dev/netif/txp/if_txp.c | 18 +++------ sys/dev/netif/vr/if_vr.c | 10 +---- sys/dev/netif/vx/if_vx.c | 6 +-- sys/dev/netif/wb/if_wb.c | 10 +---- sys/dev/netif/wi/if_wi.c | 38 ++++++------------- sys/dev/netif/wl/if_wl.c | 3 +- sys/dev/netif/wx/if_wx.c | 9 +---- sys/dev/netif/xe/if_xe.c | 8 ++-- sys/dev/netif/xl/if_xl.c | 10 +---- sys/net/ef/if_ef.c | 3 +- sys/net/ethernet.h | 9 ++--- sys/net/if_arc.h | 5 +-- sys/net/if_arcsubr.c | 22 +++++------ sys/net/if_atmsubr.c | 16 ++++---- sys/net/if_ethersubr.c | 34 +++++++++++------ sys/net/if_fddisubr.c | 35 ++++++++++++------ sys/net/if_iso88025subr.c | 55 ++++++++++++++++++++-------- sys/net/if_var.h | 12 +++--- sys/net/iso88025.h | 4 +- sys/net/tap/if_tap.c | 8 +--- sys/net/vlan/if_vlan.c | 11 +++--- sys/netgraph/eiface/ng_eiface.c | 25 +------------ sys/netgraph/fec/ng_fec.c | 9 +++-- sys/netinet/if_fddi.h | 5 +-- 72 files changed, 311 insertions(+), 614 deletions(-) diff --git a/sys/bus/usb/usb_ethersubr.c b/sys/bus/usb/usb_ethersubr.c index bfff1e5535..546c01a7eb 100644 --- a/sys/bus/usb/usb_ethersubr.c +++ b/sys/bus/usb/usb_ethersubr.c @@ -31,7 +31,7 @@ * * * $FreeBSD: src/sys/dev/usb/usb_ethersubr.c,v 1.17 2003/11/14 11:09:45 johan Exp $ - * $DragonFly: src/sys/bus/usb/usb_ethersubr.c,v 1.9 2004/04/21 18:13:49 dillon Exp $ + * $DragonFly: src/sys/bus/usb/usb_ethersubr.c,v 1.10 2004/07/23 07:16:24 joerg Exp $ */ /* @@ -79,7 +79,6 @@ Static int mtx_inited = 0; Static int usbintr(struct netmsg *msg) { struct mbuf *m = ((struct netmsg_packet *)msg)->nm_packet; - struct ether_header *eh; struct usb_qdat *q; struct ifnet *ifp; int s; @@ -91,12 +90,9 @@ Static int usbintr(struct netmsg *msg) IF_DEQUEUE(&usbq_rx, m); if (m == NULL) break; - eh = mtod(m, struct ether_header *); q = (struct usb_qdat *)m->m_pkthdr.rcvif; ifp = q->ifp; - m->m_pkthdr.rcvif = ifp; - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); /* Re-arm the receiver */ (*q->if_rxstart)(ifp); diff --git a/sys/bus/usb/usb_port.h b/sys/bus/usb/usb_port.h index 26cb867c9b..1ed84daf9a 100644 --- a/sys/bus/usb/usb_port.h +++ b/sys/bus/usb/usb_port.h @@ -2,7 +2,7 @@ * $OpenBSD: usb_port.h,v 1.18 2000/09/06 22:42:10 rahnds Exp $ * $NetBSD: usb_port.h,v 1.54 2002/03/28 21:49:19 ichiro Exp $ * $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.65 2003/11/09 23:54:21 joe Exp $ - * $DragonFly: src/sys/bus/usb/usb_port.h,v 1.8 2004/03/14 17:12:05 joerg Exp $ + * $DragonFly: src/sys/bus/usb/usb_port.h,v 1.9 2004/07/23 07:16:24 joerg Exp $ */ /* Also already merged from NetBSD: @@ -211,13 +211,7 @@ typedef int usb_malloc_type; #define Ether_ifattach ether_ifattach #define if_deactivate(x) -#define IF_INPUT(ifp, m) do { \ - struct ether_header *eh; \ - \ - eh = mtod(m, struct ether_header *); \ - m_adj(m, sizeof(struct ether_header)); \ - ether_input((ifp), (eh), (m)); \ -} while (0) +#define IF_INPUT(ifp, m) (*(ifp)->if_input)(ifp, m) #define usbpoll usbselect #define uhidpoll uhidselect diff --git a/sys/contrib/dev/oltr/if_oltr.c b/sys/contrib/dev/oltr/if_oltr.c index 8fd7c71933..18fb0b2006 100644 --- a/sys/contrib/dev/oltr/if_oltr.c +++ b/sys/contrib/dev/oltr/if_oltr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/contrib/dev/oltr/if_oltr.c,v 1.11.2.5 2001/10/20 04:15:21 mdodd Exp $ - * $DragonFly: src/sys/contrib/dev/oltr/Attic/if_oltr.c,v 1.13 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/contrib/dev/oltr/Attic/if_oltr.c,v 1.14 2004/07/23 07:16:24 joerg Exp $ */ #include @@ -380,7 +380,6 @@ oltr_pci_attach(device_t dev) */ ifp->if_softc = sc; if_initname(ifp, "oltr", device_get_unit(dev)); - ifp->if_output = iso88025_output; ifp->if_init = oltr_init; ifp->if_start = oltr_start; ifp->if_ioctl = oltr_ioctl; @@ -414,14 +413,9 @@ oltr_pci_attach(device_t dev) /* * Attach the interface */ - if_attach(ifp); ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; iso88025_ifattach(ifp); -#if (NBPFILTER > 0) || defined(__DragonFly__) || (__FreeBSD_version > 400000) - bpfattach(ifp, DLT_IEEE802, sizeof(struct iso88025_header)); -#endif - splx(s); return(0); @@ -656,14 +650,9 @@ oltr_pci_attach(pcici_t config_id, int unit) /* * Attach the interface */ - if_attach(ifp); ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; iso88025_ifattach(ifp); -#if (NBPFILTER > 0) || defined(__DragonFly__) || (__FreeBSD_version > 400000) - bpfattach(ifp, DLT_IEEE802, sizeof(struct iso88025_header)); -#endif - splx(s); return; @@ -1389,7 +1378,7 @@ DriverReceiveFrameCompleted(void *DriverHandle, int ByteCount, int FragmentCount struct ifnet *ifp = (struct ifnet *)&sc->arpcom.ac_if; struct mbuf *m0, *m1, *m; struct iso88025_header *th; - int frame_len = ByteCount, hdr_len, i = (int)FragmentHandle, rc, s; + int frame_len = ByteCount, i = (int)FragmentHandle, rc, s; int mbuf_offset, mbuf_size, frag_offset, copy_length; char *fragment = sc->rx_ring[RING_BUFFER(i)].data; @@ -1477,15 +1466,7 @@ DriverReceiveFrameCompleted(void *DriverHandle, int ByteCount, int FragmentCount /*}*/ ifp->if_ipackets++; - hdr_len = ISO88025_HDR_LEN; - if (th->iso88025_shost[0] & 0x80) - hdr_len += (ntohs(th->rcf) & 0x1f00) >> 8; - - m0->m_pkthdr.len -= hdr_len; - m0->m_len -= hdr_len; - m0->m_data += hdr_len; - - iso88025_input(ifp, th, m0); + (*ifp->if_input)(ifp, m0); } else { /* Receiver error */ if (ReceiveStatus != TRLLD_RCV_NO_DATA) { diff --git a/sys/dev/atm/en/midway.c b/sys/dev/atm/en/midway.c index e4c396efaa..6a4b373119 100644 --- a/sys/dev/atm/en/midway.c +++ b/sys/dev/atm/en/midway.c @@ -33,7 +33,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/en/midway.c,v 1.19.2.1 2003/01/23 21:06:42 sam Exp $ - * $DragonFly: src/sys/dev/atm/en/midway.c,v 1.10 2004/06/02 14:42:48 eirikn Exp $ + * $DragonFly: src/sys/dev/atm/en/midway.c,v 1.11 2004/07/23 07:16:24 joerg Exp $ */ /* @@ -813,13 +813,7 @@ done_probe: /* * final commit */ - - if_attach(ifp); atm_ifattach(ifp); - -#if NBPF > 0 - BPFATTACH(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc)); -#endif } diff --git a/sys/dev/netif/an/if_an.c b/sys/dev/netif/an/if_an.c index 49b3c40080..97dd07e6d4 100644 --- a/sys/dev/netif/an/if_an.c +++ b/sys/dev/netif/an/if_an.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/an/if_an.c,v 1.2.2.13 2003/02/11 03:32:48 ambrisko Exp $ - * $DragonFly: src/sys/dev/netif/an/if_an.c,v 1.12 2004/07/02 17:42:15 joerg Exp $ + * $DragonFly: src/sys/dev/netif/an/if_an.c,v 1.13 2004/07/23 07:16:24 joerg Exp $ * * $FreeBSD: src/sys/dev/an/if_an.c,v 1.2.2.13 2003/02/11 03:32:48 ambrisko Exp $ */ @@ -167,8 +167,8 @@ static void an_dma_malloc_cb (void *, bus_dma_segment_t *, int, int); static void an_stats_update (void *); static void an_setdef (struct an_softc *, struct an_req *); #ifdef ANCACHE -static void an_cache_store (struct an_softc *, struct ether_header *, - struct mbuf *, u_int8_t, u_int8_t); +static void an_cache_store (struct an_softc *, struct mbuf *, + uint8_t, uint8_t); #endif /* function definitions for use with the Cisco's Linux configuration @@ -748,7 +748,6 @@ an_attach(sc, unit, flags) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = an_ioctl; - ifp->if_output = ether_output; ifp->if_start = an_start; ifp->if_watchdog = an_watchdog; ifp->if_init = an_init; @@ -965,14 +964,12 @@ an_rxeof(sc) } ifp->if_ipackets++; - /* Receive packet. */ - m_adj(m, sizeof(struct ether_header)); #ifdef ANCACHE - an_cache_store(sc, eh, m, + an_cache_store(sc, m, rx_frame.an_rx_signal_strength, rx_frame.an_rsvd0); #endif - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } } else { /* MPI-350 */ @@ -1032,16 +1029,14 @@ an_rxeof(sc) ifp->if_ipackets++; - /* Receive packet. */ - m_adj(m, sizeof(struct ether_header)); #if 0 #ifdef ANCACHE - an_cache_store(sc, eh, m, + an_cache_store(sc, m, rx_frame.an_rx_signal_strength, rx_frame.an_rsvd0); #endif #endif - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); an_rx_desc.an_valid = 1; an_rx_desc.an_len = AN_RX_BUFFER_SIZE; @@ -2897,18 +2892,17 @@ SYSCTL_INT(_hw_an, OID_AUTO, an_cache_iponly, CTLFLAG_RW, * strength in MAC (src) indexed cache. */ static void -an_cache_store (sc, eh, m, rx_rssi, rx_quality) +an_cache_store (sc, m, rx_rssi, rx_quality) struct an_softc *sc; - struct ether_header *eh; struct mbuf *m; u_int8_t rx_rssi; u_int8_t rx_quality; { - struct ip *ip = 0; + struct ether_header *eh = mtod(m, struct ether_header *); + struct ip *ip = NULL; int i; static int cache_slot = 0; /* use this cache entry */ static int wrapindex = 0; /* next "free" cache entry */ - int type_ipv4 = 0; /* filters: * 1. ip only @@ -2916,15 +2910,10 @@ an_cache_store (sc, eh, m, rx_rssi, rx_quality) * keep multicast only. */ - if ((ntohs(eh->ether_type) == ETHERTYPE_IP)) { - type_ipv4 = 1; - } - - /* filter for ip packets only - */ - if ( an_cache_iponly && !type_ipv4) { + if ((ntohs(eh->ether_type) == ETHERTYPE_IP)) + ip = (struct ip *)(mtod(m, uint8_t *) + ETHER_HDR_LEN); + else if (an_cache_iponly) return; - } /* filter for broadcast/multicast only */ @@ -2937,13 +2926,6 @@ an_cache_store (sc, eh, m, rx_rssi, rx_quality) rx_rssi & 0xffff, rx_rssi >> 8, rx_rssi & 0xff); #endif - /* find the ip header. we want to store the ip_src - * address. - */ - if (type_ipv4) { - ip = mtod(m, struct ip *); - } - /* do a linear search for a matching MAC address * in the cache table * . MAC address is 6 bytes, @@ -3006,7 +2988,7 @@ an_cache_store (sc, eh, m, rx_rssi, rx_quality) * .mac src * .signal, etc. */ - if (type_ipv4) { + if (ip != NULL) { sc->an_sigcache[cache_slot].ipsrc = ip->ip_src.s_addr; } bcopy( eh->ether_shost, sc->an_sigcache[cache_slot].macsrc, 6); diff --git a/sys/dev/netif/aue/if_aue.c b/sys/dev/netif/aue/if_aue.c index 1182c74d7e..ffb1313ae1 100644 --- a/sys/dev/netif/aue/if_aue.c +++ b/sys/dev/netif/aue/if_aue.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_aue.c,v 1.78 2003/12/17 14:23:07 sanpei Exp $ - * $DragonFly: src/sys/dev/netif/aue/if_aue.c,v 1.12 2004/07/02 17:42:15 joerg Exp $ + * $DragonFly: src/sys/dev/netif/aue/if_aue.c,v 1.13 2004/07/23 07:16:24 joerg Exp $ * * $FreeBSD: src/sys/dev/usb/if_aue.c,v 1.19.2.18 2003/06/14 15:56:48 trhodes Exp $ */ @@ -736,7 +736,6 @@ USB_ATTACH(aue) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = aue_ioctl; - ifp->if_output = ether_output; ifp->if_start = aue_start; ifp->if_watchdog = aue_watchdog; ifp->if_init = aue_init; diff --git a/sys/dev/netif/awi/awi.c b/sys/dev/netif/awi/awi.c index eabf213ece..3882d63144 100644 --- a/sys/dev/netif/awi/awi.c +++ b/sys/dev/netif/awi/awi.c @@ -1,6 +1,6 @@ /* $NetBSD: awi.c,v 1.26 2000/07/21 04:48:55 onoe Exp $ */ /* $FreeBSD: src/sys/dev/awi/awi.c,v 1.10.2.2 2003/01/23 21:06:42 sam Exp $ */ -/* $DragonFly: src/sys/dev/netif/awi/Attic/awi.c,v 1.15 2004/07/10 12:48:55 joerg Exp $ */ +/* $DragonFly: src/sys/dev/netif/awi/Attic/awi.c,v 1.16 2004/07/23 07:16:24 joerg Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -292,7 +292,6 @@ awi_attach(sc) memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); #endif #if defined(__DragonFly__) || defined(__FreeBSD__) - ifp->if_output = ether_output; ifp->if_snd.ifq_maxlen = ifqmaxlen; memcpy(sc->sc_ec.ac_enaddr, sc->sc_mib_addr.aMAC_Address, ETHER_ADDR_LEN); @@ -1181,9 +1180,6 @@ awi_input(sc, m, rxts, rssi) { struct ifnet *ifp = sc->sc_ifp; struct ieee80211_frame *wh; -#ifndef __NetBSD__ - struct ether_header *eh; -#endif /* trim CRC here for WEP can find its own CRC at the end of packet. */ m_adj(m, -ETHER_CRC_LEN); @@ -1241,13 +1237,7 @@ awi_input(sc, m, rxts, rssi) #if !(defined(__DragonFly__) || (defined(__FreeBSD__) && __FreeBSD__ >= 4)) AWI_BPF_MTAP(sc, m, AWI_BPF_NORM); #endif -#ifdef __NetBSD__ (*ifp->if_input)(ifp, m); -#else - eh = mtod(m, struct ether_header *); - m_adj(m, sizeof(*eh)); - ether_input(ifp, eh, m); -#endif break; case IEEE80211_FC0_TYPE_MGT: if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) != diff --git a/sys/dev/netif/axe/if_axe.c b/sys/dev/netif/axe/if_axe.c index 718cc36c77..81555bcbc6 100644 --- a/sys/dev/netif/axe/if_axe.c +++ b/sys/dev/netif/axe/if_axe.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_axe.c,v 1.10 2003/12/08 07:54:14 obrien Exp $ - * $DragonFly: src/sys/dev/netif/axe/if_axe.c,v 1.4 2004/07/02 17:42:16 joerg Exp $ + * $DragonFly: src/sys/dev/netif/axe/if_axe.c,v 1.5 2004/07/23 07:16:24 joerg Exp $ */ /* * ASIX Electronics AX88172 USB 2.0 ethernet driver. Used in the @@ -497,7 +497,6 @@ USB_ATTACH(axe) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = axe_ioctl; - ifp->if_output = ether_output; ifp->if_start = axe_start; ifp->if_watchdog = axe_watchdog; ifp->if_init = axe_init; diff --git a/sys/dev/netif/bfe/if_bfe.c b/sys/dev/netif/bfe/if_bfe.c index bad9566a48..fc0bae9629 100644 --- a/sys/dev/netif/bfe/if_bfe.c +++ b/sys/dev/netif/bfe/if_bfe.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/bfe/if_bfe.c 1.4.4.7 2004/03/02 08:41:33 julian Exp v - * $DragonFly: src/sys/dev/netif/bfe/if_bfe.c,v 1.6 2004/07/02 17:42:16 joerg Exp $ + * $DragonFly: src/sys/dev/netif/bfe/if_bfe.c,v 1.7 2004/07/23 07:16:24 joerg Exp $ */ #include @@ -374,7 +374,6 @@ bfe_attach(device_t dev) if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = bfe_ioctl; - ifp->if_output = ether_output; ifp->if_start = bfe_start; ifp->if_watchdog = bfe_watchdog; ifp->if_init = bfe_init; @@ -1131,20 +1130,20 @@ bfe_rxeof(struct bfe_softc *sc) } /* Go past the rx header */ - if (bfe_list_newbuf(sc, cons, NULL) == 0) { - m_adj(m, BFE_RX_OFFSET); - m->m_len = m->m_pkthdr.len = len; - } else { + if (bfe_list_newbuf(sc, cons, NULL) != 0) { bfe_list_newbuf(sc, cons, m); BFE_INC(cons, BFE_RX_LIST_CNT); ifp->if_ierrors++; continue; } + m_adj(m, BFE_RX_OFFSET); + m->m_len = m->m_pkthdr.len = len; + ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; - ether_input(ifp, NULL, m); + (*ifp->if_input)(ifp, m); BFE_INC(cons, BFE_RX_LIST_CNT); } sc->bfe_rx_cons = cons; diff --git a/sys/dev/netif/bge/if_bge.c b/sys/dev/netif/bge/if_bge.c index be3112f2cb..63893b620c 100644 --- a/sys/dev/netif/bge/if_bge.c +++ b/sys/dev/netif/bge/if_bge.c @@ -31,7 +31,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/bge/if_bge.c,v 1.3.2.29 2003/12/01 21:06:59 ambrisko Exp $ - * $DragonFly: src/sys/dev/netif/bge/if_bge.c,v 1.21 2004/07/02 17:42:16 joerg Exp $ + * $DragonFly: src/sys/dev/netif/bge/if_bge.c,v 1.22 2004/07/23 07:16:24 joerg Exp $ * */ @@ -1810,7 +1810,6 @@ bge_attach(dev) if_initname(ifp, "bge", sc->bge_unit); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = bge_ioctl; - ifp->if_output = ether_output; ifp->if_start = bge_start; ifp->if_watchdog = bge_watchdog; ifp->if_init = bge_init; @@ -2071,7 +2070,6 @@ bge_rxeof(sc) sc->bge_rdata->bge_status_block.bge_idx[0].bge_rx_prod_idx) { struct bge_rx_bd *cur_rx; u_int32_t rxidx; - struct ether_header *eh; struct mbuf *m = NULL; u_int16_t vlan_tag = 0; int have_tag = 0; @@ -2133,13 +2131,9 @@ bge_rxeof(sc) m->m_data += ETHER_ALIGN; } #endif - eh = mtod(m, struct ether_header *); m->m_pkthdr.len = m->m_len = cur_rx->bge_len - ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - #if 0 /* currently broken for some packets, possibly related to TCP options */ if (ifp->if_hwassist) { m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; @@ -2158,12 +2152,12 @@ bge_rxeof(sc) * to vlan_input() instead of ether_input(). */ if (have_tag) { - VLAN_INPUT_TAG(eh, m, vlan_tag); + VLAN_INPUT_TAG(m, vlan_tag); have_tag = vlan_tag = 0; continue; } - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } CSR_WRITE_4(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx); diff --git a/sys/dev/netif/cm/smc90cx6.c b/sys/dev/netif/cm/smc90cx6.c index 3eb39155e7..b73f2a57a4 100644 --- a/sys/dev/netif/cm/smc90cx6.c +++ b/sys/dev/netif/cm/smc90cx6.c @@ -1,6 +1,6 @@ /* $NetBSD: smc90cx6.c,v 1.38 2001/07/07 15:57:53 thorpej Exp $ */ /* $FreeBSD: src/sys/dev/cm/smc90cx6.c,v 1.1.2.3 2003/02/05 18:42:14 fjoe Exp $ */ -/* $DragonFly: src/sys/dev/netif/cm/Attic/smc90cx6.c,v 1.9 2004/06/02 14:42:49 eirikn Exp $ */ +/* $DragonFly: src/sys/dev/netif/cm/Attic/smc90cx6.c,v 1.10 2004/07/23 07:16:25 joerg Exp $ */ /*- * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. @@ -314,7 +314,6 @@ cm_attach(dev) ifp->if_softc = sc; if_initname(ifp, "cm", device_get_unit(dev)); - ifp->if_output = arc_output; ifp->if_start = cm_start; ifp->if_ioctl = cm_ioctl; ifp->if_watchdog = cm_watchdog; @@ -692,7 +691,7 @@ cm_srint(vsc) rman_get_bustag(sc->mem_res), rman_get_bushandle(sc->mem_res), cm_ram_ptr + offset, mtod(m, u_char *) + 2, len); - arc_input(ifp, m); + (*ifp->if_input)(ifp, m); m = NULL; ifp->if_ipackets++; diff --git a/sys/dev/netif/cs/if_cs.c b/sys/dev/netif/cs/if_cs.c index 0aaf3f786d..40e7f41a6e 100644 --- a/sys/dev/netif/cs/if_cs.c +++ b/sys/dev/netif/cs/if_cs.c @@ -28,7 +28,7 @@ /* * $FreeBSD: src/sys/dev/cs/if_cs.c,v 1.19.2.1 2001/01/25 20:13:48 imp Exp $ - * $DragonFly: src/sys/dev/netif/cs/if_cs.c,v 1.10 2004/07/02 17:42:16 joerg Exp $ + * $DragonFly: src/sys/dev/netif/cs/if_cs.c,v 1.11 2004/07/23 07:16:25 joerg Exp $ * * Device driver for Crystal Semiconductor CS8920 based ethernet * adapters. By Maxim Bolotin and Oleg Sharoiko, 27-April-1997 @@ -590,7 +590,6 @@ cs_attach(device_t dev) ifp->if_softc=sc; if_initname(ifp, "cs", device_get_unit(dev)); - ifp->if_output=ether_output; ifp->if_start=cs_start; ifp->if_ioctl=cs_ioctl; ifp->if_watchdog=cs_watchdog; @@ -766,7 +765,6 @@ cs_get_packet(struct cs_softc *sc) { struct ifnet *ifp = &(sc->arpcom.ac_if); int iobase = sc->nic_addr, status, length; - struct ether_header *eh; struct mbuf *m; #ifdef CS_DEBUG @@ -809,8 +807,6 @@ cs_get_packet(struct cs_softc *sc) /* Get the data */ insw(iobase + RX_FRAME_PORT, m->m_data, (length+1)>>1); - eh = mtod(m, struct ether_header *); - #ifdef CS_DEBUG for (i=0;im_data+i))); @@ -819,12 +815,7 @@ cs_get_packet(struct cs_softc *sc) if (status & (RX_IA | RX_BROADCAST) || (ifp->if_flags & IFF_MULTICAST && status & RX_HASHED)) { - m->m_pkthdr.len -= sizeof(struct ether_header); - m->m_len -= sizeof(struct ether_header); - m->m_data += sizeof(struct ether_header); - - /* Feed the packet to the upper layer */ - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); ifp->if_ipackets++; diff --git a/sys/dev/netif/cue/if_cue.c b/sys/dev/netif/cue/if_cue.c index 09e68316da..8fd0eb1b8f 100644 --- a/sys/dev/netif/cue/if_cue.c +++ b/sys/dev/netif/cue/if_cue.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_cue.c,v 1.45 2003/12/08 07:54:14 obrien Exp $ - * $DragonFly: src/sys/dev/netif/cue/if_cue.c,v 1.12 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/dev/netif/cue/if_cue.c,v 1.13 2004/07/23 07:16:25 joerg Exp $ * */ @@ -514,7 +514,6 @@ USB_ATTACH(cue) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = cue_ioctl; - ifp->if_output = ether_output; ifp->if_start = cue_start; ifp->if_watchdog = cue_watchdog; ifp->if_init = cue_init; diff --git a/sys/dev/netif/dc/if_dc.c b/sys/dev/netif/dc/if_dc.c index 2d9fe9dbe9..0e69ba2cb3 100644 --- a/sys/dev/netif/dc/if_dc.c +++ b/sys/dev/netif/dc/if_dc.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_dc.c,v 1.9.2.45 2003/06/08 14:31:53 mux Exp $ - * $DragonFly: src/sys/dev/netif/dc/if_dc.c,v 1.15 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/dev/netif/dc/if_dc.c,v 1.16 2004/07/23 07:16:25 joerg Exp $ * * $FreeBSD: src/sys/pci/if_dc.c,v 1.9.2.45 2003/06/08 14:31:53 mux Exp $ */ @@ -2058,7 +2058,6 @@ static int dc_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = dc_ioctl; - ifp->if_output = ether_output; ifp->if_start = dc_start; ifp->if_watchdog = dc_watchdog; ifp->if_init = dc_init; @@ -2468,7 +2467,6 @@ static int dc_rx_resync(sc) static void dc_rxeof(sc) struct dc_softc *sc; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct dc_desc *cur_rx; @@ -2569,11 +2567,7 @@ static void dc_rxeof(sc) } ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); - - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } sc->dc_cdata.dc_rx_prod = i; diff --git a/sys/dev/netif/de/if_de.c b/sys/dev/netif/de/if_de.c index c38d3d1c2f..1201e53df7 100644 --- a/sys/dev/netif/de/if_de.c +++ b/sys/dev/netif/de/if_de.c @@ -1,7 +1,7 @@ /* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */ /* $FreeBSD: src/sys/pci/if_de.c,v 1.123.2.4 2000/08/04 23:25:09 peter Exp $ */ -/* $DragonFly: src/sys/dev/netif/de/if_de.c,v 1.14 2004/07/17 09:43:05 joerg Exp $ */ +/* $DragonFly: src/sys/dev/netif/de/if_de.c,v 1.15 2004/07/23 07:16:25 joerg Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -4846,7 +4846,6 @@ tulip_attach( ifp->if_start = tulip_ifstart; ifp->if_watchdog = tulip_ifwatchdog; ifp->if_timer = 1; - ifp->if_output = ether_output; printf("%s%d: %s%s pass %d.%d%s\n", sc->tulip_name, sc->tulip_unit, diff --git a/sys/dev/netif/ed/if_ed.c b/sys/dev/netif/ed/if_ed.c index 870c3c786e..ea363083d0 100644 --- a/sys/dev/netif/ed/if_ed.c +++ b/sys/dev/netif/ed/if_ed.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ed/if_ed.c,v 1.224 2003/12/08 07:54:12 obrien Exp $ - * $DragonFly: src/sys/dev/netif/ed/if_ed.c,v 1.14 2004/07/02 17:42:16 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ed/if_ed.c,v 1.15 2004/07/23 07:16:25 joerg Exp $ */ /* @@ -1723,7 +1723,6 @@ ed_attach(device_t dev) */ ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_output = ether_output; ifp->if_mtu = ETHERMTU; ifp->if_start = ed_start; ifp->if_ioctl = ed_ioctl; @@ -2851,13 +2850,9 @@ ed_get_packet(sc, buf, len) */ ed_ring_copy(sc, buf, (char *)eh, len); - /* - * Remove link layer address. - */ - m->m_pkthdr.len = m->m_len = len - sizeof(struct ether_header); - m->m_data += sizeof(struct ether_header); + m->m_pkthdr.len = m->m_len = len; - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } /* diff --git a/sys/dev/netif/el/if_el.c b/sys/dev/netif/el/if_el.c index a44f4906b6..af78efc9ae 100644 --- a/sys/dev/netif/el/if_el.c +++ b/sys/dev/netif/el/if_el.c @@ -7,7 +7,7 @@ * Questions, comments, bug reports and fixes to kimmel@cs.umass.edu. * * $FreeBSD: src/sys/i386/isa/if_el.c,v 1.47.2.2 2000/07/17 21:24:30 archie Exp $ - * $DragonFly: src/sys/dev/netif/el/if_el.c,v 1.10 2004/07/02 17:42:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/el/if_el.c,v 1.11 2004/07/23 07:16:25 joerg Exp $ */ /* Except of course for the portions of code lifted from other FreeBSD * drivers (mainly elread, elget and el_ioctl) @@ -187,7 +187,6 @@ el_attach(struct isa_device *idev) ifp->if_softc = sc; if_initname(ifp, "el", idev->id_unit); ifp->if_mtu = ETHERMTU; - ifp->if_output = ether_output; ifp->if_start = el_start; ifp->if_ioctl = el_ioctl; ifp->if_watchdog = el_watchdog; diff --git a/sys/dev/netif/em/if_em.c b/sys/dev/netif/em/if_em.c index 4f2cb71407..5ab3425cc7 100644 --- a/sys/dev/netif/em/if_em.c +++ b/sys/dev/netif/em/if_em.c @@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ /*$FreeBSD: src/sys/dev/em/if_em.c,v 1.2.2.15 2003/06/09 22:10:15 pdeuskar Exp $*/ -/*$DragonFly: src/sys/dev/netif/em/if_em.c,v 1.18 2004/06/05 13:52:29 joerg Exp $*/ +/*$DragonFly: src/sys/dev/netif/em/if_em.c,v 1.19 2004/07/23 07:16:25 joerg Exp $*/ #include @@ -1642,7 +1642,6 @@ em_setup_interface(device_t dev, struct adapter *adapter) ifp = &adapter->interface_data.ac_if; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_mtu = ETHERMTU; - ifp->if_output = ether_output; ifp->if_baudrate = 1000000000; ifp->if_init = em_init; ifp->if_softc = adapter; @@ -2429,9 +2428,6 @@ em_process_receive_interrupts(struct adapter *adapter, int count) { struct ifnet *ifp; struct mbuf *mp; -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - struct ether_header *eh; -#endif uint8_t accept_frame = 0; uint8_t eop = 0; uint16_t len, desc_len, prev_len_adj; @@ -2536,17 +2532,14 @@ em_process_receive_interrupts(struct adapter *adapter, int count) ifp->if_ipackets++; #if defined(__DragonFly__) || __FreeBSD_version < 500000 - eh = mtod(adapter->fmp, struct ether_header *); - /* Remove ethernet header from mbuf */ - m_adj(adapter->fmp, sizeof(struct ether_header)); em_receive_checksum(adapter, current_desc, adapter->fmp); if (current_desc->status & E1000_RXD_STAT_VP) - VLAN_INPUT_TAG(eh, adapter->fmp, + VLAN_INPUT_TAG(adapter->fmp, (current_desc->special & E1000_RXD_SPC_VLAN_MASK)); else - ether_input(ifp, eh, adapter->fmp); + (*ifp->if_input)(ifp, adapter->fmp); #else em_receive_checksum(adapter, current_desc, adapter->fmp); diff --git a/sys/dev/netif/ep/if_ep.c b/sys/dev/netif/ep/if_ep.c index c0adfd6e51..2047f995bd 100644 --- a/sys/dev/netif/ep/if_ep.c +++ b/sys/dev/netif/ep/if_ep.c @@ -39,7 +39,7 @@ /* * $FreeBSD: src/sys/dev/ep/if_ep.c,v 1.95.2.3 2002/03/06 07:26:35 imp Exp $ - * $DragonFly: src/sys/dev/netif/ep/if_ep.c,v 1.11 2004/07/02 17:42:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ep/if_ep.c,v 1.12 2004/07/23 07:16:26 joerg Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -292,7 +292,6 @@ ep_attach(sc) if_initname(ifp, "ep", sc->unit); ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_output = ether_output; ifp->if_start = ep_if_start; ifp->if_ioctl = ep_if_ioctl; ifp->if_watchdog = ep_if_watchdog; @@ -663,7 +662,6 @@ static void epread(sc) struct ep_softc *sc; { - struct ether_header *eh; struct mbuf *top, *mcur, *m; struct ifnet *ifp; int lenthisone; @@ -771,9 +769,7 @@ read_again: top->m_pkthdr.rcvif = &sc->arpcom.ac_if; top->m_pkthdr.len = sc->cur_len; - eh = mtod(top, struct ether_header *); - m_adj(top, sizeof(struct ether_header)); - ether_input(ifp, eh, top); + (*ifp->if_input)(ifp, top); sc->top = 0; while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | RX_INIT_EARLY_THRESH); diff --git a/sys/dev/netif/ex/if_ex.c b/sys/dev/netif/ex/if_ex.c index 60ff4fefd1..401029c57e 100644 --- a/sys/dev/netif/ex/if_ex.c +++ b/sys/dev/netif/ex/if_ex.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ex/if_ex.c,v 1.26.2.3 2001/03/05 05:33:20 imp Exp $ - * $DragonFly: src/sys/dev/netif/ex/if_ex.c,v 1.11 2004/07/02 17:42:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ex/if_ex.c,v 1.12 2004/07/23 07:16:26 joerg Exp $ * * MAINTAINER: Matthew N. Dodd * @@ -239,7 +239,6 @@ ex_attach(device_t dev) if_initname(ifp, "ex", unit); ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST /* XXX not done yet. | IFF_MULTICAST */; - ifp->if_output = ether_output; ifp->if_start = ex_start; ifp->if_ioctl = ex_ioctl; ifp->if_watchdog = ex_watchdog; @@ -676,7 +675,6 @@ ex_rx_intr(struct ex_softc *sc) int QQQ; struct mbuf * m; struct mbuf * ipkt; - struct ether_header * eh; DODEBUG(Start_End, printf("ex_rx_intr%d: start\n", unit);); @@ -743,17 +741,7 @@ ex_rx_intr(struct ex_softc *sc) m->m_len = MLEN; } } - eh = mtod(ipkt, struct ether_header *); -#ifdef EXDEBUG - if (debug_mask & Rcvd_Pkts) { - if ((eh->ether_dhost[5] != 0xff) || (eh->ether_dhost[0] != 0xff)) { - printf("Receive packet with %d data bytes: %6D -> ", QQQ, eh->ether_shost, ":"); - printf("%6D\n", eh->ether_dhost, ":"); - } /* QQQ */ - } -#endif - m_adj(ipkt, sizeof(struct ether_header)); - ether_input(ifp, eh, ipkt); + (*ifp->if_input)(ifp, ipkt); ifp->if_ipackets++; } } else { diff --git a/sys/dev/netif/fe/if_fe.c b/sys/dev/netif/fe/if_fe.c index 6bb28dc07f..17e9790715 100644 --- a/sys/dev/netif/fe/if_fe.c +++ b/sys/dev/netif/fe/if_fe.c @@ -22,7 +22,7 @@ /* * $FreeBSD: src/sys/dev/fe/if_fe.c,v 1.65.2.1 2000/09/22 10:01:47 nyan Exp $ - * $DragonFly: src/sys/dev/netif/fe/if_fe.c,v 1.10 2004/07/02 17:42:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/fe/if_fe.c,v 1.11 2004/07/23 07:16:26 joerg Exp $ * * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. * Contributed by M. Sekiguchi. @@ -755,7 +755,6 @@ fe_attach (device_t dev) */ sc->sc_if.if_softc = sc; if_initname(&(sc->sc_if), "fe", sc->sc_unit); - sc->sc_if.if_output = ether_output; sc->sc_if.if_start = fe_start; sc->sc_if.if_ioctl = fe_ioctl; sc->sc_if.if_watchdog = fe_watchdog; @@ -1917,13 +1916,8 @@ fe_get_packet (struct fe_softc * sc, u_short len) fe_insw(sc, FE_BMPR8, (u_int16_t *)eh, (len + 1) >> 1); } - /* Strip off the Ethernet header. */ - m->m_pkthdr.len -= sizeof (struct ether_header); - m->m_len -= sizeof (struct ether_header); - m->m_data += sizeof (struct ether_header); - /* Feed the packet to upper layer. */ - ether_input(&sc->sc_if, eh, m); + (*sc->sc_if.if_input)(&sc->sc_if, m); return 0; } diff --git a/sys/dev/netif/fwe/if_fwe.c b/sys/dev/netif/fwe/if_fwe.c index 175e517815..9106dfa452 100644 --- a/sys/dev/netif/fwe/if_fwe.c +++ b/sys/dev/netif/fwe/if_fwe.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/if_fwe.c,v 1.27 2004/01/08 14:58:09 simokawa Exp $ - * $DragonFly: src/sys/dev/netif/fwe/if_fwe.c,v 1.11 2004/06/02 14:42:51 eirikn Exp $ + * $DragonFly: src/sys/dev/netif/fwe/if_fwe.c,v 1.12 2004/07/23 07:16:26 joerg Exp $ */ #include "opt_inet.h" @@ -211,7 +211,6 @@ fwe_attach(device_t dev) ifp->if_name = "fwe"; #endif ifp->if_init = fwe_init; - ifp->if_output = ether_output; ifp->if_start = fwe_start; ifp->if_ioctl = fwe_ioctl; ifp->if_mtu = ETHERMTU; @@ -578,9 +577,6 @@ fwe_as_input(struct fw_xferq *xferq) struct fw_bulkxfer *sxfer; struct fw_pkt *fp; u_char *c; -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - struct ether_header *eh; -#endif fwe = (struct fwe_softc *)xferq->sc; ifp = &fwe->fwe_if; @@ -611,10 +607,6 @@ fwe_as_input(struct fw_xferq *xferq) m->m_data += HDR_LEN + ETHER_ALIGN; c = mtod(m, char *); -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - eh = (struct ether_header *)c; - m->m_data += sizeof(struct ether_header); -#endif m->m_len = m->m_pkthdr.len = fp->mode.stream.len - ETHER_ALIGN; m->m_pkthdr.rcvif = ifp; @@ -633,11 +625,7 @@ fwe_as_input(struct fw_xferq *xferq) c[20], c[21], c[22], c[23] ); #endif -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - ether_input(ifp, eh, m); -#else (*ifp->if_input)(ifp, m); -#endif ifp->if_ipackets ++; } if (STAILQ_FIRST(&xferq->stfree) != NULL) diff --git a/sys/dev/netif/fxp/if_fxp.c b/sys/dev/netif/fxp/if_fxp.c index 5733c04ae2..71f06e0c73 100644 --- a/sys/dev/netif/fxp/if_fxp.c +++ b/sys/dev/netif/fxp/if_fxp.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.110.2.30 2003/06/12 16:47:05 mux Exp $ - * $DragonFly: src/sys/dev/netif/fxp/if_fxp.c,v 1.13 2004/07/02 17:42:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/fxp/if_fxp.c,v 1.14 2004/07/23 07:16:26 joerg Exp $ */ /* @@ -650,7 +650,6 @@ fxp_attach(device_t dev) ifp = &sc->arpcom.ac_if; if_initname(ifp, "fxp", device_get_unit(dev)); - ifp->if_output = ether_output; ifp->if_baudrate = 100000000; ifp->if_init = fxp_init; ifp->if_softc = sc; @@ -1365,7 +1364,7 @@ fxp_intr_body(struct fxp_softc *sc, u_int8_t statack, int count) continue; } m->m_pkthdr.len = m->m_len = total_len; - ether_input(ifp, NULL, m); + (*ifp->if_input)(ifp, m); } } if (rnr) { diff --git a/sys/dev/netif/gx/if_gx.c b/sys/dev/netif/gx/if_gx.c index bf268ec057..c870c665ba 100644 --- a/sys/dev/netif/gx/if_gx.c +++ b/sys/dev/netif/gx/if_gx.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/gx/if_gx.c,v 1.2.2.3 2001/12/14 19:51:39 jlemon Exp $ - * $DragonFly: src/sys/dev/netif/gx/Attic/if_gx.c,v 1.9 2004/07/02 17:42:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/gx/Attic/if_gx.c,v 1.10 2004/07/23 07:16:26 joerg Exp $ */ #include @@ -341,7 +341,6 @@ gx_attach(device_t dev) if_initname(ifp, "gx", device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = gx_ioctl; - ifp->if_output = ether_output; ifp->if_start = gx_start; ifp->if_watchdog = gx_watchdog; ifp->if_init = gx_init; @@ -1219,7 +1218,6 @@ gx_setmulti(struct gx_softc *gx) static void gx_rxeof(struct gx_softc *gx) { - struct ether_header *eh; struct gx_rx_desc *rx; struct ifnet *ifp; int idx, staterr, len; @@ -1285,12 +1283,8 @@ gx_rxeof(struct gx_softc *gx) } ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); m->m_pkthdr.rcvif = ifp; - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - #define IP_CSMASK (GX_RXSTAT_IGNORE_CSUM | GX_RXSTAT_HAS_IP_CSUM) #define TCP_CSMASK \ (GX_RXSTAT_IGNORE_CSUM | GX_RXSTAT_HAS_TCP_CSUM | GX_RXERR_TCP_CSUM) @@ -1317,11 +1311,10 @@ gx_rxeof(struct gx_softc *gx) * If we received a packet with a vlan tag, pass it * to vlan_input() instead of ether_input(). */ - if (staterr & GX_RXSTAT_VLAN_PKT) { - VLAN_INPUT_TAG(eh, m, rx->rx_special); - continue; - } - ether_input(ifp, eh, m); + if (staterr & GX_RXSTAT_VLAN_PKT) + VLAN_INPUT_TAG(m, rx->rx_special); + else + (*ifp->if_input)(ifp, m); continue; ierror: diff --git a/sys/dev/netif/ie/if_ie.c b/sys/dev/netif/ie/if_ie.c index f079777bcf..47c8582bb8 100644 --- a/sys/dev/netif/ie/if_ie.c +++ b/sys/dev/netif/ie/if_ie.c @@ -48,7 +48,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ie/if_ie.c,v 1.72.2.4 2003/03/27 21:01:49 mdodd Exp $ - * $DragonFly: src/sys/dev/netif/ie/if_ie.c,v 1.13 2004/07/02 17:42:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ie/if_ie.c,v 1.14 2004/07/23 07:16:26 joerg Exp $ */ /* @@ -815,7 +815,6 @@ ieattach(struct isa_device *dvp) ie->hard_vers + 1); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_output = ether_output; ifp->if_start = iestart; ifp->if_ioctl = ieioctl; ifp->if_init = ieinit; diff --git a/sys/dev/netif/kue/if_kue.c b/sys/dev/netif/kue/if_kue.c index c051b015a6..6b976f342b 100644 --- a/sys/dev/netif/kue/if_kue.c +++ b/sys/dev/netif/kue/if_kue.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_kue.c,v 1.17.2.9 2003/04/13 02:39:25 murray Exp $ - * $DragonFly: src/sys/dev/netif/kue/if_kue.c,v 1.11 2004/07/02 17:42:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/kue/if_kue.c,v 1.12 2004/07/23 07:16:26 joerg Exp $ */ /* @@ -482,7 +482,6 @@ USB_ATTACH(kue) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = kue_ioctl; - ifp->if_output = ether_output; ifp->if_start = kue_start; ifp->if_watchdog = kue_watchdog; ifp->if_init = kue_init; diff --git a/sys/dev/netif/le/if_le.c b/sys/dev/netif/le/if_le.c index 153b192743..0b4097315c 100644 --- a/sys/dev/netif/le/if_le.c +++ b/sys/dev/netif/le/if_le.c @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/if_le.c,v 1.56.2.4 2002/06/05 23:24:10 paul Exp $ - * $DragonFly: src/sys/dev/netif/le/if_le.c,v 1.14 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/dev/netif/le/if_le.c,v 1.15 2004/07/23 07:16:26 joerg Exp $ */ /* @@ -345,7 +345,6 @@ le_attach( ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_output = ether_output; ifp->if_ioctl = le_ioctl; ifp->if_type = IFT_ETHER; ifp->if_addrlen = 6; diff --git a/sys/dev/netif/lge/if_lge.c b/sys/dev/netif/lge/if_lge.c index b459bc4f37..a6faf2e3d5 100644 --- a/sys/dev/netif/lge/if_lge.c +++ b/sys/dev/netif/lge/if_lge.c @@ -31,7 +31,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/lge/if_lge.c,v 1.5.2.2 2001/12/14 19:49:23 jlemon Exp $ - * $DragonFly: src/sys/dev/netif/lge/if_lge.c,v 1.12 2004/07/02 17:42:18 joerg Exp $ + * $DragonFly: src/sys/dev/netif/lge/if_lge.c,v 1.13 2004/07/23 07:16:27 joerg Exp $ * * $FreeBSD: src/sys/dev/lge/if_lge.c,v 1.5.2.2 2001/12/14 19:49:23 jlemon Exp $ */ @@ -635,7 +635,6 @@ static int lge_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = lge_ioctl; - ifp->if_output = ether_output; ifp->if_start = lge_start; ifp->if_watchdog = lge_watchdog; ifp->if_init = lge_init; @@ -1011,7 +1010,6 @@ static void lge_rxeof(sc, cnt) struct lge_softc *sc; int cnt; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct lge_rx_desc *cur_rx; @@ -1068,10 +1066,6 @@ static void lge_rxeof(sc, cnt) } ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); - - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); /* Do IP checksum checking. */ if (rxsts & LGE_RXSTS_ISIP) @@ -1087,7 +1081,7 @@ static void lge_rxeof(sc, cnt) m->m_pkthdr.csum_data = 0xffff; } - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } sc->lge_cdata.lge_rx_cons = i; diff --git a/sys/dev/netif/lnc/if_lnc.c b/sys/dev/netif/lnc/if_lnc.c index 0e1d634d3d..be8b7f8f36 100644 --- a/sys/dev/netif/lnc/if_lnc.c +++ b/sys/dev/netif/lnc/if_lnc.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/lnc/if_lnc.c,v 1.89 2001/07/04 13:00:19 nyan Exp $ - * $DragonFly: src/sys/dev/netif/lnc/Attic/if_lnc.c,v 1.11 2004/07/02 17:42:18 joerg Exp $ + * $DragonFly: src/sys/dev/netif/lnc/Attic/if_lnc.c,v 1.12 2004/07/23 07:16:27 joerg Exp $ */ /* @@ -450,6 +450,7 @@ mbuf_packet(struct lnc_softc *sc, int start_of_packet, int pkt_len) static __inline void lnc_rint(struct lnc_softc *sc) { + struct ifnet *ifp = &sc->arpcom.ac_if; struct host_ring_entry *next, *start; int start_of_packet; struct mbuf *head; @@ -469,13 +470,13 @@ lnc_rint(struct lnc_softc *sc) #ifdef DIAGNOSTIC if ((sc->recv_ring + sc->recv_next)->md->md1 & OWN) { - int unit = sc->arpcom.ac_if.if_dunit; + int unit = ifp->if_dunit; log(LOG_ERR, "lnc%d: Receive interrupt with buffer still owned by controller -- Resetting\n", unit); lnc_reset(sc); return; } if (!((sc->recv_ring + sc->recv_next)->md->md1 & STP)) { - int unit = sc->arpcom.ac_if.if_dunit; + int unit = ifp->if_dunit; log(LOG_ERR, "lnc%d: Receive interrupt but not start of packet -- Resetting\n", unit); lnc_reset(sc); return; @@ -507,7 +508,7 @@ lnc_rint(struct lnc_softc *sc) } while (!(flags & (STP | OWN | ENP | MDERR))); if (flags & STP) { - int unit = sc->arpcom.ac_if.if_dunit; + int unit = ifp->if_dunit; log(LOG_ERR, "lnc%d: Start of packet found before end of previous in receive ring -- Resetting\n", unit); lnc_reset(sc); return; @@ -521,7 +522,7 @@ lnc_rint(struct lnc_softc *sc) sc->recv_next = start_of_packet; break; } else { - int unit = sc->arpcom.ac_if.if_dunit; + int unit = ifp->if_dunit; log(LOG_ERR, "lnc%d: End of received packet not found-- Resetting\n", unit); lnc_reset(sc); return; @@ -536,7 +537,7 @@ lnc_rint(struct lnc_softc *sc) next = sc->recv_ring + sc->recv_next; if (flags & MDERR) { - int unit = sc->arpcom.ac_if.if_dunit; + int unit = ifp->if_dunit; if (flags & RBUFF) { LNCSTATS(rbuff) log(LOG_ERR, "lnc%d: Receive buffer error\n", unit); @@ -548,7 +549,7 @@ lnc_rint(struct lnc_softc *sc) log(LOG_ERR, "lnc%d: Receive overflow error \n", unit); } } else if (flags & ENP) { - if ((sc->arpcom.ac_if.if_flags & IFF_PROMISC)==0) { + if ((ifp->if_flags & IFF_PROMISC)==0) { /* * FRAM and CRC are valid only if ENP * is set and OFLO is not. @@ -569,7 +570,7 @@ lnc_rint(struct lnc_softc *sc) /* Drop packet */ LNCSTATS(rerr) - sc->arpcom.ac_if.if_ierrors++; + ifp->if_ierrors++; while (start_of_packet != sc->recv_next) { start = sc->recv_ring + start_of_packet; start->md->md2 = -RECVBUFSIZE; /* XXX - shouldn't be necessary */ @@ -579,7 +580,7 @@ lnc_rint(struct lnc_softc *sc) } } else { /* Valid packet */ - sc->arpcom.ac_if.if_ipackets++; + ifp->if_ipackets++; if (sc->nic.mem_mode == DMA_MBUF) @@ -592,9 +593,9 @@ lnc_rint(struct lnc_softc *sc) * First mbuf in packet holds the * ethernet and packet headers */ - head->m_pkthdr.rcvif = &sc->arpcom.ac_if; + head->m_pkthdr.rcvif = ifp; head->m_pkthdr.len = pkt_len ; - eh = (struct ether_header *) head->m_data; + eh = mtod(head, struct ether_header *); /* * vmware ethernet hardware emulation loops @@ -605,15 +606,10 @@ lnc_rint(struct lnc_softc *sc) sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) == 0) { m_freem(head); } else { - /* Skip over the ether header */ - head->m_data += sizeof *eh; - head->m_len -= sizeof *eh; - head->m_pkthdr.len -= sizeof *eh; - - ether_input(&sc->arpcom.ac_if, eh, head); + (ifp->if_input)(ifp, head); } } else { - int unit = sc->arpcom.ac_if.if_dunit; + int unit = ifp->if_dunit; log(LOG_ERR,"lnc%d: Packet dropped, no mbufs\n",unit); LNCSTATS(drop_packet) } @@ -892,7 +888,6 @@ lnc_attach_common(device_t dev) if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_timer = 0; - ifp->if_output = ether_output; ifp->if_start = lnc_start; ifp->if_ioctl = lnc_ioctl; ifp->if_watchdog = lnc_watchdog; diff --git a/sys/dev/netif/my/if_my.c b/sys/dev/netif/my/if_my.c index 243c09716b..f5f62e37a8 100644 --- a/sys/dev/netif/my/if_my.c +++ b/sys/dev/netif/my/if_my.c @@ -26,7 +26,7 @@ * Written by: yen_cw@myson.com.tw available at: http://www.myson.com.tw/ * * $FreeBSD: src/sys/dev/my/if_my.c,v 1.2.2.4 2002/04/17 02:05:27 julian Exp $ - * $DragonFly: src/sys/dev/netif/my/if_my.c,v 1.11 2004/07/02 17:42:18 joerg Exp $ + * $DragonFly: src/sys/dev/netif/my/if_my.c,v 1.12 2004/07/23 07:16:27 joerg Exp $ * * Myson fast ethernet PCI NIC driver * @@ -985,7 +985,6 @@ my_attach(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = my_ioctl; - ifp->if_output = ether_output; ifp->if_start = my_start; ifp->if_watchdog = my_watchdog; ifp->if_init = my_init; @@ -1262,9 +1261,7 @@ my_rxeof(struct my_softc * sc) } } #endif - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } MY_UNLOCK(sc); return; diff --git a/sys/dev/netif/nge/if_nge.c b/sys/dev/netif/nge/if_nge.c index 2bea061019..88e2b8e8dd 100644 --- a/sys/dev/netif/nge/if_nge.c +++ b/sys/dev/netif/nge/if_nge.c @@ -31,7 +31,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/nge/if_nge.c,v 1.13.2.13 2003/02/05 22:03:57 mbr Exp $ - * $DragonFly: src/sys/dev/netif/nge/if_nge.c,v 1.12 2004/07/02 17:42:18 joerg Exp $ + * $DragonFly: src/sys/dev/netif/nge/if_nge.c,v 1.13 2004/07/23 07:16:27 joerg Exp $ * * $FreeBSD: src/sys/dev/nge/if_nge.c,v 1.13.2.13 2003/02/05 22:03:57 mbr Exp $ */ @@ -953,7 +953,6 @@ static int nge_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = nge_ioctl; - ifp->if_output = ether_output; ifp->if_start = nge_start; ifp->if_watchdog = nge_watchdog; ifp->if_init = nge_init; @@ -1359,7 +1358,6 @@ static void nge_jfree(buf, size) static void nge_rxeof(sc) struct nge_softc *sc; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct nge_desc *cur_rx; @@ -1436,10 +1434,6 @@ static void nge_rxeof(sc) #endif ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); - - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); /* Do IP checksum checking. */ if (extsts & NGE_RXEXTSTS_IPPKT) @@ -1459,12 +1453,10 @@ static void nge_rxeof(sc) * If we received a packet with a vlan tag, pass it * to vlan_input() instead of ether_input(). */ - if (extsts & NGE_RXEXTSTS_VLANPKT) { - VLAN_INPUT_TAG(eh, m, extsts & NGE_RXEXTSTS_VTCI); - continue; - } - - ether_input(ifp, eh, m); + if (extsts & NGE_RXEXTSTS_VLANPKT) + VLAN_INPUT_TAG(m, extsts & NGE_RXEXTSTS_VTCI); + else + (*ifp->if_input)(ifp, m); } sc->nge_cdata.nge_rx_prod = i; diff --git a/sys/dev/netif/pcn/if_pcn.c b/sys/dev/netif/pcn/if_pcn.c index 0b15b5b172..0dae6e802a 100644 --- a/sys/dev/netif/pcn/if_pcn.c +++ b/sys/dev/netif/pcn/if_pcn.c @@ -31,7 +31,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_pcn.c,v 1.5.2.10 2003/03/05 18:42:33 njl Exp $ - * $DragonFly: src/sys/dev/netif/pcn/if_pcn.c,v 1.11 2004/07/02 17:42:18 joerg Exp $ + * $DragonFly: src/sys/dev/netif/pcn/if_pcn.c,v 1.12 2004/07/23 07:16:27 joerg Exp $ * * $FreeBSD: src/sys/pci/if_pcn.c,v 1.5.2.10 2003/03/05 18:42:33 njl Exp $ */ @@ -618,7 +618,6 @@ static int pcn_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = pcn_ioctl; - ifp->if_output = ether_output; ifp->if_start = pcn_start; ifp->if_watchdog = pcn_watchdog; ifp->if_init = pcn_init; @@ -780,7 +779,6 @@ static int pcn_newbuf(sc, idx, m) static void pcn_rxeof(sc) struct pcn_softc *sc; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct pcn_rx_desc *cur_rx; @@ -819,14 +817,11 @@ static void pcn_rxeof(sc) /* No errors; receive the packet. */ ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); m->m_len = m->m_pkthdr.len = cur_rx->pcn_rxlen - ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } sc->pcn_cdata.pcn_rx_prod = i; diff --git a/sys/dev/netif/pdq_layer/pdq_ifsubr.c b/sys/dev/netif/pdq_layer/pdq_ifsubr.c index 9f919cb1fb..5de32fadeb 100644 --- a/sys/dev/netif/pdq_layer/pdq_ifsubr.c +++ b/sys/dev/netif/pdq_layer/pdq_ifsubr.c @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/pdq/pdq_ifsubr.c,v 1.11.2.1 2000/08/02 22:39:30 peter Exp $ - * $DragonFly: src/sys/dev/netif/pdq_layer/Attic/pdq_ifsubr.c,v 1.6 2004/04/01 07:27:17 joerg Exp $ + * $DragonFly: src/sys/dev/netif/pdq_layer/Attic/pdq_ifsubr.c,v 1.7 2004/07/23 07:16:27 joerg Exp $ * */ @@ -192,11 +192,8 @@ pdq_os_receive_pdu( return; } - m->m_data += sizeof(struct fddi_header); - m->m_len -= sizeof(struct fddi_header); - m->m_pkthdr.len = pktlen - sizeof(struct fddi_header); - m->m_pkthdr.rcvif = &sc->sc_if; - fddi_input(&sc->sc_if, fh, m); + m->m_pkthdr.len = pktlen; + (*sc->sc_if.if_input)(&sc->sc_if, m); } void @@ -369,13 +366,8 @@ pdq_ifattach( #endif ifp->if_ioctl = pdq_ifioctl; - ifp->if_output = fddi_output; ifp->if_start = pdq_ifstart; ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; -#warning "Implement fddi_resolvemulti!" -/* ifp->if_resolvemulti = ether_resolvemulti; XXX */ - if_attach(ifp); fddi_ifattach(ifp); - PDQ_BPFATTACH(sc, DLT_FDDI, sizeof(struct fddi_header)); } diff --git a/sys/dev/netif/ray/if_ray.c b/sys/dev/netif/ray/if_ray.c index 01303de4ec..50e58a27b0 100644 --- a/sys/dev/netif/ray/if_ray.c +++ b/sys/dev/netif/ray/if_ray.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ray/if_ray.c,v 1.47.2.4 2001/08/14 22:54:05 dmlb Exp $ - * $DragonFly: src/sys/dev/netif/ray/Attic/if_ray.c,v 1.13 2004/07/02 17:42:18 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ray/Attic/if_ray.c,v 1.14 2004/07/23 07:16:27 joerg Exp $ * */ @@ -510,7 +510,6 @@ ray_attach(device_t dev) ifp->if_hdrlen = sizeof(struct ieee80211_frame) + sizeof(struct ether_header); ifp->if_baudrate = 1000000; /* Is this baud or bps ;-) */ - ifp->if_output = ether_output; ifp->if_start = ray_tx; ifp->if_ioctl = ray_ioctl; ifp->if_watchdog = ray_watchdog; @@ -2080,9 +2079,7 @@ ray_rx_data(struct ray_softc *sc, struct mbuf *m0, u_int8_t siglev, u_int8_t ant RAY_MBUF_DUMP(sc, RAY_DBG_RX, m0, "(3) packet after trimming"); ifp->if_ipackets++; ray_rx_update_cache(sc, header->i_addr2, siglev, antenna); - eh = mtod(m0, struct ether_header *); - m_adj(m0, sizeof(struct ether_header)); - ether_input(ifp, eh, m0); + (*ifp->if_input)(ifp, m0); } /* diff --git a/sys/dev/netif/rdp/if_rdp.c b/sys/dev/netif/rdp/if_rdp.c index 04b5e87aa3..6b3848dd18 100644 --- a/sys/dev/netif/rdp/if_rdp.c +++ b/sys/dev/netif/rdp/if_rdp.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/if_rdp.c,v 1.6.2.2 2000/07/17 21:24:32 archie Exp $ - * $DragonFly: src/sys/dev/netif/rdp/if_rdp.c,v 1.11 2004/07/02 17:42:18 joerg Exp $ + * $DragonFly: src/sys/dev/netif/rdp/if_rdp.c,v 1.12 2004/07/23 07:16:27 joerg Exp $ */ /* @@ -602,7 +602,6 @@ rdp_attach(struct isa_device *isa_dev) */ ifp->if_softc = sc; if_initname(ifp, "rdp", unit); - ifp->if_output = ether_output; ifp->if_start = rdp_start; ifp->if_ioctl = rdp_ioctl; ifp->if_watchdog = rdp_watchdog; @@ -1098,7 +1097,7 @@ rdp_rint(struct rdp_softc *sc) static void rdp_get_packet(struct rdp_softc *sc, unsigned len) { - struct ether_header *eh; + struct ifnet *ifp = &sc->arpcom.ac_if; struct mbuf *m; u_char *packet_ptr; size_t s; @@ -1107,7 +1106,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len) MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return; - m->m_pkthdr.rcvif = &sc->arpcom.ac_if; + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = len; /* @@ -1132,7 +1131,6 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len) * This is important for NFS. */ m->m_data += 2; - eh = mtod(m, struct ether_header *); /* * Get packet, including link layer address, from interface. @@ -1140,7 +1138,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len) outb(sc->baseaddr + lpt_control, Ctrl_LNibRead); outb(sc->baseaddr + lpt_data, RdAddr + MAR); - packet_ptr = (u_char *)eh; + packet_ptr = mtod(m, u_char *); if (sc->slow) for (s = 0; s < len; s++, packet_ptr++) *packet_ptr = RdByteA2(sc); @@ -1152,13 +1150,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len) outb(sc->baseaddr + lpt_control, Ctrl_SelData); WrNib(sc, CMR1, CMR1_RDPAC); - /* - * Remove link layer address. - */ - m->m_pkthdr.len = m->m_len = len - sizeof(struct ether_header); - m->m_data += sizeof(struct ether_header); - - ether_input(&sc->arpcom.ac_if, eh, m); + (*ifp->if_input)(ifp, m); } /* diff --git a/sys/dev/netif/re/if_re.c b/sys/dev/netif/re/if_re.c index b46a8ff4ad..401690ee8b 100644 --- a/sys/dev/netif/re/if_re.c +++ b/sys/dev/netif/re/if_re.c @@ -33,7 +33,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/re/if_re.c,v 1.25 2004/06/09 14:34:01 naddy Exp $ - * $DragonFly: src/sys/dev/netif/re/if_re.c,v 1.2 2004/07/14 07:40:26 joerg Exp $ + * $DragonFly: src/sys/dev/netif/re/if_re.c,v 1.3 2004/07/23 07:16:28 joerg Exp $ */ /* @@ -1118,7 +1118,6 @@ re_attach(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = re_ioctl; - ifp->if_output = ether_output; ifp->if_capabilities = IFCAP_VLAN_MTU; ifp->if_start = re_start; ifp->if_hwassist = RE_CSUM_FEATURES; @@ -1351,7 +1350,6 @@ re_rxeof(struct re_softc *sc) struct ifnet *ifp = &sc->arpcom.ac_if; struct mbuf *m; struct re_desc *cur_rx; - struct ether_header *eh; uint32_t rxstat, rxvlan; int i, total_len; @@ -1464,9 +1462,7 @@ re_rxeof(struct re_softc *sc) (total_len - ETHER_CRC_LEN); ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); m->m_pkthdr.rcvif = ifp; - m_adj(m, sizeof(struct ether_header)); /* Do RX checksumming if enabled */ @@ -1490,10 +1486,10 @@ re_rxeof(struct re_softc *sc) } if (rxvlan & RE_RDESC_VLANCTL_TAG) - VLAN_INPUT_TAG(eh, m, - be16toh((rxvlan & RE_RDESC_VLANCTL_DATA))); + VLAN_INPUT_TAG(m, + be16toh((rxvlan & RE_RDESC_VLANCTL_DATA))); else - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } /* Flush the RX DMA ring */ diff --git a/sys/dev/netif/rl/if_rl.c b/sys/dev/netif/rl/if_rl.c index 3f16351215..102402fe9c 100644 --- a/sys/dev/netif/rl/if_rl.c +++ b/sys/dev/netif/rl/if_rl.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_rl.c,v 1.38.2.16 2003/03/05 18:42:33 njl Exp $ - * $DragonFly: src/sys/dev/netif/rl/if_rl.c,v 1.13 2004/07/17 09:26:25 joerg Exp $ + * $DragonFly: src/sys/dev/netif/rl/if_rl.c,v 1.14 2004/07/23 07:16:28 joerg Exp $ * * $FreeBSD: src/sys/pci/if_rl.c,v 1.38.2.16 2003/03/05 18:42:33 njl Exp $ */ @@ -968,7 +968,6 @@ static int rl_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = rl_ioctl; - ifp->if_output = ether_output; ifp->if_start = rl_start; ifp->if_watchdog = rl_watchdog; ifp->if_init = rl_init; @@ -1066,7 +1065,6 @@ static int rl_list_tx_init(sc) static void rl_rxeof(sc) struct rl_softc *sc; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; int total_len = 0; @@ -1180,12 +1178,9 @@ static void rl_rxeof(sc) if (m == NULL) continue; - eh = mtod(m, struct ether_header *); ifp->if_ipackets++; - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } return; diff --git a/sys/dev/netif/sbni/if_sbni.c b/sys/dev/netif/sbni/if_sbni.c index 09b4493a69..bd3f6c86ab 100644 --- a/sys/dev/netif/sbni/if_sbni.c +++ b/sys/dev/netif/sbni/if_sbni.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sbni/if_sbni.c,v 1.1.2.4 2002/08/11 09:32:00 fjoe Exp $ - * $DragonFly: src/sys/dev/netif/sbni/if_sbni.c,v 1.14 2004/07/02 17:42:18 joerg Exp $ + * $DragonFly: src/sys/dev/netif/sbni/if_sbni.c,v 1.15 2004/07/23 07:16:28 joerg Exp $ */ /* @@ -232,7 +232,6 @@ sbni_attach(struct sbni_softc *sc, int unit, struct sbni_flags flags) if_initname(ifp, "sbni", unit); ifp->if_init = sbni_init; ifp->if_start = sbni_start; - ifp->if_output = ether_output; ifp->if_ioctl = sbni_ioctl; ifp->if_watchdog = sbni_watchdog; ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; @@ -852,17 +851,14 @@ get_rx_buf(struct sbni_softc *sc) static void indicate_pkt(struct sbni_softc *sc) { + struct ifnet *ifp = &sc->arpcom.ac_if; struct mbuf *m; - struct ether_header *eh; m = sc->rx_buf_p; - m->m_pkthdr.rcvif = &sc->arpcom.ac_if; + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = sc->inppos; - eh = mtod(m, struct ether_header *); - /* Remove link layer address and indicate packet */ - m_adj(m, sizeof(struct ether_header)); - ether_input(&sc->arpcom.ac_if, eh, m); + (*ifp->if_input)(ifp, m); sc->rx_buf_p = NULL; } diff --git a/sys/dev/netif/sbsh/if_sbsh.c b/sys/dev/netif/sbsh/if_sbsh.c index e734de13dd..29c39e914a 100644 --- a/sys/dev/netif/sbsh/if_sbsh.c +++ b/sys/dev/netif/sbsh/if_sbsh.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sbsh/if_sbsh.c,v 1.3.2.1 2003/04/15 18:15:07 fjoe Exp $ - * $DragonFly: src/sys/dev/netif/sbsh/if_sbsh.c,v 1.11 2004/06/02 14:42:54 eirikn Exp $ + * $DragonFly: src/sys/dev/netif/sbsh/if_sbsh.c,v 1.12 2004/07/23 07:16:28 joerg Exp $ */ #include @@ -272,7 +272,6 @@ sbsh_attach(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = sbsh_ioctl; - ifp->if_output = ether_output; ifp->if_start = sbsh_start; ifp->if_watchdog = sbsh_watchdog; ifp->if_init = sbsh_init; @@ -800,7 +799,7 @@ alloc_rx_buffers(struct sbsh_softc *sc) static void indicate_frames(struct sbsh_softc *sc) { - struct ether_header *eh; + struct ifnet *ifp = &sc->arpcom.ac_if; unsigned cur_rbd = sc->regs->CRDR & 0x7f; while (sc->head_rdesc != cur_rbd) { @@ -809,13 +808,11 @@ indicate_frames(struct sbsh_softc *sc) m->m_pkthdr.len = m->m_len = sc->rbd[sc->head_rdesc].length & 0x7ff; - m->m_pkthdr.rcvif = &sc->arpcom.ac_if; + m->m_pkthdr.rcvif = ifp; - eh = mtod(m, struct ether_header *); - m_adj(m, sizeof(struct ether_header)); - ether_input(&sc->arpcom.ac_if, eh, m); + (*ifp->if_input)(ifp, m); ++sc->in_stats.rcvd_pkts; - ++sc->arpcom.ac_if.if_ipackets; + ++ifp->if_ipackets; sc->head_rdesc = (sc->head_rdesc + 1) & 0x7f; } diff --git a/sys/dev/netif/sf/if_sf.c b/sys/dev/netif/sf/if_sf.c index 62ca2960f4..039594ca8e 100644 --- a/sys/dev/netif/sf/if_sf.c +++ b/sys/dev/netif/sf/if_sf.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_sf.c,v 1.18.2.8 2001/12/16 15:46:07 luigi Exp $ - * $DragonFly: src/sys/dev/netif/sf/if_sf.c,v 1.10 2004/07/02 17:42:19 joerg Exp $ + * $DragonFly: src/sys/dev/netif/sf/if_sf.c,v 1.11 2004/07/23 07:16:28 joerg Exp $ * * $FreeBSD: src/sys/pci/if_sf.c,v 1.18.2.8 2001/12/16 15:46:07 luigi Exp $ */ @@ -814,7 +814,6 @@ static int sf_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = sf_ioctl; - ifp->if_output = ether_output; ifp->if_start = sf_start; ifp->if_watchdog = sf_watchdog; ifp->if_init = sf_init; @@ -960,7 +959,6 @@ static int sf_newbuf(sc, c, m) static void sf_rxeof(sc) struct sf_softc *sc; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct sf_rx_bufdesc_type0 *desc; @@ -1001,12 +999,9 @@ static void sf_rxeof(sc) m_adj(m0, ETHER_ALIGN); m = m0; - eh = mtod(m, struct ether_header *); ifp->if_ipackets++; - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } csr_write_4(sc, SF_CQ_CONSIDX, diff --git a/sys/dev/netif/sis/if_sis.c b/sys/dev/netif/sis/if_sis.c index bdd8eb7cb0..68d9f24d83 100644 --- a/sys/dev/netif/sis/if_sis.c +++ b/sys/dev/netif/sis/if_sis.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_sis.c,v 1.13.4.24 2003/03/05 18:42:33 njl Exp $ - * $DragonFly: src/sys/dev/netif/sis/if_sis.c,v 1.17 2004/07/07 15:46:00 joerg Exp $ + * $DragonFly: src/sys/dev/netif/sis/if_sis.c,v 1.18 2004/07/23 07:16:28 joerg Exp $ * * $FreeBSD: src/sys/pci/if_sis.c,v 1.13.4.24 2003/03/05 18:42:33 njl Exp $ */ @@ -1276,7 +1276,6 @@ sis_attach(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = sis_ioctl; - ifp->if_output = ether_output; ifp->if_start = sis_start; ifp->if_watchdog = sis_watchdog; ifp->if_init = sis_init; @@ -1558,7 +1557,7 @@ sis_rxeof(struct sis_softc *sc) } ifp->if_ipackets++; - ether_input(ifp, NULL, m); + (*ifp->if_input)(ifp, m); } sc->sis_cdata.sis_rx_prod = i; diff --git a/sys/dev/netif/sk/if_sk.c b/sys/dev/netif/sk/if_sk.c index f3cb39d53b..f56b569add 100644 --- a/sys/dev/netif/sk/if_sk.c +++ b/sys/dev/netif/sk/if_sk.c @@ -32,7 +32,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_sk.c,v 1.19.2.9 2003/03/05 18:42:34 njl Exp $ - * $DragonFly: src/sys/dev/netif/sk/if_sk.c,v 1.16 2004/07/02 17:42:19 joerg Exp $ + * $DragonFly: src/sys/dev/netif/sk/if_sk.c,v 1.17 2004/07/23 07:16:28 joerg Exp $ * * $FreeBSD: src/sys/pci/if_sk.c,v 1.19.2.9 2003/03/05 18:42:34 njl Exp $ */ @@ -1487,7 +1487,6 @@ static int sk_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = sk_ioctl; - ifp->if_output = ether_output; ifp->if_start = sk_start; ifp->if_watchdog = sk_watchdog; ifp->if_init = sk_init; @@ -1907,7 +1906,6 @@ static void skc_shutdown(dev) static void sk_rxeof(sc_if) struct sk_if_softc *sc_if; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct sk_chain *cur_rx; @@ -1961,11 +1959,7 @@ static void sk_rxeof(sc_if) } ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); - - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } sc_if->sk_cdata.sk_rx_prod = i; diff --git a/sys/dev/netif/sn/if_sn.c b/sys/dev/netif/sn/if_sn.c index ed07ae899a..5567732af8 100644 --- a/sys/dev/netif/sn/if_sn.c +++ b/sys/dev/netif/sn/if_sn.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sn/if_sn.c,v 1.7.2.3 2001/02/04 04:38:38 toshi Exp $ - * $DragonFly: src/sys/dev/netif/sn/if_sn.c,v 1.10 2004/07/02 17:42:19 joerg Exp $ + * $DragonFly: src/sys/dev/netif/sn/if_sn.c,v 1.11 2004/07/23 07:16:28 joerg Exp $ */ /* @@ -218,7 +218,6 @@ sn_attach(device_t dev) if_initname(ifp, "sn", device_get_unit(dev)); ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_output = ether_output; ifp->if_start = snstart; ifp->if_ioctl = snioctl; ifp->if_watchdog = snwatchdog; @@ -1002,7 +1001,6 @@ void snread(struct ifnet *ifp) { struct sn_softc *sc = ifp->if_softc; - struct ether_header *eh; struct mbuf *m; short status; int packet_number; @@ -1046,7 +1044,7 @@ read_another: * Account for receive errors and discard. */ if (status & RS_ERRORS) { - ++sc->arpcom.ac_if.if_ierrors; + ++ifp->if_ierrors; goto out; } /* @@ -1066,7 +1064,7 @@ read_another: if (m == NULL) goto out; - m->m_pkthdr.rcvif = &sc->arpcom.ac_if; + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = packet_length; /* @@ -1079,31 +1077,26 @@ read_another: */ if ((m->m_flags & M_EXT) == 0) { m_freem(m); - ++sc->arpcom.ac_if.if_ierrors; + ++ifp->if_ierrors; printf("sn: snread() kernel memory allocation problem\n"); goto out; } - eh = mtod(m, struct ether_header *); /* * Get packet, including link layer address, from interface. */ - data = (u_char *) eh; + data = mtod(m, u_char *); insw(BASE + DATA_REG_W, data, packet_length >> 1); if (packet_length & 1) { data += packet_length & ~1; *data = inb(BASE + DATA_REG_B); } - ++sc->arpcom.ac_if.if_ipackets; + ++ifp->if_ipackets; - /* - * Remove link layer addresses and whatnot. - */ - m->m_pkthdr.len = m->m_len = packet_length - sizeof(struct ether_header); - m->m_data += sizeof(struct ether_header); + m->m_pkthdr.len = m->m_len = packet_length; - ether_input(&sc->arpcom.ac_if, eh, m); + (*ifp->if_input)(ifp, m); out: diff --git a/sys/dev/netif/snc/dp83932.c b/sys/dev/netif/snc/dp83932.c index 8e9463f86e..e26aa4a6aa 100644 --- a/sys/dev/netif/snc/dp83932.c +++ b/sys/dev/netif/snc/dp83932.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/snc/dp83932.c,v 1.1.2.2 2003/02/11 08:52:00 nyan Exp $ */ -/* $DragonFly: src/sys/dev/netif/snc/Attic/dp83932.c,v 1.10 2004/07/02 17:42:19 joerg Exp $ */ +/* $DragonFly: src/sys/dev/netif/snc/Attic/dp83932.c,v 1.11 2004/07/23 07:16:28 joerg Exp $ */ /* $NecBSD: dp83932.c,v 1.5 1999/07/29 05:08:44 kmatsuda Exp $ */ /* $NetBSD: if_snc.c,v 1.18 1998/04/25 21:27:40 scottr Exp $ */ @@ -186,7 +186,6 @@ sncconfig(sc, media, nmedia, defmedia, eaddr) ifp->if_softc = sc; if_initname(ifp, "snc", device_get_unit(sc->sc_dev)); ifp->if_ioctl = sncioctl; - ifp->if_output = ether_output; ifp->if_start = sncstart; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -1088,7 +1087,6 @@ sonic_read(sc, pkt, len) int len; { struct ifnet *ifp = &sc->sc_if; - struct ether_header *et; struct mbuf *m; if (len <= sizeof(struct ether_header) || @@ -1104,22 +1102,7 @@ sonic_read(sc, pkt, len) return (0); } - /* We assume that the header fit entirely in one mbuf. */ - et = mtod(m, struct ether_header *); - -#ifdef SNCDEBUG - if ((sncdebug & SNC_SHOWRXHDR) != 0) - { - device_printf(sc->sc_dev, "rcvd 0x%x len=%d type=0x%x from %6D", - pkt, len, htons(et->ether_type), - et->ether_shost, ":"); - printf(" (to %6D)\n", et->ether_dhost, ":"); - } -#endif /* SNCDEBUG */ - - /* Pass the packet up, with the ether header sort-of removed. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, et, m); + (*ifp->if_input)(ifp, m); return (1); } diff --git a/sys/dev/netif/ste/if_ste.c b/sys/dev/netif/ste/if_ste.c index 355fd172d8..df76aeee12 100644 --- a/sys/dev/netif/ste/if_ste.c +++ b/sys/dev/netif/ste/if_ste.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_ste.c,v 1.14.2.9 2003/02/05 22:03:57 mbr Exp $ - * $DragonFly: src/sys/dev/netif/ste/if_ste.c,v 1.11 2004/07/02 17:42:19 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ste/if_ste.c,v 1.12 2004/07/23 07:16:29 joerg Exp $ * * $FreeBSD: src/sys/pci/if_ste.c,v 1.14.2.9 2003/02/05 22:03:57 mbr Exp $ */ @@ -682,7 +682,6 @@ static void ste_intr(xsc) static void ste_rxeof(sc) struct ste_softc *sc; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct ste_chain_onefrag *cur_rx; @@ -743,13 +742,10 @@ static void ste_rxeof(sc) } ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = total_len; - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); cur_rx->ste_ptr->ste_status = 0; count++; @@ -1063,7 +1059,6 @@ static int ste_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = ste_ioctl; - ifp->if_output = ether_output; ifp->if_start = ste_start; ifp->if_watchdog = ste_watchdog; ifp->if_init = ste_init; diff --git a/sys/dev/netif/ti/if_ti.c b/sys/dev/netif/ti/if_ti.c index 572584584c..727e4ac418 100644 --- a/sys/dev/netif/ti/if_ti.c +++ b/sys/dev/netif/ti/if_ti.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_ti.c,v 1.25.2.14 2002/02/15 04:20:20 silby Exp $ - * $DragonFly: src/sys/dev/netif/ti/if_ti.c,v 1.12 2004/07/02 17:42:19 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ti/if_ti.c,v 1.13 2004/07/23 07:16:29 joerg Exp $ * * $FreeBSD: src/sys/pci/if_ti.c,v 1.25.2.14 2002/02/15 04:20:20 silby Exp $ */ @@ -1710,7 +1710,6 @@ static int ti_attach(dev) if_initname(ifp, "ti", sc->ti_unit); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = ti_ioctl; - ifp->if_output = ether_output; ifp->if_start = ti_start; ifp->if_watchdog = ti_watchdog; ifp->if_init = ti_init; @@ -1807,7 +1806,6 @@ static void ti_rxeof(sc) while(sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { struct ti_rx_desc *cur_rx; u_int32_t rxidx; - struct ether_header *eh; struct mbuf *m = NULL; u_int16_t vlan_tag = 0; int have_tag = 0; @@ -1868,12 +1866,8 @@ static void ti_rxeof(sc) m->m_pkthdr.len = m->m_len = cur_rx->ti_len; ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); m->m_pkthdr.rcvif = ifp; - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - if (ifp->if_hwassist) { m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | CSUM_DATA_VALID; @@ -1887,11 +1881,11 @@ static void ti_rxeof(sc) * to vlan_input() instead of ether_input(). */ if (have_tag) { - VLAN_INPUT_TAG(eh, m, vlan_tag); + VLAN_INPUT_TAG(m, vlan_tag); have_tag = vlan_tag = 0; - continue; + } else { + (*ifp->if_input)(ifp, m); } - ether_input(ifp, eh, m); } /* Only necessary on the Tigon 1. */ diff --git a/sys/dev/netif/tl/if_tl.c b/sys/dev/netif/tl/if_tl.c index 384a24ab0d..9eaff765e9 100644 --- a/sys/dev/netif/tl/if_tl.c +++ b/sys/dev/netif/tl/if_tl.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_tl.c,v 1.51.2.5 2001/12/16 15:46:08 luigi Exp $ - * $DragonFly: src/sys/dev/netif/tl/if_tl.c,v 1.11 2004/07/02 17:42:19 joerg Exp $ + * $DragonFly: src/sys/dev/netif/tl/if_tl.c,v 1.12 2004/07/23 07:16:29 joerg Exp $ * * $FreeBSD: src/sys/pci/if_tl.c,v 1.51.2.5 2001/12/16 15:46:08 luigi Exp $ */ @@ -1290,7 +1290,6 @@ static int tl_attach(dev) if_initname(ifp, "tl", sc->tl_unit); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = tl_ioctl; - ifp->if_output = ether_output; ifp->if_start = tl_start; ifp->if_watchdog = tl_watchdog; ifp->if_init = tl_init; @@ -1532,11 +1531,7 @@ static int tl_intvec_rxeof(xsc, type) continue; } - /* 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); + (*ifp->if_input)(ifp, m); } return(r); diff --git a/sys/dev/netif/tx/if_tx.c b/sys/dev/netif/tx/if_tx.c index ca84ddd90c..6e31ec1212 100644 --- a/sys/dev/netif/tx/if_tx.c +++ b/sys/dev/netif/tx/if_tx.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/tx/if_tx.c,v 1.61.2.1 2002/10/29 01:43:49 semenu Exp $ - * $DragonFly: src/sys/dev/netif/tx/if_tx.c,v 1.12 2004/07/02 17:42:20 joerg Exp $ + * $DragonFly: src/sys/dev/netif/tx/if_tx.c,v 1.13 2004/07/23 07:16:29 joerg Exp $ */ /* @@ -232,7 +232,6 @@ epic_attach(dev) ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST; ifp->if_ioctl = epic_ifioctl; - ifp->if_output = ether_output; ifp->if_start = epic_ifstart; ifp->if_watchdog = epic_ifwatchdog; ifp->if_init = (if_init_f_t*)epic_init; @@ -616,10 +615,10 @@ epic_rx_done(sc) epic_softc_t *sc; { u_int16_t len; + struct ifnet *ifp = &sc->sc_if; struct epic_rx_buffer *buf; struct epic_rx_desc *desc; struct mbuf *m; - struct ether_header *eh; while ((sc->rx_desc[sc->cur_rx].status & 0x8000) == 0) { buf = sc->rx_buffer + sc->cur_rx; @@ -648,7 +647,7 @@ epic_rx_done(sc) if (NULL == buf->mbuf) { buf->mbuf = m; desc->status = 0x8000; - sc->sc_if.if_ierrors++; + ifp->if_ierrors++; continue; } @@ -657,19 +656,14 @@ epic_rx_done(sc) desc->status = 0x8000; /* First mbuf in packet holds the ethernet and packet headers */ - eh = mtod(m, struct ether_header *); - m->m_pkthdr.rcvif = &(sc->sc_if); + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = len; - /* Second mbuf holds packet ifself */ - m->m_pkthdr.len = m->m_len = len - sizeof(struct ether_header); - m->m_data += sizeof(struct ether_header); - /* Give mbuf to OS */ - ether_input(&sc->sc_if, eh, m); + (*ifp->if_input)(ifp, m); /* Successfuly received frame */ - sc->sc_if.if_ipackets++; + ifp->if_ipackets++; } return; diff --git a/sys/dev/netif/txp/if_txp.c b/sys/dev/netif/txp/if_txp.c index f8c1c67df0..c0d40518ae 100644 --- a/sys/dev/netif/txp/if_txp.c +++ b/sys/dev/netif/txp/if_txp.c @@ -1,6 +1,6 @@ /* $OpenBSD: if_txp.c,v 1.48 2001/06/27 06:34:50 kjc Exp $ */ /* $FreeBSD: src/sys/dev/txp/if_txp.c,v 1.4.2.4 2001/12/14 19:50:43 jlemon Exp $ */ -/* $DragonFly: src/sys/dev/netif/txp/if_txp.c,v 1.12 2004/07/02 17:42:20 joerg Exp $ */ +/* $DragonFly: src/sys/dev/netif/txp/if_txp.c,v 1.13 2004/07/23 07:16:29 joerg Exp $ */ /* * Copyright (c) 2001 @@ -341,7 +341,6 @@ txp_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = txp_ioctl; - ifp->if_output = ether_output; ifp->if_start = txp_start; ifp->if_watchdog = txp_watchdog; ifp->if_init = txp_init; @@ -701,7 +700,6 @@ txp_rx_reclaim(sc, r) struct mbuf *m; struct txp_swdesc *sd = NULL; u_int32_t roff, woff; - struct ether_header *eh = NULL; roff = *r->r_roff; woff = *r->r_woff; @@ -769,16 +767,10 @@ txp_rx_reclaim(sc, r) m->m_pkthdr.csum_data = 0xffff; } - eh = mtod(m, struct ether_header *); - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - - if (rxd->rx_stat & RX_STAT_VLAN) { - VLAN_INPUT_TAG(eh, m, htons(rxd->rx_vlan >> 16)); - goto next; - } - - ether_input(ifp, eh, m); + if (rxd->rx_stat & RX_STAT_VLAN) + VLAN_INPUT_TAG(m, htons(rxd->rx_vlan >> 16)); + else + (*ifp->if_input)(ifp, m); next: diff --git a/sys/dev/netif/vr/if_vr.c b/sys/dev/netif/vr/if_vr.c index 8d1bbfe1df..120ae43e8a 100644 --- a/sys/dev/netif/vr/if_vr.c +++ b/sys/dev/netif/vr/if_vr.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_vr.c,v 1.26.2.13 2003/02/06 04:46:20 silby Exp $ - * $DragonFly: src/sys/dev/netif/vr/if_vr.c,v 1.13 2004/07/02 17:42:20 joerg Exp $ + * $DragonFly: src/sys/dev/netif/vr/if_vr.c,v 1.14 2004/07/23 07:16:29 joerg Exp $ * * $FreeBSD: src/sys/pci/if_vr.c,v 1.26.2.13 2003/02/06 04:46:20 silby Exp $ */ @@ -874,7 +874,6 @@ static int vr_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = vr_ioctl; - ifp->if_output = ether_output; ifp->if_start = vr_start; ifp->if_watchdog = vr_watchdog; ifp->if_init = vr_init; @@ -1052,7 +1051,6 @@ static int vr_newbuf(sc, c, m) static void vr_rxeof(sc) struct vr_softc *sc; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct vr_chain_onefrag *cur_rx; @@ -1121,11 +1119,7 @@ static void vr_rxeof(sc) m = m0; ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); - - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } return; diff --git a/sys/dev/netif/vx/if_vx.c b/sys/dev/netif/vx/if_vx.c index 9d940dc19f..f0b96d7b0d 100644 --- a/sys/dev/netif/vx/if_vx.c +++ b/sys/dev/netif/vx/if_vx.c @@ -28,7 +28,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/vx/if_vx.c,v 1.25.2.6 2002/02/13 00:43:10 dillon Exp $ - * $DragonFly: src/sys/dev/netif/vx/if_vx.c,v 1.12 2004/07/02 17:42:20 joerg Exp $ + * $DragonFly: src/sys/dev/netif/vx/if_vx.c,v 1.13 2004/07/23 07:16:29 joerg Exp $ * */ @@ -157,7 +157,6 @@ vxattach(sc) ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_output = ether_output; ifp->if_start = vxstart; ifp->if_ioctl = vxioctl; ifp->if_init = vxinit; @@ -703,8 +702,7 @@ again: return; } - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); /* * In periods of high traffic we can actually receive enough diff --git a/sys/dev/netif/wb/if_wb.c b/sys/dev/netif/wb/if_wb.c index 19ca6e0a78..c4e4a2a4d3 100644 --- a/sys/dev/netif/wb/if_wb.c +++ b/sys/dev/netif/wb/if_wb.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_wb.c,v 1.26.2.6 2003/03/05 18:42:34 njl Exp $ - * $DragonFly: src/sys/dev/netif/wb/if_wb.c,v 1.11 2004/07/02 17:42:20 joerg Exp $ + * $DragonFly: src/sys/dev/netif/wb/if_wb.c,v 1.12 2004/07/23 07:16:29 joerg Exp $ * * $FreeBSD: src/sys/pci/if_wb.c,v 1.26.2.6 2003/03/05 18:42:34 njl Exp $ */ @@ -937,7 +937,6 @@ static int wb_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = wb_ioctl; - ifp->if_output = ether_output; ifp->if_start = wb_start; ifp->if_watchdog = wb_watchdog; ifp->if_init = wb_init; @@ -1122,7 +1121,6 @@ static int wb_newbuf(sc, c, m) static void wb_rxeof(sc) struct wb_softc *sc; { - struct ether_header *eh; struct mbuf *m = NULL; struct ifnet *ifp; struct wb_chain_onefrag *cur_rx; @@ -1184,11 +1182,7 @@ static void wb_rxeof(sc) m = m0; ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); - - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } } diff --git a/sys/dev/netif/wi/if_wi.c b/sys/dev/netif/wi/if_wi.c index 68a3a9f618..1984163259 100644 --- a/sys/dev/netif/wi/if_wi.c +++ b/sys/dev/netif/wi/if_wi.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/wi/if_wi.c,v 1.103.2.2 2002/08/02 07:11:34 imp Exp $ - * $DragonFly: src/sys/dev/netif/wi/if_wi.c,v 1.13 2004/07/02 17:42:20 joerg Exp $ + * $DragonFly: src/sys/dev/netif/wi/if_wi.c,v 1.14 2004/07/23 07:16:29 joerg Exp $ */ /* @@ -128,8 +128,7 @@ static void wi_setdef(struct wi_softc *, struct wi_req *); #ifdef WICACHE static -void wi_cache_store(struct wi_softc *, struct ether_header *, - struct mbuf *, unsigned short); +void wi_cache_store(struct wi_softc *, struct mbuf *, unsigned short); #endif static int wi_get_cur_ssid(struct wi_softc *, char *, int *); @@ -267,7 +266,6 @@ wi_generic_attach(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = wi_ioctl; - ifp->if_output = ether_output; ifp->if_start = wi_start; ifp->if_watchdog = wi_watchdog; ifp->if_init = wi_init; @@ -800,11 +798,10 @@ wi_rxeof(sc) return; } /* Receive packet. */ - m_adj(m, sizeof(struct ether_header)); #ifdef WICACHE - wi_cache_store(sc, eh, m, rx_frame.wi_q_info); + wi_cache_store(sc, m, rx_frame.wi_q_info); #endif - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } } @@ -2642,15 +2639,14 @@ SYSCTL_INT(_machdep, OID_AUTO, wi_cache_iponly, CTLFLAG_RW, * to do that instead of the scaling it did originally. */ static void -wi_cache_store(struct wi_softc *sc, struct ether_header *eh, - struct mbuf *m, unsigned short rx_quality) +wi_cache_store(struct wi_softc *sc, struct mbuf *m, unsigned short rx_quality) { - struct ip *ip = 0; + struct ether_header *eh = mtod(m, struct ether_header *); + struct ip *ip = NULL; int i; static int cache_slot = 0; /* use this cache entry */ static int wrapindex = 0; /* next "free" cache entry */ int sig, noise; - int sawip=0; /* * filters: @@ -2659,16 +2655,10 @@ wi_cache_store(struct wi_softc *sc, struct ether_header *eh, * keep multicast only. */ - if ((ntohs(eh->ether_type) == ETHERTYPE_IP)) { - sawip = 1; - } - - /* - * filter for ip packets only - */ - if (wi_cache_iponly && !sawip) { + if ((ntohs(eh->ether_type) == ETHERTYPE_IP)) + ip = (struct ip *)(mtod(m, uint8_t *) + ETHER_HDR_LEN); + else if (wi_cache_iponly) return; - } /* * filter for broadcast/multicast only @@ -2682,12 +2672,6 @@ wi_cache_store(struct wi_softc *sc, struct ether_header *eh, rx_quality & 0xffff, rx_quality >> 8, rx_quality & 0xff); #endif - /* - * find the ip header. we want to store the ip_src - * address. - */ - if (sawip) - ip = mtod(m, struct ip *); /* * do a linear search for a matching MAC address @@ -2758,7 +2742,7 @@ wi_cache_store(struct wi_softc *sc, struct ether_header *eh, * .mac src * .signal, etc. */ - if (sawip) + if (ip != NULL) sc->wi_sigcache[cache_slot].ipsrc = ip->ip_src.s_addr; bcopy( eh->ether_shost, sc->wi_sigcache[cache_slot].macsrc, 6); diff --git a/sys/dev/netif/wl/if_wl.c b/sys/dev/netif/wl/if_wl.c index ea3ba60782..c2e845d94e 100644 --- a/sys/dev/netif/wl/if_wl.c +++ b/sys/dev/netif/wl/if_wl.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/i386/isa/if_wl.c,v 1.27.2.2 2000/07/17 21:24:32 archie Exp $ */ -/* $DragonFly: src/sys/dev/netif/wl/if_wl.c,v 1.12 2004/07/02 17:42:20 joerg Exp $ */ +/* $DragonFly: src/sys/dev/netif/wl/if_wl.c,v 1.13 2004/07/23 07:16:30 joerg Exp $ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -496,7 +496,6 @@ wlattach(struct isa_device *id) ifp->if_flags |= IFF_MULTICAST; #endif /* MULTICAST */ ifp->if_init = wlinit; - ifp->if_output = ether_output; ifp->if_start = wlstart; ifp->if_ioctl = wlioctl; ifp->if_timer = 0; /* paranoia */ diff --git a/sys/dev/netif/wx/if_wx.c b/sys/dev/netif/wx/if_wx.c index 6c3cfdefbe..40d81214c1 100644 --- a/sys/dev/netif/wx/if_wx.c +++ b/sys/dev/netif/wx/if_wx.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/pci/if_wx.c,v 1.5.2.12 2003/03/05 18:42:34 njl Exp $ */ -/* $DragonFly: src/sys/dev/netif/wx/Attic/if_wx.c,v 1.10 2004/07/02 17:42:20 joerg Exp $ */ +/* $DragonFly: src/sys/dev/netif/wx/Attic/if_wx.c,v 1.11 2004/07/23 07:16:30 joerg Exp $ */ /* * Principal Author: Matthew Jacob * Copyright (c) 1999, 2001 by Traakan Software @@ -332,7 +332,6 @@ wx_attach(device_t dev) ifp = &sc->w.arpcom.ac_if; if_initname(ifp, "wx", device_get_unit(dev)); ifp->if_mtu = ETHERMTU; /* we always start at ETHERMTU size */ - ifp->if_output = ether_output; ifp->if_baudrate = 1000000000; ifp->if_init = (void (*)(void *))wx_init; ifp->if_softc = sc; @@ -1123,7 +1122,6 @@ wx_check_link(wx_softc_t *sc) static void wx_handle_rxint(wx_softc_t *sc) { - struct ether_header *eh; struct mbuf *m0, *mb, *pending[WX_MAX_RDESC]; struct ifnet *ifp = &sc->wx_if; int npkts, ndesc, lidx, idx, tlen; @@ -1259,7 +1257,6 @@ wx_handle_rxint(wx_softc_t *sc) m0->m_pkthdr.len = tlen - WX_CRC_LENGTH; mb->m_len -= WX_CRC_LENGTH; - eh = mtod(m0, struct ether_header *); /* * No need to check for promiscous mode since * the decision to keep or drop the packet is @@ -1291,9 +1288,7 @@ wx_handle_rxint(wx_softc_t *sc) ifp->if_ipackets++; DPRINTF(sc, ("%s: RECV packet length %d\n", sc->wx_name, mb->m_pkthdr.len)); - eh = mtod(mb, struct ether_header *); - m_adj(mb, sizeof (struct ether_header)); - ether_input(ifp, eh, mb); + (*ifp->if_input)(ifp, mb); } } diff --git a/sys/dev/netif/xe/if_xe.c b/sys/dev/netif/xe/if_xe.c index b74afe64bc..e6bd4097d9 100644 --- a/sys/dev/netif/xe/if_xe.c +++ b/sys/dev/netif/xe/if_xe.c @@ -25,7 +25,7 @@ * * $Id: if_xe.c,v 1.20 1999/06/13 19:17:40 scott Exp $ * $FreeBSD: src/sys/dev/xe/if_xe.c,v 1.13.2.6 2003/02/05 22:03:57 mbr Exp $ - * $DragonFly: src/sys/dev/netif/xe/if_xe.c,v 1.12 2004/07/02 17:42:20 joerg Exp $ + * $DragonFly: src/sys/dev/netif/xe/if_xe.c,v 1.13 2004/07/23 07:16:30 joerg Exp $ */ /* @@ -530,7 +530,6 @@ xe_attach (device_t dev) { scp->ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); scp->ifp->if_linkmib = &scp->mibdata; scp->ifp->if_linkmiblen = sizeof scp->mibdata; - scp->ifp->if_output = ether_output; scp->ifp->if_start = xe_start; scp->ifp->if_ioctl = xe_ioctl; scp->ifp->if_watchdog = xe_watchdog; @@ -1019,9 +1018,8 @@ xe_intr(void *xscp) /* Deliver packet to upper layers */ if (mbp != NULL) { - mbp->m_pkthdr.len = mbp->m_len = len - ETHER_HDR_LEN; - mbp->m_data += ETHER_HDR_LEN; /* Strip off Ethernet header */ - ether_input(ifp, ehp, mbp); /* Send the packet on its way */ + mbp->m_pkthdr.len = mbp->m_len = len; + (*ifp->if_input)(ifp, mbp); /* Send the packet on its way */ ifp->if_ipackets++; /* Success! */ } XE_OUTW(XE_DO, 0x8000); /* skip_rx_packet command */ diff --git a/sys/dev/netif/xl/if_xl.c b/sys/dev/netif/xl/if_xl.c index 44e768c937..b5b6cbb309 100644 --- a/sys/dev/netif/xl/if_xl.c +++ b/sys/dev/netif/xl/if_xl.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_xl.c,v 1.72.2.28 2003/10/08 06:01:57 murray Exp $ - * $DragonFly: src/sys/dev/netif/xl/if_xl.c,v 1.13 2004/07/02 17:42:21 joerg Exp $ + * $DragonFly: src/sys/dev/netif/xl/if_xl.c,v 1.14 2004/07/23 07:16:30 joerg Exp $ */ /* @@ -1593,7 +1593,6 @@ xl_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = xl_ioctl; - ifp->if_output = ether_output; ifp->if_capabilities = 0; if (sc->xl_type == XL_TYPE_905B) { ifp->if_start = xl_start_90xB; @@ -2054,7 +2053,6 @@ static void xl_rxeof(sc) struct xl_softc *sc; { - struct ether_header *eh; struct mbuf *m; struct ifnet *ifp; struct xl_chain_onefrag *cur_rx; @@ -2133,13 +2131,9 @@ again: sc->xl_ldata.xl_rx_dmamap, BUS_DMASYNC_PREWRITE); ifp->if_ipackets++; - eh = mtod(m, struct ether_header *); m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = total_len; - /* Remove header from mbuf and pass it on. */ - m_adj(m, sizeof(struct ether_header)); - if (ifp->if_capenable & IFCAP_RXCSUM) { /* Do IP checksum checking. */ if (rxstat & XL_RXSTAT_IPCKOK) @@ -2156,7 +2150,7 @@ again: } } - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); } /* diff --git a/sys/net/ef/if_ef.c b/sys/net/ef/if_ef.c index e251ee86c9..5990596fc1 100644 --- a/sys/net/ef/if_ef.c +++ b/sys/net/ef/if_ef.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/if_ef.c,v 1.2.2.4 2001/02/22 09:27:04 bp Exp $ - * $DragonFly: src/sys/net/ef/if_ef.c,v 1.10 2004/06/02 14:42:58 eirikn Exp $ + * $DragonFly: src/sys/net/ef/if_ef.c,v 1.11 2004/07/23 07:16:30 joerg Exp $ */ #include "opt_inet.h" @@ -121,7 +121,6 @@ ef_attach(struct efnet *sc) struct ifaddr *ifa; struct sockaddr_dl *sdl; - ifp->if_output = ether_output; ifp->if_start = ef_start; ifp->if_watchdog = NULL; ifp->if_init = ef_init; diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index 2da383a2ee..c79d3bf210 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -2,7 +2,7 @@ * Fundamental constants relating to ethernet. * * $FreeBSD: src/sys/net/ethernet.h,v 1.12.2.8 2002/12/01 14:03:09 sobomax Exp $ - * $DragonFly: src/sys/net/ethernet.h,v 1.7 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/net/ethernet.h,v 1.8 2004/07/23 07:16:30 joerg Exp $ * */ @@ -361,13 +361,12 @@ extern void (*ng_ether_attach_p)(struct ifnet *ifp); extern void (*ng_ether_detach_p)(struct ifnet *ifp); extern int (*vlan_input_p)(struct ether_header *eh, struct mbuf *m); -extern int (*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m, - u_int16_t t); +extern int (*vlan_input_tag_p)(struct mbuf *m, uint16_t t); -#define VLAN_INPUT_TAG(eh, m, t) do { \ +#define VLAN_INPUT_TAG(m, t) do { \ /* XXX: lock */ \ if (vlan_input_tag_p != NULL) \ - (*vlan_input_tag_p)(eh, m, t); \ + (*vlan_input_tag_p)(m, t); \ else { \ (m)->m_pkthdr.rcvif->if_noproto++; \ m_freem(m); \ diff --git a/sys/net/if_arc.h b/sys/net/if_arc.h index e62e7d6d30..75e74efebf 100644 --- a/sys/net/if_arc.h +++ b/sys/net/if_arc.h @@ -1,6 +1,6 @@ /* $NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp $ */ /* $FreeBSD: src/sys/net/if_arc.h,v 1.2.2.3 2003/01/28 11:19:05 fjoe Exp $ */ -/* $DragonFly: src/sys/net/Attic/if_arc.h,v 1.3 2003/08/26 20:49:47 rob Exp $ */ +/* $DragonFly: src/sys/net/Attic/if_arc.h,v 1.4 2004/07/23 07:16:30 joerg Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -135,9 +135,6 @@ void arc_ifattach (struct ifnet *, u_int8_t); void arc_ifdetach (struct ifnet *); void arc_storelladdr (struct ifnet *, u_int8_t); int arc_isphds (int); -void arc_input (struct ifnet *, struct mbuf *); -int arc_output (struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *); int arc_ioctl (struct ifnet *, int, caddr_t); void arc_frag_init (struct ifnet *); diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index d745c199e8..c9b7b2c032 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -1,6 +1,6 @@ /* $NetBSD: if_arcsubr.c,v 1.36 2001/06/14 05:44:23 itojun Exp $ */ /* $FreeBSD: src/sys/net/if_arcsubr.c,v 1.1.2.5 2003/02/05 18:42:15 fjoe Exp $ */ -/* $DragonFly: src/sys/net/Attic/if_arcsubr.c,v 1.9 2004/07/17 09:43:05 joerg Exp $ */ +/* $DragonFly: src/sys/net/Attic/if_arcsubr.c,v 1.10 2004/07/23 07:16:30 joerg Exp $ */ /* * Copyright (c) 1994, 1995 Ignatios Souvatzis @@ -87,6 +87,9 @@ MODULE_VERSION(arcnet, 1); static struct mbuf *arc_defrag (struct ifnet *, struct mbuf *); static int arc_resolvemulti (struct ifnet *, struct sockaddr **, struct sockaddr *); +static void arc_input(struct ifnet *, struct mbuf *); +static int arc_output(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); #define ARC_LLADDR(ifp) (*(u_int8_t *)IF_LLADDR(ifp)) @@ -101,12 +104,9 @@ const uint8_t arcbroadcastaddr[1] = {0}; * Encapsulate a packet of type family for the local net. * Assumes that ifp is actually pointer to arccom structure. */ -int -arc_output(ifp, m, dst, rt0) - struct ifnet *ifp; - struct mbuf *m; - struct sockaddr *dst; - struct rtentry *rt0; +static int +arc_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, + struct rtentry *rt0) { struct rtentry *rt; struct arccom *ac; @@ -524,10 +524,8 @@ arc_isphds(type) * the packet is in the mbuf chain m with * the ARCnet header. */ -void -arc_input(ifp, m) - struct ifnet *ifp; - struct mbuf *m; +static void +arc_input(struct ifnet *ifp, struct mbuf *m) { struct arc_header *ah; int isr; @@ -648,6 +646,8 @@ arc_ifattach(ifp, lla) struct sockaddr_dl *sdl; struct arccom *ac; + ifp->if_input = arc_input; + ifp->if_output = arc_output; if_attach(ifp); ifp->if_type = IFT_ARCNET; ifp->if_addrlen = 1; diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index e0f4124a65..9460b7bbd0 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -32,7 +32,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net/if_atmsubr.c,v 1.10.2.1 2001/03/06 00:29:26 obrien Exp $ - * $DragonFly: src/sys/net/if_atmsubr.c,v 1.9 2004/06/02 14:42:57 eirikn Exp $ + * $DragonFly: src/sys/net/if_atmsubr.c,v 1.10 2004/07/23 07:16:30 joerg Exp $ */ /* @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -89,11 +90,8 @@ */ int -atm_output(ifp, m0, dst, rt0) - struct ifnet *ifp; - struct mbuf *m0; - struct sockaddr *dst; - struct rtentry *rt0; +atm_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, + struct rtentry *rt0) { u_int16_t etype = 0; /* if using LLC/SNAP */ int s, error = 0, sz; @@ -316,8 +314,12 @@ atm_ifattach(ifp) ifp->if_addrlen = 0; ifp->if_hdrlen = 0; ifp->if_mtu = ATMMTU; +#if 0 /* XXX */ + ifp->if_input = atm_input; +#endif ifp->if_output = atm_output; ifp->if_snd.ifq_maxlen = 50; /* dummy */ + if_attach(ifp); #if defined(__NetBSD__) || defined(__OpenBSD__) for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != 0; @@ -337,5 +339,5 @@ atm_ifattach(ifp) #endif break; } - + bpfattach(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc)); } diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 93e7db5af3..fcc8cb6b75 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -32,7 +32,7 @@ * * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/if_ethersubr.c,v 1.70.2.33 2003/04/28 15:45:53 archie Exp $ - * $DragonFly: src/sys/net/if_ethersubr.c,v 1.17 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/net/if_ethersubr.c,v 1.18 2004/07/23 07:16:30 joerg Exp $ */ #include "opt_atalk.h" @@ -110,8 +110,10 @@ void (*ng_ether_attach_p)(struct ifnet *ifp); void (*ng_ether_detach_p)(struct ifnet *ifp); int (*vlan_input_p)(struct ether_header *eh, struct mbuf *m); -int (*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m, - u_int16_t t); +int (*vlan_input_tag_p)(struct mbuf *m, uint16_t t); + +static int ether_output(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); /* bridge support */ int do_bridge; @@ -141,12 +143,9 @@ static int ether_ipfw; * packet leaves a multiple of 512 bytes of data in remainder. * Assumes that ifp is actually pointer to arpcom structure. */ -int -ether_output(ifp, m, dst, rt0) - struct ifnet *ifp; - struct mbuf *m; - struct sockaddr *dst; - struct rtentry *rt0; +static int +ether_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, + struct rtentry *rt0) { short type; int error = 0, hdrcmplt = 0; @@ -532,6 +531,15 @@ ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst, return 0; } +/* + * XXX merge this function with ether_input. + */ +static void +ether_input_internal(struct ifnet *ifp, struct mbuf *m) +{ + ether_input(ifp, NULL, m); +} + /* * Process a received Ethernet packet. We have two different interfaces: * one (conventional) assumes the packet in the mbuf, with the ethernet @@ -566,9 +574,9 @@ ether_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) } m->m_pkthdr.rcvif = ifp; eh = mtod(m, struct ether_header *); - m->m_data += sizeof(struct ether_header); - m->m_len -= sizeof(struct ether_header); - m->m_pkthdr.len = m->m_len; + m_adj(m, sizeof(struct ether_header)); + /* XXX */ + /* m->m_pkthdr.len = m->m_len; */ } /* Check for a BPF tap */ @@ -818,6 +826,8 @@ ether_ifattach_bpf(struct ifnet *ifp, uint8_t *lla, u_int dlt, u_int hdrlen) struct ifaddr *ifa; struct sockaddr_dl *sdl; + ifp->if_output = ether_output; + ifp->if_input = ether_input_internal; ifp->if_type = IFT_ETHER; ifp->if_addrlen = ETHER_ADDR_LEN; ifp->if_broadcastaddr = etherbroadcastaddr; diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 1f99d854ef..8682db9fd9 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -34,7 +34,7 @@ * * from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp * $FreeBSD: src/sys/net/if_fddisubr.c,v 1.41.2.8 2002/02/20 23:34:09 fjoe Exp $ - * $DragonFly: src/sys/net/Attic/if_fddisubr.c,v 1.10 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/net/Attic/if_fddisubr.c,v 1.11 2004/07/23 07:16:30 joerg Exp $ */ #include "opt_atalk.h" @@ -49,6 +49,7 @@ #include #include +#include #include #include #include @@ -98,6 +99,9 @@ extern u_char aarp_org_code[ 3 ]; static int fddi_resolvemulti (struct ifnet *, struct sockaddr **, struct sockaddr *); +static void fddi_input(struct ifnet *, struct mbuf *); +static int fddi_output(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); #define senderr(e) { error = (e); goto bad;} @@ -122,12 +126,9 @@ static int fddi_resolvemulti (struct ifnet *, struct sockaddr **, * packet leaves a multiple of 512 bytes of data in remainder. * Assumes that ifp is actually pointer to arpcom structure. */ -int -fddi_output(ifp, m, dst, rt0) - struct ifnet *ifp; - struct mbuf *m; - struct sockaddr *dst; - struct rtentry *rt0; +static int +fddi_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, + struct rtentry *rt0) { u_int16_t type; int s, loop_copy = 0, error = 0, hdrcmplt = 0; @@ -382,14 +383,20 @@ bad: * the packet is in the mbuf chain m without * the fddi header, which is provided separately. */ -void -fddi_input(ifp, fh, m) - struct ifnet *ifp; - struct fddi_header *fh; - struct mbuf *m; +static void +fddi_input(struct ifnet *ifp, struct mbuf *m) { int isr; struct llc *l; + struct fddi_header *fh = mtod(m, struct fddi_header *); + + if (m->m_len < sizeof(struct fddi_header)) { + /* XXX error in the caller. */ + m_freem(m); + return; + } + m_adj(m, sizeof(struct fddi_header)); + m->m_pkthdr.rcvif = ifp; if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); @@ -527,6 +534,8 @@ fddi_ifattach(ifp) struct ifaddr *ifa; struct sockaddr_dl *sdl; + ifp->if_input = fddi_input; + ifp->if_output = fddi_output; ifp->if_type = IFT_FDDI; ifp->if_addrlen = 6; ifp->if_broadcastaddr = fddibroadcastaddr; @@ -537,6 +546,7 @@ fddi_ifattach(ifp) #ifdef IFF_NOTRAILERS ifp->if_flags |= IFF_NOTRAILERS; #endif + if_attach(ifp); #if defined(__DragonFly__) || defined(__FreeBSD__) ifa = ifnet_addrs[ifp->if_index - 1]; sdl = (struct sockaddr_dl *)ifa->ifa_addr; @@ -559,6 +569,7 @@ fddi_ifattach(ifp) break; } #endif + bpfattach(ifp, DLT_FDDI, sizeof(struct fddi_header)); } static int diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c index 20f04aa324..511571f51a 100644 --- a/sys/net/if_iso88025subr.c +++ b/sys/net/if_iso88025subr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/if_iso88025subr.c,v 1.7.2.7 2002/06/18 00:15:31 kbyanc Exp $ - * $DragonFly: src/sys/net/Attic/if_iso88025subr.c,v 1.8 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/net/Attic/if_iso88025subr.c,v 1.9 2004/07/23 07:16:30 joerg Exp $ * */ @@ -83,19 +83,26 @@ #include #include +static int iso88025_output(struct ifnet *, struct mbuf *, + struct sockaddr *, struct rtentry *); +static void iso88025_input(struct ifnet *, struct mbuf *); + void iso88025_ifattach(struct ifnet *ifp) { - struct ifaddr *ifa = NULL; - struct sockaddr_dl *sdl; - - ifp->if_type = IFT_ISO88025; - ifp->if_addrlen = ISO88025_ADDR_LEN; - ifp->if_hdrlen = ISO88025_HDR_LEN; - if (ifp->if_baudrate == 0) - ifp->if_baudrate = TR_16MBPS; /* 16Mbit should be a safe default */ - if (ifp->if_mtu == 0) - ifp->if_mtu = ISO88025_DEFAULT_MTU; + struct ifaddr *ifa = NULL; + struct sockaddr_dl *sdl; + + ifp->if_input = iso88025_input; + ifp->if_output = iso88025_output; + if_attach(ifp); + ifp->if_type = IFT_ISO88025; + ifp->if_addrlen = ISO88025_ADDR_LEN; + ifp->if_hdrlen = ISO88025_HDR_LEN; + if (ifp->if_baudrate == 0) + ifp->if_baudrate = TR_16MBPS; /* 16Mbit should be a safe default */ + if (ifp->if_mtu == 0) + ifp->if_mtu = ISO88025_DEFAULT_MTU; ifa = ifnet_addrs[ifp->if_index - 1]; if (ifa == 0) { @@ -106,6 +113,7 @@ iso88025_ifattach(struct ifnet *ifp) sdl->sdl_type = IFT_ISO88025; sdl->sdl_alen = ifp->if_addrlen; bcopy(((struct arpcom *)ifp)->ac_enaddr, LLADDR(sdl), ifp->if_addrlen); + bpfattach(ifp, DLT_IEEE802, sizeof(struct iso88025_header)); } int @@ -159,7 +167,7 @@ iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data) /* * ISO88025 encapsulation */ -int +static int iso88025_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct rtentry *rt0) { struct iso88025_header *th; @@ -328,18 +336,33 @@ bad: /* * ISO 88025 de-encapsulation */ -void -iso88025_input(struct ifnet *ifp, struct iso88025_header *th, struct mbuf *m) +static void +iso88025_input(struct ifnet *ifp, struct mbuf *m) { + struct llc *l; + struct iso88025_header *th = mtod(m, struct iso88025_header *); + int isr, hdr_len; u_short ether_type; - int isr; - struct llc *l = mtod(m, struct llc *); if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); return; } + hdr_len = ISO88025_HDR_LEN; + if (th->iso88025_shost[0] & 0x80) + hdr_len += (ntohs(th->rcf) & 0x1f00) >> 8; + + if (m->m_len < hdr_len) { + m_freem(m); + return; + } + m->m_pkthdr.len -= hdr_len; + m->m_len -= hdr_len; + m->m_data += hdr_len; + + l = mtod(m, struct llc *); + switch (l->llc_control) { case LLC_UI: break; diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 6166f991a2..d7660096cd 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -32,7 +32,7 @@ * * From: @(#)if.h 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.16 2003/04/15 18:11:19 fjoe Exp $ - * $DragonFly: src/sys/net/if_var.h,v 1.14 2004/07/17 09:43:05 joerg Exp $ + * $DragonFly: src/sys/net/if_var.h,v 1.15 2004/07/23 07:16:30 joerg Exp $ */ #ifndef _NET_IF_VAR_H_ @@ -54,8 +54,10 @@ * * On input, each interface unwraps the data received by it, and either * places it on the input queue of a internetwork datagram routine - * and posts the associated software interrupt, or passes the datagram to a raw - * packet input routine. + * and posts the associated software interrupt, or passes the datagram to + * the routine if_input. It is called with the mbuf chain as parameter: + * (*ifp->if_input)(ifp, m) + * The input routine removes the protocol dependent header if necessary. * * Routines exist for locating interfaces by their addresses * or for locating a interface on a certain network, as well as more general @@ -156,6 +158,8 @@ struct ifnet { int (*if_output) /* output routine (enqueue) */ (struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); + void (*if_input) /* input routine from hardware driver */ + (struct ifnet *, struct mbuf *); void (*if_start) /* initiate output routine */ (struct ifnet *); int (*if_ioctl) /* ioctl routine */ @@ -368,8 +372,6 @@ void ether_ifattach_bpf(struct ifnet *, uint8_t *, u_int, u_int); void ether_ifdetach(struct ifnet *); void ether_input(struct ifnet *, struct ether_header *, struct mbuf *); void ether_demux(struct ifnet *, struct ether_header *, struct mbuf *); -int ether_output(struct ifnet *, - struct mbuf *, struct sockaddr *, struct rtentry *); int ether_output_frame(struct ifnet *, struct mbuf *); int ether_ioctl(struct ifnet *, int, caddr_t); uint32_t ether_crc32_le(const uint8_t *, size_t); diff --git a/sys/net/iso88025.h b/sys/net/iso88025.h index 94f6726866..acf0b1208a 100644 --- a/sys/net/iso88025.h +++ b/sys/net/iso88025.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/iso88025.h,v 1.3.2.2 2002/06/18 00:15:31 kbyanc Exp $ - * $DragonFly: src/sys/net/Attic/iso88025.h,v 1.3 2003/08/26 20:49:47 rob Exp $ + * $DragonFly: src/sys/net/Attic/iso88025.h,v 1.4 2004/07/23 07:16:30 joerg Exp $ * * Information gathered from tokenring@freebsd, /sys/net/ethernet.h and * the Mach token ring driver. @@ -128,7 +128,5 @@ struct iso88025_addr { void iso88025_ifattach (struct ifnet *); int iso88025_ioctl (struct ifnet *, int , caddr_t ); -int iso88025_output (struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); -void iso88025_input (struct ifnet *, struct iso88025_header *, struct mbuf *); #endif diff --git a/sys/net/tap/if_tap.c b/sys/net/tap/if_tap.c index d3e7109d02..3c5e8ecad5 100644 --- a/sys/net/tap/if_tap.c +++ b/sys/net/tap/if_tap.c @@ -32,7 +32,7 @@ /* * $FreeBSD: src/sys/net/if_tap.c,v 1.3.2.3 2002/04/14 21:41:48 luigi Exp $ - * $DragonFly: src/sys/net/tap/if_tap.c,v 1.14 2004/06/02 14:42:59 eirikn Exp $ + * $DragonFly: src/sys/net/tap/if_tap.c,v 1.15 2004/07/23 07:16:31 joerg Exp $ * $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $ */ @@ -244,7 +244,6 @@ tapcreate(dev) taplastunit = unit; ifp->if_init = tapifinit; - ifp->if_output = ether_output; ifp->if_start = tapifstart; ifp->if_ioctl = tapifioctl; ifp->if_mtu = ETHERMTU; @@ -716,7 +715,6 @@ tapwrite(dev, uio, flag) struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = &tp->tap_if; struct mbuf *top = NULL, **mp = NULL, *m = NULL; - struct ether_header *eh = NULL; int error = 0, tlen, mlen; TAPDEBUG("%s writting, minor = %#x\n", @@ -772,9 +770,7 @@ tapwrite(dev, uio, flag) * adjust mbuf and give packet to the ether_input */ - eh = mtod(top, struct ether_header *); - m_adj(top, sizeof(struct ether_header)); - ether_input(ifp, eh, top); + (*ifp->if_input)(ifp, top); ifp->if_ipackets ++; /* ibytes are counted in ether_input */ return (0); diff --git a/sys/net/vlan/if_vlan.c b/sys/net/vlan/if_vlan.c index bb1c63d01d..a41d115425 100644 --- a/sys/net/vlan/if_vlan.c +++ b/sys/net/vlan/if_vlan.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/if_vlan.c,v 1.15.2.13 2003/02/14 22:25:58 fenner Exp $ - * $DragonFly: src/sys/net/vlan/if_vlan.c,v 1.9 2004/06/02 14:42:59 eirikn Exp $ + * $DragonFly: src/sys/net/vlan/if_vlan.c,v 1.10 2004/07/23 07:16:31 joerg Exp $ */ /* @@ -99,8 +99,7 @@ static void vlan_clone_destroy(struct ifnet *); static void vlan_start(struct ifnet *ifp); static void vlan_ifinit(void *foo); static int vlan_input(struct ether_header *eh, struct mbuf *m); -static int vlan_input_tag(struct ether_header *eh, struct mbuf *m, - u_int16_t t); +static int vlan_input_tag(struct mbuf *m, uint16_t t); static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr, struct ucred *cr); static int vlan_setmulti(struct ifnet *ifp); @@ -230,7 +229,6 @@ vlan_clone_create(struct if_clone *ifc, int unit) ifp->if_init = vlan_ifinit; ifp->if_start = vlan_start; ifp->if_ioctl = vlan_ioctl; - ifp->if_output = ether_output; ifp->if_snd.ifq_maxlen = ifqmaxlen; ether_ifattach(ifp, ifv->ifv_ac.ac_enaddr); /* Now undo some of the damage... */ @@ -370,9 +368,12 @@ vlan_start(struct ifnet *ifp) } static int -vlan_input_tag(struct ether_header *eh, struct mbuf *m, u_int16_t t) +vlan_input_tag( struct mbuf *m, uint16_t t) { struct ifvlan *ifv; + struct ether_header *eh = mtod(m, struct ether_header *); + + m_adj(m, ETHER_HDR_LEN); /* * Fake up a header and send the packet to the physical interface's diff --git a/sys/netgraph/eiface/ng_eiface.c b/sys/netgraph/eiface/ng_eiface.c index 8e339582fb..9f8f43ca53 100644 --- a/sys/netgraph/eiface/ng_eiface.c +++ b/sys/netgraph/eiface/ng_eiface.c @@ -28,7 +28,7 @@ * * $Id: ng_eiface.c,v 1.14 2000/03/15 12:28:44 vitaly Exp $ * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.4.2.5 2002/12/17 21:47:48 julian Exp $ - * $DragonFly: src/sys/netgraph/eiface/ng_eiface.c,v 1.5 2004/03/14 15:36:54 joerg Exp $ + * $DragonFly: src/sys/netgraph/eiface/ng_eiface.c,v 1.6 2004/07/23 07:16:31 joerg Exp $ */ #include @@ -344,7 +344,6 @@ ng_eiface_constructor(node_p *nodep) /* Initialize interface structure */ if_initname(ifp, ng_eiface_ifname, ng_eiface_next_unit++); ifp->if_init = ng_eiface_init; - ifp->if_output = ether_output; ifp->if_start = ng_eiface_start; ifp->if_ioctl = ng_eiface_ioctl; ifp->if_watchdog = NULL; @@ -524,27 +523,7 @@ ng_eiface_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) if (ifp->if_bpf) bpf_mtap(ifp, m); - eh = mtod( m, struct ether_header * ); - ether_type = ntohs(eh->ether_type); - - s = splimp(); - m->m_pkthdr.len -= sizeof(*eh); - m->m_len -= sizeof(*eh); - if ( m->m_len ) - { - m->m_data += sizeof(*eh); - } - else - { - if ( ether_type == ETHERTYPE_ARP ) - { - m->m_len = m->m_next->m_len; - m->m_data = m->m_next->m_data; - } - } - splx(s); - - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); /* Done */ return (error); diff --git a/sys/netgraph/fec/ng_fec.c b/sys/netgraph/fec/ng_fec.c index 7b6a0c2343..a8250b09da 100644 --- a/sys/netgraph/fec/ng_fec.c +++ b/sys/netgraph/fec/ng_fec.c @@ -33,7 +33,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_fec.c,v 1.1.2.1 2002/11/01 21:39:31 julian Exp $ - * $DragonFly: src/sys/netgraph/fec/ng_fec.c,v 1.7 2004/07/19 09:23:23 joerg Exp $ + * $DragonFly: src/sys/netgraph/fec/ng_fec.c,v 1.8 2004/07/23 07:16:31 joerg Exp $ */ /* * Copyright (c) 1996-1999 Whistle Communications, Inc. @@ -164,6 +164,8 @@ struct ng_fec_private { node_p node; /* Our netgraph node */ struct ng_fec_bundle fec_bundle;/* Aggregate bundle */ struct callout_handle fec_ch; /* callout handle for ticker */ + int (*real_if_output)(struct ifnet *, struct mbuf *, + struct sockaddr *, struct rtentry *); }; typedef struct ng_fec_private *priv_p; @@ -832,7 +834,7 @@ ng_fec_output(struct ifnet *ifp, struct mbuf *m, * for us. */ priv->if_error = 0; - error = ether_output(ifp, m, dst, rt0); + error = priv->real_if_output(ifp, m, dst, rt0); if (priv->if_error && !error) error = priv->if_error; @@ -1084,7 +1086,6 @@ ng_fec_constructor(node_p *nodep) /* Initialize interface structure */ if_initname(ifp, NG_FEC_FEC_NAME, priv->unit); - ifp->if_output = ng_fec_output; ifp->if_start = ng_fec_start; ifp->if_ioctl = ng_fec_ioctl; ifp->if_init = ng_fec_init; @@ -1110,6 +1111,8 @@ ng_fec_constructor(node_p *nodep) /* Attach the interface */ ether_ifattach(ifp, priv->arpcom.ac_enaddr); + priv->real_if_output = ifp->if_output; + ifp->if_output = ng_fec_output; callout_handle_init(&priv->fec_ch); TAILQ_INIT(&b->ng_fec_ports); diff --git a/sys/netinet/if_fddi.h b/sys/netinet/if_fddi.h index f42d39569b..6dc082746f 100644 --- a/sys/netinet/if_fddi.h +++ b/sys/netinet/if_fddi.h @@ -34,7 +34,7 @@ * * @(#)if_fddi.h 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/netinet/if_fddi.h,v 1.8 1999/12/29 04:40:58 peter Exp $ - * $DragonFly: src/sys/netinet/Attic/if_fddi.h,v 1.3 2003/08/23 11:18:00 rob Exp $ + * $DragonFly: src/sys/netinet/Attic/if_fddi.h,v 1.4 2004/07/23 07:16:31 joerg Exp $ */ #ifndef _NETINET_IF_FDDI_H_ @@ -79,9 +79,6 @@ struct fddi_header { #define fddi_sprintf ether_sprintf void fddi_ifattach (struct ifnet *); -void fddi_input (struct ifnet *, struct fddi_header *, struct mbuf *); -int fddi_output (struct ifnet *, - struct mbuf *, struct sockaddr *, struct rtentry *); #endif -- 2.41.0