diff options
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 27 |
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 25b4356fcc1c..044abf734eb6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -651,6 +651,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
651 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 651 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
652 | u16 fc; | 652 | u16 fc; |
653 | u16 rate_mask = 0; | 653 | u16 rate_mask = 0; |
654 | s8 max_rate_idx = -1; | ||
654 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 655 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
655 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 656 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
656 | 657 | ||
@@ -675,6 +676,13 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
675 | return; | 676 | return; |
676 | } | 677 | } |
677 | 678 | ||
679 | /* get user max rate if set */ | ||
680 | max_rate_idx = txrc->max_rate_idx; | ||
681 | if ((sband->band == IEEE80211_BAND_5GHZ) && (max_rate_idx != -1)) | ||
682 | max_rate_idx += IWL_FIRST_OFDM_RATE; | ||
683 | if ((max_rate_idx < 0) || (max_rate_idx >= IWL_RATE_COUNT)) | ||
684 | max_rate_idx = -1; | ||
685 | |||
678 | index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT_3945 - 1); | 686 | index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT_3945 - 1); |
679 | 687 | ||
680 | if (sband->band == IEEE80211_BAND_5GHZ) | 688 | if (sband->band == IEEE80211_BAND_5GHZ) |
@@ -706,6 +714,12 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
706 | rs_sta->start_rate = IWL_RATE_INVALID; | 714 | rs_sta->start_rate = IWL_RATE_INVALID; |
707 | } | 715 | } |
708 | 716 | ||
717 | /* force user max rate if set by user */ | ||
718 | if ((max_rate_idx != -1) && (max_rate_idx < index)) { | ||
719 | if (rate_mask & (1 << max_rate_idx)) | ||
720 | index = max_rate_idx; | ||
721 | } | ||
722 | |||
709 | window = &(rs_sta->win[index]); | 723 | window = &(rs_sta->win[index]); |
710 | 724 | ||
711 | fail_count = window->counter - window->success_counter; | 725 | fail_count = window->counter - window->success_counter; |
@@ -732,6 +746,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
732 | low = high_low & 0xff; | 746 | low = high_low & 0xff; |
733 | high = (high_low >> 8) & 0xff; | 747 | high = (high_low >> 8) & 0xff; |
734 | 748 | ||
749 | /* If user set max rate, dont allow higher than user constrain */ | ||
750 | if ((max_rate_idx != -1) && (max_rate_idx < high)) | ||
751 | high = IWL_RATE_INVALID; | ||
752 | |||
735 | if (low != IWL_RATE_INVALID) | 753 | if (low != IWL_RATE_INVALID) |
736 | low_tpt = rs_sta->win[low].average_tpt; | 754 | low_tpt = rs_sta->win[low].average_tpt; |
737 | 755 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index a82cce5fbff8..12c5e5d6e910 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -148,6 +148,7 @@ struct iwl_lq_sta { | |||
148 | u16 active_mimo2_rate; | 148 | u16 active_mimo2_rate; |
149 | u16 active_mimo3_rate; | 149 | u16 active_mimo3_rate; |
150 | u16 active_rate_basic; | 150 | u16 active_rate_basic; |
151 | s8 max_rate_idx; /* Max rate set by user */ | ||
151 | 152 | ||
152 | struct iwl_link_quality_cmd lq; | 153 | struct iwl_link_quality_cmd lq; |
153 | struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ | 154 | struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ |
@@ -1759,6 +1760,15 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1759 | return; | 1760 | return; |
1760 | } | 1761 | } |
1761 | 1762 | ||
1763 | /* force user max rate if set by user */ | ||
1764 | if ((lq_sta->max_rate_idx != -1) && | ||
1765 | (lq_sta->max_rate_idx < index)) { | ||
1766 | index = lq_sta->max_rate_idx; | ||
1767 | update_lq = 1; | ||
1768 | window = &(tbl->win[index]); | ||
1769 | goto lq_update; | ||
1770 | } | ||
1771 | |||
1762 | window = &(tbl->win[index]); | 1772 | window = &(tbl->win[index]); |
1763 | 1773 | ||
1764 | /* | 1774 | /* |
@@ -1850,6 +1860,11 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1850 | low = high_low & 0xff; | 1860 | low = high_low & 0xff; |
1851 | high = (high_low >> 8) & 0xff; | 1861 | high = (high_low >> 8) & 0xff; |
1852 | 1862 | ||
1863 | /* If user set max rate, dont allow higher than user constrain */ | ||
1864 | if ((lq_sta->max_rate_idx != -1) && | ||
1865 | (lq_sta->max_rate_idx < high)) | ||
1866 | high = IWL_RATE_INVALID; | ||
1867 | |||
1853 | sr = window->success_ratio; | 1868 | sr = window->success_ratio; |
1854 | 1869 | ||
1855 | /* Collect measured throughputs for current and adjacent rates */ | 1870 | /* Collect measured throughputs for current and adjacent rates */ |
@@ -2110,6 +2125,17 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2110 | 2125 | ||
2111 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); | 2126 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); |
2112 | 2127 | ||
2128 | /* Get max rate if user set max rate */ | ||
2129 | if (lq_sta) { | ||
2130 | lq_sta->max_rate_idx = txrc->max_rate_idx; | ||
2131 | if ((sband->band == IEEE80211_BAND_5GHZ) && | ||
2132 | (lq_sta->max_rate_idx != -1)) | ||
2133 | lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE; | ||
2134 | if ((lq_sta->max_rate_idx < 0) || | ||
2135 | (lq_sta->max_rate_idx >= IWL_RATE_COUNT)) | ||
2136 | lq_sta->max_rate_idx = -1; | ||
2137 | } | ||
2138 | |||
2113 | if (sta) | 2139 | if (sta) |
2114 | mask_bit = sta->supp_rates[sband->band]; | 2140 | mask_bit = sta->supp_rates[sband->band]; |
2115 | 2141 | ||
@@ -2220,6 +2246,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2220 | } | 2246 | } |
2221 | 2247 | ||
2222 | lq_sta->is_dup = 0; | 2248 | lq_sta->is_dup = 0; |
2249 | lq_sta->max_rate_idx = -1; | ||
2223 | lq_sta->is_green = rs_use_green(priv, conf); | 2250 | lq_sta->is_green = rs_use_green(priv, conf); |
2224 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); | 2251 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); |
2225 | lq_sta->active_rate_basic = priv->active_rate_basic; | 2252 | lq_sta->active_rate_basic = priv->active_rate_basic; |