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/lnc | |
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/lnc')
-rw-r--r-- | sys/dev/lnc/if_lnc.c | 42 | ||||
-rw-r--r-- | sys/dev/lnc/if_lnc_cbus.c | 2 | ||||
-rw-r--r-- | sys/dev/lnc/if_lnc_isa.c | 2 | ||||
-rw-r--r-- | sys/dev/lnc/if_lnc_pci.c | 2 |
4 files changed, 19 insertions, 29 deletions
diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index 73f8d4d..eeb678a 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -446,6 +446,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; @@ -465,13 +466,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_unit; + int unit = ifp->if_unit; 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_unit; + int unit = ifp->if_unit; log(LOG_ERR, "lnc%d: Receive interrupt but not start of packet -- Resetting\n", unit); lnc_reset(sc); return; @@ -503,7 +504,7 @@ lnc_rint(struct lnc_softc *sc) } while (!(flags & (STP | OWN | ENP | MDERR))); if (flags & STP) { - int unit = sc->arpcom.ac_if.if_unit; + int unit = ifp->if_unit; log(LOG_ERR, "lnc%d: Start of packet found before end of previous in receive ring -- Resetting\n", unit); lnc_reset(sc); return; @@ -517,7 +518,7 @@ lnc_rint(struct lnc_softc *sc) sc->recv_next = start_of_packet; break; } else { - int unit = sc->arpcom.ac_if.if_unit; + int unit = ifp->if_unit; log(LOG_ERR, "lnc%d: End of received packet not found-- Resetting\n", unit); lnc_reset(sc); return; @@ -532,7 +533,7 @@ lnc_rint(struct lnc_softc *sc) next = sc->recv_ring + sc->recv_next; if (flags & MDERR) { - int unit = sc->arpcom.ac_if.if_unit; + int unit = ifp->if_unit; if (flags & RBUFF) { LNCSTATS(rbuff) log(LOG_ERR, "lnc%d: Receive buffer error\n", unit); @@ -544,7 +545,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. @@ -565,7 +566,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 */ @@ -575,7 +576,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) @@ -588,7 +589,7 @@ 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; @@ -601,15 +602,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_unit; + int unit = ifp->if_unit; log(LOG_ERR,"lnc%d: Packet dropped, no mbufs\n",unit); LNCSTATS(drop_packet) } @@ -907,7 +903,7 @@ lnc_attach_common(device_t dev) * XXX -- should check return status of if_attach */ - ether_ifattach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED); + ether_ifattach(&sc->arpcom.ac_if, sc->arpcom.ac_enaddr); printf("lnc%d: ", unit); if (sc->nic.ic == LANCE || sc->nic.ic == C_LANCE) @@ -1381,8 +1377,7 @@ lnc_start(struct ifnet *ifp) ifp->if_timer = 2; - if (sc->arpcom.ac_if.if_bpf) - bpf_mtap(&sc->arpcom.ac_if, head); + BPF_MTAP(&sc->arpcom.ac_if, head); if (sc->nic.mem_mode != DMA_MBUF) m_freem(head); @@ -1408,12 +1403,6 @@ lnc_ioctl(struct ifnet * ifp, u_long command, caddr_t data) s = splimp(); switch (command) { - case SIOCSIFADDR: - case SIOCGIFADDR: - case SIOCSIFMTU: - error = ether_ioctl(ifp, command, data); - break; - case SIOCSIFFLAGS: #ifdef DEBUG if (ifp->if_flags & IFF_DEBUG) @@ -1464,7 +1453,8 @@ lnc_ioctl(struct ifnet * ifp, u_long command, caddr_t data) error = 0; break; default: - error = EINVAL; + error = ether_ioctl(ifp, command, data); + break; } (void) splx(s); return error; diff --git a/sys/dev/lnc/if_lnc_cbus.c b/sys/dev/lnc/if_lnc_cbus.c index 85be471..571407e 100644 --- a/sys/dev/lnc/if_lnc_cbus.c +++ b/sys/dev/lnc/if_lnc_cbus.c @@ -284,7 +284,7 @@ lnc_isa_detach(device_t dev) lnc_softc_t *sc = device_get_softc(dev); int s = splimp(); - ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED); + ether_ifdetach(&sc->arpcom.ac_if); splx(s); lnc_stop(sc); diff --git a/sys/dev/lnc/if_lnc_isa.c b/sys/dev/lnc/if_lnc_isa.c index c973494..949ea7d 100644 --- a/sys/dev/lnc/if_lnc_isa.c +++ b/sys/dev/lnc/if_lnc_isa.c @@ -255,7 +255,7 @@ lnc_isa_detach(device_t dev) lnc_softc_t *sc = device_get_softc(dev); int s = splimp(); - ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED); + ether_ifdetach(&sc->arpcom.ac_if); splx(s); lnc_stop(sc); diff --git a/sys/dev/lnc/if_lnc_pci.c b/sys/dev/lnc/if_lnc_pci.c index 00d7ab8..5a6bd8d 100644 --- a/sys/dev/lnc/if_lnc_pci.c +++ b/sys/dev/lnc/if_lnc_pci.c @@ -187,7 +187,7 @@ lnc_pci_detach(device_t dev) lnc_softc_t *sc = device_get_softc(dev); int s = splimp(); - ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED); + ether_ifdetach(&sc->arpcom.ac_if); lnc_stop(sc); bus_teardown_intr(dev, sc->irqres, sc->intrhand); |