forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
....@@ -5,10 +5,9 @@
55 *
66 * GPL LICENSE SUMMARY
77 *
8
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
8
+ * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation. All rights reserved.
99 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
1010 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11
- * Copyright(c) 2018 Intel Corporation
1211 *
1312 * This program is free software; you can redistribute it and/or modify
1413 * it under the terms of version 2 of the GNU General Public License as
....@@ -19,11 +18,6 @@
1918 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2019 * General Public License for more details.
2120 *
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
- *
2721 * The full GNU General Public License is included in this distribution
2822 * in the file called COPYING.
2923 *
....@@ -33,10 +27,9 @@
3327 *
3428 * BSD LICENSE
3529 *
36
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
30
+ * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation. All rights reserved.
3731 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
3832 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
39
- * Copyright(c) 2018 Intel Corporation
4033 * All rights reserved.
4134 *
4235 * Redistribution and use in source and binary forms, with or without
....@@ -88,7 +81,6 @@
8881 #include "sta.h"
8982 #include "fw-api.h"
9083 #include "constants.h"
91
-#include "tof.h"
9284 #include "fw/runtime.h"
9385 #include "fw/dbg.h"
9486 #include "fw/acpi.h"
....@@ -100,6 +92,8 @@
10092 /* RSSI offset for WkP */
10193 #define IWL_RSSI_OFFSET 50
10294 #define IWL_MVM_MISSED_BEACONS_THRESHOLD 8
95
+#define IWL_MVM_MISSED_BEACONS_THRESHOLD_LONG 16
96
+
10397 /* A TimeUnit is 1024 microsecond */
10498 #define MSEC_TO_TU(_msec) (_msec*1000/1024)
10599
....@@ -138,12 +132,10 @@
138132 * We will register to mac80211 to have testmode working. The NIC must not
139133 * be up'ed after the INIT fw asserted. This is useful to be able to use
140134 * proprietary tools over testmode to debug the INIT fw.
141
- * @tfd_q_hang_detect: enabled the detection of hung transmit queues
142135 * @power_scheme: one of enum iwl_power_scheme
143136 */
144137 struct iwl_mvm_mod_params {
145138 bool init_dbg;
146
- bool tfd_q_hang_detect;
147139 int power_scheme;
148140 };
149141 extern struct iwl_mvm_mod_params iwlmvm_mod_params;
....@@ -262,38 +254,6 @@
262254 NUM_IWL_MVM_SMPS_REQ,
263255 };
264256
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
-
297257 enum iwl_bt_force_ant_mode {
298258 BT_FORCE_ANT_DIS = 0,
299259 BT_FORCE_ANT_AUTO,
....@@ -304,15 +264,38 @@
304264 };
305265
306266 /**
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
+/**
307281 * struct iwl_mvm_low_latency_cause - low latency set causes
308282 * @LOW_LATENCY_TRAFFIC: indicates low latency traffic was detected
309283 * @LOW_LATENCY_DEBUGFS: low latency mode set from debugfs
310284 * @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.
311291 */
312292 enum iwl_mvm_low_latency_cause {
313293 LOW_LATENCY_TRAFFIC = BIT(0),
314294 LOW_LATENCY_DEBUGFS = BIT(1),
315295 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),
316299 };
317300
318301 /**
....@@ -336,6 +319,18 @@
336319 };
337320
338321 /**
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
+/**
339334 * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context
340335 * @id: between 0 and 3
341336 * @color: to solve races upon MAC addition and removal
....@@ -351,8 +346,10 @@
351346 * @pm_enabled - Indicate if MAC power management is allowed
352347 * @monitor_active: indicates that monitor context is configured, and that the
353348 * 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.
356353 * @ps_disabled: indicates that this interface requires PS to be disabled
357354 * @queue_params: QoS params for this MAC
358355 * @bcast_sta: station used for broadcast packets. Used by the following
....@@ -365,6 +362,8 @@
365362 * average signal of beacons retrieved from the firmware
366363 * @csa_failed: CSA failed to schedule time event, report an error later
367364 * @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.
368367 */
369368 struct iwl_mvm_vif {
370369 struct iwl_mvm *mvm;
....@@ -382,7 +381,8 @@
382381 bool ap_ibss_active;
383382 bool pm_enabled;
384383 bool monitor_active;
385
- u8 low_latency;
384
+ u8 low_latency: 6;
385
+ u8 low_latency_actual: 1;
386386 bool ps_disabled;
387387 struct iwl_mvm_vif_bf_data bf_data;
388388
....@@ -416,7 +416,11 @@
416416 #ifdef CONFIG_PM
417417 /* WoWLAN GTK rekey data */
418418 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;
420424 __le64 replay_ctr;
421425 bool valid;
422426 } rekey_data;
....@@ -454,12 +458,23 @@
454458 bool csa_countdown;
455459 bool csa_failed;
456460 u16 csa_target_freq;
461
+ u16 csa_count;
462
+ u16 csa_misbehave;
463
+ struct delayed_work csa_work;
457464
458465 /* Indicates that we are waiting for a beacon on a new channel */
459466 bool csa_bcn_pending;
460467
461468 /* TCP Checksum Offload */
462469 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;
463478 };
464479
465480 static inline struct iwl_mvm_vif *
....@@ -500,6 +515,7 @@
500515 IWL_SCAN_TYPE_WILD,
501516 IWL_SCAN_TYPE_MILD,
502517 IWL_SCAN_TYPE_FRAGMENTED,
518
+ IWL_SCAN_TYPE_FAST_BALANCE,
503519 };
504520
505521 enum iwl_mvm_sched_scan_pass_all_states {
....@@ -570,11 +586,6 @@
570586 u32 fail_frames;
571587 u32 last_rates[IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES];
572588 int last_frame_idx;
573
-};
574
-
575
-enum {
576
- D0I3_DEFER_WAKEUP,
577
- D0I3_PENDING_WAKEUP,
578589 };
579590
580591 #define IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE 0xff
....@@ -650,6 +661,12 @@
650661 * @valid: reordering is valid for this queue
651662 * @lock: protect reorder buffer internal state
652663 * @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
653670 */
654671 struct iwl_mvm_reorder_buffer {
655672 u16 head_sn;
....@@ -663,6 +680,9 @@
663680 bool valid;
664681 spinlock_t lock;
665682 struct iwl_mvm *mvm;
683
+ unsigned int consec_oldsn_drops;
684
+ u32 consec_oldsn_ampdu_gp2;
685
+ unsigned int consec_oldsn_prev_drop:1;
666686 } ____cacheline_aligned_in_smp;
667687
668688 /**
....@@ -741,24 +761,12 @@
741761 * This is a state in which a single queue serves more than one TID, all of
742762 * which are not aggregated. Note that the queue is only associated to one
743763 * 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.
754764 */
755765 enum iwl_mvm_queue_status {
756766 IWL_MVM_QUEUE_FREE,
757767 IWL_MVM_QUEUE_RESERVED,
758768 IWL_MVM_QUEUE_READY,
759769 IWL_MVM_QUEUE_SHARED,
760
- IWL_MVM_QUEUE_INACTIVE,
761
- IWL_MVM_QUEUE_RECONFIGURING,
762770 };
763771
764772 #define IWL_MVM_DQA_QUEUE_TIMEOUT (5 * HZ)
....@@ -766,13 +774,49 @@
766774
767775 #define IWL_MVM_NUM_CIPHERS 10
768776
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;
772783 };
773784
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;
776820 };
777821
778822 struct iwl_mvm {
....@@ -806,11 +850,7 @@
806850 struct iwl_mvm_vif *bf_allowed_vif;
807851
808852 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;
814854
815855 u32 ampdu_ref;
816856 bool ampdu_toggle;
....@@ -829,23 +869,12 @@
829869 u64 on_time_scan;
830870 } radio_stats, accu_radio_stats;
831871
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
+ };
846877 struct work_struct add_stream_wk; /* To add streams to queues */
847
-
848
- atomic_t mac80211_queue_stop_count[IEEE80211_MAX_QUEUES];
849878
850879 const char *nvm_file_name;
851880 struct iwl_nvm_data *nvm_data;
....@@ -859,8 +888,7 @@
859888
860889 /* data related to data path */
861890 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];
864892 u8 rx_ba_sessions;
865893
866894 /* configured by mac80211 */
....@@ -921,6 +949,7 @@
921949 u32 dbgfs_prph_reg_addr;
922950 bool disable_power_off;
923951 bool disable_power_off_d3;
952
+ bool beacon_inject_active;
924953
925954 bool scan_iter_notif_enabled;
926955
....@@ -929,6 +958,7 @@
929958 struct debugfs_blob_wrapper nvm_calib_blob;
930959 struct debugfs_blob_wrapper nvm_prod_blob;
931960 struct debugfs_blob_wrapper nvm_phy_sku_blob;
961
+ struct debugfs_blob_wrapper nvm_reg_blob;
932962
933963 struct iwl_mvm_frame_stats drv_rx_stats;
934964 spinlock_t drv_stats_lock;
....@@ -947,14 +977,12 @@
947977 unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)];
948978 u8 fw_key_deleted[STA_KEY_MAX_NUM];
949979
950
- /* references taken by the driver and spinlock protecting them */
951
- spinlock_t refs_lock;
952
- u8 refs[IWL_MVM_REF_COUNT];
953
-
954980 u8 vif_count;
981
+ struct ieee80211_vif __rcu *vif_id_to_mac[NUM_MAC_INDEX_DRIVER];
955982
956983 /* -1 for always, 0 for never, >0 for that many times */
957984 s8 fw_restart;
985
+ u8 *error_recovery_buf;
958986
959987 #ifdef CONFIG_IWLWIFI_LEDS
960988 struct led_classdev led;
....@@ -973,28 +1001,16 @@
9731001 struct ieee80211_channel **nd_channels;
9741002 int n_nd_channels;
9751003 bool net_detect;
1004
+ u8 offload_tid;
9761005 #ifdef CONFIG_IWLWIFI_DEBUGFS
9771006 bool d3_wake_sysassert;
9781007 bool d3_test_active;
979
- bool store_d3_resume_sram;
980
- void *d3_resume_sram;
9811008 u32 d3_test_pme_ptr;
9821009 struct ieee80211_vif *keep_vif;
9831010 u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */
9841011 #endif
9851012 #endif
9861013
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;
9981014 wait_queue_head_t rx_sync_waitq;
9991015
10001016 /* BT-Coex */
....@@ -1044,7 +1060,8 @@
10441060
10451061 /* Indicate if device power save is allowed */
10461062 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;
10481065
10491066 struct ieee80211_vif __rcu *csa_vif;
10501067 struct ieee80211_vif __rcu *csa_tx_blocked_vif;
....@@ -1087,7 +1104,25 @@
10871104
10881105 u32 ciphers[IWL_MVM_NUM_CIPHERS];
10891106 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;
10911126
10921127 struct ieee80211_vif *nan_vif;
10931128 #define IWL_MAX_BAID 32
....@@ -1103,10 +1138,10 @@
11031138
11041139 /* does a monitor vif exist (only one can exist hence bool) */
11051140 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];
11101145 };
11111146
11121147 /* Extract MVM priv from op_mode and _hw */
....@@ -1123,11 +1158,12 @@
11231158 * @IWL_MVM_STATUS_ROC_RUNNING: remain-on-channel is running
11241159 * @IWL_MVM_STATUS_HW_RESTART_REQUESTED: HW restart was requested
11251160 * @IWL_MVM_STATUS_IN_HW_RESTART: HW restart is active
1126
- * @IWL_MVM_STATUS_IN_D0I3: NIC is in D0i3
11271161 * @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running
1128
- * @IWL_MVM_STATUS_D3_RECONFIG: D3 reconfiguration is being done
11291162 * @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running
11301163 * @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
11311167 */
11321168 enum iwl_mvm_status {
11331169 IWL_MVM_STATUS_HW_RFKILL,
....@@ -1135,19 +1171,17 @@
11351171 IWL_MVM_STATUS_ROC_RUNNING,
11361172 IWL_MVM_STATUS_HW_RESTART_REQUESTED,
11371173 IWL_MVM_STATUS_IN_HW_RESTART,
1138
- IWL_MVM_STATUS_IN_D0I3,
11391174 IWL_MVM_STATUS_ROC_AUX_RUNNING,
1140
- IWL_MVM_STATUS_D3_RECONFIG,
11411175 IWL_MVM_STATUS_FIRMWARE_RUNNING,
11421176 IWL_MVM_STATUS_NEED_FLUSH_P2P,
1177
+ IWL_MVM_STATUS_IN_D3,
1178
+ IWL_MVM_STATUS_STARTING,
11431179 };
11441180
11451181 /* Keep track of completed init configuration */
11461182 enum iwl_mvm_init_status {
11471183 IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0),
11481184 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),
11511185 };
11521186
11531187 static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
....@@ -1174,7 +1208,7 @@
11741208 {
11751209 struct ieee80211_sta *sta;
11761210
1177
- if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
1211
+ if (sta_id >= mvm->fw->ucode_capa.num_stations)
11781212 return NULL;
11791213
11801214 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
....@@ -1191,7 +1225,7 @@
11911225 {
11921226 struct ieee80211_sta *sta;
11931227
1194
- if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
1228
+ if (sta_id >= mvm->fw->ucode_capa.num_stations)
11951229 return NULL;
11961230
11971231 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],
....@@ -1204,11 +1238,17 @@
12041238 return iwl_mvm_sta_from_mac80211(sta);
12051239 }
12061240
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)
12081243 {
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));
12121252 }
12131253
12141254 static inline bool iwl_mvm_is_adaptive_dwell_supported(struct iwl_mvm *mvm)
....@@ -1223,23 +1263,27 @@
12231263 IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2);
12241264 }
12251265
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
+
12261272 static inline bool iwl_mvm_is_oce_supported(struct iwl_mvm *mvm)
12271273 {
12281274 /* OCE should never be enabled for LMAC scan FWs */
12291275 return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_OCE);
12301276 }
12311277
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)
12331279 {
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);
12431287 }
12441288
12451289 static inline bool iwl_mvm_is_dqa_data_queue(struct iwl_mvm *mvm, u8 queue)
....@@ -1259,9 +1303,6 @@
12591303 bool nvm_lar = mvm->nvm_data->lar_enabled;
12601304 bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,
12611305 IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
1262
-
1263
- if (iwlwifi_mod_params.lar_disable)
1264
- return false;
12651306
12661307 /*
12671308 * Enable LAR only if it is supported by the FW (TLV) &&
....@@ -1320,13 +1361,13 @@
13201361 static inline bool iwl_mvm_has_new_tx_api(struct iwl_mvm *mvm)
13211362 {
13221363 /* TODO - replace with TLV once defined */
1323
- return mvm->trans->cfg->use_tfh;
1364
+ return mvm->trans->trans_cfg->use_tfh;
13241365 }
13251366
13261367 static inline bool iwl_mvm_has_unified_ucode(struct iwl_mvm *mvm)
13271368 {
13281369 /* 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;
13301371 }
13311372
13321373 static inline bool iwl_mvm_is_cdb_supported(struct iwl_mvm *mvm)
....@@ -1351,7 +1392,26 @@
13511392 * but then there's a little bit of code in scan that won't make
13521393 * any sense...
13531394 */
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);
13551415 }
13561416
13571417 static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm)
....@@ -1383,7 +1443,6 @@
13831443
13841444 static inline bool iwl_mvm_is_tt_in_fw(struct iwl_mvm *mvm)
13851445 {
1386
-#ifdef CONFIG_THERMAL
13871446 /* these two TLV are redundant since the responsibility to CT-kill by
13881447 * FW happens only after we send at least one command of
13891448 * temperature THs report.
....@@ -1392,9 +1451,6 @@
13921451 IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW) &&
13931452 fw_has_capa(&mvm->fw->ucode_capa,
13941453 IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT);
1395
-#else /* CONFIG_THERMAL */
1396
- return false;
1397
-#endif /* CONFIG_THERMAL */
13981454 }
13991455
14001456 static inline bool iwl_mvm_is_ctdp_supported(struct iwl_mvm *mvm)
....@@ -1437,10 +1493,12 @@
14371493 enum nl80211_band band,
14381494 struct ieee80211_tx_rate *r);
14391495 u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
1496
+u8 iwl_mvm_mac80211_ac_to_ucode_ac(enum ieee80211_ac_numbers ac);
14401497 void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
14411498 u8 first_antenna(u8 mask);
14421499 u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx);
14431500 void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime);
1501
+u32 iwl_mvm_get_systime(struct iwl_mvm *mvm);
14441502
14451503 /* Tx / Host Commands */
14461504 int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,
....@@ -1453,8 +1511,8 @@
14531511 int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id,
14541512 u16 len, const void *data,
14551513 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);
14581516 int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb);
14591517 void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
14601518 struct iwl_tx_cmd *tx_cmd,
....@@ -1462,13 +1520,18 @@
14621520 void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd,
14631521 struct ieee80211_tx_info *info,
14641522 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
+
14651528 #ifdef CONFIG_IWLWIFI_DEBUG
14661529 const char *iwl_mvm_get_tx_fail_reason(u32 status);
14671530 #else
14681531 static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; }
14691532 #endif
14701533 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);
14721535 int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id,
14731536 u16 tids, u32 flags);
14741537
....@@ -1514,6 +1577,11 @@
15141577 mvm->fw->valid_rx_ant;
15151578 }
15161579
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
+
15171585 static inline u32 iwl_mvm_get_phy_config(struct iwl_mvm *mvm)
15181586 {
15191587 u32 phy_config = ~(FW_PHY_CFG_TX_CHAIN |
....@@ -1543,15 +1611,20 @@
15431611 struct iwl_rx_cmd_buffer *rxb);
15441612 void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
15451613 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);
15461616 void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi,
15471617 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);
15481620 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);
15521624 void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
15531625 void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm,
15541626 struct iwl_rx_cmd_buffer *rxb);
1627
+void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags);
15551628 void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
15561629 void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
15571630 struct iwl_rx_cmd_buffer *rxb);
....@@ -1584,9 +1657,19 @@
15841657 int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
15851658 bool force_assoc_off, const u8 *bssid_override);
15861659 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);
15881660 int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
15891661 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);
15901673 void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
15911674 struct iwl_rx_cmd_buffer *rxb);
15921675 void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
....@@ -1600,8 +1683,10 @@
16001683 struct iwl_rx_cmd_buffer *rxb);
16011684 void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm,
16021685 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);
16051690 void iwl_mvm_channel_switch_noa_notif(struct iwl_mvm *mvm,
16061691 struct iwl_rx_cmd_buffer *rxb);
16071692 /* Bindings */
....@@ -1665,14 +1750,13 @@
16651750
16661751 /* MVM debugfs */
16671752 #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);
16691754 void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
16701755 void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
16711756 #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)
16741759 {
1675
- return 0;
16761760 }
16771761 static inline void
16781762 iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
....@@ -1685,7 +1769,7 @@
16851769 #endif /* CONFIG_IWLWIFI_DEBUGFS */
16861770
16871771 /* 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);
16891773 void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg);
16901774 int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate);
16911775 void rs_update_last_rssi(struct iwl_mvm *mvm,
....@@ -1733,31 +1817,11 @@
17331817 void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw,
17341818 struct ieee80211_vif *vif, int idx);
17351819 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);
17361821 #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);
17441822 void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm,
17451823 struct ieee80211_vif *vif);
17461824 #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
-
17611825 static inline void
17621826 iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
17631827 {
....@@ -1770,16 +1834,6 @@
17701834 bool disable_offloading,
17711835 bool offload_ns,
17721836 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);
17831837
17841838 /* BT Coex */
17851839 int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm);
....@@ -1796,6 +1850,7 @@
17961850 bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm);
17971851 bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
17981852 enum nl80211_band band);
1853
+u8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants);
17991854 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
18001855 struct ieee80211_tx_info *info, u8 ac);
18011856
....@@ -1810,9 +1865,6 @@
18101865 struct iwl_beacon_filter_cmd *cmd)
18111866 {}
18121867 #endif
1813
-int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
1814
- struct ieee80211_vif *vif,
1815
- bool enable, u32 flags);
18161868 int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,
18171869 struct ieee80211_vif *vif,
18181870 u32 flags);
....@@ -1832,6 +1884,8 @@
18321884 /* get SystemLowLatencyMode - only needed for beacon threshold? */
18331885 bool iwl_mvm_low_latency(struct iwl_mvm *mvm);
18341886 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);
18351889
18361890 /* get VMACLowLatencyMode */
18371891 static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif)
....@@ -1846,51 +1900,64 @@
18461900 * binding, so this has no real impact. For now, just return
18471901 * the current desired low-latency state.
18481902 */
1849
- return mvmvif->low_latency;
1903
+ return mvmvif->low_latency_actual;
18501904 }
18511905
18521906 static inline
18531907 void iwl_mvm_vif_set_low_latency(struct iwl_mvm_vif *mvmvif, bool set,
18541908 enum iwl_mvm_low_latency_cause cause)
18551909 {
1910
+ u8 new_state;
1911
+
18561912 if (set)
18571913 mvmvif->low_latency |= cause;
18581914 else
18591915 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;
18601940 }
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);
18721941
18731942 /* Return a bitmask with all the hw supported queues, except for the
18741943 * command queue, which can't be flushed.
18751944 */
18761945 static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm)
18771946 {
1878
- return ((BIT(mvm->cfg->base_params->num_of_queues) - 1) &
1947
+ return ((BIT(mvm->trans->trans_cfg->base_params->num_of_queues) - 1) &
18791948 ~BIT(IWL_MVM_DQA_CMD_QUEUE));
18801949 }
18811950
18821951 static inline void iwl_mvm_stop_device(struct iwl_mvm *mvm)
18831952 {
1953
+ lockdep_assert_held(&mvm->mutex);
18841954 iwl_fw_cancel_timestamp(&mvm->fwrt);
1885
- iwl_free_fw_paging(&mvm->fwrt);
18861955 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);
18881957 iwl_trans_stop_device(mvm->trans);
1958
+ iwl_free_fw_paging(&mvm->fwrt);
1959
+ iwl_fw_dump_conf_clear(&mvm->fwrt);
18891960 }
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);
18941961
18951962 /* Re-configure the SCD for a queue that has already been configured */
18961963 int iwl_mvm_reconfig_scd(struct iwl_mvm *mvm, int queue, int fifo, int sta_id,
....@@ -1931,6 +1998,37 @@
19311998 int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
19321999 bool added_vif);
19332000
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
+
19342032 /* TDLS */
19352033
19362034 /*
....@@ -1966,8 +2064,6 @@
19662064 struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);
19672065 bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm);
19682066
1969
-void iwl_mvm_inactivity_check(struct iwl_mvm *mvm);
1970
-
19712067 #define MVM_TCM_PERIOD_MSEC 500
19722068 #define MVM_TCM_PERIOD (HZ * MVM_TCM_PERIOD_MSEC / 1000)
19732069 #define MVM_LL_PERIOD (10 * HZ)
....@@ -1992,6 +2088,7 @@
19922088
19932089 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b);
19942090 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm);
2091
+int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm);
19952092 #ifdef CONFIG_IWLWIFI_DEBUGFS
19962093 void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
19972094 struct ieee80211_vif *vif,
....@@ -1999,4 +2096,96 @@
19992096 struct dentry *dir);
20002097 #endif
20012098
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
+}
20022191 #endif /* __IWL_MVM_H__ */