1 | /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ |
2 | /* |
3 | * Copyright (C) 2012-2014, 2018-2024 Intel Corporation |
4 | * Copyright (C) 2013-2015 Intel Mobile Communications GmbH |
5 | * Copyright (C) 2016-2017 Intel Deutschland GmbH |
6 | */ |
7 | #ifndef __IWL_MVM_H__ |
8 | #define __IWL_MVM_H__ |
9 | |
10 | #include <linux/list.h> |
11 | #include <linux/spinlock.h> |
12 | #include <linux/leds.h> |
13 | #include <linux/in6.h> |
14 | |
15 | #ifdef CONFIG_THERMAL |
16 | #include <linux/thermal.h> |
17 | #endif |
18 | |
19 | #include <linux/ptp_clock_kernel.h> |
20 | |
21 | #include <linux/ktime.h> |
22 | |
23 | #include "iwl-op-mode.h" |
24 | #include "iwl-trans.h" |
25 | #include "fw/notif-wait.h" |
26 | #include "iwl-eeprom-parse.h" |
27 | #include "fw/file.h" |
28 | #include "iwl-config.h" |
29 | #include "sta.h" |
30 | #include "fw-api.h" |
31 | #include "constants.h" |
32 | #include "fw/runtime.h" |
33 | #include "fw/dbg.h" |
34 | #include "fw/acpi.h" |
35 | #include "mei/iwl-mei.h" |
36 | #include "iwl-nvm-parse.h" |
37 | |
38 | #include <linux/average.h> |
39 | |
40 | #define IWL_MVM_MAX_ADDRESSES 5 |
41 | /* RSSI offset for WkP */ |
42 | #define 50 |
43 | #define IWL_MVM_MISSED_BEACONS_SINCE_RX_THOLD 4 |
44 | #define IWL_MVM_MISSED_BEACONS_THRESHOLD 8 |
45 | #define IWL_MVM_MISSED_BEACONS_THRESHOLD_LONG 19 |
46 | |
47 | /* A TimeUnit is 1024 microsecond */ |
48 | #define MSEC_TO_TU(_msec) (_msec*1000/1024) |
49 | |
50 | /* For GO, this value represents the number of TUs before CSA "beacon |
51 | * 0" TBTT when the CSA time-event needs to be scheduled to start. It |
52 | * must be big enough to ensure that we switch in time. |
53 | */ |
54 | #define IWL_MVM_CHANNEL_SWITCH_TIME_GO 40 |
55 | |
56 | /* For client, this value represents the number of TUs before CSA |
57 | * "beacon 1" TBTT, instead. This is because we don't know when the |
58 | * GO/AP will be in the new channel, so we switch early enough. |
59 | */ |
60 | #define IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT 10 |
61 | |
62 | /* |
63 | * This value (in TUs) is used to fine tune the CSA NoA end time which should |
64 | * be just before "beacon 0" TBTT. |
65 | */ |
66 | #define IWL_MVM_CHANNEL_SWITCH_MARGIN 4 |
67 | |
68 | /* |
69 | * Number of beacons to transmit on a new channel until we unblock tx to |
70 | * the stations, even if we didn't identify them on a new channel |
71 | */ |
72 | #define IWL_MVM_CS_UNBLOCK_TX_TIMEOUT 3 |
73 | |
74 | /* offchannel queue towards mac80211 */ |
75 | #define IWL_MVM_OFFCHANNEL_QUEUE 0 |
76 | |
77 | /* invalid value for FW link id */ |
78 | #define IWL_MVM_FW_LINK_ID_INVALID 0xff |
79 | |
80 | extern const struct ieee80211_ops iwl_mvm_hw_ops; |
81 | extern const struct ieee80211_ops iwl_mvm_mld_hw_ops; |
82 | |
83 | /** |
84 | * struct iwl_mvm_mod_params - module parameters for iwlmvm |
85 | * @init_dbg: if true, then the NIC won't be stopped if the INIT fw asserted. |
86 | * We will register to mac80211 to have testmode working. The NIC must not |
87 | * be up'ed after the INIT fw asserted. This is useful to be able to use |
88 | * proprietary tools over testmode to debug the INIT fw. |
89 | * @power_scheme: one of enum iwl_power_scheme |
90 | */ |
91 | struct iwl_mvm_mod_params { |
92 | bool init_dbg; |
93 | int power_scheme; |
94 | }; |
95 | extern struct iwl_mvm_mod_params iwlmvm_mod_params; |
96 | |
97 | struct iwl_mvm_phy_ctxt { |
98 | u16 id; |
99 | u16 color; |
100 | u32 ref; |
101 | |
102 | enum nl80211_chan_width width; |
103 | |
104 | struct ieee80211_channel *channel; |
105 | |
106 | /* track for RLC config command */ |
107 | u32 center_freq1; |
108 | bool rlc_disabled; |
109 | u32 channel_load_by_us; |
110 | }; |
111 | |
112 | struct iwl_mvm_time_event_data { |
113 | struct ieee80211_vif *vif; |
114 | struct list_head list; |
115 | unsigned long end_jiffies; |
116 | u32 duration; |
117 | bool running; |
118 | u32 uid; |
119 | |
120 | /* |
121 | * The access to the 'id' field must be done when the |
122 | * mvm->time_event_lock is held, as it value is used to indicate |
123 | * if the te is in the time event list or not (when id == TE_MAX) |
124 | */ |
125 | u32 id; |
126 | s8 link_id; |
127 | }; |
128 | |
129 | /* Power management */ |
130 | |
131 | /** |
132 | * enum iwl_power_scheme |
133 | * @IWL_POWER_SCHEME_CAM: Continuously Active Mode |
134 | * @IWL_POWER_SCHEME_BPS: Balanced Power Save (default) |
135 | * @IWL_POWER_SCHEME_LP: Low Power |
136 | */ |
137 | enum iwl_power_scheme { |
138 | IWL_POWER_SCHEME_CAM = 1, |
139 | IWL_POWER_SCHEME_BPS, |
140 | IWL_POWER_SCHEME_LP |
141 | }; |
142 | |
143 | #define IWL_UAPSD_MAX_SP IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL |
144 | |
145 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
146 | enum iwl_dbgfs_pm_mask { |
147 | MVM_DEBUGFS_PM_KEEP_ALIVE = BIT(0), |
148 | MVM_DEBUGFS_PM_SKIP_OVER_DTIM = BIT(1), |
149 | MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS = BIT(2), |
150 | MVM_DEBUGFS_PM_RX_DATA_TIMEOUT = BIT(3), |
151 | MVM_DEBUGFS_PM_TX_DATA_TIMEOUT = BIT(4), |
152 | MVM_DEBUGFS_PM_LPRX_ENA = BIT(6), |
153 | = BIT(7), |
154 | MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8), |
155 | MVM_DEBUGFS_PM_UAPSD_MISBEHAVING = BIT(9), |
156 | MVM_DEBUGFS_PM_USE_PS_POLL = BIT(10), |
157 | }; |
158 | |
159 | struct iwl_dbgfs_pm { |
160 | u16 keep_alive_seconds; |
161 | u32 rx_data_timeout; |
162 | u32 tx_data_timeout; |
163 | bool skip_over_dtim; |
164 | u8 skip_dtim_periods; |
165 | bool lprx_ena; |
166 | u32 ; |
167 | bool snooze_ena; |
168 | bool uapsd_misbehaving; |
169 | bool use_ps_poll; |
170 | int mask; |
171 | }; |
172 | |
173 | /* beacon filtering */ |
174 | |
175 | enum iwl_dbgfs_bf_mask { |
176 | MVM_DEBUGFS_BF_ENERGY_DELTA = BIT(0), |
177 | MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA = BIT(1), |
178 | MVM_DEBUGFS_BF_ROAMING_STATE = BIT(2), |
179 | MVM_DEBUGFS_BF_TEMP_THRESHOLD = BIT(3), |
180 | MVM_DEBUGFS_BF_TEMP_FAST_FILTER = BIT(4), |
181 | MVM_DEBUGFS_BF_TEMP_SLOW_FILTER = BIT(5), |
182 | MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER = BIT(6), |
183 | MVM_DEBUGFS_BF_DEBUG_FLAG = BIT(7), |
184 | MVM_DEBUGFS_BF_ESCAPE_TIMER = BIT(8), |
185 | MVM_DEBUGFS_BA_ESCAPE_TIMER = BIT(9), |
186 | MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT = BIT(10), |
187 | }; |
188 | |
189 | struct iwl_dbgfs_bf { |
190 | u32 bf_energy_delta; |
191 | u32 bf_roaming_energy_delta; |
192 | u32 bf_roaming_state; |
193 | u32 bf_temp_threshold; |
194 | u32 bf_temp_fast_filter; |
195 | u32 bf_temp_slow_filter; |
196 | u32 bf_enable_beacon_filter; |
197 | u32 bf_debug_flag; |
198 | u32 bf_escape_timer; |
199 | u32 ba_escape_timer; |
200 | u32 ba_enable_beacon_abort; |
201 | int mask; |
202 | }; |
203 | #endif |
204 | |
205 | enum iwl_mvm_smps_type_request { |
206 | IWL_MVM_SMPS_REQ_BT_COEX, |
207 | IWL_MVM_SMPS_REQ_TT, |
208 | IWL_MVM_SMPS_REQ_PROT, |
209 | IWL_MVM_SMPS_REQ_FW, |
210 | NUM_IWL_MVM_SMPS_REQ, |
211 | }; |
212 | |
213 | enum iwl_bt_force_ant_mode { |
214 | BT_FORCE_ANT_DIS = 0, |
215 | BT_FORCE_ANT_AUTO, |
216 | BT_FORCE_ANT_BT, |
217 | BT_FORCE_ANT_WIFI, |
218 | |
219 | BT_FORCE_ANT_MAX, |
220 | }; |
221 | |
222 | /** |
223 | * enum iwl_mvm_low_latency_force - low latency force mode set by debugfs |
224 | * @LOW_LATENCY_FORCE_UNSET: unset force mode |
225 | * @LOW_LATENCY_FORCE_ON: for low latency on |
226 | * @LOW_LATENCY_FORCE_OFF: for low latency off |
227 | * @NUM_LOW_LATENCY_FORCE: max num of modes |
228 | */ |
229 | enum iwl_mvm_low_latency_force { |
230 | LOW_LATENCY_FORCE_UNSET, |
231 | LOW_LATENCY_FORCE_ON, |
232 | LOW_LATENCY_FORCE_OFF, |
233 | NUM_LOW_LATENCY_FORCE |
234 | }; |
235 | |
236 | /** |
237 | * enum iwl_mvm_low_latency_cause - low latency set causes |
238 | * @LOW_LATENCY_TRAFFIC: indicates low latency traffic was detected |
239 | * @LOW_LATENCY_DEBUGFS: low latency mode set from debugfs |
240 | * @LOW_LATENCY_VCMD: low latency mode set from vendor command |
241 | * @LOW_LATENCY_VIF_TYPE: low latency mode set because of vif type (ap) |
242 | * @LOW_LATENCY_DEBUGFS_FORCE_ENABLE: indicate that force mode is enabled |
243 | * the actual set/unset is done with LOW_LATENCY_DEBUGFS_FORCE |
244 | * @LOW_LATENCY_DEBUGFS_FORCE: low latency force mode from debugfs |
245 | * set this with LOW_LATENCY_DEBUGFS_FORCE_ENABLE flag |
246 | * in low_latency. |
247 | */ |
248 | enum iwl_mvm_low_latency_cause { |
249 | LOW_LATENCY_TRAFFIC = BIT(0), |
250 | LOW_LATENCY_DEBUGFS = BIT(1), |
251 | LOW_LATENCY_VCMD = BIT(2), |
252 | LOW_LATENCY_VIF_TYPE = BIT(3), |
253 | LOW_LATENCY_DEBUGFS_FORCE_ENABLE = BIT(4), |
254 | LOW_LATENCY_DEBUGFS_FORCE = BIT(5), |
255 | }; |
256 | |
257 | /** |
258 | * struct iwl_mvm_vif_bf_data - beacon filtering related data |
259 | * @bf_enabled: indicates if beacon filtering is enabled |
260 | * @ba_enabled: indicated if beacon abort is enabled |
261 | * @ave_beacon_signal: average beacon signal |
262 | * @last_cqm_event: rssi of the last cqm event |
263 | * @bt_coex_min_thold: minimum threshold for BT coex |
264 | * @bt_coex_max_thold: maximum threshold for BT coex |
265 | * @last_bt_coex_event: rssi of the last BT coex event |
266 | */ |
267 | struct iwl_mvm_vif_bf_data { |
268 | bool bf_enabled; |
269 | bool ba_enabled; |
270 | int ave_beacon_signal; |
271 | int last_cqm_event; |
272 | int bt_coex_min_thold; |
273 | int bt_coex_max_thold; |
274 | int last_bt_coex_event; |
275 | }; |
276 | |
277 | /** |
278 | * struct iwl_probe_resp_data - data for NoA/CSA updates |
279 | * @rcu_head: used for freeing the data on update |
280 | * @notif: notification data |
281 | * @noa_len: length of NoA attribute, calculated from the notification |
282 | */ |
283 | struct iwl_probe_resp_data { |
284 | struct rcu_head rcu_head; |
285 | struct iwl_probe_resp_data_notif notif; |
286 | int noa_len; |
287 | }; |
288 | |
289 | /** |
290 | * struct iwl_mvm_vif_link_info - per link data in Virtual Interface |
291 | * @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA |
292 | * @fw_link_id: the id of the link according to the FW API |
293 | * @bssid: BSSID for this (client) interface |
294 | * @bcast_sta: station used for broadcast packets. Used by the following |
295 | * vifs: P2P_DEVICE, GO and AP. |
296 | * @beacon_stats: beacon statistics, containing the # of received beacons, |
297 | * # of received beacons accumulated over FW restart, and the current |
298 | * average signal of beacons retrieved from the firmware |
299 | * @smps_requests: the SMPS requests of different parts of the driver, |
300 | * combined on update to yield the overall request to mac80211. |
301 | * @probe_resp_data: data from FW notification to store NOA and CSA related |
302 | * data to be inserted into probe response. |
303 | * @he_ru_2mhz_block: 26-tone RU OFDMA transmissions should be blocked |
304 | * @queue_params: QoS params for this MAC |
305 | * @mgmt_queue: queue number for unbufferable management frames |
306 | * @igtk: the current IGTK programmed into the firmware |
307 | * @active: indicates the link is active in FW (for sanity checking) |
308 | * @cab_queue: content-after-beacon (multicast) queue |
309 | * @listen_lmac: indicates this link is allocated to the listen LMAC |
310 | * @mcast_sta: multicast station |
311 | * @phy_ctxt: phy context allocated to this link, if any |
312 | */ |
313 | struct iwl_mvm_vif_link_info { |
314 | u8 bssid[ETH_ALEN]; |
315 | u8 ap_sta_id; |
316 | u8 fw_link_id; |
317 | |
318 | struct iwl_mvm_int_sta bcast_sta; |
319 | struct iwl_mvm_int_sta mcast_sta; |
320 | |
321 | struct { |
322 | u32 num_beacons, accu_num_beacons; |
323 | u8 avg_signal; |
324 | } beacon_stats; |
325 | |
326 | enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ]; |
327 | struct iwl_probe_resp_data __rcu *probe_resp_data; |
328 | |
329 | struct ieee80211_key_conf *igtk; |
330 | |
331 | bool he_ru_2mhz_block; |
332 | bool active; |
333 | bool listen_lmac; |
334 | |
335 | u16 cab_queue; |
336 | /* Assigned while mac80211 has the link in a channel context, |
337 | * or, for P2P Device, while it exists. |
338 | */ |
339 | struct iwl_mvm_phy_ctxt *phy_ctxt; |
340 | /* QoS data from mac80211, need to store this here |
341 | * as mac80211 has a separate callback but we need |
342 | * to have the data for the MAC context |
343 | */ |
344 | struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; |
345 | |
346 | u16 mgmt_queue; |
347 | }; |
348 | |
349 | /** |
350 | * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context |
351 | * @mvm: pointer back to the mvm struct |
352 | * @id: between 0 and 3 |
353 | * @color: to solve races upon MAC addition and removal |
354 | * @associated: indicates that we're currently associated, used only for |
355 | * managing the firmware state in iwl_mvm_bss_info_changed_station() |
356 | * @ap_assoc_sta_count: count of stations associated to us - valid only |
357 | * if VIF type is AP |
358 | * @uploaded: indicates the MAC context has been added to the device |
359 | * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface |
360 | * should get quota etc. |
361 | * @pm_enabled - indicate if MAC power management is allowed |
362 | * @monitor_active: indicates that monitor context is configured, and that the |
363 | * interface should get quota etc. |
364 | * @bt_coex_esr_disabled: indicates if esr is disabled due to bt coex |
365 | * @low_latency: bit flags for low latency |
366 | * see enum &iwl_mvm_low_latency_cause for causes. |
367 | * @low_latency_actual: boolean, indicates low latency is set, |
368 | * as a result from low_latency bit flags and takes force into account. |
369 | * @authorized: indicates the AP station was set to authorized |
370 | * @ps_disabled: indicates that this interface requires PS to be disabled |
371 | * @csa_countdown: indicates that CSA countdown may be started |
372 | * @csa_failed: CSA failed to schedule time event, report an error later |
373 | * @csa_bcn_pending: indicates that we are waiting for a beacon on a new channel |
374 | * @features: hw features active for this vif |
375 | * @ap_beacon_time: AP beacon time for synchronisation (on older FW) |
376 | * @bcn_prot: beacon protection data (keys; FIXME: needs to be per link) |
377 | * @bf_data: beacon filtering data |
378 | * @deflink: default link data for use in non-MLO |
379 | * @link: link data for each link in MLO |
380 | * @esr_active: indicates eSR mode is active |
381 | * @pm_enabled: indicates powersave is enabled |
382 | */ |
383 | struct iwl_mvm_vif { |
384 | struct iwl_mvm *mvm; |
385 | u16 id; |
386 | u16 color; |
387 | |
388 | bool associated; |
389 | u8 ap_assoc_sta_count; |
390 | bool uploaded; |
391 | bool ap_ibss_active; |
392 | bool pm_enabled; |
393 | bool monitor_active; |
394 | bool esr_active; |
395 | bool bt_coex_esr_disabled; |
396 | |
397 | u8 low_latency: 6; |
398 | u8 low_latency_actual: 1; |
399 | |
400 | u8 authorized:1; |
401 | bool ps_disabled; |
402 | |
403 | u32 ap_beacon_time; |
404 | struct iwl_mvm_vif_bf_data bf_data; |
405 | |
406 | #ifdef CONFIG_PM |
407 | /* WoWLAN GTK rekey data */ |
408 | struct { |
409 | u8 kck[NL80211_KCK_EXT_LEN]; |
410 | u8 kek[NL80211_KEK_EXT_LEN]; |
411 | size_t kek_len; |
412 | size_t kck_len; |
413 | u32 akm; |
414 | __le64 replay_ctr; |
415 | bool valid; |
416 | } rekey_data; |
417 | |
418 | int tx_key_idx; |
419 | |
420 | bool seqno_valid; |
421 | u16 seqno; |
422 | #endif |
423 | |
424 | #if IS_ENABLED(CONFIG_IPV6) |
425 | /* IPv6 addresses for WoWLAN */ |
426 | struct in6_addr target_ipv6_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX]; |
427 | unsigned long tentative_addrs[BITS_TO_LONGS(IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX)]; |
428 | int num_target_ipv6_addrs; |
429 | #endif |
430 | |
431 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
432 | struct dentry *dbgfs_dir; |
433 | struct dentry *dbgfs_slink; |
434 | struct iwl_dbgfs_pm dbgfs_pm; |
435 | struct iwl_dbgfs_bf dbgfs_bf; |
436 | struct iwl_mac_power_cmd mac_pwr_cmd; |
437 | int dbgfs_quota_min; |
438 | #endif |
439 | |
440 | /* FW identified misbehaving AP */ |
441 | u8 uapsd_misbehaving_ap_addr[ETH_ALEN] __aligned(2); |
442 | struct delayed_work uapsd_nonagg_detected_wk; |
443 | |
444 | bool csa_countdown; |
445 | bool csa_failed; |
446 | bool csa_bcn_pending; |
447 | u16 csa_target_freq; |
448 | u16 csa_count; |
449 | u16 csa_misbehave; |
450 | struct delayed_work csa_work; |
451 | |
452 | enum iwl_tsf_id tsf_id; |
453 | |
454 | struct iwl_mvm_time_event_data time_event_data; |
455 | struct iwl_mvm_time_event_data hs_time_event_data; |
456 | |
457 | /* TCP Checksum Offload */ |
458 | netdev_features_t features; |
459 | |
460 | struct ieee80211_sta *ap_sta; |
461 | |
462 | /* we can only have 2 GTK + 2 IGTK active at a time */ |
463 | struct ieee80211_key_conf *ap_early_keys[4]; |
464 | |
465 | struct { |
466 | struct ieee80211_key_conf __rcu *keys[2]; |
467 | } bcn_prot; |
468 | |
469 | struct iwl_mvm_vif_link_info deflink; |
470 | struct iwl_mvm_vif_link_info *link[IEEE80211_MLD_MAX_NUM_LINKS]; |
471 | }; |
472 | |
473 | #define for_each_mvm_vif_valid_link(mvm_vif, link_id) \ |
474 | for (link_id = 0; \ |
475 | link_id < ARRAY_SIZE((mvm_vif)->link); \ |
476 | link_id++) \ |
477 | if ((mvm_vif)->link[link_id]) |
478 | |
479 | static inline struct iwl_mvm_vif * |
480 | iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) |
481 | { |
482 | return (void *)vif->drv_priv; |
483 | } |
484 | |
485 | extern const u8 tid_to_mac80211_ac[]; |
486 | |
487 | #define IWL_MVM_SCAN_STOPPING_SHIFT 8 |
488 | |
489 | enum iwl_scan_status { |
490 | IWL_MVM_SCAN_REGULAR = BIT(0), |
491 | IWL_MVM_SCAN_SCHED = BIT(1), |
492 | IWL_MVM_SCAN_NETDETECT = BIT(2), |
493 | |
494 | IWL_MVM_SCAN_STOPPING_REGULAR = BIT(8), |
495 | IWL_MVM_SCAN_STOPPING_SCHED = BIT(9), |
496 | IWL_MVM_SCAN_STOPPING_NETDETECT = BIT(10), |
497 | |
498 | IWL_MVM_SCAN_REGULAR_MASK = IWL_MVM_SCAN_REGULAR | |
499 | IWL_MVM_SCAN_STOPPING_REGULAR, |
500 | IWL_MVM_SCAN_SCHED_MASK = IWL_MVM_SCAN_SCHED | |
501 | IWL_MVM_SCAN_STOPPING_SCHED, |
502 | IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT | |
503 | IWL_MVM_SCAN_STOPPING_NETDETECT, |
504 | |
505 | IWL_MVM_SCAN_STOPPING_MASK = 0xff << IWL_MVM_SCAN_STOPPING_SHIFT, |
506 | IWL_MVM_SCAN_MASK = 0xff, |
507 | }; |
508 | |
509 | enum iwl_mvm_scan_type { |
510 | IWL_SCAN_TYPE_NOT_SET, |
511 | IWL_SCAN_TYPE_UNASSOC, |
512 | IWL_SCAN_TYPE_WILD, |
513 | IWL_SCAN_TYPE_MILD, |
514 | IWL_SCAN_TYPE_FRAGMENTED, |
515 | IWL_SCAN_TYPE_FAST_BALANCE, |
516 | }; |
517 | |
518 | enum iwl_mvm_sched_scan_pass_all_states { |
519 | SCHED_SCAN_PASS_ALL_DISABLED, |
520 | SCHED_SCAN_PASS_ALL_ENABLED, |
521 | SCHED_SCAN_PASS_ALL_FOUND, |
522 | }; |
523 | |
524 | /** |
525 | * struct iwl_mvm_tt_mgnt - Thermal Throttling Management structure |
526 | * @ct_kill_exit: worker to exit thermal kill |
527 | * @dynamic_smps: Is thermal throttling enabled dynamic_smps? |
528 | * @tx_backoff: The current thremal throttling tx backoff in uSec. |
529 | * @min_backoff: The minimal tx backoff due to power restrictions |
530 | * @params: Parameters to configure the thermal throttling algorithm. |
531 | * @throttle: Is thermal throttling is active? |
532 | */ |
533 | struct iwl_mvm_tt_mgmt { |
534 | struct delayed_work ct_kill_exit; |
535 | bool dynamic_smps; |
536 | u32 tx_backoff; |
537 | u32 min_backoff; |
538 | struct iwl_tt_params params; |
539 | bool throttle; |
540 | }; |
541 | |
542 | #ifdef CONFIG_THERMAL |
543 | /** |
544 | * struct iwl_mvm_thermal_device - thermal zone related data |
545 | * @trips: temperature thresholds for report |
546 | * @tzone: thermal zone device data |
547 | */ |
548 | struct iwl_mvm_thermal_device { |
549 | struct thermal_trip trips[IWL_MAX_DTS_TRIPS]; |
550 | struct thermal_zone_device *tzone; |
551 | }; |
552 | |
553 | /* |
554 | * struct iwl_mvm_cooling_device |
555 | * @cur_state: current state |
556 | * @cdev: struct thermal cooling device |
557 | */ |
558 | struct iwl_mvm_cooling_device { |
559 | u32 cur_state; |
560 | struct thermal_cooling_device *cdev; |
561 | }; |
562 | #endif |
563 | |
564 | #define IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES 8 |
565 | |
566 | struct iwl_mvm_frame_stats { |
567 | u32 legacy_frames; |
568 | u32 ht_frames; |
569 | u32 vht_frames; |
570 | u32 bw_20_frames; |
571 | u32 bw_40_frames; |
572 | u32 bw_80_frames; |
573 | u32 bw_160_frames; |
574 | u32 sgi_frames; |
575 | u32 ngi_frames; |
576 | u32 siso_frames; |
577 | u32 mimo2_frames; |
578 | u32 agg_frames; |
579 | u32 ampdu_count; |
580 | u32 success_frames; |
581 | u32 fail_frames; |
582 | u32 last_rates[IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES]; |
583 | int last_frame_idx; |
584 | }; |
585 | |
586 | #define IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE 0xff |
587 | #define IWL_MVM_DEBUG_SET_TEMPERATURE_MIN -100 |
588 | #define IWL_MVM_DEBUG_SET_TEMPERATURE_MAX 200 |
589 | |
590 | enum iwl_mvm_tdls_cs_state { |
591 | IWL_MVM_TDLS_SW_IDLE = 0, |
592 | IWL_MVM_TDLS_SW_REQ_SENT, |
593 | IWL_MVM_TDLS_SW_RESP_RCVD, |
594 | IWL_MVM_TDLS_SW_REQ_RCVD, |
595 | IWL_MVM_TDLS_SW_ACTIVE, |
596 | }; |
597 | |
598 | enum iwl_mvm_traffic_load { |
599 | IWL_MVM_TRAFFIC_LOW, |
600 | IWL_MVM_TRAFFIC_MEDIUM, |
601 | IWL_MVM_TRAFFIC_HIGH, |
602 | }; |
603 | |
604 | DECLARE_EWMA(rate, 16, 16) |
605 | |
606 | struct iwl_mvm_tcm_mac { |
607 | struct { |
608 | u32 pkts[IEEE80211_NUM_ACS]; |
609 | u32 airtime; |
610 | } tx; |
611 | struct { |
612 | u32 pkts[IEEE80211_NUM_ACS]; |
613 | u32 airtime; |
614 | u32 last_ampdu_ref; |
615 | } rx; |
616 | struct { |
617 | /* track AP's transfer in client mode */ |
618 | u64 rx_bytes; |
619 | struct ewma_rate rate; |
620 | bool detected; |
621 | } uapsd_nonagg_detect; |
622 | bool opened_rx_ba_sessions; |
623 | }; |
624 | |
625 | struct iwl_mvm_tcm { |
626 | struct delayed_work work; |
627 | spinlock_t lock; /* used when time elapsed */ |
628 | unsigned long ts; /* timestamp when period ends */ |
629 | unsigned long ll_ts; |
630 | unsigned long uapsd_nonagg_ts; |
631 | bool paused; |
632 | struct iwl_mvm_tcm_mac data[NUM_MAC_INDEX_DRIVER]; |
633 | struct { |
634 | u32 elapsed; /* milliseconds for this TCM period */ |
635 | u32 airtime[NUM_MAC_INDEX_DRIVER]; |
636 | enum iwl_mvm_traffic_load load[NUM_MAC_INDEX_DRIVER]; |
637 | enum iwl_mvm_traffic_load band_load[NUM_NL80211_BANDS]; |
638 | enum iwl_mvm_traffic_load global_load; |
639 | bool low_latency[NUM_MAC_INDEX_DRIVER]; |
640 | bool change[NUM_MAC_INDEX_DRIVER]; |
641 | } result; |
642 | }; |
643 | |
644 | /** |
645 | * struct iwl_mvm_reorder_buffer - per ra/tid/queue reorder buffer |
646 | * @head_sn: reorder window head sn |
647 | * @num_stored: number of mpdus stored in the buffer |
648 | * @buf_size: the reorder buffer size as set by the last addba request |
649 | * @queue: queue of this reorder buffer |
650 | * @last_amsdu: track last ASMDU SN for duplication detection |
651 | * @last_sub_index: track ASMDU sub frame index for duplication detection |
652 | * @valid: reordering is valid for this queue |
653 | * @lock: protect reorder buffer internal state |
654 | * @mvm: mvm pointer, needed for frame timer context |
655 | */ |
656 | struct iwl_mvm_reorder_buffer { |
657 | u16 head_sn; |
658 | u16 num_stored; |
659 | u16 buf_size; |
660 | int queue; |
661 | u16 last_amsdu; |
662 | u8 last_sub_index; |
663 | bool valid; |
664 | spinlock_t lock; |
665 | struct iwl_mvm *mvm; |
666 | } ____cacheline_aligned_in_smp; |
667 | |
668 | /** |
669 | * struct iwl_mvm_reorder_buf_entry - reorder buffer entry per-queue/per-seqno |
670 | * @frames: list of skbs stored |
671 | */ |
672 | struct iwl_mvm_reorder_buf_entry { |
673 | struct sk_buff_head frames; |
674 | } |
675 | #ifndef __CHECKER__ |
676 | /* sparse doesn't like this construct: "bad integer constant expression" */ |
677 | __aligned(roundup_pow_of_two(sizeof(struct sk_buff_head))) |
678 | #endif |
679 | ; |
680 | |
681 | /** |
682 | * struct iwl_mvm_baid_data - BA session data |
683 | * @sta_mask: current station mask for the BAID |
684 | * @tid: tid of the session |
685 | * @baid: baid of the session |
686 | * @timeout: the timeout set in the addba request |
687 | * @entries_per_queue: # of buffers per queue, this actually gets |
688 | * aligned up to avoid cache line sharing between queues |
689 | * @last_rx: last rx jiffies, updated only if timeout passed from last update |
690 | * @session_timer: timer to check if BA session expired, runs at 2 * timeout |
691 | * @rcu_ptr: BA data RCU protected access |
692 | * @rcu_head: RCU head for freeing this data |
693 | * @mvm: mvm pointer, needed for timer context |
694 | * @reorder_buf: reorder buffer, allocated per queue |
695 | * @entries: data |
696 | */ |
697 | struct iwl_mvm_baid_data { |
698 | struct rcu_head rcu_head; |
699 | u32 sta_mask; |
700 | u8 tid; |
701 | u8 baid; |
702 | u16 timeout; |
703 | u16 entries_per_queue; |
704 | unsigned long last_rx; |
705 | struct timer_list session_timer; |
706 | struct iwl_mvm_baid_data __rcu **rcu_ptr; |
707 | struct iwl_mvm *mvm; |
708 | struct iwl_mvm_reorder_buffer reorder_buf[IWL_MAX_RX_HW_QUEUES]; |
709 | struct iwl_mvm_reorder_buf_entry entries[]; |
710 | }; |
711 | |
712 | static inline struct iwl_mvm_baid_data * |
713 | iwl_mvm_baid_data_from_reorder_buf(struct iwl_mvm_reorder_buffer *buf) |
714 | { |
715 | return (void *)((u8 *)buf - |
716 | offsetof(struct iwl_mvm_baid_data, reorder_buf) - |
717 | sizeof(*buf) * buf->queue); |
718 | } |
719 | |
720 | /* |
721 | * enum iwl_mvm_queue_status - queue status |
722 | * @IWL_MVM_QUEUE_FREE: the queue is not allocated nor reserved |
723 | * Basically, this means that this queue can be used for any purpose |
724 | * @IWL_MVM_QUEUE_RESERVED: queue is reserved but not yet in use |
725 | * This is the state of a queue that has been dedicated for some RATID |
726 | * (agg'd or not), but that hasn't yet gone through the actual enablement |
727 | * of iwl_mvm_enable_txq(), and therefore no traffic can go through it yet. |
728 | * Note that in this state there is no requirement to already know what TID |
729 | * should be used with this queue, it is just marked as a queue that will |
730 | * be used, and shouldn't be allocated to anyone else. |
731 | * @IWL_MVM_QUEUE_READY: queue is ready to be used |
732 | * This is the state of a queue that has been fully configured (including |
733 | * SCD pointers, etc), has a specific RA/TID assigned to it, and can be |
734 | * used to send traffic. |
735 | * @IWL_MVM_QUEUE_SHARED: queue is shared, or in a process of becoming shared |
736 | * This is a state in which a single queue serves more than one TID, all of |
737 | * which are not aggregated. Note that the queue is only associated to one |
738 | * RA. |
739 | */ |
740 | enum iwl_mvm_queue_status { |
741 | IWL_MVM_QUEUE_FREE, |
742 | IWL_MVM_QUEUE_RESERVED, |
743 | IWL_MVM_QUEUE_READY, |
744 | IWL_MVM_QUEUE_SHARED, |
745 | }; |
746 | |
747 | #define IWL_MVM_DQA_QUEUE_TIMEOUT (5 * HZ) |
748 | #define IWL_MVM_INVALID_QUEUE 0xFFFF |
749 | |
750 | #define IWL_MVM_NUM_CIPHERS 10 |
751 | |
752 | |
753 | struct iwl_mvm_txq { |
754 | struct list_head list; |
755 | u16 txq_id; |
756 | atomic_t tx_request; |
757 | #define IWL_MVM_TXQ_STATE_STOP_FULL 0 |
758 | #define IWL_MVM_TXQ_STATE_STOP_REDIRECT 1 |
759 | #define IWL_MVM_TXQ_STATE_READY 2 |
760 | unsigned long state; |
761 | }; |
762 | |
763 | static inline struct iwl_mvm_txq * |
764 | iwl_mvm_txq_from_mac80211(struct ieee80211_txq *txq) |
765 | { |
766 | return (void *)txq->drv_priv; |
767 | } |
768 | |
769 | static inline struct iwl_mvm_txq * |
770 | iwl_mvm_txq_from_tid(struct ieee80211_sta *sta, u8 tid) |
771 | { |
772 | if (tid == IWL_MAX_TID_COUNT) |
773 | tid = IEEE80211_NUM_TIDS; |
774 | |
775 | return (void *)sta->txq[tid]->drv_priv; |
776 | } |
777 | |
778 | /** |
779 | * struct iwl_mvm_tvqm_txq_info - maps TVQM hw queue to tid |
780 | * |
781 | * @sta_id: sta id |
782 | * @txq_tid: txq tid |
783 | */ |
784 | struct iwl_mvm_tvqm_txq_info { |
785 | u8 sta_id; |
786 | u8 txq_tid; |
787 | }; |
788 | |
789 | struct iwl_mvm_dqa_txq_info { |
790 | u8 ra_sta_id; /* The RA this queue is mapped to, if exists */ |
791 | bool reserved; /* Is this the TXQ reserved for a STA */ |
792 | u8 mac80211_ac; /* The mac80211 AC this queue is mapped to */ |
793 | u8 txq_tid; /* The TID "owner" of this queue*/ |
794 | u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */ |
795 | /* Timestamp for inactivation per TID of this queue */ |
796 | unsigned long last_frame_time[IWL_MAX_TID_COUNT + 1]; |
797 | enum iwl_mvm_queue_status status; |
798 | }; |
799 | |
800 | struct ptp_data { |
801 | struct ptp_clock *ptp_clock; |
802 | struct ptp_clock_info ptp_clock_info; |
803 | |
804 | struct delayed_work dwork; |
805 | |
806 | /* The last GP2 reading from the hw */ |
807 | u32 last_gp2; |
808 | |
809 | /* number of wraparounds since scale_update_adj_time_ns */ |
810 | u32 wrap_counter; |
811 | |
812 | /* GP2 time when the scale was last updated */ |
813 | u32 scale_update_gp2; |
814 | |
815 | /* Adjusted time when the scale was last updated in nanoseconds */ |
816 | u64 scale_update_adj_time_ns; |
817 | |
818 | /* clock frequency offset, scaled to 65536000000 */ |
819 | u64 scaled_freq; |
820 | |
821 | /* Delta between hardware clock and ptp clock in nanoseconds */ |
822 | s64 delta; |
823 | }; |
824 | |
825 | struct iwl_time_sync_data { |
826 | struct sk_buff_head frame_list; |
827 | u8 peer_addr[ETH_ALEN]; |
828 | bool active; |
829 | }; |
830 | |
831 | struct iwl_mei_scan_filter { |
832 | bool is_mei_limited_scan; |
833 | struct sk_buff_head scan_res; |
834 | struct work_struct scan_work; |
835 | }; |
836 | |
837 | struct iwl_mvm { |
838 | /* for logger access */ |
839 | struct device *dev; |
840 | |
841 | struct iwl_trans *trans; |
842 | const struct iwl_fw *fw; |
843 | const struct iwl_cfg *cfg; |
844 | struct iwl_phy_db *phy_db; |
845 | struct ieee80211_hw *hw; |
846 | |
847 | /* for protecting access to iwl_mvm */ |
848 | struct mutex mutex; |
849 | struct list_head async_handlers_list; |
850 | spinlock_t async_handlers_lock; |
851 | struct work_struct async_handlers_wk; |
852 | |
853 | /* For async rx handlers that require the wiphy lock */ |
854 | struct wiphy_work async_handlers_wiphy_wk; |
855 | |
856 | struct work_struct roc_done_wk; |
857 | |
858 | unsigned long init_status; |
859 | |
860 | unsigned long status; |
861 | |
862 | u32 queue_sync_cookie; |
863 | unsigned long queue_sync_state; |
864 | /* |
865 | * for beacon filtering - |
866 | * currently only one interface can be supported |
867 | */ |
868 | struct iwl_mvm_vif *bf_allowed_vif; |
869 | |
870 | bool hw_registered; |
871 | bool rfkill_safe_init_done; |
872 | |
873 | u8 cca_40mhz_workaround; |
874 | |
875 | u32 ampdu_ref; |
876 | bool ampdu_toggle; |
877 | |
878 | struct iwl_notif_wait_data notif_wait; |
879 | |
880 | union { |
881 | struct mvm_statistics_rx_v3 rx_stats_v3; |
882 | struct mvm_statistics_rx rx_stats; |
883 | }; |
884 | |
885 | struct { |
886 | u64 rx_time; |
887 | u64 tx_time; |
888 | u64 on_time_rf; |
889 | u64 on_time_scan; |
890 | } radio_stats, accu_radio_stats; |
891 | |
892 | struct list_head add_stream_txqs; |
893 | union { |
894 | struct iwl_mvm_dqa_txq_info queue_info[IWL_MAX_HW_QUEUES]; |
895 | struct iwl_mvm_tvqm_txq_info tvqm_info[IWL_MAX_TVQM_QUEUES]; |
896 | }; |
897 | struct work_struct add_stream_wk; /* To add streams to queues */ |
898 | spinlock_t add_stream_lock; |
899 | |
900 | const char *nvm_file_name; |
901 | struct iwl_nvm_data *nvm_data; |
902 | struct iwl_mei_nvm *mei_nvm_data; |
903 | struct iwl_mvm_csme_conn_info __rcu *csme_conn_info; |
904 | bool mei_rfkill_blocked; |
905 | bool mei_registered; |
906 | struct work_struct sap_connected_wk; |
907 | |
908 | /* |
909 | * NVM built based on the SAP data but that we can't free even after |
910 | * we get ownership because it contains the cfg80211's channel. |
911 | */ |
912 | struct iwl_nvm_data *temp_nvm_data; |
913 | |
914 | /* NVM sections */ |
915 | struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS]; |
916 | |
917 | struct iwl_fw_runtime fwrt; |
918 | |
919 | /* EEPROM MAC addresses */ |
920 | struct mac_address addresses[IWL_MVM_MAX_ADDRESSES]; |
921 | |
922 | /* data related to data path */ |
923 | struct iwl_rx_phy_info last_phy_info; |
924 | struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT_MAX]; |
925 | struct ieee80211_link_sta __rcu *fw_id_to_link_sta[IWL_MVM_STATION_COUNT_MAX]; |
926 | unsigned long fw_link_ids_map; |
927 | u8 rx_ba_sessions; |
928 | |
929 | /* configured by mac80211 */ |
930 | u32 rts_threshold; |
931 | |
932 | /* Scan status, cmd (pre-allocated) and auxiliary station */ |
933 | unsigned int scan_status; |
934 | size_t scan_cmd_size; |
935 | void *scan_cmd; |
936 | struct iwl_mcast_filter_cmd *mcast_filter_cmd; |
937 | /* For CDB this is low band scan type, for non-CDB - type. */ |
938 | enum iwl_mvm_scan_type scan_type; |
939 | enum iwl_mvm_scan_type hb_scan_type; |
940 | |
941 | enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all; |
942 | struct delayed_work scan_timeout_dwork; |
943 | |
944 | /* max number of simultaneous scans the FW supports */ |
945 | unsigned int max_scans; |
946 | |
947 | /* UMAC scan tracking */ |
948 | u32 scan_uid_status[IWL_MVM_MAX_UMAC_SCANS]; |
949 | |
950 | /* start time of last scan in TSF of the mac that requested the scan */ |
951 | u64 scan_start; |
952 | |
953 | /* the vif that requested the current scan */ |
954 | struct iwl_mvm_vif *scan_vif; |
955 | u8 scan_link_id; |
956 | |
957 | /* rx chain antennas set through debugfs for the scan command */ |
958 | u8 scan_rx_ant; |
959 | |
960 | /* Internal station */ |
961 | struct iwl_mvm_int_sta aux_sta; |
962 | struct iwl_mvm_int_sta snif_sta; |
963 | |
964 | bool last_ebs_successful; |
965 | |
966 | u8 scan_last_antenna_idx; /* to toggle TX between antennas */ |
967 | u8 mgmt_last_antenna_idx; |
968 | |
969 | u8 set_tx_ant; |
970 | u8 set_rx_ant; |
971 | |
972 | /* last smart fifo state that was successfully sent to firmware */ |
973 | enum iwl_sf_state sf_state; |
974 | |
975 | /* |
976 | * Leave this pointer outside the ifdef below so that it can be |
977 | * assigned without ifdef in the source code. |
978 | */ |
979 | struct dentry *debugfs_dir; |
980 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
981 | u32 dbgfs_sram_offset, dbgfs_sram_len; |
982 | u32 dbgfs_prph_reg_addr; |
983 | bool disable_power_off; |
984 | bool disable_power_off_d3; |
985 | bool beacon_inject_active; |
986 | |
987 | bool scan_iter_notif_enabled; |
988 | |
989 | struct debugfs_blob_wrapper nvm_hw_blob; |
990 | struct debugfs_blob_wrapper nvm_sw_blob; |
991 | struct debugfs_blob_wrapper nvm_calib_blob; |
992 | struct debugfs_blob_wrapper nvm_prod_blob; |
993 | struct debugfs_blob_wrapper nvm_phy_sku_blob; |
994 | struct debugfs_blob_wrapper nvm_reg_blob; |
995 | |
996 | struct iwl_mvm_frame_stats drv_rx_stats; |
997 | spinlock_t drv_stats_lock; |
998 | u16 dbgfs_rx_phyinfo; |
999 | #endif |
1000 | |
1001 | struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX]; |
1002 | |
1003 | struct list_head time_event_list; |
1004 | spinlock_t time_event_lock; |
1005 | |
1006 | /* |
1007 | * A bitmap indicating the index of the key in use. The firmware |
1008 | * can hold 16 keys at most. Reflect this fact. |
1009 | */ |
1010 | unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)]; |
1011 | u8 fw_key_deleted[STA_KEY_MAX_NUM]; |
1012 | |
1013 | struct ieee80211_vif __rcu *vif_id_to_mac[NUM_MAC_INDEX_DRIVER]; |
1014 | |
1015 | struct ieee80211_bss_conf __rcu *link_id_to_link_conf[IWL_MVM_FW_MAX_LINK_ID + 1]; |
1016 | |
1017 | /* -1 for always, 0 for never, >0 for that many times */ |
1018 | s8 fw_restart; |
1019 | u8 *error_recovery_buf; |
1020 | |
1021 | #ifdef CONFIG_IWLWIFI_LEDS |
1022 | struct led_classdev led; |
1023 | #endif |
1024 | |
1025 | struct ieee80211_vif *p2p_device_vif; |
1026 | |
1027 | #ifdef CONFIG_PM |
1028 | struct wiphy_wowlan_support wowlan; |
1029 | int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen; |
1030 | |
1031 | /* sched scan settings for net detect */ |
1032 | struct ieee80211_scan_ies nd_ies; |
1033 | struct cfg80211_match_set *nd_match_sets; |
1034 | int n_nd_match_sets; |
1035 | struct ieee80211_channel **nd_channels; |
1036 | int n_nd_channels; |
1037 | bool net_detect; |
1038 | u8 offload_tid; |
1039 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1040 | bool d3_wake_sysassert; |
1041 | bool d3_test_active; |
1042 | u32 d3_test_pme_ptr; |
1043 | struct ieee80211_vif *keep_vif; |
1044 | u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */ |
1045 | #endif |
1046 | #endif |
1047 | |
1048 | wait_queue_head_t rx_sync_waitq; |
1049 | |
1050 | /* BT-Coex */ |
1051 | struct iwl_bt_coex_profile_notif last_bt_notif; |
1052 | struct iwl_bt_coex_ci_cmd last_bt_ci_cmd; |
1053 | |
1054 | u8 bt_tx_prio; |
1055 | enum iwl_bt_force_ant_mode bt_force_ant_mode; |
1056 | |
1057 | /* Aux ROC */ |
1058 | struct list_head aux_roc_te_list; |
1059 | |
1060 | /* Thermal Throttling and CTkill */ |
1061 | struct iwl_mvm_tt_mgmt thermal_throttle; |
1062 | #ifdef CONFIG_THERMAL |
1063 | struct iwl_mvm_thermal_device tz_device; |
1064 | struct iwl_mvm_cooling_device cooling_dev; |
1065 | #endif |
1066 | |
1067 | s32 temperature; /* Celsius */ |
1068 | /* |
1069 | * Debug option to set the NIC temperature. This option makes the |
1070 | * driver think this is the actual NIC temperature, and ignore the |
1071 | * real temperature that is received from the fw |
1072 | */ |
1073 | bool temperature_test; /* Debug test temperature is enabled */ |
1074 | |
1075 | bool fw_static_smps_request; |
1076 | |
1077 | unsigned long bt_coex_last_tcm_ts; |
1078 | struct iwl_mvm_tcm tcm; |
1079 | |
1080 | u8 uapsd_noagg_bssid_write_idx; |
1081 | struct mac_address uapsd_noagg_bssids[IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM] |
1082 | __aligned(2); |
1083 | |
1084 | struct iwl_time_quota_cmd last_quota_cmd; |
1085 | |
1086 | #ifdef CONFIG_NL80211_TESTMODE |
1087 | u32 noa_duration; |
1088 | struct ieee80211_vif *noa_vif; |
1089 | #endif |
1090 | |
1091 | /* Tx queues */ |
1092 | u16 aux_queue; |
1093 | u16 snif_queue; |
1094 | u16 probe_queue; |
1095 | u16 p2p_dev_queue; |
1096 | |
1097 | /* Indicate if device power save is allowed */ |
1098 | u8 ps_disabled; /* u8 instead of bool to ease debugfs_create_* usage */ |
1099 | /* Indicate if 32Khz external clock is valid */ |
1100 | u32 ext_clock_valid; |
1101 | |
1102 | /* This vif used by CSME to send / receive traffic */ |
1103 | struct ieee80211_vif *csme_vif; |
1104 | struct ieee80211_vif __rcu *csa_vif; |
1105 | struct ieee80211_vif __rcu *csa_tx_blocked_vif; |
1106 | u8 csa_tx_block_bcn_timeout; |
1107 | |
1108 | /* system time of last beacon (for AP/GO interface) */ |
1109 | u32 ap_last_beacon_gp2; |
1110 | |
1111 | /* indicates that we transmitted the last beacon */ |
1112 | bool ibss_manager; |
1113 | |
1114 | bool lar_regdom_set; |
1115 | enum iwl_mcc_source mcc_src; |
1116 | |
1117 | /* TDLS channel switch data */ |
1118 | struct { |
1119 | struct delayed_work dwork; |
1120 | enum iwl_mvm_tdls_cs_state state; |
1121 | |
1122 | /* |
1123 | * Current cs sta - might be different from periodic cs peer |
1124 | * station. Value is meaningless when the cs-state is idle. |
1125 | */ |
1126 | u8 cur_sta_id; |
1127 | |
1128 | /* TDLS periodic channel-switch peer */ |
1129 | struct { |
1130 | u8 sta_id; |
1131 | u8 op_class; |
1132 | bool initiator; /* are we the link initiator */ |
1133 | struct cfg80211_chan_def chandef; |
1134 | struct sk_buff *skb; /* ch sw template */ |
1135 | u32 ch_sw_tm_ie; |
1136 | |
1137 | /* timestamp of last ch-sw request sent (GP2 time) */ |
1138 | u32 sent_timestamp; |
1139 | } peer; |
1140 | } tdls_cs; |
1141 | |
1142 | |
1143 | u32 ciphers[IWL_MVM_NUM_CIPHERS]; |
1144 | |
1145 | struct cfg80211_ftm_responder_stats ftm_resp_stats; |
1146 | struct { |
1147 | struct cfg80211_pmsr_request *req; |
1148 | struct wireless_dev *req_wdev; |
1149 | struct list_head loc_list; |
1150 | int responses[IWL_MVM_TOF_MAX_APS]; |
1151 | struct { |
1152 | struct list_head resp; |
1153 | } smooth; |
1154 | struct list_head pasn_list; |
1155 | } ftm_initiator; |
1156 | |
1157 | struct list_head resp_pasn_list; |
1158 | |
1159 | struct ptp_data ptp_data; |
1160 | |
1161 | struct { |
1162 | u8 range_resp; |
1163 | } cmd_ver; |
1164 | |
1165 | struct ieee80211_vif *nan_vif; |
1166 | struct iwl_mvm_baid_data __rcu *baid_map[IWL_MAX_BAID]; |
1167 | |
1168 | /* |
1169 | * Drop beacons from other APs in AP mode when there are no connected |
1170 | * clients. |
1171 | */ |
1172 | bool drop_bcn_ap_mode; |
1173 | |
1174 | struct delayed_work cs_tx_unblock_dwork; |
1175 | |
1176 | /* does a monitor vif exist (only one can exist hence bool) */ |
1177 | bool monitor_on; |
1178 | /* |
1179 | * primary channel position relative to he whole bandwidth, |
1180 | * in steps of 80 MHz |
1181 | */ |
1182 | u8 monitor_p80; |
1183 | |
1184 | /* sniffer data to include in radiotap */ |
1185 | __le16 cur_aid; |
1186 | u8 cur_bssid[ETH_ALEN]; |
1187 | |
1188 | #ifdef CONFIG_ACPI |
1189 | struct iwl_phy_specific_cfg phy_filters; |
1190 | #endif |
1191 | |
1192 | unsigned long last_6ghz_passive_scan_jiffies; |
1193 | unsigned long last_reset_or_resume_time_jiffies; |
1194 | |
1195 | bool sta_remove_requires_queue_remove; |
1196 | bool mld_api_is_used; |
1197 | |
1198 | bool pldr_sync; |
1199 | |
1200 | struct iwl_time_sync_data time_sync; |
1201 | |
1202 | struct iwl_mei_scan_filter mei_scan_filter; |
1203 | |
1204 | bool statistics_clear; |
1205 | }; |
1206 | |
1207 | /* Extract MVM priv from op_mode and _hw */ |
1208 | #define IWL_OP_MODE_GET_MVM(_iwl_op_mode) \ |
1209 | ((struct iwl_mvm *)(_iwl_op_mode)->op_mode_specific) |
1210 | |
1211 | #define IWL_MAC80211_GET_MVM(_hw) \ |
1212 | IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv)) |
1213 | |
1214 | /** |
1215 | * enum iwl_mvm_status - MVM status bits |
1216 | * @IWL_MVM_STATUS_HW_RFKILL: HW RF-kill is asserted |
1217 | * @IWL_MVM_STATUS_HW_CTKILL: CT-kill is active |
1218 | * @IWL_MVM_STATUS_ROC_RUNNING: remain-on-channel is running |
1219 | * @IWL_MVM_STATUS_HW_RESTART_REQUESTED: HW restart was requested |
1220 | * @IWL_MVM_STATUS_IN_HW_RESTART: HW restart is active |
1221 | * @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running |
1222 | * @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running |
1223 | * @IWL_MVM_STATUS_IN_D3: in D3 (or at least about to go into it) |
1224 | * @IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE: suppress one error log |
1225 | * if this is set, when intentionally triggered |
1226 | * @IWL_MVM_STATUS_STARTING: starting mac, |
1227 | * used to disable restart flow while in STARTING state |
1228 | */ |
1229 | enum iwl_mvm_status { |
1230 | IWL_MVM_STATUS_HW_RFKILL, |
1231 | IWL_MVM_STATUS_HW_CTKILL, |
1232 | IWL_MVM_STATUS_ROC_RUNNING, |
1233 | IWL_MVM_STATUS_HW_RESTART_REQUESTED, |
1234 | IWL_MVM_STATUS_IN_HW_RESTART, |
1235 | IWL_MVM_STATUS_ROC_AUX_RUNNING, |
1236 | IWL_MVM_STATUS_FIRMWARE_RUNNING, |
1237 | IWL_MVM_STATUS_IN_D3, |
1238 | IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, |
1239 | IWL_MVM_STATUS_STARTING, |
1240 | }; |
1241 | |
1242 | struct iwl_mvm_csme_conn_info { |
1243 | struct rcu_head rcu_head; |
1244 | struct iwl_mei_conn_info conn_info; |
1245 | }; |
1246 | |
1247 | /* Keep track of completed init configuration */ |
1248 | enum iwl_mvm_init_status { |
1249 | IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0), |
1250 | IWL_MVM_INIT_STATUS_LEDS_INIT_COMPLETE = BIT(1), |
1251 | }; |
1252 | |
1253 | static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm) |
1254 | { |
1255 | return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status) || |
1256 | test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status); |
1257 | } |
1258 | |
1259 | static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm) |
1260 | { |
1261 | return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); |
1262 | } |
1263 | |
1264 | static inline bool iwl_mvm_firmware_running(struct iwl_mvm *mvm) |
1265 | { |
1266 | return test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); |
1267 | } |
1268 | |
1269 | /* Must be called with rcu_read_lock() held and it can only be |
1270 | * released when mvmsta is not needed anymore. |
1271 | */ |
1272 | static inline struct iwl_mvm_sta * |
1273 | iwl_mvm_sta_from_staid_rcu(struct iwl_mvm *mvm, u8 sta_id) |
1274 | { |
1275 | struct ieee80211_sta *sta; |
1276 | |
1277 | if (sta_id >= mvm->fw->ucode_capa.num_stations) |
1278 | return NULL; |
1279 | |
1280 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); |
1281 | |
1282 | /* This can happen if the station has been removed right now */ |
1283 | if (IS_ERR_OR_NULL(ptr: sta)) |
1284 | return NULL; |
1285 | |
1286 | return iwl_mvm_sta_from_mac80211(sta); |
1287 | } |
1288 | |
1289 | static inline struct iwl_mvm_sta * |
1290 | iwl_mvm_sta_from_staid_protected(struct iwl_mvm *mvm, u8 sta_id) |
1291 | { |
1292 | struct ieee80211_sta *sta; |
1293 | |
1294 | if (sta_id >= mvm->fw->ucode_capa.num_stations) |
1295 | return NULL; |
1296 | |
1297 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], |
1298 | lockdep_is_held(&mvm->mutex)); |
1299 | |
1300 | /* This can happen if the station has been removed right now */ |
1301 | if (IS_ERR_OR_NULL(ptr: sta)) |
1302 | return NULL; |
1303 | |
1304 | return iwl_mvm_sta_from_mac80211(sta); |
1305 | } |
1306 | |
1307 | static inline struct ieee80211_vif * |
1308 | iwl_mvm_rcu_dereference_vif_id(struct iwl_mvm *mvm, u8 vif_id, bool rcu) |
1309 | { |
1310 | if (WARN_ON(vif_id >= ARRAY_SIZE(mvm->vif_id_to_mac))) |
1311 | return NULL; |
1312 | |
1313 | if (rcu) |
1314 | return rcu_dereference(mvm->vif_id_to_mac[vif_id]); |
1315 | |
1316 | return rcu_dereference_protected(mvm->vif_id_to_mac[vif_id], |
1317 | lockdep_is_held(&mvm->mutex)); |
1318 | } |
1319 | |
1320 | static inline struct ieee80211_bss_conf * |
1321 | iwl_mvm_rcu_fw_link_id_to_link_conf(struct iwl_mvm *mvm, u8 link_id, bool rcu) |
1322 | { |
1323 | if (WARN_ON(link_id >= ARRAY_SIZE(mvm->link_id_to_link_conf))) |
1324 | return NULL; |
1325 | |
1326 | if (rcu) |
1327 | return rcu_dereference(mvm->link_id_to_link_conf[link_id]); |
1328 | |
1329 | return rcu_dereference_protected(mvm->link_id_to_link_conf[link_id], |
1330 | lockdep_is_held(&mvm->mutex)); |
1331 | } |
1332 | |
1333 | static inline bool iwl_mvm_is_adaptive_dwell_supported(struct iwl_mvm *mvm) |
1334 | { |
1335 | return fw_has_api(&mvm->fw->ucode_capa, |
1336 | IWL_UCODE_TLV_API_ADAPTIVE_DWELL); |
1337 | } |
1338 | |
1339 | static inline bool iwl_mvm_is_adaptive_dwell_v2_supported(struct iwl_mvm *mvm) |
1340 | { |
1341 | return fw_has_api(&mvm->fw->ucode_capa, |
1342 | IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2); |
1343 | } |
1344 | |
1345 | static inline bool iwl_mvm_is_adwell_hb_ap_num_supported(struct iwl_mvm *mvm) |
1346 | { |
1347 | return fw_has_api(&mvm->fw->ucode_capa, |
1348 | IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP); |
1349 | } |
1350 | |
1351 | static inline bool iwl_mvm_is_oce_supported(struct iwl_mvm *mvm) |
1352 | { |
1353 | /* OCE should never be enabled for LMAC scan FWs */ |
1354 | return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_OCE); |
1355 | } |
1356 | |
1357 | static inline bool iwl_mvm_is_frag_ebs_supported(struct iwl_mvm *mvm) |
1358 | { |
1359 | return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_FRAG_EBS); |
1360 | } |
1361 | |
1362 | static inline bool iwl_mvm_is_short_beacon_notif_supported(struct iwl_mvm *mvm) |
1363 | { |
1364 | return fw_has_api(&mvm->fw->ucode_capa, |
1365 | IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF); |
1366 | } |
1367 | |
1368 | static inline bool iwl_mvm_is_dqa_data_queue(struct iwl_mvm *mvm, u8 queue) |
1369 | { |
1370 | return (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE) && |
1371 | (queue <= IWL_MVM_DQA_MAX_DATA_QUEUE); |
1372 | } |
1373 | |
1374 | static inline bool iwl_mvm_is_dqa_mgmt_queue(struct iwl_mvm *mvm, u8 queue) |
1375 | { |
1376 | return (queue >= IWL_MVM_DQA_MIN_MGMT_QUEUE) && |
1377 | (queue <= IWL_MVM_DQA_MAX_MGMT_QUEUE); |
1378 | } |
1379 | |
1380 | static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm) |
1381 | { |
1382 | bool nvm_lar = mvm->nvm_data->lar_enabled; |
1383 | bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa, |
1384 | IWL_UCODE_TLV_CAPA_LAR_SUPPORT); |
1385 | |
1386 | /* |
1387 | * Enable LAR only if it is supported by the FW (TLV) && |
1388 | * enabled in the NVM |
1389 | */ |
1390 | if (mvm->cfg->nvm_type == IWL_NVM_EXT) |
1391 | return nvm_lar && tlv_lar; |
1392 | else |
1393 | return tlv_lar; |
1394 | } |
1395 | |
1396 | static inline bool iwl_mvm_is_wifi_mcc_supported(struct iwl_mvm *mvm) |
1397 | { |
1398 | return fw_has_api(&mvm->fw->ucode_capa, |
1399 | IWL_UCODE_TLV_API_WIFI_MCC_UPDATE) || |
1400 | fw_has_capa(&mvm->fw->ucode_capa, |
1401 | IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC); |
1402 | } |
1403 | |
1404 | static inline bool iwl_mvm_bt_is_rrc_supported(struct iwl_mvm *mvm) |
1405 | { |
1406 | return fw_has_capa(&mvm->fw->ucode_capa, |
1407 | IWL_UCODE_TLV_CAPA_BT_COEX_RRC) && |
1408 | IWL_MVM_BT_COEX_RRC; |
1409 | } |
1410 | |
1411 | static inline bool iwl_mvm_is_csum_supported(struct iwl_mvm *mvm) |
1412 | { |
1413 | return fw_has_capa(&mvm->fw->ucode_capa, |
1414 | IWL_UCODE_TLV_CAPA_CSUM_SUPPORT) && |
1415 | !IWL_MVM_HW_CSUM_DISABLE; |
1416 | } |
1417 | |
1418 | static inline bool iwl_mvm_is_mplut_supported(struct iwl_mvm *mvm) |
1419 | { |
1420 | return fw_has_capa(&mvm->fw->ucode_capa, |
1421 | IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT) && |
1422 | IWL_MVM_BT_COEX_MPLUT; |
1423 | } |
1424 | |
1425 | static inline |
1426 | bool iwl_mvm_is_p2p_scm_uapsd_supported(struct iwl_mvm *mvm) |
1427 | { |
1428 | return fw_has_capa(&mvm->fw->ucode_capa, |
1429 | IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD) && |
1430 | !(iwlwifi_mod_params.uapsd_disable & |
1431 | IWL_DISABLE_UAPSD_P2P_CLIENT); |
1432 | } |
1433 | |
1434 | static inline bool iwl_mvm_has_new_rx_api(struct iwl_mvm *mvm) |
1435 | { |
1436 | return fw_has_capa(&mvm->fw->ucode_capa, |
1437 | IWL_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT); |
1438 | } |
1439 | |
1440 | static inline bool iwl_mvm_has_mld_api(const struct iwl_fw *fw) |
1441 | { |
1442 | return fw_has_capa(&fw->ucode_capa, |
1443 | IWL_UCODE_TLV_CAPA_MLD_API_SUPPORT); |
1444 | } |
1445 | |
1446 | static inline bool iwl_mvm_has_new_station_api(const struct iwl_fw *fw) |
1447 | { |
1448 | return iwl_mvm_has_mld_api(fw) || |
1449 | iwl_fw_lookup_cmd_ver(fw, ADD_STA, 0) >= 12; |
1450 | } |
1451 | |
1452 | static inline bool iwl_mvm_has_new_tx_api(struct iwl_mvm *mvm) |
1453 | { |
1454 | /* TODO - replace with TLV once defined */ |
1455 | return mvm->trans->trans_cfg->gen2; |
1456 | } |
1457 | |
1458 | static inline bool iwl_mvm_has_unified_ucode(struct iwl_mvm *mvm) |
1459 | { |
1460 | /* TODO - better define this */ |
1461 | return mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000; |
1462 | } |
1463 | |
1464 | static inline bool iwl_mvm_is_cdb_supported(struct iwl_mvm *mvm) |
1465 | { |
1466 | /* |
1467 | * TODO: |
1468 | * The issue of how to determine CDB APIs and usage is still not fully |
1469 | * defined. |
1470 | * There is a compilation for CDB and non-CDB FW, but there may |
1471 | * be also runtime check. |
1472 | * For now there is a TLV for checking compilation mode, but a |
1473 | * runtime check will also have to be here - once defined. |
1474 | */ |
1475 | return fw_has_capa(&mvm->fw->ucode_capa, |
1476 | IWL_UCODE_TLV_CAPA_CDB_SUPPORT); |
1477 | } |
1478 | |
1479 | static inline bool iwl_mvm_cdb_scan_api(struct iwl_mvm *mvm) |
1480 | { |
1481 | /* |
1482 | * TODO: should this be the same as iwl_mvm_is_cdb_supported()? |
1483 | * but then there's a little bit of code in scan that won't make |
1484 | * any sense... |
1485 | */ |
1486 | return mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000; |
1487 | } |
1488 | |
1489 | static inline bool iwl_mvm_is_scan_ext_chan_supported(struct iwl_mvm *mvm) |
1490 | { |
1491 | return fw_has_api(&mvm->fw->ucode_capa, |
1492 | IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER); |
1493 | } |
1494 | |
1495 | |
1496 | static inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm) |
1497 | { |
1498 | return fw_has_api(&mvm->fw->ucode_capa, |
1499 | IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG); |
1500 | } |
1501 | |
1502 | static inline bool iwl_mvm_is_band_in_rx_supported(struct iwl_mvm *mvm) |
1503 | { |
1504 | return fw_has_api(&mvm->fw->ucode_capa, |
1505 | IWL_UCODE_TLV_API_BAND_IN_RX_DATA); |
1506 | } |
1507 | |
1508 | static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm) |
1509 | { |
1510 | return fw_has_api(&mvm->fw->ucode_capa, |
1511 | IWL_UCODE_TLV_API_NEW_RX_STATS); |
1512 | } |
1513 | |
1514 | static inline bool iwl_mvm_has_quota_low_latency(struct iwl_mvm *mvm) |
1515 | { |
1516 | return fw_has_api(&mvm->fw->ucode_capa, |
1517 | IWL_UCODE_TLV_API_QUOTA_LOW_LATENCY); |
1518 | } |
1519 | |
1520 | static inline bool iwl_mvm_has_no_host_disable_tx(struct iwl_mvm *mvm) |
1521 | { |
1522 | return fw_has_api(&mvm->fw->ucode_capa, |
1523 | IWL_UCODE_TLV_API_NO_HOST_DISABLE_TX); |
1524 | } |
1525 | |
1526 | static inline bool iwl_mvm_has_tlc_offload(const struct iwl_mvm *mvm) |
1527 | { |
1528 | return fw_has_capa(&mvm->fw->ucode_capa, |
1529 | IWL_UCODE_TLV_CAPA_TLC_OFFLOAD); |
1530 | } |
1531 | |
1532 | static inline struct agg_tx_status * |
1533 | iwl_mvm_get_agg_status(struct iwl_mvm *mvm, void *tx_resp) |
1534 | { |
1535 | if (iwl_mvm_has_new_tx_api(mvm)) |
1536 | return &((struct iwl_mvm_tx_resp *)tx_resp)->status; |
1537 | else |
1538 | return ((struct iwl_mvm_tx_resp_v3 *)tx_resp)->status; |
1539 | } |
1540 | |
1541 | static inline bool iwl_mvm_is_tt_in_fw(struct iwl_mvm *mvm) |
1542 | { |
1543 | /* these two TLV are redundant since the responsibility to CT-kill by |
1544 | * FW happens only after we send at least one command of |
1545 | * temperature THs report. |
1546 | */ |
1547 | return fw_has_capa(&mvm->fw->ucode_capa, |
1548 | IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW) && |
1549 | fw_has_capa(&mvm->fw->ucode_capa, |
1550 | IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT); |
1551 | } |
1552 | |
1553 | static inline bool iwl_mvm_is_ctdp_supported(struct iwl_mvm *mvm) |
1554 | { |
1555 | return fw_has_capa(&mvm->fw->ucode_capa, |
1556 | IWL_UCODE_TLV_CAPA_CTDP_SUPPORT); |
1557 | } |
1558 | |
1559 | static inline bool iwl_mvm_is_esr_supported(struct iwl_trans *trans) |
1560 | { |
1561 | if ((CSR_HW_RFID_TYPE(trans->hw_rf_id) == IWL_CFG_RF_TYPE_FM) && |
1562 | !CSR_HW_RFID_IS_CDB(trans->hw_rf_id)) |
1563 | /* Step A doesn't support eSR */ |
1564 | return CSR_HW_RFID_STEP(trans->hw_rf_id); |
1565 | |
1566 | return false; |
1567 | } |
1568 | |
1569 | static inline int iwl_mvm_max_active_links(struct iwl_mvm *mvm, |
1570 | struct ieee80211_vif *vif) |
1571 | { |
1572 | struct iwl_trans *trans = mvm->fwrt.trans; |
1573 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
1574 | |
1575 | lockdep_assert_held(&mvm->mutex); |
1576 | |
1577 | if (vif->type == NL80211_IFTYPE_AP) |
1578 | return mvm->fw->ucode_capa.num_beacons; |
1579 | |
1580 | if ((iwl_mvm_is_esr_supported(trans) && |
1581 | !mvmvif->bt_coex_esr_disabled) || |
1582 | ((CSR_HW_RFID_TYPE(trans->hw_rf_id) == IWL_CFG_RF_TYPE_FM && |
1583 | CSR_HW_RFID_IS_CDB(trans->hw_rf_id)))) |
1584 | return IWL_MVM_FW_MAX_ACTIVE_LINKS_NUM; |
1585 | |
1586 | return 1; |
1587 | } |
1588 | |
1589 | extern const u8 iwl_mvm_ac_to_tx_fifo[]; |
1590 | extern const u8 iwl_mvm_ac_to_gen2_tx_fifo[]; |
1591 | extern const u8 iwl_mvm_ac_to_bz_tx_fifo[]; |
1592 | |
1593 | static inline u8 iwl_mvm_mac_ac_to_tx_fifo(struct iwl_mvm *mvm, |
1594 | enum ieee80211_ac_numbers ac) |
1595 | { |
1596 | if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) |
1597 | return iwl_mvm_ac_to_bz_tx_fifo[ac]; |
1598 | if (iwl_mvm_has_new_tx_api(mvm)) |
1599 | return iwl_mvm_ac_to_gen2_tx_fifo[ac]; |
1600 | return iwl_mvm_ac_to_tx_fifo[ac]; |
1601 | } |
1602 | |
1603 | struct iwl_rate_info { |
1604 | u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ |
1605 | u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ |
1606 | u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ |
1607 | u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */ |
1608 | u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ |
1609 | }; |
1610 | |
1611 | void __iwl_mvm_mac_stop(struct iwl_mvm *mvm); |
1612 | int __iwl_mvm_mac_start(struct iwl_mvm *mvm); |
1613 | |
1614 | /****************** |
1615 | * MVM Methods |
1616 | ******************/ |
1617 | /* uCode */ |
1618 | int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm); |
1619 | |
1620 | /* Utils */ |
1621 | int iwl_mvm_legacy_hw_idx_to_mac80211_idx(u32 rate_n_flags, |
1622 | enum nl80211_band band); |
1623 | int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags, |
1624 | enum nl80211_band band); |
1625 | void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags, |
1626 | enum nl80211_band band, |
1627 | struct ieee80211_tx_rate *r); |
1628 | void iwl_mvm_hwrate_to_tx_rate_v1(u32 rate_n_flags, |
1629 | enum nl80211_band band, |
1630 | struct ieee80211_tx_rate *r); |
1631 | u8 iwl_mvm_mac80211_idx_to_hwrate(const struct iwl_fw *fw, int rate_idx); |
1632 | u8 iwl_mvm_mac80211_ac_to_ucode_ac(enum ieee80211_ac_numbers ac); |
1633 | bool iwl_mvm_is_nic_ack_enabled(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1634 | |
1635 | static inline void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) |
1636 | { |
1637 | iwl_fwrt_dump_error_logs(&mvm->fwrt); |
1638 | } |
1639 | |
1640 | u8 first_antenna(u8 mask); |
1641 | u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx); |
1642 | void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, int clock_type, u32 *gp2, |
1643 | u64 *boottime, ktime_t *realtime); |
1644 | u32 iwl_mvm_get_systime(struct iwl_mvm *mvm); |
1645 | |
1646 | /* Tx / Host Commands */ |
1647 | int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm, |
1648 | struct iwl_host_cmd *cmd); |
1649 | int __must_check iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u32 id, |
1650 | u32 flags, u16 len, const void *data); |
1651 | int __must_check iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, |
1652 | struct iwl_host_cmd *cmd, |
1653 | u32 *status); |
1654 | int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id, |
1655 | u16 len, const void *data, |
1656 | u32 *status); |
1657 | int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb, |
1658 | struct ieee80211_sta *sta); |
1659 | int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb); |
1660 | void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, |
1661 | struct iwl_tx_cmd *tx_cmd, |
1662 | struct ieee80211_tx_info *info, u8 sta_id); |
1663 | void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd, |
1664 | struct ieee80211_tx_info *info, |
1665 | struct ieee80211_sta *sta, __le16 fc); |
1666 | void iwl_mvm_mac_itxq_xmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq); |
1667 | unsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm, |
1668 | struct ieee80211_sta *sta, |
1669 | unsigned int tid); |
1670 | |
1671 | #ifdef CONFIG_IWLWIFI_DEBUG |
1672 | const char *iwl_mvm_get_tx_fail_reason(u32 status); |
1673 | #else |
1674 | static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return "" ; } |
1675 | #endif |
1676 | int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk); |
1677 | int iwl_mvm_flush_sta(struct iwl_mvm *mvm, u32 sta_id, u32 tfd_queue_mask); |
1678 | int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id, u16 tids); |
1679 | |
1680 | /* Utils to extract sta related data */ |
1681 | __le32 iwl_mvm_get_sta_htc_flags(struct ieee80211_sta *sta, |
1682 | struct ieee80211_link_sta *link_sta); |
1683 | u8 iwl_mvm_get_sta_uapsd_acs(struct ieee80211_sta *sta); |
1684 | u32 iwl_mvm_get_sta_ampdu_dens(struct ieee80211_link_sta *link_sta, |
1685 | struct ieee80211_bss_conf *link_conf, |
1686 | u32 *_agg_size); |
1687 | int iwl_mvm_set_sta_pkt_ext(struct iwl_mvm *mvm, |
1688 | struct ieee80211_link_sta *link_sta, |
1689 | struct iwl_he_pkt_ext_v2 *pkt_ext); |
1690 | |
1691 | void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm); |
1692 | |
1693 | static inline void iwl_mvm_set_tx_cmd_ccmp(struct ieee80211_tx_info *info, |
1694 | struct iwl_tx_cmd *tx_cmd) |
1695 | { |
1696 | struct ieee80211_key_conf *keyconf = info->control.hw_key; |
1697 | |
1698 | tx_cmd->sec_ctl = TX_CMD_SEC_CCM; |
1699 | memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); |
1700 | } |
1701 | |
1702 | static inline void iwl_mvm_wait_for_async_handlers(struct iwl_mvm *mvm) |
1703 | { |
1704 | flush_work(work: &mvm->async_handlers_wk); |
1705 | } |
1706 | |
1707 | /* Statistics */ |
1708 | void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm, |
1709 | struct iwl_rx_cmd_buffer *rxb); |
1710 | void iwl_mvm_handle_rx_system_oper_part1_stats(struct iwl_mvm *mvm, |
1711 | struct iwl_rx_cmd_buffer *rxb); |
1712 | static inline void |
1713 | iwl_mvm_handle_rx_system_end_stats_notif(struct iwl_mvm *mvm, |
1714 | struct iwl_rx_cmd_buffer *rxb) |
1715 | { |
1716 | } |
1717 | |
1718 | void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm, |
1719 | struct iwl_rx_packet *pkt); |
1720 | void iwl_mvm_rx_statistics(struct iwl_mvm *mvm, |
1721 | struct iwl_rx_cmd_buffer *rxb); |
1722 | int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear); |
1723 | void iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm); |
1724 | |
1725 | /* NVM */ |
1726 | int iwl_nvm_init(struct iwl_mvm *mvm); |
1727 | int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); |
1728 | |
1729 | static inline u8 iwl_mvm_get_valid_tx_ant(struct iwl_mvm *mvm) |
1730 | { |
1731 | u8 tx_ant = mvm->fw->valid_tx_ant; |
1732 | |
1733 | if (mvm->nvm_data && mvm->nvm_data->valid_tx_ant) |
1734 | tx_ant &= mvm->nvm_data->valid_tx_ant; |
1735 | |
1736 | if (mvm->set_tx_ant) |
1737 | tx_ant &= mvm->set_tx_ant; |
1738 | |
1739 | return tx_ant; |
1740 | } |
1741 | |
1742 | static inline u8 iwl_mvm_get_valid_rx_ant(struct iwl_mvm *mvm) |
1743 | { |
1744 | u8 rx_ant = mvm->fw->valid_tx_ant; |
1745 | |
1746 | if (mvm->nvm_data && mvm->nvm_data->valid_rx_ant) |
1747 | rx_ant &= mvm->nvm_data->valid_tx_ant; |
1748 | |
1749 | if (mvm->set_rx_ant) |
1750 | rx_ant &= mvm->set_rx_ant; |
1751 | |
1752 | return rx_ant; |
1753 | |
1754 | } |
1755 | |
1756 | static inline void iwl_mvm_toggle_tx_ant(struct iwl_mvm *mvm, u8 *ant) |
1757 | { |
1758 | *ant = iwl_mvm_next_antenna(mvm, valid: iwl_mvm_get_valid_tx_ant(mvm), last_idx: *ant); |
1759 | } |
1760 | |
1761 | static inline u32 iwl_mvm_get_phy_config(struct iwl_mvm *mvm) |
1762 | { |
1763 | u32 phy_config = ~(FW_PHY_CFG_TX_CHAIN | |
1764 | FW_PHY_CFG_RX_CHAIN); |
1765 | u32 valid_rx_ant = iwl_mvm_get_valid_rx_ant(mvm); |
1766 | u32 valid_tx_ant = iwl_mvm_get_valid_tx_ant(mvm); |
1767 | |
1768 | phy_config |= valid_tx_ant << FW_PHY_CFG_TX_CHAIN_POS | |
1769 | valid_rx_ant << FW_PHY_CFG_RX_CHAIN_POS; |
1770 | |
1771 | return mvm->fw->phy_config & phy_config; |
1772 | } |
1773 | |
1774 | int iwl_mvm_up(struct iwl_mvm *mvm); |
1775 | int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm); |
1776 | |
1777 | int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm); |
1778 | |
1779 | /* |
1780 | * FW notifications / CMD responses handlers |
1781 | * Convention: iwl_mvm_rx_<NAME OF THE CMD> |
1782 | */ |
1783 | void iwl_mvm_rx_mq(struct iwl_op_mode *op_mode, |
1784 | struct napi_struct *napi, |
1785 | struct iwl_rx_cmd_buffer *rxb); |
1786 | void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
1787 | void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, |
1788 | struct iwl_rx_cmd_buffer *rxb); |
1789 | void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, |
1790 | struct iwl_rx_cmd_buffer *rxb, int queue); |
1791 | void iwl_mvm_rx_monitor_no_data(struct iwl_mvm *mvm, struct napi_struct *napi, |
1792 | struct iwl_rx_cmd_buffer *rxb, int queue); |
1793 | void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, |
1794 | struct iwl_rx_cmd_buffer *rxb, int queue); |
1795 | void iwl_mvm_rx_bar_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, |
1796 | struct iwl_rx_cmd_buffer *rxb, int queue); |
1797 | void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi, |
1798 | struct iwl_rx_cmd_buffer *rxb, int queue); |
1799 | void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
1800 | void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, |
1801 | struct iwl_rx_cmd_buffer *rxb); |
1802 | void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags); |
1803 | void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
1804 | void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, |
1805 | struct iwl_rx_cmd_buffer *rxb); |
1806 | void iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
1807 | void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm, |
1808 | struct iwl_rx_cmd_buffer *rxb); |
1809 | void iwl_mvm_rx_shared_mem_cfg_notif(struct iwl_mvm *mvm, |
1810 | struct iwl_rx_cmd_buffer *rxb); |
1811 | |
1812 | /* MVM PHY */ |
1813 | struct iwl_mvm_phy_ctxt *iwl_mvm_get_free_phy_ctxt(struct iwl_mvm *mvm); |
1814 | int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, |
1815 | const struct cfg80211_chan_def *chandef, |
1816 | const struct cfg80211_chan_def *ap, |
1817 | u8 chains_static, u8 chains_dynamic); |
1818 | int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, |
1819 | const struct cfg80211_chan_def *chandef, |
1820 | const struct cfg80211_chan_def *ap, |
1821 | u8 chains_static, u8 chains_dynamic); |
1822 | void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm, |
1823 | struct iwl_mvm_phy_ctxt *ctxt); |
1824 | void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, |
1825 | struct iwl_mvm_phy_ctxt *ctxt); |
1826 | int iwl_mvm_phy_ctx_count(struct iwl_mvm *mvm); |
1827 | u8 iwl_mvm_get_channel_width(const struct cfg80211_chan_def *chandef); |
1828 | u8 iwl_mvm_get_ctrl_pos(const struct cfg80211_chan_def *chandef); |
1829 | int iwl_mvm_phy_send_rlc(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, |
1830 | u8 chains_static, u8 chains_dynamic); |
1831 | |
1832 | /* MAC (virtual interface) programming */ |
1833 | |
1834 | void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, |
1835 | struct ieee80211_vif *vif); |
1836 | void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1837 | struct ieee80211_bss_conf *link_conf, |
1838 | __le32 *cck_rates, __le32 *ofdm_rates); |
1839 | void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm, |
1840 | struct ieee80211_vif *vif, |
1841 | struct ieee80211_bss_conf *link_conf, |
1842 | __le32 *protection_flags, u32 ht_flag, |
1843 | u32 tgg_flag); |
1844 | void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1845 | struct ieee80211_bss_conf *link_conf, |
1846 | struct iwl_ac_qos *ac, __le32 *qos_flags); |
1847 | bool iwl_mvm_set_fw_mu_edca_params(struct iwl_mvm *mvm, |
1848 | const struct iwl_mvm_vif_link_info *link_info, |
1849 | struct iwl_he_backoff_conf *trig_based_txf); |
1850 | void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1851 | struct ieee80211_bss_conf *link_conf, |
1852 | __le64 *dtim_tsf, __le32 *dtim_time, |
1853 | __le32 *assoc_beacon_arrive_time); |
1854 | __le32 iwl_mac_ctxt_p2p_dev_has_extended_disc(struct iwl_mvm *mvm, |
1855 | struct ieee80211_vif *vif); |
1856 | void iwl_mvm_mac_ctxt_cmd_ap_set_filter_flags(struct iwl_mvm *mvm, |
1857 | struct iwl_mvm_vif *mvmvif, |
1858 | __le32 *filter_flags, |
1859 | int accept_probe_req_flag, |
1860 | int accept_beacon_flag); |
1861 | int iwl_mvm_get_mac_type(struct ieee80211_vif *vif); |
1862 | __le32 iwl_mvm_mac_ctxt_cmd_p2p_sta_get_oppps_ctwin(struct iwl_mvm *mvm, |
1863 | struct ieee80211_vif *vif); |
1864 | u32 iwl_mvm_mac_ctxt_cmd_sta_get_twt_policy(struct iwl_mvm *mvm, |
1865 | struct ieee80211_vif *vif); |
1866 | int iwl_mvm_mld_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1867 | int iwl_mvm_mld_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1868 | bool force_assoc_off); |
1869 | int iwl_mvm_mld_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1870 | int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1871 | int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1872 | int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1873 | bool force_assoc_off, const u8 *bssid_override); |
1874 | int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1875 | int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, |
1876 | struct ieee80211_vif *vif, |
1877 | struct ieee80211_bss_conf *link_conf); |
1878 | int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm, |
1879 | struct sk_buff *beacon, |
1880 | void *data, int len); |
1881 | u8 iwl_mvm_mac_ctxt_get_beacon_rate(struct iwl_mvm *mvm, |
1882 | struct ieee80211_tx_info *info, |
1883 | struct ieee80211_vif *vif); |
1884 | u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm, |
1885 | struct ieee80211_tx_info *info, |
1886 | struct ieee80211_vif *vif); |
1887 | u16 iwl_mvm_mac_ctxt_get_beacon_flags(const struct iwl_fw *fw, |
1888 | u8 rate_idx); |
1889 | void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, |
1890 | __le32 *tim_index, __le32 *tim_size, |
1891 | u8 *beacon, u32 frame_size); |
1892 | void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, |
1893 | struct iwl_rx_cmd_buffer *rxb); |
1894 | void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm, |
1895 | struct iwl_rx_cmd_buffer *rxb); |
1896 | void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm, |
1897 | struct iwl_rx_cmd_buffer *rxb); |
1898 | void iwl_mvm_mu_mimo_grp_notif(struct iwl_mvm *mvm, |
1899 | struct iwl_rx_cmd_buffer *rxb); |
1900 | void iwl_mvm_sta_pm_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
1901 | void iwl_mvm_window_status_notif(struct iwl_mvm *mvm, |
1902 | struct iwl_rx_cmd_buffer *rxb); |
1903 | void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm, |
1904 | struct ieee80211_vif *vif); |
1905 | void iwl_mvm_probe_resp_data_notif(struct iwl_mvm *mvm, |
1906 | struct iwl_rx_cmd_buffer *rxb); |
1907 | void iwl_mvm_rx_missed_vap_notif(struct iwl_mvm *mvm, |
1908 | struct iwl_rx_cmd_buffer *rxb); |
1909 | void iwl_mvm_channel_switch_start_notif(struct iwl_mvm *mvm, |
1910 | struct iwl_rx_cmd_buffer *rxb); |
1911 | void iwl_mvm_channel_switch_error_notif(struct iwl_mvm *mvm, |
1912 | struct iwl_rx_cmd_buffer *rxb); |
1913 | /* Bindings */ |
1914 | int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1915 | int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1916 | u32 iwl_mvm_get_lmac_id(struct iwl_mvm *mvm, enum nl80211_band band); |
1917 | |
1918 | /* Links */ |
1919 | int iwl_mvm_set_link_mapping(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1920 | struct ieee80211_bss_conf *link_conf); |
1921 | int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1922 | struct ieee80211_bss_conf *link_conf); |
1923 | int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1924 | struct ieee80211_bss_conf *link_conf, |
1925 | u32 changes, bool active); |
1926 | int iwl_mvm_unset_link_mapping(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1927 | struct ieee80211_bss_conf *link_conf); |
1928 | int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1929 | struct ieee80211_bss_conf *link_conf); |
1930 | int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1931 | struct ieee80211_bss_conf *link_conf); |
1932 | |
1933 | /* AP and IBSS */ |
1934 | bool iwl_mvm_start_ap_ibss_common(struct ieee80211_hw *hw, |
1935 | struct ieee80211_vif *vif, int *ret); |
1936 | void iwl_mvm_stop_ap_ibss_common(struct iwl_mvm *mvm, |
1937 | struct ieee80211_vif *vif); |
1938 | |
1939 | /* BSS Info */ |
1940 | void iwl_mvm_bss_info_changed_station_common(struct iwl_mvm *mvm, |
1941 | struct ieee80211_vif *vif, |
1942 | struct ieee80211_bss_conf *link_conf, |
1943 | u64 changes); |
1944 | void iwl_mvm_bss_info_changed_station_assoc(struct iwl_mvm *mvm, |
1945 | struct ieee80211_vif *vif, |
1946 | u64 changes); |
1947 | |
1948 | /* ROC */ |
1949 | /** |
1950 | * struct iwl_mvm_roc_ops - callbacks for the remain_on_channel() |
1951 | * |
1952 | * Since the only difference between both MLD and |
1953 | * non-MLD versions of remain_on_channel() is these function calls, |
1954 | * each version will send its specific function calls to |
1955 | * %iwl_mvm_roc_common(). |
1956 | * |
1957 | * @add_aux_sta_for_hs20: pointer to the function that adds an aux sta |
1958 | * for Hot Spot 2.0 |
1959 | * @link: For a P2P Device interface, pointer to a function that links the |
1960 | * MAC/Link to the PHY context |
1961 | */ |
1962 | struct iwl_mvm_roc_ops { |
1963 | int (*add_aux_sta_for_hs20)(struct iwl_mvm *mvm, u32 lmac_id); |
1964 | int (*link)(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
1965 | }; |
1966 | |
1967 | int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1968 | struct ieee80211_channel *channel, int duration, |
1969 | enum ieee80211_roc_type type, |
1970 | const struct iwl_mvm_roc_ops *ops); |
1971 | int iwl_mvm_cancel_roc(struct ieee80211_hw *hw, |
1972 | struct ieee80211_vif *vif); |
1973 | /*Session Protection */ |
1974 | void iwl_mvm_protect_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1975 | u32 duration_override, unsigned int link_id); |
1976 | |
1977 | /* Quota management */ |
1978 | static inline size_t iwl_mvm_quota_cmd_size(struct iwl_mvm *mvm) |
1979 | { |
1980 | return iwl_mvm_has_quota_low_latency(mvm) ? |
1981 | sizeof(struct iwl_time_quota_cmd) : |
1982 | sizeof(struct iwl_time_quota_cmd_v1); |
1983 | } |
1984 | |
1985 | static inline struct iwl_time_quota_data |
1986 | *iwl_mvm_quota_cmd_get_quota(struct iwl_mvm *mvm, |
1987 | struct iwl_time_quota_cmd *cmd, |
1988 | int i) |
1989 | { |
1990 | struct iwl_time_quota_data_v1 *quotas; |
1991 | |
1992 | if (iwl_mvm_has_quota_low_latency(mvm)) |
1993 | return &cmd->quotas[i]; |
1994 | |
1995 | quotas = (struct iwl_time_quota_data_v1 *)cmd->quotas; |
1996 | return (struct iwl_time_quota_data *)"as[i]; |
1997 | } |
1998 | |
1999 | int iwl_mvm_update_quotas(struct iwl_mvm *mvm, bool force_upload, |
2000 | struct ieee80211_vif *disabled_vif); |
2001 | |
2002 | /* Scanning */ |
2003 | int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2004 | struct cfg80211_scan_request *req, |
2005 | struct ieee80211_scan_ies *ies); |
2006 | size_t iwl_mvm_scan_size(struct iwl_mvm *mvm); |
2007 | int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify); |
2008 | int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm); |
2009 | void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm); |
2010 | void iwl_mvm_scan_timeout_wk(struct work_struct *work); |
2011 | |
2012 | /* Scheduled scan */ |
2013 | void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm, |
2014 | struct iwl_rx_cmd_buffer *rxb); |
2015 | void iwl_mvm_rx_lmac_scan_iter_complete_notif(struct iwl_mvm *mvm, |
2016 | struct iwl_rx_cmd_buffer *rxb); |
2017 | int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, |
2018 | struct ieee80211_vif *vif, |
2019 | struct cfg80211_sched_scan_request *req, |
2020 | struct ieee80211_scan_ies *ies, |
2021 | int type); |
2022 | void iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm, |
2023 | struct iwl_rx_cmd_buffer *rxb); |
2024 | |
2025 | /* UMAC scan */ |
2026 | int iwl_mvm_config_scan(struct iwl_mvm *mvm); |
2027 | void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, |
2028 | struct iwl_rx_cmd_buffer *rxb); |
2029 | void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm, |
2030 | struct iwl_rx_cmd_buffer *rxb); |
2031 | |
2032 | /* MVM debugfs */ |
2033 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
2034 | void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm); |
2035 | void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
2036 | void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
2037 | void iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
2038 | #else |
2039 | static inline void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) |
2040 | { |
2041 | } |
2042 | static inline void |
2043 | iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
2044 | { |
2045 | } |
2046 | static inline void |
2047 | iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
2048 | { |
2049 | } |
2050 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
2051 | |
2052 | /* rate scaling */ |
2053 | int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq); |
2054 | void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg); |
2055 | int rs_pretty_print_rate_v1(char *buf, int bufsz, const u32 rate); |
2056 | void (struct iwl_mvm *mvm, |
2057 | struct iwl_mvm_sta *mvmsta, |
2058 | struct ieee80211_rx_status *rx_status); |
2059 | |
2060 | /* power management */ |
2061 | int iwl_mvm_power_update_device(struct iwl_mvm *mvm); |
2062 | int iwl_mvm_power_update_mac(struct iwl_mvm *mvm); |
2063 | int iwl_mvm_power_update_ps(struct iwl_mvm *mvm); |
2064 | int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2065 | char *buf, int bufsz); |
2066 | |
2067 | void iwl_mvm_power_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
2068 | void iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm, |
2069 | struct iwl_rx_cmd_buffer *rxb); |
2070 | |
2071 | #ifdef CONFIG_IWLWIFI_LEDS |
2072 | int iwl_mvm_leds_init(struct iwl_mvm *mvm); |
2073 | void iwl_mvm_leds_exit(struct iwl_mvm *mvm); |
2074 | void iwl_mvm_leds_sync(struct iwl_mvm *mvm); |
2075 | #else |
2076 | static inline int iwl_mvm_leds_init(struct iwl_mvm *mvm) |
2077 | { |
2078 | return 0; |
2079 | } |
2080 | static inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm) |
2081 | { |
2082 | } |
2083 | static inline void iwl_mvm_leds_sync(struct iwl_mvm *mvm) |
2084 | { |
2085 | } |
2086 | #endif |
2087 | |
2088 | /* D3 (WoWLAN, NetDetect) */ |
2089 | int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); |
2090 | int iwl_mvm_resume(struct ieee80211_hw *hw); |
2091 | void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled); |
2092 | void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw, |
2093 | struct ieee80211_vif *vif, |
2094 | struct cfg80211_gtk_rekey_data *data); |
2095 | void iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw, |
2096 | struct ieee80211_vif *vif, |
2097 | struct inet6_dev *idev); |
2098 | void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw, |
2099 | struct ieee80211_vif *vif, int idx); |
2100 | extern const struct file_operations iwl_dbgfs_d3_test_ops; |
2101 | #ifdef CONFIG_PM |
2102 | void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, |
2103 | struct ieee80211_vif *vif); |
2104 | #else |
2105 | static inline void |
2106 | iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
2107 | { |
2108 | } |
2109 | #endif |
2110 | void iwl_mvm_set_wowlan_qos_seq(struct iwl_mvm_sta *mvm_ap_sta, |
2111 | struct iwl_wowlan_config_cmd *cmd); |
2112 | int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm, |
2113 | struct ieee80211_vif *vif, |
2114 | bool disable_offloading, |
2115 | bool offload_ns, |
2116 | u32 cmd_flags); |
2117 | |
2118 | /* BT Coex */ |
2119 | int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm); |
2120 | void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, |
2121 | struct iwl_rx_cmd_buffer *rxb); |
2122 | void (struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2123 | enum ieee80211_rssi_event_data); |
2124 | void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm); |
2125 | u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm, |
2126 | struct ieee80211_sta *sta); |
2127 | bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, |
2128 | struct ieee80211_sta *sta); |
2129 | bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant); |
2130 | bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm); |
2131 | bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, |
2132 | enum nl80211_band band); |
2133 | u8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants); |
2134 | u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, |
2135 | struct ieee80211_tx_info *info, u8 ac); |
2136 | bool iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm, |
2137 | struct ieee80211_vif *vif, |
2138 | int link_id, int primary_link); |
2139 | void iwl_mvm_bt_coex_update_vif_esr(struct iwl_mvm *mvm, |
2140 | struct ieee80211_vif *vif, |
2141 | int link_id); |
2142 | |
2143 | /* beacon filtering */ |
2144 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
2145 | void |
2146 | iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif, |
2147 | struct iwl_beacon_filter_cmd *cmd); |
2148 | #else |
2149 | static inline void |
2150 | iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif, |
2151 | struct iwl_beacon_filter_cmd *cmd) |
2152 | {} |
2153 | #endif |
2154 | int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, |
2155 | struct ieee80211_vif *vif); |
2156 | int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, |
2157 | struct ieee80211_vif *vif); |
2158 | /* SMPS */ |
2159 | void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2160 | enum iwl_mvm_smps_type_request req_type, |
2161 | enum ieee80211_smps_mode smps_request, |
2162 | unsigned int link_id); |
2163 | void |
2164 | iwl_mvm_update_smps_on_active_links(struct iwl_mvm *mvm, |
2165 | struct ieee80211_vif *vif, |
2166 | enum iwl_mvm_smps_type_request req_type, |
2167 | enum ieee80211_smps_mode smps_request); |
2168 | bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm, |
2169 | struct iwl_mvm_phy_ctxt *ctxt); |
2170 | void iwl_mvm_update_link_smps(struct ieee80211_vif *vif, |
2171 | struct ieee80211_bss_conf *link_conf); |
2172 | |
2173 | /* Low latency */ |
2174 | int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2175 | bool low_latency, |
2176 | enum iwl_mvm_low_latency_cause cause); |
2177 | /* get SystemLowLatencyMode - only needed for beacon threshold? */ |
2178 | bool iwl_mvm_low_latency(struct iwl_mvm *mvm); |
2179 | bool iwl_mvm_low_latency_band(struct iwl_mvm *mvm, enum nl80211_band band); |
2180 | void iwl_mvm_send_low_latency_cmd(struct iwl_mvm *mvm, bool low_latency, |
2181 | u16 mac_id); |
2182 | |
2183 | /* get VMACLowLatencyMode */ |
2184 | static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif) |
2185 | { |
2186 | /* |
2187 | * should this consider associated/active/... state? |
2188 | * |
2189 | * Normally low-latency should only be active on interfaces |
2190 | * that are active, but at least with debugfs it can also be |
2191 | * enabled on interfaces that aren't active. However, when |
2192 | * interface aren't active then they aren't added into the |
2193 | * binding, so this has no real impact. For now, just return |
2194 | * the current desired low-latency state. |
2195 | */ |
2196 | return mvmvif->low_latency_actual; |
2197 | } |
2198 | |
2199 | static inline |
2200 | void iwl_mvm_vif_set_low_latency(struct iwl_mvm_vif *mvmvif, bool set, |
2201 | enum iwl_mvm_low_latency_cause cause) |
2202 | { |
2203 | u8 new_state; |
2204 | |
2205 | if (set) |
2206 | mvmvif->low_latency |= cause; |
2207 | else |
2208 | mvmvif->low_latency &= ~cause; |
2209 | |
2210 | /* |
2211 | * if LOW_LATENCY_DEBUGFS_FORCE_ENABLE is enabled no changes are |
2212 | * allowed to actual mode. |
2213 | */ |
2214 | if (mvmvif->low_latency & LOW_LATENCY_DEBUGFS_FORCE_ENABLE && |
2215 | cause != LOW_LATENCY_DEBUGFS_FORCE_ENABLE) |
2216 | return; |
2217 | |
2218 | if (cause == LOW_LATENCY_DEBUGFS_FORCE_ENABLE && set) |
2219 | /* |
2220 | * We enter force state |
2221 | */ |
2222 | new_state = !!(mvmvif->low_latency & |
2223 | LOW_LATENCY_DEBUGFS_FORCE); |
2224 | else |
2225 | /* |
2226 | * Check if any other one set low latency |
2227 | */ |
2228 | new_state = !!(mvmvif->low_latency & |
2229 | ~(LOW_LATENCY_DEBUGFS_FORCE_ENABLE | |
2230 | LOW_LATENCY_DEBUGFS_FORCE)); |
2231 | |
2232 | mvmvif->low_latency_actual = new_state; |
2233 | } |
2234 | |
2235 | /* Return a bitmask with all the hw supported queues, except for the |
2236 | * command queue, which can't be flushed. |
2237 | */ |
2238 | static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm) |
2239 | { |
2240 | return ((BIT(mvm->trans->trans_cfg->base_params->num_of_queues) - 1) & |
2241 | ~BIT(IWL_MVM_DQA_CMD_QUEUE)); |
2242 | } |
2243 | |
2244 | void iwl_mvm_stop_device(struct iwl_mvm *mvm); |
2245 | |
2246 | /* Thermal management and CT-kill */ |
2247 | void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff); |
2248 | void iwl_mvm_temp_notif(struct iwl_mvm *mvm, |
2249 | struct iwl_rx_cmd_buffer *rxb); |
2250 | void iwl_mvm_tt_handler(struct iwl_mvm *mvm); |
2251 | void iwl_mvm_thermal_initialize(struct iwl_mvm *mvm, u32 min_backoff); |
2252 | void iwl_mvm_thermal_exit(struct iwl_mvm *mvm); |
2253 | void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state); |
2254 | int iwl_mvm_get_temp(struct iwl_mvm *mvm, s32 *temp); |
2255 | void iwl_mvm_ct_kill_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
2256 | void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm); |
2257 | int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm); |
2258 | int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 budget); |
2259 | |
2260 | #if IS_ENABLED(CONFIG_IWLMEI) |
2261 | |
2262 | /* vendor commands */ |
2263 | void iwl_mvm_vendor_cmds_register(struct iwl_mvm *mvm); |
2264 | |
2265 | #else |
2266 | |
2267 | static inline void iwl_mvm_vendor_cmds_register(struct iwl_mvm *mvm) {} |
2268 | |
2269 | #endif |
2270 | |
2271 | /* Location Aware Regulatory */ |
2272 | struct iwl_mcc_update_resp_v8 * |
2273 | iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, |
2274 | enum iwl_mcc_source src_id); |
2275 | int iwl_mvm_init_mcc(struct iwl_mvm *mvm); |
2276 | void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm, |
2277 | struct iwl_rx_cmd_buffer *rxb); |
2278 | struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy, |
2279 | const char *alpha2, |
2280 | enum iwl_mcc_source src_id, |
2281 | bool *changed); |
2282 | struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm, |
2283 | bool *changed); |
2284 | int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm, bool force_regd_sync); |
2285 | void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm); |
2286 | |
2287 | /* smart fifo */ |
2288 | int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2289 | bool added_vif); |
2290 | |
2291 | /* FTM responder */ |
2292 | int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2293 | struct ieee80211_bss_conf *bss_conf); |
2294 | void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm, |
2295 | struct ieee80211_vif *vif, |
2296 | struct ieee80211_bss_conf *bss_conf); |
2297 | void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm, |
2298 | struct iwl_rx_cmd_buffer *rxb); |
2299 | int iwl_mvm_ftm_resp_remove_pasn_sta(struct iwl_mvm *mvm, |
2300 | struct ieee80211_vif *vif, u8 *addr); |
2301 | int iwl_mvm_ftm_respoder_add_pasn_sta(struct iwl_mvm *mvm, |
2302 | struct ieee80211_vif *vif, |
2303 | u8 *addr, u32 cipher, u8 *tk, u32 tk_len, |
2304 | u8 *hltk, u32 hltk_len); |
2305 | void iwl_mvm_ftm_responder_clear(struct iwl_mvm *mvm, |
2306 | struct ieee80211_vif *vif); |
2307 | |
2308 | /* FTM initiator */ |
2309 | void iwl_mvm_ftm_restart(struct iwl_mvm *mvm); |
2310 | void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, |
2311 | struct iwl_rx_cmd_buffer *rxb); |
2312 | void iwl_mvm_ftm_lc_notif(struct iwl_mvm *mvm, |
2313 | struct iwl_rx_cmd_buffer *rxb); |
2314 | int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2315 | struct cfg80211_pmsr_request *request); |
2316 | void iwl_mvm_ftm_abort(struct iwl_mvm *mvm, struct cfg80211_pmsr_request *req); |
2317 | void iwl_mvm_ftm_initiator_smooth_config(struct iwl_mvm *mvm); |
2318 | void iwl_mvm_ftm_initiator_smooth_stop(struct iwl_mvm *mvm); |
2319 | int iwl_mvm_ftm_add_pasn_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2320 | u8 *addr, u32 cipher, u8 *tk, u32 tk_len, |
2321 | u8 *hltk, u32 hltk_len); |
2322 | void iwl_mvm_ftm_remove_pasn_sta(struct iwl_mvm *mvm, u8 *addr); |
2323 | |
2324 | /* TDLS */ |
2325 | |
2326 | /* |
2327 | * We use TID 4 (VI) as a FW-used-only TID when TDLS connections are present. |
2328 | * This TID is marked as used vs the AP and all connected TDLS peers. |
2329 | */ |
2330 | #define IWL_MVM_TDLS_FW_TID 4 |
2331 | |
2332 | int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
2333 | void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm); |
2334 | void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2335 | bool sta_added); |
2336 | void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw, |
2337 | struct ieee80211_vif *vif, |
2338 | unsigned int link_id); |
2339 | int iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw, |
2340 | struct ieee80211_vif *vif, |
2341 | struct ieee80211_sta *sta, u8 oper_class, |
2342 | struct cfg80211_chan_def *chandef, |
2343 | struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie); |
2344 | void iwl_mvm_tdls_recv_channel_switch(struct ieee80211_hw *hw, |
2345 | struct ieee80211_vif *vif, |
2346 | struct ieee80211_tdls_ch_sw_params *params); |
2347 | void iwl_mvm_tdls_cancel_channel_switch(struct ieee80211_hw *hw, |
2348 | struct ieee80211_vif *vif, |
2349 | struct ieee80211_sta *sta); |
2350 | void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
2351 | void iwl_mvm_tdls_ch_switch_work(struct work_struct *work); |
2352 | |
2353 | void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, |
2354 | enum iwl_mvm_rxq_notif_type type, |
2355 | bool sync, |
2356 | const void *data, u32 size); |
2357 | struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm); |
2358 | struct ieee80211_vif *iwl_mvm_get_vif_by_macid(struct iwl_mvm *mvm, u32 macid); |
2359 | bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm); |
2360 | |
2361 | #define MVM_TCM_PERIOD_MSEC 500 |
2362 | #define MVM_TCM_PERIOD (HZ * MVM_TCM_PERIOD_MSEC / 1000) |
2363 | #define MVM_LL_PERIOD (10 * HZ) |
2364 | void iwl_mvm_tcm_work(struct work_struct *work); |
2365 | void iwl_mvm_recalc_tcm(struct iwl_mvm *mvm); |
2366 | void iwl_mvm_pause_tcm(struct iwl_mvm *mvm, bool with_cancel); |
2367 | void iwl_mvm_resume_tcm(struct iwl_mvm *mvm); |
2368 | void iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
2369 | void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
2370 | u8 iwl_mvm_tcm_load_percentage(u32 airtime, u32 elapsed); |
2371 | |
2372 | void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error); |
2373 | unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, |
2374 | struct ieee80211_vif *vif, |
2375 | bool tdls, bool cmd_q); |
2376 | void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2377 | const char *errmsg); |
2378 | void iwl_mvm_event_frame_timeout_callback(struct iwl_mvm *mvm, |
2379 | struct ieee80211_vif *vif, |
2380 | const struct ieee80211_sta *sta, |
2381 | u16 tid); |
2382 | void iwl_mvm_mei_scan_filter_init(struct iwl_mei_scan_filter *mei_scan_filter); |
2383 | |
2384 | void iwl_mvm_ptp_init(struct iwl_mvm *mvm); |
2385 | void iwl_mvm_ptp_remove(struct iwl_mvm *mvm); |
2386 | u64 iwl_mvm_ptp_get_adj_time(struct iwl_mvm *mvm, u64 base_time); |
2387 | int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b); |
2388 | int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm); |
2389 | int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm); |
2390 | void iwl_mvm_get_bios_tables(struct iwl_mvm *mvm); |
2391 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
2392 | void iwl_mvm_link_sta_add_debugfs(struct ieee80211_hw *hw, |
2393 | struct ieee80211_vif *vif, |
2394 | struct ieee80211_link_sta *link_sta, |
2395 | struct dentry *dir); |
2396 | void iwl_mvm_link_add_debugfs(struct ieee80211_hw *hw, |
2397 | struct ieee80211_vif *vif, |
2398 | struct ieee80211_bss_conf *link_conf, |
2399 | struct dentry *dir); |
2400 | #endif |
2401 | |
2402 | /* new MLD related APIs */ |
2403 | int iwl_mvm_sec_key_add(struct iwl_mvm *mvm, |
2404 | struct ieee80211_vif *vif, |
2405 | struct ieee80211_sta *sta, |
2406 | struct ieee80211_key_conf *keyconf); |
2407 | int iwl_mvm_sec_key_del(struct iwl_mvm *mvm, |
2408 | struct ieee80211_vif *vif, |
2409 | struct ieee80211_sta *sta, |
2410 | struct ieee80211_key_conf *keyconf); |
2411 | int iwl_mvm_sec_key_del_pasn(struct iwl_mvm *mvm, |
2412 | struct ieee80211_vif *vif, |
2413 | u32 sta_mask, |
2414 | struct ieee80211_key_conf *keyconf); |
2415 | void iwl_mvm_sec_key_remove_ap(struct iwl_mvm *mvm, |
2416 | struct ieee80211_vif *vif, |
2417 | struct iwl_mvm_vif_link_info *link, |
2418 | unsigned int link_id); |
2419 | int iwl_mvm_mld_update_sta_keys(struct iwl_mvm *mvm, |
2420 | struct ieee80211_vif *vif, |
2421 | struct ieee80211_sta *sta, |
2422 | u32 old_sta_mask, |
2423 | u32 new_sta_mask); |
2424 | int iwl_mvm_mld_send_key(struct iwl_mvm *mvm, u32 sta_mask, u32 key_flags, |
2425 | struct ieee80211_key_conf *keyconf); |
2426 | u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm, |
2427 | struct ieee80211_vif *vif, |
2428 | struct ieee80211_sta *sta, |
2429 | struct ieee80211_key_conf *keyconf); |
2430 | |
2431 | bool iwl_rfi_supported(struct iwl_mvm *mvm); |
2432 | int iwl_rfi_send_config_cmd(struct iwl_mvm *mvm, |
2433 | struct iwl_rfi_lut_entry *rfi_table); |
2434 | struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm); |
2435 | void iwl_rfi_deactivate_notif_handler(struct iwl_mvm *mvm, |
2436 | struct iwl_rx_cmd_buffer *rxb); |
2437 | |
2438 | static inline u8 iwl_mvm_phy_band_from_nl80211(enum nl80211_band band) |
2439 | { |
2440 | switch (band) { |
2441 | case NL80211_BAND_2GHZ: |
2442 | return PHY_BAND_24; |
2443 | case NL80211_BAND_5GHZ: |
2444 | return PHY_BAND_5; |
2445 | case NL80211_BAND_6GHZ: |
2446 | return PHY_BAND_6; |
2447 | default: |
2448 | WARN_ONCE(1, "Unsupported band (%u)\n" , band); |
2449 | return PHY_BAND_5; |
2450 | } |
2451 | } |
2452 | |
2453 | /* Channel Switch */ |
2454 | void iwl_mvm_channel_switch_disconnect_wk(struct work_struct *wk); |
2455 | int iwl_mvm_post_channel_switch(struct ieee80211_hw *hw, |
2456 | struct ieee80211_vif *vif, |
2457 | struct ieee80211_bss_conf *link); |
2458 | |
2459 | /* Channel Context */ |
2460 | /** |
2461 | * struct iwl_mvm_switch_vif_chanctx_ops - callbacks for switch_vif_chanctx() |
2462 | * |
2463 | * Since the only difference between both MLD and |
2464 | * non-MLD versions of switch_vif_chanctx() is these function calls, |
2465 | * each version will send its specific function calls to |
2466 | * %iwl_mvm_switch_vif_chanctx_common(). |
2467 | * |
2468 | * @__assign_vif_chanctx: pointer to the function that assigns a chanctx to |
2469 | * a given vif |
2470 | * @__unassign_vif_chanctx: pointer to the function that unassigns a chanctx to |
2471 | * a given vif |
2472 | */ |
2473 | struct iwl_mvm_switch_vif_chanctx_ops { |
2474 | int (*__assign_vif_chanctx)(struct iwl_mvm *mvm, |
2475 | struct ieee80211_vif *vif, |
2476 | struct ieee80211_bss_conf *link_conf, |
2477 | struct ieee80211_chanctx_conf *ctx, |
2478 | bool switching_chanctx); |
2479 | void (*__unassign_vif_chanctx)(struct iwl_mvm *mvm, |
2480 | struct ieee80211_vif *vif, |
2481 | struct ieee80211_bss_conf *link_conf, |
2482 | struct ieee80211_chanctx_conf *ctx, |
2483 | bool switching_chanctx); |
2484 | }; |
2485 | |
2486 | int |
2487 | iwl_mvm_switch_vif_chanctx_common(struct ieee80211_hw *hw, |
2488 | struct ieee80211_vif_chanctx_switch *vifs, |
2489 | int n_vifs, |
2490 | enum ieee80211_chanctx_switch_mode mode, |
2491 | const struct iwl_mvm_switch_vif_chanctx_ops *ops); |
2492 | |
2493 | /* Channel info utils */ |
2494 | static inline bool iwl_mvm_has_ultra_hb_channel(struct iwl_mvm *mvm) |
2495 | { |
2496 | return fw_has_capa(&mvm->fw->ucode_capa, |
2497 | IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS); |
2498 | } |
2499 | |
2500 | static inline void *iwl_mvm_chan_info_cmd_tail(struct iwl_mvm *mvm, |
2501 | struct iwl_fw_channel_info *ci) |
2502 | { |
2503 | return (u8 *)ci + (iwl_mvm_has_ultra_hb_channel(mvm) ? |
2504 | sizeof(struct iwl_fw_channel_info) : |
2505 | sizeof(struct iwl_fw_channel_info_v1)); |
2506 | } |
2507 | |
2508 | static inline size_t iwl_mvm_chan_info_padding(struct iwl_mvm *mvm) |
2509 | { |
2510 | return iwl_mvm_has_ultra_hb_channel(mvm) ? 0 : |
2511 | sizeof(struct iwl_fw_channel_info) - |
2512 | sizeof(struct iwl_fw_channel_info_v1); |
2513 | } |
2514 | |
2515 | static inline void iwl_mvm_set_chan_info(struct iwl_mvm *mvm, |
2516 | struct iwl_fw_channel_info *ci, |
2517 | u32 chan, u8 band, u8 width, |
2518 | u8 ctrl_pos) |
2519 | { |
2520 | if (iwl_mvm_has_ultra_hb_channel(mvm)) { |
2521 | ci->channel = cpu_to_le32(chan); |
2522 | ci->band = band; |
2523 | ci->width = width; |
2524 | ci->ctrl_pos = ctrl_pos; |
2525 | } else { |
2526 | struct iwl_fw_channel_info_v1 *ci_v1 = |
2527 | (struct iwl_fw_channel_info_v1 *)ci; |
2528 | |
2529 | ci_v1->channel = chan; |
2530 | ci_v1->band = band; |
2531 | ci_v1->width = width; |
2532 | ci_v1->ctrl_pos = ctrl_pos; |
2533 | } |
2534 | } |
2535 | |
2536 | static inline void |
2537 | iwl_mvm_set_chan_info_chandef(struct iwl_mvm *mvm, |
2538 | struct iwl_fw_channel_info *ci, |
2539 | const struct cfg80211_chan_def *chandef) |
2540 | { |
2541 | enum nl80211_band band = chandef->chan->band; |
2542 | |
2543 | iwl_mvm_set_chan_info(mvm, ci, chan: chandef->chan->hw_value, |
2544 | band: iwl_mvm_phy_band_from_nl80211(band), |
2545 | width: iwl_mvm_get_channel_width(chandef), |
2546 | ctrl_pos: iwl_mvm_get_ctrl_pos(chandef)); |
2547 | } |
2548 | |
2549 | static inline int iwl_umac_scan_get_max_profiles(const struct iwl_fw *fw) |
2550 | { |
2551 | u8 ver = iwl_fw_lookup_cmd_ver(fw, SCAN_OFFLOAD_UPDATE_PROFILES_CMD, |
2552 | IWL_FW_CMD_VER_UNKNOWN); |
2553 | return (ver == IWL_FW_CMD_VER_UNKNOWN || ver < 3) ? |
2554 | IWL_SCAN_MAX_PROFILES : IWL_SCAN_MAX_PROFILES_V2; |
2555 | } |
2556 | |
2557 | static inline |
2558 | enum iwl_location_cipher iwl_mvm_cipher_to_location_cipher(u32 cipher) |
2559 | { |
2560 | switch (cipher) { |
2561 | case WLAN_CIPHER_SUITE_CCMP: |
2562 | return IWL_LOCATION_CIPHER_CCMP_128; |
2563 | case WLAN_CIPHER_SUITE_GCMP: |
2564 | return IWL_LOCATION_CIPHER_GCMP_128; |
2565 | case WLAN_CIPHER_SUITE_GCMP_256: |
2566 | return IWL_LOCATION_CIPHER_GCMP_256; |
2567 | default: |
2568 | return IWL_LOCATION_CIPHER_INVALID; |
2569 | } |
2570 | } |
2571 | |
2572 | struct iwl_mvm_csme_conn_info *iwl_mvm_get_csme_conn_info(struct iwl_mvm *mvm); |
2573 | static inline int iwl_mvm_mei_get_ownership(struct iwl_mvm *mvm) |
2574 | { |
2575 | if (mvm->mei_registered) |
2576 | return iwl_mei_get_ownership(); |
2577 | return 0; |
2578 | } |
2579 | |
2580 | static inline void iwl_mvm_mei_tx_copy_to_csme(struct iwl_mvm *mvm, |
2581 | struct sk_buff *skb, |
2582 | unsigned int ivlen) |
2583 | { |
2584 | if (mvm->mei_registered) |
2585 | iwl_mei_tx_copy_to_csme(skb, ivlen); |
2586 | } |
2587 | |
2588 | static inline void iwl_mvm_mei_host_disassociated(struct iwl_mvm *mvm) |
2589 | { |
2590 | if (mvm->mei_registered) |
2591 | iwl_mei_host_disassociated(); |
2592 | } |
2593 | |
2594 | static inline void iwl_mvm_mei_device_state(struct iwl_mvm *mvm, bool up) |
2595 | { |
2596 | if (mvm->mei_registered) |
2597 | iwl_mei_device_state(up); |
2598 | } |
2599 | |
2600 | static inline void iwl_mvm_mei_set_sw_rfkill_state(struct iwl_mvm *mvm) |
2601 | { |
2602 | bool sw_rfkill = |
2603 | mvm->hw_registered ? rfkill_soft_blocked(rfkill: mvm->hw->wiphy->rfkill) : false; |
2604 | |
2605 | if (mvm->mei_registered) |
2606 | iwl_mei_set_rfkill_state(iwl_mvm_is_radio_killed(mvm), |
2607 | sw_rfkill); |
2608 | } |
2609 | |
2610 | static inline bool iwl_mvm_mei_filter_scan(struct iwl_mvm *mvm, |
2611 | struct sk_buff *skb) |
2612 | { |
2613 | struct ieee80211_mgmt *mgmt = (void *)skb->data; |
2614 | |
2615 | if (mvm->mei_scan_filter.is_mei_limited_scan && |
2616 | (ieee80211_is_probe_resp(fc: mgmt->frame_control) || |
2617 | ieee80211_is_beacon(fc: mgmt->frame_control))) { |
2618 | skb_queue_tail(list: &mvm->mei_scan_filter.scan_res, newsk: skb); |
2619 | schedule_work(work: &mvm->mei_scan_filter.scan_work); |
2620 | return true; |
2621 | } |
2622 | |
2623 | return false; |
2624 | } |
2625 | |
2626 | void iwl_mvm_send_roaming_forbidden_event(struct iwl_mvm *mvm, |
2627 | struct ieee80211_vif *vif, |
2628 | bool forbidden); |
2629 | |
2630 | /* Callbacks for ieee80211_ops */ |
2631 | void iwl_mvm_mac_tx(struct ieee80211_hw *hw, |
2632 | struct ieee80211_tx_control *control, struct sk_buff *skb); |
2633 | void iwl_mvm_mac_wake_tx_queue(struct ieee80211_hw *hw, |
2634 | struct ieee80211_txq *txq); |
2635 | |
2636 | int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, |
2637 | struct ieee80211_vif *vif, |
2638 | struct ieee80211_ampdu_params *params); |
2639 | int iwl_mvm_op_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); |
2640 | int iwl_mvm_op_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); |
2641 | int iwl_mvm_mac_start(struct ieee80211_hw *hw); |
2642 | void iwl_mvm_mac_reconfig_complete(struct ieee80211_hw *hw, |
2643 | enum ieee80211_reconfig_type reconfig_type); |
2644 | void iwl_mvm_mac_stop(struct ieee80211_hw *hw); |
2645 | static inline int iwl_mvm_mac_config(struct ieee80211_hw *hw, u32 changed) |
2646 | { |
2647 | return 0; |
2648 | } |
2649 | |
2650 | u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, |
2651 | struct netdev_hw_addr_list *mc_list); |
2652 | |
2653 | void iwl_mvm_configure_filter(struct ieee80211_hw *hw, |
2654 | unsigned int changed_flags, |
2655 | unsigned int *total_flags, u64 multicast); |
2656 | int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2657 | struct ieee80211_scan_request *hw_req); |
2658 | void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw, |
2659 | struct ieee80211_vif *vif); |
2660 | void iwl_mvm_sta_pre_rcu_remove(struct ieee80211_hw *hw, |
2661 | struct ieee80211_vif *vif, |
2662 | struct ieee80211_sta *sta); |
2663 | void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2664 | enum sta_notify_cmd cmd, |
2665 | struct ieee80211_sta *sta); |
2666 | void |
2667 | iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw, |
2668 | struct ieee80211_sta *sta, u16 tids, |
2669 | int num_frames, |
2670 | enum ieee80211_frame_release_type reason, |
2671 | bool more_data); |
2672 | void |
2673 | iwl_mvm_mac_release_buffered_frames(struct ieee80211_hw *hw, |
2674 | struct ieee80211_sta *sta, u16 tids, |
2675 | int num_frames, |
2676 | enum ieee80211_frame_release_type reason, |
2677 | bool more_data); |
2678 | int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value); |
2679 | void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2680 | struct ieee80211_sta *sta, u32 changed); |
2681 | void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw, |
2682 | struct ieee80211_vif *vif, |
2683 | struct ieee80211_prep_tx_info *info); |
2684 | void iwl_mvm_mac_mgd_complete_tx(struct ieee80211_hw *hw, |
2685 | struct ieee80211_vif *vif, |
2686 | struct ieee80211_prep_tx_info *info); |
2687 | void iwl_mvm_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2688 | u32 queues, bool drop); |
2689 | void iwl_mvm_mac_flush_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2690 | struct ieee80211_sta *sta); |
2691 | int iwl_mvm_mac_sched_scan_start(struct ieee80211_hw *hw, |
2692 | struct ieee80211_vif *vif, |
2693 | struct cfg80211_sched_scan_request *req, |
2694 | struct ieee80211_scan_ies *ies); |
2695 | int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, |
2696 | struct ieee80211_vif *vif); |
2697 | int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
2698 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, |
2699 | struct ieee80211_key_conf *key); |
2700 | void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw, |
2701 | struct ieee80211_vif *vif, |
2702 | struct ieee80211_key_conf *keyconf, |
2703 | struct ieee80211_sta *sta, |
2704 | u32 iv32, u16 *phase1key); |
2705 | int iwl_mvm_add_chanctx(struct ieee80211_hw *hw, |
2706 | struct ieee80211_chanctx_conf *ctx); |
2707 | void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw, |
2708 | struct ieee80211_chanctx_conf *ctx); |
2709 | void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, |
2710 | struct ieee80211_chanctx_conf *ctx, u32 changed); |
2711 | int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw); |
2712 | void iwl_mvm_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2713 | struct ieee80211_channel_switch *chsw); |
2714 | int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw, |
2715 | struct ieee80211_vif *vif, |
2716 | struct ieee80211_channel_switch *chsw); |
2717 | void iwl_mvm_abort_channel_switch(struct ieee80211_hw *hw, |
2718 | struct ieee80211_vif *vif, |
2719 | struct ieee80211_bss_conf *link_conf); |
2720 | void iwl_mvm_channel_switch_rx_beacon(struct ieee80211_hw *hw, |
2721 | struct ieee80211_vif *vif, |
2722 | struct ieee80211_channel_switch *chsw); |
2723 | void iwl_mvm_mac_event_callback(struct ieee80211_hw *hw, |
2724 | struct ieee80211_vif *vif, |
2725 | const struct ieee80211_event *event); |
2726 | void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw); |
2727 | int iwl_mvm_mac_testmode_cmd(struct ieee80211_hw *hw, |
2728 | struct ieee80211_vif *vif, |
2729 | void *data, int len); |
2730 | int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx, |
2731 | struct survey_info *survey); |
2732 | void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, |
2733 | struct ieee80211_vif *vif, |
2734 | struct ieee80211_sta *sta, |
2735 | struct station_info *sinfo); |
2736 | int |
2737 | iwl_mvm_mac_get_ftm_responder_stats(struct ieee80211_hw *hw, |
2738 | struct ieee80211_vif *vif, |
2739 | struct cfg80211_ftm_responder_stats *stats); |
2740 | int iwl_mvm_start_pmsr(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2741 | struct cfg80211_pmsr_request *request); |
2742 | void iwl_mvm_abort_pmsr(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2743 | struct cfg80211_pmsr_request *request); |
2744 | |
2745 | bool iwl_mvm_have_links_same_channel(struct iwl_mvm_vif *vif1, |
2746 | struct iwl_mvm_vif *vif2); |
2747 | bool iwl_mvm_vif_is_active(struct iwl_mvm_vif *mvmvif); |
2748 | int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2749 | s16 tx_power); |
2750 | int iwl_mvm_set_hw_timestamp(struct ieee80211_hw *hw, |
2751 | struct ieee80211_vif *vif, |
2752 | struct cfg80211_set_hw_timestamp *hwts); |
2753 | int iwl_mvm_update_mu_groups(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
2754 | bool iwl_mvm_enable_fils(struct iwl_mvm *mvm, |
2755 | struct ieee80211_chanctx_conf *ctx); |
2756 | void iwl_mvm_mld_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
2757 | bool valid_links_changed); |
2758 | int iwl_mvm_mld_get_primary_link(struct iwl_mvm *mvm, |
2759 | struct ieee80211_vif *vif, |
2760 | unsigned long usable_links); |
2761 | |
2762 | bool iwl_mvm_is_ftm_responder_chanctx(struct iwl_mvm *mvm, |
2763 | struct ieee80211_chanctx_conf *ctx); |
2764 | |
2765 | static inline struct cfg80211_chan_def * |
2766 | iwl_mvm_chanctx_def(struct iwl_mvm *mvm, struct ieee80211_chanctx_conf *ctx) |
2767 | { |
2768 | bool use_def = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx) || |
2769 | iwl_mvm_enable_fils(mvm, ctx); |
2770 | |
2771 | return use_def ? &ctx->def : &ctx->min_def; |
2772 | } |
2773 | |
2774 | void iwl_mvm_roc_duration_and_delay(struct ieee80211_vif *vif, |
2775 | u32 duration_ms, |
2776 | u32 *duration_tu, |
2777 | u32 *delay); |
2778 | int iwl_mvm_roc_add_cmd(struct iwl_mvm *mvm, |
2779 | struct ieee80211_channel *channel, |
2780 | struct ieee80211_vif *vif, |
2781 | int duration, u32 activity); |
2782 | #endif /* __IWL_MVM_H__ */ |
2783 | |