Commit 5c0ba62f authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

ath9k: fix rate control fallback rate selection

When selecting the tx fallback rate, rc.c used a separate variable
'nrix' for storing the next rate index, however it did not use that as
reference for further rate index lowering. Because of that, it ended up
reusing the same rate for multiple multi-rate retry stages, thus
decreasing delivery probability under changing link conditions.

This patch removes the separate (unnecessary) variable and fixes
fallback the way it was intended to work.
This should result in increased throughput and better link stability.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 54f2d736
...@@ -668,7 +668,7 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, ...@@ -668,7 +668,7 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
struct ieee80211_tx_rate *rates = tx_info->control.rates; struct ieee80211_tx_rate *rates = tx_info->control.rates;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
__le16 fc = hdr->frame_control; __le16 fc = hdr->frame_control;
u8 try_per_rate, i = 0, rix, nrix; u8 try_per_rate, i = 0, rix;
int is_probe = 0; int is_probe = 0;
if (rate_control_send_low(sta, priv_sta, txrc)) if (rate_control_send_low(sta, priv_sta, txrc))
...@@ -688,26 +688,25 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, ...@@ -688,26 +688,25 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
rate_table = sc->cur_rate_table; rate_table = sc->cur_rate_table;
rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, &is_probe); rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, &is_probe);
nrix = rix;
if (is_probe) { if (is_probe) {
/* set one try for probe rates. For the /* set one try for probe rates. For the
* probes don't enable rts */ * probes don't enable rts */
ath_rc_rate_set_series(rate_table, &rates[i++], txrc, ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
1, nrix, 0); 1, rix, 0);
/* Get the next tried/allowed rate. No RTS for the next series /* Get the next tried/allowed rate. No RTS for the next series
* after the probe rate * after the probe rate
*/ */
ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &nrix); ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix);
ath_rc_rate_set_series(rate_table, &rates[i++], txrc, ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
try_per_rate, nrix, 0); try_per_rate, rix, 0);
tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
} else { } else {
/* Set the choosen rate. No RTS for first series entry. */ /* Set the choosen rate. No RTS for first series entry. */
ath_rc_rate_set_series(rate_table, &rates[i++], txrc, ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
try_per_rate, nrix, 0); try_per_rate, rix, 0);
} }
/* Fill in the other rates for multirate retry */ /* Fill in the other rates for multirate retry */
...@@ -716,10 +715,10 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, ...@@ -716,10 +715,10 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
if (i + 1 == 4) if (i + 1 == 4)
try_per_rate = 8; try_per_rate = 8;
ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &nrix); ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix);
/* All other rates in the series have RTS enabled */ /* All other rates in the series have RTS enabled */
ath_rc_rate_set_series(rate_table, &rates[i], txrc, ath_rc_rate_set_series(rate_table, &rates[i], txrc,
try_per_rate, nrix, 1); try_per_rate, rix, 1);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment