Merge Android 24Q1 Release (ab/11220357)

Bug: 319669529
Merged-In: I79c67f34b77dac100610cc2e22f22dd631ecc17a
Change-Id: I47de8b64d89f7b3b581b5d2b34fc7067c654ba0a
This commit is contained in:
Xin Li 2024-01-17 22:14:15 -08:00
commit 2178cf6783
5 changed files with 418 additions and 29 deletions

View file

@ -30,7 +30,8 @@ typedef struct {
typedef enum {
ROAMING_DISABLE,
ROAMING_ENABLE
ROAMING_ENABLE,
ROAMING_AGGRESSIVE
} fw_roaming_state_t;
typedef struct {

View file

@ -50,28 +50,34 @@ typedef enum {
/* RTT Measurement Preamble */
typedef enum {
WIFI_RTT_PREAMBLE_LEGACY = 0x1,
WIFI_RTT_PREAMBLE_HT = 0x2,
WIFI_RTT_PREAMBLE_VHT = 0x4,
WIFI_RTT_PREAMBLE_HE = 0x8,
WIFI_RTT_PREAMBLE_EHT = 0x10,
} wifi_rtt_preamble;
WIFI_RTT_PREAMBLE_INVALID = 0x0,
WIFI_RTT_PREAMBLE_LEGACY = 0x1,
WIFI_RTT_PREAMBLE_HT = 0x2,
WIFI_RTT_PREAMBLE_VHT = 0x4,
WIFI_RTT_PREAMBLE_HE = 0x8,
WIFI_RTT_PREAMBLE_EHT = 0x10,
} wifi_rtt_preamble ;
/* RTT Type */
typedef enum {
RTT_TYPE_1_SIDED = 0x1,
RTT_TYPE_2_SIDED = 0x2,
RTT_TYPE_1_SIDED = 0x1,
/* Deprecated. Use RTT_TYPE_2_SIDED_11MC instead. */
RTT_TYPE_2_SIDED = 0x2,
RTT_TYPE_2_SIDED_11MC = RTT_TYPE_2_SIDED,
RTT_TYPE_2_SIDED_11AZ_NTB = 0x3,
} wifi_rtt_type;
/* RTT configuration */
typedef struct {
mac_addr addr; // peer device mac address
wifi_rtt_type type; // 1-sided or 2-sided RTT
wifi_rtt_type type; // 1-sided or 2-sided RTT (11mc and 11az)
rtt_peer_type peer; // optional - peer device hint (STA, P2P, AP)
wifi_channel_info channel; // Required for STA-AP mode, optional for P2P, NBD etc.
unsigned burst_period; // Time interval between bursts (units: 100 ms).
// Applies to 1-sided and 2-sided RTT multi-burst requests.
// Range: 0-31, 0: no preference by initiator (2-sided RTT)
// Note: Applicable for 11mc only.
unsigned num_burst; // Total number of RTT bursts to be executed. It will be
// specified in the same way as the parameter "Number of
// Burst Exponent" found in the FTM frame format. It
@ -82,6 +88,7 @@ typedef struct {
// number of RTT results is the following:
// for 1-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst)
// for 2-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst - 1)
// Note: Applicable for 11mc only.
unsigned num_frames_per_burst; // num of frames per burst.
// Minimum value = 1, Maximum value = 31
// For 2-sided this equals the number of FTM frames
@ -89,6 +96,7 @@ typedef struct {
// equals the number of FTM frames that the
// initiator will request that the responder send
// in a single frame.
// Note: Applicable for 11mc only.
unsigned num_retries_per_rtt_frame; // number of retries for a failed RTT frame. Applies
// to 1-sided RTT only. Minimum value = 0, Maximum value = 3
@ -98,7 +106,7 @@ typedef struct {
// Minimum value = 0, Maximum value = 3
byte LCI_request; // 1: request LCI, 0: do not request LCI
byte LCR_request; // 1: request LCR, 0: do not request LCR
unsigned burst_duration; // Applies to 1-sided and 2-sided RTT. Valid values will
unsigned burst_duration; // Applies to 1-sided and 2-sided 11mc RTT. Valid values will
// be 2-11 and 15 as specified by the 802.11mc std for
// the FTM parameter burst duration. In a multi-burst
// request, if responder overrides with larger value,
@ -110,10 +118,22 @@ typedef struct {
wifi_rtt_bw bw; // RTT BW to be used in the RTT frames
} wifi_rtt_config;
/* RTT configuration v3 (11az support)*/
typedef struct {
wifi_rtt_config rtt_config;
byte ntb_min_measurement_time_millis; // 11az Non-Trigger-based (non-TB) minimum measurement
// time in milliseconds
byte ntb_max_measurement_time_millis; // 11az Non-Trigger-based (non-TB) maximum measurement
// time in milliseconds
byte tx_ltf_repetition_count; // Multiple transmissions of HE-LTF symbols in an HE
// Ranging NDP. A value of 1 indicates no repetition.
} wifi_rtt_config_v3;
/* RTT results */
typedef struct {
mac_addr addr; // device mac address
unsigned burst_num; // burst number in a multi-burst request
unsigned burst_num; // burst number in a multi-burst request. Note: Applicable to
// 1-sided RTT and 2-sided IEEE 802.11mc only.
unsigned measurement_number; // Total RTT measurement frames attempted
unsigned success_number; // Total successful RTT measurement frames
byte number_per_burst_peer; // Maximum number of "FTM frames per burst" supported by
@ -139,6 +159,7 @@ typedef struct {
wifi_timespan rtt; // round trip time in picoseconds
wifi_timespan rtt_sd; // rtt standard deviation in picoseconds
wifi_timespan rtt_spread; // difference between max and min rtt times recorded in picoseconds
// Note: Only applicable for IEEE 802.11mc
int distance_mm; // distance in mm (optional)
int distance_sd_mm; // standard deviation in mm (optional)
int distance_spread_mm; // difference between max and min distance recorded in mm (optional)
@ -146,9 +167,9 @@ typedef struct {
int burst_duration; // in ms, actual time taken by the FW to finish one burst
// measurement. Applies to 1-sided and 2-sided RTT.
int negotiated_burst_num; // Number of bursts allowed by the responder. Applies
// to 2-sided RTT only.
wifi_information_element *LCI; // for 11mc only
wifi_information_element *LCR; // for 11mc only
// to 2-sided 11mc RTT only.
wifi_information_element *LCI; // for 11mc and 11az only
wifi_information_element *LCR; // for 11mc and 11az only
} wifi_rtt_result;
/* RTT results version 2 */
@ -160,21 +181,61 @@ typedef struct {
// Cap the average close to a specific valid RttBw.
} wifi_rtt_result_v2;
/* RTT results v3 (11az support)*/
typedef struct {
wifi_rtt_result_v2 rtt_result;
int tx_ltf_repetition_count; // 11az Transmit LTF repetitions used to get this result.
int ntb_min_measurement_time_millis; // Minimum non-trigger based (non-TB) dynamic measurement
// time in milliseconds assigned by the 11az responder.
int ntb_max_measurement_time_millis; // Maximum non-trigger based (non-TB) dynamic measurement
// time in milliseconds assigned by the 11az responder.
} wifi_rtt_result_v3;
/* RTT result callbacks */
typedef struct {
/*
* This callback is deprecated on Android 14 and onwards.
* Newer implementations should support on_rtt_results_v2 callback
* 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[]);
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.
*
* Note: This callback is deprecated on Android 15 onwards. Newer implementation should support
* on_rtt_results_v3.
*/
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 */
wifi_error wifi_rtt_range_request(wifi_request_id id, wifi_interface_handle iface,
unsigned num_rtt_config, wifi_rtt_config rtt_config[], wifi_rtt_event_handler handler);
/* RTT result v3 callback (11az support) */
typedef struct {
/*
* Called when vendor implementation supports sending RTT results version 3 (Added support for
* 11az ranging)
*/
void (*on_rtt_results_v3) (wifi_request_id id,
unsigned num_results,
wifi_rtt_result_v3 *rtt_result_v3[]);
} wifi_rtt_event_handler_v3;
/* v3 API to request RTT measurement(11az support). */
wifi_error wifi_rtt_range_request_v3(wifi_request_id id,
wifi_interface_handle iface,
unsigned num_rtt_config,
wifi_rtt_config_v3 rtt_config_v3[],
wifi_rtt_event_handler_v3 handler);
/* API to cancel RTT measurements */
wifi_error wifi_rtt_range_cancel(wifi_request_id id, wifi_interface_handle iface,
unsigned num_devices, mac_addr addr[]);
@ -220,16 +281,37 @@ typedef struct {
byte rtt_one_sided_supported; // if 1-sided rtt data collection is supported
byte rtt_ftm_supported; // if ftm rtt data collection is supported
byte lci_support; // if initiator supports LCI request. Applies to 2-sided RTT
// (applies to both 11mc and 11az).
byte lcr_support; // if initiator supports LCR request. Applies to 2-sided RTT
byte preamble_support; // bit mask indicates what preamble is supported by initiator
byte bw_support; // bit mask indicates what BW is supported by initiator
// (applies to both 11mc and 11az).
byte preamble_support; // bit mask indicates what preamble is supported by 11mc
// initiator
byte bw_support; // bit mask indicates what BW is supported by 11mc initiator
byte responder_supported; // if 11mc responder mode is supported
byte mc_version; // draft 11mc spec version supported by chip. For instance,
// version 4.0 should be 40 and version 4.3 should be 43 etc.
} wifi_rtt_capabilities;
/* RTT capabilities of the device */
wifi_error wifi_get_rtt_capabilities(wifi_interface_handle iface, wifi_rtt_capabilities *capabilities);
wifi_error wifi_get_rtt_capabilities(wifi_interface_handle iface,
wifi_rtt_capabilities *capabilities);
/* RTT Capabilities v3 (11az support) */
typedef struct {
wifi_rtt_capabilities rtt_capab;
byte az_preamble_support; // bit mask indicates what preamble is supported by the 11az
// initiator
byte az_bw_support; // bit mask indicates what BW is supported by 11az initiator
byte ntb_initiator_supported; // if 11az non-TB initiator is supported
byte ntb_responder_supported; // if 11az non-TB responder is supported
byte max_tx_ltf_repetition_count;// maximum HE LTF repetitions the 11az initiator is capable of
// transmitting in the preamble of I2R NDP
} wifi_rtt_capabilities_v3;
/* RTT capabilities v3 of the device (11az support) */
wifi_error wifi_get_rtt_capabilities_v3(wifi_interface_handle iface,
wifi_rtt_capabilities_v3 *capabilities);
/* debugging definitions */
enum {

View file

@ -103,6 +103,10 @@ typedef enum {
WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW_UNFOLDED = 23,
WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW_UNFOLDED = 24,
WIFI_POWER_SCENARIO_ON_BODY_REAR_CAMERA = 25,
WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF_UNFOLDED_CAP = 26,
WIFI_POWER_SCENARIO_ON_BODY_BT_UNFOLDED_CAP = 27,
WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_UNFOLDED_CAP = 28,
WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT_UNFOLDED_CAP = 29,
} wifi_power_scenario;
typedef enum {
@ -126,7 +130,7 @@ typedef enum {
*/
typedef enum {
WIFI_VOIP_MODE_OFF = 0,
WIFI_VOIP_MODE_ON = 1,
WIFI_VOIP_MODE_VOICE = 1,
} wifi_voip_mode;
/* List of interface types supported */
@ -469,6 +473,9 @@ void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer
#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
#define WIFI_FEATURE_ROAMING_MODE_CONTROL (uint64_t)0x800000000 // Support for configuring roaming mode
#define WIFI_FEATURE_SET_VOIP_MODE (uint64_t)0x1000000000 // Support Voip mode setting
#define WIFI_FEATURE_CACHED_SCAN_RESULTS (uint64_t)0x2000000000 // Support cached scan result report
// Add more features here
#define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask))
@ -762,9 +769,12 @@ typedef struct {
wifi_error (* wifi_get_valid_channels)(wifi_interface_handle,int, int, wifi_channel *, int *);
wifi_error (* wifi_rtt_range_request)(wifi_request_id, wifi_interface_handle, unsigned,
wifi_rtt_config[], wifi_rtt_event_handler);
wifi_error (* wifi_rtt_range_request_v3)(wifi_request_id, wifi_interface_handle, unsigned,
wifi_rtt_config_v3[], wifi_rtt_event_handler_v3);
wifi_error (* wifi_rtt_range_cancel)(wifi_request_id, wifi_interface_handle, unsigned,
mac_addr[]);
wifi_error (* wifi_get_rtt_capabilities)(wifi_interface_handle, wifi_rtt_capabilities *);
wifi_error (* wifi_get_rtt_capabilities_v3)(wifi_interface_handle, wifi_rtt_capabilities_v3 *);
wifi_error (* wifi_rtt_get_responder_info)(wifi_interface_handle iface,
wifi_rtt_responder *responder_info);
wifi_error (* wifi_enable_responder)(wifi_request_id id, wifi_interface_handle iface,
@ -988,11 +998,107 @@ typedef struct {
*/
wifi_error (*wifi_set_voip_mode)(wifi_interface_handle iface, wifi_voip_mode mode);
/**
* Get Target Wake Time (TWT) local device capabilities for the station interface.
*
* @param iface Wifi interface handle
* @param capabilities TWT capabilities
* @return Synchronous wifi_error
*/
wifi_error (*wifi_twt_get_capabilities)(wifi_interface_handle iface,
wifi_twt_capabilities* capabilities);
/**
* Setup a TWT session.
*
* Supported only if wifi_twt_capabilities.is_twt_requester_supported is set. Results in
* asynchronous callback wifi_twt_events.on_twt_session_create on success or
* wifi_twt_events.on_twt_failure with error code.
*
* @param id Identifier for the command. The value 0 is reserved.
* @param iface Wifi interface handle
* @param request TWT request parameters
* @param events TWT events
* @return Synchronous wifi_error
*/
wifi_error (*wifi_twt_session_setup)(wifi_request_id id, wifi_interface_handle iface,
wifi_twt_request request, wifi_twt_events events);
/**
* Update a TWT session.
*
* Supported only if wifi_twt_session.is_updatable is set. Reesults in asynchronous callback
* wifi_twt_events.on_twt_session_update on success or wifi_twt_events.on_twt_failure with
* error code.
*
* @param id Identifier for the command. The value 0 is reserved.
* @param iface Wifi interface handle
* @param session_id TWT session identifier
* @param request TWT request parameters
* @return Synchronous wifi_error
*/
wifi_error (*wifi_twt_session_update)(wifi_request_id id, wifi_interface_handle iface,
int session_id, wifi_twt_request request);
/**
* Suspend a TWT session.
* Supported only if wifi_twt_session.is_suspendable is set. Results in asynchronous callback
* wifi_twt_events.on_twt_session_suspend on success or wifi_twt_events.on_twt_failure with
* error code.
*
* @param id Identifier for the command. The value 0 is reserved.
* @param iface Wifi interface handle
* @param session_id TWT session identifier
* @return Synchronous wifi_error
*/
wifi_error (*wifi_twt_session_suspend)(wifi_request_id id, wifi_interface_handle iface,
int session_id);
/**
* Resume a suspended TWT session.
*
* Supported only if wifi_twt_session.is_suspendable is set. Results in asynchronous callback
* wifi_twt_events.on_twt_session_resume on success or wifi_twt_events.on_twt_failure with
* error code.
*
* @param id Identifier for the command. The value 0 is reserved.
* @param iface Wifi interface handle
* @param session_id TWT session identifier
* @return Synchronous wifi_error
*/
wifi_error (*wifi_twt_session_resume)(wifi_request_id id, wifi_interface_handle iface,
int session_id);
/**
* Teardown a TWT session.
*
* Results in asynchronous callback wifi_twt_events.on_twt_session_teardown on success or
* wifi_twt_events.on_twt_failure with error code.
*
* @param id Identifier for the command. The value 0 is reserved.
* @param iface Wifi interface handle
* @param session_id TWT session identifier
* @return Synchronous wifi_error
*/
wifi_error (*wifi_twt_session_teardown)(wifi_request_id id, wifi_interface_handle iface,
int session_id);
/**
* Get stats for a TWT session.
*
* Results in asynchronous callback wifi_twt_events.on_twt_session_stats on success or
* wifi_twt_events.on_twt_failure with error code.
*
* @param id Identifier for the command. The value 0 is reserved.
* @param iface Wifi interface handle
* @param session_id TWT session identifier
* @return Synchronous wifi_error
*/
wifi_error (*wifi_twt_session_get_stats)(wifi_request_id id, wifi_interface_handle iface,
int session_id);
/**@brief twt_register_handler
* Request to register TWT callback before sending any TWT request
* @param wifi_interface_handle:
* @param TwtCallbackHandler: callback function pointers
* @return Synchronous wifi_error
*
* Note: This function is deprecated
*/
wifi_error (*wifi_twt_register_handler)(wifi_interface_handle iface,
TwtCallbackHandler handler);
@ -1001,6 +1107,8 @@ typedef struct {
* Request TWT capability
* @param wifi_interface_handle:
* @return Synchronous wifi_error and TwtCapabilitySet
*
* Note: This function is deprecated by wifi_twt_get_capabilities
*/
wifi_error (*wifi_twt_get_capability)(wifi_interface_handle iface,
TwtCapabilitySet* twt_cap_set);
@ -1011,7 +1119,9 @@ typedef struct {
* @param TwtSetupRequest: detailed parameters of setup request
* @return Synchronous wifi_error
* @return Asynchronous EventTwtSetupResponse CB return TwtSetupResponse
*/
*
* Note: This function is deprecated by wifi_twt_session_setup
*/
wifi_error (*wifi_twt_setup_request)(wifi_interface_handle iface,
TwtSetupRequest* msg);
@ -1023,6 +1133,8 @@ typedef struct {
* @return Asynchronous EventTwtTeardownCompletion CB return TwtTeardownCompletion
* TwtTeardownCompletion may also be received due to other events
* like CSA, BTCX, TWT scheduler, MultiConnection, peer-initiated teardown, etc.
*
* Note: This function is deprecated by wifi_twt_session_teardown
*/
wifi_error (*wifi_twt_teardown_request)(wifi_interface_handle iface,
TwtTeardownRequest* msg);
@ -1034,6 +1146,9 @@ typedef struct {
* @return Synchronous wifi_error
* @return Asynchronous EventTwtInfoFrameReceived CB return TwtInfoFrameReceived
* Driver may also receive Peer-initiated TwtInfoFrame
*
* Note: This function is deprecated by wifi_twt_session_suspend and
* wifi_twt_session_resume
*/
wifi_error (*wifi_twt_info_frame_request)(wifi_interface_handle iface,
TwtInfoFrameRequest* msg);
@ -1043,6 +1158,8 @@ typedef struct {
* @param wifi_interface_handle:
* @param config_id: configuration ID of TWT request
* @return Synchronous wifi_error and TwtStats
*
* Note: This function is deprecated by wifi_twt_get_session_stats
*/
wifi_error (*wifi_twt_get_stats)(wifi_interface_handle iface, u8 config_id,
TwtStats* stats);
@ -1052,6 +1169,8 @@ typedef struct {
* @param wifi_interface_handle:
* @param config_id: configuration ID of TWT request
* @return Synchronous wifi_error
*
* Note: This function is deprecated by wifi_twt_session_clear_stats
*/
wifi_error (*wifi_twt_clear_stats)(wifi_interface_handle iface, u8 config_id);

View file

@ -61,7 +61,7 @@ typedef u32 NanDataPathId;
#define NAN_ERROR_STR_LEN 255
#define NAN_PMK_INFO_LEN 32
#define NAN_MAX_SCID_BUF_LEN 1024
#define NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN 1024
#define NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN 2048
#define NAN_SECURITY_MIN_PASSPHRASE_LEN 8
#define NAN_SECURITY_MAX_PASSPHRASE_LEN 63
#define NAN_MAX_CHANNEL_INFO_SUPPORTED 4
@ -2492,6 +2492,15 @@ typedef struct {
/* Publish or Subscribe Id of an earlier Publish/Subscribe */
u16 publish_subscribe_id;
/* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
are supported or not
*/
u8 csia_capabilities;
/* configure GTK(Group Transient Key) protection required or not */
u8 gtk_protection;
} NanDataPathInitiatorRequest;
/*
@ -2552,6 +2561,14 @@ typedef struct {
Discovery MAC addr of the publisher/peer
*/
u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
/* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
are supported or not
*/
u8 csia_capabilities;
/* configure GTK(Group Transient Key) protection required or not */
u8 gtk_protection;
} NanDataPathIndicationResponse;
/* Sub slot parameters */
@ -2606,6 +2623,14 @@ typedef struct {
for setting up the Secure Data Path.
*/
u8 scid[NAN_MAX_SCID_BUF_LEN];
/* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
are supported or not
*/
u8 csia_capabilities;
/* configure GTK(Group Transient Key) protection required or not */
u8 gtk_protection;
} NanDataPathRequestInd;
/*
@ -2825,7 +2850,7 @@ typedef struct {
Initiator side
*/
typedef struct {
/* Publish or Subscribe Id of an earlier Publish/Subscribe */
/* Publish instance id generated on Publisher side corresponding to a session */
u16 publish_subscribe_id;
/*
This Id is the Requestor Instance that is passed as
@ -2898,6 +2923,9 @@ typedef struct {
NAN pairing bootstrapping initiator request
*/
typedef struct {
/* Publish or Subscribe Id of local Publish/Subscribe */
u16 publish_subscribe_id;
/*
This Id is the Requestor Instance that is passed as
part of earlier MatchInd/FollowupInd message.
@ -2926,6 +2954,9 @@ typedef struct {
u16 sdea_service_specific_info_len;
u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
/* Indicates that this is comeback Bootstrapping request */
u8 comeback;
/* The length of cookie. */
u32 cookie_length;
@ -2937,9 +2968,11 @@ typedef struct {
NAN pairing bootstrapping response from responder to a initate request
*/
typedef struct {
/* Publish or Subscribe Id of local Publish/Subscribe */
u16 publish_subscribe_id;
/*
This Id is the Requestor Instance that is passed as
This Id is the Peer Instance that is passed as
part of earlier MatchInd/FollowupInd message.
*/
u32 service_instance_id;
@ -2976,7 +3009,7 @@ typedef struct {
} NanBootstrappingIndicationResponse;
/*
Event indication received on the responder side when a Nan boostrapping session is initiated on
Event indication received on the responder side when a Nan bootsrapping session is initiated on
the Initiator side
*/
typedef struct {

View file

@ -19,6 +19,160 @@
#include "wifi_hal.h"
/**
* New HAL interface to Target Wake Time (TWT).
*/
/* TWT capabilities supported */
typedef struct {
u8 is_twt_requester_supported; // 0 for not supporting twt requester
u8 is_twt_responder_supported; // 0 for not supporting twt responder
u8 is_broadcast_twt_supported; // 0 for not supporting broadcast twt
u8 is_flexible_twt_supported; // 0 for not supporting flexible twt schedules
u32 min_wake_duration_micros; // minimum twt wake duration capable in microseconds
u32 max_wake_duration_micros; // maximum twt wake duration capable in microseconds
u32 min_wake_interval_micros; // minimum twt wake interval capable in microseconds
u32 max_wake_interval_micros; // maximum twt wake interval capable in microseconds
} wifi_twt_capabilities;
/* TWT request parameters to setup or update a TWT session */
typedef struct {
s8 mlo_link_id; // MLO Link id in case TWT is requesting for MLO connection.
// Otherwise UNSPECIFIED.
u32 min_wake_duration_micros; // minimum twt wake duration in microseconds
u32 max_wake_duration_micros; // maximum twt wake duration in microseconds
u32 min_wake_interval_micros; // minimum twt wake interval in microseconds
u32 max_wake_interval_micros; // maximum twt wake interval in microseconds
} wifi_twt_request;
/* TWT negotiation types */
typedef enum {
WIFI_TWT_NEGO_TYPE_INDIVIDUAL,
WIFI_TWT_NEGO_TYPE_BROADCAST,
} wifi_twt_negotiation_type;
/* TWT session */
typedef struct {
u32 session_id; // a unique identifier for the session
s8 mlo_link_id; // link id in case of MLO connection. Otherwise UNSPECIFIED.
u32 wake_duration_micros; // TWT service period in microseconds
u32 wake_interval_micros; // TWT wake interval for this session in microseconds
wifi_twt_negotiation_type negotiation_type; // TWT negotiation type
u8 is_trigger_enabled; // 0 if this TWT session is not trigger enabled
u8 is_announced; // 0 if this TWT session is not announced
u8 is_implicit; // 0 if this TWT session is not implicit
u8 is_protected; // 0 if this TWT session is not protected
u8 is_updatable; // 0 if this TWT session is not updatable
u8 is_suspendable; // 0 if this TWT session can not be suspended and resumed
u8 is_responder_pm_mode_enabled; // 0 if TWT responder does not intend to go to doze mode
// outside of TWT service periods
} wifi_twt_session;
/* TWT session stats */
typedef struct {
u32 avg_pkt_num_tx; // Average number of Tx packets in each wake duration.
u32 avg_pkt_num_rx; // Average number of Rx packets in each wake duration.
u32 avg_tx_pkt_size; // Average bytes per Rx packet in each wake duration.
u32 avg_rx_pkt_size; // Average bytes per Rx packet in each wake duration.
u32 avg_eosp_dur_us; // Average duration of early terminated SP
u32 eosp_count; // Count of early terminations
} wifi_twt_session_stats;
/* TWT error codes */
typedef enum {
WIFI_TWT_ERROR_CODE_FAILURE_UNKNOWN, // unknown failure
WIFI_TWT_ERROR_CODE_ALREADY_RESUMED, // TWT session is already resumed
WIFI_TWT_ERROR_CODE_ALREADY_SUSPENDED, // TWT session is already suspended
WIFI_TWT_ERROR_CODE_INVALID_PARAMS, // invalid parameters
WIFI_TWT_ERROR_CODE_MAX_SESSION_REACHED,// maximum number of sessions reached
WIFI_TWT_ERROR_CODE_NOT_AVAILABLE, // requested operation is not available
WIFI_TWT_ERROR_CODE_NOT_SUPPORTED, // requested operation is not supported
WIFI_TWT_ERROR_CODE_PEER_NOT_SUPPORTED, // requested operation is not supported by the
// peer
WIFI_TWT_ERROR_CODE_PEER_REJECTED, // requested operation is rejected by the peer
WIFI_TWT_ERROR_CODE_TIMEOUT, // requested operation is timed out
} wifi_twt_error_code;
/* TWT teardown reason codes */
typedef enum {
WIFI_TWT_TEARDOWN_REASON_CODE_UNKNOWN, // unknown reason
WIFI_TWT_TEARDOWN_REASON_CODE_LOCALLY_REQUESTED, // teardown requested by the framework
WIFI_TWT_TEARDOWN_REASON_CODE_INTERNALLY_INITIATED, // teardown initiated internally by the
// firmware or driver.
WIFI_TWT_TEARDOWN_REASON_CODE_PEER_INITIATED, // teardown initiated by the peer
} wifi_twt_teardown_reason_code;
/**
* TWT events
*
* Each of the events has a wifi_request_id to match the command responsible for the event. If the
* id is 0, the event is an unsolicited.
*/
typedef struct {
/**
* Called to indicate a TWT failure.
*
* @param id Id used to identify the command. The value 0 indicates no associated command.
* @param error_code TWT error code.
*/
void (*on_twt_failure)(wifi_request_id id, wifi_twt_error_code error_code);
/**
* Called when a Target Wake Time session is created. See wifi_twt_session_setup.
*
* @param id Id used to identify the command.
* @param session TWT session created.
*/
void (*on_twt_session_create)(wifi_request_id id, wifi_twt_session session);
/**
* Called when a Target Wake Time session is updated. See wifi_twt_session_update.
*
* @param id Id used to identify the command. The value 0 indicates no associated command.
* @param twtSession TWT session.
*/
void (*on_twt_session_update)(wifi_request_id id, wifi_twt_session session);
/**
* Called when the Target Wake Time session is torn down. See wifi_twt_session_teardown.
*
* @param id Id used to identify the command. The value 0 indicates no associated command.
* @param session_id TWT session id.
* @param reason Teardown reason code.
*/
void (*on_twt_session_teardown)(wifi_request_id id, int session_id,
wifi_twt_teardown_reason_code reason);
/**
* Called when TWT session stats available. See wifi_twt_session_get_stats.
*
* @param id Id used to identify the command.
* @param session_id TWT session id.
* @param stats TWT session stats.
*/
void (*on_twt_session_stats)(wifi_request_id id, int session_id, wifi_twt_session_stats stats);
/**
* Called when the Target Wake Time session is suspended. See wifi_twt_session_suspend.
*
* @param id Id used to identify the command.
* @param session_id TWT session id.
*/
void (*on_twt_session_suspend)(wifi_request_id id, int session_id);
/**
* Called when the Target Wake Time session is resumed. See wifi_twt_session_resume.
*
* @param id Id used to identify the command.
* @param session_id TWT session id.
*/
void (*on_twt_session_resume)(wifi_request_id id, int session_id);
} wifi_twt_events;
/**
* Important note: Following legacy HAL TWT interface is deprecated. It will be removed in future.
* Please use the new interface listed above.
*/
typedef struct {
u8 requester_supported; // 0 for not supporting requester
u8 responder_supported; // 0 for not supporting responder