aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-21 06:40:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:23 -0400
commite6a9854b05c1a6af1308fe2b8c68f35abf28a3ee (patch)
tree241f611f8194586ccabf61bacb060508773b9d05 /drivers/net/wireless/iwlwifi/iwl-agn-rs.c
parentcb121bad67a32cde37adc2729b7e18aa4fd3063e (diff)
mac80211/drivers: rewrite the rate control API
So after the previous changes we were still unhappy with how convoluted the API is and decided to make things simpler for everybody. This completely changes the rate control API, now taking into account 802.11n with MCS rates and more control, most drivers don't support that though. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-rs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index e10e0ca09ce..f685e5d6c28 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -798,7 +798,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
798 !(info->flags & IEEE80211_TX_STAT_AMPDU)) 798 !(info->flags & IEEE80211_TX_STAT_AMPDU))
799 return; 799 return;
800 800
801 retries = info->status.retry_count; 801 retries = info->status.rates[0].count - 1;
802 802
803 if (retries > 15) 803 if (retries > 15)
804 retries = 15; 804 retries = 15;
@@ -830,20 +830,15 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
830 if (priv->band == IEEE80211_BAND_5GHZ) 830 if (priv->band == IEEE80211_BAND_5GHZ)
831 rs_index -= IWL_FIRST_OFDM_RATE; 831 rs_index -= IWL_FIRST_OFDM_RATE;
832 832
833 if ((info->tx_rate_idx < 0) || 833 if ((info->status.rates[0].idx < 0) ||
834 (tbl_type.is_SGI ^ 834 (tbl_type.is_SGI != !!(info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)) ||
835 !!(info->flags & IEEE80211_TX_CTL_SHORT_GI)) || 835 (tbl_type.is_fat != !!(info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) ||
836 (tbl_type.is_fat ^ 836 (tbl_type.is_dup != !!(info->status.rates[0].flags & IEEE80211_TX_RC_DUP_DATA)) ||
837 !!(info->flags & IEEE80211_TX_CTL_40_MHZ_WIDTH)) || 837 (tbl_type.ant_type != info->antenna_sel_tx) ||
838 (tbl_type.is_dup ^ 838 (!!(tx_rate & RATE_MCS_HT_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) ||
839 !!(info->flags & IEEE80211_TX_CTL_DUP_DATA)) || 839 (!!(tx_rate & RATE_MCS_GF_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)) ||
840 (tbl_type.ant_type ^ info->antenna_sel_tx) ||
841 (!!(tx_rate & RATE_MCS_HT_MSK) ^
842 !!(info->flags & IEEE80211_TX_CTL_OFDM_HT)) ||
843 (!!(tx_rate & RATE_MCS_GF_MSK) ^
844 !!(info->flags & IEEE80211_TX_CTL_GREEN_FIELD)) ||
845 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != 840 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate !=
846 hw->wiphy->bands[info->band]->bitrates[info->tx_rate_idx].bitrate)) { 841 hw->wiphy->bands[info->band]->bitrates[info->status.rates[0].idx].bitrate)) {
847 IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate); 842 IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate);
848 goto out; 843 goto out;
849 } 844 }
@@ -2098,15 +2093,17 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2098 return; 2093 return;
2099} 2094}
2100 2095
2101static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, 2096static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2102 struct ieee80211_sta *sta, void *priv_sta, 2097 struct ieee80211_tx_rate_control *txrc)
2103 struct sk_buff *skb, struct rate_selection *sel)
2104{ 2098{
2105 2099
2106 int i; 2100 int i;
2101 struct sk_buff *skb = txrc->skb;
2102 struct ieee80211_supported_band *sband = txrc->sband;
2107 struct iwl_priv *priv = (struct iwl_priv *)priv_r; 2103 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
2108 struct ieee80211_conf *conf = &priv->hw->conf; 2104 struct ieee80211_conf *conf = &priv->hw->conf;
2109 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2105 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2106 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2110 __le16 fc; 2107 __le16 fc;
2111 struct iwl_lq_sta *lq_sta; 2108 struct iwl_lq_sta *lq_sta;
2112 2109
@@ -2117,7 +2114,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
2117 fc = hdr->frame_control; 2114 fc = hdr->frame_control;
2118 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || 2115 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) ||
2119 !sta || !priv_sta) { 2116 !sta || !priv_sta) {
2120 sel->rate_idx = rate_lowest_index(sband, sta); 2117 info->control.rates[0].idx = rate_lowest_index(sband, sta);
2121 return; 2118 return;
2122 } 2119 }
2123 2120
@@ -2143,13 +2140,13 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
2143 } 2140 }
2144 2141
2145 if ((i < 0) || (i > IWL_RATE_COUNT)) { 2142 if ((i < 0) || (i > IWL_RATE_COUNT)) {
2146 sel->rate_idx = rate_lowest_index(sband, sta); 2143 info->control.rates[0].idx = rate_lowest_index(sband, sta);
2147 return; 2144 return;
2148 } 2145 }
2149 2146
2150 if (sband->band == IEEE80211_BAND_5GHZ) 2147 if (sband->band == IEEE80211_BAND_5GHZ)
2151 i -= IWL_FIRST_OFDM_RATE; 2148 i -= IWL_FIRST_OFDM_RATE;
2152 sel->rate_idx = i; 2149 info->control.rates[0].idx = i;
2153} 2150}
2154 2151
2155static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, 2152static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,