aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2014-12-17 08:38:58 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-12-28 13:16:53 -0500
commit834437dab96c751bb013aaac86b19974f6cb444e (patch)
tree657f2d5845cce4b138989aba40f4bcd385983317
parentc3f8d0a3afbc54db0b7ef079d42bc3c72f06d668 (diff)
iwlwifi: mvm: rs: organize and cleanup consts
Organize and cleanup the consts used by rs. This is part of making some of these configurable. Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/constants.h28
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c109
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.h39
3 files changed, 79 insertions, 97 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/constants.h b/drivers/net/wireless/iwlwifi/mvm/constants.h
index 3bd93476ec1c..7cd1de820ca7 100644
--- a/drivers/net/wireless/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/iwlwifi/mvm/constants.h
@@ -102,5 +102,33 @@
102#define IWL_MVM_QUOTA_THRESHOLD 8 102#define IWL_MVM_QUOTA_THRESHOLD 8
103#define IWL_MVM_RS_RSSI_BASED_INIT_RATE 0 103#define IWL_MVM_RS_RSSI_BASED_INIT_RATE 0
104#define IWL_MVM_RS_DISABLE_MIMO 0 104#define IWL_MVM_RS_DISABLE_MIMO 0
105#define IWL_MVM_RS_NUM_TRY_BEFORE_ANT_TOGGLE 1
106#define IWL_MVM_RS_LEGACY_RETRIES_PER_RATE 1
107#define IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE 2
108#define IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE_TW 1
109#define IWL_MVM_RS_INITIAL_MIMO_NUM_RATES 3
110#define IWL_MVM_RS_INITIAL_SISO_NUM_RATES 3
111#define IWL_MVM_RS_INITIAL_LEGACY_NUM_RATES 16
112#define IWL_MVM_RS_SECONDARY_LEGACY_NUM_RATES 16
113#define IWL_MVM_RS_SECONDARY_SISO_NUM_RATES 3
114#define IWL_MVM_RS_SECONDARY_SISO_RETRIES 1
115#define IWL_MVM_RS_RATE_MIN_FAILURE_TH 3
116#define IWL_MVM_RS_RATE_MIN_SUCCESS_TH 8
117#define IWL_MVM_RS_STAY_IN_COLUMN_TIMEOUT 5 /* Seconds */
118#define IWL_MVM_RS_IDLE_TIMEOUT 5 /* Seconds */
119#define IWL_MVM_RS_MISSED_RATE_MAX 15
120#define IWL_MVM_RS_LEGACY_FAILURE_LIMIT 160
121#define IWL_MVM_RS_LEGACY_SUCCESS_LIMIT 480
122#define IWL_MVM_RS_LEGACY_TABLE_COUNT 160
123#define IWL_MVM_RS_NON_LEGACY_FAILURE_LIMIT 400
124#define IWL_MVM_RS_NON_LEGACY_SUCCESS_LIMIT 4500
125#define IWL_MVM_RS_NON_LEGACY_TABLE_COUNT 1500
126#define IWL_MVM_RS_SR_FORCE_DECREASE 15 /* percent */
127#define IWL_MVM_RS_SR_NO_DECREASE 85 /* percent */
128#define IWL_MVM_RS_AGG_TIME_LIMIT 4000 /* 4 msecs. valid 100-8000 */
129#define IWL_MVM_RS_AGG_DISABLE_START 3
130#define IWL_MVM_RS_TPC_SR_FORCE_INCREASE 75 /* percent */
131#define IWL_MVM_RS_TPC_SR_NO_INCREASE 85 /* percent */
132#define IWL_MVM_RS_TPC_TX_POWER_STEP 3
105 133
106#endif /* __MVM_CONSTANTS_H */ 134#endif /* __MVM_CONSTANTS_H */
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 568829db2119..7ba6e5dbbbd0 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -42,25 +42,12 @@
42 42
43#define RS_NAME "iwl-mvm-rs" 43#define RS_NAME "iwl-mvm-rs"
44 44
45#define NUM_TRY_BEFORE_ANT_TOGGLE 1
46#define RS_LEGACY_RETRIES_PER_RATE 1
47#define RS_HT_VHT_RETRIES_PER_RATE 2
48#define RS_HT_VHT_RETRIES_PER_RATE_TW 1
49#define RS_INITIAL_MIMO_NUM_RATES 3
50#define RS_INITIAL_SISO_NUM_RATES 3
51#define RS_INITIAL_LEGACY_NUM_RATES LINK_QUAL_MAX_RETRY_NUM
52#define RS_SECONDARY_LEGACY_NUM_RATES LINK_QUAL_MAX_RETRY_NUM
53#define RS_SECONDARY_SISO_NUM_RATES 3
54#define RS_SECONDARY_SISO_RETRIES 1
55
56#define IWL_RATE_MAX_WINDOW 62 /* # tx in history window */ 45#define IWL_RATE_MAX_WINDOW 62 /* # tx in history window */
57#define IWL_RATE_MIN_FAILURE_TH 3 /* min failures to calc tpt */
58#define IWL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */
59 46
60/* max allowed rate miss before sync LQ cmd */ 47/* Calculations of success ratio are done in fixed point where 12800 is 100%.
61#define IWL_MISSED_RATE_MAX 15 48 * Use this macro when dealing with thresholds consts set as a percentage
62#define RS_STAY_IN_COLUMN_TIMEOUT (5*HZ) 49 */
63#define RS_IDLE_TIMEOUT (5*HZ) 50#define RS_PERCENT(x) (128 * x)
64 51
65static u8 rs_ht_to_legacy[] = { 52static u8 rs_ht_to_legacy[] = {
66 [IWL_RATE_MCS_0_INDEX] = IWL_RATE_6M_INDEX, 53 [IWL_RATE_MCS_0_INDEX] = IWL_RATE_6M_INDEX,
@@ -613,7 +600,8 @@ static s32 get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index)
613 * at this rate. window->data contains the bitmask of successful 600 * at this rate. window->data contains the bitmask of successful
614 * packets. 601 * packets.
615 */ 602 */
616static int _rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, 603static int _rs_collect_tx_data(struct iwl_mvm *mvm,
604 struct iwl_scale_tbl_info *tbl,
617 int scale_index, int attempts, int successes, 605 int scale_index, int attempts, int successes,
618 struct iwl_rate_scale_data *window) 606 struct iwl_rate_scale_data *window)
619{ 607{
@@ -668,8 +656,8 @@ static int _rs_collect_tx_data(struct iwl_scale_tbl_info *tbl,
668 fail_count = window->counter - window->success_counter; 656 fail_count = window->counter - window->success_counter;
669 657
670 /* Calculate average throughput, if we have enough history. */ 658 /* Calculate average throughput, if we have enough history. */
671 if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || 659 if ((fail_count >= IWL_MVM_RS_RATE_MIN_FAILURE_TH) ||
672 (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) 660 (window->success_counter >= IWL_MVM_RS_RATE_MIN_SUCCESS_TH))
673 window->average_tpt = (window->success_ratio * tpt + 64) / 128; 661 window->average_tpt = (window->success_ratio * tpt + 64) / 128;
674 else 662 else
675 window->average_tpt = IWL_INVALID_VALUE; 663 window->average_tpt = IWL_INVALID_VALUE;
@@ -677,7 +665,8 @@ static int _rs_collect_tx_data(struct iwl_scale_tbl_info *tbl,
677 return 0; 665 return 0;
678} 666}
679 667
680static int rs_collect_tx_data(struct iwl_lq_sta *lq_sta, 668static int rs_collect_tx_data(struct iwl_mvm *mvm,
669 struct iwl_lq_sta *lq_sta,
681 struct iwl_scale_tbl_info *tbl, 670 struct iwl_scale_tbl_info *tbl,
682 int scale_index, int attempts, int successes, 671 int scale_index, int attempts, int successes,
683 u8 reduced_txp) 672 u8 reduced_txp)
@@ -698,7 +687,7 @@ static int rs_collect_tx_data(struct iwl_lq_sta *lq_sta,
698 /* Select window for current tx bit rate */ 687 /* Select window for current tx bit rate */
699 window = &(tbl->win[scale_index]); 688 window = &(tbl->win[scale_index]);
700 689
701 ret = _rs_collect_tx_data(tbl, scale_index, attempts, successes, 690 ret = _rs_collect_tx_data(mvm, tbl, scale_index, attempts, successes,
702 window); 691 window);
703 if (ret) 692 if (ret)
704 return ret; 693 return ret;
@@ -707,7 +696,7 @@ static int rs_collect_tx_data(struct iwl_lq_sta *lq_sta,
707 return -EINVAL; 696 return -EINVAL;
708 697
709 window = &tbl->tpc_win[reduced_txp]; 698 window = &tbl->tpc_win[reduced_txp];
710 return _rs_collect_tx_data(tbl, scale_index, attempts, successes, 699 return _rs_collect_tx_data(mvm, tbl, scale_index, attempts, successes,
711 window); 700 window);
712} 701}
713 702
@@ -1125,7 +1114,8 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1125 } 1114 }
1126 1115
1127 if (time_after(jiffies, 1116 if (time_after(jiffies,
1128 (unsigned long)(lq_sta->last_tx + RS_IDLE_TIMEOUT))) { 1117 (unsigned long)(lq_sta->last_tx +
1118 (IWL_MVM_RS_IDLE_TIMEOUT * HZ)))) {
1129 int t; 1119 int t;
1130 1120
1131 IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); 1121 IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n");
@@ -1158,7 +1148,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1158 * ... driver. 1148 * ... driver.
1159 */ 1149 */
1160 lq_sta->missed_rate_counter++; 1150 lq_sta->missed_rate_counter++;
1161 if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { 1151 if (lq_sta->missed_rate_counter > IWL_MVM_RS_MISSED_RATE_MAX) {
1162 lq_sta->missed_rate_counter = 0; 1152 lq_sta->missed_rate_counter = 0;
1163 IWL_DEBUG_RATE(mvm, 1153 IWL_DEBUG_RATE(mvm,
1164 "Too many rates mismatch. Send sync LQ. rs_state %d\n", 1154 "Too many rates mismatch. Send sync LQ. rs_state %d\n",
@@ -1213,7 +1203,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1213 1203
1214 ucode_rate = le32_to_cpu(table->rs_table[0]); 1204 ucode_rate = le32_to_cpu(table->rs_table[0]);
1215 rs_rate_from_ucode_rate(ucode_rate, info->band, &rate); 1205 rs_rate_from_ucode_rate(ucode_rate, info->band, &rate);
1216 rs_collect_tx_data(lq_sta, curr_tbl, rate.index, 1206 rs_collect_tx_data(mvm, lq_sta, curr_tbl, rate.index,
1217 info->status.ampdu_len, 1207 info->status.ampdu_len,
1218 info->status.ampdu_ack_len, 1208 info->status.ampdu_ack_len,
1219 reduced_txp); 1209 reduced_txp);
@@ -1249,7 +1239,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1249 else 1239 else
1250 continue; 1240 continue;
1251 1241
1252 rs_collect_tx_data(lq_sta, tmp_tbl, rate.index, 1, 1242 rs_collect_tx_data(mvm, lq_sta, tmp_tbl, rate.index, 1,
1253 i < retries ? 0 : legacy_success, 1243 i < retries ? 0 : legacy_success,
1254 reduced_txp); 1244 reduced_txp);
1255 } 1245 }
@@ -1303,13 +1293,13 @@ static void rs_set_stay_in_table(struct iwl_mvm *mvm, u8 is_legacy,
1303 IWL_DEBUG_RATE(mvm, "Moving to RS_STATE_STAY_IN_COLUMN\n"); 1293 IWL_DEBUG_RATE(mvm, "Moving to RS_STATE_STAY_IN_COLUMN\n");
1304 lq_sta->rs_state = RS_STATE_STAY_IN_COLUMN; 1294 lq_sta->rs_state = RS_STATE_STAY_IN_COLUMN;
1305 if (is_legacy) { 1295 if (is_legacy) {
1306 lq_sta->table_count_limit = IWL_LEGACY_TABLE_COUNT; 1296 lq_sta->table_count_limit = IWL_MVM_RS_LEGACY_TABLE_COUNT;
1307 lq_sta->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT; 1297 lq_sta->max_failure_limit = IWL_MVM_RS_LEGACY_FAILURE_LIMIT;
1308 lq_sta->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT; 1298 lq_sta->max_success_limit = IWL_MVM_RS_LEGACY_SUCCESS_LIMIT;
1309 } else { 1299 } else {
1310 lq_sta->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT; 1300 lq_sta->table_count_limit = IWL_MVM_RS_NON_LEGACY_TABLE_COUNT;
1311 lq_sta->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT; 1301 lq_sta->max_failure_limit = IWL_MVM_RS_NON_LEGACY_FAILURE_LIMIT;
1312 lq_sta->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT; 1302 lq_sta->max_success_limit = IWL_MVM_RS_NON_LEGACY_SUCCESS_LIMIT;
1313 } 1303 }
1314 lq_sta->table_count = 0; 1304 lq_sta->table_count = 0;
1315 lq_sta->total_failed = 0; 1305 lq_sta->total_failed = 0;
@@ -1427,7 +1417,7 @@ static s32 rs_get_best_rate(struct iwl_mvm *mvm,
1427 u32 target_tpt; 1417 u32 target_tpt;
1428 int rate_idx; 1418 int rate_idx;
1429 1419
1430 if (success_ratio > RS_SR_NO_DECREASE) { 1420 if (success_ratio > IWL_MVM_RS_SR_NO_DECREASE) {
1431 target_tpt = 100 * expected_current_tpt; 1421 target_tpt = 100 * expected_current_tpt;
1432 IWL_DEBUG_RATE(mvm, 1422 IWL_DEBUG_RATE(mvm,
1433 "SR %d high. Find rate exceeding EXPECTED_CURRENT %d\n", 1423 "SR %d high. Find rate exceeding EXPECTED_CURRENT %d\n",
@@ -1495,7 +1485,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
1495 flush_interval_passed = 1485 flush_interval_passed =
1496 time_after(jiffies, 1486 time_after(jiffies,
1497 (unsigned long)(lq_sta->flush_timer + 1487 (unsigned long)(lq_sta->flush_timer +
1498 RS_STAY_IN_COLUMN_TIMEOUT)); 1488 (IWL_MVM_RS_STAY_IN_COLUMN_TIMEOUT * HZ)));
1499 1489
1500 /* 1490 /*
1501 * Check if we should allow search for new modulation mode. 1491 * Check if we should allow search for new modulation mode.
@@ -1735,7 +1725,8 @@ static enum rs_action rs_get_rate_action(struct iwl_mvm *mvm,
1735{ 1725{
1736 enum rs_action action = RS_ACTION_STAY; 1726 enum rs_action action = RS_ACTION_STAY;
1737 1727
1738 if ((sr <= RS_SR_FORCE_DECREASE) || (current_tpt == 0)) { 1728 if ((sr <= RS_PERCENT(IWL_MVM_RS_SR_FORCE_DECREASE)) ||
1729 (current_tpt == 0)) {
1739 IWL_DEBUG_RATE(mvm, 1730 IWL_DEBUG_RATE(mvm,
1740 "Decrease rate because of low SR\n"); 1731 "Decrease rate because of low SR\n");
1741 return RS_ACTION_DOWNSCALE; 1732 return RS_ACTION_DOWNSCALE;
@@ -1794,7 +1785,7 @@ static enum rs_action rs_get_rate_action(struct iwl_mvm *mvm,
1794 1785
1795out: 1786out:
1796 if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID)) { 1787 if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID)) {
1797 if (sr >= RS_SR_NO_DECREASE) { 1788 if (sr >= RS_PERCENT(IWL_MVM_RS_SR_NO_DECREASE)) {
1798 IWL_DEBUG_RATE(mvm, 1789 IWL_DEBUG_RATE(mvm,
1799 "SR is above NO DECREASE. Avoid downscale\n"); 1790 "SR is above NO DECREASE. Avoid downscale\n");
1800 action = RS_ACTION_STAY; 1791 action = RS_ACTION_STAY;
@@ -1836,11 +1827,11 @@ static bool rs_stbc_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1836static void rs_get_adjacent_txp(struct iwl_mvm *mvm, int index, 1827static void rs_get_adjacent_txp(struct iwl_mvm *mvm, int index,
1837 int *weaker, int *stronger) 1828 int *weaker, int *stronger)
1838{ 1829{
1839 *weaker = index + TPC_TX_POWER_STEP; 1830 *weaker = index + IWL_MVM_RS_TPC_TX_POWER_STEP;
1840 if (*weaker > TPC_MAX_REDUCTION) 1831 if (*weaker > TPC_MAX_REDUCTION)
1841 *weaker = TPC_INVALID; 1832 *weaker = TPC_INVALID;
1842 1833
1843 *stronger = index - TPC_TX_POWER_STEP; 1834 *stronger = index - IWL_MVM_RS_TPC_TX_POWER_STEP;
1844 if (*stronger < 0) 1835 if (*stronger < 0)
1845 *stronger = TPC_INVALID; 1836 *stronger = TPC_INVALID;
1846} 1837}
@@ -1896,7 +1887,8 @@ static enum tpc_action rs_get_tpc_action(struct iwl_mvm *mvm,
1896 } 1887 }
1897 1888
1898 /* Too many failures, increase txp */ 1889 /* Too many failures, increase txp */
1899 if (sr <= TPC_SR_FORCE_INCREASE || current_tpt == 0) { 1890 if (sr <= RS_PERCENT(IWL_MVM_RS_TPC_SR_FORCE_INCREASE) ||
1891 current_tpt == 0) {
1900 IWL_DEBUG_RATE(mvm, "increase txp because of weak SR\n"); 1892 IWL_DEBUG_RATE(mvm, "increase txp because of weak SR\n");
1901 return TPC_ACTION_NO_RESTIRCTION; 1893 return TPC_ACTION_NO_RESTIRCTION;
1902 } 1894 }
@@ -1919,7 +1911,8 @@ static enum tpc_action rs_get_tpc_action(struct iwl_mvm *mvm,
1919 } 1911 }
1920 1912
1921 /* next, increase if needed */ 1913 /* next, increase if needed */
1922 if (sr < TPC_SR_NO_INCREASE && strong != TPC_INVALID) { 1914 if (sr < RS_PERCENT(IWL_MVM_RS_TPC_SR_NO_INCREASE) &&
1915 strong != TPC_INVALID) {
1923 if (weak_tpt == IWL_INVALID_VALUE && 1916 if (weak_tpt == IWL_INVALID_VALUE &&
1924 strong_tpt != IWL_INVALID_VALUE && 1917 strong_tpt != IWL_INVALID_VALUE &&
1925 current_tpt < strong_tpt) { 1918 current_tpt < strong_tpt) {
@@ -2117,8 +2110,8 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
2117 * in current association (use new rate found above). 2110 * in current association (use new rate found above).
2118 */ 2111 */
2119 fail_count = window->counter - window->success_counter; 2112 fail_count = window->counter - window->success_counter;
2120 if ((fail_count < IWL_RATE_MIN_FAILURE_TH) && 2113 if ((fail_count < IWL_MVM_RS_RATE_MIN_FAILURE_TH) &&
2121 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) { 2114 (window->success_counter < IWL_MVM_RS_RATE_MIN_SUCCESS_TH)) {
2122 IWL_DEBUG_RATE(mvm, 2115 IWL_DEBUG_RATE(mvm,
2123 "(%s: %d): Test Window: succ %d total %d\n", 2116 "(%s: %d): Test Window: succ %d total %d\n",
2124 rs_pretty_lq_type(rate->type), 2117 rs_pretty_lq_type(rate->type),
@@ -2720,7 +2713,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
2720 * previous packets? Need to have IEEE 802.1X auth succeed immediately 2713 * previous packets? Need to have IEEE 802.1X auth succeed immediately
2721 * after assoc.. */ 2714 * after assoc.. */
2722 2715
2723 lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; 2716 lq_sta->missed_rate_counter = IWL_MVM_RS_MISSED_RATE_MAX;
2724 lq_sta->band = sband->band; 2717 lq_sta->band = sband->band;
2725 /* 2718 /*
2726 * active legacy rates as per supported rates bitmap 2719 * active legacy rates as per supported rates bitmap
@@ -2925,14 +2918,14 @@ static void rs_build_rates_table(struct iwl_mvm *mvm,
2925 rate.stbc = rs_stbc_allow(mvm, sta, lq_sta); 2918 rate.stbc = rs_stbc_allow(mvm, sta, lq_sta);
2926 2919
2927 if (is_siso(&rate)) { 2920 if (is_siso(&rate)) {
2928 num_rates = RS_INITIAL_SISO_NUM_RATES; 2921 num_rates = IWL_MVM_RS_INITIAL_SISO_NUM_RATES;
2929 num_retries = RS_HT_VHT_RETRIES_PER_RATE; 2922 num_retries = IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE;
2930 } else if (is_mimo(&rate)) { 2923 } else if (is_mimo(&rate)) {
2931 num_rates = RS_INITIAL_MIMO_NUM_RATES; 2924 num_rates = IWL_MVM_RS_INITIAL_MIMO_NUM_RATES;
2932 num_retries = RS_HT_VHT_RETRIES_PER_RATE; 2925 num_retries = IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE;
2933 } else { 2926 } else {
2934 num_rates = RS_INITIAL_LEGACY_NUM_RATES; 2927 num_rates = IWL_MVM_RS_INITIAL_LEGACY_NUM_RATES;
2935 num_retries = RS_LEGACY_RETRIES_PER_RATE; 2928 num_retries = IWL_MVM_RS_LEGACY_RETRIES_PER_RATE;
2936 toggle_ant = true; 2929 toggle_ant = true;
2937 } 2930 }
2938 2931
@@ -2943,12 +2936,12 @@ static void rs_build_rates_table(struct iwl_mvm *mvm,
2943 rs_get_lower_rate_down_column(lq_sta, &rate); 2936 rs_get_lower_rate_down_column(lq_sta, &rate);
2944 2937
2945 if (is_siso(&rate)) { 2938 if (is_siso(&rate)) {
2946 num_rates = RS_SECONDARY_SISO_NUM_RATES; 2939 num_rates = IWL_MVM_RS_SECONDARY_SISO_NUM_RATES;
2947 num_retries = RS_SECONDARY_SISO_RETRIES; 2940 num_retries = IWL_MVM_RS_SECONDARY_SISO_RETRIES;
2948 lq_cmd->mimo_delim = index; 2941 lq_cmd->mimo_delim = index;
2949 } else if (is_legacy(&rate)) { 2942 } else if (is_legacy(&rate)) {
2950 num_rates = RS_SECONDARY_LEGACY_NUM_RATES; 2943 num_rates = IWL_MVM_RS_SECONDARY_LEGACY_NUM_RATES;
2951 num_retries = RS_LEGACY_RETRIES_PER_RATE; 2944 num_retries = IWL_MVM_RS_LEGACY_RETRIES_PER_RATE;
2952 } else { 2945 } else {
2953 WARN_ON_ONCE(1); 2946 WARN_ON_ONCE(1);
2954 } 2947 }
@@ -2961,8 +2954,8 @@ static void rs_build_rates_table(struct iwl_mvm *mvm,
2961 2954
2962 rs_get_lower_rate_down_column(lq_sta, &rate); 2955 rs_get_lower_rate_down_column(lq_sta, &rate);
2963 2956
2964 num_rates = RS_SECONDARY_LEGACY_NUM_RATES; 2957 num_rates = IWL_MVM_RS_SECONDARY_LEGACY_NUM_RATES;
2965 num_retries = RS_LEGACY_RETRIES_PER_RATE; 2958 num_retries = IWL_MVM_RS_LEGACY_RETRIES_PER_RATE;
2966 2959
2967 rs_fill_rates_for_column(mvm, lq_sta, &rate, lq_cmd->rs_table, &index, 2960 rs_fill_rates_for_column(mvm, lq_sta, &rate, lq_cmd->rs_table, &index,
2968 num_rates, num_retries, valid_tx_ant, 2961 num_rates, num_retries, valid_tx_ant,
@@ -2979,9 +2972,9 @@ static void rs_fill_lq_cmd(struct iwl_mvm *mvm,
2979 struct iwl_mvm_sta *mvmsta; 2972 struct iwl_mvm_sta *mvmsta;
2980 struct iwl_mvm_vif *mvmvif; 2973 struct iwl_mvm_vif *mvmvif;
2981 2974
2982 lq_cmd->agg_disable_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; 2975 lq_cmd->agg_disable_start_th = IWL_MVM_RS_AGG_DISABLE_START;
2983 lq_cmd->agg_time_limit = 2976 lq_cmd->agg_time_limit =
2984 cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); 2977 cpu_to_le16(IWL_MVM_RS_AGG_TIME_LIMIT);
2985 2978
2986#ifdef CONFIG_MAC80211_DEBUGFS 2979#ifdef CONFIG_MAC80211_DEBUGFS
2987 if (lq_sta->pers.dbg_fixed_rate) { 2980 if (lq_sta->pers.dbg_fixed_rate) {
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h
index defd70a6d9e6..f8f5bf21cc38 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.h
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.h
@@ -137,42 +137,10 @@ enum {
137 137
138#define IWL_INVALID_VALUE -1 138#define IWL_INVALID_VALUE -1
139 139
140#define IWL_MIN_RSSI_VAL -100
141#define IWL_MAX_RSSI_VAL 0
142
143/* These values specify how many Tx frame attempts before
144 * searching for a new modulation mode */
145#define IWL_LEGACY_FAILURE_LIMIT 160
146#define IWL_LEGACY_SUCCESS_LIMIT 480
147#define IWL_LEGACY_TABLE_COUNT 160
148
149#define IWL_NONE_LEGACY_FAILURE_LIMIT 400
150#define IWL_NONE_LEGACY_SUCCESS_LIMIT 4500
151#define IWL_NONE_LEGACY_TABLE_COUNT 1500
152
153/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */
154#define IWL_RS_GOOD_RATIO 12800 /* 100% */
155#define IWL_RATE_SCALE_SWITCH 10880 /* 85% */
156#define IWL_RATE_HIGH_TH 10880 /* 85% */
157#define IWL_RATE_INCREASE_TH 6400 /* 50% */
158#define RS_SR_FORCE_DECREASE 1920 /* 15% */
159#define RS_SR_NO_DECREASE 10880 /* 85% */
160
161#define TPC_SR_FORCE_INCREASE 9600 /* 75% */
162#define TPC_SR_NO_INCREASE 10880 /* 85% */
163#define TPC_TX_POWER_STEP 3
164#define TPC_MAX_REDUCTION 15 140#define TPC_MAX_REDUCTION 15
165#define TPC_NO_REDUCTION 0 141#define TPC_NO_REDUCTION 0
166#define TPC_INVALID 0xff 142#define TPC_INVALID 0xff
167 143
168#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
169#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
170#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100)
171
172#define LINK_QUAL_AGG_DISABLE_START_DEF (3)
173#define LINK_QUAL_AGG_DISABLE_START_MAX (255)
174#define LINK_QUAL_AGG_DISABLE_START_MIN (0)
175
176#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63) 144#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63)
177#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) 145#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63)
178#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) 146#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
@@ -181,14 +149,7 @@ enum {
181 149
182/* load per tid defines for A-MPDU activation */ 150/* load per tid defines for A-MPDU activation */
183#define IWL_AGG_TPT_THREHOLD 0 151#define IWL_AGG_TPT_THREHOLD 0
184#define IWL_AGG_LOAD_THRESHOLD 10
185#define IWL_AGG_ALL_TID 0xff 152#define IWL_AGG_ALL_TID 0xff
186#define TID_QUEUE_CELL_SPACING 50 /*mS */
187#define TID_QUEUE_MAX_SIZE 20
188#define TID_ROUND_VALUE 5 /* mS */
189
190#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING)
191#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y))
192 153
193enum iwl_table_type { 154enum iwl_table_type {
194 LQ_NONE, 155 LQ_NONE,