blob: fbaa8d293654738c6ebcea4f1aa965172544bf95 [file] [log] [blame]
Johannes Berg2295c662010-10-23 09:15:41 -07001/******************************************************************************
2 *
3 * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 *
21 * Contact Information:
22 * Intel Linux Wireless <ilw@linux.intel.com>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24 *
25 *****************************************************************************/
26
27#include "iwl-dev.h"
28#include "iwl-agn.h"
29#include "iwl-sta.h"
30#include "iwl-core.h"
31#include "iwl-agn-calib.h"
32
33static int iwlagn_disable_bss(struct iwl_priv *priv,
34 struct iwl_rxon_context *ctx,
35 struct iwl_rxon_cmd *send)
36{
37 __le32 old_filter = send->filter_flags;
38 int ret;
39
40 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
41 ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, sizeof(*send), send);
42
43 send->filter_flags = old_filter;
44
45 if (ret)
46 IWL_ERR(priv, "Error clearing ASSOC_MSK on BSS (%d)\n", ret);
47
48 return ret;
49}
50
51static int iwlagn_disable_pan(struct iwl_priv *priv,
52 struct iwl_rxon_context *ctx,
53 struct iwl_rxon_cmd *send)
54{
55 __le32 old_filter = send->filter_flags;
56 u8 old_dev_type = send->dev_type;
57 int ret;
58
59 send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
60 send->dev_type = RXON_DEV_TYPE_P2P;
61 ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, sizeof(*send), send);
62
63 send->filter_flags = old_filter;
64 send->dev_type = old_dev_type;
65
66 if (ret)
67 IWL_ERR(priv, "Error disabling PAN (%d)\n", ret);
68
69 /* FIXME: WAIT FOR PAN DISABLE */
70 msleep(300);
71
72 return ret;
73}
74
Johannes Bergbd50a8ab2010-10-23 09:15:42 -070075static int iwlagn_update_beacon(struct iwl_priv *priv,
76 struct ieee80211_vif *vif)
77{
78 lockdep_assert_held(&priv->mutex);
79
80 dev_kfree_skb(priv->beacon_skb);
81 priv->beacon_skb = ieee80211_beacon_get(priv->hw, vif);
82 if (!priv->beacon_skb)
83 return -ENOMEM;
84 return iwlagn_send_beacon_cmd(priv);
85}
86
Johannes Berg2295c662010-10-23 09:15:41 -070087/**
88 * iwlagn_commit_rxon - commit staging_rxon to hardware
89 *
90 * The RXON command in staging_rxon is committed to the hardware and
91 * the active_rxon structure is updated with the new data. This
92 * function correctly transitions out of the RXON_ASSOC_MSK state if
93 * a HW tune is required based on the RXON structure changes.
94 */
95int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
96{
97 /* cast away the const for active_rxon in this function */
98 struct iwl_rxon_cmd *active = (void *)&ctx->active;
Johannes Berg2295c662010-10-23 09:15:41 -070099 bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK);
100 int ret;
101
102 lockdep_assert_held(&priv->mutex);
103
104 if (!iwl_is_alive(priv))
105 return -EBUSY;
106
107 /* This function hardcodes a bunch of dual-mode assumptions */
108 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
109
110 if (!ctx->is_active)
111 return 0;
112
113 /* always get timestamp with Rx frame */
114 ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK;
115
116 if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
117 !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
118 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
119 else
120 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
121
122 ret = iwl_check_rxon_cmd(priv, ctx);
123 if (ret) {
124 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n");
125 return -EINVAL;
126 }
127
128 /*
129 * receive commit_rxon request
130 * abort any previous channel switch if still in process
131 */
132 if (priv->switch_rxon.switch_in_progress &&
133 (priv->switch_rxon.channel != ctx->staging.channel)) {
134 IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
135 le16_to_cpu(priv->switch_rxon.channel));
136 iwl_chswitch_done(priv, false);
137 }
138
139 /*
140 * If we don't need to send a full RXON, we can use
141 * iwl_rxon_assoc_cmd which is used to reconfigure filter
142 * and other flags for the current radio configuration.
143 */
144 if (!iwl_full_rxon_required(priv, ctx)) {
145 ret = iwl_send_rxon_assoc(priv, ctx);
146 if (ret) {
147 IWL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret);
148 return ret;
149 }
150
151 memcpy(active, &ctx->staging, sizeof(*active));
152 iwl_print_rx_config_cmd(priv, ctx);
153 return 0;
154 }
155
156 if (priv->cfg->ops->hcmd->set_pan_params) {
157 ret = priv->cfg->ops->hcmd->set_pan_params(priv);
158 if (ret)
159 return ret;
160 }
161
162 iwl_set_rxon_hwcrypto(priv, ctx, !priv->cfg->mod_params->sw_crypto);
163
164 IWL_DEBUG_INFO(priv,
165 "Going to commit RXON\n"
166 " * with%s RXON_FILTER_ASSOC_MSK\n"
167 " * channel = %d\n"
168 " * bssid = %pM\n",
169 (new_assoc ? "" : "out"),
170 le16_to_cpu(ctx->staging.channel),
171 ctx->staging.bssid_addr);
172
173 /*
Johannes Berg52d980c2010-11-10 09:56:45 -0800174 * Always clear associated first, but with the correct config.
175 * This is required as for example station addition for the
176 * AP station must be done after the BSSID is set to correctly
177 * set up filters in the device.
Johannes Berg2295c662010-10-23 09:15:41 -0700178 */
Johannes Berg52d980c2010-11-10 09:56:45 -0800179 if (ctx->ctxid == IWL_RXON_CTX_BSS)
180 ret = iwlagn_disable_bss(priv, ctx, &ctx->staging);
181 else
182 ret = iwlagn_disable_pan(priv, ctx, &ctx->staging);
183 if (ret)
184 return ret;
Johannes Berg2295c662010-10-23 09:15:41 -0700185
Johannes Berg52d980c2010-11-10 09:56:45 -0800186 memcpy(active, &ctx->staging, sizeof(*active));
Johannes Berg2295c662010-10-23 09:15:41 -0700187
Johannes Berg52d980c2010-11-10 09:56:45 -0800188 /*
189 * Un-assoc RXON clears the station table and WEP
190 * keys, so we have to restore those afterwards.
191 */
192 iwl_clear_ucode_stations(priv, ctx);
193 iwl_restore_stations(priv, ctx);
194 ret = iwl_restore_default_wep_keys(priv, ctx);
195 if (ret) {
196 IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret);
197 return ret;
Johannes Berg2295c662010-10-23 09:15:41 -0700198 }
199
200 /* RXON timing must be before associated RXON */
201 ret = iwl_send_rxon_timing(priv, ctx);
202 if (ret) {
203 IWL_ERR(priv, "Failed to send timing (%d)!\n", ret);
204 return ret;
205 }
206
207 if (new_assoc) {
Johannes Bergbd50a8ab2010-10-23 09:15:42 -0700208 /*
209 * We'll run into this code path when beaconing is
210 * enabled, but then we also need to send the beacon
211 * to the device.
212 */
213 if (ctx->vif && (ctx->vif->type == NL80211_IFTYPE_AP)) {
214 ret = iwlagn_update_beacon(priv, ctx->vif);
215 if (ret) {
216 IWL_ERR(priv,
217 "Error sending required beacon (%d)!\n",
218 ret);
219 return ret;
220 }
Johannes Berg2295c662010-10-23 09:15:41 -0700221 }
222
223 priv->start_calib = 0;
224 /*
225 * Apply the new configuration.
226 *
227 * Associated RXON doesn't clear the station table in uCode,
228 * so we don't need to restore stations etc. after this.
229 */
230 ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd,
231 sizeof(struct iwl_rxon_cmd), &ctx->staging);
232 if (ret) {
233 IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
234 return ret;
235 }
236 memcpy(active, &ctx->staging, sizeof(*active));
Johannes Bergbd50a8ab2010-10-23 09:15:42 -0700237
238 /* IBSS beacon needs to be sent after setting assoc */
239 if (ctx->vif && (ctx->vif->type == NL80211_IFTYPE_ADHOC))
240 if (iwlagn_update_beacon(priv, ctx->vif))
241 IWL_ERR(priv, "Error sending IBSS beacon\n");
Johannes Berg2295c662010-10-23 09:15:41 -0700242 }
243
244 iwl_print_rx_config_cmd(priv, ctx);
245
246 iwl_init_sensitivity(priv);
247
248 /*
249 * If we issue a new RXON command which required a tune then we must
250 * send a new TXPOWER command or we won't be able to Tx any frames.
251 *
252 * FIXME: which RXON requires a tune? Can we optimise this out in
253 * some cases?
254 */
255 ret = iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
256 if (ret) {
257 IWL_ERR(priv, "Error sending TX power (%d)\n", ret);
258 return ret;
259 }
260
261 return 0;
262}
263
Wey-Yi Guy35a6eb32010-11-10 09:56:43 -0800264static void iwlagn_update_qos(struct iwl_priv *priv,
265 struct iwl_rxon_context *ctx)
266{
267 int ret;
268
269 if (!ctx->is_active)
270 return;
271
272 ctx->qos_data.def_qos_parm.qos_flags = 0;
273
274 if (ctx->qos_data.qos_active)
275 ctx->qos_data.def_qos_parm.qos_flags |=
276 QOS_PARAM_FLG_UPDATE_EDCA_MSK;
277
278 if (ctx->ht.enabled)
279 ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;
280
281 IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n",
282 ctx->qos_data.qos_active,
283 ctx->qos_data.def_qos_parm.qos_flags);
284
285 ret = iwl_send_cmd_pdu(priv, ctx->qos_cmd,
286 sizeof(struct iwl_qosparam_cmd),
287 &ctx->qos_data.def_qos_parm);
288 if (ret)
289 IWL_ERR(priv, "Failed to update QoS\n");
290}
291
Johannes Berg2295c662010-10-23 09:15:41 -0700292int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
293{
294 struct iwl_priv *priv = hw->priv;
295 struct iwl_rxon_context *ctx;
296 struct ieee80211_conf *conf = &hw->conf;
297 struct ieee80211_channel *channel = conf->channel;
298 const struct iwl_channel_info *ch_info;
299 int ret = 0;
Wey-Yi Guy35a6eb32010-11-10 09:56:43 -0800300 bool ht_changed[NUM_IWL_RXON_CTX] = {};
Johannes Berg2295c662010-10-23 09:15:41 -0700301
302 IWL_DEBUG_MAC80211(priv, "changed %#x", changed);
303
304 mutex_lock(&priv->mutex);
305
306 if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
307 IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
308 goto out;
309 }
310
311 if (!iwl_is_ready(priv)) {
312 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
313 goto out;
314 }
315
316 if (changed & (IEEE80211_CONF_CHANGE_SMPS |
317 IEEE80211_CONF_CHANGE_CHANNEL)) {
318 /* mac80211 uses static for non-HT which is what we want */
319 priv->current_ht_config.smps = conf->smps_mode;
320
321 /*
322 * Recalculate chain counts.
323 *
324 * If monitor mode is enabled then mac80211 will
325 * set up the SM PS mode to OFF if an HT channel is
326 * configured.
327 */
328 if (priv->cfg->ops->hcmd->set_rxon_chain)
329 for_each_context(priv, ctx)
330 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
331 }
332
333 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
334 unsigned long flags;
335
336 ch_info = iwl_get_channel_info(priv, channel->band,
337 channel->hw_value);
338 if (!is_channel_valid(ch_info)) {
339 IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
340 ret = -EINVAL;
341 goto out;
342 }
343
344 spin_lock_irqsave(&priv->lock, flags);
345
346 for_each_context(priv, ctx) {
347 /* Configure HT40 channels */
Wey-Yi Guy35a6eb32010-11-10 09:56:43 -0800348 if (ctx->ht.enabled != conf_is_ht(conf)) {
349 ctx->ht.enabled = conf_is_ht(conf);
350 ht_changed[ctx->ctxid] = true;
351 }
352
Johannes Berg2295c662010-10-23 09:15:41 -0700353 if (ctx->ht.enabled) {
354 if (conf_is_ht40_minus(conf)) {
355 ctx->ht.extension_chan_offset =
356 IEEE80211_HT_PARAM_CHA_SEC_BELOW;
357 ctx->ht.is_40mhz = true;
358 } else if (conf_is_ht40_plus(conf)) {
359 ctx->ht.extension_chan_offset =
360 IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
361 ctx->ht.is_40mhz = true;
362 } else {
363 ctx->ht.extension_chan_offset =
364 IEEE80211_HT_PARAM_CHA_SEC_NONE;
365 ctx->ht.is_40mhz = false;
366 }
367 } else
368 ctx->ht.is_40mhz = false;
369
370 /*
371 * Default to no protection. Protection mode will
372 * later be set from BSS config in iwl_ht_conf
373 */
374 ctx->ht.protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE;
375
376 /* if we are switching from ht to 2.4 clear flags
377 * from any ht related info since 2.4 does not
378 * support ht */
379 if (le16_to_cpu(ctx->staging.channel) !=
380 channel->hw_value)
381 ctx->staging.flags = 0;
382
383 iwl_set_rxon_channel(priv, channel, ctx);
384 iwl_set_rxon_ht(priv, &priv->current_ht_config);
385
386 iwl_set_flags_for_band(priv, ctx, channel->band,
387 ctx->vif);
388 }
389
390 spin_unlock_irqrestore(&priv->lock, flags);
391
392 iwl_update_bcast_stations(priv);
393
394 /*
395 * The list of supported rates and rate mask can be different
396 * for each band; since the band may have changed, reset
397 * the rate mask to what mac80211 lists.
398 */
399 iwl_set_rate(priv);
400 }
401
402 if (changed & (IEEE80211_CONF_CHANGE_PS |
403 IEEE80211_CONF_CHANGE_IDLE)) {
404 ret = iwl_power_update_mode(priv, false);
405 if (ret)
406 IWL_DEBUG_MAC80211(priv, "Error setting sleep level\n");
407 }
408
409 if (changed & IEEE80211_CONF_CHANGE_POWER) {
410 IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
411 priv->tx_power_user_lmt, conf->power_level);
412
413 iwl_set_tx_power(priv, conf->power_level, false);
414 }
415
416 for_each_context(priv, ctx) {
417 if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
418 continue;
419 iwlagn_commit_rxon(priv, ctx);
Wey-Yi Guy35a6eb32010-11-10 09:56:43 -0800420 if (ht_changed[ctx->ctxid])
421 iwlagn_update_qos(priv, ctx);
Johannes Berg2295c662010-10-23 09:15:41 -0700422 }
423 out:
424 mutex_unlock(&priv->mutex);
425 return ret;
426}
427
Johannes Berg2295c662010-10-23 09:15:41 -0700428static void iwlagn_check_needed_chains(struct iwl_priv *priv,
429 struct iwl_rxon_context *ctx,
430 struct ieee80211_bss_conf *bss_conf)
431{
432 struct ieee80211_vif *vif = ctx->vif;
433 struct iwl_rxon_context *tmp;
434 struct ieee80211_sta *sta;
435 struct iwl_ht_config *ht_conf = &priv->current_ht_config;
436 bool need_multiple;
437
438 lockdep_assert_held(&priv->mutex);
439
440 switch (vif->type) {
441 case NL80211_IFTYPE_STATION:
442 rcu_read_lock();
443 sta = ieee80211_find_sta(vif, bss_conf->bssid);
444 if (sta) {
445 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
446 int maxstreams;
447
448 maxstreams = (ht_cap->mcs.tx_params &
449 IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
450 >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT;
451 maxstreams += 1;
452
Johannes Berg2e1fea42010-11-10 09:56:44 -0800453 need_multiple = true;
454
Johannes Berg2295c662010-10-23 09:15:41 -0700455 if ((ht_cap->mcs.rx_mask[1] == 0) &&
456 (ht_cap->mcs.rx_mask[2] == 0))
457 need_multiple = false;
458 if (maxstreams <= 1)
Johannes Berg2e1fea42010-11-10 09:56:44 -0800459 need_multiple = false;
Johannes Berg2295c662010-10-23 09:15:41 -0700460 } else {
461 /*
462 * If at all, this can only happen through a race
463 * when the AP disconnects us while we're still
464 * setting up the connection, in that case mac80211
465 * will soon tell us about that.
466 */
467 need_multiple = false;
468 }
469 rcu_read_unlock();
470 break;
471 case NL80211_IFTYPE_ADHOC:
472 /* currently */
473 need_multiple = false;
474 break;
475 default:
476 /* only AP really */
477 need_multiple = true;
478 break;
479 }
480
481 ctx->ht_need_multiple_chains = need_multiple;
482
483 if (!need_multiple) {
484 /* check all contexts */
485 for_each_context(priv, tmp) {
486 if (!tmp->vif)
487 continue;
488 if (tmp->ht_need_multiple_chains) {
489 need_multiple = true;
490 break;
491 }
492 }
493 }
494
495 ht_conf->single_chain_sufficient = !need_multiple;
496}
497
498void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
499 struct ieee80211_vif *vif,
500 struct ieee80211_bss_conf *bss_conf,
501 u32 changes)
502{
503 struct iwl_priv *priv = hw->priv;
504 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
505 int ret;
506 bool force = false;
507
508 mutex_lock(&priv->mutex);
509
Johannes Berg893654d2010-11-10 18:25:47 -0800510 if (WARN_ON(!ctx->vif)) {
511 mutex_unlock(&priv->mutex);
512 return;
513 }
514
Johannes Berg2295c662010-10-23 09:15:41 -0700515 if (changes & BSS_CHANGED_BEACON_INT)
516 force = true;
517
518 if (changes & BSS_CHANGED_QOS) {
519 ctx->qos_data.qos_active = bss_conf->qos;
520 iwlagn_update_qos(priv, ctx);
521 }
522
523 ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid);
524 if (vif->bss_conf.use_short_preamble)
525 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
526 else
527 ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
528
529 if (changes & BSS_CHANGED_ASSOC) {
530 if (bss_conf->assoc) {
531 iwl_led_associate(priv);
532 priv->timestamp = bss_conf->timestamp;
533 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
534 } else {
535 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
536 iwl_led_disassociate(priv);
537 }
538 }
539
540 if (ctx->ht.enabled) {
541 ctx->ht.protection = bss_conf->ht_operation_mode &
542 IEEE80211_HT_OP_MODE_PROTECTION;
543 ctx->ht.non_gf_sta_present = !!(bss_conf->ht_operation_mode &
544 IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
545 iwlagn_check_needed_chains(priv, ctx, bss_conf);
Johannes Bergb2769b82010-11-10 09:56:47 -0800546 iwl_set_rxon_ht(priv, &priv->current_ht_config);
Johannes Berg2295c662010-10-23 09:15:41 -0700547 }
548
549 if (priv->cfg->ops->hcmd->set_rxon_chain)
550 priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
551
552 if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
553 ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK;
554 else
555 ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
556
557 if (bss_conf->use_cts_prot)
558 ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
559 else
560 ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN;
561
562 memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN);
563
564 if (vif->type == NL80211_IFTYPE_AP ||
565 vif->type == NL80211_IFTYPE_ADHOC) {
566 if (vif->bss_conf.enable_beacon) {
567 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
568 priv->beacon_ctx = ctx;
569 } else {
570 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
571 priv->beacon_ctx = NULL;
572 }
573 }
574
575 if (force || memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
576 iwlagn_commit_rxon(priv, ctx);
577
Johannes Berg8da8e622010-11-10 09:56:46 -0800578 if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc) {
579 /*
580 * The chain noise calibration will enable PM upon
581 * completion. If calibration has already been run
582 * then we need to enable power management here.
583 */
584 if (priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE)
585 iwl_power_update_mode(priv, false);
586
587 /* Enable RX differential gain and sensitivity calibrations */
588 iwl_chain_noise_reset(priv);
589 priv->start_calib = 1;
590 }
591
Johannes Berg2295c662010-10-23 09:15:41 -0700592 if (changes & BSS_CHANGED_IBSS) {
593 ret = iwlagn_manage_ibss_station(priv, vif,
594 bss_conf->ibss_joined);
595 if (ret)
596 IWL_ERR(priv, "failed to %s IBSS station %pM\n",
597 bss_conf->ibss_joined ? "add" : "remove",
598 bss_conf->bssid);
599 }
600
Johannes Bergbd50a8ab2010-10-23 09:15:42 -0700601 if (changes & BSS_CHANGED_BEACON && vif->type == NL80211_IFTYPE_ADHOC &&
602 priv->beacon_ctx) {
603 if (iwlagn_update_beacon(priv, vif))
604 IWL_ERR(priv, "Error sending IBSS beacon\n");
605 }
606
Johannes Berg2295c662010-10-23 09:15:41 -0700607 mutex_unlock(&priv->mutex);
608}
Johannes Bergae79d232010-11-10 09:56:38 -0800609
610void iwlagn_post_scan(struct iwl_priv *priv)
611{
612 struct iwl_rxon_context *ctx;
613
614 /*
615 * Since setting the RXON may have been deferred while
616 * performing the scan, fire one off if needed
617 */
618 for_each_context(priv, ctx)
619 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
620 iwlagn_commit_rxon(priv, ctx);
621
622 if (priv->cfg->ops->hcmd->set_pan_params)
623 priv->cfg->ops->hcmd->set_pan_params(priv);
624}