blob: c13559b4b4fd8aa2cb2361578500d4fe7f9f166c [file] [log] [blame]
Johannes Berg8ca151b2013-01-24 14:25:36 +01001/******************************************************************************
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
Emmanuel Grumbach410dc5a2013-02-18 09:22:28 +020025 * in the file called COPYING.
Johannes Berg8ca151b2013-01-24 14:25:36 +010026 *
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>
Johannes Bergf0c26462013-01-22 20:41:58 +010068#include <linux/ip.h>
Johannes Berg8ca151b2013-01-24 14:25:36 +010069#include <net/mac80211.h>
Johannes Bergf0c26462013-01-22 20:41:58 +010070#include <net/tcp.h>
Johannes Berg8ca151b2013-01-24 14:25:36 +010071
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
81static const struct ieee80211_iface_limit iwl_mvm_limits[] = {
82 {
83 .max = 1,
84 .types = BIT(NL80211_IFTYPE_STATION) |
85 BIT(NL80211_IFTYPE_AP),
86 },
Johannes Berg8ca151b2013-01-24 14:25:36 +010087};
88
89static const struct ieee80211_iface_combination iwl_mvm_iface_combinations[] = {
90 {
91 .num_different_channels = 1,
92 .max_interfaces = 3,
93 .limits = iwl_mvm_limits,
94 .n_limits = ARRAY_SIZE(iwl_mvm_limits),
95 },
96};
97
Johannes Bergf0c26462013-01-22 20:41:58 +010098#ifdef CONFIG_PM_SLEEP
99static const struct nl80211_wowlan_tcp_data_token_feature
100iwl_mvm_wowlan_tcp_token_feature = {
101 .min_len = 0,
102 .max_len = 255,
103 .bufsize = IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS,
104};
105
106static const struct wiphy_wowlan_tcp_support iwl_mvm_wowlan_tcp_support = {
107 .tok = &iwl_mvm_wowlan_tcp_token_feature,
108 .data_payload_max = IWL_WOWLAN_TCP_MAX_PACKET_LEN -
109 sizeof(struct ethhdr) -
110 sizeof(struct iphdr) -
111 sizeof(struct tcphdr),
112 .data_interval_max = 65535, /* __le16 in API */
113 .wake_payload_max = IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN -
114 sizeof(struct ethhdr) -
115 sizeof(struct iphdr) -
116 sizeof(struct tcphdr),
117 .seq = true,
118};
119#endif
120
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200121static void iwl_mvm_reset_phy_ctxts(struct iwl_mvm *mvm)
122{
123 int i;
124
125 memset(mvm->phy_ctxts, 0, sizeof(mvm->phy_ctxts));
126 for (i = 0; i < NUM_PHY_CTX; i++) {
127 mvm->phy_ctxts[i].id = i;
128 mvm->phy_ctxts[i].ref = 0;
129 }
130}
131
Johannes Berg8ca151b2013-01-24 14:25:36 +0100132int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
133{
134 struct ieee80211_hw *hw = mvm->hw;
Ilan Peer831e85f2013-02-07 17:09:09 +0200135 int num_mac, ret, i;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100136
137 /* Tell mac80211 our characteristics */
138 hw->flags = IEEE80211_HW_SIGNAL_DBM |
139 IEEE80211_HW_SPECTRUM_MGMT |
140 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
141 IEEE80211_HW_QUEUE_CONTROL |
142 IEEE80211_HW_WANT_MONITOR_VIF |
Johannes Berg8ca151b2013-01-24 14:25:36 +0100143 IEEE80211_HW_SUPPORTS_PS |
144 IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
Johannes Bergd2931bb2013-02-05 18:10:04 +0100145 IEEE80211_HW_AMPDU_AGGREGATION |
Hila Gonend64048e2013-03-13 18:00:03 +0200146 IEEE80211_HW_TIMING_BEACON_ONLY |
147 IEEE80211_HW_CONNECTION_MONITOR;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100148
Ilan Peer398e8c62013-03-13 15:20:35 +0200149 hw->queues = IWL_MVM_FIRST_AGG_QUEUE;
150 hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100151 hw->rate_control_algorithm = "iwl-mvm-rs";
152
153 /*
154 * Enable 11w if advertised by firmware and software crypto
155 * is not enabled (as the firmware will interpret some mgmt
156 * packets, so enabling it with software crypto isn't safe)
157 */
158 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP &&
159 !iwlwifi_mod_params.sw_crypto)
160 hw->flags |= IEEE80211_HW_MFP_CAPABLE;
161
162 hw->sta_data_size = sizeof(struct iwl_mvm_sta);
163 hw->vif_data_size = sizeof(struct iwl_mvm_vif);
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200164 hw->chanctx_data_size = sizeof(u16);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100165
166 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Johannes Bergeebfc932013-05-23 22:17:50 +0200167 BIT(NL80211_IFTYPE_AP);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100168
169 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
170 WIPHY_FLAG_DISABLE_BEACON_HINTS |
171 WIPHY_FLAG_IBSS_RSN;
172
173 hw->wiphy->iface_combinations = iwl_mvm_iface_combinations;
174 hw->wiphy->n_iface_combinations =
175 ARRAY_SIZE(iwl_mvm_iface_combinations);
176
Ilan Peerc451e6d2013-02-20 08:41:54 +0200177 hw->wiphy->max_remain_on_channel_duration = 10000;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100178 hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
179
180 /* Extract MAC address */
181 memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN);
182 hw->wiphy->addresses = mvm->addresses;
183 hw->wiphy->n_addresses = 1;
Ilan Peer831e85f2013-02-07 17:09:09 +0200184
185 /* Extract additional MAC addresses if available */
186 num_mac = (mvm->nvm_data->n_hw_addrs > 1) ?
187 min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1;
188
189 for (i = 1; i < num_mac; i++) {
190 memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100191 ETH_ALEN);
Ilan Peer831e85f2013-02-07 17:09:09 +0200192 mvm->addresses[i].addr[5]++;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100193 hw->wiphy->n_addresses++;
194 }
195
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200196 iwl_mvm_reset_phy_ctxts(mvm);
197
Johannes Berg8ca151b2013-01-24 14:25:36 +0100198 /* we create the 802.11 header and a max-length SSID element */
199 hw->wiphy->max_scan_ie_len =
200 mvm->fw->ucode_capa.max_probe_length - 24 - 34;
201 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX;
202
203 if (mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels)
204 hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
205 &mvm->nvm_data->bands[IEEE80211_BAND_2GHZ];
206 if (mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels)
207 hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
208 &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ];
209
210 hw->wiphy->hw_version = mvm->trans->hw_id;
211
Alexander Bondarade50652013-04-03 16:28:47 +0300212 if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM)
Johannes Berg8ca151b2013-01-24 14:25:36 +0100213 hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
214 else
215 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
216
217 hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN |
218 NL80211_FEATURE_P2P_GO_OPPPS;
219
220 mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
221
222#ifdef CONFIG_PM_SLEEP
223 if (mvm->fw->img[IWL_UCODE_WOWLAN].sec[0].len &&
224 mvm->trans->ops->d3_suspend &&
225 mvm->trans->ops->d3_resume &&
226 device_can_wakeup(mvm->trans->dev)) {
227 hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
228 WIPHY_WOWLAN_DISCONNECT |
229 WIPHY_WOWLAN_EAP_IDENTITY_REQ |
230 WIPHY_WOWLAN_RFKILL_RELEASE;
231 if (!iwlwifi_mod_params.sw_crypto)
232 hw->wiphy->wowlan.flags |=
233 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
234 WIPHY_WOWLAN_GTK_REKEY_FAILURE |
235 WIPHY_WOWLAN_4WAY_HANDSHAKE;
236
237 hw->wiphy->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS;
238 hw->wiphy->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN;
239 hw->wiphy->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN;
Johannes Bergf0c26462013-01-22 20:41:58 +0100240 hw->wiphy->wowlan.tcp = &iwl_mvm_wowlan_tcp_support;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100241 }
242#endif
243
244 ret = iwl_mvm_leds_init(mvm);
245 if (ret)
246 return ret;
247
248 return ieee80211_register_hw(mvm->hw);
249}
250
251static void iwl_mvm_mac_tx(struct ieee80211_hw *hw,
252 struct ieee80211_tx_control *control,
253 struct sk_buff *skb)
254{
255 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
256
Eytan Lifshitz9ee718a2013-05-19 19:14:41 +0300257 if (iwl_mvm_is_radio_killed(mvm)) {
258 IWL_DEBUG_DROP(mvm, "Dropping - RF/CT KILL\n");
Johannes Berg8ca151b2013-01-24 14:25:36 +0100259 goto drop;
260 }
261
Ilan Peer398e8c62013-03-13 15:20:35 +0200262 if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE &&
Johannes Berg8ca151b2013-01-24 14:25:36 +0100263 !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status))
264 goto drop;
265
266 if (control->sta) {
267 if (iwl_mvm_tx_skb(mvm, skb, control->sta))
268 goto drop;
269 return;
270 }
271
272 if (iwl_mvm_tx_skb_non_sta(mvm, skb))
273 goto drop;
274 return;
275 drop:
276 ieee80211_free_txskb(hw, skb);
277}
278
279static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw,
280 struct ieee80211_vif *vif,
281 enum ieee80211_ampdu_mlme_action action,
282 struct ieee80211_sta *sta, u16 tid,
283 u16 *ssn, u8 buf_size)
284{
285 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
286 int ret;
287
288 IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n",
289 sta->addr, tid, action);
290
291 if (!(mvm->nvm_data->sku_cap_11n_enable))
292 return -EACCES;
293
294 mutex_lock(&mvm->mutex);
295
296 switch (action) {
297 case IEEE80211_AMPDU_RX_START:
298 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) {
299 ret = -EINVAL;
300 break;
301 }
302 ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, *ssn, true);
303 break;
304 case IEEE80211_AMPDU_RX_STOP:
305 ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, 0, false);
306 break;
307 case IEEE80211_AMPDU_TX_START:
Emmanuel Grumbach5d158ef2013-02-19 14:39:58 +0200308 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) {
309 ret = -EINVAL;
310 break;
311 }
Johannes Berg8ca151b2013-01-24 14:25:36 +0100312 ret = iwl_mvm_sta_tx_agg_start(mvm, vif, sta, tid, ssn);
313 break;
314 case IEEE80211_AMPDU_TX_STOP_CONT:
Emmanuel Grumbache3d9e7c2013-02-19 16:13:53 +0200315 ret = iwl_mvm_sta_tx_agg_stop(mvm, vif, sta, tid);
316 break;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100317 case IEEE80211_AMPDU_TX_STOP_FLUSH:
318 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
Emmanuel Grumbache3d9e7c2013-02-19 16:13:53 +0200319 ret = iwl_mvm_sta_tx_agg_flush(mvm, vif, sta, tid);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100320 break;
321 case IEEE80211_AMPDU_TX_OPERATIONAL:
322 ret = iwl_mvm_sta_tx_agg_oper(mvm, vif, sta, tid, buf_size);
323 break;
324 default:
325 WARN_ON_ONCE(1);
326 ret = -EINVAL;
327 break;
328 }
329 mutex_unlock(&mvm->mutex);
330
331 return ret;
332}
333
334static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
335 struct ieee80211_vif *vif)
336{
337 struct iwl_mvm *mvm = data;
338 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
339
340 mvmvif->uploaded = false;
341 mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
342
343 /* does this make sense at all? */
344 mvmvif->color++;
345
346 spin_lock_bh(&mvm->time_event_lock);
347 iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data);
348 spin_unlock_bh(&mvm->time_event_lock);
349
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200350 mvmvif->phy_ctxt = NULL;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100351}
352
353static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
354{
355 iwl_trans_stop_device(mvm->trans);
356 iwl_trans_stop_hw(mvm->trans, false);
357
358 mvm->scan_status = IWL_MVM_SCAN_NONE;
359
360 /* just in case one was running */
361 ieee80211_remain_on_channel_expired(mvm->hw);
362
363 ieee80211_iterate_active_interfaces_atomic(
364 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
365 iwl_mvm_cleanup_iterator, mvm);
366
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200367 mvm->p2p_device_vif = NULL;
368
369 iwl_mvm_reset_phy_ctxts(mvm);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100370 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table));
371 memset(mvm->sta_drained, 0, sizeof(mvm->sta_drained));
372
373 ieee80211_wake_queues(mvm->hw);
374
375 mvm->vif_count = 0;
376}
377
378static int iwl_mvm_mac_start(struct ieee80211_hw *hw)
379{
380 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
381 int ret;
382
383 mutex_lock(&mvm->mutex);
384
385 /* Clean up some internal and mac80211 state on restart */
386 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
387 iwl_mvm_restart_cleanup(mvm);
388
389 ret = iwl_mvm_up(mvm);
390 mutex_unlock(&mvm->mutex);
391
392 return ret;
393}
394
395static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw)
396{
397 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
398 int ret;
399
400 mutex_lock(&mvm->mutex);
401
402 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
403 ret = iwl_mvm_update_quotas(mvm, NULL);
404 if (ret)
405 IWL_ERR(mvm, "Failed to update quotas after restart (%d)\n",
406 ret);
407
408 mutex_unlock(&mvm->mutex);
409}
410
411static void iwl_mvm_mac_stop(struct ieee80211_hw *hw)
412{
413 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
414
415 flush_work(&mvm->async_handlers_wk);
416
417 mutex_lock(&mvm->mutex);
418 /* async_handlers_wk is now blocked */
419
420 /*
421 * The work item could be running or queued if the
422 * ROC time event stops just as we get here.
423 */
424 cancel_work_sync(&mvm->roc_done_wk);
425
426 iwl_trans_stop_device(mvm->trans);
427 iwl_trans_stop_hw(mvm->trans, false);
428
429 iwl_mvm_async_handlers_purge(mvm);
430 /* async_handlers_list is empty and will stay empty: HW is stopped */
431
432 /* the fw is stopped, the aux sta is dead: clean up driver state */
433 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta);
434
435 mutex_unlock(&mvm->mutex);
436
437 /*
438 * The worker might have been waiting for the mutex, let it run and
439 * discover that its list is now empty.
440 */
441 cancel_work_sync(&mvm->async_handlers_wk);
442}
443
444static void iwl_mvm_pm_disable_iterator(void *data, u8 *mac,
445 struct ieee80211_vif *vif)
446{
447 struct iwl_mvm *mvm = data;
448 int ret;
449
450 ret = iwl_mvm_power_disable(mvm, vif);
451 if (ret)
452 IWL_ERR(mvm, "failed to disable power management\n");
453}
454
455static void iwl_mvm_power_update_iterator(void *data, u8 *mac,
456 struct ieee80211_vif *vif)
457{
458 struct iwl_mvm *mvm = data;
459
460 iwl_mvm_power_update_mode(mvm, vif);
461}
462
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200463static struct iwl_mvm_phy_ctxt *iwl_mvm_get_free_phy_ctxt(struct iwl_mvm *mvm)
464{
465 u16 i;
466
467 lockdep_assert_held(&mvm->mutex);
468
469 for (i = 0; i < NUM_PHY_CTX; i++)
470 if (!mvm->phy_ctxts[i].ref)
471 return &mvm->phy_ctxts[i];
472
473 IWL_ERR(mvm, "No available PHY context\n");
474 return NULL;
475}
476
Johannes Berg8ca151b2013-01-24 14:25:36 +0100477static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
478 struct ieee80211_vif *vif)
479{
480 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
481 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
482 int ret;
483
484 /*
485 * Not much to do here. The stack will not allow interface
486 * types or combinations that we didn't advertise, so we
487 * don't really have to check the types.
488 */
489
490 mutex_lock(&mvm->mutex);
491
492 /* Allocate resources for the MAC context, and add it the the fw */
493 ret = iwl_mvm_mac_ctxt_init(mvm, vif);
494 if (ret)
495 goto out_unlock;
496
497 /*
498 * The AP binding flow can be done only after the beacon
499 * template is configured (which happens only in the mac80211
500 * start_ap() flow), and adding the broadcast station can happen
501 * only after the binding.
502 * In addition, since modifying the MAC before adding a bcast
503 * station is not allowed by the FW, delay the adding of MAC context to
504 * the point where we can also add the bcast station.
505 * In short: there's not much we can do at this point, other than
506 * allocating resources :)
507 */
508 if (vif->type == NL80211_IFTYPE_AP) {
509 u32 qmask = iwl_mvm_mac_get_queues_mask(mvm, vif);
510 ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta,
511 qmask);
512 if (ret) {
513 IWL_ERR(mvm, "Failed to allocate bcast sta\n");
514 goto out_release;
515 }
516
517 goto out_unlock;
518 }
519
520 /*
521 * TODO: remove this temporary code.
522 * Currently MVM FW supports power management only on single MAC.
Alexander Bondar5ee2b212013-03-05 10:16:40 +0200523 * If new interface added, disable PM on existing interface.
524 * P2P device is a special case, since it is handled by FW similary to
525 * scan. If P2P deviced is added, PM remains enabled on existing
526 * interface.
Johannes Berg8ca151b2013-01-24 14:25:36 +0100527 * Note: the method below does not count the new interface being added
528 * at this moment.
529 */
Alexander Bondar5ee2b212013-03-05 10:16:40 +0200530 if (vif->type != NL80211_IFTYPE_P2P_DEVICE)
531 mvm->vif_count++;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100532 if (mvm->vif_count > 1) {
533 IWL_DEBUG_MAC80211(mvm,
534 "Disable power on existing interfaces\n");
Emmanuel Grumbach5360cfb2013-02-11 15:56:01 +0200535 ieee80211_iterate_active_interfaces_atomic(
Johannes Berg8ca151b2013-01-24 14:25:36 +0100536 mvm->hw,
537 IEEE80211_IFACE_ITER_NORMAL,
538 iwl_mvm_pm_disable_iterator, mvm);
539 }
540
541 ret = iwl_mvm_mac_ctxt_add(mvm, vif);
542 if (ret)
543 goto out_release;
544
545 /*
546 * Update power state on the new interface. Admittedly, based on
547 * mac80211 logics this power update will disable power management
548 */
549 iwl_mvm_power_update_mode(mvm, vif);
550
Hila Gonen7df15b12012-12-12 11:16:19 +0200551 /* beacon filtering */
552 if (!mvm->bf_allowed_vif &&
553 vif->type == NL80211_IFTYPE_STATION && !vif->p2p){
554 mvm->bf_allowed_vif = mvmvif;
555 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
556 }
557
558 ret = iwl_mvm_disable_beacon_filter(mvm, vif);
559 if (ret)
560 goto out_release;
561
Johannes Berg8ca151b2013-01-24 14:25:36 +0100562 /*
563 * P2P_DEVICE interface does not have a channel context assigned to it,
564 * so a dedicated PHY context is allocated to it and the corresponding
565 * MAC context is bound to it at this stage.
566 */
567 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100568
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200569 mvmvif->phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm);
570 if (!mvmvif->phy_ctxt) {
571 ret = -ENOSPC;
572 goto out_remove_mac;
573 }
Johannes Berg8ca151b2013-01-24 14:25:36 +0100574
Ilan Peer53a9d612013-04-28 11:55:08 +0300575 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100576 ret = iwl_mvm_binding_add_vif(mvm, vif);
577 if (ret)
Ilan Peer53a9d612013-04-28 11:55:08 +0300578 goto out_unref_phy;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100579
580 ret = iwl_mvm_add_bcast_sta(mvm, vif, &mvmvif->bcast_sta);
581 if (ret)
582 goto out_unbind;
583
584 /* Save a pointer to p2p device vif, so it can later be used to
585 * update the p2p device MAC when a GO is started/stopped */
586 mvm->p2p_device_vif = vif;
587 }
588
Johannes Berg63494372013-03-26 10:47:53 +0100589 iwl_mvm_vif_dbgfs_register(mvm, vif);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100590 goto out_unlock;
591
592 out_unbind:
593 iwl_mvm_binding_remove_vif(mvm, vif);
Ilan Peer53a9d612013-04-28 11:55:08 +0300594 out_unref_phy:
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200595 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100596 out_remove_mac:
597 mvmvif->phy_ctxt = NULL;
598 iwl_mvm_mac_ctxt_remove(mvm, vif);
599 out_release:
Alexander Bondar5ee2b212013-03-05 10:16:40 +0200600 if (vif->type != NL80211_IFTYPE_P2P_DEVICE)
601 mvm->vif_count--;
Alexander Bondar4bf881f2013-05-29 10:19:50 +0300602 ieee80211_iterate_active_interfaces(
603 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
604 iwl_mvm_power_update_iterator, mvm);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100605 iwl_mvm_mac_ctxt_release(mvm, vif);
606 out_unlock:
607 mutex_unlock(&mvm->mutex);
608
609 return ret;
610}
611
Johannes Berg38a12b52013-02-22 14:07:56 +0100612static void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm,
613 struct ieee80211_vif *vif)
Johannes Berg8ca151b2013-01-24 14:25:36 +0100614{
Johannes Berg8ca151b2013-01-24 14:25:36 +0100615 u32 tfd_msk = 0, ac;
616
617 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
618 if (vif->hw_queue[ac] != IEEE80211_INVAL_HW_QUEUE)
619 tfd_msk |= BIT(vif->hw_queue[ac]);
620
621 if (vif->cab_queue != IEEE80211_INVAL_HW_QUEUE)
622 tfd_msk |= BIT(vif->cab_queue);
623
624 if (tfd_msk) {
625 mutex_lock(&mvm->mutex);
626 iwl_mvm_flush_tx_path(mvm, tfd_msk, true);
627 mutex_unlock(&mvm->mutex);
628 }
629
630 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
631 /*
632 * Flush the ROC worker which will flush the OFFCHANNEL queue.
633 * We assume here that all the packets sent to the OFFCHANNEL
634 * queue are sent in ROC session.
635 */
636 flush_work(&mvm->roc_done_wk);
637 } else {
638 /*
639 * By now, all the AC queues are empty. The AGG queues are
640 * empty too. We already got all the Tx responses for all the
641 * packets in the queues. The drain work can have been
642 * triggered. Flush it. This work item takes the mutex, so kill
643 * it before we take it.
644 */
645 flush_work(&mvm->sta_drained_wk);
646 }
Johannes Berg38a12b52013-02-22 14:07:56 +0100647}
648
649static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
650 struct ieee80211_vif *vif)
651{
652 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
653 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
654
655 iwl_mvm_prepare_mac_removal(mvm, vif);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100656
657 mutex_lock(&mvm->mutex);
658
Hila Gonen7df15b12012-12-12 11:16:19 +0200659 if (mvm->bf_allowed_vif == mvmvif) {
660 mvm->bf_allowed_vif = NULL;
661 vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER;
662 }
663
Johannes Berg63494372013-03-26 10:47:53 +0100664 iwl_mvm_vif_dbgfs_clean(mvm, vif);
665
Johannes Berg8ca151b2013-01-24 14:25:36 +0100666 /*
667 * For AP/GO interface, the tear down of the resources allocated to the
Johannes Berg38a12b52013-02-22 14:07:56 +0100668 * interface is be handled as part of the stop_ap flow.
Johannes Berg8ca151b2013-01-24 14:25:36 +0100669 */
670 if (vif->type == NL80211_IFTYPE_AP) {
671 iwl_mvm_dealloc_int_sta(mvm, &mvmvif->bcast_sta);
672 goto out_release;
673 }
674
675 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
676 mvm->p2p_device_vif = NULL;
677 iwl_mvm_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
678 iwl_mvm_binding_remove_vif(mvm, vif);
Ilan Peerfe0f2de2013-03-21 10:23:52 +0200679 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100680 mvmvif->phy_ctxt = NULL;
681 }
682
683 /*
684 * TODO: remove this temporary code.
685 * Currently MVM FW supports power management only on single MAC.
686 * Check if only one additional interface remains after removing
687 * current one. Update power mode on the remaining interface.
688 */
Alexander Bondar5ee2b212013-03-05 10:16:40 +0200689 if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE)
Johannes Berg8ca151b2013-01-24 14:25:36 +0100690 mvm->vif_count--;
691 IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n",
692 mvm->vif_count);
693 if (mvm->vif_count == 1) {
694 ieee80211_iterate_active_interfaces(
695 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
696 iwl_mvm_power_update_iterator, mvm);
697 }
698
699 iwl_mvm_mac_ctxt_remove(mvm, vif);
700
701out_release:
702 iwl_mvm_mac_ctxt_release(mvm, vif);
703 mutex_unlock(&mvm->mutex);
704}
705
706static int iwl_mvm_mac_config(struct ieee80211_hw *hw, u32 changed)
707{
708 return 0;
709}
710
711static void iwl_mvm_configure_filter(struct ieee80211_hw *hw,
712 unsigned int changed_flags,
713 unsigned int *total_flags,
714 u64 multicast)
715{
716 *total_flags = 0;
717}
718
Emmanuel Grumbach51b6b9e2013-05-02 15:01:24 +0300719static int iwl_mvm_configure_mcast_filter(struct iwl_mvm *mvm,
720 struct ieee80211_vif *vif)
721{
722 struct iwl_mcast_filter_cmd mcast_filter_cmd = {
723 .pass_all = 1,
724 };
725
726 memcpy(mcast_filter_cmd.bssid, vif->bss_conf.bssid, ETH_ALEN);
727
728 return iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC,
729 sizeof(mcast_filter_cmd),
730 &mcast_filter_cmd);
731}
732
Johannes Berg8ca151b2013-01-24 14:25:36 +0100733static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
734 struct ieee80211_vif *vif,
735 struct ieee80211_bss_conf *bss_conf,
736 u32 changes)
737{
738 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
739 int ret;
740
741 ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
742 if (ret)
743 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);
744
745 if (changes & BSS_CHANGED_ASSOC) {
746 if (bss_conf->assoc) {
747 /* add quota for this interface */
748 ret = iwl_mvm_update_quotas(mvm, vif);
749 if (ret) {
750 IWL_ERR(mvm, "failed to update quotas\n");
751 return;
752 }
Emmanuel Grumbach9166b1e2013-03-20 15:28:27 +0200753 iwl_mvm_bt_coex_vif_assoc(mvm, vif);
Emmanuel Grumbach51b6b9e2013-05-02 15:01:24 +0300754 iwl_mvm_configure_mcast_filter(mvm, vif);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100755 } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
756 /* remove AP station now that the MAC is unassoc */
757 ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id);
758 if (ret)
759 IWL_ERR(mvm, "failed to remove AP station\n");
760 mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
761 /* remove quota for this interface */
762 ret = iwl_mvm_update_quotas(mvm, NULL);
763 if (ret)
764 IWL_ERR(mvm, "failed to update quotas\n");
765 }
Johannes Berg210a5442013-01-24 23:48:23 +0100766 } else if (changes & BSS_CHANGED_DTIM_PERIOD) {
767 /*
768 * We received a beacon _after_ association so
769 * remove the session protection.
770 */
771 iwl_mvm_remove_time_event(mvm, mvmvif,
772 &mvmvif->time_event_data);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100773 } else if (changes & BSS_CHANGED_PS) {
Alexander Bondar4bf881f2013-05-29 10:19:50 +0300774 ret = iwl_mvm_power_update_mode(mvm, vif);
775 if (ret)
776 IWL_ERR(mvm, "failed to update power mode\n");
Johannes Berg8ca151b2013-01-24 14:25:36 +0100777 }
778}
779
780static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
781{
782 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
783 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
784 int ret;
785
786 mutex_lock(&mvm->mutex);
787
788 /* Send the beacon template */
789 ret = iwl_mvm_mac_ctxt_beacon_changed(mvm, vif);
790 if (ret)
791 goto out_unlock;
792
793 /* Add the mac context */
794 ret = iwl_mvm_mac_ctxt_add(mvm, vif);
795 if (ret)
796 goto out_unlock;
797
798 /* Perform the binding */
799 ret = iwl_mvm_binding_add_vif(mvm, vif);
800 if (ret)
801 goto out_remove;
802
803 mvmvif->ap_active = true;
804
805 /* Send the bcast station. At this stage the TBTT and DTIM time events
806 * are added and applied to the scheduler */
807 ret = iwl_mvm_send_bcast_sta(mvm, vif, &mvmvif->bcast_sta);
808 if (ret)
809 goto out_unbind;
810
811 ret = iwl_mvm_update_quotas(mvm, vif);
812 if (ret)
813 goto out_rm_bcast;
814
815 /* Need to update the P2P Device MAC */
816 if (vif->p2p && mvm->p2p_device_vif)
817 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
818
819 mutex_unlock(&mvm->mutex);
820 return 0;
821
822out_rm_bcast:
823 iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
824out_unbind:
825 iwl_mvm_binding_remove_vif(mvm, vif);
826out_remove:
827 iwl_mvm_mac_ctxt_remove(mvm, vif);
828out_unlock:
829 mutex_unlock(&mvm->mutex);
830 return ret;
831}
832
833static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
834{
835 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
836 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
837
Johannes Berg38a12b52013-02-22 14:07:56 +0100838 iwl_mvm_prepare_mac_removal(mvm, vif);
839
Johannes Berg8ca151b2013-01-24 14:25:36 +0100840 mutex_lock(&mvm->mutex);
841
842 mvmvif->ap_active = false;
843
844 /* Need to update the P2P Device MAC */
845 if (vif->p2p && mvm->p2p_device_vif)
846 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
847
848 iwl_mvm_update_quotas(mvm, NULL);
849 iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
850 iwl_mvm_binding_remove_vif(mvm, vif);
851 iwl_mvm_mac_ctxt_remove(mvm, vif);
852
853 mutex_unlock(&mvm->mutex);
854}
855
856static void iwl_mvm_bss_info_changed_ap(struct iwl_mvm *mvm,
857 struct ieee80211_vif *vif,
858 struct ieee80211_bss_conf *bss_conf,
859 u32 changes)
860{
861 /* Need to send a new beacon template to the FW */
862 if (changes & BSS_CHANGED_BEACON) {
863 if (iwl_mvm_mac_ctxt_beacon_changed(mvm, vif))
864 IWL_WARN(mvm, "Failed updating beacon data\n");
865 }
866}
867
868static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
869 struct ieee80211_vif *vif,
870 struct ieee80211_bss_conf *bss_conf,
871 u32 changes)
872{
873 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
874
875 mutex_lock(&mvm->mutex);
876
877 switch (vif->type) {
878 case NL80211_IFTYPE_STATION:
879 iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes);
880 break;
881 case NL80211_IFTYPE_AP:
882 iwl_mvm_bss_info_changed_ap(mvm, vif, bss_conf, changes);
883 break;
884 default:
885 /* shouldn't happen */
886 WARN_ON_ONCE(1);
887 }
888
889 mutex_unlock(&mvm->mutex);
890}
891
892static int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw,
893 struct ieee80211_vif *vif,
894 struct cfg80211_scan_request *req)
895{
896 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
897 int ret;
898
899 if (req->n_channels == 0 || req->n_channels > MAX_NUM_SCAN_CHANNELS)
900 return -EINVAL;
901
902 mutex_lock(&mvm->mutex);
903
904 if (mvm->scan_status == IWL_MVM_SCAN_NONE)
905 ret = iwl_mvm_scan_request(mvm, vif, req);
906 else
907 ret = -EBUSY;
908
909 mutex_unlock(&mvm->mutex);
910
911 return ret;
912}
913
914static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw,
915 struct ieee80211_vif *vif)
916{
917 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
918
919 mutex_lock(&mvm->mutex);
920
921 iwl_mvm_cancel_scan(mvm);
922
923 mutex_unlock(&mvm->mutex);
924}
925
926static void
927iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw,
928 struct ieee80211_sta *sta, u16 tid,
929 int num_frames,
930 enum ieee80211_frame_release_type reason,
931 bool more_data)
932{
933 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100934
935 /* TODO: how do we tell the fw to send frames for a specific TID */
936
937 /*
938 * The fw will send EOSP notification when the last frame will be
939 * transmitted.
940 */
Johannes Berg9cc40712013-02-15 22:47:48 +0100941 iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100942}
943
944static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
945 struct ieee80211_vif *vif,
946 enum sta_notify_cmd cmd,
947 struct ieee80211_sta *sta)
948{
949 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
950 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
951
952 switch (cmd) {
953 case STA_NOTIFY_SLEEP:
Emmanuel Grumbache3d4bc82013-05-07 14:08:24 +0300954 if (atomic_read(&mvm->pending_frames[mvmsta->sta_id]) > 0)
Johannes Berg8ca151b2013-01-24 14:25:36 +0100955 ieee80211_sta_block_awake(hw, sta, true);
956 /*
957 * The fw updates the STA to be asleep. Tx packets on the Tx
958 * queues to this station will not be transmitted. The fw will
959 * send a Tx response with TX_STATUS_FAIL_DEST_PS.
960 */
961 break;
962 case STA_NOTIFY_AWAKE:
Emmanuel Grumbach881acd82013-03-19 16:16:00 +0200963 if (WARN_ON(mvmsta->sta_id == IWL_MVM_STATION_COUNT))
Johannes Berg8ca151b2013-01-24 14:25:36 +0100964 break;
Johannes Berg9cc40712013-02-15 22:47:48 +0100965 iwl_mvm_sta_modify_ps_wake(mvm, sta);
Johannes Berg8ca151b2013-01-24 14:25:36 +0100966 break;
967 default:
968 break;
969 }
970}
971
972static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
973 struct ieee80211_vif *vif,
974 struct ieee80211_sta *sta,
975 enum ieee80211_sta_state old_state,
976 enum ieee80211_sta_state new_state)
977{
978 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
979 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
980 int ret;
981
982 IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n",
983 sta->addr, old_state, new_state);
984
985 /* this would be a mac80211 bug ... but don't crash */
986 if (WARN_ON_ONCE(!mvmvif->phy_ctxt))
987 return -EINVAL;
988
989 /* if a STA is being removed, reuse its ID */
990 flush_work(&mvm->sta_drained_wk);
991
992 mutex_lock(&mvm->mutex);
993 if (old_state == IEEE80211_STA_NOTEXIST &&
994 new_state == IEEE80211_STA_NONE) {
995 ret = iwl_mvm_add_sta(mvm, vif, sta);
996 } else if (old_state == IEEE80211_STA_NONE &&
997 new_state == IEEE80211_STA_AUTH) {
998 ret = 0;
999 } else if (old_state == IEEE80211_STA_AUTH &&
1000 new_state == IEEE80211_STA_ASSOC) {
Johannes Berg7a453972013-02-12 13:10:44 +01001001 ret = iwl_mvm_update_sta(mvm, vif, sta);
1002 if (ret == 0)
1003 iwl_mvm_rs_rate_init(mvm, sta,
1004 mvmvif->phy_ctxt->channel->band);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001005 } else if (old_state == IEEE80211_STA_ASSOC &&
1006 new_state == IEEE80211_STA_AUTHORIZED) {
Hila Gonen7df15b12012-12-12 11:16:19 +02001007 /* enable beacon filtering */
1008 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif));
Johannes Berg8ca151b2013-01-24 14:25:36 +01001009 ret = 0;
1010 } else if (old_state == IEEE80211_STA_AUTHORIZED &&
1011 new_state == IEEE80211_STA_ASSOC) {
Hila Gonen7df15b12012-12-12 11:16:19 +02001012 /* disable beacon filtering */
1013 WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif));
Johannes Berg8ca151b2013-01-24 14:25:36 +01001014 ret = 0;
1015 } else if (old_state == IEEE80211_STA_ASSOC &&
1016 new_state == IEEE80211_STA_AUTH) {
1017 ret = 0;
1018 } else if (old_state == IEEE80211_STA_AUTH &&
1019 new_state == IEEE80211_STA_NONE) {
1020 ret = 0;
1021 } else if (old_state == IEEE80211_STA_NONE &&
1022 new_state == IEEE80211_STA_NOTEXIST) {
1023 ret = iwl_mvm_rm_sta(mvm, vif, sta);
1024 } else {
1025 ret = -EIO;
1026 }
1027 mutex_unlock(&mvm->mutex);
1028
1029 return ret;
1030}
1031
1032static int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
1033{
1034 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1035
1036 mvm->rts_threshold = value;
1037
1038 return 0;
1039}
1040
1041static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw,
1042 struct ieee80211_vif *vif, u16 ac,
1043 const struct ieee80211_tx_queue_params *params)
1044{
1045 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1046 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1047
1048 mvmvif->queue_params[ac] = *params;
1049
1050 /*
1051 * No need to update right away, we'll get BSS_CHANGED_QOS
1052 * The exception is P2P_DEVICE interface which needs immediate update.
1053 */
1054 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
1055 int ret;
1056
1057 mutex_lock(&mvm->mutex);
1058 ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
1059 mutex_unlock(&mvm->mutex);
1060 return ret;
1061 }
1062 return 0;
1063}
1064
1065static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
1066 struct ieee80211_vif *vif)
1067{
1068 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1069 u32 duration = min(IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS,
1070 200 + vif->bss_conf.beacon_int);
1071 u32 min_duration = min(IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS,
1072 100 + vif->bss_conf.beacon_int);
1073
1074 if (WARN_ON_ONCE(vif->bss_conf.assoc))
1075 return;
1076
1077 mutex_lock(&mvm->mutex);
1078 /* Try really hard to protect the session and hear a beacon */
1079 iwl_mvm_protect_session(mvm, vif, duration, min_duration);
1080 mutex_unlock(&mvm->mutex);
1081}
1082
1083static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
1084 enum set_key_cmd cmd,
1085 struct ieee80211_vif *vif,
1086 struct ieee80211_sta *sta,
1087 struct ieee80211_key_conf *key)
1088{
1089 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1090 int ret;
1091
1092 if (iwlwifi_mod_params.sw_crypto) {
1093 IWL_DEBUG_MAC80211(mvm, "leave - hwcrypto disabled\n");
1094 return -EOPNOTSUPP;
1095 }
1096
1097 switch (key->cipher) {
1098 case WLAN_CIPHER_SUITE_TKIP:
1099 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
1100 /* fall-through */
1101 case WLAN_CIPHER_SUITE_CCMP:
1102 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
1103 break;
1104 case WLAN_CIPHER_SUITE_AES_CMAC:
1105 WARN_ON_ONCE(!(hw->flags & IEEE80211_HW_MFP_CAPABLE));
1106 break;
1107 case WLAN_CIPHER_SUITE_WEP40:
1108 case WLAN_CIPHER_SUITE_WEP104:
1109 /*
1110 * Support for TX only, at least for now, so accept
1111 * the key and do nothing else. Then mac80211 will
1112 * pass it for TX but we don't have to use it for RX.
1113 */
1114 return 0;
1115 default:
1116 return -EOPNOTSUPP;
1117 }
1118
1119 mutex_lock(&mvm->mutex);
1120
1121 switch (cmd) {
1122 case SET_KEY:
Johannes Berg6caffd42013-03-06 13:15:21 +01001123 if (vif->type == NL80211_IFTYPE_AP && !sta) {
1124 /* GTK on AP interface is a TX-only key, return 0 */
1125 ret = 0;
1126 key->hw_key_idx = STA_KEY_IDX_INVALID;
1127 break;
1128 }
1129
Johannes Berg8ca151b2013-01-24 14:25:36 +01001130 IWL_DEBUG_MAC80211(mvm, "set hwcrypto key\n");
1131 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, false);
1132 if (ret) {
1133 IWL_WARN(mvm, "set key failed\n");
1134 /*
1135 * can't add key for RX, but we don't need it
1136 * in the device for TX so still return 0
1137 */
Johannes Berg6caffd42013-03-06 13:15:21 +01001138 key->hw_key_idx = STA_KEY_IDX_INVALID;
Johannes Berg8ca151b2013-01-24 14:25:36 +01001139 ret = 0;
1140 }
1141
1142 break;
1143 case DISABLE_KEY:
Johannes Berg6caffd42013-03-06 13:15:21 +01001144 if (key->hw_key_idx == STA_KEY_IDX_INVALID) {
1145 ret = 0;
1146 break;
1147 }
1148
Johannes Berg8ca151b2013-01-24 14:25:36 +01001149 IWL_DEBUG_MAC80211(mvm, "disable hwcrypto key\n");
1150 ret = iwl_mvm_remove_sta_key(mvm, vif, sta, key);
1151 break;
1152 default:
1153 ret = -EINVAL;
1154 }
1155
1156 mutex_unlock(&mvm->mutex);
1157 return ret;
1158}
1159
1160static void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw,
1161 struct ieee80211_vif *vif,
1162 struct ieee80211_key_conf *keyconf,
1163 struct ieee80211_sta *sta,
1164 u32 iv32, u16 *phase1key)
1165{
1166 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1167
1168 iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key);
1169}
1170
1171
1172static int iwl_mvm_roc(struct ieee80211_hw *hw,
1173 struct ieee80211_vif *vif,
1174 struct ieee80211_channel *channel,
Ilan Peerd339d5c2013-02-12 09:34:13 +02001175 int duration,
1176 enum ieee80211_roc_type type)
Johannes Berg8ca151b2013-01-24 14:25:36 +01001177{
1178 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001179 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001180 struct cfg80211_chan_def chandef;
Ilan Peer31d385a2013-04-02 10:25:46 +03001181 struct iwl_mvm_phy_ctxt *phy_ctxt;
1182 int ret, i;
1183
1184 IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value,
1185 duration, type);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001186
1187 if (vif->type != NL80211_IFTYPE_P2P_DEVICE) {
1188 IWL_ERR(mvm, "vif isn't a P2P_DEVICE: %d\n", vif->type);
1189 return -EINVAL;
1190 }
1191
Johannes Berg8ca151b2013-01-24 14:25:36 +01001192 mutex_lock(&mvm->mutex);
1193
Ilan Peer31d385a2013-04-02 10:25:46 +03001194 for (i = 0; i < NUM_PHY_CTX; i++) {
1195 phy_ctxt = &mvm->phy_ctxts[i];
1196 if (phy_ctxt->ref == 0 || mvmvif->phy_ctxt == phy_ctxt)
1197 continue;
Johannes Berg8ca151b2013-01-24 14:25:36 +01001198
Ilan Peer31d385a2013-04-02 10:25:46 +03001199 if (phy_ctxt->ref && channel == phy_ctxt->channel) {
1200 /*
1201 * Unbind the P2P_DEVICE from the current PHY context,
1202 * and if the PHY context is not used remove it.
1203 */
1204 ret = iwl_mvm_binding_remove_vif(mvm, vif);
1205 if (WARN(ret, "Failed unbinding P2P_DEVICE\n"))
1206 goto out_unlock;
1207
1208 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt);
1209
1210 /* Bind the P2P_DEVICE to the current PHY Context */
1211 mvmvif->phy_ctxt = phy_ctxt;
1212
1213 ret = iwl_mvm_binding_add_vif(mvm, vif);
1214 if (WARN(ret, "Failed binding P2P_DEVICE\n"))
1215 goto out_unlock;
1216
1217 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt);
1218 goto schedule_time_event;
1219 }
1220 }
1221
1222 /* Need to update the PHY context only if the ROC channel changed */
1223 if (channel == mvmvif->phy_ctxt->channel)
1224 goto schedule_time_event;
1225
1226 cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT);
1227
1228 /*
1229 * Change the PHY context configuration as it is currently referenced
1230 * only by the P2P Device MAC
1231 */
1232 if (mvmvif->phy_ctxt->ref == 1) {
1233 ret = iwl_mvm_phy_ctxt_changed(mvm, mvmvif->phy_ctxt,
1234 &chandef, 1, 1);
1235 if (ret)
1236 goto out_unlock;
1237 } else {
1238 /*
1239 * The PHY context is shared with other MACs. Need to remove the
1240 * P2P Device from the binding, allocate an new PHY context and
1241 * create a new binding
1242 */
1243 phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm);
1244 if (!phy_ctxt) {
1245 ret = -ENOSPC;
1246 goto out_unlock;
1247 }
1248
1249 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &chandef,
1250 1, 1);
1251 if (ret) {
1252 IWL_ERR(mvm, "Failed to change PHY context\n");
1253 goto out_unlock;
1254 }
1255
1256 /* Unbind the P2P_DEVICE from the current PHY context */
1257 ret = iwl_mvm_binding_remove_vif(mvm, vif);
1258 if (WARN(ret, "Failed unbinding P2P_DEVICE\n"))
1259 goto out_unlock;
1260
1261 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt);
1262
1263 /* Bind the P2P_DEVICE to the new allocated PHY context */
1264 mvmvif->phy_ctxt = phy_ctxt;
1265
1266 ret = iwl_mvm_binding_add_vif(mvm, vif);
1267 if (WARN(ret, "Failed binding P2P_DEVICE\n"))
1268 goto out_unlock;
1269
1270 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt);
1271 }
1272
1273schedule_time_event:
Johannes Berg8ca151b2013-01-24 14:25:36 +01001274 /* Schedule the time events */
Ilan Peere635c792013-02-13 11:05:18 +02001275 ret = iwl_mvm_start_p2p_roc(mvm, vif, duration, type);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001276
Ilan Peer31d385a2013-04-02 10:25:46 +03001277out_unlock:
Johannes Berg8ca151b2013-01-24 14:25:36 +01001278 mutex_unlock(&mvm->mutex);
1279 IWL_DEBUG_MAC80211(mvm, "leave\n");
Johannes Berg8ca151b2013-01-24 14:25:36 +01001280 return ret;
1281}
1282
1283static int iwl_mvm_cancel_roc(struct ieee80211_hw *hw)
1284{
1285 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1286
1287 IWL_DEBUG_MAC80211(mvm, "enter\n");
1288
1289 mutex_lock(&mvm->mutex);
1290 iwl_mvm_stop_p2p_roc(mvm);
1291 mutex_unlock(&mvm->mutex);
1292
1293 IWL_DEBUG_MAC80211(mvm, "leave\n");
1294 return 0;
1295}
1296
1297static int iwl_mvm_add_chanctx(struct ieee80211_hw *hw,
1298 struct ieee80211_chanctx_conf *ctx)
1299{
1300 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001301 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
1302 struct iwl_mvm_phy_ctxt *phy_ctxt;
Johannes Berg8ca151b2013-01-24 14:25:36 +01001303 int ret;
1304
Ilan Peer53a9d612013-04-28 11:55:08 +03001305 IWL_DEBUG_MAC80211(mvm, "Add channel context\n");
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001306
1307 mutex_lock(&mvm->mutex);
1308 phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm);
1309 if (!phy_ctxt) {
1310 ret = -ENOSPC;
1311 goto out;
1312 }
1313
Ilan Peer53a9d612013-04-28 11:55:08 +03001314 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->def,
1315 ctx->rx_chains_static,
1316 ctx->rx_chains_dynamic);
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001317 if (ret) {
1318 IWL_ERR(mvm, "Failed to add PHY context\n");
1319 goto out;
1320 }
1321
Ilan Peer53a9d612013-04-28 11:55:08 +03001322 iwl_mvm_phy_ctxt_ref(mvm, phy_ctxt);
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001323 *phy_ctxt_id = phy_ctxt->id;
1324out:
Johannes Berg8ca151b2013-01-24 14:25:36 +01001325 mutex_unlock(&mvm->mutex);
1326 return ret;
1327}
1328
1329static void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw,
1330 struct ieee80211_chanctx_conf *ctx)
1331{
1332 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001333 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
1334 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
Johannes Berg8ca151b2013-01-24 14:25:36 +01001335
1336 mutex_lock(&mvm->mutex);
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001337 iwl_mvm_phy_ctxt_unref(mvm, phy_ctxt);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001338 mutex_unlock(&mvm->mutex);
1339}
1340
1341static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
1342 struct ieee80211_chanctx_conf *ctx,
1343 u32 changed)
1344{
1345 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001346 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
1347 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
Johannes Berg8ca151b2013-01-24 14:25:36 +01001348
Ilan Peer31d385a2013-04-02 10:25:46 +03001349 if (WARN_ONCE((phy_ctxt->ref > 1) &&
1350 (changed & ~(IEEE80211_CHANCTX_CHANGE_WIDTH |
1351 IEEE80211_CHANCTX_CHANGE_RX_CHAINS |
1352 IEEE80211_CHANCTX_CHANGE_RADAR)),
1353 "Cannot change PHY. Ref=%d, changed=0x%X\n",
1354 phy_ctxt->ref, changed))
1355 return;
1356
Johannes Berg8ca151b2013-01-24 14:25:36 +01001357 mutex_lock(&mvm->mutex);
1358 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->def,
1359 ctx->rx_chains_static,
1360 ctx->rx_chains_dynamic);
1361 mutex_unlock(&mvm->mutex);
1362}
1363
1364static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
1365 struct ieee80211_vif *vif,
1366 struct ieee80211_chanctx_conf *ctx)
1367{
1368 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001369 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
1370 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
Johannes Berg8ca151b2013-01-24 14:25:36 +01001371 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1372 int ret;
1373
1374 mutex_lock(&mvm->mutex);
1375
Ilan Peerfe0f2de2013-03-21 10:23:52 +02001376 mvmvif->phy_ctxt = phy_ctxt;
Johannes Berg8ca151b2013-01-24 14:25:36 +01001377
1378 switch (vif->type) {
1379 case NL80211_IFTYPE_AP:
1380 /*
1381 * The AP binding flow is handled as part of the start_ap flow
1382 * (in bss_info_changed).
1383 */
1384 ret = 0;
1385 goto out_unlock;
1386 case NL80211_IFTYPE_STATION:
1387 case NL80211_IFTYPE_ADHOC:
1388 case NL80211_IFTYPE_MONITOR:
1389 break;
1390 default:
1391 ret = -EINVAL;
1392 goto out_unlock;
1393 }
1394
1395 ret = iwl_mvm_binding_add_vif(mvm, vif);
1396 if (ret)
1397 goto out_unlock;
1398
1399 /*
1400 * Setting the quota at this stage is only required for monitor
1401 * interfaces. For the other types, the bss_info changed flow
1402 * will handle quota settings.
1403 */
1404 if (vif->type == NL80211_IFTYPE_MONITOR) {
Ilan Peer1e1391c2013-03-13 14:52:04 +02001405 mvmvif->monitor_active = true;
Johannes Berg8ca151b2013-01-24 14:25:36 +01001406 ret = iwl_mvm_update_quotas(mvm, vif);
1407 if (ret)
1408 goto out_remove_binding;
1409 }
1410
1411 goto out_unlock;
1412
1413 out_remove_binding:
1414 iwl_mvm_binding_remove_vif(mvm, vif);
1415 out_unlock:
1416 mutex_unlock(&mvm->mutex);
1417 if (ret)
1418 mvmvif->phy_ctxt = NULL;
1419 return ret;
1420}
1421
1422static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
1423 struct ieee80211_vif *vif,
1424 struct ieee80211_chanctx_conf *ctx)
1425{
1426 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1427 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1428
1429 mutex_lock(&mvm->mutex);
1430
1431 iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data);
1432
1433 if (vif->type == NL80211_IFTYPE_AP)
1434 goto out_unlock;
1435
Johannes Berg8ca151b2013-01-24 14:25:36 +01001436 switch (vif->type) {
1437 case NL80211_IFTYPE_MONITOR:
Ilan Peer1e1391c2013-03-13 14:52:04 +02001438 mvmvif->monitor_active = false;
1439 iwl_mvm_update_quotas(mvm, NULL);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001440 break;
1441 default:
1442 break;
1443 }
1444
Ilan Peer1e1391c2013-03-13 14:52:04 +02001445 iwl_mvm_binding_remove_vif(mvm, vif);
Johannes Berg8ca151b2013-01-24 14:25:36 +01001446out_unlock:
1447 mvmvif->phy_ctxt = NULL;
1448 mutex_unlock(&mvm->mutex);
1449}
1450
1451static int iwl_mvm_set_tim(struct ieee80211_hw *hw,
1452 struct ieee80211_sta *sta,
1453 bool set)
1454{
1455 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1456 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv;
1457
1458 if (!mvm_sta || !mvm_sta->vif) {
1459 IWL_ERR(mvm, "Station is not associated to a vif\n");
1460 return -EINVAL;
1461 }
1462
1463 return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif);
1464}
1465
Emmanuel Grumbach2b76ef12013-01-24 10:35:13 +02001466static void iwl_mvm_mac_rssi_callback(struct ieee80211_hw *hw,
1467 struct ieee80211_vif *vif,
1468 enum ieee80211_rssi_event rssi_event)
1469{
1470 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1471
1472 iwl_mvm_bt_rssi_event(mvm, vif, rssi_event);
1473}
1474
Johannes Berg8ca151b2013-01-24 14:25:36 +01001475struct ieee80211_ops iwl_mvm_hw_ops = {
1476 .tx = iwl_mvm_mac_tx,
1477 .ampdu_action = iwl_mvm_mac_ampdu_action,
1478 .start = iwl_mvm_mac_start,
1479 .restart_complete = iwl_mvm_mac_restart_complete,
1480 .stop = iwl_mvm_mac_stop,
1481 .add_interface = iwl_mvm_mac_add_interface,
1482 .remove_interface = iwl_mvm_mac_remove_interface,
1483 .config = iwl_mvm_mac_config,
1484 .configure_filter = iwl_mvm_configure_filter,
1485 .bss_info_changed = iwl_mvm_bss_info_changed,
1486 .hw_scan = iwl_mvm_mac_hw_scan,
1487 .cancel_hw_scan = iwl_mvm_mac_cancel_hw_scan,
1488 .sta_state = iwl_mvm_mac_sta_state,
1489 .sta_notify = iwl_mvm_mac_sta_notify,
1490 .allow_buffered_frames = iwl_mvm_mac_allow_buffered_frames,
1491 .set_rts_threshold = iwl_mvm_mac_set_rts_threshold,
1492 .conf_tx = iwl_mvm_mac_conf_tx,
1493 .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx,
1494 .set_key = iwl_mvm_mac_set_key,
1495 .update_tkip_key = iwl_mvm_mac_update_tkip_key,
1496 .remain_on_channel = iwl_mvm_roc,
1497 .cancel_remain_on_channel = iwl_mvm_cancel_roc,
Emmanuel Grumbach2b76ef12013-01-24 10:35:13 +02001498 .rssi_callback = iwl_mvm_mac_rssi_callback,
Johannes Berg8ca151b2013-01-24 14:25:36 +01001499
1500 .add_chanctx = iwl_mvm_add_chanctx,
1501 .remove_chanctx = iwl_mvm_remove_chanctx,
1502 .change_chanctx = iwl_mvm_change_chanctx,
1503 .assign_vif_chanctx = iwl_mvm_assign_vif_chanctx,
1504 .unassign_vif_chanctx = iwl_mvm_unassign_vif_chanctx,
1505
1506 .start_ap = iwl_mvm_start_ap,
1507 .stop_ap = iwl_mvm_stop_ap,
1508
1509 .set_tim = iwl_mvm_set_tim,
1510
1511#ifdef CONFIG_PM_SLEEP
1512 /* look at d3.c */
1513 .suspend = iwl_mvm_suspend,
1514 .resume = iwl_mvm_resume,
1515 .set_wakeup = iwl_mvm_set_wakeup,
1516 .set_rekey_data = iwl_mvm_set_rekey_data,
1517#if IS_ENABLED(CONFIG_IPV6)
1518 .ipv6_addr_change = iwl_mvm_ipv6_addr_change,
1519#endif
1520 .set_default_unicast_key = iwl_mvm_set_default_unicast_key,
1521#endif
1522};