Commit b7e35008 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: move last_txrate_idx into RC algorithms

This variable in sta_info is only used in a meaningful way
by the Intel RC algorithms, so move it into those.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 95dac040
...@@ -65,6 +65,9 @@ struct iwl3945_rs_sta { ...@@ -65,6 +65,9 @@ struct iwl3945_rs_sta {
u8 ibss_sta_added; u8 ibss_sta_added;
struct timer_list rate_scale_flush; struct timer_list rate_scale_flush;
struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; struct iwl3945_rate_scale_data win[IWL_RATE_COUNT];
/* used to be in sta_info */
int last_txrate_idx;
}; };
static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = {
...@@ -319,6 +322,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, ...@@ -319,6 +322,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
static void rs_rate_init(void *priv_rate, void *priv_sta, static void rs_rate_init(void *priv_rate, void *priv_sta,
struct ieee80211_local *local, struct sta_info *sta) struct ieee80211_local *local, struct sta_info *sta)
{ {
struct iwl3945_rs_sta *rs_sta = (void *)sta->rate_ctrl_priv;
int i; int i;
IWL_DEBUG_RATE("enter\n"); IWL_DEBUG_RATE("enter\n");
...@@ -335,11 +339,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, ...@@ -335,11 +339,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
} }
} }
sta->last_txrate_idx = sta->txrate_idx; 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)
sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
IWL_DEBUG_RATE("leave\n"); IWL_DEBUG_RATE("leave\n");
} }
...@@ -674,14 +678,14 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, ...@@ -674,14 +678,14 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
return; return;
} }
rs_sta = (void *)sta->rate_ctrl_priv;
rate_mask = sta->supp_rates[sband->band]; rate_mask = sta->supp_rates[sband->band];
index = min(sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1);
if (sband->band == IEEE80211_BAND_5GHZ) if (sband->band == IEEE80211_BAND_5GHZ)
rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; rate_mask = rate_mask << IWL_FIRST_OFDM_RATE;
rs_sta = (void *)sta->rate_ctrl_priv;
if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
!rs_sta->ibss_sta_added) { !rs_sta->ibss_sta_added) {
u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
...@@ -803,11 +807,11 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, ...@@ -803,11 +807,11 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
out: out:
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 = sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; sta->txrate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE;
else else
sta->txrate_idx = sta->last_txrate_idx; sta->txrate_idx = rs_sta->last_txrate_idx;
rcu_read_unlock(); rcu_read_unlock();
......
...@@ -163,6 +163,9 @@ struct iwl_lq_sta { ...@@ -163,6 +163,9 @@ struct iwl_lq_sta {
u32 dbg_fixed_rate; u32 dbg_fixed_rate;
#endif #endif
struct iwl_priv *drv; struct iwl_priv *drv;
/* used to be in sta_info */
int last_txrate_idx;
}; };
static void rs_rate_scale_perform(struct iwl_priv *priv, static void rs_rate_scale_perform(struct iwl_priv *priv,
...@@ -1746,7 +1749,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, ...@@ -1746,7 +1749,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
is_green = lq_sta->is_green; is_green = lq_sta->is_green;
/* current tx rate */ /* current tx rate */
index = sta->last_txrate_idx; index = lq_sta->last_txrate_idx;
IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index,
tbl->lq_type); tbl->lq_type);
...@@ -2059,7 +2062,7 @@ lq_update: ...@@ -2059,7 +2062,7 @@ lq_update:
out: out:
tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green); tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green);
i = index; i = index;
sta->last_txrate_idx = i; lq_sta->last_txrate_idx = i;
/* sta->txrate_idx is an index to A mode rates which start /* sta->txrate_idx is an index to A mode rates which start
* at IWL_FIRST_OFDM_RATE * at IWL_FIRST_OFDM_RATE
...@@ -2090,7 +2093,7 @@ static void rs_initialize_lq(struct iwl_priv *priv, ...@@ -2090,7 +2093,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
goto out; goto out;
lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
i = sta->last_txrate_idx; i = lq_sta->last_txrate_idx;
if ((lq_sta->lq.sta_id == 0xff) && if ((lq_sta->lq.sta_id == 0xff) &&
(priv->iw_mode == NL80211_IFTYPE_ADHOC)) (priv->iw_mode == NL80211_IFTYPE_ADHOC))
...@@ -2161,7 +2164,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, ...@@ -2161,7 +2164,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
} }
lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
i = sta->last_txrate_idx; i = lq_sta->last_txrate_idx;
if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
!lq_sta->ibss_sta_added) { !lq_sta->ibss_sta_added) {
...@@ -2270,10 +2273,10 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, ...@@ -2270,10 +2273,10 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
if (sta->supp_rates[sband->band] & BIT(i)) if (sta->supp_rates[sband->band] & BIT(i))
sta->txrate_idx = i; sta->txrate_idx = i;
sta->last_txrate_idx = sta->txrate_idx; 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)
sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
lq_sta->is_dup = 0; lq_sta->is_dup = 0;
lq_sta->is_green = rs_use_green(priv, conf); lq_sta->is_green = rs_use_green(priv, conf);
......
...@@ -329,8 +329,6 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev, ...@@ -329,8 +329,6 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev,
if (rateidx >= sband->n_bitrates) if (rateidx >= sband->n_bitrates)
rateidx = sband->n_bitrates - 1; rateidx = sband->n_bitrates - 1;
sta->last_txrate_idx = rateidx;
rcu_read_unlock(); rcu_read_unlock();
sel->rate_idx = rateidx; sel->rate_idx = rateidx;
......
...@@ -200,7 +200,6 @@ struct sta_ampdu_mlme { ...@@ -200,7 +200,6 @@ struct sta_ampdu_mlme {
* @tx_bytes: TBD * @tx_bytes: TBD
* @tx_fragments: number of transmitted MPDUs * @tx_fragments: number of transmitted MPDUs
* @txrate_idx: TBD * @txrate_idx: TBD
* @last_txrate_idx: TBD
* @tid_seq: TBD * @tid_seq: TBD
* @wme_tx_queue: TBD * @wme_tx_queue: TBD
* @ampdu_mlme: TBD * @ampdu_mlme: TBD
...@@ -278,7 +277,6 @@ struct sta_info { ...@@ -278,7 +277,6 @@ struct sta_info {
unsigned long tx_bytes; unsigned long tx_bytes;
unsigned long tx_fragments; unsigned long tx_fragments;
int txrate_idx; int txrate_idx;
int last_txrate_idx;
u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
#ifdef CONFIG_MAC80211_DEBUG_COUNTERS #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
......
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