aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-rs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c146
1 files changed, 59 insertions, 87 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 8b57b390c8b..93944de923c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -35,8 +35,6 @@
35 35
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37 37
38#include "../net/mac80211/rate.h"
39
40#include "iwl-dev.h" 38#include "iwl-dev.h"
41#include "iwl-sta.h" 39#include "iwl-sta.h"
42#include "iwl-core.h" 40#include "iwl-core.h"
@@ -169,9 +167,9 @@ struct iwl_lq_sta {
169}; 167};
170 168
171static void rs_rate_scale_perform(struct iwl_priv *priv, 169static void rs_rate_scale_perform(struct iwl_priv *priv,
172 struct net_device *dev,
173 struct ieee80211_hdr *hdr, 170 struct ieee80211_hdr *hdr,
174 struct sta_info *sta); 171 struct ieee80211_sta *sta,
172 struct iwl_lq_sta *lq_sta);
175static void rs_fill_link_cmd(const struct iwl_priv *priv, 173static void rs_fill_link_cmd(const struct iwl_priv *priv,
176 struct iwl_lq_sta *lq_sta, u32 rate_n_flags); 174 struct iwl_lq_sta *lq_sta, u32 rate_n_flags);
177 175
@@ -357,20 +355,20 @@ static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid)
357 355
358static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, 356static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
359 struct iwl_lq_sta *lq_data, u8 tid, 357 struct iwl_lq_sta *lq_data, u8 tid,
360 struct sta_info *sta) 358 struct ieee80211_sta *sta)
361{ 359{
362 DECLARE_MAC_BUF(mac); 360 DECLARE_MAC_BUF(mac);
363 361
364 if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { 362 if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) {
365 IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", 363 IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n",
366 print_mac(mac, sta->sta.addr), tid); 364 print_mac(mac, sta->addr), tid);
367 ieee80211_start_tx_ba_session(priv->hw, sta->sta.addr, tid); 365 ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid);
368 } 366 }
369} 367}
370 368
371static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, 369static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
372 struct iwl_lq_sta *lq_data, 370 struct iwl_lq_sta *lq_data,
373 struct sta_info *sta) 371 struct ieee80211_sta *sta)
374{ 372{
375 if ((tid < TID_MAX_LOAD_COUNT)) 373 if ((tid < TID_MAX_LOAD_COUNT))
376 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); 374 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta);
@@ -770,7 +768,8 @@ out:
770/* 768/*
771 * mac80211 sends us Tx status 769 * mac80211 sends us Tx status
772 */ 770 */
773static void rs_tx_status(void *priv_rate, struct net_device *dev, 771static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
772 struct ieee80211_sta *sta, void *priv_sta,
774 struct sk_buff *skb) 773 struct sk_buff *skb)
775{ 774{
776 int status; 775 int status;
@@ -778,11 +777,9 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
778 int rs_index, index = 0; 777 int rs_index, index = 0;
779 struct iwl_lq_sta *lq_sta; 778 struct iwl_lq_sta *lq_sta;
780 struct iwl_link_quality_cmd *table; 779 struct iwl_link_quality_cmd *table;
781 struct sta_info *sta;
782 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 780 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
783 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 781 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
784 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 782 struct ieee80211_hw *hw = priv->hw;
785 struct ieee80211_hw *hw = local_to_hw(local);
786 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 783 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
787 struct iwl_rate_scale_data *window = NULL; 784 struct iwl_rate_scale_data *window = NULL;
788 struct iwl_rate_scale_data *search_win = NULL; 785 struct iwl_rate_scale_data *search_win = NULL;
@@ -808,15 +805,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
808 if (retries > 15) 805 if (retries > 15)
809 retries = 15; 806 retries = 15;
810 807
811 rcu_read_lock(); 808 lq_sta = (struct iwl_lq_sta *)priv_sta;
812
813 sta = sta_info_get(local, hdr->addr1);
814
815 if (!sta || !sta->rate_ctrl_priv)
816 goto out;
817
818
819 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
820 809
821 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 810 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
822 !lq_sta->ibss_sta_added) 811 !lq_sta->ibss_sta_added)
@@ -962,9 +951,8 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
962 } 951 }
963 952
964 /* See if there's a better rate or modulation mode to try. */ 953 /* See if there's a better rate or modulation mode to try. */
965 rs_rate_scale_perform(priv, dev, hdr, sta); 954 rs_rate_scale_perform(priv, hdr, sta, lq_sta);
966out: 955out:
967 rcu_read_unlock();
968 return; 956 return;
969} 957}
970 958
@@ -1140,7 +1128,7 @@ static s32 rs_get_best_rate(struct iwl_priv *priv,
1140static int rs_switch_to_mimo2(struct iwl_priv *priv, 1128static int rs_switch_to_mimo2(struct iwl_priv *priv,
1141 struct iwl_lq_sta *lq_sta, 1129 struct iwl_lq_sta *lq_sta,
1142 struct ieee80211_conf *conf, 1130 struct ieee80211_conf *conf,
1143 struct sta_info *sta, 1131 struct ieee80211_sta *sta,
1144 struct iwl_scale_tbl_info *tbl, int index) 1132 struct iwl_scale_tbl_info *tbl, int index)
1145{ 1133{
1146 u16 rate_mask; 1134 u16 rate_mask;
@@ -1148,10 +1136,10 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1148 s8 is_green = lq_sta->is_green; 1136 s8 is_green = lq_sta->is_green;
1149 1137
1150 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || 1138 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
1151 !sta->sta.ht_info.ht_supported) 1139 !sta->ht_info.ht_supported)
1152 return -1; 1140 return -1;
1153 1141
1154 if (((sta->sta.ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) 1142 if (((sta->ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2)
1155 == WLAN_HT_CAP_SM_PS_STATIC) 1143 == WLAN_HT_CAP_SM_PS_STATIC)
1156 return -1; 1144 return -1;
1157 1145
@@ -1208,7 +1196,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1208static int rs_switch_to_siso(struct iwl_priv *priv, 1196static int rs_switch_to_siso(struct iwl_priv *priv,
1209 struct iwl_lq_sta *lq_sta, 1197 struct iwl_lq_sta *lq_sta,
1210 struct ieee80211_conf *conf, 1198 struct ieee80211_conf *conf,
1211 struct sta_info *sta, 1199 struct ieee80211_sta *sta,
1212 struct iwl_scale_tbl_info *tbl, int index) 1200 struct iwl_scale_tbl_info *tbl, int index)
1213{ 1201{
1214 u16 rate_mask; 1202 u16 rate_mask;
@@ -1216,7 +1204,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
1216 s32 rate; 1204 s32 rate;
1217 1205
1218 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || 1206 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
1219 !sta->sta.ht_info.ht_supported) 1207 !sta->ht_info.ht_supported)
1220 return -1; 1208 return -1;
1221 1209
1222 IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); 1210 IWL_DEBUG_RATE("LQ: try to switch to SISO\n");
@@ -1268,7 +1256,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
1268static int rs_move_legacy_other(struct iwl_priv *priv, 1256static int rs_move_legacy_other(struct iwl_priv *priv,
1269 struct iwl_lq_sta *lq_sta, 1257 struct iwl_lq_sta *lq_sta,
1270 struct ieee80211_conf *conf, 1258 struct ieee80211_conf *conf,
1271 struct sta_info *sta, 1259 struct ieee80211_sta *sta,
1272 int index) 1260 int index)
1273{ 1261{
1274 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1262 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
@@ -1376,7 +1364,7 @@ out:
1376static int rs_move_siso_to_other(struct iwl_priv *priv, 1364static int rs_move_siso_to_other(struct iwl_priv *priv,
1377 struct iwl_lq_sta *lq_sta, 1365 struct iwl_lq_sta *lq_sta,
1378 struct ieee80211_conf *conf, 1366 struct ieee80211_conf *conf,
1379 struct sta_info *sta, int index) 1367 struct ieee80211_sta *sta, int index)
1380{ 1368{
1381 u8 is_green = lq_sta->is_green; 1369 u8 is_green = lq_sta->is_green;
1382 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1370 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
@@ -1487,7 +1475,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1487static int rs_move_mimo_to_other(struct iwl_priv *priv, 1475static int rs_move_mimo_to_other(struct iwl_priv *priv,
1488 struct iwl_lq_sta *lq_sta, 1476 struct iwl_lq_sta *lq_sta,
1489 struct ieee80211_conf *conf, 1477 struct ieee80211_conf *conf,
1490 struct sta_info *sta, int index) 1478 struct ieee80211_sta *sta, int index)
1491{ 1479{
1492 s8 is_green = lq_sta->is_green; 1480 s8 is_green = lq_sta->is_green;
1493 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1481 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
@@ -1680,12 +1668,11 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta)
1680 * Do rate scaling and search for new modulation mode. 1668 * Do rate scaling and search for new modulation mode.
1681 */ 1669 */
1682static void rs_rate_scale_perform(struct iwl_priv *priv, 1670static void rs_rate_scale_perform(struct iwl_priv *priv,
1683 struct net_device *dev,
1684 struct ieee80211_hdr *hdr, 1671 struct ieee80211_hdr *hdr,
1685 struct sta_info *sta) 1672 struct ieee80211_sta *sta,
1673 struct iwl_lq_sta *lq_sta)
1686{ 1674{
1687 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1675 struct ieee80211_hw *hw = priv->hw;
1688 struct ieee80211_hw *hw = local_to_hw(local);
1689 struct ieee80211_conf *conf = &hw->conf; 1676 struct ieee80211_conf *conf = &hw->conf;
1690 int low = IWL_RATE_INVALID; 1677 int low = IWL_RATE_INVALID;
1691 int high = IWL_RATE_INVALID; 1678 int high = IWL_RATE_INVALID;
@@ -1700,7 +1687,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1700 __le16 fc; 1687 __le16 fc;
1701 u16 rate_mask; 1688 u16 rate_mask;
1702 u8 update_lq = 0; 1689 u8 update_lq = 0;
1703 struct iwl_lq_sta *lq_sta;
1704 struct iwl_scale_tbl_info *tbl, *tbl1; 1690 struct iwl_scale_tbl_info *tbl, *tbl1;
1705 u16 rate_scale_index_msk = 0; 1691 u16 rate_scale_index_msk = 0;
1706 u32 rate; 1692 u32 rate;
@@ -1721,11 +1707,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1721 return; 1707 return;
1722 } 1708 }
1723 1709
1724 if (!sta || !sta->rate_ctrl_priv) 1710 if (!sta || !lq_sta)
1725 return; 1711 return;
1726 1712
1727 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 1713 lq_sta->supp_rates = sta->supp_rates[lq_sta->band];
1728 lq_sta->supp_rates = sta->sta.supp_rates[lq_sta->band];
1729 1714
1730 tid = rs_tl_add_packet(lq_sta, hdr); 1715 tid = rs_tl_add_packet(lq_sta, hdr);
1731 1716
@@ -2064,9 +2049,9 @@ out:
2064 2049
2065static void rs_initialize_lq(struct iwl_priv *priv, 2050static void rs_initialize_lq(struct iwl_priv *priv,
2066 struct ieee80211_conf *conf, 2051 struct ieee80211_conf *conf,
2067 struct sta_info *sta) 2052 struct ieee80211_sta *sta,
2053 struct iwl_lq_sta *lq_sta)
2068{ 2054{
2069 struct iwl_lq_sta *lq_sta;
2070 struct iwl_scale_tbl_info *tbl; 2055 struct iwl_scale_tbl_info *tbl;
2071 int rate_idx; 2056 int rate_idx;
2072 int i; 2057 int i;
@@ -2075,10 +2060,9 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2075 u8 active_tbl = 0; 2060 u8 active_tbl = 0;
2076 u8 valid_tx_ant; 2061 u8 valid_tx_ant;
2077 2062
2078 if (!sta || !sta->rate_ctrl_priv) 2063 if (!sta || !lq_sta)
2079 goto out; 2064 goto out;
2080 2065
2081 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
2082 i = lq_sta->last_txrate_idx; 2066 i = lq_sta->last_txrate_idx;
2083 2067
2084 if ((lq_sta->lq.sta_id == 0xff) && 2068 if ((lq_sta->lq.sta_id == 0xff) &&
@@ -2119,37 +2103,30 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2119 return; 2103 return;
2120} 2104}
2121 2105
2122static void rs_get_rate(void *priv_rate, struct net_device *dev, 2106static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
2123 struct ieee80211_supported_band *sband, 2107 struct ieee80211_sta *sta, void *priv_sta,
2124 struct sk_buff *skb, 2108 struct sk_buff *skb, struct rate_selection *sel)
2125 struct rate_selection *sel)
2126{ 2109{
2127 2110
2128 int i; 2111 int i;
2129 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 2112 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
2130 struct ieee80211_conf *conf = &local->hw.conf; 2113 struct ieee80211_conf *conf = &priv->hw->conf;
2131 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2114 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2132 struct sta_info *sta;
2133 __le16 fc; 2115 __le16 fc;
2134 struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
2135 struct iwl_lq_sta *lq_sta; 2116 struct iwl_lq_sta *lq_sta;
2136 2117
2137 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); 2118 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
2138 2119
2139 rcu_read_lock();
2140
2141 sta = sta_info_get(local, hdr->addr1);
2142
2143 /* Send management frames and broadcast/multicast data using lowest 2120 /* Send management frames and broadcast/multicast data using lowest
2144 * rate. */ 2121 * rate. */
2145 fc = hdr->frame_control; 2122 fc = hdr->frame_control;
2146 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || 2123 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) ||
2147 !sta || !sta->rate_ctrl_priv) { 2124 !sta || !priv_sta) {
2148 sel->rate_idx = rate_lowest_index(local, sband, sta); 2125 sel->rate_idx = rate_lowest_index(sband, sta);
2149 goto out; 2126 return;
2150 } 2127 }
2151 2128
2152 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 2129 lq_sta = (struct iwl_lq_sta *)priv_sta;
2153 i = lq_sta->last_txrate_idx; 2130 i = lq_sta->last_txrate_idx;
2154 2131
2155 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 2132 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
@@ -2167,23 +2144,22 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
2167 lq_sta->lq.sta_id = sta_id; 2144 lq_sta->lq.sta_id = sta_id;
2168 lq_sta->lq.rs_table[0].rate_n_flags = 0; 2145 lq_sta->lq.rs_table[0].rate_n_flags = 0;
2169 lq_sta->ibss_sta_added = 1; 2146 lq_sta->ibss_sta_added = 1;
2170 rs_initialize_lq(priv, conf, sta); 2147 rs_initialize_lq(priv, conf, sta, lq_sta);
2171 } 2148 }
2172 } 2149 }
2173 2150
2174 if ((i < 0) || (i > IWL_RATE_COUNT)) { 2151 if ((i < 0) || (i > IWL_RATE_COUNT)) {
2175 sel->rate_idx = rate_lowest_index(local, sband, sta); 2152 sel->rate_idx = rate_lowest_index(sband, sta);
2176 goto out; 2153 return;
2177 } 2154 }
2178 2155
2179 if (sband->band == IEEE80211_BAND_5GHZ) 2156 if (sband->band == IEEE80211_BAND_5GHZ)
2180 i -= IWL_FIRST_OFDM_RATE; 2157 i -= IWL_FIRST_OFDM_RATE;
2181 sel->rate_idx = i; 2158 sel->rate_idx = i;
2182out:
2183 rcu_read_unlock();
2184} 2159}
2185 2160
2186static void *rs_alloc_sta(void *priv_rate, gfp_t gfp) 2161static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
2162 gfp_t gfp)
2187{ 2163{
2188 struct iwl_lq_sta *lq_sta; 2164 struct iwl_lq_sta *lq_sta;
2189 struct iwl_priv *priv; 2165 struct iwl_priv *priv;
@@ -2206,20 +2182,16 @@ static void *rs_alloc_sta(void *priv_rate, gfp_t gfp)
2206 return lq_sta; 2182 return lq_sta;
2207} 2183}
2208 2184
2209static void rs_rate_init(void *priv_rate, void *priv_sta, 2185static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
2210 struct ieee80211_local *local, 2186 struct ieee80211_sta *sta, void *priv_sta)
2211 struct sta_info *sta)
2212{ 2187{
2213 int i, j; 2188 int i, j;
2214 struct ieee80211_conf *conf = &local->hw.conf; 2189 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
2215 struct ieee80211_supported_band *sband; 2190 struct ieee80211_conf *conf = &priv->hw->conf;
2216 struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
2217 struct iwl_lq_sta *lq_sta = priv_sta; 2191 struct iwl_lq_sta *lq_sta = priv_sta;
2218 2192
2219 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
2220
2221 lq_sta->flush_timer = 0; 2193 lq_sta->flush_timer = 0;
2222 lq_sta->supp_rates = sta->sta.supp_rates[sband->band]; 2194 lq_sta->supp_rates = sta->supp_rates[sband->band];
2223 for (j = 0; j < LQ_SIZE; j++) 2195 for (j = 0; j < LQ_SIZE; j++)
2224 for (i = 0; i < IWL_RATE_COUNT; i++) 2196 for (i = 0; i < IWL_RATE_COUNT; i++)
2225 rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); 2197 rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
@@ -2232,17 +2204,17 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2232 2204
2233 lq_sta->ibss_sta_added = 0; 2205 lq_sta->ibss_sta_added = 0;
2234 if (priv->iw_mode == NL80211_IFTYPE_AP) { 2206 if (priv->iw_mode == NL80211_IFTYPE_AP) {
2235 u8 sta_id = iwl_find_station(priv, sta->sta.addr); 2207 u8 sta_id = iwl_find_station(priv, sta->addr);
2236 DECLARE_MAC_BUF(mac); 2208 DECLARE_MAC_BUF(mac);
2237 2209
2238 /* for IBSS the call are from tasklet */ 2210 /* for IBSS the call are from tasklet */
2239 IWL_DEBUG_RATE("LQ: ADD station %s\n", 2211 IWL_DEBUG_RATE("LQ: ADD station %s\n",
2240 print_mac(mac, sta->sta.addr)); 2212 print_mac(mac, sta->addr));
2241 2213
2242 if (sta_id == IWL_INVALID_STATION) { 2214 if (sta_id == IWL_INVALID_STATION) {
2243 IWL_DEBUG_RATE("LQ: ADD station %s\n", 2215 IWL_DEBUG_RATE("LQ: ADD station %s\n",
2244 print_mac(mac, sta->sta.addr)); 2216 print_mac(mac, sta->addr));
2245 sta_id = iwl_add_station_flags(priv, sta->sta.addr, 2217 sta_id = iwl_add_station_flags(priv, sta->addr,
2246 0, CMD_ASYNC, NULL); 2218 0, CMD_ASYNC, NULL);
2247 } 2219 }
2248 if ((sta_id != IWL_INVALID_STATION)) { 2220 if ((sta_id != IWL_INVALID_STATION)) {
@@ -2256,11 +2228,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2256 /* Find highest tx rate supported by hardware and destination station */ 2228 /* Find highest tx rate supported by hardware and destination station */
2257 lq_sta->last_txrate_idx = 3; 2229 lq_sta->last_txrate_idx = 3;
2258 for (i = 0; i < sband->n_bitrates; i++) 2230 for (i = 0; i < sband->n_bitrates; i++)
2259 if (sta->sta.supp_rates[sband->band] & BIT(i)) 2231 if (sta->supp_rates[sband->band] & BIT(i))
2260 lq_sta->last_txrate_idx = i; 2232 lq_sta->last_txrate_idx = i;
2261 2233
2262 /* For MODE_IEEE80211A, skip over cck rates in global rate table */ 2234 /* For MODE_IEEE80211A, skip over cck rates in global rate table */
2263 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) 2235 if (sband->band == IEEE80211_BAND_5GHZ)
2264 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 2236 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
2265 2237
2266 lq_sta->is_dup = 0; 2238 lq_sta->is_dup = 0;
@@ -2301,7 +2273,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2301 lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; 2273 lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID;
2302 lq_sta->drv = priv; 2274 lq_sta->drv = priv;
2303 2275
2304 rs_initialize_lq(priv, conf, sta); 2276 rs_initialize_lq(priv, conf, sta, lq_sta);
2305} 2277}
2306 2278
2307static void rs_fill_link_cmd(const struct iwl_priv *priv, 2279static void rs_fill_link_cmd(const struct iwl_priv *priv,
@@ -2423,9 +2395,9 @@ static void rs_fill_link_cmd(const struct iwl_priv *priv,
2423 lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000); 2395 lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000);
2424} 2396}
2425 2397
2426static void *rs_alloc(struct ieee80211_local *local) 2398static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
2427{ 2399{
2428 return local->hw.priv; 2400 return hw->priv;
2429} 2401}
2430/* rate scale requires free function to be implemented */ 2402/* rate scale requires free function to be implemented */
2431static void rs_free(void *priv_rate) 2403static void rs_free(void *priv_rate)
@@ -2446,12 +2418,12 @@ static void rs_clear(void *priv_rate)
2446#endif /* CONFIG_IWLWIFI_DEBUG */ 2418#endif /* CONFIG_IWLWIFI_DEBUG */
2447} 2419}
2448 2420
2449static void rs_free_sta(void *priv_rate, void *priv_sta) 2421static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
2422 void *priv_sta)
2450{ 2423{
2451 struct iwl_lq_sta *lq_sta = priv_sta; 2424 struct iwl_lq_sta *lq_sta = priv_sta;
2452 struct iwl_priv *priv; 2425 struct iwl_priv *priv = priv_r;
2453 2426
2454 priv = (struct iwl_priv *)priv_rate;
2455 IWL_DEBUG_RATE("enter\n"); 2427 IWL_DEBUG_RATE("enter\n");
2456 kfree(lq_sta); 2428 kfree(lq_sta);
2457 IWL_DEBUG_RATE("leave\n"); 2429 IWL_DEBUG_RATE("leave\n");