diff options
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index f28b3cc272df..a89639f958e1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -1336,7 +1336,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1336 | lq_sta->search_better_tbl = 1; | 1336 | lq_sta->search_better_tbl = 1; |
1337 | goto out; | 1337 | goto out; |
1338 | } | 1338 | } |
1339 | 1339 | break; | |
1340 | case IWL_LEGACY_SWITCH_SISO: | 1340 | case IWL_LEGACY_SWITCH_SISO: |
1341 | IWL_DEBUG_RATE("LQ: Legacy switch to SISO\n"); | 1341 | IWL_DEBUG_RATE("LQ: Legacy switch to SISO\n"); |
1342 | 1342 | ||
@@ -1422,9 +1422,9 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1422 | lq_sta->search_better_tbl = 1; | 1422 | lq_sta->search_better_tbl = 1; |
1423 | goto out; | 1423 | goto out; |
1424 | } | 1424 | } |
1425 | 1425 | break; | |
1426 | case IWL_SISO_SWITCH_MIMO2: | 1426 | case IWL_SISO_SWITCH_MIMO2: |
1427 | IWL_DEBUG_RATE("LQ: SISO switch to MIMO\n"); | 1427 | IWL_DEBUG_RATE("LQ: SISO switch to MIMO2\n"); |
1428 | memcpy(search_tbl, tbl, sz); | 1428 | memcpy(search_tbl, tbl, sz); |
1429 | search_tbl->is_SGI = 0; | 1429 | search_tbl->is_SGI = 0; |
1430 | search_tbl->ant_type = ANT_AB; /*FIXME:RS*/ | 1430 | search_tbl->ant_type = ANT_AB; /*FIXME:RS*/ |
@@ -1689,6 +1689,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1689 | u8 active_tbl = 0; | 1689 | u8 active_tbl = 0; |
1690 | u8 done_search = 0; | 1690 | u8 done_search = 0; |
1691 | u16 high_low; | 1691 | u16 high_low; |
1692 | s32 sr; | ||
1692 | #ifdef CONFIG_IWL4965_HT | 1693 | #ifdef CONFIG_IWL4965_HT |
1693 | u8 tid = MAX_TID_COUNT; | 1694 | u8 tid = MAX_TID_COUNT; |
1694 | #endif | 1695 | #endif |
@@ -1864,6 +1865,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1864 | low = high_low & 0xff; | 1865 | low = high_low & 0xff; |
1865 | high = (high_low >> 8) & 0xff; | 1866 | high = (high_low >> 8) & 0xff; |
1866 | 1867 | ||
1868 | sr = window->success_ratio; | ||
1869 | |||
1867 | /* Collect measured throughputs for current and adjacent rates */ | 1870 | /* Collect measured throughputs for current and adjacent rates */ |
1868 | current_tpt = window->average_tpt; | 1871 | current_tpt = window->average_tpt; |
1869 | if (low != IWL_RATE_INVALID) | 1872 | if (low != IWL_RATE_INVALID) |
@@ -1871,19 +1874,22 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1871 | if (high != IWL_RATE_INVALID) | 1874 | if (high != IWL_RATE_INVALID) |
1872 | high_tpt = tbl->win[high].average_tpt; | 1875 | high_tpt = tbl->win[high].average_tpt; |
1873 | 1876 | ||
1874 | /* Assume rate increase */ | 1877 | scale_action = 0; |
1875 | scale_action = 1; | ||
1876 | 1878 | ||
1877 | /* Too many failures, decrease rate */ | 1879 | /* Too many failures, decrease rate */ |
1878 | if ((window->success_ratio <= IWL_RATE_DECREASE_TH) || | 1880 | if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) { |
1879 | (current_tpt == 0)) { | ||
1880 | IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); | 1881 | IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); |
1881 | scale_action = -1; | 1882 | scale_action = -1; |
1882 | 1883 | ||
1883 | /* No throughput measured yet for adjacent rates; try increase. */ | 1884 | /* No throughput measured yet for adjacent rates; try increase. */ |
1884 | } else if ((low_tpt == IWL_INVALID_VALUE) && | 1885 | } else if ((low_tpt == IWL_INVALID_VALUE) && |
1885 | (high_tpt == IWL_INVALID_VALUE)) | 1886 | (high_tpt == IWL_INVALID_VALUE)) { |
1886 | scale_action = 1; | 1887 | |
1888 | if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) | ||
1889 | scale_action = 1; | ||
1890 | else if (low != IWL_RATE_INVALID) | ||
1891 | scale_action = -1; | ||
1892 | } | ||
1887 | 1893 | ||
1888 | /* Both adjacent throughputs are measured, but neither one has better | 1894 | /* Both adjacent throughputs are measured, but neither one has better |
1889 | * throughput; we're using the best rate, don't change it! */ | 1895 | * throughput; we're using the best rate, don't change it! */ |
@@ -1899,9 +1905,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1899 | /* Higher adjacent rate's throughput is measured */ | 1905 | /* Higher adjacent rate's throughput is measured */ |
1900 | if (high_tpt != IWL_INVALID_VALUE) { | 1906 | if (high_tpt != IWL_INVALID_VALUE) { |
1901 | /* Higher rate has better throughput */ | 1907 | /* Higher rate has better throughput */ |
1902 | if (high_tpt > current_tpt) | 1908 | if (high_tpt > current_tpt && |
1909 | sr >= IWL_RATE_INCREASE_TH) { | ||
1903 | scale_action = 1; | 1910 | scale_action = 1; |
1904 | else { | 1911 | } else { |
1905 | IWL_DEBUG_RATE | 1912 | IWL_DEBUG_RATE |
1906 | ("decrease rate because of high tpt\n"); | 1913 | ("decrease rate because of high tpt\n"); |
1907 | scale_action = -1; | 1914 | scale_action = -1; |
@@ -1914,23 +1921,17 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1914 | IWL_DEBUG_RATE | 1921 | IWL_DEBUG_RATE |
1915 | ("decrease rate because of low tpt\n"); | 1922 | ("decrease rate because of low tpt\n"); |
1916 | scale_action = -1; | 1923 | scale_action = -1; |
1917 | } else | 1924 | } else if (sr >= IWL_RATE_INCREASE_TH) { |
1918 | scale_action = 1; | 1925 | scale_action = 1; |
1926 | } | ||
1919 | } | 1927 | } |
1920 | } | 1928 | } |
1921 | 1929 | ||
1922 | /* Sanity check; asked for decrease, but success rate or throughput | 1930 | /* Sanity check; asked for decrease, but success rate or throughput |
1923 | * has been good at old rate. Don't change it. */ | 1931 | * has been good at old rate. Don't change it. */ |
1924 | if (scale_action == -1) { | 1932 | if ((scale_action == -1) && (low != IWL_RATE_INVALID) && |
1925 | if ((low != IWL_RATE_INVALID) && | 1933 | ((sr > IWL_RATE_HIGH_TH) || |
1926 | ((window->success_ratio > IWL_RATE_HIGH_TH) || | ||
1927 | (current_tpt > (100 * tbl->expected_tpt[low])))) | 1934 | (current_tpt > (100 * tbl->expected_tpt[low])))) |
1928 | scale_action = 0; | ||
1929 | |||
1930 | /* Sanity check; asked for increase, but success rate has not been great | ||
1931 | * even at old rate, higher rate will be worse. Don't change it. */ | ||
1932 | } else if ((scale_action == 1) && | ||
1933 | (window->success_ratio < IWL_RATE_INCREASE_TH)) | ||
1934 | scale_action = 0; | 1935 | scale_action = 0; |
1935 | 1936 | ||
1936 | switch (scale_action) { | 1937 | switch (scale_action) { |
@@ -1959,7 +1960,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1959 | "high %d type %d\n", | 1960 | "high %d type %d\n", |
1960 | index, scale_action, low, high, tbl->lq_type); | 1961 | index, scale_action, low, high, tbl->lq_type); |
1961 | 1962 | ||
1962 | lq_update: | 1963 | lq_update: |
1963 | /* Replace uCode's rate table for the destination station. */ | 1964 | /* Replace uCode's rate table for the destination station. */ |
1964 | if (update_lq) { | 1965 | if (update_lq) { |
1965 | rate = rate_n_flags_from_tbl(tbl, index, is_green); | 1966 | rate = rate_n_flags_from_tbl(tbl, index, is_green); |