aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-09-02 19:40:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-14 13:56:19 -0400
commit82b2d334314c387ebd857b88a3d889c9a2cfec4a (patch)
tree3108d4abc5ccf7711306a6e92ed87e6da4532f77
parent693828fe92933ce4fff4c1e51365b2e6ab033b0e (diff)
ath9k: eliminate common->{rx,tx}_chainmask
we already have ah->{rx,tx}chainmask for the same purpose Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c20
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c8
10 files changed, 27 insertions, 41 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 9891fb605a01..4ed7f248a577 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -140,9 +140,6 @@ struct ath_common {
140 u8 curbssid[ETH_ALEN]; 140 u8 curbssid[ETH_ALEN];
141 u8 bssidmask[ETH_ALEN]; 141 u8 bssidmask[ETH_ALEN];
142 142
143 u8 tx_chainmask;
144 u8 rx_chainmask;
145
146 u32 rx_bufsize; 143 u32 rx_bufsize;
147 144
148 u32 keymax; 145 u32 keymax;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index f80d1d633980..bb2214f425b2 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -113,7 +113,7 @@ static int ar9003_get_training_power_5g(struct ath_hw *ah)
113 if (delta > scale) 113 if (delta > scale)
114 return -1; 114 return -1;
115 115
116 switch (get_streams(common->tx_chainmask)) { 116 switch (get_streams(ah->txchainmask)) {
117 case 1: 117 case 1:
118 delta = 6; 118 delta = 6;
119 break; 119 break;
@@ -126,7 +126,7 @@ static int ar9003_get_training_power_5g(struct ath_hw *ah)
126 default: 126 default:
127 delta = 0; 127 delta = 0;
128 ath_dbg(common, ATH_DBG_CALIBRATE, 128 ath_dbg(common, ATH_DBG_CALIBRATE,
129 "Invalid tx-chainmask: %u\n", common->tx_chainmask); 129 "Invalid tx-chainmask: %u\n", ah->txchainmask);
130 } 130 }
131 131
132 power += delta; 132 power += delta;
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 086c9c816bf7..0c757c9f978a 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -107,7 +107,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,
107 series[0].Tries = 1; 107 series[0].Tries = 1;
108 series[0].Rate = rate; 108 series[0].Rate = rate;
109 series[0].ChSel = ath_txchainmask_reduction(sc, 109 series[0].ChSel = ath_txchainmask_reduction(sc,
110 common->tx_chainmask, series[0].Rate); 110 ah->txchainmask, series[0].Rate);
111 series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0; 111 series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0;
112 ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration, 112 ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration,
113 series, 4, 0); 113 series, 4, 0);
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 727e8de22fda..19ef559ac78f 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -95,11 +95,11 @@ static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
95 size_t count, loff_t *ppos) 95 size_t count, loff_t *ppos)
96{ 96{
97 struct ath_softc *sc = file->private_data; 97 struct ath_softc *sc = file->private_data;
98 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 98 struct ath_hw *ah = sc->sc_ah;
99 char buf[32]; 99 char buf[32];
100 unsigned int len; 100 unsigned int len;
101 101
102 len = sprintf(buf, "0x%08x\n", common->tx_chainmask); 102 len = sprintf(buf, "0x%08x\n", ah->txchainmask);
103 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 103 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
104} 104}
105 105
@@ -107,7 +107,7 @@ static ssize_t write_file_tx_chainmask(struct file *file, const char __user *use
107 size_t count, loff_t *ppos) 107 size_t count, loff_t *ppos)
108{ 108{
109 struct ath_softc *sc = file->private_data; 109 struct ath_softc *sc = file->private_data;
110 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 110 struct ath_hw *ah = sc->sc_ah;
111 unsigned long mask; 111 unsigned long mask;
112 char buf[32]; 112 char buf[32];
113 ssize_t len; 113 ssize_t len;
@@ -120,8 +120,8 @@ static ssize_t write_file_tx_chainmask(struct file *file, const char __user *use
120 if (strict_strtoul(buf, 0, &mask)) 120 if (strict_strtoul(buf, 0, &mask))
121 return -EINVAL; 121 return -EINVAL;
122 122
123 common->tx_chainmask = mask; 123 ah->txchainmask = mask;
124 sc->sc_ah->caps.tx_chainmask = mask; 124 ah->caps.tx_chainmask = mask;
125 return count; 125 return count;
126} 126}
127 127
@@ -138,11 +138,11 @@ static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
138 size_t count, loff_t *ppos) 138 size_t count, loff_t *ppos)
139{ 139{
140 struct ath_softc *sc = file->private_data; 140 struct ath_softc *sc = file->private_data;
141 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 141 struct ath_hw *ah = sc->sc_ah;
142 char buf[32]; 142 char buf[32];
143 unsigned int len; 143 unsigned int len;
144 144
145 len = sprintf(buf, "0x%08x\n", common->rx_chainmask); 145 len = sprintf(buf, "0x%08x\n", ah->rxchainmask);
146 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 146 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
147} 147}
148 148
@@ -150,7 +150,7 @@ static ssize_t write_file_rx_chainmask(struct file *file, const char __user *use
150 size_t count, loff_t *ppos) 150 size_t count, loff_t *ppos)
151{ 151{
152 struct ath_softc *sc = file->private_data; 152 struct ath_softc *sc = file->private_data;
153 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 153 struct ath_hw *ah = sc->sc_ah;
154 unsigned long mask; 154 unsigned long mask;
155 char buf[32]; 155 char buf[32];
156 ssize_t len; 156 ssize_t len;
@@ -163,8 +163,8 @@ static ssize_t write_file_rx_chainmask(struct file *file, const char __user *use
163 if (strict_strtoul(buf, 0, &mask)) 163 if (strict_strtoul(buf, 0, &mask))
164 return -EINVAL; 164 return -EINVAL;
165 165
166 common->rx_chainmask = mask; 166 ah->rxchainmask = mask;
167 sc->sc_ah->caps.rx_chainmask = mask; 167 ah->caps.rx_chainmask = mask;
168 return count; 168 return count;
169} 169}
170 170
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 9cf42f6973aa..966661c9e586 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -509,8 +509,8 @@ static void setup_ht_cap(struct ath9k_htc_priv *priv,
509 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); 509 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
510 510
511 /* ath9k_htc supports only 1 or 2 stream devices */ 511 /* ath9k_htc supports only 1 or 2 stream devices */
512 tx_streams = ath9k_cmn_count_streams(common->tx_chainmask, 2); 512 tx_streams = ath9k_cmn_count_streams(priv->ah->txchainmask, 2);
513 rx_streams = ath9k_cmn_count_streams(common->rx_chainmask, 2); 513 rx_streams = ath9k_cmn_count_streams(priv->ah->rxchainmask, 2);
514 514
515 ath_dbg(common, ATH_DBG_CONFIG, 515 ath_dbg(common, ATH_DBG_CONFIG,
516 "TX streams %d, RX streams: %d\n", 516 "TX streams %d, RX streams: %d\n",
@@ -601,9 +601,6 @@ static void ath9k_init_misc(struct ath9k_htc_priv *priv)
601{ 601{
602 struct ath_common *common = ath9k_hw_common(priv->ah); 602 struct ath_common *common = ath9k_hw_common(priv->ah);
603 603
604 common->tx_chainmask = priv->ah->caps.tx_chainmask;
605 common->rx_chainmask = priv->ah->caps.rx_chainmask;
606
607 memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN); 604 memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
608 605
609 priv->ah->opmode = NL80211_IFTYPE_STATION; 606 priv->ah->opmode = NL80211_IFTYPE_STATION;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index b9de1511add9..495fdf680a6c 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -826,8 +826,7 @@ void ath9k_htc_ani_work(struct work_struct *work)
826 if (longcal || shortcal) 826 if (longcal || shortcal)
827 common->ani.caldone = 827 common->ani.caldone =
828 ath9k_hw_calibrate(ah, ah->curchan, 828 ath9k_hw_calibrate(ah, ah->curchan,
829 common->rx_chainmask, 829 ah->rxchainmask, longcal);
830 longcal);
831 830
832 ath9k_htc_ps_restore(priv); 831 ath9k_htc_ps_restore(priv);
833 } 832 }
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 47d10a4463f1..f2065fce4ec9 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1479,9 +1479,6 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1479 u64 tsf = 0; 1479 u64 tsf = 0;
1480 int i, r; 1480 int i, r;
1481 1481
1482 ah->txchainmask = common->tx_chainmask;
1483 ah->rxchainmask = common->rx_chainmask;
1484
1485 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) 1482 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
1486 return -EIO; 1483 return -EIO;
1487 1484
@@ -2095,6 +2092,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
2095 2092
2096 pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask); 2093 pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask);
2097 pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask); 2094 pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask);
2095 ah->txchainmask = pCap->tx_chainmask;
2096 ah->rxchainmask = pCap->rx_chainmask;
2098 2097
2099 ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA; 2098 ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
2100 2099
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index dd71a5f77516..50da6421728b 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -270,8 +270,8 @@ static void setup_ht_cap(struct ath_softc *sc,
270 270
271 /* set up supported mcs set */ 271 /* set up supported mcs set */
272 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); 272 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
273 tx_streams = ath9k_cmn_count_streams(common->tx_chainmask, max_streams); 273 tx_streams = ath9k_cmn_count_streams(ah->txchainmask, max_streams);
274 rx_streams = ath9k_cmn_count_streams(common->rx_chainmask, max_streams); 274 rx_streams = ath9k_cmn_count_streams(ah->rxchainmask, max_streams);
275 275
276 ath_dbg(common, ATH_DBG_CONFIG, 276 ath_dbg(common, ATH_DBG_CONFIG,
277 "TX streams %d, RX streams: %d\n", 277 "TX streams %d, RX streams: %d\n",
@@ -506,9 +506,6 @@ static void ath9k_init_misc(struct ath_softc *sc)
506 sc->sc_flags |= SC_OP_RXAGGR; 506 sc->sc_flags |= SC_OP_RXAGGR;
507 } 507 }
508 508
509 common->tx_chainmask = sc->sc_ah->caps.tx_chainmask;
510 common->rx_chainmask = sc->sc_ah->caps.rx_chainmask;
511
512 ath9k_hw_set_diversity(sc->sc_ah, true); 509 ath9k_hw_set_diversity(sc->sc_ah, true);
513 sc->rx.defant = ath9k_hw_getdefantenna(sc->sc_ah); 510 sc->rx.defant = ath9k_hw_getdefantenna(sc->sc_ah);
514 511
@@ -646,10 +643,8 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
646static void ath9k_init_txpower_limits(struct ath_softc *sc) 643static void ath9k_init_txpower_limits(struct ath_softc *sc)
647{ 644{
648 struct ath_hw *ah = sc->sc_ah; 645 struct ath_hw *ah = sc->sc_ah;
649 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
650 struct ath9k_channel *curchan = ah->curchan; 646 struct ath9k_channel *curchan = ah->curchan;
651 647
652 ah->txchainmask = common->tx_chainmask;
653 if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) 648 if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
654 ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ); 649 ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ);
655 if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) 650 if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 7b7864dfab75..e944eadd677d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -318,7 +318,6 @@ static void ath_paprd_activate(struct ath_softc *sc)
318{ 318{
319 struct ath_hw *ah = sc->sc_ah; 319 struct ath_hw *ah = sc->sc_ah;
320 struct ath9k_hw_cal_data *caldata = ah->caldata; 320 struct ath9k_hw_cal_data *caldata = ah->caldata;
321 struct ath_common *common = ath9k_hw_common(ah);
322 int chain; 321 int chain;
323 322
324 if (!caldata || !caldata->paprd_done) 323 if (!caldata || !caldata->paprd_done)
@@ -327,7 +326,7 @@ static void ath_paprd_activate(struct ath_softc *sc)
327 ath9k_ps_wakeup(sc); 326 ath9k_ps_wakeup(sc);
328 ar9003_paprd_enable(ah, false); 327 ar9003_paprd_enable(ah, false);
329 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { 328 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
330 if (!(common->tx_chainmask & BIT(chain))) 329 if (!(ah->txchainmask & BIT(chain)))
331 continue; 330 continue;
332 331
333 ar9003_paprd_populate_single_table(ah, caldata, chain); 332 ar9003_paprd_populate_single_table(ah, caldata, chain);
@@ -414,7 +413,7 @@ void ath_paprd_calibrate(struct work_struct *work)
414 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); 413 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
415 414
416 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { 415 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
417 if (!(common->tx_chainmask & BIT(chain))) 416 if (!(ah->txchainmask & BIT(chain)))
418 continue; 417 continue;
419 418
420 chain_ok = 0; 419 chain_ok = 0;
@@ -535,7 +534,7 @@ void ath_ani_calibrate(unsigned long data)
535 if (longcal || shortcal) { 534 if (longcal || shortcal) {
536 common->ani.caldone = 535 common->ani.caldone =
537 ath9k_hw_calibrate(ah, ah->curchan, 536 ath9k_hw_calibrate(ah, ah->curchan,
538 common->rx_chainmask, longcal); 537 ah->rxchainmask, longcal);
539 } 538 }
540 539
541 ath9k_ps_restore(sc); 540 ath9k_ps_restore(sc);
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 29bcc55a6f9e..0fb8fb57b5c8 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1634,7 +1634,7 @@ u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
1634 1634
1635static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len) 1635static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1636{ 1636{
1637 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1637 struct ath_hw *ah = sc->sc_ah;
1638 struct ath9k_11n_rate_series series[4]; 1638 struct ath9k_11n_rate_series series[4];
1639 struct sk_buff *skb; 1639 struct sk_buff *skb;
1640 struct ieee80211_tx_info *tx_info; 1640 struct ieee80211_tx_info *tx_info;
@@ -1694,7 +1694,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1694 /* MCS rates */ 1694 /* MCS rates */
1695 series[i].Rate = rix | 0x80; 1695 series[i].Rate = rix | 0x80;
1696 series[i].ChSel = ath_txchainmask_reduction(sc, 1696 series[i].ChSel = ath_txchainmask_reduction(sc,
1697 common->tx_chainmask, series[i].Rate); 1697 ah->txchainmask, series[i].Rate);
1698 series[i].PktDuration = ath_pkt_duration(sc, rix, len, 1698 series[i].PktDuration = ath_pkt_duration(sc, rix, len,
1699 is_40, is_sgi, is_sp); 1699 is_40, is_sgi, is_sp);
1700 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC)) 1700 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC))
@@ -1719,10 +1719,10 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1719 } 1719 }
1720 1720
1721 if (bf->bf_state.bfs_paprd) 1721 if (bf->bf_state.bfs_paprd)
1722 series[i].ChSel = common->tx_chainmask; 1722 series[i].ChSel = ah->txchainmask;
1723 else 1723 else
1724 series[i].ChSel = ath_txchainmask_reduction(sc, 1724 series[i].ChSel = ath_txchainmask_reduction(sc,
1725 common->tx_chainmask, series[i].Rate); 1725 ah->txchainmask, series[i].Rate);
1726 1726
1727 series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah, 1727 series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah,
1728 phy, rate->bitrate * 100, len, rix, is_sp); 1728 phy, rate->bitrate * 100, len, rix, is_sp);