aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2014-03-10 10:33:43 -0400
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-03-16 02:58:44 -0400
commit3ca71f603bb1a0f55e1ba24618ba45617bc36f70 (patch)
tree3f0f6ba7462342bf11e1fcb4dac38df90f3a8754 /drivers/net
parent0bd3c5a7abb1a4d280c9a209ac3ee17d67b60acb (diff)
iwlwifi: add rs_rate_scale_clear_tbl_windows helper function
instead of duplicating the same loop multiple times, use a new function for it. this will be later used also for clearing other windows in the table. Signed-off-by: Eliad Peller <eliadx.peller@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 953c33f4dd42..568abd61b14f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -503,6 +503,14 @@ static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
503 window->average_tpt = IWL_INVALID_VALUE; 503 window->average_tpt = IWL_INVALID_VALUE;
504} 504}
505 505
506static void rs_rate_scale_clear_tbl_windows(struct iwl_scale_tbl_info *tbl)
507{
508 int i;
509
510 for (i = 0; i < IWL_RATE_COUNT; i++)
511 rs_rate_scale_clear_window(&tbl->win[i]);
512}
513
506static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type) 514static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type)
507{ 515{
508 return (ant_type & valid_antenna) == ant_type; 516 return (ant_type & valid_antenna) == ant_type;
@@ -1370,7 +1378,6 @@ static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta)
1370static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) 1378static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1371{ 1379{
1372 struct iwl_scale_tbl_info *tbl; 1380 struct iwl_scale_tbl_info *tbl;
1373 int i;
1374 int active_tbl; 1381 int active_tbl;
1375 int flush_interval_passed = 0; 1382 int flush_interval_passed = 0;
1376 struct iwl_mvm *mvm; 1383 struct iwl_mvm *mvm;
@@ -1431,9 +1438,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1431 1438
1432 IWL_DEBUG_RATE(mvm, 1439 IWL_DEBUG_RATE(mvm,
1433 "LQ: stay in table clear win\n"); 1440 "LQ: stay in table clear win\n");
1434 for (i = 0; i < IWL_RATE_COUNT; i++) 1441 rs_rate_scale_clear_tbl_windows(tbl);
1435 rs_rate_scale_clear_window(
1436 &(tbl->win[i]));
1437 } 1442 }
1438 } 1443 }
1439 1444
@@ -1442,8 +1447,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1442 * "search" table). */ 1447 * "search" table). */
1443 if (lq_sta->rs_state == RS_STATE_SEARCH_CYCLE_STARTED) { 1448 if (lq_sta->rs_state == RS_STATE_SEARCH_CYCLE_STARTED) {
1444 IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); 1449 IWL_DEBUG_RATE(mvm, "Clearing up window stats\n");
1445 for (i = 0; i < IWL_RATE_COUNT; i++) 1450 rs_rate_scale_clear_tbl_windows(tbl);
1446 rs_rate_scale_clear_window(&(tbl->win[i]));
1447 } 1451 }
1448 } 1452 }
1449} 1453}
@@ -1733,7 +1737,6 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1733 int low = IWL_RATE_INVALID; 1737 int low = IWL_RATE_INVALID;
1734 int high = IWL_RATE_INVALID; 1738 int high = IWL_RATE_INVALID;
1735 int index; 1739 int index;
1736 int i;
1737 struct iwl_rate_scale_data *window = NULL; 1740 struct iwl_rate_scale_data *window = NULL;
1738 int current_tpt = IWL_INVALID_VALUE; 1741 int current_tpt = IWL_INVALID_VALUE;
1739 int low_tpt = IWL_INVALID_VALUE; 1742 int low_tpt = IWL_INVALID_VALUE;
@@ -2018,8 +2021,7 @@ lq_update:
2018 if (lq_sta->search_better_tbl) { 2021 if (lq_sta->search_better_tbl) {
2019 /* Access the "search" table, clear its history. */ 2022 /* Access the "search" table, clear its history. */
2020 tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 2023 tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
2021 for (i = 0; i < IWL_RATE_COUNT; i++) 2024 rs_rate_scale_clear_tbl_windows(tbl);
2022 rs_rate_scale_clear_window(&(tbl->win[i]));
2023 2025
2024 /* Use new "search" start rate */ 2026 /* Use new "search" start rate */
2025 index = tbl->rate.index; 2027 index = tbl->rate.index;
@@ -2340,8 +2342,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
2340 lq_sta->lq.sta_id = sta_priv->sta_id; 2342 lq_sta->lq.sta_id = sta_priv->sta_id;
2341 2343
2342 for (j = 0; j < LQ_SIZE; j++) 2344 for (j = 0; j < LQ_SIZE; j++)
2343 for (i = 0; i < IWL_RATE_COUNT; i++) 2345 rs_rate_scale_clear_tbl_windows(&lq_sta->lq_info[j]);
2344 rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
2345 2346
2346 lq_sta->flush_timer = 0; 2347 lq_sta->flush_timer = 0;
2347 2348