diff options
author | 2015-11-13 10:36:29 +0000 | |
---|---|---|
committer | 2015-11-13 10:36:29 +0000 | |
commit | 32a12f8b53bcf09e627a8bf1c4f5cf6e3f67c7d7 (patch) | |
tree | be868dd20fd8239f6a679fc4394aabd302fc966b /sys/dev/usb/if_uath.c | |
parent | Do not cast malloc(9) results. (diff) | |
download | wireguard-openbsd-32a12f8b53bcf09e627a8bf1c4f5cf6e3f67c7d7.tar.xz wireguard-openbsd-32a12f8b53bcf09e627a8bf1c4f5cf6e3f67c7d7.zip |
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/usb/if_uath.c')
-rw-r--r-- | sys/dev/usb/if_uath.c | 21 |
1 files changed, 8 insertions, 13 deletions
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); |