aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-23 04:46:45 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-08-27 12:26:54 -0400
commit238d781d33dcd7941e7ab799c59156e5f7ebda9d (patch)
treed9cc8c5b60b2feeee14a6a98d22603e769459c1b /drivers/net/wireless/iwlwifi/iwl-sta.c
parent770e13bdda27065e31b3ab4daa3a04b6429719a1 (diff)
iwlwifi: add context pointer to station
Sometimes we only pass around station pointers but need to find the context they belong to, so store it in there. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-sta.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index e6bb81b1514c..c18eb89a9aed 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -172,12 +172,13 @@ 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_ht_cap *sta_ht_inf) 175 struct ieee80211_sta *sta)
176{ 176{
177 struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap;
177 __le32 sta_flags; 178 __le32 sta_flags;
178 u8 mimo_ps_mode; 179 u8 mimo_ps_mode;
179 180
180 if (!sta_ht_inf || !sta_ht_inf->ht_supported) 181 if (!sta || !sta_ht_inf->ht_supported)
181 goto done; 182 goto done;
182 183
183 mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; 184 mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2;
@@ -228,7 +229,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
228 */ 229 */
229static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 230static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
230 const u8 *addr, bool is_ap, 231 const u8 *addr, bool is_ap,
231 struct ieee80211_sta_ht_cap *ht_info) 232 struct ieee80211_sta *sta)
232{ 233{
233 struct iwl_station_entry *station; 234 struct iwl_station_entry *station;
234 int i; 235 int i;
@@ -292,12 +293,19 @@ static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
292 station->sta.station_flags = ctx->station_flags; 293 station->sta.station_flags = ctx->station_flags;
293 station->ctxid = ctx->ctxid; 294 station->ctxid = ctx->ctxid;
294 295
296 if (sta) {
297 struct iwl_station_priv_common *sta_priv;
298
299 sta_priv = (void *)sta->drv_priv;
300 sta_priv->ctx = ctx;
301 }
302
295 /* 303 /*
296 * OK to call unconditionally, since local stations (IBSS BSSID 304 * OK to call unconditionally, since local stations (IBSS BSSID
297 * STA and broadcast STA) pass in a NULL ht_info, and mac80211 305 * STA and broadcast STA) pass in a NULL sta, and mac80211
298 * doesn't allow HT IBSS. 306 * doesn't allow HT IBSS.
299 */ 307 */
300 iwl_set_ht_add_station(priv, sta_id, ht_info); 308 iwl_set_ht_add_station(priv, sta_id, sta);
301 309
302 /* 3945 only */ 310 /* 3945 only */
303 rate = (priv->band == IEEE80211_BAND_5GHZ) ? 311 rate = (priv->band == IEEE80211_BAND_5GHZ) ?
@@ -316,7 +324,7 @@ static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
316 */ 324 */
317int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 325int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
318 const u8 *addr, bool is_ap, 326 const u8 *addr, bool is_ap,
319 struct ieee80211_sta_ht_cap *ht_info, u8 *sta_id_r) 327 struct ieee80211_sta *sta, u8 *sta_id_r)
320{ 328{
321 unsigned long flags_spin; 329 unsigned long flags_spin;
322 int ret = 0; 330 int ret = 0;
@@ -325,7 +333,7 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
325 333
326 *sta_id_r = 0; 334 *sta_id_r = 0;
327 spin_lock_irqsave(&priv->sta_lock, flags_spin); 335 spin_lock_irqsave(&priv->sta_lock, flags_spin);
328 sta_id = iwl_prep_station(priv, ctx, addr, is_ap, ht_info); 336 sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta);
329 if (sta_id == IWL_INVALID_STATION) { 337 if (sta_id == IWL_INVALID_STATION) {
330 IWL_ERR(priv, "Unable to prepare station %pM for addition\n", 338 IWL_ERR(priv, "Unable to prepare station %pM for addition\n",
331 addr); 339 addr);