From: Sepherosa Ziehau Date: Fri, 28 Dec 2012 09:31:10 +0000 (+0800) Subject: if: Move IFF_OACTIVE bit into ifaltq; prepare multiple TX queues support X-Git-Tag: v3.4.0rc~585 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/9ed293e071aa5626e1e68861be45f0002c7b0d8c if: Move IFF_OACTIVE bit into ifaltq; prepare multiple TX queues support ifaltq.altq_hw_oactive is now used to record that NIC's TX queue is full. IFF_OACTIVE is removed from kernel. User space IFF_OACTIVE is kept for compability. ifaltq.altq_hw_oactive should not be accessed directly. Following set of functions are provided and should be used: ifq_is_oactive(ifnet.if_snd) - Whether NIC's TX queue is full or not ifq_set_oactive(ifnet.if_snd) - NIC's TX queue is full ifq_clr_oactive(ifnet.if_snd) - NIC's TX queue is no longer full --- diff --git a/sys/bus/u4b/net/if_axe.c b/sys/bus/u4b/net/if_axe.c index b36a300290..ab4e16ac0b 100644 --- a/sys/bus/u4b/net/if_axe.c +++ b/sys/bus/u4b/net/if_axe.c @@ -1185,14 +1185,14 @@ axe_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer complete\n"); - - ifp->if_flags &= ~IFF_OACTIVE; + + ifq_clr_oactive(&ifp->if_snd); /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: if ((sc->sc_flags & AXE_FLAG_LINK) == 0 || - (ifp->if_flags & IFF_OACTIVE) != 0) { + ifq_is_oactive(&ifp->if_snd)) { /* * Don't send anything if there is no link or * controller is busy. @@ -1272,7 +1272,7 @@ tr_setup: usbd_xfer_set_frames(xfer, nframes); DPRINTFN(5, "submitting transfer\n"); usbd_transfer_submit(xfer); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); } return; /* NOTREACHED */ @@ -1281,7 +1281,7 @@ tr_setup: usbd_errstr(error)); ifp->if_oerrors++; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ usbd_xfer_set_stall(xfer); @@ -1481,7 +1481,8 @@ axe_stop(struct usb_ether *ue) AXE_LOCK_ASSERT(sc); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); sc->sc_flags &= ~AXE_FLAG_LINK; diff --git a/sys/dev/netif/acx/if_acx.c b/sys/dev/netif/acx/if_acx.c index f96f4c7841..1de02fd312 100644 --- a/sys/dev/netif/acx/if_acx.c +++ b/sys/dev/netif/acx/if_acx.c @@ -693,7 +693,7 @@ acx_init(void *arg) 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) { if (ic->ic_roaming != IEEE80211_ROAMING_MANUAL) @@ -832,7 +832,8 @@ acx_stop(struct acx_softc *sc) 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); return 0; } @@ -1109,8 +1110,7 @@ acx_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & IFF_RUNNING) == 0 || - (ifp->if_flags & IFF_OACTIVE)) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(ifp->if_snd)) return; /* @@ -1241,7 +1241,7 @@ acx_start(struct ifnet *ifp) 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_tx_timer == 0) sc->sc_tx_timer = 5; @@ -1369,7 +1369,7 @@ acx_txeof(struct acx_softc *sc) sc->sc_tx_timer = 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); ifp->if_start(ifp); } } diff --git a/sys/dev/netif/ae/if_ae.c b/sys/dev/netif/ae/if_ae.c index 091fadac4b..8877edf2c5 100644 --- a/sys/dev/netif/ae/if_ae.c +++ b/sys/dev/netif/ae/if_ae.c @@ -224,7 +224,8 @@ ae_stop(struct ae_softc *sc) ASSERT_SERIALIZED(ifp->if_serializer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; sc->ae_flags &= ~AE_FLAG_LINK; @@ -737,7 +738,7 @@ ae_tx_intr(struct ae_softc *sc) if (sc->tx_inproc == 0) ifp->if_timer = 0; /* Unarm watchdog. */ if (sc->ae_flags & AE_FLAG_TXAVAIL) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (!ifq_is_empty(&ifp->if_snd)) #ifdef foo ae_intr(sc); @@ -973,7 +974,7 @@ ae_init(void *xsc) callout_reset(&sc->ae_tick_ch, hz, ae_tick, sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -1165,7 +1166,7 @@ ae_start(struct ifnet *ifp) ifq_purge(&ifp->if_snd); return; } - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; trans = 0; @@ -1180,7 +1181,7 @@ ae_start(struct ifnet *ifp) if (error != 0) { if (m0 != NULL) { ifq_prepend(&ifp->if_snd, m0); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); #ifdef AE_DEBUG if_printf(ifp, "Setting OACTIVE.\n"); #endif diff --git a/sys/dev/netif/age/if_age.c b/sys/dev/netif/age/if_age.c index d875bc2505..e58f72aaba 100644 --- a/sys/dev/netif/age/if_age.c +++ b/sys/dev/netif/age/if_age.c @@ -1588,7 +1588,7 @@ age_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; enq = 0; @@ -1606,7 +1606,7 @@ age_start(struct ifnet *ifp) if (m_head == NULL) break; ifq_prepend(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } enq = 1; @@ -1967,7 +1967,7 @@ age_txintr(struct age_softc *sc, int tpd_cons) if (sc->age_cdata.age_tx_cnt <= 0) break; prog++; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->age_cdata.age_tx_cnt--; txd = &sc->age_cdata.age_txdesc[cons]; /* @@ -2529,7 +2529,7 @@ age_init(void *xsc) callout_reset(&sc->age_tick_ch, hz, age_tick, sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -2546,7 +2546,8 @@ age_stop(struct age_softc *sc) /* * Mark the interface down and cancel the watchdog timer. */ - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; sc->age_flags &= ~AGE_FLAG_LINK; diff --git a/sys/dev/netif/alc/if_alc.c b/sys/dev/netif/alc/if_alc.c index 52b483f486..9681e8e629 100644 --- a/sys/dev/netif/alc/if_alc.c +++ b/sys/dev/netif/alc/if_alc.c @@ -2180,7 +2180,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) == 0 || ifq_is_oactive(&ifp->if_snd)) return; if ((sc->alc_flags & ALC_FLAG_LINK) == 0) { ifq_purge(&ifp->if_snd); @@ -2200,7 +2200,7 @@ alc_start(struct ifnet *ifp) if (m_head == NULL) break; ifq_prepend(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2621,7 +2621,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) { @@ -3228,7 +3228,7 @@ alc_init(void *xsc) callout_reset(&sc->alc_tick_ch, hz, alc_tick, sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -3245,7 +3245,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); sc->alc_flags &= ~ALC_FLAG_LINK; callout_stop(&sc->alc_tick_ch); sc->alc_watchdog_timer = 0; diff --git a/sys/dev/netif/ale/if_ale.c b/sys/dev/netif/ale/if_ale.c index 44060971e5..d9c29e1602 100644 --- a/sys/dev/netif/ale/if_ale.c +++ b/sys/dev/netif/ale/if_ale.c @@ -1674,7 +1674,7 @@ ale_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; /* Reclaim transmitted frames. */ @@ -1696,7 +1696,7 @@ ale_start(struct ifnet *ifp) if (m_head == NULL) break; ifq_prepend(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } enq = 1; @@ -2052,7 +2052,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) { @@ -2556,7 +2556,7 @@ ale_init(void *xsc) callout_reset(&sc->ale_tick_ch, hz, ale_tick, sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -2572,7 +2572,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; callout_stop(&sc->ale_tick_ch); diff --git a/sys/dev/netif/an/if_an.c b/sys/dev/netif/an/if_an.c index cd053cd1de..e2d5c9df67 100644 --- a/sys/dev/netif/an/if_an.c +++ b/sys/dev/netif/an/if_an.c @@ -1055,7 +1055,7 @@ an_txeof(struct an_softc *sc, int status) ifp = &sc->arpcom.ac_if; ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (!sc->mpi350) { id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350)); @@ -1115,7 +1115,7 @@ an_stats_update(void *xsc) sc->an_associated = 0; /* Don't do this while we're not transmitting */ - if ((ifp->if_flags & IFF_OACTIVE) == 0) { + if (!ifq_is_oactive(&ifp->if_snd)) { sc->an_stats.an_len = sizeof(struct an_ltv_stats); sc->an_stats.an_type = AN_RID_32BITS_CUM; an_read_record(sc, (struct an_ltv_gen *)&sc->an_stats.an_len); @@ -2471,7 +2471,7 @@ an_init(void *xsc) CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350)); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->an_stat_timer, hz, an_stats_update, sc); } @@ -2490,7 +2490,7 @@ an_start(struct ifnet *ifp) sc = ifp->if_softc; - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; if (!sc->an_associated) { @@ -2644,7 +2644,7 @@ an_start(struct ifnet *ifp) } if (!ready) - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); sc->an_rdata.an_tx_prod = idx; } @@ -2666,7 +2666,8 @@ an_stop(struct an_softc *sc) callout_stop(&sc->an_stat_timer); - ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (sc->an_flash_buffer) { kfree(sc->an_flash_buffer, M_DEVBUF); diff --git a/sys/dev/netif/ar/if_ar.c b/sys/dev/netif/ar/if_ar.c index eb52b7df68..97a24d6d12 100644 --- a/sys/dev/netif/ar/if_ar.c +++ b/sys/dev/netif/ar/if_ar.c @@ -60,6 +60,7 @@ #include #include +#include #ifdef NETGRAPH #include #include @@ -615,7 +616,7 @@ ar_xmit(struct ar_softc *sc) * This function only place the data in the oncard buffers. It does not * start the transmition. ar_xmit() does that. * - * Transmitter idle state is indicated by the IFF_OACTIVE flag. The function + * Transmitter idle state is indicated by the ifq_is_oactive. The function * that clears that should ensure that the transmitter and its DMA is * in a "good" idle state. */ @@ -649,9 +650,9 @@ top_arstart: */ if(sc->txb_inuse == AR_TX_BLOCKS) { #ifndef NETGRAPH - ifp->if_flags |= IFF_OACTIVE; /* yes, mark active */ + ifq_set_oactive(&ifp->if_snd); /* yes, mark active */ #else /* NETGRAPH */ -/*XXX*/ /*ifp->if_flags |= IFF_OACTIVE;*/ /* yes, mark active */ +/*XXX*/ /*ifq_set_oactive(&ifp->if_snd);*/ /* yes, mark active */ #endif /* NETGRAPH */ return; } @@ -854,9 +855,9 @@ arwatchdog(struct ar_softc *sc) sc->xmit_busy = 0; #ifndef NETGRAPH - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); #else /* NETGRAPH */ - /* XXX ifp->if_flags &= ~IFF_OACTIVE; */ + /* XXX ifq_clr_oactive(&ifp->if_snd); */ #endif /* NETGRAPH */ if(sc->txb_inuse && --sc->txb_inuse) @@ -1847,17 +1848,15 @@ ar_dmac_intr(struct ar_hardc *hc, int scano, u_char isr1) /* * This should be the most common case. * - * Clear the IFF_OACTIVE flag. - * * Call arstart to start a new transmit if * there is data to transmit. */ sc->xmit_busy = 0; #ifndef NETGRAPH - sc->ifsppp.pp_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->ifsppp.pp_if.if_snd); sc->ifsppp.pp_if.if_timer = 0; #else /* NETGRAPH */ - /* XXX c->ifsppp.pp_if.if_flags &= ~IFF_OACTIVE; */ + /* XXX ifq_clr_oactive(&sc->ifsppp.pp_if.if_snd); */ sc->out_dog = 0; /* XXX */ #endif /* NETGRAPH */ diff --git a/sys/dev/netif/ath/ath/if_ath.c b/sys/dev/netif/ath/ath/if_ath.c index 023fdc6867..18083b2ef6 100644 --- a/sys/dev/netif/ath/ath/if_ath.c +++ b/sys/dev/netif/ath/ath/if_ath.c @@ -1756,7 +1756,7 @@ ath_getbuf(struct ath_softc *sc) DPRINTF(sc, ATH_DEBUG_XMIT, "%s: stop queue\n", __func__); sc->sc_stats.ast_tx_qstop++; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); } return bf; } @@ -4052,7 +4052,7 @@ rx_next: if (ngood) sc->sc_lastrx = tsf; - if ((ifp->if_flags & IFF_OACTIVE) == 0) { + if (!ifq_is_oactive(&ifp->if_snd)) { #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_ff_age_all(ic, 100); #endif @@ -5040,7 +5040,7 @@ ath_tx_task_q0(void *arg, int npending) sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum)) ath_tx_processq(sc, sc->sc_cabq); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->sc_wd_timer = 0; if (sc->sc_softled) @@ -5079,7 +5079,7 @@ ath_tx_task_q0123(void *arg, int npending) if (nacked) sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->sc_wd_timer = 0; if (sc->sc_softled) @@ -5112,7 +5112,7 @@ ath_tx_task(void *arg, int npending) if (nacked) sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->sc_wd_timer = 0; if (sc->sc_softled) @@ -5226,7 +5226,7 @@ ath_draintxq(struct ath_softc *sc) } } #endif /* ATH_DEBUG */ - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->sc_wd_timer = 0; } diff --git a/sys/dev/netif/aue/if_aue.c b/sys/dev/netif/aue/if_aue.c index 88e56a1113..baf5be6100 100644 --- a/sys/dev/netif/aue/if_aue.c +++ b/sys/dev/netif/aue/if_aue.c @@ -1021,7 +1021,7 @@ aue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) /* XXX should hold serializer */ ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (!ifq_is_empty(&ifp->if_snd)) aue_start_schedule(ifp); @@ -1121,7 +1121,8 @@ aue_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) { + if ((ifp->if_flags & IFF_RUNNING) == 0 || + ifq_is_oactive(&ifp->if_snd)) { AUE_UNLOCK(sc); return; } @@ -1134,7 +1135,7 @@ aue_start(struct ifnet *ifp) if (aue_encap(sc, m_head, 0)) { /* aue_encap() will free m_head, if we reach here */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); AUE_UNLOCK(sc); return; } @@ -1145,7 +1146,7 @@ aue_start(struct ifnet *ifp) */ BPF_MTAP(ifp, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -1257,7 +1258,7 @@ aue_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->aue_stat_timer, hz, aue_tick, sc); @@ -1475,7 +1476,8 @@ aue_stop(struct aue_softc *sc) sc->aue_link = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); AUE_UNLOCK(sc); return; diff --git a/sys/dev/netif/axe/if_axe.c b/sys/dev/netif/axe/if_axe.c index e184c94b6c..5c27c1029d 100644 --- a/sys/dev/netif/axe/if_axe.c +++ b/sys/dev/netif/axe/if_axe.c @@ -681,7 +681,7 @@ axe_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); usbd_get_xfer_status(c->axe_xfer, NULL, NULL, NULL, &err); if (c->axe_mbuf != NULL) { @@ -765,7 +765,7 @@ axe_start(struct ifnet *ifp) return; } - if (ifp->if_flags & IFF_OACTIVE) { + if (ifq_is_oactive(&ifp->if_snd)) { return; } @@ -775,7 +775,7 @@ axe_start(struct ifnet *ifp) if (axe_encap(sc, m_head, 0)) { /* axe_encap() will free m_head, if we reach here */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -785,7 +785,7 @@ axe_start(struct ifnet *ifp) */ BPF_MTAP(ifp, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -876,7 +876,7 @@ axe_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->axe_stat_timer, hz, axe_tick, sc); } @@ -1047,7 +1047,8 @@ axe_stop(struct axe_softc *sc) } } - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); sc->axe_link = 0; } diff --git a/sys/dev/netif/bce/if_bce.c b/sys/dev/netif/bce/if_bce.c index f3a8e021b6..c1d5346456 100644 --- a/sys/dev/netif/bce/if_bce.c +++ b/sys/dev/netif/bce/if_bce.c @@ -3496,7 +3496,8 @@ bce_stop(struct bce_softc *sc) sc->bce_link = 0; sc->bce_coalchg_mask = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; } @@ -4638,7 +4639,7 @@ bce_tx_intr(struct bce_softc *sc, uint16_t hw_tx_cons) /* Clear the tx hardware queue full flag. */ if (sc->max_tx_bd - sc->used_tx_bd >= BCE_TX_SPARE_SPACE) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->tx_cons = sw_tx_cons; } @@ -4823,7 +4824,7 @@ bce_init(void *xsc) bce_ifmedia_upd(ifp); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset_bycpu(&sc->bce_tick_callout, hz, bce_tick, sc, sc->bce_intr_cpuid); @@ -5004,7 +5005,7 @@ bce_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { @@ -5015,7 +5016,7 @@ bce_start(struct ifnet *ifp) * unlikely to fail. */ if (sc->max_tx_bd - sc->used_tx_bd < BCE_TX_SPARE_SPACE) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -5035,7 +5036,7 @@ bce_start(struct ifnet *ifp) if (sc->used_tx_bd == 0) { continue; } else { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } diff --git a/sys/dev/netif/bfe/if_bfe.c b/sys/dev/netif/bfe/if_bfe.c index d79505ad49..23d92e6260 100644 --- a/sys/dev/netif/bfe/if_bfe.c +++ b/sys/dev/netif/bfe/if_bfe.c @@ -1091,7 +1091,7 @@ bfe_txeof(struct bfe_softc *sc) sc->bfe_tx_cons = i; if (sc->bfe_tx_cnt + BFE_SPARE_TXDESC < BFE_TX_LIST_CNT) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } if (sc->bfe_tx_cnt == 0) ifp->if_timer = 0; @@ -1293,7 +1293,7 @@ bfe_start(struct ifnet *ifp) return; } - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; idx = sc->bfe_tx_prod; @@ -1301,7 +1301,7 @@ bfe_start(struct ifnet *ifp) need_trans = 0; while (!ifq_is_empty(&ifp->if_snd)) { if (sc->bfe_tx_cnt + BFE_SPARE_TXDESC >= BFE_TX_LIST_CNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1318,13 +1318,13 @@ bfe_start(struct ifnet *ifp) ifp->if_oerrors++; if (sc->bfe_tx_cnt > 0) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } else { /* - * IFF_OACTIVE could not be set under + * ifq_set_oactive could not be called under * this situation, since except up/down, - * nothing will clear IFF_OACTIVE. + * nothing will call ifq_clr_oactive. * * Let's just keep draining the ifq ... */ @@ -1385,7 +1385,7 @@ bfe_init(void *xsc) bfe_ifmedia_upd(ifp); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->bfe_stat_timer, hz, bfe_tick, sc); } @@ -1529,5 +1529,6 @@ bfe_stop(struct bfe_softc *sc) bfe_tx_ring_free(sc); bfe_rx_ring_free(sc); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } diff --git a/sys/dev/netif/bge/if_bge.c b/sys/dev/netif/bge/if_bge.c index 1b44d3d4ae..b9c2680cbc 100644 --- a/sys/dev/netif/bge/if_bge.c +++ b/sys/dev/netif/bge/if_bge.c @@ -3053,7 +3053,7 @@ bge_txeof(struct bge_softc *sc, uint16_t tx_cons) if ((BGE_TX_RING_CNT - sc->bge_txcnt) >= (sc->bge_txrsvd + sc->bge_txspare)) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc->bge_txcnt == 0) ifp->if_timer = 0; @@ -3505,7 +3505,7 @@ bge_start(struct ifnet *ifp) uint32_t prodidx; int nsegs = 0; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; prodidx = sc->bge_tx_prodidx; @@ -3532,7 +3532,7 @@ bge_start(struct ifnet *ifp) (m_head->m_pkthdr.csum_flags & CSUM_DELAY_DATA)) { if ((BGE_TX_RING_CNT - sc->bge_txcnt) < m_head->m_pkthdr.csum_data + sc->bge_txrsvd) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m_head); break; } @@ -3546,7 +3546,7 @@ bge_start(struct ifnet *ifp) */ if ((BGE_TX_RING_CNT - sc->bge_txcnt) < (sc->bge_txrsvd + sc->bge_txspare)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m_head); break; } @@ -3557,7 +3557,7 @@ bge_start(struct ifnet *ifp) * for the NIC to drain the ring. */ if (bge_encap(sc, &m_head, &prodidx, &nsegs)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_oerrors++; break; } @@ -3714,7 +3714,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); callout_reset(&sc->bge_stat_timer, hz, bge_tick, sc); } @@ -4015,7 +4015,8 @@ bge_stop(struct bge_softc *sc) sc->bge_tx_saved_considx = BGE_TXCONS_UNSET; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; } diff --git a/sys/dev/netif/bnx/if_bnx.c b/sys/dev/netif/bnx/if_bnx.c index 8b4ea244aa..3d1ce3a754 100644 --- a/sys/dev/netif/bnx/if_bnx.c +++ b/sys/dev/netif/bnx/if_bnx.c @@ -2629,7 +2629,7 @@ bnx_txeof(struct bnx_softc *sc, uint16_t tx_cons) if ((BGE_TX_RING_CNT - sc->bnx_txcnt) >= (BNX_NSEG_RSVD + BNX_NSEG_SPARE)) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc->bnx_txcnt == 0) ifp->if_timer = 0; @@ -2985,7 +2985,7 @@ bnx_start(struct ifnet *ifp) uint32_t prodidx; int nsegs = 0; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; prodidx = sc->bnx_tx_prodidx; @@ -2999,7 +2999,7 @@ bnx_start(struct ifnet *ifp) */ if ((BGE_TX_RING_CNT - sc->bnx_txcnt) < (BNX_NSEG_RSVD + BNX_NSEG_SPARE)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -3013,7 +3013,7 @@ bnx_start(struct ifnet *ifp) * for the NIC to drain the ring. */ if (bnx_encap(sc, &m_head, &prodidx, &nsegs)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_oerrors++; break; } @@ -3148,7 +3148,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); callout_reset_bycpu(&sc->bnx_stat_timer, hz, bnx_tick, sc, sc->bnx_stat_cpuid); @@ -3419,7 +3419,8 @@ bnx_stop(struct bnx_softc *sc) sc->bnx_tx_saved_considx = BNX_TXCONS_UNSET; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; } diff --git a/sys/dev/netif/bwi/if_bwi.c b/sys/dev/netif/bwi/if_bwi.c index a0158b30eb..7ca742bf34 100644 --- a/sys/dev/netif/bwi/if_bwi.c +++ b/sys/dev/netif/bwi/if_bwi.c @@ -1494,7 +1494,7 @@ bwi_init_statechg(struct bwi_softc *sc, int statechg) bwi_enable_intrs(sc, BWI_INIT_INTRS); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (statechg) { if (ic->ic_opmode != IEEE80211_M_MONITOR) { @@ -1578,8 +1578,7 @@ bwi_start(struct ifnet *ifp) ASSERT_SERIALIZED(ifp->if_serializer); - 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; @@ -1667,7 +1666,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; } } @@ -1748,7 +1747,8 @@ bwi_stop(struct bwi_softc *sc, int state_chg) sc->sc_tx_timer = 0; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); return 0; } @@ -3250,7 +3250,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)) ifp->if_start(ifp); } @@ -3330,7 +3330,7 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt) if (tbd->tbd_used == 0) sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -3385,7 +3385,7 @@ bwi_txeof(struct bwi_softc *sc) data_txcnt); } - if ((ifp->if_flags & IFF_OACTIVE) == 0) + if (!ifq_is_oactive(&ifp->if_snd)) ifp->if_start(ifp); } diff --git a/sys/dev/netif/cs/if_cs.c b/sys/dev/netif/cs/if_cs.c index 1a13b40685..36477aae66 100644 --- a/sys/dev/netif/cs/if_cs.c +++ b/sys/dev/netif/cs/if_cs.c @@ -797,7 +797,7 @@ cs_init(void *xsc) * Set running and clear output active flags */ sc->arpcom.ac_if.if_flags |= IFF_RUNNING; - sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->arpcom.ac_if.if_snd); /* * Start sending process @@ -906,18 +906,18 @@ csintr(void *arg) ifp->if_opackets++; else ifp->if_oerrors++; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; break; case ISQ_BUFFER_EVENT: if (status & READY_FOR_TX) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; } if (status & TX_UNDERRUN) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; ifp->if_oerrors++; } @@ -933,7 +933,7 @@ csintr(void *arg) } } - if (!(ifp->if_flags & IFF_OACTIVE)) + if (!ifq_is_oactive(&ifp->if_snd)) if_devstart(ifp); } @@ -1022,7 +1022,7 @@ cs_start(struct ifnet *ifp) */ if (!(cs_readreg(sc->nic_addr, PP_BusST) & READY_FOR_TX_NOW)) { ifp->if_timer = sc->buf_len; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -1035,7 +1035,7 @@ cs_start(struct ifnet *ifp) */ ifp->if_timer = length; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } } @@ -1051,7 +1051,8 @@ cs_stop(struct cs_softc *sc) cs_writereg(sc->nic_addr, PP_BufCFG, 0); cs_writereg(sc->nic_addr, PP_BusCTL, 0); - sc->arpcom.ac_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&sc->arpcom.ac_if.if_snd); sc->arpcom.ac_if.if_timer = 0; } diff --git a/sys/dev/netif/cue/if_cue.c b/sys/dev/netif/cue/if_cue.c index 1dd32fc853..2d9a50b417 100644 --- a/sys/dev/netif/cue/if_cue.c +++ b/sys/dev/netif/cue/if_cue.c @@ -724,7 +724,7 @@ cue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); usbd_get_xfer_status(c->cue_xfer, NULL, NULL, NULL, &err); if (c->cue_mbuf != NULL) { @@ -820,7 +820,7 @@ cue_start(struct ifnet *ifp) sc = ifp->if_softc; CUE_LOCK(sc); - if (ifp->if_flags & IFF_OACTIVE) { + if (ifq_is_oactive(&ifp->if_snd)) { CUE_UNLOCK(sc); return; } @@ -833,7 +833,7 @@ cue_start(struct ifnet *ifp) if (cue_encap(sc, m_head, 0)) { /* cue_encap() will free m_head, if we reach here */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); CUE_UNLOCK(sc); return; } @@ -844,7 +844,7 @@ cue_start(struct ifnet *ifp) */ BPF_MTAP(ifp, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -947,7 +947,7 @@ cue_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); CUE_UNLOCK(sc); @@ -1118,7 +1118,8 @@ cue_stop(struct cue_softc *sc) } } - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); CUE_UNLOCK(sc); return; diff --git a/sys/dev/netif/dc/if_dc.c b/sys/dev/netif/dc/if_dc.c index 202ab7c9d7..b289edc0a8 100644 --- a/sys/dev/netif/dc/if_dc.c +++ b/sys/dev/netif/dc/if_dc.c @@ -2706,7 +2706,7 @@ dc_txeof(struct dc_softc *sc) if (idx != sc->dc_cdata.dc_tx_cons) { /* some buffers have been freed */ sc->dc_cdata.dc_tx_cons = idx; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } ifp->if_timer = (sc->dc_cdata.dc_tx_cnt == 0) ? 0 : 5; @@ -3087,7 +3087,7 @@ dc_start(struct ifnet *ifp) return; } - if (ifp->if_flags & IFF_OACTIVE) + if (ifq_is_oactive(&ifp->if_snd)) return; idx = sc->dc_cdata.dc_tx_prod; @@ -3109,12 +3109,12 @@ dc_start(struct ifnet *ifp) if ((sc->dc_flags & DC_TX_ADMTEK_WAR) && idx != sc->dc_cdata.dc_tx_prod && idx == (DC_TX_LIST_CNT - 1)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m_head); break; } if ((DC_TX_LIST_CNT - sc->dc_cdata.dc_tx_cnt) < 5) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m_head); break; } @@ -3122,7 +3122,7 @@ dc_start(struct ifnet *ifp) /* only coalesce if have >1 mbufs */ m_defragged = m_defrag(m_head, MB_DONTWAIT); if (m_defragged == NULL) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m_head); break; } @@ -3140,7 +3140,7 @@ dc_start(struct ifnet *ifp) } else { ifq_prepend(&ifp->if_snd, m_head); } - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -3153,7 +3153,7 @@ dc_start(struct ifnet *ifp) BPF_MTAP(ifp, m_head); if (sc->dc_flags & DC_TX_ONE) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } @@ -3323,7 +3323,7 @@ dc_init(void *xsc) * working. */ ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* * Load the RX/multicast filter. We do this sort of late @@ -3479,7 +3479,8 @@ dc_stop(struct dc_softc *sc) callout_stop(&sc->dc_stat_timer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_RX_ON|DC_NETCFG_TX_ON)); CSR_WRITE_4(sc, DC_IMR, 0x00000000); diff --git a/sys/dev/netif/de/if_de.c b/sys/dev/netif/de/if_de.c index 7700bd7a02..b7ca4e7d5f 100644 --- a/sys/dev/netif/de/if_de.c +++ b/sys/dev/netif/de/if_de.c @@ -282,7 +282,7 @@ tulip_linkup(tulip_softc_t *sc, tulip_media_t media) if ((sc->tulip_flags & TULIP_LINKUP) == 0) sc->tulip_flags |= TULIP_PRINTLINKUP; sc->tulip_flags |= TULIP_LINKUP; - sc->tulip_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->tulip_if.if_snd); #if 0 /* XXX how does with work with ifmedia? */ if ((sc->tulip_flags & TULIP_DIDNWAY) == 0) { if (sc->tulip_if.if_flags & IFF_FULLDUPLEX) { @@ -532,7 +532,7 @@ tulip_media_poll(tulip_softc_t *sc, tulip_mediapoll_event_t event) } if (event == TULIP_MEDIAPOLL_START) { - sc->tulip_if.if_flags |= IFF_OACTIVE; + ifq_set_oactive(&sc->tulip_if.if_snd); if (sc->tulip_probe_state != TULIP_PROBE_INACTIVE) return; sc->tulip_probe_mediamask = 0; @@ -901,7 +901,7 @@ tulip_21041_media_poll(tulip_softc_t *sc, tulip_mediapoll_event_t event) * 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); #ifdef notyet if (sc->tulip_revinfo >= 0x20) { @@ -2902,7 +2902,7 @@ tulip_reset(tulip_softc_t *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; } @@ -2996,7 +2996,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; } @@ -3298,7 +3298,7 @@ tulip_tx_intr(tulip_softc_t *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. @@ -3598,7 +3598,7 @@ tulip_txput(tulip_softc_t *sc, struct mbuf *m) 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; return NULL; } @@ -3623,7 +3623,7 @@ tulip_txput(tulip_softc_t *sc, struct mbuf *m) */ finish: if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_DOINGSETUP)) { - sc->tulip_if.if_flags |= IFF_OACTIVE; + ifq_set_oactive(&sc->tulip_if.if_snd); sc->tulip_if.if_start = tulip_ifstart; if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) { sc->tulip_intrmask |= TULIP_STS_TXINTR; diff --git a/sys/dev/netif/ed/if_ed.c b/sys/dev/netif/ed/if_ed.c index 16ada2324d..cbcc3449bf 100644 --- a/sys/dev/netif/ed/if_ed.c +++ b/sys/dev/netif/ed/if_ed.c @@ -1992,7 +1992,7 @@ ed_init(void *xsc) * 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 @@ -2061,7 +2061,7 @@ ed_xmit(struct ed_softc *sc) * 1) that the current priority is set to splimp _before_ this code * is called *and* is returned to the appropriate priority after * return - * 2) that the IFF_OACTIVE flag is checked before this code is called + * 2) that the OACTIVE flag is checked before this code is called * (i.e. that the output part of the interface is idle) */ static void @@ -2096,7 +2096,7 @@ outloop: /* * No room. Indicate this to the outside world and exit. */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } m = ifq_dequeue(&ifp->if_snd, NULL); @@ -2109,7 +2109,7 @@ outloop: * transmitter may be active, but if we haven't filled all the * buffers with data then we still want to accept more. */ - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); return; } @@ -2456,7 +2456,7 @@ edintr(void *arg) * reset tx busy and output active flags */ sc->xmit_busy = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* * clear watchdog timer @@ -2586,7 +2586,7 @@ edintr(void *arg) * attempt to start output on the interface. This is done * after handling the receiver to give the receiver priority. */ - if ((ifp->if_flags & IFF_OACTIVE) == 0) + if (!ifq_is_oactive(&ifp->if_snd)) if_devstart(ifp); /* diff --git a/sys/dev/netif/em/if_em.c b/sys/dev/netif/em/if_em.c index 90d8df88fb..6bdea6d126 100644 --- a/sys/dev/netif/em/if_em.c +++ b/sys/dev/netif/em/if_em.c @@ -996,7 +996,7 @@ em_start(struct ifnet *ifp) ASSERT_SERIALIZED(ifp->if_serializer); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; if (!adapter->link_active) { @@ -1009,7 +1009,7 @@ em_start(struct ifnet *ifp) if (EM_IS_OACTIVE(adapter)) { em_tx_collect(adapter); if (EM_IS_OACTIVE(adapter)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); adapter->no_tx_desc_avail1++; break; } @@ -1212,7 +1212,7 @@ em_watchdog(struct ifnet *ifp) * the TX engine should have been idled for some time. * We don't need to call if_devstart() here. */ - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; return; } @@ -1374,7 +1374,7 @@ em_init(void *xsc) em_set_promisc(adapter); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&adapter->timer, hz, em_timer, adapter); e1000_clear_hw_cntrs_base_generic(&adapter->hw); @@ -2173,7 +2173,8 @@ em_stop(struct adapter *adapter) callout_stop(&adapter->timer); callout_stop(&adapter->tx_fifo_timer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; e1000_reset_hw(&adapter->hw); @@ -2948,7 +2949,7 @@ em_txeof(struct adapter *adapter) } if (!EM_IS_OACTIVE(adapter)) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* All clean, turn off the timer */ if (adapter->num_tx_desc_avail == adapter->num_tx_desc) @@ -3008,7 +3009,7 @@ em_tx_collect(struct adapter *adapter) adapter->num_tx_desc_avail = num_avail; if (!EM_IS_OACTIVE(adapter)) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* All clean, turn off the timer */ if (adapter->num_tx_desc_avail == adapter->num_tx_desc) diff --git a/sys/dev/netif/emx/if_emx.c b/sys/dev/netif/emx/if_emx.c index c237d2f406..3cf99e1be5 100644 --- a/sys/dev/netif/emx/if_emx.c +++ b/sys/dev/netif/emx/if_emx.c @@ -945,7 +945,7 @@ emx_start(struct ifnet *ifp) ASSERT_SERIALIZED(&sc->tx_data.tx_serialize); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; if (!sc->link_active) { @@ -958,7 +958,7 @@ emx_start(struct ifnet *ifp) if (EMX_IS_OACTIVE(tdata)) { emx_tx_collect(tdata); if (EMX_IS_OACTIVE(tdata)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } @@ -1145,7 +1145,7 @@ emx_watchdog(struct ifnet *ifp) * the TX engine should have been idled for some time. * We don't need to call if_devstart() here. */ - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; return; } @@ -1275,7 +1275,7 @@ emx_init(void *xsc) emx_set_promisc(sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->timer, hz, emx_timer, sc); e1000_clear_hw_cntrs_base_generic(&sc->hw); @@ -1824,7 +1824,8 @@ emx_stop(struct emx_softc *sc) callout_stop(&sc->timer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; /* @@ -2416,7 +2417,7 @@ emx_txeof(struct emx_txdata *tdata) } if (!EMX_IS_OACTIVE(tdata)) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* All clean, turn off the timer */ if (tdata->num_tx_desc_avail == tdata->num_tx_desc) @@ -2476,7 +2477,7 @@ emx_tx_collect(struct emx_txdata *tdata) tdata->num_tx_desc_avail = num_avail; if (!EMX_IS_OACTIVE(tdata)) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* All clean, turn off the timer */ if (tdata->num_tx_desc_avail == tdata->num_tx_desc) diff --git a/sys/dev/netif/ep/if_ep.c b/sys/dev/netif/ep/if_ep.c index 37afd8b117..3a75732d84 100644 --- a/sys/dev/netif/ep/if_ep.c +++ b/sys/dev/netif/ep/if_ep.c @@ -383,7 +383,7 @@ ep_if_init(void *xsc) outw(BASE + EP_COMMAND, TX_ENABLE); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; /* just in case */ + ifq_clr_oactive(&ifp->if_snd); /* just in case */ #ifdef EP_LOCAL_STATS sc->rx_no_first = sc->rx_no_mbuf = @@ -427,7 +427,7 @@ ep_if_start(struct ifnet *ifp) } while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); - if (ifp->if_flags & IFF_OACTIVE) { + if (ifq_is_oactive(&ifp->if_snd)) { return; } @@ -463,7 +463,7 @@ startagain: outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | (len + pad + 4)); /* make sure */ if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, top); crit_exit(); return; @@ -549,7 +549,7 @@ rescan: if (status & S_TX_AVAIL) { /* we need ACK */ ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); GO_WINDOW(1); inw(BASE + EP_W1_FREE_TX); if_devstart(ifp); @@ -611,7 +611,7 @@ rescan: outb(BASE + EP_W1_TX_STATUS, 0x0); /* pops up the next * status */ } /* while */ - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); GO_WINDOW(1); inw(BASE + EP_W1_FREE_TX); if_devstart(ifp); @@ -879,7 +879,7 @@ ep_if_watchdog(struct ifnet *ifp) return; } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if_devstart(ifp); ep_intr(ifp->if_softc); } diff --git a/sys/dev/netif/et/if_et.c b/sys/dev/netif/et/if_et.c index 5d41de0146..59d0b35ef1 100644 --- a/sys/dev/netif/et/if_et.c +++ b/sys/dev/netif/et/if_et.c @@ -571,7 +571,8 @@ et_stop(struct et_softc *sc) sc->sc_flags &= ~ET_FLAG_TXRX_ENABLED; ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } static int @@ -1127,7 +1128,7 @@ et_init(void *xsc) 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); @@ -1208,7 +1209,7 @@ et_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; oactive = 0; @@ -1219,7 +1220,7 @@ et_start(struct ifnet *ifp) if ((tbd->tbd_used + ET_NSEG_SPARE) > ET_TX_NDESC) { if (oactive) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1242,7 +1243,7 @@ et_start(struct ifnet *ifp) * Excessive fragmented packets */ if (oactive) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } et_txeof(sc, 0); @@ -2057,7 +2058,7 @@ et_txeof(struct et_softc *sc, int start) if (tbd->tbd_used == 0) 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); if (start) if_devstart(ifp); diff --git a/sys/dev/netif/ex/if_ex.c b/sys/dev/netif/ex/if_ex.c index d420a036ea..e487c1fbdb 100644 --- a/sys/dev/netif/ex/if_ex.c +++ b/sys/dev/netif/ex/if_ex.c @@ -342,7 +342,7 @@ ex_init(void *xsc) 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, kprintf("OIDLE init\n");); /* @@ -375,7 +375,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) == 0) { + while (!ifq_is_oactive(&ifp->if_snd)) { opkt = ifq_dequeue(&ifp->if_snd, NULL); if (opkt == NULL) break; @@ -523,7 +523,7 @@ ex_start(struct ifnet *ifp) ifp->if_opackets++; m_freem(opkt); } else { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, opkt); DODEBUG(Status, kprintf("OACTIVE start\n");); } @@ -647,7 +647,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, kprintf("OIDLE tx_intr\n");); DODEBUG(Start_End, kprintf("ex_tx_intr%d: finish\n", unit);); @@ -820,7 +820,7 @@ ex_watchdog(struct ifnet *ifp) DODEBUG(Start_End, kprintf("ex_watchdog%d: start\n", ifp->if_dunit);); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); DODEBUG(Status, kprintf("OIDLE watchdog\n");); diff --git a/sys/dev/netif/fe/if_fe.c b/sys/dev/netif/fe/if_fe.c index 67441ef4da..c1f7606a72 100644 --- a/sys/dev/netif/fe/if_fe.c +++ b/sys/dev/netif/fe/if_fe.c @@ -963,7 +963,8 @@ fe_stop (struct fe_softc *sc) DELAY(200); /* Reset transmitter variables and interface flags. */ - sc->sc_if.if_flags &= ~(IFF_OACTIVE | IFF_RUNNING); + sc->sc_if.if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&sc->sc_if.if_snd); sc->sc_if.if_timer = 0; sc->txb_free = sc->txb_size; sc->txb_count = 0; @@ -1142,7 +1143,7 @@ fe_xmit (struct fe_softc *sc) * 1) that the current priority is set to splimp _before_ this code * is called *and* is returned to the appropriate priority after * return - * 2) that the IFF_OACTIVE flag is checked before this code is called + * 2) that the OACTIVE flag is checked before this code is called * (i.e. that the output part of the interface is idle) */ void @@ -1280,7 +1281,7 @@ fe_start (struct ifnet *ifp) * filled all the buffers with data then we still * want to accept more. */ - sc->sc_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->sc_if.if_snd); return; indicate_active: @@ -1288,7 +1289,7 @@ fe_start (struct ifnet *ifp) * The transmitter is active, and there are no room for * more outgoing packets in the transmission buffer. */ - sc->sc_if.if_flags |= IFF_OACTIVE; + ifq_set_oactive(&sc->sc_if.if_snd); return; } @@ -1517,7 +1518,7 @@ fe_tint (struct fe_softc * sc, u_char tstat) * The transmitter is no more active. * Reset output active flag and watchdog timer. */ - sc->sc_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->sc_if.if_snd); sc->sc_if.if_timer = 0; /* @@ -1711,7 +1712,7 @@ fe_intr (void *arg) if (sc->filter_change && sc->txb_count == 0 && sc->txb_sched == 0) { fe_loadmar(sc); - sc->sc_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->sc_if.if_snd); } /* @@ -1727,7 +1728,7 @@ fe_intr (void *arg) * receiver interrupts. 86960 can raise a receiver * interrupt when the transmission buffer is full. */ - if ((sc->sc_if.if_flags & IFF_OACTIVE) == 0) + if (!ifq_is_oactive(&sc->sc_if.if_snd)) if_devstart(&sc->sc_if); } diff --git a/sys/dev/netif/fwe/if_fwe.c b/sys/dev/netif/fwe/if_fwe.c index 9c1ab41d15..c3b20db511 100644 --- a/sys/dev/netif/fwe/if_fwe.c +++ b/sys/dev/netif/fwe/if_fwe.c @@ -253,7 +253,8 @@ fwe_stop(struct fwe_softc *fwe) fc = fwe->fd.fc; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (fwe->dma_ch >= 0) { xferq = fc->ir[fwe->dma_ch]; @@ -384,7 +385,7 @@ found: fc->irx_enable(fc, fwe->dma_ch); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } @@ -464,12 +465,12 @@ fwe_start(struct ifnet *ifp) ifq_purge(&ifp->if_snd); } else { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); if (!ifq_is_empty(&ifp->if_snd)) fwe_as_output(fwe, ifp); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } } diff --git a/sys/dev/netif/fxp/if_fxp.c b/sys/dev/netif/fxp/if_fxp.c index acb90ded55..4f45277746 100644 --- a/sys/dev/netif/fxp/if_fxp.c +++ b/sys/dev/netif/fxp/if_fxp.c @@ -1064,7 +1064,7 @@ fxp_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; txp = NULL; @@ -1185,7 +1185,7 @@ tbdinit: } if (sc->tx_queued >= FXP_USABLE_TXCB) - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * We're finished. If we added to the list, issue a RESUME to get DMA @@ -1339,7 +1339,7 @@ fxp_intr_body(struct fxp_softc *sc, u_int8_t statack, int count) sc->cbl_first = txp; if (sc->tx_queued < FXP_USABLE_TXCB) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc->tx_queued == 0) { ifp->if_timer = 0; @@ -1504,7 +1504,7 @@ fxp_tick(void *xsc) sc->cbl_first = txp; if (sc->tx_queued < FXP_USABLE_TXCB) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc->tx_queued == 0) ifp->if_timer = 0; @@ -1576,7 +1576,8 @@ fxp_stop(struct fxp_softc *sc) ASSERT_SERIALIZED(ifp->if_serializer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; /* @@ -1871,7 +1872,7 @@ fxp_init(void *xsc) mii_mediachg(device_get_softc(sc->miibus)); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* * Enable interrupts. diff --git a/sys/dev/netif/igb/if_igb.c b/sys/dev/netif/igb/if_igb.c index 47399f47df..22280d3c64 100644 --- a/sys/dev/netif/igb/if_igb.c +++ b/sys/dev/netif/igb/if_igb.c @@ -953,7 +953,7 @@ igb_init(void *xsc) igb_set_promisc(sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (polling || sc->intr_type == PCI_INTR_TYPE_MSIX) sc->timer_cpuid = 0; /* XXX fixed */ @@ -1256,7 +1256,8 @@ igb_stop(struct igb_softc *sc) callout_stop(&sc->timer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; e1000_reset_hw(&sc->hw); @@ -1985,11 +1986,11 @@ igb_txeof(struct igb_tx_ring *txr) txr->tx_avail = avail; /* - * If we have a minimum free, clear IFF_OACTIVE + * If we have a minimum free, clear OACTIVE * to tell the stack that it is OK to send packets. */ if (IGB_IS_NOT_OACTIVE(txr)) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* * We have enough TX descriptors, turn off @@ -3310,7 +3311,7 @@ igb_start(struct ifnet *ifp) ASSERT_SERIALIZED(&txr->tx_serialize); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; if (!sc->link_active) { @@ -3323,7 +3324,7 @@ igb_start(struct ifnet *ifp) while (!ifq_is_empty(&ifp->if_snd)) { if (IGB_IS_OACTIVE(txr)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* Set watchdog on */ ifp->if_timer = 5; break; diff --git a/sys/dev/netif/iwi/if_iwi.c b/sys/dev/netif/iwi/if_iwi.c index 8876bf70cf..f351b91e96 100644 --- a/sys/dev/netif/iwi/if_iwi.c +++ b/sys/dev/netif/iwi/if_iwi.c @@ -1610,7 +1610,7 @@ iwi_tx_intr(struct iwi_softc *sc, struct iwi_tx_ring *txq) } sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc->sc_softled) iwi_led_event(sc, IWI_LED_TX); @@ -1943,7 +1943,7 @@ iwi_start_locked(struct ifnet *ifp) /* there is no place left in this ring; tail drop */ /* XXX tail drop */ IF_PREPEND(&ifp->if_snd, m); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -3111,7 +3111,7 @@ iwi_init_locked(struct iwi_softc *sc) } callout_reset(&sc->sc_wdtimer_callout, hz, iwi_watchdog, sc); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; return; fail: @@ -3139,7 +3139,8 @@ iwi_stop_locked(void *priv) struct iwi_softc *sc = priv; struct ifnet *ifp = sc->sc_ifp; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (sc->sc_softled) { callout_stop(&sc->sc_ledtimer_callout); diff --git a/sys/dev/netif/iwl/iwl2100.c b/sys/dev/netif/iwl/iwl2100.c index 85f0716f69..058d124980 100644 --- a/sys/dev/netif/iwl/iwl2100.c +++ b/sys/dev/netif/iwl/iwl2100.c @@ -467,7 +467,8 @@ iwl2100_hw_stop(struct iwl2100_softc *sc) iwl2100_free_cmd(sc); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); sc->sc_tx_timer = 0; sc->sc_flags &= ~(IWL2100_F_WAITCMD | @@ -854,7 +855,7 @@ iwl2100_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; if ((sc->sc_flags & IWL2100_F_IFSTART) == 0) { @@ -937,7 +938,7 @@ iwl2100_start(struct ifnet *ifp) } if (tr->tr_used >= IWL2100_TX_USED_MAX) - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); if (trans) { bus_dmamap_sync(tr->tr_dtag, tr->tr_dmap, BUS_DMASYNC_PREWRITE); @@ -2507,7 +2508,7 @@ next: sc->sc_tx_timer = 0; } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if_devstart(ifp); } } @@ -3185,7 +3186,7 @@ iwl2100_hw_init(struct iwl2100_softc *sc, const uint8_t *bssid, } } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; back: if (error) diff --git a/sys/dev/netif/iwn/if_iwn.c b/sys/dev/netif/iwn/if_iwn.c index 1c634cc833..91b0c671da 100644 --- a/sys/dev/netif/iwn/if_iwn.c +++ b/sys/dev/netif/iwn/if_iwn.c @@ -2428,9 +2428,8 @@ iwn_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, int ackfailcnt, sc->sc_tx_timer = 0; if (--ring->queued < IWN_TX_RING_LOMARK) { sc->qfullmsk &= ~(1 << ring->qid); - if (sc->qfullmsk == 0 && - (ifp->if_flags & IFF_OACTIVE)) { - ifp->if_flags &= ~IFF_OACTIVE; + if (sc->qfullmsk == 0 && ifq_is_oactive(&ifp->if_snd)) { + ifq_clr_oactive(&ifp->if_snd); iwn_start_locked(ifp); } } @@ -3382,7 +3381,7 @@ iwn_start_locked(struct ifnet *ifp) for (;;) { if (sc->qfullmsk != 0) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } m = ifq_dequeue(&ifp->if_snd, NULL); @@ -6187,7 +6186,7 @@ iwn_init_locked(struct iwn_softc *sc) goto fail; } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; if (wlan_serializer_needed) wlan_serialize_exit(); @@ -6221,7 +6220,8 @@ iwn_stop_locked(struct iwn_softc *sc) sc->sc_tx_timer = 0; callout_stop(&sc->sc_timer_to); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* Power OFF hardware. */ iwn_hw_stop(sc); diff --git a/sys/dev/netif/ixgbe/ixgbe.c b/sys/dev/netif/ixgbe/ixgbe.c index 274affda39..eec64fc695 100644 --- a/sys/dev/netif/ixgbe/ixgbe.c +++ b/sys/dev/netif/ixgbe/ixgbe.c @@ -687,7 +687,7 @@ ixgbe_start_locked(struct tx_ring *txr, struct ifnet * ifp) IXGBE_TX_LOCK_ASSERT(txr); - if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; if (!adapter->link_active) { @@ -1266,7 +1266,7 @@ ixgbe_init_locked(struct adapter *adapter) /* Now inform the stack we're ready */ ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); return; } @@ -1882,10 +1882,9 @@ ixgbe_local_timer(void *arg) goto watchdog; /* Only turn off the stack flow when ALL are depleted */ if (busy == adapter->num_queues) - ifp->if_flags |= IFF_OACTIVE; - else if ((ifp->if_flags & IFF_OACTIVE) && - (busy < adapter->num_queues)) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); + else if (ifq_is_oactive(&ifp->if_snd) && (busy < adapter->num_queues)) + ifq_clr_oactive(&ifp->if_snd); out: ixgbe_rearm_queues(adapter, adapter->que_mask); @@ -1973,7 +1972,7 @@ ixgbe_stop(void *arg) /* Let the stack know...*/ ifp->if_flags &= ~IFF_RUNNING; - ifp->if_flags |= IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ixgbe_reset_hw(hw); hw->adapter_stopped = FALSE; diff --git a/sys/dev/netif/jme/if_jme.c b/sys/dev/netif/jme/if_jme.c index b25b427ef7..c96c0c3217 100644 --- a/sys/dev/netif/jme/if_jme.c +++ b/sys/dev/netif/jme/if_jme.c @@ -404,7 +404,8 @@ jme_miibus_statchg(device_t 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; callout_stop(&sc->jme_tick_ch); @@ -479,7 +480,7 @@ jme_miibus_statchg(device_t dev) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset_bycpu(&sc->jme_tick_ch, hz, jme_tick, sc, JME_TICK_CPUID); @@ -1809,7 +1810,7 @@ jme_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; if (tdata->jme_tx_cnt >= JME_TX_DESC_HIWAT(tdata)) @@ -1822,7 +1823,7 @@ jme_start(struct ifnet *ifp) */ if (tdata->jme_tx_cnt + JME_TXD_SPARE > tdata->jme_tx_desc_cnt - JME_TXD_RSVD) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1838,7 +1839,7 @@ jme_start(struct ifnet *ifp) if (jme_encap(tdata, &m_head, &enq)) { KKASSERT(m_head == NULL); ifp->if_oerrors++; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2260,7 +2261,7 @@ jme_txeof(struct jme_txdata *tdata) if (tdata->jme_tx_cnt + JME_TXD_SPARE <= tdata->jme_tx_desc_cnt - JME_TXD_RSVD) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static __inline void @@ -2879,7 +2880,7 @@ jme_init(void *xsc) JME_TICK_CPUID); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -2897,7 +2898,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; callout_stop(&sc->jme_tick_ch); diff --git a/sys/dev/netif/kue/if_kue.c b/sys/dev/netif/kue/if_kue.c index af66b9c017..416250d4bb 100644 --- a/sys/dev/netif/kue/if_kue.c +++ b/sys/dev/netif/kue/if_kue.c @@ -712,7 +712,7 @@ kue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) ifp = &sc->arpcom.ac_if; 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) { @@ -794,7 +794,7 @@ kue_start(struct ifnet *ifp) sc = ifp->if_softc; KUE_LOCK(sc); - if (ifp->if_flags & IFF_OACTIVE) { + if (ifq_is_oactive(&ifp->if_snd)) { KUE_UNLOCK(sc); return; } @@ -807,7 +807,7 @@ kue_start(struct ifnet *ifp) if (kue_encap(sc, m_head, 0)) { /* kue_encap() will free m_head, if we reach here */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); KUE_UNLOCK(sc); return; } @@ -818,7 +818,7 @@ kue_start(struct ifnet *ifp) */ BPF_MTAP(ifp, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -913,7 +913,7 @@ kue_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd) KUE_UNLOCK(sc); @@ -1080,7 +1080,8 @@ kue_stop(struct kue_softc *sc) } } - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); KUE_UNLOCK(sc); return; diff --git a/sys/dev/netif/lge/if_lge.c b/sys/dev/netif/lge/if_lge.c index f15f8574e4..40a80733d8 100644 --- a/sys/dev/netif/lge/if_lge.c +++ b/sys/dev/netif/lge/if_lge.c @@ -973,7 +973,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); } static void @@ -1134,7 +1134,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; need_timer = 0; @@ -1143,7 +1143,7 @@ lge_start(struct ifnet *ifp) int frags; if (CSR_READ_1(sc, LGE_TXCMDFREE_8BIT) == 0) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1316,7 +1316,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); callout_reset(&sc->lge_stat_timer, hz, lge_tick, sc); } @@ -1471,7 +1471,8 @@ lge_stop(struct lge_softc *sc) bzero(&sc->lge_ldata->lge_tx_list, sizeof(sc->lge_ldata->lge_tx_list)); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } /* diff --git a/sys/dev/netif/lgue/if_lgue.c b/sys/dev/netif/lgue/if_lgue.c index 6b53eea245..3a94b09ee6 100644 --- a/sys/dev/netif/lgue/if_lgue.c +++ b/sys/dev/netif/lgue/if_lgue.c @@ -443,7 +443,7 @@ lgue_start_transfer(struct lgue_softc *sc) { m_freem(entry->entry_mbuf); kfree(entry, M_USBDEV); lgue_stop(sc); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); return(EIO); } @@ -451,7 +451,7 @@ lgue_start_transfer(struct lgue_softc *sc) { kfree(entry, M_USBDEV); sc->lgue_tx_cnt++; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_timer = 5; return(0); } @@ -522,7 +522,7 @@ lgue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } /* @@ -538,7 +538,7 @@ lgue_start(struct ifnet *ifp) if (sc->lgue_dying) return; - if (ifp->if_flags & IFF_OACTIVE) { + if (ifq_is_oactive(&ifp->if_snd)) { return; } @@ -647,7 +647,8 @@ lgue_stop(struct lgue_softc *sc) kfree(entry, M_USBDEV); } - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } /* @@ -720,7 +721,7 @@ lgue_init(void *xsc) STAILQ_INIT(&sc->lgue_tx_queue); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->lgue_dying = 0; diff --git a/sys/dev/netif/lnc/am7990.c b/sys/dev/netif/lnc/am7990.c index 2d7fd3f235..bfba8d4281 100644 --- a/sys/dev/netif/lnc/am7990.c +++ b/sys/dev/netif/lnc/am7990.c @@ -333,7 +333,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) @@ -495,8 +495,7 @@ am7990_start_locked(struct lance_softc *sc) struct mbuf *m; int bix, enq, len, rp; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != - IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; bix = sc->sc_last_td; @@ -508,7 +507,7 @@ am7990_start_locked(struct lance_softc *sc) (*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); if_printf(ifp, "missing buffer, no_td = %d, last_td = %d\n", sc->sc_no_td, sc->sc_last_td); @@ -555,7 +554,7 @@ am7990_start_locked(struct lance_softc *sc) bix = 0; if (++sc->sc_no_td == sc->sc_ntbuf) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } diff --git a/sys/dev/netif/lnc/am79900.c b/sys/dev/netif/lnc/am79900.c index 08095a292f..a575ae4552 100644 --- a/sys/dev/netif/lnc/am79900.c +++ b/sys/dev/netif/lnc/am79900.c @@ -369,7 +369,7 @@ am79900_tint(struct lance_softc *sc) if (tmd1 & LE_T1_OWN) break; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (tmd1 & LE_T1_ERR) { tmd2 = LE_LE32TOH(tmd.tmd2); @@ -531,8 +531,7 @@ am79900_start_locked(struct lance_softc *sc) struct mbuf *m; int bix, enq, len, rp; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != - IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; bix = sc->sc_last_td; @@ -544,7 +543,7 @@ am79900_start_locked(struct lance_softc *sc) (*sc->sc_copyfromdesc)(sc, &tmd, rp, sizeof(tmd)); if (LE_LE32TOH(tmd.tmd1) & LE_T1_OWN) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); if_printf(ifp, "missing buffer, no_td = %d, last_td = %d\n", sc->sc_no_td, sc->sc_last_td); @@ -592,7 +591,7 @@ am79900_start_locked(struct lance_softc *sc) bix = 0; if (++sc->sc_no_td == sc->sc_ntbuf) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } diff --git a/sys/dev/netif/lnc/lance.c b/sys/dev/netif/lnc/lance.c index 7817bd0d70..2f80de67b8 100644 --- a/sys/dev/netif/lnc/lance.c +++ b/sys/dev/netif/lnc/lance.c @@ -229,7 +229,8 @@ lance_stop(struct lance_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->sc_wrcsr)(sc, LE_CSR0, LE_C0_STOP); @@ -297,7 +298,7 @@ lance_init_locked(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; if_devstart(ifp); } else diff --git a/sys/dev/netif/msk/if_msk.c b/sys/dev/netif/msk/if_msk.c index 990f7811e0..039cb1b5fd 100644 --- a/sys/dev/netif/msk/if_msk.c +++ b/sys/dev/netif/msk/if_msk.c @@ -2615,13 +2615,13 @@ msk_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; enq = 0; while (!ifq_is_empty(&ifp->if_snd)) { if (MSK_IS_OACTIVE(sc_if)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2639,7 +2639,7 @@ msk_start(struct ifnet *ifp) if (sc_if->msk_cdata.msk_tx_cnt == 0) { continue; } else { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } @@ -2936,7 +2936,7 @@ msk_txeof(struct msk_if_softc *sc_if, int idx) if (prog > 0) { sc_if->msk_cdata.msk_tx_cons = cons; if (!MSK_IS_OACTIVE(sc_if)) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc_if->msk_cdata.msk_tx_cnt == 0) ifp->if_timer = 0; /* No need to sync LEs as we didn't update LEs. */ @@ -3607,7 +3607,7 @@ msk_init(void *xsc) mskc_set_imtimer(sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc_if->msk_tick_ch, hz, msk_tick, sc_if); } @@ -3834,7 +3834,8 @@ msk_stop(struct msk_if_softc *sc_if) /* * Mark the interface down. */ - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); sc_if->msk_link = 0; } diff --git a/sys/dev/netif/mxge/if_mxge.c b/sys/dev/netif/mxge/if_mxge.c index aa7d0ae2e1..45324ce0e0 100644 --- a/sys/dev/netif/mxge/if_mxge.c +++ b/sys/dev/netif/mxge/if_mxge.c @@ -2169,117 +2169,6 @@ drop: return; } -#ifdef IFNET_BUF_RING -static void -mxge_qflush(struct ifnet *ifp) -{ - mxge_softc_t *sc = ifp->if_softc; - mxge_tx_ring_t *tx; - struct mbuf *m; - int slice; - - for (slice = 0; slice < sc->num_slices; slice++) { - tx = &sc->ss[slice].tx; - lwkt_serialize_enter(sc->ifp->if_serializer); - while ((m = buf_ring_dequeue_sc(tx->br)) != NULL) - m_freem(m); - lwkt_serialize_exit(sc->ifp->if_serializer); - } - if_qflush(ifp); -} - -static inline void -mxge_start_locked(struct mxge_slice_state *ss) -{ - mxge_softc_t *sc; - struct mbuf *m; - struct ifnet *ifp; - mxge_tx_ring_t *tx; - - sc = ss->sc; - ifp = sc->ifp; - tx = &ss->tx; - - while ((tx->mask - (tx->req - tx->done)) > tx->max_desc) { - m = drbr_dequeue(ifp, tx->br); - if (m == NULL) { - return; - } - /* let BPF see it */ - BPF_MTAP(ifp, m); - - /* give it to the nic */ - mxge_encap(ss, m); - } - /* ran out of transmit slots */ - if (((ss->if_flags & IFF_OACTIVE) == 0) - && (!drbr_empty(ifp, tx->br))) { - ss->if_flags |= IFF_OACTIVE; - tx->stall++; - } -} - -static int -mxge_transmit_locked(struct mxge_slice_state *ss, struct mbuf *m) -{ - mxge_softc_t *sc; - struct ifnet *ifp; - mxge_tx_ring_t *tx; - int err; - - sc = ss->sc; - ifp = sc->ifp; - tx = &ss->tx; - - if ((ss->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != - IFF_RUNNING) { - err = drbr_enqueue(ifp, tx->br, m); - return (err); - } - - if (drbr_empty(ifp, tx->br) && - ((tx->mask - (tx->req - tx->done)) > tx->max_desc)) { - /* let BPF see it */ - BPF_MTAP(ifp, m); - /* give it to the nic */ - mxge_encap(ss, m); - } else if ((err = drbr_enqueue(ifp, tx->br, m)) != 0) { - return (err); - } - if (!drbr_empty(ifp, tx->br)) - mxge_start_locked(ss); - return (0); -} - -static int -mxge_transmit(struct ifnet *ifp, struct mbuf *m) -{ - mxge_softc_t *sc = ifp->if_softc; - struct mxge_slice_state *ss; - mxge_tx_ring_t *tx; - int err = 0; - int slice; - -#if 0 - slice = m->m_pkthdr.flowid; -#endif - slice &= (sc->num_slices - 1); /* num_slices always power of 2 */ - - ss = &sc->ss[slice]; - tx = &ss->tx; - - if(lwkt_serialize_try(ifp->if_serializer)) { - err = mxge_transmit_locked(ss, m); - lwkt_serialize_exit(ifp->if_serializer); - } else { - err = drbr_enqueue(ifp, tx->br, m); - } - - return (err); -} - -#else - static inline void mxge_start_locked(struct mxge_slice_state *ss) { @@ -2303,12 +2192,12 @@ mxge_start_locked(struct mxge_slice_state *ss) mxge_encap(ss, m); } /* ran out of transmit slots */ - if ((sc->ifp->if_flags & IFF_OACTIVE) == 0) { - sc->ifp->if_flags |= IFF_OACTIVE; + if (!ifq_is_oactive(&ifp->if_snd)) { + ifq_set_oactive(&ifp->if_snd); tx->stall++; } } -#endif + static void mxge_start(struct ifnet *ifp) { @@ -2715,7 +2604,6 @@ mxge_tx_done(struct mxge_slice_state *ss, uint32_t mcp_idx) struct mbuf *m; bus_dmamap_t map; int idx; - int *flags; tx = &ss->tx; ifp = ss->sc->ifp; @@ -2742,16 +2630,11 @@ mxge_tx_done(struct mxge_slice_state *ss, uint32_t mcp_idx) } } - /* If we have space, clear IFF_OACTIVE to tell the stack that + /* If we have space, clear OACTIVE to tell the stack that its OK to send packets */ -#ifdef IFNET_BUF_RING - flags = &ss->if_flags; -#else - flags = &ifp->if_flags; -#endif - if ((*flags) & IFF_OACTIVE && + if (ifq_is_oactive(&ifp->if_snd) && tx->req - tx->done < (tx->mask + 1)/4) { - *(flags) &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ss->tx.wake++; mxge_start_locked(ss); } @@ -3625,15 +3508,8 @@ mxge_open(mxge_softc_t *sc) device_printf(sc->dev, "Couldn't bring up link\n"); goto abort; } -#ifdef IFNET_BUF_RING - for (slice = 0; slice < sc->num_slices; slice++) { - ss = &sc->ss[slice]; - ss->if_flags |= IFF_RUNNING; - ss->if_flags &= ~IFF_OACTIVE; - } -#endif sc->ifp->if_flags |= IFF_RUNNING; - sc->ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->ifp->if_snd); callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc); return 0; diff --git a/sys/dev/netif/my/if_my.c b/sys/dev/netif/my/if_my.c index e292d8bfdf..4240e1e360 100644 --- a/sys/dev/netif/my/if_my.c +++ b/sys/dev/netif/my/if_my.c @@ -1199,7 +1199,7 @@ my_txeoc(struct my_softc * sc) ifp->if_timer = 0; if (sc->my_cdata.my_tx_head == NULL) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->my_cdata.my_tx_tail = NULL; if (sc->my_want_auto) my_autoneg_mii(sc, MY_FLAG_SCHEDDELAY, 1); @@ -1346,7 +1346,7 @@ my_start(struct ifnet * ifp) * Check for an available queue slot. If there are none, punt. */ if (sc->my_cdata.my_tx_free->my_mbuf != NULL) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); crit_exit(); return; } @@ -1486,7 +1486,7 @@ my_init(void *xsc) if (sc->my_pinfo != NULL) my_phy_writereg(sc, PHY_BMCR, phy_bmcr); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); crit_exit(); } @@ -1675,7 +1675,8 @@ my_stop(struct my_softc * sc) } bzero((char *)&sc->my_ldata->my_tx_list, sizeof(sc->my_ldata->my_tx_list)); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } /* diff --git a/sys/dev/netif/ndis/if_ndis.c b/sys/dev/netif/ndis/if_ndis.c index 82e524c428..a261fca1b7 100644 --- a/sys/dev/netif/ndis/if_ndis.c +++ b/sys/dev/netif/ndis/if_ndis.c @@ -1563,7 +1563,7 @@ ndis_txeof(ndis_handle adapter, ndis_packet *packet, ndis_status status) ifp->if_oerrors++; sc->ndis_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); NDISMTX_UNLOCK(sc); @@ -1810,7 +1810,13 @@ ndis_start(struct ifnet *ifp) sc = ifp->if_softc; NDIS_LOCK(sc); - if (!sc->ndis_link || ifp->if_flags & IFF_OACTIVE) { + if (!sc->ndis_link) { + ifq_purge(&ifp->if_snd); + NDIS_UNLOCK(sc); + return; + } + + if (ifq_is_oactive(&ifp->if_snd)) { NDIS_UNLOCK(sc); return; } @@ -1902,7 +1908,7 @@ ndis_start(struct ifnet *ifp) } if (sc->ndis_txpending == 0) - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -2001,7 +2007,7 @@ ndis_init(void *xsc) if_link_state_change(sc->ifp); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->ndis_tx_timer = 0; /* @@ -3108,7 +3114,8 @@ ndis_stop(struct ndis_softc *sc) NDIS_LOCK(sc); sc->ndis_tx_timer = 0; sc->ndis_link = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); NDIS_UNLOCK(sc); if (sc->ndis_iftype != PNPBus || diff --git a/sys/dev/netif/nfe/if_nfe.c b/sys/dev/netif/nfe/if_nfe.c index 042a6315d0..fc50d851b3 100644 --- a/sys/dev/netif/nfe/if_nfe.c +++ b/sys/dev/netif/nfe/if_nfe.c @@ -1227,7 +1227,7 @@ skip: if (sc->sc_tx_ring_count - ring->queued >= sc->sc_tx_spare + NFE_NSEG_RSVD) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (ring->queued == 0) ifp->if_timer = 0; @@ -1366,7 +1366,7 @@ nfe_start(struct ifnet *ifp) ASSERT_SERIALIZED(ifp->if_serializer); - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; for (;;) { @@ -1375,7 +1375,7 @@ nfe_start(struct ifnet *ifp) if (sc->sc_tx_ring_count - ring->queued < sc->sc_tx_spare + NFE_NSEG_RSVD) { if (oactive) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1395,7 +1395,7 @@ nfe_start(struct ifnet *ifp) ifp->if_oerrors++; if (error == EFBIG) { if (oactive) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } nfe_txeof(sc, 0); @@ -1583,7 +1583,7 @@ nfe_init(void *xsc) callout_reset(&sc->sc_tick_ch, hz, nfe_tick, sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* * If we had stuff in the tx ring before its all cleaned out now @@ -1606,7 +1606,8 @@ nfe_stop(struct nfe_softc *sc) callout_stop(&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); sc->sc_flags &= ~NFE_F_IRQ_TIMER; #define WAITMAX 50000 diff --git a/sys/dev/netif/nge/if_nge.c b/sys/dev/netif/nge/if_nge.c index e984a63ca8..3d9df992b9 100644 --- a/sys/dev/netif/nge/if_nge.c +++ b/sys/dev/netif/nge/if_nge.c @@ -1360,7 +1360,7 @@ nge_txeof(struct nge_softc *sc) sc->nge_cdata.nge_tx_cons = idx; if (cur_tx != NULL) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -1638,7 +1638,7 @@ nge_start(struct ifnet *ifp) idx = sc->nge_cdata.nge_tx_prod; - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; need_trans = 0; @@ -1664,7 +1664,7 @@ again: * drop this packet. */ m_freem(m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1877,7 +1877,7 @@ nge_init(void *xsc) nge_ifmedia_upd(ifp); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } /* @@ -2149,7 +2149,8 @@ nge_stop(struct nge_softc *sc) bzero(&sc->nge_ldata->nge_tx_list, sizeof(sc->nge_ldata->nge_tx_list)); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } /* diff --git a/sys/dev/netif/pcn/if_pcn.c b/sys/dev/netif/pcn/if_pcn.c index 1b3b5832ef..af4f587d25 100644 --- a/sys/dev/netif/pcn/if_pcn.c +++ b/sys/dev/netif/pcn/if_pcn.c @@ -863,7 +863,7 @@ pcn_txeof(struct pcn_softc *sc) if (idx != sc->pcn_cdata.pcn_tx_cons) { /* Some buffers have been freed. */ sc->pcn_cdata.pcn_tx_cons = idx; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } ifp->if_timer = (sc->pcn_cdata.pcn_tx_cnt == 0) ? 0 : 5; @@ -1008,7 +1008,7 @@ pcn_start(struct ifnet *ifp) idx = sc->pcn_cdata.pcn_tx_prod; - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; need_trans = 0; @@ -1034,7 +1034,7 @@ again: * drop this packet. */ m_freem(m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1189,7 +1189,7 @@ pcn_init(void *xsc) mii_mediachg(mii); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->pcn_stat_timer, hz, pcn_tick, sc); } @@ -1354,7 +1354,8 @@ pcn_stop(struct pcn_softc *sc) bzero((char *)&sc->pcn_ldata->pcn_tx_list, sizeof(sc->pcn_ldata->pcn_tx_list)); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); return; } diff --git a/sys/dev/netif/ral/rt2560.c b/sys/dev/netif/ral/rt2560.c index 56303069db..8136f5d322 100644 --- a/sys/dev/netif/ral/rt2560.c +++ b/sys/dev/netif/ral/rt2560.c @@ -1022,7 +1022,7 @@ rt2560_tx_intr(struct rt2560_softc *sc) sc->sc_flags &= ~RT2560_F_DATA_OACTIVE; if ((sc->sc_flags & (RT2560_F_DATA_OACTIVE | RT2560_F_PRIO_OACTIVE)) == 0) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); rt2560_start_locked(ifp); } } @@ -1106,7 +1106,7 @@ rt2560_prio_intr(struct rt2560_softc *sc) sc->sc_flags &= ~RT2560_F_PRIO_OACTIVE; if ((sc->sc_flags & (RT2560_F_DATA_OACTIVE | RT2560_F_PRIO_OACTIVE)) == 0) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); rt2560_start_locked(ifp); } } @@ -1921,7 +1921,7 @@ rt2560_start_locked(struct ifnet *ifp) break; if (sc->txq.queued >= RT2560_TX_RING_COUNT - 1) { IF_PREPEND(&ifp->if_snd, m); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); sc->sc_flags |= RT2560_F_DATA_OACTIVE; break; } @@ -2671,7 +2671,7 @@ rt2560_init_locked(struct rt2560_softc *sc) /* enable interrupts */ RAL_WRITE(sc, RT2560_CSR8, RT2560_INTR_MASK); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; callout_reset(&sc->watchdog_ch, hz, rt2560_watchdog_callout, sc); @@ -2704,7 +2704,8 @@ rt2560_stop_locked(struct rt2560_softc *sc) sc->sc_tx_timer = 0; if (ifp->if_flags & IFF_RUNNING) { - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* abort Tx */ RAL_WRITE(sc, RT2560_TXCSR0, RT2560_ABORT_TX); @@ -2752,7 +2753,7 @@ rt2560_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, return ENETDOWN; } if (sc->prioq.queued >= RT2560_PRIO_RING_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); sc->sc_flags |= RT2560_F_PRIO_OACTIVE; m_freem(m); ieee80211_free_node(ni); diff --git a/sys/dev/netif/ral/rt2661.c b/sys/dev/netif/ral/rt2661.c index 1c6ca4f552..605a48e792 100644 --- a/sys/dev/netif/ral/rt2661.c +++ b/sys/dev/netif/ral/rt2661.c @@ -955,7 +955,7 @@ rt2661_tx_intr(struct rt2661_softc *sc) } sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); rt2661_start_locked(ifp); } @@ -1627,7 +1627,7 @@ rt2661_start_locked(struct ifnet *ifp) if (sc->txq[ac].queued >= RT2661_TX_RING_COUNT - 1) { /* there is no place left in this ring */ IF_PREPEND(&ifp->if_snd, m); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; @@ -1662,7 +1662,7 @@ rt2661_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, return ENETDOWN; } if (sc->mgtq.queued >= RT2661_MGT_RING_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); m_freem(m); ieee80211_free_node(ni); return ENOBUFS; /* XXX */ @@ -2416,7 +2416,7 @@ rt2661_init_locked(struct rt2661_softc *sc) /* kick Rx */ RAL_WRITE(sc, RT2661_RX_CNTL_CSR, 1); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog_callout, sc); @@ -2450,7 +2450,8 @@ rt2661_stop_locked(struct rt2661_softc *sc) sc->sc_tx_timer = 0; if (ifp->if_flags & IFF_RUNNING) { - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* abort Tx (for all 5 Tx rings) */ RAL_WRITE(sc, RT2661_TX_CNTL_CSR, 0x1f << 16); diff --git a/sys/dev/netif/re/if_re.c b/sys/dev/netif/re/if_re.c index 150577aeb9..bf100c3db0 100644 --- a/sys/dev/netif/re/if_re.c +++ b/sys/dev/netif/re/if_re.c @@ -2104,7 +2104,7 @@ re_txeof(struct re_softc *sc) /* There is enough free TX descs */ if (sc->re_ldata.re_tx_free > RE_TXDESC_SPARE) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* * Some chips will ignore a second TX request issued while an @@ -2453,7 +2453,7 @@ re_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; idx = sc->re_ldata.re_tx_prodidx; @@ -2468,7 +2468,7 @@ re_start(struct ifnet *ifp) continue; } } - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2487,7 +2487,7 @@ re_start(struct ifnet *ifp) continue; } } - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2503,17 +2503,16 @@ re_start(struct ifnet *ifp) /* * If sc->re_ldata.re_tx_mbuf[idx] is not NULL it is possible - * for IFF_OACTIVE to not be properly set when we also do not + * for OACTIVE to not be properly set when we also do not * have sufficient free tx descriptors, leaving packet in - * ifp->if_send. This can cause if_start_dispatch() to loop - * infinitely so make sure IFF_OACTIVE is set properly. + * ifp->if_snd. This can cause if_start_dispatch() to loop + * infinitely so make sure OACTIVE is set properly. */ if (sc->re_ldata.re_tx_free <= RE_TXDESC_SPARE) { - if ((ifp->if_flags & IFF_OACTIVE) == 0) { - device_printf(sc->re_dev, - "Debug: IFF_OACTIVE was not set when" - " re_tx_free was below minimum!\n"); - ifp->if_flags |= IFF_OACTIVE; + if (!ifq_is_oactive(&ifp->if_snd)) { + if_printf(ifp, "Debug: OACTIVE was not set when " + "re_tx_free was below minimum!\n"); + ifq_set_oactive(&ifp->if_snd); } } if (!need_trans) @@ -2710,7 +2709,7 @@ re_init(void *xsc) CSR_WRITE_1(sc, RE_CFG1, RE_CFG1_DRVLOAD|RE_CFG1_FULLDUPLEX); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->re_timer, hz, re_tick, sc); } @@ -2857,7 +2856,8 @@ re_stop(struct re_softc *sc) ifp->if_timer = 0; callout_stop(&sc->re_timer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); sc->re_flags &= ~(RE_F_TIMER_INTR | RE_F_DROP_RXFRAG | RE_F_LINKED); CSR_WRITE_1(sc, RE_COMMAND, 0x00); diff --git a/sys/dev/netif/rl/if_rl.c b/sys/dev/netif/rl/if_rl.c index 0896e4a1a1..d104ed9176 100644 --- a/sys/dev/netif/rl/if_rl.c +++ b/sys/dev/netif/rl/if_rl.c @@ -1143,7 +1143,7 @@ rl_txeof(struct rl_softc *sc) if (txstat & (RL_TXSTAT_TXABRT | RL_TXSTAT_OUTOFWIN)) CSR_WRITE_4(sc, RL_TXCFG, RL_TXCFG_CONFIG); } - 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) @@ -1346,7 +1346,7 @@ rl_start(struct ifnet *ifp) struct rl_softc *sc = ifp->if_softc; struct mbuf *m_head = NULL; - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; while (RL_CUR_TXMBUF(sc) == NULL) { @@ -1377,7 +1377,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); } static void @@ -1481,7 +1481,7 @@ rl_init(void *xsc) CSR_WRITE_1(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); callout_reset(&sc->rl_stat_timer, hz, rl_tick, sc); } @@ -1581,7 +1581,8 @@ rl_stop(struct rl_softc *sc) ifp->if_timer = 0; callout_stop(&sc->rl_stat_timer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); CSR_WRITE_1(sc, RL_COMMAND, 0x00); CSR_WRITE_2(sc, RL_IMR, 0x0000); diff --git a/sys/dev/netif/rtw/rtw.c b/sys/dev/netif/rtw/rtw.c index 657b436636..20301fc863 100644 --- a/sys/dev/netif/rtw/rtw.c +++ b/sys/dev/netif/rtw/rtw.c @@ -1620,7 +1620,7 @@ rtw_reset_oactive(struct rtw_softc *sc) struct rtw_txdesc_blk *tdb = &sc->sc_txdesc_blk[pri]; if (!STAILQ_EMPTY(&tsb->tsb_freeq) && tdb->tdb_nfree > 0) - sc->sc_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->sc_if.if_snd); } #ifdef RTW_DEBUG @@ -2150,7 +2150,8 @@ rtw_stop(struct rtw_softc *sc, 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; } @@ -2897,7 +2898,7 @@ rtw_txring_choose(struct rtw_softc *sc, struct rtw_txsoft_blk **tsbp, static __inline struct mbuf * rtw_80211_dequeue(struct rtw_softc *sc, struct ifqueue *ifq, int pri, struct rtw_txsoft_blk **tsbp, struct rtw_txdesc_blk **tdbp, - struct ieee80211_node **nip, int *if_flagsp) + struct ieee80211_node **nip) { struct mbuf *m; struct ifnet *ifp = &sc->sc_if; @@ -2907,7 +2908,7 @@ rtw_80211_dequeue(struct rtw_softc *sc, struct ifqueue *ifq, int pri, if (rtw_txring_choose(sc, tsbp, tdbp, pri) == -1) { DPRINTF(sc, RTW_DEBUG_XMIT_RSRC, ("%s: no ring %d descriptor\n", ifp->if_xname, pri)); - *if_flagsp |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_timer = 1; return NULL; } @@ -2928,7 +2929,6 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp, struct ieee80211_node **nip) { struct rtw_softc *sc = ifp->if_softc; - int *if_flagsp = &ifp->if_flags; struct ether_header *eh; struct mbuf *m0; int pri; @@ -2938,14 +2938,14 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp, if (sc->sc_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", ifp->if_xname)); return 0; } if ((*mp = rtw_80211_dequeue(sc, &sc->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", ifp->if_xname)); return 0; @@ -2974,7 +2974,7 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp, if (rtw_txring_choose(sc, tsbp, tdbp, pri) == -1) { DPRINTF(sc, RTW_DEBUG_XMIT_RSRC, ("%s: no ring %d descriptor\n", ifp->if_xname, pri)); - *if_flagsp |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m0); sc->sc_if.if_timer = 1; return 0; @@ -3142,7 +3142,7 @@ rtw_start(struct ifnet *ifp) DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: enter %s\n", ifp->if_xname, __func__)); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) goto out; /* XXX do real rate control */ diff --git a/sys/dev/netif/rue/if_rue.c b/sys/dev/netif/rue/if_rue.c index 05d6ad272a..ce98e906a0 100644 --- a/sys/dev/netif/rue/if_rue.c +++ b/sys/dev/netif/rue/if_rue.c @@ -886,7 +886,7 @@ rue_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); usbd_get_xfer_status(c->rue_xfer, NULL, NULL, NULL, &err); if (c->rue_mbuf != NULL) { @@ -992,7 +992,7 @@ rue_start(struct ifnet *ifp) return; } - if (ifp->if_flags & IFF_OACTIVE) { + if (ifq_is_oactive(&ifp->if_snd)) { RUE_UNLOCK(sc); return; } @@ -1005,7 +1005,7 @@ rue_start(struct ifnet *ifp) if (rue_encap(sc, m_head, 0)) { /* rue_encap() will free m_head, if we reach here */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); RUE_UNLOCK(sc); return; } @@ -1016,7 +1016,7 @@ rue_start(struct ifnet *ifp) */ BPF_MTAP(ifp, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Set a timeout in case the chip goes out to lunch. @@ -1138,7 +1138,7 @@ rue_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->rue_stat_ch, hz, rue_tick, sc); @@ -1365,7 +1365,8 @@ rue_stop(struct rue_softc *sc) sc->rue_link = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); RUE_UNLOCK(sc); } diff --git a/sys/dev/netif/rum/if_rum.c b/sys/dev/netif/rum/if_rum.c index c467953cc4..1381a59c1f 100644 --- a/sys/dev/netif/rum/if_rum.c +++ b/sys/dev/netif/rum/if_rum.c @@ -782,7 +782,7 @@ rum_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) DPRINTFN(10, ("tx done\n")); sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); lwkt_serialize_enter(ifp->if_serializer); ieee80211_free_node(ni); @@ -889,7 +889,7 @@ rum_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) /* node is no longer needed */ ieee80211_free_node(ni); - if ((ifp->if_flags & IFF_OACTIVE) == 0) + if (!ifq_is_oactive(&ifp->if_snd)) ifp->if_start(ifp); lwkt_serialize_exit(ifp->if_serializer); @@ -1131,7 +1131,8 @@ rum_start(struct ifnet *ifp) crit_enter(); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) { + if ((ifp->if_flags & IFF_RUNNING) == 0 || + ifq_is_oactive(&ifp->if_snd)) { crit_exit(); return; } @@ -1142,7 +1143,7 @@ rum_start(struct ifnet *ifp) if (!IF_QEMPTY(&ic->ic_mgtq)) { if (sc->tx_queued >= RT2573_TX_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } IF_DEQUEUE(&ic->ic_mgtq, m0); @@ -1165,7 +1166,7 @@ rum_start(struct ifnet *ifp) } if (sc->tx_queued >= RT2573_TX_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2007,7 +2008,7 @@ fail: if (error) { rum_stop(sc); } else { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; if (ic->ic_opmode != IEEE80211_M_MONITOR) { @@ -2033,7 +2034,8 @@ rum_stop(struct rum_softc *sc) crit_enter(); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); sc->sc_stopped = 1; ieee80211_new_state(ic, IEEE80211_S_INIT, -1); /* free all nodes */ diff --git a/sys/dev/netif/sbni/if_sbni.c b/sys/dev/netif/sbni/if_sbni.c index e5ad57516c..74ae2488b7 100644 --- a/sys/dev/netif/sbni/if_sbni.c +++ b/sys/dev/netif/sbni/if_sbni.c @@ -275,7 +275,7 @@ sbni_init(void *xsc) callout_reset(&sc->sbni_stat_timer,hz / SBNI_HZ, sbni_timeout, sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* attempt to start output */ if_devstart(ifp); @@ -662,7 +662,7 @@ prepare_to_send(struct sbni_softc *sc) sc->pktlen = 0; sc->tx_frameno = 0; sc->framelen = 0; - sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->arpcom.ac_if.if_snd); return; } @@ -682,7 +682,7 @@ prepare_to_send(struct sbni_softc *sc) sc->framelen = min(len, sc->maxframe); sbni_outb(sc, CSR0, sbni_inb(sc, CSR0) | TR_REQ); - sc->arpcom.ac_if.if_flags |= IFF_OACTIVE; + ifq_set_oactive(&sc->arpcom.ac_if.if_snd); BPF_MTAP(&sc->arpcom.ac_if, sc->tx_buf_p); } @@ -702,7 +702,7 @@ drop_xmit_queue(struct sbni_softc *sc) sc->framelen = 0; sc->outpos = 0; sc->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); - sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->arpcom.ac_if.if_snd); } diff --git a/sys/dev/netif/sbsh/if_sbsh.c b/sys/dev/netif/sbsh/if_sbsh.c index f891554126..35ae4a97c3 100644 --- a/sys/dev/netif/sbsh/if_sbsh.c +++ b/sys/dev/netif/sbsh/if_sbsh.c @@ -343,7 +343,7 @@ sbsh_init(void *xsc) sc->state = ACTIVATION; ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } } @@ -624,9 +624,9 @@ start_xmit_frames(struct sbsh_softc *sc) } if (sc->regs->CTDR != sc->regs->LTDR) - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); else - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } diff --git a/sys/dev/netif/sf/if_sf.c b/sys/dev/netif/sf/if_sf.c index dd0c0da23f..5da2342954 100644 --- a/sys/dev/netif/sf/if_sf.c +++ b/sys/dev/netif/sf/if_sf.c @@ -1016,7 +1016,7 @@ sf_txeof(struct sf_softc *sc) } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); csr_write_4(sc, SF_CQ_CONSIDX, (txcons & ~SF_CQ_CONSIDX_TXQ) | @@ -1197,7 +1197,7 @@ sf_init(void *xsc) sf_ifmedia_upd(ifp); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->sf_stat_timer, hz, sf_stats_update, sc); } @@ -1250,7 +1250,7 @@ sf_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; txprod = csr_read_4(sc, SF_TXDQ_PRODIDX); @@ -1271,12 +1271,12 @@ sf_start(struct ifnet *ifp) * Don't get the TX DMA queue get too full. */ if (sc->sf_tx_cnt > 64) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } #ifdef foo if (sc->sf_tx_cnt >= (SF_TX_DLIST_CNT - 5)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } #endif @@ -1369,7 +1369,8 @@ sf_stop(struct sf_softc *sc) } } - ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); return; } diff --git a/sys/dev/netif/sis/if_sis.c b/sys/dev/netif/sis/if_sis.c index 32150c7fcc..2f70cd73bd 100644 --- a/sys/dev/netif/sis/if_sis.c +++ b/sys/dev/netif/sis/if_sis.c @@ -1472,7 +1472,7 @@ sis_txeof(struct sis_softc *sc) if (cd->sis_tx_cnt == 0) ifp->if_timer = 0; if (!SIS_IS_OACTIVE(sc)) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -1702,7 +1702,7 @@ sis_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; idx = sc->sis_cdata.sis_tx_prod; @@ -1715,7 +1715,7 @@ sis_start(struct ifnet *ifp) * If there's no way we can send any packets, return now. */ if (SIS_IS_OACTIVE(sc)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1729,7 +1729,7 @@ sis_start(struct ifnet *ifp) if (sc->sis_cdata.sis_tx_cnt == 0) { continue; } else { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } @@ -1916,7 +1916,7 @@ sis_init(void *xsc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->sis_timer, hz, sis_tick, sc); } @@ -2031,7 +2031,8 @@ sis_stop(struct sis_softc *sc) callout_stop(&sc->sis_timer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); ifp->if_timer = 0; CSR_WRITE_4(sc, SIS_IER, 0); diff --git a/sys/dev/netif/sk/if_sk.c b/sys/dev/netif/sk/if_sk.c index 54b5c261d4..aee2b72d36 100644 --- a/sys/dev/netif/sk/if_sk.c +++ b/sys/dev/netif/sk/if_sk.c @@ -1709,14 +1709,14 @@ sk_start(struct ifnet *ifp) DPRINTFN(2, ("sk_start\n")); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; while (sc_if->sk_cdata.sk_tx_mbuf[idx] == NULL) { struct mbuf *m_head; if (SK_IS_OACTIVE(sc_if)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1733,7 +1733,7 @@ sk_start(struct ifnet *ifp) if (sc_if->sk_cdata.sk_tx_cnt == 0) { continue; } else { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } @@ -2038,7 +2038,7 @@ sk_txeof(struct sk_if_softc *sc_if) } if (!SK_IS_OACTIVE(sc_if)) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc_if->sk_cdata.sk_tx_cnt == 0) ifp->if_timer = 0; @@ -2778,7 +2778,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)) callout_reset(&sc_if->sk_tick_timer, hz, sk_yukon_tick, sc_if); @@ -2799,7 +2799,8 @@ sk_stop(struct sk_if_softc *sc_if) callout_stop(&sc_if->sk_tick_timer); - ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); /* Stop Tx descriptor polling timer */ SK_IF_WRITE_4(sc_if, 0, SK_DPT_TIMER_CTRL, SK_DPT_TCTL_STOP); diff --git a/sys/dev/netif/sln/if_sln.c b/sys/dev/netif/sln/if_sln.c index f34bc27c96..992cc2f9ce 100644 --- a/sys/dev/netif/sln/if_sln.c +++ b/sys/dev/netif/sln/if_sln.c @@ -306,7 +306,8 @@ sln_stop(struct sln_softc *sc) } } - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } static int @@ -720,7 +721,7 @@ sln_init(void *x) sc->suspended = 0; ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->sln_state, hz, sln_tick, sc); } @@ -741,7 +742,7 @@ sln_tx(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; while (SL_CUR_TXBUF(sc) == NULL) { /* SL_CUR_TXBUF(x) = x->sln_bufdata.sln_tx_buf[x->sln_bufdata.cur_tx] */ @@ -799,7 +800,7 @@ sln_tx(struct ifnet *ifp) /* Tx buffer chain full */ if (SL_CUR_TXBUF(sc) != NULL) - 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; @@ -991,7 +992,7 @@ sln_tx_intr(struct sln_softc *sc) PDEBUG("tx done descriprtor %x\n", entry); sc->sln_bufdata.dirty_tx = (entry + 1) % SL_TXD_CNT; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } while (sc->sln_bufdata.dirty_tx != sc->sln_bufdata.cur_tx); if (sc->sln_bufdata.dirty_tx == sc->sln_bufdata.cur_tx) diff --git a/sys/dev/netif/sn/if_sn.c b/sys/dev/netif/sn/if_sn.c index c7224660e1..150539f42b 100644 --- a/sys/dev/netif/sn/if_sn.c +++ b/sys/dev/netif/sn/if_sn.c @@ -325,7 +325,7 @@ sninit(void *xsc) * Mark the interface running but not active. */ ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* * Attempt to push out any waiting packets. @@ -348,14 +348,14 @@ snstart(struct ifnet *ifp) u_char packet_no; int time_out; - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; if (sc->pages_wanted != -1) { /* XXX should never happen */ kprintf("%s: snstart() while memory allocation pending\n", ifp->if_xname); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } startagain: @@ -440,7 +440,7 @@ startagain: sc->intr_mask = mask; ifp->if_timer = 1; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); sc->pages_wanted = numPages; ifq_prepend(&ifp->if_snd, top); @@ -517,7 +517,7 @@ startagain: outw(BASE + MMU_CMD_REG_W, MMUCR_ENQUEUE); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_timer = 1; BPF_MTAP(ifp, top); @@ -718,14 +718,14 @@ try_start: /* * Now pass control to snstart() to queue any additional packets */ - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if_devstart(ifp); /* * We've sent something, so we're active. Set a watchdog in case the * TX_EMPTY interrupt is lost. */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_timer = 1; } @@ -814,7 +814,7 @@ sn_intr(void *arg) * Disable this interrupt. */ mask &= ~IM_ALLOC_INT; - sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->arpcom.ac_if.if_snd); snresume(&sc->arpcom.ac_if); } /* @@ -882,7 +882,7 @@ sn_intr(void *arg) /* * Attempt to queue more transmits. */ - sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->arpcom.ac_if.if_snd); if_devstart(&sc->arpcom.ac_if); } /* @@ -920,7 +920,7 @@ sn_intr(void *arg) /* * Attempt to enqueue some more stuff. */ - sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->arpcom.ac_if.if_snd); if_devstart(&sc->arpcom.ac_if); } /* diff --git a/sys/dev/netif/sr/if_sr.c b/sys/dev/netif/sr/if_sr.c index 5d8f0dda69..d1accd4180 100644 --- a/sys/dev/netif/sr/if_sr.c +++ b/sys/dev/netif/sr/if_sr.c @@ -64,6 +64,7 @@ #include #include +#include #ifdef NETGRAPH #include #else /* NETGRAPH */ @@ -709,7 +710,7 @@ sr_xmit(struct sr_softc *sc) * This function only place the data in the oncard buffers. It does not * start the transmition. sr_xmit() does that. * - * Transmitter idle state is indicated by the IFF_OACTIVE flag. + * Transmitter idle state is indicated by the OACTIVE flag. * The function that clears that should ensure that the transmitter * and its DMA is in a "good" idle state. */ @@ -760,9 +761,9 @@ top_srstart: */ if (sc->txb_inuse == SR_TX_BLOCKS) { /* out of space? */ #ifndef NETGRAPH - ifp->if_flags |= IFF_OACTIVE; /* yes, mark active */ + ifq_set_oactive(&ifp->if_snd); /* yes, mark active */ #else - /*ifp->if_flags |= IFF_OACTIVE;*/ /* yes, mark active */ + /*ifq_set_oactive(&ifp->if_snd);*/ /* yes, mark active */ #endif /* NETGRAPH */ #if BUGGY > 9 @@ -1092,9 +1093,9 @@ srwatchdog(struct sr_softc *sc) } sc->xmit_busy = 0; #ifndef NETGRAPH - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); #else - /*ifp->if_flags &= ~IFF_OACTIVE; */ + /*ifq_clr_oactive(&ifp->if_snd) */ #endif /* NETGRAPH */ if (sc->txb_inuse && --sc->txb_inuse) @@ -2216,7 +2217,7 @@ sr_dmac_intr(struct sr_hardc *hc, u_char isr1) /* * This should be the most common case. * - * Clear the IFF_OACTIVE flag. + * Clear the OACTIVE flag. * * Call srstart to start a new transmit if * there is data to transmit. @@ -2226,7 +2227,7 @@ sr_dmac_intr(struct sr_hardc *hc, u_char isr1) #endif sc->xmit_busy = 0; #ifndef NETGRAPH - sc->ifsppp.pp_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->ifsppp.pp_if.if_snd); sc->ifsppp.pp_if.if_timer = 0; #else /* XXX may need to mark tx inactive? */ diff --git a/sys/dev/netif/ste/if_ste.c b/sys/dev/netif/ste/if_ste.c index 040cbfae74..a729a16088 100644 --- a/sys/dev/netif/ste/if_ste.c +++ b/sys/dev/netif/ste/if_ste.c @@ -770,7 +770,7 @@ ste_txeof(struct ste_softc *sc) sc->ste_cdata.ste_tx_cons = idx; if (cur_tx != NULL) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); return; } @@ -1214,7 +1214,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); callout_reset(&sc->ste_stat_timer, hz, ste_stats_update, sc); } @@ -1260,7 +1260,8 @@ ste_stop(struct ste_softc *sc) bzero(sc->ste_ldata, sizeof(struct ste_list_data)); - ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); return; } @@ -1419,7 +1420,7 @@ ste_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; idx = sc->ste_cdata.ste_tx_prod; @@ -1427,7 +1428,7 @@ ste_start(struct ifnet *ifp) while(sc->ste_cdata.ste_tx_chain[idx].ste_mbuf == NULL) { if ((STE_TX_LIST_CNT - sc->ste_cdata.ste_tx_cnt) < 3) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } diff --git a/sys/dev/netif/stge/if_stge.c b/sys/dev/netif/stge/if_stge.c index b69d8ad1d2..0c28b9233f 100644 --- a/sys/dev/netif/stge/if_stge.c +++ b/sys/dev/netif/stge/if_stge.c @@ -1194,14 +1194,13 @@ stge_start(struct ifnet *ifp) ASSERT_SERIALIZED(ifp->if_serializer); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != - IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; enq = 0; while (!ifq_is_empty(&ifp->if_snd)) { if (sc->sc_cdata.stge_tx_cnt >= STGE_TX_HIWAT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1218,7 +1217,7 @@ stge_start(struct ifnet *ifp) if (sc->sc_cdata.stge_tx_cnt == 0) { continue; } else { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } } @@ -1506,7 +1505,7 @@ stge_txeof(struct stge_softc *sc) sc->sc_cdata.stge_tx_cons = cons; if (sc->sc_cdata.stge_tx_cnt < STGE_TX_HIWAT) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (sc->sc_cdata.stge_tx_cnt == 0) ifp->if_timer = 0; } @@ -2079,7 +2078,7 @@ stge_init(void *xsc) * ...all done! */ ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); out: if (error != 0) @@ -2180,7 +2179,8 @@ stge_stop(struct stge_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; } diff --git a/sys/dev/netif/ti/if_ti.c b/sys/dev/netif/ti/if_ti.c index eaa3cdc198..a661ee4284 100644 --- a/sys/dev/netif/ti/if_ti.c +++ b/sys/dev/netif/ti/if_ti.c @@ -1760,7 +1760,7 @@ ti_txeof(struct ti_softc *sc) } if (cur_tx != NULL) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } static void @@ -1932,7 +1932,7 @@ ti_start(struct ifnet *ifp) m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) { if ((TI_TX_RING_CNT - sc->ti_txcnt) < m_head->m_pkthdr.csum_data + 16) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m_head); break; } @@ -1944,7 +1944,7 @@ ti_start(struct ifnet *ifp) * for the NIC to drain the ring. */ if (ti_encap(sc, m_head, &prodidx)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m_head); break; } @@ -2044,7 +2044,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 @@ -2292,7 +2292,8 @@ ti_stop(struct ti_softc *sc) sc->ti_tx_considx.ti_idx = 0; sc->ti_tx_saved_considx = TI_TXCONS_UNSET; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } /* diff --git a/sys/dev/netif/tl/if_tl.c b/sys/dev/netif/tl/if_tl.c index 4947bdf5b0..b646ba4ab8 100644 --- a/sys/dev/netif/tl/if_tl.c +++ b/sys/dev/netif/tl/if_tl.c @@ -1536,7 +1536,7 @@ tl_intvec_txeoc(void *xsc, u_int32_t type) ifp->if_timer = 0; if (sc->tl_cdata.tl_tx_head == NULL) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->tl_cdata.tl_tx_tail = NULL; sc->tl_txeoc = 1; } else { @@ -1835,7 +1835,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; } @@ -1975,7 +1975,7 @@ tl_init(void *xsc) CMD_SET(sc, TL_CMD_GO|TL_CMD_NES|TL_CMD_RT); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* Start the stats update counter */ callout_reset(&sc->tl_stat_timer, hz, tl_stats_update, sc); @@ -2164,7 +2164,8 @@ tl_stop(struct tl_softc *sc) bzero((char *)&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); return; } diff --git a/sys/dev/netif/tx/if_tx.c b/sys/dev/netif/tx/if_tx.c index a1c769093d..8325e9bdfd 100644 --- a/sys/dev/netif/tx/if_tx.c +++ b/sys/dev/netif/tx/if_tx.c @@ -542,7 +542,7 @@ epic_ifstart(struct ifnet *ifp) BPF_MTAP(ifp, m0); } - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; @@ -651,7 +651,7 @@ epic_tx_done(epic_softc_t *sc) } if (sc->pending_txs < TX_RING_SIZE) - sc->sc_if.if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&sc->sc_if.if_snd); } /* @@ -1116,7 +1116,7 @@ epic_init(epic_softc_t *sc) else ifp->if_flags &= ~IFF_RUNNING; /* ... and free */ - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* Start Rx process */ epic_start_activity(sc); diff --git a/sys/dev/netif/txp/if_txp.c b/sys/dev/netif/txp/if_txp.c index bbc4933c3c..bafbe27719 100644 --- a/sys/dev/netif/txp/if_txp.c +++ b/sys/dev/netif/txp/if_txp.c @@ -825,7 +825,7 @@ txp_tx_reclaim(struct txp_softc *sc, struct txp_tx_ring *r) ifp->if_opackets++; } } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if (++cons == TX_ENTRIES) { txd = r->r_desc; @@ -1139,7 +1139,7 @@ txp_init(void *xsc) 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); ifp->if_timer = 0; callout_reset(&sc->txp_stat_timer, hz, txp_tick, sc); @@ -1194,7 +1194,7 @@ txp_start(struct ifnet *ifp) struct txp_swdesc *sd; u_int32_t firstprod, firstcnt, prod, cnt; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; prod = r->r_prod; @@ -1307,7 +1307,7 @@ again: return; oactive: - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); r->r_prod = firstprod; r->r_cnt = firstcnt; return; @@ -1510,7 +1510,8 @@ txp_stop(struct txp_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); callout_stop(&sc->txp_stat_timer); diff --git a/sys/dev/netif/ural/if_ural.c b/sys/dev/netif/ural/if_ural.c index a03b47d18d..cf5a21d64f 100644 --- a/sys/dev/netif/ural/if_ural.c +++ b/sys/dev/netif/ural/if_ural.c @@ -939,7 +939,7 @@ ural_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) DPRINTFN(10, ("tx done\n")); sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); lwkt_serialize_enter(ifp->if_serializer); ieee80211_free_node(ni); @@ -1375,7 +1375,8 @@ ural_start(struct ifnet *ifp) crit_enter(); - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) { + if ((ifp->if_flags & IFF_RUNNING) == 0 || + ifq_is_oactive(&ifp->if_snd)) { crit_exit(); return; } @@ -1386,7 +1387,7 @@ ural_start(struct ifnet *ifp) if (!IF_QEMPTY(&ic->ic_mgtq)) { if (sc->tx_queued >= RAL_TX_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } IF_DEQUEUE(&ic->ic_mgtq, m0); @@ -1410,7 +1411,7 @@ ural_start(struct ifnet *ifp) } if (sc->tx_queued >= RAL_TX_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -2272,7 +2273,7 @@ fail: if (error) { ural_stop(sc); } else { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; if (ic->ic_opmode != IEEE80211_M_MONITOR) { @@ -2297,7 +2298,8 @@ ural_stop(struct ural_softc *sc) crit_enter(); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); sc->sc_stopped = 1; ieee80211_new_state(ic, IEEE80211_S_INIT, -1); diff --git a/sys/dev/netif/vge/if_vge.c b/sys/dev/netif/vge/if_vge.c index df12fd9b3e..3b0f58c95e 100644 --- a/sys/dev/netif/vge/if_vge.c +++ b/sys/dev/netif/vge/if_vge.c @@ -1451,7 +1451,7 @@ vge_txeof(struct vge_softc *sc) /* No changes made to the TX ring, so no flush needed */ 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; } @@ -1700,7 +1700,7 @@ vge_start(struct ifnet *ifp) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; idx = sc->vge_ldata.vge_tx_prodidx; @@ -1711,7 +1711,7 @@ vge_start(struct ifnet *ifp) while (sc->vge_ldata.vge_tx_mbuf[idx] == NULL) { if (sc->vge_ldata.vge_tx_free <= 2) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1721,7 +1721,7 @@ vge_start(struct ifnet *ifp) if (vge_encap(sc, m_head, idx)) { /* If vge_encap() failed, it will free m_head for us */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } @@ -1917,7 +1917,7 @@ vge_init(void *xsc) mii_mediachg(mii); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->vge_if_flags = 0; sc->vge_link = 0; @@ -2093,7 +2093,8 @@ vge_stop(struct vge_softc *sc) ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); CSR_WRITE_1(sc, VGE_CRS0, VGE_CR0_STOP); diff --git a/sys/dev/netif/vr/if_vr.c b/sys/dev/netif/vr/if_vr.c index c1d30edfe4..b18814ff7c 100644 --- a/sys/dev/netif/vr/if_vr.c +++ b/sys/dev/netif/vr/if_vr.c @@ -1149,7 +1149,7 @@ vr_txeoc(struct vr_softc *sc) ifp = &sc->arpcom.ac_if; if (sc->vr_cdata.vr_tx_head_idx == -1) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->vr_cdata.vr_tx_tail_idx = -1; ifp->if_timer = 0; } @@ -1327,7 +1327,7 @@ vr_start(struct ifnet *ifp) struct vr_chain *tx_chain; int cur_tx_idx, start_tx_idx, prev_tx_idx; - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; sc = ifp->if_softc; @@ -1339,7 +1339,7 @@ vr_start(struct ifnet *ifp) /* Check for an available queue slot. If there are none, punt. */ if (tx_chain[start_tx_idx].vr_buf != NULL) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -1357,7 +1357,7 @@ vr_start(struct ifnet *ifp) /* Pack the data into the descriptor. */ if (vr_encap(sc, cur_tx_idx, m_head)) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); cur_tx_idx = prev_tx_idx; break; } @@ -1481,7 +1481,7 @@ vr_init(void *xsc) mii_mediachg(mii); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->vr_stat_timer, hz, vr_tick, sc); } @@ -1652,7 +1652,8 @@ vr_stop(struct vr_softc *sc) bzero(&sc->vr_ldata->vr_tx_list, sizeof(sc->vr_ldata->vr_tx_list)); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } /* diff --git a/sys/dev/netif/vx/if_vx.c b/sys/dev/netif/vx/if_vx.c index 3d9d79066a..d6495e7d85 100644 --- a/sys/dev/netif/vx/if_vx.c +++ b/sys/dev/netif/vx/if_vx.c @@ -226,7 +226,7 @@ vxinit(void *xsc) /* 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. */ if_devstart(ifp); @@ -389,7 +389,7 @@ vxstart(struct ifnet *ifp) int len, pad; /* 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) == 0 || ifq_is_oactive(&ifp->if_snd)) return; startagain: @@ -420,7 +420,7 @@ startagain: CSR_WRITE_2(sc, VX_COMMAND, SET_TX_AVAIL_THRESH | ((len + pad + 4) >> 2)); /* not enough room in FIFO */ if (CSR_READ_2(sc, VX_W1_FREE_TX) < len + pad + 4) { /* make sure */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifp->if_timer = 1; ifq_prepend(&ifp->if_snd, m0); return; @@ -568,7 +568,7 @@ vxtxstat(struct vx_softc *sc) } else if (i & TXS_MAX_COLLISION) { ++ifp->if_collisions; CSR_WRITE_2(sc, VX_COMMAND, TX_ENABLE); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } else { sc->tx_succ_ok = (sc->tx_succ_ok+1) & 127; } @@ -603,7 +603,7 @@ vxintr(void *voidsc) vxread(sc); if (status & S_TX_AVAIL) { ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if_devstart(ifp); } if (status & S_CARD_FAILURE) { @@ -892,7 +892,7 @@ vxwatchdog(struct ifnet *ifp) if (ifp->if_flags & IFF_DEBUG) if_printf(ifp, "device timeout\n"); - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); if_devstart(ifp); vxintr(sc); } diff --git a/sys/dev/netif/wb/if_wb.c b/sys/dev/netif/wb/if_wb.c index 3347846b10..17000354f3 100644 --- a/sys/dev/netif/wb/if_wb.c +++ b/sys/dev/netif/wb/if_wb.c @@ -1103,7 +1103,7 @@ wb_txeoc(struct wb_softc *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) { WB_TXOWN(sc->wb_cdata.wb_tx_head) = WB_TXSTAT_OWN; @@ -1305,7 +1305,7 @@ wb_start(struct ifnet *ifp) * punt. */ if (sc->wb_cdata.wb_tx_free->wb_mbuf != NULL) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -1480,7 +1480,7 @@ wb_init(void *xsc) mii_mediachg(mii); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); crit_exit(); @@ -1614,7 +1614,8 @@ wb_stop(struct wb_softc *sc) bzero(&sc->wb_ldata->wb_tx_list, sizeof(sc->wb_ldata->wb_tx_list)); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } /* diff --git a/sys/dev/netif/wi/if_wi.c b/sys/dev/netif/wi/if_wi.c index 3fa8ef301a..7f6c1ef49d 100644 --- a/sys/dev/netif/wi/if_wi.c +++ b/sys/dev/netif/wi/if_wi.c @@ -606,8 +606,7 @@ wi_intr(void *arg) wi_tx_ex_intr(sc); if (status & WI_EV_INFO) wi_info_intr(sc); - if ((ifp->if_flags & IFF_OACTIVE) == 0 && - !ifq_is_empty(&ifp->if_snd)) + if (!ifq_is_oactive(&ifp->if_snd) && !ifq_is_empty(&ifp->if_snd)) wi_start_locked(ifp); /* Re-enable interrupts. */ @@ -680,7 +679,7 @@ wi_init_locked(struct wi_softc *sc) } ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); callout_reset(&sc->sc_watchdog, hz, wi_watchdog_callout, sc); @@ -717,7 +716,8 @@ wi_stop_locked(struct wi_softc *sc, int disable) sc->sc_tx_timer = 0; sc->sc_false_syns = 0; - ifp->if_flags &= ~(IFF_OACTIVE | IFF_RUNNING); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } void @@ -945,7 +945,7 @@ wi_start_locked(struct ifnet *ifp) break; if (sc->sc_txd[cur].d_len != 0) { IF_PREPEND(&ifp->if_snd, m0); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); break; } ni = (struct ieee80211_node *) m0->m_pkthdr.rcvif; @@ -1059,7 +1059,7 @@ wi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m0, memset(&frmhdr, 0, sizeof(frmhdr)); cur = sc->sc_txnext; if (sc->sc_txd[cur].d_len != 0) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); rc = ENOBUFS; goto out; } @@ -1440,7 +1440,7 @@ wi_tx_intr(struct wi_softc *sc) sc->sc_txd[cur].d_len = 0; sc->sc_txcur = cur = (cur + 1) % sc->sc_ntxbuf; if (sc->sc_txd[cur].d_len == 0) - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); else { if (wi_cmd(sc, WI_CMD_TX | WI_RECLAIM, sc->sc_txd[cur].d_fid, 0, 0)) { diff --git a/sys/dev/netif/wpi/if_wpi.c b/sys/dev/netif/wpi/if_wpi.c index 686a510577..8092ebe835 100644 --- a/sys/dev/netif/wpi/if_wpi.c +++ b/sys/dev/netif/wpi/if_wpi.c @@ -1611,7 +1611,7 @@ wpi_tx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc) ring->queued--; sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); wpi_start_locked(ifp); } @@ -2041,7 +2041,7 @@ wpi_start_locked(struct ifnet *ifp) * XXX: we CANNOT do it this way. If something * is prepended already, this is going to blow. */ - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, m); break; } @@ -2072,7 +2072,7 @@ wpi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, /* management frames go into ring 0 */ if (sc->txq[0].queued > sc->txq[0].count - 8) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); m_freem(m); ieee80211_free_node(ni); return ENOBUFS; /* XXX */ @@ -3015,7 +3015,7 @@ wpi_rfkill_resume(struct wpi_softc *sc) return; } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; sc->flags &= ~WPI_FLAG_HW_RADIO_OFF; @@ -3138,7 +3138,7 @@ wpi_init_locked(struct wpi_softc *sc, int force) return; } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; out: callout_reset(&sc->watchdog_to_callout, hz, wpi_watchdog_callout, sc); @@ -3166,7 +3166,8 @@ wpi_stop_locked(struct wpi_softc *sc) sc->sc_tx_timer = 0; sc->sc_scan_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); sc->flags &= ~WPI_FLAG_HW_RADIO_OFF; callout_stop(&sc->watchdog_to_callout); callout_stop(&sc->calib_to_callout); diff --git a/sys/dev/netif/xe/if_xe.c b/sys/dev/netif/xe/if_xe.c index 60361ef73b..4023aba2c5 100644 --- a/sys/dev/netif/xe/if_xe.c +++ b/sys/dev/netif/xe/if_xe.c @@ -456,7 +456,7 @@ xe_init(void *xscp) { /* Enable output */ scp->ifp->if_flags |= IFF_RUNNING; - scp->ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&scp->ifp->if_snd); crit_exit(); } @@ -464,8 +464,8 @@ xe_init(void *xscp) { /* * Start output on interface. Should be called at splimp() priority. Check - * that the output is idle (ie, IFF_OACTIVE is not set) before calling this - * function. If media selection is in progress we set IFF_OACTIVE ourselves + * that the output is idle (ie, OACTIVE is not set) before calling this + * function. If media selection is in progress we set OACTIVE ourselves * and return immediately. */ static void @@ -474,7 +474,7 @@ xe_start(struct ifnet *ifp) { struct mbuf *mbp; if (scp->autoneg_status != XE_AUTONEG_NONE) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } @@ -494,12 +494,12 @@ xe_start(struct ifnet *ifp) { * transmitter may be active, but if we haven't filled all * the buffers with data then we still want to accept more. */ - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); return; } if (xe_pio_write_packet(scp, mbp) != 0) { - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq_prepend(&ifp->if_snd, mbp); return; } @@ -672,7 +672,7 @@ xe_intr(void *xscp) } } ifp->if_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } /* Handle most MAC interrupts */ @@ -982,7 +982,7 @@ xe_setmedia_serialized(void *xscp) case XE_AUTONEG_NONE: IFPRINTF(2, (scp->ifp, "Waiting for idle transmitter\n")); - scp->arpcom.ac_if.if_flags |= IFF_OACTIVE; + ifq_set_oactive(&scp->arpcom.ac_if.if_snd); scp->autoneg_status = XE_AUTONEG_WAITING; /* FALL THROUGH */ @@ -1176,7 +1176,7 @@ xe_setmedia_serialized(void *xscp) /* Restart output? */ xe_enable_intr(scp); - scp->ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&scp->ifp->if_snd); if_devstart(scp->ifp); } @@ -1244,7 +1244,7 @@ xe_stop(struct xe_softc *scp) { * ~IFF_RUNNING == interface down. */ scp->ifp->if_flags &= ~IFF_RUNNING; - scp->ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&scp->ifp->if_snd); scp->ifp->if_timer = 0; crit_exit(); diff --git a/sys/dev/netif/xl/if_xl.c b/sys/dev/netif/xl/if_xl.c index e8522e94a9..ff7ceffc4c 100644 --- a/sys/dev/netif/xl/if_xl.c +++ b/sys/dev/netif/xl/if_xl.c @@ -2137,7 +2137,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); sc->xl_cdata.xl_tx_tail = NULL; } else { if (CSR_READ_4(sc, XL_DMACTL) & XL_DMACTL_DOWN_STALLED || @@ -2185,7 +2185,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); return; } @@ -2540,7 +2540,7 @@ xl_start_body(struct ifnet *ifp, int proc_rx) 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; } } @@ -2657,7 +2657,7 @@ xl_start_90xB(struct ifnet *ifp) sc = ifp->if_softc; - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; idx = sc->xl_cdata.xl_tx_prod; @@ -2666,7 +2666,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; } @@ -2939,7 +2939,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); callout_reset(&sc->xl_stat_timer, hz, xl_stats_update, sc); } @@ -3220,7 +3220,8 @@ xl_stop(struct xl_softc *sc) } bzero(sc->xl_ldata.xl_tx_list, XL_TX_LIST_SZ); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } /* diff --git a/sys/dev/virtual/vkernel/net/if_vke.c b/sys/dev/virtual/vkernel/net/if_vke.c index 106dfb3d17..83945e4037 100644 --- a/sys/dev/virtual/vkernel/net/if_vke.c +++ b/sys/dev/virtual/vkernel/net/if_vke.c @@ -281,7 +281,7 @@ vke_init(void *xsc) vke_stop(sc); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); sc->sc_txfifo = kmalloc(sizeof(*sc->sc_txfifo), M_DEVBUF, M_WAITOK); sc->sc_txfifo_done = kmalloc(sizeof(*sc->sc_txfifo_done), M_DEVBUF, M_WAITOK); @@ -333,7 +333,7 @@ vke_start(struct ifnet *ifp) ASSERT_SERIALIZED(ifp->if_serializer); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0 || ifq_is_oactive(&ifp->if_snd)) return; count = 0; @@ -416,7 +416,8 @@ vke_stop(struct vke_softc *sc) ASSERT_SERIALIZED(ifp->if_serializer); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); if (sc) { if (sc->cotd_tx) { diff --git a/sys/emulation/linux/linux_ioctl.c b/sys/emulation/linux/linux_ioctl.c index f5ba0a92d5..2041315e0a 100644 --- a/sys/emulation/linux/linux_ioctl.c +++ b/sys/emulation/linux/linux_ioctl.c @@ -1078,8 +1078,7 @@ linux_ioctl_SIOCGIFFLAGS(struct file *fp, u_long cmd, u_long ocmd, caddr_t data, flags = ifp->if_flags; /* these flags have no Linux equivalent */ - flags &= ~(IFF_SMART|IFF_OACTIVE|IFF_SIMPLEX| - IFF_LINK0|IFF_LINK1|IFF_LINK2); + flags &= ~(IFF_SMART|IFF_SIMPLEX| IFF_LINK0|IFF_LINK1|IFF_LINK2); /* Linux' multicast flag is in a different bit */ if (flags & IFF_MULTICAST) { flags &= ~IFF_MULTICAST; diff --git a/sys/net/altq/altq_cbq.c b/sys/net/altq/altq_cbq.c index f6c23e07bc..a7b873f6c3 100644 --- a/sys/net/altq/altq_cbq.c +++ b/sys/net/altq/altq_cbq.c @@ -573,7 +573,7 @@ cbqrestart(struct ifaltq *ifq) ALTQ_UNLOCK(ifq); ifnet_serialize_tx(ifp); - if (ifp->if_start && (ifp->if_flags & IFF_OACTIVE) == 0) + if (ifp->if_start && !ifq_is_oactive(&ifp->if_snd)) (*ifp->if_start)(ifp); ifnet_deserialize_tx(ifp); diff --git a/sys/net/altq/if_altq.h b/sys/net/altq/if_altq.h index cffe70fd0a..8ab008f8c2 100644 --- a/sys/net/altq/if_altq.h +++ b/sys/net/altq/if_altq.h @@ -80,6 +80,7 @@ struct ifaltq { struct lwkt_serialize altq_lock; struct mbuf *altq_prepended; /* mbuf dequeued, but not yet xmit */ int altq_started; /* ifnet.if_start interlock */ + int altq_hw_oactive; /* hw too busy, protected by driver */ struct ifaltq_stage *altq_stage; }; diff --git a/sys/net/bridge/if_bridge.c b/sys/net/bridge/if_bridge.c index 5b0618777a..955b85d9bd 100644 --- a/sys/net/bridge/if_bridge.c +++ b/sys/net/bridge/if_bridge.c @@ -2303,7 +2303,7 @@ bridge_start(struct ifnet *ifp) ASSERT_IFNET_SERIALIZED_TX(ifp); - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); for (;;) { struct ifnet *dst_if = NULL; struct ether_header *eh; @@ -2347,7 +2347,7 @@ bridge_start(struct ifnet *ifp) else bridge_enqueue(dst_if, m); } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } /* diff --git a/sys/net/ef/if_ef.c b/sys/net/ef/if_ef.c index 1e2bc07164..4c40ea1afa 100644 --- a/sys/net/ef/if_ef.c +++ b/sys/net/ef/if_ef.c @@ -207,7 +207,7 @@ ef_start(struct ifnet *ifp) struct ifnet *p; struct mbuf *m; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); p = sc->ef_ifp; EFDEBUG("\n"); @@ -223,12 +223,12 @@ ef_start(struct ifnet *ifp) continue; } IF_ENQUEUE(&p->if_snd, m); - if ((p->if_flags & IFF_OACTIVE) == 0) { + if (!ifq_is_oactive(&p->if_snd)) { p->if_start(p); ifp->if_opackets++; } } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); return; } diff --git a/sys/net/if.c b/sys/net/if.c index 12163f32b6..595172d072 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -308,7 +308,7 @@ if_start_need_schedule(struct ifaltq *ifq, int running) * ifnet.if_start interlock is released, if: * 1) Hardware can not take any packets, due to * o interface is marked down - * o hardware queue is full (IFF_OACTIVE) + * o hardware queue is full (ifq_is_oactive) * Under the second situation, hardware interrupt * or polling(4) will call/schedule ifnet.if_start * when hardware queue is ready @@ -351,11 +351,10 @@ if_start_dispatch(netmsg_t msg) } ifnet_serialize_tx(ifp); - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) == IFF_RUNNING) { + if ((ifp->if_flags & IFF_RUNNING) && !ifq_is_oactive(ifq)) { logifstart(run, ifp); ifp->if_start(ifp); - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) == - IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) && !ifq_is_oactive(ifq)) running = 1; } need_sched = if_start_need_schedule(ifq, running); @@ -393,7 +392,7 @@ if_devstart(struct ifnet *ifp) logifstart(run, ifp); ifp->if_start(ifp); - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) == IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) && !ifq_is_oactive(ifq)) running = 1; if (if_start_need_schedule(ifq, running)) { @@ -2486,11 +2485,10 @@ ifq_try_ifstart(struct ifaltq *ifq, int force_sched) return; } - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) == IFF_RUNNING) { + if ((ifp->if_flags & IFF_RUNNING) && !ifq_is_oactive(ifq)) { logifstart(run, ifp); ifp->if_start(ifp); - if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) == - IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) && !ifq_is_oactive(ifq)) running = 1; } need_sched = if_start_need_schedule(ifq, running); diff --git a/sys/net/if.h b/sys/net/if.h index efd211452c..b1214fa95a 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -126,7 +126,7 @@ struct if_data { #define IFF_NOARP 0x80 /* no address resolution protocol */ #define IFF_PROMISC 0x100 /* receive all packets */ #define IFF_ALLMULTI 0x200 /* receive all multicast packets */ -#define IFF_OACTIVE 0x400 /* transmission in progress */ +#define IFF_OACTIVE_COMPAT 0x400 /* was transmission in progress */ #define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ #define IFF_LINK0 0x1000 /* per link layer defined bit */ #define IFF_LINK1 0x2000 /* per link layer defined bit */ @@ -141,10 +141,14 @@ struct if_data { /* flags set internally only: */ #define IFF_CANTCHANGE \ - (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ + (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE_COMPAT|\ IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_POLLING|\ IFF_NPOLLING) +#ifndef _KERNEL +#define IFF_OACTIVE IFF_OACTIVE_COMPAT +#endif + /* * Some convenience macros used for setting ifi_baudrate. * XXX 1000 vs. 1024? --thorpej@netbsd.org diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 2cee6ca8c8..b960cd41ce 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -463,7 +463,7 @@ if_handoff(struct ifqueue *_ifq, struct mbuf *_m, struct ifnet *_ifp, _ifp->if_obytes += _m->m_pkthdr.len + _adjust; if (_m->m_flags & M_MCAST) _ifp->if_omcasts++; - _need_if_start = !(_ifp->if_flags & IFF_OACTIVE); + _need_if_start = !_ifp->if_snd.altq_hw_oactive; } IF_ENQUEUE(_ifq, _m); if (_need_if_start) { diff --git a/sys/net/ifq_var.h b/sys/net/ifq_var.h index 38a9b77c6a..a8531ba3ab 100644 --- a/sys/net/ifq_var.h +++ b/sys/net/ifq_var.h @@ -285,6 +285,24 @@ ifq_prepend(struct ifaltq *_ifq, struct mbuf *_m) ALTQ_UNLOCK(_ifq); } +static __inline void +ifq_set_oactive(struct ifaltq *_ifq) +{ + _ifq->altq_hw_oactive = 1; +} + +static __inline void +ifq_clr_oactive(struct ifaltq *_ifq) +{ + _ifq->altq_hw_oactive = 0; +} + +static __inline int +ifq_is_oactive(const struct ifaltq *_ifq) +{ + return _ifq->altq_hw_oactive; +} + /* * Hand a packet to an interface. * @@ -305,7 +323,7 @@ ifq_handoff(struct ifnet *_ifp, struct mbuf *_m, struct altq_pktattr *_pa) _ifp->if_obytes += _m->m_pkthdr.len; if (_m->m_flags & M_MCAST) _ifp->if_omcasts++; - if ((_ifp->if_flags & IFF_OACTIVE) == 0) + if (!ifq_is_oactive(&_ifp->if_snd)) (*_ifp->if_start)(_ifp); } return(_error); diff --git a/sys/net/sppp/if_spppsubr.c b/sys/net/sppp/if_spppsubr.c index c599162ebd..d7c5c840c9 100644 --- a/sys/net/sppp/if_spppsubr.c +++ b/sys/net/sppp/if_spppsubr.c @@ -950,7 +950,7 @@ sppp_output_serialized(struct ifnet *ifp, struct mbuf *m, crit_exit(); return(rv); } - if (! (ifp->if_flags & IFF_OACTIVE)) + if (!ifq_is_oactive(&ifp->if_snd)) (*ifp->if_start) (ifp); /* @@ -1384,7 +1384,7 @@ sppp_cisco_send(struct sppp *sp, int type, long par1, long par2) m_freem (m); } else IF_ENQUEUE (&sp->pp_cpq, m); - if (! (ifp->if_flags & IFF_OACTIVE)) + if (!ifq_is_oactive(&ifp->if_snd)) (*ifp->if_start) (ifp); ifp->if_obytes += m->m_pkthdr.len + 3; } @@ -1441,7 +1441,7 @@ sppp_cp_send(struct sppp *sp, u_short proto, u_char type, ++ifp->if_oerrors; } else IF_ENQUEUE (&sp->pp_cpq, m); - if (! (ifp->if_flags & IFF_OACTIVE)) + if (!ifq_is_oactive(&ifp->if_snd)) (*ifp->if_start) (ifp); ifp->if_obytes += m->m_pkthdr.len + 3; } @@ -4780,7 +4780,7 @@ sppp_auth_send(const struct cp *cp, struct sppp *sp, ++ifp->if_oerrors; } else IF_ENQUEUE (&sp->pp_cpq, m); - if (! (ifp->if_flags & IFF_OACTIVE)) + if (!ifq_is_oactive(&ifp->if_snd)) (*ifp->if_start) (ifp); ifp->if_obytes += m->m_pkthdr.len + 3; } diff --git a/sys/net/tap/if_tap.c b/sys/net/tap/if_tap.c index 14ad923a6c..afb8a2c8f2 100644 --- a/sys/net/tap/if_tap.c +++ b/sys/net/tap/if_tap.c @@ -537,7 +537,7 @@ tapifinit(void *xtp) tapifstop(tp, 1); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); /* attempt to start output */ tapifstart(ifp); @@ -655,7 +655,7 @@ tapifstart(struct ifnet *ifp) return; } - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); ifq = &tp->tap_devq; while ((m = ifq_dequeue(&ifp->if_snd, NULL)) != NULL) { @@ -685,7 +685,7 @@ tapifstart(struct ifnet *ifp) } } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); } @@ -1041,8 +1041,10 @@ tapifstop(struct tap_softc *tp, int clear_flags) ASSERT_IFNET_SERIALIZED_ALL(ifp); IF_DRAIN(&tp->tap_devq); tp->tap_flags &= ~TAP_CLOSEDOWN; - if (clear_flags) - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + if (clear_flags) { + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); + } } static void diff --git a/sys/netgraph/eiface/ng_eiface.c b/sys/netgraph/eiface/ng_eiface.c index a9dd4fba6c..6f9c39415e 100644 --- a/sys/netgraph/eiface/ng_eiface.c +++ b/sys/netgraph/eiface/ng_eiface.c @@ -160,12 +160,14 @@ ng_eiface_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr) */ if (ifr->ifr_flags & IFF_UP) { if (!(ifp->if_flags & IFF_RUNNING)) { - ifp->if_flags &= ~(IFF_OACTIVE); + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; } } else { - if (ifp->if_flags & IFF_RUNNING) - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + if (ifp->if_flags & IFF_RUNNING) { + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); + } } break; @@ -204,7 +206,7 @@ ng_eiface_init(void *xsc) crit_enter(); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); crit_exit(); @@ -229,10 +231,10 @@ ng_eiface_start(struct ifnet *ifp) return; /* Don't do anything if output is active */ - if( ifp->if_flags & IFF_OACTIVE ) + if(ifq_is_oactive(&ifp->if_snd)) return; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); /* * Grab a packet to transmit. @@ -242,7 +244,7 @@ ng_eiface_start(struct ifnet *ifp) /* If there's nothing to send, return. */ if(m == NULL) { - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); return; } @@ -260,7 +262,7 @@ ng_eiface_start(struct ifnet *ifp) ifp->if_opackets++; } - ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&ifp->if_snd); return; } @@ -533,7 +535,8 @@ ng_eiface_rmnode(node_p node) ng_cutlinks(node); node->flags &= ~NG_INVALID; ifnet_serialize_all(ifp); - ifp->if_flags &= ~(IFF_UP | IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~(IFF_UP | IFF_RUNNING); + ifq_clr_oactive(&ifp->if_snd); ifnet_deserialize_all(ifp); return (0); } diff --git a/sys/netgraph/fec/ng_fec.c b/sys/netgraph/fec/ng_fec.c index 7eeaaad8b5..98eabde4b2 100644 --- a/sys/netgraph/fec/ng_fec.c +++ b/sys/netgraph/fec/ng_fec.c @@ -671,7 +671,7 @@ ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data, struct ucred *cr) error = EINVAL; break; } - ifp->if_flags &= ~(IFF_OACTIVE); + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; ng_fec_init(ifp); } @@ -685,8 +685,10 @@ ng_fec_ioctl(struct ifnet *ifp, u_long command, caddr_t data, struct ucred *cr) priv->if_flags = ifp->if_flags; } } else { - if (ifp->if_flags & IFF_RUNNING) - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + if (ifp->if_flags & IFF_RUNNING) { + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); + } ng_fec_stop(ifp); } break; diff --git a/sys/netgraph/iface/ng_iface.c b/sys/netgraph/iface/ng_iface.c index fb04bd3ba0..a87a91014d 100644 --- a/sys/netgraph/iface/ng_iface.c +++ b/sys/netgraph/iface/ng_iface.c @@ -352,7 +352,7 @@ ng_iface_ioctl(struct ifnet *ifp, u_long command, caddr_t data, /* These two are mostly handled at a higher layer */ case SIOCSIFADDR: ifp->if_flags |= (IFF_UP | IFF_RUNNING); - ifp->if_flags &= ~(IFF_OACTIVE); + ifq_clr_oactive(&ifp->if_snd); break; case SIOCGIFADDR: break; @@ -365,12 +365,13 @@ ng_iface_ioctl(struct ifnet *ifp, u_long command, caddr_t data, */ if (ifr->ifr_flags & IFF_UP) { if (!(ifp->if_flags & IFF_RUNNING)) { - ifp->if_flags &= ~(IFF_OACTIVE); + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; } } else { if (ifp->if_flags & IFF_RUNNING) - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); } break; diff --git a/sys/netgraph7/iface/ng_iface.c b/sys/netgraph7/iface/ng_iface.c index 83a7ed054b..c870c9daa3 100644 --- a/sys/netgraph7/iface/ng_iface.c +++ b/sys/netgraph7/iface/ng_iface.c @@ -358,7 +358,7 @@ ng_iface_ioctl(struct ifnet *ifp, u_long command, caddr_t data, case SIOCSIFADDR: ifp->if_flags |= IFF_UP; ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~(IFF_OACTIVE); + ifq_clr_oactive(&ifp->if_snd); break; case SIOCGIFADDR: break; @@ -371,12 +371,14 @@ ng_iface_ioctl(struct ifnet *ifp, u_long command, caddr_t data, */ if (ifr->ifr_flags & IFF_UP) { if (!(ifp->if_flags & IFF_RUNNING)) { - ifp->if_flags &= ~(IFF_OACTIVE); + ifq_clr_oactive(&ifp->if_snd); ifp->if_flags |= IFF_RUNNING; } } else { - if (ifp->if_flags & IFF_RUNNING) - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + if (ifp->if_flags & IFF_RUNNING) { + ifp->if_flags &= ~IFF_RUNNING; + ifq_clr_oactive(&ifp->if_snd); + } } break; diff --git a/sys/netproto/802_11/wlan/ieee80211_output.c b/sys/netproto/802_11/wlan/ieee80211_output.c index cbd8fd7207..fee8b19468 100644 --- a/sys/netproto/802_11/wlan/ieee80211_output.c +++ b/sys/netproto/802_11/wlan/ieee80211_output.c @@ -153,7 +153,7 @@ ieee80211_start(struct ifnet *ifp) "%s: ignore queue, in %s state\n", __func__, ieee80211_state_name[vap->iv_state]); vap->iv_stats.is_tx_badstate++; - ifp->if_flags |= IFF_OACTIVE; + ifq_set_oactive(&ifp->if_snd); return; } } @@ -384,7 +384,7 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m, struct ieee80211_frame *wh; int error; - if (ifp->if_flags & IFF_OACTIVE) { + if (ifq_is_oactive(&ifp->if_snd)) { /* * Short-circuit requests if the vap is marked OACTIVE * as this can happen because a packet came down through diff --git a/sys/netproto/802_11/wlan/ieee80211_proto.c b/sys/netproto/802_11/wlan/ieee80211_proto.c index 4da05470d2..9e68165b60 100644 --- a/sys/netproto/802_11/wlan/ieee80211_proto.c +++ b/sys/netproto/802_11/wlan/ieee80211_proto.c @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -1659,7 +1660,7 @@ ieee80211_newstate_task(void *xvap, int npending) * Note this can also happen as a result of SLEEP->RUN * (i.e. coming out of power save mode). */ - vap->iv_ifp->if_flags &= ~IFF_OACTIVE; + ifq_clr_oactive(&vap->iv_ifp->if_snd); vap->iv_ifp->if_start(vap->iv_ifp); /* bring up any vaps waiting on us */