summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-04-10 08:41:44 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-04-10 08:41:44 +0000
commitce0a75964b64abfccb45f894d8538453837109a2 (patch)
treefbbb48c1cc8a7b71ccae96ea491c0869275b8e7c /sys
parent2573d6fb7a9bd282e81e58b43ae366453c40f35c (diff)
Convert remaining USB Ethernet adapter to if_input().
ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_cdce.c20
-rw-r--r--sys/dev/usb/if_cdcef.c19
-rw-r--r--sys/dev/usb/if_cue.c22
-rw-r--r--sys/dev/usb/if_kue.c22
-rw-r--r--sys/dev/usb/if_mos.c15
-rw-r--r--sys/dev/usb/if_upl.c26
6 files changed, 35 insertions, 89 deletions
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index cc7958e939e..eeace64dc53 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cdce.c,v 1.63 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_cdce.c,v 1.64 2015/04/10 08:41:43 mpi Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com>
@@ -726,6 +726,7 @@ cdce_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
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 *priv, usbd_status status)
}
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:
diff --git a/sys/dev/usb/if_cdcef.c b/sys/dev/usb/if_cdcef.c
index 998c8c43c80..f85a2029c03 100644
--- a/sys/dev/usb/if_cdcef.c
+++ b/sys/dev/usb/if_cdcef.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cdcef.c,v 1.35 2014/12/22 02:28:52 tedu Exp $ */
+/* $OpenBSD: if_cdcef.c,v 1.36 2015/04/10 08:41:43 mpi Exp $ */
/*
* Copyright (c) 2007 Dale Rahn <drahn@openbsd.org>
@@ -361,6 +361,7 @@ cdcef_rxeof(struct usbf_xfer *xfer, void *priv,
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 *priv,
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,
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index 2c8069f69cc..b96b718f4c5 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cue.c,v 1.69 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_cue.c,v 1.70 2015/04/10 08:41:43 mpi Exp $ */
/* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -674,6 +674,7 @@ cue_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
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 *priv, usbd_status status)
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:
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index d1809ba0dc4..0e1630eeee5 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_kue.c,v 1.78 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_kue.c,v 1.79 2015/04/10 08:41:43 mpi Exp $ */
/* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -676,6 +676,7 @@ kue_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
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 *priv, usbd_status status)
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:
diff --git a/sys/dev/usb/if_mos.c b/sys/dev/usb/if_mos.c
index 8db8040f571..e05b559b3cf 100644
--- a/sys/dev/usb/if_mos.c
+++ b/sys/dev/usb/if_mos.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mos.c,v 1.28 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_mos.c,v 1.29 2015/04/10 08:41:43 mpi Exp $ */
/*
* Copyright (c) 2008 Johann Christian Rode <jcrode@gmx.net>
@@ -902,6 +902,7 @@ mos_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
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 *priv, usbd_status status)
}
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:
diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c
index 1219072fe4b..d4f519ad3f4 100644
--- a/sys/dev/usb/if_upl.c
+++ b/sys/dev/usb/if_upl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_upl.c,v 1.63 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_upl.c,v 1.64 2015/04/10 08:41:43 mpi Exp $ */
/* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -421,6 +421,7 @@ upl_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
struct upl_chain *c = priv;
struct upl_softc *sc = c->upl_sc;
struct ifnet *ifp = &sc->sc_if;
+ struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
int total_len = 0;
int s;
@@ -456,31 +457,16 @@ upl_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
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 (upl_newbuf(sc, c, NULL) == ENOBUFS) {
ifp->if_ierrors++;
- goto done1;
- }
-
-#if NBPFILTER > 0
- if (ifp->if_bpf) {
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ goto done;
}
-#endif
-
- DPRINTFN(10,("%s: %s: deliver %d\n", sc->sc_dev.dv_xname,
- __func__, m->m_len));
- ether_input_mbuf(ifp, m);
-
- done1:
+ s = splnet();
+ if_input(ifp, &ml);
splx(s);
-
done:
#if 1
/* Setup new transfer. */