Skip to content

Commit

Permalink
iwlwifi: mvm: rs: clear per rate stats when aggregation changes
Browse files Browse the repository at this point in the history
The per rate stats should be cleared when aggregation state changes
to avoid making rate scale decisions based on throughput figures which
were collected prior to the aggregation state change and are now stale.
While at it make sure any clearing of the per rate stats will get logged.

Cc: <stable@vger.kernel.org> [3.14]
Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  • Loading branch information
Eyal Shapira authored and Emmanuel Grumbach committed Apr 13, 2014
1 parent d8fff91 commit b804eeb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/net/wireless/iwlwifi/mvm/rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,12 @@ static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
window->average_tpt = IWL_INVALID_VALUE;
}

static void rs_rate_scale_clear_tbl_windows(struct iwl_scale_tbl_info *tbl)
static void rs_rate_scale_clear_tbl_windows(struct iwl_mvm *mvm,
struct iwl_scale_tbl_info *tbl)
{
int i;

IWL_DEBUG_RATE(mvm, "Clearing up window stats\n");
for (i = 0; i < IWL_RATE_COUNT; i++)
rs_rate_scale_clear_window(&tbl->win[i]);
}
Expand Down Expand Up @@ -1490,16 +1492,15 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)

IWL_DEBUG_RATE(mvm,
"LQ: stay in table clear win\n");
rs_rate_scale_clear_tbl_windows(tbl);
rs_rate_scale_clear_tbl_windows(mvm, tbl);
}
}

/* If transitioning to allow "search", reset all history
* bitmaps and stats in active table (this will become the new
* "search" table). */
if (lq_sta->rs_state == RS_STATE_SEARCH_CYCLE_STARTED) {
IWL_DEBUG_RATE(mvm, "Clearing up window stats\n");
rs_rate_scale_clear_tbl_windows(tbl);
rs_rate_scale_clear_tbl_windows(mvm, tbl);
}
}
}
Expand Down Expand Up @@ -1836,6 +1837,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
"Aggregation changed: prev %d current %d. Update expected TPT table\n",
prev_agg, lq_sta->is_agg);
rs_set_expected_tpt_table(lq_sta, tbl);
rs_rate_scale_clear_tbl_windows(mvm, tbl);
}

/* current tx rate */
Expand Down Expand Up @@ -2065,7 +2067,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
if (lq_sta->search_better_tbl) {
/* Access the "search" table, clear its history. */
tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
rs_rate_scale_clear_tbl_windows(tbl);
rs_rate_scale_clear_tbl_windows(mvm, tbl);

/* Use new "search" start rate */
index = tbl->rate.index;
Expand Down Expand Up @@ -2396,7 +2398,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
lq_sta->lq.sta_id = sta_priv->sta_id;

for (j = 0; j < LQ_SIZE; j++)
rs_rate_scale_clear_tbl_windows(&lq_sta->lq_info[j]);
rs_rate_scale_clear_tbl_windows(mvm, &lq_sta->lq_info[j]);

lq_sta->flush_timer = 0;
lq_sta->last_tx = jiffies;
Expand Down

0 comments on commit b804eeb

Please sign in to comment.