diff options
Diffstat (limited to 'include/hardware_legacy/wifi_hal.h')
-rw-r--r-- | include/hardware_legacy/wifi_hal.h | 229 |
1 files changed, 228 insertions, 1 deletions
diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 952e894..e2e2bd6 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -24,6 +24,7 @@ extern "C" #include <stdint.h> #define IFNAMSIZ 16 +#define UNSPECIFIED -1 // wifi HAL common definition for unspecified value /* typedefs */ typedef unsigned char byte; @@ -64,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, @@ -125,6 +134,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; /* @@ -232,6 +242,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, @@ -277,6 +293,125 @@ typedef struct { wifi_radio_combination radio_combinations[]; } 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 + * different from the maximum number of radios supported by the chip. + * + * This is a static configuration of the chip. + */ + u32 max_mlo_str_link_count; + /** + * Maximum number of concurrent TDLS sessions supported by the chip. + * + */ + 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); @@ -331,6 +466,8 @@ 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 +#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)) @@ -578,6 +715,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,10 +1163,99 @@ 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); + /**@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); + + /**@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); + + /**@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); + + /**@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); + + 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); + + /**@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); + + wifi_error (*wifi_nan_pairing_end)(transaction_id id, + 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 - * hal_tool.cpp::init_wifi_stub_hal_func_table + * wifi_legacy_hal_stubs.cpp::initHalFuncTableWithStubs */ } wifi_hal_fn; |