mac80211: update to wireless-testing 2010-10-15, add a few ath9k fixes and performanc...
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 541-ath9k_rc_rate_table_cleanup.patch
1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -624,8 +624,6 @@ struct ath_softc {
4 struct ath_rx rx;
5 struct ath_tx tx;
6 struct ath_beacon beacon;
7 - const struct ath_rate_table *cur_rate_table;
8 - enum wireless_mode cur_rate_mode;
9 struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
10
11 struct ath_led radio_led;
12 --- a/drivers/net/wireless/ath/ath9k/main.c
13 +++ b/drivers/net/wireless/ath/ath9k/main.c
14 @@ -19,36 +19,6 @@
15 #include "ath9k.h"
16 #include "btcoex.h"
17
18 -static void ath_cache_conf_rate(struct ath_softc *sc,
19 - struct ieee80211_conf *conf)
20 -{
21 - switch (conf->channel->band) {
22 - case IEEE80211_BAND_2GHZ:
23 - if (conf_is_ht20(conf))
24 - sc->cur_rate_mode = ATH9K_MODE_11NG_HT20;
25 - else if (conf_is_ht40_minus(conf))
26 - sc->cur_rate_mode = ATH9K_MODE_11NG_HT40MINUS;
27 - else if (conf_is_ht40_plus(conf))
28 - sc->cur_rate_mode = ATH9K_MODE_11NG_HT40PLUS;
29 - else
30 - sc->cur_rate_mode = ATH9K_MODE_11G;
31 - break;
32 - case IEEE80211_BAND_5GHZ:
33 - if (conf_is_ht20(conf))
34 - sc->cur_rate_mode = ATH9K_MODE_11NA_HT20;
35 - else if (conf_is_ht40_minus(conf))
36 - sc->cur_rate_mode = ATH9K_MODE_11NA_HT40MINUS;
37 - else if (conf_is_ht40_plus(conf))
38 - sc->cur_rate_mode = ATH9K_MODE_11NA_HT40PLUS;
39 - else
40 - sc->cur_rate_mode = ATH9K_MODE_11A;
41 - break;
42 - default:
43 - BUG_ON(1);
44 - break;
45 - }
46 -}
47 -
48 static void ath_update_txpow(struct ath_softc *sc)
49 {
50 struct ath_hw *ah = sc->sc_ah;
51 @@ -307,7 +277,6 @@ int ath_set_channel(struct ath_softc *sc
52 goto ps_restore;
53 }
54
55 - ath_cache_conf_rate(sc, &hw->conf);
56 ath_update_txpow(sc);
57 ath9k_hw_set_interrupts(ah, ah->imask);
58
59 @@ -1014,8 +983,6 @@ int ath_reset(struct ath_softc *sc, bool
60 * that changes the channel so update any state that
61 * might change as a result.
62 */
63 - ath_cache_conf_rate(sc, &hw->conf);
64 -
65 ath_update_txpow(sc);
66
67 if ((sc->sc_flags & SC_OP_BEACONS) || !(sc->sc_flags & (SC_OP_OFFCHANNEL)))
68 @@ -1222,8 +1189,6 @@ static int ath9k_start(struct ieee80211_
69 if (ah->caps.hw_caps & ATH9K_HW_CAP_HT)
70 ah->imask |= ATH9K_INT_CST;
71
72 - ath_cache_conf_rate(sc, &hw->conf);
73 -
74 sc->sc_flags &= ~SC_OP_INVALID;
75
76 /* Disable BMISS interrupt when we're not associated */
77 --- a/drivers/net/wireless/ath/ath9k/rc.c
78 +++ b/drivers/net/wireless/ath/ath9k/rc.c
79 @@ -791,7 +791,7 @@ static void ath_get_rate(void *priv, str
80 */
81 try_per_rate = 4;
82
83 - rate_table = sc->cur_rate_table;
84 + rate_table = ath_rc_priv->rate_table;
85 rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, &is_probe);
86
87 /*
88 @@ -1048,7 +1048,7 @@ static void ath_rc_update_ht(struct ath_
89 int rate;
90 u8 last_per;
91 bool state_change = false;
92 - const struct ath_rate_table *rate_table = sc->cur_rate_table;
93 + const struct ath_rate_table *rate_table = ath_rc_priv->rate_table;
94 int size = ath_rc_priv->rate_table_size;
95
96 if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt))
97 @@ -1150,7 +1150,7 @@ static void ath_rc_tx_status(struct ath_
98 u8 flags;
99 u32 i = 0, rix;
100
101 - rate_table = sc->cur_rate_table;
102 + rate_table = ath_rc_priv->rate_table;
103
104 /*
105 * If the first rate is not the final index, there
106 @@ -1231,7 +1231,6 @@ struct ath_rate_table *ath_choose_rate_t
107 ath_print(common, ATH_DBG_CONFIG,
108 "Choosing rate table for mode: %d\n", mode);
109
110 - sc->cur_rate_mode = mode;
111 return hw_rate_table[mode];
112 }
113
114 @@ -1303,7 +1302,6 @@ static void ath_rc_init(struct ath_softc
115 ath_rc_priv->max_valid_rate = k;
116 ath_rc_sort_validrates(rate_table, ath_rc_priv);
117 ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4];
118 - sc->cur_rate_table = rate_table;
119 ath_rc_priv->rate_table = rate_table;
120
121 ath_print(common, ATH_DBG_CONFIG,
122 @@ -1439,8 +1437,9 @@ static void ath_tx_status(void *priv, st
123 }
124 }
125
126 - ath_debug_stat_rc(ath_rc_priv, ath_rc_get_rateindex(sc->cur_rate_table,
127 - &tx_info->status.rates[final_ts_idx]));
128 + ath_debug_stat_rc(ath_rc_priv,
129 + ath_rc_get_rateindex(ath_rc_priv->rate_table,
130 + &tx_info->status.rates[final_ts_idx]));
131 }
132
133 static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
134 @@ -1480,14 +1479,8 @@ static void ath_rate_init(void *priv, st
135
136 /* Choose rate table first */
137
138 - if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) ||
139 - (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) ||
140 - (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)) {
141 - rate_table = ath_choose_rate_table(sc, sband->band,
142 - sta->ht_cap.ht_supported, is_cw40);
143 - } else {
144 - rate_table = hw_rate_table[sc->cur_rate_mode];
145 - }
146 + rate_table = ath_choose_rate_table(sc, sband->band,
147 + sta->ht_cap.ht_supported, is_cw40);
148
149 ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, is_cw40, is_sgi);
150 ath_rc_init(sc, priv_sta, sband, sta, rate_table);
151 @@ -1536,7 +1529,6 @@ static void ath_rate_update(void *priv,
152 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG,
153 "Operating HT Bandwidth changed to: %d\n",
154 sc->hw->conf.channel_type);
155 - sc->cur_rate_table = hw_rate_table[sc->cur_rate_mode];
156 }
157 }
158 }