This spring the new trend has a name: if_input() !

If you are the owner of one of these USB Ethernet dongle, please do
me a favor a make sure they still work as expected with the diff
below.

Martin

Index: if_cdce.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_cdce.c,v
retrieving revision 1.63
diff -u -p -r1.63 if_cdce.c
--- if_cdce.c   14 Mar 2015 03:38:49 -0000      1.63
+++ if_cdce.c   17 Mar 2015 21:45:15 -0000
@@ -726,6 +726,7 @@ cdce_rxeof(struct usbd_xfer *xfer, void 
        struct cdce_softc       *sc = c->cdce_sc;
        struct ifnet            *ifp = GET_IFP(sc);
        struct mbuf             *m;
+       struct mbuf_list         ml = MBUF_LIST_INITIALIZER();
        int                      total_len = 0;
        int                      s;
 
@@ -767,25 +768,16 @@ cdce_rxeof(struct usbd_xfer *xfer, void 
        }
 
        ifp->if_ipackets++;
-
        m->m_pkthdr.len = m->m_len = total_len;
-       m->m_pkthdr.rcvif = ifp;
-
-       s = splnet();
+       ml_enqueue(&ml, m);
 
        if (cdce_newbuf(sc, c, NULL) == ENOBUFS) {
                ifp->if_ierrors++;
-               goto done1;
+               goto done;
        }
 
-#if NBPFILTER > 0
-       if (ifp->if_bpf)
-               bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-       ether_input_mbuf(ifp, m);
-
-done1:
+       s = splnet();
+       if_input(ifp, &ml);
        splx(s);
 
 done:
Index: if_cdcef.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_cdcef.c,v
retrieving revision 1.35
diff -u -p -r1.35 if_cdcef.c
--- if_cdcef.c  22 Dec 2014 02:28:52 -0000      1.35
+++ if_cdcef.c  17 Mar 2015 21:43:23 -0000
@@ -361,6 +361,7 @@ cdcef_rxeof(struct usbf_xfer *xfer, void
        struct cdcef_softc      *sc = priv;
        int total_len = 0;
        struct ifnet            *ifp = GET_IFP(sc);
+       struct mbuf_list        ml = MBUF_LIST_INITIALIZER();
        struct mbuf             *m = NULL;
 
 
@@ -403,32 +404,24 @@ cdcef_rxeof(struct usbf_xfer *xfer, void
                goto done;
        }
 
-       s = splnet();
        if (ifp->if_flags & IFF_RUNNING) {
                m = cdcef_newbuf();
                if (m == NULL) {
                        /* message? */
                        ifp->if_ierrors++;
-                       goto done1;
+                       goto done;
                }
 
                m->m_pkthdr.len = m->m_len = total_len;
                bcopy(sc->sc_buffer_out, mtod(m, char *), total_len);
-               m->m_pkthdr.rcvif = ifp;
 
                ifp->if_ipackets++;
-
-#if NBPFILTER > 0
-               if (ifp->if_bpf)
-                       bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-               ether_input_mbuf(ifp, m);
+               ml_enqueue(&ml, m);
        }
 
-done1:
+       s = splnet();
+       if_input(ifp, &ml);
        splx(s);
-
 done:
        /* Setup another xfer. */
        usbf_setup_xfer(xfer, sc->sc_pipe_out, sc, sc->sc_buffer_out,
Index: if_cue.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_cue.c,v
retrieving revision 1.69
diff -u -p -r1.69 if_cue.c
--- if_cue.c    14 Mar 2015 03:38:49 -0000      1.69
+++ if_cue.c    17 Mar 2015 21:45:06 -0000
@@ -674,6 +674,7 @@ cue_rxeof(struct usbd_xfer *xfer, void *
        struct cue_chain        *c = priv;
        struct cue_softc        *sc = c->cue_sc;
        struct ifnet            *ifp = GET_IFP(sc);
+       struct mbuf_list        ml = MBUF_LIST_INITIALIZER();
        struct mbuf             *m;
        int                     total_len = 0;
        u_int16_t               len;
@@ -721,26 +722,15 @@ cue_rxeof(struct usbd_xfer *xfer, void *
        ifp->if_ipackets++;
        m_adj(m, sizeof(u_int16_t));
        m->m_pkthdr.len = m->m_len = total_len;
+       ml_enqueue(&ml, m);
 
-       m->m_pkthdr.rcvif = ifp;
-
-       s = splnet();
-
-       /* XXX ugly */
        if (cue_newbuf(sc, c, NULL) == ENOBUFS) {
                ifp->if_ierrors++;
-               goto done1;
+               goto done;
        }
 
-#if NBPFILTER > 0
-       if (ifp->if_bpf)
-               bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-       DPRINTFN(10,("%s: %s: deliver %d\n", sc->cue_dev.dv_xname,
-                   __func__, m->m_len));
-       ether_input_mbuf(ifp, m);
- done1:
+       s = splnet();
+       if_input(ifp, &ml);
        splx(s);
 
 done:
Index: if_kue.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_kue.c,v
retrieving revision 1.78
diff -u -p -r1.78 if_kue.c
--- if_kue.c    14 Mar 2015 03:38:49 -0000      1.78
+++ if_kue.c    17 Mar 2015 21:44:56 -0000
@@ -676,6 +676,7 @@ kue_rxeof(struct usbd_xfer *xfer, void *
        struct kue_chain        *c = priv;
        struct kue_softc        *sc = c->kue_sc;
        struct ifnet            *ifp = GET_IFP(sc);
+       struct mbuf_list        ml = MBUF_LIST_INITIALIZER();
        struct mbuf             *m;
        int                     total_len = 0;
        int                     s;
@@ -728,26 +729,15 @@ kue_rxeof(struct usbd_xfer *xfer, void *
 
        ifp->if_ipackets++;
        m->m_pkthdr.len = m->m_len = total_len;
+       ml_enqueue(&ml, m);
 
-       m->m_pkthdr.rcvif = ifp;
-
-       s = splnet();
-
-       /* XXX ugly */
        if (kue_newbuf(sc, c, NULL) == ENOBUFS) {
                ifp->if_ierrors++;
-               goto done1;
+               goto done;
        }
 
-#if NBPFILTER > 0
-       if (ifp->if_bpf)
-               bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-       DPRINTFN(10,("%s: %s: deliver %d\n", sc->kue_dev.dv_xname,
-                   __func__, m->m_len));
-       ether_input_mbuf(ifp, m);
- done1:
+       s = splnet();
+       if_input(ifp, &ml);
        splx(s);
 
  done:
Index: if_mos.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_mos.c,v
retrieving revision 1.28
diff -u -p -r1.28 if_mos.c
--- if_mos.c    14 Mar 2015 03:38:49 -0000      1.28
+++ if_mos.c    17 Mar 2015 20:58:39 -0000
@@ -902,6 +902,7 @@ mos_rxeof(struct usbd_xfer *xfer, void *
        u_int8_t                rxstat;
        u_int32_t               total_len;
        u_int16_t               pktlen = 0;
+       struct mbuf_list        ml = MBUF_LIST_INITIALIZER();
        struct mbuf             *m;
        int                     s;
 
@@ -961,20 +962,14 @@ mos_rxeof(struct usbd_xfer *xfer, void *
        }
 
        ifp->if_ipackets++;
-       m->m_pkthdr.rcvif = ifp;
        m->m_pkthdr.len = m->m_len = pktlen;
 
        memcpy(mtod(m, char *), buf, pktlen);
 
-       /* push the packet up */
-       s = splnet();
-#if NBPFILTER > 0
-       if (ifp->if_bpf)
-               bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-       ether_input_mbuf(ifp, m);
+       ml_enqueue(&ml, m);
 
+       s = splnet();
+       if_input(ifp, &ml);
        splx(s);
 
 done:

Reply via email to