Skip to content

Commit 1c096d8

Browse files
AviSternlucacoelho
authored andcommitted
iwlwifi: mvm: add support for range request command ver 11
Version 11 of the range request command adds support for setting the PN for secure ranging. For now, this is not yet supported. The same functions that are used for version 9 and 10 are also used for version 11 as the common part is the same. Signed-off-by: Avraham Stern <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20200928121852.6f9ed4140e8c.I046e0d9f6dfaafda9794e5eb2ee1f02fcad2851a@changeid Signed-off-by: Luca Coelho <[email protected]>
1 parent 0a8159c commit 1c096d8

File tree

4 files changed

+234
-26
lines changed

4 files changed

+234
-26
lines changed

drivers/net/wireless/intel/iwlwifi/fw/api/location.h

Lines changed: 176 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -552,15 +552,19 @@ struct iwl_tof_range_req_ap_entry_v4 {
552552
* @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128
553553
* @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128
554554
* @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256
555+
* @IWL_LOCATION_CIPHER_INVALID: security is not used.
556+
* @IWL_LOCATION_CIPHER_MAX: maximum value for this enum.
555557
*/
556558
enum iwl_location_cipher {
557559
IWL_LOCATION_CIPHER_CCMP_128,
558560
IWL_LOCATION_CIPHER_GCMP_128,
559561
IWL_LOCATION_CIPHER_GCMP_256,
562+
IWL_LOCATION_CIPHER_INVALID,
563+
IWL_LOCATION_CIPHER_MAX,
560564
};
561565

562566
/**
563-
* struct iwl_tof_range_req_ap_entry - AP configuration parameters
567+
* struct iwl_tof_range_req_ap_entry_v6 - AP configuration parameters
564568
* @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
565569
* @channel_num: AP Channel number
566570
* @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
@@ -588,7 +592,7 @@ enum iwl_location_cipher {
588592
* @beacon_interval: beacon interval of the AP in TUs. Only required if
589593
* &IWL_INITIATOR_AP_FLAGS_TB is set.
590594
*/
591-
struct iwl_tof_range_req_ap_entry {
595+
struct iwl_tof_range_req_ap_entry_v6 {
592596
__le32 initiator_ap_flags;
593597
u8 channel_num;
594598
u8 format_bw;
@@ -606,6 +610,61 @@ struct iwl_tof_range_req_ap_entry {
606610
__le16 beacon_interval;
607611
} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */
608612

613+
/**
614+
* struct iwl_tof_range_req_ap_entry_v7 - AP configuration parameters
615+
* @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
616+
* @channel_num: AP Channel number
617+
* @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
618+
* bits 4 - 7: &enum iwl_location_bw.
619+
* @ctrl_ch_position: Coding of the control channel position relative to the
620+
* center frequency, see iwl_mvm_get_ctrl_pos().
621+
* @ftmr_max_retries: Max number of retries to send the FTMR in case of no
622+
* reply from the AP.
623+
* @bssid: AP's BSSID
624+
* @burst_period: Recommended value to be sent to the AP. Measurement
625+
* periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
626+
* @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
627+
* @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
628+
* the number of measurement iterations (min 2^0 = 1, max 2^14)
629+
* @sta_id: the station id of the AP. Only relevant when associated to the AP,
630+
* otherwise should be set to &IWL_MVM_INVALID_STA.
631+
* @cipher: pairwise cipher suite for secured measurement.
632+
* &enum iwl_location_cipher.
633+
* @hltk: HLTK to be used for secured 11az measurement
634+
* @tk: TK to be used for secured 11az measurement
635+
* @calib: An array of calibration values per FTM rx bandwidth.
636+
* If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
637+
* calibration value that corresponds to the rx bandwidth of the FTM
638+
* frame.
639+
* @beacon_interval: beacon interval of the AP in TUs. Only required if
640+
* &IWL_INITIATOR_AP_FLAGS_TB is set.
641+
* @rx_pn: the next expected PN for protected management frames Rx. LE byte
642+
* order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
643+
* is set to &IWL_MVM_INVALID_STA.
644+
* @tx_pn: the next PN to use for protected management frames Tx. LE byte
645+
* order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
646+
* is set to &IWL_MVM_INVALID_STA.
647+
*/
648+
struct iwl_tof_range_req_ap_entry_v7 {
649+
__le32 initiator_ap_flags;
650+
u8 channel_num;
651+
u8 format_bw;
652+
u8 ctrl_ch_position;
653+
u8 ftmr_max_retries;
654+
u8 bssid[ETH_ALEN];
655+
__le16 burst_period;
656+
u8 samples_per_burst;
657+
u8 num_of_bursts;
658+
u8 sta_id;
659+
u8 cipher;
660+
u8 hltk[HLTK_11AZ_LEN];
661+
u8 tk[TK_11AZ_LEN];
662+
__le16 calib[IWL_TOF_BW_NUM];
663+
__le16 beacon_interval;
664+
u8 rx_pn[IEEE80211_CCMP_PN_LEN];
665+
u8 tx_pn[IEEE80211_CCMP_PN_LEN];
666+
} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_7 */
667+
609668
/**
610669
* enum iwl_tof_response_mode
611670
* @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as
@@ -772,7 +831,7 @@ struct iwl_tof_range_req_cmd_v8 {
772831
} __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_8 */
773832

774833
/**
775-
* struct iwl_tof_range_req_cmd - start measurement cmd
834+
* struct iwl_tof_range_req_cmd_v9 - start measurement cmd
776835
* @initiator_flags: see flags @ iwl_tof_initiator_flags
777836
* @request_id: A Token incremented per request. The same Token will be
778837
* sent back in the range response
@@ -787,7 +846,7 @@ struct iwl_tof_range_req_cmd_v8 {
787846
* TSF of this mac id. 0xff to disable TSF reporting.
788847
* @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
789848
*/
790-
struct iwl_tof_range_req_cmd {
849+
struct iwl_tof_range_req_cmd_v9 {
791850
__le32 initiator_flags;
792851
u8 request_id;
793852
u8 num_of_ap;
@@ -796,9 +855,37 @@ struct iwl_tof_range_req_cmd {
796855
u8 macaddr_template[ETH_ALEN];
797856
__le32 req_timeout_ms;
798857
__le32 tsf_mac_id;
799-
struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS];
858+
struct iwl_tof_range_req_ap_entry_v6 ap[IWL_MVM_TOF_MAX_APS];
800859
} __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_9 */
801860

861+
/**
862+
* struct iwl_tof_range_req_cmd_v11 - start measurement cmd
863+
* @initiator_flags: see flags @ iwl_tof_initiator_flags
864+
* @request_id: A Token incremented per request. The same Token will be
865+
* sent back in the range response
866+
* @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
867+
* @range_req_bssid: ranging request BSSID
868+
* @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
869+
* Bits set to 1 shall be randomized by the UMAC
870+
* @macaddr_template: MAC address template to use for non-randomized bits
871+
* @req_timeout_ms: Requested timeout of the response in units of milliseconds.
872+
* This is the session time for completing the measurement.
873+
* @tsf_mac_id: report the measurement start time for each ap in terms of the
874+
* TSF of this mac id. 0xff to disable TSF reporting.
875+
* @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
876+
*/
877+
struct iwl_tof_range_req_cmd_v11 {
878+
__le32 initiator_flags;
879+
u8 request_id;
880+
u8 num_of_ap;
881+
u8 range_req_bssid[ETH_ALEN];
882+
u8 macaddr_mask[ETH_ALEN];
883+
u8 macaddr_template[ETH_ALEN];
884+
__le32 req_timeout_ms;
885+
__le32 tsf_mac_id;
886+
struct iwl_tof_range_req_ap_entry_v7 ap[IWL_MVM_TOF_MAX_APS];
887+
} __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_11 */
888+
802889
/*
803890
* enum iwl_tof_range_request_status - status of the sent request
804891
* @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the
@@ -960,7 +1047,7 @@ struct iwl_tof_range_rsp_ap_entry_ntfy_v4 {
9601047
} __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */
9611048

9621049
/**
963-
* struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response)
1050+
* struct iwl_tof_range_rsp_ap_entry_ntfy_v5 - AP parameters (response)
9641051
* @bssid: BSSID of the AP
9651052
* @measure_status: current APs measurement status, one of
9661053
* &enum iwl_tof_entry_status.
@@ -992,7 +1079,7 @@ struct iwl_tof_range_rsp_ap_entry_ntfy_v4 {
9921079
* @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
9931080
* @reserved: for alignment
9941081
*/
995-
struct iwl_tof_range_rsp_ap_entry_ntfy {
1082+
struct iwl_tof_range_rsp_ap_entry_ntfy_v5 {
9961083
u8 bssid[ETH_ALEN];
9971084
u8 measure_status;
9981085
u8 measure_bw;
@@ -1016,6 +1103,69 @@ struct iwl_tof_range_rsp_ap_entry_ntfy {
10161103
u8 reserved[3];
10171104
} __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_5 */
10181105

1106+
/**
1107+
* struct iwl_tof_range_rsp_ap_entry_ntfy_v6 - AP parameters (response)
1108+
* @bssid: BSSID of the AP
1109+
* @measure_status: current APs measurement status, one of
1110+
* &enum iwl_tof_entry_status.
1111+
* @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz
1112+
* @rtt: The Round Trip Time that took for the last measurement for
1113+
* current AP [pSec]
1114+
* @rtt_variance: The Variance of the RTT values measured for current AP
1115+
* @rtt_spread: The Difference between the maximum and the minimum RTT
1116+
* values measured for current AP in the current session [pSec]
1117+
* @rssi: RSSI as uploaded in the Channel Estimation notification
1118+
* @rssi_spread: The Difference between the maximum and the minimum RSSI values
1119+
* measured for current AP in the current session
1120+
* @last_burst: 1 if no more FTM sessions are scheduled for this responder
1121+
* @refusal_period: refusal period in case of
1122+
* @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1123+
* @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1124+
* uploaded by the LMAC
1125+
* @start_tsf: measurement start time in TSF of the mac specified in the range
1126+
* request
1127+
* @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1128+
* responder
1129+
* @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1130+
* @t2t3_initiator: as calculated from the algo in the initiator
1131+
* @t1t4_responder: as calculated from the algo in the responder
1132+
* @common_calib: Calib val that was used in for this AP measurement
1133+
* @specific_calib: val that was used in for this AP measurement
1134+
* @papd_calib_output: The result of the tof papd calibration that was injected
1135+
* into the algorithm.
1136+
* @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
1137+
* @reserved: for alignment
1138+
* @rx_pn: the last PN used for this responder Rx in case PMF is configured in
1139+
* LE byte order.
1140+
* @tx_pn: the last PN used for this responder Tx in case PMF is configured in
1141+
* LE byte order.
1142+
*/
1143+
struct iwl_tof_range_rsp_ap_entry_ntfy_v6 {
1144+
u8 bssid[ETH_ALEN];
1145+
u8 measure_status;
1146+
u8 measure_bw;
1147+
__le32 rtt;
1148+
__le32 rtt_variance;
1149+
__le32 rtt_spread;
1150+
s8 rssi;
1151+
u8 rssi_spread;
1152+
u8 last_burst;
1153+
u8 refusal_period;
1154+
__le32 timestamp;
1155+
__le32 start_tsf;
1156+
__le32 rx_rate_n_flags;
1157+
__le32 tx_rate_n_flags;
1158+
__le32 t2t3_initiator;
1159+
__le32 t1t4_responder;
1160+
__le16 common_calib;
1161+
__le16 specific_calib;
1162+
__le32 papd_calib_output;
1163+
u8 rttConfidence;
1164+
u8 reserved[3];
1165+
u8 rx_pn[IEEE80211_CCMP_PN_LEN];
1166+
u8 tx_pn[IEEE80211_CCMP_PN_LEN];
1167+
} __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_6 */
1168+
10191169
/**
10201170
* enum iwl_tof_response_status - tof response status
10211171
*
@@ -1066,21 +1216,37 @@ struct iwl_tof_range_rsp_ntfy_v6 {
10661216
} __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */
10671217

10681218
/**
1069-
* struct iwl_tof_range_rsp_ntfy - ranging response notification
1219+
* struct iwl_tof_range_rsp_ntfy_v7 - ranging response notification
10701220
* @request_id: A Token ID of the corresponding Range request
10711221
* @num_of_aps: Number of APs results
10721222
* @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
10731223
* @reserved: reserved
10741224
* @ap: per-AP data
10751225
*/
1076-
struct iwl_tof_range_rsp_ntfy {
1226+
struct iwl_tof_range_rsp_ntfy_v7 {
10771227
u8 request_id;
10781228
u8 num_of_aps;
10791229
u8 last_report;
10801230
u8 reserved;
1081-
struct iwl_tof_range_rsp_ap_entry_ntfy ap[IWL_MVM_TOF_MAX_APS];
1231+
struct iwl_tof_range_rsp_ap_entry_ntfy_v5 ap[IWL_MVM_TOF_MAX_APS];
10821232
} __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_7 */
10831233

1234+
/**
1235+
* struct iwl_tof_range_rsp_ntfy_v8 - ranging response notification
1236+
* @request_id: A Token ID of the corresponding Range request
1237+
* @num_of_aps: Number of APs results
1238+
* @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1239+
* @reserved: reserved
1240+
* @ap: per-AP data
1241+
*/
1242+
struct iwl_tof_range_rsp_ntfy_v8 {
1243+
u8 request_id;
1244+
u8 num_of_aps;
1245+
u8 last_report;
1246+
u8 reserved;
1247+
struct iwl_tof_range_rsp_ap_entry_ntfy_v6 ap[IWL_MVM_TOF_MAX_APS];
1248+
} __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_8 */
1249+
10841250
#define IWL_MVM_TOF_MCSI_BUF_SIZE (245)
10851251
/**
10861252
* struct iwl_tof_mcsi_notif - used for debug

0 commit comments

Comments
 (0)