if_ath.c (250619) | if_ath.c (250665) |
---|---|
1/*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 250619 2013-05-13 21:18:00Z adrian $"); | 31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 250665 2013-05-15 18:33:05Z adrian $"); |
32 33/* 34 * Driver for the Atheros Wireless LAN controller. 35 * 36 * This software is derived from work of Atsushi Onoe; his contribution 37 * is greatly appreciated. 38 */ 39 --- 80 unchanged lines hidden (view full) --- 120 121#ifdef ATH_DEBUG_ALQ 122#include <dev/ath/if_ath_alq.h> 123#endif 124 125/* 126 * Only enable this if you're working on PS-POLL support. 127 */ | 32 33/* 34 * Driver for the Atheros Wireless LAN controller. 35 * 36 * This software is derived from work of Atsushi Onoe; his contribution 37 * is greatly appreciated. 38 */ 39 --- 80 unchanged lines hidden (view full) --- 120 121#ifdef ATH_DEBUG_ALQ 122#include <dev/ath/if_ath_alq.h> 123#endif 124 125/* 126 * Only enable this if you're working on PS-POLL support. 127 */ |
128#undef ATH_SW_PSQ | 128#define ATH_SW_PSQ |
129 130/* 131 * ATH_BCBUF determines the number of vap's that can transmit 132 * beacons and also (currently) the number of vap's that can 133 * have unique mac addresses/bssid. When staggering beacons 134 * 4 is probably a good max as otherwise the beacons become 135 * very closely spaced and there is limited time for cab q traffic 136 * to go out. You can burst beacons instead but that is not good --- 70 unchanged lines hidden (view full) --- 207static int ath_rate_setup(struct ath_softc *, u_int mode); 208static void ath_setcurmode(struct ath_softc *, enum ieee80211_phymode); 209 210static void ath_announce(struct ath_softc *); 211 212static void ath_dfs_tasklet(void *, int); 213static void ath_node_powersave(struct ieee80211_node *, int); 214static int ath_node_set_tim(struct ieee80211_node *, int); | 129 130/* 131 * ATH_BCBUF determines the number of vap's that can transmit 132 * beacons and also (currently) the number of vap's that can 133 * have unique mac addresses/bssid. When staggering beacons 134 * 4 is probably a good max as otherwise the beacons become 135 * very closely spaced and there is limited time for cab q traffic 136 * to go out. You can burst beacons instead but that is not good --- 70 unchanged lines hidden (view full) --- 207static int ath_rate_setup(struct ath_softc *, u_int mode); 208static void ath_setcurmode(struct ath_softc *, enum ieee80211_phymode); 209 210static void ath_announce(struct ath_softc *); 211 212static void ath_dfs_tasklet(void *, int); 213static void ath_node_powersave(struct ieee80211_node *, int); 214static int ath_node_set_tim(struct ieee80211_node *, int); |
215static void ath_node_recv_pspoll(struct ieee80211_node *, struct mbuf *); |
|
215 216#ifdef IEEE80211_SUPPORT_TDMA 217#include <dev/ath/if_ath_tdma.h> 218#endif 219 220SYSCTL_DECL(_hw_ath); 221 222/* XXX validate sysctl values */ --- 467 unchanged lines hidden (view full) --- 690 /* 691 * Leave this as default to maintain legacy behaviour. 692 * Shortening the cabq/mcastq may end up causing some 693 * undesirable behaviour. 694 */ 695 sc->sc_txq_mcastq_maxdepth = ath_txbuf; 696 697 /* | 216 217#ifdef IEEE80211_SUPPORT_TDMA 218#include <dev/ath/if_ath_tdma.h> 219#endif 220 221SYSCTL_DECL(_hw_ath); 222 223/* XXX validate sysctl values */ --- 467 unchanged lines hidden (view full) --- 691 /* 692 * Leave this as default to maintain legacy behaviour. 693 * Shortening the cabq/mcastq may end up causing some 694 * undesirable behaviour. 695 */ 696 sc->sc_txq_mcastq_maxdepth = ath_txbuf; 697 698 /* |
699 * How deep can the node software TX queue get whilst it's asleep. 700 */ 701 sc->sc_txq_node_psq_maxdepth = 16; 702 703 /* |
|
698 * Default the maximum queue depth for a given node 699 * to 1/4'th the TX buffers, or 64, whichever 700 * is larger. 701 */ 702 sc->sc_txq_node_maxdepth = MAX(64, ath_txbuf / 4); 703 704 /* Enable CABQ by default */ 705 sc->sc_cabq_enable = 1; --- 537 unchanged lines hidden (view full) --- 1243 vap->iv_bmiss = ath_bmiss_vap; 1244 1245 avp->av_node_ps = vap->iv_node_ps; 1246 vap->iv_node_ps = ath_node_powersave; 1247 1248 avp->av_set_tim = vap->iv_set_tim; 1249 vap->iv_set_tim = ath_node_set_tim; 1250 | 704 * Default the maximum queue depth for a given node 705 * to 1/4'th the TX buffers, or 64, whichever 706 * is larger. 707 */ 708 sc->sc_txq_node_maxdepth = MAX(64, ath_txbuf / 4); 709 710 /* Enable CABQ by default */ 711 sc->sc_cabq_enable = 1; --- 537 unchanged lines hidden (view full) --- 1249 vap->iv_bmiss = ath_bmiss_vap; 1250 1251 avp->av_node_ps = vap->iv_node_ps; 1252 vap->iv_node_ps = ath_node_powersave; 1253 1254 avp->av_set_tim = vap->iv_set_tim; 1255 vap->iv_set_tim = ath_node_set_tim; 1256 |
1257 avp->av_recv_pspoll = vap->iv_recv_pspoll; 1258 vap->iv_recv_pspoll = ath_node_recv_pspoll; 1259 |
|
1251 /* Set default parameters */ 1252 1253 /* 1254 * Anything earlier than some AR9300 series MACs don't 1255 * support a smaller MPDU density. 1256 */ 1257 vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_8; 1258 /* --- 4905 unchanged lines hidden (view full) --- 6164 if (&an->an_swq_depth != 0) 6165 return; 6166 6167 if (an->an_is_powersave && 6168 an->an_stack_psq == 0 && 6169 an->an_tim_set == 1 && 6170 an->an_swq_depth == 0) { 6171 DPRINTF(sc, ATH_DEBUG_NODE_PWRSAVE, | 1260 /* Set default parameters */ 1261 1262 /* 1263 * Anything earlier than some AR9300 series MACs don't 1264 * support a smaller MPDU density. 1265 */ 1266 vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_8; 1267 /* --- 4905 unchanged lines hidden (view full) --- 6173 if (&an->an_swq_depth != 0) 6174 return; 6175 6176 if (an->an_is_powersave && 6177 an->an_stack_psq == 0 && 6178 an->an_tim_set == 1 && 6179 an->an_swq_depth == 0) { 6180 DPRINTF(sc, ATH_DEBUG_NODE_PWRSAVE, |
6172 "%s: an=%p, swq_depth=0, tim_set=1, psq_set=0," | 6181 "%s: %6D: swq_depth=0, tim_set=1, psq_set=0," |
6173 " clear!\n", | 6182 " clear!\n", |
6174 __func__, an); | 6183 __func__, 6184 ni->ni_macaddr, 6185 ":"); |
6175 an->an_tim_set = 0; 6176 (void) avp->av_set_tim(ni, 0); 6177 } 6178 } 6179#else 6180 return; 6181#endif /* ATH_SW_PSQ */ 6182} 6183 | 6186 an->an_tim_set = 0; 6187 (void) avp->av_set_tim(ni, 0); 6188 } 6189 } 6190#else 6191 return; 6192#endif /* ATH_SW_PSQ */ 6193} 6194 |
6195/* 6196 * Received a ps-poll frame from net80211. 6197 * 6198 * Here we get a chance to serve out a software-queued frame ourselves 6199 * before we punt it to net80211 to transmit us one itself - either 6200 * because there's traffic in the net80211 psq, or a NULL frame to 6201 * indicate there's nothing else. 6202 */ 6203static void 6204ath_node_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m) 6205{ 6206#ifdef ATH_SW_PSQ 6207 struct ath_node *an; 6208 struct ath_vap *avp; 6209 struct ieee80211com *ic = ni->ni_ic; 6210 struct ath_softc *sc = ic->ic_ifp->if_softc; 6211 int tid; 6212 6213 /* Just paranoia */ 6214 if (ni == NULL) 6215 return; 6216 6217 /* 6218 * Unassociated (temporary node) station. 6219 */ 6220 if (ni->ni_associd == 0) 6221 return; 6222 6223 /* 6224 * We do have an active node, so let's begin looking into it. 6225 */ 6226 an = ATH_NODE(ni); 6227 avp = ATH_VAP(ni->ni_vap); 6228 6229 /* 6230 * For now, we just call the original ps-poll method. 6231 * Once we're ready to flip this on: 6232 * 6233 * + Set leak to 1, as no matter what we're going to have 6234 * to send a frame; 6235 * + Check the software queue and if there's something in it, 6236 * schedule the highest TID thas has traffic from this node. 6237 * Then make sure we schedule the software scheduler to 6238 * run so it picks up said frame. 6239 * 6240 * That way whatever happens, we'll at least send _a_ frame 6241 * to the given node. 6242 * 6243 * Again, yes, it's crappy QoS if the node has multiple 6244 * TIDs worth of traffic - but let's get it working first 6245 * before we optimise it. 6246 * 6247 * Also yes, there's definitely latency here - we're not 6248 * direct dispatching to the hardware in this path (and 6249 * we're likely being called from the packet receive path, 6250 * so going back into TX may be a little hairy!) but again 6251 * I'd like to get this working first before optimising 6252 * turn-around time. 6253 */ 6254 6255 ATH_TX_LOCK(sc); 6256 6257 /* 6258 * Legacy - we're called and the node isn't asleep. 6259 * Immediately punt. 6260 */ 6261 if (! an->an_is_powersave) { 6262 device_printf(sc->sc_dev, 6263 "%s: %6D: not in powersave?\n", 6264 __func__, 6265 ni->ni_macaddr, 6266 ":"); 6267 ATH_TX_UNLOCK(sc); 6268 avp->av_recv_pspoll(ni, m); 6269 return; 6270 } 6271 6272 /* 6273 * We're in powersave. 6274 * 6275 * Leak a frame. 6276 */ 6277 an->an_leak_count = 1; 6278 6279 /* 6280 * Now, if there's no frames in the node, just punt to 6281 * recv_pspoll. 6282 * 6283 * Don't bother checking if the TIM bit is set, we really 6284 * only care if there are any frames here! 6285 */ 6286 if (an->an_swq_depth == 0) { 6287 ATH_TX_UNLOCK(sc); 6288 DPRINTF(sc, ATH_DEBUG_NODE_PWRSAVE, 6289 "%s: %6D: SWQ empty; punting to net80211\n", 6290 __func__, 6291 ni->ni_macaddr, 6292 ":"); 6293 avp->av_recv_pspoll(ni, m); 6294 return; 6295 } 6296 6297 /* 6298 * Ok, let's schedule the highest TID that has traffic 6299 * and then schedule something. 6300 */ 6301 for (tid = IEEE80211_TID_SIZE - 1; tid >= 0; tid--) { 6302 struct ath_tid *atid = &an->an_tid[tid]; 6303 /* 6304 * No frames? Skip. 6305 */ 6306 if (atid->axq_depth == 0) 6307 continue; 6308 ath_tx_tid_sched(sc, atid); 6309 /* 6310 * XXX we could do a direct call to the TXQ 6311 * scheduler code here to optimise latency 6312 * at the expense of a REALLY deep callstack. 6313 */ 6314 ATH_TX_UNLOCK(sc); 6315 taskqueue_enqueue(sc->sc_tq, &sc->sc_txqtask); 6316 DPRINTF(sc, ATH_DEBUG_NODE_PWRSAVE, 6317 "%s: %6D: leaking frame to TID %d\n", 6318 __func__, 6319 ni->ni_macaddr, 6320 ":", 6321 tid); 6322 return; 6323 } 6324 6325 ATH_TX_UNLOCK(sc); 6326 6327 /* 6328 * XXX nothing in the TIDs at this point? Eek. 6329 */ 6330 device_printf(sc->sc_dev, "%s: %6D: TIDs empty, but ath_node showed traffic?!\n", 6331 __func__, 6332 ni->ni_macaddr, 6333 ":"); 6334 avp->av_recv_pspoll(ni, m); 6335#else 6336 avp->av_recv_pspoll(ni, m); 6337#endif /* ATH_SW_PSQ */ 6338} 6339 |
|
6184MODULE_VERSION(if_ath, 1); 6185MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */ 6186#if defined(IEEE80211_ALQ) || defined(AH_DEBUG_ALQ) 6187MODULE_DEPEND(if_ath, alq, 1, 1, 1); 6188#endif | 6340MODULE_VERSION(if_ath, 1); 6341MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */ 6342#if defined(IEEE80211_ALQ) || defined(AH_DEBUG_ALQ) 6343MODULE_DEPEND(if_ath, alq, 1, 1, 1); 6344#endif |