diff options
author | sam <sam@FreeBSD.org> | 2002-11-14 23:54:55 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2002-11-14 23:54:55 +0000 |
commit | 14c32b5f40c5ee3bd5649c3737f359f7e65e6944 (patch) | |
tree | 84eb7252cc6a518796c6bf88903ed6e2d12e7b91 /sys/dev/tx | |
parent | 10eb947d277840d02ef35d6c6303b64329d53806 (diff) | |
download | FreeBSD-src-14c32b5f40c5ee3bd5649c3737f359f7e65e6944.zip FreeBSD-src-14c32b5f40c5ee3bd5649c3737f359f7e65e6944.tar.gz |
network interface driver changes:
o don't strip the Ethernet header from inbound packets; pass packets
up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls
Reviewed by: many
Approved by: re
Diffstat (limited to 'sys/dev/tx')
-rw-r--r-- | sys/dev/tx/if_tx.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c index dd94f6e..51690e4 100644 --- a/sys/dev/tx/if_tx.c +++ b/sys/dev/tx/if_tx.c @@ -333,8 +333,9 @@ epic_attach(dev) printf("\n"); /* Attach to OS's managers */ - ether_ifattach(ifp, ETHER_BPF_SUPPORTED); + ether_ifattach(ifp, sc->sc_macaddr); ifp->if_hdrlen = sizeof(struct ether_vlan_header); + ifp->if_capabilities |= IFCAP_VLAN_MTU; callout_handle_init(&sc->stat_ch); fail: @@ -359,7 +360,7 @@ epic_detach(dev) sc = device_get_softc(dev); ifp = &sc->arpcom.ac_if; - ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); + ether_ifdetach(ifp); epic_stop(sc); @@ -416,10 +417,6 @@ epic_ifioctl(ifp, command, data) x = splimp(); switch (command) { - case SIOCSIFADDR: - case SIOCGIFADDR: - error = ether_ioctl(ifp, command, data); - break; case SIOCSIFMTU: if (ifp->if_mtu == ifr->ifr_mtu) break; @@ -475,7 +472,8 @@ epic_ifioctl(ifp, command, data) break; default: - error = EINVAL; + error = ether_ioctl(ifp, command, data); + break; } splx(x); @@ -609,8 +607,7 @@ epic_ifstart(ifp) /* Set watchdog timer */ ifp->if_timer = 8; - if (ifp->if_bpf) - bpf_mtap(ifp, m0); + BPF_MTAP(ifp, m0); } ifp->if_flags |= IFF_OACTIVE; @@ -631,7 +628,6 @@ epic_rx_done(sc) 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; @@ -671,13 +667,11 @@ 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.len = m->m_len = len - sizeof(struct ether_header); - m->m_data += sizeof(struct ether_header); m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; /* Give mbuf to OS */ - ether_input(ifp, eh, m); + (*ifp->if_input)(ifp, m); /* Successfuly received frame */ ifp->if_ipackets++; |