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@.

Index: isa/if_ef_isapnp.c
===================================================================
RCS file: /cvs/src/sys/dev/isa/if_ef_isapnp.c,v
retrieving revision 1.27
diff -u -p -r1.27 if_ef_isapnp.c
--- isa/if_ef_isapnp.c  22 Dec 2014 02:28:51 -0000      1.27
+++ isa/if_ef_isapnp.c  26 Mar 2015 11:29:22 -0000
@@ -671,6 +671,7 @@ efread(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;
 
@@ -719,13 +720,9 @@ efread(sc)
        }
 
        ifp->if_ipackets++;
+       ml_enqueue(&ml, m);
 
-#if NBPFILTER > 0
-       if (ifp->if_bpf)
-               bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-       ether_input_mbuf(ifp, m);
+       if_input(ifp, &ml);
 }
 
 struct mbuf *
@@ -735,14 +732,12 @@ efget(sc, 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 *top, **mp, *m;
        int len, pad, s;
 
        MGETHDR(m, M_DONTWAIT, MT_DATA);
        if (m == NULL)
                return (NULL);
-       m->m_pkthdr.rcvif = ifp;
        m->m_pkthdr.len = totlen;
        pad = ALIGN(sizeof(struct ether_header)) - sizeof(struct ether_header);
        m->m_data += pad;
Index: isa/if_eg.c
===================================================================
RCS file: /cvs/src/sys/dev/isa/if_eg.c,v
retrieving revision 1.36
diff -u -p -r1.36 if_eg.c
--- isa/if_eg.c 22 Dec 2014 02:28:51 -0000      1.36
+++ isa/if_eg.c 26 Mar 2015 11:28:42 -0000
@@ -670,8 +670,9 @@ void
 egread(struct eg_softc *sc, caddr_t buf, int len)
 {
        struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+       struct mbuf_list ml = MBUF_LIST_INITIALIZER();
        struct mbuf *m;
-       
+
        if (len <= sizeof(struct ether_header) ||
            len > ETHER_MAX_LEN) {
                printf("%s: invalid packet size %d; dropping\n",
@@ -688,17 +689,9 @@ egread(struct eg_softc *sc, caddr_t buf,
        }
 
        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);
 }
 
 /*
@@ -707,14 +700,12 @@ egread(struct eg_softc *sc, caddr_t buf,
 struct mbuf *
 egget(struct eg_softc *sc, caddr_t buf, int totlen)
 {
-       struct ifnet *ifp = &sc->sc_arpcom.ac_if;
        struct mbuf *top, **mp, *m;
        int len;
 
        MGETHDR(m, M_DONTWAIT, MT_DATA);
        if (m == 0)
                return (0);
-       m->m_pkthdr.rcvif = ifp;
        m->m_pkthdr.len = totlen;
        len = MHLEN;
        top = 0;
Index: isa/if_el.c
===================================================================
RCS file: /cvs/src/sys/dev/isa/if_el.c,v
retrieving revision 1.24
diff -u -p -r1.24 if_el.c
--- isa/if_el.c 22 Dec 2014 02:28:51 -0000      1.24
+++ isa/if_el.c 26 Mar 2015 11:28:38 -0000
@@ -490,6 +490,7 @@ elread(sc, len)
        int len;
 {
        struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+       struct mbuf_list ml = MBUF_LIST_INITIALIZER();
        struct mbuf *m;
 
        if (len <= sizeof(struct ether_header) ||
@@ -508,17 +509,9 @@ elread(sc, len)
        }
 
        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);
 }
 
 /*
@@ -531,7 +524,6 @@ elget(sc, totlen)
        struct el_softc *sc;
        int totlen;
 {
-       struct ifnet *ifp = &sc->sc_arpcom.ac_if;
        int iobase = sc->sc_iobase;
        struct mbuf *top, **mp, *m;
        int len;
@@ -539,7 +531,6 @@ elget(sc, totlen)
        MGETHDR(m, M_DONTWAIT, MT_DATA);
        if (m == 0)
                return 0;
-       m->m_pkthdr.rcvif = ifp;
        m->m_pkthdr.len = totlen;
        len = MHLEN;
        top = 0;
Index: isa/if_ex.c
===================================================================
RCS file: /cvs/src/sys/dev/isa/if_ex.c,v
retrieving revision 1.37
diff -u -p -r1.37 if_ex.c
--- isa/if_ex.c 22 Dec 2014 02:28:51 -0000      1.37
+++ isa/if_ex.c 26 Mar 2015 11:24:27 -0000
@@ -639,6 +639,7 @@ void 
 ex_rx_intr(struct ex_softc *sc)
 {
        struct ifnet *ifp = &sc->arpcom.ac_if;
+       struct mbuf_list ml = MBUF_LIST_INITIALIZER();
        int rx_status, pkt_len, QQQ;
        struct mbuf *m, *ipkt;
 
@@ -661,7 +662,6 @@ ex_rx_intr(struct ex_softc *sc)
                        if (ipkt == NULL)
                                ifp->if_iqdrops++;
                        else {
-                               ipkt->m_pkthdr.rcvif = ifp;
                                ipkt->m_pkthdr.len = pkt_len;
                                ipkt->m_len = MHLEN;
                                while (pkt_len > 0) {
@@ -710,13 +710,8 @@ ex_rx_intr(struct ex_softc *sc)
                                } /* QQQ */
                        }
 #endif
-#if NBPFILTER > 0
-                       if (ifp->if_bpf != NULL)
-                               bpf_mtap(ifp->if_bpf, ipkt,
-                                   BPF_DIRECTION_IN);
-#endif
-                       ether_input_mbuf(ifp, ipkt);
                        ifp->if_ipackets++;
+                       ml_enqueue(&ml, ipkt);
                }
        } else
                ifp->if_ierrors++;
