diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-10-14 10:02:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-15 15:48:45 -0400 |
commit | d4659912b557e9f68c0ad8be14e2cafd3210dd16 (patch) | |
tree | 5bd3dbc2b7ba736ff1dc0717154e7b592a22c32f /drivers/net/wireless | |
parent | 4e9900180eb72b3b22fc9742999045b11607eb24 (diff) |
ath9k_hw: remove enum wireless_mode and its users
The wireless mode bitfield was only used to detect 2.4 and 5 GHz support,
which can be simplified by using ATH9K_HW_CAP_* capabilities.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_init.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 34 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 15 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/rc.c | 41 |
5 files changed, 25 insertions, 89 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index bbb54bc28a44..3d7b97f1b3ae 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -566,7 +566,7 @@ static void ath9k_init_crypto(struct ath9k_htc_priv *priv) | |||
566 | 566 | ||
567 | static void ath9k_init_channels_rates(struct ath9k_htc_priv *priv) | 567 | static void ath9k_init_channels_rates(struct ath9k_htc_priv *priv) |
568 | { | 568 | { |
569 | if (test_bit(ATH9K_MODE_11G, priv->ah->caps.wireless_modes)) { | 569 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) { |
570 | priv->sbands[IEEE80211_BAND_2GHZ].channels = | 570 | priv->sbands[IEEE80211_BAND_2GHZ].channels = |
571 | ath9k_2ghz_channels; | 571 | ath9k_2ghz_channels; |
572 | priv->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; | 572 | priv->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; |
@@ -577,7 +577,7 @@ static void ath9k_init_channels_rates(struct ath9k_htc_priv *priv) | |||
577 | ARRAY_SIZE(ath9k_legacy_rates); | 577 | ARRAY_SIZE(ath9k_legacy_rates); |
578 | } | 578 | } |
579 | 579 | ||
580 | if (test_bit(ATH9K_MODE_11A, priv->ah->caps.wireless_modes)) { | 580 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) { |
581 | priv->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_channels; | 581 | priv->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_channels; |
582 | priv->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; | 582 | priv->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; |
583 | priv->sbands[IEEE80211_BAND_5GHZ].n_channels = | 583 | priv->sbands[IEEE80211_BAND_5GHZ].n_channels = |
@@ -740,18 +740,18 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv, | |||
740 | hw->extra_tx_headroom = sizeof(struct tx_frame_hdr) + | 740 | hw->extra_tx_headroom = sizeof(struct tx_frame_hdr) + |
741 | sizeof(struct htc_frame_hdr) + 4; | 741 | sizeof(struct htc_frame_hdr) + 4; |
742 | 742 | ||
743 | if (test_bit(ATH9K_MODE_11G, priv->ah->caps.wireless_modes)) | 743 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) |
744 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | 744 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = |
745 | &priv->sbands[IEEE80211_BAND_2GHZ]; | 745 | &priv->sbands[IEEE80211_BAND_2GHZ]; |
746 | if (test_bit(ATH9K_MODE_11A, priv->ah->caps.wireless_modes)) | 746 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) |
747 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 747 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
748 | &priv->sbands[IEEE80211_BAND_5GHZ]; | 748 | &priv->sbands[IEEE80211_BAND_5GHZ]; |
749 | 749 | ||
750 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_HT) { | 750 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_HT) { |
751 | if (test_bit(ATH9K_MODE_11G, priv->ah->caps.wireless_modes)) | 751 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) |
752 | setup_ht_cap(priv, | 752 | setup_ht_cap(priv, |
753 | &priv->sbands[IEEE80211_BAND_2GHZ].ht_cap); | 753 | &priv->sbands[IEEE80211_BAND_2GHZ].ht_cap); |
754 | if (test_bit(ATH9K_MODE_11A, priv->ah->caps.wireless_modes)) | 754 | if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) |
755 | setup_ht_cap(priv, | 755 | setup_ht_cap(priv, |
756 | &priv->sbands[IEEE80211_BAND_5GHZ].ht_cap); | 756 | &priv->sbands[IEEE80211_BAND_5GHZ].ht_cap); |
757 | } | 757 | } |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index f5d79177770c..cc13ee117823 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1800,37 +1800,11 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
1800 | return -EINVAL; | 1800 | return -EINVAL; |
1801 | } | 1801 | } |
1802 | 1802 | ||
1803 | bitmap_zero(pCap->wireless_modes, ATH9K_MODE_MAX); | 1803 | if (eeval & AR5416_OPFLAGS_11A) |
1804 | 1804 | pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; | |
1805 | if (eeval & AR5416_OPFLAGS_11A) { | ||
1806 | set_bit(ATH9K_MODE_11A, pCap->wireless_modes); | ||
1807 | if (ah->config.ht_enable) { | ||
1808 | if (!(eeval & AR5416_OPFLAGS_N_5G_HT20)) | ||
1809 | set_bit(ATH9K_MODE_11NA_HT20, | ||
1810 | pCap->wireless_modes); | ||
1811 | if (!(eeval & AR5416_OPFLAGS_N_5G_HT40)) { | ||
1812 | set_bit(ATH9K_MODE_11NA_HT40PLUS, | ||
1813 | pCap->wireless_modes); | ||
1814 | set_bit(ATH9K_MODE_11NA_HT40MINUS, | ||
1815 | pCap->wireless_modes); | ||
1816 | } | ||
1817 | } | ||
1818 | } | ||
1819 | 1805 | ||
1820 | if (eeval & AR5416_OPFLAGS_11G) { | 1806 | if (eeval & AR5416_OPFLAGS_11G) |
1821 | set_bit(ATH9K_MODE_11G, pCap->wireless_modes); | 1807 | pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; |
1822 | if (ah->config.ht_enable) { | ||
1823 | if (!(eeval & AR5416_OPFLAGS_N_2G_HT20)) | ||
1824 | set_bit(ATH9K_MODE_11NG_HT20, | ||
1825 | pCap->wireless_modes); | ||
1826 | if (!(eeval & AR5416_OPFLAGS_N_2G_HT40)) { | ||
1827 | set_bit(ATH9K_MODE_11NG_HT40PLUS, | ||
1828 | pCap->wireless_modes); | ||
1829 | set_bit(ATH9K_MODE_11NG_HT40MINUS, | ||
1830 | pCap->wireless_modes); | ||
1831 | } | ||
1832 | } | ||
1833 | } | ||
1834 | 1808 | ||
1835 | pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); | 1809 | pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); |
1836 | /* | 1810 | /* |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 6b9233472fbf..d032939768b0 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -164,18 +164,6 @@ enum ath_ini_subsys { | |||
164 | ATH_INI_NUM_SPLIT, | 164 | ATH_INI_NUM_SPLIT, |
165 | }; | 165 | }; |
166 | 166 | ||
167 | enum wireless_mode { | ||
168 | ATH9K_MODE_11A = 0, | ||
169 | ATH9K_MODE_11G, | ||
170 | ATH9K_MODE_11NA_HT20, | ||
171 | ATH9K_MODE_11NG_HT20, | ||
172 | ATH9K_MODE_11NA_HT40PLUS, | ||
173 | ATH9K_MODE_11NA_HT40MINUS, | ||
174 | ATH9K_MODE_11NG_HT40PLUS, | ||
175 | ATH9K_MODE_11NG_HT40MINUS, | ||
176 | ATH9K_MODE_MAX, | ||
177 | }; | ||
178 | |||
179 | enum ath9k_hw_caps { | 167 | enum ath9k_hw_caps { |
180 | ATH9K_HW_CAP_HT = BIT(0), | 168 | ATH9K_HW_CAP_HT = BIT(0), |
181 | ATH9K_HW_CAP_RFSILENT = BIT(1), | 169 | ATH9K_HW_CAP_RFSILENT = BIT(1), |
@@ -190,11 +178,12 @@ enum ath9k_hw_caps { | |||
190 | ATH9K_HW_CAP_SGI_20 = BIT(10), | 178 | ATH9K_HW_CAP_SGI_20 = BIT(10), |
191 | ATH9K_HW_CAP_PAPRD = BIT(11), | 179 | ATH9K_HW_CAP_PAPRD = BIT(11), |
192 | ATH9K_HW_CAP_ANT_DIV_COMB = BIT(12), | 180 | ATH9K_HW_CAP_ANT_DIV_COMB = BIT(12), |
181 | ATH9K_HW_CAP_2GHZ = BIT(13), | ||
182 | ATH9K_HW_CAP_5GHZ = BIT(14), | ||
193 | }; | 183 | }; |
194 | 184 | ||
195 | struct ath9k_hw_capabilities { | 185 | struct ath9k_hw_capabilities { |
196 | u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ | 186 | u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ |
197 | DECLARE_BITMAP(wireless_modes, ATH9K_MODE_MAX); /* ATH9K_MODE_* */ | ||
198 | u16 total_queues; | 187 | u16 total_queues; |
199 | u16 keycache_size; | 188 | u16 keycache_size; |
200 | u16 low_5ghz_chan, high_5ghz_chan; | 189 | u16 low_5ghz_chan, high_5ghz_chan; |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index a4c5ed41b176..bc6c4df9712c 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -485,7 +485,7 @@ static int ath9k_init_channels_rates(struct ath_softc *sc) | |||
485 | ARRAY_SIZE(ath9k_5ghz_chantable) != | 485 | ARRAY_SIZE(ath9k_5ghz_chantable) != |
486 | ATH9K_NUM_CHANNELS); | 486 | ATH9K_NUM_CHANNELS); |
487 | 487 | ||
488 | if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { | 488 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) { |
489 | channels = kmemdup(ath9k_2ghz_chantable, | 489 | channels = kmemdup(ath9k_2ghz_chantable, |
490 | sizeof(ath9k_2ghz_chantable), GFP_KERNEL); | 490 | sizeof(ath9k_2ghz_chantable), GFP_KERNEL); |
491 | if (!channels) | 491 | if (!channels) |
@@ -500,7 +500,7 @@ static int ath9k_init_channels_rates(struct ath_softc *sc) | |||
500 | ARRAY_SIZE(ath9k_legacy_rates); | 500 | ARRAY_SIZE(ath9k_legacy_rates); |
501 | } | 501 | } |
502 | 502 | ||
503 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { | 503 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) { |
504 | channels = kmemdup(ath9k_5ghz_chantable, | 504 | channels = kmemdup(ath9k_5ghz_chantable, |
505 | sizeof(ath9k_5ghz_chantable), GFP_KERNEL); | 505 | sizeof(ath9k_5ghz_chantable), GFP_KERNEL); |
506 | if (!channels) { | 506 | if (!channels) { |
@@ -681,17 +681,17 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
681 | hw->rate_control_algorithm = "ath9k_rate_control"; | 681 | hw->rate_control_algorithm = "ath9k_rate_control"; |
682 | #endif | 682 | #endif |
683 | 683 | ||
684 | if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) | 684 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) |
685 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | 685 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = |
686 | &sc->sbands[IEEE80211_BAND_2GHZ]; | 686 | &sc->sbands[IEEE80211_BAND_2GHZ]; |
687 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) | 687 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) |
688 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 688 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
689 | &sc->sbands[IEEE80211_BAND_5GHZ]; | 689 | &sc->sbands[IEEE80211_BAND_5GHZ]; |
690 | 690 | ||
691 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { | 691 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { |
692 | if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) | 692 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) |
693 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); | 693 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); |
694 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) | 694 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) |
695 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); | 695 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); |
696 | } | 696 | } |
697 | 697 | ||
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 2d3a67fc9bbf..0cee90cf8dc9 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -378,17 +378,6 @@ static const struct ath_rate_table ar5416_11g_ratetable = { | |||
378 | 0, /* Phy rates allowed initially */ | 378 | 0, /* Phy rates allowed initially */ |
379 | }; | 379 | }; |
380 | 380 | ||
381 | static const struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX] = { | ||
382 | [ATH9K_MODE_11A] = &ar5416_11a_ratetable, | ||
383 | [ATH9K_MODE_11G] = &ar5416_11g_ratetable, | ||
384 | [ATH9K_MODE_11NA_HT20] = &ar5416_11na_ratetable, | ||
385 | [ATH9K_MODE_11NG_HT20] = &ar5416_11ng_ratetable, | ||
386 | [ATH9K_MODE_11NA_HT40PLUS] = &ar5416_11na_ratetable, | ||
387 | [ATH9K_MODE_11NA_HT40MINUS] = &ar5416_11na_ratetable, | ||
388 | [ATH9K_MODE_11NG_HT40PLUS] = &ar5416_11ng_ratetable, | ||
389 | [ATH9K_MODE_11NG_HT40MINUS] = &ar5416_11ng_ratetable, | ||
390 | }; | ||
391 | |||
392 | static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, | 381 | static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, |
393 | struct ieee80211_tx_rate *rate); | 382 | struct ieee80211_tx_rate *rate); |
394 | 383 | ||
@@ -1200,38 +1189,23 @@ static void ath_rc_tx_status(struct ath_softc *sc, | |||
1200 | static const | 1189 | static const |
1201 | struct ath_rate_table *ath_choose_rate_table(struct ath_softc *sc, | 1190 | struct ath_rate_table *ath_choose_rate_table(struct ath_softc *sc, |
1202 | enum ieee80211_band band, | 1191 | enum ieee80211_band band, |
1203 | bool is_ht, | 1192 | bool is_ht) |
1204 | bool is_cw_40) | ||
1205 | { | 1193 | { |
1206 | int mode = 0; | ||
1207 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1194 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1208 | 1195 | ||
1209 | switch(band) { | 1196 | switch(band) { |
1210 | case IEEE80211_BAND_2GHZ: | 1197 | case IEEE80211_BAND_2GHZ: |
1211 | mode = ATH9K_MODE_11G; | ||
1212 | if (is_ht) | 1198 | if (is_ht) |
1213 | mode = ATH9K_MODE_11NG_HT20; | 1199 | return &ar5416_11ng_ratetable; |
1214 | if (is_cw_40) | 1200 | return &ar5416_11g_ratetable; |
1215 | mode = ATH9K_MODE_11NG_HT40PLUS; | ||
1216 | break; | ||
1217 | case IEEE80211_BAND_5GHZ: | 1201 | case IEEE80211_BAND_5GHZ: |
1218 | mode = ATH9K_MODE_11A; | ||
1219 | if (is_ht) | 1202 | if (is_ht) |
1220 | mode = ATH9K_MODE_11NA_HT20; | 1203 | return &ar5416_11na_ratetable; |
1221 | if (is_cw_40) | 1204 | return &ar5416_11a_ratetable; |
1222 | mode = ATH9K_MODE_11NA_HT40PLUS; | ||
1223 | break; | ||
1224 | default: | 1205 | default: |
1225 | ath_print(common, ATH_DBG_CONFIG, "Invalid band\n"); | 1206 | ath_print(common, ATH_DBG_CONFIG, "Invalid band\n"); |
1226 | return NULL; | 1207 | return NULL; |
1227 | } | 1208 | } |
1228 | |||
1229 | BUG_ON(mode >= ATH9K_MODE_MAX); | ||
1230 | |||
1231 | ath_print(common, ATH_DBG_CONFIG, | ||
1232 | "Choosing rate table for mode: %d\n", mode); | ||
1233 | |||
1234 | return hw_rate_table[mode]; | ||
1235 | } | 1209 | } |
1236 | 1210 | ||
1237 | static void ath_rc_init(struct ath_softc *sc, | 1211 | static void ath_rc_init(struct ath_softc *sc, |
@@ -1480,7 +1454,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
1480 | /* Choose rate table first */ | 1454 | /* Choose rate table first */ |
1481 | 1455 | ||
1482 | rate_table = ath_choose_rate_table(sc, sband->band, | 1456 | rate_table = ath_choose_rate_table(sc, sband->band, |
1483 | sta->ht_cap.ht_supported, is_cw40); | 1457 | sta->ht_cap.ht_supported); |
1484 | 1458 | ||
1485 | ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, is_cw40, is_sgi); | 1459 | ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, is_cw40, is_sgi); |
1486 | ath_rc_init(sc, priv_sta, sband, sta, rate_table); | 1460 | ath_rc_init(sc, priv_sta, sband, sta, rate_table); |
@@ -1520,8 +1494,7 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, | |||
1520 | 1494 | ||
1521 | if ((local_cw40 != oper_cw40) || (local_sgi != oper_sgi)) { | 1495 | if ((local_cw40 != oper_cw40) || (local_sgi != oper_sgi)) { |
1522 | rate_table = ath_choose_rate_table(sc, sband->band, | 1496 | rate_table = ath_choose_rate_table(sc, sband->band, |
1523 | sta->ht_cap.ht_supported, | 1497 | sta->ht_cap.ht_supported); |
1524 | oper_cw40); | ||
1525 | ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, | 1498 | ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, |
1526 | oper_cw40, oper_sgi); | 1499 | oper_cw40, oper_sgi); |
1527 | ath_rc_init(sc, priv_sta, sband, sta, rate_table); | 1500 | ath_rc_init(sc, priv_sta, sband, sta, rate_table); |