iwl-agn-rxon.c 17 KB

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