Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 5253ffb

Browse files
Karl Beldanjmberg-intel
authored andcommitted
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>
1 parent 2419ea1 commit 5253ffb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

net/mac80211/tx.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,19 +712,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
712712
}
713713

714714
/*
715-
* set up the RTS/CTS rate as the fastest basic rate
716-
* that is not faster than the data rate
715+
* Set up the RTS/CTS rate as the fastest basic rate
716+
* that is not faster than the data rate unless there
717+
* is no basic rate slower than the data rate, in which
718+
* case we pick the slowest basic rate
717719
*
718720
* XXX: Should this check all retry rates?
719721
*/
720722
if (!(info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) {
721-
s8 baserate = 0;
723+
u32 basic_rates = tx->sdata->vif.bss_conf.basic_rates;
724+
s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0;
722725

723726
rate = &sband->bitrates[info->control.rates[0].idx];
724727

725728
for (i = 0; i < sband->n_bitrates; i++) {
726729
/* must be a basic rate */
727-
if (!(tx->sdata->vif.bss_conf.basic_rates & BIT(i)))
730+
if (!(basic_rates & BIT(i)))
728731
continue;
729732
/* must not be faster than the data rate */
730733
if (sband->bitrates[i].bitrate > rate->bitrate)

0 commit comments

Comments
 (0)