diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-11-25 03:10:01 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-11-25 03:10:01 +0000 |
commit | 6215416f96d04fd1a1b0e14e2670c208f0acc34c (patch) | |
tree | 14249f751ae54985d3581b0632deb81620be2edf /sys/dev/usb | |
parent | bbe7ffca434bff081b83e600614f4ec4cded8f3b (diff) |
replace IFF_OACTIVE manipulation with mpsafe operations.
there are two things shared between the network stack and drivers
in the send path: the send queue and the IFF_OACTIVE flag. the send
queue is now protected by a mutex. this diff makes the oactive
functionality mpsafe too.
IFF_OACTIVE is part of if_flags. there are two problems with that.
firstly, if_flags is a short and we dont have any MI atomic operations
to manipulate a short. secondly, while we could make the IFF_OACTIVE
operates mpsafe, all changes to other flags would have to be made
safe at the same time, otherwise a read-modify-write cycle on their
updates could clobber the oactive change.
instead, this moves the oactive mark into struct ifqueue and provides
an API for changing it. there's ifq_set_oactive, ifq_clr_oactive,
and ifq_is_oactive. these are modelled on ifsq_set_oactive,
ifsq_clr_oactive, and ifsq_is_oactive in dragonflybsd.
this diff includes changes to all the drivers manipulating IFF_OACTIVE
to now use the ifsq_{set,clr_is}_oactive API too.
ok kettenis@ mpi@ jmatthew@ deraadt@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_athn_usb.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_atu.c | 17 | ||||
-rw-r--r-- | sys/dev/usb/if_aue.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_axe.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_axen.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_cdce.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_cdcef.c | 17 | ||||
-rw-r--r-- | sys/dev/usb/if_cue.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_kue.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_mos.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_otus.c | 16 | ||||
-rw-r--r-- | sys/dev/usb/if_ral.c | 13 | ||||
-rw-r--r-- | sys/dev/usb/if_rsu.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_rum.c | 13 | ||||
-rw-r--r-- | sys/dev/usb/if_run.c | 16 | ||||
-rw-r--r-- | sys/dev/usb/if_smsc.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_uath.c | 13 | ||||
-rw-r--r-- | sys/dev/usb/if_udav.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_ugl.c | 17 | ||||
-rw-r--r-- | sys/dev/usb/if_upgt.c | 13 | ||||
-rw-r--r-- | sys/dev/usb/if_upl.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_url.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_urndis.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_urtw.c | 17 | ||||
-rw-r--r-- | sys/dev/usb/if_urtwn.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/if_zyd.c | 13 |
26 files changed, 209 insertions, 181 deletions
diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c index b3f256f12e1..e099cf3fd02 100644 --- a/sys/dev/usb/if_athn_usb.c +++ b/sys/dev/usb/if_athn_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_usb.c,v 1.40 2015/11/24 13:45:06 mpi Exp $ */ +/* $OpenBSD: if_athn_usb.c,v 1.41 2015/11/25 03:09:59 dlg Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -1923,8 +1923,8 @@ athn_usb_txeof(struct usbd_xfer *xfer, void *priv, ifp->if_opackets++; /* We just released a Tx buffer, notify Tx. */ - if (ifp->if_flags & IFF_OACTIVE) { - ifp->if_flags &= ~IFF_OACTIVE; + if (ifq_is_oactive(&ifp->if_snd)) { + ifq_clr_oactive(&ifp->if_snd); ifp->if_start(ifp); } splx(s); @@ -2054,12 +2054,12 @@ athn_usb_start(struct ifnet *ifp) struct ieee80211_node *ni; struct mbuf *m; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (TAILQ_EMPTY(&usc->tx_free_list)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } /* Send pending management frames first. */ @@ -2322,8 +2322,8 @@ athn_usb_init(struct ifnet *ifp) goto fail; } /* We're ready to go. */ - ifp->if_flags &= ~IFF_OACTIVE; ifp->if_flags |= IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); #ifdef notyet if (ic->ic_flags & IEEE80211_F_WEPON) { @@ -2355,7 +2355,8 @@ athn_usb_stop(struct ifnet *ifp) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); s = splusb(); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index d7c74af6233..dcd6d754264 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.115 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_atu.c,v 1.116 2015/11/25 03:09:59 dlg Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. @@ -1797,7 +1797,7 @@ atu_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) sc->atu_cdata.atu_tx_inuse--; if (sc->atu_cdata.atu_tx_inuse == 0) ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); atu_start(ifp); @@ -1915,8 +1915,8 @@ atu_start(struct ifnet *ifp) return; } - if (ifp->if_flags & IFF_OACTIVE) { - DPRINTFN(30, ("%s: atu_start: IFF_OACTIVE\n", + if (ifq_is_oactive(&ifp->if_snd)) { + DPRINTFN(30, ("%s: atu_start: oactive\n", sc->atu_dev.dv_xname)); return; } @@ -1929,13 +1929,13 @@ atu_start(struct ifnet *ifp) SLIST_REMOVE_HEAD(&cd->atu_tx_free, atu_list); cd->atu_tx_inuse++; if (cd->atu_tx_inuse == ATU_TX_LIST_CNT) - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); } splx(s); if (c == NULL) { DPRINTFN(10, ("%s: out of tx xfers\n", sc->atu_dev.dv_xname)); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2092,7 +2092,7 @@ atu_init(struct ifnet *ifp) */ ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); /* XXX the following HAS to be replaced */ @@ -2248,7 +2248,8 @@ atu_stop(struct ifnet *ifp, int disable) int s; s = splnet(); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; /* Stop transfers. */ diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index b20af87c447..58654187e0c 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aue.c,v 1.103 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_aue.c,v 1.104 2015/11/25 03:10:00 dlg Exp $ */ /* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1097,7 +1097,7 @@ aue_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) __func__, status)); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { @@ -1240,7 +1240,7 @@ aue_start(struct ifnet *ifp) if (!sc->aue_link) return; - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -1249,7 +1249,7 @@ aue_start(struct ifnet *ifp) if (aue_send(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -1264,7 +1264,7 @@ aue_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -1329,7 +1329,7 @@ aue_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -1513,7 +1513,8 @@ aue_stop(struct aue_softc *sc) ifp = GET_IFP(sc); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); aue_csr_write_1(sc, AUE_CTL0, 0); aue_csr_write_1(sc, AUE_CTL1, 0); diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 98013dde8fb..6ae4238390b 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axe.c,v 1.135 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_axe.c,v 1.136 2015/11/25 03:10:00 dlg Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org> @@ -1123,7 +1123,7 @@ axe_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); m_freem(c->axe_mbuf); c->axe_mbuf = NULL; @@ -1249,7 +1249,7 @@ axe_start(struct ifnet *ifp) if (!sc->axe_link) return; - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -1258,7 +1258,7 @@ axe_start(struct ifnet *ifp) if (axe_encap(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } ifq_deq_commit(&ifp->if_snd, m_head); @@ -1272,7 +1272,7 @@ axe_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -1379,7 +1379,7 @@ axe_init(void *xsc) sc->axe_link = 0; ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -1472,7 +1472,8 @@ axe_stop(struct axe_softc *sc) ifp = &sc->arpcom.ac_if; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); timeout_del(&sc->axe_stat_ch); diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c index 786f223b540..a0803eea097 100644 --- a/sys/dev/usb/if_axen.c +++ b/sys/dev/usb/if_axen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axen.c,v 1.19 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_axen.c,v 1.20 2015/11/25 03:10:00 dlg Exp $ */ /* * Copyright (c) 2013 Yojiro UO <yuo@openbsd.org> @@ -1140,7 +1140,7 @@ axen_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); m_freem(c->axen_mbuf); c->axen_mbuf = NULL; @@ -1269,7 +1269,7 @@ axen_start(struct ifnet *ifp) if (!sc->axen_link) return; - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -1278,7 +1278,7 @@ axen_start(struct ifnet *ifp) if (axen_encap(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } ifq_deq_commit(&ifp->if_snd, m_head); @@ -1292,7 +1292,7 @@ axen_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -1380,7 +1380,7 @@ axen_init(void *xsc) sc->axen_link = 0; ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -1480,7 +1480,8 @@ axen_stop(struct axen_softc *sc) ifp = &sc->arpcom.ac_if; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); timeout_del(&sc->axen_stat_ch); diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index d8435a28d67..8bc98d8b629 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.67 2015/11/20 03:35:23 dlg Exp $ */ +/* $OpenBSD: if_cdce.c,v 1.68 2015/11/25 03:10:00 dlg Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> @@ -386,7 +386,7 @@ cdce_start(struct ifnet *ifp) struct cdce_softc *sc = ifp->if_softc; struct mbuf *m_head = NULL; - if (usbd_is_dying(sc->cdce_udev) || (ifp->if_flags & IFF_OACTIVE)) + if (usbd_is_dying(sc->cdce_udev) || ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -395,7 +395,7 @@ cdce_start(struct ifnet *ifp) if (cdce_encap(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -406,7 +406,7 @@ cdce_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_timer = 6; } @@ -453,7 +453,8 @@ cdce_stop(struct cdce_softc *sc) int i; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (sc->cdce_bulkin_pipe != NULL) { usbd_abort_pipe(sc->cdce_bulkin_pipe); @@ -626,7 +627,7 @@ cdce_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); } @@ -800,7 +801,7 @@ cdce_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) s = splnet(); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { diff --git a/sys/dev/usb/if_cdcef.c b/sys/dev/usb/if_cdcef.c index 858ebbca91f..5496d9c1c4e 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.40 2015/11/22 23:56:10 dlg Exp $ */ +/* $OpenBSD: if_cdcef.c,v 1.41 2015/11/25 03:10:00 dlg Exp $ */ /* * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org> @@ -274,7 +274,7 @@ cdcef_start(struct ifnet *ifp) struct cdcef_softc *sc = ifp->if_softc; struct mbuf *m_head = NULL; - if(ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -294,7 +294,7 @@ cdcef_start(struct ifnet *ifp) if (cdcef_encap(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -305,7 +305,7 @@ cdcef_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_timer = 6; } @@ -325,7 +325,7 @@ cdcef_txeof(struct usbf_xfer *xfer, void *priv, #endif ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc->sc_xmit_mbuf != NULL) { m_freem(sc->sc_xmit_mbuf); @@ -504,7 +504,7 @@ cdcef_watchdog(struct ifnet *ifp) s = splusb(); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* cancel receive pipe? */ usbf_abort_pipe(sc->sc_pipe_in); /* in is tx pipe */ @@ -520,7 +520,7 @@ cdcef_init(struct cdcef_softc *sc) s = splnet(); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); } @@ -555,7 +555,8 @@ cdcef_stop(struct cdcef_softc *sc) struct ifnet *ifp = GET_IFP(sc); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* cancel receive pipe? */ diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index eb85e2bb574..b13dedf3341 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.73 2015/11/20 03:35:23 dlg Exp $ */ +/* $OpenBSD: if_cue.c,v 1.74 2015/11/25 03:10:00 dlg Exp $ */ /* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -764,7 +764,7 @@ cue_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) __func__, status)); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { @@ -884,7 +884,7 @@ cue_start(struct ifnet *ifp) DPRINTFN(10,("%s: %s: enter\n", sc->cue_dev.dv_xname,__func__)); - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -893,7 +893,7 @@ cue_start(struct ifnet *ifp) if (cue_send(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -908,7 +908,7 @@ cue_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -995,7 +995,7 @@ cue_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -1132,7 +1132,8 @@ cue_stop(struct cue_softc *sc) ifp = GET_IFP(sc); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); cue_csr_write_1(sc, CUE_ETHCTL, 0); cue_reset(sc); diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index d8497babd1a..abed32c9652 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.82 2015/11/20 03:35:23 dlg Exp $ */ +/* $OpenBSD: if_kue.c,v 1.83 2015/11/25 03:10:00 dlg Exp $ */ /* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -773,7 +773,7 @@ kue_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) __func__, status)); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { @@ -855,7 +855,7 @@ kue_start(struct ifnet *ifp) if (usbd_is_dying(sc->kue_udev)) return; - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -864,7 +864,7 @@ kue_start(struct ifnet *ifp) if (kue_send(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -879,7 +879,7 @@ kue_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -949,7 +949,7 @@ kue_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); } @@ -1100,7 +1100,8 @@ kue_stop(struct kue_softc *sc) ifp = GET_IFP(sc); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* Stop transfers. */ if (sc->kue_ep[KUE_ENDPT_RX] != NULL) { diff --git a/sys/dev/usb/if_mos.c b/sys/dev/usb/if_mos.c index 8a63d31733f..c894ae1324b 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.34 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_mos.c,v 1.35 2015/11/25 03:10:00 dlg Exp $ */ /* * Copyright (c) 2008 Johann Christian Rode <jcrode@gmx.net> @@ -1023,7 +1023,7 @@ mos_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); m_freem(c->mos_mbuf); c->mos_mbuf = NULL; @@ -1134,7 +1134,7 @@ mos_start(struct ifnet *ifp) if (!sc->mos_link) return; - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -1143,7 +1143,7 @@ mos_start(struct ifnet *ifp) if (mos_encap(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } ifq_deq_commit(&ifp->if_snd, m_head); @@ -1157,7 +1157,7 @@ mos_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -1250,7 +1250,7 @@ mos_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -1344,7 +1344,8 @@ mos_stop(struct mos_softc *sc) ifp = &sc->arpcom.ac_if; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); timeout_del(&sc->mos_stat_ch); diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c index 52df4d0ac56..d978d70f520 100644 --- a/sys/dev/usb/if_otus.c +++ b/sys/dev/usb/if_otus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_otus.c,v 1.50 2015/11/24 13:45:06 mpi Exp $ */ +/* $OpenBSD: if_otus.c,v 1.51 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -244,7 +244,8 @@ otus_detach(struct device *self, int flags) usbd_ref_wait(sc->sc_udev); if (ifp->if_softc != NULL) { - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ieee80211_ifdetach(ifp); if_detach(ifp); } @@ -1267,7 +1268,7 @@ otus_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) } sc->sc_tx_timer = 0; ifp->if_opackets++; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); otus_start(ifp); splx(s); } @@ -1405,12 +1406,12 @@ otus_start(struct ifnet *ifp) struct ieee80211_node *ni; struct mbuf *m; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (sc->tx_queued >= OTUS_TX_DATA_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } /* Send pending management frames first. */ @@ -2286,8 +2287,8 @@ otus_init(struct ifnet *ifp) otus_write(sc, 0x1c3d30, 0x100); (void)otus_write_barrier(sc); - ifp->if_flags &= ~IFF_OACTIVE; ifp->if_flags |= IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (ic->ic_opmode == IEEE80211_M_MONITOR) ieee80211_new_state(ic, IEEE80211_S_RUN, -1); @@ -2306,7 +2307,8 @@ otus_stop(struct ifnet *ifp) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); timeout_del(&sc->scan_to); timeout_del(&sc->calib_to); diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index 75e9e4a8186..ecd6bb4a01d 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.137 2015/11/24 13:45:06 mpi Exp $ */ +/* $OpenBSD: if_ral.c,v 1.138 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -693,7 +693,7 @@ ural_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) DPRINTFN(10, ("tx done\n")); sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ural_start(ifp); splx(s); @@ -1232,12 +1232,12 @@ ural_start(struct ifnet *ifp) * net80211 may still try to send management frames even if the * IFF_RUNNING flag is not set... */ - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (sc->tx_queued >= RAL_TX_LIST_COUNT - 1) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2056,7 +2056,7 @@ ural_init(struct ifnet *ifp) } ural_write(sc, RAL_TXRX_CSR2, tmp); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; if (ic->ic_opmode == IEEE80211_M_MONITOR) @@ -2078,7 +2078,8 @@ ural_stop(struct ifnet *ifp, int disable) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); /* free all nodes */ diff --git a/sys/dev/usb/if_rsu.c b/sys/dev/usb/if_rsu.c index 8d8755899b1..8701d96326e 100644 --- a/sys/dev/usb/if_rsu.c +++ b/sys/dev/usb/if_rsu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsu.c,v 1.31 2015/11/24 13:45:06 mpi Exp $ */ +/* $OpenBSD: if_rsu.c,v 1.32 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1461,8 +1461,8 @@ rsu_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) ifp->if_opackets++; /* We just released a Tx buffer, notify Tx. */ - if (ifp->if_flags & IFF_OACTIVE) { - ifp->if_flags &= ~IFF_OACTIVE; + if (ifq_is_oactive(&ifp->if_snd)) { + ifq_clr_oactive(&ifp->if_snd); rsu_start(ifp); } splx(s); @@ -1601,12 +1601,12 @@ rsu_start(struct ifnet *ifp) struct ieee80211_node *ni; struct mbuf *m; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (TAILQ_EMPTY(&sc->tx_free_list)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } if (ic->ic_state != IEEE80211_S_RUN) @@ -2274,8 +2274,8 @@ rsu_init(struct ifnet *ifp) ic->ic_bss->ni_chan = ic->ic_ibss_chan; /* We're ready to go. */ - ifp->if_flags &= ~IFF_OACTIVE; ifp->if_flags |= IFF_RUNNING; + ifq_set_oactive(&ifp->if_snd); #ifdef notyet if (ic->ic_flags & IEEE80211_F_WEPON) { @@ -2303,7 +2303,8 @@ rsu_stop(struct ifnet *ifp) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* In case we were scanning, release the scan "lock". */ ic->ic_scan_lock = IEEE80211_SCAN_UNLOCKED; diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 774773f1630..9e970597a40 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.116 2015/11/24 13:45:06 mpi Exp $ */ +/* $OpenBSD: if_rum.c,v 1.117 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr> @@ -751,7 +751,7 @@ rum_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) DPRINTFN(10, ("tx done\n")); sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); rum_start(ifp); splx(s); @@ -1236,12 +1236,12 @@ rum_start(struct ifnet *ifp) * net80211 may still try to send management frames even if the * IFF_RUNNING flag is not set... */ - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (sc->tx_queued >= RUM_TX_LIST_COUNT - 1) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2066,7 +2066,7 @@ rum_init(struct ifnet *ifp) } rum_write(sc, RT2573_TXRX_CSR0, tmp); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; if (ic->ic_opmode == IEEE80211_M_MONITOR) @@ -2089,7 +2089,8 @@ rum_stop(struct ifnet *ifp, int disable) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); /* free all nodes */ diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index 5db42fade86..6d4f24f7656 100644 --- a/sys/dev/usb/if_run.c +++ b/sys/dev/usb/if_run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_run.c,v 1.114 2015/11/24 13:45:06 mpi Exp $ */ +/* $OpenBSD: if_run.c,v 1.115 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -694,7 +694,8 @@ run_detach(struct device *self, int flags) usbd_ref_wait(sc->sc_udev); if (ifp->if_softc != NULL) { - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ieee80211_ifdetach(ifp); if_detach(ifp); } @@ -2375,7 +2376,7 @@ run_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) sc->sc_tx_timer = 0; ifp->if_opackets++; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); run_start(ifp); splx(s); } @@ -2519,12 +2520,12 @@ run_start(struct ifnet *ifp) struct ieee80211_node *ni; struct mbuf *m; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (sc->qfullmsk != 0) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } /* send pending management frames first */ @@ -4698,8 +4699,8 @@ run_init(struct ifnet *ifp) if ((error = run_txrx_enable(sc)) != 0) goto fail; - ifp->if_flags &= ~IFF_OACTIVE; ifp->if_flags |= IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (ic->ic_flags & IEEE80211_F_WEPON) { /* install WEP keys */ @@ -4730,7 +4731,8 @@ run_stop(struct ifnet *ifp, int disable) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); timeout_del(&sc->scan_to); timeout_del(&sc->calib_to); diff --git a/sys/dev/usb/if_smsc.c b/sys/dev/usb/if_smsc.c index 0311186a7d0..460dd56229f 100644 --- a/sys/dev/usb/if_smsc.c +++ b/sys/dev/usb/if_smsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_smsc.c,v 1.24 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_smsc.c,v 1.25 2015/11/25 03:10:00 dlg Exp $ */ /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ /*- * Copyright (c) 2012 @@ -589,7 +589,7 @@ smsc_init(void *xsc) /* Indicate we are up and running. */ ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); timeout_add_sec(&sc->sc_stat_ch, 1); @@ -604,7 +604,7 @@ smsc_start(struct ifnet *ifp) /* Don't send anything if there is no link or controller is busy. */ if ((sc->sc_flags & SMSC_FLAG_LINK) == 0 || - (ifp->if_flags & IFF_OACTIVE) != 0) { + ifq_is_oactive(&ifp->if_snd)) { return; } @@ -614,7 +614,7 @@ smsc_start(struct ifnet *ifp) if (smsc_encap(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } ifq_deq_commit(&ifp->if_snd, m_head); @@ -623,7 +623,7 @@ smsc_start(struct ifnet *ifp) if (ifp->if_bpf) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); } void @@ -651,7 +651,8 @@ smsc_stop(struct smsc_softc *sc) ifp = &sc->sc_ac.ac_if; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); timeout_del(&sc->sc_stat_ch); @@ -1263,7 +1264,7 @@ smsc_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); m_freem(c->sc_mbuf); c->sc_mbuf = NULL; diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index 00ed3939ab7..b55474ab1cc 100644 --- a/sys/dev/usb/if_uath.c +++ b/sys/dev/usb/if_uath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uath.c,v 1.74 2015/11/24 13:45:07 mpi Exp $ */ +/* $OpenBSD: if_uath.c,v 1.75 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2006 @@ -1347,7 +1347,7 @@ uath_data_txeof(struct usbd_xfer *xfer, void *priv, ifp->if_opackets++; sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); uath_start(ifp); splx(s); @@ -1471,12 +1471,12 @@ uath_start(struct ifnet *ifp) * net80211 may still try to send management frames even if the * IFF_RUNNING flag is not set... */ - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) && ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (sc->tx_queued >= UATH_TX_DATA_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1934,8 +1934,8 @@ uath_init(struct ifnet *ifp) cmd31.magic2 = htobe32(0xffffffff); (void)uath_cmd_write(sc, UATH_CMD_31, &cmd31, sizeof cmd31, 0); - ifp->if_flags &= ~IFF_OACTIVE; ifp->if_flags |= IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (ic->ic_opmode == IEEE80211_M_MONITOR) ieee80211_new_state(ic, IEEE80211_S_RUN, -1); @@ -1960,7 +1960,8 @@ uath_stop(struct ifnet *ifp, int disable) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); /* free all nodes */ diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index 8b577c0b750..f3b378f2bbc 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_udav.c,v 1.76 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_udav.c,v 1.77 2015/11/25 03:10:00 dlg Exp $ */ /* $NetBSD: if_udav.c,v 1.3 2004/04/23 17:25:25 itojun Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* @@ -646,7 +646,7 @@ udav_init(struct ifnet *ifp) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -913,7 +913,7 @@ udav_start(struct ifnet *ifp) if (!sc->sc_link) return; - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -922,7 +922,7 @@ udav_start(struct ifnet *ifp) if (udav_send(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -933,7 +933,7 @@ udav_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* Set a timeout in case the chip goes out to lunch. */ ifp->if_timer = 5; @@ -1007,7 +1007,7 @@ udav_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { @@ -1220,7 +1220,8 @@ udav_stop(struct ifnet *ifp, int disable) DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); udav_reset(sc); diff --git a/sys/dev/usb/if_ugl.c b/sys/dev/usb/if_ugl.c index d707d69e3e6..df3f92586db 100644 --- a/sys/dev/usb/if_ugl.c +++ b/sys/dev/usb/if_ugl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ugl.c,v 1.16 2015/11/24 13:33:18 mpi Exp $ */ +/* $OpenBSD: if_ugl.c,v 1.17 2015/11/25 03:10:00 dlg Exp $ */ /* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 2013 SASANO Takayoshi <uaa@uaa.org.uk> @@ -521,7 +521,7 @@ ugl_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) __func__, status)); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { @@ -600,7 +600,7 @@ ugl_start(struct ifnet *ifp) DPRINTFN(10,("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -609,7 +609,7 @@ ugl_start(struct ifnet *ifp) if (ugl_send(sc, m_head, 0)) { ifq_deq_commit(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -624,7 +624,7 @@ ugl_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -668,9 +668,9 @@ ugl_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; - splx(s); + + ifq_clr_oactive(&ifp->if_snd); } int @@ -827,7 +827,8 @@ ugl_stop(struct ugl_softc *sc) ifp = GET_IFP(sc); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* Stop transfers. */ if (sc->sc_ep[UGL_ENDPT_RX] != NULL) { diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c index ea03a3ede63..ab65a4dbe06 100644 --- a/sys/dev/usb/if_upgt.c +++ b/sys/dev/usb/if_upgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upgt.c,v 1.74 2015/11/24 13:45:07 mpi Exp $ */ +/* $OpenBSD: if_upgt.c,v 1.75 2015/11/25 03:10:00 dlg Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -1214,7 +1214,7 @@ upgt_init(struct ifnet *ifp) upgt_setup_rates(sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); upgt_set_macfilter(sc, IEEE80211_S_SCAN); @@ -1237,7 +1237,8 @@ upgt_stop(struct upgt_softc *sc) /* device down */ ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); upgt_set_led(sc, UPGT_LED_OFF); @@ -1367,7 +1368,7 @@ upgt_start(struct ifnet *ifp) int i; /* don't transmit packets if interface is busy or down */ - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; DPRINTF(2, "%s: %s\n", sc->sc_dev.dv_xname, __func__); @@ -1427,7 +1428,7 @@ upgt_start(struct ifnet *ifp) sc->sc_dev.dv_xname, sc->tx_queued); /* process the TX queue in process context */ ifp->if_timer = 5; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); usb_rem_task(sc->sc_udev, &sc->sc_task_tx); usb_add_task(sc->sc_udev, &sc->sc_task_tx); } @@ -1629,7 +1630,7 @@ upgt_tx_done(struct upgt_softc *sc, uint8_t *data) if (sc->tx_queued == 0) { /* TX queued was processed, continue */ ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); upgt_start(ifp); } diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c index 2c58fa65fd8..9e8d688dc1b 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.68 2015/11/20 03:35:23 dlg Exp $ */ +/* $OpenBSD: if_upl.c,v 1.69 2015/11/25 03:10:00 dlg Exp $ */ /* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -500,7 +500,7 @@ upl_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) __func__, status)); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { @@ -577,7 +577,7 @@ upl_start(struct ifnet *ifp) DPRINTFN(10,("%s: %s: enter\n", sc->sc_dev.dv_xname,__func__)); - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -586,7 +586,7 @@ upl_start(struct ifnet *ifp) if (upl_send(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -601,7 +601,7 @@ upl_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -645,7 +645,7 @@ upl_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); } @@ -826,7 +826,8 @@ upl_stop(struct upl_softc *sc) ifp = &sc->sc_if; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* Stop transfers. */ if (sc->sc_ep[UPL_ENDPT_RX] != NULL) { diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index 921e39034bc..8447f9bcc28 100644 --- a/sys/dev/usb/if_url.c +++ b/sys/dev/usb/if_url.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_url.c,v 1.78 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_url.c,v 1.79 2015/11/25 03:10:00 dlg Exp $ */ /* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */ /* * Copyright (c) 2001, 2002 @@ -522,7 +522,7 @@ url_init(struct ifnet *ifp) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -787,7 +787,7 @@ url_start(struct ifnet *ifp) if (!sc->sc_link) return; - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -796,7 +796,7 @@ url_start(struct ifnet *ifp) if (url_send(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -807,7 +807,7 @@ url_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* Set a timeout in case the chip goes out to lunch. */ ifp->if_timer = 5; @@ -874,7 +874,7 @@ url_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { @@ -1088,7 +1088,8 @@ url_stop(struct ifnet *ifp, int disable) DPRINTF(("%s: %s: enter\n", sc->sc_dev.dv_xname, __func__)); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); url_reset(sc); diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c index 06762723f5c..dd72dcf7c0c 100644 --- a/sys/dev/usb/if_urndis.c +++ b/sys/dev/usb/if_urndis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urndis.c,v 1.58 2015/11/24 17:11:40 mpi Exp $ */ +/* $OpenBSD: if_urndis.c,v 1.59 2015/11/25 03:10:00 dlg Exp $ */ /* * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> @@ -1079,7 +1079,7 @@ urndis_init(struct urndis_softc *sc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); } @@ -1093,7 +1093,8 @@ urndis_stop(struct urndis_softc *sc) ifp = GET_IFP(sc); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (sc->sc_bulkin_pipe != NULL) { usbd_abort_pipe(sc->sc_bulkin_pipe); @@ -1144,7 +1145,7 @@ urndis_start(struct ifnet *ifp) sc = ifp->if_softc; - if (usbd_is_dying(sc->sc_udev) || (ifp->if_flags & IFF_OACTIVE)) + if (usbd_is_dying(sc->sc_udev) || ifq_is_oactive(&ifp->if_snd)) return; m_head = ifq_deq_begin(&ifp->if_snd); @@ -1153,7 +1154,7 @@ urndis_start(struct ifnet *ifp) if (urndis_encap(sc, m_head, 0)) { ifq_deq_rollback(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } ifq_deq_commit(&ifp->if_snd, m_head); @@ -1167,7 +1168,7 @@ urndis_start(struct ifnet *ifp) bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -1242,7 +1243,7 @@ urndis_txeof(struct usbd_xfer *xfer, s = splnet(); ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index 4d45b04d642..b56b9e9942c 100644 --- a/sys/dev/usb/if_urtw.c +++ b/sys/dev/usb/if_urtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtw.c,v 1.59 2015/11/24 13:45:07 mpi Exp $ */ +/* $OpenBSD: if_urtw.c,v 1.60 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2009 Martynas Venckus <martynas@openbsd.org> @@ -2297,7 +2297,7 @@ urtw_init(struct ifnet *ifp) if (error != 0) goto fail; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; ifp->if_timer = 1; @@ -2423,13 +2423,13 @@ urtw_start(struct ifnet *ifp) * net80211 may still try to send management frames even if the * IFF_RUNNING flag is not set... */ - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (sc->sc_tx_low_queued >= URTW_TX_DATA_LIST_COUNT || sc->sc_tx_normal_queued >= URTW_TX_DATA_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2524,7 +2524,7 @@ urtw_txeof_low(struct usbd_xfer *xfer, void *priv, ifp->if_opackets++; sc->sc_tx_low_queued--; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); urtw_start(ifp); splx(s); @@ -2563,7 +2563,7 @@ urtw_txeof_normal(struct usbd_xfer *xfer, void *priv, ifp->if_opackets++; sc->sc_tx_normal_queued--; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); urtw_start(ifp); splx(s); @@ -3006,7 +3006,8 @@ urtw_stop(struct ifnet *ifp, int disable) uint8_t data; usbd_status error; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); @@ -3701,8 +3702,8 @@ urtw_8187b_init(struct ifnet *ifp) if (error != 0) goto fail; - ifp->if_flags &= ~IFF_OACTIVE; ifp->if_flags |= IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 1; diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c index 3442db4f489..8b202dca5ee 100644 --- a/sys/dev/usb/if_urtwn.c +++ b/sys/dev/usb/if_urtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtwn.c,v 1.56 2015/11/24 13:45:07 mpi Exp $ */ +/* $OpenBSD: if_urtwn.c,v 1.57 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1950,8 +1950,8 @@ urtwn_txeof(struct usbd_xfer *xfer, void *priv, ifp->if_opackets++; /* We just released a Tx buffer, notify Tx. */ - if (ifp->if_flags & IFF_OACTIVE) { - ifp->if_flags &= ~IFF_OACTIVE; + if (ifq_is_oactive(&ifp->if_snd)) { + ifq_clr_oactive(&ifp->if_snd); urtwn_start(ifp); } splx(s); @@ -2131,12 +2131,12 @@ urtwn_start(struct ifnet *ifp) struct ieee80211_node *ni; struct mbuf *m; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (TAILQ_EMPTY(&sc->tx_free_list)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } /* Send pending management frames first. */ @@ -3697,8 +3697,8 @@ urtwn_init(struct ifnet *ifp) } /* We're ready to go. */ - ifp->if_flags &= ~IFF_OACTIVE; ifp->if_flags |= IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); #ifdef notyet if (ic->ic_flags & IEEE80211_F_WEPON) { @@ -3727,7 +3727,8 @@ urtwn_stop(struct ifnet *ifp) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); s = splusb(); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 9f44b40742d..5d81a64e619 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.112 2015/11/24 13:45:07 mpi Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.113 2015/11/25 03:10:00 dlg Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -2086,7 +2086,7 @@ zyd_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) ifp->if_opackets++; sc->tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); zyd_start(ifp); splx(s); @@ -2231,12 +2231,12 @@ zyd_start(struct ifnet *ifp) struct ieee80211_node *ni; struct mbuf *m; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { if (sc->tx_queued >= ZYD_TX_LIST_CNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } /* send pending management frames first */ @@ -2455,7 +2455,7 @@ zyd_init(struct ifnet *ifp) } } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; if (ic->ic_opmode == IEEE80211_M_MONITOR) @@ -2477,7 +2477,8 @@ zyd_stop(struct ifnet *ifp, int disable) sc->tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); /* free all nodes */ |