Index: share/man/man9/Makefile =================================================================== RCS file: /cvs/src/share/man/man9/Makefile,v retrieving revision 1.260 diff -u -p -r1.260 Makefile --- share/man/man9/Makefile 23 Nov 2015 10:45:26 -0000 1.260 +++ share/man/man9/Makefile 23 Nov 2015 14:06:53 -0000 @@ -217,7 +217,9 @@ MLINKS+=if_rxr_init.9 if_rxr_get.9 if_rx 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 \ Index: share/man/man9/ifq_enqueue.9 =================================================================== RCS file: /cvs/src/share/man/man9/ifq_enqueue.9,v retrieving revision 1.3 diff -u -p -r1.3 ifq_enqueue.9 --- share/man/man9/ifq_enqueue.9 23 Nov 2015 11:07:58 -0000 1.3 +++ share/man/man9/ifq_enqueue.9 23 Nov 2015 14:06:53 -0000 @@ -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 Index: sys/arch/armv7/imx/imxenet.c =================================================================== RCS file: /cvs/src/sys/arch/armv7/imx/imxenet.c,v retrieving revision 1.18 diff -u -p -r1.18 imxenet.c --- sys/arch/armv7/imx/imxenet.c 20 Nov 2015 03:35:22 -0000 1.18 +++ sys/arch/armv7/imx/imxenet.c 23 Nov 2015 13:55:27 -0000 @@ -698,7 +698,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); @@ -715,8 +715,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); @@ -812,7 +813,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 (;;) { @@ -822,7 +823,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; } Index: sys/arch/armv7/omap/if_cpsw.c =================================================================== RCS file: /cvs/src/sys/arch/armv7/omap/if_cpsw.c,v retrieving revision 1.29 diff -u -p -r1.29 if_cpsw.c --- sys/arch/armv7/omap/if_cpsw.c 12 Nov 2015 10:23:08 -0000 1.29 +++ sys/arch/armv7/omap/if_cpsw.c 23 Nov 2015 13:55:27 -0000 @@ -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)) == Index: sys/arch/armv7/sunxi/sxie.c =================================================================== RCS file: /cvs/src/sys/arch/armv7/sunxi/sxie.c,v retrieving revision 1.11 diff -u -p -r1.11 sxie.c --- sys/arch/armv7/sunxi/sxie.c 20 Nov 2015 03:35:22 -0000 1.11 +++ sys/arch/armv7/sunxi/sxie.c 23 Nov 2015 13:55:27 -0000 @@ -397,7 +397,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); @@ -427,7 +427,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 */ @@ -462,9 +462,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]; @@ -485,7 +485,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; } @@ -525,8 +525,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 Index: sys/arch/macppc/dev/if_bm.c =================================================================== RCS file: /cvs/src/sys/arch/macppc/dev/if_bm.c,v retrieving revision 1.37 diff -u -p -r1.37 if_bm.c --- sys/arch/macppc/dev/if_bm.c 14 Nov 2015 17:26:40 -0000 1.37 +++ sys/arch/macppc/dev/if_bm.c 23 Nov 2015 13:55:28 -0000 @@ -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 */ Index: sys/arch/macppc/dev/if_mc.c =================================================================== RCS file: /cvs/src/sys/arch/macppc/dev/if_mc.c,v retrieving revision 1.24 diff -u -p -r1.24 if_mc.c --- sys/arch/macppc/dev/if_mc.c 14 Nov 2015 17:26:40 -0000 1.24 +++ sys/arch/macppc/dev/if_mc.c 23 Nov 2015 13:55:28 -0000 @@ -547,11 +547,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); @@ -570,7 +570,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 */ @@ -648,7 +648,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); } @@ -670,7 +670,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); @@ -776,7 +777,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); } Index: sys/arch/octeon/dev/if_cnmac.c =================================================================== RCS file: /cvs/src/sys/arch/octeon/dev/if_cnmac.c,v retrieving revision 1.33 diff -u -p -r1.33 if_cnmac.c --- sys/arch/octeon/dev/if_cnmac.c 21 Nov 2015 05:11:32 -0000 1.33 +++ sys/arch/octeon/dev/if_cnmac.c 23 Nov 2015 13:55:28 -0000 @@ -1007,7 +1007,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))) @@ -1064,7 +1064,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); @@ -1098,7 +1098,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; } @@ -1117,7 +1117,8 @@ octeon_eth_stop(struct ifnet *ifp, int d 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); Index: sys/arch/sgi/dev/if_iec.c =================================================================== RCS file: /cvs/src/sys/arch/sgi/dev/if_iec.c,v retrieving revision 1.17 diff -u -p -r1.17 if_iec.c --- sys/arch/sgi/dev/if_iec.c 20 Nov 2015 03:35:22 -0000 1.17 +++ sys/arch/sgi/dev/if_iec.c 23 Nov 2015 13:55:28 -0000 @@ -684,7 +684,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); @@ -746,7 +746,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; /* @@ -956,7 +956,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) { @@ -991,7 +991,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); @@ -1325,7 +1326,7 @@ iec_txintr(struct iec_softc *sc, uint32_ 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; Index: sys/arch/sgi/dev/if_mec.c =================================================================== RCS file: /cvs/src/sys/arch/sgi/dev/if_mec.c,v retrieving revision 1.32 diff -u -p -r1.32 if_mec.c --- sys/arch/sgi/dev/if_mec.c 20 Nov 2015 03:35:22 -0000 1.32 +++ sys/arch/sgi/dev/if_mec.c 23 Nov 2015 13:55:28 -0000 @@ -670,7 +670,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); @@ -724,7 +724,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; /* @@ -962,7 +962,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) { @@ -1003,7 +1003,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); @@ -1330,7 +1331,7 @@ mec_txintr(struct mec_softc *sc, uint32_ 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")); Index: sys/arch/sgi/hpc/if_sq.c =================================================================== RCS file: /cvs/src/sys/arch/sgi/hpc/if_sq.c,v retrieving revision 1.20 diff -u -p -r1.20 if_sq.c --- sys/arch/sgi/hpc/if_sq.c 21 Nov 2015 00:59:25 -0000 1.20 +++ sys/arch/sgi/hpc/if_sq.c 23 Nov 2015 13:55:28 -0000 @@ -550,7 +550,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; @@ -652,7 +652,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; /* @@ -748,7 +748,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); @@ -848,7 +848,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", @@ -950,7 +950,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) { @@ -1267,7 +1268,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) Index: sys/arch/socppc/dev/if_tsec.c =================================================================== RCS file: /cvs/src/sys/arch/socppc/dev/if_tsec.c,v retrieving revision 1.40 diff -u -p -r1.40 if_tsec.c --- sys/arch/socppc/dev/if_tsec.c 20 Nov 2015 03:35:22 -0000 1.40 +++ sys/arch/socppc/dev/if_tsec.c 23 Nov 2015 13:55:28 -0000 @@ -518,7 +518,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; @@ -534,7 +534,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) { @@ -829,7 +829,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--; @@ -1032,7 +1032,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 | @@ -1051,7 +1051,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); Index: sys/arch/sparc/dev/be.c =================================================================== RCS file: /cvs/src/sys/arch/sparc/dev/be.c,v retrieving revision 1.54 diff -u -p -r1.54 be.c --- sys/arch/sparc/dev/be.c 14 Nov 2015 17:26:40 -0000 1.54 +++ sys/arch/sparc/dev/be.c 23 Nov 2015 13:55:28 -0000 @@ -253,7 +253,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; @@ -290,7 +290,7 @@ bestart(ifp) bix = 0; if (++cnt == BE_TX_RING_SIZE) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } @@ -471,7 +471,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) { @@ -716,7 +716,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); Index: sys/arch/sparc/dev/hme.c =================================================================== RCS file: /cvs/src/sys/arch/sparc/dev/hme.c,v retrieving revision 1.73 diff -u -p -r1.73 hme.c --- sys/arch/sparc/dev/hme.c 14 Nov 2015 17:26:40 -0000 1.73 +++ sys/arch/sparc/dev/hme.c 23 Nov 2015 13:55:29 -0000 @@ -274,7 +274,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; @@ -309,7 +309,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; } } @@ -331,7 +331,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); @@ -573,7 +574,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 @@ -671,7 +672,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) Index: sys/arch/sparc/dev/if_ie.c =================================================================== RCS file: /cvs/src/sys/arch/sparc/dev/if_ie.c,v retrieving revision 1.56 diff -u -p -r1.56 if_ie.c --- sys/arch/sparc/dev/if_ie.c 14 Nov 2015 17:26:40 -0000 1.56 +++ sys/arch/sparc/dev/if_ie.c 23 Nov 2015 13:55:29 -0000 @@ -821,7 +821,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; @@ -1308,7 +1308,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; @@ -1408,7 +1408,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); /* Index: sys/arch/sparc/dev/qe.c =================================================================== RCS file: /cvs/src/sys/arch/sparc/dev/qe.c,v retrieving revision 1.44 diff -u -p -r1.44 qe.c --- sys/arch/sparc/dev/qe.c 14 Nov 2015 17:26:40 -0000 1.44 +++ sys/arch/sparc/dev/qe.c 23 Nov 2015 13:55:29 -0000 @@ -194,7 +194,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; @@ -230,7 +230,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; } } @@ -357,8 +357,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); } } @@ -719,7 +719,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); Index: sys/arch/sparc64/dev/vnet.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/dev/vnet.c,v retrieving revision 1.48 diff -u -p -r1.48 vnet.c --- sys/arch/sparc64/dev/vnet.c 20 Nov 2015 03:35:22 -0000 1.48 +++ sys/arch/sparc64/dev/vnet.c 23 Nov 2015 13:55:29 -0000 @@ -662,7 +662,7 @@ vnet_rx_vio_rdx(struct vnet_softc *sc, s vnet_setmulti(sc, 1); KERNEL_LOCK(); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); vnet_start(ifp); KERNEL_UNLOCK(); } @@ -891,7 +891,7 @@ vnet_rx_vio_dring_data(struct vnet_softc 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; @@ -1066,7 +1066,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)) @@ -1090,7 +1090,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; } @@ -1109,14 +1109,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); @@ -1186,14 +1186,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); @@ -1431,7 +1431,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); Index: sys/arch/vax/if/if_de.c =================================================================== RCS file: /cvs/src/sys/arch/vax/if/if_de.c,v retrieving revision 1.32 diff -u -p -r1.32 if_de.c --- sys/arch/vax/if/if_de.c 6 Nov 2015 07:08:42 -0000 1.32 +++ sys/arch/vax/if/if_de.c 23 Nov 2015 13:55:29 -0000 @@ -223,7 +223,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"); @@ -348,7 +349,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); @@ -402,7 +403,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 @@ -453,7 +454,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) { @@ -580,7 +581,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); Index: sys/arch/vax/if/if_qe.c =================================================================== RCS file: /cvs/src/sys/arch/vax/if/if_qe.c,v retrieving revision 1.38 diff -u -p -r1.38 if_qe.c --- sys/arch/vax/if/if_qe.c 20 Nov 2015 03:35:22 -0000 1.38 +++ sys/arch/vax/if/if_qe.c 23 Nov 2015 13:55:29 -0000 @@ -408,7 +408,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. @@ -458,7 +458,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; } @@ -526,7 +526,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 */ @@ -603,7 +603,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 */ } /* Index: sys/arch/vax/if/sgec.c =================================================================== RCS file: /cvs/src/sys/arch/vax/if/sgec.c,v retrieving revision 1.32 diff -u -p -r1.32 sgec.c --- sys/arch/vax/if/sgec.c 14 Nov 2015 17:26:40 -0000 1.32 +++ sys/arch/vax/if/sgec.c 23 Nov 2015 13:55:29 -0000 @@ -318,7 +318,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. @@ -394,11 +394,19 @@ zestart(ifp) for (m0 = m, i = 0; m0; m0 = m0->m_next) if (m0->m_len) i++; - if (i >= TXDESCS) - panic("zestart"); /* XXX */ + if (i >= TXDESCS) { + if (m_defrag(m, M_NOWAIT) != 0) { + IFQ_DEQUEUE(&sc->sc_if.if_snd, m); + m_freem(m); + continue; + } + for (m0 = m, i = 0; m0; m0 = m0->m_next) + if (m0->m_len) + i++; + } 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); @@ -451,7 +459,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 */ @@ -567,7 +575,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 */ } Index: sys/dev/ic/acx.c =================================================================== RCS file: /cvs/src/sys/dev/ic/acx.c,v retrieving revision 1.114 diff -u -p -r1.114 acx.c --- sys/dev/ic/acx.c 4 Nov 2015 12:11:59 -0000 1.114 +++ sys/dev/ic/acx.c 23 Nov 2015 13:55:29 -0000 @@ -479,7 +479,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 */ @@ -612,7 +612,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 */ @@ -912,7 +913,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; /* @@ -1068,7 +1069,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; @@ -1218,7 +1219,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); } } Index: sys/dev/ic/aic6915.c =================================================================== RCS file: /cvs/src/sys/dev/ic/aic6915.c,v retrieving revision 1.19 diff -u -p -r1.19 aic6915.c --- sys/dev/ic/aic6915.c 20 Nov 2015 03:35:22 -0000 1.19 +++ sys/dev/ic/aic6915.c 23 Nov 2015 13:55:29 -0000 @@ -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; } Index: sys/dev/ic/am7990.c =================================================================== RCS file: /cvs/src/sys/dev/ic/am7990.c,v retrieving revision 1.51 diff -u -p -r1.51 am7990.c --- sys/dev/ic/am7990.c 13 May 2015 10:42:46 -0000 1.51 +++ sys/dev/ic/am7990.c 23 Nov 2015 13:55:29 -0000 @@ -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; } Index: sys/dev/ic/am79900.c =================================================================== RCS file: /cvs/src/sys/dev/ic/am79900.c,v retrieving revision 1.5 diff -u -p -r1.5 am79900.c --- sys/dev/ic/am79900.c 13 May 2015 10:42:46 -0000 1.5 +++ sys/dev/ic/am79900.c 23 Nov 2015 13:55:29 -0000 @@ -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; } Index: sys/dev/ic/an.c =================================================================== RCS file: /cvs/src/sys/dev/ic/an.c,v retrieving revision 1.67 diff -u -p -r1.67 an.c --- sys/dev/ic/an.c 20 Nov 2015 03:35:22 -0000 1.67 +++ sys/dev/ic/an.c 23 Nov 2015 13:55:29 -0000 @@ -490,7 +490,7 @@ an_txeof(struct an_softc *sc, u_int16_t 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)); @@ -565,7 +565,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); @@ -1062,7 +1062,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); @@ -1106,7 +1106,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); @@ -1244,7 +1244,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) Index: sys/dev/ic/ar5008.c =================================================================== RCS file: /cvs/src/sys/dev/ic/ar5008.c,v retrieving revision 1.30 diff -u -p -r1.30 ar5008.c --- sys/dev/ic/ar5008.c 4 Nov 2015 12:11:59 -0000 1.30 +++ sys/dev/ic/ar5008.c 23 Nov 2015 13:55:29 -0000 @@ -1035,7 +1035,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); } } Index: sys/dev/ic/ar9003.c =================================================================== RCS file: /cvs/src/sys/dev/ic/ar9003.c,v retrieving revision 1.34 diff -u -p -r1.34 ar9003.c --- sys/dev/ic/ar9003.c 4 Nov 2015 12:11:59 -0000 1.34 +++ sys/dev/ic/ar9003.c 23 Nov 2015 13:55:30 -0000 @@ -1167,7 +1167,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); } } Index: sys/dev/ic/ath.c =================================================================== RCS file: /cvs/src/sys/dev/ic/ath.c,v retrieving revision 1.107 diff -u -p -r1.107 ath.c --- sys/dev/ic/ath.c 4 Nov 2015 12:11:59 -0000 1.107 +++ sys/dev/ic/ath.c 23 Nov 2015 13:55:30 -0000 @@ -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; } Index: sys/dev/ic/athn.c =================================================================== RCS file: /cvs/src/sys/dev/ic/athn.c,v retrieving revision 1.88 diff -u -p -r1.88 athn.c --- sys/dev/ic/athn.c 4 Nov 2015 12:11:59 -0000 1.88 +++ sys/dev/ic/athn.c 23 Nov 2015 13:55:30 -0000 @@ -2540,12 +2540,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. */ @@ -2791,7 +2791,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 @@ -2820,7 +2820,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". */ Index: sys/dev/ic/atw.c =================================================================== RCS file: /cvs/src/sys/dev/ic/atw.c,v retrieving revision 1.90 diff -u -p -r1.90 atw.c --- sys/dev/ic/atw.c 4 Nov 2015 12:11:59 -0000 1.90 +++ sys/dev/ic/atw.c 23 Nov 2015 13:55:30 -0000 @@ -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) { Index: sys/dev/ic/bwi.c =================================================================== RCS file: /cvs/src/sys/dev/ic/bwi.c,v retrieving revision 1.121 diff -u -p -r1.121 bwi.c --- sys/dev/ic/bwi.c 12 Nov 2015 10:25:03 -0000 1.121 +++ sys/dev/ic/bwi.c 23 Nov 2015 13:55:31 -0000 @@ -7088,7 +7088,7 @@ bwi_init_statechg(struct bwi_softc *sc, 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 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_ 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); } Index: sys/dev/ic/dc.c =================================================================== RCS file: /cvs/src/sys/dev/ic/dc.c,v retrieving revision 1.146 diff -u -p -r1.146 dc.c --- sys/dev/ic/dc.c 20 Nov 2015 03:35:22 -0000 1.146 +++ sys/dev/ic/dc.c 23 Nov 2015 13:55:31 -0000 @@ -2276,7 +2276,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; } @@ -2612,7 +2612,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; @@ -2630,7 +2630,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; } } @@ -2639,7 +2639,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; } @@ -2658,7 +2658,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; } } @@ -2836,7 +2836,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); @@ -2994,7 +2994,8 @@ dc_stop(struct dc_softc *sc, int softonl 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)); Index: sys/dev/ic/dp8390.c =================================================================== RCS file: /cvs/src/sys/dev/ic/dp8390.c,v retrieving revision 1.56 diff -u -p -r1.56 dp8390.c --- sys/dev/ic/dp8390.c 25 Oct 2015 12:48:46 -0000 1.56 +++ sys/dev/ic/dp8390.c 23 Nov 2015 13:55:31 -0000 @@ -357,7 +357,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); @@ -429,14 +429,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); @@ -704,7 +704,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 Index: sys/dev/ic/elink3.c =================================================================== RCS file: /cvs/src/sys/dev/ic/elink3.c,v retrieving revision 1.89 diff -u -p -r1.89 elink3.c --- sys/dev/ic/elink3.c 20 Nov 2015 03:35:22 -0000 1.89 +++ sys/dev/ic/elink3.c 23 Nov 2015 13:55:31 -0000 @@ -662,7 +662,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); @@ -949,7 +949,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: @@ -984,7 +984,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, @@ -1183,7 +1183,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; } @@ -1221,7 +1221,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) { @@ -1491,7 +1491,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); Index: sys/dev/ic/fxp.c =================================================================== RCS file: /cvs/src/sys/dev/ic/fxp.c,v retrieving revision 1.124 diff -u -p -r1.124 fxp.c --- sys/dev/ic/fxp.c 20 Nov 2015 03:35:22 -0000 1.124 +++ sys/dev/ic/fxp.c 23 Nov 2015 13:55:31 -0000 @@ -678,12 +678,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; } @@ -848,7 +848,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; @@ -1076,7 +1076,8 @@ fxp_stop(struct fxp_softc *sc, int drain * 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); @@ -1428,7 +1429,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 Index: sys/dev/ic/gem.c =================================================================== RCS file: /cvs/src/sys/dev/ic/gem.c,v retrieving revision 1.115 diff -u -p -r1.115 gem.c --- sys/dev/ic/gem.c 20 Nov 2015 03:35:22 -0000 1.115 +++ sys/dev/ic/gem.c 23 Nov 2015 13:55:31 -0000 @@ -529,7 +529,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) { @@ -836,7 +837,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); @@ -1634,7 +1635,7 @@ gem_tint(struct gem_softc *sc, u_int32_t 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; @@ -1653,7 +1654,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) { @@ -1686,7 +1687,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; } Index: sys/dev/ic/hme.c =================================================================== RCS file: /cvs/src/sys/dev/ic/hme.c,v retrieving revision 1.76 diff -u -p -r1.76 hme.c --- sys/dev/ic/hme.c 20 Nov 2015 03:35:22 -0000 1.76 +++ sys/dev/ic/hme.c 23 Nov 2015 13:55:31 -0000 @@ -383,7 +383,8 @@ hme_stop(struct hme_softc *sc, int softo /* * 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) { @@ -624,7 +625,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); } @@ -640,7 +641,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) { @@ -673,7 +674,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; } @@ -762,7 +763,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++; Index: sys/dev/ic/i82596.c =================================================================== RCS file: /cvs/src/sys/dev/ic/i82596.c,v retrieving revision 1.45 diff -u -p -r1.45 i82596.c --- sys/dev/ic/i82596.c 25 Oct 2015 12:48:46 -0000 1.45 +++ sys/dev/ic/i82596.c 23 Nov 2015 13:55:31 -0000 @@ -726,7 +726,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) { @@ -1216,12 +1216,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; } @@ -1355,7 +1355,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. @@ -1785,7 +1785,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; Index: sys/dev/ic/if_wi.c =================================================================== RCS file: /cvs/src/sys/dev/ic/if_wi.c,v retrieving revision 1.164 diff -u -p -r1.164 if_wi.c --- sys/dev/ic/if_wi.c 25 Oct 2015 12:48:46 -0000 1.164 +++ sys/dev/ic/if_wi.c 23 Nov 2015 13:55:31 -0000 @@ -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; Index: sys/dev/ic/lance.c =================================================================== RCS file: /cvs/src/sys/dev/ic/lance.c,v retrieving revision 1.9 diff -u -p -r1.9 lance.c --- sys/dev/ic/lance.c 25 Oct 2015 12:48:46 -0000 1.9 +++ sys/dev/ic/lance.c 23 Nov 2015 13:55:32 -0000 @@ -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 Index: sys/dev/ic/lemac.c =================================================================== RCS file: /cvs/src/sys/dev/ic/lemac.c,v retrieving revision 1.23 diff -u -p -r1.23 lemac.c --- sys/dev/ic/lemac.c 20 Nov 2015 03:35:22 -0000 1.23 +++ sys/dev/ic/lemac.c 23 Nov 2015 13:55:32 -0000 @@ -168,7 +168,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); } @@ -191,7 +191,7 @@ lemac_txd_intr(struct lemac_softc *sc, u /* 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 @@ -506,7 +506,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); @@ -649,7 +649,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; } @@ -664,7 +664,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; } Index: sys/dev/ic/malo.c =================================================================== RCS file: /cvs/src/sys/dev/ic/malo.c,v retrieving revision 1.110 diff -u -p -r1.110 malo.c --- sys/dev/ic/malo.c 16 Nov 2015 10:03:01 -0000 1.110 +++ sys/dev/ic/malo.c 23 Nov 2015 13:55:32 -0000 @@ -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); } Index: sys/dev/ic/mtd8xx.c =================================================================== RCS file: /cvs/src/sys/dev/ic/mtd8xx.c,v retrieving revision 1.28 diff -u -p -r1.28 mtd8xx.c --- sys/dev/ic/mtd8xx.c 25 Oct 2015 12:48:46 -0000 1.28 +++ sys/dev/ic/mtd8xx.c 23 Nov 2015 13:55:32 -0000 @@ -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 == Index: sys/dev/ic/pgt.c =================================================================== RCS file: /cvs/src/sys/dev/ic/pgt.c,v retrieving revision 1.80 diff -u -p -r1.80 pgt.c --- sys/dev/ic/pgt.c 20 Nov 2015 03:35:22 -0000 1.80 +++ sys/dev/ic/pgt.c 23 Nov 2015 13:55:32 -0000 @@ -551,7 +551,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); } @@ -749,8 +750,8 @@ pgt_update_intr(struct pgt_softc *sc, in 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]); @@ -2527,7 +2528,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); Index: sys/dev/ic/re.c =================================================================== RCS file: /cvs/src/sys/dev/ic/re.c,v retrieving revision 1.184 diff -u -p -r1.184 re.c --- sys/dev/ic/re.c 20 Nov 2015 03:35:22 -0000 1.184 +++ sys/dev/ic/re.c 23 Nov 2015 13:55:32 -0000 @@ -1491,7 +1491,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 @@ -1542,9 +1542,6 @@ re_intr(void *arg) if (!(ifp->if_flags & IFF_RUNNING)) return (0); - /* Disable interrupts. */ - CSR_WRITE_2(sc, RL_IMR, 0); - rx = tx = 0; status = CSR_READ_2(sc, RL_ISR); /* If the card has gone away the read returns 0xffff. */ @@ -1603,8 +1600,6 @@ re_intr(void *arg) re_start(ifp); - CSR_WRITE_2(sc, RL_IMR, sc->rl_intrs); - return (claimed); } @@ -1838,7 +1833,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; @@ -1855,14 +1850,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); @@ -2024,7 +2019,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); @@ -2147,7 +2142,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); Index: sys/dev/ic/rt2560.c =================================================================== RCS file: /cvs/src/sys/dev/ic/rt2560.c,v retrieving revision 1.76 diff -u -p -r1.76 rt2560.c --- sys/dev/ic/rt2560.c 20 Nov 2015 12:41:29 -0000 1.76 +++ sys/dev/ic/rt2560.c 23 Nov 2015 13:55:32 -0000 @@ -992,7 +992,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); } } @@ -1063,7 +1063,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); } } @@ -1924,13 +1924,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; } @@ -1949,7 +1949,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; } @@ -2677,8 +2677,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); @@ -2697,7 +2697,8 @@ rt2560_stop(struct ifnet *ifp, int disab 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 */ Index: sys/dev/ic/rt2661.c =================================================================== RCS file: /cvs/src/sys/dev/ic/rt2661.c,v retrieving revision 1.86 diff -u -p -r1.86 rt2661.c --- sys/dev/ic/rt2661.c 20 Nov 2015 12:41:29 -0000 1.86 +++ sys/dev/ic/rt2661.c 23 Nov 2015 13:55:32 -0000 @@ -1151,7 +1151,7 @@ rt2661_tx_dma_intr(struct rt2661_softc * 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); } } @@ -1929,13 +1929,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; } @@ -1952,7 +1952,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; } @@ -2708,8 +2708,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); @@ -2729,7 +2729,8 @@ rt2661_stop(struct ifnet *ifp, int disab 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); Index: sys/dev/ic/rt2860.c =================================================================== RCS file: /cvs/src/sys/dev/ic/rt2860.c,v retrieving revision 1.83 diff -u -p -r1.83 rt2860.c --- sys/dev/ic/rt2860.c 4 Nov 2015 12:11:59 -0000 1.83 +++ sys/dev/ic/rt2860.c 23 Nov 2015 13:55:32 -0000 @@ -1181,7 +1181,7 @@ rt2860_tx_intr(struct rt2860_softc *sc, 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); } @@ -1739,12 +1739,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 */ @@ -3589,8 +3589,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 */ @@ -3619,7 +3619,8 @@ rt2860_stop(struct ifnet *ifp, int disab 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 */ Index: sys/dev/ic/rtl81x9.c =================================================================== RCS file: /cvs/src/sys/dev/ic/rtl81x9.c,v retrieving revision 1.92 diff -u -p -r1.92 rtl81x9.c --- sys/dev/ic/rtl81x9.c 25 Oct 2015 12:48:46 -0000 1.92 +++ sys/dev/ic/rtl81x9.c 23 Nov 2015 13:55:32 -0000 @@ -736,7 +736,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) @@ -897,7 +897,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 @@ -970,7 +970,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); @@ -1075,7 +1075,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); Index: sys/dev/ic/rtw.c =================================================================== RCS file: /cvs/src/sys/dev/ic/rtw.c,v retrieving revision 1.93 diff -u -p -r1.93 rtw.c --- sys/dev/ic/rtw.c 20 Nov 2015 03:35:22 -0000 1.93 +++ sys/dev/ic/rtw.c 23 Nov 2015 13:55:33 -0000 @@ -187,7 +187,7 @@ int rtw_txring_choose(struct rtw_softc 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, 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 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, 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 rt 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 rt 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 rt } 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 rt 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 */ Index: sys/dev/ic/smc83c170.c =================================================================== RCS file: /cvs/src/sys/dev/ic/smc83c170.c,v retrieving revision 1.24 diff -u -p -r1.24 smc83c170.c --- sys/dev/ic/smc83c170.c 20 Nov 2015 03:35:22 -0000 1.24 +++ sys/dev/ic/smc83c170.c 23 Nov 2015 13:55:33 -0000 @@ -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. */ Index: sys/dev/ic/smc91cxx.c =================================================================== RCS file: /cvs/src/sys/dev/ic/smc91cxx.c,v retrieving revision 1.43 diff -u -p -r1.43 smc91cxx.c --- sys/dev/ic/smc91cxx.c 20 Nov 2015 03:35:22 -0000 1.43 +++ sys/dev/ic/smc91cxx.c 23 Nov 2015 13:55:33 -0000 @@ -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; } Index: sys/dev/ic/ti.c =================================================================== RCS file: /cvs/src/sys/dev/ic/ti.c,v retrieving revision 1.20 diff -u -p -r1.20 ti.c --- sys/dev/ic/ti.c 20 Nov 2015 03:35:22 -0000 1.20 +++ sys/dev/ic/ti.c 23 Nov 2015 13:55:33 -0000 @@ -1670,7 +1670,7 @@ ti_txeof_tigon1(struct ti_softc *sc) } if (!active) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } void @@ -1714,7 +1714,7 @@ ti_txeof_tigon2(struct ti_softc *sc) } if (cur_tx != NULL) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } int @@ -1977,7 +1977,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; } @@ -2088,7 +2088,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 @@ -2290,7 +2290,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); Index: sys/dev/ic/xl.c =================================================================== RCS file: /cvs/src/sys/dev/ic/xl.c,v retrieving revision 1.127 diff -u -p -r1.127 xl.c --- sys/dev/ic/xl.c 25 Oct 2015 12:48:46 -0000 1.127 +++ sys/dev/ic/xl.c 23 Nov 2015 13:55:33 -0000 @@ -1291,7 +1291,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; @@ -1345,7 +1345,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; } @@ -1660,7 +1660,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; } } @@ -1784,7 +1784,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; @@ -1793,7 +1793,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; } @@ -2037,7 +2037,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); @@ -2298,7 +2298,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); Index: sys/dev/isa/if_ef_isapnp.c =================================================================== RCS file: /cvs/src/sys/dev/isa/if_ef_isapnp.c,v retrieving revision 1.32 diff -u -p -r1.32 if_ef_isapnp.c --- sys/dev/isa/if_ef_isapnp.c 20 Nov 2015 03:35:23 -0000 1.32 +++ sys/dev/isa/if_ef_isapnp.c 23 Nov 2015 13:55:33 -0000 @@ -239,7 +239,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: @@ -263,7 +263,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, @@ -441,7 +441,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); @@ -471,7 +471,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); @@ -525,7 +526,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) { @@ -588,7 +589,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; Index: sys/dev/isa/if_eg.c =================================================================== RCS file: /cvs/src/sys/dev/isa/if_eg.c,v retrieving revision 1.40 diff -u -p -r1.40 if_eg.c --- sys/dev/isa/if_eg.c 25 Oct 2015 13:13:06 -0000 1.40 +++ sys/dev/isa/if_eg.c 23 Nov 2015 13:55:33 -0000 @@ -476,7 +476,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); @@ -515,7 +515,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: @@ -524,7 +524,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) @@ -547,7 +547,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; } @@ -633,7 +633,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; Index: sys/dev/isa/if_el.c =================================================================== RCS file: /cvs/src/sys/dev/isa/if_el.c,v retrieving revision 1.28 diff -u -p -r1.28 if_el.c --- sys/dev/isa/if_el.c 25 Oct 2015 13:13:06 -0000 1.28 +++ sys/dev/isa/if_el.c 23 Nov 2015 13:55:33 -0000 @@ -274,7 +274,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); @@ -298,12 +298,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 @@ -386,7 +386,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); } Index: sys/dev/isa/if_ex.c =================================================================== RCS file: /cvs/src/sys/dev/isa/if_ex.c,v retrieving revision 1.42 diff -u -p -r1.42 if_ex.c --- sys/dev/isa/if_ex.c 20 Nov 2015 03:35:23 -0000 1.42 +++ sys/dev/isa/if_ex.c 23 Nov 2015 13:55:33 -0000 @@ -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); Index: sys/dev/isa/if_ie.c =================================================================== RCS file: /cvs/src/sys/dev/isa/if_ie.c,v retrieving revision 1.44 diff -u -p -r1.44 if_ie.c --- sys/dev/isa/if_ie.c 25 Oct 2015 13:13:06 -0000 1.44 +++ sys/dev/isa/if_ie.c 23 Nov 2015 13:55:33 -0000 @@ -937,7 +937,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; @@ -1359,12 +1359,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; } @@ -1981,7 +1981,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); Index: sys/dev/pci/if_age.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_age.c,v retrieving revision 1.30 diff -u -p -r1.30 if_age.c --- sys/dev/pci/if_age.c 9 Nov 2015 00:29:06 -0000 1.30 +++ sys/dev/pci/if_age.c 23 Nov 2015 13:55:33 -0000 @@ -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 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; Index: sys/dev/pci/if_alc.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_alc.c,v retrieving revision 1.36 diff -u -p -r1.36 if_alc.c --- sys/dev/pci/if_alc.c 9 Nov 2015 00:29:06 -0000 1.36 +++ sys/dev/pci/if_alc.c 23 Nov 2015 13:55:33 -0000 @@ -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); Index: sys/dev/pci/if_ale.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_ale.c,v retrieving revision 1.41 diff -u -p -r1.41 if_ale.c --- sys/dev/pci/if_ale.c 9 Nov 2015 00:29:06 -0000 1.41 +++ sys/dev/pci/if_ale.c 23 Nov 2015 13:55:33 -0000 @@ -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); Index: sys/dev/pci/if_bce.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_bce.c,v retrieving revision 1.48 diff -u -p -r1.48 if_bce.c --- sys/dev/pci/if_bce.c 20 Nov 2015 03:35:23 -0000 1.48 +++ sys/dev/pci/if_bce.c 23 Nov 2015 13:55:33 -0000 @@ -518,7 +518,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 */ @@ -588,7 +588,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. */ @@ -758,7 +758,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 @@ -901,7 +901,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; } @@ -969,7 +969,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. */ Index: sys/dev/pci/if_bge.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_bge.c,v retrieving revision 1.377 diff -u -p -r1.377 if_bge.c --- sys/dev/pci/if_bge.c 23 Nov 2015 10:52:43 -0000 1.377 +++ sys/dev/pci/if_bge.c 23 Nov 2015 13:55:34 -0000 @@ -3629,7 +3629,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; @@ -4095,7 +4095,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; @@ -4105,7 +4105,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; } @@ -4281,7 +4281,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); @@ -4553,7 +4553,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; /* Index: sys/dev/pci/if_bnx.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_bnx.c,v retrieving revision 1.116 diff -u -p -r1.116 if_bnx.c --- sys/dev/pci/if_bnx.c 20 Nov 2015 03:35:23 -0000 1.116 +++ sys/dev/pci/if_bnx.c 23 Nov 2015 13:55:34 -0000 @@ -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); Index: sys/dev/pci/if_cas.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_cas.c,v retrieving revision 1.44 diff -u -p -r1.44 if_cas.c --- sys/dev/pci/if_cas.c 20 Nov 2015 03:35:23 -0000 1.44 +++ sys/dev/pci/if_cas.c 23 Nov 2015 13:55:34 -0000 @@ -720,7 +720,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); @@ -1068,7 +1069,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); @@ -1842,7 +1843,7 @@ cas_tint(struct cas_softc *sc, u_int32_t 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; @@ -1858,7 +1859,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; @@ -1882,7 +1883,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; } Index: sys/dev/pci/if_de.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_de.c,v retrieving revision 1.127 diff -u -p -r1.127 if_de.c --- sys/dev/pci/if_de.c 20 Nov 2015 03:35:23 -0000 1.127 +++ sys/dev/pci/if_de.c 23 Nov 2015 13:55:34 -0000 @@ -412,7 +412,7 @@ tulip_linkup(tulip_softc_t * const sc, t 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; @@ -620,7 +620,7 @@ tulip_media_poll(tulip_softc_t * const s } 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; @@ -969,7 +969,7 @@ tulip_21041_media_poll(tulip_softc_t * c * 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; @@ -3037,7 +3037,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; } @@ -3160,7 +3160,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; } @@ -3561,7 +3561,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. @@ -3969,7 +3969,7 @@ tulip_txput(tulip_softc_t * const sc, st 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); @@ -3999,7 +3999,7 @@ tulip_txput(tulip_softc_t * const sc, st 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; Index: sys/dev/pci/if_em.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_em.c,v retrieving revision 1.312 diff -u -p -r1.312 if_em.c --- sys/dev/pci/if_em.c 20 Nov 2015 13:11:16 -0000 1.312 +++ sys/dev/pci/if_em.c 23 Nov 2015 13:55:34 -0000 @@ -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) Index: sys/dev/pci/if_et.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_et.c,v retrieving revision 1.31 diff -u -p -r1.31 if_et.c --- sys/dev/pci/if_et.c 14 Nov 2015 17:54:57 -0000 1.31 +++ sys/dev/pci/if_et.c 23 Nov 2015 13:55:34 -0000 @@ -471,7 +471,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 @@ -992,7 +993,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); @@ -1067,7 +1068,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; @@ -1077,13 +1078,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; } @@ -1930,7 +1931,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); } Index: sys/dev/pci/if_ipw.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_ipw.c,v retrieving revision 1.111 diff -u -p -r1.111 if_ipw.c --- sys/dev/pci/if_ipw.c 20 Nov 2015 03:35:23 -0000 1.111 +++ sys/dev/pci/if_ipw.c 23 Nov 2015 13:55:34 -0000 @@ -1035,7 +1035,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); } @@ -1300,7 +1300,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; } @@ -2023,7 +2023,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) @@ -2050,7 +2050,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. Index: sys/dev/pci/if_iwi.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_iwi.c,v retrieving revision 1.128 diff -u -p -r1.128 if_iwi.c --- sys/dev/pci/if_iwi.c 20 Nov 2015 03:35:23 -0000 1.128 +++ sys/dev/pci/if_iwi.c 23 Nov 2015 13:55:35 -0000 @@ -1138,7 +1138,7 @@ iwi_tx_intr(struct iwi_softc *sc, struct } sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); (*ifp->if_start)(ifp); } @@ -1390,7 +1390,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; } @@ -2293,7 +2293,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) @@ -2317,7 +2317,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; Index: sys/dev/pci/if_iwm.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v retrieving revision 1.63 diff -u -p -r1.63 if_iwm.c --- sys/dev/pci/if_iwm.c 4 Nov 2015 12:11:59 -0000 1.63 +++ sys/dev/pci/if_iwm.c 23 Nov 2015 13:55:35 -0000 @@ -3180,8 +3180,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 @@ -5557,7 +5557,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); @@ -5580,13 +5580,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; } @@ -5649,7 +5649,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); Index: sys/dev/pci/if_iwn.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.146 diff -u -p -r1.146 if_iwn.c --- sys/dev/pci/if_iwn.c 4 Nov 2015 12:11:59 -0000 1.146 +++ sys/dev/pci/if_iwn.c 23 Nov 2015 13:55:35 -0000 @@ -2299,8 +2299,8 @@ iwn_tx_done(struct iwn_softc *sc, struct 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); } } @@ -3037,12 +3037,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. */ @@ -6168,7 +6168,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) @@ -6190,7 +6190,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; Index: sys/dev/pci/if_ix.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_ix.c,v retrieving revision 1.128 diff -u -p -r1.128 if_ix.c --- sys/dev/pci/if_ix.c 20 Nov 2015 03:35:23 -0000 1.128 +++ sys/dev/pci/if_ix.c 23 Nov 2015 13:55:35 -0000 @@ -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) { Index: sys/dev/pci/if_ixgb.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_ixgb.c,v retrieving revision 1.67 diff -u -p -r1.67 if_ixgb.c --- sys/dev/pci/if_ixgb.c 20 Nov 2015 03:35:23 -0000 1.67 +++ sys/dev/pci/if_ixgb.c 23 Nov 2015 13:55:35 -0000 @@ -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) Index: sys/dev/pci/if_jme.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_jme.c,v retrieving revision 1.43 diff -u -p -r1.43 if_jme.c --- sys/dev/pci/if_jme.c 9 Nov 2015 00:29:06 -0000 1.43 +++ sys/dev/pci/if_jme.c 23 Nov 2015 13:55:35 -0000 @@ -251,7 +251,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); @@ -314,7 +315,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. */ @@ -1206,7 +1207,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; @@ -1220,7 +1221,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; } @@ -1566,7 +1567,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); @@ -2005,7 +2006,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); } @@ -2021,7 +2022,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); Index: sys/dev/pci/if_lge.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_lge.c,v retrieving revision 1.69 diff -u -p -r1.69 if_lge.c --- sys/dev/pci/if_lge.c 20 Nov 2015 03:35:23 -0000 1.69 +++ sys/dev/pci/if_lge.c 23 Nov 2015 13:55:35 -0000 @@ -794,7 +794,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 @@ -949,7 +949,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) { @@ -962,7 +962,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; } @@ -1109,7 +1109,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); @@ -1248,7 +1248,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); Index: sys/dev/pci/if_lii.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_lii.c,v retrieving revision 1.39 diff -u -p -r1.39 if_lii.c --- sys/dev/pci/if_lii.c 20 Nov 2015 03:35:23 -0000 1.39 +++ sys/dev/pci/if_lii.c 23 Nov 2015 13:55:35 -0000 @@ -730,7 +730,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; @@ -794,7 +794,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 (;;) { @@ -805,7 +805,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; } @@ -838,7 +838,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); @@ -982,7 +983,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) Index: sys/dev/pci/if_msk.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_msk.c,v retrieving revision 1.119 diff -u -p -r1.119 if_msk.c --- sys/dev/pci/if_msk.c 20 Nov 2015 03:35:23 -0000 1.119 +++ sys/dev/pci/if_msk.c 23 Nov 2015 13:55:35 -0000 @@ -1555,7 +1555,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; } @@ -1722,7 +1722,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; } @@ -2091,7 +2091,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); @@ -2110,7 +2110,8 @@ msk_stop(struct sk_if_softc *sc_if, int 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 */ Index: sys/dev/pci/if_myx.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_myx.c,v retrieving revision 1.86 diff -u -p -r1.86 if_myx.c --- sys/dev/pci/if_myx.c 19 Nov 2015 12:46:08 -0000 1.86 +++ sys/dev/pci/if_myx.c 23 Nov 2015 13:55:36 -0000 @@ -1203,7 +1203,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); @@ -1359,7 +1359,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]; @@ -1435,7 +1436,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(); } Index: sys/dev/pci/if_nep.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_nep.c,v retrieving revision 1.22 diff -u -p -r1.22 if_nep.c --- sys/dev/pci/if_nep.c 22 Nov 2015 00:42:24 -0000 1.22 +++ sys/dev/pci/if_nep.c 23 Nov 2015 13:55:36 -0000 @@ -1092,7 +1092,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++; @@ -1649,7 +1649,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. */ @@ -1686,7 +1686,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); @@ -1870,7 +1871,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; @@ -1883,7 +1884,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; } Index: sys/dev/pci/if_nfe.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_nfe.c,v retrieving revision 1.114 diff -u -p -r1.114 if_nfe.c --- sys/dev/pci/if_nfe.c 20 Nov 2015 03:35:23 -0000 1.114 +++ sys/dev/pci/if_nfe.c 23 Nov 2015 13:55:36 -0000 @@ -853,7 +853,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); } } @@ -970,7 +970,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 (;;) { @@ -980,7 +980,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; } @@ -1121,7 +1121,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; } @@ -1134,7 +1134,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); Index: sys/dev/pci/if_nge.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_nge.c,v retrieving revision 1.88 diff -u -p -r1.88 if_nge.c --- sys/dev/pci/if_nge.c 20 Nov 2015 03:35:23 -0000 1.88 +++ sys/dev/pci/if_nge.c 23 Nov 2015 13:55:36 -0000 @@ -1149,7 +1149,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--; @@ -1404,7 +1404,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) { @@ -1414,7 +1414,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; } @@ -1622,7 +1622,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); } @@ -1877,7 +1877,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); Index: sys/dev/pci/if_nxe.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_nxe.c,v retrieving revision 1.69 diff -u -p -r1.69 if_nxe.c --- sys/dev/pci/if_nxe.c 20 Nov 2015 03:35:23 -0000 1.69 +++ sys/dev/pci/if_nxe.c 23 Nov 2015 13:55:36 -0000 @@ -1171,7 +1171,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); @@ -1271,7 +1271,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 */ @@ -1308,12 +1309,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; } @@ -1329,7 +1330,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; } @@ -1437,7 +1438,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_flags); } return (rv); Index: sys/dev/pci/if_oce.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_oce.c,v retrieving revision 1.89 diff -u -p -r1.89 if_oce.c --- sys/dev/pci/if_oce.c 14 Nov 2015 17:54:57 -0000 1.89 +++ sys/dev/pci/if_oce.c 23 Nov 2015 13:55:36 -0000 @@ -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); } } Index: sys/dev/pci/if_pcn.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_pcn.c,v retrieving revision 1.39 diff -u -p -r1.39 if_pcn.c --- sys/dev/pci/if_pcn.c 20 Nov 2015 03:35:23 -0000 1.39 +++ sys/dev/pci/if_pcn.c 23 Nov 2015 13:55:36 -0000 @@ -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. */ Index: sys/dev/pci/if_rtwn.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_rtwn.c,v retrieving revision 1.8 diff -u -p -r1.8 if_rtwn.c --- sys/dev/pci/if_rtwn.c 4 Nov 2015 12:11:59 -0000 1.8 +++ sys/dev/pci/if_rtwn.c 23 Nov 2015 13:55:36 -0000 @@ -1849,7 +1849,7 @@ rtwn_tx_done(struct rtwn_softc *sc, int sc->qfullmsk &= ~(1 << qid); if (sc->qfullmsk == 0) { - ifp->if_flags &= (~IFF_OACTIVE); + ifq_clr_oactive(&ifp->if_snd); (*ifp->if_start)(ifp); } } @@ -1862,12 +1862,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. */ @@ -3411,7 +3411,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 @@ -3463,7 +3463,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); Index: sys/dev/pci/if_se.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_se.c,v retrieving revision 1.15 diff -u -p -r1.15 if_se.c --- sys/dev/pci/if_se.c 20 Nov 2015 03:35:23 -0000 1.15 +++ sys/dev/pci/if_se.c 23 Nov 2015 13:55:36 -0000 @@ -997,7 +997,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) @@ -1205,7 +1205,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", @@ -1223,7 +1223,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; } @@ -1307,7 +1307,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); @@ -1421,7 +1421,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); Index: sys/dev/pci/if_sis.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_sis.c,v retrieving revision 1.129 diff -u -p -r1.129 if_sis.c --- sys/dev/pci/if_sis.c 20 Nov 2015 03:35:23 -0000 1.129 +++ sys/dev/pci/if_sis.c 23 Nov 2015 13:55:36 -0000 @@ -1506,7 +1506,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; @@ -1673,7 +1673,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) { @@ -1683,7 +1683,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; } @@ -1840,7 +1840,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); @@ -1981,7 +1981,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); Index: sys/dev/pci/if_sk.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_sk.c,v retrieving revision 1.180 diff -u -p -r1.180 if_sk.c --- sys/dev/pci/if_sk.c 20 Nov 2015 03:35:23 -0000 1.180 +++ sys/dev/pci/if_sk.c 23 Nov 2015 13:55:36 -0000 @@ -1509,7 +1509,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; } @@ -1697,7 +1697,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; } @@ -2398,7 +2398,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); @@ -2420,7 +2420,8 @@ sk_stop(struct sk_if_softc *sc_if, int s 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 */ Index: sys/dev/pci/if_ste.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_ste.c,v retrieving revision 1.60 diff -u -p -r1.60 if_ste.c --- sys/dev/pci/if_ste.c 25 Oct 2015 13:04:28 -0000 1.60 +++ sys/dev/pci/if_ste.c 23 Nov 2015 13:55:36 -0000 @@ -750,7 +750,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); @@ -1115,7 +1115,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); @@ -1133,7 +1133,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); @@ -1312,7 +1313,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; @@ -1324,7 +1325,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; } Index: sys/dev/pci/if_stge.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_stge.c,v retrieving revision 1.64 diff -u -p -r1.64 if_stge.c --- sys/dev/pci/if_stge.c 20 Nov 2015 03:35:23 -0000 1.64 +++ sys/dev/pci/if_stge.c 23 Nov 2015 13:55:36 -0000 @@ -463,7 +463,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; /* @@ -609,7 +609,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) { @@ -802,7 +802,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 @@ -1292,7 +1292,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) @@ -1342,7 +1342,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. */ Index: sys/dev/pci/if_tht.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_tht.c,v retrieving revision 1.135 diff -u -p -r1.135 if_tht.c --- sys/dev/pci/if_tht.c 20 Nov 2015 03:35:23 -0000 1.135 +++ sys/dev/pci/if_tht.c 23 Nov 2015 13:55:37 -0000 @@ -968,7 +968,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); @@ -1063,7 +1063,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) @@ -1098,7 +1099,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; @@ -1118,7 +1119,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; } @@ -1234,7 +1235,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); } Index: sys/dev/pci/if_tl.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_tl.c,v retrieving revision 1.66 diff -u -p -r1.66 if_tl.c --- sys/dev/pci/if_tl.c 25 Oct 2015 13:04:28 -0000 1.66 +++ sys/dev/pci/if_tl.c 23 Nov 2015 13:55:37 -0000 @@ -1177,7 +1177,7 @@ tl_intvec_txeoc(void *xsc, u_int32_t typ 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 { @@ -1460,7 +1460,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; } @@ -1769,7 +1769,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 @@ -2020,7 +2021,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 = { Index: sys/dev/pci/if_txp.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_txp.c,v retrieving revision 1.119 diff -u -p -r1.119 if_txp.c --- sys/dev/pci/if_txp.c 20 Nov 2015 03:35:23 -0000 1.119 +++ sys/dev/pci/if_txp.c 23 Nov 2015 13:55:37 -0000 @@ -827,7 +827,7 @@ txp_tx_reclaim(struct txp_softc *sc, str ifp->if_opackets++; } } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (++cons == TX_ENTRIES) { txd = r->r_desc; @@ -1217,7 +1217,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); @@ -1275,7 +1275,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; @@ -1437,7 +1437,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; } @@ -1648,7 +1648,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); Index: sys/dev/pci/if_vge.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_vge.c,v retrieving revision 1.67 diff -u -p -r1.67 if_vge.c --- sys/dev/pci/if_vge.c 16 Nov 2015 04:02:34 -0000 1.67 +++ sys/dev/pci/if_vge.c 23 Nov 2015 13:55:37 -0000 @@ -1194,7 +1194,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; } @@ -1413,7 +1413,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)) @@ -1427,7 +1427,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; } @@ -1640,7 +1640,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; @@ -1810,7 +1810,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); Index: sys/dev/pci/if_vic.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_vic.c,v retrieving revision 1.93 diff -u -p -r1.93 if_vic.c --- sys/dev/pci/if_vic.c 20 Nov 2015 03:35:23 -0000 1.93 +++ sys/dev/pci/if_vic.c 23 Nov 2015 13:55:37 -0000 @@ -911,7 +911,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; @@ -1036,7 +1036,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)) @@ -1049,7 +1049,7 @@ vic_start(struct ifnet *ifp) for (;;) { if (VIC_TXURN(sc)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1268,7 +1268,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); @@ -1288,7 +1288,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); Index: sys/dev/pci/if_vio.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_vio.c,v retrieving revision 1.35 diff -u -p -r1.35 if_vio.c --- sys/dev/pci/if_vio.c 20 Nov 2015 03:35:23 -0000 1.35 +++ sys/dev/pci/if_vio.c 23 Nov 2015 13:55:37 -0000 @@ -679,7 +679,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; @@ -693,7 +693,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); @@ -728,7 +729,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; @@ -745,7 +746,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) @@ -793,7 +794,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); @@ -811,7 +812,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]); @@ -1161,7 +1162,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) Index: sys/dev/pci/if_vmx.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_vmx.c,v retrieving revision 1.36 diff -u -p -r1.36 if_vmx.c --- sys/dev/pci/if_vmx.c 23 Nov 2015 10:52:43 -0000 1.36 +++ sys/dev/pci/if_vmx.c 23 Nov 2015 13:55:37 -0000 @@ -695,9 +695,9 @@ vmxnet3_txintr(struct vmxnet3_softc *sc, 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(); } @@ -926,7 +926,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); @@ -988,7 +989,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; } @@ -1051,7 +1052,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; @@ -1059,7 +1060,7 @@ vmxnet3_start(struct ifnet *ifp) for (;;) { if (used + NTXSEGS > free) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } Index: sys/dev/pci/if_vr.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_vr.c,v retrieving revision 1.145 diff -u -p -r1.145 if_vr.c --- sys/dev/pci/if_vr.c 9 Nov 2015 00:22:57 -0000 1.145 +++ sys/dev/pci/if_vr.c 23 Nov 2015 13:55:37 -0000 @@ -1046,7 +1046,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; @@ -1311,7 +1311,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) @@ -1321,7 +1321,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; } @@ -1482,7 +1482,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); @@ -1610,7 +1610,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)); Index: sys/dev/pci/if_vte.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_vte.c,v retrieving revision 1.15 diff -u -p -r1.15 if_vte.c --- sys/dev/pci/if_vte.c 14 Nov 2015 17:54:57 -0000 1.15 +++ sys/dev/pci/if_vte.c 23 Nov 2015 13:55:37 -0000 @@ -658,13 +658,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); @@ -922,7 +922,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 @@ -1228,7 +1228,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); } @@ -1244,7 +1244,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); Index: sys/dev/pci/if_wb.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_wb.c,v retrieving revision 1.63 diff -u -p -r1.63 if_wb.c --- sys/dev/pci/if_wb.c 25 Oct 2015 13:04:28 -0000 1.63 +++ sys/dev/pci/if_wb.c 23 Nov 2015 13:55:37 -0000 @@ -1067,7 +1067,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) { @@ -1287,7 +1287,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; } @@ -1470,7 +1470,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); @@ -1595,7 +1595,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); Index: sys/dev/pci/if_wpi.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_wpi.c,v retrieving revision 1.130 diff -u -p -r1.130 if_wpi.c --- sys/dev/pci/if_wpi.c 4 Nov 2015 12:11:59 -0000 1.130 +++ sys/dev/pci/if_wpi.c 23 Nov 2015 13:55:37 -0000 @@ -1373,8 +1373,8 @@ wpi_tx_done(struct wpi_softc *sc, struct 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); } } @@ -1896,12 +1896,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. */ @@ -3310,7 +3310,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) @@ -3331,7 +3331,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; Index: sys/dev/pci/if_xge.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_xge.c,v retrieving revision 1.65 diff -u -p -r1.65 if_xge.c --- sys/dev/pci/if_xge.c 20 Nov 2015 03:35:23 -0000 1.65 +++ sys/dev/pci/if_xge.c 23 Nov 2015 13:55:37 -0000 @@ -770,7 +770,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); @@ -783,7 +783,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; @@ -850,7 +851,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); @@ -1063,7 +1064,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; Index: sys/dev/pcmcia/if_malo.c =================================================================== RCS file: /cvs/src/sys/dev/pcmcia/if_malo.c,v retrieving revision 1.88 diff -u -p -r1.88 if_malo.c --- sys/dev/pcmcia/if_malo.c 20 Nov 2015 03:35:23 -0000 1.88 +++ sys/dev/pcmcia/if_malo.c 23 Nov 2015 13:55:37 -0000 @@ -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 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); } Index: sys/dev/pcmcia/if_xe.c =================================================================== RCS file: /cvs/src/sys/dev/pcmcia/if_xe.c,v retrieving revision 1.54 diff -u -p -r1.54 if_xe.c --- sys/dev/pcmcia/if_xe.c 20 Nov 2015 03:35:23 -0000 1.54 +++ sys/dev/pcmcia/if_xe.c 23 Nov 2015 13:55:37 -0000 @@ -1065,7 +1065,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); } @@ -1086,7 +1086,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. */ Index: sys/dev/sbus/be.c =================================================================== RCS file: /cvs/src/sys/dev/sbus/be.c,v retrieving revision 1.35 diff -u -p -r1.35 be.c --- sys/dev/sbus/be.c 25 Oct 2015 13:13:06 -0000 1.35 +++ sys/dev/sbus/be.c 23 Nov 2015 13:55:37 -0000 @@ -572,7 +572,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; @@ -608,7 +608,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; } } @@ -853,7 +853,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) @@ -1062,7 +1062,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); Index: sys/dev/sbus/qe.c =================================================================== RCS file: /cvs/src/sys/dev/sbus/qe.c,v retrieving revision 1.33 diff -u -p -r1.33 qe.c --- sys/dev/sbus/qe.c 11 Nov 2015 10:07:25 -0000 1.33 +++ sys/dev/sbus/qe.c 23 Nov 2015 13:55:38 -0000 @@ -444,7 +444,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; @@ -481,7 +481,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; } } @@ -630,7 +630,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) @@ -644,8 +644,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); } } @@ -1041,7 +1041,7 @@ qeinit(sc) qe_mcreset(sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); } Index: sys/dev/usb/if_athn_usb.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_athn_usb.c,v retrieving revision 1.38 diff -u -p -r1.38 if_athn_usb.c --- sys/dev/usb/if_athn_usb.c 4 Nov 2015 12:12:00 -0000 1.38 +++ sys/dev/usb/if_athn_usb.c 23 Nov 2015 13:55:38 -0000 @@ -1925,8 +1925,8 @@ athn_usb_txeof(struct usbd_xfer *xfer, v 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); @@ -2056,12 +2056,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. */ @@ -2324,8 +2324,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) { @@ -2357,7 +2357,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); Index: sys/dev/usb/if_atu.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_atu.c,v retrieving revision 1.114 diff -u -p -r1.114 if_atu.c --- sys/dev/usb/if_atu.c 4 Nov 2015 12:12:00 -0000 1.114 +++ sys/dev/usb/if_atu.c 23 Nov 2015 13:55:38 -0000 @@ -1798,7 +1798,7 @@ atu_txeof(struct usbd_xfer *xfer, void * 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); @@ -1916,8 +1916,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; } @@ -1930,13 +1930,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; } @@ -2093,7 +2093,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 */ @@ -2249,7 +2249,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. */ Index: sys/dev/usb/if_aue.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_aue.c,v retrieving revision 1.102 diff -u -p -r1.102 if_aue.c --- sys/dev/usb/if_aue.c 20 Nov 2015 03:35:23 -0000 1.102 +++ sys/dev/usb/if_aue.c 23 Nov 2015 13:55:38 -0000 @@ -1098,7 +1098,7 @@ aue_txeof(struct usbd_xfer *xfer, void * __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) { @@ -1241,7 +1241,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); @@ -1250,7 +1250,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; } @@ -1265,7 +1265,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. @@ -1330,7 +1330,7 @@ aue_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -1514,7 +1514,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); Index: sys/dev/usb/if_axe.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_axe.c,v retrieving revision 1.134 diff -u -p -r1.134 if_axe.c --- sys/dev/usb/if_axe.c 20 Nov 2015 03:35:23 -0000 1.134 +++ sys/dev/usb/if_axe.c 23 Nov 2015 13:55:38 -0000 @@ -1124,7 +1124,7 @@ axe_txeof(struct usbd_xfer *xfer, void * } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); m_freem(c->axe_mbuf); c->axe_mbuf = NULL; @@ -1250,7 +1250,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); @@ -1259,7 +1259,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); @@ -1273,7 +1273,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. @@ -1380,7 +1380,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); @@ -1473,7 +1473,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); Index: sys/dev/usb/if_axen.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_axen.c,v retrieving revision 1.18 diff -u -p -r1.18 if_axen.c --- sys/dev/usb/if_axen.c 20 Nov 2015 03:35:23 -0000 1.18 +++ sys/dev/usb/if_axen.c 23 Nov 2015 13:55:38 -0000 @@ -1141,7 +1141,7 @@ axen_txeof(struct usbd_xfer *xfer, void } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); m_freem(c->axen_mbuf); c->axen_mbuf = NULL; @@ -1270,7 +1270,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); @@ -1279,7 +1279,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); @@ -1293,7 +1293,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. @@ -1381,7 +1381,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); @@ -1481,7 +1481,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); Index: sys/dev/usb/if_cdce.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_cdce.c,v retrieving revision 1.67 diff -u -p -r1.67 if_cdce.c --- sys/dev/usb/if_cdce.c 20 Nov 2015 03:35:23 -0000 1.67 +++ sys/dev/usb/if_cdce.c 23 Nov 2015 13:55:38 -0000 @@ -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 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) { Index: sys/dev/usb/if_cdcef.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_cdcef.c,v retrieving revision 1.40 diff -u -p -r1.40 if_cdcef.c --- sys/dev/usb/if_cdcef.c 22 Nov 2015 23:56:10 -0000 1.40 +++ sys/dev/usb/if_cdcef.c 23 Nov 2015 13:55:38 -0000 @@ -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 #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? */ Index: sys/dev/usb/if_cue.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_cue.c,v retrieving revision 1.73 diff -u -p -r1.73 if_cue.c --- sys/dev/usb/if_cue.c 20 Nov 2015 03:35:23 -0000 1.73 +++ sys/dev/usb/if_cue.c 23 Nov 2015 13:55:38 -0000 @@ -764,7 +764,7 @@ cue_txeof(struct usbd_xfer *xfer, void * __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); Index: sys/dev/usb/if_kue.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_kue.c,v retrieving revision 1.82 diff -u -p -r1.82 if_kue.c --- sys/dev/usb/if_kue.c 20 Nov 2015 03:35:23 -0000 1.82 +++ sys/dev/usb/if_kue.c 23 Nov 2015 13:55:38 -0000 @@ -773,7 +773,7 @@ kue_txeof(struct usbd_xfer *xfer, void * __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) { Index: sys/dev/usb/if_mos.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_mos.c,v retrieving revision 1.33 diff -u -p -r1.33 if_mos.c --- sys/dev/usb/if_mos.c 20 Nov 2015 03:35:23 -0000 1.33 +++ sys/dev/usb/if_mos.c 23 Nov 2015 13:55:38 -0000 @@ -1024,7 +1024,7 @@ mos_txeof(struct usbd_xfer *xfer, void * } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); m_freem(c->mos_mbuf); c->mos_mbuf = NULL; @@ -1135,7 +1135,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); @@ -1144,7 +1144,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); @@ -1158,7 +1158,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. @@ -1251,7 +1251,7 @@ mos_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -1345,7 +1345,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); Index: sys/dev/usb/if_otus.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_otus.c,v retrieving revision 1.48 diff -u -p -r1.48 if_otus.c --- sys/dev/usb/if_otus.c 4 Nov 2015 12:12:00 -0000 1.48 +++ sys/dev/usb/if_otus.c 23 Nov 2015 13:55:38 -0000 @@ -246,7 +246,8 @@ otus_detach(struct device *self, int fla 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); } @@ -1269,7 +1270,7 @@ otus_txeof(struct usbd_xfer *xfer, void } sc->sc_tx_timer = 0; ifp->if_opackets++; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); otus_start(ifp); splx(s); } @@ -1407,12 +1408,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. */ @@ -2288,8 +2289,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); @@ -2308,7 +2309,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); Index: sys/dev/usb/if_ral.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_ral.c,v retrieving revision 1.135 diff -u -p -r1.135 if_ral.c --- sys/dev/usb/if_ral.c 13 Nov 2015 10:36:29 -0000 1.135 +++ sys/dev/usb/if_ral.c 23 Nov 2015 13:55:38 -0000 @@ -695,7 +695,7 @@ ural_txeof(struct usbd_xfer *xfer, void 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); @@ -1234,12 +1234,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; } @@ -2058,7 +2058,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) @@ -2080,7 +2080,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 */ Index: sys/dev/usb/if_rsu.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_rsu.c,v retrieving revision 1.29 diff -u -p -r1.29 if_rsu.c --- sys/dev/usb/if_rsu.c 15 Nov 2015 01:05:25 -0000 1.29 +++ sys/dev/usb/if_rsu.c 23 Nov 2015 13:55:38 -0000 @@ -1463,8 +1463,8 @@ rsu_txeof(struct usbd_xfer *xfer, void * 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); @@ -1603,12 +1603,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) @@ -2276,8 +2276,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) { @@ -2305,7 +2305,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; Index: sys/dev/usb/if_rum.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_rum.c,v retrieving revision 1.114 diff -u -p -r1.114 if_rum.c --- sys/dev/usb/if_rum.c 13 Nov 2015 10:36:29 -0000 1.114 +++ sys/dev/usb/if_rum.c 23 Nov 2015 13:55:38 -0000 @@ -753,7 +753,7 @@ rum_txeof(struct usbd_xfer *xfer, void * 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); @@ -1238,12 +1238,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; } @@ -2068,7 +2068,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) @@ -2091,7 +2091,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 */ Index: sys/dev/usb/if_run.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_run.c,v retrieving revision 1.112 diff -u -p -r1.112 if_run.c --- sys/dev/usb/if_run.c 4 Nov 2015 12:12:00 -0000 1.112 +++ sys/dev/usb/if_run.c 23 Nov 2015 13:55:39 -0000 @@ -696,7 +696,8 @@ run_detach(struct device *self, int flag 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); } @@ -2377,7 +2378,7 @@ run_txeof(struct usbd_xfer *xfer, void * sc->sc_tx_timer = 0; ifp->if_opackets++; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); run_start(ifp); splx(s); } @@ -2521,12 +2522,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 */ @@ -4700,8 +4701,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 */ @@ -4732,7 +4733,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); Index: sys/dev/usb/if_smsc.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_smsc.c,v retrieving revision 1.22 diff -u -p -r1.22 if_smsc.c --- sys/dev/usb/if_smsc.c 20 Nov 2015 03:35:23 -0000 1.22 +++ sys/dev/usb/if_smsc.c 23 Nov 2015 13:55:39 -0000 @@ -591,7 +591,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); @@ -606,7 +606,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; } @@ -616,7 +616,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); @@ -625,7 +625,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 @@ -653,7 +653,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); @@ -1265,7 +1266,7 @@ smsc_txeof(struct usbd_xfer *xfer, void } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); m_freem(c->sc_mbuf); c->sc_mbuf = NULL; Index: sys/dev/usb/if_uath.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_uath.c,v retrieving revision 1.72 diff -u -p -r1.72 if_uath.c --- sys/dev/usb/if_uath.c 13 Nov 2015 10:36:29 -0000 1.72 +++ sys/dev/usb/if_uath.c 23 Nov 2015 13:55:39 -0000 @@ -1349,7 +1349,7 @@ uath_data_txeof(struct usbd_xfer *xfer, ifp->if_opackets++; sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); uath_start(ifp); splx(s); @@ -1473,12 +1473,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; } @@ -1936,8 +1936,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); @@ -1962,7 +1962,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 */ Index: sys/dev/usb/if_udav.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_udav.c,v retrieving revision 1.74 diff -u -p -r1.74 if_udav.c --- sys/dev/usb/if_udav.c 20 Nov 2015 03:35:23 -0000 1.74 +++ sys/dev/usb/if_udav.c 23 Nov 2015 13:55:39 -0000 @@ -648,7 +648,7 @@ udav_init(struct ifnet *ifp) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -915,7 +915,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); @@ -924,7 +924,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; } @@ -935,7 +935,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; @@ -1009,7 +1009,7 @@ udav_txeof(struct usbd_xfer *xfer, void 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) { @@ -1222,7 +1222,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); Index: sys/dev/usb/if_ugl.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_ugl.c,v retrieving revision 1.15 diff -u -p -r1.15 if_ugl.c --- sys/dev/usb/if_ugl.c 20 Nov 2015 03:35:23 -0000 1.15 +++ sys/dev/usb/if_ugl.c 23 Nov 2015 13:55:39 -0000 @@ -522,7 +522,7 @@ ugl_txeof(struct usbd_xfer *xfer, void * __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) { @@ -601,7 +601,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); @@ -610,7 +610,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; } @@ -625,7 +625,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. @@ -669,9 +669,9 @@ ugl_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; - splx(s); + + ifq_clr_oactive(&ifp->if_snd); } int @@ -828,7 +828,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) { Index: sys/dev/usb/if_upgt.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_upgt.c,v retrieving revision 1.72 diff -u -p -r1.72 if_upgt.c --- sys/dev/usb/if_upgt.c 11 Nov 2015 10:07:25 -0000 1.72 +++ sys/dev/usb/if_upgt.c 23 Nov 2015 13:55:39 -0000 @@ -1216,7 +1216,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); @@ -1239,7 +1239,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); @@ -1369,7 +1370,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__); @@ -1429,7 +1430,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); } @@ -1631,7 +1632,7 @@ upgt_tx_done(struct upgt_softc *sc, uint 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); } Index: sys/dev/usb/if_upl.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_upl.c,v retrieving revision 1.68 diff -u -p -r1.68 if_upl.c --- sys/dev/usb/if_upl.c 20 Nov 2015 03:35:23 -0000 1.68 +++ sys/dev/usb/if_upl.c 23 Nov 2015 13:55:39 -0000 @@ -500,7 +500,7 @@ upl_txeof(struct usbd_xfer *xfer, void * __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) { Index: sys/dev/usb/if_url.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_url.c,v retrieving revision 1.77 diff -u -p -r1.77 if_url.c --- sys/dev/usb/if_url.c 20 Nov 2015 03:35:23 -0000 1.77 +++ sys/dev/usb/if_url.c 23 Nov 2015 13:55:39 -0000 @@ -523,7 +523,7 @@ url_init(struct ifnet *ifp) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); splx(s); @@ -788,7 +788,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); @@ -797,7 +797,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; } @@ -808,7 +808,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; @@ -875,7 +875,7 @@ url_txeof(struct usbd_xfer *xfer, void * 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) { @@ -1089,7 +1089,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); Index: sys/dev/usb/if_urndis.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_urndis.c,v retrieving revision 1.57 diff -u -p -r1.57 if_urndis.c --- sys/dev/usb/if_urndis.c 20 Nov 2015 03:35:23 -0000 1.57 +++ sys/dev/usb/if_urndis.c 23 Nov 2015 13:55:39 -0000 @@ -1080,7 +1080,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); } @@ -1094,7 +1094,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); @@ -1145,7 +1146,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); @@ -1154,7 +1155,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); @@ -1168,7 +1169,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. @@ -1243,7 +1244,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) { Index: sys/dev/usb/if_urtw.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_urtw.c,v retrieving revision 1.57 diff -u -p -r1.57 if_urtw.c --- sys/dev/usb/if_urtw.c 13 Nov 2015 10:36:29 -0000 1.57 +++ sys/dev/usb/if_urtw.c 23 Nov 2015 13:55:39 -0000 @@ -2299,7 +2299,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; @@ -2425,13 +2425,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; } @@ -2526,7 +2526,7 @@ urtw_txeof_low(struct usbd_xfer *xfer, v ifp->if_opackets++; sc->sc_tx_low_queued--; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); urtw_start(ifp); splx(s); @@ -2565,7 +2565,7 @@ urtw_txeof_normal(struct usbd_xfer *xfer ifp->if_opackets++; sc->sc_tx_normal_queued--; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); urtw_start(ifp); splx(s); @@ -3008,7 +3008,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); @@ -3703,8 +3704,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; Index: sys/dev/usb/if_urtwn.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v retrieving revision 1.54 diff -u -p -r1.54 if_urtwn.c --- sys/dev/usb/if_urtwn.c 4 Nov 2015 12:12:00 -0000 1.54 +++ sys/dev/usb/if_urtwn.c 23 Nov 2015 13:55:39 -0000 @@ -1952,8 +1952,8 @@ urtwn_txeof(struct usbd_xfer *xfer, void 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); @@ -2133,12 +2133,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. */ @@ -3699,8 +3699,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) { @@ -3729,7 +3729,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); Index: sys/dev/usb/if_zyd.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_zyd.c,v retrieving revision 1.110 diff -u -p -r1.110 if_zyd.c --- sys/dev/usb/if_zyd.c 4 Nov 2015 12:12:00 -0000 1.110 +++ sys/dev/usb/if_zyd.c 23 Nov 2015 13:55:39 -0000 @@ -2088,7 +2088,7 @@ zyd_txeof(struct usbd_xfer *xfer, void * ifp->if_opackets++; sc->tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); zyd_start(ifp); splx(s); @@ -2233,12 +2233,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 */ @@ -2457,7 +2457,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) @@ -2479,7 +2479,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 */ Index: sys/net/if.c =================================================================== RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.412 diff -u -p -r1.412 if.c --- sys/net/if.c 21 Nov 2015 01:08:49 -0000 1.412 +++ sys/net/if.c 23 Nov 2015 13:55:39 -0000 @@ -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, c case SIOCGIFFLAGS: ifr->ifr_flags = ifp->if_flags; + if (ifq_is_oactive(&ifp->if_snd)) + ifr->ifr_flags |= IFF_OACTIVE; break; case SIOCGIFXFLAGS: Index: sys/net/if_var.h =================================================================== RCS file: /cvs/src/sys/net/if_var.h,v retrieving revision 1.56 diff -u -p -r1.56 if_var.h --- sys/net/if_var.h 21 Nov 2015 01:08:50 -0000 1.56 +++ sys/net/if_var.h 23 Nov 2015 13:55:39 -0000 @@ -121,6 +121,7 @@ struct ifqueue { void *ifq_q; unsigned int ifq_len; unsigned int ifq_serializer; + unsigned int ifq_oactive; unsigned int ifq_maxlen; }; @@ -290,6 +291,24 @@ void ifq_q_leave(struct ifqueue *, voi #define ifq_len(_ifq) ((_ifq)->ifq_len) #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; Index: sys/net80211/ieee80211_pae_output.c =================================================================== RCS file: /cvs/src/sys/net80211/ieee80211_pae_output.c,v retrieving revision 1.24 diff -u -p -r1.24 ieee80211_pae_output.c --- sys/net80211/ieee80211_pae_output.c 12 Oct 2015 13:17:58 -0000 1.24 +++ sys/net80211/ieee80211_pae_output.c 23 Nov 2015 13:55:39 -0000 @@ -129,7 +129,7 @@ ieee80211_send_eapol_key(struct ieee8021 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);