iwl-agn-rxon.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. /******************************************************************************
  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. #include "iwl-dev.h"
  27. #include "iwl-agn.h"
  28. #include "iwl-sta.h"
  29. #include "iwl-core.h"
  30. #include "iwl-agn-calib.h"
  31. static int iwlagn_disable_bss(struct iwl_priv *priv,
  32. struct iwl_rxon_context *ctx,
  33. struct iwl_rxon_cmd *send)
  34. {
  35. __le32 old_filter = send->filter_flags;
  36. int ret;
  37. send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
  38. ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, sizeof(*send), send);
  39. send->filter_flags = old_filter;
  40. if (ret)
  41. IWL_ERR(priv, "Error clearing ASSOC_MSK on BSS (%d)\n", ret);
  42. return ret;
  43. }
  44. static int iwlagn_disable_pan(struct iwl_priv *priv,
  45. struct iwl_rxon_context *ctx,
  46. struct iwl_rxon_cmd *send)
  47. {
  48. __le32 old_filter = send->filter_flags;
  49. u8 old_dev_type = send->dev_type;
  50. int ret;
  51. send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
  52. send->dev_type = RXON_DEV_TYPE_P2P;
  53. ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, sizeof(*send), send);
  54. send->filter_flags = old_filter;
  55. send->dev_type = old_dev_type;
  56. if (ret)
  57. IWL_ERR(priv, "Error disabling PAN (%d)\n", ret);
  58. /* FIXME: WAIT FOR PAN DISABLE */
  59. msleep(300);
  60. return ret;
  61. }
  62. static void iwlagn_update_qos(struct iwl_priv *priv,
  63. struct iwl_rxon_context *ctx)
  64. {
  65. int ret;
  66. if (!ctx->is_active)
  67. return;
  68. ctx->qos_data.def_qos_parm.qos_flags = 0;
  69. if (ctx->qos_data.qos_active)
  70. ctx->qos_data.def_qos_parm.qos_flags |=
  71. QOS_PARAM_FLG_UPDATE_EDCA_MSK;
  72. if (ctx->ht.enabled)
  73. ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;
  74. IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n",
  75. ctx->qos_data.qos_active,
  76. ctx->qos_data.def_qos_parm.qos_flags);
  77. ret = iwl_send_cmd_pdu(priv, ctx->qos_cmd,
  78. sizeof(struct iwl_qosparam_cmd),
  79. &ctx->qos_data.def_qos_parm);
  80. if (ret)
  81. IWL_ERR(priv, "Failed to update QoS\n");
  82. }
  83. static int iwlagn_update_beacon(struct iwl_priv *priv,
  84. struct ieee80211_vif *vif)
  85. {
  86. lockdep_assert_held(&priv->mutex);
  87. dev_kfree_skb(priv->beacon_skb);
  88. priv->beacon_skb = ieee80211_beacon_get(priv->hw, vif);
  89. if (!priv->beacon_skb)
  90. return -ENOMEM;
  91. return iwlagn_send_beacon_cmd(priv);
  92. }
  93. /**
  94. * iwlagn_commit_rxon - commit staging_rxon to hardware
  95. *
  96. * The RXON command in staging_rxon is committed to the hardware and
  97. * the active_rxon structure is updated with the new data. This
  98. * function correctly transitions out of the RXON_ASSOC_MSK state if
  99. * a HW tune is required based on the RXON structure changes.
  100. */
  101. int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
  102. {
  103. /* cast away the const for active_rxon in this function */
  104. struct iwl_rxon_cmd *active = (void *)&ctx->active;
  105. bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK);
  106. bool old_assoc = !!(ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK);
  107. int ret;
  108. lockdep_assert_held(&priv->mutex);
  109. if (!iwl_is_alive(priv))
  110. return -EBUSY;
  111. /* This function hardcodes a bunch of dual-mode assumptions */
  112. BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
  113. if (!ctx->is_active)
  114. return 0;
  115. /* always get timestamp with Rx frame */
  116. ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK;
  117. if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
  118. !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
  119. ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
  120. else
  121. ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
  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. * receive commit_rxon request
  129. * abort any previous channel switch if still in process
  130. */
  131. if (priv->switch_rxon.switch_in_progress &&
  132. (priv->switch_rxon.channel != ctx->staging.channel)) {
  133. IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
  134. le16_to_cpu(priv->switch_rxon.channel));
  135. iwl_chswitch_done(priv, false);
  136. }
  137. /*
  138. * If we don't need to send a full RXON, we can use
  139. * iwl_rxon_assoc_cmd which is used to reconfigure filter
  140. * and other flags for the current radio configuration.
  141. */
  142. if (!iwl_full_rxon_required(priv, ctx)) {
  143. ret = iwl_send_rxon_assoc(priv, ctx);
  144. if (ret) {
  145. IWL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret);
  146. return ret;
  147. }
  148. memcpy(active, &ctx->staging, sizeof(*active));
  149. iwl_print_rx_config_cmd(priv, ctx);
  150. return 0;
  151. }
  152. if (priv->cfg->ops->hcmd->set_pan_params) {
  153. ret = priv->cfg->ops->hcmd->set_pan_params(priv);
  154. if (ret)
  155. return ret;
  156. }
  157. iwl_set_rxon_hwcrypto(priv, ctx, !priv->cfg->mod_params->sw_crypto);
  158. IWL_DEBUG_INFO(priv,
  159. "Going to commit RXON\n"
  160. " * with%s RXON_FILTER_ASSOC_MSK\n"
  161. " * channel = %d\n"
  162. " * bssid = %pM\n",
  163. (new_assoc ? "" : "out"),
  164. le16_to_cpu(ctx->staging.channel),
  165. ctx->staging.bssid_addr);
  166. /*
  167. * Always clear associated first, but with the correct config.
  168. * This is required as for example station addition for the
  169. * AP station must be done after the BSSID is set to correctly
  170. * set up filters in the device.
  171. */
  172. if ((old_assoc && new_assoc) || !new_assoc) {
  173. if (ctx->ctxid == IWL_RXON_CTX_BSS)
  174. ret = iwlagn_disable_bss(priv, ctx, &ctx->staging);
  175. else
  176. ret = iwlagn_disable_pan(priv, ctx, &ctx->staging);
  177. if (ret)
  178. return ret;
  179. memcpy(active, &ctx->staging, sizeof(*active));
  180. /*
  181. * Un-assoc RXON clears the station table and WEP
  182. * keys, so we have to restore those afterwards.
  183. */
  184. iwl_clear_ucode_stations(priv, ctx);
  185. iwl_restore_stations(priv, ctx);
  186. ret = iwl_restore_default_wep_keys(priv, ctx);
  187. if (ret) {
  188. IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret);
  189. return ret;
  190. }
  191. }
  192. /* RXON timing must be before associated RXON */
  193. ret = iwl_send_rxon_timing(priv, ctx);
  194. if (ret) {
  195. IWL_ERR(priv, "Failed to send timing (%d)!\n", ret);
  196. return ret;
  197. }
  198. if (new_assoc) {
  199. /* QoS info may be cleared by previous un-assoc RXON */
  200. iwlagn_update_qos(priv, ctx);
  201. /*
  202. * We'll run into this code path when beaconing is
  203. * enabled, but then we also need to send the beacon
  204. * to the device.
  205. */
  206. if (ctx->vif && (ctx->vif->type == NL80211_IFTYPE_AP)) {
  207. ret = iwlagn_update_beacon(priv, ctx->vif);
  208. if (ret) {
  209. IWL_ERR(priv,
  210. "Error sending required beacon (%d)!\n",
  211. ret);
  212. return ret;
  213. }
  214. }
  215. priv->start_calib = 0;
  216. /*
  217. * Apply the new configuration.
  218. *
  219. * Associated RXON doesn't clear the station table in uCode,
  220. * so we don't need to restore stations etc. after this.
  221. */
  222. ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd,
  223. sizeof(struct iwl_rxon_cmd), &ctx->staging);
  224. if (ret) {
  225. IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
  226. return ret;
  227. }
  228. memcpy(active, &ctx->staging, sizeof(*active));
  229. iwl_reprogram_ap_sta(priv, ctx);
  230. /* IBSS beacon needs to be sent after setting assoc */
  231. if (ctx->vif && (ctx->vif->type == NL80211_IFTYPE_ADHOC))
  232. if (iwlagn_update_beacon(priv, ctx->vif))
  233. IWL_ERR(priv, "Error sending IBSS beacon\n");
  234. }
  235. iwl_print_rx_config_cmd(priv, ctx);
  236. iwl_init_sensitivity(priv);
  237. /*
  238. * If we issue a new RXON command which required a tune then we must
  239. * send a new TXPOWER command or we won't be able to Tx any frames.
  240. *
  241. * FIXME: which RXON requires a tune? Can we optimise this out in
  242. * some cases?
  243. */
  244. ret = iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
  245. if (ret) {
  246. IWL_ERR(priv, "Error sending TX power (%d)\n", ret);
  247. return ret;
  248. }
  249. return 0;
  250. }
  251. int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
  252. {
  253. struct iwl_priv *priv = hw->priv;
  254. struct iwl_rxon_context *ctx;
  255. struct ieee80211_conf *conf = &hw->conf;
  256. struct ieee80211_channel *channel = conf->channel;
  257. const struct iwl_channel_info *ch_info;
  258. int ret = 0;
  259. bool ht_changed[NUM_IWL_RXON_CTX] = {};
  260. IWL_DEBUG_MAC80211(priv, "changed %#x", changed);
  261. mutex_lock(&priv->mutex);
  262. if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
  263. IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
  264. goto out;
  265. }
  266. if (!iwl_is_ready(priv)) {
  267. IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
  268. goto out;
  269. }
  270. if (changed & (IEEE80211_CONF_CHANGE_SMPS |
  271. IEEE80211_CONF_CHANGE_CHANNEL)) {
  272. /* mac80211 uses static for non-HT which is what we want */
  273. priv->current_ht_config.smps = conf->smps_mode;
  274. /*
  275. * Recalculate chain counts.
  276. *
  277. * If monitor mode is enabled then mac80211 will
  278. * set up the SM PS mode to OFF if an HT channel is
  279. * configured.
  280. */
  281. if (priv->cfg->ops->hcmd->set_rxon_chain)
  282. for_each_context(priv, ctx)
  283. priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
  284. }
  285. if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  286. unsigned long flags;
  287. ch_info = iwl_get_channel_info(priv, channel->band,
  288. channel->hw_value);
  289. if (!is_channel_valid(ch_info)) {
  290. IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
  291. ret = -EINVAL;
  292. goto out;
  293. }
  294. spin_lock_irqsave(&priv->lock, flags);
  295. for_each_context(priv, ctx) {
  296. /* Configure HT40 channels */
  297. if (ctx->ht.enabled != conf_is_ht(conf)) {
  298. ctx->ht.enabled = conf_is_ht(conf);
  299. ht_changed[ctx->ctxid] = true;
  300. }
  301. if (ctx->ht.enabled) {
  302. if (conf_is_ht40_minus(conf)) {
  303. ctx->ht.extension_chan_offset =
  304. IEEE80211_HT_PARAM_CHA_SEC_BELOW;
  305. ctx->ht.is_40mhz = true;
  306. } else if (conf_is_ht40_plus(conf)) {
  307. ctx->ht.extension_chan_offset =
  308. IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
  309. ctx->ht.is_40mhz = true;
  310. } else {
  311. ctx->ht.extension_chan_offset =
  312. IEEE80211_HT_PARAM_CHA_SEC_NONE;
  313. ctx->ht.is_40mhz = false;
  314. }
  315. } else
  316. ctx->ht.is_40mhz = false;
  317. /*
  318. * Default to no protection. Protection mode will
  319. * later be set from BSS config in iwl_ht_conf
  320. */
  321. ctx->ht.protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE;
  322. /* if we are switching from ht to 2.4 clear flags
  323. * from any ht related info since 2.4 does not
  324. * support ht */
  325. if (le16_to_cpu(ctx->staging.channel) !=
  326. channel->hw_value)
  327. ctx->staging.flags = 0;
  328. iwl_set_rxon_channel(priv, channel, ctx);
  329. iwl_set_rxon_ht(priv, &priv->current_ht_config);
  330. iwl_set_flags_for_band(priv, ctx, channel->band,
  331. ctx->vif);
  332. }
  333. spin_unlock_irqrestore(&priv->lock, flags);
  334. iwl_update_bcast_stations(priv);
  335. /*
  336. * The list of supported rates and rate mask can be different
  337. * for each band; since the band may have changed, reset
  338. * the rate mask to what mac80211 lists.
  339. */
  340. iwl_set_rate(priv);
  341. }
  342. if (changed & (IEEE80211_CONF_CHANGE_PS |
  343. IEEE80211_CONF_CHANGE_IDLE)) {
  344. ret = iwl_power_update_mode(priv, false);
  345. if (ret)
  346. IWL_DEBUG_MAC80211(priv, "Error setting sleep level\n");
  347. }
  348. if (changed & IEEE80211_CONF_CHANGE_POWER) {
  349. IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
  350. priv->tx_power_user_lmt, conf->power_level);
  351. iwl_set_tx_power(priv, conf->power_level, false);
  352. }
  353. for_each_context(priv, ctx) {
  354. if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
  355. continue;
  356. iwlagn_commit_rxon(priv, ctx);
  357. if (ht_changed[ctx->ctxid])
  358. iwlagn_update_qos(priv, ctx);
  359. }
  360. out:
  361. mutex_unlock(&priv->mutex);
  362. return ret;
  363. }
  364. static void iwlagn_check_needed_chains(struct iwl_priv *priv,
  365. struct iwl_rxon_context *ctx,
  366. struct ieee80211_bss_conf *bss_conf)
  367. {
  368. struct ieee80211_vif *vif = ctx->vif;
  369. struct iwl_rxon_context *tmp;
  370. struct ieee80211_sta *sta;
  371. struct iwl_ht_config *ht_conf = &priv->current_ht_config;
  372. bool need_multiple;
  373. lockdep_assert_held(&priv->mutex);
  374. switch (vif->type) {
  375. case NL80211_IFTYPE_STATION:
  376. rcu_read_lock();
  377. sta = ieee80211_find_sta(vif, bss_conf->bssid);
  378. if (sta) {
  379. struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
  380. int maxstreams;
  381. maxstreams = (ht_cap->mcs.tx_params &
  382. IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
  383. >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT;
  384. maxstreams += 1;
  385. need_multiple = true;
  386. if ((ht_cap->mcs.rx_mask[1] == 0) &&
  387. (ht_cap->mcs.rx_mask[2] == 0))
  388. need_multiple = false;
  389. if (maxstreams <= 1)
  390. need_multiple = false;
  391. } else {
  392. /*
  393. * If at all, this can only happen through a race
  394. * when the AP disconnects us while we're still
  395. * setting up the connection, in that case mac80211
  396. * will soon tell us about that.
  397. */
  398. need_multiple = false;
  399. }
  400. rcu_read_unlock();
  401. break;
  402. case NL80211_IFTYPE_ADHOC:
  403. /* currently */
  404. need_multiple = false;
  405. break;
  406. default:
  407. /* only AP really */
  408. need_multiple = true;
  409. break;
  410. }
  411. ctx->ht_need_multiple_chains = need_multiple;
  412. if (!need_multiple) {
  413. /* check all contexts */
  414. for_each_context(priv, tmp) {
  415. if (!tmp->vif)
  416. continue;
  417. if (tmp->ht_need_multiple_chains) {
  418. need_multiple = true;
  419. break;
  420. }
  421. }
  422. }
  423. ht_conf->single_chain_sufficient = !need_multiple;
  424. }
  425. void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
  426. struct ieee80211_vif *vif,
  427. struct ieee80211_bss_conf *bss_conf,
  428. u32 changes)
  429. {
  430. struct iwl_priv *priv = hw->priv;
  431. struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
  432. int ret;
  433. bool force = false;
  434. mutex_lock(&priv->mutex);
  435. if (WARN_ON(!ctx->vif)) {
  436. mutex_unlock(&priv->mutex);
  437. return;
  438. }
  439. if (changes & BSS_CHANGED_BEACON_INT)
  440. force = true;
  441. if (changes & BSS_CHANGED_QOS) {
  442. ctx->qos_data.qos_active = bss_conf->qos;
  443. iwlagn_update_qos(priv, ctx);
  444. }
  445. ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid);
  446. if (vif->bss_conf.use_short_preamble)
  447. ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
  448. else
  449. ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
  450. if (changes & BSS_CHANGED_ASSOC) {
  451. if (bss_conf->assoc) {
  452. iwl_led_associate(priv);
  453. priv->timestamp = bss_conf->timestamp;
  454. ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
  455. } else {
  456. ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
  457. iwl_led_disassociate(priv);
  458. }
  459. }
  460. if (ctx->ht.enabled) {
  461. ctx->ht.protection = bss_conf->ht_operation_mode &
  462. IEEE80211_HT_OP_MODE_PROTECTION;
  463. ctx->ht.non_gf_sta_present = !!(bss_conf->ht_operation_mode &
  464. IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
  465. iwlagn_check_needed_chains(priv, ctx, bss_conf);
  466. iwl_set_rxon_ht(priv, &priv->current_ht_config);
  467. }
  468. if (priv->cfg->ops->hcmd->set_rxon_chain)
  469. priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
  470. if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
  471. ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK;
  472. else
  473. ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
  474. if (bss_conf->use_cts_prot)
  475. ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
  476. else
  477. ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN;
  478. memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN);
  479. if (vif->type == NL80211_IFTYPE_AP ||
  480. vif->type == NL80211_IFTYPE_ADHOC) {
  481. if (vif->bss_conf.enable_beacon) {
  482. ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
  483. priv->beacon_ctx = ctx;
  484. } else {
  485. ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
  486. priv->beacon_ctx = NULL;
  487. }
  488. }
  489. if (force || memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
  490. iwlagn_commit_rxon(priv, ctx);
  491. if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc) {
  492. /*
  493. * The chain noise calibration will enable PM upon
  494. * completion. If calibration has already been run
  495. * then we need to enable power management here.
  496. */
  497. if (priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE)
  498. iwl_power_update_mode(priv, false);
  499. /* Enable RX differential gain and sensitivity calibrations */
  500. iwl_chain_noise_reset(priv);
  501. priv->start_calib = 1;
  502. }
  503. if (changes & BSS_CHANGED_IBSS) {
  504. ret = iwlagn_manage_ibss_station(priv, vif,
  505. bss_conf->ibss_joined);
  506. if (ret)
  507. IWL_ERR(priv, "failed to %s IBSS station %pM\n",
  508. bss_conf->ibss_joined ? "add" : "remove",
  509. bss_conf->bssid);
  510. }
  511. if (changes & BSS_CHANGED_BEACON && vif->type == NL80211_IFTYPE_ADHOC &&
  512. priv->beacon_ctx) {
  513. if (iwlagn_update_beacon(priv, vif))
  514. IWL_ERR(priv, "Error sending IBSS beacon\n");
  515. }
  516. mutex_unlock(&priv->mutex);
  517. }
  518. void iwlagn_post_scan(struct iwl_priv *priv)
  519. {
  520. struct iwl_rxon_context *ctx;
  521. /*
  522. * Since setting the RXON may have been deferred while
  523. * performing the scan, fire one off if needed
  524. */
  525. for_each_context(priv, ctx)
  526. if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
  527. iwlagn_commit_rxon(priv, ctx);
  528. if (priv->cfg->ops->hcmd->set_pan_params)
  529. priv->cfg->ops->hcmd->set_pan_params(priv);
  530. }