Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae17e986 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

mac80211: move txrate_idx into RC algorithms



The sta_info->txrate_idx member isn't used by all RC algorithms
in the way it was intended to be used, move it into those that
require it (only PID) and keep track in the core code of which
rate was last used for reporting to userspace and the mesh MLME.

Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 323ce79a
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -2039,7 +2039,6 @@ static void ath_rate_init(void *priv, void *priv_sta,
	DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
	DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);


	sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
	sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
	sta->txrate_idx = rate_lowest_index(local, sband, sta);


	ath_setup_rates(local, sta);
	ath_setup_rates(local, sta);
	if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
	if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
+3 −7
Original line number Original line Diff line number Diff line
@@ -334,13 +334,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,


	for (i = IWL_RATE_COUNT - 1; i >= 0; i--) {
	for (i = IWL_RATE_COUNT - 1; i >= 0; i--) {
		if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) {
		if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) {
			sta->txrate_idx = i;
			rs_sta->last_txrate_idx = i;
			break;
			break;
		}
		}
	}
	}


	rs_sta->last_txrate_idx = sta->txrate_idx;

	/* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */
	/* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */
	if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
	if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
		rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
		rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
@@ -809,15 +807,13 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,


	rs_sta->last_txrate_idx = index;
	rs_sta->last_txrate_idx = index;
	if (sband->band == IEEE80211_BAND_5GHZ)
	if (sband->band == IEEE80211_BAND_5GHZ)
		sta->txrate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE;
		sel->rate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE;
	else
	else
		sta->txrate_idx = rs_sta->last_txrate_idx;
		sel->rate_idx = rs_sta->last_txrate_idx;


	rcu_read_unlock();
	rcu_read_unlock();


	IWL_DEBUG_RATE("leave: %d\n", index);
	IWL_DEBUG_RATE("leave: %d\n", index);

	sel->rate_idx = sta->txrate_idx;
}
}


static struct rate_control_ops rs_ops = {
static struct rate_control_ops rs_ops = {
+2 −11
Original line number Original line Diff line number Diff line
@@ -2064,14 +2064,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
	i = index;
	i = index;
	lq_sta->last_txrate_idx = i;
	lq_sta->last_txrate_idx = i;


	/* sta->txrate_idx is an index to A mode rates which start
	 * at IWL_FIRST_OFDM_RATE
	 */
	if (lq_sta->band == IEEE80211_BAND_5GHZ)
		sta->txrate_idx = i - IWL_FIRST_OFDM_RATE;
	else
		sta->txrate_idx = i;

	return;
	return;
}
}


@@ -2234,7 +2226,6 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,


	lq_sta->flush_timer = 0;
	lq_sta->flush_timer = 0;
	lq_sta->supp_rates = sta->sta.supp_rates[sband->band];
	lq_sta->supp_rates = sta->sta.supp_rates[sband->band];
	sta->txrate_idx = 3;
	for (j = 0; j < LQ_SIZE; j++)
	for (j = 0; j < LQ_SIZE; j++)
		for (i = 0; i < IWL_RATE_COUNT; i++)
		for (i = 0; i < IWL_RATE_COUNT; i++)
			rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
			rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
@@ -2269,11 +2260,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
	}
	}


	/* Find highest tx rate supported by hardware and destination station */
	/* Find highest tx rate supported by hardware and destination station */
	lq_sta->last_txrate_idx = 3;
	for (i = 0; i < sband->n_bitrates; i++)
	for (i = 0; i < sband->n_bitrates; i++)
		if (sta->sta.supp_rates[sband->band] & BIT(i))
		if (sta->sta.supp_rates[sband->band] & BIT(i))
			sta->txrate_idx = i;
			lq_sta->last_txrate_idx = i;


	lq_sta->last_txrate_idx = sta->txrate_idx;
	/* For MODE_IEEE80211A, skip over cck rates in global rate table */
	/* For MODE_IEEE80211A, skip over cck rates in global rate table */
	if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
	if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
		lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
		lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
+1 −1
Original line number Original line Diff line number Diff line
@@ -223,7 +223,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,
	/* bitrate is in units of 100 Kbps, while we need rate in units of
	/* bitrate is in units of 100 Kbps, while we need rate in units of
	 * 1Mbps. This will be corrected on tx_time computation.
	 * 1Mbps. This will be corrected on tx_time computation.
	 */
	 */
	rate = sband->bitrates[sta->txrate_idx].bitrate;
	rate = sband->bitrates[sta->last_txrate_idx].bitrate;
	tx_time = (device_constant + 10 * test_frame_len / rate);
	tx_time = (device_constant + 10 * test_frame_len / rate);
	estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err));
	estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err));
	result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ;
	result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ;
+2 −0
Original line number Original line Diff line number Diff line
@@ -180,6 +180,8 @@ struct rc_pid_sta_info {
	u32 tx_num_failed;
	u32 tx_num_failed;
	u32 tx_num_xmit;
	u32 tx_num_xmit;


	int txrate_idx;

	/* Average failed frames percentage error (i.e. actual vs. target
	/* Average failed frames percentage error (i.e. actual vs. target
	 * percentage), scaled by RC_PID_SMOOTHING. This value is computed
	 * percentage), scaled by RC_PID_SMOOTHING. This value is computed
	 * using using an exponential weighted average technique:
	 * using using an exponential weighted average technique:
Loading