aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h43
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c36
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c36
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c18
4 files changed, 68 insertions, 65 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 68a423054e6..f4645a45ef3 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -416,26 +416,28 @@ void ath_deinit_leds(struct ath_softc *sc);
416#define ATH_TXPOWER_MAX 100 /* .5 dBm units */ 416#define ATH_TXPOWER_MAX 100 /* .5 dBm units */
417#define ATH_RATE_DUMMY_MARKER 0 417#define ATH_RATE_DUMMY_MARKER 0
418 418
419#define SC_OP_INVALID BIT(0) 419#define SC_OP_INVALID BIT(0)
420#define SC_OP_BEACONS BIT(1) 420#define SC_OP_BEACONS BIT(1)
421#define SC_OP_RXAGGR BIT(2) 421#define SC_OP_RXAGGR BIT(2)
422#define SC_OP_TXAGGR BIT(3) 422#define SC_OP_TXAGGR BIT(3)
423#define SC_OP_FULL_RESET BIT(4) 423#define SC_OP_FULL_RESET BIT(4)
424#define SC_OP_PREAMBLE_SHORT BIT(5) 424#define SC_OP_PREAMBLE_SHORT BIT(5)
425#define SC_OP_PROTECT_ENABLE BIT(6) 425#define SC_OP_PROTECT_ENABLE BIT(6)
426#define SC_OP_RXFLUSH BIT(7) 426#define SC_OP_RXFLUSH BIT(7)
427#define SC_OP_LED_ASSOCIATED BIT(8) 427#define SC_OP_LED_ASSOCIATED BIT(8)
428#define SC_OP_WAIT_FOR_BEACON BIT(12) 428#define SC_OP_LED_ON BIT(9)
429#define SC_OP_LED_ON BIT(13) 429#define SC_OP_SCANNING BIT(10)
430#define SC_OP_SCANNING BIT(14) 430#define SC_OP_TSF_RESET BIT(11)
431#define SC_OP_TSF_RESET BIT(15) 431#define SC_OP_BT_PRIORITY_DETECTED BIT(12)
432#define SC_OP_WAIT_FOR_CAB BIT(16) 432
433#define SC_OP_WAIT_FOR_PSPOLL_DATA BIT(17) 433/* Powersave flags */
434#define SC_OP_WAIT_FOR_TX_ACK BIT(18) 434#define PS_WAIT_FOR_BEACON BIT(0)
435#define SC_OP_BEACON_SYNC BIT(19) 435#define PS_WAIT_FOR_CAB BIT(1)
436#define SC_OP_BT_PRIORITY_DETECTED BIT(21) 436#define PS_WAIT_FOR_PSPOLL_DATA BIT(2)
437#define SC_OP_NULLFUNC_COMPLETED BIT(22) 437#define PS_WAIT_FOR_TX_ACK BIT(3)
438#define SC_OP_PS_ENABLED BIT(23) 438#define PS_BEACON_SYNC BIT(4)
439#define PS_NULLFUNC_COMPLETED BIT(5)
440#define PS_ENABLED BIT(6)
439 441
440struct ath_wiphy; 442struct ath_wiphy;
441struct ath_rate_table; 443struct ath_rate_table;
@@ -471,6 +473,7 @@ struct ath_softc {
471 473
472 u32 intrstatus; 474 u32 intrstatus;
473 u32 sc_flags; /* SC_OP_* */ 475 u32 sc_flags; /* SC_OP_* */
476 u16 ps_flags; /* PS_* */
474 u16 curtxpow; 477 u16 curtxpow;
475 u8 nbcnvifs; 478 u8 nbcnvifs;
476 u16 nvifs; 479 u16 nvifs;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 48bd5d50f4d..974de2056b4 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -144,10 +144,10 @@ void ath9k_ps_restore(struct ath_softc *sc)
144 goto unlock; 144 goto unlock;
145 145
146 if (sc->ps_enabled && 146 if (sc->ps_enabled &&
147 !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | 147 !(sc->ps_flags & (PS_WAIT_FOR_BEACON |
148 SC_OP_WAIT_FOR_CAB | 148 PS_WAIT_FOR_CAB |
149 SC_OP_WAIT_FOR_PSPOLL_DATA | 149 PS_WAIT_FOR_PSPOLL_DATA |
150 SC_OP_WAIT_FOR_TX_ACK))) 150 PS_WAIT_FOR_TX_ACK)))
151 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP); 151 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
152 152
153 unlock: 153 unlock:
@@ -424,7 +424,7 @@ void ath9k_tasklet(unsigned long data)
424 */ 424 */
425 ath_print(common, ATH_DBG_PS, 425 ath_print(common, ATH_DBG_PS,
426 "TSFOOR - Sync with next Beacon\n"); 426 "TSFOOR - Sync with next Beacon\n");
427 sc->sc_flags |= SC_OP_WAIT_FOR_BEACON | SC_OP_BEACON_SYNC; 427 sc->ps_flags |= PS_WAIT_FOR_BEACON | PS_BEACON_SYNC;
428 } 428 }
429 429
430 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) 430 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
@@ -525,7 +525,7 @@ irqreturn_t ath_isr(int irq, void *dev)
525 * receive frames */ 525 * receive frames */
526 ath9k_setpower(sc, ATH9K_PM_AWAKE); 526 ath9k_setpower(sc, ATH9K_PM_AWAKE);
527 ath9k_hw_setrxabort(sc->sc_ah, 0); 527 ath9k_hw_setrxabort(sc->sc_ah, 0);
528 sc->sc_flags |= SC_OP_WAIT_FOR_BEACON; 528 sc->ps_flags |= PS_WAIT_FOR_BEACON;
529 } 529 }
530 530
531chip_reset: 531chip_reset:
@@ -833,7 +833,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
833 * on the receipt of the first Beacon frame (i.e., 833 * on the receipt of the first Beacon frame (i.e.,
834 * after time sync with the AP). 834 * after time sync with the AP).
835 */ 835 */
836 sc->sc_flags |= SC_OP_BEACON_SYNC; 836 sc->ps_flags |= PS_BEACON_SYNC;
837 837
838 /* Configure the beacon */ 838 /* Configure the beacon */
839 ath_beacon_config(sc, vif); 839 ath_beacon_config(sc, vif);
@@ -1238,11 +1238,11 @@ static int ath9k_tx(struct ieee80211_hw *hw,
1238 if (ieee80211_is_pspoll(hdr->frame_control)) { 1238 if (ieee80211_is_pspoll(hdr->frame_control)) {
1239 ath_print(common, ATH_DBG_PS, 1239 ath_print(common, ATH_DBG_PS,
1240 "Sending PS-Poll to pick a buffered frame\n"); 1240 "Sending PS-Poll to pick a buffered frame\n");
1241 sc->sc_flags |= SC_OP_WAIT_FOR_PSPOLL_DATA; 1241 sc->ps_flags |= PS_WAIT_FOR_PSPOLL_DATA;
1242 } else { 1242 } else {
1243 ath_print(common, ATH_DBG_PS, 1243 ath_print(common, ATH_DBG_PS,
1244 "Wake up to complete TX\n"); 1244 "Wake up to complete TX\n");
1245 sc->sc_flags |= SC_OP_WAIT_FOR_TX_ACK; 1245 sc->ps_flags |= PS_WAIT_FOR_TX_ACK;
1246 } 1246 }
1247 /* 1247 /*
1248 * The actual restore operation will happen only after 1248 * The actual restore operation will happen only after
@@ -1538,7 +1538,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1538 */ 1538 */
1539 if (changed & IEEE80211_CONF_CHANGE_PS) { 1539 if (changed & IEEE80211_CONF_CHANGE_PS) {
1540 if (conf->flags & IEEE80211_CONF_PS) { 1540 if (conf->flags & IEEE80211_CONF_PS) {
1541 sc->sc_flags |= SC_OP_PS_ENABLED; 1541 sc->ps_flags |= PS_ENABLED;
1542 if (!(ah->caps.hw_caps & 1542 if (!(ah->caps.hw_caps &
1543 ATH9K_HW_CAP_AUTOSLEEP)) { 1543 ATH9K_HW_CAP_AUTOSLEEP)) {
1544 if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) { 1544 if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) {
@@ -1551,23 +1551,23 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1551 * At this point we know hardware has received an ACK 1551 * At this point we know hardware has received an ACK
1552 * of a previously sent null data frame. 1552 * of a previously sent null data frame.
1553 */ 1553 */
1554 if ((sc->sc_flags & SC_OP_NULLFUNC_COMPLETED)) { 1554 if ((sc->ps_flags & PS_NULLFUNC_COMPLETED)) {
1555 sc->sc_flags &= ~SC_OP_NULLFUNC_COMPLETED; 1555 sc->ps_flags &= ~PS_NULLFUNC_COMPLETED;
1556 sc->ps_enabled = true; 1556 sc->ps_enabled = true;
1557 ath9k_hw_setrxabort(sc->sc_ah, 1); 1557 ath9k_hw_setrxabort(sc->sc_ah, 1);
1558 } 1558 }
1559 } else { 1559 } else {
1560 sc->ps_enabled = false; 1560 sc->ps_enabled = false;
1561 sc->sc_flags &= ~(SC_OP_PS_ENABLED | 1561 sc->ps_flags &= ~(PS_ENABLED |
1562 SC_OP_NULLFUNC_COMPLETED); 1562 PS_NULLFUNC_COMPLETED);
1563 ath9k_setpower(sc, ATH9K_PM_AWAKE); 1563 ath9k_setpower(sc, ATH9K_PM_AWAKE);
1564 if (!(ah->caps.hw_caps & 1564 if (!(ah->caps.hw_caps &
1565 ATH9K_HW_CAP_AUTOSLEEP)) { 1565 ATH9K_HW_CAP_AUTOSLEEP)) {
1566 ath9k_hw_setrxabort(sc->sc_ah, 0); 1566 ath9k_hw_setrxabort(sc->sc_ah, 0);
1567 sc->sc_flags &= ~(SC_OP_WAIT_FOR_BEACON | 1567 sc->ps_flags &= ~(PS_WAIT_FOR_BEACON |
1568 SC_OP_WAIT_FOR_CAB | 1568 PS_WAIT_FOR_CAB |
1569 SC_OP_WAIT_FOR_PSPOLL_DATA | 1569 PS_WAIT_FOR_PSPOLL_DATA |
1570 SC_OP_WAIT_FOR_TX_ACK); 1570 PS_WAIT_FOR_TX_ACK);
1571 if (sc->imask & ATH9K_INT_TIM_TIMER) { 1571 if (sc->imask & ATH9K_INT_TIM_TIMER) {
1572 sc->imask &= ~ATH9K_INT_TIM_TIMER; 1572 sc->imask &= ~ATH9K_INT_TIM_TIMER;
1573 ath9k_hw_set_interrupts(sc->sc_ah, 1573 ath9k_hw_set_interrupts(sc->sc_ah,
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 477365e5ae6..17b0a6dd8ca 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -364,10 +364,10 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
364 if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0) 364 if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0)
365 return; /* not from our current AP */ 365 return; /* not from our current AP */
366 366
367 sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON; 367 sc->ps_flags &= ~PS_WAIT_FOR_BEACON;
368 368
369 if (sc->sc_flags & SC_OP_BEACON_SYNC) { 369 if (sc->ps_flags & PS_BEACON_SYNC) {
370 sc->sc_flags &= ~SC_OP_BEACON_SYNC; 370 sc->ps_flags &= ~PS_BEACON_SYNC;
371 ath_print(common, ATH_DBG_PS, 371 ath_print(common, ATH_DBG_PS,
372 "Reconfigure Beacon timers based on " 372 "Reconfigure Beacon timers based on "
373 "timestamp from the AP\n"); 373 "timestamp from the AP\n");
@@ -384,17 +384,17 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
384 */ 384 */
385 ath_print(common, ATH_DBG_PS, "Received DTIM beacon indicating " 385 ath_print(common, ATH_DBG_PS, "Received DTIM beacon indicating "
386 "buffered broadcast/multicast frame(s)\n"); 386 "buffered broadcast/multicast frame(s)\n");
387 sc->sc_flags |= SC_OP_WAIT_FOR_CAB | SC_OP_WAIT_FOR_BEACON; 387 sc->ps_flags |= PS_WAIT_FOR_CAB | PS_WAIT_FOR_BEACON;
388 return; 388 return;
389 } 389 }
390 390
391 if (sc->sc_flags & SC_OP_WAIT_FOR_CAB) { 391 if (sc->ps_flags & PS_WAIT_FOR_CAB) {
392 /* 392 /*
393 * This can happen if a broadcast frame is dropped or the AP 393 * This can happen if a broadcast frame is dropped or the AP
394 * fails to send a frame indicating that all CAB frames have 394 * fails to send a frame indicating that all CAB frames have
395 * been delivered. 395 * been delivered.
396 */ 396 */
397 sc->sc_flags &= ~SC_OP_WAIT_FOR_CAB; 397 sc->ps_flags &= ~PS_WAIT_FOR_CAB;
398 ath_print(common, ATH_DBG_PS, 398 ath_print(common, ATH_DBG_PS,
399 "PS wait for CAB frames timed out\n"); 399 "PS wait for CAB frames timed out\n");
400 } 400 }
@@ -408,10 +408,10 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb)
408 hdr = (struct ieee80211_hdr *)skb->data; 408 hdr = (struct ieee80211_hdr *)skb->data;
409 409
410 /* Process Beacon and CAB receive in PS state */ 410 /* Process Beacon and CAB receive in PS state */
411 if ((sc->sc_flags & SC_OP_WAIT_FOR_BEACON) && 411 if ((sc->ps_flags & PS_WAIT_FOR_BEACON) &&
412 ieee80211_is_beacon(hdr->frame_control)) 412 ieee80211_is_beacon(hdr->frame_control))
413 ath_rx_ps_beacon(sc, skb); 413 ath_rx_ps_beacon(sc, skb);
414 else if ((sc->sc_flags & SC_OP_WAIT_FOR_CAB) && 414 else if ((sc->ps_flags & PS_WAIT_FOR_CAB) &&
415 (ieee80211_is_data(hdr->frame_control) || 415 (ieee80211_is_data(hdr->frame_control) ||
416 ieee80211_is_action(hdr->frame_control)) && 416 ieee80211_is_action(hdr->frame_control)) &&
417 is_multicast_ether_addr(hdr->addr1) && 417 is_multicast_ether_addr(hdr->addr1) &&
@@ -420,20 +420,20 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb)
420 * No more broadcast/multicast frames to be received at this 420 * No more broadcast/multicast frames to be received at this
421 * point. 421 * point.
422 */ 422 */
423 sc->sc_flags &= ~SC_OP_WAIT_FOR_CAB; 423 sc->ps_flags &= ~PS_WAIT_FOR_CAB;
424 ath_print(common, ATH_DBG_PS, 424 ath_print(common, ATH_DBG_PS,
425 "All PS CAB frames received, back to sleep\n"); 425 "All PS CAB frames received, back to sleep\n");
426 } else if ((sc->sc_flags & SC_OP_WAIT_FOR_PSPOLL_DATA) && 426 } else if ((sc->ps_flags & PS_WAIT_FOR_PSPOLL_DATA) &&
427 !is_multicast_ether_addr(hdr->addr1) && 427 !is_multicast_ether_addr(hdr->addr1) &&
428 !ieee80211_has_morefrags(hdr->frame_control)) { 428 !ieee80211_has_morefrags(hdr->frame_control)) {
429 sc->sc_flags &= ~SC_OP_WAIT_FOR_PSPOLL_DATA; 429 sc->ps_flags &= ~PS_WAIT_FOR_PSPOLL_DATA;
430 ath_print(common, ATH_DBG_PS, 430 ath_print(common, ATH_DBG_PS,
431 "Going back to sleep after having received " 431 "Going back to sleep after having received "
432 "PS-Poll data (0x%x)\n", 432 "PS-Poll data (0x%x)\n",
433 sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | 433 sc->ps_flags & (PS_WAIT_FOR_BEACON |
434 SC_OP_WAIT_FOR_CAB | 434 PS_WAIT_FOR_CAB |
435 SC_OP_WAIT_FOR_PSPOLL_DATA | 435 PS_WAIT_FOR_PSPOLL_DATA |
436 SC_OP_WAIT_FOR_TX_ACK)); 436 PS_WAIT_FOR_TX_ACK));
437 } 437 }
438} 438}
439 439
@@ -631,9 +631,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
631 sc->rx.rxotherant = 0; 631 sc->rx.rxotherant = 0;
632 } 632 }
633 633
634 if (unlikely(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | 634 if (unlikely(sc->ps_flags & (PS_WAIT_FOR_BEACON |
635 SC_OP_WAIT_FOR_CAB | 635 PS_WAIT_FOR_CAB |
636 SC_OP_WAIT_FOR_PSPOLL_DATA))) 636 PS_WAIT_FOR_PSPOLL_DATA)))
637 ath_rx_ps(sc, skb); 637 ath_rx_ps(sc, skb);
638 638
639 ath_rx_send_to_mac80211(hw, sc, skb, rxs); 639 ath_rx_send_to_mac80211(hw, sc, skb, rxs);
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index fa12b9060b0..a821bb687b3 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1648,7 +1648,7 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
1648 /* tag if this is a nullfunc frame to enable PS when AP acks it */ 1648 /* tag if this is a nullfunc frame to enable PS when AP acks it */
1649 if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc)) { 1649 if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc)) {
1650 bf->bf_isnullfunc = true; 1650 bf->bf_isnullfunc = true;
1651 sc->sc_flags &= ~SC_OP_NULLFUNC_COMPLETED; 1651 sc->ps_flags &= ~PS_NULLFUNC_COMPLETED;
1652 } else 1652 } else
1653 bf->bf_isnullfunc = false; 1653 bf->bf_isnullfunc = false;
1654 1654
@@ -1858,15 +1858,15 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
1858 skb_pull(skb, padsize); 1858 skb_pull(skb, padsize);
1859 } 1859 }
1860 1860
1861 if (sc->sc_flags & SC_OP_WAIT_FOR_TX_ACK) { 1861 if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) {
1862 sc->sc_flags &= ~SC_OP_WAIT_FOR_TX_ACK; 1862 sc->ps_flags &= ~PS_WAIT_FOR_TX_ACK;
1863 ath_print(common, ATH_DBG_PS, 1863 ath_print(common, ATH_DBG_PS,
1864 "Going back to sleep after having " 1864 "Going back to sleep after having "
1865 "received TX status (0x%x)\n", 1865 "received TX status (0x%x)\n",
1866 sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | 1866 sc->ps_flags & (PS_WAIT_FOR_BEACON |
1867 SC_OP_WAIT_FOR_CAB | 1867 PS_WAIT_FOR_CAB |
1868 SC_OP_WAIT_FOR_PSPOLL_DATA | 1868 PS_WAIT_FOR_PSPOLL_DATA |
1869 SC_OP_WAIT_FOR_TX_ACK)); 1869 PS_WAIT_FOR_TX_ACK));
1870 } 1870 }
1871 1871
1872 if (unlikely(tx_info->pad[0] & ATH_TX_INFO_FRAME_TYPE_INTERNAL)) 1872 if (unlikely(tx_info->pad[0] & ATH_TX_INFO_FRAME_TYPE_INTERNAL))
@@ -2053,11 +2053,11 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2053 */ 2053 */
2054 if (bf->bf_isnullfunc && 2054 if (bf->bf_isnullfunc &&
2055 (ds->ds_txstat.ts_status & ATH9K_TX_ACKED)) { 2055 (ds->ds_txstat.ts_status & ATH9K_TX_ACKED)) {
2056 if ((sc->sc_flags & SC_OP_PS_ENABLED)) { 2056 if ((sc->ps_flags & PS_ENABLED)) {
2057 sc->ps_enabled = true; 2057 sc->ps_enabled = true;
2058 ath9k_hw_setrxabort(sc->sc_ah, 1); 2058 ath9k_hw_setrxabort(sc->sc_ah, 1);
2059 } else 2059 } else
2060 sc->sc_flags |= SC_OP_NULLFUNC_COMPLETED; 2060 sc->ps_flags |= PS_NULLFUNC_COMPLETED;
2061 } 2061 }
2062 2062
2063 /* 2063 /*