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