diff options
author | Eyal Shapira <eyal@wizery.com> | 2014-03-31 15:37:39 -0400 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-04-13 09:51:03 -0400 |
commit | 198266a3c110e8a68895a24e937003f5da0c5f60 (patch) | |
tree | 05f862de53c0a649906785f7de1b7f3295002e16 /drivers/net | |
parent | 08a732f4e4a842f0101e5ea03d79e9d613ffadbe (diff) |
iwlwifi: mvm: rs: use correct max expected throughput figures
The selection of the max expected throughput for a column
didn't take into account the maximal allowed rate for the current
peer. This can cause unnecessary switches during the search cycle
to columns which have no chance of beating the current throughput.
Signed-off-by: Eyal Shapira <eyalx.shapira@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.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/rs.h | 12 |
2 files changed, 51 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index dd13629d0187..cd32ad54384e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
@@ -1186,9 +1186,26 @@ static void rs_set_stay_in_table(struct iwl_mvm *mvm, u8 is_legacy, | |||
1186 | lq_sta->visited_columns = 0; | 1186 | lq_sta->visited_columns = 0; |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | static int rs_get_max_allowed_rate(struct iwl_lq_sta *lq_sta, | ||
1190 | const struct rs_tx_column *column) | ||
1191 | { | ||
1192 | switch (column->mode) { | ||
1193 | case RS_LEGACY: | ||
1194 | return lq_sta->max_legacy_rate_idx; | ||
1195 | case RS_SISO: | ||
1196 | return lq_sta->max_siso_rate_idx; | ||
1197 | case RS_MIMO2: | ||
1198 | return lq_sta->max_mimo2_rate_idx; | ||
1199 | default: | ||
1200 | WARN_ON_ONCE(1); | ||
1201 | } | ||
1202 | |||
1203 | return lq_sta->max_legacy_rate_idx; | ||
1204 | } | ||
1205 | |||
1189 | static const u16 *rs_get_expected_tpt_table(struct iwl_lq_sta *lq_sta, | 1206 | static const u16 *rs_get_expected_tpt_table(struct iwl_lq_sta *lq_sta, |
1190 | const struct rs_tx_column *column, | 1207 | const struct rs_tx_column *column, |
1191 | u32 bw) | 1208 | u32 bw) |
1192 | { | 1209 | { |
1193 | /* Used to choose among HT tables */ | 1210 | /* Used to choose among HT tables */ |
1194 | const u16 (*ht_tbl_pointer)[IWL_RATE_COUNT]; | 1211 | const u16 (*ht_tbl_pointer)[IWL_RATE_COUNT]; |
@@ -1485,14 +1502,14 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
1485 | struct ieee80211_sta *sta, | 1502 | struct ieee80211_sta *sta, |
1486 | struct iwl_scale_tbl_info *tbl) | 1503 | struct iwl_scale_tbl_info *tbl) |
1487 | { | 1504 | { |
1488 | int i, j, n; | 1505 | int i, j, max_rate; |
1489 | enum rs_column next_col_id; | 1506 | enum rs_column next_col_id; |
1490 | const struct rs_tx_column *curr_col = &rs_tx_columns[tbl->column]; | 1507 | const struct rs_tx_column *curr_col = &rs_tx_columns[tbl->column]; |
1491 | const struct rs_tx_column *next_col; | 1508 | const struct rs_tx_column *next_col; |
1492 | allow_column_func_t allow_func; | 1509 | allow_column_func_t allow_func; |
1493 | u8 valid_ants = mvm->fw->valid_tx_ant; | 1510 | u8 valid_ants = mvm->fw->valid_tx_ant; |
1494 | const u16 *expected_tpt_tbl; | 1511 | const u16 *expected_tpt_tbl; |
1495 | s32 tpt, max_expected_tpt; | 1512 | u16 tpt, max_expected_tpt; |
1496 | 1513 | ||
1497 | for (i = 0; i < MAX_NEXT_COLUMNS; i++) { | 1514 | for (i = 0; i < MAX_NEXT_COLUMNS; i++) { |
1498 | next_col_id = curr_col->next_columns[i]; | 1515 | next_col_id = curr_col->next_columns[i]; |
@@ -1535,11 +1552,11 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
1535 | if (WARN_ON_ONCE(!expected_tpt_tbl)) | 1552 | if (WARN_ON_ONCE(!expected_tpt_tbl)) |
1536 | continue; | 1553 | continue; |
1537 | 1554 | ||
1538 | max_expected_tpt = 0; | 1555 | max_rate = rs_get_max_allowed_rate(lq_sta, next_col); |
1539 | for (n = 0; n < IWL_RATE_COUNT; n++) | 1556 | if (WARN_ON_ONCE(max_rate == IWL_RATE_INVALID)) |
1540 | if (expected_tpt_tbl[n] > max_expected_tpt) | 1557 | continue; |
1541 | max_expected_tpt = expected_tpt_tbl[n]; | ||
1542 | 1558 | ||
1559 | max_expected_tpt = expected_tpt_tbl[max_rate]; | ||
1543 | if (tpt >= max_expected_tpt) { | 1560 | if (tpt >= max_expected_tpt) { |
1544 | IWL_DEBUG_RATE(mvm, | 1561 | IWL_DEBUG_RATE(mvm, |
1545 | "Skip column %d: can't beat current TPT. Max expected %d current %d\n", | 1562 | "Skip column %d: can't beat current TPT. Max expected %d current %d\n", |
@@ -1547,14 +1564,15 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
1547 | continue; | 1564 | continue; |
1548 | } | 1565 | } |
1549 | 1566 | ||
1567 | IWL_DEBUG_RATE(mvm, | ||
1568 | "Found potential column %d. Max expected %d current %d\n", | ||
1569 | next_col_id, max_expected_tpt, tpt); | ||
1550 | break; | 1570 | break; |
1551 | } | 1571 | } |
1552 | 1572 | ||
1553 | if (i == MAX_NEXT_COLUMNS) | 1573 | if (i == MAX_NEXT_COLUMNS) |
1554 | return RS_COLUMN_INVALID; | 1574 | return RS_COLUMN_INVALID; |
1555 | 1575 | ||
1556 | IWL_DEBUG_RATE(mvm, "Found potential column %d\n", next_col_id); | ||
1557 | |||
1558 | return next_col_id; | 1576 | return next_col_id; |
1559 | } | 1577 | } |
1560 | 1578 | ||
@@ -2388,11 +2406,22 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
2388 | lq_sta->is_vht = true; | 2406 | lq_sta->is_vht = true; |
2389 | } | 2407 | } |
2390 | 2408 | ||
2391 | IWL_DEBUG_RATE(mvm, | 2409 | lq_sta->max_legacy_rate_idx = find_last_bit(&lq_sta->active_legacy_rate, |
2392 | "SISO-RATE=%X MIMO2-RATE=%X VHT=%d\n", | 2410 | BITS_PER_LONG); |
2411 | lq_sta->max_siso_rate_idx = find_last_bit(&lq_sta->active_siso_rate, | ||
2412 | BITS_PER_LONG); | ||
2413 | lq_sta->max_mimo2_rate_idx = find_last_bit(&lq_sta->active_mimo2_rate, | ||
2414 | BITS_PER_LONG); | ||
2415 | |||
2416 | IWL_DEBUG_RATE(mvm, "RATE MASK: LEGACY=%lX SISO=%lX MIMO2=%lX VHT=%d\n", | ||
2417 | lq_sta->active_legacy_rate, | ||
2393 | lq_sta->active_siso_rate, | 2418 | lq_sta->active_siso_rate, |
2394 | lq_sta->active_mimo2_rate, | 2419 | lq_sta->active_mimo2_rate, |
2395 | lq_sta->is_vht); | 2420 | lq_sta->is_vht); |
2421 | IWL_DEBUG_RATE(mvm, "MAX RATE: LEGACY=%d SISO=%d MIMO2=%d\n", | ||
2422 | lq_sta->max_legacy_rate_idx, | ||
2423 | lq_sta->max_siso_rate_idx, | ||
2424 | lq_sta->max_mimo2_rate_idx); | ||
2396 | 2425 | ||
2397 | /* These values will be overridden later */ | 2426 | /* These values will be overridden later */ |
2398 | lq_sta->lq.single_stream_ant_msk = | 2427 | lq_sta->lq.single_stream_ant_msk = |
@@ -2750,7 +2779,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2750 | return -ENOMEM; | 2779 | return -ENOMEM; |
2751 | 2780 | ||
2752 | desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); | 2781 | desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); |
2753 | desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", | 2782 | desc += sprintf(buff+desc, "failed=%d success=%d rate=0%lX\n", |
2754 | lq_sta->total_failed, lq_sta->total_success, | 2783 | lq_sta->total_failed, lq_sta->total_success, |
2755 | lq_sta->active_legacy_rate); | 2784 | lq_sta->active_legacy_rate); |
2756 | desc += sprintf(buff+desc, "fixed rate 0x%X\n", | 2785 | desc += sprintf(buff+desc, "fixed rate 0x%X\n", |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h index 3332b396011e..9892d92d5901 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.h +++ b/drivers/net/wireless/iwlwifi/mvm/rs.h | |||
@@ -314,9 +314,15 @@ struct iwl_lq_sta { | |||
314 | enum ieee80211_band band; | 314 | enum ieee80211_band band; |
315 | 315 | ||
316 | /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ | 316 | /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ |
317 | u16 active_legacy_rate; | 317 | unsigned long active_legacy_rate; |
318 | u16 active_siso_rate; | 318 | unsigned long active_siso_rate; |
319 | u16 active_mimo2_rate; | 319 | unsigned long active_mimo2_rate; |
320 | |||
321 | /* Highest rate per Tx mode */ | ||
322 | u8 max_legacy_rate_idx; | ||
323 | u8 max_siso_rate_idx; | ||
324 | u8 max_mimo2_rate_idx; | ||
325 | |||
320 | s8 max_rate_idx; /* Max rate set by user */ | 326 | s8 max_rate_idx; /* Max rate set by user */ |
321 | u8 missed_rate_counter; | 327 | u8 missed_rate_counter; |
322 | 328 | ||