diff options
author | 2015-11-04 12:11:59 +0000 | |
---|---|---|
committer | 2015-11-04 12:11:59 +0000 | |
commit | 351e1934c2099e25d34ae49fa59b7275f24892c3 (patch) | |
tree | e51a56981b6c0e9162caa898eb8044d35ab90853 /sys | |
parent | some fixes from raf czlonka (diff) | |
download | wireguard-openbsd-351e1934c2099e25d34ae49fa59b7275f24892c3.tar.xz wireguard-openbsd-351e1934c2099e25d34ae49fa59b7275f24892c3.zip |
replace the ifqueues in net80211 with mbuf_queues.
the specific queues are ic_mgtq, ic_pwrsaveq, and ni_savedq. rtw
had its own queue for beacons.
tested by mpi@ and jmc@
ok mpi@
Diffstat (limited to 'sys')
34 files changed, 112 insertions, 124 deletions
diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c index c932aa64574..ba986b2b5dc 100644 --- a/sys/dev/ic/acx.c +++ b/sys/dev/ic/acx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx.c,v 1.113 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: acx.c,v 1.114 2015/11/04 12:11:59 dlg Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -930,7 +930,7 @@ acx_start(struct ifnet *ifp) struct mbuf *m; int rate; - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); /* first dequeue management frames */ if (m != NULL) { ni = m->m_pkthdr.ph_cookie; @@ -958,7 +958,7 @@ acx_start(struct ifnet *ifp) struct ether_header *eh; /* then dequeue packets on the powersave queue */ - IF_DEQUEUE(&ic->ic_pwrsaveq, m); + m = mq_dequeue(&ic->ic_pwrsaveq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto encapped; diff --git a/sys/dev/ic/ar5008.c b/sys/dev/ic/ar5008.c index fed671d6509..3f46fd4d7b0 100644 --- a/sys/dev/ic/ar5008.c +++ b/sys/dev/ic/ar5008.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5008.c,v 1.29 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: ar5008.c,v 1.30 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -1058,7 +1058,7 @@ ar5008_swba_intr(struct athn_softc *sc) int error, totlen; if (ic->ic_tim_mcast_pending && - IF_IS_EMPTY(&ni->ni_savedq) && + mq_empty(&ni->ni_savedq) && SIMPLEQ_EMPTY(&sc->txq[ATHN_QID_CAB].head)) ic->ic_tim_mcast_pending = 0; @@ -1139,10 +1139,10 @@ ar5008_swba_intr(struct athn_softc *sc) if (SIMPLEQ_EMPTY(&sc->txbufs)) break; - IF_DEQUEUE(&ni->ni_savedq, m); + m = mq_dequeue(&ni->ni_savedq); if (m == NULL) break; - if (!IF_IS_EMPTY(&ni->ni_savedq)) { + if (!mq_empty(&ni->ni_savedq)) { /* more queued frames, set the more data bit */ wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; diff --git a/sys/dev/ic/ar9003.c b/sys/dev/ic/ar9003.c index ab6a36b2758..a259d4a5a70 100644 --- a/sys/dev/ic/ar9003.c +++ b/sys/dev/ic/ar9003.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9003.c,v 1.33 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: ar9003.c,v 1.34 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1191,7 +1191,7 @@ ar9003_swba_intr(struct athn_softc *sc) int error, totlen; if (ic->ic_tim_mcast_pending && - IF_IS_EMPTY(&ni->ni_savedq) && + mq_empty(&ni->ni_savedq) && SIMPLEQ_EMPTY(&sc->txq[ATHN_QID_CAB].head)) ic->ic_tim_mcast_pending = 0; @@ -1284,10 +1284,10 @@ ar9003_swba_intr(struct athn_softc *sc) if (SIMPLEQ_EMPTY(&sc->txbufs)) break; - IF_DEQUEUE(&ni->ni_savedq, m); + m = mq_dequeue(&ni->ni_savedq); if (m == NULL) break; - if (!IF_IS_EMPTY(&ni->ni_savedq)) { + if (!mq_empty(&ni->ni_savedq)) { /* more queued frames, set the more data bit */ wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 6fa549bcb3b..314dc23655f 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.106 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: ath.c,v 1.107 2015/11/04 12:11:59 dlg Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -857,7 +857,7 @@ ath_start(struct ifnet *ifp) * Poll the management queue for frames; they * have priority over normal data frames. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m == NULL) { /* * No data frames go out unless we're associated. diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index 55f9d4df062..e93102be4c3 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.87 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: athn.c,v 1.88 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -2549,7 +2549,7 @@ athn_start(struct ifnet *ifp) break; } /* Send pending management frames first. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; @@ -2557,7 +2557,7 @@ athn_start(struct ifnet *ifp) if (ic->ic_state != IEEE80211_S_RUN) break; - IF_DEQUEUE(&ic->ic_pwrsaveq, m); + m = mq_dequeue(&ic->ic_pwrsaveq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 1e42fd7fbf8..b43b4635017 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atw.c,v 1.89 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: atw.c,v 1.90 2015/11/04 12:11:59 dlg Exp $ */ /* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */ /*- @@ -3596,7 +3596,7 @@ atw_start(struct ifnet *ifp) * Grab a packet off the management queue, if it * is not empty. Otherwise, from the data queue. */ - IF_DEQUEUE(&ic->ic_mgtq, m0); + m0 = mq_dequeue(&ic->ic_mgtq); if (m0 != NULL) { ni = m0->m_pkthdr.ph_cookie; } else { diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index 214644f9ad4..66503b6ccc4 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.118 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: bwi.c,v 1.119 2015/11/04 12:11:59 dlg Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -7194,10 +7194,8 @@ bwi_start(struct ifnet *ifp) struct mbuf *m; int mgt_pkt = 0; - IF_POLL(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { - IF_DEQUEUE(&ic->ic_mgtq, m); - ni = m->m_pkthdr.ph_cookie; mgt_pkt = 1; diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index 2ab80aba5fe..9f132221dff 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malo.c,v 1.108 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: malo.c,v 1.109 2015/11/04 12:11:59 dlg Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -1010,13 +1010,13 @@ malo_start(struct ifnet *ifp) return; for (;;) { - IF_POLL(&ic->ic_mgtq, m0); + m0 = mq_dequeue(&ic->ic_mgtq); if (m0 != NULL) { if (sc->sc_txring.queued >= MALO_TX_RING_COUNT) { ifp->if_flags |= IFF_OACTIVE; + mq_requeue(&ic->ic_mgtq, m0); break; } - IF_DEQUEUE(&ic->ic_mgtq, m0); ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 0cb12360c09..e766fe3cb0a 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.73 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: rt2560.c,v 1.74 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1928,14 +1928,14 @@ rt2560_start(struct ifnet *ifp) return; for (;;) { - IF_POLL(&ic->ic_mgtq, m0); + m0 = mq_dequeue(&ic->ic_mgtq); if (m0 != NULL) { if (sc->prioq.queued >= RT2560_PRIO_RING_COUNT) { ifp->if_flags |= IFF_OACTIVE; sc->sc_flags |= RT2560_PRIO_OACTIVE; + mq_requeue(&ic->ic_mgtq, m0); break; } - IF_DEQUEUE(&ic->ic_mgtq, m0); ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index 6c121104cf0..55fed910a64 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.83 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: rt2661.c,v 1.84 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2006 @@ -1933,13 +1933,13 @@ rt2661_start(struct ifnet *ifp) return; for (;;) { - IF_POLL(&ic->ic_mgtq, m0); + m0 = mq_dequeue(&ic->ic_mgtq); if (m0 != NULL) { if (sc->mgtq.queued >= RT2661_MGT_RING_COUNT) { ifp->if_flags |= IFF_OACTIVE; + mq_requeue(&ic->ic_mgtq, m0); break; } - IF_DEQUEUE(&ic->ic_mgtq, m0); ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c index a1e3d887474..cab0d974e9f 100644 --- a/sys/dev/ic/rt2860.c +++ b/sys/dev/ic/rt2860.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2860.c,v 1.82 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: rt2860.c,v 1.83 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1748,7 +1748,7 @@ rt2860_start(struct ifnet *ifp) break; } /* send pending management frames first */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; @@ -1757,7 +1757,7 @@ rt2860_start(struct ifnet *ifp) break; /* send buffered frames for power-save mode */ - IF_DEQUEUE(&ic->ic_pwrsaveq, m); + m = mq_dequeue(&ic->ic_pwrsaveq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index 9592b45943d..07c66cb5dfb 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.91 2015/10/25 12:48:46 mpi Exp $ */ +/* $OpenBSD: rtw.c,v 1.92 2015/11/04 12:11:59 dlg Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- @@ -185,7 +185,7 @@ void rtw_rxdesc_init_all(struct rtw_rxdesc_blk *, struct rtw_rxsoft *, int rtw_txring_choose(struct rtw_softc *, struct rtw_txsoft_blk **, struct rtw_txdesc_blk **, int); u_int rtw_txring_next(struct rtw_regs *, struct rtw_txdesc_blk *); -struct mbuf *rtw_80211_dequeue(struct rtw_softc *, struct ifqueue *, int, +struct mbuf *rtw_80211_dequeue(struct rtw_softc *, struct mbuf_queue *, int, struct rtw_txsoft_blk **, struct rtw_txdesc_blk **, struct ieee80211_node **, short *); uint64_t rtw_tsf_extend(struct rtw_regs *, u_int32_t); @@ -1500,7 +1500,7 @@ rtw_intr_beacon(struct rtw_softc *sc, u_int16_t isr) return; } m->m_pkthdr.ph_cookie = ieee80211_ref_node(ic->ic_bss); - IF_ENQUEUE(&sc->sc_beaconq, m); + mq_enqueue(&sc->sc_beaconq, m); rtw_start(&sc->sc_if); } } @@ -2678,13 +2678,13 @@ rtw_txring_choose(struct rtw_softc *sc, struct rtw_txsoft_blk **tsbp, } struct mbuf * -rtw_80211_dequeue(struct rtw_softc *sc, struct ifqueue *ifq, int pri, +rtw_80211_dequeue(struct rtw_softc *sc, struct mbuf_queue *ifq, int pri, struct rtw_txsoft_blk **tsbp, struct rtw_txdesc_blk **tdbp, struct ieee80211_node **nip, short *if_flagsp) { struct mbuf *m; - if (IF_IS_EMPTY(ifq)) + if (mq_empty(ifq)) return NULL; if (rtw_txring_choose(sc, tsbp, tdbp, pri) == -1) { DPRINTF(sc, RTW_DEBUG_XMIT_RSRC, ("%s: no ring %d descriptor\n", @@ -2693,7 +2693,7 @@ rtw_80211_dequeue(struct rtw_softc *sc, struct ifqueue *ifq, int pri, sc->sc_if.if_timer = 1; return NULL; } - IF_DEQUEUE(ifq, m); + m = mq_dequeue(ifq); *nip = m->m_pkthdr.ph_cookie; return m; } diff --git a/sys/dev/ic/rtwvar.h b/sys/dev/ic/rtwvar.h index 79bf05b2e0b..1e9e13367da 100644 --- a/sys/dev/ic/rtwvar.h +++ b/sys/dev/ic/rtwvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rtwvar.h,v 1.30 2010/09/07 16:21:43 deraadt Exp $ */ +/* $OpenBSD: rtwvar.h,v 1.31 2015/11/04 12:11:59 dlg Exp $ */ /* $NetBSD: rtwvar.h,v 1.10 2004/12/26 22:37:57 mycroft Exp $ */ /*- @@ -423,7 +423,7 @@ struct rtw_softc { } sc_txtapu; union rtw_keys sc_keys; int sc_txkey; - struct ifqueue sc_beaconq; + struct mbuf_queue sc_beaconq; struct rtw_led_state sc_led_state; u_int sc_hwverid; }; diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index a1b647b91be..2de408640ab 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.62 2015/10/25 13:04:28 mpi Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.63 2015/11/04 12:11:59 dlg Exp $ */ /* * Copyright (c) 2014 genua mbh <info@genua.de> @@ -5591,7 +5591,7 @@ iwm_start(struct ifnet *ifp) } /* need to send management frames even if we're not RUNning */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index 0b1aa9b35f7..9a1d3edbdc4 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.145 2015/10/25 13:04:28 mpi Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.146 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -3046,7 +3046,7 @@ iwn_start(struct ifnet *ifp) break; } /* Send pending management frames first. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index a55f99a94b4..08f1236722b 100644 --- a/sys/dev/pci/if_rtwn.c +++ b/sys/dev/pci/if_rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtwn.c,v 1.7 2015/10/25 13:04:28 mpi Exp $ */ +/* $OpenBSD: if_rtwn.c,v 1.8 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1871,7 +1871,7 @@ rtwn_start(struct ifnet *ifp) break; } /* Send pending management frames first. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index 4defce0f8ca..eabfee0fd67 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.129 2015/10/25 13:04:28 mpi Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.130 2015/11/04 12:11:59 dlg Exp $ */ /*- * Copyright (c) 2006-2008 @@ -1905,7 +1905,7 @@ wpi_start(struct ifnet *ifp) break; } /* Send pending management frames first. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c index e35a21e8b8a..f63a3e53730 100644 --- a/sys/dev/usb/if_athn_usb.c +++ b/sys/dev/usb/if_athn_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_usb.c,v 1.37 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_athn_usb.c,v 1.38 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -2065,7 +2065,7 @@ athn_usb_start(struct ifnet *ifp) break; } /* Send pending management frames first. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index a6bfdee6901..f795acd4aaf 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.113 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_atu.c,v 1.114 2015/11/04 12:12:00 dlg Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. @@ -1944,7 +1944,7 @@ atu_start(struct ifnet *ifp) * Poll the management queue for frames, it has priority over * normal data frames. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m == NULL) { DPRINTFN(10, ("%s: atu_start: data packet\n", sc->atu_dev.dv_xname)); diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c index 1e7c2a35f36..f2cce0ecd88 100644 --- a/sys/dev/usb/if_otus.c +++ b/sys/dev/usb/if_otus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_otus.c,v 1.47 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_otus.c,v 1.48 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -1416,7 +1416,7 @@ otus_start(struct ifnet *ifp) break; } /* Send pending management frames first. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index 7a12cca9c36..2f906b1b2c6 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.133 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_ral.c,v 1.134 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1238,13 +1238,13 @@ ural_start(struct ifnet *ifp) return; for (;;) { - IF_POLL(&ic->ic_mgtq, m0); + 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; } - IF_DEQUEUE(&ic->ic_mgtq, m0); ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index ef0466cd88c..567d20e0349 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.112 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_rum.c,v 1.113 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr> @@ -1242,13 +1242,13 @@ rum_start(struct ifnet *ifp) return; for (;;) { - IF_POLL(&ic->ic_mgtq, m0); + 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; } - IF_DEQUEUE(&ic->ic_mgtq, m0); ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index 639bc68d521..ac7c22b2d13 100644 --- a/sys/dev/usb/if_run.c +++ b/sys/dev/usb/if_run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_run.c,v 1.111 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_run.c,v 1.112 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -2530,7 +2530,7 @@ run_start(struct ifnet *ifp) break; } /* send pending management frames first */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index 0a044f36bf2..84293ed3806 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.70 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_uath.c,v 1.71 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2006 @@ -1477,13 +1477,13 @@ uath_start(struct ifnet *ifp) return; for (;;) { - IF_POLL(&ic->ic_mgtq, m0); + 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; } - IF_DEQUEUE(&ic->ic_mgtq, m0); ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c index ebba641d27b..108bcddfa10 100644 --- a/sys/dev/usb/if_upgt.c +++ b/sys/dev/usb/if_upgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upgt.c,v 1.70 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_upgt.c,v 1.71 2015/11/04 12:12:00 dlg Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -1377,11 +1377,9 @@ upgt_start(struct ifnet *ifp) for (i = 0; i < UPGT_TX_COUNT; i++) { struct upgt_data *data_tx = &sc->tx_data[i]; - IF_POLL(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { /* management frame */ - IF_DEQUEUE(&ic->ic_mgtq, m); - ni = m->m_pkthdr.ph_cookie; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index 064acb822ac..22f4254bb20 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.55 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_urtw.c,v 1.56 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2009 Martynas Venckus <martynas@openbsd.org> @@ -2429,15 +2429,15 @@ urtw_start(struct ifnet *ifp) return; for (;;) { - IF_POLL(&ic->ic_mgtq, m0); + 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; } - IF_DEQUEUE(&ic->ic_mgtq, m0); ni = m0->m_pkthdr.ph_cookie; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c index 6e28ee96b5e..3ae8885bcd6 100644 --- a/sys/dev/usb/if_urtwn.c +++ b/sys/dev/usb/if_urtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtwn.c,v 1.53 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_urtwn.c,v 1.54 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -2142,7 +2142,7 @@ urtwn_start(struct ifnet *ifp) break; } /* Send pending management frames first. */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 9f3eb309ae3..08547d7e358 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.109 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.110 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -2242,7 +2242,7 @@ zyd_start(struct ifnet *ifp) break; } /* send pending management frames first */ - IF_DEQUEUE(&ic->ic_mgtq, m); + m = mq_dequeue(&ic->ic_mgtq); if (m != NULL) { ni = m->m_pkthdr.ph_cookie; goto sendit; diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 84421e85e92..f0acbe2ddf5 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_input.c,v 1.137 2015/07/15 22:16:42 deraadt Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.138 2015/11/04 12:12:00 dlg Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe @@ -316,6 +316,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, ether_sprintf(wh->i_addr2), ic->ic_pssta)); } } else if (ni->ni_pwrsave == IEEE80211_PS_DOZE) { + struct mbuf *m; + /* turn off PS mode */ ni->ni_pwrsave = IEEE80211_PS_AWAKE; ic->ic_pssta--; @@ -325,10 +327,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, (*ic->ic_set_tim)(ic, ni->ni_associd, 0); /* dequeue buffered unicast frames */ - while (!IF_IS_EMPTY(&ni->ni_savedq)) { - struct mbuf *m; - IF_DEQUEUE(&ni->ni_savedq, m); - IF_ENQUEUE(&ic->ic_pwrsaveq, m); + while ((m = mq_dequeue(&ni->ni_savedq)) != NULL) { + mq_enqueue(&ic->ic_pwrsaveq, m); (*ifp->if_start)(ifp); } } @@ -2799,10 +2799,10 @@ ieee80211_recv_pspoll(struct ieee80211com *ic, struct mbuf *m, } /* take the first queued frame and put it out.. */ - IF_DEQUEUE(&ni->ni_savedq, m); + m = mq_dequeue(&ni->ni_savedq); if (m == NULL) return; - if (IF_IS_EMPTY(&ni->ni_savedq)) { + if (mq_empty(&ni->ni_savedq)) { /* last queued frame, turn off the TIM bit */ (*ic->ic_set_tim)(ic, ni->ni_associd, 0); } else { @@ -2810,7 +2810,7 @@ ieee80211_recv_pspoll(struct ieee80211com *ic, struct mbuf *m, wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; } - IF_ENQUEUE(&ic->ic_pwrsaveq, m); + mq_enqueue(&ic->ic_pwrsaveq, m); (*ifp->if_start)(ifp); } #endif /* IEEE80211_STA_ONLY */ diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 5c929223135..39b94c38a17 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.c,v 1.88 2015/07/15 22:16:42 deraadt Exp $ */ +/* $OpenBSD: ieee80211_node.c,v 1.89 2015/11/04 12:12:00 dlg Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */ /*- @@ -191,7 +191,7 @@ ieee80211_node_lateattach(struct ifnet *ifp) ic->ic_bss = ieee80211_ref_node(ni); ic->ic_txpower = IEEE80211_TXPOWER_MAX; #ifndef IEEE80211_STA_ONLY - IFQ_SET_MAXLEN(&ni->ni_savedq, IEEE80211_PS_MAX_QUEUE); + mq_init(&ni->ni_savedq, IEEE80211_PS_MAX_QUEUE, IPL_NET); #endif } @@ -797,7 +797,7 @@ ieee80211_setup_node(struct ieee80211com *ic, ni->ni_ic = ic; /* back-pointer */ #ifndef IEEE80211_STA_ONLY - IFQ_SET_MAXLEN(&ni->ni_savedq, IEEE80211_PS_MAX_QUEUE); + mq_init(&ni->ni_savedq, IEEE80211_PS_MAX_QUEUE, IPL_NET); timeout_set(&ni->ni_eapol_to, ieee80211_eapol_timeout, ni); timeout_set(&ni->ni_sa_query_to, ieee80211_sa_query_timeout, ni); #endif @@ -1083,8 +1083,7 @@ ieee80211_free_node(struct ieee80211com *ic, struct ieee80211_node *ni) RB_REMOVE(ieee80211_tree, &ic->ic_tree, ni); ic->ic_nnodes--; #ifndef IEEE80211_STA_ONLY - if (!IF_IS_EMPTY(&ni->ni_savedq)) { - IF_PURGE(&ni->ni_savedq); + if (mq_purge(&ni->ni_savedq) > 0) { if (ic->ic_set_tim != NULL) (*ic->ic_set_tim)(ic, ni->ni_associd, 0); } @@ -1611,8 +1610,7 @@ ieee80211_node_leave(struct ieee80211com *ic, struct ieee80211_node *ni) ni->ni_pwrsave = IEEE80211_PS_AWAKE; } - if (!IF_IS_EMPTY(&ni->ni_savedq)) { - IF_PURGE(&ni->ni_savedq); + if (mq_purge(&ni->ni_savedq) > 0) { if (ic->ic_set_tim != NULL) (*ic->ic_set_tim)(ic, ni->ni_associd, 0); } @@ -1772,16 +1770,13 @@ ieee80211_notify_dtim(struct ieee80211com *ic) KASSERT(ic->ic_opmode == IEEE80211_M_HOSTAP); - for (;;) { - IF_DEQUEUE(&ni->ni_savedq, m); - if (m == NULL) - break; - if (!IF_IS_EMPTY(&ni->ni_savedq)) { + while ((m = mq_dequeue(&ni->ni_savedq)) != NULL) { + if (!mq_empty(&ni->ni_savedq)) { /* more queued frames, set the more data bit */ wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; } - IF_ENQUEUE(&ic->ic_pwrsaveq, m); + mq_enqueue(&ic->ic_pwrsaveq, m); (*ifp->if_start)(ifp); } /* XXX assumes everything has been sent */ diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 2d6016ff6a3..1b7b7907ff1 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.h,v 1.46 2014/09/12 16:02:40 sthen Exp $ */ +/* $OpenBSD: ieee80211_node.h,v 1.47 2015/11/04 12:12:00 dlg Exp $ */ /* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */ /*- @@ -188,7 +188,7 @@ struct ieee80211_node { /* power saving mode */ u_int8_t ni_pwrsave; - struct ifqueue ni_savedq; /* packets queued for pspoll */ + struct mbuf_queue ni_savedq; /* packets queued for pspoll */ /* RSN */ struct timeout ni_eapol_to; diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index f06b162de71..6f6f91238db 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_output.c,v 1.97 2015/07/15 22:16:42 deraadt Exp $ */ +/* $OpenBSD: ieee80211_output.c,v 1.98 2015/11/04 12:12:00 dlg Exp $ */ /* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */ /*- @@ -239,7 +239,7 @@ ieee80211_mgmt_output(struct ifnet *ifp, struct ieee80211_node *ni, ieee80211_pwrsave(ic, m, ni) != 0) return 0; #endif - IF_ENQUEUE(&ic->ic_mgtq, m); + mq_enqueue(&ic->ic_mgtq, m); ifp->if_timer = 1; (*ifp->if_start)(ifp); return 0; @@ -1867,22 +1867,16 @@ ieee80211_pwrsave(struct ieee80211com *ic, struct mbuf *m, (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) return 0; - if (IF_IS_EMPTY(&ni->ni_savedq)) + if (mq_empty(&ni->ni_savedq)) (*ic->ic_set_tim)(ic, ni->ni_associd, 1); } /* NB: ni == ic->ic_bss for broadcast/multicast */ - if (IF_QFULL(&ni->ni_savedq)) { - /* XXX should we drop the oldest instead? */ - IF_DROP(&ni->ni_savedq); - m_freem(m); - } else { - IF_ENQUEUE(&ni->ni_savedq, m); - /* - * Similar to ieee80211_mgmt_output, store the node in a - * special pkthdr field. - */ - m->m_pkthdr.ph_cookie = ni; - } + /* + * Similar to ieee80211_mgmt_output, store the node in a + * special pkthdr field. + */ + m->m_pkthdr.ph_cookie = ni; + mq_enqueue(&ni->ni_savedq, m); return 1; } #endif /* IEEE80211_STA_ONLY */ diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index 5cc59aee286..90d65a1933e 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_proto.c,v 1.52 2015/07/15 22:16:42 deraadt Exp $ */ +/* $OpenBSD: ieee80211_proto.c,v 1.53 2015/11/04 12:12:00 dlg Exp $ */ /* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */ /*- @@ -84,6 +84,9 @@ ieee80211_proto_attach(struct ifnet *ifp) { struct ieee80211com *ic = (void *)ifp; + mq_init(&ic->ic_mgtq, IFQ_MAXLEN, IPL_NET); + mq_init(&ic->ic_pwrsaveq, IFQ_MAXLEN, IPL_NET); + ifp->if_hdrlen = sizeof(struct ieee80211_frame); #ifdef notdef @@ -108,8 +111,8 @@ ieee80211_proto_detach(struct ifnet *ifp) { struct ieee80211com *ic = (void *)ifp; - IF_PURGE(&ic->ic_mgtq); - IF_PURGE(&ic->ic_pwrsaveq); + mq_purge(&ic->ic_mgtq); + mq_purge(&ic->ic_pwrsaveq); } void @@ -835,8 +838,8 @@ justcleanup: timeout_del(&ic->ic_rsn_timeout); #endif ic->ic_mgt_timer = 0; - IF_PURGE(&ic->ic_mgtq); - IF_PURGE(&ic->ic_pwrsaveq); + mq_purge(&ic->ic_mgtq); + mq_purge(&ic->ic_pwrsaveq); ieee80211_free_allnodes(ic); break; } diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index d4b532d780d..ca95b105da8 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.64 2015/09/27 16:51:31 stsp Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.65 2015/11/04 12:12:00 dlg Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -227,8 +227,8 @@ struct ieee80211com { u_char ic_chan_avail[howmany(IEEE80211_CHAN_MAX,NBBY)]; u_char ic_chan_active[howmany(IEEE80211_CHAN_MAX, NBBY)]; u_char ic_chan_scan[howmany(IEEE80211_CHAN_MAX,NBBY)]; - struct ifqueue ic_mgtq; - struct ifqueue ic_pwrsaveq; + struct mbuf_queue ic_mgtq; + struct mbuf_queue ic_pwrsaveq; u_int ic_scan_lock; /* user-initiated scan */ u_int8_t ic_scan_count; /* count scans */ u_int32_t ic_flags; /* state flags */ |