aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath9k/recv.c61
1 files changed, 26 insertions, 35 deletions
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index f2327d8e9c28..cc160fe9f817 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -111,33 +111,6 @@ static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, u32 len)
111 return skb; 111 return skb;
112} 112}
113 113
114static int ath_rate2idx(struct ath_softc *sc, int rate)
115{
116 int i = 0, cur_band, n_rates;
117 struct ieee80211_hw *hw = sc->hw;
118
119 cur_band = hw->conf.channel->band;
120 n_rates = sc->sbands[cur_band].n_bitrates;
121
122 for (i = 0; i < n_rates; i++) {
123 if (sc->sbands[cur_band].bitrates[i].bitrate == rate)
124 break;
125 }
126
127 /*
128 * NB:mac80211 validates rx rate index against the supported legacy rate
129 * index only (should be done against ht rates also), return the highest
130 * legacy rate index for rx rate which does not match any one of the
131 * supported basic and extended rates to make mac80211 happy.
132 * The following hack will be cleaned up once the issue with
133 * the rx rate index validation in mac80211 is fixed.
134 */
135 if (i == n_rates)
136 return n_rates - 1;
137
138 return i;
139}
140
141/* 114/*
142 * For Decrypt or Demic errors, we only mark packet status here and always push 115 * For Decrypt or Demic errors, we only mark packet status here and always push
143 * up the frame up to let mac80211 handle the actual error case, be it no 116 * up the frame up to let mac80211 handle the actual error case, be it no
@@ -147,9 +120,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
147 struct ieee80211_rx_status *rx_status, bool *decrypt_error, 120 struct ieee80211_rx_status *rx_status, bool *decrypt_error,
148 struct ath_softc *sc) 121 struct ath_softc *sc)
149{ 122{
150 struct ath_rate_table *rate_table = sc->cur_rate_table;
151 struct ieee80211_hdr *hdr; 123 struct ieee80211_hdr *hdr;
152 int ratekbps, rix;
153 u8 ratecode; 124 u8 ratecode;
154 __le16 fc; 125 __le16 fc;
155 126
@@ -204,15 +175,36 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
204 } 175 }
205 176
206 ratecode = ds->ds_rxstat.rs_rate; 177 ratecode = ds->ds_rxstat.rs_rate;
207 rix = rate_table->rateCodeToIndex[ratecode];
208 ratekbps = rate_table->info[rix].ratekbps;
209 178
210 /* HT rate */
211 if (ratecode & 0x80) { 179 if (ratecode & 0x80) {
180 /* HT rate */
181 rx_status->flag |= RX_FLAG_HT;
212 if (ds->ds_rxstat.rs_flags & ATH9K_RX_2040) 182 if (ds->ds_rxstat.rs_flags & ATH9K_RX_2040)
213 ratekbps = (ratekbps * 27) / 13; 183 rx_status->flag |= RX_FLAG_40MHZ;
214 if (ds->ds_rxstat.rs_flags & ATH9K_RX_GI) 184 if (ds->ds_rxstat.rs_flags & ATH9K_RX_GI)
215 ratekbps = (ratekbps * 10) / 9; 185 rx_status->flag |= RX_FLAG_SHORT_GI;
186 rx_status->rate_idx = ratecode & 0x7f;
187 } else {
188 int i = 0, cur_band, n_rates;
189 struct ieee80211_hw *hw = sc->hw;
190
191 cur_band = hw->conf.channel->band;
192 n_rates = sc->sbands[cur_band].n_bitrates;
193
194 for (i = 0; i < n_rates; i++) {
195 if (sc->sbands[cur_band].bitrates[i].hw_value ==
196 ratecode) {
197 rx_status->rate_idx = i;
198 break;
199 }
200
201 if (sc->sbands[cur_band].bitrates[i].hw_value_short ==
202 ratecode) {
203 rx_status->rate_idx = i;
204 rx_status->flag |= RX_FLAG_SHORTPRE;
205 break;
206 }
207 }
216 } 208 }
217 209
218 rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp); 210 rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp);
@@ -220,7 +212,6 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
220 rx_status->freq = sc->hw->conf.channel->center_freq; 212 rx_status->freq = sc->hw->conf.channel->center_freq;
221 rx_status->noise = sc->sc_ani.sc_noise_floor; 213 rx_status->noise = sc->sc_ani.sc_noise_floor;
222 rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi; 214 rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi;
223 rx_status->rate_idx = ath_rate2idx(sc, (ratekbps / 100));
224 rx_status->antenna = ds->ds_rxstat.rs_antenna; 215 rx_status->antenna = ds->ds_rxstat.rs_antenna;
225 216
226 /* at 45 you will be able to use MCS 15 reliably. A more elaborate 217 /* at 45 you will be able to use MCS 15 reliably. A more elaborate