@@ -727,6 +722,8 @@ ex_rx_intr(struct ex_softc *sc)
                CSR_WRITE_2(sc, RCV_STOP_REG, sc->rx_upper_limit);
        else
                CSR_WRITE_2(sc, RCV_STOP_REG, sc->rx_head - 2);
+
+       if_input(ifp, &ml);
 
        DODEBUG(Start_End, printf("ex_rx_intr: finish\n"););
 }      
Index: isa/if_ie.c
===================================================================
RCS file: /cvs/src/sys/dev/isa/if_ie.c,v
retrieving revision 1.40
diff -u -p -r1.40 if_ie.c
--- isa/if_ie.c 22 Dec 2014 02:28:51 -0000      1.40
+++ isa/if_ie.c 26 Mar 2015 11:26:48 -0000
@@ -1260,7 +1260,6 @@ ieget(sc, ehp, to_bpf)
        MGETHDR(m, M_DONTWAIT, MT_DATA);
        if (m == 0)
                return 0;
-       m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if;
        m->m_pkthdr.len = totlen;
        len = MHLEN;
        top = 0;
@@ -1344,6 +1343,7 @@ ie_readframe(sc, num)
        int num;                        /* frame number to read */
 {
        int status;
+       struct mbuf_list ml = MBUF_LIST_INITIALIZER();
        struct mbuf *m = 0;
        struct ether_header eh;
 #if NBPFILTER > 0
@@ -1378,38 +1378,10 @@ ie_readframe(sc, num)
                    ether_sprintf(eh.ether_shost), (u_int)eh.ether_type);
 #endif
 
-#if NBPFILTER > 0
-       /* Check for a BPF filter; if so, hand it up. */
-       if (bpf_gets_it) {
-               /* Pass it up. */
-               bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN);
-
-               /*
-                * A signal passed up from the filtering code indicating that
-                * the packet is intended for BPF but not for the protocol
-                * machinery.  We can save a few cycles by not handing it off
-                * to them.
-                */
-               if (bpf_gets_it == 2) {
-                       m_freem(m);
-                       return;
-               }
-       }
-#endif /* NBPFILTER > 0 */
-
-       /*
-        * In here there used to be code to check destination addresses upon
-        * receipt of a packet.  We have deleted that code, and replaced it
-        * with code to check the address much earlier in the cycle, before
-        * copying the data in; this saves us valuable cycles when operating
-        * as a multicast router or when using BPF.
-        */
-
-       /*
-        * Finally pass this packet up to higher layers.
-        */
-       ether_input_mbuf(&sc->sc_arpcom.ac_if, m);
        sc->sc_arpcom.ac_if.if_ipackets++;
+       ml_enqueue(&ml, m);
+
+       if_input(&sc->sc_arpcom.ac_if, &ml);
 }
 
 void

Reply via email to