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/usb | |
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/usb')
-rw-r--r-- | sys/dev/usb/if_aue.c | 14 | ||||
-rw-r--r-- | sys/dev/usb/if_auereg.h | 1 | ||||
-rw-r--r-- | sys/dev/usb/if_cue.c | 14 | ||||
-rw-r--r-- | sys/dev/usb/if_cuereg.h | 1 | ||||
-rw-r--r-- | sys/dev/usb/if_kue.c | 14 | ||||
-rw-r--r-- | sys/dev/usb/if_kuereg.h | 1 | ||||
-rw-r--r-- | sys/dev/usb/usb_ethersubr.c | 5 |
7 files changed, 13 insertions, 37 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index a2bf54a..fa80dd6 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -765,7 +765,7 @@ USB_ATTACH(aue) /* * Call MI attach routine. */ - ether_ifattach(ifp, ETHER_BPF_SUPPORTED); + ether_ifattach(ifp, eaddr); callout_handle_init(&sc->aue_stat_ch); usb_register_netisr(); sc->aue_dying = 0; @@ -786,7 +786,7 @@ aue_detach(device_ptr_t dev) sc->aue_dying = 1; untimeout(aue_tick, sc, sc->aue_stat_ch); - ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); + ether_ifdetach(ifp); if (sc->aue_ep[AUE_ENDPT_TX] != NULL) usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_TX]); @@ -1196,8 +1196,7 @@ aue_start(struct ifnet *ifp) * If there's a BPF listener, bounce a copy of this frame * to him. */ - if (ifp->if_bpf) - bpf_mtap(ifp, m_head); + BPF_MTAP(ifp, m_head); ifp->if_flags |= IFF_OACTIVE; @@ -1367,11 +1366,6 @@ aue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) AUE_LOCK(sc); switch(command) { - case SIOCSIFADDR: - case SIOCGIFADDR: - case SIOCSIFMTU: - error = ether_ioctl(ifp, command, data); - break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1402,7 +1396,7 @@ aue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; default: - error = EINVAL; + error = ether_ioctl(ifp, command, data); break; } diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h index 57ad525..97480e5 100644 --- a/sys/dev/usb/if_auereg.h +++ b/sys/dev/usb/if_auereg.h @@ -257,7 +257,6 @@ struct aue_softc { #endif #define AUE_TIMEOUT 1000 -#define ETHER_ALIGN 2 #define AUE_BUFSZ 1536 #define AUE_MIN_FRAMELEN 60 #define AUE_INTR_INTERVAL 100 /* ms */ diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index ab150df..8748a83 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -523,7 +523,7 @@ USB_ATTACH(cue) /* * Call MI attach routine. */ - ether_ifattach(ifp, ETHER_BPF_SUPPORTED); + ether_ifattach(ifp, eaddr); callout_handle_init(&sc->cue_stat_ch); usb_register_netisr(); sc->cue_dying = 0; @@ -544,7 +544,7 @@ cue_detach(device_ptr_t dev) sc->cue_dying = 1; untimeout(cue_tick, sc, sc->cue_stat_ch); - ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); + ether_ifdetach(ifp); if (sc->cue_ep[CUE_ENDPT_TX] != NULL) usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_TX]); @@ -890,8 +890,7 @@ cue_start(struct ifnet *ifp) * If there's a BPF listener, bounce a copy of this frame * to him. */ - if (ifp->if_bpf) - bpf_mtap(ifp, m_head); + BPF_MTAP(ifp, m_head); ifp->if_flags |= IFF_OACTIVE; @@ -1016,11 +1015,6 @@ cue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) CUE_LOCK(sc); switch(command) { - case SIOCSIFADDR: - case SIOCGIFADDR: - case SIOCSIFMTU: - error = ether_ioctl(ifp, command, data); - break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1048,7 +1042,7 @@ cue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = 0; break; default: - error = EINVAL; + error = ether_ioctl(ifp, command, data); break; } diff --git a/sys/dev/usb/if_cuereg.h b/sys/dev/usb/if_cuereg.h index b875983..ae72d4f 100644 --- a/sys/dev/usb/if_cuereg.h +++ b/sys/dev/usb/if_cuereg.h @@ -116,7 +116,6 @@ #define CUE_MCAST_TABLE_LEN 64 #define CUE_TIMEOUT 1000 -#define ETHER_ALIGN 2 #define CUE_BUFSZ 1536 #define CUE_MIN_FRAMELEN 60 #define CUE_RX_FRAMES 1 diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 8c50cf5..767d6fa 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -493,7 +493,7 @@ USB_ATTACH(kue) /* * Call MI attach routine. */ - ether_ifattach(ifp, ETHER_BPF_SUPPORTED); + ether_ifattach(ifp, sc->kue_desc.kue_macaddr); usb_register_netisr(); sc->kue_dying = 0; @@ -515,7 +515,7 @@ kue_detach(device_ptr_t dev) sc->kue_dying = 1; if (ifp != NULL) - ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); + ether_ifdetach(ifp); if (sc->kue_ep[KUE_ENDPT_TX] != NULL) usbd_abort_pipe(sc->kue_ep[KUE_ENDPT_TX]); @@ -839,8 +839,7 @@ kue_start(struct ifnet *ifp) * If there's a BPF listener, bounce a copy of this frame * to him. */ - if (ifp->if_bpf) - bpf_mtap(ifp, m_head); + BPF_MTAP(ifp, m_head); ifp->if_flags |= IFF_OACTIVE; @@ -953,11 +952,6 @@ kue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) KUE_LOCK(sc); switch(command) { - case SIOCSIFADDR: - case SIOCGIFADDR: - case SIOCSIFMTU: - error = ether_ioctl(ifp, command, data); - break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -987,7 +981,7 @@ kue_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = 0; break; default: - error = EINVAL; + error = ether_ioctl(ifp, command, data); break; } diff --git a/sys/dev/usb/if_kuereg.h b/sys/dev/usb/if_kuereg.h index a72faad..1755e5c 100644 --- a/sys/dev/usb/if_kuereg.h +++ b/sys/dev/usb/if_kuereg.h @@ -110,7 +110,6 @@ struct kue_ether_desc { #define KUE_RXFILT_MULTICAST 0x0010 #define KUE_TIMEOUT 1000 -#define ETHER_ALIGN 2 #define KUE_BUFSZ 1536 #define KUE_MIN_FRAMELEN 60 diff --git a/sys/dev/usb/usb_ethersubr.c b/sys/dev/usb/usb_ethersubr.c index 100d93a..4e8daf3 100644 --- a/sys/dev/usb/usb_ethersubr.c +++ b/sys/dev/usb/usb_ethersubr.c @@ -80,7 +80,6 @@ Static void usbintr (void); Static void usbintr() { - struct ether_header *eh; struct mbuf *m; struct usb_qdat *q; struct ifnet *ifp; @@ -90,12 +89,10 @@ Static void usbintr() 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); |