iwlwifi: mvm: support sched scan if supported by the fw
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / mvm / mac80211.c
1 /******************************************************************************
2 *
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.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
9 *
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.
13 *
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.
18 *
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,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called COPYING.
26 *
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
33 * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
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
45 * distribution.
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.
49 *
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.
61 *
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>
68 #include <linux/ip.h>
69 #include <net/mac80211.h>
70 #include <net/tcp.h>
71
72 #include "iwl-op-mode.h"
73 #include "iwl-io.h"
74 #include "mvm.h"
75 #include "sta.h"
76 #include "time-event.h"
77 #include "iwl-eeprom-parse.h"
78 #include "fw-api-scan.h"
79 #include "iwl-phy-db.h"
80 #include "testmode.h"
81
82 static const struct ieee80211_iface_limit iwl_mvm_limits[] = {
83 {
84 .max = 1,
85 .types = BIT(NL80211_IFTYPE_STATION),
86 },
87 {
88 .max = 1,
89 .types = BIT(NL80211_IFTYPE_AP) |
90 BIT(NL80211_IFTYPE_P2P_CLIENT) |
91 BIT(NL80211_IFTYPE_P2P_GO),
92 },
93 {
94 .max = 1,
95 .types = BIT(NL80211_IFTYPE_P2P_DEVICE),
96 },
97 };
98
99 static const struct ieee80211_iface_combination iwl_mvm_iface_combinations[] = {
100 {
101 .num_different_channels = 1,
102 .max_interfaces = 3,
103 .limits = iwl_mvm_limits,
104 .n_limits = ARRAY_SIZE(iwl_mvm_limits),
105 },
106 };
107
108 #ifdef CONFIG_PM_SLEEP
109 static const struct nl80211_wowlan_tcp_data_token_feature
110 iwl_mvm_wowlan_tcp_token_feature = {
111 .min_len = 0,
112 .max_len = 255,
113 .bufsize = IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS,
114 };
115
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),
127 .seq = true,
128 };
129 #endif
130
131 static void iwl_mvm_reset_phy_ctxts(struct iwl_mvm *mvm)
132 {
133 int i;
134
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;
139 }
140 }
141
142 static int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm)
143 {
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;
148 }
149
150 int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
151 {
152 struct ieee80211_hw *hw = mvm->hw;
153 int num_mac, ret, i;
154
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 |
168 IEEE80211_HW_SUPPORTS_UAPSD;
169
170 hw->queues = IWL_MVM_FIRST_AGG_QUEUE;
171 hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE;
172 hw->rate_control_algorithm = "iwl-mvm-rs";
173
174 /*
175 * Enable 11w if advertised by firmware and software crypto
176 * is not enabled (as the firmware will interpret some mgmt
177 * packets, so enabling it with software crypto isn't safe)
178 */
179 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP &&
180 !iwlwifi_mod_params.sw_crypto)
181 hw->flags |= IEEE80211_HW_MFP_CAPABLE;
182
183 hw->sta_data_size = sizeof(struct iwl_mvm_sta);
184 hw->vif_data_size = sizeof(struct iwl_mvm_vif);
185 hw->chanctx_data_size = sizeof(u16);
186
187 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
188 BIT(NL80211_IFTYPE_P2P_CLIENT) |
189 BIT(NL80211_IFTYPE_AP) |
190 BIT(NL80211_IFTYPE_P2P_GO) |
191 BIT(NL80211_IFTYPE_P2P_DEVICE);
192
193 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
194 WIPHY_FLAG_DISABLE_BEACON_HINTS |
195 WIPHY_FLAG_IBSS_RSN;
196
197 hw->wiphy->iface_combinations = iwl_mvm_iface_combinations;
198 hw->wiphy->n_iface_combinations =
199 ARRAY_SIZE(iwl_mvm_iface_combinations);
200
201 hw->wiphy->max_remain_on_channel_duration = 10000;
202 hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
203 hw->uapsd_queues = IWL_UAPSD_AC_INFO;
204 hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP;
205
206 /* Extract MAC address */
207 memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN);
208 hw->wiphy->addresses = mvm->addresses;
209 hw->wiphy->n_addresses = 1;
210
211 /* Extract additional MAC addresses if available */
212 num_mac = (mvm->nvm_data->n_hw_addrs > 1) ?
213 min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1;
214
215 for (i = 1; i < num_mac; i++) {
216 memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr,
217 ETH_ALEN);
218 mvm->addresses[i].addr[5]++;
219 hw->wiphy->n_addresses++;
220 }
221
222 iwl_mvm_reset_phy_ctxts(mvm);
223
224 hw->wiphy->max_scan_ie_len = iwl_mvm_max_scan_ie_len(mvm);
225
226 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX;
227
228 if (mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels)
229 hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
230 &mvm->nvm_data->bands[IEEE80211_BAND_2GHZ];
231 if (mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels)
232 hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
233 &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ];
234
235 hw->wiphy->hw_version = mvm->trans->hw_id;
236
237 if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM)
238 hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
239 else
240 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
241
242 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SCHED_SCAN) {
243 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
244 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX;
245 hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES;
246 /* we create the 802.11 header and zero length SSID IE. */
247 hw->wiphy->max_sched_scan_ie_len =
248 SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2;
249 }
250
251 hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN |
252 NL80211_FEATURE_P2P_GO_OPPPS;
253
254 mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
255
256 #ifdef CONFIG_PM_SLEEP
257 if (mvm->fw->img[IWL_UCODE_WOWLAN].sec[0].len &&
258 mvm->trans->ops->d3_suspend &&
259 mvm->trans->ops->d3_resume &&
260 device_can_wakeup(mvm->trans->dev)) {
261 mvm->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
262 WIPHY_WOWLAN_DISCONNECT |
263 WIPHY_WOWLAN_EAP_IDENTITY_REQ |
264 WIPHY_WOWLAN_RFKILL_RELEASE;
265 if (!iwlwifi_mod_params.sw_crypto)
266 mvm->wowlan.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
267 WIPHY_WOWLAN_GTK_REKEY_FAILURE |
268 WIPHY_WOWLAN_4WAY_HANDSHAKE;
269
270 mvm->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS;
271 mvm->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN;
272 mvm->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN;
273 mvm->wowlan.tcp = &iwl_mvm_wowlan_tcp_support;
274 hw->wiphy->wowlan = &mvm->wowlan;
275 }
276 #endif
277
278 ret = iwl_mvm_leds_init(mvm);
279 if (ret)
280 return ret;
281
282 ret = ieee80211_register_hw(mvm->hw);
283 if (ret)
284 iwl_mvm_leds_exit(mvm);
285
286 return ret;
287 }
288
289 static void iwl_mvm_mac_tx(struct ieee80211_hw *hw,
290 struct ieee80211_tx_control *control,
291 struct sk_buff *skb)
292 {
293 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
294
295 if (iwl_mvm_is_radio_killed(mvm)) {
296 IWL_DEBUG_DROP(mvm, "Dropping - RF/CT KILL\n");
297 goto drop;
298 }
299
300 if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE &&
301 !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status))
302 goto drop;
303
304 if (control->sta) {
305 if (iwl_mvm_tx_skb(mvm, skb, control->sta))
306 goto drop;
307 return;
308 }
309
310 if (iwl_mvm_tx_skb_non_sta(mvm, skb))
311 goto drop;
312 return;
313 drop:
314 ieee80211_free_txskb(hw, skb);
315 }
316
317 static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw,
318 struct ieee80211_vif *vif,
319 enum ieee80211_ampdu_mlme_action action,
320 struct ieee80211_sta *sta, u16 tid,
321 u16 *ssn, u8 buf_size)
322 {
323 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
324 int ret;
325
326 IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n",
327 sta->addr, tid, action);
328
329 if (!(mvm->nvm_data->sku_cap_11n_enable))
330 return -EACCES;
331
332 mutex_lock(&mvm->mutex);
333
334 switch (action) {
335 case IEEE80211_AMPDU_RX_START:
336 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) {
337 ret = -EINVAL;
338 break;
339 }
340 ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, *ssn, true);
341 break;
342 case IEEE80211_AMPDU_RX_STOP:
343 ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, 0, false);
344 break;
345 case IEEE80211_AMPDU_TX_START:
346 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) {
347 ret = -EINVAL;
348 break;
349 }
350 ret = iwl_mvm_sta_tx_agg_start(mvm, vif, sta, tid, ssn);
351 break;
352 case IEEE80211_AMPDU_TX_STOP_CONT:
353 ret = iwl_mvm_sta_tx_agg_stop(mvm, vif, sta, tid);
354 break;
355 case IEEE80211_AMPDU_TX_STOP_FLUSH:
356 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
357 ret = iwl_mvm_sta_tx_agg_flush(mvm, vif, sta, tid);
358 break;
359 case IEEE80211_AMPDU_TX_OPERATIONAL:
360 ret = iwl_mvm_sta_tx_agg_oper(mvm, vif, sta, tid, buf_size);
361 break;
362 default:
363 WARN_ON_ONCE(1);
364 ret = -EINVAL;
365 break;
366 }
367 mutex_unlock(&mvm->mutex);
368
369 return ret;
370 }
371
372 static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
373 struct ieee80211_vif *vif)
374 {
375 struct iwl_mvm *mvm = data;
376 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
377
378 mvmvif->uploaded = false;
379 mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
380
381 /* does this make sense at all? */
382 mvmvif->color++;
383
384 spin_lock_bh(&mvm->time_event_lock);
385 iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data);
386 spin_unlock_bh(&mvm->time_event_lock);
387
388 mvmvif->phy_ctxt = NULL;
389 }
390
391 static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
392 {
393 iwl_trans_stop_device(mvm->trans);
394 iwl_trans_stop_hw(mvm->trans, false);
395
396 mvm->scan_status = IWL_MVM_SCAN_NONE;
397
398 /* just in case one was running */
399 ieee80211_remain_on_channel_expired(mvm->hw);
400
401 ieee80211_iterate_active_interfaces_atomic(
402 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
403 iwl_mvm_cleanup_iterator, mvm);
404
405 mvm->p2p_device_vif = NULL;
406
407 iwl_mvm_reset_phy_ctxts(mvm);
408 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table));
409 memset(mvm->sta_drained, 0, sizeof(mvm->sta_drained));
410
411 ieee80211_wake_queues(mvm->hw);
412
413 mvm->vif_count = 0;
414 mvm->rx_ba_sessions = 0;
415 }
416
417 static int iwl_mvm_mac_start(struct ieee80211_hw *hw)
418 {
419 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
420 int ret;
421
422 mutex_lock(&mvm->mutex);
423
424 /* Clean up some internal and mac80211 state on restart */
425 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
426 iwl_mvm_restart_cleanup(mvm);
427
428 ret = iwl_mvm_up(mvm);
429 mutex_unlock(&mvm->mutex);
430
431 return ret;
432 }
433
434 static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw)
435 {
436 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
437 int ret;
438
439 mutex_lock(&mvm->mutex);
440
441 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
442 ret = iwl_mvm_update_quotas(mvm, NULL);
443 if (ret)
444 IWL_ERR(mvm, "Failed to update quotas after restart (%d)\n",
445 ret);
446
447 mutex_unlock(&mvm->mutex);
448 }
449
450 static void iwl_mvm_mac_stop(struct ieee80211_hw *hw)
451 {
452 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
453
454 flush_work(&mvm->async_handlers_wk);
455
456 mutex_lock(&mvm->mutex);
457 /* async_handlers_wk is now blocked */
458
459 /*
460 * The work item could be running or queued if the
461 * ROC time event stops just as we get here.
462 */
463 cancel_work_sync(&mvm->roc_done_wk);
464
465 iwl_trans_stop_device(mvm->trans);
466 iwl_trans_stop_hw(mvm->trans, false);
467
468 iwl_mvm_async_handlers_purge(mvm);
469 /* async_handlers_list is empty and will stay empty: HW is stopped */
470
471 /* the fw is stopped, the aux sta is dead: clean up driver state */
472 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta);
473
474 mutex_unlock(&mvm->mutex);
475
476 /*
477 * The worker might have been waiting for the mutex, let it run and
478 * discover that its list is now empty.
479 */
480 cancel_work_sync(&mvm->async_handlers_wk);
481 }
482
483 static void iwl_mvm_pm_disable_iterator(void *data, u8 *mac,
484 struct ieee80211_vif *vif)
485 {
486 struct iwl_mvm *mvm = data;
487 int ret;
488
489 ret = iwl_mvm_power_disable(mvm, vif);
490 if (ret)
491 IWL_ERR(mvm, "failed to disable power management\n");
492 }
493
494 static void iwl_mvm_power_update_iterator(void *data, u8 *mac,
495 struct ieee80211_vif *vif)
496 {
497 struct iwl_mvm *mvm = data;
498
499 iwl_mvm_power_update_mode(mvm, vif);
500 }
501
502 static struct iwl_mvm_phy_ctxt *iwl_mvm_get_free_phy_ctxt(struct iwl_mvm *mvm)
503 {
504 u16 i;
505
506 lockdep_assert_held(&mvm->mutex);
507
508 for (i = 0; i < NUM_PHY_CTX; i++)
509 if (!mvm->phy_ctxts[i].ref)
510 return &mvm->phy_ctxts[i];
511
512 IWL_ERR(mvm, "No available PHY context\n");
513 return NULL;
514 }
515
516 static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
517 struct ieee80211_vif *vif)
518 {
519 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
520 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
521 int ret;
522
523 /*
524 * Not much to do here. The stack will not allow interface
525 * types or combinations that we didn't advertise, so we
526 * don't really have to check the types.
527 */
528
529 mutex_lock(&mvm->mutex);
530
531 /* Allocate resources for the MAC context, and add it to the fw */
532 ret = iwl_mvm_mac_ctxt_init(mvm, vif);
533 if (ret)
534 goto out_unlock;
535
536 /*
537 * TODO: remove this temporary code.
538 * Currently MVM FW supports power management only on single MAC.
539 * If new interface added, disable PM on existing interface.
540 * P2P device is a special case, since it is handled by FW similary to
541 * scan. If P2P deviced is added, PM remains enabled on existing
542 * interface.
543 * Note: the method below does not count the new interface being added
544 * at this moment.
545 */
546 if (vif->type != NL80211_IFTYPE_P2P_DEVICE)
547 mvm->vif_count++;
548 if (mvm->vif_count > 1) {
549 IWL_DEBUG_MAC80211(mvm,
550 "Disable power on existing interfaces\n");
551 ieee80211_iterate_active_interfaces_atomic(
552 mvm->hw,
553 IEEE80211_IFACE_ITER_NORMAL,
554 iwl_mvm_pm_disable_iterator, mvm);
555 }
556
557 /*
558 * The AP binding flow can be done only after the beacon
559 * template is configured (which happens only in the mac80211
560 * start_ap() flow), and adding the broadcast station can happen
561 * only after the binding.
562 * In addition, since modifying the MAC before adding a bcast
563 * station is not allowed by the FW, delay the adding of MAC context to
564 * the point where we can also add the bcast station.
565 * In short: there's not much we can do at this point, other than
566 * allocating resources :)
567 */
568 if (vif->type == NL80211_IFTYPE_AP) {
569 u32 qmask = iwl_mvm_mac_get_queues_mask(mvm, vif);
570 ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta,
571 qmask);
572 if (ret) {
573 IWL_ERR(mvm, "Failed to allocate bcast sta\n");
574 goto out_release;
575 }
576
577 iwl_mvm_vif_dbgfs_register(mvm, vif);
578 goto out_unlock;
579 }
580
581 ret = iwl_mvm_mac_ctxt_add(mvm, vif);
582 if (ret)
583 goto out_release;
584
585 /*
586 * Update power state on the new interface. Admittedly, based on
587 * mac80211 logics this power update will disable power management
588 */
589 iwl_mvm_power_update_mode(mvm, vif);
590
591 /* beacon filtering */
592 ret = iwl_mvm_disable_beacon_filter(mvm, vif);
593 if (ret)
594 goto out_remove_mac;
595
596 if (!mvm->bf_allowed_vif &&
597 vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
598 mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BF_UPDATED){
599 mvm->bf_allowed_vif = mvmvif;
600 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER |
601 IEEE80211_VIF_SUPPORTS_CQM_RSSI;
602 }
603
604 /*
605 * P2P_DEVICE interface does not have a channel context assigned to it,
606 * so a dedicated PHY context is allocated to it and the corresponding
607 * MAC context is bound to it at this stage.
608 */
609 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
610
611 mvmvif->phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm);
612 if (!mvmvif->phy_ctxt) {
613 ret = -ENOSPC;
614 goto out_free_bf;
615 }
616
617 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt);
618 ret = iwl_mvm_binding_add_vif(mvm, vif);
619 if (ret)
620 goto out_unref_phy;
621
622 ret = iwl_mvm_add_bcast_sta(mvm, vif, &mvmvif->bcast_sta);
623 if (ret)
624 goto out_unbind;
625
626 /* Save a pointer to p2p device vif, so it can later be used to
627 * update the p2p device MAC when a GO is started/stopped */
628 mvm->p2p_device_vif = vif;
629 }
630
631 iwl_mvm_vif_dbgfs_register(mvm, vif);
632 goto out_unlock;
633
634 out_unbind:
635 iwl_mvm_binding_remove_vif(mvm, vif);
636 out_unref_phy:
637 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt);
638 out_free_bf:
639 if (mvm->bf_allowed_vif == mvmvif) {
640 mvm->bf_allowed_vif = NULL;
641 vif->driver_flags &= ~(IEEE80211_VIF_BEACON_FILTER |
642 IEEE80211_VIF_SUPPORTS_CQM_RSSI);
643 }
644 out_remove_mac:
645 mvmvif->phy_ctxt = NULL;
646 iwl_mvm_mac_ctxt_remove(mvm, vif);
647 out_release:
648 if (vif->type != NL80211_IFTYPE_P2P_DEVICE)
649 mvm->vif_count--;
650 ieee80211_iterate_active_interfaces(
651 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
652 iwl_mvm_power_update_iterator, mvm);
653 iwl_mvm_mac_ctxt_release(mvm, vif);
654 out_unlock:
655 mutex_unlock(&mvm->mutex);
656
657 return ret;
658 }
659
660 static void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm,
661 struct ieee80211_vif *vif)
662 {
663 u32 tfd_msk = 0, ac;
664
665 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
666 if (vif->hw_queue[ac] != IEEE80211_INVAL_HW_QUEUE)
667 tfd_msk |= BIT(vif->hw_queue[ac]);
668
669 if (vif->cab_queue != IEEE80211_INVAL_HW_QUEUE)
670 tfd_msk |= BIT(vif->cab_queue);
671
672 if (tfd_msk) {
673 mutex_lock(&mvm->mutex);
674 iwl_mvm_flush_tx_path(mvm, tfd_msk, true);
675 mutex_unlock(&mvm->mutex);
676 }
677
678 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
679 /*
680 * Flush the ROC worker which will flush the OFFCHANNEL queue.
681 * We assume here that all the packets sent to the OFFCHANNEL
682 * queue are sent in ROC session.
683 */
684 flush_work(&mvm->roc_done_wk);
685 } else {
686 /*
687 * By now, all the AC queues are empty. The AGG queues are
688 * empty too. We already got all the Tx responses for all the
689 * packets in the queues. The drain work can have been
690 * triggered. Flush it.
691 */
692 flush_work(&mvm->sta_drained_wk);
693 }
694 }
695
696 static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
697 struct ieee80211_vif *vif)
698 {
699 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
700 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
701
702 iwl_mvm_prepare_mac_removal(mvm, vif);
703
704 mutex_lock(&mvm->mutex);
705
706 if (mvm->bf_allowed_vif == mvmvif) {
707 mvm->bf_allowed_vif = NULL;
708 vif->driver_flags &= ~(IEEE80211_VIF_BEACON_FILTER |
709 IEEE80211_VIF_SUPPORTS_CQM_RSSI);
710 }
711
712 iwl_mvm_vif_dbgfs_clean(mvm, vif);
713
714 /*
715 * For AP/GO interface, the tear down of the resources allocated to the
716 * interface is be handled as part of the stop_ap flow.
717 */
718 if (vif->type == NL80211_IFTYPE_AP) {
719 #ifdef CONFIG_NL80211_TESTMODE
720 if (vif == mvm->noa_vif) {
721 mvm->noa_vif = NULL;
722 mvm->noa_duration = 0;
723 }
724 #endif
725 iwl_mvm_dealloc_int_sta(mvm, &mvmvif->bcast_sta);
726 goto out_release;
727 }
728
729 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
730 mvm->p2p_device_vif = NULL;
731 iwl_mvm_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
732 iwl_mvm_binding_remove_vif(mvm, vif);
733 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt);
734 mvmvif->phy_ctxt = NULL;
735 }
736
737 /*
738 * TODO: remove this temporary code.
739 * Currently MVM FW supports power management only on single MAC.
740 * Check if only one additional interface remains after removing
741 * current one. Update power mode on the remaining interface.
742 */
743 if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE)
744 mvm->vif_count--;
745 IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n",
746 mvm->vif_count);
747 if (mvm->vif_count == 1) {
748 ieee80211_iterate_active_interfaces(
749 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
750 iwl_mvm_power_update_iterator, mvm);
751 }
752
753 iwl_mvm_mac_ctxt_remove(mvm, vif);
754
755 out_release:
756 iwl_mvm_mac_ctxt_release(mvm, vif);
757 mutex_unlock(&mvm->mutex);
758 }
759
760 static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
761 s8 tx_power)
762 {
763 /* FW is in charge of regulatory enforcement */
764 struct iwl_reduce_tx_power_cmd reduce_txpwr_cmd = {
765 .mac_context_id = iwl_mvm_vif_from_mac80211(vif)->id,
766 .pwr_restriction = cpu_to_le16(tx_power),
767 };
768
769 return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, CMD_SYNC,
770 sizeof(reduce_txpwr_cmd),
771 &reduce_txpwr_cmd);
772 }
773
774 static int iwl_mvm_mac_config(struct ieee80211_hw *hw, u32 changed)
775 {
776 return 0;
777 }
778
779 static void iwl_mvm_configure_filter(struct ieee80211_hw *hw,
780 unsigned int changed_flags,
781 unsigned int *total_flags,
782 u64 multicast)
783 {
784 *total_flags = 0;
785 }
786
787 static int iwl_mvm_configure_mcast_filter(struct iwl_mvm *mvm,
788 struct ieee80211_vif *vif)
789 {
790 struct iwl_mcast_filter_cmd mcast_filter_cmd = {
791 .pass_all = 1,
792 };
793
794 memcpy(mcast_filter_cmd.bssid, vif->bss_conf.bssid, ETH_ALEN);
795
796 return iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC,
797 sizeof(mcast_filter_cmd),
798 &mcast_filter_cmd);
799 }
800
801 static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
802 struct ieee80211_vif *vif,
803 struct ieee80211_bss_conf *bss_conf,
804 u32 changes)
805 {
806 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
807 int ret;
808
809 ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
810 if (ret)
811 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);
812
813 if (changes & BSS_CHANGED_ASSOC) {
814 if (bss_conf->assoc) {
815 /* add quota for this interface */
816 ret = iwl_mvm_update_quotas(mvm, vif);
817 if (ret) {
818 IWL_ERR(mvm, "failed to update quotas\n");
819 return;
820 }
821 iwl_mvm_configure_mcast_filter(mvm, vif);
822
823 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART,
824 &mvm->status)) {
825 /*
826 * If we're restarting then the firmware will
827 * obviously have lost synchronisation with
828 * the AP. It will attempt to synchronise by
829 * itself, but we can make it more reliable by
830 * scheduling a session protection time event.
831 *
832 * The firmware needs to receive a beacon to
833 * catch up with synchronisation, use 110% of
834 * the beacon interval.
835 *
836 * Set a large maximum delay to allow for more
837 * than a single interface.
838 */
839 u32 dur = (11 * vif->bss_conf.beacon_int) / 10;
840 iwl_mvm_protect_session(mvm, vif, dur, dur,
841 5 * dur);
842 }
843 } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
844 /* remove AP station now that the MAC is unassoc */
845 ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id);
846 if (ret)
847 IWL_ERR(mvm, "failed to remove AP station\n");
848 mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
849 /* remove quota for this interface */
850 ret = iwl_mvm_update_quotas(mvm, NULL);
851 if (ret)
852 IWL_ERR(mvm, "failed to update quotas\n");
853 }
854
855 /* reset rssi values */
856 mvmvif->bf_data.ave_beacon_signal = 0;
857
858 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD)) {
859 /* Workaround for FW bug, otherwise FW disables device
860 * power save upon disassociation
861 */
862 ret = iwl_mvm_power_update_mode(mvm, vif);
863 if (ret)
864 IWL_ERR(mvm, "failed to update power mode\n");
865 }
866 iwl_mvm_bt_coex_vif_assoc(mvm, vif);
867 } else if (changes & BSS_CHANGED_BEACON_INFO) {
868 /*
869 * We received a beacon _after_ association so
870 * remove the session protection.
871 */
872 iwl_mvm_remove_time_event(mvm, mvmvif,
873 &mvmvif->time_event_data);
874 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_QOS)) {
875 ret = iwl_mvm_power_update_mode(mvm, vif);
876 if (ret)
877 IWL_ERR(mvm, "failed to update power mode\n");
878 }
879 if (changes & BSS_CHANGED_TXPOWER) {
880 IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n",
881 bss_conf->txpower);
882 iwl_mvm_set_tx_power(mvm, vif, bss_conf->txpower);
883 }
884
885 if (changes & BSS_CHANGED_CQM) {
886 IWL_DEBUG_MAC80211(mvm, "cqm info_changed");
887 /* reset cqm events tracking */
888 mvmvif->bf_data.last_cqm_event = 0;
889 ret = iwl_mvm_update_beacon_filter(mvm, vif);
890 if (ret)
891 IWL_ERR(mvm, "failed to update CQM thresholds\n");
892 }
893 }
894
895 static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
896 {
897 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
898 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
899 int ret;
900
901 mutex_lock(&mvm->mutex);
902
903 /* Send the beacon template */
904 ret = iwl_mvm_mac_ctxt_beacon_changed(mvm, vif);
905 if (ret)
906 goto out_unlock;
907
908 /* Add the mac context */
909 ret = iwl_mvm_mac_ctxt_add(mvm, vif);
910 if (ret)
911 goto out_unlock;
912
913 /* Perform the binding */
914 ret = iwl_mvm_binding_add_vif(mvm, vif);
915 if (ret)
916 goto out_remove;
917
918 mvmvif->ap_active = true;
919
920 /* Send the bcast station. At this stage the TBTT and DTIM time events
921 * are added and applied to the scheduler */
922 ret = iwl_mvm_send_bcast_sta(mvm, vif, &mvmvif->bcast_sta);
923 if (ret)
924 goto out_unbind;
925
926 ret = iwl_mvm_update_quotas(mvm, vif);
927 if (ret)
928 goto out_rm_bcast;
929
930 /* Need to update the P2P Device MAC */
931 if (vif->p2p && mvm->p2p_device_vif)
932 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
933
934 mutex_unlock(&mvm->mutex);
935 return 0;
936
937 out_rm_bcast:
938 iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
939 out_unbind:
940 iwl_mvm_binding_remove_vif(mvm, vif);
941 out_remove:
942 iwl_mvm_mac_ctxt_remove(mvm, vif);
943 out_unlock:
944 mutex_unlock(&mvm->mutex);
945 return ret;
946 }
947
948 static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
949 {
950 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
951 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
952
953 iwl_mvm_prepare_mac_removal(mvm, vif);
954
955 mutex_lock(&mvm->mutex);
956
957 mvmvif->ap_active = false;
958
959 /* Need to update the P2P Device MAC */
960 if (vif->p2p && mvm->p2p_device_vif)
961 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
962
963 iwl_mvm_update_quotas(mvm, NULL);
964 iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
965 iwl_mvm_binding_remove_vif(mvm, vif);
966 iwl_mvm_mac_ctxt_remove(mvm, vif);
967
968 mutex_unlock(&mvm->mutex);
969 }
970
971 static void iwl_mvm_bss_info_changed_ap(struct iwl_mvm *mvm,
972 struct ieee80211_vif *vif,
973 struct ieee80211_bss_conf *bss_conf,
974 u32 changes)
975 {
976 /* Need to send a new beacon template to the FW */
977 if (changes & BSS_CHANGED_BEACON) {
978 if (iwl_mvm_mac_ctxt_beacon_changed(mvm, vif))
979 IWL_WARN(mvm, "Failed updating beacon data\n");
980 }
981 }
982
983 static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
984 struct ieee80211_vif *vif,
985 struct ieee80211_bss_conf *bss_conf,
986 u32 changes)
987 {
988 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
989
990 mutex_lock(&mvm->mutex);
991
992 switch (vif->type) {
993 case NL80211_IFTYPE_STATION:
994 iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes);
995 break;
996 case NL80211_IFTYPE_AP:
997 iwl_mvm_bss_info_changed_ap(mvm, vif, bss_conf, changes);
998 break;
999 default:
1000 /* shouldn't happen */
1001 WARN_ON_ONCE(1);
1002 }
1003
1004 mutex_unlock(&mvm->mutex);
1005 }
1006
1007 static int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw,
1008 struct ieee80211_vif *vif,
1009 struct cfg80211_scan_request *req)
1010 {
1011 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1012 int ret;
1013
1014 if (req->n_channels == 0 || req->n_channels > MAX_NUM_SCAN_CHANNELS)
1015 return -EINVAL;
1016
1017 mutex_lock(&mvm->mutex);
1018
1019 if (mvm->scan_status == IWL_MVM_SCAN_NONE)
1020 ret = iwl_mvm_scan_request(mvm, vif, req);
1021 else
1022 ret = -EBUSY;
1023
1024 mutex_unlock(&mvm->mutex);
1025
1026 return ret;
1027 }
1028
1029 static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw,
1030 struct ieee80211_vif *vif)
1031 {
1032 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1033
1034 mutex_lock(&mvm->mutex);
1035
1036 iwl_mvm_cancel_scan(mvm);
1037
1038 mutex_unlock(&mvm->mutex);
1039 }
1040
1041 static void
1042 iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw,
1043 struct ieee80211_sta *sta, u16 tid,
1044 int num_frames,
1045 enum ieee80211_frame_release_type reason,
1046 bool more_data)
1047 {
1048 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1049
1050 /* TODO: how do we tell the fw to send frames for a specific TID */
1051
1052 /*
1053 * The fw will send EOSP notification when the last frame will be
1054 * transmitted.
1055 */
1056 iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames);
1057 }
1058
1059 static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
1060 struct ieee80211_vif *vif,
1061 enum sta_notify_cmd cmd,
1062 struct ieee80211_sta *sta)
1063 {
1064 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1065 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
1066
1067 switch (cmd) {
1068 case STA_NOTIFY_SLEEP:
1069 if (atomic_read(&mvm->pending_frames[mvmsta->sta_id]) > 0)
1070 ieee80211_sta_block_awake(hw, sta, true);
1071 /*
1072 * The fw updates the STA to be asleep. Tx packets on the Tx
1073 * queues to this station will not be transmitted. The fw will
1074 * send a Tx response with TX_STATUS_FAIL_DEST_PS.
1075 */
1076 break;
1077 case STA_NOTIFY_AWAKE:
1078 if (WARN_ON(mvmsta->sta_id == IWL_MVM_STATION_COUNT))
1079 break;
1080 iwl_mvm_sta_modify_ps_wake(mvm, sta);
1081 break;
1082 default:
1083 break;
1084 }
1085 }
1086
1087 static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
1088 struct ieee80211_vif *vif,
1089 struct ieee80211_sta *sta,
1090 enum ieee80211_sta_state old_state,
1091 enum ieee80211_sta_state new_state)
1092 {
1093 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1094 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1095 int ret;
1096
1097 IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n",
1098 sta->addr, old_state, new_state);
1099
1100 /* this would be a mac80211 bug ... but don't crash */
1101 if (WARN_ON_ONCE(!mvmvif->phy_ctxt))
1102 return -EINVAL;
1103
1104 /* if a STA is being removed, reuse its ID */
1105 flush_work(&mvm->sta_drained_wk);
1106
1107 mutex_lock(&mvm->mutex);
1108 if (old_state == IEEE80211_STA_NOTEXIST &&
1109 new_state == IEEE80211_STA_NONE) {
1110 /*
1111 * Firmware bug - it'll crash if the beacon interval is less
1112 * than 16. We can't avoid connecting at all, so refuse the
1113 * station state change, this will cause mac80211 to abandon
1114 * attempts to connect to this AP, and eventually wpa_s will
1115 * blacklist the AP...
1116 */
1117 if (vif->type == NL80211_IFTYPE_STATION &&
1118 vif->bss_conf.beacon_int < 16) {
1119 IWL_ERR(mvm,
1120 "AP %pM beacon interval is %d, refusing due to firmware bug!\n",
1121 sta->addr, vif->bss_conf.beacon_int);
1122 ret = -EINVAL;
1123 goto out_unlock;
1124 }
1125 ret = iwl_mvm_add_sta(mvm, vif, sta);
1126 } else if (old_state == IEEE80211_STA_NONE &&
1127 new_state == IEEE80211_STA_AUTH) {
1128 ret = 0;
1129 } else if (old_state == IEEE80211_STA_AUTH &&
1130 new_state == IEEE80211_STA_ASSOC) {
1131 ret = iwl_mvm_update_sta(mvm, vif, sta);
1132 if (ret == 0)
1133 iwl_mvm_rs_rate_init(mvm, sta,
1134 mvmvif->phy_ctxt->channel->band);
1135 } else if (old_state == IEEE80211_STA_ASSOC &&
1136 new_state == IEEE80211_STA_AUTHORIZED) {
1137 /* enable beacon filtering */
1138 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif));
1139 ret = 0;
1140 } else if (old_state == IEEE80211_STA_AUTHORIZED &&
1141 new_state == IEEE80211_STA_ASSOC) {
1142 /* disable beacon filtering */
1143 WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif));
1144 ret = 0;
1145 } else if (old_state == IEEE80211_STA_ASSOC &&
1146 new_state == IEEE80211_STA_AUTH) {
1147 ret = 0;
1148 } else if (old_state == IEEE80211_STA_AUTH &&
1149 new_state == IEEE80211_STA_NONE) {
1150 ret = 0;
1151 } else if (old_state == IEEE80211_STA_NONE &&
1152 new_state == IEEE80211_STA_NOTEXIST) {
1153 ret = iwl_mvm_rm_sta(mvm, vif, sta);
1154 } else {
1155 ret = -EIO;
1156 }
1157 out_unlock:
1158 mutex_unlock(&mvm->mutex);
1159
1160 return ret;
1161 }
1162
1163 static int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
1164 {
1165 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1166
1167 mvm->rts_threshold = value;
1168
1169 return 0;
1170 }
1171
1172 static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw,
1173 struct ieee80211_vif *vif, u16 ac,
1174 const struct ieee80211_tx_queue_params *params)
1175 {
1176 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1177 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1178
1179 mvmvif->queue_params[ac] = *params;
1180
1181 /*
1182 * No need to update right away, we'll get BSS_CHANGED_QOS
1183 * The exception is P2P_DEVICE interface which needs immediate update.
1184 */
1185 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
1186 int ret;
1187
1188 mutex_lock(&mvm->mutex);
1189 ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
1190 mutex_unlock(&mvm->mutex);
1191 return ret;
1192 }
1193 return 0;
1194 }
1195
1196 static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
1197 struct ieee80211_vif *vif)
1198 {
1199 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1200 u32 duration = min(IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS,
1201 200 + vif->bss_conf.beacon_int);
1202 u32 min_duration = min(IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS,
1203 100 + vif->bss_conf.beacon_int);
1204
1205 if (WARN_ON_ONCE(vif->bss_conf.assoc))
1206 return;
1207
1208 mutex_lock(&mvm->mutex);
1209 /* Try really hard to protect the session and hear a beacon */
1210 iwl_mvm_protect_session(mvm, vif, duration, min_duration, 500);
1211 mutex_unlock(&mvm->mutex);
1212 }
1213
1214 static int iwl_mvm_mac_sched_scan_start(struct ieee80211_hw *hw,
1215 struct ieee80211_vif *vif,
1216 struct cfg80211_sched_scan_request *req,
1217 struct ieee80211_sched_scan_ies *ies)
1218 {
1219 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1220 int ret;
1221
1222 mutex_lock(&mvm->mutex);
1223
1224 if (mvm->scan_status != IWL_MVM_SCAN_NONE) {
1225 IWL_DEBUG_SCAN(mvm,
1226 "SCHED SCAN request during internal scan - abort\n");
1227 ret = -EBUSY;
1228 goto out;
1229 }
1230
1231 mvm->scan_status = IWL_MVM_SCAN_SCHED;
1232
1233 ret = iwl_mvm_config_sched_scan(mvm, vif, req, ies);
1234 if (ret)
1235 goto err;
1236
1237 ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
1238 if (ret)
1239 goto err;
1240
1241 ret = iwl_mvm_sched_scan_start(mvm, req);
1242 if (!ret)
1243 goto out;
1244 err:
1245 mvm->scan_status = IWL_MVM_SCAN_NONE;
1246 out:
1247 mutex_unlock(&mvm->mutex);
1248 return ret;
1249 }
1250
1251 static void iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw,
1252 struct ieee80211_vif *vif)
1253 {
1254 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1255
1256 mutex_lock(&mvm->mutex);
1257 iwl_mvm_sched_scan_stop(mvm);
1258 mutex_unlock(&mvm->mutex);
1259 }
1260
1261 static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
1262 enum set_key_cmd cmd,
1263 struct ieee80211_vif *vif,
1264 struct ieee80211_sta *sta,
1265 struct ieee80211_key_conf *key)
1266 {
1267 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1268 int ret;
1269
1270 if (iwlwifi_mod_params.sw_crypto) {
1271 IWL_DEBUG_MAC80211(mvm, "leave - hwcrypto disabled\n");
1272 return -EOPNOTSUPP;
1273 }
1274
1275 switch (key->cipher) {
1276 case WLAN_CIPHER_SUITE_TKIP:
1277 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
1278 /* fall-through */
1279 case WLAN_CIPHER_SUITE_CCMP:
1280 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
1281 break;
1282 case WLAN_CIPHER_SUITE_AES_CMAC:
1283 WARN_ON_ONCE(!(hw->flags & IEEE80211_HW_MFP_CAPABLE));
1284 break;
1285 case WLAN_CIPHER_SUITE_WEP40:
1286 case WLAN_CIPHER_SUITE_WEP104:
1287 /*
1288 * Support for TX only, at least for now, so accept
1289 * the key and do nothing else. Then mac80211 will
1290 * pass it for TX but we don't have to use it for RX.
1291 */
1292 return 0;
1293 default:
1294 return -EOPNOTSUPP;
1295 }
1296
1297 mutex_lock(&mvm->mutex);
1298
1299 switch (cmd) {
1300 case SET_KEY:
1301 if (vif->type == NL80211_IFTYPE_AP && !sta) {
1302 /* GTK on AP interface is a TX-only key, return 0 */
1303 ret = 0;
1304 key->hw_key_idx = STA_KEY_IDX_INVALID;
1305 break;
1306 }
1307
1308 IWL_DEBUG_MAC80211(mvm, "set hwcrypto key\n");
1309 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, false);
1310 if (ret) {
1311 IWL_WARN(mvm, "set key failed\n");
1312 /*
1313 * can't add key for RX, but we don't need it
1314 * in the device for TX so still return 0
1315 */
1316 key->hw_key_idx = STA_KEY_IDX_INVALID;
1317 ret = 0;
1318 }
1319
1320 break;
1321 case DISABLE_KEY:
1322 if (key->hw_key_idx == STA_KEY_IDX_INVALID) {
1323 ret = 0;
1324 break;
1325 }
1326
1327 IWL_DEBUG_MAC80211(mvm, "disable hwcrypto key\n");
1328 ret = iwl_mvm_remove_sta_key(mvm, vif, sta, key);
1329 break;
1330 default:
1331 ret = -EINVAL;
1332 }
1333
1334 mutex_unlock(&mvm->mutex);
1335 return ret;
1336 }
1337
1338 static void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw,
1339 struct ieee80211_vif *vif,
1340 struct ieee80211_key_conf *keyconf,
1341 struct ieee80211_sta *sta,
1342 u32 iv32, u16 *phase1key)
1343 {
1344 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1345
1346 iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key);
1347 }
1348
1349
1350 static int iwl_mvm_roc(struct ieee80211_hw *hw,
1351 struct ieee80211_vif *vif,
1352 struct ieee80211_channel *channel,
1353 int duration,
1354 enum ieee80211_roc_type type)
1355 {
1356 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1357 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1358 struct cfg80211_chan_def chandef;
1359 struct iwl_mvm_phy_ctxt *phy_ctxt;
1360 int ret, i;
1361
1362 IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value,
1363 duration, type);
1364
1365 if (vif->type != NL80211_IFTYPE_P2P_DEVICE) {
1366 IWL_ERR(mvm, "vif isn't a P2P_DEVICE: %d\n", vif->type);
1367 return -EINVAL;
1368 }
1369
1370 mutex_lock(&mvm->mutex);
1371
1372 for (i = 0; i < NUM_PHY_CTX; i++) {
1373 phy_ctxt = &mvm->phy_ctxts[i];
1374 if (phy_ctxt->ref == 0 || mvmvif->phy_ctxt == phy_ctxt)
1375 continue;
1376
1377 if (phy_ctxt->ref && channel == phy_ctxt->channel) {
1378 /*
1379 * Unbind the P2P_DEVICE from the current PHY context,
1380 * and if the PHY context is not used remove it.
1381 */
1382 ret = iwl_mvm_binding_remove_vif(mvm, vif);
1383 if (WARN(ret, "Failed unbinding P2P_DEVICE\n"))
1384 goto out_unlock;
1385
1386 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt);
1387
1388 /* Bind the P2P_DEVICE to the current PHY Context */
1389 mvmvif->phy_ctxt = phy_ctxt;
1390
1391 ret = iwl_mvm_binding_add_vif(mvm, vif);
1392 if (WARN(ret, "Failed binding P2P_DEVICE\n"))
1393 goto out_unlock;
1394
1395 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt);
1396 goto schedule_time_event;
1397 }
1398 }
1399
1400 /* Need to update the PHY context only if the ROC channel changed */
1401 if (channel == mvmvif->phy_ctxt->channel)
1402 goto schedule_time_event;
1403
1404 cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT);
1405
1406 /*
1407 * Change the PHY context configuration as it is currently referenced
1408 * only by the P2P Device MAC
1409 */
1410 if (mvmvif->phy_ctxt->ref == 1) {
1411 ret = iwl_mvm_phy_ctxt_changed(mvm, mvmvif->phy_ctxt,
1412 &chandef, 1, 1);
1413 if (ret)
1414 goto out_unlock;
1415 } else {
1416 /*
1417 * The PHY context is shared with other MACs. Need to remove the
1418 * P2P Device from the binding, allocate an new PHY context and
1419 * create a new binding
1420 */
1421 phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm);
1422 if (!phy_ctxt) {
1423 ret = -ENOSPC;
1424 goto out_unlock;
1425 }
1426
1427 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &chandef,
1428 1, 1);
1429 if (ret) {
1430 IWL_ERR(mvm, "Failed to change PHY context\n");
1431 goto out_unlock;
1432 }
1433
1434 /* Unbind the P2P_DEVICE from the current PHY context */
1435 ret = iwl_mvm_binding_remove_vif(mvm, vif);
1436 if (WARN(ret, "Failed unbinding P2P_DEVICE\n"))
1437 goto out_unlock;
1438
1439 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt);
1440
1441 /* Bind the P2P_DEVICE to the new allocated PHY context */
1442 mvmvif->phy_ctxt = phy_ctxt;
1443
1444 ret = iwl_mvm_binding_add_vif(mvm, vif);
1445 if (WARN(ret, "Failed binding P2P_DEVICE\n"))
1446 goto out_unlock;
1447
1448 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt);
1449 }
1450
1451 schedule_time_event:
1452 /* Schedule the time events */
1453 ret = iwl_mvm_start_p2p_roc(mvm, vif, duration, type);
1454
1455 out_unlock:
1456 mutex_unlock(&mvm->mutex);
1457 IWL_DEBUG_MAC80211(mvm, "leave\n");
1458 return ret;
1459 }
1460
1461 static int iwl_mvm_cancel_roc(struct ieee80211_hw *hw)
1462 {
1463 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1464
1465 IWL_DEBUG_MAC80211(mvm, "enter\n");
1466
1467 mutex_lock(&mvm->mutex);
1468 iwl_mvm_stop_p2p_roc(mvm);
1469 mutex_unlock(&mvm->mutex);
1470
1471 IWL_DEBUG_MAC80211(mvm, "leave\n");
1472 return 0;
1473 }
1474
1475 static int iwl_mvm_add_chanctx(struct ieee80211_hw *hw,
1476 struct ieee80211_chanctx_conf *ctx)
1477 {
1478 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1479 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
1480 struct iwl_mvm_phy_ctxt *phy_ctxt;
1481 int ret;
1482
1483 IWL_DEBUG_MAC80211(mvm, "Add channel context\n");
1484
1485 mutex_lock(&mvm->mutex);
1486 phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm);
1487 if (!phy_ctxt) {
1488 ret = -ENOSPC;
1489 goto out;
1490 }
1491
1492 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->def,
1493 ctx->rx_chains_static,
1494 ctx->rx_chains_dynamic);
1495 if (ret) {
1496 IWL_ERR(mvm, "Failed to add PHY context\n");
1497 goto out;
1498 }
1499
1500 iwl_mvm_phy_ctxt_ref(mvm, phy_ctxt);
1501 *phy_ctxt_id = phy_ctxt->id;
1502 out:
1503 mutex_unlock(&mvm->mutex);
1504 return ret;
1505 }
1506
1507 static void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw,
1508 struct ieee80211_chanctx_conf *ctx)
1509 {
1510 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1511 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
1512 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
1513
1514 mutex_lock(&mvm->mutex);
1515 iwl_mvm_phy_ctxt_unref(mvm, phy_ctxt);
1516 mutex_unlock(&mvm->mutex);
1517 }
1518
1519 static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
1520 struct ieee80211_chanctx_conf *ctx,
1521 u32 changed)
1522 {
1523 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1524 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
1525 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
1526
1527 if (WARN_ONCE((phy_ctxt->ref > 1) &&
1528 (changed & ~(IEEE80211_CHANCTX_CHANGE_WIDTH |
1529 IEEE80211_CHANCTX_CHANGE_RX_CHAINS |
1530 IEEE80211_CHANCTX_CHANGE_RADAR)),
1531 "Cannot change PHY. Ref=%d, changed=0x%X\n",
1532 phy_ctxt->ref, changed))
1533 return;
1534
1535 mutex_lock(&mvm->mutex);
1536 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->def,
1537 ctx->rx_chains_static,
1538 ctx->rx_chains_dynamic);
1539 mutex_unlock(&mvm->mutex);
1540 }
1541
1542 static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
1543 struct ieee80211_vif *vif,
1544 struct ieee80211_chanctx_conf *ctx)
1545 {
1546 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1547 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
1548 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
1549 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1550 int ret;
1551
1552 mutex_lock(&mvm->mutex);
1553
1554 mvmvif->phy_ctxt = phy_ctxt;
1555
1556 switch (vif->type) {
1557 case NL80211_IFTYPE_AP:
1558 /*
1559 * The AP binding flow is handled as part of the start_ap flow
1560 * (in bss_info_changed).
1561 */
1562 ret = 0;
1563 goto out_unlock;
1564 case NL80211_IFTYPE_STATION:
1565 case NL80211_IFTYPE_ADHOC:
1566 case NL80211_IFTYPE_MONITOR:
1567 break;
1568 default:
1569 ret = -EINVAL;
1570 goto out_unlock;
1571 }
1572
1573 ret = iwl_mvm_binding_add_vif(mvm, vif);
1574 if (ret)
1575 goto out_unlock;
1576
1577 /*
1578 * Setting the quota at this stage is only required for monitor
1579 * interfaces. For the other types, the bss_info changed flow
1580 * will handle quota settings.
1581 */
1582 if (vif->type == NL80211_IFTYPE_MONITOR) {
1583 mvmvif->monitor_active = true;
1584 ret = iwl_mvm_update_quotas(mvm, vif);
1585 if (ret)
1586 goto out_remove_binding;
1587 }
1588
1589 goto out_unlock;
1590
1591 out_remove_binding:
1592 iwl_mvm_binding_remove_vif(mvm, vif);
1593 out_unlock:
1594 mutex_unlock(&mvm->mutex);
1595 if (ret)
1596 mvmvif->phy_ctxt = NULL;
1597 return ret;
1598 }
1599
1600 static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
1601 struct ieee80211_vif *vif,
1602 struct ieee80211_chanctx_conf *ctx)
1603 {
1604 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1605 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1606
1607 mutex_lock(&mvm->mutex);
1608
1609 iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data);
1610
1611 if (vif->type == NL80211_IFTYPE_AP)
1612 goto out_unlock;
1613
1614 switch (vif->type) {
1615 case NL80211_IFTYPE_MONITOR:
1616 mvmvif->monitor_active = false;
1617 iwl_mvm_update_quotas(mvm, NULL);
1618 break;
1619 default:
1620 break;
1621 }
1622
1623 iwl_mvm_binding_remove_vif(mvm, vif);
1624 out_unlock:
1625 mvmvif->phy_ctxt = NULL;
1626 mutex_unlock(&mvm->mutex);
1627 }
1628
1629 static int iwl_mvm_set_tim(struct ieee80211_hw *hw,
1630 struct ieee80211_sta *sta,
1631 bool set)
1632 {
1633 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1634 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv;
1635
1636 if (!mvm_sta || !mvm_sta->vif) {
1637 IWL_ERR(mvm, "Station is not associated to a vif\n");
1638 return -EINVAL;
1639 }
1640
1641 return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif);
1642 }
1643
1644 #ifdef CONFIG_NL80211_TESTMODE
1645 static const struct nla_policy iwl_mvm_tm_policy[IWL_MVM_TM_ATTR_MAX + 1] = {
1646 [IWL_MVM_TM_ATTR_CMD] = { .type = NLA_U32 },
1647 [IWL_MVM_TM_ATTR_NOA_DURATION] = { .type = NLA_U32 },
1648 [IWL_MVM_TM_ATTR_BEACON_FILTER_STATE] = { .type = NLA_U32 },
1649 };
1650
1651 static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm,
1652 struct ieee80211_vif *vif,
1653 void *data, int len)
1654 {
1655 struct nlattr *tb[IWL_MVM_TM_ATTR_MAX + 1];
1656 int err;
1657 u32 noa_duration;
1658
1659 err = nla_parse(tb, IWL_MVM_TM_ATTR_MAX, data, len, iwl_mvm_tm_policy);
1660 if (err)
1661 return err;
1662
1663 if (!tb[IWL_MVM_TM_ATTR_CMD])
1664 return -EINVAL;
1665
1666 switch (nla_get_u32(tb[IWL_MVM_TM_ATTR_CMD])) {
1667 case IWL_MVM_TM_CMD_SET_NOA:
1668 if (!vif || vif->type != NL80211_IFTYPE_AP || !vif->p2p ||
1669 !vif->bss_conf.enable_beacon ||
1670 !tb[IWL_MVM_TM_ATTR_NOA_DURATION])
1671 return -EINVAL;
1672
1673 noa_duration = nla_get_u32(tb[IWL_MVM_TM_ATTR_NOA_DURATION]);
1674 if (noa_duration >= vif->bss_conf.beacon_int)
1675 return -EINVAL;
1676
1677 mvm->noa_duration = noa_duration;
1678 mvm->noa_vif = vif;
1679
1680 return iwl_mvm_update_quotas(mvm, NULL);
1681 case IWL_MVM_TM_CMD_SET_BEACON_FILTER:
1682 /* must be associated client vif - ignore authorized */
1683 if (!vif || vif->type != NL80211_IFTYPE_STATION ||
1684 !vif->bss_conf.assoc || !vif->bss_conf.dtim_period ||
1685 !tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE])
1686 return -EINVAL;
1687
1688 if (nla_get_u32(tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE]))
1689 return iwl_mvm_enable_beacon_filter(mvm, vif);
1690 return iwl_mvm_disable_beacon_filter(mvm, vif);
1691 }
1692
1693 return -EOPNOTSUPP;
1694 }
1695
1696 static int iwl_mvm_mac_testmode_cmd(struct ieee80211_hw *hw,
1697 struct ieee80211_vif *vif,
1698 void *data, int len)
1699 {
1700 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1701 int err;
1702
1703 mutex_lock(&mvm->mutex);
1704 err = __iwl_mvm_mac_testmode_cmd(mvm, vif, data, len);
1705 mutex_unlock(&mvm->mutex);
1706
1707 return err;
1708 }
1709 #endif
1710
1711 struct ieee80211_ops iwl_mvm_hw_ops = {
1712 .tx = iwl_mvm_mac_tx,
1713 .ampdu_action = iwl_mvm_mac_ampdu_action,
1714 .start = iwl_mvm_mac_start,
1715 .restart_complete = iwl_mvm_mac_restart_complete,
1716 .stop = iwl_mvm_mac_stop,
1717 .add_interface = iwl_mvm_mac_add_interface,
1718 .remove_interface = iwl_mvm_mac_remove_interface,
1719 .config = iwl_mvm_mac_config,
1720 .configure_filter = iwl_mvm_configure_filter,
1721 .bss_info_changed = iwl_mvm_bss_info_changed,
1722 .hw_scan = iwl_mvm_mac_hw_scan,
1723 .cancel_hw_scan = iwl_mvm_mac_cancel_hw_scan,
1724 .sta_state = iwl_mvm_mac_sta_state,
1725 .sta_notify = iwl_mvm_mac_sta_notify,
1726 .allow_buffered_frames = iwl_mvm_mac_allow_buffered_frames,
1727 .set_rts_threshold = iwl_mvm_mac_set_rts_threshold,
1728 .conf_tx = iwl_mvm_mac_conf_tx,
1729 .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx,
1730 .sched_scan_start = iwl_mvm_mac_sched_scan_start,
1731 .sched_scan_stop = iwl_mvm_mac_sched_scan_stop,
1732 .set_key = iwl_mvm_mac_set_key,
1733 .update_tkip_key = iwl_mvm_mac_update_tkip_key,
1734 .remain_on_channel = iwl_mvm_roc,
1735 .cancel_remain_on_channel = iwl_mvm_cancel_roc,
1736 .add_chanctx = iwl_mvm_add_chanctx,
1737 .remove_chanctx = iwl_mvm_remove_chanctx,
1738 .change_chanctx = iwl_mvm_change_chanctx,
1739 .assign_vif_chanctx = iwl_mvm_assign_vif_chanctx,
1740 .unassign_vif_chanctx = iwl_mvm_unassign_vif_chanctx,
1741
1742 .start_ap = iwl_mvm_start_ap,
1743 .stop_ap = iwl_mvm_stop_ap,
1744
1745 .set_tim = iwl_mvm_set_tim,
1746
1747 CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd)
1748
1749 #ifdef CONFIG_PM_SLEEP
1750 /* look at d3.c */
1751 .suspend = iwl_mvm_suspend,
1752 .resume = iwl_mvm_resume,
1753 .set_wakeup = iwl_mvm_set_wakeup,
1754 .set_rekey_data = iwl_mvm_set_rekey_data,
1755 #if IS_ENABLED(CONFIG_IPV6)
1756 .ipv6_addr_change = iwl_mvm_ipv6_addr_change,
1757 #endif
1758 .set_default_unicast_key = iwl_mvm_set_default_unicast_key,
1759 #endif
1760 };
This page took 0.070731 seconds and 5 git commands to generate.