aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2013-11-19 18:45:38 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2013-12-09 15:29:46 -0500
commit4d30ee8247872b7eb7f38342d603963045ed8cba (patch)
treea7e4d5728611cf50b6d0bc5e3f7b0cfe7fadcd76
parentecc90e79e5add903de9f1bb599bdb2384cc762fb (diff)
iwlwifi: mvm: rs: improve debug prints
Enable better tracking of different decisions made by the rate scale algorithm. Signed-off-by: Eyal Shapira <eyal@wizery.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c116
1 files changed, 83 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index a7efeb31c258..065520968d29 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -174,7 +174,7 @@ static void rs_fill_link_cmd(struct iwl_mvm *mvm,
174 struct ieee80211_sta *sta, 174 struct ieee80211_sta *sta,
175 struct iwl_lq_sta *lq_sta, u32 rate_n_flags); 175 struct iwl_lq_sta *lq_sta, u32 rate_n_flags);
176static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search); 176static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search);
177 177static const char *rs_pretty_lq_type(enum iwl_table_type type);
178 178
179#ifdef CONFIG_MAC80211_DEBUGFS 179#ifdef CONFIG_MAC80211_DEBUGFS
180static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 180static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
@@ -778,9 +778,6 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband,
778 struct iwl_scale_tbl_info tbl_type; 778 struct iwl_scale_tbl_info tbl_type;
779 struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 779 struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl;
780 780
781 IWL_DEBUG_RATE_LIMIT(mvm,
782 "get frame ack response, update rate scale window\n");
783
784 /* Treat uninitialized rate scaling data same as non-existing. */ 781 /* Treat uninitialized rate scaling data same as non-existing. */
785 if (!lq_sta) { 782 if (!lq_sta) {
786 IWL_DEBUG_RATE(mvm, "Station rate scaling not created yet.\n"); 783 IWL_DEBUG_RATE(mvm, "Station rate scaling not created yet.\n");
@@ -1499,8 +1496,10 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm,
1499 u8 update_search_tbl_counter = 0; 1496 u8 update_search_tbl_counter = 0;
1500 int ret; 1497 int ret;
1501 1498
1502 if (!iwl_mvm_bt_coex_is_mimo_allowed(mvm, sta)) 1499 if (!iwl_mvm_bt_coex_is_mimo_allowed(mvm, sta)) {
1500 IWL_DEBUG_RATE(mvm, "BT COEX force switch to SISO A\n");
1503 tbl->action = IWL_MIMO2_SWITCH_SISO_A; 1501 tbl->action = IWL_MIMO2_SWITCH_SISO_A;
1502 }
1504 1503
1505 start_action = tbl->action; 1504 start_action = tbl->action;
1506 while (1) { 1505 while (1) {
@@ -1721,8 +1720,6 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1721 struct iwl_mvm_sta *sta_priv = (void *)sta->drv_priv; 1720 struct iwl_mvm_sta *sta_priv = (void *)sta->drv_priv;
1722 struct iwl_mvm_tid_data *tid_data; 1721 struct iwl_mvm_tid_data *tid_data;
1723 1722
1724 IWL_DEBUG_RATE(mvm, "rate scale calculate new rate for skb\n");
1725
1726 /* Send management frames and NO_ACK data using lowest rate. */ 1723 /* Send management frames and NO_ACK data using lowest rate. */
1727 /* TODO: this could probably be improved.. */ 1724 /* TODO: this could probably be improved.. */
1728 if (!ieee80211_is_data(hdr->frame_control) || 1725 if (!ieee80211_is_data(hdr->frame_control) ||
@@ -1758,14 +1755,9 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1758 /* current tx rate */ 1755 /* current tx rate */
1759 index = lq_sta->last_txrate_idx; 1756 index = lq_sta->last_txrate_idx;
1760 1757
1761 IWL_DEBUG_RATE(mvm, "Rate scale index %d for type %d\n", index,
1762 tbl->lq_type);
1763
1764 /* rates available for this association, and for modulation mode */ 1758 /* rates available for this association, and for modulation mode */
1765 rate_mask = rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); 1759 rate_mask = rs_get_supported_rates(lq_sta, hdr, tbl->lq_type);
1766 1760
1767 IWL_DEBUG_RATE(mvm, "mask 0x%04X\n", rate_mask);
1768
1769 /* mask with station rate restriction */ 1761 /* mask with station rate restriction */
1770 if (is_legacy(tbl->lq_type)) { 1762 if (is_legacy(tbl->lq_type)) {
1771 if (lq_sta->band == IEEE80211_BAND_5GHZ) 1763 if (lq_sta->band == IEEE80211_BAND_5GHZ)
@@ -1809,6 +1801,9 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1809 index = lq_sta->max_rate_idx; 1801 index = lq_sta->max_rate_idx;
1810 update_lq = 1; 1802 update_lq = 1;
1811 window = &(tbl->win[index]); 1803 window = &(tbl->win[index]);
1804 IWL_DEBUG_RATE(mvm,
1805 "Forcing user max rate %d\n",
1806 index);
1812 goto lq_update; 1807 goto lq_update;
1813 } 1808 }
1814 1809
@@ -1825,8 +1820,9 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1825 if ((fail_count < IWL_RATE_MIN_FAILURE_TH) && 1820 if ((fail_count < IWL_RATE_MIN_FAILURE_TH) &&
1826 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) { 1821 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) {
1827 IWL_DEBUG_RATE(mvm, 1822 IWL_DEBUG_RATE(mvm,
1828 "LQ: still below TH. succ=%d total=%d for index %d\n", 1823 "(%s: %d): Test Window: succ %d total %d\n",
1829 window->success_counter, window->counter, index); 1824 rs_pretty_lq_type(tbl->lq_type),
1825 index, window->success_counter, window->counter);
1830 1826
1831 /* Can't calculate this yet; not enough history */ 1827 /* Can't calculate this yet; not enough history */
1832 window->average_tpt = IWL_INVALID_VALUE; 1828 window->average_tpt = IWL_INVALID_VALUE;
@@ -1854,7 +1850,8 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1854 * continuing to use the setup that we've been trying. */ 1850 * continuing to use the setup that we've been trying. */
1855 if (window->average_tpt > lq_sta->last_tpt) { 1851 if (window->average_tpt > lq_sta->last_tpt) {
1856 IWL_DEBUG_RATE(mvm, 1852 IWL_DEBUG_RATE(mvm,
1857 "LQ: SWITCHING TO NEW TABLE suc=%d cur-tpt=%d old-tpt=%d\n", 1853 "SWITCHING TO NEW TABLE SR: %d "
1854 "cur-tpt %d old-tpt %d\n",
1858 window->success_ratio, 1855 window->success_ratio,
1859 window->average_tpt, 1856 window->average_tpt,
1860 lq_sta->last_tpt); 1857 lq_sta->last_tpt);
@@ -1868,7 +1865,8 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1868 /* Else poor success; go back to mode in "active" table */ 1865 /* Else poor success; go back to mode in "active" table */
1869 } else { 1866 } else {
1870 IWL_DEBUG_RATE(mvm, 1867 IWL_DEBUG_RATE(mvm,
1871 "LQ: GOING BACK TO THE OLD TABLE suc=%d cur-tpt=%d old-tpt=%d\n", 1868 "GOING BACK TO THE OLD TABLE: SR %d "
1869 "cur-tpt %d old-tpt %d\n",
1872 window->success_ratio, 1870 window->success_ratio,
1873 window->average_tpt, 1871 window->average_tpt,
1874 lq_sta->last_tpt); 1872 lq_sta->last_tpt);
@@ -1916,20 +1914,31 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1916 if (high != IWL_RATE_INVALID) 1914 if (high != IWL_RATE_INVALID)
1917 high_tpt = tbl->win[high].average_tpt; 1915 high_tpt = tbl->win[high].average_tpt;
1918 1916
1917 IWL_DEBUG_RATE(mvm,
1918 "(%s: %d): cur_tpt %d SR %d low %d high %d low_tpt %d high_tpt %d\n",
1919 rs_pretty_lq_type(tbl->lq_type), index, current_tpt,
1920 sr, low, high, low_tpt, high_tpt);
1921
1919 scale_action = 0; 1922 scale_action = 0;
1920 1923
1921 /* Too many failures, decrease rate */ 1924 /* Too many failures, decrease rate */
1922 if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) { 1925 if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) {
1923 IWL_DEBUG_RATE(mvm, 1926 IWL_DEBUG_RATE(mvm,
1924 "decrease rate because of low success_ratio\n"); 1927 "decrease rate because of low SR\n");
1925 scale_action = -1; 1928 scale_action = -1;
1926 /* No throughput measured yet for adjacent rates; try increase. */ 1929 /* No throughput measured yet for adjacent rates; try increase. */
1927 } else if ((low_tpt == IWL_INVALID_VALUE) && 1930 } else if ((low_tpt == IWL_INVALID_VALUE) &&
1928 (high_tpt == IWL_INVALID_VALUE)) { 1931 (high_tpt == IWL_INVALID_VALUE)) {
1929 if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) 1932 if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) {
1933 IWL_DEBUG_RATE(mvm,
1934 "Good SR and no high rate measurement. "
1935 "Increase rate\n");
1930 scale_action = 1; 1936 scale_action = 1;
1931 else if (low != IWL_RATE_INVALID) 1937 } else if (low != IWL_RATE_INVALID) {
1938 IWL_DEBUG_RATE(mvm,
1939 "Remain in current rate\n");
1932 scale_action = 0; 1940 scale_action = 0;
1941 }
1933 } 1942 }
1934 1943
1935 /* Both adjacent throughputs are measured, but neither one has better 1944 /* Both adjacent throughputs are measured, but neither one has better
@@ -1937,8 +1946,12 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1937 else if ((low_tpt != IWL_INVALID_VALUE) && 1946 else if ((low_tpt != IWL_INVALID_VALUE) &&
1938 (high_tpt != IWL_INVALID_VALUE) && 1947 (high_tpt != IWL_INVALID_VALUE) &&
1939 (low_tpt < current_tpt) && 1948 (low_tpt < current_tpt) &&
1940 (high_tpt < current_tpt)) 1949 (high_tpt < current_tpt)) {
1950 IWL_DEBUG_RATE(mvm,
1951 "Both high and low are worse. "
1952 "Maintain rate\n");
1941 scale_action = 0; 1953 scale_action = 0;
1954 }
1942 1955
1943 /* At least one adjacent rate's throughput is measured, 1956 /* At least one adjacent rate's throughput is measured,
1944 * and may have better performance. */ 1957 * and may have better performance. */
@@ -1948,8 +1961,14 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1948 /* Higher rate has better throughput */ 1961 /* Higher rate has better throughput */
1949 if (high_tpt > current_tpt && 1962 if (high_tpt > current_tpt &&
1950 sr >= IWL_RATE_INCREASE_TH) { 1963 sr >= IWL_RATE_INCREASE_TH) {
1964 IWL_DEBUG_RATE(mvm,
1965 "Higher rate is better and good "
1966 "SR. Increate rate\n");
1951 scale_action = 1; 1967 scale_action = 1;
1952 } else { 1968 } else {
1969 IWL_DEBUG_RATE(mvm,
1970 "Higher rate isn't better OR "
1971 "no good SR. Maintain rate\n");
1953 scale_action = 0; 1972 scale_action = 0;
1954 } 1973 }
1955 1974
@@ -1958,9 +1977,13 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1958 /* Lower rate has better throughput */ 1977 /* Lower rate has better throughput */
1959 if (low_tpt > current_tpt) { 1978 if (low_tpt > current_tpt) {
1960 IWL_DEBUG_RATE(mvm, 1979 IWL_DEBUG_RATE(mvm,
1961 "decrease rate because of low tpt\n"); 1980 "Lower rate is better. "
1981 "Decrease rate\n");
1962 scale_action = -1; 1982 scale_action = -1;
1963 } else if (sr >= IWL_RATE_INCREASE_TH) { 1983 } else if (sr >= IWL_RATE_INCREASE_TH) {
1984 IWL_DEBUG_RATE(mvm,
1985 "Lower rate isn't better and "
1986 "good SR. Increase rate\n");
1964 scale_action = 1; 1987 scale_action = 1;
1965 } 1988 }
1966 } 1989 }
@@ -1970,12 +1993,17 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1970 * has been good at old rate. Don't change it. */ 1993 * has been good at old rate. Don't change it. */
1971 if ((scale_action == -1) && (low != IWL_RATE_INVALID) && 1994 if ((scale_action == -1) && (low != IWL_RATE_INVALID) &&
1972 ((sr > IWL_RATE_HIGH_TH) || 1995 ((sr > IWL_RATE_HIGH_TH) ||
1973 (current_tpt > (100 * tbl->expected_tpt[low])))) 1996 (current_tpt > (100 * tbl->expected_tpt[low])))) {
1997 IWL_DEBUG_RATE(mvm,
1998 "Sanity check failed. Maintain rate\n");
1974 scale_action = 0; 1999 scale_action = 0;
2000 }
1975 2001
1976 /* Force a search in case BT doesn't like us being in MIMO */ 2002 /* Force a search in case BT doesn't like us being in MIMO */
1977 if (is_mimo(tbl->lq_type) && 2003 if (is_mimo(tbl->lq_type) &&
1978 !iwl_mvm_bt_coex_is_mimo_allowed(mvm, sta)) { 2004 !iwl_mvm_bt_coex_is_mimo_allowed(mvm, sta)) {
2005 IWL_DEBUG_RATE(mvm,
2006 "BT Coex forbids MIMO. Search for new config\n");
1979 rs_stay_in_table(lq_sta, true); 2007 rs_stay_in_table(lq_sta, true);
1980 goto lq_update; 2008 goto lq_update;
1981 } 2009 }
@@ -1986,6 +2014,9 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1986 if (low != IWL_RATE_INVALID) { 2014 if (low != IWL_RATE_INVALID) {
1987 update_lq = 1; 2015 update_lq = 1;
1988 index = low; 2016 index = low;
2017 } else {
2018 IWL_DEBUG_RATE(mvm,
2019 "At the bottom rate. Can't decrease\n");
1989 } 2020 }
1990 2021
1991 break; 2022 break;
@@ -1994,6 +2025,9 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1994 if (high != IWL_RATE_INVALID) { 2025 if (high != IWL_RATE_INVALID) {
1995 update_lq = 1; 2026 update_lq = 1;
1996 index = high; 2027 index = high;
2028 } else {
2029 IWL_DEBUG_RATE(mvm,
2030 "At the top rate. Can't increase\n");
1997 } 2031 }
1998 2032
1999 break; 2033 break;
@@ -2003,10 +2037,6 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
2003 break; 2037 break;
2004 } 2038 }
2005 2039
2006 IWL_DEBUG_RATE(mvm,
2007 "choose rate scale index %d action %d low %d high %d type %d\n",
2008 index, scale_action, low, high, tbl->lq_type);
2009
2010lq_update: 2040lq_update:
2011 /* Replace uCode's rate table for the destination station. */ 2041 /* Replace uCode's rate table for the destination station. */
2012 if (update_lq) 2042 if (update_lq)
@@ -2025,6 +2055,10 @@ lq_update:
2025 /* Save current throughput to compare with "search" throughput*/ 2055 /* Save current throughput to compare with "search" throughput*/
2026 lq_sta->last_tpt = current_tpt; 2056 lq_sta->last_tpt = current_tpt;
2027 2057
2058 IWL_DEBUG_RATE(mvm,
2059 "Start Search: update_lq %d done_search %d stay_in_tbl %d win->counter %d\n",
2060 update_lq, done_search, lq_sta->stay_in_tbl,
2061 window->counter);
2028 /* Select a new "search" modulation mode to try. 2062 /* Select a new "search" modulation mode to try.
2029 * If one is found, set up the new "search" table. */ 2063 * If one is found, set up the new "search" table. */
2030 if (is_legacy(tbl->lq_type)) 2064 if (is_legacy(tbl->lq_type))
@@ -2047,8 +2081,11 @@ lq_update:
2047 index = iwl_hwrate_to_plcp_idx(tbl->current_rate); 2081 index = iwl_hwrate_to_plcp_idx(tbl->current_rate);
2048 2082
2049 IWL_DEBUG_RATE(mvm, 2083 IWL_DEBUG_RATE(mvm,
2050 "Switch current mcs: %X index: %d\n", 2084 "Switch to SEARCH TABLE: "
2051 tbl->current_rate, index); 2085 "mcs %X (%s: %d)\n",
2086 tbl->current_rate,
2087 rs_pretty_lq_type(tbl->lq_type),
2088 index);
2052 rs_fill_link_cmd(mvm, sta, lq_sta, tbl->current_rate); 2089 rs_fill_link_cmd(mvm, sta, lq_sta, tbl->current_rate);
2053 iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, false); 2090 iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, false);
2054 } else { 2091 } else {
@@ -2169,8 +2206,6 @@ static void rs_get_rate(void *mvm_r, struct ieee80211_sta *sta, void *mvm_sta,
2169 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2206 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2170 struct iwl_lq_sta *lq_sta = mvm_sta; 2207 struct iwl_lq_sta *lq_sta = mvm_sta;
2171 2208
2172 IWL_DEBUG_RATE_LIMIT(mvm, "rate scale calculate new rate for skb\n");
2173
2174 /* Get max rate if user set max rate */ 2209 /* Get max rate if user set max rate */
2175 if (lq_sta) { 2210 if (lq_sta) {
2176 lq_sta->max_rate_idx = txrc->max_rate_idx; 2211 lq_sta->max_rate_idx = txrc->max_rate_idx;
@@ -2554,7 +2589,6 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
2554 >> RATE_MCS_ANT_POS); 2589 >> RATE_MCS_ANT_POS);
2555 if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { 2590 if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) {
2556 *rate_n_flags = lq_sta->dbg_fixed_rate; 2591 *rate_n_flags = lq_sta->dbg_fixed_rate;
2557 IWL_DEBUG_RATE(mvm, "Fixed rate ON\n");
2558 } else { 2592 } else {
2559 lq_sta->dbg_fixed_rate = 0; 2593 lq_sta->dbg_fixed_rate = 0;
2560 IWL_ERR(mvm, 2594 IWL_ERR(mvm,
@@ -2562,8 +2596,6 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
2562 ant_sel_tx, valid_tx_ant); 2596 ant_sel_tx, valid_tx_ant);
2563 IWL_DEBUG_RATE(mvm, "Fixed rate OFF\n"); 2597 IWL_DEBUG_RATE(mvm, "Fixed rate OFF\n");
2564 } 2598 }
2565 } else {
2566 IWL_DEBUG_RATE(mvm, "Fixed rate OFF\n");
2567 } 2599 }
2568} 2600}
2569 2601
@@ -2593,6 +2625,24 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
2593 return count; 2625 return count;
2594} 2626}
2595 2627
2628static const char *rs_pretty_lq_type(enum iwl_table_type type)
2629{
2630 static const char * const lq_type[] = {
2631 [LQ_NONE] = "NONE",
2632 [LQ_LEGACY_A] = "LEGACY_A",
2633 [LQ_LEGACY_G] = "LEGACY_G",
2634 [LQ_HT_SISO] = "HT SISO",
2635 [LQ_HT_MIMO2] = "HT MIMO",
2636 [LQ_VHT_SISO] = "VHT SISO",
2637 [LQ_VHT_MIMO2] = "VHT MIMO",
2638 };
2639
2640 if (type < LQ_NONE || type >= LQ_MAX)
2641 return "UNKNOWN";
2642
2643 return lq_type[type];
2644}
2645
2596static int rs_pretty_print_rate(char *buf, const u32 rate) 2646static int rs_pretty_print_rate(char *buf, const u32 rate)
2597{ 2647{
2598 static const char * const ant_name[] = { 2648 static const char * const ant_name[] = {