diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-11-13 10:36:30 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-11-13 10:36:30 +0000 |
commit | 2a0e184066a934df6bcc13b04454e8b6f4d09871 (patch) | |
tree | 168ee2a79bf16743ebe261d06b5d42fbf6805564 /sys/dev | |
parent | fbd4873807a5947cb4cb925b0b6119e0fbcd1bde (diff) |
Check for space on the ring before dequeuing packets.
Allows us to get rid of mq_requeue(9) and IFQ_POLL(9) because wireless
drivers use a special queue for management frames.
Tested by stsp@, ok dlg@, stsp@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/if_ral.c | 21 | ||||
-rw-r--r-- | sys/dev/usb/if_rum.c | 21 | ||||
-rw-r--r-- | sys/dev/usb/if_uath.c | 21 | ||||
-rw-r--r-- | sys/dev/usb/if_urtw.c | 24 |
4 files changed, 32 insertions, 55 deletions
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index 2f906b1b2c6..08daa0829df 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.134 2015/11/04 12:12:00 dlg Exp $ */ +/* $OpenBSD: if_ral.c,v 1.135 2015/11/13 10:36:29 mpi Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1238,14 +1238,13 @@ ural_start(struct ifnet *ifp) return; for (;;) { + if (sc->tx_queued >= RAL_TX_LIST_COUNT - 1) { + ifp->if_flags |= IFF_OACTIVE; + break; + } + m0 = mq_dequeue(&ic->ic_mgtq); if (m0 != NULL) { - if (sc->tx_queued >= RAL_TX_LIST_COUNT - 1) { - mq_requeue(&ic->ic_mgtq, m0); - ifp->if_flags |= IFF_OACTIVE; - break; - } - ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) @@ -1257,14 +1256,10 @@ ural_start(struct ifnet *ifp) } else { if (ic->ic_state != IEEE80211_S_RUN) break; - IFQ_POLL(&ifp->if_snd, m0); + + IFQ_DEQUEUE(&ifp->if_snd, m0); if (m0 == NULL) break; - if (sc->tx_queued >= RAL_TX_LIST_COUNT - 1) { - ifp->if_flags |= IFF_OACTIVE; - break; - } - IFQ_DEQUEUE(&ifp->if_snd, m0); #if NBPFILTER > 0 if (ifp->if_bpf != NULL) bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 567d20e0349..09a42757608 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.113 2015/11/04 12:12:00 dlg Exp $ */ +/* $OpenBSD: if_rum.c,v 1.114 2015/11/13 10:36:29 mpi Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr> @@ -1242,14 +1242,13 @@ rum_start(struct ifnet *ifp) return; for (;;) { + if (sc->tx_queued >= RUM_TX_LIST_COUNT - 1) { + ifp->if_flags |= IFF_OACTIVE; + break; + } + m0 = mq_dequeue(&ic->ic_mgtq); if (m0 != NULL) { - if (sc->tx_queued >= RUM_TX_LIST_COUNT - 1) { - mq_requeue(&ic->ic_mgtq, m0); - ifp->if_flags |= IFF_OACTIVE; - break; - } - ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) @@ -1261,14 +1260,10 @@ rum_start(struct ifnet *ifp) } else { if (ic->ic_state != IEEE80211_S_RUN) break; - IFQ_POLL(&ifp->if_snd, m0); + + IFQ_DEQUEUE(&ifp->if_snd, m0); if (m0 == NULL) break; - if (sc->tx_queued >= RUM_TX_LIST_COUNT - 1) { - ifp->if_flags |= IFF_OACTIVE; - break; - } - IFQ_DEQUEUE(&ifp->if_snd, m0); #if NBPFILTER > 0 if (ifp->if_bpf != NULL) bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index 84293ed3806..1752061466c 100644 --- a/sys/dev/usb/if_uath.c +++ b/sys/dev/usb/if_uath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uath.c,v 1.71 2015/11/04 12:12:00 dlg Exp $ */ +/* $OpenBSD: if_uath.c,v 1.72 2015/11/13 10:36:29 mpi Exp $ */ /*- * Copyright (c) 2006 @@ -1477,14 +1477,13 @@ uath_start(struct ifnet *ifp) return; for (;;) { + if (sc->tx_queued >= UATH_TX_DATA_LIST_COUNT) { + ifp->if_flags |= IFF_OACTIVE; + break; + } + m0 = mq_dequeue(&ic->ic_mgtq); if (m0 != NULL) { - if (sc->tx_queued >= UATH_TX_DATA_LIST_COUNT) { - mq_requeue(&ic->ic_mgtq, m0); - ifp->if_flags |= IFF_OACTIVE; - break; - } - ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) @@ -1495,14 +1494,10 @@ uath_start(struct ifnet *ifp) } else { if (ic->ic_state != IEEE80211_S_RUN) break; - IFQ_POLL(&ifp->if_snd, m0); + + IFQ_DEQUEUE(&ifp->if_snd, m0); if (m0 == NULL) break; - if (sc->tx_queued >= UATH_TX_DATA_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; - break; - } - IFQ_DEQUEUE(&ifp->if_snd, m0); #if NBPFILTER > 0 if (ifp->if_bpf != NULL) bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index 22f4254bb20..6ba00806ba9 100644 --- a/sys/dev/usb/if_urtw.c +++ b/sys/dev/usb/if_urtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtw.c,v 1.56 2015/11/04 12:12:00 dlg Exp $ */ +/* $OpenBSD: if_urtw.c,v 1.57 2015/11/13 10:36:29 mpi Exp $ */ /*- * Copyright (c) 2009 Martynas Venckus <martynas@openbsd.org> @@ -2429,15 +2429,14 @@ urtw_start(struct ifnet *ifp) return; for (;;) { + if (sc->sc_tx_low_queued >= URTW_TX_DATA_LIST_COUNT || + sc->sc_tx_normal_queued >= URTW_TX_DATA_LIST_COUNT) { + ifp->if_flags |= IFF_OACTIVE; + break; + } + m0 = mq_dequeue(&ic->ic_mgtq); if (m0 != NULL) { - if (sc->sc_tx_low_queued >= URTW_TX_DATA_LIST_COUNT || - sc->sc_tx_normal_queued >= - URTW_TX_DATA_LIST_COUNT) { - mq_requeue(&ic->ic_mgtq, m0); - ifp->if_flags |= IFF_OACTIVE; - break; - } ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) @@ -2449,16 +2448,9 @@ urtw_start(struct ifnet *ifp) } else { if (ic->ic_state != IEEE80211_S_RUN) break; - IFQ_POLL(&ifp->if_snd, m0); + IFQ_DEQUEUE(&ifp->if_snd, m0); if (m0 == NULL) break; - if (sc->sc_tx_low_queued >= URTW_TX_DATA_LIST_COUNT || - sc->sc_tx_normal_queued >= - URTW_TX_DATA_LIST_COUNT) { - ifp->if_flags |= IFF_OACTIVE; - break; - } - IFQ_DEQUEUE(&ifp->if_snd, m0); #if NBPFILTER > 0 if (ifp->if_bpf != NULL) bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); |