]>
Commit | Line | Data |
---|---|---|
8ca151b5 JB |
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 | |
410dc5aa | 25 | * in the file called COPYING. |
8ca151b5 JB |
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> | |
f0c2646a | 68 | #include <linux/ip.h> |
8ca151b5 | 69 | #include <net/mac80211.h> |
f0c2646a | 70 | #include <net/tcp.h> |
8ca151b5 JB |
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 | ||
81 | static const struct ieee80211_iface_limit iwl_mvm_limits[] = { | |
82 | { | |
83 | .max = 1, | |
84 | .types = BIT(NL80211_IFTYPE_STATION) | | |
85 | BIT(NL80211_IFTYPE_AP), | |
86 | }, | |
87 | { | |
88 | .max = 1, | |
89 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | | |
90 | BIT(NL80211_IFTYPE_P2P_GO), | |
91 | }, | |
92 | { | |
93 | .max = 1, | |
94 | .types = BIT(NL80211_IFTYPE_P2P_DEVICE), | |
95 | }, | |
96 | }; | |
97 | ||
98 | static const struct ieee80211_iface_combination iwl_mvm_iface_combinations[] = { | |
99 | { | |
100 | .num_different_channels = 1, | |
101 | .max_interfaces = 3, | |
102 | .limits = iwl_mvm_limits, | |
103 | .n_limits = ARRAY_SIZE(iwl_mvm_limits), | |
104 | }, | |
105 | }; | |
106 | ||
f0c2646a JB |
107 | #ifdef CONFIG_PM_SLEEP |
108 | static const struct nl80211_wowlan_tcp_data_token_feature | |
109 | iwl_mvm_wowlan_tcp_token_feature = { | |
110 | .min_len = 0, | |
111 | .max_len = 255, | |
112 | .bufsize = IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS, | |
113 | }; | |
114 | ||
115 | static const struct wiphy_wowlan_tcp_support iwl_mvm_wowlan_tcp_support = { | |
116 | .tok = &iwl_mvm_wowlan_tcp_token_feature, | |
117 | .data_payload_max = IWL_WOWLAN_TCP_MAX_PACKET_LEN - | |
118 | sizeof(struct ethhdr) - | |
119 | sizeof(struct iphdr) - | |
120 | sizeof(struct tcphdr), | |
121 | .data_interval_max = 65535, /* __le16 in API */ | |
122 | .wake_payload_max = IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN - | |
123 | sizeof(struct ethhdr) - | |
124 | sizeof(struct iphdr) - | |
125 | sizeof(struct tcphdr), | |
126 | .seq = true, | |
127 | }; | |
128 | #endif | |
129 | ||
fe0f2de3 IP |
130 | static void iwl_mvm_reset_phy_ctxts(struct iwl_mvm *mvm) |
131 | { | |
132 | int i; | |
133 | ||
134 | memset(mvm->phy_ctxts, 0, sizeof(mvm->phy_ctxts)); | |
135 | for (i = 0; i < NUM_PHY_CTX; i++) { | |
136 | mvm->phy_ctxts[i].id = i; | |
137 | mvm->phy_ctxts[i].ref = 0; | |
138 | } | |
139 | } | |
140 | ||
8ca151b5 JB |
141 | int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) |
142 | { | |
143 | struct ieee80211_hw *hw = mvm->hw; | |
831e85f3 | 144 | int num_mac, ret, i; |
8ca151b5 JB |
145 | |
146 | /* Tell mac80211 our characteristics */ | |
147 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | |
148 | IEEE80211_HW_SPECTRUM_MGMT | | |
149 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | | |
150 | IEEE80211_HW_QUEUE_CONTROL | | |
151 | IEEE80211_HW_WANT_MONITOR_VIF | | |
8ca151b5 JB |
152 | IEEE80211_HW_SUPPORTS_PS | |
153 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS | | |
d2931bbd JB |
154 | IEEE80211_HW_AMPDU_AGGREGATION | |
155 | IEEE80211_HW_TIMING_BEACON_ONLY; | |
8ca151b5 | 156 | |
398e8c6c IP |
157 | hw->queues = IWL_MVM_FIRST_AGG_QUEUE; |
158 | hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE; | |
8ca151b5 JB |
159 | hw->rate_control_algorithm = "iwl-mvm-rs"; |
160 | ||
161 | /* | |
162 | * Enable 11w if advertised by firmware and software crypto | |
163 | * is not enabled (as the firmware will interpret some mgmt | |
164 | * packets, so enabling it with software crypto isn't safe) | |
165 | */ | |
166 | if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP && | |
167 | !iwlwifi_mod_params.sw_crypto) | |
168 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; | |
169 | ||
170 | hw->sta_data_size = sizeof(struct iwl_mvm_sta); | |
171 | hw->vif_data_size = sizeof(struct iwl_mvm_vif); | |
fe0f2de3 | 172 | hw->chanctx_data_size = sizeof(u16); |
8ca151b5 JB |
173 | |
174 | hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | | |
175 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | |
176 | BIT(NL80211_IFTYPE_AP) | | |
177 | BIT(NL80211_IFTYPE_P2P_GO) | | |
178 | BIT(NL80211_IFTYPE_P2P_DEVICE); | |
179 | ||
180 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | |
181 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | |
182 | WIPHY_FLAG_IBSS_RSN; | |
183 | ||
184 | hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; | |
185 | hw->wiphy->n_iface_combinations = | |
186 | ARRAY_SIZE(iwl_mvm_iface_combinations); | |
187 | ||
c451e6d4 | 188 | hw->wiphy->max_remain_on_channel_duration = 10000; |
8ca151b5 JB |
189 | hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; |
190 | ||
191 | /* Extract MAC address */ | |
192 | memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN); | |
193 | hw->wiphy->addresses = mvm->addresses; | |
194 | hw->wiphy->n_addresses = 1; | |
831e85f3 IP |
195 | |
196 | /* Extract additional MAC addresses if available */ | |
197 | num_mac = (mvm->nvm_data->n_hw_addrs > 1) ? | |
198 | min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1; | |
199 | ||
200 | for (i = 1; i < num_mac; i++) { | |
201 | memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr, | |
8ca151b5 | 202 | ETH_ALEN); |
831e85f3 | 203 | mvm->addresses[i].addr[5]++; |
8ca151b5 JB |
204 | hw->wiphy->n_addresses++; |
205 | } | |
206 | ||
fe0f2de3 IP |
207 | iwl_mvm_reset_phy_ctxts(mvm); |
208 | ||
8ca151b5 JB |
209 | /* we create the 802.11 header and a max-length SSID element */ |
210 | hw->wiphy->max_scan_ie_len = | |
211 | mvm->fw->ucode_capa.max_probe_length - 24 - 34; | |
212 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; | |
213 | ||
214 | if (mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels) | |
215 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | |
216 | &mvm->nvm_data->bands[IEEE80211_BAND_2GHZ]; | |
217 | if (mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels) | |
218 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | |
219 | &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ]; | |
220 | ||
221 | hw->wiphy->hw_version = mvm->trans->hw_id; | |
222 | ||
ade50652 | 223 | if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) |
8ca151b5 JB |
224 | hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; |
225 | else | |
226 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | |
227 | ||
228 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | | |
229 | NL80211_FEATURE_P2P_GO_OPPPS; | |
230 | ||
231 | mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; | |
232 | ||
233 | #ifdef CONFIG_PM_SLEEP | |
234 | if (mvm->fw->img[IWL_UCODE_WOWLAN].sec[0].len && | |
235 | mvm->trans->ops->d3_suspend && | |
236 | mvm->trans->ops->d3_resume && | |
237 | device_can_wakeup(mvm->trans->dev)) { | |
238 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | | |
239 | WIPHY_WOWLAN_DISCONNECT | | |
240 | WIPHY_WOWLAN_EAP_IDENTITY_REQ | | |
241 | WIPHY_WOWLAN_RFKILL_RELEASE; | |
242 | if (!iwlwifi_mod_params.sw_crypto) | |
243 | hw->wiphy->wowlan.flags |= | |
244 | WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | | |
245 | WIPHY_WOWLAN_GTK_REKEY_FAILURE | | |
246 | WIPHY_WOWLAN_4WAY_HANDSHAKE; | |
247 | ||
248 | hw->wiphy->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS; | |
249 | hw->wiphy->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN; | |
250 | hw->wiphy->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN; | |
f0c2646a | 251 | hw->wiphy->wowlan.tcp = &iwl_mvm_wowlan_tcp_support; |
8ca151b5 JB |
252 | } |
253 | #endif | |
254 | ||
255 | ret = iwl_mvm_leds_init(mvm); | |
256 | if (ret) | |
257 | return ret; | |
258 | ||
259 | return ieee80211_register_hw(mvm->hw); | |
260 | } | |
261 | ||
262 | static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, | |
263 | struct ieee80211_tx_control *control, | |
264 | struct sk_buff *skb) | |
265 | { | |
266 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
267 | ||
268 | if (test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status)) { | |
269 | IWL_DEBUG_DROP(mvm, "Dropping - RF KILL\n"); | |
270 | goto drop; | |
271 | } | |
272 | ||
398e8c6c | 273 | if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && |
8ca151b5 JB |
274 | !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status)) |
275 | goto drop; | |
276 | ||
277 | if (control->sta) { | |
278 | if (iwl_mvm_tx_skb(mvm, skb, control->sta)) | |
279 | goto drop; | |
280 | return; | |
281 | } | |
282 | ||
283 | if (iwl_mvm_tx_skb_non_sta(mvm, skb)) | |
284 | goto drop; | |
285 | return; | |
286 | drop: | |
287 | ieee80211_free_txskb(hw, skb); | |
288 | } | |
289 | ||
290 | static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, | |
291 | struct ieee80211_vif *vif, | |
292 | enum ieee80211_ampdu_mlme_action action, | |
293 | struct ieee80211_sta *sta, u16 tid, | |
294 | u16 *ssn, u8 buf_size) | |
295 | { | |
296 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
297 | int ret; | |
298 | ||
299 | IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n", | |
300 | sta->addr, tid, action); | |
301 | ||
302 | if (!(mvm->nvm_data->sku_cap_11n_enable)) | |
303 | return -EACCES; | |
304 | ||
305 | mutex_lock(&mvm->mutex); | |
306 | ||
307 | switch (action) { | |
308 | case IEEE80211_AMPDU_RX_START: | |
309 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) { | |
310 | ret = -EINVAL; | |
311 | break; | |
312 | } | |
313 | ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, *ssn, true); | |
314 | break; | |
315 | case IEEE80211_AMPDU_RX_STOP: | |
316 | ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, 0, false); | |
317 | break; | |
318 | case IEEE80211_AMPDU_TX_START: | |
5d158efa EG |
319 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) { |
320 | ret = -EINVAL; | |
321 | break; | |
322 | } | |
8ca151b5 JB |
323 | ret = iwl_mvm_sta_tx_agg_start(mvm, vif, sta, tid, ssn); |
324 | break; | |
325 | case IEEE80211_AMPDU_TX_STOP_CONT: | |
e3d9e7ce EG |
326 | ret = iwl_mvm_sta_tx_agg_stop(mvm, vif, sta, tid); |
327 | break; | |
8ca151b5 JB |
328 | case IEEE80211_AMPDU_TX_STOP_FLUSH: |
329 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: | |
e3d9e7ce | 330 | ret = iwl_mvm_sta_tx_agg_flush(mvm, vif, sta, tid); |
8ca151b5 JB |
331 | break; |
332 | case IEEE80211_AMPDU_TX_OPERATIONAL: | |
333 | ret = iwl_mvm_sta_tx_agg_oper(mvm, vif, sta, tid, buf_size); | |
334 | break; | |
335 | default: | |
336 | WARN_ON_ONCE(1); | |
337 | ret = -EINVAL; | |
338 | break; | |
339 | } | |
340 | mutex_unlock(&mvm->mutex); | |
341 | ||
342 | return ret; | |
343 | } | |
344 | ||
345 | static void iwl_mvm_cleanup_iterator(void *data, u8 *mac, | |
346 | struct ieee80211_vif *vif) | |
347 | { | |
348 | struct iwl_mvm *mvm = data; | |
349 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
350 | ||
351 | mvmvif->uploaded = false; | |
352 | mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; | |
353 | ||
354 | /* does this make sense at all? */ | |
355 | mvmvif->color++; | |
356 | ||
357 | spin_lock_bh(&mvm->time_event_lock); | |
358 | iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); | |
359 | spin_unlock_bh(&mvm->time_event_lock); | |
360 | ||
fe0f2de3 | 361 | mvmvif->phy_ctxt = NULL; |
8ca151b5 JB |
362 | } |
363 | ||
364 | static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) | |
365 | { | |
366 | iwl_trans_stop_device(mvm->trans); | |
367 | iwl_trans_stop_hw(mvm->trans, false); | |
368 | ||
369 | mvm->scan_status = IWL_MVM_SCAN_NONE; | |
370 | ||
371 | /* just in case one was running */ | |
372 | ieee80211_remain_on_channel_expired(mvm->hw); | |
373 | ||
374 | ieee80211_iterate_active_interfaces_atomic( | |
375 | mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, | |
376 | iwl_mvm_cleanup_iterator, mvm); | |
377 | ||
fe0f2de3 IP |
378 | mvm->p2p_device_vif = NULL; |
379 | ||
380 | iwl_mvm_reset_phy_ctxts(mvm); | |
8ca151b5 JB |
381 | memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); |
382 | memset(mvm->sta_drained, 0, sizeof(mvm->sta_drained)); | |
383 | ||
384 | ieee80211_wake_queues(mvm->hw); | |
385 | ||
386 | mvm->vif_count = 0; | |
387 | } | |
388 | ||
389 | static int iwl_mvm_mac_start(struct ieee80211_hw *hw) | |
390 | { | |
391 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
392 | int ret; | |
393 | ||
394 | mutex_lock(&mvm->mutex); | |
395 | ||
396 | /* Clean up some internal and mac80211 state on restart */ | |
397 | if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) | |
398 | iwl_mvm_restart_cleanup(mvm); | |
399 | ||
400 | ret = iwl_mvm_up(mvm); | |
401 | mutex_unlock(&mvm->mutex); | |
402 | ||
403 | return ret; | |
404 | } | |
405 | ||
406 | static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw) | |
407 | { | |
408 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
409 | int ret; | |
410 | ||
411 | mutex_lock(&mvm->mutex); | |
412 | ||
413 | clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); | |
414 | ret = iwl_mvm_update_quotas(mvm, NULL); | |
415 | if (ret) | |
416 | IWL_ERR(mvm, "Failed to update quotas after restart (%d)\n", | |
417 | ret); | |
418 | ||
419 | mutex_unlock(&mvm->mutex); | |
420 | } | |
421 | ||
422 | static void iwl_mvm_mac_stop(struct ieee80211_hw *hw) | |
423 | { | |
424 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
425 | ||
426 | flush_work(&mvm->async_handlers_wk); | |
427 | ||
428 | mutex_lock(&mvm->mutex); | |
429 | /* async_handlers_wk is now blocked */ | |
430 | ||
431 | /* | |
432 | * The work item could be running or queued if the | |
433 | * ROC time event stops just as we get here. | |
434 | */ | |
435 | cancel_work_sync(&mvm->roc_done_wk); | |
436 | ||
437 | iwl_trans_stop_device(mvm->trans); | |
438 | iwl_trans_stop_hw(mvm->trans, false); | |
439 | ||
440 | iwl_mvm_async_handlers_purge(mvm); | |
441 | /* async_handlers_list is empty and will stay empty: HW is stopped */ | |
442 | ||
443 | /* the fw is stopped, the aux sta is dead: clean up driver state */ | |
444 | iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); | |
445 | ||
446 | mutex_unlock(&mvm->mutex); | |
447 | ||
448 | /* | |
449 | * The worker might have been waiting for the mutex, let it run and | |
450 | * discover that its list is now empty. | |
451 | */ | |
452 | cancel_work_sync(&mvm->async_handlers_wk); | |
453 | } | |
454 | ||
455 | static void iwl_mvm_pm_disable_iterator(void *data, u8 *mac, | |
456 | struct ieee80211_vif *vif) | |
457 | { | |
458 | struct iwl_mvm *mvm = data; | |
459 | int ret; | |
460 | ||
461 | ret = iwl_mvm_power_disable(mvm, vif); | |
462 | if (ret) | |
463 | IWL_ERR(mvm, "failed to disable power management\n"); | |
464 | } | |
465 | ||
466 | static void iwl_mvm_power_update_iterator(void *data, u8 *mac, | |
467 | struct ieee80211_vif *vif) | |
468 | { | |
469 | struct iwl_mvm *mvm = data; | |
470 | ||
471 | iwl_mvm_power_update_mode(mvm, vif); | |
472 | } | |
473 | ||
fe0f2de3 IP |
474 | static struct iwl_mvm_phy_ctxt *iwl_mvm_get_free_phy_ctxt(struct iwl_mvm *mvm) |
475 | { | |
476 | u16 i; | |
477 | ||
478 | lockdep_assert_held(&mvm->mutex); | |
479 | ||
480 | for (i = 0; i < NUM_PHY_CTX; i++) | |
481 | if (!mvm->phy_ctxts[i].ref) | |
482 | return &mvm->phy_ctxts[i]; | |
483 | ||
484 | IWL_ERR(mvm, "No available PHY context\n"); | |
485 | return NULL; | |
486 | } | |
487 | ||
8ca151b5 JB |
488 | static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, |
489 | struct ieee80211_vif *vif) | |
490 | { | |
491 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
492 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
493 | int ret; | |
494 | ||
495 | /* | |
496 | * Not much to do here. The stack will not allow interface | |
497 | * types or combinations that we didn't advertise, so we | |
498 | * don't really have to check the types. | |
499 | */ | |
500 | ||
501 | mutex_lock(&mvm->mutex); | |
502 | ||
503 | /* Allocate resources for the MAC context, and add it the the fw */ | |
504 | ret = iwl_mvm_mac_ctxt_init(mvm, vif); | |
505 | if (ret) | |
506 | goto out_unlock; | |
507 | ||
508 | /* | |
509 | * The AP binding flow can be done only after the beacon | |
510 | * template is configured (which happens only in the mac80211 | |
511 | * start_ap() flow), and adding the broadcast station can happen | |
512 | * only after the binding. | |
513 | * In addition, since modifying the MAC before adding a bcast | |
514 | * station is not allowed by the FW, delay the adding of MAC context to | |
515 | * the point where we can also add the bcast station. | |
516 | * In short: there's not much we can do at this point, other than | |
517 | * allocating resources :) | |
518 | */ | |
519 | if (vif->type == NL80211_IFTYPE_AP) { | |
520 | u32 qmask = iwl_mvm_mac_get_queues_mask(mvm, vif); | |
521 | ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta, | |
522 | qmask); | |
523 | if (ret) { | |
524 | IWL_ERR(mvm, "Failed to allocate bcast sta\n"); | |
525 | goto out_release; | |
526 | } | |
527 | ||
528 | goto out_unlock; | |
529 | } | |
530 | ||
531 | /* | |
532 | * TODO: remove this temporary code. | |
533 | * Currently MVM FW supports power management only on single MAC. | |
5ee2b215 AB |
534 | * If new interface added, disable PM on existing interface. |
535 | * P2P device is a special case, since it is handled by FW similary to | |
536 | * scan. If P2P deviced is added, PM remains enabled on existing | |
537 | * interface. | |
8ca151b5 JB |
538 | * Note: the method below does not count the new interface being added |
539 | * at this moment. | |
540 | */ | |
5ee2b215 AB |
541 | if (vif->type != NL80211_IFTYPE_P2P_DEVICE) |
542 | mvm->vif_count++; | |
8ca151b5 JB |
543 | if (mvm->vif_count > 1) { |
544 | IWL_DEBUG_MAC80211(mvm, | |
545 | "Disable power on existing interfaces\n"); | |
5360cfb2 | 546 | ieee80211_iterate_active_interfaces_atomic( |
8ca151b5 JB |
547 | mvm->hw, |
548 | IEEE80211_IFACE_ITER_NORMAL, | |
549 | iwl_mvm_pm_disable_iterator, mvm); | |
550 | } | |
551 | ||
552 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); | |
553 | if (ret) | |
554 | goto out_release; | |
555 | ||
556 | /* | |
557 | * Update power state on the new interface. Admittedly, based on | |
558 | * mac80211 logics this power update will disable power management | |
559 | */ | |
560 | iwl_mvm_power_update_mode(mvm, vif); | |
561 | ||
7df15b1e HG |
562 | /* beacon filtering */ |
563 | if (!mvm->bf_allowed_vif && | |
564 | vif->type == NL80211_IFTYPE_STATION && !vif->p2p){ | |
565 | mvm->bf_allowed_vif = mvmvif; | |
566 | vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER; | |
567 | } | |
568 | ||
569 | ret = iwl_mvm_disable_beacon_filter(mvm, vif); | |
570 | if (ret) | |
571 | goto out_release; | |
572 | ||
8ca151b5 JB |
573 | /* |
574 | * P2P_DEVICE interface does not have a channel context assigned to it, | |
575 | * so a dedicated PHY context is allocated to it and the corresponding | |
576 | * MAC context is bound to it at this stage. | |
577 | */ | |
578 | if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { | |
579 | struct ieee80211_channel *chan; | |
580 | struct cfg80211_chan_def chandef; | |
581 | ||
fe0f2de3 IP |
582 | mvmvif->phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); |
583 | if (!mvmvif->phy_ctxt) { | |
584 | ret = -ENOSPC; | |
585 | goto out_remove_mac; | |
586 | } | |
8ca151b5 JB |
587 | |
588 | /* | |
589 | * The channel used here isn't relevant as it's | |
590 | * going to be overwritten as part of the ROC flow. | |
591 | * For now use the first channel we have. | |
592 | */ | |
593 | chan = &mvm->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels[0]; | |
594 | cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT); | |
595 | ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->phy_ctxt, | |
596 | &chandef, 1, 1); | |
597 | if (ret) | |
598 | goto out_remove_mac; | |
599 | ||
600 | ret = iwl_mvm_binding_add_vif(mvm, vif); | |
601 | if (ret) | |
602 | goto out_remove_phy; | |
603 | ||
604 | ret = iwl_mvm_add_bcast_sta(mvm, vif, &mvmvif->bcast_sta); | |
605 | if (ret) | |
606 | goto out_unbind; | |
607 | ||
608 | /* Save a pointer to p2p device vif, so it can later be used to | |
609 | * update the p2p device MAC when a GO is started/stopped */ | |
610 | mvm->p2p_device_vif = vif; | |
611 | } | |
612 | ||
63494374 | 613 | iwl_mvm_vif_dbgfs_register(mvm, vif); |
8ca151b5 JB |
614 | goto out_unlock; |
615 | ||
616 | out_unbind: | |
617 | iwl_mvm_binding_remove_vif(mvm, vif); | |
618 | out_remove_phy: | |
fe0f2de3 | 619 | iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt); |
8ca151b5 JB |
620 | out_remove_mac: |
621 | mvmvif->phy_ctxt = NULL; | |
622 | iwl_mvm_mac_ctxt_remove(mvm, vif); | |
623 | out_release: | |
624 | /* | |
625 | * TODO: remove this temporary code. | |
626 | * Currently MVM FW supports power management only on single MAC. | |
5ee2b215 | 627 | * Check if only one additional interface remains after releasing |
8ca151b5 JB |
628 | * current one. Update power mode on the remaining interface. |
629 | */ | |
5ee2b215 AB |
630 | if (vif->type != NL80211_IFTYPE_P2P_DEVICE) |
631 | mvm->vif_count--; | |
8ca151b5 JB |
632 | IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n", |
633 | mvm->vif_count); | |
634 | if (mvm->vif_count == 1) { | |
635 | ieee80211_iterate_active_interfaces( | |
636 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | |
637 | iwl_mvm_power_update_iterator, mvm); | |
638 | } | |
639 | iwl_mvm_mac_ctxt_release(mvm, vif); | |
640 | out_unlock: | |
641 | mutex_unlock(&mvm->mutex); | |
642 | ||
643 | return ret; | |
644 | } | |
645 | ||
38a12b5b JB |
646 | static void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, |
647 | struct ieee80211_vif *vif) | |
8ca151b5 | 648 | { |
8ca151b5 JB |
649 | u32 tfd_msk = 0, ac; |
650 | ||
651 | for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) | |
652 | if (vif->hw_queue[ac] != IEEE80211_INVAL_HW_QUEUE) | |
653 | tfd_msk |= BIT(vif->hw_queue[ac]); | |
654 | ||
655 | if (vif->cab_queue != IEEE80211_INVAL_HW_QUEUE) | |
656 | tfd_msk |= BIT(vif->cab_queue); | |
657 | ||
658 | if (tfd_msk) { | |
659 | mutex_lock(&mvm->mutex); | |
660 | iwl_mvm_flush_tx_path(mvm, tfd_msk, true); | |
661 | mutex_unlock(&mvm->mutex); | |
662 | } | |
663 | ||
664 | if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { | |
665 | /* | |
666 | * Flush the ROC worker which will flush the OFFCHANNEL queue. | |
667 | * We assume here that all the packets sent to the OFFCHANNEL | |
668 | * queue are sent in ROC session. | |
669 | */ | |
670 | flush_work(&mvm->roc_done_wk); | |
671 | } else { | |
672 | /* | |
673 | * By now, all the AC queues are empty. The AGG queues are | |
674 | * empty too. We already got all the Tx responses for all the | |
675 | * packets in the queues. The drain work can have been | |
676 | * triggered. Flush it. This work item takes the mutex, so kill | |
677 | * it before we take it. | |
678 | */ | |
679 | flush_work(&mvm->sta_drained_wk); | |
680 | } | |
38a12b5b JB |
681 | } |
682 | ||
683 | static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw, | |
684 | struct ieee80211_vif *vif) | |
685 | { | |
686 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
687 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
688 | ||
689 | iwl_mvm_prepare_mac_removal(mvm, vif); | |
8ca151b5 JB |
690 | |
691 | mutex_lock(&mvm->mutex); | |
692 | ||
7df15b1e HG |
693 | if (mvm->bf_allowed_vif == mvmvif) { |
694 | mvm->bf_allowed_vif = NULL; | |
695 | vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER; | |
696 | } | |
697 | ||
63494374 JB |
698 | iwl_mvm_vif_dbgfs_clean(mvm, vif); |
699 | ||
8ca151b5 JB |
700 | /* |
701 | * For AP/GO interface, the tear down of the resources allocated to the | |
38a12b5b | 702 | * interface is be handled as part of the stop_ap flow. |
8ca151b5 JB |
703 | */ |
704 | if (vif->type == NL80211_IFTYPE_AP) { | |
705 | iwl_mvm_dealloc_int_sta(mvm, &mvmvif->bcast_sta); | |
706 | goto out_release; | |
707 | } | |
708 | ||
709 | if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { | |
710 | mvm->p2p_device_vif = NULL; | |
711 | iwl_mvm_rm_bcast_sta(mvm, &mvmvif->bcast_sta); | |
712 | iwl_mvm_binding_remove_vif(mvm, vif); | |
fe0f2de3 | 713 | iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt); |
8ca151b5 JB |
714 | mvmvif->phy_ctxt = NULL; |
715 | } | |
716 | ||
717 | /* | |
718 | * TODO: remove this temporary code. | |
719 | * Currently MVM FW supports power management only on single MAC. | |
720 | * Check if only one additional interface remains after removing | |
721 | * current one. Update power mode on the remaining interface. | |
722 | */ | |
5ee2b215 | 723 | if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE) |
8ca151b5 JB |
724 | mvm->vif_count--; |
725 | IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n", | |
726 | mvm->vif_count); | |
727 | if (mvm->vif_count == 1) { | |
728 | ieee80211_iterate_active_interfaces( | |
729 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | |
730 | iwl_mvm_power_update_iterator, mvm); | |
731 | } | |
732 | ||
733 | iwl_mvm_mac_ctxt_remove(mvm, vif); | |
734 | ||
735 | out_release: | |
736 | iwl_mvm_mac_ctxt_release(mvm, vif); | |
737 | mutex_unlock(&mvm->mutex); | |
738 | } | |
739 | ||
740 | static int iwl_mvm_mac_config(struct ieee80211_hw *hw, u32 changed) | |
741 | { | |
742 | return 0; | |
743 | } | |
744 | ||
745 | static void iwl_mvm_configure_filter(struct ieee80211_hw *hw, | |
746 | unsigned int changed_flags, | |
747 | unsigned int *total_flags, | |
748 | u64 multicast) | |
749 | { | |
750 | *total_flags = 0; | |
751 | } | |
752 | ||
753 | static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |
754 | struct ieee80211_vif *vif, | |
755 | struct ieee80211_bss_conf *bss_conf, | |
756 | u32 changes) | |
757 | { | |
758 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
759 | int ret; | |
760 | ||
761 | ret = iwl_mvm_mac_ctxt_changed(mvm, vif); | |
762 | if (ret) | |
763 | IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); | |
764 | ||
765 | if (changes & BSS_CHANGED_ASSOC) { | |
766 | if (bss_conf->assoc) { | |
767 | /* add quota for this interface */ | |
768 | ret = iwl_mvm_update_quotas(mvm, vif); | |
769 | if (ret) { | |
770 | IWL_ERR(mvm, "failed to update quotas\n"); | |
771 | return; | |
772 | } | |
9166b1ee | 773 | iwl_mvm_bt_coex_vif_assoc(mvm, vif); |
8ca151b5 JB |
774 | } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { |
775 | /* remove AP station now that the MAC is unassoc */ | |
776 | ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id); | |
777 | if (ret) | |
778 | IWL_ERR(mvm, "failed to remove AP station\n"); | |
779 | mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; | |
780 | /* remove quota for this interface */ | |
781 | ret = iwl_mvm_update_quotas(mvm, NULL); | |
782 | if (ret) | |
783 | IWL_ERR(mvm, "failed to update quotas\n"); | |
784 | } | |
210a544e JB |
785 | } else if (changes & BSS_CHANGED_DTIM_PERIOD) { |
786 | /* | |
787 | * We received a beacon _after_ association so | |
788 | * remove the session protection. | |
789 | */ | |
790 | iwl_mvm_remove_time_event(mvm, mvmvif, | |
791 | &mvmvif->time_event_data); | |
8ca151b5 JB |
792 | } else if (changes & BSS_CHANGED_PS) { |
793 | /* | |
794 | * TODO: remove this temporary code. | |
795 | * Currently MVM FW supports power management only on single | |
796 | * MAC. Avoid power mode update if more than one interface | |
797 | * is active. | |
798 | */ | |
799 | IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n", | |
800 | mvm->vif_count); | |
801 | if (mvm->vif_count == 1) { | |
802 | ret = iwl_mvm_power_update_mode(mvm, vif); | |
803 | if (ret) | |
804 | IWL_ERR(mvm, "failed to update power mode\n"); | |
805 | } | |
806 | } | |
807 | } | |
808 | ||
809 | static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |
810 | { | |
811 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
812 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
813 | int ret; | |
814 | ||
815 | mutex_lock(&mvm->mutex); | |
816 | ||
817 | /* Send the beacon template */ | |
818 | ret = iwl_mvm_mac_ctxt_beacon_changed(mvm, vif); | |
819 | if (ret) | |
820 | goto out_unlock; | |
821 | ||
822 | /* Add the mac context */ | |
823 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); | |
824 | if (ret) | |
825 | goto out_unlock; | |
826 | ||
827 | /* Perform the binding */ | |
828 | ret = iwl_mvm_binding_add_vif(mvm, vif); | |
829 | if (ret) | |
830 | goto out_remove; | |
831 | ||
832 | mvmvif->ap_active = true; | |
833 | ||
834 | /* Send the bcast station. At this stage the TBTT and DTIM time events | |
835 | * are added and applied to the scheduler */ | |
836 | ret = iwl_mvm_send_bcast_sta(mvm, vif, &mvmvif->bcast_sta); | |
837 | if (ret) | |
838 | goto out_unbind; | |
839 | ||
840 | ret = iwl_mvm_update_quotas(mvm, vif); | |
841 | if (ret) | |
842 | goto out_rm_bcast; | |
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 | mutex_unlock(&mvm->mutex); | |
849 | return 0; | |
850 | ||
851 | out_rm_bcast: | |
852 | iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); | |
853 | out_unbind: | |
854 | iwl_mvm_binding_remove_vif(mvm, vif); | |
855 | out_remove: | |
856 | iwl_mvm_mac_ctxt_remove(mvm, vif); | |
857 | out_unlock: | |
858 | mutex_unlock(&mvm->mutex); | |
859 | return ret; | |
860 | } | |
861 | ||
862 | static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |
863 | { | |
864 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
865 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
866 | ||
38a12b5b JB |
867 | iwl_mvm_prepare_mac_removal(mvm, vif); |
868 | ||
8ca151b5 JB |
869 | mutex_lock(&mvm->mutex); |
870 | ||
871 | mvmvif->ap_active = false; | |
872 | ||
873 | /* Need to update the P2P Device MAC */ | |
874 | if (vif->p2p && mvm->p2p_device_vif) | |
875 | iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); | |
876 | ||
877 | iwl_mvm_update_quotas(mvm, NULL); | |
878 | iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); | |
879 | iwl_mvm_binding_remove_vif(mvm, vif); | |
880 | iwl_mvm_mac_ctxt_remove(mvm, vif); | |
881 | ||
882 | mutex_unlock(&mvm->mutex); | |
883 | } | |
884 | ||
885 | static void iwl_mvm_bss_info_changed_ap(struct iwl_mvm *mvm, | |
886 | struct ieee80211_vif *vif, | |
887 | struct ieee80211_bss_conf *bss_conf, | |
888 | u32 changes) | |
889 | { | |
890 | /* Need to send a new beacon template to the FW */ | |
891 | if (changes & BSS_CHANGED_BEACON) { | |
892 | if (iwl_mvm_mac_ctxt_beacon_changed(mvm, vif)) | |
893 | IWL_WARN(mvm, "Failed updating beacon data\n"); | |
894 | } | |
895 | } | |
896 | ||
897 | static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, | |
898 | struct ieee80211_vif *vif, | |
899 | struct ieee80211_bss_conf *bss_conf, | |
900 | u32 changes) | |
901 | { | |
902 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
903 | ||
904 | mutex_lock(&mvm->mutex); | |
905 | ||
906 | switch (vif->type) { | |
907 | case NL80211_IFTYPE_STATION: | |
908 | iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes); | |
909 | break; | |
910 | case NL80211_IFTYPE_AP: | |
911 | iwl_mvm_bss_info_changed_ap(mvm, vif, bss_conf, changes); | |
912 | break; | |
913 | default: | |
914 | /* shouldn't happen */ | |
915 | WARN_ON_ONCE(1); | |
916 | } | |
917 | ||
918 | mutex_unlock(&mvm->mutex); | |
919 | } | |
920 | ||
921 | static int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw, | |
922 | struct ieee80211_vif *vif, | |
923 | struct cfg80211_scan_request *req) | |
924 | { | |
925 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
926 | int ret; | |
927 | ||
928 | if (req->n_channels == 0 || req->n_channels > MAX_NUM_SCAN_CHANNELS) | |
929 | return -EINVAL; | |
930 | ||
931 | mutex_lock(&mvm->mutex); | |
932 | ||
933 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | |
934 | ret = iwl_mvm_scan_request(mvm, vif, req); | |
935 | else | |
936 | ret = -EBUSY; | |
937 | ||
938 | mutex_unlock(&mvm->mutex); | |
939 | ||
940 | return ret; | |
941 | } | |
942 | ||
943 | static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw, | |
944 | struct ieee80211_vif *vif) | |
945 | { | |
946 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
947 | ||
948 | mutex_lock(&mvm->mutex); | |
949 | ||
950 | iwl_mvm_cancel_scan(mvm); | |
951 | ||
952 | mutex_unlock(&mvm->mutex); | |
953 | } | |
954 | ||
955 | static void | |
956 | iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw, | |
957 | struct ieee80211_sta *sta, u16 tid, | |
958 | int num_frames, | |
959 | enum ieee80211_frame_release_type reason, | |
960 | bool more_data) | |
961 | { | |
962 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
8ca151b5 JB |
963 | |
964 | /* TODO: how do we tell the fw to send frames for a specific TID */ | |
965 | ||
966 | /* | |
967 | * The fw will send EOSP notification when the last frame will be | |
968 | * transmitted. | |
969 | */ | |
9cc40712 | 970 | iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames); |
8ca151b5 JB |
971 | } |
972 | ||
973 | static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, | |
974 | struct ieee80211_vif *vif, | |
975 | enum sta_notify_cmd cmd, | |
976 | struct ieee80211_sta *sta) | |
977 | { | |
978 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
979 | struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; | |
980 | ||
981 | switch (cmd) { | |
982 | case STA_NOTIFY_SLEEP: | |
983 | if (atomic_read(&mvmsta->pending_frames) > 0) | |
984 | ieee80211_sta_block_awake(hw, sta, true); | |
985 | /* | |
986 | * The fw updates the STA to be asleep. Tx packets on the Tx | |
987 | * queues to this station will not be transmitted. The fw will | |
988 | * send a Tx response with TX_STATUS_FAIL_DEST_PS. | |
989 | */ | |
990 | break; | |
991 | case STA_NOTIFY_AWAKE: | |
881acd89 | 992 | if (WARN_ON(mvmsta->sta_id == IWL_MVM_STATION_COUNT)) |
8ca151b5 | 993 | break; |
9cc40712 | 994 | iwl_mvm_sta_modify_ps_wake(mvm, sta); |
8ca151b5 JB |
995 | break; |
996 | default: | |
997 | break; | |
998 | } | |
999 | } | |
1000 | ||
1001 | static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |
1002 | struct ieee80211_vif *vif, | |
1003 | struct ieee80211_sta *sta, | |
1004 | enum ieee80211_sta_state old_state, | |
1005 | enum ieee80211_sta_state new_state) | |
1006 | { | |
1007 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1008 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
1009 | int ret; | |
1010 | ||
1011 | IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n", | |
1012 | sta->addr, old_state, new_state); | |
1013 | ||
1014 | /* this would be a mac80211 bug ... but don't crash */ | |
1015 | if (WARN_ON_ONCE(!mvmvif->phy_ctxt)) | |
1016 | return -EINVAL; | |
1017 | ||
1018 | /* if a STA is being removed, reuse its ID */ | |
1019 | flush_work(&mvm->sta_drained_wk); | |
1020 | ||
1021 | mutex_lock(&mvm->mutex); | |
1022 | if (old_state == IEEE80211_STA_NOTEXIST && | |
1023 | new_state == IEEE80211_STA_NONE) { | |
1024 | ret = iwl_mvm_add_sta(mvm, vif, sta); | |
1025 | } else if (old_state == IEEE80211_STA_NONE && | |
1026 | new_state == IEEE80211_STA_AUTH) { | |
1027 | ret = 0; | |
1028 | } else if (old_state == IEEE80211_STA_AUTH && | |
1029 | new_state == IEEE80211_STA_ASSOC) { | |
7a453973 JB |
1030 | ret = iwl_mvm_update_sta(mvm, vif, sta); |
1031 | if (ret == 0) | |
1032 | iwl_mvm_rs_rate_init(mvm, sta, | |
1033 | mvmvif->phy_ctxt->channel->band); | |
8ca151b5 JB |
1034 | } else if (old_state == IEEE80211_STA_ASSOC && |
1035 | new_state == IEEE80211_STA_AUTHORIZED) { | |
7df15b1e HG |
1036 | /* enable beacon filtering */ |
1037 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif)); | |
8ca151b5 JB |
1038 | ret = 0; |
1039 | } else if (old_state == IEEE80211_STA_AUTHORIZED && | |
1040 | new_state == IEEE80211_STA_ASSOC) { | |
7df15b1e HG |
1041 | /* disable beacon filtering */ |
1042 | WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif)); | |
8ca151b5 JB |
1043 | ret = 0; |
1044 | } else if (old_state == IEEE80211_STA_ASSOC && | |
1045 | new_state == IEEE80211_STA_AUTH) { | |
1046 | ret = 0; | |
1047 | } else if (old_state == IEEE80211_STA_AUTH && | |
1048 | new_state == IEEE80211_STA_NONE) { | |
1049 | ret = 0; | |
1050 | } else if (old_state == IEEE80211_STA_NONE && | |
1051 | new_state == IEEE80211_STA_NOTEXIST) { | |
1052 | ret = iwl_mvm_rm_sta(mvm, vif, sta); | |
1053 | } else { | |
1054 | ret = -EIO; | |
1055 | } | |
1056 | mutex_unlock(&mvm->mutex); | |
1057 | ||
1058 | return ret; | |
1059 | } | |
1060 | ||
1061 | static int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | |
1062 | { | |
1063 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1064 | ||
1065 | mvm->rts_threshold = value; | |
1066 | ||
1067 | return 0; | |
1068 | } | |
1069 | ||
1070 | static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw, | |
1071 | struct ieee80211_vif *vif, u16 ac, | |
1072 | const struct ieee80211_tx_queue_params *params) | |
1073 | { | |
1074 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1075 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
1076 | ||
1077 | mvmvif->queue_params[ac] = *params; | |
1078 | ||
1079 | /* | |
1080 | * No need to update right away, we'll get BSS_CHANGED_QOS | |
1081 | * The exception is P2P_DEVICE interface which needs immediate update. | |
1082 | */ | |
1083 | if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { | |
1084 | int ret; | |
1085 | ||
1086 | mutex_lock(&mvm->mutex); | |
1087 | ret = iwl_mvm_mac_ctxt_changed(mvm, vif); | |
1088 | mutex_unlock(&mvm->mutex); | |
1089 | return ret; | |
1090 | } | |
1091 | return 0; | |
1092 | } | |
1093 | ||
1094 | static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw, | |
1095 | struct ieee80211_vif *vif) | |
1096 | { | |
1097 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1098 | u32 duration = min(IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS, | |
1099 | 200 + vif->bss_conf.beacon_int); | |
1100 | u32 min_duration = min(IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS, | |
1101 | 100 + vif->bss_conf.beacon_int); | |
1102 | ||
1103 | if (WARN_ON_ONCE(vif->bss_conf.assoc)) | |
1104 | return; | |
1105 | ||
1106 | mutex_lock(&mvm->mutex); | |
1107 | /* Try really hard to protect the session and hear a beacon */ | |
1108 | iwl_mvm_protect_session(mvm, vif, duration, min_duration); | |
1109 | mutex_unlock(&mvm->mutex); | |
1110 | } | |
1111 | ||
1112 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |
1113 | enum set_key_cmd cmd, | |
1114 | struct ieee80211_vif *vif, | |
1115 | struct ieee80211_sta *sta, | |
1116 | struct ieee80211_key_conf *key) | |
1117 | { | |
1118 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1119 | int ret; | |
1120 | ||
1121 | if (iwlwifi_mod_params.sw_crypto) { | |
1122 | IWL_DEBUG_MAC80211(mvm, "leave - hwcrypto disabled\n"); | |
1123 | return -EOPNOTSUPP; | |
1124 | } | |
1125 | ||
1126 | switch (key->cipher) { | |
1127 | case WLAN_CIPHER_SUITE_TKIP: | |
1128 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | |
1129 | /* fall-through */ | |
1130 | case WLAN_CIPHER_SUITE_CCMP: | |
1131 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | |
1132 | break; | |
1133 | case WLAN_CIPHER_SUITE_AES_CMAC: | |
1134 | WARN_ON_ONCE(!(hw->flags & IEEE80211_HW_MFP_CAPABLE)); | |
1135 | break; | |
1136 | case WLAN_CIPHER_SUITE_WEP40: | |
1137 | case WLAN_CIPHER_SUITE_WEP104: | |
1138 | /* | |
1139 | * Support for TX only, at least for now, so accept | |
1140 | * the key and do nothing else. Then mac80211 will | |
1141 | * pass it for TX but we don't have to use it for RX. | |
1142 | */ | |
1143 | return 0; | |
1144 | default: | |
1145 | return -EOPNOTSUPP; | |
1146 | } | |
1147 | ||
1148 | mutex_lock(&mvm->mutex); | |
1149 | ||
1150 | switch (cmd) { | |
1151 | case SET_KEY: | |
6caffd4f JB |
1152 | if (vif->type == NL80211_IFTYPE_AP && !sta) { |
1153 | /* GTK on AP interface is a TX-only key, return 0 */ | |
1154 | ret = 0; | |
1155 | key->hw_key_idx = STA_KEY_IDX_INVALID; | |
1156 | break; | |
1157 | } | |
1158 | ||
8ca151b5 JB |
1159 | IWL_DEBUG_MAC80211(mvm, "set hwcrypto key\n"); |
1160 | ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, false); | |
1161 | if (ret) { | |
1162 | IWL_WARN(mvm, "set key failed\n"); | |
1163 | /* | |
1164 | * can't add key for RX, but we don't need it | |
1165 | * in the device for TX so still return 0 | |
1166 | */ | |
6caffd4f | 1167 | key->hw_key_idx = STA_KEY_IDX_INVALID; |
8ca151b5 JB |
1168 | ret = 0; |
1169 | } | |
1170 | ||
1171 | break; | |
1172 | case DISABLE_KEY: | |
6caffd4f JB |
1173 | if (key->hw_key_idx == STA_KEY_IDX_INVALID) { |
1174 | ret = 0; | |
1175 | break; | |
1176 | } | |
1177 | ||
8ca151b5 JB |
1178 | IWL_DEBUG_MAC80211(mvm, "disable hwcrypto key\n"); |
1179 | ret = iwl_mvm_remove_sta_key(mvm, vif, sta, key); | |
1180 | break; | |
1181 | default: | |
1182 | ret = -EINVAL; | |
1183 | } | |
1184 | ||
1185 | mutex_unlock(&mvm->mutex); | |
1186 | return ret; | |
1187 | } | |
1188 | ||
1189 | static void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw, | |
1190 | struct ieee80211_vif *vif, | |
1191 | struct ieee80211_key_conf *keyconf, | |
1192 | struct ieee80211_sta *sta, | |
1193 | u32 iv32, u16 *phase1key) | |
1194 | { | |
1195 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1196 | ||
1197 | iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key); | |
1198 | } | |
1199 | ||
1200 | ||
1201 | static int iwl_mvm_roc(struct ieee80211_hw *hw, | |
1202 | struct ieee80211_vif *vif, | |
1203 | struct ieee80211_channel *channel, | |
d339d5ca IP |
1204 | int duration, |
1205 | enum ieee80211_roc_type type) | |
8ca151b5 JB |
1206 | { |
1207 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
fe0f2de3 | 1208 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
8ca151b5 JB |
1209 | struct cfg80211_chan_def chandef; |
1210 | int ret; | |
1211 | ||
1212 | if (vif->type != NL80211_IFTYPE_P2P_DEVICE) { | |
1213 | IWL_ERR(mvm, "vif isn't a P2P_DEVICE: %d\n", vif->type); | |
1214 | return -EINVAL; | |
1215 | } | |
1216 | ||
d339d5ca IP |
1217 | IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, |
1218 | duration, type); | |
8ca151b5 JB |
1219 | |
1220 | mutex_lock(&mvm->mutex); | |
1221 | ||
1222 | cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT); | |
fe0f2de3 | 1223 | ret = iwl_mvm_phy_ctxt_changed(mvm, mvmvif->phy_ctxt, |
8ca151b5 JB |
1224 | &chandef, 1, 1); |
1225 | ||
1226 | /* Schedule the time events */ | |
e635c797 | 1227 | ret = iwl_mvm_start_p2p_roc(mvm, vif, duration, type); |
8ca151b5 JB |
1228 | |
1229 | mutex_unlock(&mvm->mutex); | |
1230 | IWL_DEBUG_MAC80211(mvm, "leave\n"); | |
1231 | ||
1232 | return ret; | |
1233 | } | |
1234 | ||
1235 | static int iwl_mvm_cancel_roc(struct ieee80211_hw *hw) | |
1236 | { | |
1237 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1238 | ||
1239 | IWL_DEBUG_MAC80211(mvm, "enter\n"); | |
1240 | ||
1241 | mutex_lock(&mvm->mutex); | |
1242 | iwl_mvm_stop_p2p_roc(mvm); | |
1243 | mutex_unlock(&mvm->mutex); | |
1244 | ||
1245 | IWL_DEBUG_MAC80211(mvm, "leave\n"); | |
1246 | return 0; | |
1247 | } | |
1248 | ||
1249 | static int iwl_mvm_add_chanctx(struct ieee80211_hw *hw, | |
1250 | struct ieee80211_chanctx_conf *ctx) | |
1251 | { | |
1252 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
fe0f2de3 IP |
1253 | u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; |
1254 | struct iwl_mvm_phy_ctxt *phy_ctxt; | |
8ca151b5 JB |
1255 | int ret; |
1256 | ||
fe0f2de3 IP |
1257 | IWL_DEBUG_MAC80211(mvm, "Add PHY context\n"); |
1258 | ||
8ca151b5 | 1259 | mutex_lock(&mvm->mutex); |
fe0f2de3 IP |
1260 | phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); |
1261 | if (!phy_ctxt) { | |
1262 | ret = -ENOSPC; | |
1263 | goto out; | |
1264 | } | |
8ca151b5 | 1265 | |
8ca151b5 JB |
1266 | ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, &ctx->def, |
1267 | ctx->rx_chains_static, | |
1268 | ctx->rx_chains_dynamic); | |
fe0f2de3 IP |
1269 | if (ret) { |
1270 | IWL_ERR(mvm, "Failed to add PHY context\n"); | |
1271 | goto out; | |
1272 | } | |
1273 | ||
1274 | *phy_ctxt_id = phy_ctxt->id; | |
1275 | out: | |
8ca151b5 JB |
1276 | mutex_unlock(&mvm->mutex); |
1277 | return ret; | |
1278 | } | |
1279 | ||
1280 | static void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw, | |
1281 | struct ieee80211_chanctx_conf *ctx) | |
1282 | { | |
1283 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
fe0f2de3 IP |
1284 | u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; |
1285 | struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; | |
8ca151b5 JB |
1286 | |
1287 | mutex_lock(&mvm->mutex); | |
fe0f2de3 | 1288 | iwl_mvm_phy_ctxt_unref(mvm, phy_ctxt); |
8ca151b5 JB |
1289 | mutex_unlock(&mvm->mutex); |
1290 | } | |
1291 | ||
1292 | static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, | |
1293 | struct ieee80211_chanctx_conf *ctx, | |
1294 | u32 changed) | |
1295 | { | |
1296 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
fe0f2de3 IP |
1297 | u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; |
1298 | struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; | |
8ca151b5 JB |
1299 | |
1300 | mutex_lock(&mvm->mutex); | |
1301 | iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->def, | |
1302 | ctx->rx_chains_static, | |
1303 | ctx->rx_chains_dynamic); | |
1304 | mutex_unlock(&mvm->mutex); | |
1305 | } | |
1306 | ||
1307 | static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, | |
1308 | struct ieee80211_vif *vif, | |
1309 | struct ieee80211_chanctx_conf *ctx) | |
1310 | { | |
1311 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
fe0f2de3 IP |
1312 | u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; |
1313 | struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; | |
8ca151b5 JB |
1314 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
1315 | int ret; | |
1316 | ||
1317 | mutex_lock(&mvm->mutex); | |
1318 | ||
fe0f2de3 | 1319 | mvmvif->phy_ctxt = phy_ctxt; |
8ca151b5 JB |
1320 | |
1321 | switch (vif->type) { | |
1322 | case NL80211_IFTYPE_AP: | |
1323 | /* | |
1324 | * The AP binding flow is handled as part of the start_ap flow | |
1325 | * (in bss_info_changed). | |
1326 | */ | |
1327 | ret = 0; | |
1328 | goto out_unlock; | |
1329 | case NL80211_IFTYPE_STATION: | |
1330 | case NL80211_IFTYPE_ADHOC: | |
1331 | case NL80211_IFTYPE_MONITOR: | |
1332 | break; | |
1333 | default: | |
1334 | ret = -EINVAL; | |
1335 | goto out_unlock; | |
1336 | } | |
1337 | ||
1338 | ret = iwl_mvm_binding_add_vif(mvm, vif); | |
1339 | if (ret) | |
1340 | goto out_unlock; | |
1341 | ||
1342 | /* | |
1343 | * Setting the quota at this stage is only required for monitor | |
1344 | * interfaces. For the other types, the bss_info changed flow | |
1345 | * will handle quota settings. | |
1346 | */ | |
1347 | if (vif->type == NL80211_IFTYPE_MONITOR) { | |
1e1391ca | 1348 | mvmvif->monitor_active = true; |
8ca151b5 JB |
1349 | ret = iwl_mvm_update_quotas(mvm, vif); |
1350 | if (ret) | |
1351 | goto out_remove_binding; | |
1352 | } | |
1353 | ||
1354 | goto out_unlock; | |
1355 | ||
1356 | out_remove_binding: | |
1357 | iwl_mvm_binding_remove_vif(mvm, vif); | |
1358 | out_unlock: | |
1359 | mutex_unlock(&mvm->mutex); | |
1360 | if (ret) | |
1361 | mvmvif->phy_ctxt = NULL; | |
1362 | return ret; | |
1363 | } | |
1364 | ||
1365 | static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw, | |
1366 | struct ieee80211_vif *vif, | |
1367 | struct ieee80211_chanctx_conf *ctx) | |
1368 | { | |
1369 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1370 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
1371 | ||
1372 | mutex_lock(&mvm->mutex); | |
1373 | ||
1374 | iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); | |
1375 | ||
1376 | if (vif->type == NL80211_IFTYPE_AP) | |
1377 | goto out_unlock; | |
1378 | ||
8ca151b5 JB |
1379 | switch (vif->type) { |
1380 | case NL80211_IFTYPE_MONITOR: | |
1e1391ca IP |
1381 | mvmvif->monitor_active = false; |
1382 | iwl_mvm_update_quotas(mvm, NULL); | |
8ca151b5 JB |
1383 | break; |
1384 | default: | |
1385 | break; | |
1386 | } | |
1387 | ||
1e1391ca | 1388 | iwl_mvm_binding_remove_vif(mvm, vif); |
8ca151b5 JB |
1389 | out_unlock: |
1390 | mvmvif->phy_ctxt = NULL; | |
1391 | mutex_unlock(&mvm->mutex); | |
1392 | } | |
1393 | ||
1394 | static int iwl_mvm_set_tim(struct ieee80211_hw *hw, | |
1395 | struct ieee80211_sta *sta, | |
1396 | bool set) | |
1397 | { | |
1398 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1399 | struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; | |
1400 | ||
1401 | if (!mvm_sta || !mvm_sta->vif) { | |
1402 | IWL_ERR(mvm, "Station is not associated to a vif\n"); | |
1403 | return -EINVAL; | |
1404 | } | |
1405 | ||
1406 | return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif); | |
1407 | } | |
1408 | ||
2b76ef13 EG |
1409 | static void iwl_mvm_mac_rssi_callback(struct ieee80211_hw *hw, |
1410 | struct ieee80211_vif *vif, | |
1411 | enum ieee80211_rssi_event rssi_event) | |
1412 | { | |
1413 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | |
1414 | ||
1415 | iwl_mvm_bt_rssi_event(mvm, vif, rssi_event); | |
1416 | } | |
1417 | ||
8ca151b5 JB |
1418 | struct ieee80211_ops iwl_mvm_hw_ops = { |
1419 | .tx = iwl_mvm_mac_tx, | |
1420 | .ampdu_action = iwl_mvm_mac_ampdu_action, | |
1421 | .start = iwl_mvm_mac_start, | |
1422 | .restart_complete = iwl_mvm_mac_restart_complete, | |
1423 | .stop = iwl_mvm_mac_stop, | |
1424 | .add_interface = iwl_mvm_mac_add_interface, | |
1425 | .remove_interface = iwl_mvm_mac_remove_interface, | |
1426 | .config = iwl_mvm_mac_config, | |
1427 | .configure_filter = iwl_mvm_configure_filter, | |
1428 | .bss_info_changed = iwl_mvm_bss_info_changed, | |
1429 | .hw_scan = iwl_mvm_mac_hw_scan, | |
1430 | .cancel_hw_scan = iwl_mvm_mac_cancel_hw_scan, | |
1431 | .sta_state = iwl_mvm_mac_sta_state, | |
1432 | .sta_notify = iwl_mvm_mac_sta_notify, | |
1433 | .allow_buffered_frames = iwl_mvm_mac_allow_buffered_frames, | |
1434 | .set_rts_threshold = iwl_mvm_mac_set_rts_threshold, | |
1435 | .conf_tx = iwl_mvm_mac_conf_tx, | |
1436 | .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx, | |
1437 | .set_key = iwl_mvm_mac_set_key, | |
1438 | .update_tkip_key = iwl_mvm_mac_update_tkip_key, | |
1439 | .remain_on_channel = iwl_mvm_roc, | |
1440 | .cancel_remain_on_channel = iwl_mvm_cancel_roc, | |
2b76ef13 | 1441 | .rssi_callback = iwl_mvm_mac_rssi_callback, |
8ca151b5 JB |
1442 | |
1443 | .add_chanctx = iwl_mvm_add_chanctx, | |
1444 | .remove_chanctx = iwl_mvm_remove_chanctx, | |
1445 | .change_chanctx = iwl_mvm_change_chanctx, | |
1446 | .assign_vif_chanctx = iwl_mvm_assign_vif_chanctx, | |
1447 | .unassign_vif_chanctx = iwl_mvm_unassign_vif_chanctx, | |
1448 | ||
1449 | .start_ap = iwl_mvm_start_ap, | |
1450 | .stop_ap = iwl_mvm_stop_ap, | |
1451 | ||
1452 | .set_tim = iwl_mvm_set_tim, | |
1453 | ||
1454 | #ifdef CONFIG_PM_SLEEP | |
1455 | /* look at d3.c */ | |
1456 | .suspend = iwl_mvm_suspend, | |
1457 | .resume = iwl_mvm_resume, | |
1458 | .set_wakeup = iwl_mvm_set_wakeup, | |
1459 | .set_rekey_data = iwl_mvm_set_rekey_data, | |
1460 | #if IS_ENABLED(CONFIG_IPV6) | |
1461 | .ipv6_addr_change = iwl_mvm_ipv6_addr_change, | |
1462 | #endif | |
1463 | .set_default_unicast_key = iwl_mvm_set_default_unicast_key, | |
1464 | #endif | |
1465 | }; |