aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-23 04:46:46 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-08-27 12:27:19 -0400
commit7e6a588601eb85feb10c7e8898f1f69c3b229a20 (patch)
tree09022d681e613f567ff86d836ad85369b7927ccd
parent238d781d33dcd7941e7ab799c59156e5f7ebda9d (diff)
iwlwifi: move HT configuration data into context
A lot of HT configuration semantically belongs into the context, even if right now it will never be different between contexts. Move it so we're better prepared for future changes in mac80211. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c66
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c26
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c113
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c23
6 files changed, 134 insertions, 115 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index e78f3f0592d6..57629fba3a7d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -602,11 +602,13 @@ static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
602 * Green-field mode is valid if the station supports it and 602 * Green-field mode is valid if the station supports it and
603 * there are no non-GF stations present in the BSS. 603 * there are no non-GF stations present in the BSS.
604 */ 604 */
605static inline u8 rs_use_green(struct ieee80211_sta *sta, 605static bool rs_use_green(struct ieee80211_sta *sta)
606 struct iwl_ht_config *ht_conf)
607{ 606{
607 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
608 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
609
608 return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && 610 return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) &&
609 !(ht_conf->non_GF_STA_present); 611 !(ctx->ht.non_gf_sta_present);
610} 612}
611 613
612/** 614/**
@@ -758,8 +760,8 @@ static bool table_type_matches(struct iwl_scale_tbl_info *a,
758 (a->is_SGI == b->is_SGI); 760 (a->is_SGI == b->is_SGI);
759} 761}
760 762
761static void rs_bt_update_lq(struct iwl_priv *priv, 763static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
762 struct iwl_lq_sta *lq_sta) 764 struct iwl_lq_sta *lq_sta)
763{ 765{
764 struct iwl_scale_tbl_info *tbl; 766 struct iwl_scale_tbl_info *tbl;
765 bool full_concurrent; 767 bool full_concurrent;
@@ -778,7 +780,7 @@ static void rs_bt_update_lq(struct iwl_priv *priv,
778 /* Update uCode's rate table. */ 780 /* Update uCode's rate table. */
779 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 781 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
780 rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); 782 rs_fill_link_cmd(priv, lq_sta, tbl->current_rate);
781 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); 783 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false);
782 784
783 queue_work(priv->workqueue, &priv->bt_full_concurrency); 785 queue_work(priv->workqueue, &priv->bt_full_concurrency);
784 } 786 }
@@ -803,6 +805,8 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
803 u32 tx_rate; 805 u32 tx_rate;
804 struct iwl_scale_tbl_info tbl_type; 806 struct iwl_scale_tbl_info tbl_type;
805 struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 807 struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl;
808 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
809 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
806 810
807 IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n"); 811 IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n");
808 812
@@ -869,7 +873,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
869 lq_sta->missed_rate_counter++; 873 lq_sta->missed_rate_counter++;
870 if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { 874 if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) {
871 lq_sta->missed_rate_counter = 0; 875 lq_sta->missed_rate_counter = 0;
872 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); 876 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false);
873 } 877 }
874 /* Regardless, ignore this status info for outdated rate */ 878 /* Regardless, ignore this status info for outdated rate */
875 return; 879 return;
@@ -969,7 +973,7 @@ done:
969 973
970 /* Is there a need to switch between full concurrency and 3-wire? */ 974 /* Is there a need to switch between full concurrency and 3-wire? */
971 if (priv->bt_ant_couple_ok) 975 if (priv->bt_ant_couple_ok)
972 rs_bt_update_lq(priv, lq_sta); 976 rs_bt_update_lq(priv, ctx, lq_sta);
973} 977}
974 978
975/* 979/*
@@ -1163,6 +1167,8 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1163 u16 rate_mask; 1167 u16 rate_mask;
1164 s32 rate; 1168 s32 rate;
1165 s8 is_green = lq_sta->is_green; 1169 s8 is_green = lq_sta->is_green;
1170 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
1171 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
1166 1172
1167 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1173 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1168 return -1; 1174 return -1;
@@ -1183,7 +1189,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1183 tbl->max_search = IWL_MAX_SEARCH; 1189 tbl->max_search = IWL_MAX_SEARCH;
1184 rate_mask = lq_sta->active_mimo2_rate; 1190 rate_mask = lq_sta->active_mimo2_rate;
1185 1191
1186 if (iwl_is_ht40_tx_allowed(priv, &sta->ht_cap)) 1192 if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
1187 tbl->is_ht40 = 1; 1193 tbl->is_ht40 = 1;
1188 else 1194 else
1189 tbl->is_ht40 = 0; 1195 tbl->is_ht40 = 0;
@@ -1217,6 +1223,8 @@ static int rs_switch_to_mimo3(struct iwl_priv *priv,
1217 u16 rate_mask; 1223 u16 rate_mask;
1218 s32 rate; 1224 s32 rate;
1219 s8 is_green = lq_sta->is_green; 1225 s8 is_green = lq_sta->is_green;
1226 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
1227 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
1220 1228
1221 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1229 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1222 return -1; 1230 return -1;
@@ -1237,7 +1245,7 @@ static int rs_switch_to_mimo3(struct iwl_priv *priv,
1237 tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; 1245 tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH;
1238 rate_mask = lq_sta->active_mimo3_rate; 1246 rate_mask = lq_sta->active_mimo3_rate;
1239 1247
1240 if (iwl_is_ht40_tx_allowed(priv, &sta->ht_cap)) 1248 if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
1241 tbl->is_ht40 = 1; 1249 tbl->is_ht40 = 1;
1242 else 1250 else
1243 tbl->is_ht40 = 0; 1251 tbl->is_ht40 = 0;
@@ -1272,6 +1280,8 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
1272 u16 rate_mask; 1280 u16 rate_mask;
1273 u8 is_green = lq_sta->is_green; 1281 u8 is_green = lq_sta->is_green;
1274 s32 rate; 1282 s32 rate;
1283 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
1284 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
1275 1285
1276 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1286 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1277 return -1; 1287 return -1;
@@ -1284,7 +1294,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
1284 tbl->max_search = IWL_MAX_SEARCH; 1294 tbl->max_search = IWL_MAX_SEARCH;
1285 rate_mask = lq_sta->active_siso_rate; 1295 rate_mask = lq_sta->active_siso_rate;
1286 1296
1287 if (iwl_is_ht40_tx_allowed(priv, &sta->ht_cap)) 1297 if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
1288 tbl->is_ht40 = 1; 1298 tbl->is_ht40 = 1;
1289 else 1299 else
1290 tbl->is_ht40 = 0; 1300 tbl->is_ht40 = 0;
@@ -2086,6 +2096,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
2086 * return rate_n_flags as used in the table 2096 * return rate_n_flags as used in the table
2087 */ 2097 */
2088static u32 rs_update_rate_tbl(struct iwl_priv *priv, 2098static u32 rs_update_rate_tbl(struct iwl_priv *priv,
2099 struct iwl_rxon_context *ctx,
2089 struct iwl_lq_sta *lq_sta, 2100 struct iwl_lq_sta *lq_sta,
2090 struct iwl_scale_tbl_info *tbl, 2101 struct iwl_scale_tbl_info *tbl,
2091 int index, u8 is_green) 2102 int index, u8 is_green)
@@ -2095,7 +2106,7 @@ static u32 rs_update_rate_tbl(struct iwl_priv *priv,
2095 /* Update uCode's rate table. */ 2106 /* Update uCode's rate table. */
2096 rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); 2107 rate = rate_n_flags_from_tbl(priv, tbl, index, is_green);
2097 rs_fill_link_cmd(priv, lq_sta, rate); 2108 rs_fill_link_cmd(priv, lq_sta, rate);
2098 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); 2109 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false);
2099 2110
2100 return rate; 2111 return rate;
2101} 2112}
@@ -2134,6 +2145,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2134 s32 sr; 2145 s32 sr;
2135 u8 tid = MAX_TID_COUNT; 2146 u8 tid = MAX_TID_COUNT;
2136 struct iwl_tid_data *tid_data; 2147 struct iwl_tid_data *tid_data;
2148 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
2149 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
2137 2150
2138 IWL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); 2151 IWL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n");
2139 2152
@@ -2172,7 +2185,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2172 if (is_legacy(tbl->lq_type)) 2185 if (is_legacy(tbl->lq_type))
2173 lq_sta->is_green = 0; 2186 lq_sta->is_green = 0;
2174 else 2187 else
2175 lq_sta->is_green = rs_use_green(sta, &priv->current_ht_config); 2188 lq_sta->is_green = rs_use_green(sta);
2176 is_green = lq_sta->is_green; 2189 is_green = lq_sta->is_green;
2177 2190
2178 /* current tx rate */ 2191 /* current tx rate */
@@ -2211,7 +2224,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2211 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 2224 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
2212 /* get "active" rate info */ 2225 /* get "active" rate info */
2213 index = iwl_hwrate_to_plcp_idx(tbl->current_rate); 2226 index = iwl_hwrate_to_plcp_idx(tbl->current_rate);
2214 rate = rs_update_rate_tbl(priv, lq_sta, 2227 rate = rs_update_rate_tbl(priv, ctx, lq_sta,
2215 tbl, index, is_green); 2228 tbl, index, is_green);
2216 } 2229 }
2217 return; 2230 return;
@@ -2453,7 +2466,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2453lq_update: 2466lq_update:
2454 /* Replace uCode's rate table for the destination station. */ 2467 /* Replace uCode's rate table for the destination station. */
2455 if (update_lq) 2468 if (update_lq)
2456 rate = rs_update_rate_tbl(priv, lq_sta, 2469 rate = rs_update_rate_tbl(priv, ctx, lq_sta,
2457 tbl, index, is_green); 2470 tbl, index, is_green);
2458 2471
2459 if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) { 2472 if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) {
@@ -2495,7 +2508,7 @@ lq_update:
2495 IWL_DEBUG_RATE(priv, "Switch current mcs: %X index: %d\n", 2508 IWL_DEBUG_RATE(priv, "Switch current mcs: %X index: %d\n",
2496 tbl->current_rate, index); 2509 tbl->current_rate, index);
2497 rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); 2510 rs_fill_link_cmd(priv, lq_sta, tbl->current_rate);
2498 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); 2511 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false);
2499 } else 2512 } else
2500 done_search = 1; 2513 done_search = 1;
2501 } 2514 }
@@ -2565,12 +2578,17 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2565 int rate_idx; 2578 int rate_idx;
2566 int i; 2579 int i;
2567 u32 rate; 2580 u32 rate;
2568 u8 use_green = rs_use_green(sta, &priv->current_ht_config); 2581 u8 use_green = rs_use_green(sta);
2569 u8 active_tbl = 0; 2582 u8 active_tbl = 0;
2570 u8 valid_tx_ant; 2583 u8 valid_tx_ant;
2584 struct iwl_station_priv *sta_priv;
2585 struct iwl_rxon_context *ctx;
2571 2586
2572 if (!sta || !lq_sta) 2587 if (!sta || !lq_sta)
2573 goto out; 2588 return;
2589
2590 sta_priv = (void *)sta->drv_priv;
2591 ctx = sta_priv->common.ctx;
2574 2592
2575 i = lq_sta->last_txrate_idx; 2593 i = lq_sta->last_txrate_idx;
2576 2594
@@ -2602,9 +2620,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2602 rs_set_expected_tpt_table(lq_sta, tbl); 2620 rs_set_expected_tpt_table(lq_sta, tbl);
2603 rs_fill_link_cmd(NULL, lq_sta, rate); 2621 rs_fill_link_cmd(NULL, lq_sta, rate);
2604 priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; 2622 priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq;
2605 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_SYNC, true); 2623 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true);
2606 out:
2607 return;
2608} 2624}
2609 2625
2610static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, 2626static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
@@ -2732,7 +2748,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
2732 lq_sta->is_dup = 0; 2748 lq_sta->is_dup = 0;
2733 lq_sta->max_rate_idx = -1; 2749 lq_sta->max_rate_idx = -1;
2734 lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; 2750 lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX;
2735 lq_sta->is_green = rs_use_green(sta, &priv->current_ht_config); 2751 lq_sta->is_green = rs_use_green(sta);
2736 lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); 2752 lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000);
2737 lq_sta->band = priv->band; 2753 lq_sta->band = priv->band;
2738 /* 2754 /*
@@ -2992,6 +3008,9 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
2992 char buf[64]; 3008 char buf[64];
2993 int buf_size; 3009 int buf_size;
2994 u32 parsed_rate; 3010 u32 parsed_rate;
3011 struct iwl_station_priv *sta_priv =
3012 container_of(lq_sta, struct iwl_station_priv, lq_sta);
3013 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
2995 3014
2996 priv = lq_sta->drv; 3015 priv = lq_sta->drv;
2997 memset(buf, 0, sizeof(buf)); 3016 memset(buf, 0, sizeof(buf));
@@ -3014,7 +3033,8 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
3014 3033
3015 if (lq_sta->dbg_fixed_rate) { 3034 if (lq_sta->dbg_fixed_rate) {
3016 rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); 3035 rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate);
3017 iwl_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC, false); 3036 iwl_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC,
3037 false);
3018 } 3038 }
3019 3039
3020 return count; 3040 return count;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index de8db3a3848d..4efca99b2a9c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3671,8 +3671,8 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3671 3671
3672 sta_priv->lq_sta.lq.general_params.flags &= 3672 sta_priv->lq_sta.lq.general_params.flags &=
3673 ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; 3673 ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK;
3674 iwl_send_lq_cmd(priv, &sta_priv->lq_sta.lq, 3674 iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif),
3675 CMD_ASYNC, false); 3675 &sta_priv->lq_sta.lq, CMD_ASYNC, false);
3676 } 3676 }
3677 break; 3677 break;
3678 case IEEE80211_AMPDU_TX_OPERATIONAL: 3678 case IEEE80211_AMPDU_TX_OPERATIONAL:
@@ -3687,8 +3687,8 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3687 3687
3688 sta_priv->lq_sta.lq.general_params.flags |= 3688 sta_priv->lq_sta.lq.general_params.flags |=
3689 LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; 3689 LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK;
3690 iwl_send_lq_cmd(priv, &sta_priv->lq_sta.lq, 3690 iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif),
3691 CMD_ASYNC, false); 3691 &sta_priv->lq_sta.lq, CMD_ASYNC, false);
3692 } 3692 }
3693 ret = 0; 3693 ret = 0;
3694 break; 3694 break;
@@ -3824,23 +3824,23 @@ static void iwl_mac_channel_switch(struct ieee80211_hw *hw,
3824 priv->current_ht_config.smps = conf->smps_mode; 3824 priv->current_ht_config.smps = conf->smps_mode;
3825 3825
3826 /* Configure HT40 channels */ 3826 /* Configure HT40 channels */
3827 ht_conf->is_ht = conf_is_ht(conf); 3827 ctx->ht.enabled = conf_is_ht(conf);
3828 if (ht_conf->is_ht) { 3828 if (ctx->ht.enabled) {
3829 if (conf_is_ht40_minus(conf)) { 3829 if (conf_is_ht40_minus(conf)) {
3830 ht_conf->extension_chan_offset = 3830 ctx->ht.extension_chan_offset =
3831 IEEE80211_HT_PARAM_CHA_SEC_BELOW; 3831 IEEE80211_HT_PARAM_CHA_SEC_BELOW;
3832 ht_conf->is_40mhz = true; 3832 ctx->ht.is_40mhz = true;
3833 } else if (conf_is_ht40_plus(conf)) { 3833 } else if (conf_is_ht40_plus(conf)) {
3834 ht_conf->extension_chan_offset = 3834 ctx->ht.extension_chan_offset =
3835 IEEE80211_HT_PARAM_CHA_SEC_ABOVE; 3835 IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
3836 ht_conf->is_40mhz = true; 3836 ctx->ht.is_40mhz = true;
3837 } else { 3837 } else {
3838 ht_conf->extension_chan_offset = 3838 ctx->ht.extension_chan_offset =
3839 IEEE80211_HT_PARAM_CHA_SEC_NONE; 3839 IEEE80211_HT_PARAM_CHA_SEC_NONE;
3840 ht_conf->is_40mhz = false; 3840 ctx->ht.is_40mhz = false;
3841 } 3841 }
3842 } else 3842 } else
3843 ht_conf->is_40mhz = false; 3843 ctx->ht.is_40mhz = false;
3844 3844
3845 if ((le16_to_cpu(ctx->staging.channel) != ch)) 3845 if ((le16_to_cpu(ctx->staging.channel) != ch))
3846 ctx->staging.flags = 0; 3846 ctx->staging.flags = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index f9abcd80271c..8ec042d4e375 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -202,7 +202,7 @@ static void iwl_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
202 ctx->qos_data.def_qos_parm.qos_flags |= 202 ctx->qos_data.def_qos_parm.qos_flags |=
203 QOS_PARAM_FLG_UPDATE_EDCA_MSK; 203 QOS_PARAM_FLG_UPDATE_EDCA_MSK;
204 204
205 if (priv->current_ht_config.is_ht) 205 if (ctx->ht.enabled)
206 ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; 206 ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;
207 207
208 IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", 208 IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n",
@@ -441,15 +441,15 @@ static bool is_single_rx_stream(struct iwl_priv *priv)
441 priv->current_ht_config.single_chain_sufficient; 441 priv->current_ht_config.single_chain_sufficient;
442} 442}
443 443
444static u8 iwl_is_channel_extension(struct iwl_priv *priv, 444static bool iwl_is_channel_extension(struct iwl_priv *priv,
445 enum ieee80211_band band, 445 enum ieee80211_band band,
446 u16 channel, u8 extension_chan_offset) 446 u16 channel, u8 extension_chan_offset)
447{ 447{
448 const struct iwl_channel_info *ch_info; 448 const struct iwl_channel_info *ch_info;
449 449
450 ch_info = iwl_get_channel_info(priv, band, channel); 450 ch_info = iwl_get_channel_info(priv, band, channel);
451 if (!is_channel_valid(ch_info)) 451 if (!is_channel_valid(ch_info))
452 return 0; 452 return false;
453 453
454 if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) 454 if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
455 return !(ch_info->ht40_extension_channel & 455 return !(ch_info->ht40_extension_channel &
@@ -458,34 +458,31 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv,
458 return !(ch_info->ht40_extension_channel & 458 return !(ch_info->ht40_extension_channel &
459 IEEE80211_CHAN_NO_HT40MINUS); 459 IEEE80211_CHAN_NO_HT40MINUS);
460 460
461 return 0; 461 return false;
462} 462}
463 463
464u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, 464bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
465 struct ieee80211_sta_ht_cap *sta_ht_inf) 465 struct iwl_rxon_context *ctx,
466 struct ieee80211_sta_ht_cap *ht_cap)
466{ 467{
467 struct iwl_ht_config *ht_conf = &priv->current_ht_config; 468 if (!ctx->ht.enabled || !ctx->ht.is_40mhz)
468#if !TODO 469 return false;
469 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
470#endif
471 470
472 if (!ht_conf->is_ht || !ht_conf->is_40mhz) 471 /*
473 return 0; 472 * We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
474
475 /* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
476 * the bit will not set if it is pure 40MHz case 473 * the bit will not set if it is pure 40MHz case
477 */ 474 */
478 if (sta_ht_inf) { 475 if (ht_cap && !ht_cap->ht_supported)
479 if (!sta_ht_inf->ht_supported) 476 return false;
480 return 0; 477
481 }
482#ifdef CONFIG_IWLWIFI_DEBUGFS 478#ifdef CONFIG_IWLWIFI_DEBUGFS
483 if (priv->disable_ht40) 479 if (priv->disable_ht40)
484 return 0; 480 return false;
485#endif 481#endif
482
486 return iwl_is_channel_extension(priv, priv->band, 483 return iwl_is_channel_extension(priv, priv->band,
487 le16_to_cpu(ctx->staging.channel), 484 le16_to_cpu(ctx->staging.channel),
488 ht_conf->extension_chan_offset); 485 ctx->ht.extension_chan_offset);
489} 486}
490EXPORT_SYMBOL(iwl_is_ht40_tx_allowed); 487EXPORT_SYMBOL(iwl_is_ht40_tx_allowed);
491 488
@@ -724,7 +721,7 @@ static void _iwl_set_rxon_ht(struct iwl_priv *priv,
724{ 721{
725 struct iwl_rxon_cmd *rxon = &ctx->staging; 722 struct iwl_rxon_cmd *rxon = &ctx->staging;
726 723
727 if (!ht_conf->is_ht) { 724 if (!ctx->ht.enabled) {
728 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | 725 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK |
729 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | 726 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK |
730 RXON_FLG_HT40_PROT_MSK | 727 RXON_FLG_HT40_PROT_MSK |
@@ -732,22 +729,22 @@ static void _iwl_set_rxon_ht(struct iwl_priv *priv,
732 return; 729 return;
733 } 730 }
734 731
735 /* FIXME: if the definition of ht_protection changed, the "translation" 732 /* FIXME: if the definition of ht.protection changed, the "translation"
736 * will be needed for rxon->flags 733 * will be needed for rxon->flags
737 */ 734 */
738 rxon->flags |= cpu_to_le32(ht_conf->ht_protection << RXON_FLG_HT_OPERATING_MODE_POS); 735 rxon->flags |= cpu_to_le32(ctx->ht.protection << RXON_FLG_HT_OPERATING_MODE_POS);
739 736
740 /* Set up channel bandwidth: 737 /* Set up channel bandwidth:
741 * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */ 738 * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */
742 /* clear the HT channel mode before set the mode */ 739 /* clear the HT channel mode before set the mode */
743 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | 740 rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK |
744 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); 741 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
745 if (iwl_is_ht40_tx_allowed(priv, NULL)) { 742 if (iwl_is_ht40_tx_allowed(priv, ctx, NULL)) {
746 /* pure ht40 */ 743 /* pure ht40 */
747 if (ht_conf->ht_protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { 744 if (ctx->ht.protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
748 rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40; 745 rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40;
749 /* Note: control channel is opposite of extension channel */ 746 /* Note: control channel is opposite of extension channel */
750 switch (ht_conf->extension_chan_offset) { 747 switch (ctx->ht.extension_chan_offset) {
751 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: 748 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
752 rxon->flags &= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; 749 rxon->flags &= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
753 break; 750 break;
@@ -757,7 +754,7 @@ static void _iwl_set_rxon_ht(struct iwl_priv *priv,
757 } 754 }
758 } else { 755 } else {
759 /* Note: control channel is opposite of extension channel */ 756 /* Note: control channel is opposite of extension channel */
760 switch (ht_conf->extension_chan_offset) { 757 switch (ctx->ht.extension_chan_offset) {
761 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: 758 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
762 rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); 759 rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
763 rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED; 760 rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED;
@@ -782,8 +779,8 @@ static void _iwl_set_rxon_ht(struct iwl_priv *priv,
782 779
783 IWL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " 780 IWL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X "
784 "extension channel offset 0x%x\n", 781 "extension channel offset 0x%x\n",
785 le32_to_cpu(rxon->flags), ht_conf->ht_protection, 782 le32_to_cpu(rxon->flags), ctx->ht.protection,
786 ht_conf->extension_chan_offset); 783 ctx->ht.extension_chan_offset);
787} 784}
788 785
789void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) 786void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf)
@@ -1649,15 +1646,16 @@ static void iwl_ht_conf(struct iwl_priv *priv,
1649 struct iwl_ht_config *ht_conf = &priv->current_ht_config; 1646 struct iwl_ht_config *ht_conf = &priv->current_ht_config;
1650 struct ieee80211_sta *sta; 1647 struct ieee80211_sta *sta;
1651 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; 1648 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
1649 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
1652 1650
1653 IWL_DEBUG_MAC80211(priv, "enter:\n"); 1651 IWL_DEBUG_MAC80211(priv, "enter:\n");
1654 1652
1655 if (!ht_conf->is_ht) 1653 if (!ctx->ht.enabled)
1656 return; 1654 return;
1657 1655
1658 ht_conf->ht_protection = 1656 ctx->ht.protection =
1659 bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; 1657 bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION;
1660 ht_conf->non_GF_STA_present = 1658 ctx->ht.non_gf_sta_present =
1661 !!(bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); 1659 !!(bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
1662 1660
1663 ht_conf->single_chain_sufficient = false; 1661 ht_conf->single_chain_sufficient = false;
@@ -2098,29 +2096,32 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2098 2096
2099 spin_lock_irqsave(&priv->lock, flags); 2097 spin_lock_irqsave(&priv->lock, flags);
2100 2098
2101 /* Configure HT40 channels */
2102 ht_conf->is_ht = conf_is_ht(conf);
2103 if (ht_conf->is_ht) {
2104 if (conf_is_ht40_minus(conf)) {
2105 ht_conf->extension_chan_offset =
2106 IEEE80211_HT_PARAM_CHA_SEC_BELOW;
2107 ht_conf->is_40mhz = true;
2108 } else if (conf_is_ht40_plus(conf)) {
2109 ht_conf->extension_chan_offset =
2110 IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
2111 ht_conf->is_40mhz = true;
2112 } else {
2113 ht_conf->extension_chan_offset =
2114 IEEE80211_HT_PARAM_CHA_SEC_NONE;
2115 ht_conf->is_40mhz = false;
2116 }
2117 } else
2118 ht_conf->is_40mhz = false;
2119 /* Default to no protection. Protection mode will later be set
2120 * from BSS config in iwl_ht_conf */
2121 ht_conf->ht_protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE;
2122
2123 for_each_context(priv, ctx) { 2099 for_each_context(priv, ctx) {
2100 /* Configure HT40 channels */
2101 ctx->ht.enabled = conf_is_ht(conf);
2102 if (ctx->ht.enabled) {
2103 if (conf_is_ht40_minus(conf)) {
2104 ctx->ht.extension_chan_offset =
2105 IEEE80211_HT_PARAM_CHA_SEC_BELOW;
2106 ctx->ht.is_40mhz = true;
2107 } else if (conf_is_ht40_plus(conf)) {
2108 ctx->ht.extension_chan_offset =
2109 IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
2110 ctx->ht.is_40mhz = true;
2111 } else {
2112 ctx->ht.extension_chan_offset =
2113 IEEE80211_HT_PARAM_CHA_SEC_NONE;
2114 ctx->ht.is_40mhz = false;
2115 }
2116 } else
2117 ctx->ht.is_40mhz = false;
2118
2119 /*
2120 * Default to no protection. Protection mode will
2121 * later be set from BSS config in iwl_ht_conf
2122 */
2123 ctx->ht.protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE;
2124
2124 /* if we are switching from ht to 2.4 clear flags 2125 /* if we are switching from ht to 2.4 clear flags
2125 * from any ht related info since 2.4 does not 2126 * from any ht related info since 2.4 does not
2126 * support ht */ 2127 * support ht */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 7aa9c6c5c43e..289fef8a881b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -389,8 +389,9 @@ void iwl_set_flags_for_band(struct iwl_priv *priv,
389u8 iwl_get_single_channel_number(struct iwl_priv *priv, 389u8 iwl_get_single_channel_number(struct iwl_priv *priv,
390 enum ieee80211_band band); 390 enum ieee80211_band band);
391void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); 391void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf);
392u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, 392bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
393 struct ieee80211_sta_ht_cap *sta_ht_inf); 393 struct iwl_rxon_context *ctx,
394 struct ieee80211_sta_ht_cap *ht_cap);
394void iwl_connection_init_rx_config(struct iwl_priv *priv, 395void iwl_connection_init_rx_config(struct iwl_priv *priv,
395 struct ieee80211_vif *vif); 396 struct ieee80211_vif *vif);
396void iwl_set_rate(struct iwl_priv *priv); 397void iwl_set_rate(struct iwl_priv *priv);
@@ -720,7 +721,7 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv)
720extern void iwl_send_bt_config(struct iwl_priv *priv); 721extern void iwl_send_bt_config(struct iwl_priv *priv);
721extern int iwl_send_statistics_request(struct iwl_priv *priv, 722extern int iwl_send_statistics_request(struct iwl_priv *priv,
722 u8 flags, bool clear); 723 u8 flags, bool clear);
723extern int iwl_send_lq_cmd(struct iwl_priv *priv, 724extern int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
724 struct iwl_link_quality_cmd *lq, u8 flags, bool init); 725 struct iwl_link_quality_cmd *lq, u8 flags, bool init);
725void iwl_apm_stop(struct iwl_priv *priv); 726void iwl_apm_stop(struct iwl_priv *priv);
726int iwl_apm_init(struct iwl_priv *priv); 727int iwl_apm_init(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 93647688d720..c17c67f767e6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -470,15 +470,8 @@ union iwl_ht_rate_supp {
470#define CFG_HT_MPDU_DENSITY_MIN (0x1) 470#define CFG_HT_MPDU_DENSITY_MIN (0x1)
471 471
472struct iwl_ht_config { 472struct iwl_ht_config {
473 /* self configuration data */
474 bool is_ht;
475 bool is_40mhz;
476 bool single_chain_sufficient; 473 bool single_chain_sufficient;
477 enum ieee80211_smps_mode smps; /* current smps mode */ 474 enum ieee80211_smps_mode smps; /* current smps mode */
478 /* BSS related data */
479 u8 extension_chan_offset;
480 u8 ht_protection;
481 u8 non_GF_STA_present;
482}; 475};
483 476
484/* QoS structures */ 477/* QoS structures */
@@ -1140,6 +1133,13 @@ struct iwl_rxon_context {
1140 u8 key_mapping_keys; 1133 u8 key_mapping_keys;
1141 1134
1142 __le32 station_flags; 1135 __le32 station_flags;
1136
1137 struct {
1138 bool non_gf_sta_present;
1139 u8 protection;
1140 bool enabled, is_40mhz;
1141 u8 extension_chan_offset;
1142 } ht;
1143}; 1143};
1144 1144
1145struct iwl_priv { 1145struct iwl_priv {
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index c18eb89a9aed..ccd09027c7cd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -172,7 +172,8 @@ int iwl_send_add_sta(struct iwl_priv *priv,
172EXPORT_SYMBOL(iwl_send_add_sta); 172EXPORT_SYMBOL(iwl_send_add_sta);
173 173
174static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, 174static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
175 struct ieee80211_sta *sta) 175 struct ieee80211_sta *sta,
176 struct iwl_rxon_context *ctx)
176{ 177{
177 struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap; 178 struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap;
178 __le32 sta_flags; 179 __le32 sta_flags;
@@ -212,7 +213,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
212 sta_flags |= cpu_to_le32( 213 sta_flags |= cpu_to_le32(
213 (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); 214 (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS);
214 215
215 if (iwl_is_ht40_tx_allowed(priv, sta_ht_inf)) 216 if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
216 sta_flags |= STA_FLG_HT40_EN_MSK; 217 sta_flags |= STA_FLG_HT40_EN_MSK;
217 else 218 else
218 sta_flags &= ~STA_FLG_HT40_EN_MSK; 219 sta_flags &= ~STA_FLG_HT40_EN_MSK;
@@ -305,7 +306,7 @@ static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
305 * STA and broadcast STA) pass in a NULL sta, and mac80211 306 * STA and broadcast STA) pass in a NULL sta, and mac80211
306 * doesn't allow HT IBSS. 307 * doesn't allow HT IBSS.
307 */ 308 */
308 iwl_set_ht_add_station(priv, sta_id, sta); 309 iwl_set_ht_add_station(priv, sta_id, sta, ctx);
309 310
310 /* 3945 only */ 311 /* 3945 only */
311 rate = (priv->band == IEEE80211_BAND_5GHZ) ? 312 rate = (priv->band == IEEE80211_BAND_5GHZ) ?
@@ -472,7 +473,7 @@ int iwl_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
472 return -ENOMEM; 473 return -ENOMEM;
473 } 474 }
474 475
475 ret = iwl_send_lq_cmd(priv, link_cmd, CMD_SYNC, true); 476 ret = iwl_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true);
476 if (ret) 477 if (ret)
477 IWL_ERR(priv, "Link quality command failed (%d)\n", ret); 478 IWL_ERR(priv, "Link quality command failed (%d)\n", ret);
478 479
@@ -714,7 +715,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
714 * current LQ command 715 * current LQ command
715 */ 716 */
716 if (send_lq) 717 if (send_lq)
717 iwl_send_lq_cmd(priv, &lq, CMD_SYNC, true); 718 iwl_send_lq_cmd(priv, ctx, &lq, CMD_SYNC, true);
718 spin_lock_irqsave(&priv->sta_lock, flags_spin); 719 spin_lock_irqsave(&priv->sta_lock, flags_spin);
719 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; 720 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS;
720 } 721 }
@@ -1173,16 +1174,12 @@ static inline void iwl_dump_lq_cmd(struct iwl_priv *priv,
1173 * RXON flags are updated and when LQ command is updated. 1174 * RXON flags are updated and when LQ command is updated.
1174 */ 1175 */
1175static bool is_lq_table_valid(struct iwl_priv *priv, 1176static bool is_lq_table_valid(struct iwl_priv *priv,
1177 struct iwl_rxon_context *ctx,
1176 struct iwl_link_quality_cmd *lq) 1178 struct iwl_link_quality_cmd *lq)
1177{ 1179{
1178 int i; 1180 int i;
1179 struct iwl_ht_config *ht_conf = &priv->current_ht_config;
1180#if !TODO
1181 struct iwl_rxon_context *ctx =
1182 &priv->contexts[IWL_RXON_CTX_BSS];
1183#endif
1184 1181
1185 if (ht_conf->is_ht) 1182 if (ctx->ht.enabled)
1186 return true; 1183 return true;
1187 1184
1188 IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", 1185 IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n",
@@ -1208,7 +1205,7 @@ static bool is_lq_table_valid(struct iwl_priv *priv,
1208 * this case to clear the state indicating that station creation is in 1205 * this case to clear the state indicating that station creation is in
1209 * progress. 1206 * progress.
1210 */ 1207 */
1211int iwl_send_lq_cmd(struct iwl_priv *priv, 1208int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
1212 struct iwl_link_quality_cmd *lq, u8 flags, bool init) 1209 struct iwl_link_quality_cmd *lq, u8 flags, bool init)
1213{ 1210{
1214 int ret = 0; 1211 int ret = 0;
@@ -1227,7 +1224,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv,
1227 iwl_dump_lq_cmd(priv, lq); 1224 iwl_dump_lq_cmd(priv, lq);
1228 BUG_ON(init && (cmd.flags & CMD_ASYNC)); 1225 BUG_ON(init && (cmd.flags & CMD_ASYNC));
1229 1226
1230 if (is_lq_table_valid(priv, lq)) 1227 if (is_lq_table_valid(priv, ctx, lq))
1231 ret = iwl_send_cmd(priv, &cmd); 1228 ret = iwl_send_cmd(priv, &cmd);
1232 else 1229 else
1233 ret = -EINVAL; 1230 ret = -EINVAL;