summaryrefslogtreecommitdiff
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorKarl Beldan <karl.beldan@rivierawaves.com>2013-04-05 10:06:24 (GMT)
committerJohannes Berg <johannes.berg@intel.com>2013-04-11 10:08:20 (GMT)
commit5253ffb8c9e1f2bf25c2e85dc0be8f74f55cf1ce (patch)
treef5393fc2f054e68109748eea134b78424ddeb201 /net/mac80211/tx.c
parent2419ea14bb0dfabe740f1e005c0782db9bc56441 (diff)
downloadlinux-5253ffb8c9e1f2bf25c2e85dc0be8f74f55cf1ce.tar.xz
mac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates
When the 1st rate control entry is a pre-HT rate we want to set rts_cts_rate_idx "as the fastest basic rate that is not faster than the data rate"(code comments). But in case some bss allowed rate indexes are lower than the lowest bss basic rate, if the rate control selects a rate among the formers for its 1st rate control entry, rts_cts_rate_idx remains 0 and is not a basic rate index. This commit sets rts_cts_rate_idx to the lowest bss basic rate index in this situation. Note that the code assumes that lowest indexes == lowest bitrates. Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index aad0bf5..c93483f 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -712,19 +712,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
}
/*
- * set up the RTS/CTS rate as the fastest basic rate
- * that is not faster than the data rate
+ * Set up the RTS/CTS rate as the fastest basic rate
+ * that is not faster than the data rate unless there
+ * is no basic rate slower than the data rate, in which
+ * case we pick the slowest basic rate
*
* XXX: Should this check all retry rates?
*/
if (!(info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) {
- s8 baserate = 0;
+ u32 basic_rates = tx->sdata->vif.bss_conf.basic_rates;
+ s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0;
rate = &sband->bitrates[info->control.rates[0].idx];
for (i = 0; i < sband->n_bitrates; i++) {
/* must be a basic rate */
- if (!(tx->sdata->vif.bss_conf.basic_rates & BIT(i)))
+ if (!(basic_rates & BIT(i)))
continue;
/* must not be faster than the data rate */
if (sband->bitrates[i].bitrate > rate->bitrate)