| .. | .. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * GPL LICENSE SUMMARY |
|---|
| 7 | 7 | * |
|---|
| 8 | | - * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
|---|
| 8 | + * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation. All rights reserved. |
|---|
| 9 | 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
|---|
| 10 | 10 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
|---|
| 11 | | - * Copyright(c) 2018 Intel Corporation |
|---|
| 12 | 11 | * |
|---|
| 13 | 12 | * This program is free software; you can redistribute it and/or modify |
|---|
| 14 | 13 | * it under the terms of version 2 of the GNU General Public License as |
|---|
| .. | .. |
|---|
| 19 | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 20 | 19 | * General Public License for more details. |
|---|
| 21 | 20 | * |
|---|
| 22 | | - * You should have received a copy of the GNU General Public License |
|---|
| 23 | | - * along with this program; if not, write to the Free Software |
|---|
| 24 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
|---|
| 25 | | - * USA |
|---|
| 26 | | - * |
|---|
| 27 | 21 | * The full GNU General Public License is included in this distribution |
|---|
| 28 | 22 | * in the file called COPYING. |
|---|
| 29 | 23 | * |
|---|
| .. | .. |
|---|
| 33 | 27 | * |
|---|
| 34 | 28 | * BSD LICENSE |
|---|
| 35 | 29 | * |
|---|
| 36 | | - * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
|---|
| 30 | + * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation. All rights reserved. |
|---|
| 37 | 31 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
|---|
| 38 | 32 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
|---|
| 39 | | - * Copyright(c) 2018 Intel Corporation |
|---|
| 40 | 33 | * All rights reserved. |
|---|
| 41 | 34 | * |
|---|
| 42 | 35 | * Redistribution and use in source and binary forms, with or without |
|---|
| .. | .. |
|---|
| 88 | 81 | #include "sta.h" |
|---|
| 89 | 82 | #include "fw-api.h" |
|---|
| 90 | 83 | #include "constants.h" |
|---|
| 91 | | -#include "tof.h" |
|---|
| 92 | 84 | #include "fw/runtime.h" |
|---|
| 93 | 85 | #include "fw/dbg.h" |
|---|
| 94 | 86 | #include "fw/acpi.h" |
|---|
| .. | .. |
|---|
| 100 | 92 | /* RSSI offset for WkP */ |
|---|
| 101 | 93 | #define IWL_RSSI_OFFSET 50 |
|---|
| 102 | 94 | #define IWL_MVM_MISSED_BEACONS_THRESHOLD 8 |
|---|
| 95 | +#define IWL_MVM_MISSED_BEACONS_THRESHOLD_LONG 16 |
|---|
| 96 | + |
|---|
| 103 | 97 | /* A TimeUnit is 1024 microsecond */ |
|---|
| 104 | 98 | #define MSEC_TO_TU(_msec) (_msec*1000/1024) |
|---|
| 105 | 99 | |
|---|
| .. | .. |
|---|
| 138 | 132 | * We will register to mac80211 to have testmode working. The NIC must not |
|---|
| 139 | 133 | * be up'ed after the INIT fw asserted. This is useful to be able to use |
|---|
| 140 | 134 | * proprietary tools over testmode to debug the INIT fw. |
|---|
| 141 | | - * @tfd_q_hang_detect: enabled the detection of hung transmit queues |
|---|
| 142 | 135 | * @power_scheme: one of enum iwl_power_scheme |
|---|
| 143 | 136 | */ |
|---|
| 144 | 137 | struct iwl_mvm_mod_params { |
|---|
| 145 | 138 | bool init_dbg; |
|---|
| 146 | | - bool tfd_q_hang_detect; |
|---|
| 147 | 139 | int power_scheme; |
|---|
| 148 | 140 | }; |
|---|
| 149 | 141 | extern struct iwl_mvm_mod_params iwlmvm_mod_params; |
|---|
| .. | .. |
|---|
| 262 | 254 | NUM_IWL_MVM_SMPS_REQ, |
|---|
| 263 | 255 | }; |
|---|
| 264 | 256 | |
|---|
| 265 | | -enum iwl_mvm_ref_type { |
|---|
| 266 | | - IWL_MVM_REF_UCODE_DOWN, |
|---|
| 267 | | - IWL_MVM_REF_SCAN, |
|---|
| 268 | | - IWL_MVM_REF_ROC, |
|---|
| 269 | | - IWL_MVM_REF_ROC_AUX, |
|---|
| 270 | | - IWL_MVM_REF_P2P_CLIENT, |
|---|
| 271 | | - IWL_MVM_REF_AP_IBSS, |
|---|
| 272 | | - IWL_MVM_REF_USER, |
|---|
| 273 | | - IWL_MVM_REF_TX, |
|---|
| 274 | | - IWL_MVM_REF_TX_AGG, |
|---|
| 275 | | - IWL_MVM_REF_ADD_IF, |
|---|
| 276 | | - IWL_MVM_REF_START_AP, |
|---|
| 277 | | - IWL_MVM_REF_BSS_CHANGED, |
|---|
| 278 | | - IWL_MVM_REF_PREPARE_TX, |
|---|
| 279 | | - IWL_MVM_REF_PROTECT_TDLS, |
|---|
| 280 | | - IWL_MVM_REF_CHECK_CTKILL, |
|---|
| 281 | | - IWL_MVM_REF_PRPH_READ, |
|---|
| 282 | | - IWL_MVM_REF_PRPH_WRITE, |
|---|
| 283 | | - IWL_MVM_REF_NMI, |
|---|
| 284 | | - IWL_MVM_REF_TM_CMD, |
|---|
| 285 | | - IWL_MVM_REF_EXIT_WORK, |
|---|
| 286 | | - IWL_MVM_REF_PROTECT_CSA, |
|---|
| 287 | | - IWL_MVM_REF_FW_DBG_COLLECT, |
|---|
| 288 | | - IWL_MVM_REF_INIT_UCODE, |
|---|
| 289 | | - IWL_MVM_REF_SENDING_CMD, |
|---|
| 290 | | - IWL_MVM_REF_RX, |
|---|
| 291 | | - |
|---|
| 292 | | - /* update debugfs.c when changing this */ |
|---|
| 293 | | - |
|---|
| 294 | | - IWL_MVM_REF_COUNT, |
|---|
| 295 | | -}; |
|---|
| 296 | | - |
|---|
| 297 | 257 | enum iwl_bt_force_ant_mode { |
|---|
| 298 | 258 | BT_FORCE_ANT_DIS = 0, |
|---|
| 299 | 259 | BT_FORCE_ANT_AUTO, |
|---|
| .. | .. |
|---|
| 304 | 264 | }; |
|---|
| 305 | 265 | |
|---|
| 306 | 266 | /** |
|---|
| 267 | + * struct iwl_mvm_low_latency_force - low latency force mode set by debugfs |
|---|
| 268 | + * @LOW_LATENCY_FORCE_UNSET: unset force mode |
|---|
| 269 | + * @LOW_LATENCY_FORCE_ON: for low latency on |
|---|
| 270 | + * @LOW_LATENCY_FORCE_OFF: for low latency off |
|---|
| 271 | + * @NUM_LOW_LATENCY_FORCE: max num of modes |
|---|
| 272 | + */ |
|---|
| 273 | +enum iwl_mvm_low_latency_force { |
|---|
| 274 | + LOW_LATENCY_FORCE_UNSET, |
|---|
| 275 | + LOW_LATENCY_FORCE_ON, |
|---|
| 276 | + LOW_LATENCY_FORCE_OFF, |
|---|
| 277 | + NUM_LOW_LATENCY_FORCE |
|---|
| 278 | +}; |
|---|
| 279 | + |
|---|
| 280 | +/** |
|---|
| 307 | 281 | * struct iwl_mvm_low_latency_cause - low latency set causes |
|---|
| 308 | 282 | * @LOW_LATENCY_TRAFFIC: indicates low latency traffic was detected |
|---|
| 309 | 283 | * @LOW_LATENCY_DEBUGFS: low latency mode set from debugfs |
|---|
| 310 | 284 | * @LOW_LATENCY_VCMD: low latency mode set from vendor command |
|---|
| 285 | +* @LOW_LATENCY_VIF_TYPE: low latency mode set because of vif type (ap) |
|---|
| 286 | +* @LOW_LATENCY_DEBUGFS_FORCE_ENABLE: indicate that force mode is enabled |
|---|
| 287 | +* the actual set/unset is done with LOW_LATENCY_DEBUGFS_FORCE |
|---|
| 288 | +* @LOW_LATENCY_DEBUGFS_FORCE: low latency force mode from debugfs |
|---|
| 289 | +* set this with LOW_LATENCY_DEBUGFS_FORCE_ENABLE flag |
|---|
| 290 | +* in low_latency. |
|---|
| 311 | 291 | */ |
|---|
| 312 | 292 | enum iwl_mvm_low_latency_cause { |
|---|
| 313 | 293 | LOW_LATENCY_TRAFFIC = BIT(0), |
|---|
| 314 | 294 | LOW_LATENCY_DEBUGFS = BIT(1), |
|---|
| 315 | 295 | LOW_LATENCY_VCMD = BIT(2), |
|---|
| 296 | + LOW_LATENCY_VIF_TYPE = BIT(3), |
|---|
| 297 | + LOW_LATENCY_DEBUGFS_FORCE_ENABLE = BIT(4), |
|---|
| 298 | + LOW_LATENCY_DEBUGFS_FORCE = BIT(5), |
|---|
| 316 | 299 | }; |
|---|
| 317 | 300 | |
|---|
| 318 | 301 | /** |
|---|
| .. | .. |
|---|
| 336 | 319 | }; |
|---|
| 337 | 320 | |
|---|
| 338 | 321 | /** |
|---|
| 322 | + * struct iwl_probe_resp_data - data for NoA/CSA updates |
|---|
| 323 | + * @rcu_head: used for freeing the data on update |
|---|
| 324 | + * @notif: notification data |
|---|
| 325 | + * @noa_len: length of NoA attribute, calculated from the notification |
|---|
| 326 | + */ |
|---|
| 327 | +struct iwl_probe_resp_data { |
|---|
| 328 | + struct rcu_head rcu_head; |
|---|
| 329 | + struct iwl_probe_resp_data_notif notif; |
|---|
| 330 | + int noa_len; |
|---|
| 331 | +}; |
|---|
| 332 | + |
|---|
| 333 | +/** |
|---|
| 339 | 334 | * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context |
|---|
| 340 | 335 | * @id: between 0 and 3 |
|---|
| 341 | 336 | * @color: to solve races upon MAC addition and removal |
|---|
| .. | .. |
|---|
| 351 | 346 | * @pm_enabled - Indicate if MAC power management is allowed |
|---|
| 352 | 347 | * @monitor_active: indicates that monitor context is configured, and that the |
|---|
| 353 | 348 | * interface should get quota etc. |
|---|
| 354 | | - * @low_latency: indicates low latency is set, see |
|---|
| 355 | | - * enum &iwl_mvm_low_latency_cause for causes. |
|---|
| 349 | + * @low_latency: bit flags for low latency |
|---|
| 350 | + * see enum &iwl_mvm_low_latency_cause for causes. |
|---|
| 351 | + * @low_latency_actual: boolean, indicates low latency is set, |
|---|
| 352 | + * as a result from low_latency bit flags and takes force into account. |
|---|
| 356 | 353 | * @ps_disabled: indicates that this interface requires PS to be disabled |
|---|
| 357 | 354 | * @queue_params: QoS params for this MAC |
|---|
| 358 | 355 | * @bcast_sta: station used for broadcast packets. Used by the following |
|---|
| .. | .. |
|---|
| 365 | 362 | * average signal of beacons retrieved from the firmware |
|---|
| 366 | 363 | * @csa_failed: CSA failed to schedule time event, report an error later |
|---|
| 367 | 364 | * @features: hw features active for this vif |
|---|
| 365 | + * @probe_resp_data: data from FW notification to store NOA and CSA related |
|---|
| 366 | + * data to be inserted into probe response. |
|---|
| 368 | 367 | */ |
|---|
| 369 | 368 | struct iwl_mvm_vif { |
|---|
| 370 | 369 | struct iwl_mvm *mvm; |
|---|
| .. | .. |
|---|
| 382 | 381 | bool ap_ibss_active; |
|---|
| 383 | 382 | bool pm_enabled; |
|---|
| 384 | 383 | bool monitor_active; |
|---|
| 385 | | - u8 low_latency; |
|---|
| 384 | + u8 low_latency: 6; |
|---|
| 385 | + u8 low_latency_actual: 1; |
|---|
| 386 | 386 | bool ps_disabled; |
|---|
| 387 | 387 | struct iwl_mvm_vif_bf_data bf_data; |
|---|
| 388 | 388 | |
|---|
| .. | .. |
|---|
| 416 | 416 | #ifdef CONFIG_PM |
|---|
| 417 | 417 | /* WoWLAN GTK rekey data */ |
|---|
| 418 | 418 | struct { |
|---|
| 419 | | - u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; |
|---|
| 419 | + u8 kck[NL80211_KCK_EXT_LEN]; |
|---|
| 420 | + u8 kek[NL80211_KEK_EXT_LEN]; |
|---|
| 421 | + size_t kek_len; |
|---|
| 422 | + size_t kck_len; |
|---|
| 423 | + u32 akm; |
|---|
| 420 | 424 | __le64 replay_ctr; |
|---|
| 421 | 425 | bool valid; |
|---|
| 422 | 426 | } rekey_data; |
|---|
| .. | .. |
|---|
| 454 | 458 | bool csa_countdown; |
|---|
| 455 | 459 | bool csa_failed; |
|---|
| 456 | 460 | u16 csa_target_freq; |
|---|
| 461 | + u16 csa_count; |
|---|
| 462 | + u16 csa_misbehave; |
|---|
| 463 | + struct delayed_work csa_work; |
|---|
| 457 | 464 | |
|---|
| 458 | 465 | /* Indicates that we are waiting for a beacon on a new channel */ |
|---|
| 459 | 466 | bool csa_bcn_pending; |
|---|
| 460 | 467 | |
|---|
| 461 | 468 | /* TCP Checksum Offload */ |
|---|
| 462 | 469 | netdev_features_t features; |
|---|
| 470 | + |
|---|
| 471 | + struct iwl_probe_resp_data __rcu *probe_resp_data; |
|---|
| 472 | + |
|---|
| 473 | + /* we can only have 2 GTK + 2 IGTK active at a time */ |
|---|
| 474 | + struct ieee80211_key_conf *ap_early_keys[4]; |
|---|
| 475 | + |
|---|
| 476 | + /* 26-tone RU OFDMA transmissions should be blocked */ |
|---|
| 477 | + bool he_ru_2mhz_block; |
|---|
| 463 | 478 | }; |
|---|
| 464 | 479 | |
|---|
| 465 | 480 | static inline struct iwl_mvm_vif * |
|---|
| .. | .. |
|---|
| 500 | 515 | IWL_SCAN_TYPE_WILD, |
|---|
| 501 | 516 | IWL_SCAN_TYPE_MILD, |
|---|
| 502 | 517 | IWL_SCAN_TYPE_FRAGMENTED, |
|---|
| 518 | + IWL_SCAN_TYPE_FAST_BALANCE, |
|---|
| 503 | 519 | }; |
|---|
| 504 | 520 | |
|---|
| 505 | 521 | enum iwl_mvm_sched_scan_pass_all_states { |
|---|
| .. | .. |
|---|
| 570 | 586 | u32 fail_frames; |
|---|
| 571 | 587 | u32 last_rates[IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES]; |
|---|
| 572 | 588 | int last_frame_idx; |
|---|
| 573 | | -}; |
|---|
| 574 | | - |
|---|
| 575 | | -enum { |
|---|
| 576 | | - D0I3_DEFER_WAKEUP, |
|---|
| 577 | | - D0I3_PENDING_WAKEUP, |
|---|
| 578 | 589 | }; |
|---|
| 579 | 590 | |
|---|
| 580 | 591 | #define IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE 0xff |
|---|
| .. | .. |
|---|
| 650 | 661 | * @valid: reordering is valid for this queue |
|---|
| 651 | 662 | * @lock: protect reorder buffer internal state |
|---|
| 652 | 663 | * @mvm: mvm pointer, needed for frame timer context |
|---|
| 664 | + * @consec_oldsn_drops: consecutive drops due to old SN |
|---|
| 665 | + * @consec_oldsn_ampdu_gp2: A-MPDU GP2 timestamp to track |
|---|
| 666 | + * when to apply old SN consecutive drop workaround |
|---|
| 667 | + * @consec_oldsn_prev_drop: track whether or not an MPDU |
|---|
| 668 | + * that was single/part of the previous A-MPDU was |
|---|
| 669 | + * dropped due to old SN |
|---|
| 653 | 670 | */ |
|---|
| 654 | 671 | struct iwl_mvm_reorder_buffer { |
|---|
| 655 | 672 | u16 head_sn; |
|---|
| .. | .. |
|---|
| 663 | 680 | bool valid; |
|---|
| 664 | 681 | spinlock_t lock; |
|---|
| 665 | 682 | struct iwl_mvm *mvm; |
|---|
| 683 | + unsigned int consec_oldsn_drops; |
|---|
| 684 | + u32 consec_oldsn_ampdu_gp2; |
|---|
| 685 | + unsigned int consec_oldsn_prev_drop:1; |
|---|
| 666 | 686 | } ____cacheline_aligned_in_smp; |
|---|
| 667 | 687 | |
|---|
| 668 | 688 | /** |
|---|
| .. | .. |
|---|
| 741 | 761 | * This is a state in which a single queue serves more than one TID, all of |
|---|
| 742 | 762 | * which are not aggregated. Note that the queue is only associated to one |
|---|
| 743 | 763 | * RA. |
|---|
| 744 | | - * @IWL_MVM_QUEUE_INACTIVE: queue is allocated but no traffic on it |
|---|
| 745 | | - * This is a state of a queue that has had traffic on it, but during the |
|---|
| 746 | | - * last %IWL_MVM_DQA_QUEUE_TIMEOUT time period there has been no traffic on |
|---|
| 747 | | - * it. In this state, when a new queue is needed to be allocated but no |
|---|
| 748 | | - * such free queue exists, an inactive queue might be freed and given to |
|---|
| 749 | | - * the new RA/TID. |
|---|
| 750 | | - * @IWL_MVM_QUEUE_RECONFIGURING: queue is being reconfigured |
|---|
| 751 | | - * This is the state of a queue that has had traffic pass through it, but |
|---|
| 752 | | - * needs to be reconfigured for some reason, e.g. the queue needs to |
|---|
| 753 | | - * become unshared and aggregations re-enabled on. |
|---|
| 754 | 764 | */ |
|---|
| 755 | 765 | enum iwl_mvm_queue_status { |
|---|
| 756 | 766 | IWL_MVM_QUEUE_FREE, |
|---|
| 757 | 767 | IWL_MVM_QUEUE_RESERVED, |
|---|
| 758 | 768 | IWL_MVM_QUEUE_READY, |
|---|
| 759 | 769 | IWL_MVM_QUEUE_SHARED, |
|---|
| 760 | | - IWL_MVM_QUEUE_INACTIVE, |
|---|
| 761 | | - IWL_MVM_QUEUE_RECONFIGURING, |
|---|
| 762 | 770 | }; |
|---|
| 763 | 771 | |
|---|
| 764 | 772 | #define IWL_MVM_DQA_QUEUE_TIMEOUT (5 * HZ) |
|---|
| .. | .. |
|---|
| 766 | 774 | |
|---|
| 767 | 775 | #define IWL_MVM_NUM_CIPHERS 10 |
|---|
| 768 | 776 | |
|---|
| 769 | | -struct iwl_mvm_sar_profile { |
|---|
| 770 | | - bool enabled; |
|---|
| 771 | | - u8 table[ACPI_SAR_TABLE_SIZE]; |
|---|
| 777 | + |
|---|
| 778 | +struct iwl_mvm_txq { |
|---|
| 779 | + struct list_head list; |
|---|
| 780 | + u16 txq_id; |
|---|
| 781 | + atomic_t tx_request; |
|---|
| 782 | + bool stopped; |
|---|
| 772 | 783 | }; |
|---|
| 773 | 784 | |
|---|
| 774 | | -struct iwl_mvm_geo_profile { |
|---|
| 775 | | - u8 values[ACPI_GEO_TABLE_SIZE]; |
|---|
| 785 | +static inline struct iwl_mvm_txq * |
|---|
| 786 | +iwl_mvm_txq_from_mac80211(struct ieee80211_txq *txq) |
|---|
| 787 | +{ |
|---|
| 788 | + return (void *)txq->drv_priv; |
|---|
| 789 | +} |
|---|
| 790 | + |
|---|
| 791 | +static inline struct iwl_mvm_txq * |
|---|
| 792 | +iwl_mvm_txq_from_tid(struct ieee80211_sta *sta, u8 tid) |
|---|
| 793 | +{ |
|---|
| 794 | + if (tid == IWL_MAX_TID_COUNT) |
|---|
| 795 | + tid = IEEE80211_NUM_TIDS; |
|---|
| 796 | + |
|---|
| 797 | + return (void *)sta->txq[tid]->drv_priv; |
|---|
| 798 | +} |
|---|
| 799 | + |
|---|
| 800 | +/** |
|---|
| 801 | + * struct iwl_mvm_tvqm_txq_info - maps TVQM hw queue to tid |
|---|
| 802 | + * |
|---|
| 803 | + * @sta_id: sta id |
|---|
| 804 | + * @txq_tid: txq tid |
|---|
| 805 | + */ |
|---|
| 806 | +struct iwl_mvm_tvqm_txq_info { |
|---|
| 807 | + u8 sta_id; |
|---|
| 808 | + u8 txq_tid; |
|---|
| 809 | +}; |
|---|
| 810 | + |
|---|
| 811 | +struct iwl_mvm_dqa_txq_info { |
|---|
| 812 | + u8 ra_sta_id; /* The RA this queue is mapped to, if exists */ |
|---|
| 813 | + bool reserved; /* Is this the TXQ reserved for a STA */ |
|---|
| 814 | + u8 mac80211_ac; /* The mac80211 AC this queue is mapped to */ |
|---|
| 815 | + u8 txq_tid; /* The TID "owner" of this queue*/ |
|---|
| 816 | + u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */ |
|---|
| 817 | + /* Timestamp for inactivation per TID of this queue */ |
|---|
| 818 | + unsigned long last_frame_time[IWL_MAX_TID_COUNT + 1]; |
|---|
| 819 | + enum iwl_mvm_queue_status status; |
|---|
| 776 | 820 | }; |
|---|
| 777 | 821 | |
|---|
| 778 | 822 | struct iwl_mvm { |
|---|
| .. | .. |
|---|
| 806 | 850 | struct iwl_mvm_vif *bf_allowed_vif; |
|---|
| 807 | 851 | |
|---|
| 808 | 852 | bool hw_registered; |
|---|
| 809 | | - bool calibrating; |
|---|
| 810 | | - u32 error_event_table[2]; |
|---|
| 811 | | - u32 log_event_table; |
|---|
| 812 | | - u32 umac_error_event_table; |
|---|
| 813 | | - bool support_umac_log; |
|---|
| 853 | + bool rfkill_safe_init_done; |
|---|
| 814 | 854 | |
|---|
| 815 | 855 | u32 ampdu_ref; |
|---|
| 816 | 856 | bool ampdu_toggle; |
|---|
| .. | .. |
|---|
| 829 | 869 | u64 on_time_scan; |
|---|
| 830 | 870 | } radio_stats, accu_radio_stats; |
|---|
| 831 | 871 | |
|---|
| 832 | | - u16 hw_queue_to_mac80211[IWL_MAX_TVQM_QUEUES]; |
|---|
| 833 | | - |
|---|
| 834 | | - struct { |
|---|
| 835 | | - u8 hw_queue_refcount; |
|---|
| 836 | | - u8 ra_sta_id; /* The RA this queue is mapped to, if exists */ |
|---|
| 837 | | - bool reserved; /* Is this the TXQ reserved for a STA */ |
|---|
| 838 | | - u8 mac80211_ac; /* The mac80211 AC this queue is mapped to */ |
|---|
| 839 | | - u8 txq_tid; /* The TID "owner" of this queue*/ |
|---|
| 840 | | - u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */ |
|---|
| 841 | | - /* Timestamp for inactivation per TID of this queue */ |
|---|
| 842 | | - unsigned long last_frame_time[IWL_MAX_TID_COUNT + 1]; |
|---|
| 843 | | - enum iwl_mvm_queue_status status; |
|---|
| 844 | | - } queue_info[IWL_MAX_HW_QUEUES]; |
|---|
| 845 | | - spinlock_t queue_info_lock; /* For syncing queue mgmt operations */ |
|---|
| 872 | + struct list_head add_stream_txqs; |
|---|
| 873 | + union { |
|---|
| 874 | + struct iwl_mvm_dqa_txq_info queue_info[IWL_MAX_HW_QUEUES]; |
|---|
| 875 | + struct iwl_mvm_tvqm_txq_info tvqm_info[IWL_MAX_TVQM_QUEUES]; |
|---|
| 876 | + }; |
|---|
| 846 | 877 | struct work_struct add_stream_wk; /* To add streams to queues */ |
|---|
| 847 | | - |
|---|
| 848 | | - atomic_t mac80211_queue_stop_count[IEEE80211_MAX_QUEUES]; |
|---|
| 849 | 878 | |
|---|
| 850 | 879 | const char *nvm_file_name; |
|---|
| 851 | 880 | struct iwl_nvm_data *nvm_data; |
|---|
| .. | .. |
|---|
| 859 | 888 | |
|---|
| 860 | 889 | /* data related to data path */ |
|---|
| 861 | 890 | struct iwl_rx_phy_info last_phy_info; |
|---|
| 862 | | - struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT]; |
|---|
| 863 | | - unsigned long sta_deferred_frames[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; |
|---|
| 891 | + struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT_MAX]; |
|---|
| 864 | 892 | u8 rx_ba_sessions; |
|---|
| 865 | 893 | |
|---|
| 866 | 894 | /* configured by mac80211 */ |
|---|
| .. | .. |
|---|
| 921 | 949 | u32 dbgfs_prph_reg_addr; |
|---|
| 922 | 950 | bool disable_power_off; |
|---|
| 923 | 951 | bool disable_power_off_d3; |
|---|
| 952 | + bool beacon_inject_active; |
|---|
| 924 | 953 | |
|---|
| 925 | 954 | bool scan_iter_notif_enabled; |
|---|
| 926 | 955 | |
|---|
| .. | .. |
|---|
| 929 | 958 | struct debugfs_blob_wrapper nvm_calib_blob; |
|---|
| 930 | 959 | struct debugfs_blob_wrapper nvm_prod_blob; |
|---|
| 931 | 960 | struct debugfs_blob_wrapper nvm_phy_sku_blob; |
|---|
| 961 | + struct debugfs_blob_wrapper nvm_reg_blob; |
|---|
| 932 | 962 | |
|---|
| 933 | 963 | struct iwl_mvm_frame_stats drv_rx_stats; |
|---|
| 934 | 964 | spinlock_t drv_stats_lock; |
|---|
| .. | .. |
|---|
| 947 | 977 | unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)]; |
|---|
| 948 | 978 | u8 fw_key_deleted[STA_KEY_MAX_NUM]; |
|---|
| 949 | 979 | |
|---|
| 950 | | - /* references taken by the driver and spinlock protecting them */ |
|---|
| 951 | | - spinlock_t refs_lock; |
|---|
| 952 | | - u8 refs[IWL_MVM_REF_COUNT]; |
|---|
| 953 | | - |
|---|
| 954 | 980 | u8 vif_count; |
|---|
| 981 | + struct ieee80211_vif __rcu *vif_id_to_mac[NUM_MAC_INDEX_DRIVER]; |
|---|
| 955 | 982 | |
|---|
| 956 | 983 | /* -1 for always, 0 for never, >0 for that many times */ |
|---|
| 957 | 984 | s8 fw_restart; |
|---|
| 985 | + u8 *error_recovery_buf; |
|---|
| 958 | 986 | |
|---|
| 959 | 987 | #ifdef CONFIG_IWLWIFI_LEDS |
|---|
| 960 | 988 | struct led_classdev led; |
|---|
| .. | .. |
|---|
| 973 | 1001 | struct ieee80211_channel **nd_channels; |
|---|
| 974 | 1002 | int n_nd_channels; |
|---|
| 975 | 1003 | bool net_detect; |
|---|
| 1004 | + u8 offload_tid; |
|---|
| 976 | 1005 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
|---|
| 977 | 1006 | bool d3_wake_sysassert; |
|---|
| 978 | 1007 | bool d3_test_active; |
|---|
| 979 | | - bool store_d3_resume_sram; |
|---|
| 980 | | - void *d3_resume_sram; |
|---|
| 981 | 1008 | u32 d3_test_pme_ptr; |
|---|
| 982 | 1009 | struct ieee80211_vif *keep_vif; |
|---|
| 983 | 1010 | u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */ |
|---|
| 984 | 1011 | #endif |
|---|
| 985 | 1012 | #endif |
|---|
| 986 | 1013 | |
|---|
| 987 | | - /* d0i3 */ |
|---|
| 988 | | - u8 d0i3_ap_sta_id; |
|---|
| 989 | | - bool d0i3_offloading; |
|---|
| 990 | | - struct work_struct d0i3_exit_work; |
|---|
| 991 | | - struct sk_buff_head d0i3_tx; |
|---|
| 992 | | - /* protect d0i3_suspend_flags */ |
|---|
| 993 | | - struct mutex d0i3_suspend_mutex; |
|---|
| 994 | | - unsigned long d0i3_suspend_flags; |
|---|
| 995 | | - /* sync d0i3_tx queue and IWL_MVM_STATUS_IN_D0I3 status flag */ |
|---|
| 996 | | - spinlock_t d0i3_tx_lock; |
|---|
| 997 | | - wait_queue_head_t d0i3_exit_waitq; |
|---|
| 998 | 1014 | wait_queue_head_t rx_sync_waitq; |
|---|
| 999 | 1015 | |
|---|
| 1000 | 1016 | /* BT-Coex */ |
|---|
| .. | .. |
|---|
| 1044 | 1060 | |
|---|
| 1045 | 1061 | /* Indicate if device power save is allowed */ |
|---|
| 1046 | 1062 | u8 ps_disabled; /* u8 instead of bool to ease debugfs_create_* usage */ |
|---|
| 1047 | | - unsigned int max_amsdu_len; /* used for debugfs only */ |
|---|
| 1063 | + /* Indicate if 32Khz external clock is valid */ |
|---|
| 1064 | + u32 ext_clock_valid; |
|---|
| 1048 | 1065 | |
|---|
| 1049 | 1066 | struct ieee80211_vif __rcu *csa_vif; |
|---|
| 1050 | 1067 | struct ieee80211_vif __rcu *csa_tx_blocked_vif; |
|---|
| .. | .. |
|---|
| 1087 | 1104 | |
|---|
| 1088 | 1105 | u32 ciphers[IWL_MVM_NUM_CIPHERS]; |
|---|
| 1089 | 1106 | struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS]; |
|---|
| 1090 | | - struct iwl_mvm_tof_data tof_data; |
|---|
| 1107 | + |
|---|
| 1108 | + struct cfg80211_ftm_responder_stats ftm_resp_stats; |
|---|
| 1109 | + struct { |
|---|
| 1110 | + struct cfg80211_pmsr_request *req; |
|---|
| 1111 | + struct wireless_dev *req_wdev; |
|---|
| 1112 | + struct list_head loc_list; |
|---|
| 1113 | + int responses[IWL_MVM_TOF_MAX_APS]; |
|---|
| 1114 | + struct { |
|---|
| 1115 | + struct list_head resp; |
|---|
| 1116 | + } smooth; |
|---|
| 1117 | + struct list_head pasn_list; |
|---|
| 1118 | + } ftm_initiator; |
|---|
| 1119 | + |
|---|
| 1120 | + struct list_head resp_pasn_list; |
|---|
| 1121 | + |
|---|
| 1122 | + struct { |
|---|
| 1123 | + u8 d0i3_resp; |
|---|
| 1124 | + u8 range_resp; |
|---|
| 1125 | + } cmd_ver; |
|---|
| 1091 | 1126 | |
|---|
| 1092 | 1127 | struct ieee80211_vif *nan_vif; |
|---|
| 1093 | 1128 | #define IWL_MAX_BAID 32 |
|---|
| .. | .. |
|---|
| 1103 | 1138 | |
|---|
| 1104 | 1139 | /* does a monitor vif exist (only one can exist hence bool) */ |
|---|
| 1105 | 1140 | bool monitor_on; |
|---|
| 1106 | | -#ifdef CONFIG_ACPI |
|---|
| 1107 | | - struct iwl_mvm_sar_profile sar_profiles[ACPI_SAR_PROFILE_NUM]; |
|---|
| 1108 | | - struct iwl_mvm_geo_profile geo_profiles[ACPI_NUM_GEO_PROFILES]; |
|---|
| 1109 | | -#endif |
|---|
| 1141 | + |
|---|
| 1142 | + /* sniffer data to include in radiotap */ |
|---|
| 1143 | + __le16 cur_aid; |
|---|
| 1144 | + u8 cur_bssid[ETH_ALEN]; |
|---|
| 1110 | 1145 | }; |
|---|
| 1111 | 1146 | |
|---|
| 1112 | 1147 | /* Extract MVM priv from op_mode and _hw */ |
|---|
| .. | .. |
|---|
| 1123 | 1158 | * @IWL_MVM_STATUS_ROC_RUNNING: remain-on-channel is running |
|---|
| 1124 | 1159 | * @IWL_MVM_STATUS_HW_RESTART_REQUESTED: HW restart was requested |
|---|
| 1125 | 1160 | * @IWL_MVM_STATUS_IN_HW_RESTART: HW restart is active |
|---|
| 1126 | | - * @IWL_MVM_STATUS_IN_D0I3: NIC is in D0i3 |
|---|
| 1127 | 1161 | * @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running |
|---|
| 1128 | | - * @IWL_MVM_STATUS_D3_RECONFIG: D3 reconfiguration is being done |
|---|
| 1129 | 1162 | * @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running |
|---|
| 1130 | 1163 | * @IWL_MVM_STATUS_NEED_FLUSH_P2P: need to flush P2P bcast STA |
|---|
| 1164 | + * @IWL_MVM_STATUS_IN_D3: in D3 (or at least about to go into it) |
|---|
| 1165 | + * @IWL_MVM_STATUS_STARTING: starting mac, |
|---|
| 1166 | + * used to disable restart flow while in STARTING state |
|---|
| 1131 | 1167 | */ |
|---|
| 1132 | 1168 | enum iwl_mvm_status { |
|---|
| 1133 | 1169 | IWL_MVM_STATUS_HW_RFKILL, |
|---|
| .. | .. |
|---|
| 1135 | 1171 | IWL_MVM_STATUS_ROC_RUNNING, |
|---|
| 1136 | 1172 | IWL_MVM_STATUS_HW_RESTART_REQUESTED, |
|---|
| 1137 | 1173 | IWL_MVM_STATUS_IN_HW_RESTART, |
|---|
| 1138 | | - IWL_MVM_STATUS_IN_D0I3, |
|---|
| 1139 | 1174 | IWL_MVM_STATUS_ROC_AUX_RUNNING, |
|---|
| 1140 | | - IWL_MVM_STATUS_D3_RECONFIG, |
|---|
| 1141 | 1175 | IWL_MVM_STATUS_FIRMWARE_RUNNING, |
|---|
| 1142 | 1176 | IWL_MVM_STATUS_NEED_FLUSH_P2P, |
|---|
| 1177 | + IWL_MVM_STATUS_IN_D3, |
|---|
| 1178 | + IWL_MVM_STATUS_STARTING, |
|---|
| 1143 | 1179 | }; |
|---|
| 1144 | 1180 | |
|---|
| 1145 | 1181 | /* Keep track of completed init configuration */ |
|---|
| 1146 | 1182 | enum iwl_mvm_init_status { |
|---|
| 1147 | 1183 | IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0), |
|---|
| 1148 | 1184 | IWL_MVM_INIT_STATUS_LEDS_INIT_COMPLETE = BIT(1), |
|---|
| 1149 | | - IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE = BIT(2), |
|---|
| 1150 | | - IWL_MVM_INIT_STATUS_TOF_INIT_COMPLETE = BIT(3), |
|---|
| 1151 | 1185 | }; |
|---|
| 1152 | 1186 | |
|---|
| 1153 | 1187 | static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm) |
|---|
| .. | .. |
|---|
| 1174 | 1208 | { |
|---|
| 1175 | 1209 | struct ieee80211_sta *sta; |
|---|
| 1176 | 1210 | |
|---|
| 1177 | | - if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id)) |
|---|
| 1211 | + if (sta_id >= mvm->fw->ucode_capa.num_stations) |
|---|
| 1178 | 1212 | return NULL; |
|---|
| 1179 | 1213 | |
|---|
| 1180 | 1214 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); |
|---|
| .. | .. |
|---|
| 1191 | 1225 | { |
|---|
| 1192 | 1226 | struct ieee80211_sta *sta; |
|---|
| 1193 | 1227 | |
|---|
| 1194 | | - if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id)) |
|---|
| 1228 | + if (sta_id >= mvm->fw->ucode_capa.num_stations) |
|---|
| 1195 | 1229 | return NULL; |
|---|
| 1196 | 1230 | |
|---|
| 1197 | 1231 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], |
|---|
| .. | .. |
|---|
| 1204 | 1238 | return iwl_mvm_sta_from_mac80211(sta); |
|---|
| 1205 | 1239 | } |
|---|
| 1206 | 1240 | |
|---|
| 1207 | | -static inline bool iwl_mvm_is_d0i3_supported(struct iwl_mvm *mvm) |
|---|
| 1241 | +static inline struct ieee80211_vif * |
|---|
| 1242 | +iwl_mvm_rcu_dereference_vif_id(struct iwl_mvm *mvm, u8 vif_id, bool rcu) |
|---|
| 1208 | 1243 | { |
|---|
| 1209 | | - return !iwlwifi_mod_params.d0i3_disable && |
|---|
| 1210 | | - fw_has_capa(&mvm->fw->ucode_capa, |
|---|
| 1211 | | - IWL_UCODE_TLV_CAPA_D0I3_SUPPORT); |
|---|
| 1244 | + if (WARN_ON(vif_id >= ARRAY_SIZE(mvm->vif_id_to_mac))) |
|---|
| 1245 | + return NULL; |
|---|
| 1246 | + |
|---|
| 1247 | + if (rcu) |
|---|
| 1248 | + return rcu_dereference(mvm->vif_id_to_mac[vif_id]); |
|---|
| 1249 | + |
|---|
| 1250 | + return rcu_dereference_protected(mvm->vif_id_to_mac[vif_id], |
|---|
| 1251 | + lockdep_is_held(&mvm->mutex)); |
|---|
| 1212 | 1252 | } |
|---|
| 1213 | 1253 | |
|---|
| 1214 | 1254 | static inline bool iwl_mvm_is_adaptive_dwell_supported(struct iwl_mvm *mvm) |
|---|
| .. | .. |
|---|
| 1223 | 1263 | IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2); |
|---|
| 1224 | 1264 | } |
|---|
| 1225 | 1265 | |
|---|
| 1266 | +static inline bool iwl_mvm_is_adwell_hb_ap_num_supported(struct iwl_mvm *mvm) |
|---|
| 1267 | +{ |
|---|
| 1268 | + return fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1269 | + IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP); |
|---|
| 1270 | +} |
|---|
| 1271 | + |
|---|
| 1226 | 1272 | static inline bool iwl_mvm_is_oce_supported(struct iwl_mvm *mvm) |
|---|
| 1227 | 1273 | { |
|---|
| 1228 | 1274 | /* OCE should never be enabled for LMAC scan FWs */ |
|---|
| 1229 | 1275 | return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_OCE); |
|---|
| 1230 | 1276 | } |
|---|
| 1231 | 1277 | |
|---|
| 1232 | | -static inline bool iwl_mvm_enter_d0i3_on_suspend(struct iwl_mvm *mvm) |
|---|
| 1278 | +static inline bool iwl_mvm_is_frag_ebs_supported(struct iwl_mvm *mvm) |
|---|
| 1233 | 1279 | { |
|---|
| 1234 | | - /* For now we only use this mode to differentiate between |
|---|
| 1235 | | - * slave transports, which handle D0i3 entry in suspend by |
|---|
| 1236 | | - * themselves in conjunction with runtime PM D0i3. So, this |
|---|
| 1237 | | - * function is used to check whether we need to do anything |
|---|
| 1238 | | - * when entering suspend or if the transport layer has already |
|---|
| 1239 | | - * done it. |
|---|
| 1240 | | - */ |
|---|
| 1241 | | - return (mvm->trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3) && |
|---|
| 1242 | | - (mvm->trans->runtime_pm_mode != IWL_PLAT_PM_MODE_D0I3); |
|---|
| 1280 | + return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_FRAG_EBS); |
|---|
| 1281 | +} |
|---|
| 1282 | + |
|---|
| 1283 | +static inline bool iwl_mvm_is_short_beacon_notif_supported(struct iwl_mvm *mvm) |
|---|
| 1284 | +{ |
|---|
| 1285 | + return fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1286 | + IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF); |
|---|
| 1243 | 1287 | } |
|---|
| 1244 | 1288 | |
|---|
| 1245 | 1289 | static inline bool iwl_mvm_is_dqa_data_queue(struct iwl_mvm *mvm, u8 queue) |
|---|
| .. | .. |
|---|
| 1259 | 1303 | bool nvm_lar = mvm->nvm_data->lar_enabled; |
|---|
| 1260 | 1304 | bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa, |
|---|
| 1261 | 1305 | IWL_UCODE_TLV_CAPA_LAR_SUPPORT); |
|---|
| 1262 | | - |
|---|
| 1263 | | - if (iwlwifi_mod_params.lar_disable) |
|---|
| 1264 | | - return false; |
|---|
| 1265 | 1306 | |
|---|
| 1266 | 1307 | /* |
|---|
| 1267 | 1308 | * Enable LAR only if it is supported by the FW (TLV) && |
|---|
| .. | .. |
|---|
| 1320 | 1361 | static inline bool iwl_mvm_has_new_tx_api(struct iwl_mvm *mvm) |
|---|
| 1321 | 1362 | { |
|---|
| 1322 | 1363 | /* TODO - replace with TLV once defined */ |
|---|
| 1323 | | - return mvm->trans->cfg->use_tfh; |
|---|
| 1364 | + return mvm->trans->trans_cfg->use_tfh; |
|---|
| 1324 | 1365 | } |
|---|
| 1325 | 1366 | |
|---|
| 1326 | 1367 | static inline bool iwl_mvm_has_unified_ucode(struct iwl_mvm *mvm) |
|---|
| 1327 | 1368 | { |
|---|
| 1328 | 1369 | /* TODO - better define this */ |
|---|
| 1329 | | - return mvm->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000; |
|---|
| 1370 | + return mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000; |
|---|
| 1330 | 1371 | } |
|---|
| 1331 | 1372 | |
|---|
| 1332 | 1373 | static inline bool iwl_mvm_is_cdb_supported(struct iwl_mvm *mvm) |
|---|
| .. | .. |
|---|
| 1351 | 1392 | * but then there's a little bit of code in scan that won't make |
|---|
| 1352 | 1393 | * any sense... |
|---|
| 1353 | 1394 | */ |
|---|
| 1354 | | - return mvm->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000; |
|---|
| 1395 | + return mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000; |
|---|
| 1396 | +} |
|---|
| 1397 | + |
|---|
| 1398 | +static inline bool iwl_mvm_is_scan_ext_chan_supported(struct iwl_mvm *mvm) |
|---|
| 1399 | +{ |
|---|
| 1400 | + return fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1401 | + IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER); |
|---|
| 1402 | +} |
|---|
| 1403 | + |
|---|
| 1404 | + |
|---|
| 1405 | +static inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm) |
|---|
| 1406 | +{ |
|---|
| 1407 | + return fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1408 | + IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG); |
|---|
| 1409 | +} |
|---|
| 1410 | + |
|---|
| 1411 | +static inline bool iwl_mvm_is_band_in_rx_supported(struct iwl_mvm *mvm) |
|---|
| 1412 | +{ |
|---|
| 1413 | + return fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1414 | + IWL_UCODE_TLV_API_BAND_IN_RX_DATA); |
|---|
| 1355 | 1415 | } |
|---|
| 1356 | 1416 | |
|---|
| 1357 | 1417 | static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm) |
|---|
| .. | .. |
|---|
| 1383 | 1443 | |
|---|
| 1384 | 1444 | static inline bool iwl_mvm_is_tt_in_fw(struct iwl_mvm *mvm) |
|---|
| 1385 | 1445 | { |
|---|
| 1386 | | -#ifdef CONFIG_THERMAL |
|---|
| 1387 | 1446 | /* these two TLV are redundant since the responsibility to CT-kill by |
|---|
| 1388 | 1447 | * FW happens only after we send at least one command of |
|---|
| 1389 | 1448 | * temperature THs report. |
|---|
| .. | .. |
|---|
| 1392 | 1451 | IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW) && |
|---|
| 1393 | 1452 | fw_has_capa(&mvm->fw->ucode_capa, |
|---|
| 1394 | 1453 | IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT); |
|---|
| 1395 | | -#else /* CONFIG_THERMAL */ |
|---|
| 1396 | | - return false; |
|---|
| 1397 | | -#endif /* CONFIG_THERMAL */ |
|---|
| 1398 | 1454 | } |
|---|
| 1399 | 1455 | |
|---|
| 1400 | 1456 | static inline bool iwl_mvm_is_ctdp_supported(struct iwl_mvm *mvm) |
|---|
| .. | .. |
|---|
| 1437 | 1493 | enum nl80211_band band, |
|---|
| 1438 | 1494 | struct ieee80211_tx_rate *r); |
|---|
| 1439 | 1495 | u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx); |
|---|
| 1496 | +u8 iwl_mvm_mac80211_ac_to_ucode_ac(enum ieee80211_ac_numbers ac); |
|---|
| 1440 | 1497 | void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm); |
|---|
| 1441 | 1498 | u8 first_antenna(u8 mask); |
|---|
| 1442 | 1499 | u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx); |
|---|
| 1443 | 1500 | void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime); |
|---|
| 1501 | +u32 iwl_mvm_get_systime(struct iwl_mvm *mvm); |
|---|
| 1444 | 1502 | |
|---|
| 1445 | 1503 | /* Tx / Host Commands */ |
|---|
| 1446 | 1504 | int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm, |
|---|
| .. | .. |
|---|
| 1453 | 1511 | int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id, |
|---|
| 1454 | 1512 | u16 len, const void *data, |
|---|
| 1455 | 1513 | u32 *status); |
|---|
| 1456 | | -int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, |
|---|
| 1457 | | - struct ieee80211_sta *sta); |
|---|
| 1514 | +int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb, |
|---|
| 1515 | + struct ieee80211_sta *sta); |
|---|
| 1458 | 1516 | int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb); |
|---|
| 1459 | 1517 | void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, |
|---|
| 1460 | 1518 | struct iwl_tx_cmd *tx_cmd, |
|---|
| .. | .. |
|---|
| 1462 | 1520 | void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd, |
|---|
| 1463 | 1521 | struct ieee80211_tx_info *info, |
|---|
| 1464 | 1522 | struct ieee80211_sta *sta, __le16 fc); |
|---|
| 1523 | +void iwl_mvm_mac_itxq_xmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq); |
|---|
| 1524 | +unsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm, |
|---|
| 1525 | + struct ieee80211_sta *sta, |
|---|
| 1526 | + unsigned int tid); |
|---|
| 1527 | + |
|---|
| 1465 | 1528 | #ifdef CONFIG_IWLWIFI_DEBUG |
|---|
| 1466 | 1529 | const char *iwl_mvm_get_tx_fail_reason(u32 status); |
|---|
| 1467 | 1530 | #else |
|---|
| 1468 | 1531 | static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; } |
|---|
| 1469 | 1532 | #endif |
|---|
| 1470 | 1533 | int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, u32 flags); |
|---|
| 1471 | | -int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal, u32 flags); |
|---|
| 1534 | +int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal); |
|---|
| 1472 | 1535 | int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id, |
|---|
| 1473 | 1536 | u16 tids, u32 flags); |
|---|
| 1474 | 1537 | |
|---|
| .. | .. |
|---|
| 1514 | 1577 | mvm->fw->valid_rx_ant; |
|---|
| 1515 | 1578 | } |
|---|
| 1516 | 1579 | |
|---|
| 1580 | +static inline void iwl_mvm_toggle_tx_ant(struct iwl_mvm *mvm, u8 *ant) |
|---|
| 1581 | +{ |
|---|
| 1582 | + *ant = iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm), *ant); |
|---|
| 1583 | +} |
|---|
| 1584 | + |
|---|
| 1517 | 1585 | static inline u32 iwl_mvm_get_phy_config(struct iwl_mvm *mvm) |
|---|
| 1518 | 1586 | { |
|---|
| 1519 | 1587 | u32 phy_config = ~(FW_PHY_CFG_TX_CHAIN | |
|---|
| .. | .. |
|---|
| 1543 | 1611 | struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1544 | 1612 | void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, |
|---|
| 1545 | 1613 | struct iwl_rx_cmd_buffer *rxb, int queue); |
|---|
| 1614 | +void iwl_mvm_rx_monitor_no_data(struct iwl_mvm *mvm, struct napi_struct *napi, |
|---|
| 1615 | + struct iwl_rx_cmd_buffer *rxb, int queue); |
|---|
| 1546 | 1616 | void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, |
|---|
| 1547 | 1617 | struct iwl_rx_cmd_buffer *rxb, int queue); |
|---|
| 1618 | +void iwl_mvm_rx_bar_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, |
|---|
| 1619 | + struct iwl_rx_cmd_buffer *rxb, int queue); |
|---|
| 1548 | 1620 | int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, |
|---|
| 1549 | | - const u8 *data, u32 count); |
|---|
| 1550 | | -void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, |
|---|
| 1551 | | - int queue); |
|---|
| 1621 | + const u8 *data, u32 count, bool async); |
|---|
| 1622 | +void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi, |
|---|
| 1623 | + struct iwl_rx_cmd_buffer *rxb, int queue); |
|---|
| 1552 | 1624 | void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1553 | 1625 | void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, |
|---|
| 1554 | 1626 | struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1627 | +void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags); |
|---|
| 1555 | 1628 | void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1556 | 1629 | void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, |
|---|
| 1557 | 1630 | struct iwl_rx_cmd_buffer *rxb); |
|---|
| .. | .. |
|---|
| 1584 | 1657 | int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
|---|
| 1585 | 1658 | bool force_assoc_off, const u8 *bssid_override); |
|---|
| 1586 | 1659 | int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
|---|
| 1587 | | -u32 iwl_mvm_mac_get_queues_mask(struct ieee80211_vif *vif); |
|---|
| 1588 | 1660 | int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, |
|---|
| 1589 | 1661 | struct ieee80211_vif *vif); |
|---|
| 1662 | +int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, |
|---|
| 1663 | + struct ieee80211_vif *vif, |
|---|
| 1664 | + struct sk_buff *beacon); |
|---|
| 1665 | +int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm, |
|---|
| 1666 | + struct sk_buff *beacon, |
|---|
| 1667 | + void *data, int len); |
|---|
| 1668 | +u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct ieee80211_tx_info *info, |
|---|
| 1669 | + struct ieee80211_vif *vif); |
|---|
| 1670 | +void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, |
|---|
| 1671 | + __le32 *tim_index, __le32 *tim_size, |
|---|
| 1672 | + u8 *beacon, u32 frame_size); |
|---|
| 1590 | 1673 | void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, |
|---|
| 1591 | 1674 | struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1592 | 1675 | void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm, |
|---|
| .. | .. |
|---|
| 1600 | 1683 | struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1601 | 1684 | void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm, |
|---|
| 1602 | 1685 | struct ieee80211_vif *vif); |
|---|
| 1603 | | -unsigned long iwl_mvm_get_used_hw_queues(struct iwl_mvm *mvm, |
|---|
| 1604 | | - struct ieee80211_vif *exclude_vif); |
|---|
| 1686 | +void iwl_mvm_probe_resp_data_notif(struct iwl_mvm *mvm, |
|---|
| 1687 | + struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1688 | +void iwl_mvm_rx_missed_vap_notif(struct iwl_mvm *mvm, |
|---|
| 1689 | + struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1605 | 1690 | void iwl_mvm_channel_switch_noa_notif(struct iwl_mvm *mvm, |
|---|
| 1606 | 1691 | struct iwl_rx_cmd_buffer *rxb); |
|---|
| 1607 | 1692 | /* Bindings */ |
|---|
| .. | .. |
|---|
| 1665 | 1750 | |
|---|
| 1666 | 1751 | /* MVM debugfs */ |
|---|
| 1667 | 1752 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
|---|
| 1668 | | -int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir); |
|---|
| 1753 | +void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir); |
|---|
| 1669 | 1754 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
|---|
| 1670 | 1755 | void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
|---|
| 1671 | 1756 | #else |
|---|
| 1672 | | -static inline int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, |
|---|
| 1673 | | - struct dentry *dbgfs_dir) |
|---|
| 1757 | +static inline void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, |
|---|
| 1758 | + struct dentry *dbgfs_dir) |
|---|
| 1674 | 1759 | { |
|---|
| 1675 | | - return 0; |
|---|
| 1676 | 1760 | } |
|---|
| 1677 | 1761 | static inline void |
|---|
| 1678 | 1762 | iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
|---|
| .. | .. |
|---|
| 1685 | 1769 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
|---|
| 1686 | 1770 | |
|---|
| 1687 | 1771 | /* rate scaling */ |
|---|
| 1688 | | -int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool sync); |
|---|
| 1772 | +int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq); |
|---|
| 1689 | 1773 | void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg); |
|---|
| 1690 | 1774 | int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate); |
|---|
| 1691 | 1775 | void rs_update_last_rssi(struct iwl_mvm *mvm, |
|---|
| .. | .. |
|---|
| 1733 | 1817 | void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw, |
|---|
| 1734 | 1818 | struct ieee80211_vif *vif, int idx); |
|---|
| 1735 | 1819 | extern const struct file_operations iwl_dbgfs_d3_test_ops; |
|---|
| 1820 | +struct iwl_wowlan_status *iwl_mvm_send_wowlan_get_status(struct iwl_mvm *mvm); |
|---|
| 1736 | 1821 | #ifdef CONFIG_PM |
|---|
| 1737 | | -int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, |
|---|
| 1738 | | - struct ieee80211_vif *vif, |
|---|
| 1739 | | - bool host_awake, |
|---|
| 1740 | | - u32 cmd_flags); |
|---|
| 1741 | | -void iwl_mvm_d0i3_update_keys(struct iwl_mvm *mvm, |
|---|
| 1742 | | - struct ieee80211_vif *vif, |
|---|
| 1743 | | - struct iwl_wowlan_status *status); |
|---|
| 1744 | 1822 | void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, |
|---|
| 1745 | 1823 | struct ieee80211_vif *vif); |
|---|
| 1746 | 1824 | #else |
|---|
| 1747 | | -static inline int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, |
|---|
| 1748 | | - struct ieee80211_vif *vif, |
|---|
| 1749 | | - bool host_awake, |
|---|
| 1750 | | - u32 cmd_flags) |
|---|
| 1751 | | -{ |
|---|
| 1752 | | - return 0; |
|---|
| 1753 | | -} |
|---|
| 1754 | | - |
|---|
| 1755 | | -static inline void iwl_mvm_d0i3_update_keys(struct iwl_mvm *mvm, |
|---|
| 1756 | | - struct ieee80211_vif *vif, |
|---|
| 1757 | | - struct iwl_wowlan_status *status) |
|---|
| 1758 | | -{ |
|---|
| 1759 | | -} |
|---|
| 1760 | | - |
|---|
| 1761 | 1825 | static inline void |
|---|
| 1762 | 1826 | iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
|---|
| 1763 | 1827 | { |
|---|
| .. | .. |
|---|
| 1770 | 1834 | bool disable_offloading, |
|---|
| 1771 | 1835 | bool offload_ns, |
|---|
| 1772 | 1836 | u32 cmd_flags); |
|---|
| 1773 | | - |
|---|
| 1774 | | -/* D0i3 */ |
|---|
| 1775 | | -void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type); |
|---|
| 1776 | | -void iwl_mvm_unref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type); |
|---|
| 1777 | | -int iwl_mvm_ref_sync(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type); |
|---|
| 1778 | | -bool iwl_mvm_ref_taken(struct iwl_mvm *mvm); |
|---|
| 1779 | | -void iwl_mvm_d0i3_enable_tx(struct iwl_mvm *mvm, __le16 *qos_seq); |
|---|
| 1780 | | -int iwl_mvm_enter_d0i3(struct iwl_op_mode *op_mode); |
|---|
| 1781 | | -int iwl_mvm_exit_d0i3(struct iwl_op_mode *op_mode); |
|---|
| 1782 | | -int _iwl_mvm_exit_d0i3(struct iwl_mvm *mvm); |
|---|
| 1783 | 1837 | |
|---|
| 1784 | 1838 | /* BT Coex */ |
|---|
| 1785 | 1839 | int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm); |
|---|
| .. | .. |
|---|
| 1796 | 1850 | bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm); |
|---|
| 1797 | 1851 | bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, |
|---|
| 1798 | 1852 | enum nl80211_band band); |
|---|
| 1853 | +u8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants); |
|---|
| 1799 | 1854 | u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, |
|---|
| 1800 | 1855 | struct ieee80211_tx_info *info, u8 ac); |
|---|
| 1801 | 1856 | |
|---|
| .. | .. |
|---|
| 1810 | 1865 | struct iwl_beacon_filter_cmd *cmd) |
|---|
| 1811 | 1866 | {} |
|---|
| 1812 | 1867 | #endif |
|---|
| 1813 | | -int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, |
|---|
| 1814 | | - struct ieee80211_vif *vif, |
|---|
| 1815 | | - bool enable, u32 flags); |
|---|
| 1816 | 1868 | int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, |
|---|
| 1817 | 1869 | struct ieee80211_vif *vif, |
|---|
| 1818 | 1870 | u32 flags); |
|---|
| .. | .. |
|---|
| 1832 | 1884 | /* get SystemLowLatencyMode - only needed for beacon threshold? */ |
|---|
| 1833 | 1885 | bool iwl_mvm_low_latency(struct iwl_mvm *mvm); |
|---|
| 1834 | 1886 | bool iwl_mvm_low_latency_band(struct iwl_mvm *mvm, enum nl80211_band band); |
|---|
| 1887 | +void iwl_mvm_send_low_latency_cmd(struct iwl_mvm *mvm, bool low_latency, |
|---|
| 1888 | + u16 mac_id); |
|---|
| 1835 | 1889 | |
|---|
| 1836 | 1890 | /* get VMACLowLatencyMode */ |
|---|
| 1837 | 1891 | static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif) |
|---|
| .. | .. |
|---|
| 1846 | 1900 | * binding, so this has no real impact. For now, just return |
|---|
| 1847 | 1901 | * the current desired low-latency state. |
|---|
| 1848 | 1902 | */ |
|---|
| 1849 | | - return mvmvif->low_latency; |
|---|
| 1903 | + return mvmvif->low_latency_actual; |
|---|
| 1850 | 1904 | } |
|---|
| 1851 | 1905 | |
|---|
| 1852 | 1906 | static inline |
|---|
| 1853 | 1907 | void iwl_mvm_vif_set_low_latency(struct iwl_mvm_vif *mvmvif, bool set, |
|---|
| 1854 | 1908 | enum iwl_mvm_low_latency_cause cause) |
|---|
| 1855 | 1909 | { |
|---|
| 1910 | + u8 new_state; |
|---|
| 1911 | + |
|---|
| 1856 | 1912 | if (set) |
|---|
| 1857 | 1913 | mvmvif->low_latency |= cause; |
|---|
| 1858 | 1914 | else |
|---|
| 1859 | 1915 | mvmvif->low_latency &= ~cause; |
|---|
| 1916 | + |
|---|
| 1917 | + /* |
|---|
| 1918 | + * if LOW_LATENCY_DEBUGFS_FORCE_ENABLE is enabled no changes are |
|---|
| 1919 | + * allowed to actual mode. |
|---|
| 1920 | + */ |
|---|
| 1921 | + if (mvmvif->low_latency & LOW_LATENCY_DEBUGFS_FORCE_ENABLE && |
|---|
| 1922 | + cause != LOW_LATENCY_DEBUGFS_FORCE_ENABLE) |
|---|
| 1923 | + return; |
|---|
| 1924 | + |
|---|
| 1925 | + if (cause == LOW_LATENCY_DEBUGFS_FORCE_ENABLE && set) |
|---|
| 1926 | + /* |
|---|
| 1927 | + * We enter force state |
|---|
| 1928 | + */ |
|---|
| 1929 | + new_state = !!(mvmvif->low_latency & |
|---|
| 1930 | + LOW_LATENCY_DEBUGFS_FORCE); |
|---|
| 1931 | + else |
|---|
| 1932 | + /* |
|---|
| 1933 | + * Check if any other one set low latency |
|---|
| 1934 | + */ |
|---|
| 1935 | + new_state = !!(mvmvif->low_latency & |
|---|
| 1936 | + ~(LOW_LATENCY_DEBUGFS_FORCE_ENABLE | |
|---|
| 1937 | + LOW_LATENCY_DEBUGFS_FORCE)); |
|---|
| 1938 | + |
|---|
| 1939 | + mvmvif->low_latency_actual = new_state; |
|---|
| 1860 | 1940 | } |
|---|
| 1861 | | - |
|---|
| 1862 | | -/* hw scheduler queue config */ |
|---|
| 1863 | | -bool iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue, |
|---|
| 1864 | | - u16 ssn, const struct iwl_trans_txq_scd_cfg *cfg, |
|---|
| 1865 | | - unsigned int wdg_timeout); |
|---|
| 1866 | | -int iwl_mvm_tvqm_enable_txq(struct iwl_mvm *mvm, int mac80211_queue, |
|---|
| 1867 | | - u8 sta_id, u8 tid, unsigned int timeout); |
|---|
| 1868 | | - |
|---|
| 1869 | | -int iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue, |
|---|
| 1870 | | - u8 tid, u8 flags); |
|---|
| 1871 | | -int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq); |
|---|
| 1872 | 1941 | |
|---|
| 1873 | 1942 | /* Return a bitmask with all the hw supported queues, except for the |
|---|
| 1874 | 1943 | * command queue, which can't be flushed. |
|---|
| 1875 | 1944 | */ |
|---|
| 1876 | 1945 | static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm) |
|---|
| 1877 | 1946 | { |
|---|
| 1878 | | - return ((BIT(mvm->cfg->base_params->num_of_queues) - 1) & |
|---|
| 1947 | + return ((BIT(mvm->trans->trans_cfg->base_params->num_of_queues) - 1) & |
|---|
| 1879 | 1948 | ~BIT(IWL_MVM_DQA_CMD_QUEUE)); |
|---|
| 1880 | 1949 | } |
|---|
| 1881 | 1950 | |
|---|
| 1882 | 1951 | static inline void iwl_mvm_stop_device(struct iwl_mvm *mvm) |
|---|
| 1883 | 1952 | { |
|---|
| 1953 | + lockdep_assert_held(&mvm->mutex); |
|---|
| 1884 | 1954 | iwl_fw_cancel_timestamp(&mvm->fwrt); |
|---|
| 1885 | | - iwl_free_fw_paging(&mvm->fwrt); |
|---|
| 1886 | 1955 | clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); |
|---|
| 1887 | | - iwl_fw_dump_conf_clear(&mvm->fwrt); |
|---|
| 1956 | + iwl_fw_dbg_stop_sync(&mvm->fwrt); |
|---|
| 1888 | 1957 | iwl_trans_stop_device(mvm->trans); |
|---|
| 1958 | + iwl_free_fw_paging(&mvm->fwrt); |
|---|
| 1959 | + iwl_fw_dump_conf_clear(&mvm->fwrt); |
|---|
| 1889 | 1960 | } |
|---|
| 1890 | | - |
|---|
| 1891 | | -/* Stop/start all mac queues in a given bitmap */ |
|---|
| 1892 | | -void iwl_mvm_start_mac_queues(struct iwl_mvm *mvm, unsigned long mq); |
|---|
| 1893 | | -void iwl_mvm_stop_mac_queues(struct iwl_mvm *mvm, unsigned long mq); |
|---|
| 1894 | 1961 | |
|---|
| 1895 | 1962 | /* Re-configure the SCD for a queue that has already been configured */ |
|---|
| 1896 | 1963 | int iwl_mvm_reconfig_scd(struct iwl_mvm *mvm, int queue, int fifo, int sta_id, |
|---|
| .. | .. |
|---|
| 1931 | 1998 | int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
|---|
| 1932 | 1999 | bool added_vif); |
|---|
| 1933 | 2000 | |
|---|
| 2001 | +/* FTM responder */ |
|---|
| 2002 | +int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif); |
|---|
| 2003 | +void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm, |
|---|
| 2004 | + struct ieee80211_vif *vif); |
|---|
| 2005 | +void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm, |
|---|
| 2006 | + struct iwl_rx_cmd_buffer *rxb); |
|---|
| 2007 | +int iwl_mvm_ftm_resp_remove_pasn_sta(struct iwl_mvm *mvm, |
|---|
| 2008 | + struct ieee80211_vif *vif, u8 *addr); |
|---|
| 2009 | +int iwl_mvm_ftm_respoder_add_pasn_sta(struct iwl_mvm *mvm, |
|---|
| 2010 | + struct ieee80211_vif *vif, |
|---|
| 2011 | + u8 *addr, u32 cipher, u8 *tk, u32 tk_len, |
|---|
| 2012 | + u8 *hltk, u32 hltk_len); |
|---|
| 2013 | +void iwl_mvm_ftm_responder_clear(struct iwl_mvm *mvm, |
|---|
| 2014 | + struct ieee80211_vif *vif); |
|---|
| 2015 | + |
|---|
| 2016 | +/* FTM initiator */ |
|---|
| 2017 | +void iwl_mvm_ftm_restart(struct iwl_mvm *mvm); |
|---|
| 2018 | +void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, |
|---|
| 2019 | + struct iwl_rx_cmd_buffer *rxb); |
|---|
| 2020 | +void iwl_mvm_ftm_lc_notif(struct iwl_mvm *mvm, |
|---|
| 2021 | + struct iwl_rx_cmd_buffer *rxb); |
|---|
| 2022 | +int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
|---|
| 2023 | + struct cfg80211_pmsr_request *request); |
|---|
| 2024 | +void iwl_mvm_ftm_abort(struct iwl_mvm *mvm, struct cfg80211_pmsr_request *req); |
|---|
| 2025 | +void iwl_mvm_ftm_initiator_smooth_config(struct iwl_mvm *mvm); |
|---|
| 2026 | +void iwl_mvm_ftm_initiator_smooth_stop(struct iwl_mvm *mvm); |
|---|
| 2027 | +int iwl_mvm_ftm_add_pasn_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
|---|
| 2028 | + u8 *addr, u32 cipher, u8 *tk, u32 tk_len, |
|---|
| 2029 | + u8 *hltk, u32 hltk_len); |
|---|
| 2030 | +void iwl_mvm_ftm_remove_pasn_sta(struct iwl_mvm *mvm, u8 *addr); |
|---|
| 2031 | + |
|---|
| 1934 | 2032 | /* TDLS */ |
|---|
| 1935 | 2033 | |
|---|
| 1936 | 2034 | /* |
|---|
| .. | .. |
|---|
| 1966 | 2064 | struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm); |
|---|
| 1967 | 2065 | bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm); |
|---|
| 1968 | 2066 | |
|---|
| 1969 | | -void iwl_mvm_inactivity_check(struct iwl_mvm *mvm); |
|---|
| 1970 | | - |
|---|
| 1971 | 2067 | #define MVM_TCM_PERIOD_MSEC 500 |
|---|
| 1972 | 2068 | #define MVM_TCM_PERIOD (HZ * MVM_TCM_PERIOD_MSEC / 1000) |
|---|
| 1973 | 2069 | #define MVM_LL_PERIOD (10 * HZ) |
|---|
| .. | .. |
|---|
| 1992 | 2088 | |
|---|
| 1993 | 2089 | int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b); |
|---|
| 1994 | 2090 | int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm); |
|---|
| 2091 | +int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm); |
|---|
| 1995 | 2092 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
|---|
| 1996 | 2093 | void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw, |
|---|
| 1997 | 2094 | struct ieee80211_vif *vif, |
|---|
| .. | .. |
|---|
| 1999 | 2096 | struct dentry *dir); |
|---|
| 2000 | 2097 | #endif |
|---|
| 2001 | 2098 | |
|---|
| 2099 | +static inline u8 iwl_mvm_phy_band_from_nl80211(enum nl80211_band band) |
|---|
| 2100 | +{ |
|---|
| 2101 | + switch (band) { |
|---|
| 2102 | + case NL80211_BAND_2GHZ: |
|---|
| 2103 | + return PHY_BAND_24; |
|---|
| 2104 | + case NL80211_BAND_5GHZ: |
|---|
| 2105 | + return PHY_BAND_5; |
|---|
| 2106 | + default: |
|---|
| 2107 | + WARN_ONCE(1, "Unsupported band (%u)\n", band); |
|---|
| 2108 | + return PHY_BAND_5; |
|---|
| 2109 | + } |
|---|
| 2110 | +} |
|---|
| 2111 | + |
|---|
| 2112 | +/* Channel info utils */ |
|---|
| 2113 | +static inline bool iwl_mvm_has_ultra_hb_channel(struct iwl_mvm *mvm) |
|---|
| 2114 | +{ |
|---|
| 2115 | + return fw_has_capa(&mvm->fw->ucode_capa, |
|---|
| 2116 | + IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS); |
|---|
| 2117 | +} |
|---|
| 2118 | + |
|---|
| 2119 | +static inline void *iwl_mvm_chan_info_cmd_tail(struct iwl_mvm *mvm, |
|---|
| 2120 | + struct iwl_fw_channel_info *ci) |
|---|
| 2121 | +{ |
|---|
| 2122 | + return (u8 *)ci + (iwl_mvm_has_ultra_hb_channel(mvm) ? |
|---|
| 2123 | + sizeof(struct iwl_fw_channel_info) : |
|---|
| 2124 | + sizeof(struct iwl_fw_channel_info_v1)); |
|---|
| 2125 | +} |
|---|
| 2126 | + |
|---|
| 2127 | +static inline size_t iwl_mvm_chan_info_padding(struct iwl_mvm *mvm) |
|---|
| 2128 | +{ |
|---|
| 2129 | + return iwl_mvm_has_ultra_hb_channel(mvm) ? 0 : |
|---|
| 2130 | + sizeof(struct iwl_fw_channel_info) - |
|---|
| 2131 | + sizeof(struct iwl_fw_channel_info_v1); |
|---|
| 2132 | +} |
|---|
| 2133 | + |
|---|
| 2134 | +static inline void iwl_mvm_set_chan_info(struct iwl_mvm *mvm, |
|---|
| 2135 | + struct iwl_fw_channel_info *ci, |
|---|
| 2136 | + u32 chan, u8 band, u8 width, |
|---|
| 2137 | + u8 ctrl_pos) |
|---|
| 2138 | +{ |
|---|
| 2139 | + if (iwl_mvm_has_ultra_hb_channel(mvm)) { |
|---|
| 2140 | + ci->channel = cpu_to_le32(chan); |
|---|
| 2141 | + ci->band = band; |
|---|
| 2142 | + ci->width = width; |
|---|
| 2143 | + ci->ctrl_pos = ctrl_pos; |
|---|
| 2144 | + } else { |
|---|
| 2145 | + struct iwl_fw_channel_info_v1 *ci_v1 = |
|---|
| 2146 | + (struct iwl_fw_channel_info_v1 *)ci; |
|---|
| 2147 | + |
|---|
| 2148 | + ci_v1->channel = chan; |
|---|
| 2149 | + ci_v1->band = band; |
|---|
| 2150 | + ci_v1->width = width; |
|---|
| 2151 | + ci_v1->ctrl_pos = ctrl_pos; |
|---|
| 2152 | + } |
|---|
| 2153 | +} |
|---|
| 2154 | + |
|---|
| 2155 | +static inline void |
|---|
| 2156 | +iwl_mvm_set_chan_info_chandef(struct iwl_mvm *mvm, |
|---|
| 2157 | + struct iwl_fw_channel_info *ci, |
|---|
| 2158 | + struct cfg80211_chan_def *chandef) |
|---|
| 2159 | +{ |
|---|
| 2160 | + enum nl80211_band band = chandef->chan->band; |
|---|
| 2161 | + |
|---|
| 2162 | + iwl_mvm_set_chan_info(mvm, ci, chandef->chan->hw_value, |
|---|
| 2163 | + iwl_mvm_phy_band_from_nl80211(band), |
|---|
| 2164 | + iwl_mvm_get_channel_width(chandef), |
|---|
| 2165 | + iwl_mvm_get_ctrl_pos(chandef)); |
|---|
| 2166 | +} |
|---|
| 2167 | + |
|---|
| 2168 | +static inline int iwl_umac_scan_get_max_profiles(const struct iwl_fw *fw) |
|---|
| 2169 | +{ |
|---|
| 2170 | + u8 ver = iwl_fw_lookup_cmd_ver(fw, IWL_ALWAYS_LONG_GROUP, |
|---|
| 2171 | + SCAN_OFFLOAD_UPDATE_PROFILES_CMD, |
|---|
| 2172 | + IWL_FW_CMD_VER_UNKNOWN); |
|---|
| 2173 | + return (ver == IWL_FW_CMD_VER_UNKNOWN || ver < 3) ? |
|---|
| 2174 | + IWL_SCAN_MAX_PROFILES : IWL_SCAN_MAX_PROFILES_V2; |
|---|
| 2175 | +} |
|---|
| 2176 | + |
|---|
| 2177 | +static inline |
|---|
| 2178 | +enum iwl_location_cipher iwl_mvm_cipher_to_location_cipher(u32 cipher) |
|---|
| 2179 | +{ |
|---|
| 2180 | + switch (cipher) { |
|---|
| 2181 | + case WLAN_CIPHER_SUITE_CCMP: |
|---|
| 2182 | + return IWL_LOCATION_CIPHER_CCMP_128; |
|---|
| 2183 | + case WLAN_CIPHER_SUITE_GCMP: |
|---|
| 2184 | + return IWL_LOCATION_CIPHER_GCMP_128; |
|---|
| 2185 | + case WLAN_CIPHER_SUITE_GCMP_256: |
|---|
| 2186 | + return IWL_LOCATION_CIPHER_GCMP_256; |
|---|
| 2187 | + default: |
|---|
| 2188 | + return IWL_LOCATION_CIPHER_INVALID; |
|---|
| 2189 | + } |
|---|
| 2190 | +} |
|---|
| 2002 | 2191 | #endif /* __IWL_MVM_H__ */ |
|---|