summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-11-25 03:10:01 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-11-25 03:10:01 +0000
commit6215416f96d04fd1a1b0e14e2670c208f0acc34c (patch)
tree14249f751ae54985d3581b0632deb81620be2edf
parentbbe7ffca434bff081b83e600614f4ec4cded8f3b (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@
-rw-r--r--share/man/man9/Makefile6
-rw-r--r--share/man/man9/ifq_enqueue.940
-rw-r--r--sys/arch/armv7/imx/imxenet.c11
-rw-r--r--sys/arch/armv7/omap/if_cpsw.c13
-rw-r--r--sys/arch/armv7/sunxi/sxie.c15
-rw-r--r--sys/arch/macppc/dev/if_bm.c12
-rw-r--r--sys/arch/macppc/dev/if_mc.c15
-rw-r--r--sys/arch/octeon/dev/if_cnmac.c11
-rw-r--r--sys/arch/sgi/dev/if_iec.c13
-rw-r--r--sys/arch/sgi/dev/if_mec.c13
-rw-r--r--sys/arch/sgi/hpc/if_sq.c15
-rw-r--r--sys/arch/socppc/dev/if_tsec.c13
-rw-r--r--sys/arch/sparc/dev/be.c10
-rw-r--r--sys/arch/sparc/dev/hme.c13
-rw-r--r--sys/arch/sparc/dev/if_ie.c9
-rw-r--r--sys/arch/sparc/dev/qe.c12
-rw-r--r--sys/arch/sparc64/dev/vnet.c21
-rw-r--r--sys/arch/vax/if/if_de.c13
-rw-r--r--sys/arch/vax/if/if_qe.c10
-rw-r--r--sys/arch/vax/if/sgec.c10
-rw-r--r--sys/dev/ic/acx.c13
-rw-r--r--sys/dev/ic/aic6915.c14
-rw-r--r--sys/dev/ic/am7990.c10
-rw-r--r--sys/dev/ic/am79900.c10
-rw-r--r--sys/dev/ic/an.c13
-rw-r--r--sys/dev/ic/ar5008.c4
-rw-r--r--sys/dev/ic/ar9003.c4
-rw-r--r--sys/dev/ic/ath.c10
-rw-r--r--sys/dev/ic/athn.c11
-rw-r--r--sys/dev/ic/atw.c18
-rw-r--r--sys/dev/ic/bwi.c17
-rw-r--r--sys/dev/ic/dc.c17
-rw-r--r--sys/dev/ic/dp8390.c10
-rw-r--r--sys/dev/ic/elink3.c15
-rw-r--r--sys/dev/ic/fxp.c13
-rw-r--r--sys/dev/ic/gem.c13
-rw-r--r--sys/dev/ic/hme.c13
-rw-r--r--sys/dev/ic/i82596.c12
-rw-r--r--sys/dev/ic/if_wi.c15
-rw-r--r--sys/dev/ic/lance.c4
-rw-r--r--sys/dev/ic/lemac.c12
-rw-r--r--sys/dev/ic/malo.c11
-rw-r--r--sys/dev/ic/mtd8xx.c13
-rw-r--r--sys/dev/ic/pgt.c11
-rw-r--r--sys/dev/ic/re.c15
-rw-r--r--sys/dev/ic/rt2560.c17
-rw-r--r--sys/dev/ic/rt2661.c15
-rw-r--r--sys/dev/ic/rt2860.c13
-rw-r--r--sys/dev/ic/rtl81x9.c11
-rw-r--r--sys/dev/ic/rtw.c32
-rw-r--r--sys/dev/ic/smc83c170.c11
-rw-r--r--sys/dev/ic/smc91cxx.c11
-rw-r--r--sys/dev/ic/ti.c13
-rw-r--r--sys/dev/ic/xl.c17
-rw-r--r--sys/dev/isa/if_ef_isapnp.c15
-rw-r--r--sys/dev/isa/if_eg.c12
-rw-r--r--sys/dev/isa/if_el.c10
-rw-r--r--sys/dev/isa/if_ex.c12
-rw-r--r--sys/dev/isa/if_ie.c10
-rw-r--r--sys/dev/pci/if_age.c13
-rw-r--r--sys/dev/pci/if_alc.c13
-rw-r--r--sys/dev/pci/if_ale.c13
-rw-r--r--sys/dev/pci/if_bce.c13
-rw-r--r--sys/dev/pci/if_bge.c13
-rw-r--r--sys/dev/pci/if_bnx.c19
-rw-r--r--sys/dev/pci/if_cas.c13
-rw-r--r--sys/dev/pci/if_de.c18
-rw-r--r--sys/dev/pci/if_em.c13
-rw-r--r--sys/dev/pci/if_et.c15
-rw-r--r--sys/dev/pci/if_ipw.c11
-rw-r--r--sys/dev/pci/if_iwi.c11
-rw-r--r--sys/dev/pci/if_iwm.c15
-rw-r--r--sys/dev/pci/if_iwn.c15
-rw-r--r--sys/dev/pci/if_ix.c15
-rw-r--r--sys/dev/pci/if_ixgb.c13
-rw-r--r--sys/dev/pci/if_jme.c18
-rw-r--r--sys/dev/pci/if_lge.c13
-rw-r--r--sys/dev/pci/if_lii.c13
-rw-r--r--sys/dev/pci/if_msk.c11
-rw-r--r--sys/dev/pci/if_myx.c15
-rw-r--r--sys/dev/pci/if_nep.c13
-rw-r--r--sys/dev/pci/if_nfe.c13
-rw-r--r--sys/dev/pci/if_nge.c13
-rw-r--r--sys/dev/pci/if_nxe.c15
-rw-r--r--sys/dev/pci/if_oce.c15
-rw-r--r--sys/dev/pci/if_pcn.c15
-rw-r--r--sys/dev/pci/if_rtwn.c13
-rw-r--r--sys/dev/pci/if_se.c13
-rw-r--r--sys/dev/pci/if_sis.c13
-rw-r--r--sys/dev/pci/if_sk.c11
-rw-r--r--sys/dev/pci/if_ste.c13
-rw-r--r--sys/dev/pci/if_stge.c13
-rw-r--r--sys/dev/pci/if_tht.c13
-rw-r--r--sys/dev/pci/if_tl.c11
-rw-r--r--sys/dev/pci/if_txp.c13
-rw-r--r--sys/dev/pci/if_vge.c13
-rw-r--r--sys/dev/pci/if_vic.c13
-rw-r--r--sys/dev/pci/if_vio.c17
-rw-r--r--sys/dev/pci/if_vmx.c15
-rw-r--r--sys/dev/pci/if_vr.c13
-rw-r--r--sys/dev/pci/if_vte.c13
-rw-r--r--sys/dev/pci/if_wb.c11
-rw-r--r--sys/dev/pci/if_wpi.c15
-rw-r--r--sys/dev/pci/if_xge.c11
-rw-r--r--sys/dev/pcmcia/if_malo.c15
-rw-r--r--sys/dev/pcmcia/if_xe.c6
-rw-r--r--sys/dev/sbus/be.c10
-rw-r--r--sys/dev/sbus/qe.c14
-rw-r--r--sys/dev/usb/if_athn_usb.c15
-rw-r--r--sys/dev/usb/if_atu.c17
-rw-r--r--sys/dev/usb/if_aue.c15
-rw-r--r--sys/dev/usb/if_axe.c15
-rw-r--r--sys/dev/usb/if_axen.c15
-rw-r--r--sys/dev/usb/if_cdce.c15
-rw-r--r--sys/dev/usb/if_cdcef.c17
-rw-r--r--sys/dev/usb/if_cue.c15
-rw-r--r--sys/dev/usb/if_kue.c15
-rw-r--r--sys/dev/usb/if_mos.c15
-rw-r--r--sys/dev/usb/if_otus.c16
-rw-r--r--sys/dev/usb/if_ral.c13
-rw-r--r--sys/dev/usb/if_rsu.c15
-rw-r--r--sys/dev/usb/if_rum.c13
-rw-r--r--sys/dev/usb/if_run.c16
-rw-r--r--sys/dev/usb/if_smsc.c15
-rw-r--r--sys/dev/usb/if_uath.c13
-rw-r--r--sys/dev/usb/if_udav.c15
-rw-r--r--sys/dev/usb/if_ugl.c17
-rw-r--r--sys/dev/usb/if_upgt.c13
-rw-r--r--sys/dev/usb/if_upl.c15
-rw-r--r--sys/dev/usb/if_url.c15
-rw-r--r--sys/dev/usb/if_urndis.c15
-rw-r--r--sys/dev/usb/if_urtw.c17
-rw-r--r--sys/dev/usb/if_urtwn.c15
-rw-r--r--sys/dev/usb/if_zyd.c13
-rw-r--r--sys/net/if.c9
-rw-r--r--sys/net/if_var.h21
-rw-r--r--sys/net80211/ieee80211_pae_output.c4
137 files changed, 1009 insertions, 843 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 285f0584b6a..e25808556ec 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.261 2015/11/24 19:37:30 jmc Exp $
+# $OpenBSD: Makefile,v 1.262 2015/11/25 03:09:57 dlg Exp $
# $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@@ -217,7 +217,9 @@ MLINKS+=if_rxr_init.9 if_rxr_get.9 if_rxr_init.9 if_rxr_put.9 \
if_rxr_init.9 if_rxr_inuse.9 if_rxr_init.9 if_rxr_ioctl.9 \
if_rxr_init.9 if_rxr_info_ioctl.9
MLINKS+=ifq_enqueue.9 ifq_dequeue.9 ifq_enqueue.9 ifq_purge.9 \
- ifq_enqueue.9 ifq_len.9 ifq_enqueue.9 ifq_empty.9
+ ifq_enqueue.9 ifq_len.9 ifq_enqueue.9 ifq_empty.9 \
+ ifq_enqueue.9 ifq_set_oactive.9 ifq_enqueue.9 ifq_clr_oactive.9 \
+ ifq_enqueue.9 ifq_is_oactive.9
MLINKS+=ifq_deq_begin.9 ifq_deq_commit.9 ifq_deq_begin.9 ifq_deq_rollback.9
MLINKS+=iic.9 iic_acquire_bus.9 iic.9 iic_release_bus.9 iic.9 iic_exec.9 \
iic.9 iic_smbus_write_byte.9 iic.9 iic_smbus_read_byte.9 \
diff --git a/share/man/man9/ifq_enqueue.9 b/share/man/man9/ifq_enqueue.9
index d3509cbbf5d..03c5909b0ca 100644
--- a/share/man/man9/ifq_enqueue.9
+++ b/share/man/man9/ifq_enqueue.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifq_enqueue.9,v 1.3 2015/11/23 11:07:58 jmc Exp $
+.\" $OpenBSD: ifq_enqueue.9,v 1.4 2015/11/25 03:09:57 dlg Exp $
.\"
.\" Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 23 2015 $
+.Dd $Mdocdate: November 25 2015 $
.Dt IFQ_ENQUEUE 9
.Os
.Sh NAME
@@ -22,7 +22,10 @@
.Nm ifq_dequeue ,
.Nm ifq_purge ,
.Nm ifq_len ,
-.Nm ifq_empty
+.Nm ifq_empty ,
+.Nm ifq_set_oactive ,
+.Nm ifq_clr_oactive ,
+.Nm ifq_is_oactive
.Nd interface send queue API
.Sh SYNOPSIS
.In net/if_var.h
@@ -36,6 +39,12 @@
.Fn ifq_len "struct ifqueue *ifq"
.Ft unsigned int
.Fn ifq_empty "struct ifqueue *ifq"
+.Ft void
+.Fn ifq_set_oactive "struct ifqueue *ifq"
+.Ft void
+.Fn ifq_clr_oactive "struct ifqueue *ifq"
+.Ft unsigned int
+.Fn ifq_is_oactive "struct ifqueue *ifq"
.Sh DESCRIPTION
The ifqueue API provides implementions of data structures and
operations for the network stack to queue mbufs for a network driver
@@ -72,14 +81,33 @@ or
Return if the interface send queue
.Fa ifq
is empty.
+.It Fn ifq_set_oactive "struct ifqueue *ifq"
+.Fn ifq_set_oactive
+is called by the relevant driver to mark the hardware associated
+with the interface send queue
+.Fa ifq
+as unable to transmit more packets.
+.It Fn ifq_clr_oactive "struct ifqueue *ifq"
+.Fn ifq_clr_oactive
+is called by the relevant driver to clear the "active" mark on the
+hardware associated with the interface send queue
+.Fa ifq ,
+meaning it is now able to transmit packets.
+.It Fn ifq_is_oactive "struct ifqueue *ifq"
+Return if the hardware associated with the interface send queue
+.Fa ifq
+is unable to transmit more packets.
.El
.Sh CONTEXT
.Fn ifq_enqueue ,
.Fn ifq_dequeue ,
.Fn ifq_purge ,
.Fn ifq_len ,
+.Fn ifq_empty ,
+.Fn ifq_set_oactive ,
+.Fn ifq_clr_oactive ,
and
-.Fn ifq_empty
+.Fn ifq_is_oactive
can be called during autoconf, from process context, or from interrupt context.
.Sh RETURN VALUES
.Fn ifq_enqueue
@@ -99,6 +127,10 @@ returns the number of mbufs on the queue.
.Pp
.Fn ifq_empty
returns a non-zero value if the queue is empty, otherwise 0.
+.Pp
+.Fn ifq_is_oactive
+returns a non-zero value if the hardware associated with the interface
+send queue is unable to transmit more packets, otherwise 0.
.Sh SEE ALSO
.Xr ifq_deq_begin 9 ,
.Xr m_freem 9
diff --git a/sys/arch/armv7/imx/imxenet.c b/sys/arch/armv7/imx/imxenet.c
index 479f90d2823..b9273fc247d 100644
--- a/sys/arch/armv7/imx/imxenet.c
+++ b/sys/arch/armv7/imx/imxenet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxenet.c,v 1.19 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: imxenet.c,v 1.20 2015/11/25 03:09:57 dlg Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -697,7 +697,7 @@ imxenet_init(struct imxenet_softc *sc)
/* Indicate we are up and running. */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* enable interrupts for tx/rx */
HWRITE4(sc, ENET_EIMR, ENET_EIR_TXF | ENET_EIR_RXF);
@@ -714,8 +714,9 @@ imxenet_stop(struct imxenet_softc *sc)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
ifp->if_timer = 0;
+ ifq_clr_oactive(&ifp->if_snd);
/* reset the controller */
HSET4(sc, ENET_ECR, ENET_ECR_RESET);
@@ -811,7 +812,7 @@ imxenet_start(struct ifnet *ifp)
struct imxenet_softc *sc = ifp->if_softc;
struct mbuf *m_head = NULL;
- if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING)
+ if (ifq_is_oactive(&ifp->if_snd) || !(ifp->if_flags & IFF_RUNNING))
return;
for (;;) {
@@ -821,7 +822,7 @@ imxenet_start(struct ifnet *ifp)
if (imxenet_encap(sc, m_head)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/arch/armv7/omap/if_cpsw.c b/sys/arch/armv7/omap/if_cpsw.c
index 126d569476e..124b06a1143 100644
--- a/sys/arch/armv7/omap/if_cpsw.c
+++ b/sys/arch/armv7/omap/if_cpsw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cpsw.c,v 1.29 2015/11/12 10:23:08 dlg Exp $ */
+/* $OpenBSD: if_cpsw.c,v 1.30 2015/11/25 03:09:57 dlg Exp $ */
/* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */
/*
@@ -450,7 +450,7 @@ cpsw_start(struct ifnet *ifp)
u_int mlen;
if (!ISSET(ifp->if_flags, IFF_RUNNING) ||
- ISSET(ifp->if_flags, IFF_OACTIVE) ||
+ ifq_is_oactive(&ifp->if_snd) ||
IFQ_IS_EMPTY(&ifp->if_snd))
return;
@@ -461,7 +461,7 @@ cpsw_start(struct ifnet *ifp)
for (;;) {
if (txfree <= CPSW_TXFRAGS) {
- SET(ifp->if_flags, IFF_OACTIVE);
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -867,7 +867,7 @@ cpsw_init(struct ifnet *ifp)
sc->sc_txeoq = true;
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
timeout_add_sec(&sc->sc_tick, 1);
@@ -935,8 +935,9 @@ cpsw_stop(struct ifnet *ifp)
rdp->tx_mb[i] = NULL;
}
- ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING);
ifp->if_timer = 0;
+ ifq_clr_oactive(&ifp->if_snd);
/* XXX Not sure what this is doing calling disable here
where is disable set?
@@ -1122,7 +1123,7 @@ cpsw_txintr(void *arg)
handled = true;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
next:
if ((bd.flags & (CPDMA_BD_EOP|CPDMA_BD_EOQ)) ==
diff --git a/sys/arch/armv7/sunxi/sxie.c b/sys/arch/armv7/sunxi/sxie.c
index c74bbaf7d19..062b0d06337 100644
--- a/sys/arch/armv7/sunxi/sxie.c
+++ b/sys/arch/armv7/sunxi/sxie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxie.c,v 1.12 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: sxie.c,v 1.13 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
* Copyright (c) 2013 Artturi Alm
@@ -396,7 +396,7 @@ sxie_init(struct sxie_softc *sc)
/* Indicate we are up and running. */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
SXISET4(sc, SXIE_INTCR, SXIE_INTR_ENABLE);
@@ -426,7 +426,7 @@ sxie_intr(void *arg)
pending &= 3;
if (pending) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->txf_inuse--;
ifp->if_opackets++;
if (pending == 3) { /* 2 packets got sent */
@@ -461,9 +461,9 @@ sxie_start(struct ifnet *ifp)
uint32_t txbuf[SXIE_MAX_PKT_SIZE / sizeof(uint32_t)]; /* XXX !!! */
if (sc->txf_inuse > 1)
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
- if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
td = (uint8_t *)&txbuf[0];
@@ -484,7 +484,7 @@ trynext:
if (sc->txf_inuse > 1) {
ifq_deq_rollback(&ifp->if_snd, m);
printf("sxie_start: tx fifos in use.\n");
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
@@ -524,8 +524,9 @@ sxie_stop(struct sxie_softc *sc)
sxie_reset(sc);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
ifp->if_timer = 0;
+ ifq_clr_oactive(&ifp->if_snd);
}
void
diff --git a/sys/arch/macppc/dev/if_bm.c b/sys/arch/macppc/dev/if_bm.c
index 3cdeaa9ab72..c328a3c4d84 100644
--- a/sys/arch/macppc/dev/if_bm.c
+++ b/sys/arch/macppc/dev/if_bm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bm.c,v 1.37 2015/11/14 17:26:40 mpi Exp $ */
+/* $OpenBSD: if_bm.c,v 1.38 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: if_bm.c,v 1.1 1999/01/01 01:27:52 tsubai Exp $ */
/*-
@@ -421,7 +421,7 @@ bmac_init(struct bmac_softc *sc)
bmac_write_reg(sc, INTDISABLE, NormalIntEvents);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
data = sc->sc_txbuf;
@@ -483,7 +483,7 @@ bmac_intr(void *v)
#endif
if (stat & IntFrameSent) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
ifp->if_opackets++;
bmac_start(ifp);
@@ -610,11 +610,11 @@ bmac_start(struct ifnet *ifp)
struct mbuf *m;
int tlen;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
while (1) {
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
IFQ_DEQUEUE(&ifp->if_snd, m);
@@ -629,7 +629,7 @@ bmac_start(struct ifnet *ifp)
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
tlen = bmac_put(sc, sc->sc_txbuf, m);
/* 5 seconds to watch for failing to transmit */
diff --git a/sys/arch/macppc/dev/if_mc.c b/sys/arch/macppc/dev/if_mc.c
index 31f019bae0f..2369d4b7156 100644
--- a/sys/arch/macppc/dev/if_mc.c
+++ b/sys/arch/macppc/dev/if_mc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mc.c,v 1.25 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: if_mc.c,v 1.26 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: if_mc.c,v 1.9.16.1 2006/06/21 14:53:13 yamt Exp $ */
/*-
@@ -546,11 +546,11 @@ mc_start(struct ifnet *ifp)
struct mc_softc *sc = ifp->if_softc;
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;
while (1) {
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
IFQ_DEQUEUE(&ifp->if_snd, m);
@@ -569,7 +569,7 @@ mc_start(struct ifnet *ifp)
/*
* Copy the mbuf chain into the transmit buffer.
*/
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
maceput(sc, m);
ifp->if_opackets++; /* # of pkts */
@@ -647,7 +647,7 @@ mc_init(struct mc_softc *sc)
/* flag interface as "running" */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
}
@@ -669,7 +669,8 @@ mc_stop(struct mc_softc *sc)
DELAY(100);
ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
return (0);
@@ -775,7 +776,7 @@ mc_tint(struct mc_softc *sc)
ifp->if_oerrors++;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
mc_start(ifp);
}
diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c
index c31b889c85a..f7ac8d6fd63 100644
--- a/sys/arch/octeon/dev/if_cnmac.c
+++ b/sys/arch/octeon/dev/if_cnmac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cnmac.c,v 1.34 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: if_cnmac.c,v 1.35 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -1006,7 +1006,7 @@ octeon_eth_start(struct ifnet *ifp)
*/
octeon_eth_send_queue_flush_prefetch(sc);
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
goto last;
if (__predict_false(!cn30xxgmx_link_status(sc->sc_gmx_port)))
@@ -1063,7 +1063,7 @@ octeon_eth_watchdog(struct ifnet *ifp)
octeon_eth_configure(sc);
SET(ifp->if_flags, IFF_RUNNING);
- CLR(ifp->if_flags, IFF_OACTIVE);
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
octeon_eth_start(ifp);
@@ -1097,7 +1097,7 @@ octeon_eth_init(struct ifnet *ifp)
timeout_add_sec(&sc->sc_tick_free_ch, 1);
SET(ifp->if_flags, IFF_RUNNING);
- CLR(ifp->if_flags, IFF_OACTIVE);
+ ifq_clr_oactive(&ifp->if_snd);
return 0;
}
@@ -1116,7 +1116,8 @@ octeon_eth_stop(struct ifnet *ifp, int disable)
cn30xxgmx_port_enable(sc->sc_gmx_port, 0);
/* Mark the interface as down and cancel the watchdog timer. */
- CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE);
+ CLR(ifp->if_flags, IFF_RUNNING);
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
intr_barrier(octeon_eth_pow_recv_ih);
diff --git a/sys/arch/sgi/dev/if_iec.c b/sys/arch/sgi/dev/if_iec.c
index 3dc1674dfe5..623a04c8d00 100644
--- a/sys/arch/sgi/dev/if_iec.c
+++ b/sys/arch/sgi/dev/if_iec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iec.c,v 1.19 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: if_iec.c,v 1.20 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -682,7 +682,7 @@ iec_init(struct ifnet *ifp)
timeout_add_sec(&sc->sc_tick, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
iec_start(ifp);
@@ -744,7 +744,7 @@ iec_start(struct ifnet *ifp)
int error, firstdirty, nexttx, opending;
int len;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
/*
@@ -954,7 +954,7 @@ iec_start(struct ifnet *ifp)
if (sc->sc_txpending == IEC_NTXDESC) {
/* No more slots; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
if (sc->sc_txpending != opending) {
@@ -989,7 +989,8 @@ iec_stop(struct ifnet *ifp)
DPRINTF(IEC_DEBUG_STOP, ("iec_stop\n"));
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_tick);
mii_down(&sc->sc_mii);
@@ -1323,7 +1324,7 @@ iec_txintr(struct iec_softc *sc, uint32_t stat)
uint32_t tcir;
int i, once, last;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
tcir = bus_space_read_4(st, sh, IOC3_ENET_TCIR) & ~IOC3_ENET_TCIR_IDLE;
last = (tcir / IEC_TXDESCSIZE) % IEC_NTXDESC_MAX;
diff --git a/sys/arch/sgi/dev/if_mec.c b/sys/arch/sgi/dev/if_mec.c
index 1fb905e7ac8..1e7d32f616f 100644
--- a/sys/arch/sgi/dev/if_mec.c
+++ b/sys/arch/sgi/dev/if_mec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mec.c,v 1.34 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: if_mec.c,v 1.35 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: if_mec_mace.c,v 1.5 2004/08/01 06:36:36 tsutsui Exp $ */
/*
@@ -668,7 +668,7 @@ mec_init(struct ifnet *ifp)
timeout_add_sec(&sc->sc_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
mec_start(ifp);
mii_mediachg(&sc->sc_mii);
@@ -722,7 +722,7 @@ mec_start(struct ifnet *ifp)
int error, firsttx, nexttx, opending;
int len, bufoff, buflen, unaligned, txdlen;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
/*
@@ -960,7 +960,7 @@ mec_start(struct ifnet *ifp)
if (sc->sc_txpending == MEC_NTXDESC) {
/* No more slots; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
if (sc->sc_txpending != opending) {
@@ -1001,7 +1001,8 @@ mec_stop(struct ifnet *ifp)
DPRINTF(MEC_DEBUG_STOP, ("mec_stop\n"));
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_tick_ch);
mii_down(&sc->sc_mii);
@@ -1328,7 +1329,7 @@ mec_txintr(struct mec_softc *sc, uint32_t stat)
int i, last;
u_int col;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
DPRINTF(MEC_DEBUG_TXINTR, ("mec_txintr: called\n"));
diff --git a/sys/arch/sgi/hpc/if_sq.c b/sys/arch/sgi/hpc/if_sq.c
index 0f2f0d034dd..f09e0937e1b 100644
--- a/sys/arch/sgi/hpc/if_sq.c
+++ b/sys/arch/sgi/hpc/if_sq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sq.c,v 1.22 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: if_sq.c,v 1.23 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: if_sq.c,v 1.42 2011/07/01 18:53:47 dyoung Exp $ */
/*
@@ -548,7 +548,7 @@ sq_init(struct ifnet *ifp)
sq_hpc_write(sc, HPC1_ENET_INTDELAY, HPC1_ENET_INTDELAY_OFF);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sq_start(ifp);
return 0;
@@ -650,7 +650,7 @@ sq_start(struct ifnet *ifp)
uint32_t status;
int err, len, totlen, nexttx, firsttx, lasttx = -1, ofree, seg;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
/*
@@ -746,7 +746,7 @@ sq_start(struct ifnet *ifp)
* XXX We could allocate an mbuf and copy, but
* XXX it is worth it?
*/
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
bus_dmamap_unload(sc->sc_dmat, dmamap);
if (m != NULL)
m_freem(m);
@@ -846,7 +846,7 @@ sq_start(struct ifnet *ifp)
/* All transmit descriptors used up, let upper layers know */
if (sc->sc_nfreetx == 0)
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
if (sc->sc_nfreetx != ofree) {
SQ_DPRINTF(("%s: %d packets enqueued, first %d, INTR on %d\n",
@@ -948,7 +948,8 @@ sq_stop(struct ifnet *ifp)
int i;
ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
for (i = 0; i < SQ_NTXDESC; i++) {
if (sc->sc_txmbuf[i] != NULL) {
@@ -1265,7 +1266,7 @@ sq_txintr(struct sq_softc *sc)
/* If we have buffers free, let upper layers know */
if (sc->sc_nfreetx > 0)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* If all packets have left the coop, cancel watchdog */
if (sc->sc_nfreetx == SQ_NTXDESC)
diff --git a/sys/arch/socppc/dev/if_tsec.c b/sys/arch/socppc/dev/if_tsec.c
index 28976795850..c2eea96903f 100644
--- a/sys/arch/socppc/dev/if_tsec.c
+++ b/sys/arch/socppc/dev/if_tsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tsec.c,v 1.41 2015/11/24 13:33:18 mpi Exp $ */
+/* $OpenBSD: if_tsec.c,v 1.42 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
@@ -517,7 +517,7 @@ tsec_start(struct ifnet *ifp)
if (!(ifp->if_flags & IFF_RUNNING))
return;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
if (IFQ_IS_EMPTY(&ifp->if_snd))
return;
@@ -533,7 +533,7 @@ tsec_start(struct ifnet *ifp)
error = tsec_encap(sc, m, &idx);
if (error == ENOBUFS) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
if (error == EFBIG) {
@@ -828,7 +828,7 @@ tsec_tx_proc(struct tsec_softc *sc)
ifp->if_opackets++;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->sc_tx_cnt--;
@@ -1031,7 +1031,7 @@ tsec_up(struct tsec_softc *sc)
tsec_iff(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
tsec_write(sc, TSEC_IMASK, TSEC_IMASK_TXEEN |
TSEC_IMASK_TXBEN | TSEC_IMASK_TXFEN |
@@ -1050,7 +1050,8 @@ tsec_down(struct tsec_softc *sc)
timeout_del(&sc->sc_tick);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
tsec_stop_dma(sc);
diff --git a/sys/arch/sparc/dev/be.c b/sys/arch/sparc/dev/be.c
index a45833e6708..966ea70bc3a 100644
--- a/sys/arch/sparc/dev/be.c
+++ b/sys/arch/sparc/dev/be.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: be.c,v 1.56 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: be.c,v 1.57 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 1998 Theo de Raadt and Jason L. Wright.
@@ -251,7 +251,7 @@ bestart(ifp)
be_tx_harvest(sc);
}
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
bix = sc->sc_last_td;
@@ -288,7 +288,7 @@ bestart(ifp)
bix = 0;
if (++cnt == BE_TX_RING_SIZE) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
}
@@ -469,7 +469,7 @@ be_tx_harvest(sc)
if (sc->sc_no_td != cnt) {
sc->sc_first_td = bix;
sc->sc_no_td = cnt;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
if (sc->sc_no_td < BE_TX_LOW_WATER) {
@@ -714,7 +714,7 @@ beinit(sc)
br->rx_cfg |= BE_BR_RXCFG_ENABLE;
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
timeout_add_sec(&sc->sc_tick, 1);
diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c
index a197caa59a3..217c8e8a642 100644
--- a/sys/arch/sparc/dev/hme.c
+++ b/sys/arch/sparc/dev/hme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hme.c,v 1.75 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: hme.c,v 1.76 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 1998 Jason L. Wright (jason@thought.net)
@@ -272,7 +272,7 @@ hmestart(ifp)
struct mbuf *m;
int bix, len;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
bix = sc->sc_last_td;
@@ -307,7 +307,7 @@ hmestart(ifp)
bix = 0;
if (++sc->sc_no_td == HME_TX_RING_SIZE) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
}
@@ -329,7 +329,8 @@ hmestop(sc)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
mii_down(&sc->sc_mii);
@@ -571,7 +572,7 @@ hmeinit(sc)
timeout_add_sec(&sc->sc_tick, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
void
@@ -669,7 +670,7 @@ hme_tint(sc)
if (txd.tx_flags & HME_TXD_OWN)
break;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_opackets++;
if (++bix == HME_TX_RING_SIZE)
diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c
index 50bc9282f77..5430c53467b 100644
--- a/sys/arch/sparc/dev/if_ie.c
+++ b/sys/arch/sparc/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.58 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: if_ie.c,v 1.59 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */
/*-
@@ -819,7 +819,7 @@ ietint(sc)
int status;
sc->sc_arpcom.ac_if.if_timer = 0;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_arpcom.ac_if.if_snd);
status = sc->xmit_cmds[sc->xctail]->ie_xmit_status;
@@ -1306,7 +1306,7 @@ iestart(ifp)
return;
if (sc->xmit_free == 0) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
if (!sc->xmit_busy)
iexmit(sc);
return;
@@ -1406,7 +1406,8 @@ iereset(sc)
printf("%s: reset\n", sc->sc_dev.dv_xname);
/* Clear OACTIVE in case we're called from watchdog (frozen xmit). */
- sc->sc_arpcom.ac_if.if_flags &= ~(IFF_UP | IFF_OACTIVE);
+ sc->sc_arpcom.ac_if.if_flags &= ~IFF_UP;
+ ifq_clr_oactive(&sc->sc_arpcom.ac_if.if_snd);
ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, 0);
/*
diff --git a/sys/arch/sparc/dev/qe.c b/sys/arch/sparc/dev/qe.c
index 0da22b6e595..8251d544311 100644
--- a/sys/arch/sparc/dev/qe.c
+++ b/sys/arch/sparc/dev/qe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qe.c,v 1.46 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: qe.c,v 1.47 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 1998, 2000 Jason L. Wright.
@@ -192,7 +192,7 @@ qestart(ifp)
struct mbuf *m;
int bix, len;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
bix = sc->sc_last_td;
@@ -228,7 +228,7 @@ qestart(ifp)
bix = 0;
if (++sc->sc_no_td == QE_TX_RING_SIZE) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
}
@@ -355,8 +355,8 @@ qe_tint(sc)
*/
if (sc->sc_first_td != bix) {
sc->sc_first_td = bix;
- if (ifp->if_flags & IFF_OACTIVE) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ if (ifq_is_oactive(&ifp->if_snd)) {
+ ifq_clr_oactive(&ifp->if_snd);
qestart(ifp);
}
}
@@ -717,7 +717,7 @@ qeinit(sc)
i = mr->mpc; /* cleared on read */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
mr->maccc = QE_MR_MACCC_ENXMT | QE_MR_MACCC_ENRCV |
((ifp->if_flags & IFF_PROMISC) ? QE_MR_MACCC_PROM : 0);
diff --git a/sys/arch/sparc64/dev/vnet.c b/sys/arch/sparc64/dev/vnet.c
index 001f317301e..39a37c89800 100644
--- a/sys/arch/sparc64/dev/vnet.c
+++ b/sys/arch/sparc64/dev/vnet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnet.c,v 1.50 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: vnet.c,v 1.51 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2009, 2015 Mark Kettenis
*
@@ -660,7 +660,7 @@ vnet_rx_vio_rdx(struct vnet_softc *sc, struct vio_msg_tag *tag)
vnet_setmulti(sc, 1);
KERNEL_LOCK();
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
vnet_start(ifp);
KERNEL_UNLOCK();
}
@@ -889,7 +889,7 @@ vnet_rx_vio_dring_data(struct vnet_softc *sc, struct vio_msg_tag *tag)
KERNEL_LOCK();
if (count < (sc->sc_vd->vd_nentries - 1))
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (count == 0)
ifp->if_timer = 0;
@@ -1064,7 +1064,7 @@ vnet_start(struct ifnet *ifp)
u_int start, prod, count;
int err;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if (IFQ_IS_EMPTY(&ifp->if_snd))
@@ -1088,7 +1088,7 @@ vnet_start(struct ifnet *ifp)
tx_tail += sizeof(struct ldc_pkt);
tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(struct ldc_pkt)) - 1);
if (tx_tail == tx_head) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
@@ -1107,14 +1107,14 @@ vnet_start(struct ifnet *ifp)
if (count >= (sc->sc_vd->vd_nentries - 1) ||
map->lm_count >= map->lm_nentries) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
buf = pool_get(&sc->sc_pool, PR_NOWAIT|PR_ZERO);
if (buf == NULL) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
m_copydata(m, 0, m->m_pkthdr.len, buf + VNET_ETHER_ALIGN);
@@ -1184,14 +1184,14 @@ vnet_start_desc(struct ifnet *ifp)
if (count >= (sc->sc_vd->vd_nentries - 1) ||
map->lm_count >= map->lm_nentries) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
buf = pool_get(&sc->sc_pool, PR_NOWAIT|PR_ZERO);
if (buf == NULL) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
m_copydata(m, 0, m->m_pkthdr.len, buf);
@@ -1429,7 +1429,8 @@ vnet_stop(struct ifnet *ifp)
struct vnet_softc *sc = ifp->if_softc;
struct ldc_conn *lc = &sc->sc_lc;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_DISABLED);
diff --git a/sys/arch/vax/if/if_de.c b/sys/arch/vax/if/if_de.c
index c26e9e5c955..455a96e256d 100644
--- a/sys/arch/vax/if/if_de.c
+++ b/sys/arch/vax/if/if_de.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_de.c,v 1.33 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: if_de.c,v 1.34 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: if_de.c,v 1.27 1997/04/19 15:02:29 ragge Exp $ */
/*
@@ -222,7 +222,8 @@ dereset(unit)
volatile struct dedevice *addr = sc->ds_vaddr;
printf(" de%d", unit);
- sc->ds_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ sc->ds_if.if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&sc->ds_if.if_snd);
sc->ds_flags &= ~DSF_RUNNING;
addr->pcsr0 = PCSR0_RSET;
(void)dewait(sc, "reset");
@@ -347,7 +348,7 @@ destart(ifp)
* the code is not reentrant and we have
* multiple transmission buffers.
*/
- if (ds->ds_if.if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ds->ds_if.if_snd))
return;
for (nxmit = ds->ds_nxmit; nxmit < NXMT; nxmit++) {
IFQ_DEQUEUE(&ds->ds_if.if_snd, m);
@@ -401,7 +402,7 @@ deintr(unit)
addr->pchigh = csr0 >> 8;
- ds->ds_if.if_flags |= IFF_OACTIVE; /* prevent entering destart */
+ ifq_set_oactive(&ds->ds_if.if_snd); /* prevent entering destart */
/*
* if receive, put receive buffer on mbuf
* and hang the request again
@@ -452,7 +453,7 @@ deintr(unit)
if (ds->ds_xindex == NXMT)
ds->ds_xindex = 0;
}
- ds->ds_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ds->ds_if.if_snd);
destart(&ds->ds_if);
if (csr0 & PCSR0_RCBI) {
@@ -579,7 +580,7 @@ deioctl(ifp, cmd, data)
DELAY(5000);
ds->ds_vaddr->pclow = PCSR0_RSET;
ds->ds_flags &= ~DSF_RUNNING;
- ds->ds_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ds->ds_if.if_snd);
} else if (ifp->if_flags & IFF_UP &&
(ds->ds_flags & DSF_RUNNING) == 0)
deinit(ds);
diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c
index 90d12d77801..7b89e7ead59 100644
--- a/sys/arch/vax/if/if_qe.c
+++ b/sys/arch/vax/if/if_qe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_qe.c,v 1.39 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: if_qe.c,v 1.40 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -407,7 +407,7 @@ qeinit(struct qe_softc *sc)
HIWORD(sc->sc_pqedata->qc_recv));
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Send a setup frame.
@@ -457,7 +457,7 @@ qestart(struct ifnet *ifp)
if ((i + sc->sc_inq) >= (TXDESCS - 1)) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
goto out;
}
@@ -525,7 +525,7 @@ qestart(struct ifnet *ifp)
sc->sc_nexttx = idx;
}
if (sc->sc_inq == (TXDESCS - 1))
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
out: if (sc->sc_inq)
ifp->if_timer = 5; /* If transmit logic dies */
@@ -602,7 +602,7 @@ qeintr(void *arg)
}
}
ifp->if_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
qestart(ifp); /* Put in more in queue */
}
/*
diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c
index c77f3d1247f..aac5be97b97 100644
--- a/sys/arch/vax/if/sgec.c
+++ b/sys/arch/vax/if/sgec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sgec.c,v 1.33 2015/11/24 17:11:38 mpi Exp $ */
+/* $OpenBSD: sgec.c,v 1.34 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -317,7 +317,7 @@ zeinit(sc)
ZE_NICSR6_SR | ZE_NICSR6_DC);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Send a setup frame.
@@ -397,7 +397,7 @@ zestart(ifp)
panic("zestart"); /* XXX */
if ((i + sc->sc_inq) >= (TXDESCS - 1)) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
goto out;
}
IFQ_DEQUEUE(&sc->sc_if.if_snd, m);
@@ -450,7 +450,7 @@ zestart(ifp)
sc->sc_nexttx = idx;
}
if (sc->sc_inq == (TXDESCS - 1))
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
out: if (old_inq < sc->sc_inq)
ifp->if_timer = 5; /* If transmit logic dies */
@@ -566,7 +566,7 @@ sgec_txintr(struct ze_softc *sc)
if (sc->sc_inq == 0)
ifp->if_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
zestart(ifp); /* Put in more in queue */
}
diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c
index b84a7d6a60c..ec24038e630 100644
--- a/sys/dev/ic/acx.c
+++ b/sys/dev/ic/acx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acx.c,v 1.116 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: acx.c,v 1.117 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -477,7 +477,7 @@ acx_init(struct ifnet *ifp)
acx_enable_intr(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (ic->ic_opmode != IEEE80211_M_MONITOR)
/* start background scanning */
@@ -610,7 +610,8 @@ acx_stop(struct acx_softc *sc)
sc->sc_txtimer = 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(&sc->sc_ic, IEEE80211_S_INIT, -1);
/* disable card if possible */
@@ -910,7 +911,7 @@ acx_start(struct ifnet *ifp)
if ((sc->sc_flags & ACX_FLAG_FW_LOADED) == 0 ||
(ifp->if_flags & IFF_RUNNING) == 0 ||
- (ifp->if_flags & IFF_OACTIVE))
+ ifq_is_oactive(&ifp->if_snd))
return;
/*
@@ -1066,7 +1067,7 @@ encapped:
bd->tx_free_start = idx;
if (bd->tx_used_count == ACX_TX_DESC_CNT)
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
if (trans && sc->sc_txtimer == 0)
sc->sc_txtimer = 5;
@@ -1216,7 +1217,7 @@ acx_txeof(struct acx_softc *sc)
sc->sc_txtimer = bd->tx_used_count == 0 ? 0 : 5;
if (bd->tx_used_count != ACX_TX_DESC_CNT) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
acx_start(ifp);
}
}
diff --git a/sys/dev/ic/aic6915.c b/sys/dev/ic/aic6915.c
index 13150cb0e93..3b466c7948d 100644
--- a/sys/dev/ic/aic6915.c
+++ b/sys/dev/ic/aic6915.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic6915.c,v 1.19 2015/11/20 03:35:22 dlg Exp $ */
+/* $OpenBSD: aic6915.c,v 1.20 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: aic6915.c,v 1.15 2005/12/24 20:27:29 perry Exp $ */
/*-
@@ -461,7 +461,7 @@ sf_start(struct ifnet *ifp)
if (sc->sc_txpending == (SF_NTXDESC - 1)) {
/* No more slots left; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
if (sc->sc_txpending != opending) {
@@ -659,7 +659,7 @@ sf_txintr(struct sf_softc *sc)
if (consumer == producer)
return;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
while (consumer != producer) {
SF_CDTXCSYNC(sc, consumer, BUS_DMASYNC_POSTREAD);
@@ -1106,11 +1106,12 @@ sf_init(struct ifnet *ifp)
* Note that the interface is now running.
*/
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
out:
if (error) {
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
printf("%s: interface not running\n", sc->sc_dev.dv_xname);
}
@@ -1181,7 +1182,8 @@ sf_stop(struct ifnet *ifp, int disable)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
}
diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c
index 8524336db79..18581038d9c 100644
--- a/sys/dev/ic/am7990.c
+++ b/sys/dev/ic/am7990.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: am7990.c,v 1.51 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: am7990.c,v 1.52 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: am7990.c,v 1.74 2012/02/02 19:43:02 tls Exp $ */
/*-
@@ -318,7 +318,7 @@ am7990_tint(struct lance_softc *sc)
if (tmd.tmd1_bits & LE_T1_OWN)
break;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (tmd.tmd1_bits & LE_T1_ERR) {
if (tmd.tmd3 & LE_T3_BUFF)
@@ -469,7 +469,7 @@ am7990_start(struct ifnet *ifp)
int rp;
int len;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
bix = sc->sc_last_td;
@@ -479,7 +479,7 @@ am7990_start(struct ifnet *ifp)
(*sc->sc_copyfromdesc)(sc, &tmd, rp, sizeof(tmd));
if (tmd.tmd1_bits & LE_T1_OWN) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
printf("missing buffer, no_td = %d, last_td = %d\n",
sc->sc_no_td, sc->sc_last_td);
}
@@ -529,7 +529,7 @@ am7990_start(struct ifnet *ifp)
bix = 0;
if (++sc->sc_no_td == sc->sc_ntbuf) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/dev/ic/am79900.c b/sys/dev/ic/am79900.c
index c0a624698f2..0aa9aca9c7b 100644
--- a/sys/dev/ic/am79900.c
+++ b/sys/dev/ic/am79900.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: am79900.c,v 1.5 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: am79900.c,v 1.6 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: am79900.c,v 1.23 2012/02/02 19:43:02 tls Exp $ */
/*-
@@ -346,7 +346,7 @@ am79900_tint(struct lance_softc *sc)
if (tmd.tmd1 & LE_T1_OWN)
break;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (tmd.tmd1 & LE_T1_ERR) {
if (tmd.tmd2 & LE_T2_BUFF)
@@ -492,7 +492,7 @@ am79900_start(struct ifnet *ifp)
int rp;
int len;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
bix = sc->sc_last_td;
@@ -502,7 +502,7 @@ am79900_start(struct ifnet *ifp)
(*sc->sc_copyfromdesc)(sc, &tmd, rp, sizeof(tmd));
if (tmd.tmd1 & LE_T1_OWN) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
printf("missing buffer, no_td = %d, last_td = %d\n",
sc->sc_no_td, sc->sc_last_td);
}
@@ -553,7 +553,7 @@ am79900_start(struct ifnet *ifp)
bix = 0;
if (++sc->sc_no_td == sc->sc_ntbuf) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c
index 0c05eb80947..e32333a02c2 100644
--- a/sys/dev/ic/an.c
+++ b/sys/dev/ic/an.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: an.c,v 1.69 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: an.c,v 1.70 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -488,7 +488,7 @@ an_txeof(struct an_softc *sc, u_int16_t status)
int cur, id;
sc->sc_tx_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
id = CSR_READ_2(sc, AN_TX_CMP_FID);
CSR_WRITE_2(sc, AN_EVENT_ACK, status & (AN_EV_TX | AN_EV_TX_EXC));
@@ -563,7 +563,7 @@ an_intr(void *arg)
if (status & AN_EV_LINKSTAT)
an_linkstat_intr(sc);
- if ((ifp->if_flags & IFF_OACTIVE) == 0 &&
+ if (ifq_is_oactive(&ifp->if_snd) == 0 &&
sc->sc_ic.ic_state == IEEE80211_S_RUN &&
!IFQ_IS_EMPTY(&ifp->if_snd))
an_start(ifp);
@@ -1060,7 +1060,7 @@ an_init(struct ifnet *ifp)
an_cmd(sc, AN_CMD_SET_MODE, 0xffff);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ic->ic_state = IEEE80211_S_INIT;
if (ic->ic_opmode == IEEE80211_M_MONITOR)
ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
@@ -1104,7 +1104,7 @@ an_start(struct ifnet *ifp)
ifq_deq_rollback(&ifp->if_snd, m);
DPRINTF2(("an_start: %x/%d busy\n",
sc->sc_txd[cur].d_fid, cur));
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
ifq_deq_commit(&ifp->if_snd, m);
@@ -1242,7 +1242,8 @@ an_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);
if (disable) {
if (sc->sc_disable)
diff --git a/sys/dev/ic/ar5008.c b/sys/dev/ic/ar5008.c
index 194d6d35c13..6818e4421e6 100644
--- a/sys/dev/ic/ar5008.c
+++ b/sys/dev/ic/ar5008.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5008.c,v 1.33 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: ar5008.c,v 1.34 2015/11/25 03:09:58 dlg Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -1032,7 +1032,7 @@ ar5008_tx_intr(struct athn_softc *sc)
while (ar5008_tx_process(sc, qid) == 0);
}
if (!SIMPLEQ_EMPTY(&sc->txbufs)) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_start(ifp);
}
}
diff --git a/sys/dev/ic/ar9003.c b/sys/dev/ic/ar9003.c
index 6753d58cdeb..d987c8dee44 100644
--- a/sys/dev/ic/ar9003.c
+++ b/sys/dev/ic/ar9003.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar9003.c,v 1.37 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: ar9003.c,v 1.38 2015/11/25 03:09:58 dlg Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -1164,7 +1164,7 @@ ar9003_tx_intr(struct athn_softc *sc)
while (ar9003_tx_process(sc) == 0);
if (!SIMPLEQ_EMPTY(&sc->txbufs)) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_start(ifp);
}
}
diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c
index 314dc23655f..f207ee09ac7 100644
--- a/sys/dev/ic/ath.c
+++ b/sys/dev/ic/ath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ath.c,v 1.107 2015/11/04 12:11:59 dlg Exp $ */
+/* $OpenBSD: ath.c,v 1.108 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */
/*-
@@ -834,7 +834,7 @@ ath_start(struct ifnet *ifp)
struct ieee80211_frame *wh;
int s;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING ||
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd) ||
sc->sc_invalid)
return;
for (;;) {
@@ -850,7 +850,7 @@ ath_start(struct ifnet *ifp)
DPRINTF(ATH_DEBUG_ANY, ("%s: out of xmit buffers\n",
__func__));
sc->sc_stats.ast_tx_qstop++;
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
/*
@@ -2507,7 +2507,7 @@ ath_tx_proc(void *arg, int npending)
TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list);
splx(s);
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->sc_tx_timer = 0;
ath_start(ifp);
@@ -2572,7 +2572,7 @@ ath_draintxq(struct ath_softc *sc)
TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list);
splx(s);
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->sc_tx_timer = 0;
}
diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c
index 6dbaee3bd01..0d2b74b640b 100644
--- a/sys/dev/ic/athn.c
+++ b/sys/dev/ic/athn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: athn.c,v 1.89 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: athn.c,v 1.90 2015/11/25 03:09:58 dlg Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -2539,12 +2539,12 @@ athn_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 (SIMPLEQ_EMPTY(&sc->txbufs)) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
/* Send pending management frames first. */
@@ -2790,7 +2790,7 @@ athn_init(struct ifnet *ifp)
athn_btcoex_enable(sc);
#endif
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;
#ifdef notyet
@@ -2819,7 +2819,8 @@ athn_stop(struct ifnet *ifp, int disable)
int qid;
ifp->if_timer = sc->sc_tx_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);
/* In case we were scanning, release the scan "lock". */
diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c
index b43b4635017..c1003a4a327 100644
--- a/sys/dev/ic/atw.c
+++ b/sys/dev/ic/atw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atw.c,v 1.90 2015/11/04 12:11:59 dlg Exp $ */
+/* $OpenBSD: atw.c,v 1.91 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */
/*-
@@ -1433,7 +1433,7 @@ atw_init(struct ifnet *ifp)
* Note that the interface is now running.
*/
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* send no beacons, yet. */
atw_start_beacon(sc, 0);
@@ -1444,7 +1444,8 @@ atw_init(struct ifnet *ifp)
error = ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
out:
if (error) {
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
printf("%s: interface not running\n", sc->sc_dev.dv_xname);
}
@@ -2644,7 +2645,8 @@ atw_stop(struct ifnet *ifp, int disable)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
/* Disable interrupts. */
@@ -3215,7 +3217,7 @@ atw_txintr(struct atw_softc *sc)
DPRINTF3(sc, ("%s: atw_txintr: sc_flags 0x%08x\n",
sc->sc_dev.dv_xname, sc->sc_flags));
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Go through our Tx list and free mbufs for those
@@ -3571,7 +3573,7 @@ atw_start(struct ifnet *ifp)
DPRINTF2(sc, ("%s: atw_start: sc_flags 0x%08x, if_flags 0x%08x\n",
sc->sc_dev.dv_xname, sc->sc_flags, ifp->if_flags));
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
/*
@@ -3833,7 +3835,7 @@ atw_start(struct ifnet *ifp)
* XXX We could allocate an mbuf and copy, but
* XXX it is worth it?
*/
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
bus_dmamap_unload(sc->sc_dmat, dmamap);
m_freem(m0);
break;
@@ -3933,7 +3935,7 @@ atw_start(struct ifnet *ifp)
if (txs == NULL || sc->sc_txfree == 0) {
/* No more slots left; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
if (sc->sc_txfree != ofree) {
diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c
index 9da160dae75..d612db39d38 100644
--- a/sys/dev/ic/bwi.c
+++ b/sys/dev/ic/bwi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwi.c,v 1.121 2015/11/12 10:25:03 dlg Exp $ */
+/* $OpenBSD: bwi.c,v 1.122 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
@@ -7088,7 +7088,7 @@ bwi_init_statechg(struct bwi_softc *sc, int statechg)
bwi_enable_intrs(sc, BWI_INIT_INTRS);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (statechg) {
if (ic->ic_opmode != IEEE80211_M_MONITOR) {
@@ -7181,7 +7181,7 @@ bwi_start(struct ifnet *ifp)
struct bwi_txbuf_data *tbd = &sc->sc_tx_bdata[BWI_TX_DATA_RING];
int trans, idx;
- if ((ifp->if_flags & IFF_OACTIVE) || (ifp->if_flags & IFF_RUNNING) == 0)
+ if (ifq_is_oactive(&ifp->if_snd) || (ifp->if_flags & IFF_RUNNING) == 0)
return;
trans = 0;
@@ -7264,7 +7264,7 @@ bwi_start(struct ifnet *ifp)
idx = (idx + 1) % BWI_TX_NDESC;
if (tbd->tbd_used + BWI_TX_NSPRDESC >= BWI_TX_NDESC) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
}
@@ -7356,7 +7356,8 @@ bwi_stop(struct bwi_softc *sc, int state_chg)
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);
/* power off cardbus socket */
if (sc->sc_disable)
@@ -9067,7 +9068,7 @@ bwi_txeof_status32(struct bwi_softc *sc)
CSR_WRITE_4(sc, ctrl_base + BWI_RX32_INDEX,
end_idx * sizeof(struct bwi_desc32));
- if ((ifp->if_flags & IFF_OACTIVE) == 0)
+ if (ifq_is_oactive(&ifp->if_snd) == 0)
ifp->if_start(ifp);
}
@@ -9111,7 +9112,7 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id)
if (tbd->tbd_used == 0)
sc->sc_tx_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
void
@@ -9156,7 +9157,7 @@ bwi_txeof(struct bwi_softc *sc)
ifp->if_opackets++;
}
- if ((ifp->if_flags & IFF_OACTIVE) == 0)
+ if (ifq_is_oactive(&ifp->if_snd) == 0)
ifp->if_start(ifp);
}
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c
index 8dceaffdcff..7df7529349b 100644
--- a/sys/dev/ic/dc.c
+++ b/sys/dev/ic/dc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dc.c,v 1.147 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: dc.c,v 1.148 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -2275,7 +2275,7 @@ dc_txeof(struct dc_softc *sc)
sc->dc_cdata.dc_tx_cons = idx;
if (DC_TX_LIST_CNT - sc->dc_cdata.dc_tx_cnt > 5)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (sc->dc_cdata.dc_tx_cnt == 0)
ifp->if_timer = 0;
}
@@ -2611,7 +2611,7 @@ dc_start(struct ifnet *ifp)
if (!sc->dc_link && IFQ_LEN(&ifp->if_snd) < 10)
return;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
idx = sc->dc_cdata.dc_tx_prod;
@@ -2629,7 +2629,7 @@ dc_start(struct ifnet *ifp)
*/
ifq_deq_commit(&ifp->if_snd, m_head);
if (dc_coal(sc, &m_head)) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
}
@@ -2638,7 +2638,7 @@ dc_start(struct ifnet *ifp)
if ((sc->dc_flags & DC_TX_COALESCE) == 0)
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -2657,7 +2657,7 @@ dc_start(struct ifnet *ifp)
bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
if (sc->dc_flags & DC_TX_ONE) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
}
@@ -2835,7 +2835,7 @@ dc_init(void *xsc)
dc_setcfg(sc, sc->dc_if_media);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -2993,7 +2993,8 @@ dc_stop(struct dc_softc *sc, int softonly)
timeout_del(&sc->dc_tick_tmo);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
if (!softonly) {
DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_RX_ON|DC_NETCFG_TX_ON));
diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c
index 2198af92ed6..32b6b1b104a 100644
--- a/sys/dev/ic/dp8390.c
+++ b/sys/dev/ic/dp8390.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dp8390.c,v 1.57 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: dp8390.c,v 1.58 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */
/*
@@ -356,7 +356,7 @@ dp8390_init(struct dp8390_softc *sc)
/* Set 'running' flag, and clear output active flag. */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* ...and attempt to start output. */
dp8390_start(ifp);
@@ -428,14 +428,14 @@ dp8390_start(struct ifnet *ifp)
int buffer;
int len;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
outloop:
/* See if there is room to put another packet in the buffer. */
if (sc->txb_inuse == sc->txb_cnt) {
/* No room. Indicate this to the outside world and exit. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
IFQ_DEQUEUE(&ifp->if_snd, m0);
@@ -703,7 +703,7 @@ dp8390_intr(void *arg)
/* Clear watchdog timer. */
ifp->if_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Add in total number of collisions on last
diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c
index 7079d7cfb06..eac3b48fb4d 100644
--- a/sys/dev/ic/elink3.c
+++ b/sys/dev/ic/elink3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elink3.c,v 1.90 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: elink3.c,v 1.91 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */
/*
@@ -661,7 +661,7 @@ epinit(struct ep_softc *sc)
/* Interface is now `running', with no output active. */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* Attempt to start output, if any. */
epstart(ifp);
@@ -948,7 +948,7 @@ epstart(struct ifnet *ifp)
int sh, len, pad, txreg;
/* Don't transmit if interface is busy or not running */
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
startagain:
@@ -983,7 +983,7 @@ startagain:
SET_TX_AVAIL_THRESH | ((len + pad + 4) >> sc->txashift));
/* not enough room in FIFO */
ifq_deq_rollback(&ifp->if_snd, m0);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
} else {
bus_space_write_2(iot, ioh, EP_COMMAND,
@@ -1182,7 +1182,7 @@ eptxstat(struct ep_softc *sc)
} else if (i & TXS_MAX_COLLISION) {
++sc->sc_arpcom.ac_if.if_collisions;
bus_space_write_2(iot, ioh, EP_COMMAND, TX_ENABLE);
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_arpcom.ac_if.if_snd);
} else
sc->tx_succ_ok = (sc->tx_succ_ok+1) & 127;
}
@@ -1220,7 +1220,7 @@ epintr(void *arg)
if (status & S_RX_COMPLETE)
epread(sc);
if (status & S_TX_AVAIL) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
epstart(ifp);
}
if (status & S_CARD_FAILURE) {
@@ -1490,7 +1490,8 @@ epstop(struct ep_softc *sc)
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
if (sc->ep_flags & EP_FLAGS_MII) {
mii_down(&sc->sc_mii);
diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c
index ddfe8bc65c7..cab62a62232 100644
--- a/sys/dev/ic/fxp.c
+++ b/sys/dev/ic/fxp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fxp.c,v 1.126 2015/11/24 15:43:15 mpi Exp $ */
+/* $OpenBSD: fxp.c,v 1.127 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */
/*
@@ -676,12 +676,12 @@ fxp_start(struct ifnet *ifp)
struct mbuf *m0, *m = NULL;
int cnt = sc->sc_cbt_cnt, seg;
- if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
while (1) {
if (cnt >= (FXP_NTXCB - 2)) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -846,7 +846,7 @@ fxp_intr(void *arg)
sc->sc_cbt_cnt = txcnt;
/* Did we transmit any packets? */
if (sc->sc_cbt_cons != txs)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = sc->sc_cbt_cnt ? 5 : 0;
sc->sc_cbt_cons = txs;
@@ -1074,7 +1074,8 @@ fxp_stop(struct fxp_softc *sc, int drain, int softonly)
* between panics, and the watchdog timer)
*/
ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
if (!softonly)
mii_down(&sc->sc_mii);
@@ -1426,7 +1427,7 @@ fxp_init(void *xsc)
mii_mediachg(&sc->sc_mii);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Request a software generated interrupt that will be used to
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index 05ae6cc147c..483067f4b35 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gem.c,v 1.116 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: gem.c,v 1.117 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */
/*
@@ -528,7 +528,8 @@ gem_stop(struct ifnet *ifp, int softonly)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
if (!softonly) {
@@ -835,7 +836,7 @@ gem_init(struct ifnet *ifp)
timeout_add_sec(&sc->sc_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -1633,7 +1634,7 @@ gem_tint(struct gem_softc *sc, u_int32_t status)
sc->sc_tx_cons = cons;
if (sc->sc_tx_cnt < GEM_NTXDESC - 2)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (sc->sc_tx_cnt == 0)
ifp->if_timer = 0;
@@ -1652,7 +1653,7 @@ gem_start(struct ifnet *ifp)
u_int32_t cur, frag, i;
int error;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
while (sc->sc_txd[sc->sc_tx_prod].sd_mbuf == NULL) {
@@ -1685,7 +1686,7 @@ gem_start(struct ifnet *ifp)
if ((sc->sc_tx_cnt + map->dm_nsegs) > (GEM_NTXDESC - 2)) {
bus_dmamap_unload(sc->sc_dmatag, map);
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c
index 38e2ee25c20..ffa9ff2ba8b 100644
--- a/sys/dev/ic/hme.c
+++ b/sys/dev/ic/hme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hme.c,v 1.77 2015/11/24 15:25:20 mpi Exp $ */
+/* $OpenBSD: hme.c,v 1.78 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */
/*-
@@ -382,7 +382,8 @@ hme_stop(struct hme_softc *sc, int softonly)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
if (!softonly) {
@@ -623,7 +624,7 @@ hme_init(struct hme_softc *sc)
timeout_add_sec(&sc->sc_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
hme_start(ifp);
}
@@ -639,7 +640,7 @@ hme_start(struct ifnet *ifp)
u_int32_t frag, cur, i;
int error;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
while (sc->sc_txd[sc->sc_tx_prod].sd_mbuf == NULL) {
@@ -672,7 +673,7 @@ hme_start(struct ifnet *ifp)
if ((HME_TX_RING_SIZE - (sc->sc_tx_cnt + map->dm_nsegs)) < 5) {
bus_dmamap_unload(sc->sc_dmatag, map);
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -761,7 +762,7 @@ hme_tint(struct hme_softc *sc)
if (txflags & HME_XD_OWN)
break;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (txflags & HME_XD_EOP)
ifp->if_opackets++;
diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c
index 36f20ffc54c..c47ae409f79 100644
--- a/sys/dev/ic/i82596.c
+++ b/sys/dev/ic/i82596.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i82596.c,v 1.47 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: i82596.c,v 1.48 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */
/*-
@@ -724,7 +724,7 @@ i82596_tint(sc, scbstatus)
register int off, status;
ifp->if_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
#ifdef I82596_DEBUG
if (sc->xmit_busy <= 0) {
@@ -1214,12 +1214,12 @@ i82596_start(ifp)
printf("i82596_start(%p)\n", ifp);
#endif
- 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->xmit_busy == NTXBUF) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1353,7 +1353,7 @@ i82596_reset(sc, hard)
/* Clear OACTIVE in case we're called from watchdog (frozen xmit). */
sc->sc_arpcom.ac_if.if_timer = 0;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(sc->sc_arpcom.ac_if.if_snd);
/*
* Stop i82596 dead in its tracks.
@@ -1783,7 +1783,7 @@ i82596_init(sc)
(sc->hwinit)(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (NTXBUF < 2)
sc->do_xmitnopchain = 0;
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index 7502b274562..13374509c1f 100644
--- a/sys/dev/ic/if_wi.c
+++ b/sys/dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.164 2015/10/25 12:48:46 mpi Exp $ */
+/* $OpenBSD: if_wi.c,v 1.165 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -833,7 +833,7 @@ wi_txeof(struct wi_softc *sc, int status)
ifp = &sc->sc_ic.ic_if;
ifp->if_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (status & WI_EV_TX_EXC)
ifp->if_oerrors++;
@@ -856,7 +856,7 @@ wi_inquire(void *xsc)
timeout_add_sec(&sc->sc_timo, 60);
/* Don't do this while we're transmitting */
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
s = splnet();
@@ -2199,7 +2199,7 @@ wi_init_io(struct wi_softc *sc)
splx(s);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
timeout_add_sec(&sc->sc_timo, 60);
@@ -2329,7 +2329,7 @@ wi_start(struct ifnet *ifp)
if (!(sc->wi_flags & WI_FLAGS_ATTACHED))
return;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
nextpkt:
@@ -2463,7 +2463,7 @@ nextpkt:
m_freem(m0);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
/*
* Set a timeout in case the chip goes out to lunch.
@@ -2538,7 +2538,8 @@ wi_stop(struct wi_softc *sc)
wi_intr_enable(sc, 0);
wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0, 0, 0);
- ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
return;
diff --git a/sys/dev/ic/lance.c b/sys/dev/ic/lance.c
index daeb185354d..d8d0203d6e5 100644
--- a/sys/dev/ic/lance.c
+++ b/sys/dev/ic/lance.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lance.c,v 1.9 2015/10/25 12:48:46 mpi Exp $ */
+/* $OpenBSD: lance.c,v 1.10 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */
/*-
@@ -309,7 +309,7 @@ lance_init(struct lance_softc *sc)
/* Start the LANCE. */
(*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA | LE_C0_STRT);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
(*sc->sc_start)(ifp);
} else
diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c
index f097e3cde9d..9434e5b398c 100644
--- a/sys/dev/ic/lemac.c
+++ b/sys/dev/ic/lemac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lemac.c,v 1.25 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: lemac.c,v 1.26 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: lemac.c,v 1.20 2001/06/13 10:46:02 wiz Exp $ */
/*-
@@ -166,7 +166,7 @@ lemac_tne_intr(struct lemac_softc *sc)
sc->sc_if.if_collisions++;
}
}
- sc->sc_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_if.if_snd);
lemac_ifstart(&sc->sc_if);
}
@@ -189,7 +189,7 @@ lemac_txd_intr(struct lemac_softc *sc, unsigned cs_value)
/* Turn back on transmitter if disabled */
LEMAC_OUTB(sc, LEMAC_REG_CS, cs_value & ~LEMAC_CS_TXD);
- sc->sc_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_if.if_snd);
}
int
@@ -504,7 +504,7 @@ lemac_reset(struct lemac_softc *const sc)
* Initialize board..
*/
sc->sc_flags &= ~LEMAC_LINKUP;
- sc->sc_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_if.if_snd);
LEMAC_INTR_DISABLE(sc);
LEMAC_OUTB(sc, LEMAC_REG_IOP, LEMAC_IOP_EEINIT);
@@ -647,7 +647,7 @@ lemac_ifstart(struct ifnet *ifp)
lemac_txmax) {
sc->sc_cntrs.cntr_txfull++;
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -662,7 +662,7 @@ lemac_ifstart(struct ifnet *ifp)
if (tx_pg == 0 || tx_pg > sc->sc_lastpage) {
sc->sc_cntrs.cntr_txnospc++;
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c
index caeefbe719b..22f82b1d81a 100644
--- a/sys/dev/ic/malo.c
+++ b/sys/dev/ic/malo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malo.c,v 1.110 2015/11/16 10:03:01 mpi Exp $ */
+/* $OpenBSD: malo.c,v 1.111 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -1006,12 +1006,12 @@ malo_start(struct ifnet *ifp)
DPRINTF(2, "%s: %s\n", sc->sc_dev.dv_xname, __func__);
- 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_txring.queued >= MALO_TX_RING_COUNT - 1) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1065,7 +1065,8 @@ malo_stop(struct malo_softc *sc)
malo_ctl_write4(sc, 0x0c18, (1 << 15));
/* device is not running anymore */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
/* change back to initial state */
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
@@ -1369,7 +1370,7 @@ next:
}
sc->sc_tx_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
malo_start(ifp);
}
diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c
index eef31bf3df1..6906b7fd760 100644
--- a/sys/dev/ic/mtd8xx.c
+++ b/sys/dev/ic/mtd8xx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtd8xx.c,v 1.28 2015/10/25 12:48:46 mpi Exp $ */
+/* $OpenBSD: mtd8xx.c,v 1.29 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2003 Oleg Safiullin <form@pdp11.org.ru>
@@ -676,7 +676,7 @@ mtd_init(struct ifnet *ifp)
CSR_WRITE_4(MTD_RXPDR, 0xffffffff);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
}
@@ -695,7 +695,7 @@ mtd_start(struct ifnet *ifp)
int idx;
if (sc->mtd_cdata.mtd_tx_cnt) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
@@ -706,7 +706,7 @@ mtd_start(struct ifnet *ifp)
break;
if (mtd_encap(sc, m_head, &idx)) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -741,7 +741,8 @@ mtd_stop(struct ifnet *ifp)
int i;
ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
CSR_CLRBIT(MTD_TCRRCR, (RCR_RE | TCR_TE));
CSR_WRITE_4(MTD_IMR, 0);
@@ -1048,7 +1049,7 @@ mtd_txeof(struct mtd_softc *sc)
}
if (cur_tx != NULL) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->mtd_cdata.mtd_tx_cons = idx;
} else
if (sc->mtd_ldata->mtd_tx_list[idx].td_tsw ==
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c
index a2f0b897848..2460c2643af 100644
--- a/sys/dev/ic/pgt.c
+++ b/sys/dev/ic/pgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgt.c,v 1.83 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: pgt.c,v 1.84 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -548,7 +548,8 @@ trying_again:
ic->ic_opmode != IEEE80211_M_MONITOR);
}
- ic->ic_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ic->ic_if.if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ic->ic_if.if_snd);
ieee80211_new_state(&sc->sc_ic, IEEE80211_S_INIT, -1);
}
@@ -746,8 +747,8 @@ pgt_update_intr(struct pgt_softc *sc, int hack)
if (qdirty > npend) {
if (pgt_queue_is_data(pqs[i])) {
sc->sc_ic.ic_if.if_timer = 0;
- sc->sc_ic.ic_if.if_flags &=
- ~IFF_OACTIVE;
+ ifq_clr_oactive(
+ &sc->sc_ic.ic_if.if_snd);
}
while (qdirty-- > npend)
pgt_txdone(sc, pqs[i]);
@@ -2524,7 +2525,7 @@ pgt_init(struct ifnet *ifp)
ic->ic_opmode != IEEE80211_M_MONITOR);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* Begin background scanning */
ieee80211_new_state(&sc->sc_ic, IEEE80211_S_SCAN, -1);
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index 12ae46ae3b6..63c09d4ef15 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.186 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: re.c,v 1.187 2015/11/25 03:09:58 dlg Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -1489,7 +1489,7 @@ re_txeof(struct rl_softc *sc)
sc->rl_ldata.rl_txq_considx = idx;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Some chips will ignore a second TX request issued while an
@@ -1836,7 +1836,7 @@ re_start(struct ifnet *ifp)
struct mbuf *m;
int idx, queued = 0, error;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if ((sc->rl_flags & RL_FLAG_LINK) == 0)
return;
@@ -1853,14 +1853,14 @@ re_start(struct ifnet *ifp)
if (sc->rl_ldata.rl_txq[idx].txq_mbuf != NULL) {
KASSERT(idx == sc->rl_ldata.rl_txq_considx);
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
error = re_encap(sc, m, &idx);
if (error != 0 && error != ENOBUFS) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
} else if (error != 0) {
ifq_deq_commit(&ifp->if_snd, m);
@@ -2022,7 +2022,7 @@ re_init(struct ifnet *ifp)
RL_CFG1_DRVLOAD);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -2145,7 +2145,8 @@ re_stop(struct ifnet *ifp)
sc->rl_flags &= ~(RL_FLAG_LINK|RL_FLAG_TIMERINTR);
timeout_del(&sc->timer_handle);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
mii_down(&sc->sc_mii);
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c
index 06869ba408d..0dfbdd16c3b 100644
--- a/sys/dev/ic/rt2560.c
+++ b/sys/dev/ic/rt2560.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2560.c,v 1.77 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: rt2560.c,v 1.78 2015/11/25 03:09:58 dlg Exp $ */
/*-
* Copyright (c) 2005, 2006
@@ -991,7 +991,7 @@ rt2560_tx_intr(struct rt2560_softc *sc)
if (sc->txq.queued < RT2560_TX_RING_COUNT - 1) {
sc->sc_flags &= ~RT2560_DATA_OACTIVE;
if (!(sc->sc_flags & (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE)))
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
rt2560_start(ifp);
}
}
@@ -1062,7 +1062,7 @@ rt2560_prio_intr(struct rt2560_softc *sc)
if (sc->prioq.queued < RT2560_PRIO_RING_COUNT) {
sc->sc_flags &= ~RT2560_PRIO_OACTIVE;
if (!(sc->sc_flags & (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE)))
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
rt2560_start(ifp);
}
}
@@ -1923,13 +1923,13 @@ rt2560_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 (mq_len(&ic->ic_mgtq) > 0) {
if (sc->prioq.queued >= RT2560_PRIO_RING_COUNT) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
sc->sc_flags |= RT2560_PRIO_OACTIVE;
break;
}
@@ -1948,7 +1948,7 @@ rt2560_start(struct ifnet *ifp)
} else {
if (sc->txq.queued >= RT2560_TX_RING_COUNT - 1) {
ifq_deq_rollback(&ifp->if_snd, m0);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
sc->sc_flags |= RT2560_DATA_OACTIVE;
break;
}
@@ -2676,8 +2676,8 @@ rt2560_init(struct ifnet *ifp)
/* enable interrupts */
RAL_WRITE(sc, RT2560_CSR8, RT2560_INTR_MASK);
- 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);
@@ -2696,7 +2696,8 @@ rt2560_stop(struct ifnet *ifp, int disable)
sc->sc_tx_timer = 0;
sc->sc_flags &= ~(RT2560_PRIO_OACTIVE|RT2560_DATA_OACTIVE);
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/ic/rt2661.c b/sys/dev/ic/rt2661.c
index e58b6eb31c3..15656768762 100644
--- a/sys/dev/ic/rt2661.c
+++ b/sys/dev/ic/rt2661.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2661.c,v 1.87 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: rt2661.c,v 1.88 2015/11/25 03:09:58 dlg Exp $ */
/*-
* Copyright (c) 2006
@@ -1150,7 +1150,7 @@ rt2661_tx_dma_intr(struct rt2661_softc *sc, struct rt2661_tx_ring *txq)
if (sc->txq[0].queued < RT2661_TX_RING_COUNT - 1)
sc->sc_flags &= ~RT2661_DATA_OACTIVE;
if (!(sc->sc_flags & (RT2661_MGT_OACTIVE|RT2661_DATA_OACTIVE)))
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
rt2661_start(ifp);
}
}
@@ -1928,13 +1928,13 @@ rt2661_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 (mq_len(&ic->ic_mgtq) > 0) {
if (sc->mgtq.queued >= RT2661_MGT_RING_COUNT) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1951,7 +1951,7 @@ rt2661_start(struct ifnet *ifp)
} else {
if (sc->txq[0].queued >= RT2661_TX_RING_COUNT - 1) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -2707,8 +2707,8 @@ rt2661_init(struct ifnet *ifp)
/* kick Rx */
RAL_WRITE(sc, RT2661_RX_CNTL_CSR, 1);
- 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_SCAN, -1);
@@ -2728,7 +2728,8 @@ rt2661_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 */
rt2661_amrr_node_free_all(sc);
diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c
index 2b74941a496..2d16c80e4de 100644
--- a/sys/dev/ic/rt2860.c
+++ b/sys/dev/ic/rt2860.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2860.c,v 1.84 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: rt2860.c,v 1.85 2015/11/25 03:09:58 dlg Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -1180,7 +1180,7 @@ rt2860_tx_intr(struct rt2860_softc *sc, int qid)
sc->sc_tx_timer = 0;
if (ring->queued < RT2860_TX_RING_COUNT)
sc->qfullmsk &= ~(1 << qid);
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
rt2860_start(ifp);
}
@@ -1738,12 +1738,12 @@ rt2860_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 (SLIST_EMPTY(&sc->data_pool) || sc->qfullmsk != 0) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
/* send pending management frames first */
@@ -3588,8 +3588,8 @@ rt2860_init(struct ifnet *ifp)
if (sc->sc_flags & RT2860_ADVANCED_PS)
rt2860_mcu_cmd(sc, RT2860_MCU_CMD_PSLEVEL, sc->pslevel, 0);
- 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 */
@@ -3618,7 +3618,8 @@ rt2860_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/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c
index ff0ccd8000c..f8509356018 100644
--- a/sys/dev/ic/rtl81x9.c
+++ b/sys/dev/ic/rtl81x9.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtl81x9.c,v 1.93 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: rtl81x9.c,v 1.94 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -735,7 +735,7 @@ rl_txeof(struct rl_softc *sc)
return;
}
RL_INC(sc->rl_cdata.last_tx);
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
} while (sc->rl_cdata.last_tx != sc->rl_cdata.cur_tx);
if (RL_LAST_TXMBUF(sc) == NULL)
@@ -896,7 +896,7 @@ rl_start(struct ifnet *ifp)
* packets from the queue.
*/
if (RL_CUR_TXMBUF(sc) != NULL)
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
void
@@ -969,7 +969,7 @@ rl_init(void *xsc)
CSR_WRITE_1(sc, sc->rl_cfg1, RL_CFG1_DRVLOAD|RL_CFG1_FULLDUPLEX);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -1074,7 +1074,8 @@ rl_stop(struct rl_softc *sc)
timeout_del(&sc->sc_tick_tmo);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
CSR_WRITE_1(sc, RL_COMMAND, 0x00);
CSR_WRITE_2(sc, RL_IMR, 0x0000);
diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c
index ebf94678520..8ceda1ec8ca 100644
--- a/sys/dev/ic/rtw.c
+++ b/sys/dev/ic/rtw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtw.c,v 1.93 2015/11/20 03:35:22 dlg Exp $ */
+/* $OpenBSD: rtw.c,v 1.94 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */
/*-
@@ -187,7 +187,7 @@ int rtw_txring_choose(struct rtw_softc *, struct rtw_txsoft_blk **,
u_int rtw_txring_next(struct rtw_regs *, struct rtw_txdesc_blk *);
struct mbuf *rtw_80211_dequeue(struct rtw_softc *, struct mbuf_queue *, int,
struct rtw_txsoft_blk **, struct rtw_txdesc_blk **,
- struct ieee80211_node **, short *);
+ struct ieee80211_node **);
uint64_t rtw_tsf_extend(struct rtw_regs *, u_int32_t);
#ifndef IEEE80211_STA_ONLY
void rtw_ibss_merge(struct rtw_softc *, struct ieee80211_node *,
@@ -1375,18 +1375,18 @@ rtw_collect_txpkt(struct rtw_softc *sc, struct rtw_txdesc_blk *tdb,
void
rtw_reset_oactive(struct rtw_softc *sc)
{
- short oflags;
+ int oactive;
int pri;
struct rtw_txsoft_blk *tsb;
struct rtw_txdesc_blk *tdb;
- oflags = sc->sc_if.if_flags;
+ oactive = ifq_is_oactive(&sc->sc_if.if_snd);
for (pri = 0; pri < RTW_NTXPRI; pri++) {
tsb = &sc->sc_txsoft_blk[pri];
tdb = &sc->sc_txdesc_blk[pri];
if (!SIMPLEQ_EMPTY(&tsb->tsb_freeq) && tdb->tdb_nfree > 0)
- sc->sc_if.if_flags &= ~IFF_OACTIVE;
+ ifq_set_oactive(&sc->sc_if.if_snd);
}
- if (oflags != sc->sc_if.if_flags) {
+ if (oactive != ifq_is_oactive(&sc->sc_if.if_snd)) {
DPRINTF(sc, RTW_DEBUG_OACTIVE,
("%s: reset OACTIVE\n", __func__));
}
@@ -1903,7 +1903,8 @@ rtw_stop(struct ifnet *ifp, int disable)
rtw_disable(sc);
/* Mark the interface as not running. Cancel the watchdog timer. */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
return;
@@ -2680,7 +2681,7 @@ rtw_txring_choose(struct rtw_softc *sc, struct rtw_txsoft_blk **tsbp,
struct mbuf *
rtw_80211_dequeue(struct rtw_softc *sc, struct mbuf_queue *ifq, int pri,
struct rtw_txsoft_blk **tsbp, struct rtw_txdesc_blk **tdbp,
- struct ieee80211_node **nip, short *if_flagsp)
+ struct ieee80211_node **nip)
{
struct mbuf *m;
@@ -2689,7 +2690,7 @@ rtw_80211_dequeue(struct rtw_softc *sc, struct mbuf_queue *ifq, int pri,
if (rtw_txring_choose(sc, tsbp, tdbp, pri) == -1) {
DPRINTF(sc, RTW_DEBUG_XMIT_RSRC, ("%s: no ring %d descriptor\n",
__func__, pri));
- *if_flagsp |= IFF_OACTIVE;
+ ifq_set_oactive(&sc->sc_if.if_snd);
sc->sc_if.if_timer = 1;
return NULL;
}
@@ -2711,7 +2712,6 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp,
struct ieee80211_key *k;
struct mbuf *m0;
struct rtw_softc *sc;
- short *if_flagsp;
sc = (struct rtw_softc *)ifp->if_softc;
ic = &sc->sc_ic;
@@ -2719,18 +2719,16 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp,
DPRINTF(sc, RTW_DEBUG_XMIT,
("%s: enter %s\n", sc->sc_dev.dv_xname, __func__));
- if_flagsp = &ifp->if_flags;
-
if (ic->ic_state == IEEE80211_S_RUN &&
(*mp = rtw_80211_dequeue(sc, &sc->sc_beaconq, RTW_TXPRIBCN, tsbp,
- tdbp, nip, if_flagsp)) != NULL) {
+ tdbp, nip)) != NULL) {
DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: dequeue beacon frame\n",
__func__));
return 0;
}
if ((*mp = rtw_80211_dequeue(sc, &ic->ic_mgtq, RTW_TXPRIMD, tsbp,
- tdbp, nip, if_flagsp)) != NULL) {
+ tdbp, nip)) != NULL) {
DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: dequeue mgt frame\n",
__func__));
return 0;
@@ -2742,7 +2740,7 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp,
}
if ((*mp = rtw_80211_dequeue(sc, &ic->ic_pwrsaveq, RTW_TXPRIHI,
- tsbp, tdbp, nip, if_flagsp)) != NULL) {
+ tsbp, tdbp, nip)) != NULL) {
DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: dequeue pwrsave frame\n",
__func__));
return 0;
@@ -2765,7 +2763,7 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp,
if (rtw_txring_choose(sc, tsbp, tdbp, RTW_TXPRIMD) == -1) {
DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: no descriptor\n", __func__));
ifq_deq_rollback(&ifp->if_snd, m0);
- *if_flagsp |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
sc->sc_if.if_timer = 1;
return 0;
}
@@ -3081,7 +3079,7 @@ rtw_start(struct ifnet *ifp)
DPRINTF(sc, RTW_DEBUG_XMIT,
("%s: enter %s\n", sc->sc_dev.dv_xname, __func__));
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
goto out;
/* XXX do real rate control */
diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c
index 8940373ec28..a45a3e5091a 100644
--- a/sys/dev/ic/smc83c170.c
+++ b/sys/dev/ic/smc83c170.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc83c170.c,v 1.24 2015/11/20 03:35:22 dlg Exp $ */
+/* $OpenBSD: smc83c170.c,v 1.25 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: smc83c170.c,v 1.59 2005/02/27 00:27:02 perry Exp $ */
/*-
@@ -468,7 +468,7 @@ epic_start(struct ifnet *ifp)
if (sc->sc_txpending == EPIC_NTXDESC) {
/* No more slots left; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
if (sc->sc_txpending != opending) {
@@ -729,7 +729,7 @@ epic_intr(void *arg)
* Check for transmission complete interrupts.
*/
if (intstat & (INTSTAT_TXC | INTSTAT_TXU)) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
for (i = sc->sc_txdirty; sc->sc_txpending != 0;
i = EPIC_NEXTTX(i), sc->sc_txpending--) {
txd = EPIC_CDTX(sc, i);
@@ -1014,7 +1014,7 @@ epic_init(struct ifnet *ifp)
* ...all done!
*/
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Start the one second clock.
@@ -1072,7 +1072,8 @@ epic_stop(struct ifnet *ifp, int disable)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
/* Down the MII. */
diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c
index 6d36e9a75f0..c4f404f9255 100644
--- a/sys/dev/ic/smc91cxx.c
+++ b/sys/dev/ic/smc91cxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc91cxx.c,v 1.43 2015/11/20 03:35:22 dlg Exp $ */
+/* $OpenBSD: smc91cxx.c,v 1.44 2015/11/25 03:09:58 dlg Exp $ */
/* $NetBSD: smc91cxx.c,v 1.11 1998/08/08 23:51:41 mycroft Exp $ */
/*-
@@ -508,7 +508,7 @@ smc91cxx_init(sc)
/* Interface is now running, with no output active. */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (sc->sc_flags & SMC_FLAGS_HAS_MII) {
/* Start the one second clock. */
@@ -541,7 +541,7 @@ smc91cxx_start(ifp)
u_int8_t packetno;
int timo, pad;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
again:
@@ -618,9 +618,8 @@ smc91cxx_start(ifp)
bus_space_read_1(bst, bsh, INTR_MASK_REG_B) | IM_ALLOC_INT);
ifp->if_timer = 5;
- ifp->if_flags |= IFF_OACTIVE;
-
ifq_deq_rollback(&ifp->if_snd, m);
+ ifq_set_oactive(&ifp->if_snd);
return;
}
@@ -791,7 +790,7 @@ smc91cxx_intr(arg)
/* XXX bound this loop! */ ;
bus_space_write_2(bst, bsh, MMU_CMD_REG_W, MMUCR_FREEPKT);
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
}
diff --git a/sys/dev/ic/ti.c b/sys/dev/ic/ti.c
index 106be6eb4de..13e7423b647 100644
--- a/sys/dev/ic/ti.c
+++ b/sys/dev/ic/ti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ti.c,v 1.21 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: ti.c,v 1.22 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1669,7 +1669,7 @@ ti_txeof_tigon1(struct ti_softc *sc)
}
if (!active)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
void
@@ -1713,7 +1713,7 @@ ti_txeof_tigon2(struct ti_softc *sc)
}
if (cur_tx != NULL)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
int
@@ -1976,7 +1976,7 @@ ti_start(struct ifnet *ifp)
if (error) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -2087,7 +2087,7 @@ ti_init2(struct ti_softc *sc)
CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Make sure to set media properly. We have to do this
@@ -2289,7 +2289,8 @@ ti_stop(struct ti_softc *sc)
ifp = &sc->arpcom.ac_if;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
/* Disable host interrupts. */
CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1);
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c
index e7f14ac22ba..ee4e6ba4d90 100644
--- a/sys/dev/ic/xl.c
+++ b/sys/dev/ic/xl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xl.c,v 1.129 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: xl.c,v 1.130 2015/11/25 03:09:58 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1289,7 +1289,7 @@ xl_txeof(struct xl_softc *sc)
}
if (sc->xl_cdata.xl_tx_head == NULL) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* Clear the timeout timer. */
ifp->if_timer = 0;
sc->xl_cdata.xl_tx_tail = NULL;
@@ -1343,7 +1343,7 @@ xl_txeof_90xB(struct xl_softc *sc)
sc->xl_cdata.xl_tx_cons = idx;
if (cur_tx != NULL)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (sc->xl_cdata.xl_tx_cnt == 0)
ifp->if_timer = 0;
}
@@ -1658,7 +1658,7 @@ xl_start(struct ifnet *ifp)
xl_txeoc(sc);
xl_txeof(sc);
if (sc->xl_cdata.xl_tx_free == NULL) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
}
@@ -1782,7 +1782,7 @@ xl_start_90xB(struct ifnet *ifp)
sc = ifp->if_softc;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
idx = sc->xl_cdata.xl_tx_prod;
@@ -1791,7 +1791,7 @@ xl_start_90xB(struct ifnet *ifp)
while (sc->xl_cdata.xl_tx_chain[idx].xl_mbuf == NULL) {
if ((XL_TX_LIST_CNT - sc->xl_cdata.xl_tx_cnt) < 3) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -2035,7 +2035,7 @@ xl_init(void *xsc)
XL_SEL_WIN(7);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -2296,7 +2296,8 @@ xl_stop(struct xl_softc *sc)
ifp = &sc->sc_arpcom.ac_if;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_DISABLE);
diff --git a/sys/dev/isa/if_ef_isapnp.c b/sys/dev/isa/if_ef_isapnp.c
index 954143fddc2..a6d1dc5e781 100644
--- a/sys/dev/isa/if_ef_isapnp.c
+++ b/sys/dev/isa/if_ef_isapnp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ef_isapnp.c,v 1.34 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_ef_isapnp.c,v 1.35 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -237,7 +237,7 @@ efstart(ifp)
int fillcnt = 0;
u_int32_t filler = 0;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
startagain:
@@ -261,7 +261,7 @@ startagain:
bus_space_write_2(iot, ioh, EP_COMMAND,
SET_TX_AVAIL_THRESH | ((len + pad) >> 2));
ifq_deq_rollback(&ifp->if_snd, m0);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
} else {
bus_space_write_2(iot, ioh, EP_COMMAND,
@@ -439,7 +439,7 @@ efinit(sc)
mii_mediachg(&sc->sc_mii);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -469,7 +469,8 @@ efstop(sc)
bus_space_handle_t ioh = sc->sc_ioh;
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_tick_tmo);
@@ -523,7 +524,7 @@ efintr(vsc)
if (status & S_TX_AVAIL) {
bus_space_write_2(iot, ioh, EP_STATUS, C_TX_AVAIL);
r = 1;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_arpcom.ac_if.if_snd);
efstart(&sc->sc_arpcom.ac_if);
}
if (status & S_CARD_FAILURE) {
@@ -586,7 +587,7 @@ eftxstat(sc)
else if (i & TXS_MAX_COLLISION) {
sc->sc_arpcom.ac_if.if_collisions++;
bus_space_write_2(iot, ioh, EP_COMMAND, TX_ENABLE);
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_arpcom.ac_if.if_snd);
}
else
sc->sc_tx_succ_ok = (sc->sc_tx_succ_ok + 1) & 127;
diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c
index d1c28542cd6..6187beaf40c 100644
--- a/sys/dev/isa/if_eg.c
+++ b/sys/dev/isa/if_eg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_eg.c,v 1.42 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_eg.c,v 1.43 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: if_eg.c,v 1.26 1996/05/12 23:52:27 mycroft Exp $ */
/*
@@ -474,7 +474,7 @@ eginit(register struct eg_softc *sc)
/* Interface is now `running', with no output active. */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* Attempt to start output, if any. */
egstart(ifp);
@@ -513,7 +513,7 @@ egstart(struct ifnet *ifp)
u_int i;
/* Don't transmit if interface is busy or not running */
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
loop:
@@ -522,7 +522,7 @@ loop:
if (m0 == NULL)
return;
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
/* We need to use m->m_pkthdr.len, so require the header */
if ((m0->m_flags & M_PKTHDR) == 0)
@@ -545,7 +545,7 @@ loop:
if (egwritePCB(sc) != 0) {
DPRINTF(("egwritePCB in egstart failed\n"));
ifp->if_oerrors++;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
m_freem(m0);
goto loop;
}
@@ -631,7 +631,7 @@ egintr(void *arg)
sc->sc_arpcom.ac_if.if_opackets++;
sc->sc_arpcom.ac_if.if_collisions +=
sc->eg_pcb[8] & 0xf;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_arpcom.ac_if.if_snd);
egstart(&sc->sc_arpcom.ac_if);
break;
diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c
index 9cc69f33a40..c2128770433 100644
--- a/sys/dev/isa/if_el.c
+++ b/sys/dev/isa/if_el.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_el.c,v 1.30 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_el.c,v 1.31 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: if_el.c,v 1.39 1996/05/12 23:52:32 mycroft Exp $ */
/*
@@ -272,7 +272,7 @@ elinit(sc)
/* Set flags appropriately. */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* And start output. */
elstart(ifp);
@@ -296,12 +296,12 @@ elstart(ifp)
s = splnet();
/* Don't do anything if output is active. */
- if ((ifp->if_flags & IFF_OACTIVE) != 0) {
+ if (ifq_is_oactive(&ifp->if_snd) != 0) {
splx(s);
return;
}
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
/*
* The main loop. They warned me against endless loops, but would I
@@ -384,7 +384,7 @@ elstart(ifp)
(void)inb(iobase+EL_AS);
outb(iobase+EL_AC, EL_AC_IRQE | EL_AC_RX);
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
}
diff --git a/sys/dev/isa/if_ex.c b/sys/dev/isa/if_ex.c
index 147dbcf27a8..bbbf55c5a37 100644
--- a/sys/dev/isa/if_ex.c
+++ b/sys/dev/isa/if_ex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ex.c,v 1.42 2015/11/20 03:35:23 dlg Exp $ */
+/* $OpenBSD: if_ex.c,v 1.43 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1997, Donald A. Schmidt
* Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es)
@@ -355,7 +355,7 @@ ex_init(struct ex_softc *sc)
sc->tx_head = sc->tx_tail = sc->tx_lower_limit;
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
DODEBUG(Status, printf("OIDLE init\n"););
ex_setmulti(sc);
@@ -388,7 +388,7 @@ ex_start(struct ifnet *ifp)
* Main loop: send outgoing packets to network card until there are no
* more packets left, or the card cannot accept any more yet.
*/
- while (!(ifp->if_flags & IFF_OACTIVE)) {
+ while (!ifq_is_oactive(&ifp->if_snd)) {
opkt = ifq_deq_begin(&ifp->if_snd);
if (opkt == NULL)
break;
@@ -520,7 +520,7 @@ ex_start(struct ifnet *ifp)
m_freem(opkt);
} else {
ifq_deq_rollback(&ifp->if_snd, opkt);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
DODEBUG(Status, printf("OACTIVE start\n"););
}
}
@@ -630,7 +630,7 @@ ex_tx_intr(struct ex_softc *sc)
}
/* The card should be ready to accept more packets now. */
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
DODEBUG(Status, printf("OIDLE tx_intr\n"););
DODEBUG(Start_End, printf("ex_tx_intr: finish\n"););
@@ -889,7 +889,7 @@ ex_watchdog(struct ifnet *ifp)
DODEBUG(Start_End, printf("ex_watchdog: start\n"););
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
DODEBUG(Status, printf("OIDLE watchdog\n"););
ifp->if_oerrors++;
ex_reset(sc);
diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c
index d4e00e44dcc..bfbc63daff2 100644
--- a/sys/dev/isa/if_ie.c
+++ b/sys/dev/isa/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.46 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_ie.c,v 1.47 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: if_ie.c,v 1.51 1996/05/12 23:52:48 mycroft Exp $ */
/*-
@@ -935,7 +935,7 @@ ietint(sc)
int status;
ifp->if_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
status = sc->xmit_cmds[sc->xctail]->ie_xmit_status;
@@ -1357,12 +1357,12 @@ iestart(ifp)
u_char *buffer;
u_short len;
- 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->xmit_busy == NTXBUF) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1979,7 +1979,7 @@ ieinit(sc)
iememinit(ptr, sc);
sc->sc_arpcom.ac_if.if_flags |= IFF_RUNNING;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->sc_arpcom.ac_if.if_snd);
sc->scb->ie_recv_list = MK_16(MEM, sc->rframes[0]);
command_and_wait(sc, IE_RU_START, 0, 0);
diff --git a/sys/dev/pci/if_age.c b/sys/dev/pci/if_age.c
index 9b285cb00df..1720916168c 100644
--- a/sys/dev/pci/if_age.c
+++ b/sys/dev/pci/if_age.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_age.c,v 1.30 2015/11/09 00:29:06 dlg Exp $ */
+/* $OpenBSD: if_age.c,v 1.31 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
@@ -960,7 +960,7 @@ age_start(struct ifnet *ifp)
struct mbuf *m;
int enq;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if ((sc->age_flags & AGE_FLAG_LINK) == 0)
return;
@@ -971,7 +971,7 @@ age_start(struct ifnet *ifp)
for (;;) {
if (sc->age_cdata.age_tx_cnt + AGE_MAXTXSEGS >=
AGE_TX_RING_CNT - 2) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1226,7 +1226,7 @@ age_txintr(struct age_softc *sc, int tpd_cons)
if (sc->age_cdata.age_tx_cnt <= 0)
break;
prog++;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->age_cdata.age_tx_cnt--;
txd = &sc->age_cdata.age_txdesc[cons];
/*
@@ -1782,7 +1782,7 @@ age_init(struct ifnet *ifp)
timeout_add_sec(&sc->age_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
return (0);
}
@@ -1799,7 +1799,8 @@ age_stop(struct age_softc *sc)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
sc->age_flags &= ~AGE_FLAG_LINK;
diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c
index d0344b85821..c7452555726 100644
--- a/sys/dev/pci/if_alc.c
+++ b/sys/dev/pci/if_alc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_alc.c,v 1.36 2015/11/09 00:29:06 dlg Exp $ */
+/* $OpenBSD: if_alc.c,v 1.37 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -1359,7 +1359,7 @@ alc_start(struct ifnet *ifp)
if (sc->alc_cdata.alc_tx_cnt >= ALC_TX_DESC_HIWAT)
alc_txeof(sc);
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if ((sc->alc_flags & ALC_FLAG_LINK) == 0)
return;
@@ -1369,7 +1369,7 @@ alc_start(struct ifnet *ifp)
for (;;) {
if (sc->alc_cdata.alc_tx_cnt + ALC_MAXTXSEGS >=
ALC_TX_RING_CNT - 3) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1739,7 +1739,7 @@ alc_txeof(struct alc_softc *sc)
if (sc->alc_cdata.alc_tx_cnt <= 0)
break;
prog++;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->alc_cdata.alc_tx_cnt--;
txd = &sc->alc_cdata.alc_txdesc[cons];
if (txd->tx_m != NULL) {
@@ -2335,7 +2335,7 @@ alc_init(struct ifnet *ifp)
timeout_add_sec(&sc->alc_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
return (0);
}
@@ -2352,7 +2352,8 @@ alc_stop(struct alc_softc *sc)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
timeout_del(&sc->alc_tick_ch);
diff --git a/sys/dev/pci/if_ale.c b/sys/dev/pci/if_ale.c
index fded56a79b7..97919a11123 100644
--- a/sys/dev/pci/if_ale.c
+++ b/sys/dev/pci/if_ale.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ale.c,v 1.41 2015/11/09 00:29:06 dlg Exp $ */
+/* $OpenBSD: if_ale.c,v 1.42 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -986,7 +986,7 @@ ale_start(struct ifnet *ifp)
if (sc->ale_cdata.ale_tx_cnt >= ALE_TX_DESC_HIWAT)
ale_txeof(sc);
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if ((sc->ale_flags & ALE_FLAG_LINK) == 0)
return;
@@ -998,7 +998,7 @@ ale_start(struct ifnet *ifp)
/* Check descriptor overrun. */
if (sc->ale_cdata.ale_tx_cnt + ALE_MAXTXSEGS >=
ALE_TX_RING_CNT - 2) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1320,7 +1320,7 @@ ale_txeof(struct ale_softc *sc)
if (sc->ale_cdata.ale_tx_cnt <= 0)
break;
prog++;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->ale_cdata.ale_tx_cnt--;
txd = &sc->ale_cdata.ale_txdesc[cons];
if (txd->tx_m != NULL) {
@@ -1826,7 +1826,7 @@ ale_init(struct ifnet *ifp)
timeout_add_sec(&sc->ale_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
return 0;
}
@@ -1842,7 +1842,8 @@ ale_stop(struct ale_softc *sc)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
timeout_del(&sc->ale_tick_ch);
diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c
index 4c8c02a9e17..46682431fb5 100644
--- a/sys/dev/pci/if_bce.c
+++ b/sys/dev/pci/if_bce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bce.c,v 1.49 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_bce.c,v 1.50 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: if_bce.c,v 1.3 2003/09/29 01:53:02 mrg Exp $ */
/*
@@ -517,7 +517,7 @@ bce_start(struct ifnet *ifp)
* do not start another if currently transmitting, and more
* descriptors(tx slots) are needed for next packet.
*/
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
/* determine number of descriptors available */
@@ -587,7 +587,7 @@ bce_start(struct ifnet *ifp)
}
if (txsfree == 0) {
/* No more slots left; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
if (newpkts) {
/* Set a watchdog timer in case the chip flakes out. */
@@ -757,7 +757,7 @@ bce_txintr(struct bce_softc *sc)
int curr;
int i;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Go through the Tx list and free mbufs for those
@@ -900,7 +900,7 @@ bce_init(struct ifnet *ifp)
/* mark as running, and no outputs active */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
return 0;
}
@@ -968,7 +968,8 @@ bce_stop(struct ifnet *ifp)
timeout_del(&sc->bce_timeout);
/* Mark the interface down and cancel the watchdog timer. */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
/* Down the MII. */
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index abe763458c7..710cccb2baf 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.378 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_bge.c,v 1.379 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -3628,7 +3628,7 @@ bge_txeof(struct bge_softc *sc)
txcnt = atomic_sub_int_nv(&sc->bge_txcnt, freed);
if (txcnt < BGE_TX_RING_CNT - 16)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (txcnt == 0)
ifp->if_timer = 0;
@@ -4094,7 +4094,7 @@ bge_start(struct ifnet *ifp)
sc = ifp->if_softc;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if (!BGE_STS_BIT(sc, BGE_STS_LINK))
return;
@@ -4104,7 +4104,7 @@ bge_start(struct ifnet *ifp)
/* Check if we have enough free send BDs. */
if (sc->bge_txcnt + txinc + BGE_NTXSEG + 16 >=
BGE_TX_RING_CNT) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -4280,7 +4280,7 @@ bge_init(void *xsc)
bge_ifmedia_upd(ifp);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -4552,7 +4552,8 @@ bge_stop(struct bge_softc *sc)
timeout_del(&sc->bge_rxtimeout);
timeout_del(&sc->bge_rxtimeout_jumbo);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
/*
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index e839c226a8b..b1729410914 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnx.c,v 1.116 2015/11/20 03:35:23 dlg Exp $ */
+/* $OpenBSD: if_bnx.c,v 1.117 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -3256,7 +3256,8 @@ bnx_stop(struct bnx_softc *sc)
timeout_del(&sc->bnx_timeout);
timeout_del(&sc->bnx_rxrefill);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
/* Disable the transmit/receive blocks. */
REG_WR(sc, BNX_MISC_ENABLE_CLR_BITS, 0x5ffffff);
@@ -4634,11 +4635,11 @@ bnx_tx_intr(struct bnx_softc *sc)
/* Clear the tx hardware queue full flag. */
if (sc->used_tx_bd < sc->max_tx_bd) {
- DBRUNIF((ifp->if_flags & IFF_OACTIVE),
- printf("%s: Open TX chain! %d/%d (used/total)\n",
- sc->bnx_dev.dv_xname, sc->used_tx_bd,
- sc->max_tx_bd));
- ifp->if_flags &= ~IFF_OACTIVE;
+ DBRUNIF(ifq_is_oactive(&ifp->if_snd),
+ printf("%s: Open TX chain! %d/%d (used/total)\n",
+ sc->bnx_dev.dv_xname, sc->used_tx_bd,
+ sc->max_tx_bd));
+ ifq_clr_oactive(&ifp->if_snd);
}
sc->tx_cons = sw_tx_cons;
@@ -4768,7 +4769,7 @@ bnx_init(void *xsc)
bnx_ifmedia_upd(ifp);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
timeout_add_sec(&sc->bnx_timeout, 1);
@@ -5017,7 +5018,7 @@ bnx_start(struct ifnet *ifp)
*/
if (bnx_tx_encap(sc, m_head)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
DBPRINT(sc, BNX_INFO_SEND, "TX chain is closed for "
"business! Total tx_bd used = %d\n",
sc->used_tx_bd);
diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c
index 01d9a12580f..8d0a3cdab40 100644
--- a/sys/dev/pci/if_cas.c
+++ b/sys/dev/pci/if_cas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cas.c,v 1.45 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_cas.c,v 1.46 2015/11/25 03:09:59 dlg Exp $ */
/*
*
@@ -719,7 +719,8 @@ cas_stop(struct ifnet *ifp, int disable)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
mii_down(&sc->sc_mii);
@@ -1067,7 +1068,7 @@ cas_init(struct ifnet *ifp)
timeout_add_sec(&sc->sc_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
splx(s);
@@ -1841,7 +1842,7 @@ cas_tint(struct cas_softc *sc, u_int32_t status)
sc->sc_tx_cons = cons;
if (sc->sc_tx_cnt < CAS_NTXDESC - 2)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (sc->sc_tx_cnt == 0)
ifp->if_timer = 0;
@@ -1857,7 +1858,7 @@ cas_start(struct ifnet *ifp)
struct mbuf *m;
u_int32_t bix;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
bix = sc->sc_tx_prod;
@@ -1881,7 +1882,7 @@ cas_start(struct ifnet *ifp)
*/
if (cas_encap(sc, m, &bix)) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c
index 972ddadd378..e247c69dc81 100644
--- a/sys/dev/pci/if_de.c
+++ b/sys/dev/pci/if_de.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_de.c,v 1.130 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_de.c,v 1.131 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: if_de.c,v 1.58 1998/01/12 09:39:58 thorpej Exp $ */
/*-
@@ -410,7 +410,7 @@ tulip_linkup(tulip_softc_t * const sc, tulip_media_t media)
if ((sc->tulip_flags & TULIP_LINKUP) == 0)
sc->tulip_flags |= TULIP_PRINTLINKUP;
sc->tulip_flags |= TULIP_LINKUP;
- sc->tulip_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->tulip_if.if_snd);
if (sc->tulip_media != media) {
#ifdef TULIP_DEBUG
sc->tulip_dbg.dbg_last_media = sc->tulip_media;
@@ -618,7 +618,7 @@ tulip_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event)
}
if (event == TULIP_MEDIAPOLL_START) {
- sc->tulip_if.if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&sc->tulip_if.if_snd);
if (sc->tulip_probe_state != TULIP_PROBE_INACTIVE)
return;
sc->tulip_probe_mediamask = 0;
@@ -967,7 +967,7 @@ tulip_21041_media_poll(tulip_softc_t * const sc, const tulip_mediapoll_event_t e
* restart the probe (and reset the tulip to a known state).
*/
if (event == TULIP_MEDIAPOLL_START) {
- sc->tulip_if.if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&sc->tulip_if.if_snd);
sc->tulip_cmdmode &= ~(TULIP_CMD_FULLDUPLEX|TULIP_CMD_RXRUN);
TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
sc->tulip_probe_state = TULIP_PROBE_MEDIATEST;
@@ -3035,7 +3035,7 @@ tulip_reset(tulip_softc_t * const sc)
if (!inreset) {
sc->tulip_flags |= TULIP_INRESET;
sc->tulip_flags &= ~(TULIP_NEEDRESET|TULIP_RXBUFSLOW);
- sc->tulip_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->tulip_if.if_snd);
sc->tulip_if.if_start = tulip_ifstart;
}
@@ -3158,7 +3158,7 @@ tulip_init(tulip_softc_t * const sc)
sc->tulip_cmdmode |= TULIP_CMD_RXRUN;
sc->tulip_intrmask |= TULIP_STS_RXSTOPPED;
} else {
- sc->tulip_if.if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&sc->tulip_if.if_snd);
sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN;
sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED;
}
@@ -3550,7 +3550,7 @@ tulip_tx_intr(tulip_softc_t * const sc)
ri->ri_nextin = ri->ri_first;
if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0)
- sc->tulip_if.if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&sc->tulip_if.if_snd);
}
/*
* If nothing left to transmit, disable the timer.
@@ -3959,7 +3959,7 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m, int notonqueue)
if (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) {
TULIP_CSR_WRITE(sc, csr_txpoll, 1);
- sc->tulip_if.if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&sc->tulip_if.if_snd);
sc->tulip_if.if_start = tulip_ifstart;
TULIP_PERFEND(txput);
return (NULL);
@@ -3989,7 +3989,7 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m, int notonqueue)
sc->tulip_dbg.dbg_txput_finishes[6]++;
#endif
if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_DOINGSETUP)) {
- sc->tulip_if.if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&sc->tulip_if.if_snd);
sc->tulip_if.if_start = tulip_ifstart;
if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) {
sc->tulip_intrmask |= TULIP_STS_TXINTR;
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index 3739ad6b41c..cb3f6427731 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_em.c,v 1.312 2015/11/20 13:11:16 mpi Exp $ */
+/* $OpenBSD: if_em.c,v 1.313 2015/11/25 03:09:59 dlg Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -592,7 +592,7 @@ em_start(struct ifnet *ifp)
struct em_softc *sc = ifp->if_softc;
int post = 0;
- if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if (!sc->link_active)
@@ -611,7 +611,7 @@ em_start(struct ifnet *ifp)
if (em_encap(sc, m_head)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -878,7 +878,7 @@ em_init(void *arg)
em_iff(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
timeout_add_sec(&sc->timer_handle, 1);
em_clear_hw_cntrs(&sc->hw);
@@ -1557,7 +1557,8 @@ em_stop(void *arg, int softonly)
struct ifnet *ifp = &sc->interface_data.ac_if;
/* Tell the stack that the interface is no longer active */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
INIT_DEBUGOUT("em_stop: begin");
@@ -2486,7 +2487,7 @@ em_txeof(struct em_softc *sc)
* if some descriptors have been freed, restart the timeout.
*/
if (num_avail > EM_TX_CLEANUP_THRESHOLD)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* All clean, turn off the timer */
if (num_avail == sc->num_tx_desc)
diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c
index 5eba3767fd9..94fb3a4d587 100644
--- a/sys/dev/pci/if_et.c
+++ b/sys/dev/pci/if_et.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_et.c,v 1.32 2015/11/24 15:25:20 mpi Exp $ */
+/* $OpenBSD: if_et.c,v 1.33 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
*
@@ -470,7 +470,8 @@ et_stop(struct et_softc *sc)
sc->sc_tx_intr = 0;
ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
}
int
@@ -991,7 +992,7 @@ et_init(struct ifnet *ifp)
CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
back:
if (error)
et_stop(sc);
@@ -1066,7 +1067,7 @@ et_start(struct ifnet *ifp)
int trans;
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;
trans = 0;
@@ -1076,13 +1077,13 @@ et_start(struct ifnet *ifp)
break;
if ((tbd->tbd_used + ET_NSEG_SPARE) > ET_TX_NDESC) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
if (et_encap(sc, &m)) {
ifp->if_oerrors++;
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1929,7 +1930,7 @@ et_txeof(struct et_softc *sc)
ifp->if_timer = 0;
}
if (tbd->tbd_used + ET_NSEG_SPARE <= ET_TX_NDESC)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
et_start(ifp);
}
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c
index b228876010a..825d4966076 100644
--- a/sys/dev/pci/if_ipw.c
+++ b/sys/dev/pci/if_ipw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ipw.c,v 1.113 2015/11/24 13:45:06 mpi Exp $ */
+/* $OpenBSD: if_ipw.c,v 1.114 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2004-2008
@@ -1033,7 +1033,7 @@ ipw_tx_intr(struct ipw_softc *sc)
sc->txold = (r == 0) ? IPW_NTBD - 1 : r - 1;
/* call start() since some buffer descriptors have been released */
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
(*ifp->if_start)(ifp);
}
@@ -1298,7 +1298,7 @@ ipw_start(struct ifnet *ifp)
for (;;) {
if (sc->txfree < 1 + IPW_MAX_NSEG) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -2021,7 +2021,7 @@ ipw_init(struct ifnet *ifp)
goto fail1;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;
if (ic->ic_opmode != IEEE80211_M_MONITOR)
@@ -2048,7 +2048,8 @@ ipw_stop(struct ifnet *ifp, int disable)
CSR_WRITE_4(sc, IPW_CSR_RST, IPW_RST_SW_RESET);
ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Release tx buffers.
diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c
index c511f0dc675..4640accf0e9 100644
--- a/sys/dev/pci/if_iwi.c
+++ b/sys/dev/pci/if_iwi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwi.c,v 1.130 2015/11/24 13:45:06 mpi Exp $ */
+/* $OpenBSD: if_iwi.c,v 1.131 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2004-2008
@@ -1136,7 +1136,7 @@ iwi_tx_intr(struct iwi_softc *sc, struct iwi_tx_ring *txq)
}
sc->sc_tx_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
(*ifp->if_start)(ifp);
}
@@ -1388,7 +1388,7 @@ iwi_start(struct ifnet *ifp)
for (;;) {
if (sc->txq[0].queued + IWI_MAX_NSEG + 2 >= IWI_TX_RING_COUNT) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -2291,7 +2291,7 @@ iwi_init(struct ifnet *ifp)
goto fail1;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;
if (ic->ic_opmode != IEEE80211_M_MONITOR)
@@ -2315,7 +2315,8 @@ iwi_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);
/* in case we were scanning, release the scan "lock" */
ic->ic_scan_lock = IEEE80211_SCAN_UNLOCKED;
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 94ab7e188e0..92f9828066d 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.67 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.68 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2014 genua mbh <info@genua.de>
@@ -3175,8 +3175,8 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc,
if (--ring->queued < IWM_TX_RING_LOMARK) {
sc->qfullmsk &= ~(1 << ring->qid);
- if (sc->qfullmsk == 0 && (ifp->if_flags & IFF_OACTIVE)) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ if (sc->qfullmsk == 0 && ifq_is_oactive(&ifp->if_snd)) {
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Well, we're in interrupt context, but then again
* I guess net80211 does all sorts of stunts in
@@ -5552,7 +5552,7 @@ iwm_init(struct ifnet *ifp)
* Ok, firmware loaded and we are jogging
*/
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;
ieee80211_begin_scan(ifp);
@@ -5575,13 +5575,13 @@ iwm_start(struct ifnet *ifp)
struct mbuf *m;
int ac = EDCA_AC_BE; /* XXX */
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
for (;;) {
/* why isn't this done per-queue? */
if (sc->qfullmsk != 0) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -5644,7 +5644,8 @@ iwm_stop(struct ifnet *ifp, int disable)
sc->sc_scanband = 0;
sc->sc_auth_prot = 0;
ic->ic_scan_lock = IEEE80211_SCAN_UNLOCKED;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
task_del(systq, &sc->init_task);
task_del(sc->sc_nswq, &sc->newstate_task);
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index ff4693a698a..1d295c5104a 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwn.c,v 1.147 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.148 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -2298,8 +2298,8 @@ iwn_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, int ackfailcnt,
sc->sc_tx_timer = 0;
if (--ring->queued < IWN_TX_RING_LOMARK) {
sc->qfullmsk &= ~(1 << ring->qid);
- if (sc->qfullmsk == 0 && (ifp->if_flags & IFF_OACTIVE)) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ if (sc->qfullmsk == 0 && ifq_is_oactive(&ifp->if_snd)) {
+ ifq_clr_oactive(&ifp->if_snd);
(*ifp->if_start)(ifp);
}
}
@@ -3036,12 +3036,12 @@ iwn_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. */
@@ -6167,7 +6167,7 @@ iwn_init(struct ifnet *ifp)
goto fail;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;
if (ic->ic_opmode != IEEE80211_M_MONITOR)
@@ -6189,7 +6189,8 @@ iwn_stop(struct ifnet *ifp, int disable)
timeout_del(&sc->calib_to);
ifp->if_timer = sc->sc_tx_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/pci/if_ix.c b/sys/dev/pci/if_ix.c
index 8f12f70bcf1..f5fec4777c7 100644
--- a/sys/dev/pci/if_ix.c
+++ b/sys/dev/pci/if_ix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ix.c,v 1.128 2015/11/20 03:35:23 dlg Exp $ */
+/* $OpenBSD: if_ix.c,v 1.129 2015/11/25 03:09:59 dlg Exp $ */
/******************************************************************************
@@ -368,7 +368,7 @@ ixgbe_start(struct ifnet * ifp)
struct mbuf *m_head;
int post = 0;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if (!sc->link_up)
return;
@@ -384,7 +384,7 @@ ixgbe_start(struct ifnet * ifp)
if (ixgbe_encap(txr, m_head)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -801,7 +801,7 @@ ixgbe_init(void *arg)
/* Now inform the stack we're ready */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
}
@@ -874,7 +874,7 @@ ixgbe_intr(void *arg)
ixgbe_rxeof(que);
refill = 1;
- if (ISSET(ifp->if_flags, IFF_OACTIVE))
+ if (ifq_is_oactive(&ifp->if_snd))
was_active = 1;
ixgbe_txeof(txr);
}
@@ -1302,7 +1302,8 @@ ixgbe_stop(void *arg)
struct ifnet *ifp = &sc->arpcom.ac_if;
/* Tell the stack that the interface is no longer active */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
INIT_DEBUGOUT("ixgbe_stop: begin\n");
ixgbe_disable_intr(sc);
@@ -2442,7 +2443,7 @@ ixgbe_txeof(struct tx_ring *txr)
* restart the timeout.
*/
if (txr->tx_avail > IXGBE_TX_CLEANUP_THRESHOLD) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* If all are clean turn off the timer */
if (txr->tx_avail == sc->num_tx_desc) {
diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c
index 1f5282ab273..36ed45655c2 100644
--- a/sys/dev/pci/if_ixgb.c
+++ b/sys/dev/pci/if_ixgb.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_ixgb.c,v 1.67 2015/11/20 03:35:23 dlg Exp $ */
+/* $OpenBSD: if_ixgb.c,v 1.68 2015/11/25 03:09:59 dlg Exp $ */
#include <dev/pci/if_ixgb.h>
@@ -272,7 +272,7 @@ ixgb_start(struct ifnet *ifp)
struct ixgb_softc *sc = ifp->if_softc;
int post = 0;
- if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if (!sc->link_active)
@@ -289,7 +289,7 @@ ixgb_start(struct ifnet *ifp)
if (ixgb_encap(sc, m_head)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -486,7 +486,7 @@ ixgb_init(void *arg)
ixgb_set_promisc(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* Enable jumbo frames */
IXGB_WRITE_REG(&sc->hw, MFRMS,
@@ -849,7 +849,8 @@ ixgb_stop(void *arg)
timeout_del(&sc->timer_handle);
/* Tell the stack that the interface is no longer active */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ixgb_free_transmit_structures(sc);
ixgb_free_receive_structures(sc);
@@ -1414,7 +1415,7 @@ ixgb_txeof(struct ixgb_softc *sc)
* restart the timeout.
*/
if (num_avail > IXGB_TX_CLEANUP_THRESHOLD)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* All clean, turn off the timer */
if (num_avail == sc->num_tx_desc)
diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c
index 2675a1c4e9d..0e67e4ee34c 100644
--- a/sys/dev/pci/if_jme.c
+++ b/sys/dev/pci/if_jme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_jme.c,v 1.44 2015/11/24 12:32:53 mpi Exp $ */
+/* $OpenBSD: if_jme.c,v 1.45 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -250,7 +250,8 @@ jme_miibus_statchg(struct device *dev)
CSR_WRITE_4(sc, JME_INTR_MASK_CLR, JME_INTRS);
/* Stop driver */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
timeout_del(&sc->jme_tick_ch);
@@ -313,7 +314,7 @@ jme_miibus_statchg(struct device *dev)
}
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
timeout_add_sec(&sc->jme_tick_ch, 1);
/* Reenable interrupts. */
@@ -1205,7 +1206,7 @@ jme_start(struct ifnet *ifp)
if (sc->jme_cdata.jme_tx_cnt >= JME_TX_DESC_HIWAT)
jme_txeof(sc);
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if ((sc->jme_flags & JME_FLAG_LINK) == 0)
return;
@@ -1219,7 +1220,7 @@ jme_start(struct ifnet *ifp)
*/
if (sc->jme_cdata.jme_tx_cnt + JME_TXD_RSVD >
JME_TX_RING_CNT - JME_TXD_RSVD) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1565,7 +1566,7 @@ jme_txeof(struct jme_softc *sc)
if (sc->jme_cdata.jme_tx_cnt + JME_TXD_RSVD <=
JME_TX_RING_CNT - JME_TXD_RSVD)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
bus_dmamap_sync(sc->sc_dmat, sc->jme_cdata.jme_tx_ring_map, 0,
sc->jme_cdata.jme_tx_ring_map->dm_mapsize, BUS_DMASYNC_PREWRITE);
@@ -2004,7 +2005,7 @@ jme_init(struct ifnet *ifp)
timeout_add_sec(&sc->jme_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
return (0);
}
@@ -2020,7 +2021,8 @@ jme_stop(struct jme_softc *sc)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
timeout_del(&sc->jme_tick_ch);
diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c
index e6e1e5f41ad..58e6204a0ec 100644
--- a/sys/dev/pci/if_lge.c
+++ b/sys/dev/pci/if_lge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_lge.c,v 1.70 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_lge.c,v 1.71 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -793,7 +793,7 @@ lge_txeof(struct lge_softc *sc)
sc->lge_cdata.lge_tx_cons = idx;
if (cur_tx != NULL)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
void
@@ -948,7 +948,7 @@ lge_start(struct ifnet *ifp)
idx = sc->lge_cdata.lge_tx_prod;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
while(sc->lge_ldata->lge_tx_list[idx].lge_mbuf == NULL) {
@@ -961,7 +961,7 @@ lge_start(struct ifnet *ifp)
if (lge_encap(sc, m_head, &idx)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1108,7 +1108,7 @@ lge_init(void *xsc)
lge_ifmedia_upd(ifp);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -1247,7 +1247,8 @@ lge_stop(struct lge_softc *sc)
ifp->if_timer = 0;
timeout_del(&sc->lge_timeout);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
CSR_WRITE_4(sc, LGE_IMR, LGE_IMR_INTR_ENB);
diff --git a/sys/dev/pci/if_lii.c b/sys/dev/pci/if_lii.c
index f695258a3ad..2d80c32228d 100644
--- a/sys/dev/pci/if_lii.c
+++ b/sys/dev/pci/if_lii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_lii.c,v 1.41 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_lii.c,v 1.42 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation.
@@ -728,7 +728,7 @@ lii_init(struct ifnet *ifp)
timeout_add_sec(&sc->sc_tick, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
out:
return error;
@@ -792,7 +792,7 @@ lii_start(struct ifnet *ifp)
DPRINTF(("lii_start\n"));
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
for (;;) {
@@ -803,7 +803,7 @@ lii_start(struct ifnet *ifp)
if (!sc->sc_free_tx_slots ||
lii_free_tx_space(sc) < m0->m_pkthdr.len) {
ifq_deq_rollback(&ifp->if_snd, m0);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -836,7 +836,8 @@ lii_stop(struct ifnet *ifp)
timeout_del(&sc->sc_tick);
ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
mii_down(&sc->sc_mii);
@@ -980,7 +981,7 @@ lii_txintr(struct lii_softc *sc)
++ifp->if_opackets;
else
++ifp->if_oerrors;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
if (sc->sc_free_tx_slots)
diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c
index 2c2eb146695..ebc741414c7 100644
--- a/sys/dev/pci/if_msk.c
+++ b/sys/dev/pci/if_msk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_msk.c,v 1.121 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_msk.c,v 1.122 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -1553,7 +1553,7 @@ msk_start(struct ifnet *ifp)
*/
if (msk_encap(sc_if, m_head, &idx)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1720,7 +1720,7 @@ msk_txeof(struct sk_if_softc *sc_if)
ifp->if_timer = sc_if->sk_cdata.sk_tx_cnt > 0 ? 5 : 0;
if (sc_if->sk_cdata.sk_tx_cnt < MSK_TX_RING_CNT - 2)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc_if->sk_cdata.sk_tx_cons = idx;
}
@@ -2089,7 +2089,7 @@ msk_init(void *xsc_if)
CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
timeout_add_sec(&sc_if->sk_tick_ch, 1);
@@ -2108,7 +2108,8 @@ msk_stop(struct sk_if_softc *sc_if, int softonly)
timeout_del(&sc_if->sk_tick_ch);
- ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
/* Stop transfer of Tx descriptors */
diff --git a/sys/dev/pci/if_myx.c b/sys/dev/pci/if_myx.c
index 0c1b7d11740..ecb47ce472e 100644
--- a/sys/dev/pci/if_myx.c
+++ b/sys/dev/pci/if_myx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_myx.c,v 1.87 2015/11/24 10:04:34 dlg Exp $ */
+/* $OpenBSD: if_myx.c,v 1.88 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1205,7 +1205,7 @@ myx_up(struct myx_softc *sc)
goto empty_rx_ring_big;
}
- CLR(ifp->if_flags, IFF_OACTIVE);
+ ifq_clr_oactive(&ifp->if_snd);
SET(ifp->if_flags, IFF_RUNNING);
myx_iff(sc);
myx_start(ifp);
@@ -1361,7 +1361,8 @@ myx_down(struct myx_softc *sc)
printf("%s: failed to reset the device\n", DEVNAME(sc));
}
- CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE);
+ CLR(ifp->if_flags, IFF_RUNNING);
+ ifq_clr_oactive(&ifp->if_snd);
for (ring = 0; ring < 2; ring++) {
struct myx_rx_ring *mrr = &sc->sc_rx_ring[ring];
@@ -1437,7 +1438,7 @@ myx_start(struct ifnet *ifp)
u_int8_t flags;
if (!ISSET(ifp->if_flags, IFF_RUNNING) ||
- ISSET(ifp->if_flags, IFF_OACTIVE) ||
+ ifq_is_oactive(&ifp->if_snd) ||
IFQ_IS_EMPTY(&ifp->if_snd))
return;
@@ -1455,7 +1456,7 @@ myx_start(struct ifnet *ifp)
for (;;) {
if (used + sc->sc_tx_nsegs + 1 > free) {
- SET(ifp->if_flags, IFF_OACTIVE);
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1638,7 +1639,7 @@ myx_intr(void *arg)
bus_space_write_raw_region_4(sc->sc_memt, sc->sc_memh,
sc->sc_irqclaimoff + sizeof(data), &data, sizeof(data));
- start = ISSET(ifp->if_flags, IFF_OACTIVE);
+ start = ifq_is_oactive(&ifp->if_snd);
if (sts->ms_statusupdated) {
if (state == MYX_S_DOWN &&
@@ -1662,7 +1663,7 @@ myx_intr(void *arg)
if (start) {
KERNEL_LOCK();
- CLR(ifp->if_flags, IFF_OACTIVE);
+ ifq_clr_oactive(&ifp->if_snd);
myx_start(ifp);
KERNEL_UNLOCK();
}
diff --git a/sys/dev/pci/if_nep.c b/sys/dev/pci/if_nep.c
index f20df06c633..ae3d817d588 100644
--- a/sys/dev/pci/if_nep.c
+++ b/sys/dev/pci/if_nep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nep.c,v 1.23 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_nep.c,v 1.24 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2014, 2015 Mark Kettenis
*
@@ -1091,7 +1091,7 @@ nep_tx_proc(struct nep_softc *sc)
count--;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->sc_tx_cnt--;
sc->sc_tx_cons++;
@@ -1648,7 +1648,7 @@ nep_up(struct nep_softc *sc)
nep_write(sc, RXDMA_CFIG1(sc->sc_port), val);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
/* Enable interrupts. */
@@ -1685,7 +1685,8 @@ nep_down(struct nep_softc *sc)
nep_write(sc, LD_IM0(LDN_RXDMA(sc->sc_port)), 1);
nep_write(sc, LD_IM0(LDN_TXDMA(sc->sc_port)), 1);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
nep_disable_rx_mac(sc);
@@ -1869,7 +1870,7 @@ nep_start(struct ifnet *ifp)
if (!(ifp->if_flags & IFF_RUNNING))
return;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
if (IFQ_IS_EMPTY(&ifp->if_snd))
return;
@@ -1882,7 +1883,7 @@ nep_start(struct ifnet *ifp)
if (sc->sc_tx_cnt >= (NEP_NTXDESC - NEP_NTXSEGS)) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c
index 2b3e816d67d..68068c0aaf4 100644
--- a/sys/dev/pci/if_nfe.c
+++ b/sys/dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfe.c,v 1.115 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_nfe.c,v 1.116 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2006, 2007 Damien Bergamini <damien.bergamini@free.fr>
@@ -852,7 +852,7 @@ skip: sc->txq.queued--;
}
if (data != NULL) { /* at least one slot freed */
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
nfe_start(ifp);
}
}
@@ -969,7 +969,7 @@ nfe_start(struct ifnet *ifp)
int old = sc->txq.cur;
struct mbuf *m0;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
for (;;) {
@@ -979,7 +979,7 @@ nfe_start(struct ifnet *ifp)
if (nfe_encap(sc, m0) != 0) {
ifq_deq_rollback(&ifp->if_snd, m0);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1120,7 +1120,7 @@ nfe_init(struct ifnet *ifp)
timeout_add_sec(&sc->sc_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
return 0;
}
@@ -1133,7 +1133,8 @@ nfe_stop(struct ifnet *ifp, int disable)
timeout_del(&sc->sc_tick_ch);
ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
mii_down(&sc->sc_mii);
diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c
index fe8bcca6366..14c1ff4dcee 100644
--- a/sys/dev/pci/if_nge.c
+++ b/sys/dev/pci/if_nge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nge.c,v 1.89 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_nge.c,v 1.90 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -1148,7 +1148,7 @@ nge_txeof(struct nge_softc *sc)
if (cur_tx->nge_mbuf != NULL) {
m_freem(cur_tx->nge_mbuf);
cur_tx->nge_mbuf = NULL;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
sc->nge_cdata.nge_tx_cnt--;
@@ -1403,7 +1403,7 @@ nge_start(struct ifnet *ifp)
idx = sc->nge_cdata.nge_tx_prod;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
while(sc->nge_ldata->nge_tx_list[idx].nge_mbuf == NULL) {
@@ -1413,7 +1413,7 @@ nge_start(struct ifnet *ifp)
if (nge_encap(sc, m_head, &idx)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1621,7 +1621,7 @@ nge_init(void *xsc)
nge_ifmedia_mii_upd(ifp);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
}
@@ -1876,7 +1876,8 @@ nge_stop(struct nge_softc *sc)
timeout_del(&sc->nge_timeout);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
CSR_WRITE_4(sc, NGE_IER, 0);
CSR_WRITE_4(sc, NGE_IMR, 0);
diff --git a/sys/dev/pci/if_nxe.c b/sys/dev/pci/if_nxe.c
index 1e87bb54fa8..63c4b3ea385 100644
--- a/sys/dev/pci/if_nxe.c
+++ b/sys/dev/pci/if_nxe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nxe.c,v 1.70 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: if_nxe.c,v 1.71 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -1170,7 +1170,7 @@ nxe_up(struct nxe_softc *sc)
nxe_crb_set(sc, 1);
SET(ifp->if_flags, IFF_RUNNING);
- CLR(ifp->if_flags, IFF_OACTIVE);
+ ifq_clr_oactive(&ifp->if_snd);
/* enable interrupts */
intr_scheme = nxe_crb_read(sc, NXE_1_SW_NIC_CAP_FW);
@@ -1270,7 +1270,8 @@ nxe_down(struct nxe_softc *sc)
struct ifnet *ifp = &sc->sc_ac.ac_if;
int i;
- CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE | IFF_ALLMULTI);
+ CLR(ifp->if_flags, IFF_RUNNING | IFF_ALLMULTI);
+ ifq_clr_oactive(&ifp->if_snd);
/* XXX turn the chip off */
@@ -1307,12 +1308,12 @@ nxe_start(struct ifnet *ifp)
int nsegs;
if (!ISSET(ifp->if_flags, IFF_RUNNING) ||
- ISSET(ifp->if_flags, IFF_OACTIVE) ||
+ ifq_is_oactive(&ifp->if_snd) ||
IFQ_IS_EMPTY(&ifp->if_snd))
return;
if (nxe_ring_writeable(nr, sc->sc_cmd_consumer_cur) < NXE_TXD_DESCS) {
- SET(ifp->if_flags, IFF_OACTIVE);
+ ifq_set_oactive(&ifp->if_snd);
return;
}
@@ -1328,7 +1329,7 @@ nxe_start(struct ifnet *ifp)
pkt = nxe_pkt_get(sc->sc_tx_pkts);
if (pkt == NULL) {
ifq_deq_rollback(&ifp->if_snd, m);
- SET(ifp->if_flags, IFF_OACTIVE);
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1436,7 +1437,7 @@ nxe_complete(struct nxe_softc *sc)
if (rv == 1) {
sc->sc_cmd_consumer_cur = cur_cons;
- CLR(sc->sc_ac.ac_if.if_flags, IFF_OACTIVE);
+ ifq_clr_oactive(&sc->sc_ac.ac_if.if_snd);
}
return (rv);
diff --git a/sys/dev/pci/if_oce.c b/sys/dev/pci/if_oce.c
index 1f3ed555153..bff7f2b6d33 100644
--- a/sys/dev/pci/if_oce.c
+++ b/sys/dev/pci/if_oce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_oce.c,v 1.89 2015/11/14 17:54:57 mpi Exp $ */
+/* $OpenBSD: if_oce.c,v 1.90 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2012 Mike Belopuhov
@@ -1108,7 +1108,7 @@ oce_init(void *arg)
oce_link_status(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
timeout_add_sec(&sc->sc_tick, 1);
@@ -1132,7 +1132,8 @@ oce_stop(struct oce_softc *sc)
timeout_del(&sc->sc_tick);
timeout_del(&sc->sc_rxrefill);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
/* Stop intrs and finish any bottom halves pending */
oce_intr_disable(sc);
@@ -1175,7 +1176,7 @@ oce_start(struct ifnet *ifp)
struct mbuf *m;
int pkts = 0;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
for (;;) {
@@ -1184,7 +1185,7 @@ oce_start(struct ifnet *ifp)
break;
if (oce_encap(sc, &m, 0)) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1448,9 +1449,9 @@ oce_intr_wq(void *arg)
}
oce_dma_sync(&cq->ring->dma, BUS_DMASYNC_PREWRITE);
- if (ifp->if_flags & IFF_OACTIVE) {
+ if (ifq_is_oactive(&ifp->if_snd)) {
if (wq->ring->nused < (wq->ring->nitems / 2)) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
oce_start(ifp);
}
}
diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c
index 2f970cce7eb..bbf98a20946 100644
--- a/sys/dev/pci/if_pcn.c
+++ b/sys/dev/pci/if_pcn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pcn.c,v 1.39 2015/11/20 03:35:23 dlg Exp $ */
+/* $OpenBSD: if_pcn.c,v 1.40 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: if_pcn.c,v 1.26 2005/05/07 09:15:44 is Exp $ */
/*
@@ -817,7 +817,7 @@ pcn_start(struct ifnet *ifp)
bus_dmamap_t dmamap;
int error, nexttx, lasttx = -1, ofree, seg;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
/*
@@ -895,7 +895,7 @@ pcn_start(struct ifnet *ifp)
* XXX We could allocate an mbuf and copy, but
* XXX is it worth it?
*/
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
bus_dmamap_unload(sc->sc_dmat, dmamap);
if (m != NULL)
m_freem(m);
@@ -1004,7 +1004,7 @@ pcn_start(struct ifnet *ifp)
if (sc->sc_txsfree == 0 || sc->sc_txfree == 0) {
/* No more slots left; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
if (sc->sc_txfree != ofree) {
@@ -1200,7 +1200,7 @@ pcn_txintr(struct pcn_softc *sc)
uint32_t tmd1, tmd2, tmd;
int i, j;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Go through our Tx list and free mbufs for those
@@ -1687,7 +1687,7 @@ pcn_init(struct ifnet *ifp)
/* ...all done! */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
out:
if (error)
@@ -1737,7 +1737,8 @@ pcn_stop(struct ifnet *ifp, int disable)
}
/* Mark the interface as down and cancel the watchdog timer. */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
/* Stop the chip. */
diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c
index a2e87189f0e..d696c19212c 100644
--- a/sys/dev/pci/if_rtwn.c
+++ b/sys/dev/pci/if_rtwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rtwn.c,v 1.10 2015/11/24 13:45:06 mpi Exp $ */
+/* $OpenBSD: if_rtwn.c,v 1.11 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -1847,7 +1847,7 @@ rtwn_tx_done(struct rtwn_softc *sc, int qid)
sc->qfullmsk &= ~(1 << qid);
if (sc->qfullmsk == 0) {
- ifp->if_flags &= (~IFF_OACTIVE);
+ ifq_clr_oactive(&ifp->if_snd);
(*ifp->if_start)(ifp);
}
}
@@ -1860,12 +1860,12 @@ rtwn_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. */
@@ -3409,7 +3409,7 @@ rtwn_init(struct ifnet *ifp)
rtwn_write_4(sc, R92C_HIMR, RTWN_INT_ENABLE);
/* We're ready to go. */
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;
#ifdef notyet
@@ -3461,7 +3461,8 @@ rtwn_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 = splnet();
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
diff --git a/sys/dev/pci/if_se.c b/sys/dev/pci/if_se.c
index cb3a0978876..45929eb1be2 100644
--- a/sys/dev/pci/if_se.c
+++ b/sys/dev/pci/if_se.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_se.c,v 1.17 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_se.c,v 1.18 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2009, 2010 Christopher Zimmermann <madroach@zakweb.de>
@@ -995,7 +995,7 @@ se_txeof(struct se_softc *sc)
if ((txstat & TDC_OWN) != 0)
break;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (SE_TX_ERROR(txstat) != 0) {
if (ifp->if_flags & IFF_DEBUG)
@@ -1203,7 +1203,7 @@ se_start(struct ifnet *ifp)
uint i, queued = 0;
if ((sc->sc_flags & SE_FLAG_LINK) == 0 ||
- (ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) {
+ !(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd)) {
#ifdef SE_DEBUG
if (ifp->if_flags & IFF_DEBUG)
printf("%s: can't tx, flags 0x%x 0x%04x\n",
@@ -1221,7 +1221,7 @@ se_start(struct ifnet *ifp)
if (se_encap(sc, m_head, &i) != 0) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1305,7 +1305,7 @@ se_init(struct ifnet *ifp)
CSR_WRITE_4(sc, RX_CTL, 0x1a00 | 0x000c | RX_CTL_POLL | RX_CTL_ENB);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->sc_flags &= ~SE_FLAG_LINK;
mii_mediachg(&sc->sc_mii);
@@ -1419,7 +1419,8 @@ se_stop(struct se_softc *sc)
struct ifnet *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_tick_tmo);
mii_down(&sc->sc_mii);
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c
index 23ecd1f5996..140f6642dba 100644
--- a/sys/dev/pci/if_sis.c
+++ b/sys/dev/pci/if_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sis.c,v 1.131 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_sis.c,v 1.132 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -1504,7 +1504,7 @@ sis_txeof(struct sis_softc *sc)
if (idx != sc->sis_cdata.sis_tx_cons) {
/* we freed up some buffers */
sc->sis_cdata.sis_tx_cons = idx;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
ifp->if_timer = (sc->sis_cdata.sis_tx_cnt == 0) ? 0 : 5;
@@ -1671,7 +1671,7 @@ sis_start(struct ifnet *ifp)
idx = sc->sis_cdata.sis_tx_prod;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
while(sc->sis_ldata->sis_tx_list[idx].sis_mbuf == NULL) {
@@ -1681,7 +1681,7 @@ sis_start(struct ifnet *ifp)
if (sis_encap(sc, m_head, &idx)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1838,7 +1838,7 @@ sis_init(void *xsc)
sc->sis_stopped = 0;
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -1979,7 +1979,8 @@ sis_stop(struct sis_softc *sc)
timeout_del(&sc->sis_timeout);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
sc->sis_stopped = 1;
CSR_WRITE_4(sc, SIS_IER, 0);
diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c
index b10761ea93b..b672cfa0808 100644
--- a/sys/dev/pci/if_sk.c
+++ b/sys/dev/pci/if_sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sk.c,v 1.182 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_sk.c,v 1.183 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -1507,7 +1507,7 @@ sk_start(struct ifnet *ifp)
*/
if (sk_encap(sc_if, m_head, &idx)) {
ifq_deq_rollback(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1695,7 +1695,7 @@ sk_txeof(struct sk_if_softc *sc_if)
ifp->if_timer = sc_if->sk_cdata.sk_tx_cnt > 0 ? 5 : 0;
if (sc_if->sk_cdata.sk_tx_cnt < SK_TX_RING_CNT - 2)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc_if->sk_cdata.sk_tx_cons = idx;
}
@@ -2396,7 +2396,7 @@ sk_init(void *xsc_if)
CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (SK_IS_YUKON(sc))
timeout_add_sec(&sc_if->sk_tick_ch, 1);
@@ -2418,7 +2418,8 @@ sk_stop(struct sk_if_softc *sc_if, int softonly)
timeout_del(&sc_if->sk_tick_ch);
- ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
if (!softonly) {
/* stop Tx descriptor polling timer */
diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c
index 07938c7e363..74aeb310134 100644
--- a/sys/dev/pci/if_ste.c
+++ b/sys/dev/pci/if_ste.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ste.c,v 1.62 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_ste.c,v 1.63 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -748,7 +748,7 @@ ste_txeof(struct ste_softc *sc)
m_freem(cur_tx->ste_mbuf);
cur_tx->ste_mbuf = NULL;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_opackets++;
STE_INC(idx, STE_TX_LIST_CNT);
@@ -1113,7 +1113,7 @@ ste_init(void *xsc)
ste_ifmedia_upd(ifp);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -1131,7 +1131,8 @@ ste_stop(struct ste_softc *sc)
timeout_del(&sc->sc_stats_tmo);
- ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
CSR_WRITE_2(sc, STE_IMR, 0);
STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_TX_DISABLE);
@@ -1310,7 +1311,7 @@ ste_start(struct ifnet *ifp)
if (!sc->ste_link)
return;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
idx = sc->ste_cdata.ste_tx_prod;
@@ -1322,7 +1323,7 @@ ste_start(struct ifnet *ifp)
*/
if (STE_NEXT(idx, STE_TX_LIST_CNT) ==
sc->ste_cdata.ste_tx_cons) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c
index 5b6a501810f..1e606be1527 100644
--- a/sys/dev/pci/if_stge.c
+++ b/sys/dev/pci/if_stge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_stge.c,v 1.65 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_stge.c,v 1.66 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: if_stge.c,v 1.27 2005/05/16 21:35:32 bouyer Exp $ */
/*-
@@ -462,7 +462,7 @@ stge_start(struct ifnet *ifp)
int error, firsttx, nexttx, opending, seg, totlen;
uint64_t csum_flags = 0, tfc;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
/*
@@ -608,7 +608,7 @@ stge_start(struct ifnet *ifp)
if (sc->sc_txpending == (STGE_NTXDESC - 1)) {
/* No more slots left; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
}
if (sc->sc_txpending != opending) {
@@ -801,7 +801,7 @@ stge_txintr(struct stge_softc *sc)
uint64_t control;
int i;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/*
* Go through our Tx list and free mbufs for those
@@ -1291,7 +1291,7 @@ stge_init(struct ifnet *ifp)
* ...all done!
*/
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
out:
if (error)
@@ -1341,7 +1341,8 @@ stge_stop(struct ifnet *ifp, int disable)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
/* Down the MII. */
diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c
index e1814c70c71..e2473a2735e 100644
--- a/sys/dev/pci/if_tht.c
+++ b/sys/dev/pci/if_tht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tht.c,v 1.136 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: if_tht.c,v 1.137 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -967,7 +967,7 @@ tht_up(struct tht_softc *sc)
tht_iff(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* enable interrupts */
sc->sc_imr = THT_IMR_UP(sc->sc_port);
@@ -1062,7 +1062,8 @@ tht_down(struct tht_softc *sc)
return;
}
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE | IFF_ALLMULTI);
+ ifp->if_flags &= ~(IFF_RUNNING | IFF_ALLMULTI);
+ ifq_clr_oactive(&ifp->if_snd);
while (tht_fifo_writable(sc, &sc->sc_txt) < sc->sc_txt.tf_len &&
tht_fifo_readable(sc, &sc->sc_txf) > 0)
@@ -1097,7 +1098,7 @@ tht_start(struct ifnet *ifp)
if (!(ifp->if_flags & IFF_RUNNING))
return;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
if (IFQ_IS_EMPTY(&ifp->if_snd))
return;
@@ -1117,7 +1118,7 @@ tht_start(struct ifnet *ifp)
pkt = tht_pkt_get(&sc->sc_tx_list);
if (pkt == NULL) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1233,7 +1234,7 @@ tht_txf(struct tht_softc *sc)
} while (sc->sc_txf.tf_ready >= sizeof(txf));
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
tht_fifo_post(sc, &sc->sc_txf);
}
diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c
index c3bc7d3bebb..3a982136a79 100644
--- a/sys/dev/pci/if_tl.c
+++ b/sys/dev/pci/if_tl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tl.c,v 1.67 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_tl.c,v 1.68 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -1176,7 +1176,7 @@ tl_intvec_txeoc(void *xsc, u_int32_t type)
ifp->if_timer = 0;
if (sc->tl_cdata.tl_tx_head == NULL) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->tl_cdata.tl_tx_tail = NULL;
sc->tl_txeoc = 1;
} else {
@@ -1459,7 +1459,7 @@ tl_start(struct ifnet *ifp)
* punt.
*/
if (sc->tl_cdata.tl_tx_free == NULL) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
@@ -1768,7 +1768,8 @@ tl_stop(struct tl_softc *sc)
}
bzero(&sc->tl_ldata->tl_tx_list, sizeof(sc->tl_ldata->tl_tx_list));
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
}
int
@@ -2019,7 +2020,7 @@ tl_wait_up(void *xsc)
struct ifnet *ifp = &sc->arpcom.ac_if;
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
struct cfattach tl_ca = {
diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c
index 56d82416b62..6f9584b5726 100644
--- a/sys/dev/pci/if_txp.c
+++ b/sys/dev/pci/if_txp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_txp.c,v 1.121 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_txp.c,v 1.122 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2001
@@ -825,7 +825,7 @@ txp_tx_reclaim(struct txp_softc *sc, struct txp_tx_ring *r,
ifp->if_opackets++;
}
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (++cons == TX_ENTRIES) {
txd = r->r_desc;
@@ -1215,7 +1215,7 @@ txp_init(struct txp_softc *sc)
WRITE_REG(sc, TXP_IMR, TXP_INT_A2H_3);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (!timeout_pending(&sc->sc_tick))
timeout_add_sec(&sc->sc_tick, 1);
@@ -1273,7 +1273,7 @@ txp_start(struct ifnet *ifp)
struct txp_swdesc *sd;
u_int32_t firstprod, firstcnt, prod, cnt, i;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
prod = r->r_prod;
@@ -1435,7 +1435,7 @@ oactive:
bus_dmamap_unload(sc->sc_dmat, sd->sd_map);
oactive1:
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
r->r_prod = firstprod;
r->r_cnt = firstcnt;
}
@@ -1646,7 +1646,8 @@ txp_stop(struct txp_softc *sc)
timeout_del(&sc->sc_tick);
/* Mark the interface as down and cancel the watchdog timer. */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
txp_command(sc, TXP_CMD_TX_DISABLE, 0, 0, 0, NULL, NULL, NULL, 1);
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c
index 1cbbd425b28..ef328617276 100644
--- a/sys/dev/pci/if_vge.c
+++ b/sys/dev/pci/if_vge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vge.c,v 1.68 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_vge.c,v 1.69 2015/11/25 03:09:59 dlg Exp $ */
/* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */
/*
* Copyright (c) 2004
@@ -1193,7 +1193,7 @@ vge_txeof(struct vge_softc *sc)
if (idx != sc->vge_ldata.vge_tx_considx) {
sc->vge_ldata.vge_tx_considx = idx;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
}
@@ -1412,7 +1412,7 @@ vge_start(struct ifnet *ifp)
sc = ifp->if_softc;
- if (!sc->vge_link || ifp->if_flags & IFF_OACTIVE)
+ if (!sc->vge_link || ifq_is_oactive(&ifp->if_snd))
return;
if (IFQ_IS_EMPTY(&ifp->if_snd))
@@ -1426,7 +1426,7 @@ vge_start(struct ifnet *ifp)
for (;;) {
if (sc->vge_ldata.vge_tx_mbuf[idx] != NULL) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1639,7 +1639,7 @@ vge_init(struct ifnet *ifp)
mii_mediachg(&sc->sc_mii);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->vge_link = 0;
@@ -1809,7 +1809,8 @@ vge_stop(struct vge_softc *sc)
timeout_del(&sc->timer_handle);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK);
CSR_WRITE_1(sc, VGE_CRS0, VGE_CR0_STOP);
diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c
index f0c2ec0b3a5..8cd0a38d3e0 100644
--- a/sys/dev/pci/if_vic.c
+++ b/sys/dev/pci/if_vic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vic.c,v 1.94 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: if_vic.c,v 1.95 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org>
@@ -910,7 +910,7 @@ vic_tx_proc(struct vic_softc *sc)
m_freem(txb->txb_m);
txb->txb_m = NULL;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->sc_txpending--;
sc->sc_data->vd_tx_stopped = 0;
@@ -1035,7 +1035,7 @@ vic_start(struct ifnet *ifp)
if (!(ifp->if_flags & IFF_RUNNING))
return;
- if (ifp->if_flags & IFF_OACTIVE)
+ if (ifq_is_oactive(&ifp->if_snd))
return;
if (IFQ_IS_EMPTY(&ifp->if_snd))
@@ -1048,7 +1048,7 @@ vic_start(struct ifnet *ifp)
for (;;) {
if (VIC_TXURN(sc)) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1267,7 +1267,7 @@ vic_init(struct ifnet *ifp)
vic_write(sc, VIC_DATA_LENGTH, sc->sc_dma_size);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
vic_iff(sc);
vic_write(sc, VIC_CMD, VIC_CMD_INTR_ENABLE);
@@ -1287,7 +1287,8 @@ vic_stop(struct ifnet *ifp)
timeout_del(&sc->sc_tick);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_map, 0, sc->sc_dma_size,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
diff --git a/sys/dev/pci/if_vio.c b/sys/dev/pci/if_vio.c
index dbb110878f0..4cd80d579db 100644
--- a/sys/dev/pci/if_vio.c
+++ b/sys/dev/pci/if_vio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vio.c,v 1.38 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_vio.c,v 1.39 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
@@ -676,7 +676,7 @@ vio_init(struct ifnet *ifp)
sc->sc_vq[VQRX].vq_num);
vio_populate_rx_mbufs(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
vio_iff(sc);
vio_link_state(ifp);
return 0;
@@ -690,7 +690,8 @@ vio_stop(struct ifnet *ifp, int disable)
timeout_del(&sc->sc_txtick);
timeout_del(&sc->sc_rxtick);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
/* only way to stop I/O and DMA is resetting... */
virtio_reset(vsc);
vio_rxeof(sc);
@@ -725,7 +726,7 @@ vio_start(struct ifnet *ifp)
vio_txeof(vq);
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if (IFQ_IS_EMPTY(&ifp->if_snd))
return;
@@ -742,7 +743,7 @@ again:
r = virtio_enqueue_prep(vq, &slot);
if (r == EAGAIN) {
ifq_deq_rollback(&ifp->if_snd, m);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
if (r != 0)
@@ -790,7 +791,7 @@ again:
sc->sc_tx_dmamaps[slot]);
ifq_deq_rollback(&ifp->if_snd, m);
sc->sc_tx_mbufs[slot] = NULL;
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
ifq_deq_commit(&ifp->if_snd, m);
@@ -808,7 +809,7 @@ again:
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif
}
- if (ifp->if_flags & IFF_OACTIVE) {
+ if (ifq_is_oactive(&ifp->if_snd)) {
int r;
if (vsc->sc_features & VIRTIO_F_RING_EVENT_IDX)
r = virtio_postpone_intr_smart(&sc->sc_vq[VQTX]);
@@ -1158,7 +1159,7 @@ vio_txeof(struct virtqueue *vq)
}
if (r) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
virtio_stop_vq_intr(vsc, &sc->sc_vq[VQTX]);
}
if (vq->vq_used_idx == vq->vq_avail_idx)
diff --git a/sys/dev/pci/if_vmx.c b/sys/dev/pci/if_vmx.c
index 85649e58bd0..055cfe184c2 100644
--- a/sys/dev/pci/if_vmx.c
+++ b/sys/dev/pci/if_vmx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vmx.c,v 1.39 2015/11/24 15:25:20 mpi Exp $ */
+/* $OpenBSD: if_vmx.c,v 1.40 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2013 Tsubai Masanari
@@ -692,9 +692,9 @@ vmxnet3_txintr(struct vmxnet3_softc *sc, struct vmxnet3_txqueue *tq)
if (atomic_add_int_nv(&ring->free, free) == NTXDESC)
ifp->if_timer = 0;
- if (ISSET(ifp->if_flags, IFF_OACTIVE)) {
+ if (ifq_is_oactive(&ifp->if_snd)) {
KERNEL_LOCK();
- CLR(ifp->if_flags, IFF_OACTIVE);
+ ifq_clr_oactive(&ifp->if_snd);
vmxnet3_start(ifp);
KERNEL_UNLOCK();
}
@@ -923,7 +923,8 @@ vmxnet3_stop(struct ifnet *ifp)
struct vmxnet3_softc *sc = ifp->if_softc;
int queue;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
vmxnet3_disable_all_intrs(sc);
@@ -985,7 +986,7 @@ vmxnet3_init(struct vmxnet3_softc *sc)
vmxnet3_link_state(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
return 0;
}
@@ -1048,7 +1049,7 @@ vmxnet3_start(struct ifnet *ifp)
u_int free, used;
int n;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
free = ring->free;
@@ -1056,7 +1057,7 @@ vmxnet3_start(struct ifnet *ifp)
for (;;) {
if (used + NTXSEGS > free) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c
index 2984e8b4581..0cb32d806ac 100644
--- a/sys/dev/pci/if_vr.c
+++ b/sys/dev/pci/if_vr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vr.c,v 1.147 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_vr.c,v 1.148 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -1044,7 +1044,7 @@ vr_txeof(struct vr_softc *sc)
m_freem(cur_tx->vr_mbuf);
cur_tx->vr_mbuf = NULL;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
next:
cur_tx = cur_tx->vr_nextdesc;
@@ -1309,7 +1309,7 @@ vr_start(struct ifnet *ifp)
sc = ifp->if_softc;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
if (sc->vr_link == 0)
@@ -1319,7 +1319,7 @@ vr_start(struct ifnet *ifp)
for (;;) {
if (sc->vr_cdata.vr_tx_cnt + VR_MAXFRAGS >=
VR_TX_LIST_CNT - 1) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
@@ -1480,7 +1480,7 @@ vr_init(void *xsc)
mii_mediachg(mii);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
if (!timeout_pending(&sc->sc_to))
timeout_add_sec(&sc->sc_to, 1);
@@ -1608,7 +1608,8 @@ vr_stop(struct vr_softc *sc)
timeout_del(&sc->sc_to);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
VR_SETBIT16(sc, VR_COMMAND, VR_CMD_STOP);
VR_CLRBIT16(sc, VR_COMMAND, (VR_CMD_RX_ON|VR_CMD_TX_ON));
diff --git a/sys/dev/pci/if_vte.c b/sys/dev/pci/if_vte.c
index dd4d3aff758..9171bda9fb1 100644
--- a/sys/dev/pci/if_vte.c
+++ b/sys/dev/pci/if_vte.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vte.c,v 1.16 2015/11/24 15:25:20 mpi Exp $ */
+/* $OpenBSD: if_vte.c,v 1.17 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2010, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -657,13 +657,13 @@ vte_start(struct ifnet *ifp)
struct mbuf *m_head;
int enq = 0;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
for (;;) {
/* Reserve one free TX descriptor. */
if (sc->vte_cdata.vte_tx_cnt >= VTE_TX_RING_CNT - 1) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
IFQ_DEQUEUE(&ifp->if_snd, m_head);
@@ -921,7 +921,7 @@ vte_txeof(struct vte_softc *sc)
}
if (prog > 0) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->vte_cdata.vte_tx_cons = cons;
/*
* Unarm watchdog timer only when there is no pending
@@ -1227,7 +1227,7 @@ vte_init(struct ifnet *ifp)
timeout_add_sec(&sc->vte_tick_ch, 1);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
return (0);
}
@@ -1243,7 +1243,8 @@ vte_stop(struct vte_softc *sc)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
sc->vte_flags &= ~VTE_FLAG_LINK;
timeout_del(&sc->vte_tick_ch);
diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c
index 8cf4c154d8f..ea52e9a4bf9 100644
--- a/sys/dev/pci/if_wb.c
+++ b/sys/dev/pci/if_wb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wb.c,v 1.65 2015/11/24 17:11:39 mpi Exp $ */
+/* $OpenBSD: if_wb.c,v 1.66 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -1065,7 +1065,7 @@ void wb_txeoc(sc)
ifp->if_timer = 0;
if (sc->wb_cdata.wb_tx_head == NULL) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
sc->wb_cdata.wb_tx_tail = NULL;
} else {
if (WB_TXOWN(sc->wb_cdata.wb_tx_head) == WB_UNSENT) {
@@ -1285,7 +1285,7 @@ void wb_start(ifp)
* punt.
*/
if (sc->wb_cdata.wb_tx_free->wb_mbuf != NULL) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
return;
}
@@ -1468,7 +1468,7 @@ void wb_init(xsc)
WB_SETBIT(sc, WB_NETCFG, WB_NETCFG_TX_ON);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -1593,7 +1593,8 @@ void wb_stop(sc)
timeout_del(&sc->wb_tick_tmo);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
WB_CLRBIT(sc, WB_NETCFG, (WB_NETCFG_RX_ON|WB_NETCFG_TX_ON));
CSR_WRITE_4(sc, WB_IMR, 0x00000000);
diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c
index 3a19a60a67a..d2d69a78a8f 100644
--- a/sys/dev/pci/if_wpi.c
+++ b/sys/dev/pci/if_wpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wpi.c,v 1.131 2015/11/24 13:33:17 mpi Exp $ */
+/* $OpenBSD: if_wpi.c,v 1.132 2015/11/25 03:09:59 dlg Exp $ */
/*-
* Copyright (c) 2006-2008
@@ -1372,8 +1372,8 @@ wpi_tx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc)
sc->sc_tx_timer = 0;
if (--ring->queued < WPI_TX_RING_LOMARK) {
sc->qfullmsk &= ~(1 << ring->qid);
- if (sc->qfullmsk == 0 && (ifp->if_flags & IFF_OACTIVE)) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ if (sc->qfullmsk == 0 && ifq_is_oactive(&ifp->if_snd)) {
+ ifq_clr_oactive(&ifp->if_snd);
(*ifp->if_start)(ifp);
}
}
@@ -1895,12 +1895,12 @@ wpi_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. */
@@ -3309,7 +3309,7 @@ wpi_init(struct ifnet *ifp)
goto fail;
}
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;
if (ic->ic_opmode != IEEE80211_M_MONITOR)
@@ -3330,7 +3330,8 @@ wpi_stop(struct ifnet *ifp, int disable)
struct ieee80211com *ic = &sc->sc_ic;
ifp->if_timer = sc->sc_tx_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/pci/if_xge.c b/sys/dev/pci/if_xge.c
index 04d3c588541..912dc2b8e7d 100644
--- a/sys/dev/pci/if_xge.c
+++ b/sys/dev/pci/if_xge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xge.c,v 1.66 2015/11/24 17:11:40 mpi Exp $ */
+/* $OpenBSD: if_xge.c,v 1.67 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */
/*
@@ -769,7 +769,7 @@ xge_init(struct ifnet *ifp)
/* Done... */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
@@ -782,7 +782,8 @@ xge_stop(struct ifnet *ifp, int disable)
struct xge_softc *sc = ifp->if_softc;
uint64_t val;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
val = PIF_RCSR(ADAPTER_CONTROL);
val &= ~ADAPTER_EN;
@@ -849,7 +850,7 @@ xge_intr(void *pv)
}
if (sc->sc_lasttx != lasttx)
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* Try to get more packets on the wire */
xge_start(ifp);
@@ -1062,7 +1063,7 @@ xge_start(struct ifnet *ifp)
uint64_t par, lcr;
int nexttx = 0, ntxd, error, i;
- if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
par = lcr = 0;
diff --git a/sys/dev/pcmcia/if_malo.c b/sys/dev/pcmcia/if_malo.c
index 5a98cb117b2..1223001a4ad 100644
--- a/sys/dev/pcmcia/if_malo.c
+++ b/sys/dev/pcmcia/if_malo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_malo.c,v 1.88 2015/11/20 03:35:23 dlg Exp $ */
+/* $OpenBSD: if_malo.c,v 1.89 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -716,7 +716,7 @@ cmalo_init(struct ifnet *ifp)
/* device up */
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
/* start network */
if (ic->ic_opmode != IEEE80211_M_MONITOR)
@@ -739,7 +739,8 @@ cmalo_stop(struct malo_softc *sc)
struct ifnet *ifp = &ic->ic_if;
/* device down */
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_flags &= ~IFF_RUNNING;
+ ifq_clr_oactive(&ifp->if_snd);
/* change device back to initial state */
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
@@ -989,7 +990,7 @@ cmalo_start(struct ifnet *ifp)
struct mbuf *m;
/* 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;
IFQ_DEQUEUE(&ifp->if_snd, m);
@@ -1011,7 +1012,7 @@ cmalo_watchdog(struct ifnet *ifp)
DPRINTF(2, "watchdog timeout\n");
/* accept TX packets again */
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
}
int
@@ -1051,7 +1052,7 @@ cmalo_tx(struct malo_softc *sc, struct mbuf *m)
MALO_WRITE_1(sc, MALO_REG_HOST_STATUS, MALO_VAL_TX_DL_OVER);
MALO_WRITE_2(sc, MALO_REG_CARD_INTR_CAUSE, MALO_VAL_TX_DL_OVER);
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
ifp->if_timer = 5;
DPRINTF(2, "%s: TX status=%d, pkglen=%d, pkgoffset=%d\n",
@@ -1071,7 +1072,7 @@ cmalo_tx_done(struct malo_softc *sc)
DPRINTF(2, "%s: TX done\n", sc->sc_dev.dv_xname);
ifp->if_opackets++;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_timer = 0;
cmalo_start(ifp);
}
diff --git a/sys/dev/pcmcia/if_xe.c b/sys/dev/pcmcia/if_xe.c
index 21cfd38550f..76e62545a2f 100644
--- a/sys/dev/pcmcia/if_xe.c
+++ b/sys/dev/pcmcia/if_xe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xe.c,v 1.55 2015/11/24 13:33:18 mpi Exp $ */
+/* $OpenBSD: if_xe.c,v 1.56 2015/11/25 03:09:59 dlg Exp $ */
/*
* Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas
@@ -1064,7 +1064,7 @@ xe_init(sc)
mii_mediachg(&sc->sc_mii);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
}
@@ -1085,7 +1085,7 @@ xe_start(ifp)
u_int16_t space;
/* Don't transmit if interface is busy or not running. */
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
/* Peek at the next packet. */
diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c
index a6e58d7ffa4..dacb19acb80 100644
--- a/sys/dev/sbus/be.c
+++ b/sys/dev/sbus/be.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: be.c,v 1.37 2015/11/24 17:11:40 mpi Exp $ */
+/* $OpenBSD: be.c,v 1.38 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: be.c,v 1.26 2001/03/20 15:39:20 pk Exp $ */
/*-
@@ -570,7 +570,7 @@ bestart(struct ifnet *ifp)
unsigned int bix, len;
unsigned int ntbuf = sc->sc_rb.rb_ntbuf;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
bix = sc->sc_rb.rb_tdhead;
@@ -606,7 +606,7 @@ bestart(struct ifnet *ifp)
bix = 0;
if (++sc->sc_rb.rb_td_nbusy == ntbuf) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
}
@@ -851,7 +851,7 @@ betint(struct be_softc *sc)
if (txflags & QEC_XD_OWN)
break;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_opackets++;
if (++bix == QEC_XD_RING_MAXSIZE)
@@ -1060,7 +1060,7 @@ beinit(struct be_softc *sc)
bus_space_write_4(t, br, BE_BRI_RXCFG, v);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
be_ifmedia_upd(ifp);
timeout_add_sec(&sc->sc_tick_ch, 1);
diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c
index 12bfbc56a7d..108f64047de 100644
--- a/sys/dev/sbus/qe.c
+++ b/sys/dev/sbus/qe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qe.c,v 1.35 2015/11/24 17:11:40 mpi Exp $ */
+/* $OpenBSD: qe.c,v 1.36 2015/11/25 03:09:59 dlg Exp $ */
/* $NetBSD: qe.c,v 1.16 2001/03/30 17:30:18 christos Exp $ */
/*-
@@ -442,7 +442,7 @@ qestart(ifp)
unsigned int bix, len;
unsigned int ntbuf = sc->sc_rb.rb_ntbuf;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd))
return;
bix = sc->sc_rb.rb_tdhead;
@@ -479,7 +479,7 @@ qestart(ifp)
bix = 0;
if (++sc->sc_rb.rb_td_nbusy == ntbuf) {
- ifp->if_flags |= IFF_OACTIVE;
+ ifq_set_oactive(&ifp->if_snd);
break;
}
}
@@ -628,7 +628,7 @@ qe_tint(sc)
if (txflags & QEC_XD_OWN)
break;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
ifp->if_opackets++;
if (++bix == QEC_XD_RING_MAXSIZE)
@@ -642,8 +642,8 @@ qe_tint(sc)
if (sc->sc_rb.rb_tdtail != bix) {
sc->sc_rb.rb_tdtail = bix;
- if (ifp->if_flags & IFF_OACTIVE) {
- ifp->if_flags &= ~IFF_OACTIVE;
+ if (ifq_is_oactive(&ifp->if_snd)) {
+ ifq_clr_oactive(&ifp->if_snd);
qestart(ifp);
}
}
@@ -1039,7 +1039,7 @@ qeinit(sc)
qe_mcreset(sc);
ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifq_clr_oactive(&ifp->if_snd);
splx(s);
}
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 */
diff --git a/sys/net/if.c b/sys/net/if.c
index e54741aaa43..a3128706d7d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.412 2015/11/21 01:08:49 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.413 2015/11/25 03:10:00 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -539,7 +539,7 @@ if_start(struct ifnet *ifp)
splassert(IPL_NET);
if (ifq_len(&ifp->if_snd) >= min(8, ifp->if_snd.ifq_maxlen) &&
- !ISSET(ifp->if_flags, IFF_OACTIVE)) {
+ !ifq_is_oactive(&ifp->if_snd)) {
if (ISSET(ifp->if_xflags, IFXF_TXREADY)) {
TAILQ_REMOVE(&iftxlist, ifp, if_txlist);
CLR(ifp->if_xflags, IFXF_TXREADY);
@@ -866,8 +866,9 @@ if_detach(struct ifnet *ifp)
/* Undo pseudo-driver changes. */
if_deactivate(ifp);
+ ifq_clr_oactive(&ifp->if_snd);
+
s = splnet();
- ifp->if_flags &= ~IFF_OACTIVE;
ifp->if_start = if_detached_start;
ifp->if_ioctl = if_detached_ioctl;
ifp->if_watchdog = NULL;
@@ -1634,6 +1635,8 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
case SIOCGIFFLAGS:
ifr->ifr_flags = ifp->if_flags;
+ if (ifq_is_oactive(&ifp->if_snd))
+ ifr->ifr_flags |= IFF_OACTIVE;
break;
case SIOCGIFXFLAGS:
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 30e21d757a0..13b72b555e2 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_var.h,v 1.57 2015/11/23 15:53:35 mpi Exp $ */
+/* $OpenBSD: if_var.h,v 1.58 2015/11/25 03:10:00 dlg Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -118,6 +118,7 @@ struct ifqueue {
void *ifq_q;
unsigned int ifq_len;
unsigned int ifq_serializer;
+ unsigned int ifq_oactive;
unsigned int ifq_maxlen;
};
@@ -288,6 +289,24 @@ void ifq_q_leave(struct ifqueue *, void *);
#define ifq_empty(_ifq) (ifq_len(_ifq) == 0)
#define ifq_set_maxlen(_ifq, _l) ((_ifq)->ifq_maxlen = (_l))
+static inline void
+ifq_set_oactive(struct ifqueue *ifq)
+{
+ ifq->ifq_oactive = 1;
+}
+
+static inline void
+ifq_clr_oactive(struct ifqueue *ifq)
+{
+ ifq->ifq_oactive = 0;
+}
+
+static inline unsigned int
+ifq_is_oactive(struct ifqueue *ifq)
+{
+ return (ifq->ifq_oactive);
+}
+
extern const struct ifq_ops * const ifq_priq_ops;
#define IFQ_MAXLEN 256
diff --git a/sys/net80211/ieee80211_pae_output.c b/sys/net80211/ieee80211_pae_output.c
index 210371496f2..ee67d54e643 100644
--- a/sys/net80211/ieee80211_pae_output.c
+++ b/sys/net80211/ieee80211_pae_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_pae_output.c,v 1.25 2015/11/24 13:45:06 mpi Exp $ */
+/* $OpenBSD: ieee80211_pae_output.c,v 1.26 2015/11/25 03:10:00 dlg Exp $ */
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
@@ -128,7 +128,7 @@ ieee80211_send_eapol_key(struct ieee80211com *ic, struct mbuf *m,
IFQ_ENQUEUE(&ifp->if_snd, m, error);
if (error == 0) {
ifp->if_obytes += len;
- if ((ifp->if_flags & IFF_OACTIVE) == 0)
+ if (!ifq_is_oactive(&ifp->if_snd))
(*ifp->if_start)(ifp);
}
splx(s);