From 31684a15c2655716632fd15d6469fe8831ab604d Mon Sep 17 00:00:00 2001 From: kensun Date: Mon, 31 Oct 2022 13:41:09 +0000 Subject: Add HAL APIs to query cached scan results Add HAL API to retrieve the on-chip scan results. Bug: 232030878 Test: New API works fine Change-Id: I0487d010078f4e33fef76a951cc87647746ac867 --- include/hardware_legacy/wifi_cached_scan_results.h | 92 ++++++++++++++++++++++ include/hardware_legacy/wifi_hal.h | 10 ++- 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 include/hardware_legacy/wifi_cached_scan_results.h diff --git a/include/hardware_legacy/wifi_cached_scan_results.h b/include/hardware_legacy/wifi_cached_scan_results.h new file mode 100644 index 0000000..a2a23fe --- /dev/null +++ b/include/hardware_legacy/wifi_cached_scan_results.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __WIFI_CACHED_SCAN_RESULTS_H__ +#define __WIFI_CACHED_SCAN_RESULTS_H__ + +#include "wifi_hal.h" + +#define WIFI_CACHED_SCAN_RESULT_FLAGS_NONE (0) +/* Element ID 61 (HT Operation) is present (see HT 7.3.2) */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_HT_OPS_PRESENT (1 << 0) +/* Element ID 192 (VHT Operation) is present (see VHT 8.4.2) */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_VHT_OPS_PRESENT (1 << 1) +/* Element ID 255 + Extension 36 (HE Operation) is present + * (see 802.11ax 9.4.2.1) + */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_HE_OPS_PRESENT (1 << 2) +/* Element ID 255 + Extension 106 (HE Operation) is present + * (see 802.11be D1.5 9.4.2.1) + */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_EHT_OPS_PRESENT (1 << 3) +/* Element ID 127 (Extended Capabilities) is present, and bit 70 + * (Fine Timing Measurement Responder) is set to 1 + * (see IEEE Std 802.11-2016 9.4.2.27) + */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_IS_FTM_RESPONDER (1 << 4) + +/** + * Provides information about a single access point (AP) detected in a scan. + */ +typedef struct { + /* Number of milliseconds prior to ts in the enclosing + * wifi_cached_scan_result_report struct when + * the probe response or beacon frame that + * was used to populate this structure was received. + */ + u32 age_ms; + /* The Capability Information field */ + u16 capability; + /* null terminated */ + u8 ssid[33]; + u8 ssid_len; + u8 bssid[6]; + /* A set of flags from WIFI_CACHED_SCAN_RESULT_FLAGS_* */ + u8 flags; + s8 rssi; + wifi_channel_spec chanspec; +}wifi_cached_scan_result; + +/* + * Data structure sent with events of type WifiCachedScanResult. + */ +typedef struct { + /* time since boot (in microsecond) when the result was retrieved */ + wifi_timestamp ts; + /* If 0, indicates that all frequencies in current regulation were + * scanned. Otherwise, indicates the number of frequencies scanned, as + * specified in scanned_freq_list. + */ + u16 scanned_freq_num; + /* Pointer to an array containing scanned_freq_num values comprising the + * set of frequencies that were scanned. Frequencies are specified as + * channel center frequencies in MHz. May be NULL if scannedFreqListLen is + * 0. + */ + const u32 *scanned_freq_list; + /* The total number of cached results returned. */ + u8 result_cnt; + /* Pointer to an array containing result_cnt entries. May be NULL if + * result_cnt is 0. + */ + const wifi_cached_scan_result *results; +} wifi_cached_scan_report; + +/* callback for reporting cached scan report */ +typedef struct { + void (*on_cached_scan_results) (wifi_cached_scan_report *cache_report); +} wifi_cached_scan_result_handler; +#endif diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 952e894..6ffd2d1 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -578,6 +578,7 @@ typedef struct { #include "gscan.h" #include "link_layer_stats.h" +#include "wifi_cached_scan_results.h" #include "rtt.h" #include "tdls.h" #include "wifi_logger.h" @@ -1025,7 +1026,14 @@ typedef struct { wifi_error (*wifi_enable_tx_power_limits) (wifi_interface_handle iface, bool isEnable); - + /**@brief wifi_get_cached_scan_results + * Retrieve scan results cached in wifi firmware + * @param wifi_interface_handle + * @param wifi_cached_scan_result_handler : callback function pointer + * @return Synchronous wifi_error + */ + wifi_error (*wifi_get_cached_scan_results)(wifi_interface_handle iface, + wifi_cached_scan_result_handler handler); /* * when adding new functions make sure to add stubs in * hal_tool.cpp::init_wifi_stub_hal_func_table -- cgit v1.2.3 From cac6d2ece83d90838517a7f1fcda38842065d7ff Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Fri, 2 Dec 2022 17:10:42 -0800 Subject: wifi: Add HAL API to get wifi chip capabilities Bug: 231497844 Test: Builds successfully Change-Id: Ie7192ad484a9ecef3c6c98d03710af32c5558904 --- include/hardware_legacy/wifi_hal.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 6ffd2d1..cef5a5e 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -277,6 +277,17 @@ typedef struct { wifi_radio_combination radio_combinations[]; } wifi_radio_combination_matrix; +typedef struct { + /** + * Maximum number of links used in Multi-Link Operation. The maximum + * number of links used for MLO can be different from the number of + * radios supported by the chip. + * + * This is a static configuration of the chip. + */ + u32 max_mlo_link_count; +} wifi_chip_capabilities; + /* Initialize/Cleanup */ wifi_error wifi_initialize(wifi_handle *handle); @@ -1034,6 +1045,13 @@ typedef struct { */ wifi_error (*wifi_get_cached_scan_results)(wifi_interface_handle iface, wifi_cached_scan_result_handler handler); + /**@brief wifi_get_chip_capabilities + * Retrieve capabilities supported by this chip + * @param wifi_handle + * @return Synchronous wifi_error and chip capabilites + */ + wifi_error (*wifi_get_chip_capabilities)(wifi_handle handle, + wifi_chip_capabilities *chip_capabilities); /* * when adding new functions make sure to add stubs in * hal_tool.cpp::init_wifi_stub_hal_func_table -- cgit v1.2.3 From 7d67567dd8f4d334ad2f7be113c95ff095dddfa8 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Mon, 12 Dec 2022 03:46:36 +0000 Subject: wifi: Add number of TDLS sessions in chip capability Bug: 240247868 Test: Manual - STA connect/disconnect Change-Id: I54417931d4634085a9de490b9b07029b0c3c7b7f --- include/hardware_legacy/wifi_hal.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index cef5a5e..74cfcb9 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -286,6 +286,11 @@ typedef struct { * This is a static configuration of the chip. */ u32 max_mlo_link_count; + /** + * Maximum number of concurrent TDLS sessions supported by the chip. + * + */ + u32 max_concurrent_tdls_session_count; } wifi_chip_capabilities; /* Initialize/Cleanup */ -- cgit v1.2.3 From 2832940b56f03db12d883536bae7f581e78a3fc8 Mon Sep 17 00:00:00 2001 From: Purushottam Kushwaha Date: Tue, 14 Jun 2022 12:02:19 +0530 Subject: wifi_hal: Add interface to get driver supported iface combinations Interface combinations may vary based on underlying hardware/firmware and driver support. Add a new API to query the interface combination matrix through vendor hal. Bug: 249351396 Test: Build successfully Change-Id: I51dae4b182ef60a0ab4f1b16d624c69e0a3aebc4 --- include/hardware_legacy/wifi_hal.h | 112 +++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 74cfcb9..7cd17af 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -125,6 +125,7 @@ typedef enum { WIFI_INTERFACE_TYPE_AP = 1, WIFI_INTERFACE_TYPE_P2P = 2, WIFI_INTERFACE_TYPE_NAN = 3, + WIFI_INTERFACE_TYPE_AP_BRIDGED = 4, } wifi_interface_type; /* @@ -293,6 +294,105 @@ typedef struct { u32 max_concurrent_tdls_session_count; } wifi_chip_capabilities; +#define MAX_IFACE_COMBINATIONS 16 +#define MAX_IFACE_LIMITS 8 + +/* Wifi interface limit + * Example: + * 1. To allow STA+STA: + * wifi_iface_limit limit1 = { + * .max_limit = 2, + * .iface_mask = BIT(WIFI_INTERFACE_TYPE_STA) + * }; + * 2. To allow Single P2P/NAN: + * wifi_iface_limit limit2 = { + * .max_limit = 1, + * .iface_mask = BIT(WIFI_INTERFACE_TYPE_P2P) + * | BIT(WIFI_INTERFACE_TYPE_NAN) + * }; + */ +typedef struct { + /* Max number of interfaces of same type */ + u32 max_limit; + /* BIT mask of interfaces from wifi_interface_type */ + u32 iface_mask; +} wifi_iface_limit; + +/* Wifi Interface combination + * Example: + * 1. To allow STA+SAP: + * wifi_iface_limit limits1[] = { + * {1, BIT(WIFI_INTERFACE_TYPE_STA)}, + * }; + * wifi_iface_limit limits2[] = { + * {1, BIT(WIFI_INTERFACE_TYPE_AP)}, + * }; + * wifi_iface_combination comb1 = { + * .max_ifaces = 2, + * .num_iface_limits = 2, + * .iface_limits = {limits1, limits2,}, + * }; + * + * 2. To allow STA+P2P/NAN: + * wifi_iface_limit limits3[] = { + * {1, BIT(WIFI_INTERFACE_TYPE_STA)}, + * {1, BIT(WIFI_INTERFACE_TYPE_P2P) + | BIT(WIFI_INTERFACE_TYPE_NAN)}, + * }; + * wifi_iface_combination comb2 = { + * .max_ifaces = 2, + * .num_iface_limits = 1, + * .iface_limits = {limits3,}, + * }; + * + * 3. To allow STA+STA/AP: + * wifi_iface_limit limits4[] = { + * {2, BIT(WIFI_INTERFACE_TYPE_STA)}, + * }; + * wifi_iface_limit limits5[] = { + * {1, BIT(WIFI_INTERFACE_TYPE_STA)}, + * {1, BIT(WIFI_INTERFACE_TYPE_AP)}, + * }; + * wifi_iface_combination comb3 = { + * .max_ifaces = 2, + * .num_iface_limits = 2, + * .iface_limits = {limits4, limits5,}, + * }; + * + * 4. To allow AP_BRIDGED (AP+AP in bridge mode): + * wifi_iface_limit limits6[] = { + * {1, BIT(WIFI_INTERFACE_TYPE_AP_BRIDGED)}, + * }; + * wifi_iface_combination comb4 = { + * .max_ifaces = 1, + * .num_iface_limits = 1, + * .iface_limits = {limits6,}, + * }; + */ +typedef struct { + /* Maximum number of concurrent interfaces allowed in this combination */ + u32 max_ifaces; + /* Total number of interface limits in a combination */ + u32 num_iface_limits; + /* Interface limits */ + wifi_iface_limit iface_limits[MAX_IFACE_LIMITS]; +} wifi_iface_combination; + +/* Wifi Interface concurrency combination matrix + * Example: + * 1. To allow 2 port concurrency with limts defined in above comments: + * wifi_iface_concurrency_matrix iface_concurrency_matrix = { + * .num_iface_combinations = 4, + * .iface_combinations = {comb1, comb2, comb3, comb4, } + * }; + */ +typedef struct { + /* Total count of possible iface combinations */ + u32 num_iface_combinations; + /* Interface combinations */ + wifi_iface_combination iface_combinations[MAX_IFACE_COMBINATIONS]; +} wifi_iface_concurrency_matrix; + /* Initialize/Cleanup */ wifi_error wifi_initialize(wifi_handle *handle); @@ -1057,6 +1157,18 @@ typedef struct { */ wifi_error (*wifi_get_chip_capabilities)(wifi_handle handle, wifi_chip_capabilities *chip_capabilities); + + /**@brief wifi_get_supported_iface_concurrency_matrix + * Request all the possible interface concurrency combinations this + * Wifi Chip can offer. + * @param handle global wifi_handle + * @param wifi_iface_concurrency_matrix to return all the possible + * interface concurrency combinations. + * @return Synchronous wifi_error + */ + wifi_error (*wifi_get_supported_iface_concurrency_matrix)( + wifi_handle handle, wifi_iface_concurrency_matrix *matrix); + /* * when adding new functions make sure to add stubs in * hal_tool.cpp::init_wifi_stub_hal_func_table -- cgit v1.2.3 From c4b6fa85b76cbe598c37d1d834b96d71a27b1291 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Fri, 11 Nov 2022 15:51:54 -0800 Subject: [Aware] Wifi Aware 4.0 legacy HAL change To support Wifi Aware 4.0 with pairing Bug: 249185683 Test: CtsWifiTest Change-Id: I829a770b9a6ba2a3324d8d227d23e0ad2cdc0ac9 --- include/hardware_legacy/wifi_hal.h | 12 + include/hardware_legacy/wifi_nan.h | 501 +++++++++++++++++++++++++++++++++++-- 2 files changed, 492 insertions(+), 21 deletions(-) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 74cfcb9..22fa983 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -763,6 +763,18 @@ typedef struct { wifi_error (*wifi_nan_data_end)(transaction_id id, wifi_interface_handle iface, NanDataPathEndRequest *msg); + wifi_error (*wifi_nan_pairing_request)( + transaction_id id, wifi_interface_handle iface, + NanPairingRequest *msg); + wifi_error (*wifi_nan_pairing_indication_response)( + transaction_id id, wifi_interface_handle iface, + NanPairingIndicationResponse *msg); + wifi_error (*wifi_nan_bootstrapping_request)( + transaction_id id, wifi_interface_handle iface, + NanBootstrappingRequest *msg); + wifi_error (*wifi_nan_bootstrapping_indication_response)( + transaction_id id, wifi_interface_handle iface, + NanBootstrappingIndicationResponse *msg); wifi_error (*wifi_select_tx_power_scenario)(wifi_interface_handle iface, wifi_power_scenario scenario); wifi_error (*wifi_reset_tx_power_scenario)(wifi_interface_handle iface); diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index 8437a1d..bceb717 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -65,29 +65,36 @@ typedef u32 NanDataPathId; #define NAN_SECURITY_MIN_PASSPHRASE_LEN 8 #define NAN_SECURITY_MAX_PASSPHRASE_LEN 63 #define NAN_MAX_CHANNEL_INFO_SUPPORTED 4 - +#define NAN_IDENTITY_KEY_LEN 16 +#define NAN_IDENTITY_TAG_LEN 8 +#define NAN_IDENTITY_NONCE_LEN 8 +#define NAN_MAX_MATCH_IDENTITY_LEN 1024 /* Definition of various NanResponseType */ typedef enum { - NAN_RESPONSE_ENABLED = 0, - NAN_RESPONSE_DISABLED = 1, - NAN_RESPONSE_PUBLISH = 2, - NAN_RESPONSE_PUBLISH_CANCEL = 3, - NAN_RESPONSE_TRANSMIT_FOLLOWUP = 4, - NAN_RESPONSE_SUBSCRIBE = 5, - NAN_RESPONSE_SUBSCRIBE_CANCEL = 6, - NAN_RESPONSE_STATS = 7, - NAN_RESPONSE_CONFIG = 8, - NAN_RESPONSE_TCA = 9, - NAN_RESPONSE_ERROR = 10, - NAN_RESPONSE_BEACON_SDF_PAYLOAD = 11, - NAN_GET_CAPABILITIES = 12, - NAN_DP_INTERFACE_CREATE = 13, - NAN_DP_INTERFACE_DELETE = 14, - NAN_DP_INITIATOR_RESPONSE = 15, - NAN_DP_RESPONDER_RESPONSE = 16, - NAN_DP_END = 17 + NAN_RESPONSE_ENABLED = 0, + NAN_RESPONSE_DISABLED = 1, + NAN_RESPONSE_PUBLISH = 2, + NAN_RESPONSE_PUBLISH_CANCEL = 3, + NAN_RESPONSE_TRANSMIT_FOLLOWUP = 4, + NAN_RESPONSE_SUBSCRIBE = 5, + NAN_RESPONSE_SUBSCRIBE_CANCEL = 6, + NAN_RESPONSE_STATS = 7, + NAN_RESPONSE_CONFIG = 8, + NAN_RESPONSE_TCA = 9, + NAN_RESPONSE_ERROR = 10, + NAN_RESPONSE_BEACON_SDF_PAYLOAD = 11, + NAN_GET_CAPABILITIES = 12, + NAN_DP_INTERFACE_CREATE = 13, + NAN_DP_INTERFACE_DELETE = 14, + NAN_DP_INITIATOR_RESPONSE = 15, + NAN_DP_RESPONDER_RESPONSE = 16, + NAN_DP_END = 17, + NAN_PAIRING_INITIATOR_RESPONSE = 18, + NAN_PAIRING_RESPONDER_RESPONSE = 19, + NAN_BOOTSTRAPPING_INITIATOR_RESPONSE = 20, + NAN_BOOTSTRAPPING_RESPONDER_RESPONSE = 21 } NanResponseType; /* NAN Publish Types */ @@ -137,6 +144,18 @@ typedef enum { NAN_TCA_ID_CLUSTER_SIZE = 0 } NanTcaType; +/* pairing request type*/ +typedef enum { + NAN_PAIRING_SETUP = 0, + NAN_PAIRING_VERIFICATION = 1 +} NanPairingRequestType; + +/* AKM type */ +typedef enum { + SAE = 0, + PASN = 1 +} Akm; + /* NAN Channel Info */ typedef struct { u32 channel; @@ -173,7 +192,11 @@ typedef enum { /* If followup message internal queue is full */ NAN_STATUS_FOLLOWUP_QUEUE_FULL = 11, /* Unsupported concurrency session enabled, NAN disabled notified */ - NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12 + NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12, + /* if the pairing id is invalid */ + NAN_STATUS_INVALID_PAIRING_ID = 13, + /* if the bootstrapping id is invalid */ + NAN_STATUS_INVALID_BOOTSTRAPPING_ID = 14 } NanStatusType; /* NAN Transmit Types */ @@ -243,6 +266,18 @@ typedef enum { NAN_DP_REQUEST_REJECT } NanDataPathResponseCode; +/* Pairing request Responder's response */ +typedef enum { + NAN_PAIRING_REQUEST_ACCEPT = 0, + NAN_PAIRING_REQUEST_REJECT +} NanPairingResponseCode; + +/* Pairing bootstrapping Responder's response */ +typedef enum { + NAN_BOOTSTRAPPING_REQUEST_ACCEPT = 0, + NAN_BOOTSTRAPPING_REQUEST_REJECT = 1 +} NanBootstrappingResponseCode; + /* NAN DP channel config options */ typedef enum { NAN_DP_CHANNEL_NOT_REQUESTED = 0, @@ -311,6 +346,8 @@ typedef struct { #define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK 0x02 #define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_128_MASK 0x04 #define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_256_MASK 0x08 +#define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_128_MASK 0x10 +#define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_256_MASK 0x20 /* NAN ranging indication condition MASKS */ #define NAN_RANGING_INDICATE_CONTINUOUS_MASK 0x01 @@ -321,6 +358,19 @@ typedef struct { #define NAN_SCHEDULE_UPDATE_NSS_MASK 0x01 #define NAN_SCHEDULE_UPDATE_CHANNEL_MASK 0x02 +/* NAN pairing bootstrapping method */ +#define NAN_PAIRING_BOOTSTRAPPING_OPPORTUNISTIC_MASK 0x01 +#define NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK 0x02 +#define NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK 0x04 +#define NAN_PAIRING_BOOTSTRAPPING_QR_DISPLAY_MASK 0x08 +#define NAN_PAIRING_BOOTSTRAPPING_NFC_TAG_MASK 0x10 +#define NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK 0x20 +#define NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK 0x40 +#define NAN_PAIRING_BOOTSTRAPPING_QR_SCAN_MASK 0x80 +#define NAN_PAIRING_BOOTSTRAPPING_NFC_READER_MASK 0x100 +#define NAN_PAIRING_BOOTSTRAPPING_SERVICE_MANAGED_MASK 0x4000 +#define NAN_PAIRING_BOOTSTRAPPING_HANDSHAKE_SHIP_MASK 0x8000 + /* Structure to set the Service Descriptor Extension Attribute (SDEA) passed as part of NanPublishRequest/ @@ -392,6 +442,9 @@ typedef struct { u32 max_subscribe_address; u32 ndpe_attr_supported; bool is_instant_mode_supported; + bool is_6g_supported; + bool is_he_supported; + bool is_pairing_supported; } NanCapabilities; /* @@ -1056,6 +1109,32 @@ typedef struct { wifi_channel instant_mode_channel; } NanEnableRequest; +/* + NAN pairing config. +*/ +typedef struct { + + /* + Enable Nan pairing setup + */ + u32 enable_pairing_setup; + + /* + Enable cache NIK/NPK after Nan pairing setup + */ + u32 enable_pairing_cache; + + /* + Enable Nan pairing verification with cached NIK/NPK + */ + u32 enable_pairing_verification; + + /* + The set of supported bootstrapping methods. + */ + u16 supported_bootstrapping_methods; +} NanPairingConfig; + /* Publish Msg Structure Message is used to request the DE to publish the Service Name @@ -1187,6 +1266,17 @@ typedef struct { */ u16 sdea_service_specific_info_len; u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; + + /* + The Identity key for pairing, used to generate NIRA + */ + u8 nan_identity_key[NAN_IDENTITY_KEY_LEN]; + + /* + The config for Nan pairing + */ + NanPairingConfig nan_pairing_config; + } NanPublishRequest; /* @@ -1350,6 +1440,15 @@ typedef struct { */ u16 sdea_service_specific_info_len; u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; + /* + The Identity key for pairing, used to generate NIRA + */ + u8 nan_identity_key[NAN_IDENTITY_KEY_LEN]; + + /* + The config for Nan pairing + */ + NanPairingConfig nan_pairing_config; } NanSubscribeRequest; /* @@ -1814,6 +1913,24 @@ typedef struct { NanDataPathId ndp_instance_id; } NanDataPathRequestResponse; +/* Response returned for Initiators pairing request */ +typedef struct { + /* + Unique token Id generated on the initiator + side used for a pairing session between two NAN devices + */ + u32 paring_instance_id; +} NanPairingRequestResponse; + +/* Response returned for Initiators bootstrapping request */ +typedef struct { + /* + Unique token Id generated on the initiator + side used for a bootstrapping session between two NAN devices + */ + u32 bootstrapping_instance_id; +} NanBootstrappingRequestResponse; + /* NAN Response messages */ @@ -1827,6 +1944,8 @@ typedef struct { NanStatsResponse stats_response; NanDataPathRequestResponse data_request_response; NanCapabilities nan_capabilities; + NanPairingRequestResponse pairing_request_response; + NanBootstrappingRequestResponse bootstrapping_request_response; } body; } NanResponseMsg; @@ -1867,6 +1986,12 @@ typedef struct { char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ } NanPublishTerminatedInd; +/* The NIRA used to identify the pairing devices*/ +typedef struct { + u8 nonce[NAN_IDENTITY_NONCE_LEN]; + u8 tag[NAN_IDENTITY_TAG_LEN]; +} NanIdentityResolutionAttribute; + /* Match Indication The MatchInd message is sent once per responding MAC address whenever @@ -1990,6 +2115,16 @@ typedef struct { */ u16 sdea_service_specific_info_len; u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; + + /* + The config for Nan pairing set by the peer + */ + NanPairingConfig peer_pairing_config; + + /* + The NIRA from peer for Nan pairing verification + */ + NanIdentityResolutionAttribute nira; } NanMatchInd; /* @@ -2462,6 +2597,252 @@ typedef struct { u32 range_measurement_mm; } NanRangeReportInd; +/* + NAN pairing initator request +*/ +typedef struct { + /* + This Id is the Requestor Instance that is passed as + part of earlier MatchInd/FollowupInd message. + */ + u32 requestor_instance_id; + + /* + Discovery MAC addr of the publisher/peer + */ + u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; + + /* + Indicate the pairing session is of setup or verification + */ + NanPairingRequestType nan_pairing_request_type; + + /* + whether the pairing is opportunistic or password + */ + u8 is_opportunistic; + + /* + Security key info used for the pairing setup or verification + */ + NanSecurityKeyInfo key_info; + /* + AKM used for the pairing verification + */ + Akm akm; + + /* + Whether should cache the negotiated NIK/NPK for future verification + */ + u8 enable_pairing_cache; + + /* + The Identity key for pairing, can be used for pairing verification + */ + u8 nan_identity_key[NAN_IDENTITY_KEY_LEN]; + +} NanPairingRequest; + +/* + Data struct to initiate a pairing response on the responder side for an indication received with a + pairing request +*/ +typedef struct { + + /* + Unique token Id generated on the initiator/responder side + used for a pairing session between two NAN devices + */ + u32 pairing_instance_id; + + /* + Indicate the pairing session is setup or verification + */ + NanPairingRequestType nan_pairing_request_type; + + /* Response Code indicating ACCEPT/REJECT */ + NanPairingResponseCode rsp_code; + + /* + whether the pairing is opportunistic or password + */ + u8 is_opportunistic; + + /* + Security key info used for the pairing setup or verification + */ + NanSecurityKeyInfo key_info; + + /* + AKM used for the pairing verification + */ + Akm akm; + + /* + Whether should cache the negotiated NIK/NPK for future verification + */ + u8 enable_pairing_cache; + + /* + The Identity key for pairing, can be used for pairing verification + */ + u8 nan_identity_key[NAN_IDENTITY_KEY_LEN]; +} NanPairingIndicationResponse; + +/* + Event indication received on the responder side when a Nan pairing session is initiated on the + Initiator side +*/ +typedef struct { + /* Publish or Subscribe Id of an earlier Publish/Subscribe */ + u16 publish_subscribe_id; + /* + This Id is the Requestor Instance that is passed as + part of earlier MatchInd/FollowupInd message. + */ + u32 requestor_instance_id; + /* + Unique Instance Id corresponding to a service/session. + This is similar to the publish_id generated on the + publisher side + */ + u32 pairing_instance_id; + /* Discovery MAC addr of the peer/initiator */ + u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; + /* Indicate the pairing session is setup or verification */ + NanPairingRequestType nan_pairing_request_type; + /* Whether should cache the negotiated NIK/NPK for future verification */ + u8 enable_pairing_cache; + /* The NIRA from peer for Nan pairing verification */ + NanIdentityResolutionAttribute nira; +} NanPairingRequestInd; + +/* + The security info negotiate after the pairing setup for caching +*/ +typedef struct { + /* The inentity key of peer device*/ + u8 peer_nan_identity_key[NAN_IDENTITY_KEY_LEN]; + /* The inentity key of local device*/ + u8 local_nan_identity_key[NAN_IDENTITY_KEY_LEN]; + /* The PMK excahnge between two devices*/ + NanSecurityPmk npk; + /* The AKM used during the key exchange*/ + Akm akm; +} NpkSecurityAssociation; + +/* + Event indication of pairing confirm is received on both + initiator and responder side confirming a pairing session +*/ +typedef struct { + /* + Unique token Id generated on the initiator/responder side + used for a pairing session between two NAN devices + */ + u32 pairing_instance_id; + /* Response code indicating ACCEPT/REJECT */ + NanPairingResponseCode rsp_code; + /* + Reason code indicating the cause for REJECT. + NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are + expected reason codes. + */ + NanStatusType reason_code; + /* + Indicate the pairing session is setup or verification + */ + NanPairingRequestType nan_pairing_request_type; + /* Whether should cache the negotiated NIK/NPK for future verification */ + u8 enable_pairing_cache; + /* + The security association info negotiated in the pairing setup, used for future verification + */ + NpkSecurityAssociation npk_security_association; +} NanPairingConfirmInd; + +/* + NAN pairing bootstrapping initiator request +*/ +typedef struct { + /* + This Id is the Requestor Instance that is passed as + part of earlier MatchInd/FollowupInd message. + */ + u32 requestor_instance_id; + + /* + Discovery MAC addr of the publisher/peer + */ + u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; + + /* Proposed bootstrapping method */ + u16 request_bootstrapping_method; + +} NanBootstrappingRequest; +/* + NAN pairing bootstrapping response from responder to a initate request +*/ +typedef struct { + + /* + This Id is the Requestor Instance that is passed as + part of earlier MatchInd/FollowupInd message. + */ + u32 service_instance_id; + + + /* Response Code indicating ACCEPT/REJECT */ + NanBootstrappingResponseCode rsp_code; + +} NanBootstrappingIndicationResponse; + +/* + Event indication received on the responder side when a Nan boostrapping session is initiated on + the Initiator side +*/ +typedef struct { + /* Publish or Subscribe Id of an earlier Publish/Subscribe */ + u16 publish_subscribe_id; + /* + Unique Instance Id corresponding to a service/session. + This is similar to the publish_id generated on the + publisher side + */ + u32 bootstrapping_instance_id; + /* + This Id is the Requestor Instance that is passed as + part of earlier MatchInd/FollowupInd message. + */ + u32 requestor_instance_id; + /* Discovery MAC addr of the peer/initiator */ + u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; + /* Proposed bootstrapping method from peer*/ + u16 request_bootstrapping_method; + +} NanBootstrappingRequestInd; + +/* + Event indication of bootstapping confirm is received on both + initiator side confirming a bootstrapping method +*/ +typedef struct { + /* + Unique token Id generated on the initiator/responder side + used for a bootstrapping session between two NAN devices + */ + u32 bootstrapping_instance_id; + /* Response Code indicating ACCEPT/REJECT */ + NanBootstrappingResponseCode rsp_code; + /* + Reason code indicating the cause for REJECT. + NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are + expected reason codes. + */ + NanStatusType reason_code; + +} NanBootstrappingConfirmInd; + /* Response and Event Callbacks */ typedef struct { /* NotifyResponse invoked to notify the status of the Request */ @@ -2483,7 +2864,11 @@ typedef struct { void (*EventTransmitFollowup) (NanTransmitFollowupInd* event); void (*EventRangeRequest) (NanRangeRequestInd* event); void (*EventRangeReport) (NanRangeReportInd* event); - void (*EventScheduleUpdate)(NanDataPathScheduleUpdateInd* event); + void (*EventScheduleUpdate) (NanDataPathScheduleUpdateInd* event); + void (*EventPairingRequest) (NanPairingRequestInd* event); + void (*EventPairingConfirm) (NanPairingConfirmInd* event); + void (*EventBootstrappingRequest) (NanBootstrappingRequestInd* event); + void (*EventBootstrappingConfirm) (NanBootstrappingConfirmInd* event); } NanCallbackHandler; /**@brief nan_enable_request @@ -2789,6 +3174,80 @@ wifi_error nan_data_indication_response(transaction_id id, wifi_error nan_data_end(transaction_id id, wifi_interface_handle iface, NanDataPathEndRequest* msg); +/**@brief nan_pairing_request + * Initiate a NAN Pairingsession. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanPairingRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID + */ +wifi_error nan_pairing_request(transaction_id id, wifi_interface_handle iface, + NanPairingRequest* msg); + +/**@brief nan_pairing_indication_response + * Response to a pairing indication received + * corresponding to a pairing session. An indication + * is received with a pairing request and the responder + * will send a pairing response + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanPairingIndicationResponse: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INVALID_PAIRING_ID + */ +wifi_error nan_pairing_indication_response(transaction_id id, wifi_interface_handle iface, + NanPairingIndicationResponse* msg); + +/**@brief nan_bootstrapping_request + * Initiate a NAN Bootstrapping session. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanBootstrappingRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID + */ +wifi_error nan_bootstrapping_request(transaction_id id, wifi_interface_handle iface, + NanBootstrappingRequest* msg); + +/**@brief nan_bootstrapping_indication_response + * Response to a pairing indication received + * corresponding to a pairing session. An indication + * is received with a pairing request and the responder + * will send a pairing response + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanBootstrappingIndicationResponse: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INVALID_BOOTSTRAPPING_ID + */ +wifi_error nan_bootstrapping_indication_response(transaction_id id, wifi_interface_handle iface, + NanBootstrappingIndicationResponse* msg); + #ifdef __cplusplus } #endif /* __cplusplus */ -- cgit v1.2.3 From 832ef8ef71eeae787955ca9bc69e390713398b09 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Mon, 7 Nov 2022 23:13:03 -0800 Subject: wifi: Add multi link stats support to legacy HAL Multi-link operation (MLO) is considered a key feature in IEEE 802.11be, which allows devices to transmit and receive data using multiple links concurrently, thereby contributing to improving throughput and reducing latency. Currently HAL supports querying stats from single link. Add a callback to get stats from multiple links supported by the Wi-Fi chip. Also keep the callback to get single link layer stats as it is for backward compatibility. Multi link stats callback can be used for legacy case as well with single link. Bug: 246988155 Test: Builds successfully Change-Id: Iea2649b6868e9b153ae31e5c05457c324f5b4e98 --- include/hardware_legacy/link_layer_stats.h | 62 ++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/include/hardware_legacy/link_layer_stats.h b/include/hardware_legacy/link_layer_stats.h index bac84e1..24699a9 100644 --- a/include/hardware_legacy/link_layer_stats.h +++ b/include/hardware_legacy/link_layer_stats.h @@ -221,6 +221,53 @@ typedef struct { wifi_peer_info peer_info[]; // per peer statistics } wifi_iface_stat; +/* Per link statistics */ +typedef struct { + u8 link_id; // Identifier for the link. + u32 beacon_rx; // Beacon received count from connected AP on the link. + u64 average_tsf_offset; // Average beacon offset encountered (beacon_TSF - + // TBTT). The average_tsf_offset field is used so as + // to calculate the typical beacon contention time on + // the channel as well may be used to debug beacon + // synchronization and related power consumption + // issue. + u32 leaky_ap_detected; // Indicate that this AP on the link typically leaks + // packets beyond the driver guard time. + u32 leaky_ap_avg_num_frames_leaked; // Average number of frame leaked by AP + // in the link after frame with PM bit + // set was ACK'ed by AP. + u32 leaky_ap_guard_time; // Guard time currently in force (when implementing + // IEEE power management based on frame control PM + // bit), How long driver waits before shutting down + // the radio and after receiving an ACK for a data + // frame with PM bit set). + u32 mgmt_rx; // Management frames received count from connected AP on the + // link (including Beacon). + u32 mgmt_action_rx; // Action frames received count on the link. + u32 mgmt_action_tx; // Action frames transmit count on the link. + wifi_rssi rssi_mgmt; // Access Point Beacon and Management frames RSSI + // (averaged) on the link. + wifi_rssi rssi_data; // Access Point Data Frames RSSI (averaged) from + // connected AP on the link. + wifi_rssi rssi_ack; // Access Point ACK RSSI (averaged) from connected AP on + // the links. + wifi_wmm_ac_stat ac[WIFI_AC_MAX]; // Per AC data packet statistics for the + // link. + u8 time_slicing_duty_cycle_percent; // If this link is being served using + // time slicing on a radio with one or + // more links, then the duty cycle + // assigned to this link in %. + u32 num_peers; // Number of peers. + wifi_peer_info peer_info[]; // Peer statistics for the link. +} wifi_link_stat; + +/* Multi link stats for interface */ +typedef struct { + wifi_interface_handle iface; // Wifi interface. + wifi_interface_link_layer_info info; // Current state of the interface. + int num_links; // Number of links. + wifi_link_stat links[]; // Stats per link. +} wifi_iface_ml_stat; /* configuration params */ typedef struct { u32 mpdu_size_threshold; // threshold to classify the pkts as short or long @@ -234,10 +281,18 @@ typedef struct { Interface statistics (once started) reset and start afresh after each connection */ wifi_error wifi_set_link_stats(wifi_interface_handle iface, wifi_link_layer_params params); -/* callback for reporting link layer stats */ +/* Callbacks for reporting link layer stats. Only one of the callbacks needs to + * be called. */ typedef struct { - void (*on_link_stats_results) (wifi_request_id id, wifi_iface_stat *iface_stat, - int num_radios, wifi_radio_stat *radio_stat); + /* Legacy: Single iface/link stats. */ + void (*on_link_stats_results)(wifi_request_id id, + wifi_iface_stat *iface_stat, int num_radios, + wifi_radio_stat *radio_stat); + /* Multi link stats. */ + void (*on_multi_link_stats_results)(wifi_request_id id, + wifi_iface_ml_stat *iface_ml_stat, + int num_radios, + wifi_radio_stat *radio_stat); } wifi_stats_result_handler; /* api to collect the link layer statistics for a given iface and all the radio stats */ @@ -266,4 +321,3 @@ wifi_error wifi_clear_link_stats(wifi_interface_handle iface, #endif /* __cplusplus */ #endif /*__WIFI_HAL_STATS_ */ - -- cgit v1.2.3 From d937de94dd6b3e1df8455f7f179360041b64f626 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Tue, 6 Dec 2022 20:47:30 -0800 Subject: wifi: Add radio_id and frequency to link layer stats These two new parameters helps to find the mapping between link layer stats, radio stat and channel info. Bug: 258013268 Test: Builds successfully Change-Id: I6bec665b581020c8b27ed2685c684d5ef8bf4107 --- include/hardware_legacy/link_layer_stats.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/hardware_legacy/link_layer_stats.h b/include/hardware_legacy/link_layer_stats.h index 24699a9..3b418cb 100644 --- a/include/hardware_legacy/link_layer_stats.h +++ b/include/hardware_legacy/link_layer_stats.h @@ -223,8 +223,10 @@ typedef struct { /* Per link statistics */ typedef struct { - u8 link_id; // Identifier for the link. - u32 beacon_rx; // Beacon received count from connected AP on the link. + u8 link_id; // Identifier for the link. + wifi_radio radio; // Radio on which link stats are sampled. + u32 frequency; // Frequency on which link is operating. + u32 beacon_rx; // Beacon received count from connected AP on the link. u64 average_tsf_offset; // Average beacon offset encountered (beacon_TSF - // TBTT). The average_tsf_offset field is used so as // to calculate the typical beacon contention time on -- cgit v1.2.3 From 6fb46c645eb14fe1aca90a64e365b1fcb027b4ee Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Thu, 10 Nov 2022 18:36:00 +0000 Subject: Add frequency/Bandwidth to RttResults Added frequency and RTT packet bandwidth in rtt results data structure. Also added new rtt result callback function. The newer vendor implementations which supports sending frequency and bandwidth should call rtt result callback version 2. Bug: 222186547 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Test: RTT test using wifi rtt scan app from playstore. Change-Id: I3265baa477b73cddaff49cd4d9ee88692878365c --- include/hardware_legacy/rtt.h | 32 ++++++++++++++++++++++++-------- include/hardware_legacy/wifi_hal.h | 1 + 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/include/hardware_legacy/rtt.h b/include/hardware_legacy/rtt.h index 4ef7770..ce17443 100644 --- a/include/hardware_legacy/rtt.h +++ b/include/hardware_legacy/rtt.h @@ -38,13 +38,14 @@ typedef enum { /* RTT Measurement Bandwidth */ typedef enum { - WIFI_RTT_BW_5 = 0x01, - WIFI_RTT_BW_10 = 0x02, - WIFI_RTT_BW_20 = 0x04, - WIFI_RTT_BW_40 = 0x08, - WIFI_RTT_BW_80 = 0x10, - WIFI_RTT_BW_160 = 0x20, - WIFI_RTT_BW_320 = 0x40 + WIFI_RTT_BW_UNSPECIFIED = 0x00, + WIFI_RTT_BW_5 = 0x01, + WIFI_RTT_BW_10 = 0x02, + WIFI_RTT_BW_20 = 0x04, + WIFI_RTT_BW_40 = 0x08, + WIFI_RTT_BW_80 = 0x10, + WIFI_RTT_BW_160 = 0x20, + WIFI_RTT_BW_320 = 0x40 } wifi_rtt_bw; /* RTT Measurement Preamble */ @@ -150,9 +151,24 @@ typedef struct { wifi_information_element *LCR; // for 11mc only } wifi_rtt_result; -/* RTT result callback */ +/* RTT results version 2 */ typedef struct { + wifi_rtt_result rtt_result; // Legacy wifi rtt result structure + wifi_channel frequency; // primary channel frequency (MHz) used for ranging measurements + // If frequency is unknown, this will be set to |UNSPECIFIED(-1)| + wifi_rtt_bw packet_bw; // RTT packet bandwidth is an average BW of the BWs of RTT frames. + // Cap the average close to a specific valid RttBw. +} wifi_rtt_result_v2; + +/* RTT result callbacks */ +typedef struct { + /* + * This callback is deprecated on Android 14 and onwards. + * Newer implementations should support on_rtt_results_v2 callback + */ void (*on_rtt_results) (wifi_request_id id, unsigned num_results, wifi_rtt_result *rtt_result[]); + /* Called when vendor implementation supports sending RTT results version 2 */ + void (*on_rtt_results_v2) (wifi_request_id id, unsigned num_results, wifi_rtt_result_v2 *rtt_result_v2[]); } wifi_rtt_event_handler; /* API to request RTT measurement */ diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 7cd17af..011694f 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -24,6 +24,7 @@ extern "C" #include #define IFNAMSIZ 16 +#define UNSPECIFIED -1 // wifi HAL common definition for unspecified value /* typedefs */ typedef unsigned char byte; -- cgit v1.2.3 From 267d9197b8a97de4dfb9a435b565ab4bec6ae42e Mon Sep 17 00:00:00 2001 From: Sherri Lin Date: Thu, 29 Dec 2022 19:44:28 +0100 Subject: [Aware] Add paramters in NanConfigRequest to support setting cluster id Bug: 262872131 Test: build Change-Id: I55a588eb03d44236efff9bdd00c7e861bb090b66 --- include/hardware_legacy/wifi_nan.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index bceb717..35feebd 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -445,6 +445,7 @@ typedef struct { bool is_6g_supported; bool is_he_supported; bool is_pairing_supported; + bool is_set_cluster_id_supported; } NanCapabilities; /* @@ -1656,6 +1657,11 @@ typedef struct { */ u8 config_instant_mode_channel; wifi_channel instant_mode_channel; + /* + Config cluster ID with the cluster ID selected over NFC/OOB method. + */ + u8 config_cluster_id; + u16 cluster_id_val; // default value 0x0 } NanConfigRequest; /* -- cgit v1.2.3 From 38ea4fc71787d10e4ce26aee788b90885524162e Mon Sep 17 00:00:00 2001 From: Shuibing Dai Date: Wed, 4 Jan 2023 16:49:34 -0800 Subject: Add a new function in wifi_hal_fn table for wifi indoor/dfs channel usage Vendor can enable/disable STA-connected indoor or DFS channels for WFA Go, SAP and Wi-Fi Aware. Bug: 207669954 Test: m android.hardware.wifi-update-api Change-Id: Ifc6646b01b0fec082ee8f92ba483f0d4102610df --- include/hardware_legacy/wifi_hal.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index efb1d77..ab24f90 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -234,6 +234,12 @@ typedef enum { WIFI_ACCESS_CATEGORY_VOICE = 3 } wifi_access_category; +/* Channel category mask */ +typedef enum { + WIFI_INDOOR_CHANNEL = 1 << 0, + WIFI_DFS_CHANNEL = 1 << 1, +} wifi_channel_category; + /* Antenna configuration */ typedef enum { WIFI_ANTENNA_UNSPECIFIED = 0, @@ -1182,6 +1188,16 @@ typedef struct { wifi_error (*wifi_get_supported_iface_concurrency_matrix)( wifi_handle handle, wifi_iface_concurrency_matrix *matrix); + /**@brief wifi_enable_sta_channel_for_peer_network + * enable or disable the feature of allowing current STA-connected + * channel for WFA GO, SAP and Wi-Fi Aware when the regulatory allows. + * @param handle global wifi_handle + * @param channelCategoryEnableFlag bitmask of |wifi_channel_category|. + * @return Synchronous wifi_error + */ + wifi_error (*wifi_enable_sta_channel_for_peer_network)( + wifi_handle handle, u32 channelCategoryEnableFlag); + /* * when adding new functions make sure to add stubs in * hal_tool.cpp::init_wifi_stub_hal_func_table -- cgit v1.2.3 From 0a60d071599ddaf7345b58a06f78bbb2dd152488 Mon Sep 17 00:00:00 2001 From: Sujit Kautkar Date: Mon, 9 Jan 2023 20:59:09 +0000 Subject: Revert "[Aware] Add paramters in NanConfigRequest to support set..." Revert submission 20813956-issue-262873111-API-set-clusterId-newAPI Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=oriole-userdebug&lkgb=9469876&lkbb=9470237&fkbb=9469914, bug b/264915970 Reverted changes: /q/submissionid:20813956-issue-262873111-API-set-clusterId-newAPI Bug: 264915970 Change-Id: I59be92a57e6c6086b9a652bf19adf4391fc4d2d8 --- include/hardware_legacy/wifi_nan.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index 35feebd..bceb717 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -445,7 +445,6 @@ typedef struct { bool is_6g_supported; bool is_he_supported; bool is_pairing_supported; - bool is_set_cluster_id_supported; } NanCapabilities; /* @@ -1657,11 +1656,6 @@ typedef struct { */ u8 config_instant_mode_channel; wifi_channel instant_mode_channel; - /* - Config cluster ID with the cluster ID selected over NFC/OOB method. - */ - u8 config_cluster_id; - u16 cluster_id_val; // default value 0x0 } NanConfigRequest; /* -- cgit v1.2.3 From 584f074153b21619aec93d47e36d3910c04da028 Mon Sep 17 00:00:00 2001 From: Biswarup Pal Date: Mon, 9 Jan 2023 21:21:07 +0000 Subject: Revert "Revert "[Aware] Add paramters in NanConfigRequest to sup..." Revert submission 20917465-revert-20813956-issue-262873111-API-set-clusterId-newAPI-FRIOZCUQWG Reverted changes: /q/submissionid:20917465-revert-20813956-issue-262873111-API-set-clusterId-newAPI-FRIOZCUQWG Change-Id: I71fd896e76e996a01a7c50237a9777f33bc11367 --- include/hardware_legacy/wifi_nan.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index bceb717..35feebd 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -445,6 +445,7 @@ typedef struct { bool is_6g_supported; bool is_he_supported; bool is_pairing_supported; + bool is_set_cluster_id_supported; } NanCapabilities; /* @@ -1656,6 +1657,11 @@ typedef struct { */ u8 config_instant_mode_channel; wifi_channel instant_mode_channel; + /* + Config cluster ID with the cluster ID selected over NFC/OOB method. + */ + u8 config_cluster_id; + u16 cluster_id_val; // default value 0x0 } NanConfigRequest; /* -- cgit v1.2.3 From 2ebbe247b0607f59f1e10e641a03bfcab2ceb95f Mon Sep 17 00:00:00 2001 From: Biswarup Pal Date: Tue, 20 Dec 2022 18:06:09 +0000 Subject: Add NAN suspension flag to NanCapabilities HAL Test: m Bug: 262872127 Change-Id: I1c59200af16f31cd801d06e15eb3a9f64664aa73 --- include/hardware_legacy/wifi_nan.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index 35feebd..fc22304 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -446,6 +446,7 @@ typedef struct { bool is_he_supported; bool is_pairing_supported; bool is_set_cluster_id_supported; + bool is_suspension_supported; } NanCapabilities; /* -- cgit v1.2.3 From b3d0989c55c1dadc37fd00b93ad112726edce9cf Mon Sep 17 00:00:00 2001 From: Biswarup Pal Date: Mon, 9 Jan 2023 14:12:13 +0000 Subject: Add suspendable option in NanPublishRequest and NanSubscribeRequest Test: m Bug: 263014869 Change-Id: I71f28b36be13befaf4d7f85dfab369593bc8e61d --- include/hardware_legacy/wifi_nan.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index fc22304..9be1140 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -1279,6 +1279,12 @@ typedef struct { */ NanPairingConfig nan_pairing_config; + /* + Specifies whether suspension can be possible in this publish session. + The request would fail if enable_suspendability is true but + is_suspension_supported is false in NanCapabilities. + */ + bool enable_suspendability; } NanPublishRequest; /* @@ -1451,6 +1457,13 @@ typedef struct { The config for Nan pairing */ NanPairingConfig nan_pairing_config; + + /* + Specifies whether suspension can be possible in this subscribe session. + The request would fail if enable_suspendability is true but + is_suspension_supported is false in NanCapabilities. + */ + bool enable_suspendability; } NanSubscribeRequest; /* -- cgit v1.2.3 From 4f30a1732283acc8f3a5ba433814428d93bfdc59 Mon Sep 17 00:00:00 2001 From: Phill Hayers Date: Mon, 9 Jan 2023 15:56:40 +0000 Subject: Add a new function in wifi_hal_fn table for suspend/resume. Bug: 259950106 Test: m android.hardware.wifi-update-api Change-Id: I6d9b8baef13f07a684d5486576c3298be1e5e482 --- include/hardware_legacy/wifi_hal.h | 20 ++++++++++++++++++++ include/hardware_legacy/wifi_nan.h | 17 +++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index ab24f90..f48492c 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -1198,6 +1198,26 @@ typedef struct { wifi_error (*wifi_enable_sta_channel_for_peer_network)( wifi_handle handle, u32 channelCategoryEnableFlag); + /**@brief wifi_nan_suspend_request + * Request that the specified NAN session be suspended. + * @param transaction_id: NAN transaction id + * @param wifi_interface_handle + * @param NanSuspendRequest request message + * @return Synchronous wifi_error + */ + wifi_error (*wifi_nan_suspend_request)(transaction_id id, wifi_interface_handle iface, + NanSuspendRequest *msg); + + /**@brief wifi_nan_resume_request + * Request that the specified NAN session be resumed. + * @param transaction_id: NAN transaction id + * @param wifi_interface_handle + * @param NanResumeRequest request message + * @return Synchronous wifi_error + */ + wifi_error (*wifi_nan_resume_request)(transaction_id id, wifi_interface_handle iface, + NanResumeRequest *msg); + /* * when adding new functions make sure to add stubs in * hal_tool.cpp::init_wifi_stub_hal_func_table diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index fc22304..3687bb3 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -1508,6 +1508,23 @@ typedef struct { u8 clear; /* 0= Do not clear the stats and return the current contents , 1= Clear the associated stats */ } NanStatsRequest; +/* + Suspend Request Structure + The SuspendRequest message is used to request that the specified session is suspended. + The session can be resumed using the NanResumeRequest message. +*/ +typedef struct { + u16 publish_subscribe_id; +} NanSuspendRequest; + +/* + Resume Request Structure + The ResumeRequest message is used to request that the specified session is resumed. +*/ +typedef struct { + u16 publish_subscribe_id; +} NanResumeRequest; + /* Config Structure The NanConfigurationReq message is sent by the Host to the -- cgit v1.2.3 From 36cff5cd7da8f56e065f938e326ee3342d66e584 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Wed, 25 Jan 2023 14:52:20 -0800 Subject: Move the newly added method to the end of the function table This can avoid pointer mismatch due to HIDL is using a cached version of the legacy HAL. Bug: 265396931 Test: build and wifi connection Change-Id: Id56c4b315cbd84f8ba69f7d7e12b3d07e656defb --- include/hardware_legacy/wifi_hal.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index f48492c..c0763f2 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -870,18 +870,6 @@ typedef struct { wifi_error (*wifi_nan_data_end)(transaction_id id, wifi_interface_handle iface, NanDataPathEndRequest *msg); - wifi_error (*wifi_nan_pairing_request)( - transaction_id id, wifi_interface_handle iface, - NanPairingRequest *msg); - wifi_error (*wifi_nan_pairing_indication_response)( - transaction_id id, wifi_interface_handle iface, - NanPairingIndicationResponse *msg); - wifi_error (*wifi_nan_bootstrapping_request)( - transaction_id id, wifi_interface_handle iface, - NanBootstrappingRequest *msg); - wifi_error (*wifi_nan_bootstrapping_indication_response)( - transaction_id id, wifi_interface_handle iface, - NanBootstrappingIndicationResponse *msg); wifi_error (*wifi_select_tx_power_scenario)(wifi_interface_handle iface, wifi_power_scenario scenario); wifi_error (*wifi_reset_tx_power_scenario)(wifi_interface_handle iface); @@ -1218,9 +1206,22 @@ typedef struct { wifi_error (*wifi_nan_resume_request)(transaction_id id, wifi_interface_handle iface, NanResumeRequest *msg); + wifi_error (*wifi_nan_pairing_request)( + transaction_id id, wifi_interface_handle iface, + NanPairingRequest *msg); + wifi_error (*wifi_nan_pairing_indication_response)( + transaction_id id, wifi_interface_handle iface, + NanPairingIndicationResponse *msg); + wifi_error (*wifi_nan_bootstrapping_request)( + transaction_id id, wifi_interface_handle iface, + NanBootstrappingRequest *msg); + wifi_error (*wifi_nan_bootstrapping_indication_response)( + transaction_id id, wifi_interface_handle iface, + NanBootstrappingIndicationResponse *msg); + /* * when adding new functions make sure to add stubs in - * hal_tool.cpp::init_wifi_stub_hal_func_table + * wifi_legacy_hal_stubs.cpp::initHalFuncTableWithStubs */ } wifi_hal_fn; -- cgit v1.2.3 From 282246a8ad1ea25253b4abeaaa9ef1f6cf9e5440 Mon Sep 17 00:00:00 2001 From: Ye Jiao Date: Tue, 17 Jan 2023 15:10:59 +0800 Subject: Move setScanMode to legacy HAL Cherry-pick from: https://partner-android-review.git.corp.google.com/c/platform/hardware/libhardware_legacy/+/2368871 Implementation of setScanMode is platform-specific. It's more reasonable to move it the legacy HAL like other platform-specific APIs. Bug: 265866990 Test: manual Test Test: VTS Change-Id: I2e9d30698a8bcb915a746f6253ec3b6e6d903bc0 --- include/hardware_legacy/wifi_hal.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index c0763f2..adf2f88 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -1219,6 +1219,14 @@ typedef struct { transaction_id id, wifi_interface_handle iface, NanBootstrappingIndicationResponse *msg); + /**@brief wifi_set_scan_mode + * Notify driver/firmware current is scan only mode to allow lower + * level to optimize power consumption. + * @param enable true if current is scan only mode + * @return Synchronous wifi_error + */ + wifi_error (*wifi_set_scan_mode)(const char * ifname, bool enable); + /* * when adding new functions make sure to add stubs in * wifi_legacy_hal_stubs.cpp::initHalFuncTableWithStubs -- cgit v1.2.3 From 55f43fb91ee8e0395a48105d0219c2bba1bf037a Mon Sep 17 00:00:00 2001 From: Oscar Shu Date: Fri, 27 Jan 2023 21:54:14 +0000 Subject: Legacy wifi feature flag for AFC channel allowance Bug: 242917176 Test: compile Change-Id: Ida30239103d751eb4c7ce5bf96e8068a92a77247 --- include/hardware_legacy/wifi_hal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index adf2f88..efe5ed8 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -454,6 +454,7 @@ void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer #define WIFI_FEATURE_SET_LATENCY_MODE (uint64_t)0x40000000 // Support Latency mode setting #define WIFI_FEATURE_P2P_RAND_MAC (uint64_t)0x80000000 // Support P2P MAC randomization #define WIFI_FEATURE_INFRA_60G (uint64_t)0x100000000 // Support for 60GHz Band +#define WIFI_FEATURE_AFC_CHANNEL (uint64_t)0x200000000 // Support for setting 6GHz AFC channel allowance // Add more features here #define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask)) -- cgit v1.2.3 From cd75a54c4ab96de930e78bab89bb2d7833aabc80 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Sun, 5 Feb 2023 20:29:38 -0800 Subject: Rename max_mlo_link_count to max_mlo_str_link_count The maximum number of Simultaneous Transmit Receive (STR) links used in Multi-Link Operation can be different from the maximum radios supported by the chip.Explicitly mention the max links as max STR links. Update the description and usage of the capability field. Bug: 267963579 Test: build and wifi connection Change-Id: Ic12055a4a340aeff15382e198a76328431f9def6 --- include/hardware_legacy/wifi_hal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index efe5ed8..494d653 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -287,13 +287,13 @@ typedef struct { typedef struct { /** - * Maximum number of links used in Multi-Link Operation. The maximum - * number of links used for MLO can be different from the number of - * radios supported by the chip. + * Maximum number of Simultaneous Transmit and Receive (STR) links used + * in Multi-Link Operation. The maximum number of STR links used can be + * different from the maximum number of radios supported by the chip. * * This is a static configuration of the chip. */ - u32 max_mlo_link_count; + u32 max_mlo_str_link_count; /** * Maximum number of concurrent TDLS sessions supported by the chip. * -- cgit v1.2.3 From ef9956a53bfed99aca98b3a86ea8344473059dff Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Tue, 7 Feb 2023 17:01:42 -0800 Subject: Add link state for link layer stats Bug: 263029630 Test: Build successfully Change-Id: I31a7ab0893fc8168d16a68631f5e06d4170ef71d --- include/hardware_legacy/link_layer_stats.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/hardware_legacy/link_layer_stats.h b/include/hardware_legacy/link_layer_stats.h index 3b418cb..f4e16c6 100644 --- a/include/hardware_legacy/link_layer_stats.h +++ b/include/hardware_legacy/link_layer_stats.h @@ -221,9 +221,26 @@ typedef struct { wifi_peer_info peer_info[]; // per peer statistics } wifi_iface_stat; +/* Various states for the link */ +typedef enum { + // Chip does not support reporting the state of the link. + WIFI_LINK_STATE_UNKNOWN = 0, + // Link has not been in use since last report. It is placed in power save. All + // management, control and data frames for the MLO connection are carried over + // other links. In this state the link will not listen to beacons even in DTIM + // period and does not perform any GTK/IGTK/BIGTK updates but remains + // associated. + WIFI_LINK_STATE_NOT_IN_USE = 1, + // Link is in use. In presence of traffic, it is set to be power active. When + // the traffic stops, the link will go into power save mode and will listen + // for beacons every DTIM period. + WIFI_LINK_STATE_IN_USE = 2, +} wifi_link_state; + /* Per link statistics */ typedef struct { u8 link_id; // Identifier for the link. + wifi_link_state state; // State for the link. wifi_radio radio; // Radio on which link stats are sampled. u32 frequency; // Frequency on which link is operating. u32 beacon_rx; // Beacon received count from connected AP on the link. -- cgit v1.2.3 From b505efe7ffcc8afab79bb72df0d1cdc158b12ee6 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Fri, 10 Feb 2023 14:43:18 -0800 Subject: Modify based on the vendor feedback - Add end pairing request method - Handle bootstrapping comeback event - Add cipher type in the pairing request - Remame AKM to NAN specific Bug: 265075699 Test: cts sinlgeDeviceTest Change-Id: Ic55370873ba8d938ea32f63b3e69253ee47bd969 --- include/hardware_legacy/wifi_hal.h | 4 +++ include/hardware_legacy/wifi_nan.h | 67 ++++++++++++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 494d653..17bc376 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -1228,6 +1228,10 @@ typedef struct { */ wifi_error (*wifi_set_scan_mode)(const char * ifname, bool enable); + wifi_error (*wifi_nan_pairing_end)(transaction_id id, + wifi_interface_handle iface, + NanPairingEndRequest *msg); + /* * when adding new functions make sure to add stubs in * wifi_legacy_hal_stubs.cpp::initHalFuncTableWithStubs diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index 9c7397c..e0b93d8 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -94,7 +94,8 @@ typedef enum { NAN_PAIRING_INITIATOR_RESPONSE = 18, NAN_PAIRING_RESPONDER_RESPONSE = 19, NAN_BOOTSTRAPPING_INITIATOR_RESPONSE = 20, - NAN_BOOTSTRAPPING_RESPONDER_RESPONSE = 21 + NAN_BOOTSTRAPPING_RESPONDER_RESPONSE = 21, + NAN_PAIRING_END = 22 } NanResponseType; /* NAN Publish Types */ @@ -150,11 +151,11 @@ typedef enum { NAN_PAIRING_VERIFICATION = 1 } NanPairingRequestType; -/* AKM type */ +/* Nan AKM type */ typedef enum { SAE = 0, PASN = 1 -} Akm; +} NanAkm; /* NAN Channel Info */ typedef struct { @@ -275,7 +276,8 @@ typedef enum { /* Pairing bootstrapping Responder's response */ typedef enum { NAN_BOOTSTRAPPING_REQUEST_ACCEPT = 0, - NAN_BOOTSTRAPPING_REQUEST_REJECT = 1 + NAN_BOOTSTRAPPING_REQUEST_REJECT = 1, + NAN_BOOTSTRAPPING_REQUEST_COMEBACK = 2 } NanBootstrappingResponseCode; /* NAN DP channel config options */ @@ -2666,7 +2668,7 @@ typedef struct { /* AKM used for the pairing verification */ - Akm akm; + NanAkm akm; /* Whether should cache the negotiated NIK/NPK for future verification @@ -2678,6 +2680,11 @@ typedef struct { */ u8 nan_identity_key[NAN_IDENTITY_KEY_LEN]; + /* + NAN Cipher Suite Type + */ + u32 cipher_type; + } NanPairingRequest; /* @@ -2713,7 +2720,7 @@ typedef struct { /* AKM used for the pairing verification */ - Akm akm; + NanAkm akm; /* Whether should cache the negotiated NIK/NPK for future verification @@ -2724,8 +2731,21 @@ typedef struct { The Identity key for pairing, can be used for pairing verification */ u8 nan_identity_key[NAN_IDENTITY_KEY_LEN]; + + /* + NAN Cipher Suite Type + */ + u32 cipher_type; } NanPairingIndicationResponse; +typedef struct { + /* + Unique token Id generated on the initiator/responder side + used for a pairing session between two NAN devices + */ + u32 pairing_instance_id; +} NanPairingEndRequest; + /* Event indication received on the responder side when a Nan pairing session is initiated on the Initiator side @@ -2765,7 +2785,9 @@ typedef struct { /* The PMK excahnge between two devices*/ NanSecurityPmk npk; /* The AKM used during the key exchange*/ - Akm akm; + NanAkm akm; + /* NAN Cipher Suite Type */ + u32 cipher_type; } NpkSecurityAssociation; /* @@ -2816,6 +2838,12 @@ typedef struct { /* Proposed bootstrapping method */ u16 request_bootstrapping_method; + /* The length of cookie. */ + u32 cookie_length; + + /* Cookie for the follow up request */ + u8 cookie[]; + } NanBootstrappingRequest; /* NAN pairing bootstrapping response from responder to a initate request @@ -2877,6 +2905,14 @@ typedef struct { expected reason codes. */ NanStatusType reason_code; + /* The delay of bootstrapping in seconds */ + u32 come_back_delay; + + /* The length of cookie. */ + u32 cookie_length; + + /* Cookie received from the comeback response */ + u8 cookie[]; } NanBootstrappingConfirmInd; @@ -3248,6 +3284,23 @@ wifi_error nan_pairing_request(transaction_id id, wifi_interface_handle iface, wifi_error nan_pairing_indication_response(transaction_id id, wifi_interface_handle iface, NanPairingIndicationResponse* msg); +/**@brief nan_pairing_end + * Cancel and remove the existing Pairing setups + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanPairingEndRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INVALID_PAIRING_ID + */ +wifi_error nan_pairing_end(transaction_id id, wifi_interface_handle iface, + NanPairingEndRequest* msg); + /**@brief nan_bootstrapping_request * Initiate a NAN Bootstrapping session. * -- cgit v1.2.3 From f716fa48a84c2fb7cfffb0a4c59e732903e8df4b Mon Sep 17 00:00:00 2001 From: maheshkkv Date: Mon, 13 Feb 2023 22:57:31 -0800 Subject: Add TID-To-Link mapping negotiation feature Bug: 268219346 Test: Build successfully Change-Id: I7b875e7fd0583ae4b4d48a284cf30af6602f9511 --- include/hardware_legacy/wifi_hal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 494d653..970a183 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -455,6 +455,7 @@ void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer #define WIFI_FEATURE_P2P_RAND_MAC (uint64_t)0x80000000 // Support P2P MAC randomization #define WIFI_FEATURE_INFRA_60G (uint64_t)0x100000000 // Support for 60GHz Band #define WIFI_FEATURE_AFC_CHANNEL (uint64_t)0x200000000 // Support for setting 6GHz AFC channel allowance +#define WIFI_FEATURE_T2LM_NEGO (uint64_t)0x400000000 // Support for TID-To-Link mapping negotiation // Add more features here #define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask)) -- cgit v1.2.3 From 3c54751d17d8dbf5c7a926b6ac84451bf425446e Mon Sep 17 00:00:00 2001 From: maheshkkv Date: Tue, 14 Feb 2023 13:49:27 -0800 Subject: Add maximum association link count Maximum MLO association link count can be an input for MLO scoring logic. If the candidate AP has less number of links to associate, scroring logic can give a weightage to an AP with matching links as station Assumption here is when the environment becomes better, the AP with less score now can be a better choice. Bug: 269336948 Test: Build successfully Change-Id: I1fe60f68fb99b0cb00a851981cbe45cde74457e1 --- include/hardware_legacy/wifi_hal.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 494d653..5532328 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -286,6 +286,10 @@ typedef struct { } wifi_radio_combination_matrix; typedef struct { + /** + * Maximum number of links supported by the chip for MLO association. + */ + u32 max_mlo_association_link_count; /** * Maximum number of Simultaneous Transmit and Receive (STR) links used * in Multi-Link Operation. The maximum number of STR links used can be -- cgit v1.2.3 From 1e1b31581d0ef7afa4cfdb9a9d9f5d3b6c1732ec Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Tue, 14 Feb 2023 16:35:22 -0800 Subject: Modify HAL for Aware suspension mode - Add an event to know the device is suspended - More status code - Add pub_sub_id in the datapath request to build the relationship Bug: 247913151 Test: build Change-Id: I1ce107aa9abe1f31b738a382faecb8503cf09816 --- include/hardware_legacy/wifi_nan.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index e0b93d8..d8c6824 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -95,7 +95,9 @@ typedef enum { NAN_PAIRING_RESPONDER_RESPONSE = 19, NAN_BOOTSTRAPPING_INITIATOR_RESPONSE = 20, NAN_BOOTSTRAPPING_RESPONDER_RESPONSE = 21, - NAN_PAIRING_END = 22 + NAN_PAIRING_END = 22, + NAN_SUSPEND_REQUEST_RESPONSE = 23, + NAN_RESUME_REQUEST_RESPONSE = 24 } NanResponseType; /* NAN Publish Types */ @@ -197,7 +199,13 @@ typedef enum { /* if the pairing id is invalid */ NAN_STATUS_INVALID_PAIRING_ID = 13, /* if the bootstrapping id is invalid */ - NAN_STATUS_INVALID_BOOTSTRAPPING_ID = 14 + NAN_STATUS_INVALID_BOOTSTRAPPING_ID = 14, + /* If same request is received again */ + NAN_STATUS_REDUNDANT_REQUEST = 15, + /* If current request is not supported */ + NAN_STATUS_NOT_SUPPORTED = 16, + /* If no Wifi Aware connection is active */ + NAN_STATUS_NO_CONNECTION = 17, } NanStatusType; /* NAN Transmit Types */ @@ -2433,6 +2441,9 @@ typedef struct { for setting up the Secure Data Path. */ u8 scid[NAN_MAX_SCID_BUF_LEN]; + + /* Publish or Subscribe Id of an earlier Publish/Subscribe */ + u16 publish_subscribe_id; } NanDataPathInitiatorRequest; /* @@ -2485,6 +2496,9 @@ typedef struct { for setting up the Secure Data Path. */ u8 scid[NAN_MAX_SCID_BUF_LEN]; + + /* Publish or Subscribe Id of an earlier Publish/Subscribe */ + u16 publish_subscribe_id; } NanDataPathIndicationResponse; /* NDP termination info */ @@ -2916,6 +2930,14 @@ typedef struct { } NanBootstrappingConfirmInd; +/* + Event indication the device enter or exist the suspension mode +*/ +typedef struct { + /* Indication the device is suspended or not */ + bool is_suspended; +} NanSuspensionModeChangeInd; + /* Response and Event Callbacks */ typedef struct { /* NotifyResponse invoked to notify the status of the Request */ @@ -2942,6 +2964,7 @@ typedef struct { void (*EventPairingConfirm) (NanPairingConfirmInd* event); void (*EventBootstrappingRequest) (NanBootstrappingRequestInd* event); void (*EventBootstrappingConfirm) (NanBootstrappingConfirmInd* event); + void (*EventSuspensionModeChange) (NanSuspensionModeChangeInd* event); } NanCallbackHandler; /**@brief nan_enable_request -- cgit v1.2.3 From da7fe36ab51aef50268e0f3fbe4fe0489113aa8d Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Wed, 8 Feb 2023 09:39:21 -0800 Subject: Add wifi hal API for Multi-Link Operation mode Bug: 268235139 Test: Build successfully Change-Id: Ia103ecc2b5cad29520c7b4235ccc051629561fdc --- include/hardware_legacy/wifi_hal.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 17bc376..9030129 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -65,6 +65,14 @@ typedef enum { WIFI_CHAN_WIDTH_INVALID = -1 } wifi_channel_width; +/* Multi-Link Operation modes */ +typedef enum { + WIFI_MLO_MODE_DEFAULT = 0, + WIFI_MLO_MODE_LOW_LATENCY = 1, + WIFI_MLO_MODE_HIGH_THROUGHPUT = 2, + WIFI_MLO_MODE_LOW_POWER = 3, +} wifi_mlo_mode; + /* Pre selected Power scenarios to be applied from BDF file */ typedef enum { WIFI_POWER_SCENARIO_INVALID = -2, @@ -1232,6 +1240,14 @@ typedef struct { wifi_interface_handle iface, NanPairingEndRequest *msg); + /**@brief wifi_set_mlo_mode + * Set Multi-Link Operation mode. + * @param handle global wifi_handle + * @param mode: MLO mode + * @return Synchronous wifi_error + */ + wifi_error (*wifi_set_mlo_mode)(wifi_handle handle, wifi_mlo_mode mode); + /* * when adding new functions make sure to add stubs in * wifi_legacy_hal_stubs.cpp::initHalFuncTableWithStubs -- cgit v1.2.3 From 2b3c3a49bf1b49101f6615f967a64f7e01051afc Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Thu, 16 Feb 2023 13:11:04 -0800 Subject: NAN R4 additional iface changes for WFA certification Bug: 269440402 Test: build Change-Id: Ieaa28d5a5b71ca755f06b72c24fa8090179eeb4a --- include/hardware_legacy/wifi_nan.h | 58 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index d8c6824..d2bb621 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -356,8 +356,8 @@ typedef struct { #define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK 0x02 #define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_128_MASK 0x04 #define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_256_MASK 0x08 -#define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_128_MASK 0x10 -#define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_256_MASK 0x20 +#define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_128_MASK 0x40 +#define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_256_MASK 0x80 /* NAN ranging indication condition MASKS */ #define NAN_RANGING_INDICATE_CONTINUOUS_MASK 0x01 @@ -414,6 +414,25 @@ typedef struct { if QOS is required or not. */ NanQosCfgStatus qos_cfg; + /* + Config to set FSD with Gas bit + in the SDEA Control Field. + */ + u8 config_fsd_gas; + u8 enable_fsd_gas; + + /* + Config to set FSD Required bit + in the SDEA Control Field. + */ + u8 config_fsd_req; + u8 enable_fsd_req; + + /* + Config to set gtk protection bit + in the SDEA Control Field. + */ + u8 gtk_protection; } NanSdeaCtrlParams; /* @@ -1119,6 +1138,20 @@ typedef struct { */ u8 config_instant_mode_channel; wifi_channel instant_mode_channel; + + /* + Enable/Disable unsync service discovery. + 0 - Disable + 1 - Enable + */ + u8 config_unsync_srvdsc; + u8 enable_unsync_srvdsc; + + /* + Configure regulatory information. + */ + u8 config_reg_info; + u8 reg_info_val; } NanEnableRequest; /* @@ -1295,6 +1328,12 @@ typedef struct { is_suspension_supported is false in NanCapabilities. */ bool enable_suspendability; + + /* s3 capabilities */ + u16 s3_capabilities; + + /* cipher capabilities */ + u8 cipher_capabilities; } NanPublishRequest; /* @@ -1474,6 +1513,9 @@ typedef struct { is_suspension_supported is false in NanCapabilities. */ bool enable_suspendability; + + /* cipher capabilities */ + u8 cipher_capabilities; } NanSubscribeRequest; /* @@ -2499,8 +2541,20 @@ typedef struct { /* Publish or Subscribe Id of an earlier Publish/Subscribe */ u16 publish_subscribe_id; + + /* + Discovery MAC addr of the publisher/peer + */ + u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; } NanDataPathIndicationResponse; +/* Sub slot parameters */ +typedef struct { + u8 entry_control; + u16 time_bitmap_control; + u32 time_bitmap; +} NanS3Params; + /* NDP termination info */ typedef struct { u8 num_ndp_instances; -- cgit v1.2.3 From d1de22e90fc699742e664619817768b91b9edc02 Mon Sep 17 00:00:00 2001 From: Vinay Gannevaram Date: Sat, 22 Apr 2023 11:35:01 +0530 Subject: Interface changes for Aware 4.0 Bootsrapping and Shared Key Some methods like service managed bootstrapping required SDEA attribute to carry service specific information during bootstrapping handshake. Also once Pairing is setup User can transmit follow up frames to share NIK to the peer which should carry shared key descriptor. Comeback timeout can be set by Bootstrapping responder to defer the ongoing handshake. Hence Add interface changes for above requirements. Bug: 279363671 Test: build, flash and CtsWifiTestCases Change-Id: I67c4e5283189cfc80ef86b610d9d7f021ff4b29b --- include/hardware_legacy/wifi_nan.h | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index d2bb621..70e49ed 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -1561,6 +1561,12 @@ typedef struct { */ u16 sdea_service_specific_info_len; u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; + + /* + Add shared key descriptor attribute to the Followup request when the + flag is set + */ + u8 shared_key_desc_flag; } NanTransmitFollowupRequest; /* @@ -2906,6 +2912,20 @@ typedef struct { /* Proposed bootstrapping method */ u16 request_bootstrapping_method; + /* + Sequence of values which further specify the published service beyond + the service name. + */ + u16 service_specific_info_len; + u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; + + /* + Sequence of values indicating the service specific info in SDEA + Used for service managed bootstrapping method + */ + u16 sdea_service_specific_info_len; + u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; + /* The length of cookie. */ u32 cookie_length; @@ -2924,10 +2944,35 @@ typedef struct { */ u32 service_instance_id; + /* Discovery MAC addr of the peer/initiator */ + u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; + + /* + Sequence of values which further specify the published service beyond + the service name. + */ + u16 service_specific_info_len; + u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; + + /* + Sequence of values indicating the service specific info in SDEA + Used for service managed bootstrapping method + */ + u16 sdea_service_specific_info_len; + u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; /* Response Code indicating ACCEPT/REJECT */ NanBootstrappingResponseCode rsp_code; + /* The delay of bootstrapping in seconds */ + u32 come_back_delay; + + /* The length of cookie. */ + u32 cookie_length; + + /* Cookie for the follow up response */ + u8 cookie[]; + } NanBootstrappingIndicationResponse; /* -- cgit v1.2.3 From 787b2cd73a5f5d2c4c17c549116d0491d350f7f6 Mon Sep 17 00:00:00 2001 From: Vinay Gannevaram Date: Tue, 2 May 2023 23:13:42 +0530 Subject: Update NAN MAJOR and MINOR version to 4.0.0 As NAN interface supports the functionality of WiFi-Aware 4.0 specification, update MAJOR and MINOR version accordingly Bug: 280415518 Test: TH Change-Id: I29c80311ba5447aebeba9d455d81293f23c20a1d --- include/hardware_legacy/wifi_nan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index 70e49ed..6754252 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -40,9 +40,9 @@ typedef u16 transaction_id; typedef u32 NanDataPathId; #define NAN_MAC_ADDR_LEN 6 -#define NAN_MAJOR_VERSION 2 +#define NAN_MAJOR_VERSION 4 #define NAN_MINOR_VERSION 0 -#define NAN_MICRO_VERSION 1 +#define NAN_MICRO_VERSION 0 #define NAN_MAX_SOCIAL_CHANNELS 3 /* NAN Maximum Lengths */ -- cgit v1.2.3