1 /******************************************************************************
5 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
29 #include <linux/kernel.h>
30 #include <linux/module.h>
31 #include <linux/etherdevice.h>
32 #include <linux/sched.h>
33 #include <linux/slab.h>
34 #include <net/mac80211.h>
36 #include "iwl-eeprom.h"
37 #include "iwl-debug.h"
40 #include "iwl-power.h"
41 #include "iwl-shared.h"
43 #include "iwl-trans.h"
45 const u8 iwl_bcast_addr
[ETH_ALEN
] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
47 static bool iwl_is_channel_extension(struct iwl_priv
*priv
,
48 enum ieee80211_band band
,
49 u16 channel
, u8 extension_chan_offset
)
51 const struct iwl_channel_info
*ch_info
;
53 ch_info
= iwl_get_channel_info(priv
, band
, channel
);
54 if (!is_channel_valid(ch_info
))
57 if (extension_chan_offset
== IEEE80211_HT_PARAM_CHA_SEC_ABOVE
)
58 return !(ch_info
->ht40_extension_channel
&
59 IEEE80211_CHAN_NO_HT40PLUS
);
60 else if (extension_chan_offset
== IEEE80211_HT_PARAM_CHA_SEC_BELOW
)
61 return !(ch_info
->ht40_extension_channel
&
62 IEEE80211_CHAN_NO_HT40MINUS
);
67 bool iwl_is_ht40_tx_allowed(struct iwl_priv
*priv
,
68 struct iwl_rxon_context
*ctx
,
69 struct ieee80211_sta_ht_cap
*ht_cap
)
71 if (!ctx
->ht
.enabled
|| !ctx
->ht
.is_40mhz
)
75 * We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
76 * the bit will not set if it is pure 40MHz case
78 if (ht_cap
&& !ht_cap
->ht_supported
)
81 #ifdef CONFIG_IWLWIFI_DEBUGFS
82 if (priv
->disable_ht40
)
86 return iwl_is_channel_extension(priv
, priv
->band
,
87 le16_to_cpu(ctx
->staging
.channel
),
88 ctx
->ht
.extension_chan_offset
);
91 static u16
iwl_adjust_beacon_interval(u16 beacon_val
, u16 max_beacon_val
)
97 * If mac80211 hasn't given us a beacon interval, program
98 * the default into the device (not checking this here
99 * would cause the adjustment below to return the maximum
100 * value, which may break PAN.)
103 return DEFAULT_BEACON_INTERVAL
;
106 * If the beacon interval we obtained from the peer
107 * is too large, we'll have to wake up more often
108 * (and in IBSS case, we'll beacon too much)
110 * For example, if max_beacon_val is 4096, and the
111 * requested beacon interval is 7000, we'll have to
112 * use 3500 to be able to wake up on the beacons.
114 * This could badly influence beacon detection stats.
117 beacon_factor
= (beacon_val
+ max_beacon_val
) / max_beacon_val
;
118 new_val
= beacon_val
/ beacon_factor
;
121 new_val
= max_beacon_val
;
126 int iwl_send_rxon_timing(struct iwl_priv
*priv
, struct iwl_rxon_context
*ctx
)
129 s32 interval_tm
, rem
;
130 struct ieee80211_conf
*conf
= NULL
;
132 struct ieee80211_vif
*vif
= ctx
->vif
;
134 conf
= &priv
->hw
->conf
;
136 lockdep_assert_held(&priv
->mutex
);
138 memset(&ctx
->timing
, 0, sizeof(struct iwl_rxon_time_cmd
));
140 ctx
->timing
.timestamp
= cpu_to_le64(priv
->timestamp
);
141 ctx
->timing
.listen_interval
= cpu_to_le16(conf
->listen_interval
);
143 beacon_int
= vif
? vif
->bss_conf
.beacon_int
: 0;
146 * TODO: For IBSS we need to get atim_window from mac80211,
147 * for now just always use 0
149 ctx
->timing
.atim_window
= 0;
151 if (ctx
->ctxid
== IWL_RXON_CTX_PAN
&&
152 (!ctx
->vif
|| ctx
->vif
->type
!= NL80211_IFTYPE_STATION
) &&
153 iwl_is_associated(priv
, IWL_RXON_CTX_BSS
) &&
154 priv
->contexts
[IWL_RXON_CTX_BSS
].vif
&&
155 priv
->contexts
[IWL_RXON_CTX_BSS
].vif
->bss_conf
.beacon_int
) {
156 ctx
->timing
.beacon_interval
=
157 priv
->contexts
[IWL_RXON_CTX_BSS
].timing
.beacon_interval
;
158 beacon_int
= le16_to_cpu(ctx
->timing
.beacon_interval
);
159 } else if (ctx
->ctxid
== IWL_RXON_CTX_BSS
&&
160 iwl_is_associated(priv
, IWL_RXON_CTX_PAN
) &&
161 priv
->contexts
[IWL_RXON_CTX_PAN
].vif
&&
162 priv
->contexts
[IWL_RXON_CTX_PAN
].vif
->bss_conf
.beacon_int
&&
163 (!iwl_is_associated_ctx(ctx
) || !ctx
->vif
||
164 !ctx
->vif
->bss_conf
.beacon_int
)) {
165 ctx
->timing
.beacon_interval
=
166 priv
->contexts
[IWL_RXON_CTX_PAN
].timing
.beacon_interval
;
167 beacon_int
= le16_to_cpu(ctx
->timing
.beacon_interval
);
169 beacon_int
= iwl_adjust_beacon_interval(beacon_int
,
170 IWL_MAX_UCODE_BEACON_INTERVAL
* TIME_UNIT
);
171 ctx
->timing
.beacon_interval
= cpu_to_le16(beacon_int
);
174 ctx
->beacon_int
= beacon_int
;
176 tsf
= priv
->timestamp
; /* tsf is modifed by do_div: copy it */
177 interval_tm
= beacon_int
* TIME_UNIT
;
178 rem
= do_div(tsf
, interval_tm
);
179 ctx
->timing
.beacon_init_val
= cpu_to_le32(interval_tm
- rem
);
181 ctx
->timing
.dtim_period
= vif
? (vif
->bss_conf
.dtim_period
?: 1) : 1;
183 IWL_DEBUG_ASSOC(priv
,
184 "beacon interval %d beacon timer %d beacon tim %d\n",
185 le16_to_cpu(ctx
->timing
.beacon_interval
),
186 le32_to_cpu(ctx
->timing
.beacon_init_val
),
187 le16_to_cpu(ctx
->timing
.atim_window
));
189 return iwl_dvm_send_cmd_pdu(priv
, ctx
->rxon_timing_cmd
,
190 CMD_SYNC
, sizeof(ctx
->timing
), &ctx
->timing
);
193 void iwl_set_rxon_hwcrypto(struct iwl_priv
*priv
, struct iwl_rxon_context
*ctx
,
196 struct iwl_rxon_cmd
*rxon
= &ctx
->staging
;
199 rxon
->filter_flags
&= ~RXON_FILTER_DIS_DECRYPT_MSK
;
201 rxon
->filter_flags
|= RXON_FILTER_DIS_DECRYPT_MSK
;
205 /* validate RXON structure is valid */
206 int iwl_check_rxon_cmd(struct iwl_priv
*priv
, struct iwl_rxon_context
*ctx
)
208 struct iwl_rxon_cmd
*rxon
= &ctx
->staging
;
211 if (rxon
->flags
& RXON_FLG_BAND_24G_MSK
) {
212 if (rxon
->flags
& RXON_FLG_TGJ_NARROW_BAND_MSK
) {
213 IWL_WARN(priv
, "check 2.4G: wrong narrow\n");
216 if (rxon
->flags
& RXON_FLG_RADAR_DETECT_MSK
) {
217 IWL_WARN(priv
, "check 2.4G: wrong radar\n");
221 if (!(rxon
->flags
& RXON_FLG_SHORT_SLOT_MSK
)) {
222 IWL_WARN(priv
, "check 5.2G: not short slot!\n");
225 if (rxon
->flags
& RXON_FLG_CCK_MSK
) {
226 IWL_WARN(priv
, "check 5.2G: CCK!\n");
230 if ((rxon
->node_addr
[0] | rxon
->bssid_addr
[0]) & 0x1) {
231 IWL_WARN(priv
, "mac/bssid mcast!\n");
235 /* make sure basic rates 6Mbps and 1Mbps are supported */
236 if ((rxon
->ofdm_basic_rates
& IWL_RATE_6M_MASK
) == 0 &&
237 (rxon
->cck_basic_rates
& IWL_RATE_1M_MASK
) == 0) {
238 IWL_WARN(priv
, "neither 1 nor 6 are basic\n");
242 if (le16_to_cpu(rxon
->assoc_id
) > 2007) {
243 IWL_WARN(priv
, "aid > 2007\n");
247 if ((rxon
->flags
& (RXON_FLG_CCK_MSK
| RXON_FLG_SHORT_SLOT_MSK
))
248 == (RXON_FLG_CCK_MSK
| RXON_FLG_SHORT_SLOT_MSK
)) {
249 IWL_WARN(priv
, "CCK and short slot\n");
253 if ((rxon
->flags
& (RXON_FLG_CCK_MSK
| RXON_FLG_AUTO_DETECT_MSK
))
254 == (RXON_FLG_CCK_MSK
| RXON_FLG_AUTO_DETECT_MSK
)) {
255 IWL_WARN(priv
, "CCK and auto detect");
259 if ((rxon
->flags
& (RXON_FLG_AUTO_DETECT_MSK
|
260 RXON_FLG_TGG_PROTECT_MSK
)) ==
261 RXON_FLG_TGG_PROTECT_MSK
) {
262 IWL_WARN(priv
, "TGg but no auto-detect\n");
266 if (rxon
->channel
== 0) {
267 IWL_WARN(priv
, "zero channel is invalid\n");
271 WARN(errors
, "Invalid RXON (%#x), channel %d",
272 errors
, le16_to_cpu(rxon
->channel
));
274 return errors
? -EINVAL
: 0;
278 * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
279 * @priv: staging_rxon is compared to active_rxon
281 * If the RXON structure is changing enough to require a new tune,
282 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
283 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
285 int iwl_full_rxon_required(struct iwl_priv
*priv
,
286 struct iwl_rxon_context
*ctx
)
288 const struct iwl_rxon_cmd
*staging
= &ctx
->staging
;
289 const struct iwl_rxon_cmd
*active
= &ctx
->active
;
293 IWL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \
297 #define CHK_NEQ(c1, c2) \
298 if ((c1) != (c2)) { \
299 IWL_DEBUG_INFO(priv, "need full RXON - " \
300 #c1 " != " #c2 " - %d != %d\n", \
305 /* These items are only settable from the full RXON command */
306 CHK(!iwl_is_associated_ctx(ctx
));
307 CHK(compare_ether_addr(staging
->bssid_addr
, active
->bssid_addr
));
308 CHK(compare_ether_addr(staging
->node_addr
, active
->node_addr
));
309 CHK(compare_ether_addr(staging
->wlap_bssid_addr
,
310 active
->wlap_bssid_addr
));
311 CHK_NEQ(staging
->dev_type
, active
->dev_type
);
312 CHK_NEQ(staging
->channel
, active
->channel
);
313 CHK_NEQ(staging
->air_propagation
, active
->air_propagation
);
314 CHK_NEQ(staging
->ofdm_ht_single_stream_basic_rates
,
315 active
->ofdm_ht_single_stream_basic_rates
);
316 CHK_NEQ(staging
->ofdm_ht_dual_stream_basic_rates
,
317 active
->ofdm_ht_dual_stream_basic_rates
);
318 CHK_NEQ(staging
->ofdm_ht_triple_stream_basic_rates
,
319 active
->ofdm_ht_triple_stream_basic_rates
);
320 CHK_NEQ(staging
->assoc_id
, active
->assoc_id
);
322 /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can
323 * be updated with the RXON_ASSOC command -- however only some
324 * flag transitions are allowed using RXON_ASSOC */
326 /* Check if we are not switching bands */
327 CHK_NEQ(staging
->flags
& RXON_FLG_BAND_24G_MSK
,
328 active
->flags
& RXON_FLG_BAND_24G_MSK
);
330 /* Check if we are switching association toggle */
331 CHK_NEQ(staging
->filter_flags
& RXON_FILTER_ASSOC_MSK
,
332 active
->filter_flags
& RXON_FILTER_ASSOC_MSK
);
340 static void _iwl_set_rxon_ht(struct iwl_priv
*priv
,
341 struct iwl_ht_config
*ht_conf
,
342 struct iwl_rxon_context
*ctx
)
344 struct iwl_rxon_cmd
*rxon
= &ctx
->staging
;
346 if (!ctx
->ht
.enabled
) {
347 rxon
->flags
&= ~(RXON_FLG_CHANNEL_MODE_MSK
|
348 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK
|
349 RXON_FLG_HT40_PROT_MSK
|
350 RXON_FLG_HT_PROT_MSK
);
354 /* FIXME: if the definition of ht.protection changed, the "translation"
355 * will be needed for rxon->flags
357 rxon
->flags
|= cpu_to_le32(ctx
->ht
.protection
<< RXON_FLG_HT_OPERATING_MODE_POS
);
359 /* Set up channel bandwidth:
360 * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */
361 /* clear the HT channel mode before set the mode */
362 rxon
->flags
&= ~(RXON_FLG_CHANNEL_MODE_MSK
|
363 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK
);
364 if (iwl_is_ht40_tx_allowed(priv
, ctx
, NULL
)) {
366 if (ctx
->ht
.protection
== IEEE80211_HT_OP_MODE_PROTECTION_20MHZ
) {
367 rxon
->flags
|= RXON_FLG_CHANNEL_MODE_PURE_40
;
368 /* Note: control channel is opposite of extension channel */
369 switch (ctx
->ht
.extension_chan_offset
) {
370 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE
:
371 rxon
->flags
&= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK
;
373 case IEEE80211_HT_PARAM_CHA_SEC_BELOW
:
374 rxon
->flags
|= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK
;
378 /* Note: control channel is opposite of extension channel */
379 switch (ctx
->ht
.extension_chan_offset
) {
380 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE
:
381 rxon
->flags
&= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK
);
382 rxon
->flags
|= RXON_FLG_CHANNEL_MODE_MIXED
;
384 case IEEE80211_HT_PARAM_CHA_SEC_BELOW
:
385 rxon
->flags
|= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK
;
386 rxon
->flags
|= RXON_FLG_CHANNEL_MODE_MIXED
;
388 case IEEE80211_HT_PARAM_CHA_SEC_NONE
:
390 /* channel location only valid if in Mixed mode */
391 IWL_ERR(priv
, "invalid extension channel offset\n");
396 rxon
->flags
|= RXON_FLG_CHANNEL_MODE_LEGACY
;
399 iwlagn_set_rxon_chain(priv
, ctx
);
401 IWL_DEBUG_ASSOC(priv
, "rxon flags 0x%X operation mode :0x%X "
402 "extension channel offset 0x%x\n",
403 le32_to_cpu(rxon
->flags
), ctx
->ht
.protection
,
404 ctx
->ht
.extension_chan_offset
);
407 void iwl_set_rxon_ht(struct iwl_priv
*priv
, struct iwl_ht_config
*ht_conf
)
409 struct iwl_rxon_context
*ctx
;
411 for_each_context(priv
, ctx
)
412 _iwl_set_rxon_ht(priv
, ht_conf
, ctx
);
415 /* Return valid, unused, channel for a passive scan to reset the RF */
416 u8
iwl_get_single_channel_number(struct iwl_priv
*priv
,
417 enum ieee80211_band band
)
419 const struct iwl_channel_info
*ch_info
;
423 struct iwl_rxon_context
*ctx
;
425 if (band
== IEEE80211_BAND_5GHZ
) {
427 max
= priv
->channel_count
;
433 for (i
= min
; i
< max
; i
++) {
436 for_each_context(priv
, ctx
) {
437 busy
= priv
->channel_info
[i
].channel
==
438 le16_to_cpu(ctx
->staging
.channel
);
446 channel
= priv
->channel_info
[i
].channel
;
447 ch_info
= iwl_get_channel_info(priv
, band
, channel
);
448 if (is_channel_valid(ch_info
))
456 * iwl_set_rxon_channel - Set the band and channel values in staging RXON
457 * @ch: requested channel as a pointer to struct ieee80211_channel
459 * NOTE: Does not commit to the hardware; it sets appropriate bit fields
460 * in the staging RXON flag structure based on the ch->band
462 void iwl_set_rxon_channel(struct iwl_priv
*priv
, struct ieee80211_channel
*ch
,
463 struct iwl_rxon_context
*ctx
)
465 enum ieee80211_band band
= ch
->band
;
466 u16 channel
= ch
->hw_value
;
468 if ((le16_to_cpu(ctx
->staging
.channel
) == channel
) &&
469 (priv
->band
== band
))
472 ctx
->staging
.channel
= cpu_to_le16(channel
);
473 if (band
== IEEE80211_BAND_5GHZ
)
474 ctx
->staging
.flags
&= ~RXON_FLG_BAND_24G_MSK
;
476 ctx
->staging
.flags
|= RXON_FLG_BAND_24G_MSK
;
480 IWL_DEBUG_INFO(priv
, "Staging channel set to %d [%d]\n", channel
, band
);
484 void iwl_set_flags_for_band(struct iwl_priv
*priv
,
485 struct iwl_rxon_context
*ctx
,
486 enum ieee80211_band band
,
487 struct ieee80211_vif
*vif
)
489 if (band
== IEEE80211_BAND_5GHZ
) {
490 ctx
->staging
.flags
&=
491 ~(RXON_FLG_BAND_24G_MSK
| RXON_FLG_AUTO_DETECT_MSK
493 ctx
->staging
.flags
|= RXON_FLG_SHORT_SLOT_MSK
;
495 /* Copied from iwl_post_associate() */
496 if (vif
&& vif
->bss_conf
.use_short_slot
)
497 ctx
->staging
.flags
|= RXON_FLG_SHORT_SLOT_MSK
;
499 ctx
->staging
.flags
&= ~RXON_FLG_SHORT_SLOT_MSK
;
501 ctx
->staging
.flags
|= RXON_FLG_BAND_24G_MSK
;
502 ctx
->staging
.flags
|= RXON_FLG_AUTO_DETECT_MSK
;
503 ctx
->staging
.flags
&= ~RXON_FLG_CCK_MSK
;
508 * initialize rxon structure with default values from eeprom
510 void iwl_connection_init_rx_config(struct iwl_priv
*priv
,
511 struct iwl_rxon_context
*ctx
)
513 const struct iwl_channel_info
*ch_info
;
515 memset(&ctx
->staging
, 0, sizeof(ctx
->staging
));
518 ctx
->staging
.dev_type
= ctx
->unused_devtype
;
519 } else switch (ctx
->vif
->type
) {
520 case NL80211_IFTYPE_AP
:
521 ctx
->staging
.dev_type
= ctx
->ap_devtype
;
524 case NL80211_IFTYPE_STATION
:
525 ctx
->staging
.dev_type
= ctx
->station_devtype
;
526 ctx
->staging
.filter_flags
= RXON_FILTER_ACCEPT_GRP_MSK
;
529 case NL80211_IFTYPE_ADHOC
:
530 ctx
->staging
.dev_type
= ctx
->ibss_devtype
;
531 ctx
->staging
.flags
= RXON_FLG_SHORT_PREAMBLE_MSK
;
532 ctx
->staging
.filter_flags
= RXON_FILTER_BCON_AWARE_MSK
|
533 RXON_FILTER_ACCEPT_GRP_MSK
;
537 IWL_ERR(priv
, "Unsupported interface type %d\n",
543 /* TODO: Figure out when short_preamble would be set and cache from
545 if (!hw_to_local(priv
->hw
)->short_preamble
)
546 ctx
->staging
.flags
&= ~RXON_FLG_SHORT_PREAMBLE_MSK
;
548 ctx
->staging
.flags
|= RXON_FLG_SHORT_PREAMBLE_MSK
;
551 ch_info
= iwl_get_channel_info(priv
, priv
->band
,
552 le16_to_cpu(ctx
->active
.channel
));
555 ch_info
= &priv
->channel_info
[0];
557 ctx
->staging
.channel
= cpu_to_le16(ch_info
->channel
);
558 priv
->band
= ch_info
->band
;
560 iwl_set_flags_for_band(priv
, ctx
, priv
->band
, ctx
->vif
);
562 ctx
->staging
.ofdm_basic_rates
=
563 (IWL_OFDM_RATES_MASK
>> IWL_FIRST_OFDM_RATE
) & 0xFF;
564 ctx
->staging
.cck_basic_rates
=
565 (IWL_CCK_RATES_MASK
>> IWL_FIRST_CCK_RATE
) & 0xF;
567 /* clear both MIX and PURE40 mode flag */
568 ctx
->staging
.flags
&= ~(RXON_FLG_CHANNEL_MODE_MIXED
|
569 RXON_FLG_CHANNEL_MODE_PURE_40
);
571 memcpy(ctx
->staging
.node_addr
, ctx
->vif
->addr
, ETH_ALEN
);
573 ctx
->staging
.ofdm_ht_single_stream_basic_rates
= 0xff;
574 ctx
->staging
.ofdm_ht_dual_stream_basic_rates
= 0xff;
575 ctx
->staging
.ofdm_ht_triple_stream_basic_rates
= 0xff;
578 void iwl_set_rate(struct iwl_priv
*priv
)
580 const struct ieee80211_supported_band
*hw
= NULL
;
581 struct ieee80211_rate
*rate
;
582 struct iwl_rxon_context
*ctx
;
585 hw
= iwl_get_hw_mode(priv
, priv
->band
);
587 IWL_ERR(priv
, "Failed to set rate: unable to get hw mode\n");
591 priv
->active_rate
= 0;
593 for (i
= 0; i
< hw
->n_bitrates
; i
++) {
594 rate
= &(hw
->bitrates
[i
]);
595 if (rate
->hw_value
< IWL_RATE_COUNT_LEGACY
)
596 priv
->active_rate
|= (1 << rate
->hw_value
);
599 IWL_DEBUG_RATE(priv
, "Set active_rate = %0x\n", priv
->active_rate
);
601 for_each_context(priv
, ctx
) {
602 ctx
->staging
.cck_basic_rates
=
603 (IWL_CCK_BASIC_RATES_MASK
>> IWL_FIRST_CCK_RATE
) & 0xF;
605 ctx
->staging
.ofdm_basic_rates
=
606 (IWL_OFDM_BASIC_RATES_MASK
>> IWL_FIRST_OFDM_RATE
) & 0xFF;
610 void iwl_chswitch_done(struct iwl_priv
*priv
, bool is_success
)
614 * See iwlagn_mac_channel_switch.
616 struct iwl_rxon_context
*ctx
= &priv
->contexts
[IWL_RXON_CTX_BSS
];
618 if (test_bit(STATUS_EXIT_PENDING
, &priv
->status
))
621 if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING
, &priv
->status
))
622 ieee80211_chswitch_done(ctx
->vif
, is_success
);
625 #ifdef CONFIG_IWLWIFI_DEBUG
626 void iwl_print_rx_config_cmd(struct iwl_priv
*priv
,
627 enum iwl_rxon_context_id ctxid
)
629 struct iwl_rxon_context
*ctx
= &priv
->contexts
[ctxid
];
630 struct iwl_rxon_cmd
*rxon
= &ctx
->staging
;
632 IWL_DEBUG_RADIO(priv
, "RX CONFIG:\n");
633 iwl_print_hex_dump(priv
, IWL_DL_RADIO
, (u8
*) rxon
, sizeof(*rxon
));
634 IWL_DEBUG_RADIO(priv
, "u16 channel: 0x%x\n", le16_to_cpu(rxon
->channel
));
635 IWL_DEBUG_RADIO(priv
, "u32 flags: 0x%08X\n", le32_to_cpu(rxon
->flags
));
636 IWL_DEBUG_RADIO(priv
, "u32 filter_flags: 0x%08x\n",
637 le32_to_cpu(rxon
->filter_flags
));
638 IWL_DEBUG_RADIO(priv
, "u8 dev_type: 0x%x\n", rxon
->dev_type
);
639 IWL_DEBUG_RADIO(priv
, "u8 ofdm_basic_rates: 0x%02x\n",
640 rxon
->ofdm_basic_rates
);
641 IWL_DEBUG_RADIO(priv
, "u8 cck_basic_rates: 0x%02x\n", rxon
->cck_basic_rates
);
642 IWL_DEBUG_RADIO(priv
, "u8[6] node_addr: %pM\n", rxon
->node_addr
);
643 IWL_DEBUG_RADIO(priv
, "u8[6] bssid_addr: %pM\n", rxon
->bssid_addr
);
644 IWL_DEBUG_RADIO(priv
, "u16 assoc_id: 0x%x\n", le16_to_cpu(rxon
->assoc_id
));
648 void iwlagn_fw_error(struct iwl_priv
*priv
, bool ondemand
)
650 unsigned int reload_msec
;
651 unsigned long reload_jiffies
;
653 #ifdef CONFIG_IWLWIFI_DEBUG
654 if (iwl_have_debug_level(IWL_DL_FW_ERRORS
))
655 iwl_print_rx_config_cmd(priv
, IWL_RXON_CTX_BSS
);
658 /* uCode is no longer loaded. */
659 priv
->ucode_loaded
= false;
661 /* Set the FW error flag -- cleared on iwl_down */
662 set_bit(STATUS_FW_ERROR
, &priv
->shrd
->status
);
664 /* Cancel currently queued command. */
665 clear_bit(STATUS_HCMD_ACTIVE
, &priv
->shrd
->status
);
667 iwl_abort_notification_waits(&priv
->notif_wait
);
669 /* Keep the restart process from trying to send host
670 * commands by clearing the ready bit */
671 clear_bit(STATUS_READY
, &priv
->status
);
673 wake_up(&trans(priv
)->wait_command_queue
);
677 * If firmware keep reloading, then it indicate something
678 * serious wrong and firmware having problem to recover
679 * from it. Instead of keep trying which will fill the syslog
680 * and hang the system, let's just stop it
682 reload_jiffies
= jiffies
;
683 reload_msec
= jiffies_to_msecs((long) reload_jiffies
-
684 (long) priv
->reload_jiffies
);
685 priv
->reload_jiffies
= reload_jiffies
;
686 if (reload_msec
<= IWL_MIN_RELOAD_DURATION
) {
687 priv
->reload_count
++;
688 if (priv
->reload_count
>= IWL_MAX_CONTINUE_RELOAD_CNT
) {
689 IWL_ERR(priv
, "BUG_ON, Stop restarting\n");
693 priv
->reload_count
= 0;
696 if (!test_bit(STATUS_EXIT_PENDING
, &priv
->status
)) {
697 if (iwlagn_mod_params
.restart_fw
) {
698 IWL_DEBUG_FW_ERRORS(priv
,
699 "Restarting adapter due to uCode error.\n");
700 queue_work(priv
->workqueue
, &priv
->restart
);
702 IWL_DEBUG_FW_ERRORS(priv
,
703 "Detected FW error, but not restarting\n");
707 int iwl_set_tx_power(struct iwl_priv
*priv
, s8 tx_power
, bool force
)
712 struct iwl_rxon_context
*ctx
= &priv
->contexts
[IWL_RXON_CTX_BSS
];
714 lockdep_assert_held(&priv
->mutex
);
716 if (priv
->tx_power_user_lmt
== tx_power
&& !force
)
719 if (tx_power
< IWLAGN_TX_POWER_TARGET_POWER_MIN
) {
721 "Requested user TXPOWER %d below lower limit %d.\n",
723 IWLAGN_TX_POWER_TARGET_POWER_MIN
);
727 if (tx_power
> priv
->tx_power_device_lmt
) {
729 "Requested user TXPOWER %d above upper limit %d.\n",
730 tx_power
, priv
->tx_power_device_lmt
);
734 if (!iwl_is_ready_rf(priv
))
737 /* scan complete and commit_rxon use tx_power_next value,
738 * it always need to be updated for newest request */
739 priv
->tx_power_next
= tx_power
;
741 /* do not set tx power when scanning or channel changing */
742 defer
= test_bit(STATUS_SCANNING
, &priv
->status
) ||
743 memcmp(&ctx
->active
, &ctx
->staging
, sizeof(ctx
->staging
));
744 if (defer
&& !force
) {
745 IWL_DEBUG_INFO(priv
, "Deferring tx power set\n");
749 prev_tx_power
= priv
->tx_power_user_lmt
;
750 priv
->tx_power_user_lmt
= tx_power
;
752 ret
= iwlagn_send_tx_power(priv
);
754 /* if fail to set tx_power, restore the orig. tx power */
756 priv
->tx_power_user_lmt
= prev_tx_power
;
757 priv
->tx_power_next
= prev_tx_power
;
762 void iwl_send_bt_config(struct iwl_priv
*priv
)
764 struct iwl_bt_cmd bt_cmd
= {
765 .lead_time
= BT_LEAD_TIME_DEF
,
766 .max_kill
= BT_MAX_KILL_DEF
,
771 if (!iwlagn_mod_params
.bt_coex_active
)
772 bt_cmd
.flags
= BT_COEX_DISABLE
;
774 bt_cmd
.flags
= BT_COEX_ENABLE
;
776 priv
->bt_enable_flag
= bt_cmd
.flags
;
777 IWL_DEBUG_INFO(priv
, "BT coex %s\n",
778 (bt_cmd
.flags
== BT_COEX_DISABLE
) ? "disable" : "active");
780 if (iwl_dvm_send_cmd_pdu(priv
, REPLY_BT_CONFIG
,
781 CMD_SYNC
, sizeof(struct iwl_bt_cmd
), &bt_cmd
))
782 IWL_ERR(priv
, "failed to send BT Coex Config\n");
785 int iwl_send_statistics_request(struct iwl_priv
*priv
, u8 flags
, bool clear
)
787 struct iwl_statistics_cmd statistics_cmd
= {
788 .configuration_flags
=
789 clear
? IWL_STATS_CONF_CLEAR_STATS
: 0,
792 if (flags
& CMD_ASYNC
)
793 return iwl_dvm_send_cmd_pdu(priv
, REPLY_STATISTICS_CMD
,
795 sizeof(struct iwl_statistics_cmd
),
798 return iwl_dvm_send_cmd_pdu(priv
, REPLY_STATISTICS_CMD
,
800 sizeof(struct iwl_statistics_cmd
),
807 #ifdef CONFIG_IWLWIFI_DEBUGFS
809 #define IWL_TRAFFIC_DUMP_SIZE (IWL_TRAFFIC_ENTRY_SIZE * IWL_TRAFFIC_ENTRIES)
811 void iwl_reset_traffic_log(struct iwl_priv
*priv
)
813 priv
->tx_traffic_idx
= 0;
814 priv
->rx_traffic_idx
= 0;
815 if (priv
->tx_traffic
)
816 memset(priv
->tx_traffic
, 0, IWL_TRAFFIC_DUMP_SIZE
);
817 if (priv
->rx_traffic
)
818 memset(priv
->rx_traffic
, 0, IWL_TRAFFIC_DUMP_SIZE
);
821 int iwl_alloc_traffic_mem(struct iwl_priv
*priv
)
823 u32 traffic_size
= IWL_TRAFFIC_DUMP_SIZE
;
825 if (iwl_have_debug_level(IWL_DL_TX
)) {
826 if (!priv
->tx_traffic
) {
828 kzalloc(traffic_size
, GFP_KERNEL
);
829 if (!priv
->tx_traffic
)
833 if (iwl_have_debug_level(IWL_DL_RX
)) {
834 if (!priv
->rx_traffic
) {
836 kzalloc(traffic_size
, GFP_KERNEL
);
837 if (!priv
->rx_traffic
)
841 iwl_reset_traffic_log(priv
);
845 void iwl_free_traffic_mem(struct iwl_priv
*priv
)
847 kfree(priv
->tx_traffic
);
848 priv
->tx_traffic
= NULL
;
850 kfree(priv
->rx_traffic
);
851 priv
->rx_traffic
= NULL
;
854 void iwl_dbg_log_tx_data_frame(struct iwl_priv
*priv
,
855 u16 length
, struct ieee80211_hdr
*header
)
860 if (likely(!iwl_have_debug_level(IWL_DL_TX
)))
863 if (!priv
->tx_traffic
)
866 fc
= header
->frame_control
;
867 if (ieee80211_is_data(fc
)) {
868 len
= (length
> IWL_TRAFFIC_ENTRY_SIZE
)
869 ? IWL_TRAFFIC_ENTRY_SIZE
: length
;
870 memcpy((priv
->tx_traffic
+
871 (priv
->tx_traffic_idx
* IWL_TRAFFIC_ENTRY_SIZE
)),
873 priv
->tx_traffic_idx
=
874 (priv
->tx_traffic_idx
+ 1) % IWL_TRAFFIC_ENTRIES
;
878 void iwl_dbg_log_rx_data_frame(struct iwl_priv
*priv
,
879 u16 length
, struct ieee80211_hdr
*header
)
884 if (likely(!iwl_have_debug_level(IWL_DL_RX
)))
887 if (!priv
->rx_traffic
)
890 fc
= header
->frame_control
;
891 if (ieee80211_is_data(fc
)) {
892 len
= (length
> IWL_TRAFFIC_ENTRY_SIZE
)
893 ? IWL_TRAFFIC_ENTRY_SIZE
: length
;
894 memcpy((priv
->rx_traffic
+
895 (priv
->rx_traffic_idx
* IWL_TRAFFIC_ENTRY_SIZE
)),
897 priv
->rx_traffic_idx
=
898 (priv
->rx_traffic_idx
+ 1) % IWL_TRAFFIC_ENTRIES
;
902 const char *get_mgmt_string(int cmd
)
905 IWL_CMD(MANAGEMENT_ASSOC_REQ
);
906 IWL_CMD(MANAGEMENT_ASSOC_RESP
);
907 IWL_CMD(MANAGEMENT_REASSOC_REQ
);
908 IWL_CMD(MANAGEMENT_REASSOC_RESP
);
909 IWL_CMD(MANAGEMENT_PROBE_REQ
);
910 IWL_CMD(MANAGEMENT_PROBE_RESP
);
911 IWL_CMD(MANAGEMENT_BEACON
);
912 IWL_CMD(MANAGEMENT_ATIM
);
913 IWL_CMD(MANAGEMENT_DISASSOC
);
914 IWL_CMD(MANAGEMENT_AUTH
);
915 IWL_CMD(MANAGEMENT_DEAUTH
);
916 IWL_CMD(MANAGEMENT_ACTION
);
923 const char *get_ctrl_string(int cmd
)
926 IWL_CMD(CONTROL_BACK_REQ
);
927 IWL_CMD(CONTROL_BACK
);
928 IWL_CMD(CONTROL_PSPOLL
);
929 IWL_CMD(CONTROL_RTS
);
930 IWL_CMD(CONTROL_CTS
);
931 IWL_CMD(CONTROL_ACK
);
932 IWL_CMD(CONTROL_CFEND
);
933 IWL_CMD(CONTROL_CFENDACK
);
940 void iwl_clear_traffic_stats(struct iwl_priv
*priv
)
942 memset(&priv
->tx_stats
, 0, sizeof(struct traffic_stats
));
943 memset(&priv
->rx_stats
, 0, sizeof(struct traffic_stats
));
947 * if CONFIG_IWLWIFI_DEBUGFS defined, iwl_update_stats function will
948 * record all the MGMT, CTRL and DATA pkt for both TX and Rx pass.
949 * Use debugFs to display the rx/rx_statistics
950 * if CONFIG_IWLWIFI_DEBUGFS not being defined, then no MGMT and CTRL
951 * information will be recorded, but DATA pkt still will be recorded
952 * for the reason of iwl_led.c need to control the led blinking based on
953 * number of tx and rx data.
956 void iwl_update_stats(struct iwl_priv
*priv
, bool is_tx
, __le16 fc
, u16 len
)
958 struct traffic_stats
*stats
;
961 stats
= &priv
->tx_stats
;
963 stats
= &priv
->rx_stats
;
965 if (ieee80211_is_mgmt(fc
)) {
966 switch (fc
& cpu_to_le16(IEEE80211_FCTL_STYPE
)) {
967 case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ
):
968 stats
->mgmt
[MANAGEMENT_ASSOC_REQ
]++;
970 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP
):
971 stats
->mgmt
[MANAGEMENT_ASSOC_RESP
]++;
973 case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ
):
974 stats
->mgmt
[MANAGEMENT_REASSOC_REQ
]++;
976 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP
):
977 stats
->mgmt
[MANAGEMENT_REASSOC_RESP
]++;
979 case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ
):
980 stats
->mgmt
[MANAGEMENT_PROBE_REQ
]++;
982 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP
):
983 stats
->mgmt
[MANAGEMENT_PROBE_RESP
]++;
985 case cpu_to_le16(IEEE80211_STYPE_BEACON
):
986 stats
->mgmt
[MANAGEMENT_BEACON
]++;
988 case cpu_to_le16(IEEE80211_STYPE_ATIM
):
989 stats
->mgmt
[MANAGEMENT_ATIM
]++;
991 case cpu_to_le16(IEEE80211_STYPE_DISASSOC
):
992 stats
->mgmt
[MANAGEMENT_DISASSOC
]++;
994 case cpu_to_le16(IEEE80211_STYPE_AUTH
):
995 stats
->mgmt
[MANAGEMENT_AUTH
]++;
997 case cpu_to_le16(IEEE80211_STYPE_DEAUTH
):
998 stats
->mgmt
[MANAGEMENT_DEAUTH
]++;
1000 case cpu_to_le16(IEEE80211_STYPE_ACTION
):
1001 stats
->mgmt
[MANAGEMENT_ACTION
]++;
1004 } else if (ieee80211_is_ctl(fc
)) {
1005 switch (fc
& cpu_to_le16(IEEE80211_FCTL_STYPE
)) {
1006 case cpu_to_le16(IEEE80211_STYPE_BACK_REQ
):
1007 stats
->ctrl
[CONTROL_BACK_REQ
]++;
1009 case cpu_to_le16(IEEE80211_STYPE_BACK
):
1010 stats
->ctrl
[CONTROL_BACK
]++;
1012 case cpu_to_le16(IEEE80211_STYPE_PSPOLL
):
1013 stats
->ctrl
[CONTROL_PSPOLL
]++;
1015 case cpu_to_le16(IEEE80211_STYPE_RTS
):
1016 stats
->ctrl
[CONTROL_RTS
]++;
1018 case cpu_to_le16(IEEE80211_STYPE_CTS
):
1019 stats
->ctrl
[CONTROL_CTS
]++;
1021 case cpu_to_le16(IEEE80211_STYPE_ACK
):
1022 stats
->ctrl
[CONTROL_ACK
]++;
1024 case cpu_to_le16(IEEE80211_STYPE_CFEND
):
1025 stats
->ctrl
[CONTROL_CFEND
]++;
1027 case cpu_to_le16(IEEE80211_STYPE_CFENDACK
):
1028 stats
->ctrl
[CONTROL_CFENDACK
]++;
1034 stats
->data_bytes
+= len
;
1039 static void iwl_force_rf_reset(struct iwl_priv
*priv
)
1041 if (test_bit(STATUS_EXIT_PENDING
, &priv
->status
))
1044 if (!iwl_is_any_associated(priv
)) {
1045 IWL_DEBUG_SCAN(priv
, "force reset rejected: not associated\n");
1049 * There is no easy and better way to force reset the radio,
1050 * the only known method is switching channel which will force to
1051 * reset and tune the radio.
1052 * Use internal short scan (single channel) operation to should
1053 * achieve this objective.
1054 * Driver should reset the radio when number of consecutive missed
1055 * beacon, or any other uCode error condition detected.
1057 IWL_DEBUG_INFO(priv
, "perform radio reset.\n");
1058 iwl_internal_short_hw_scan(priv
);
1062 int iwl_force_reset(struct iwl_priv
*priv
, int mode
, bool external
)
1064 struct iwl_force_reset
*force_reset
;
1066 if (test_bit(STATUS_EXIT_PENDING
, &priv
->status
))
1069 if (mode
>= IWL_MAX_FORCE_RESET
) {
1070 IWL_DEBUG_INFO(priv
, "invalid reset request.\n");
1073 force_reset
= &priv
->force_reset
[mode
];
1074 force_reset
->reset_request_count
++;
1076 if (force_reset
->last_force_reset_jiffies
&&
1077 time_after(force_reset
->last_force_reset_jiffies
+
1078 force_reset
->reset_duration
, jiffies
)) {
1079 IWL_DEBUG_INFO(priv
, "force reset rejected\n");
1080 force_reset
->reset_reject_count
++;
1084 force_reset
->reset_success_count
++;
1085 force_reset
->last_force_reset_jiffies
= jiffies
;
1086 IWL_DEBUG_INFO(priv
, "perform force reset (%d)\n", mode
);
1089 iwl_force_rf_reset(priv
);
1093 * if the request is from external(ex: debugfs),
1094 * then always perform the request in regardless the module
1096 * if the request is from internal (uCode error or driver
1097 * detect failure), then fw_restart module parameter
1098 * need to be check before performing firmware reload
1100 if (!external
&& !iwlagn_mod_params
.restart_fw
) {
1101 IWL_DEBUG_INFO(priv
, "Cancel firmware reload based on "
1102 "module parameter setting\n");
1105 IWL_ERR(priv
, "On demand firmware reload\n");
1106 iwlagn_fw_error(priv
, true);
1113 int iwl_cmd_echo_test(struct iwl_priv
*priv
)
1116 struct iwl_host_cmd cmd
= {
1122 ret
= iwl_dvm_send_cmd(priv
, &cmd
);
1124 IWL_ERR(priv
, "echo testing fail: 0X%x\n", ret
);
1126 IWL_DEBUG_INFO(priv
, "echo testing pass\n");
1130 static inline int iwl_check_stuck_queue(struct iwl_priv
*priv
, int txq
)
1132 if (iwl_trans_check_stuck_queue(trans(priv
), txq
)) {
1134 ret
= iwl_force_reset(priv
, IWL_FW_RESET
, false);
1135 return (ret
== -EAGAIN
) ? 0 : 1;
1141 * Making watchdog tick be a quarter of timeout assure we will
1142 * discover the queue hung between timeout and 1.25*timeout
1144 #define IWL_WD_TICK(timeout) ((timeout) / 4)
1147 * Watchdog timer callback, we check each tx queue for stuck, if if hung
1148 * we reset the firmware. If everything is fine just rearm the timer.
1150 void iwl_bg_watchdog(unsigned long data
)
1152 struct iwl_priv
*priv
= (struct iwl_priv
*)data
;
1154 unsigned long timeout
;
1156 if (test_bit(STATUS_EXIT_PENDING
, &priv
->status
))
1159 if (iwl_is_rfkill(priv
))
1162 timeout
= hw_params(priv
).wd_timeout
;
1166 /* monitor and check for stuck queues */
1167 for (cnt
= 0; cnt
< cfg(priv
)->base_params
->num_of_queues
; cnt
++)
1168 if (iwl_check_stuck_queue(priv
, cnt
))
1171 mod_timer(&priv
->watchdog
, jiffies
+
1172 msecs_to_jiffies(IWL_WD_TICK(timeout
)));
1175 void iwl_setup_watchdog(struct iwl_priv
*priv
)
1177 unsigned int timeout
= hw_params(priv
).wd_timeout
;
1179 if (!iwlagn_mod_params
.wd_disable
) {
1180 /* use system default */
1181 if (timeout
&& !cfg(priv
)->base_params
->wd_disable
)
1182 mod_timer(&priv
->watchdog
,
1184 msecs_to_jiffies(IWL_WD_TICK(timeout
)));
1186 del_timer(&priv
->watchdog
);
1188 /* module parameter overwrite default configuration */
1189 if (timeout
&& iwlagn_mod_params
.wd_disable
== 2)
1190 mod_timer(&priv
->watchdog
,
1192 msecs_to_jiffies(IWL_WD_TICK(timeout
)));
1194 del_timer(&priv
->watchdog
);
1199 * iwl_beacon_time_mask_low - mask of lower 32 bit of beacon time
1200 * @priv -- pointer to iwl_priv data structure
1201 * @tsf_bits -- number of bits need to shift for masking)
1203 static inline u32
iwl_beacon_time_mask_low(struct iwl_priv
*priv
,
1206 return (1 << tsf_bits
) - 1;
1210 * iwl_beacon_time_mask_high - mask of higher 32 bit of beacon time
1211 * @priv -- pointer to iwl_priv data structure
1212 * @tsf_bits -- number of bits need to shift for masking)
1214 static inline u32
iwl_beacon_time_mask_high(struct iwl_priv
*priv
,
1217 return ((1 << (32 - tsf_bits
)) - 1) << tsf_bits
;
1221 * extended beacon time format
1222 * time in usec will be changed into a 32-bit value in extended:internal format
1223 * the extended part is the beacon counts
1224 * the internal part is the time in usec within one beacon interval
1226 u32
iwl_usecs_to_beacons(struct iwl_priv
*priv
, u32 usec
, u32 beacon_interval
)
1230 u32 interval
= beacon_interval
* TIME_UNIT
;
1232 if (!interval
|| !usec
)
1235 quot
= (usec
/ interval
) &
1236 (iwl_beacon_time_mask_high(priv
, IWLAGN_EXT_BEACON_TIME_POS
) >>
1237 IWLAGN_EXT_BEACON_TIME_POS
);
1238 rem
= (usec
% interval
) & iwl_beacon_time_mask_low(priv
,
1239 IWLAGN_EXT_BEACON_TIME_POS
);
1241 return (quot
<< IWLAGN_EXT_BEACON_TIME_POS
) + rem
;
1244 /* base is usually what we get from ucode with each received frame,
1245 * the same as HW timer counter counting down
1247 __le32
iwl_add_beacon_time(struct iwl_priv
*priv
, u32 base
,
1248 u32 addon
, u32 beacon_interval
)
1250 u32 base_low
= base
& iwl_beacon_time_mask_low(priv
,
1251 IWLAGN_EXT_BEACON_TIME_POS
);
1252 u32 addon_low
= addon
& iwl_beacon_time_mask_low(priv
,
1253 IWLAGN_EXT_BEACON_TIME_POS
);
1254 u32 interval
= beacon_interval
* TIME_UNIT
;
1255 u32 res
= (base
& iwl_beacon_time_mask_high(priv
,
1256 IWLAGN_EXT_BEACON_TIME_POS
)) +
1257 (addon
& iwl_beacon_time_mask_high(priv
,
1258 IWLAGN_EXT_BEACON_TIME_POS
));
1260 if (base_low
> addon_low
)
1261 res
+= base_low
- addon_low
;
1262 else if (base_low
< addon_low
) {
1263 res
+= interval
+ base_low
- addon_low
;
1264 res
+= (1 << IWLAGN_EXT_BEACON_TIME_POS
);
1266 res
+= (1 << IWLAGN_EXT_BEACON_TIME_POS
);
1268 return cpu_to_le32(res
);
1271 void iwl_set_hw_rfkill_state(struct iwl_op_mode
*op_mode
, bool state
)
1273 struct iwl_priv
*priv
= IWL_OP_MODE_GET_DVM(op_mode
);
1276 set_bit(STATUS_RF_KILL_HW
, &priv
->status
);
1278 clear_bit(STATUS_RF_KILL_HW
, &priv
->status
);
1280 wiphy_rfkill_set_hw_state(priv
->hw
->wiphy
, state
);
1283 void iwl_free_skb(struct iwl_op_mode
*op_mode
, struct sk_buff
*skb
)
1285 struct ieee80211_tx_info
*info
;
1287 info
= IEEE80211_SKB_CB(skb
);
1288 kmem_cache_free(iwl_tx_cmd_pool
, (info
->driver_data
[1]));
1289 dev_kfree_skb_any(skb
);