1 /******************************************************************************
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * The full GNU General Public License is included in this distribution
25 * in the file called COPYING.
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
33 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 *****************************************************************************/
63 #include <linux/kernel.h>
64 #include <linux/slab.h>
65 #include <linux/skbuff.h>
66 #include <linux/netdevice.h>
67 #include <linux/etherdevice.h>
69 #include <net/mac80211.h>
72 #include "iwl-op-mode.h"
76 #include "time-event.h"
77 #include "iwl-eeprom-parse.h"
78 #include "fw-api-scan.h"
79 #include "iwl-phy-db.h"
82 static const struct ieee80211_iface_limit iwl_mvm_limits
[] = {
85 .types
= BIT(NL80211_IFTYPE_STATION
),
89 .types
= BIT(NL80211_IFTYPE_AP
) |
90 BIT(NL80211_IFTYPE_P2P_CLIENT
) |
91 BIT(NL80211_IFTYPE_P2P_GO
),
95 .types
= BIT(NL80211_IFTYPE_P2P_DEVICE
),
99 static const struct ieee80211_iface_combination iwl_mvm_iface_combinations
[] = {
101 .num_different_channels
= 1,
103 .limits
= iwl_mvm_limits
,
104 .n_limits
= ARRAY_SIZE(iwl_mvm_limits
),
108 #ifdef CONFIG_PM_SLEEP
109 static const struct nl80211_wowlan_tcp_data_token_feature
110 iwl_mvm_wowlan_tcp_token_feature
= {
113 .bufsize
= IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS
,
116 static const struct wiphy_wowlan_tcp_support iwl_mvm_wowlan_tcp_support
= {
117 .tok
= &iwl_mvm_wowlan_tcp_token_feature
,
118 .data_payload_max
= IWL_WOWLAN_TCP_MAX_PACKET_LEN
-
119 sizeof(struct ethhdr
) -
120 sizeof(struct iphdr
) -
121 sizeof(struct tcphdr
),
122 .data_interval_max
= 65535, /* __le16 in API */
123 .wake_payload_max
= IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN
-
124 sizeof(struct ethhdr
) -
125 sizeof(struct iphdr
) -
126 sizeof(struct tcphdr
),
131 static void iwl_mvm_reset_phy_ctxts(struct iwl_mvm
*mvm
)
135 memset(mvm
->phy_ctxts
, 0, sizeof(mvm
->phy_ctxts
));
136 for (i
= 0; i
< NUM_PHY_CTX
; i
++) {
137 mvm
->phy_ctxts
[i
].id
= i
;
138 mvm
->phy_ctxts
[i
].ref
= 0;
142 static int iwl_mvm_max_scan_ie_len(struct iwl_mvm
*mvm
)
144 /* we create the 802.11 header and SSID element */
145 if (mvm
->fw
->ucode_capa
.flags
& IWL_UCODE_TLV_FLAGS_NO_BASIC_SSID
)
146 return mvm
->fw
->ucode_capa
.max_probe_length
- 24 - 2;
147 return mvm
->fw
->ucode_capa
.max_probe_length
- 24 - 34;
150 int iwl_mvm_mac_setup_register(struct iwl_mvm
*mvm
)
152 struct ieee80211_hw
*hw
= mvm
->hw
;
155 /* Tell mac80211 our characteristics */
156 hw
->flags
= IEEE80211_HW_SIGNAL_DBM
|
157 IEEE80211_HW_SPECTRUM_MGMT
|
158 IEEE80211_HW_REPORTS_TX_ACK_STATUS
|
159 IEEE80211_HW_QUEUE_CONTROL
|
160 IEEE80211_HW_WANT_MONITOR_VIF
|
161 IEEE80211_HW_SUPPORTS_PS
|
162 IEEE80211_HW_SUPPORTS_DYNAMIC_PS
|
163 IEEE80211_HW_AMPDU_AGGREGATION
|
164 IEEE80211_HW_TIMING_BEACON_ONLY
|
165 IEEE80211_HW_CONNECTION_MONITOR
|
166 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS
|
167 IEEE80211_HW_SUPPORTS_STATIC_SMPS
;
169 hw
->queues
= mvm
->first_agg_queue
;
170 hw
->offchannel_tx_hw_queue
= IWL_MVM_OFFCHANNEL_QUEUE
;
171 hw
->rate_control_algorithm
= "iwl-mvm-rs";
174 * Enable 11w if advertised by firmware and software crypto
175 * is not enabled (as the firmware will interpret some mgmt
176 * packets, so enabling it with software crypto isn't safe)
178 if (mvm
->fw
->ucode_capa
.flags
& IWL_UCODE_TLV_FLAGS_MFP
&&
179 !iwlwifi_mod_params
.sw_crypto
)
180 hw
->flags
|= IEEE80211_HW_MFP_CAPABLE
;
182 if (mvm
->fw
->ucode_capa
.flags
& IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT
) {
183 hw
->flags
|= IEEE80211_HW_SUPPORTS_UAPSD
;
184 hw
->uapsd_queues
= IWL_UAPSD_AC_INFO
;
185 hw
->uapsd_max_sp_len
= IWL_UAPSD_MAX_SP
;
188 hw
->sta_data_size
= sizeof(struct iwl_mvm_sta
);
189 hw
->vif_data_size
= sizeof(struct iwl_mvm_vif
);
190 hw
->chanctx_data_size
= sizeof(u16
);
192 hw
->wiphy
->interface_modes
= BIT(NL80211_IFTYPE_STATION
) |
193 BIT(NL80211_IFTYPE_P2P_CLIENT
) |
194 BIT(NL80211_IFTYPE_AP
) |
195 BIT(NL80211_IFTYPE_P2P_GO
) |
196 BIT(NL80211_IFTYPE_P2P_DEVICE
);
198 /* IBSS has bugs in older versions */
199 if (IWL_UCODE_API(mvm
->fw
->ucode_ver
) >= 8)
200 hw
->wiphy
->interface_modes
|= BIT(NL80211_IFTYPE_ADHOC
);
202 hw
->wiphy
->flags
|= WIPHY_FLAG_IBSS_RSN
;
203 hw
->wiphy
->regulatory_flags
|= REGULATORY_CUSTOM_REG
|
204 REGULATORY_DISABLE_BEACON_HINTS
;
206 hw
->wiphy
->iface_combinations
= iwl_mvm_iface_combinations
;
207 hw
->wiphy
->n_iface_combinations
=
208 ARRAY_SIZE(iwl_mvm_iface_combinations
);
210 hw
->wiphy
->max_remain_on_channel_duration
= 10000;
211 hw
->max_listen_interval
= IWL_CONN_MAX_LISTEN_INTERVAL
;
213 /* Extract MAC address */
214 memcpy(mvm
->addresses
[0].addr
, mvm
->nvm_data
->hw_addr
, ETH_ALEN
);
215 hw
->wiphy
->addresses
= mvm
->addresses
;
216 hw
->wiphy
->n_addresses
= 1;
218 /* Extract additional MAC addresses if available */
219 num_mac
= (mvm
->nvm_data
->n_hw_addrs
> 1) ?
220 min(IWL_MVM_MAX_ADDRESSES
, mvm
->nvm_data
->n_hw_addrs
) : 1;
222 for (i
= 1; i
< num_mac
; i
++) {
223 memcpy(mvm
->addresses
[i
].addr
, mvm
->addresses
[i
-1].addr
,
225 mvm
->addresses
[i
].addr
[5]++;
226 hw
->wiphy
->n_addresses
++;
229 iwl_mvm_reset_phy_ctxts(mvm
);
231 hw
->wiphy
->max_scan_ie_len
= iwl_mvm_max_scan_ie_len(mvm
);
233 hw
->wiphy
->max_scan_ssids
= PROBE_OPTION_MAX
;
235 if (mvm
->nvm_data
->bands
[IEEE80211_BAND_2GHZ
].n_channels
)
236 hw
->wiphy
->bands
[IEEE80211_BAND_2GHZ
] =
237 &mvm
->nvm_data
->bands
[IEEE80211_BAND_2GHZ
];
238 if (mvm
->nvm_data
->bands
[IEEE80211_BAND_5GHZ
].n_channels
)
239 hw
->wiphy
->bands
[IEEE80211_BAND_5GHZ
] =
240 &mvm
->nvm_data
->bands
[IEEE80211_BAND_5GHZ
];
242 hw
->wiphy
->hw_version
= mvm
->trans
->hw_id
;
244 if (iwlmvm_mod_params
.power_scheme
!= IWL_POWER_SCHEME_CAM
)
245 hw
->wiphy
->flags
|= WIPHY_FLAG_PS_ON_BY_DEFAULT
;
247 hw
->wiphy
->flags
&= ~WIPHY_FLAG_PS_ON_BY_DEFAULT
;
249 if (mvm
->fw
->ucode_capa
.flags
& IWL_UCODE_TLV_FLAGS_SCHED_SCAN
) {
250 hw
->wiphy
->flags
|= WIPHY_FLAG_SUPPORTS_SCHED_SCAN
;
251 hw
->wiphy
->max_sched_scan_ssids
= PROBE_OPTION_MAX
;
252 hw
->wiphy
->max_match_sets
= IWL_SCAN_MAX_PROFILES
;
253 /* we create the 802.11 header and zero length SSID IE. */
254 hw
->wiphy
->max_sched_scan_ie_len
=
255 SCAN_OFFLOAD_PROBE_REQ_SIZE
- 24 - 2;
258 hw
->wiphy
->features
|= NL80211_FEATURE_P2P_GO_CTWIN
|
259 NL80211_FEATURE_P2P_GO_OPPPS
|
260 NL80211_FEATURE_LOW_PRIORITY_SCAN
;
262 mvm
->rts_threshold
= IEEE80211_MAX_RTS_THRESHOLD
;
264 /* currently FW API supports only one optional cipher scheme */
265 if (mvm
->fw
->cs
[0].cipher
) {
266 mvm
->hw
->n_cipher_schemes
= 1;
267 mvm
->hw
->cipher_schemes
= &mvm
->fw
->cs
[0];
270 #ifdef CONFIG_PM_SLEEP
271 if (mvm
->fw
->img
[IWL_UCODE_WOWLAN
].sec
[0].len
&&
272 mvm
->trans
->ops
->d3_suspend
&&
273 mvm
->trans
->ops
->d3_resume
&&
274 device_can_wakeup(mvm
->trans
->dev
)) {
275 mvm
->wowlan
.flags
= WIPHY_WOWLAN_MAGIC_PKT
|
276 WIPHY_WOWLAN_DISCONNECT
|
277 WIPHY_WOWLAN_EAP_IDENTITY_REQ
|
278 WIPHY_WOWLAN_RFKILL_RELEASE
;
279 if (!iwlwifi_mod_params
.sw_crypto
)
280 mvm
->wowlan
.flags
|= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY
|
281 WIPHY_WOWLAN_GTK_REKEY_FAILURE
|
282 WIPHY_WOWLAN_4WAY_HANDSHAKE
;
284 mvm
->wowlan
.n_patterns
= IWL_WOWLAN_MAX_PATTERNS
;
285 mvm
->wowlan
.pattern_min_len
= IWL_WOWLAN_MIN_PATTERN_LEN
;
286 mvm
->wowlan
.pattern_max_len
= IWL_WOWLAN_MAX_PATTERN_LEN
;
287 mvm
->wowlan
.tcp
= &iwl_mvm_wowlan_tcp_support
;
288 hw
->wiphy
->wowlan
= &mvm
->wowlan
;
292 ret
= iwl_mvm_leds_init(mvm
);
296 ret
= ieee80211_register_hw(mvm
->hw
);
298 iwl_mvm_leds_exit(mvm
);
303 static void iwl_mvm_mac_tx(struct ieee80211_hw
*hw
,
304 struct ieee80211_tx_control
*control
,
307 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
309 if (iwl_mvm_is_radio_killed(mvm
)) {
310 IWL_DEBUG_DROP(mvm
, "Dropping - RF/CT KILL\n");
314 if (IEEE80211_SKB_CB(skb
)->hw_queue
== IWL_MVM_OFFCHANNEL_QUEUE
&&
315 !test_bit(IWL_MVM_STATUS_ROC_RUNNING
, &mvm
->status
))
319 if (iwl_mvm_tx_skb(mvm
, skb
, control
->sta
))
324 if (iwl_mvm_tx_skb_non_sta(mvm
, skb
))
328 ieee80211_free_txskb(hw
, skb
);
331 static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw
*hw
,
332 struct ieee80211_vif
*vif
,
333 enum ieee80211_ampdu_mlme_action action
,
334 struct ieee80211_sta
*sta
, u16 tid
,
335 u16
*ssn
, u8 buf_size
)
337 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
340 IWL_DEBUG_HT(mvm
, "A-MPDU action on addr %pM tid %d: action %d\n",
341 sta
->addr
, tid
, action
);
343 if (!(mvm
->nvm_data
->sku_cap_11n_enable
))
346 mutex_lock(&mvm
->mutex
);
349 case IEEE80211_AMPDU_RX_START
:
350 if (iwlwifi_mod_params
.disable_11n
& IWL_DISABLE_HT_RXAGG
) {
354 ret
= iwl_mvm_sta_rx_agg(mvm
, sta
, tid
, *ssn
, true);
356 case IEEE80211_AMPDU_RX_STOP
:
357 ret
= iwl_mvm_sta_rx_agg(mvm
, sta
, tid
, 0, false);
359 case IEEE80211_AMPDU_TX_START
:
360 if (iwlwifi_mod_params
.disable_11n
& IWL_DISABLE_HT_TXAGG
) {
364 ret
= iwl_mvm_sta_tx_agg_start(mvm
, vif
, sta
, tid
, ssn
);
366 case IEEE80211_AMPDU_TX_STOP_CONT
:
367 ret
= iwl_mvm_sta_tx_agg_stop(mvm
, vif
, sta
, tid
);
369 case IEEE80211_AMPDU_TX_STOP_FLUSH
:
370 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT
:
371 ret
= iwl_mvm_sta_tx_agg_flush(mvm
, vif
, sta
, tid
);
373 case IEEE80211_AMPDU_TX_OPERATIONAL
:
374 ret
= iwl_mvm_sta_tx_agg_oper(mvm
, vif
, sta
, tid
, buf_size
);
381 mutex_unlock(&mvm
->mutex
);
386 static void iwl_mvm_cleanup_iterator(void *data
, u8
*mac
,
387 struct ieee80211_vif
*vif
)
389 struct iwl_mvm
*mvm
= data
;
390 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
392 mvmvif
->uploaded
= false;
393 mvmvif
->ap_sta_id
= IWL_MVM_STATION_COUNT
;
395 /* does this make sense at all? */
398 spin_lock_bh(&mvm
->time_event_lock
);
399 iwl_mvm_te_clear_data(mvm
, &mvmvif
->time_event_data
);
400 spin_unlock_bh(&mvm
->time_event_lock
);
402 mvmvif
->phy_ctxt
= NULL
;
405 static void iwl_mvm_restart_cleanup(struct iwl_mvm
*mvm
)
407 iwl_trans_stop_device(mvm
->trans
);
409 mvm
->scan_status
= IWL_MVM_SCAN_NONE
;
411 /* just in case one was running */
412 ieee80211_remain_on_channel_expired(mvm
->hw
);
414 ieee80211_iterate_active_interfaces_atomic(
415 mvm
->hw
, IEEE80211_IFACE_ITER_RESUME_ALL
,
416 iwl_mvm_cleanup_iterator
, mvm
);
418 mvm
->p2p_device_vif
= NULL
;
420 iwl_mvm_reset_phy_ctxts(mvm
);
421 memset(mvm
->fw_key_table
, 0, sizeof(mvm
->fw_key_table
));
422 memset(mvm
->sta_drained
, 0, sizeof(mvm
->sta_drained
));
424 ieee80211_wake_queues(mvm
->hw
);
427 mvm
->rx_ba_sessions
= 0;
430 static int iwl_mvm_mac_start(struct ieee80211_hw
*hw
)
432 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
435 mutex_lock(&mvm
->mutex
);
437 /* Clean up some internal and mac80211 state on restart */
438 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART
, &mvm
->status
))
439 iwl_mvm_restart_cleanup(mvm
);
441 ret
= iwl_mvm_up(mvm
);
442 mutex_unlock(&mvm
->mutex
);
447 static void iwl_mvm_mac_restart_complete(struct ieee80211_hw
*hw
)
449 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
452 mutex_lock(&mvm
->mutex
);
454 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART
, &mvm
->status
);
455 ret
= iwl_mvm_update_quotas(mvm
, NULL
);
457 IWL_ERR(mvm
, "Failed to update quotas after restart (%d)\n",
460 mutex_unlock(&mvm
->mutex
);
463 static void iwl_mvm_mac_stop(struct ieee80211_hw
*hw
)
465 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
467 flush_work(&mvm
->async_handlers_wk
);
469 mutex_lock(&mvm
->mutex
);
470 /* async_handlers_wk is now blocked */
473 * The work item could be running or queued if the
474 * ROC time event stops just as we get here.
476 cancel_work_sync(&mvm
->roc_done_wk
);
478 iwl_trans_stop_device(mvm
->trans
);
480 iwl_mvm_async_handlers_purge(mvm
);
481 /* async_handlers_list is empty and will stay empty: HW is stopped */
483 /* the fw is stopped, the aux sta is dead: clean up driver state */
484 iwl_mvm_dealloc_int_sta(mvm
, &mvm
->aux_sta
);
486 mutex_unlock(&mvm
->mutex
);
489 * The worker might have been waiting for the mutex, let it run and
490 * discover that its list is now empty.
492 cancel_work_sync(&mvm
->async_handlers_wk
);
495 static void iwl_mvm_power_update_iterator(void *data
, u8
*mac
,
496 struct ieee80211_vif
*vif
)
498 struct iwl_mvm
*mvm
= data
;
500 iwl_mvm_power_update_mode(mvm
, vif
);
503 static struct iwl_mvm_phy_ctxt
*iwl_mvm_get_free_phy_ctxt(struct iwl_mvm
*mvm
)
507 lockdep_assert_held(&mvm
->mutex
);
509 for (i
= 0; i
< NUM_PHY_CTX
; i
++)
510 if (!mvm
->phy_ctxts
[i
].ref
)
511 return &mvm
->phy_ctxts
[i
];
513 IWL_ERR(mvm
, "No available PHY context\n");
517 static int iwl_mvm_set_tx_power(struct iwl_mvm
*mvm
, struct ieee80211_vif
*vif
,
520 /* FW is in charge of regulatory enforcement */
521 struct iwl_reduce_tx_power_cmd reduce_txpwr_cmd
= {
522 .mac_context_id
= iwl_mvm_vif_from_mac80211(vif
)->id
,
523 .pwr_restriction
= cpu_to_le16(tx_power
),
526 return iwl_mvm_send_cmd_pdu(mvm
, REDUCE_TX_POWER_CMD
, CMD_SYNC
,
527 sizeof(reduce_txpwr_cmd
),
531 static int iwl_mvm_mac_add_interface(struct ieee80211_hw
*hw
,
532 struct ieee80211_vif
*vif
)
534 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
535 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
539 * Not much to do here. The stack will not allow interface
540 * types or combinations that we didn't advertise, so we
541 * don't really have to check the types.
544 mutex_lock(&mvm
->mutex
);
546 /* Allocate resources for the MAC context, and add it to the fw */
547 ret
= iwl_mvm_mac_ctxt_init(mvm
, vif
);
551 /* Counting number of interfaces is needed for legacy PM */
552 if (vif
->type
!= NL80211_IFTYPE_P2P_DEVICE
)
556 * The AP binding flow can be done only after the beacon
557 * template is configured (which happens only in the mac80211
558 * start_ap() flow), and adding the broadcast station can happen
559 * only after the binding.
560 * In addition, since modifying the MAC before adding a bcast
561 * station is not allowed by the FW, delay the adding of MAC context to
562 * the point where we can also add the bcast station.
563 * In short: there's not much we can do at this point, other than
564 * allocating resources :)
566 if (vif
->type
== NL80211_IFTYPE_AP
||
567 vif
->type
== NL80211_IFTYPE_ADHOC
) {
568 u32 qmask
= iwl_mvm_mac_get_queues_mask(mvm
, vif
);
569 ret
= iwl_mvm_allocate_int_sta(mvm
, &mvmvif
->bcast_sta
,
572 IWL_ERR(mvm
, "Failed to allocate bcast sta\n");
576 iwl_mvm_vif_dbgfs_register(mvm
, vif
);
580 ret
= iwl_mvm_mac_ctxt_add(mvm
, vif
);
584 iwl_mvm_power_disable(mvm
, vif
);
586 /* beacon filtering */
587 ret
= iwl_mvm_disable_beacon_filter(mvm
, vif
);
591 if (!mvm
->bf_allowed_vif
&&
592 vif
->type
== NL80211_IFTYPE_STATION
&& !vif
->p2p
&&
593 mvm
->fw
->ucode_capa
.flags
& IWL_UCODE_TLV_FLAGS_BF_UPDATED
){
594 mvm
->bf_allowed_vif
= mvmvif
;
595 vif
->driver_flags
|= IEEE80211_VIF_BEACON_FILTER
|
596 IEEE80211_VIF_SUPPORTS_CQM_RSSI
;
600 * P2P_DEVICE interface does not have a channel context assigned to it,
601 * so a dedicated PHY context is allocated to it and the corresponding
602 * MAC context is bound to it at this stage.
604 if (vif
->type
== NL80211_IFTYPE_P2P_DEVICE
) {
606 mvmvif
->phy_ctxt
= iwl_mvm_get_free_phy_ctxt(mvm
);
607 if (!mvmvif
->phy_ctxt
) {
612 iwl_mvm_phy_ctxt_ref(mvm
, mvmvif
->phy_ctxt
);
613 ret
= iwl_mvm_binding_add_vif(mvm
, vif
);
617 ret
= iwl_mvm_add_bcast_sta(mvm
, vif
, &mvmvif
->bcast_sta
);
621 /* Save a pointer to p2p device vif, so it can later be used to
622 * update the p2p device MAC when a GO is started/stopped */
623 mvm
->p2p_device_vif
= vif
;
626 iwl_mvm_vif_dbgfs_register(mvm
, vif
);
630 iwl_mvm_binding_remove_vif(mvm
, vif
);
632 iwl_mvm_phy_ctxt_unref(mvm
, mvmvif
->phy_ctxt
);
634 if (mvm
->bf_allowed_vif
== mvmvif
) {
635 mvm
->bf_allowed_vif
= NULL
;
636 vif
->driver_flags
&= ~(IEEE80211_VIF_BEACON_FILTER
|
637 IEEE80211_VIF_SUPPORTS_CQM_RSSI
);
640 mvmvif
->phy_ctxt
= NULL
;
641 iwl_mvm_mac_ctxt_remove(mvm
, vif
);
643 if (vif
->type
!= NL80211_IFTYPE_P2P_DEVICE
)
646 /* TODO: remove this when legacy PM will be discarded */
647 ieee80211_iterate_active_interfaces(
648 mvm
->hw
, IEEE80211_IFACE_ITER_NORMAL
,
649 iwl_mvm_power_update_iterator
, mvm
);
651 iwl_mvm_mac_ctxt_release(mvm
, vif
);
653 mutex_unlock(&mvm
->mutex
);
658 static void iwl_mvm_prepare_mac_removal(struct iwl_mvm
*mvm
,
659 struct ieee80211_vif
*vif
)
663 for (ac
= 0; ac
< IEEE80211_NUM_ACS
; ac
++)
664 if (vif
->hw_queue
[ac
] != IEEE80211_INVAL_HW_QUEUE
)
665 tfd_msk
|= BIT(vif
->hw_queue
[ac
]);
667 if (vif
->cab_queue
!= IEEE80211_INVAL_HW_QUEUE
)
668 tfd_msk
|= BIT(vif
->cab_queue
);
671 mutex_lock(&mvm
->mutex
);
672 iwl_mvm_flush_tx_path(mvm
, tfd_msk
, true);
673 mutex_unlock(&mvm
->mutex
);
676 if (vif
->type
== NL80211_IFTYPE_P2P_DEVICE
) {
678 * Flush the ROC worker which will flush the OFFCHANNEL queue.
679 * We assume here that all the packets sent to the OFFCHANNEL
680 * queue are sent in ROC session.
682 flush_work(&mvm
->roc_done_wk
);
685 * By now, all the AC queues are empty. The AGG queues are
686 * empty too. We already got all the Tx responses for all the
687 * packets in the queues. The drain work can have been
688 * triggered. Flush it.
690 flush_work(&mvm
->sta_drained_wk
);
694 static void iwl_mvm_mac_remove_interface(struct ieee80211_hw
*hw
,
695 struct ieee80211_vif
*vif
)
697 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
698 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
700 iwl_mvm_prepare_mac_removal(mvm
, vif
);
702 mutex_lock(&mvm
->mutex
);
704 if (mvm
->bf_allowed_vif
== mvmvif
) {
705 mvm
->bf_allowed_vif
= NULL
;
706 vif
->driver_flags
&= ~(IEEE80211_VIF_BEACON_FILTER
|
707 IEEE80211_VIF_SUPPORTS_CQM_RSSI
);
710 iwl_mvm_vif_dbgfs_clean(mvm
, vif
);
713 * For AP/GO interface, the tear down of the resources allocated to the
714 * interface is be handled as part of the stop_ap flow.
716 if (vif
->type
== NL80211_IFTYPE_AP
||
717 vif
->type
== NL80211_IFTYPE_ADHOC
) {
718 #ifdef CONFIG_NL80211_TESTMODE
719 if (vif
== mvm
->noa_vif
) {
721 mvm
->noa_duration
= 0;
724 iwl_mvm_dealloc_int_sta(mvm
, &mvmvif
->bcast_sta
);
728 if (vif
->type
== NL80211_IFTYPE_P2P_DEVICE
) {
729 mvm
->p2p_device_vif
= NULL
;
730 iwl_mvm_rm_bcast_sta(mvm
, &mvmvif
->bcast_sta
);
731 iwl_mvm_binding_remove_vif(mvm
, vif
);
732 iwl_mvm_phy_ctxt_unref(mvm
, mvmvif
->phy_ctxt
);
733 mvmvif
->phy_ctxt
= NULL
;
736 if (mvm
->vif_count
&& vif
->type
!= NL80211_IFTYPE_P2P_DEVICE
)
739 /* TODO: remove this when legacy PM will be discarded */
740 ieee80211_iterate_active_interfaces(
741 mvm
->hw
, IEEE80211_IFACE_ITER_NORMAL
,
742 iwl_mvm_power_update_iterator
, mvm
);
744 iwl_mvm_mac_ctxt_remove(mvm
, vif
);
747 iwl_mvm_mac_ctxt_release(mvm
, vif
);
748 mutex_unlock(&mvm
->mutex
);
751 static int iwl_mvm_mac_config(struct ieee80211_hw
*hw
, u32 changed
)
756 struct iwl_mvm_mc_iter_data
{
761 static void iwl_mvm_mc_iface_iterator(void *_data
, u8
*mac
,
762 struct ieee80211_vif
*vif
)
764 struct iwl_mvm_mc_iter_data
*data
= _data
;
765 struct iwl_mvm
*mvm
= data
->mvm
;
766 struct iwl_mcast_filter_cmd
*cmd
= mvm
->mcast_filter_cmd
;
769 /* if we don't have free ports, mcast frames will be dropped */
770 if (WARN_ON_ONCE(data
->port_id
>= MAX_PORT_ID_NUM
))
773 if (vif
->type
!= NL80211_IFTYPE_STATION
||
774 !vif
->bss_conf
.assoc
)
777 cmd
->port_id
= data
->port_id
++;
778 memcpy(cmd
->bssid
, vif
->bss_conf
.bssid
, ETH_ALEN
);
779 len
= roundup(sizeof(*cmd
) + cmd
->count
* ETH_ALEN
, 4);
781 ret
= iwl_mvm_send_cmd_pdu(mvm
, MCAST_FILTER_CMD
, CMD_SYNC
, len
, cmd
);
783 IWL_ERR(mvm
, "mcast filter cmd error. ret=%d\n", ret
);
786 static void iwl_mvm_recalc_multicast(struct iwl_mvm
*mvm
)
788 struct iwl_mvm_mc_iter_data iter_data
= {
792 lockdep_assert_held(&mvm
->mutex
);
794 if (WARN_ON_ONCE(!mvm
->mcast_filter_cmd
))
797 ieee80211_iterate_active_interfaces(
798 mvm
->hw
, IEEE80211_IFACE_ITER_NORMAL
,
799 iwl_mvm_mc_iface_iterator
, &iter_data
);
802 static u64
iwl_mvm_prepare_multicast(struct ieee80211_hw
*hw
,
803 struct netdev_hw_addr_list
*mc_list
)
805 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
806 struct iwl_mcast_filter_cmd
*cmd
;
807 struct netdev_hw_addr
*addr
;
808 int addr_count
= netdev_hw_addr_list_count(mc_list
);
809 bool pass_all
= false;
812 if (addr_count
> MAX_MCAST_FILTERING_ADDRESSES
) {
817 len
= roundup(sizeof(*cmd
) + addr_count
* ETH_ALEN
, 4);
818 cmd
= kzalloc(len
, GFP_ATOMIC
);
824 return (u64
)(unsigned long)cmd
;
827 netdev_hw_addr_list_for_each(addr
, mc_list
) {
828 IWL_DEBUG_MAC80211(mvm
, "mcast addr (%d): %pM\n",
829 cmd
->count
, addr
->addr
);
830 memcpy(&cmd
->addr_list
[cmd
->count
* ETH_ALEN
],
831 addr
->addr
, ETH_ALEN
);
835 return (u64
)(unsigned long)cmd
;
838 static void iwl_mvm_configure_filter(struct ieee80211_hw
*hw
,
839 unsigned int changed_flags
,
840 unsigned int *total_flags
,
843 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
844 struct iwl_mcast_filter_cmd
*cmd
= (void *)(unsigned long)multicast
;
846 mutex_lock(&mvm
->mutex
);
848 /* replace previous configuration */
849 kfree(mvm
->mcast_filter_cmd
);
850 mvm
->mcast_filter_cmd
= cmd
;
855 iwl_mvm_recalc_multicast(mvm
);
857 mutex_unlock(&mvm
->mutex
);
861 static void iwl_mvm_bss_info_changed_station(struct iwl_mvm
*mvm
,
862 struct ieee80211_vif
*vif
,
863 struct ieee80211_bss_conf
*bss_conf
,
866 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
870 * Re-calculate the tsf id, as the master-slave relations depend on the
871 * beacon interval, which was not known when the station interface was
874 if (changes
& BSS_CHANGED_ASSOC
&& bss_conf
->assoc
)
875 iwl_mvm_mac_ctxt_recalc_tsf_id(mvm
, vif
);
877 ret
= iwl_mvm_mac_ctxt_changed(mvm
, vif
);
879 IWL_ERR(mvm
, "failed to update MAC %pM\n", vif
->addr
);
881 if (changes
& BSS_CHANGED_ASSOC
) {
882 if (bss_conf
->assoc
) {
883 /* add quota for this interface */
884 ret
= iwl_mvm_update_quotas(mvm
, vif
);
886 IWL_ERR(mvm
, "failed to update quotas\n");
890 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART
,
893 * If we're restarting then the firmware will
894 * obviously have lost synchronisation with
895 * the AP. It will attempt to synchronise by
896 * itself, but we can make it more reliable by
897 * scheduling a session protection time event.
899 * The firmware needs to receive a beacon to
900 * catch up with synchronisation, use 110% of
901 * the beacon interval.
903 * Set a large maximum delay to allow for more
904 * than a single interface.
906 u32 dur
= (11 * vif
->bss_conf
.beacon_int
) / 10;
907 iwl_mvm_protect_session(mvm
, vif
, dur
, dur
,
911 iwl_mvm_sf_update(mvm
, vif
, false);
912 iwl_mvm_power_vif_assoc(mvm
, vif
);
913 } else if (mvmvif
->ap_sta_id
!= IWL_MVM_STATION_COUNT
) {
915 * If update fails - SF might be running in associated
916 * mode while disassociated - which is forbidden.
918 WARN_ONCE(iwl_mvm_sf_update(mvm
, vif
, false),
919 "Failed to update SF upon disassociation\n");
921 /* remove AP station now that the MAC is unassoc */
922 ret
= iwl_mvm_rm_sta_id(mvm
, vif
, mvmvif
->ap_sta_id
);
924 IWL_ERR(mvm
, "failed to remove AP station\n");
925 mvmvif
->ap_sta_id
= IWL_MVM_STATION_COUNT
;
926 /* remove quota for this interface */
927 ret
= iwl_mvm_update_quotas(mvm
, NULL
);
929 IWL_ERR(mvm
, "failed to update quotas\n");
932 iwl_mvm_recalc_multicast(mvm
);
934 /* reset rssi values */
935 mvmvif
->bf_data
.ave_beacon_signal
= 0;
937 if (!(mvm
->fw
->ucode_capa
.flags
&
938 IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT
)) {
939 /* Workaround for FW bug, otherwise FW disables device
940 * power save upon disassociation
942 ret
= iwl_mvm_power_update_mode(mvm
, vif
);
944 IWL_ERR(mvm
, "failed to update power mode\n");
946 iwl_mvm_bt_coex_vif_change(mvm
);
947 iwl_mvm_update_smps(mvm
, vif
, IWL_MVM_SMPS_REQ_TT
,
948 IEEE80211_SMPS_AUTOMATIC
);
949 } else if (changes
& BSS_CHANGED_BEACON_INFO
) {
951 * We received a beacon _after_ association so
952 * remove the session protection.
954 iwl_mvm_remove_time_event(mvm
, mvmvif
,
955 &mvmvif
->time_event_data
);
956 } else if (changes
& (BSS_CHANGED_PS
| BSS_CHANGED_P2P_PS
|
958 ret
= iwl_mvm_power_update_mode(mvm
, vif
);
960 IWL_ERR(mvm
, "failed to update power mode\n");
962 if (changes
& BSS_CHANGED_TXPOWER
) {
963 IWL_DEBUG_CALIB(mvm
, "Changing TX Power to %d\n",
965 iwl_mvm_set_tx_power(mvm
, vif
, bss_conf
->txpower
);
968 if (changes
& BSS_CHANGED_CQM
) {
969 IWL_DEBUG_MAC80211(mvm
, "cqm info_changed");
970 /* reset cqm events tracking */
971 mvmvif
->bf_data
.last_cqm_event
= 0;
972 ret
= iwl_mvm_update_beacon_filter(mvm
, vif
);
974 IWL_ERR(mvm
, "failed to update CQM thresholds\n");
978 static int iwl_mvm_start_ap_ibss(struct ieee80211_hw
*hw
,
979 struct ieee80211_vif
*vif
)
981 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
982 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
985 mutex_lock(&mvm
->mutex
);
987 /* Send the beacon template */
988 ret
= iwl_mvm_mac_ctxt_beacon_changed(mvm
, vif
);
993 * Re-calculate the tsf id, as the master-slave relations depend on the
994 * beacon interval, which was not known when the AP interface was added.
996 if (vif
->type
== NL80211_IFTYPE_AP
)
997 iwl_mvm_mac_ctxt_recalc_tsf_id(mvm
, vif
);
999 /* Add the mac context */
1000 ret
= iwl_mvm_mac_ctxt_add(mvm
, vif
);
1004 /* Perform the binding */
1005 ret
= iwl_mvm_binding_add_vif(mvm
, vif
);
1009 mvmvif
->ap_ibss_active
= true;
1011 /* Send the bcast station. At this stage the TBTT and DTIM time events
1012 * are added and applied to the scheduler */
1013 ret
= iwl_mvm_send_bcast_sta(mvm
, vif
, &mvmvif
->bcast_sta
);
1017 /* must be set before quota calculations */
1018 mvmvif
->ap_ibss_active
= true;
1020 /* power updated needs to be done before quotas */
1021 mvm
->bound_vif_cnt
++;
1022 iwl_mvm_power_update_binding(mvm
, vif
, true);
1024 ret
= iwl_mvm_update_quotas(mvm
, vif
);
1026 goto out_quota_failed
;
1028 /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
1029 if (vif
->p2p
&& mvm
->p2p_device_vif
)
1030 iwl_mvm_mac_ctxt_changed(mvm
, mvm
->p2p_device_vif
);
1032 iwl_mvm_bt_coex_vif_change(mvm
);
1034 mutex_unlock(&mvm
->mutex
);
1038 mvm
->bound_vif_cnt
--;
1039 iwl_mvm_power_update_binding(mvm
, vif
, false);
1040 mvmvif
->ap_ibss_active
= false;
1041 iwl_mvm_send_rm_bcast_sta(mvm
, &mvmvif
->bcast_sta
);
1043 iwl_mvm_binding_remove_vif(mvm
, vif
);
1045 iwl_mvm_mac_ctxt_remove(mvm
, vif
);
1047 mutex_unlock(&mvm
->mutex
);
1051 static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw
*hw
,
1052 struct ieee80211_vif
*vif
)
1054 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1055 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
1057 iwl_mvm_prepare_mac_removal(mvm
, vif
);
1059 mutex_lock(&mvm
->mutex
);
1061 mvmvif
->ap_ibss_active
= false;
1063 iwl_mvm_bt_coex_vif_change(mvm
);
1065 /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
1066 if (vif
->p2p
&& mvm
->p2p_device_vif
)
1067 iwl_mvm_mac_ctxt_changed(mvm
, mvm
->p2p_device_vif
);
1069 iwl_mvm_update_quotas(mvm
, NULL
);
1070 iwl_mvm_send_rm_bcast_sta(mvm
, &mvmvif
->bcast_sta
);
1071 iwl_mvm_binding_remove_vif(mvm
, vif
);
1073 mvm
->bound_vif_cnt
--;
1074 iwl_mvm_power_update_binding(mvm
, vif
, false);
1076 iwl_mvm_mac_ctxt_remove(mvm
, vif
);
1078 mutex_unlock(&mvm
->mutex
);
1082 iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm
*mvm
,
1083 struct ieee80211_vif
*vif
,
1084 struct ieee80211_bss_conf
*bss_conf
,
1087 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
1088 enum ieee80211_bss_change ht_change
= BSS_CHANGED_ERP_CTS_PROT
|
1090 BSS_CHANGED_BANDWIDTH
;
1093 /* Changes will be applied when the AP/IBSS is started */
1094 if (!mvmvif
->ap_ibss_active
)
1097 if (changes
& ht_change
) {
1098 ret
= iwl_mvm_mac_ctxt_changed(mvm
, vif
);
1100 IWL_ERR(mvm
, "failed to update MAC %pM\n", vif
->addr
);
1103 /* Need to send a new beacon template to the FW */
1104 if (changes
& BSS_CHANGED_BEACON
) {
1105 if (iwl_mvm_mac_ctxt_beacon_changed(mvm
, vif
))
1106 IWL_WARN(mvm
, "Failed updating beacon data\n");
1110 static void iwl_mvm_bss_info_changed(struct ieee80211_hw
*hw
,
1111 struct ieee80211_vif
*vif
,
1112 struct ieee80211_bss_conf
*bss_conf
,
1115 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1117 mutex_lock(&mvm
->mutex
);
1119 switch (vif
->type
) {
1120 case NL80211_IFTYPE_STATION
:
1121 iwl_mvm_bss_info_changed_station(mvm
, vif
, bss_conf
, changes
);
1123 case NL80211_IFTYPE_AP
:
1124 case NL80211_IFTYPE_ADHOC
:
1125 iwl_mvm_bss_info_changed_ap_ibss(mvm
, vif
, bss_conf
, changes
);
1128 /* shouldn't happen */
1132 mutex_unlock(&mvm
->mutex
);
1135 static int iwl_mvm_mac_hw_scan(struct ieee80211_hw
*hw
,
1136 struct ieee80211_vif
*vif
,
1137 struct cfg80211_scan_request
*req
)
1139 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1142 if (req
->n_channels
== 0 || req
->n_channels
> MAX_NUM_SCAN_CHANNELS
)
1145 mutex_lock(&mvm
->mutex
);
1147 if (mvm
->scan_status
== IWL_MVM_SCAN_NONE
)
1148 ret
= iwl_mvm_scan_request(mvm
, vif
, req
);
1152 mutex_unlock(&mvm
->mutex
);
1157 static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw
*hw
,
1158 struct ieee80211_vif
*vif
)
1160 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1162 mutex_lock(&mvm
->mutex
);
1164 iwl_mvm_cancel_scan(mvm
);
1166 mutex_unlock(&mvm
->mutex
);
1170 iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw
*hw
,
1171 struct ieee80211_sta
*sta
, u16 tid
,
1173 enum ieee80211_frame_release_type reason
,
1176 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1178 /* TODO: how do we tell the fw to send frames for a specific TID */
1181 * The fw will send EOSP notification when the last frame will be
1184 iwl_mvm_sta_modify_sleep_tx_count(mvm
, sta
, reason
, num_frames
);
1187 static void iwl_mvm_mac_sta_notify(struct ieee80211_hw
*hw
,
1188 struct ieee80211_vif
*vif
,
1189 enum sta_notify_cmd cmd
,
1190 struct ieee80211_sta
*sta
)
1192 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1193 struct iwl_mvm_sta
*mvmsta
= iwl_mvm_sta_from_mac80211(sta
);
1196 case STA_NOTIFY_SLEEP
:
1197 if (atomic_read(&mvm
->pending_frames
[mvmsta
->sta_id
]) > 0)
1198 ieee80211_sta_block_awake(hw
, sta
, true);
1200 * The fw updates the STA to be asleep. Tx packets on the Tx
1201 * queues to this station will not be transmitted. The fw will
1202 * send a Tx response with TX_STATUS_FAIL_DEST_PS.
1205 case STA_NOTIFY_AWAKE
:
1206 if (WARN_ON(mvmsta
->sta_id
== IWL_MVM_STATION_COUNT
))
1208 iwl_mvm_sta_modify_ps_wake(mvm
, sta
);
1215 static void iwl_mvm_sta_pre_rcu_remove(struct ieee80211_hw
*hw
,
1216 struct ieee80211_vif
*vif
,
1217 struct ieee80211_sta
*sta
)
1219 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1220 struct iwl_mvm_sta
*mvm_sta
= (void *)sta
->drv_priv
;
1223 * This is called before mac80211 does RCU synchronisation,
1224 * so here we already invalidate our internal RCU-protected
1225 * station pointer. The rest of the code will thus no longer
1226 * be able to find the station this way, and we don't rely
1227 * on further RCU synchronisation after the sta_state()
1228 * callback deleted the station.
1230 mutex_lock(&mvm
->mutex
);
1231 if (sta
== rcu_access_pointer(mvm
->fw_id_to_mac_id
[mvm_sta
->sta_id
]))
1232 rcu_assign_pointer(mvm
->fw_id_to_mac_id
[mvm_sta
->sta_id
],
1234 mutex_unlock(&mvm
->mutex
);
1237 static int iwl_mvm_mac_sta_state(struct ieee80211_hw
*hw
,
1238 struct ieee80211_vif
*vif
,
1239 struct ieee80211_sta
*sta
,
1240 enum ieee80211_sta_state old_state
,
1241 enum ieee80211_sta_state new_state
)
1243 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1244 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
1247 IWL_DEBUG_MAC80211(mvm
, "station %pM state change %d->%d\n",
1248 sta
->addr
, old_state
, new_state
);
1250 /* this would be a mac80211 bug ... but don't crash */
1251 if (WARN_ON_ONCE(!mvmvif
->phy_ctxt
))
1254 /* if a STA is being removed, reuse its ID */
1255 flush_work(&mvm
->sta_drained_wk
);
1257 mutex_lock(&mvm
->mutex
);
1258 if (old_state
== IEEE80211_STA_NOTEXIST
&&
1259 new_state
== IEEE80211_STA_NONE
) {
1261 * Firmware bug - it'll crash if the beacon interval is less
1262 * than 16. We can't avoid connecting at all, so refuse the
1263 * station state change, this will cause mac80211 to abandon
1264 * attempts to connect to this AP, and eventually wpa_s will
1265 * blacklist the AP...
1267 if (vif
->type
== NL80211_IFTYPE_STATION
&&
1268 vif
->bss_conf
.beacon_int
< 16) {
1270 "AP %pM beacon interval is %d, refusing due to firmware bug!\n",
1271 sta
->addr
, vif
->bss_conf
.beacon_int
);
1275 ret
= iwl_mvm_add_sta(mvm
, vif
, sta
);
1276 } else if (old_state
== IEEE80211_STA_NONE
&&
1277 new_state
== IEEE80211_STA_AUTH
) {
1279 } else if (old_state
== IEEE80211_STA_AUTH
&&
1280 new_state
== IEEE80211_STA_ASSOC
) {
1281 ret
= iwl_mvm_update_sta(mvm
, vif
, sta
);
1283 iwl_mvm_rs_rate_init(mvm
, sta
,
1284 mvmvif
->phy_ctxt
->channel
->band
,
1286 } else if (old_state
== IEEE80211_STA_ASSOC
&&
1287 new_state
== IEEE80211_STA_AUTHORIZED
) {
1288 /* enable beacon filtering */
1289 WARN_ON(iwl_mvm_enable_beacon_filter(mvm
, vif
));
1291 } else if (old_state
== IEEE80211_STA_AUTHORIZED
&&
1292 new_state
== IEEE80211_STA_ASSOC
) {
1293 /* disable beacon filtering */
1294 WARN_ON(iwl_mvm_disable_beacon_filter(mvm
, vif
));
1296 } else if (old_state
== IEEE80211_STA_ASSOC
&&
1297 new_state
== IEEE80211_STA_AUTH
) {
1299 } else if (old_state
== IEEE80211_STA_AUTH
&&
1300 new_state
== IEEE80211_STA_NONE
) {
1302 } else if (old_state
== IEEE80211_STA_NONE
&&
1303 new_state
== IEEE80211_STA_NOTEXIST
) {
1304 ret
= iwl_mvm_rm_sta(mvm
, vif
, sta
);
1309 mutex_unlock(&mvm
->mutex
);
1314 static int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw
*hw
, u32 value
)
1316 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1318 mvm
->rts_threshold
= value
;
1323 static void iwl_mvm_sta_rc_update(struct ieee80211_hw
*hw
,
1324 struct ieee80211_vif
*vif
,
1325 struct ieee80211_sta
*sta
, u32 changed
)
1327 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1329 if (vif
->type
== NL80211_IFTYPE_STATION
&&
1330 changed
& IEEE80211_RC_NSS_CHANGED
)
1331 iwl_mvm_sf_update(mvm
, vif
, false);
1334 static int iwl_mvm_mac_conf_tx(struct ieee80211_hw
*hw
,
1335 struct ieee80211_vif
*vif
, u16 ac
,
1336 const struct ieee80211_tx_queue_params
*params
)
1338 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1339 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
1341 mvmvif
->queue_params
[ac
] = *params
;
1344 * No need to update right away, we'll get BSS_CHANGED_QOS
1345 * The exception is P2P_DEVICE interface which needs immediate update.
1347 if (vif
->type
== NL80211_IFTYPE_P2P_DEVICE
) {
1350 mutex_lock(&mvm
->mutex
);
1351 ret
= iwl_mvm_mac_ctxt_changed(mvm
, vif
);
1352 mutex_unlock(&mvm
->mutex
);
1358 static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw
*hw
,
1359 struct ieee80211_vif
*vif
)
1361 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1362 u32 duration
= min(IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS
,
1363 200 + vif
->bss_conf
.beacon_int
);
1364 u32 min_duration
= min(IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS
,
1365 100 + vif
->bss_conf
.beacon_int
);
1367 if (WARN_ON_ONCE(vif
->bss_conf
.assoc
))
1370 mutex_lock(&mvm
->mutex
);
1371 /* Try really hard to protect the session and hear a beacon */
1372 iwl_mvm_protect_session(mvm
, vif
, duration
, min_duration
, 500);
1373 mutex_unlock(&mvm
->mutex
);
1376 static int iwl_mvm_mac_sched_scan_start(struct ieee80211_hw
*hw
,
1377 struct ieee80211_vif
*vif
,
1378 struct cfg80211_sched_scan_request
*req
,
1379 struct ieee80211_sched_scan_ies
*ies
)
1381 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1384 mutex_lock(&mvm
->mutex
);
1386 if (mvm
->scan_status
!= IWL_MVM_SCAN_NONE
) {
1388 "SCHED SCAN request during internal scan - abort\n");
1393 mvm
->scan_status
= IWL_MVM_SCAN_SCHED
;
1395 ret
= iwl_mvm_config_sched_scan(mvm
, vif
, req
, ies
);
1399 ret
= iwl_mvm_config_sched_scan_profiles(mvm
, req
);
1403 ret
= iwl_mvm_sched_scan_start(mvm
, req
);
1407 mvm
->scan_status
= IWL_MVM_SCAN_NONE
;
1409 mutex_unlock(&mvm
->mutex
);
1413 static void iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw
*hw
,
1414 struct ieee80211_vif
*vif
)
1416 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1418 mutex_lock(&mvm
->mutex
);
1419 iwl_mvm_sched_scan_stop(mvm
);
1420 mutex_unlock(&mvm
->mutex
);
1423 static int iwl_mvm_mac_set_key(struct ieee80211_hw
*hw
,
1424 enum set_key_cmd cmd
,
1425 struct ieee80211_vif
*vif
,
1426 struct ieee80211_sta
*sta
,
1427 struct ieee80211_key_conf
*key
)
1429 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1432 if (iwlwifi_mod_params
.sw_crypto
) {
1433 IWL_DEBUG_MAC80211(mvm
, "leave - hwcrypto disabled\n");
1437 switch (key
->cipher
) {
1438 case WLAN_CIPHER_SUITE_TKIP
:
1439 key
->flags
|= IEEE80211_KEY_FLAG_GENERATE_MMIC
;
1441 case WLAN_CIPHER_SUITE_CCMP
:
1442 key
->flags
|= IEEE80211_KEY_FLAG_GENERATE_IV
;
1444 case WLAN_CIPHER_SUITE_AES_CMAC
:
1445 WARN_ON_ONCE(!(hw
->flags
& IEEE80211_HW_MFP_CAPABLE
));
1447 case WLAN_CIPHER_SUITE_WEP40
:
1448 case WLAN_CIPHER_SUITE_WEP104
:
1450 * Support for TX only, at least for now, so accept
1451 * the key and do nothing else. Then mac80211 will
1452 * pass it for TX but we don't have to use it for RX.
1456 /* currently FW supports only one optional cipher scheme */
1457 if (hw
->n_cipher_schemes
&&
1458 hw
->cipher_schemes
->cipher
== key
->cipher
)
1459 key
->flags
|= IEEE80211_KEY_FLAG_PUT_IV_SPACE
;
1464 mutex_lock(&mvm
->mutex
);
1468 if ((vif
->type
== NL80211_IFTYPE_ADHOC
||
1469 vif
->type
== NL80211_IFTYPE_AP
) && !sta
) {
1471 * GTK on AP interface is a TX-only key, return 0;
1472 * on IBSS they're per-station and because we're lazy
1473 * we don't support them for RX, so do the same.
1476 key
->hw_key_idx
= STA_KEY_IDX_INVALID
;
1480 IWL_DEBUG_MAC80211(mvm
, "set hwcrypto key\n");
1481 ret
= iwl_mvm_set_sta_key(mvm
, vif
, sta
, key
, false);
1483 IWL_WARN(mvm
, "set key failed\n");
1485 * can't add key for RX, but we don't need it
1486 * in the device for TX so still return 0
1488 key
->hw_key_idx
= STA_KEY_IDX_INVALID
;
1494 if (key
->hw_key_idx
== STA_KEY_IDX_INVALID
) {
1499 IWL_DEBUG_MAC80211(mvm
, "disable hwcrypto key\n");
1500 ret
= iwl_mvm_remove_sta_key(mvm
, vif
, sta
, key
);
1506 mutex_unlock(&mvm
->mutex
);
1510 static void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw
*hw
,
1511 struct ieee80211_vif
*vif
,
1512 struct ieee80211_key_conf
*keyconf
,
1513 struct ieee80211_sta
*sta
,
1514 u32 iv32
, u16
*phase1key
)
1516 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1518 if (keyconf
->hw_key_idx
== STA_KEY_IDX_INVALID
)
1521 iwl_mvm_update_tkip_key(mvm
, vif
, keyconf
, sta
, iv32
, phase1key
);
1525 static int iwl_mvm_roc(struct ieee80211_hw
*hw
,
1526 struct ieee80211_vif
*vif
,
1527 struct ieee80211_channel
*channel
,
1529 enum ieee80211_roc_type type
)
1531 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1532 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
1533 struct cfg80211_chan_def chandef
;
1534 struct iwl_mvm_phy_ctxt
*phy_ctxt
;
1537 IWL_DEBUG_MAC80211(mvm
, "enter (%d, %d, %d)\n", channel
->hw_value
,
1540 if (vif
->type
!= NL80211_IFTYPE_P2P_DEVICE
) {
1541 IWL_ERR(mvm
, "vif isn't a P2P_DEVICE: %d\n", vif
->type
);
1545 mutex_lock(&mvm
->mutex
);
1547 for (i
= 0; i
< NUM_PHY_CTX
; i
++) {
1548 phy_ctxt
= &mvm
->phy_ctxts
[i
];
1549 if (phy_ctxt
->ref
== 0 || mvmvif
->phy_ctxt
== phy_ctxt
)
1552 if (phy_ctxt
->ref
&& channel
== phy_ctxt
->channel
) {
1554 * Unbind the P2P_DEVICE from the current PHY context,
1555 * and if the PHY context is not used remove it.
1557 ret
= iwl_mvm_binding_remove_vif(mvm
, vif
);
1558 if (WARN(ret
, "Failed unbinding P2P_DEVICE\n"))
1561 iwl_mvm_phy_ctxt_unref(mvm
, mvmvif
->phy_ctxt
);
1563 /* Bind the P2P_DEVICE to the current PHY Context */
1564 mvmvif
->phy_ctxt
= phy_ctxt
;
1566 ret
= iwl_mvm_binding_add_vif(mvm
, vif
);
1567 if (WARN(ret
, "Failed binding P2P_DEVICE\n"))
1570 iwl_mvm_phy_ctxt_ref(mvm
, mvmvif
->phy_ctxt
);
1571 goto schedule_time_event
;
1575 /* Need to update the PHY context only if the ROC channel changed */
1576 if (channel
== mvmvif
->phy_ctxt
->channel
)
1577 goto schedule_time_event
;
1579 cfg80211_chandef_create(&chandef
, channel
, NL80211_CHAN_NO_HT
);
1582 * Change the PHY context configuration as it is currently referenced
1583 * only by the P2P Device MAC
1585 if (mvmvif
->phy_ctxt
->ref
== 1) {
1586 ret
= iwl_mvm_phy_ctxt_changed(mvm
, mvmvif
->phy_ctxt
,
1592 * The PHY context is shared with other MACs. Need to remove the
1593 * P2P Device from the binding, allocate an new PHY context and
1594 * create a new binding
1596 phy_ctxt
= iwl_mvm_get_free_phy_ctxt(mvm
);
1602 ret
= iwl_mvm_phy_ctxt_changed(mvm
, phy_ctxt
, &chandef
,
1605 IWL_ERR(mvm
, "Failed to change PHY context\n");
1609 /* Unbind the P2P_DEVICE from the current PHY context */
1610 ret
= iwl_mvm_binding_remove_vif(mvm
, vif
);
1611 if (WARN(ret
, "Failed unbinding P2P_DEVICE\n"))
1614 iwl_mvm_phy_ctxt_unref(mvm
, mvmvif
->phy_ctxt
);
1616 /* Bind the P2P_DEVICE to the new allocated PHY context */
1617 mvmvif
->phy_ctxt
= phy_ctxt
;
1619 ret
= iwl_mvm_binding_add_vif(mvm
, vif
);
1620 if (WARN(ret
, "Failed binding P2P_DEVICE\n"))
1623 iwl_mvm_phy_ctxt_ref(mvm
, mvmvif
->phy_ctxt
);
1626 schedule_time_event
:
1627 /* Schedule the time events */
1628 ret
= iwl_mvm_start_p2p_roc(mvm
, vif
, duration
, type
);
1631 mutex_unlock(&mvm
->mutex
);
1632 IWL_DEBUG_MAC80211(mvm
, "leave\n");
1636 static int iwl_mvm_cancel_roc(struct ieee80211_hw
*hw
)
1638 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1640 IWL_DEBUG_MAC80211(mvm
, "enter\n");
1642 mutex_lock(&mvm
->mutex
);
1643 iwl_mvm_stop_p2p_roc(mvm
);
1644 mutex_unlock(&mvm
->mutex
);
1646 IWL_DEBUG_MAC80211(mvm
, "leave\n");
1650 static int iwl_mvm_add_chanctx(struct ieee80211_hw
*hw
,
1651 struct ieee80211_chanctx_conf
*ctx
)
1653 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1654 u16
*phy_ctxt_id
= (u16
*)ctx
->drv_priv
;
1655 struct iwl_mvm_phy_ctxt
*phy_ctxt
;
1658 IWL_DEBUG_MAC80211(mvm
, "Add channel context\n");
1660 mutex_lock(&mvm
->mutex
);
1661 phy_ctxt
= iwl_mvm_get_free_phy_ctxt(mvm
);
1667 ret
= iwl_mvm_phy_ctxt_changed(mvm
, phy_ctxt
, &ctx
->min_def
,
1668 ctx
->rx_chains_static
,
1669 ctx
->rx_chains_dynamic
);
1671 IWL_ERR(mvm
, "Failed to add PHY context\n");
1675 iwl_mvm_phy_ctxt_ref(mvm
, phy_ctxt
);
1676 *phy_ctxt_id
= phy_ctxt
->id
;
1678 mutex_unlock(&mvm
->mutex
);
1682 static void iwl_mvm_remove_chanctx(struct ieee80211_hw
*hw
,
1683 struct ieee80211_chanctx_conf
*ctx
)
1685 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1686 u16
*phy_ctxt_id
= (u16
*)ctx
->drv_priv
;
1687 struct iwl_mvm_phy_ctxt
*phy_ctxt
= &mvm
->phy_ctxts
[*phy_ctxt_id
];
1689 mutex_lock(&mvm
->mutex
);
1690 iwl_mvm_phy_ctxt_unref(mvm
, phy_ctxt
);
1691 mutex_unlock(&mvm
->mutex
);
1694 static void iwl_mvm_change_chanctx(struct ieee80211_hw
*hw
,
1695 struct ieee80211_chanctx_conf
*ctx
,
1698 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1699 u16
*phy_ctxt_id
= (u16
*)ctx
->drv_priv
;
1700 struct iwl_mvm_phy_ctxt
*phy_ctxt
= &mvm
->phy_ctxts
[*phy_ctxt_id
];
1702 if (WARN_ONCE((phy_ctxt
->ref
> 1) &&
1703 (changed
& ~(IEEE80211_CHANCTX_CHANGE_WIDTH
|
1704 IEEE80211_CHANCTX_CHANGE_RX_CHAINS
|
1705 IEEE80211_CHANCTX_CHANGE_RADAR
|
1706 IEEE80211_CHANCTX_CHANGE_MIN_WIDTH
)),
1707 "Cannot change PHY. Ref=%d, changed=0x%X\n",
1708 phy_ctxt
->ref
, changed
))
1711 mutex_lock(&mvm
->mutex
);
1712 iwl_mvm_phy_ctxt_changed(mvm
, phy_ctxt
, &ctx
->min_def
,
1713 ctx
->rx_chains_static
,
1714 ctx
->rx_chains_dynamic
);
1715 iwl_mvm_bt_coex_vif_change(mvm
);
1716 mutex_unlock(&mvm
->mutex
);
1719 static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw
*hw
,
1720 struct ieee80211_vif
*vif
,
1721 struct ieee80211_chanctx_conf
*ctx
)
1723 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1724 u16
*phy_ctxt_id
= (u16
*)ctx
->drv_priv
;
1725 struct iwl_mvm_phy_ctxt
*phy_ctxt
= &mvm
->phy_ctxts
[*phy_ctxt_id
];
1726 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
1729 mutex_lock(&mvm
->mutex
);
1731 mvmvif
->phy_ctxt
= phy_ctxt
;
1733 switch (vif
->type
) {
1734 case NL80211_IFTYPE_AP
:
1735 case NL80211_IFTYPE_ADHOC
:
1737 * The AP binding flow is handled as part of the start_ap flow
1738 * (in bss_info_changed), similarly for IBSS.
1742 case NL80211_IFTYPE_STATION
:
1743 case NL80211_IFTYPE_MONITOR
:
1750 ret
= iwl_mvm_binding_add_vif(mvm
, vif
);
1755 * Power state must be updated before quotas,
1756 * otherwise fw will complain.
1758 mvm
->bound_vif_cnt
++;
1759 iwl_mvm_power_update_binding(mvm
, vif
, true);
1761 /* Setting the quota at this stage is only required for monitor
1762 * interfaces. For the other types, the bss_info changed flow
1763 * will handle quota settings.
1765 if (vif
->type
== NL80211_IFTYPE_MONITOR
) {
1766 mvmvif
->monitor_active
= true;
1767 ret
= iwl_mvm_update_quotas(mvm
, vif
);
1769 goto out_remove_binding
;
1775 iwl_mvm_binding_remove_vif(mvm
, vif
);
1776 mvm
->bound_vif_cnt
--;
1777 iwl_mvm_power_update_binding(mvm
, vif
, false);
1779 mutex_unlock(&mvm
->mutex
);
1781 mvmvif
->phy_ctxt
= NULL
;
1785 static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw
*hw
,
1786 struct ieee80211_vif
*vif
,
1787 struct ieee80211_chanctx_conf
*ctx
)
1789 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1790 struct iwl_mvm_vif
*mvmvif
= iwl_mvm_vif_from_mac80211(vif
);
1792 mutex_lock(&mvm
->mutex
);
1794 iwl_mvm_remove_time_event(mvm
, mvmvif
, &mvmvif
->time_event_data
);
1796 switch (vif
->type
) {
1797 case NL80211_IFTYPE_AP
:
1798 case NL80211_IFTYPE_ADHOC
:
1800 case NL80211_IFTYPE_MONITOR
:
1801 mvmvif
->monitor_active
= false;
1802 iwl_mvm_update_quotas(mvm
, NULL
);
1808 iwl_mvm_binding_remove_vif(mvm
, vif
);
1809 mvm
->bound_vif_cnt
--;
1810 iwl_mvm_power_update_binding(mvm
, vif
, false);
1813 mvmvif
->phy_ctxt
= NULL
;
1814 mutex_unlock(&mvm
->mutex
);
1817 static int iwl_mvm_set_tim(struct ieee80211_hw
*hw
,
1818 struct ieee80211_sta
*sta
,
1821 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1822 struct iwl_mvm_sta
*mvm_sta
= (void *)sta
->drv_priv
;
1824 if (!mvm_sta
|| !mvm_sta
->vif
) {
1825 IWL_ERR(mvm
, "Station is not associated to a vif\n");
1829 return iwl_mvm_mac_ctxt_beacon_changed(mvm
, mvm_sta
->vif
);
1832 #ifdef CONFIG_NL80211_TESTMODE
1833 static const struct nla_policy iwl_mvm_tm_policy
[IWL_MVM_TM_ATTR_MAX
+ 1] = {
1834 [IWL_MVM_TM_ATTR_CMD
] = { .type
= NLA_U32
},
1835 [IWL_MVM_TM_ATTR_NOA_DURATION
] = { .type
= NLA_U32
},
1836 [IWL_MVM_TM_ATTR_BEACON_FILTER_STATE
] = { .type
= NLA_U32
},
1839 static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm
*mvm
,
1840 struct ieee80211_vif
*vif
,
1841 void *data
, int len
)
1843 struct nlattr
*tb
[IWL_MVM_TM_ATTR_MAX
+ 1];
1847 err
= nla_parse(tb
, IWL_MVM_TM_ATTR_MAX
, data
, len
, iwl_mvm_tm_policy
);
1851 if (!tb
[IWL_MVM_TM_ATTR_CMD
])
1854 switch (nla_get_u32(tb
[IWL_MVM_TM_ATTR_CMD
])) {
1855 case IWL_MVM_TM_CMD_SET_NOA
:
1856 if (!vif
|| vif
->type
!= NL80211_IFTYPE_AP
|| !vif
->p2p
||
1857 !vif
->bss_conf
.enable_beacon
||
1858 !tb
[IWL_MVM_TM_ATTR_NOA_DURATION
])
1861 noa_duration
= nla_get_u32(tb
[IWL_MVM_TM_ATTR_NOA_DURATION
]);
1862 if (noa_duration
>= vif
->bss_conf
.beacon_int
)
1865 mvm
->noa_duration
= noa_duration
;
1868 return iwl_mvm_update_quotas(mvm
, NULL
);
1869 case IWL_MVM_TM_CMD_SET_BEACON_FILTER
:
1870 /* must be associated client vif - ignore authorized */
1871 if (!vif
|| vif
->type
!= NL80211_IFTYPE_STATION
||
1872 !vif
->bss_conf
.assoc
|| !vif
->bss_conf
.dtim_period
||
1873 !tb
[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE
])
1876 if (nla_get_u32(tb
[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE
]))
1877 return iwl_mvm_enable_beacon_filter(mvm
, vif
);
1878 return iwl_mvm_disable_beacon_filter(mvm
, vif
);
1884 static int iwl_mvm_mac_testmode_cmd(struct ieee80211_hw
*hw
,
1885 struct ieee80211_vif
*vif
,
1886 void *data
, int len
)
1888 struct iwl_mvm
*mvm
= IWL_MAC80211_GET_MVM(hw
);
1891 mutex_lock(&mvm
->mutex
);
1892 err
= __iwl_mvm_mac_testmode_cmd(mvm
, vif
, data
, len
);
1893 mutex_unlock(&mvm
->mutex
);
1899 struct ieee80211_ops iwl_mvm_hw_ops
= {
1900 .tx
= iwl_mvm_mac_tx
,
1901 .ampdu_action
= iwl_mvm_mac_ampdu_action
,
1902 .start
= iwl_mvm_mac_start
,
1903 .restart_complete
= iwl_mvm_mac_restart_complete
,
1904 .stop
= iwl_mvm_mac_stop
,
1905 .add_interface
= iwl_mvm_mac_add_interface
,
1906 .remove_interface
= iwl_mvm_mac_remove_interface
,
1907 .config
= iwl_mvm_mac_config
,
1908 .prepare_multicast
= iwl_mvm_prepare_multicast
,
1909 .configure_filter
= iwl_mvm_configure_filter
,
1910 .bss_info_changed
= iwl_mvm_bss_info_changed
,
1911 .hw_scan
= iwl_mvm_mac_hw_scan
,
1912 .cancel_hw_scan
= iwl_mvm_mac_cancel_hw_scan
,
1913 .sta_pre_rcu_remove
= iwl_mvm_sta_pre_rcu_remove
,
1914 .sta_state
= iwl_mvm_mac_sta_state
,
1915 .sta_notify
= iwl_mvm_mac_sta_notify
,
1916 .allow_buffered_frames
= iwl_mvm_mac_allow_buffered_frames
,
1917 .set_rts_threshold
= iwl_mvm_mac_set_rts_threshold
,
1918 .sta_rc_update
= iwl_mvm_sta_rc_update
,
1919 .conf_tx
= iwl_mvm_mac_conf_tx
,
1920 .mgd_prepare_tx
= iwl_mvm_mac_mgd_prepare_tx
,
1921 .sched_scan_start
= iwl_mvm_mac_sched_scan_start
,
1922 .sched_scan_stop
= iwl_mvm_mac_sched_scan_stop
,
1923 .set_key
= iwl_mvm_mac_set_key
,
1924 .update_tkip_key
= iwl_mvm_mac_update_tkip_key
,
1925 .remain_on_channel
= iwl_mvm_roc
,
1926 .cancel_remain_on_channel
= iwl_mvm_cancel_roc
,
1927 .add_chanctx
= iwl_mvm_add_chanctx
,
1928 .remove_chanctx
= iwl_mvm_remove_chanctx
,
1929 .change_chanctx
= iwl_mvm_change_chanctx
,
1930 .assign_vif_chanctx
= iwl_mvm_assign_vif_chanctx
,
1931 .unassign_vif_chanctx
= iwl_mvm_unassign_vif_chanctx
,
1933 .start_ap
= iwl_mvm_start_ap_ibss
,
1934 .stop_ap
= iwl_mvm_stop_ap_ibss
,
1935 .join_ibss
= iwl_mvm_start_ap_ibss
,
1936 .leave_ibss
= iwl_mvm_stop_ap_ibss
,
1938 .set_tim
= iwl_mvm_set_tim
,
1940 CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd
)
1942 #ifdef CONFIG_PM_SLEEP
1944 .suspend
= iwl_mvm_suspend
,
1945 .resume
= iwl_mvm_resume
,
1946 .set_wakeup
= iwl_mvm_set_wakeup
,
1947 .set_rekey_data
= iwl_mvm_set_rekey_data
,
1948 #if IS_ENABLED(CONFIG_IPV6)
1949 .ipv6_addr_change
= iwl_mvm_ipv6_addr_change
,
1951 .set_default_unicast_key
= iwl_mvm_set_default_unicast_key
,