On 26/03/15(Thu) 08:00, Ted Unangst wrote: > Martin Pieuchot wrote: > > Even our ISA Ethernet drivers can be converted to if_input(). If you > > still use some of these, I appreciate test reports. > > > > I'm asking here because Miod said everybody can test them... hum hum. > > > > Alternatively, if you think some drivers can go away, I'll summon > > tedu@. > > What, no ec? No ep? Why play favorites???
You're asking for tricky ones! Enjoy :) Index: dev/ic/elink3.c =================================================================== RCS file: /cvs/src/sys/dev/ic/elink3.c,v retrieving revision 1.83 diff -u -p -r1.83 elink3.c --- dev/ic/elink3.c 14 Mar 2015 03:38:47 -0000 1.83 +++ dev/ic/elink3.c 26 Mar 2015 12:26:41 -0000 @@ -1243,8 +1243,9 @@ epread(struct ep_softc *sc) bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct mbuf_list ml = MBUF_LIST_INITIALIZER(); struct mbuf *m; - int len; + int len, error = 0; len = bus_space_read_2(iot, ioh, ep_w1_reg(sc, EP_W1_RX_STATUS)); @@ -1275,11 +1276,12 @@ again: #endif if (len & ERR_INCOMPLETE) - return; + goto done; if (len & ERR_RX) { ++ifp->if_ierrors; - goto abort; + error = 1; + goto done; } len &= RX_BYTES_MASK; /* Lower 11 bits = RX bytes. */ @@ -1288,21 +1290,13 @@ again: m = epget(sc, len); if (m == NULL) { ifp->if_ierrors++; - goto abort; + error = 1; + goto done; } ++ifp->if_ipackets; -#if NBPFILTER > 0 - /* - * Check if there's a BPF listener on this interface. - * If so, hand off the raw packet to BPF. - */ - if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); -#endif - - ether_input_mbuf(ifp, m); + ml_enqueue(&ml, m); /* * In periods of high traffic we can actually receive enough @@ -1331,15 +1325,14 @@ again: sc->sc_dev.dv_xname); #endif epreset(sc); - return; + goto done; } goto again; } - - return; - -abort: - ep_discard_rxtop(iot, ioh); +done: + if (error) + ep_discard_rxtop(iot, ioh); + if_input(ifp, &ml); } struct mbuf * @@ -1347,7 +1340,6 @@ epget(struct ep_softc *sc, int totlen) { bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; struct mbuf *m; caddr_t data; int len, pad, off, sh, rxreg; @@ -1368,7 +1360,6 @@ epget(struct ep_softc *sc, int totlen) sc->next_mb = (sc->next_mb + 1) % MAX_MBS; len = MCLBYTES; - m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = totlen; m->m_len = totlen; pad = ALIGN(sizeof(struct ether_header)) - sizeof(struct ether_header); Index: dev/ic/dp8390.c =================================================================== RCS file: /cvs/src/sys/dev/ic/dp8390.c,v retrieving revision 1.49 diff -u -p -r1.49 dp8390.c --- dev/ic/dp8390.c 14 Mar 2015 03:38:47 -0000 1.49 +++ dev/ic/dp8390.c 26 Mar 2015 12:35:46 -0000 @@ -867,6 +867,7 @@ void dp8390_read(struct dp8390_softc *sc, int buf, u_short len) { struct ifnet *ifp = &sc->sc_arpcom.ac_if; + struct mbuf_list ml = MBUF_LIST_INITIALIZER(); struct mbuf *m; /* Pull packet off interface. */ @@ -877,17 +878,9 @@ dp8390_read(struct dp8390_softc *sc, int } ifp->if_ipackets++; + ml_enqueue(&ml, m); -#if NBPFILTER > 0 - /* - * Check if there's a BPF listener on this interface. - * If so, hand off the raw packet to bpf. - */ - if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); -#endif - - ether_input_mbuf(ifp, m); + if_input(ifp, &ml); } @@ -947,14 +940,12 @@ dp8390_getmcaf(struct arpcom *ac, u_int8 struct mbuf * dp8390_get(struct dp8390_softc *sc, int src, u_short total_len) { - struct ifnet *ifp = &sc->sc_arpcom.ac_if; struct mbuf *m, *m0, *newm; u_short len; MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 == NULL) return (0); - m0->m_pkthdr.rcvif = ifp; m0->m_pkthdr.len = total_len; len = MHLEN; m = m0;