aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-08-11 04:35:08 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:23:59 -0400
commit672840ac04f79f499b60b9f0eb41799c837db4eb (patch)
treeabea21f851556acbf16d217f2849577399610654 /drivers/net
parentb4696c8b9233bea812b972a5e79c5db7ecf13867 (diff)
ath9k: Use bitfields for sc operations
Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath9k/beacon.c4
-rw-r--r--drivers/net/wireless/ath9k/core.c45
-rw-r--r--drivers/net/wireless/ath9k/core.h24
-rw-r--r--drivers/net/wireless/ath9k/main.c14
-rw-r--r--drivers/net/wireless/ath9k/rc.c2
-rw-r--r--drivers/net/wireless/ath9k/recv.c8
-rw-r--r--drivers/net/wireless/ath9k/xmit.c31
7 files changed, 66 insertions, 62 deletions
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index 2736a4b4e4a1..f1c420141714 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -111,7 +111,7 @@ static void ath_beacon_setup(struct ath_softc *sc,
111 rix = 0; 111 rix = 0;
112 rt = sc->sc_currates; 112 rt = sc->sc_currates;
113 rate = rt->info[rix].rateCode; 113 rate = rt->info[rix].rateCode;
114 if (sc->sc_flags & ATH_PREAMBLE_SHORT) 114 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
115 rate |= rt->info[rix].shortPreamble; 115 rate |= rt->info[rix].shortPreamble;
116 116
117 ath9k_hw_set11n_txdesc(ah, ds 117 ath9k_hw_set11n_txdesc(ah, ds
@@ -975,5 +975,5 @@ void ath_beacon_sync(struct ath_softc *sc, int if_id)
975 * beacon frame we just received. 975 * beacon frame we just received.
976 */ 976 */
977 ath_beacon_config(sc, if_id); 977 ath_beacon_config(sc, if_id);
978 sc->sc_beacons = 1; 978 sc->sc_flags |= SC_OP_BEACONS;
979} 979}
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c
index 8359356ac02e..9b8258d9efd3 100644
--- a/drivers/net/wireless/ath9k/core.c
+++ b/drivers/net/wireless/ath9k/core.c
@@ -272,8 +272,8 @@ static int ath_stop(struct ath_softc *sc)
272{ 272{
273 struct ath_hal *ah = sc->sc_ah; 273 struct ath_hal *ah = sc->sc_ah;
274 274
275 DPRINTF(sc, ATH_DBG_CONFIG, "%s: invalid %u\n", 275 DPRINTF(sc, ATH_DBG_CONFIG, "%s: invalid %ld\n",
276 __func__, sc->sc_invalid); 276 __func__, sc->sc_flags & SC_OP_INVALID);
277 277
278 /* 278 /*
279 * Shutdown the hardware and driver: 279 * Shutdown the hardware and driver:
@@ -291,10 +291,10 @@ static int ath_stop(struct ath_softc *sc)
291 * hardware is gone (invalid). 291 * hardware is gone (invalid).
292 */ 292 */
293 293
294 if (!sc->sc_invalid) 294 if (!(sc->sc_flags & SC_OP_INVALID))
295 ath9k_hw_set_interrupts(ah, 0); 295 ath9k_hw_set_interrupts(ah, 0);
296 ath_draintxq(sc, false); 296 ath_draintxq(sc, false);
297 if (!sc->sc_invalid) { 297 if (!(sc->sc_flags & SC_OP_INVALID)) {
298 ath_stoprecv(sc); 298 ath_stoprecv(sc);
299 ath9k_hw_phy_disable(ah); 299 ath9k_hw_phy_disable(ah);
300 } else 300 } else
@@ -316,7 +316,7 @@ int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
316 bool fastcc = true, stopped; 316 bool fastcc = true, stopped;
317 enum ath9k_ht_macmode ht_macmode; 317 enum ath9k_ht_macmode ht_macmode;
318 318
319 if (sc->sc_invalid) /* if the device is invalid or removed */ 319 if (sc->sc_flags & SC_OP_INVALID) /* the device is invalid or removed */
320 return -EIO; 320 return -EIO;
321 321
322 DPRINTF(sc, ATH_DBG_CONFIG, 322 DPRINTF(sc, ATH_DBG_CONFIG,
@@ -332,7 +332,8 @@ int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
332 332
333 if (hchan->channel != sc->sc_curchan.channel || 333 if (hchan->channel != sc->sc_curchan.channel ||
334 hchan->channelFlags != sc->sc_curchan.channelFlags || 334 hchan->channelFlags != sc->sc_curchan.channelFlags ||
335 sc->sc_update_chainmask || sc->sc_full_reset) { 335 (sc->sc_flags & SC_OP_CHAINMASK_UPDATE) ||
336 (sc->sc_flags & SC_OP_FULL_RESET)) {
336 int status; 337 int status;
337 /* 338 /*
338 * This is only performed if the channel settings have 339 * This is only performed if the channel settings have
@@ -351,7 +352,7 @@ int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
351 * to flush data frames already in queue because of 352 * to flush data frames already in queue because of
352 * changing channel. */ 353 * changing channel. */
353 354
354 if (!stopped || sc->sc_full_reset) 355 if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET))
355 fastcc = false; 356 fastcc = false;
356 357
357 spin_lock_bh(&sc->sc_resetlock); 358 spin_lock_bh(&sc->sc_resetlock);
@@ -372,8 +373,8 @@ int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
372 spin_unlock_bh(&sc->sc_resetlock); 373 spin_unlock_bh(&sc->sc_resetlock);
373 374
374 sc->sc_curchan = *hchan; 375 sc->sc_curchan = *hchan;
375 sc->sc_update_chainmask = 0; 376 sc->sc_flags &= ~SC_OP_CHAINMASK_UPDATE;
376 sc->sc_full_reset = 0; 377 sc->sc_flags &= ~SC_OP_FULL_RESET;
377 378
378 /* Re-enable rx framework */ 379 /* Re-enable rx framework */
379 if (ath_startrecv(sc) != 0) { 380 if (ath_startrecv(sc) != 0) {
@@ -484,7 +485,7 @@ int ath_chainmask_sel_logic(struct ath_softc *sc, struct ath_node *an)
484 485
485void ath_update_chainmask(struct ath_softc *sc, int is_ht) 486void ath_update_chainmask(struct ath_softc *sc, int is_ht)
486{ 487{
487 sc->sc_update_chainmask = 1; 488 sc->sc_flags |= SC_OP_CHAINMASK_UPDATE;
488 if (is_ht) { 489 if (is_ht) {
489 sc->sc_tx_chainmask = sc->sc_ah->ah_caps.tx_chainmask; 490 sc->sc_tx_chainmask = sc->sc_ah->ah_caps.tx_chainmask;
490 sc->sc_rx_chainmask = sc->sc_ah->ah_caps.rx_chainmask; 491 sc->sc_rx_chainmask = sc->sc_ah->ah_caps.rx_chainmask;
@@ -553,7 +554,7 @@ int ath_vap_listen(struct ath_softc *sc, int if_id)
553 sc->sc_imask & ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS)); 554 sc->sc_imask & ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS));
554 sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); 555 sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
555 /* need to reconfigure the beacons when it moves to RUN */ 556 /* need to reconfigure the beacons when it moves to RUN */
556 sc->sc_beacons = 0; 557 sc->sc_flags &= ~SC_OP_BEACONS;
557 558
558 return 0; 559 return 0;
559} 560}
@@ -773,7 +774,7 @@ int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan)
773 774
774 /* XXX: we must make sure h/w is ready and clear invalid flag 775 /* XXX: we must make sure h/w is ready and clear invalid flag
775 * before turning on interrupt. */ 776 * before turning on interrupt. */
776 sc->sc_invalid = 0; 777 sc->sc_flags &= ~SC_OP_INVALID;
777done: 778done:
778 return error; 779 return error;
779} 780}
@@ -816,7 +817,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
816 817
817 ath_update_txpow(sc); 818 ath_update_txpow(sc);
818 819
819 if (sc->sc_beacons) 820 if (sc->sc_flags & SC_OP_BEACONS)
820 ath_beacon_config(sc, ATH_IF_ID_ANY); /* restart beacons */ 821 ath_beacon_config(sc, ATH_IF_ID_ANY); /* restart beacons */
821 822
822 ath9k_hw_set_interrupts(ah, sc->sc_imask); 823 ath9k_hw_set_interrupts(ah, sc->sc_imask);
@@ -841,7 +842,7 @@ int ath_suspend(struct ath_softc *sc)
841 struct ath_hal *ah = sc->sc_ah; 842 struct ath_hal *ah = sc->sc_ah;
842 843
843 /* No I/O if device has been surprise removed */ 844 /* No I/O if device has been surprise removed */
844 if (sc->sc_invalid) 845 if (sc->sc_flags & SC_OP_INVALID)
845 return -EIO; 846 return -EIO;
846 847
847 /* Shut off the interrupt before setting sc->sc_invalid to '1' */ 848 /* Shut off the interrupt before setting sc->sc_invalid to '1' */
@@ -849,7 +850,7 @@ int ath_suspend(struct ath_softc *sc)
849 850
850 /* XXX: we must make sure h/w will not generate any interrupt 851 /* XXX: we must make sure h/w will not generate any interrupt
851 * before setting the invalid flag. */ 852 * before setting the invalid flag. */
852 sc->sc_invalid = 1; 853 sc->sc_flags |= SC_OP_INVALID;
853 854
854 /* disable HAL and put h/w to sleep */ 855 /* disable HAL and put h/w to sleep */
855 ath9k_hw_disable(sc->sc_ah); 856 ath9k_hw_disable(sc->sc_ah);
@@ -870,7 +871,7 @@ irqreturn_t ath_isr(int irq, void *dev)
870 bool sched = false; 871 bool sched = false;
871 872
872 do { 873 do {
873 if (sc->sc_invalid) { 874 if (sc->sc_flags & SC_OP_INVALID) {
874 /* 875 /*
875 * The hardware is not ready/present, don't 876 * The hardware is not ready/present, don't
876 * touch anything. Note this can happen early 877 * touch anything. Note this can happen early
@@ -1026,7 +1027,7 @@ int ath_init(u16 devid, struct ath_softc *sc)
1026 u32 rd; 1027 u32 rd;
1027 1028
1028 /* XXX: hardware will not be ready until ath_open() being called */ 1029 /* XXX: hardware will not be ready until ath_open() being called */
1029 sc->sc_invalid = 1; 1030 sc->sc_flags |= SC_OP_INVALID;
1030 1031
1031 sc->sc_debug = DBG_DEFAULT; 1032 sc->sc_debug = DBG_DEFAULT;
1032 DPRINTF(sc, ATH_DBG_CONFIG, "%s: devid 0x%x\n", __func__, devid); 1033 DPRINTF(sc, ATH_DBG_CONFIG, "%s: devid 0x%x\n", __func__, devid);
@@ -1210,8 +1211,8 @@ int ath_init(u16 devid, struct ath_softc *sc)
1210 1211
1211 /* 11n Capabilities */ 1212 /* 11n Capabilities */
1212 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) { 1213 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) {
1213 sc->sc_txaggr = 1; 1214 sc->sc_flags |= SC_OP_TXAGGR;
1214 sc->sc_rxaggr = 1; 1215 sc->sc_flags |= SC_OP_RXAGGR;
1215 } 1216 }
1216 1217
1217 sc->sc_tx_chainmask = ah->ah_caps.tx_chainmask; 1218 sc->sc_tx_chainmask = ah->ah_caps.tx_chainmask;
@@ -1267,7 +1268,7 @@ void ath_deinit(struct ath_softc *sc)
1267 DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__); 1268 DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__);
1268 1269
1269 ath_stop(sc); 1270 ath_stop(sc);
1270 if (!sc->sc_invalid) 1271 if (!(sc->sc_flags & SC_OP_INVALID))
1271 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); 1272 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
1272 ath_rate_detach(sc->sc_rc); 1273 ath_rate_detach(sc->sc_rc);
1273 /* cleanup tx queues */ 1274 /* cleanup tx queues */
@@ -1394,9 +1395,9 @@ void ath_newassoc(struct ath_softc *sc,
1394 /* if station reassociates, tear down the aggregation state. */ 1395 /* if station reassociates, tear down the aggregation state. */
1395 if (!isnew) { 1396 if (!isnew) {
1396 for (tidno = 0; tidno < WME_NUM_TID; tidno++) { 1397 for (tidno = 0; tidno < WME_NUM_TID; tidno++) {
1397 if (sc->sc_txaggr) 1398 if (sc->sc_flags & SC_OP_TXAGGR)
1398 ath_tx_aggr_teardown(sc, an, tidno); 1399 ath_tx_aggr_teardown(sc, an, tidno);
1399 if (sc->sc_rxaggr) 1400 if (sc->sc_flags & SC_OP_RXAGGR)
1400 ath_rx_aggr_teardown(sc, an, tidno); 1401 ath_rx_aggr_teardown(sc, an, tidno);
1401 } 1402 }
1402 } 1403 }
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index bfe16230b5e7..702f7b8eba59 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -830,8 +830,6 @@ void ath_setdefantenna(void *sc, u32 antenna);
830#define ATH_DEFAULT_NOISE_FLOOR -95 830#define ATH_DEFAULT_NOISE_FLOOR -95
831#define ATH_REGCLASSIDS_MAX 10 831#define ATH_REGCLASSIDS_MAX 10
832#define ATH_CABQ_READY_TIME 80 /* % of beacon interval */ 832#define ATH_CABQ_READY_TIME 80 /* % of beacon interval */
833#define ATH_PREAMBLE_SHORT (1<<0)
834#define ATH_PROTECT_ENABLE (1<<1)
835#define ATH_MAX_SW_RETRIES 10 833#define ATH_MAX_SW_RETRIES 10
836#define ATH_CHAN_MAX 255 834#define ATH_CHAN_MAX 255
837#define IEEE80211_WEP_NKID 4 /* number of key ids */ 835#define IEEE80211_WEP_NKID 4 /* number of key ids */
@@ -892,25 +890,30 @@ struct ath_ht_info {
892 u8 ext_chan_offset; 890 u8 ext_chan_offset;
893}; 891};
894 892
893#define SC_OP_INVALID BIT(0)
894#define SC_OP_BEACONS BIT(1)
895#define SC_OP_RXAGGR BIT(2)
896#define SC_OP_TXAGGR BIT(3)
897#define SC_OP_CHAINMASK_UPDATE BIT(4)
898#define SC_OP_FULL_RESET BIT(5)
899#define SC_OP_PREAMBLE_SHORT BIT(6)
900#define SC_OP_PROTECT_ENABLE BIT(7)
901
895struct ath_softc { 902struct ath_softc {
896 struct ieee80211_hw *hw; 903 struct ieee80211_hw *hw;
897 struct pci_dev *pdev; 904 struct pci_dev *pdev;
898 struct tasklet_struct intr_tq; 905 struct tasklet_struct intr_tq;
899 struct tasklet_struct bcon_tasklet; 906 struct tasklet_struct bcon_tasklet;
900 struct ath_config sc_config; /* load-time parameters */ 907 struct ath_config sc_config;
901 struct ath_hal *sc_ah; 908 struct ath_hal *sc_ah;
902 struct ath_rate_softc *sc_rc; /* tx rate control support */ 909 struct ath_rate_softc *sc_rc;
903 void __iomem *mem; 910 void __iomem *mem;
904 911
905 int sc_debug; 912 int sc_debug;
906 u32 sc_intrstatus; 913 u32 sc_intrstatus;
914 u32 sc_flags; /* SC_OP_* */
907 unsigned int rx_filter; 915 unsigned int rx_filter;
908 u8 sc_invalid; /* being detached */ 916
909 u8 sc_beacons; /* beacons running */
910 u8 sc_txaggr; /* enable 11n tx aggregation */
911 u8 sc_rxaggr; /* enable 11n rx aggregation */
912 u8 sc_update_chainmask; /* change chain mask */
913 u8 sc_full_reset; /* force full reset */
914 enum wireless_mode sc_curmode; /* current phy mode */ 917 enum wireless_mode sc_curmode; /* current phy mode */
915 u16 sc_curtxpow; 918 u16 sc_curtxpow;
916 u16 sc_curaid; 919 u16 sc_curaid;
@@ -944,7 +947,6 @@ struct ath_softc {
944 u8 sc_rxchaindetect_delta5GHz; 947 u8 sc_rxchaindetect_delta5GHz;
945 u8 sc_rxchaindetect_delta2GHz; 948 u8 sc_rxchaindetect_delta2GHz;
946 u32 sc_rtsaggrlimit; /* Chipset specific aggr limit */ 949 u32 sc_rtsaggrlimit; /* Chipset specific aggr limit */
947 u32 sc_flags;
948#ifdef CONFIG_SLOW_ANT_DIV 950#ifdef CONFIG_SLOW_ANT_DIV
949 struct ath_antdiv sc_antdiv; 951 struct ath_antdiv sc_antdiv;
950#endif 952#endif
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 7504b64020c9..7fb57ee4c436 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -481,7 +481,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
481 /* Set interrupt mask */ 481 /* Set interrupt mask */
482 sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); 482 sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
483 ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_imask & ~ATH9K_INT_GLOBAL); 483 ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_imask & ~ATH9K_INT_GLOBAL);
484 sc->sc_beacons = 0; 484 sc->sc_flags &= ~SC_OP_BEACONS;
485 485
486 error = ath_vap_detach(sc, 0); 486 error = ath_vap_detach(sc, 0);
487 if (error) 487 if (error)
@@ -582,7 +582,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
582 print_mac(mac, sc->sc_curbssid), sc->sc_curaid); 582 print_mac(mac, sc->sc_curbssid), sc->sc_curaid);
583 583
584 /* need to reconfigure the beacon */ 584 /* need to reconfigure the beacon */
585 sc->sc_beacons = 0; 585 sc->sc_flags &= ~SC_OP_BEACONS ;
586 586
587 break; 587 break;
588 default: 588 default:
@@ -833,7 +833,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
833 833
834 /* Configure the beacon */ 834 /* Configure the beacon */
835 ath_beacon_config(sc, 0); 835 ath_beacon_config(sc, 0);
836 sc->sc_beacons = 1; 836 sc->sc_flags |= SC_OP_BEACONS;
837 837
838 /* Reset rssi stats */ 838 /* Reset rssi stats */
839 sc->sc_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER; 839 sc->sc_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER;
@@ -896,9 +896,9 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
896 __func__, 896 __func__,
897 bss_conf->use_short_preamble); 897 bss_conf->use_short_preamble);
898 if (bss_conf->use_short_preamble) 898 if (bss_conf->use_short_preamble)
899 sc->sc_flags |= ATH_PREAMBLE_SHORT; 899 sc->sc_flags |= SC_OP_PREAMBLE_SHORT;
900 else 900 else
901 sc->sc_flags &= ~ATH_PREAMBLE_SHORT; 901 sc->sc_flags &= ~SC_OP_PREAMBLE_SHORT;
902 } 902 }
903 903
904 if (changed & BSS_CHANGED_ERP_CTS_PROT) { 904 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
@@ -907,9 +907,9 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
907 bss_conf->use_cts_prot); 907 bss_conf->use_cts_prot);
908 if (bss_conf->use_cts_prot && 908 if (bss_conf->use_cts_prot &&
909 hw->conf.channel->band != IEEE80211_BAND_5GHZ) 909 hw->conf.channel->band != IEEE80211_BAND_5GHZ)
910 sc->sc_flags |= ATH_PROTECT_ENABLE; 910 sc->sc_flags |= SC_OP_PROTECT_ENABLE;
911 else 911 else
912 sc->sc_flags &= ~ATH_PROTECT_ENABLE; 912 sc->sc_flags &= ~SC_OP_PROTECT_ENABLE;
913 } 913 }
914 914
915 if (changed & BSS_CHANGED_HT) { 915 if (changed & BSS_CHANGED_HT) {
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 73c460ad355f..20e10849e934 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -1903,7 +1903,7 @@ static void ath_tx_aggr_resp(struct ath_softc *sc,
1903 int state; 1903 int state;
1904 DECLARE_MAC_BUF(mac); 1904 DECLARE_MAC_BUF(mac);
1905 1905
1906 if (!sc->sc_txaggr) 1906 if (!(sc->sc_flags & SC_OP_TXAGGR))
1907 return; 1907 return;
1908 1908
1909 txtid = ATH_AN_2_TID(an, tidno); 1909 txtid = ATH_AN_2_TID(an, tidno);
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 6d1d5035f159..9c7583210e36 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -724,7 +724,7 @@ int ath_rx_input(struct ath_softc *sc,
724 struct ath_recv_status *rx_status, 724 struct ath_recv_status *rx_status,
725 enum ATH_RX_TYPE *status) 725 enum ATH_RX_TYPE *status)
726{ 726{
727 if (is_ampdu && sc->sc_rxaggr) { 727 if (is_ampdu && (sc->sc_flags & SC_OP_RXAGGR)) {
728 *status = ATH_RX_CONSUMED; 728 *status = ATH_RX_CONSUMED;
729 return ath_ampdu_input(sc, an, skb, rx_status); 729 return ath_ampdu_input(sc, an, skb, rx_status);
730 } else { 730 } else {
@@ -1132,7 +1132,7 @@ int ath_rx_aggr_start(struct ath_softc *sc,
1132 rxtid = &an->an_aggr.rx.tid[tid]; 1132 rxtid = &an->an_aggr.rx.tid[tid];
1133 1133
1134 spin_lock_bh(&rxtid->tidlock); 1134 spin_lock_bh(&rxtid->tidlock);
1135 if (sc->sc_rxaggr) { 1135 if (sc->sc_flags & SC_OP_RXAGGR) {
1136 /* Allow aggregation reception 1136 /* Allow aggregation reception
1137 * Adjust rx BA window size. Peer might indicate a 1137 * Adjust rx BA window size. Peer might indicate a
1138 * zero buffer size for a _dont_care_ condition. 1138 * zero buffer size for a _dont_care_ condition.
@@ -1232,7 +1232,7 @@ void ath_rx_aggr_teardown(struct ath_softc *sc,
1232 1232
1233void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an) 1233void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an)
1234{ 1234{
1235 if (sc->sc_rxaggr) { 1235 if (sc->sc_flags & SC_OP_RXAGGR) {
1236 struct ath_arx_tid *rxtid; 1236 struct ath_arx_tid *rxtid;
1237 int tidno; 1237 int tidno;
1238 1238
@@ -1264,7 +1264,7 @@ void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an)
1264 1264
1265void ath_rx_node_cleanup(struct ath_softc *sc, struct ath_node *an) 1265void ath_rx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
1266{ 1266{
1267 if (sc->sc_rxaggr) { 1267 if (sc->sc_flags & SC_OP_RXAGGR) {
1268 struct ath_arx_tid *rxtid; 1268 struct ath_arx_tid *rxtid;
1269 int tidno, i; 1269 int tidno, i;
1270 1270
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 0b5b2dd92562..75a84924b4dc 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -392,7 +392,7 @@ static int ath_tx_prepare(struct ath_softc *sc,
392 * incremented by the fragmentation routine. 392 * incremented by the fragmentation routine.
393 */ 393 */
394 if (likely(!(txctl->flags & ATH9K_TXDESC_FRAG_IS_ON)) && 394 if (likely(!(txctl->flags & ATH9K_TXDESC_FRAG_IS_ON)) &&
395 txctl->ht && sc->sc_txaggr) { 395 txctl->ht && (sc->sc_flags & SC_OP_TXAGGR)) {
396 struct ath_atx_tid *tid; 396 struct ath_atx_tid *tid;
397 397
398 tid = ATH_AN_2_TID(txctl->an, txctl->tidno); 398 tid = ATH_AN_2_TID(txctl->an, txctl->tidno);
@@ -422,7 +422,7 @@ static int ath_tx_prepare(struct ath_softc *sc,
422 /* 422 /*
423 * XXX not right with fragmentation. 423 * XXX not right with fragmentation.
424 */ 424 */
425 if (sc->sc_flags & ATH_PREAMBLE_SHORT) 425 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
426 dur = rt->info[rix].spAckDuration; 426 dur = rt->info[rix].spAckDuration;
427 else 427 else
428 dur = rt->info[rix].lpAckDuration; 428 dur = rt->info[rix].lpAckDuration;
@@ -438,8 +438,9 @@ static int ath_tx_prepare(struct ath_softc *sc,
438 ** Add time for next fragment. 438 ** Add time for next fragment.
439 */ 439 */
440 dur += ath9k_hw_computetxtime(sc->sc_ah, rt, 440 dur += ath9k_hw_computetxtime(sc->sc_ah, rt,
441 txctl->nextfraglen, 441 txctl->nextfraglen,
442 rix, sc->sc_flags & ATH_PREAMBLE_SHORT); 442 rix,
443 (sc->sc_flags & SC_OP_PREAMBLE_SHORT));
443 } 444 }
444 445
445 if (ieee80211_has_morefrags(fc) || 446 if (ieee80211_has_morefrags(fc) ||
@@ -1406,7 +1407,7 @@ static int ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
1406 /* 1407 /*
1407 * schedule any pending packets if aggregation is enabled 1408 * schedule any pending packets if aggregation is enabled
1408 */ 1409 */
1409 if (sc->sc_txaggr) 1410 if (sc->sc_flags & SC_OP_TXAGGR)
1410 ath_txq_schedule(sc, txq); 1411 ath_txq_schedule(sc, txq);
1411 spin_unlock_bh(&txq->axq_lock); 1412 spin_unlock_bh(&txq->axq_lock);
1412 } 1413 }
@@ -1433,7 +1434,7 @@ static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx)
1433 enum ath9k_ht_macmode ht_macmode = ath_cwm_macmode(sc); 1434 enum ath9k_ht_macmode ht_macmode = ath_cwm_macmode(sc);
1434 1435
1435 /* XXX return value */ 1436 /* XXX return value */
1436 if (!sc->sc_invalid) { 1437 if (!(sc->sc_flags & SC_OP_INVALID)) {
1437 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 1438 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
1438 if (ATH_TXQ_SETUP(sc, i)) { 1439 if (ATH_TXQ_SETUP(sc, i)) {
1439 ath_tx_stopdma(sc, &sc->sc_txq[i]); 1440 ath_tx_stopdma(sc, &sc->sc_txq[i]);
@@ -2024,7 +2025,7 @@ static int ath_tx_start_dma(struct ath_softc *sc,
2024 ieee80211_is_pspoll(fc) ? 2025 ieee80211_is_pspoll(fc) ?
2025 (bf->bf_state.bf_type |= BUF_PSPOLL) : 2026 (bf->bf_state.bf_type |= BUF_PSPOLL) :
2026 (bf->bf_state.bf_type &= ~BUF_PSPOLL); 2027 (bf->bf_state.bf_type &= ~BUF_PSPOLL);
2027 (sc->sc_flags & ATH_PREAMBLE_SHORT) ? 2028 (sc->sc_flags & SC_OP_PREAMBLE_SHORT) ?
2028 (bf->bf_state.bf_type |= BUF_SHORT_PREAMBLE) : 2029 (bf->bf_state.bf_type |= BUF_SHORT_PREAMBLE) :
2029 (bf->bf_state.bf_type &= ~BUF_SHORT_PREAMBLE); 2030 (bf->bf_state.bf_type &= ~BUF_SHORT_PREAMBLE);
2030 2031
@@ -2076,7 +2077,7 @@ static int ath_tx_start_dma(struct ath_softc *sc,
2076 2077
2077 spin_lock_bh(&txq->axq_lock); 2078 spin_lock_bh(&txq->axq_lock);
2078 2079
2079 if (txctl->ht && sc->sc_txaggr) { 2080 if (txctl->ht && (sc->sc_flags & SC_OP_TXAGGR)) {
2080 struct ath_atx_tid *tid = ATH_AN_2_TID(an, txctl->tidno); 2081 struct ath_atx_tid *tid = ATH_AN_2_TID(an, txctl->tidno);
2081 if (ath_aggr_query(sc, an, txctl->tidno)) { 2082 if (ath_aggr_query(sc, an, txctl->tidno)) {
2082 /* 2083 /*
@@ -2153,7 +2154,7 @@ static void xmit_map_sg(struct ath_softc *sc,
2153 tx_status.retries = 0; 2154 tx_status.retries = 0;
2154 tx_status.flags = ATH_TX_ERROR; 2155 tx_status.flags = ATH_TX_ERROR;
2155 2156
2156 if (txctl->ht && sc->sc_txaggr) { 2157 if (txctl->ht && (sc->sc_flags & SC_OP_TXAGGR)) {
2157 /* Reclaim the seqno. */ 2158 /* Reclaim the seqno. */
2158 tid = ATH_AN_2_TID((struct ath_node *) 2159 tid = ATH_AN_2_TID((struct ath_node *)
2159 txctl->an, txctl->tidno); 2160 txctl->an, txctl->tidno);
@@ -2505,7 +2506,7 @@ void ath_tx_draintxq(struct ath_softc *sc,
2505 } 2506 }
2506 2507
2507 /* flush any pending frames if aggregation is enabled */ 2508 /* flush any pending frames if aggregation is enabled */
2508 if (sc->sc_txaggr) { 2509 if (sc->sc_flags & SC_OP_TXAGGR) {
2509 if (!retry_tx) { 2510 if (!retry_tx) {
2510 spin_lock_bh(&txq->axq_lock); 2511 spin_lock_bh(&txq->axq_lock);
2511 ath_txq_drain_pending_buffers(sc, txq, 2512 ath_txq_drain_pending_buffers(sc, txq,
@@ -2521,7 +2522,7 @@ void ath_draintxq(struct ath_softc *sc, bool retry_tx)
2521{ 2522{
2522 /* stop beacon queue. The beacon will be freed when 2523 /* stop beacon queue. The beacon will be freed when
2523 * we go to INIT state */ 2524 * we go to INIT state */
2524 if (!sc->sc_invalid) { 2525 if (!(sc->sc_flags & SC_OP_INVALID)) {
2525 (void) ath9k_hw_stoptxdma(sc->sc_ah, sc->sc_bhalq); 2526 (void) ath9k_hw_stoptxdma(sc->sc_ah, sc->sc_bhalq);
2526 DPRINTF(sc, ATH_DBG_XMIT, "%s: beacon queue %x\n", __func__, 2527 DPRINTF(sc, ATH_DBG_XMIT, "%s: beacon queue %x\n", __func__,
2527 ath9k_hw_gettxbuf(sc->sc_ah, sc->sc_bhalq)); 2528 ath9k_hw_gettxbuf(sc->sc_ah, sc->sc_bhalq));
@@ -2548,7 +2549,7 @@ enum ATH_AGGR_CHECK ath_tx_aggr_check(struct ath_softc *sc,
2548 struct ath_atx_tid *txtid; 2549 struct ath_atx_tid *txtid;
2549 DECLARE_MAC_BUF(mac); 2550 DECLARE_MAC_BUF(mac);
2550 2551
2551 if (!sc->sc_txaggr) 2552 if (!(sc->sc_flags & SC_OP_TXAGGR))
2552 return AGGR_NOT_REQUIRED; 2553 return AGGR_NOT_REQUIRED;
2553 2554
2554 /* ADDBA exchange must be completed before sending aggregates */ 2555 /* ADDBA exchange must be completed before sending aggregates */
@@ -2595,7 +2596,7 @@ int ath_tx_aggr_start(struct ath_softc *sc,
2595 return -1; 2596 return -1;
2596 } 2597 }
2597 2598
2598 if (sc->sc_txaggr) { 2599 if (sc->sc_flags & SC_OP_TXAGGR) {
2599 txtid = ATH_AN_2_TID(an, tid); 2600 txtid = ATH_AN_2_TID(an, tid);
2600 txtid->addba_exchangeinprogress = 1; 2601 txtid->addba_exchangeinprogress = 1;
2601 ath_tx_pause_tid(sc, txtid); 2602 ath_tx_pause_tid(sc, txtid);
@@ -2755,7 +2756,7 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
2755 2756
2756void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) 2757void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
2757{ 2758{
2758 if (sc->sc_txaggr) { 2759 if (sc->sc_flags & SC_OP_TXAGGR) {
2759 struct ath_atx_tid *tid; 2760 struct ath_atx_tid *tid;
2760 struct ath_atx_ac *ac; 2761 struct ath_atx_ac *ac;
2761 int tidno, acno; 2762 int tidno, acno;
@@ -2867,7 +2868,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc,
2867 2868
2868void ath_tx_node_free(struct ath_softc *sc, struct ath_node *an) 2869void ath_tx_node_free(struct ath_softc *sc, struct ath_node *an)
2869{ 2870{
2870 if (sc->sc_txaggr) { 2871 if (sc->sc_flags & SC_OP_TXAGGR) {
2871 struct ath_atx_tid *tid; 2872 struct ath_atx_tid *tid;
2872 int tidno, i; 2873 int tidno, i;
2873 2874