1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __WIFI_HAL_H__ 18 #define __WIFI_HAL_H__ 19 20 #ifdef __cplusplus 21 extern "C" 22 { 23 #endif 24 #include <stdint.h> 25 26 #define IFNAMSIZ 16 27 28 /* WiFi Common definitions */ 29 /* channel operating width */ 30 typedef enum { 31 WIFI_CHAN_WIDTH_20 = 0, 32 WIFI_CHAN_WIDTH_40 = 1, 33 WIFI_CHAN_WIDTH_80 = 2, 34 WIFI_CHAN_WIDTH_160 = 3, 35 WIFI_CHAN_WIDTH_80P80 = 4, 36 WIFI_CHAN_WIDTH_5 = 5, 37 WIFI_CHAN_WIDTH_10 = 6, 38 WIFI_CHAN_WIDTH_INVALID = -1 39 } wifi_channel_width; 40 41 /* Pre selected Power scenarios to be applied from BDF file */ 42 typedef enum { 43 WIFI_POWER_SCENARIO_INVALID = -2, 44 WIFI_POWER_SCENARIO_DEFAULT = -1, 45 WIFI_POWER_SCENARIO_VOICE_CALL = 0, 46 WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF = 1, 47 WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON = 2, 48 WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF = 3, 49 WIFI_POWER_SCENARIO_ON_BODY_CELL_ON = 4, 50 WIFI_POWER_SCENARIO_ON_BODY_BT = 5, 51 } wifi_power_scenario; 52 53 typedef enum { 54 WIFI_LATENCY_MODE_NORMAL = 0, 55 WIFI_LATENCY_MODE_LOW = 1, 56 } wifi_latency_mode; 57 58 /* Wifi Thermal mitigation modes */ 59 typedef enum { 60 WIFI_MITIGATION_NONE = 0, 61 WIFI_MITIGATION_LIGHT = 1, 62 WIFI_MITIGATION_MODERATE = 2, 63 WIFI_MITIGATION_SEVERE = 3, 64 WIFI_MITIGATION_CRITICAL = 4, 65 WIFI_MITIGATION_EMERGENCY = 5, 66 } wifi_thermal_mode; 67 68 /* List of interface types supported */ 69 typedef enum { 70 WIFI_INTERFACE_TYPE_STA = 0, 71 WIFI_INTERFACE_TYPE_AP = 1, 72 WIFI_INTERFACE_TYPE_P2P = 2, 73 WIFI_INTERFACE_TYPE_NAN = 3, 74 } wifi_interface_type; 75 76 /* 77 * enum wlan_mac_band - Band information corresponding to the WLAN MAC. 78 */ 79 typedef enum { 80 /* WLAN MAC Operates in 2.4 GHz Band */ 81 WLAN_MAC_2_4_BAND = 1 << 0, 82 /* WLAN MAC Operates in 5 GHz Band */ 83 WLAN_MAC_5_0_BAND = 1 << 1, 84 /* WLAN MAC Operates in 6 GHz Band */ 85 WLAN_MAC_6_0_BAND = 1 << 2 86 } wlan_mac_band; 87 88 typedef int wifi_radio; 89 typedef int wifi_channel; 90 91 typedef struct { 92 wifi_channel_width width; 93 int center_frequency0; 94 int center_frequency1; 95 int primary_frequency; 96 } wifi_channel_spec; 97 98 typedef enum { 99 WIFI_SUCCESS = 0, 100 WIFI_ERROR_NONE = 0, 101 WIFI_ERROR_UNKNOWN = -1, 102 WIFI_ERROR_UNINITIALIZED = -2, 103 WIFI_ERROR_NOT_SUPPORTED = -3, 104 WIFI_ERROR_NOT_AVAILABLE = -4, // Not available right now, but try later 105 WIFI_ERROR_INVALID_ARGS = -5, 106 WIFI_ERROR_INVALID_REQUEST_ID = -6, 107 WIFI_ERROR_TIMED_OUT = -7, 108 WIFI_ERROR_TOO_MANY_REQUESTS = -8, // Too many instances of this request 109 WIFI_ERROR_OUT_OF_MEMORY = -9, 110 WIFI_ERROR_BUSY = -10, 111 } wifi_error; 112 113 typedef enum { 114 WIFI_ACCESS_CATEGORY_BEST_EFFORT = 0, 115 WIFI_ACCESS_CATEGORY_BACKGROUND = 1, 116 WIFI_ACCESS_CATEGORY_VIDEO = 2, 117 WIFI_ACCESS_CATEGORY_VOICE = 3 118 } wifi_access_category; 119 120 typedef unsigned char byte; 121 typedef unsigned char u8; 122 typedef signed char s8; 123 typedef uint16_t u16; 124 typedef uint32_t u32; 125 typedef int32_t s32; 126 typedef uint64_t u64; 127 typedef int64_t s64; 128 typedef int wifi_request_id; 129 typedef int wifi_channel; // indicates channel frequency in MHz 130 typedef int wifi_rssi; 131 typedef byte mac_addr[6]; 132 typedef byte oui[3]; 133 typedef int64_t wifi_timestamp; // In microseconds (us) 134 typedef int64_t wifi_timespan; // In picoseconds (ps) 135 136 struct wifi_info; 137 struct wifi_interface_info; 138 typedef struct wifi_info *wifi_handle; 139 typedef struct wifi_interface_info *wifi_interface_handle; 140 141 /* Initialize/Cleanup */ 142 143 wifi_error wifi_initialize(wifi_handle *handle); 144 145 /** 146 * wifi_wait_for_driver 147 * Function should block until the driver is ready to proceed. 148 * Any errors from this function is considered fatal & will fail the HAL startup sequence. 149 * 150 * on success returns WIFI_SUCCESS 151 * on failure returns WIFI_ERROR_TIMED_OUT 152 */ 153 wifi_error wifi_wait_for_driver_ready(void); 154 155 typedef void (*wifi_cleaned_up_handler) (wifi_handle handle); 156 void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler); 157 void wifi_event_loop(wifi_handle handle); 158 159 /* Error handling */ 160 void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer to a static string 161 162 /* Feature enums */ 163 #define WIFI_FEATURE_INFRA (uint64_t)0x1 // Basic infrastructure mode 164 #define WIFI_FEATURE_INFRA_5G (uint64_t)0x2 // Support for 5 GHz Band 165 #define WIFI_FEATURE_HOTSPOT (uint64_t)0x4 // Support for GAS/ANQP 166 #define WIFI_FEATURE_P2P (uint64_t)0x8 // Wifi-Direct 167 #define WIFI_FEATURE_SOFT_AP (uint64_t)0x10 // Soft AP 168 #define WIFI_FEATURE_GSCAN (uint64_t)0x20 // Google-Scan APIs 169 #define WIFI_FEATURE_NAN (uint64_t)0x40 // Neighbor Awareness Networking 170 #define WIFI_FEATURE_D2D_RTT (uint64_t)0x80 // Device-to-device RTT 171 #define WIFI_FEATURE_D2AP_RTT (uint64_t)0x100 // Device-to-AP RTT 172 #define WIFI_FEATURE_BATCH_SCAN (uint64_t)0x200 // Batched Scan (legacy) 173 #define WIFI_FEATURE_PNO (uint64_t)0x400 // Preferred network offload 174 #define WIFI_FEATURE_ADDITIONAL_STA (uint64_t)0x800 // Support for two STAs 175 #define WIFI_FEATURE_TDLS (uint64_t)0x1000 // Tunnel directed link setup 176 #define WIFI_FEATURE_TDLS_OFFCHANNEL (uint64_t)0x2000 // Support for TDLS off channel 177 #define WIFI_FEATURE_EPR (uint64_t)0x4000 // Enhanced power reporting 178 #define WIFI_FEATURE_AP_STA (uint64_t)0x8000 // Support for AP STA Concurrency 179 #define WIFI_FEATURE_LINK_LAYER_STATS (uint64_t)0x10000 // Link layer stats collection 180 #define WIFI_FEATURE_LOGGER (uint64_t)0x20000 // WiFi Logger 181 #define WIFI_FEATURE_HAL_EPNO (uint64_t)0x40000 // WiFi PNO enhanced 182 #define WIFI_FEATURE_RSSI_MONITOR (uint64_t)0x80000 // RSSI Monitor 183 #define WIFI_FEATURE_MKEEP_ALIVE (uint64_t)0x100000 // WiFi mkeep_alive 184 #define WIFI_FEATURE_CONFIG_NDO (uint64_t)0x200000 // ND offload configure 185 #define WIFI_FEATURE_TX_TRANSMIT_POWER (uint64_t)0x400000 // Capture Tx transmit power levels 186 #define WIFI_FEATURE_CONTROL_ROAMING (uint64_t)0x800000 // Enable/Disable firmware roaming 187 #define WIFI_FEATURE_IE_WHITELIST (uint64_t)0x1000000 // Support Probe IE white listing 188 #define WIFI_FEATURE_SCAN_RAND (uint64_t)0x2000000 // Support MAC & Probe Sequence Number randomization 189 #define WIFI_FEATURE_SET_TX_POWER_LIMIT (uint64_t)0x4000000 // Support Tx Power Limit setting 190 #define WIFI_FEATURE_USE_BODY_HEAD_SAR (uint64_t)0x8000000 // Support Using Body/Head Proximity for SAR 191 #define WIFI_FEATURE_SET_LATENCY_MODE (uint64_t)0x40000000 // Support Latency mode setting 192 #define WIFI_FEATURE_P2P_RAND_MAC (uint64_t)0x80000000 // Support P2P MAC randomization 193 // Add more features here 194 195 196 typedef uint64_t feature_set; 197 198 #define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask)) 199 200 #define IS_SUPPORTED_FEATURE(feature, featureSet) IS_MASK_SET(feature, featureSet) 201 202 /* Feature set */ 203 wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_set *set); 204 205 /* 206 * Each row represents a valid feature combination; 207 * all other combinations are invalid! 208 */ 209 wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, int set_size_max, 210 feature_set set[], int *set_size); 211 212 /* multiple interface support */ 213 214 wifi_error wifi_get_ifaces(wifi_handle handle, int *num_ifaces, wifi_interface_handle **ifaces); 215 wifi_error wifi_get_iface_name(wifi_interface_handle iface, char *name, size_t size); 216 wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name); 217 218 /* Configuration events */ 219 220 typedef struct { 221 void (*on_country_code_changed)(char code[2]); // We can get this from supplicant too 222 223 // More event handlers 224 } wifi_event_handler; 225 226 typedef struct { 227 char iface_name[IFNAMSIZ + 1]; 228 wifi_channel channel; 229 } wifi_iface_info; 230 231 typedef struct { 232 u32 wlan_mac_id; 233 /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */ 234 u32 mac_band; 235 /* Represents the connected Wi-Fi interfaces associated with each MAC */ 236 int num_iface; 237 wifi_iface_info *iface_info; 238 } wifi_mac_info; 239 240 typedef struct { 241 void (*on_radio_mode_change)(wifi_request_id id, unsigned num_mac, 242 wifi_mac_info *mac_info); 243 } wifi_radio_mode_change_handler; 244 245 typedef struct { 246 void (*on_rssi_threshold_breached)(wifi_request_id id, u8 *cur_bssid, s8 cur_rssi); 247 } wifi_rssi_event_handler; 248 249 wifi_error wifi_set_iface_event_handler(wifi_request_id id, wifi_interface_handle iface, wifi_event_handler eh); 250 wifi_error wifi_reset_iface_event_handler(wifi_request_id id, wifi_interface_handle iface); 251 252 wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs); 253 wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, wifi_power_scenario scenario); 254 wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle); 255 wifi_error wifi_set_latency_mode(wifi_interface_handle handle, wifi_latency_mode mode); 256 wifi_error wifi_map_dscp_access_category(wifi_handle handle, 257 uint32_t start, uint32_t end, 258 uint32_t access_category); 259 wifi_error wifi_reset_dscp_mapping(wifi_handle handle); 260 261 /** 262 * Wifi HAL Thermal Mitigation API 263 * 264 * wifi_handle : wifi global handle (note: this is not a interface specific 265 * command). Mitigation is expected to be applied across all active interfaces 266 * The implementation and the mitigation action mapping to each mode is chip 267 * specific. Mitigation will be active until Wifi is turned off or 268 * WIFI_MITIGATION_NONE mode is sent 269 * 270 * mode: Thermal mitigation mode 271 * WIFI_MITIGATION_NONE : Clear all Wifi thermal mitigation actions 272 * WIFI_MITIGATION_LIGHT : Light Throttling where UX is not impacted 273 * WIFI_MITIGATION_MODERATE : Moderate throttling where UX not largely impacted 274 * WIFI_MITIGATION_SEVERE : Severe throttling where UX is largely impacted 275 * WIFI_MITIGATION_CRITICAL : Platform has done everything to reduce power 276 * WIFI_MITIGATION_EMERGENCY: Key components in platform are shutting down 277 * 278 * completion_window 279 * Deadline (in milliseconds) to complete this request, value 0 implies apply 280 * immediately. Deadline is basically a relaxed limit and allows vendors to 281 * apply the mitigation within the window (if it cannot apply immediately) 282 * 283 * Return 284 * WIFI_ERROR_NOT_SUPPORTED : Chip does not support thermal mitigation 285 * WIFI_ERROR_BUSY : Mitigation is supported, but retry later 286 * WIFI_ERROR_NONE : Mitigation request has been accepted 287 */ 288 wifi_error wifi_set_thermal_mitigation_mode(wifi_handle handle, 289 wifi_thermal_mode mode, 290 u32 completion_window); 291 292 293 typedef struct rx_data_cnt_details_t { 294 int rx_unicast_cnt; /*Total rx unicast packet which woke up host */ 295 int rx_multicast_cnt; /*Total rx multicast packet which woke up host */ 296 int rx_broadcast_cnt; /*Total rx broadcast packet which woke up host */ 297 } RX_DATA_WAKE_CNT_DETAILS; 298 299 typedef struct rx_wake_pkt_type_classification_t { 300 int icmp_pkt; /*wake icmp packet count */ 301 int icmp6_pkt; /*wake icmp6 packet count */ 302 int icmp6_ra; /*wake icmp6 RA packet count */ 303 int icmp6_na; /*wake icmp6 NA packet count */ 304 int icmp6_ns; /*wake icmp6 NS packet count */ 305 //ToDo: Any more interesting classification to add? 306 } RX_WAKE_PKT_TYPE_CLASSFICATION; 307 308 typedef struct rx_multicast_cnt_t{ 309 int ipv4_rx_multicast_addr_cnt; /*Rx wake packet was ipv4 multicast */ 310 int ipv6_rx_multicast_addr_cnt; /*Rx wake packet was ipv6 multicast */ 311 int other_rx_multicast_addr_cnt;/*Rx wake packet was non-ipv4 and non-ipv6*/ 312 } RX_MULTICAST_WAKE_DATA_CNT; 313 314 /* 315 * Structure holding all the driver/firmware wake count reasons. 316 * 317 * Buffers for the array fields (cmd_event_wake_cnt/driver_fw_local_wake_cnt) 318 * are allocated and freed by the framework. The size of each allocated 319 * array is indicated by the corresponding |_cnt| field. HAL needs to fill in 320 * the corresponding |_used| field to indicate the number of elements used in 321 * the array. 322 */ 323 typedef struct wlan_driver_wake_reason_cnt_t { 324 int total_cmd_event_wake; /* Total count of cmd event wakes */ 325 int *cmd_event_wake_cnt; /* Individual wake count array, each index a reason */ 326 int cmd_event_wake_cnt_sz; /* Max number of cmd event wake reasons */ 327 int cmd_event_wake_cnt_used; /* Number of cmd event wake reasons specific to the driver */ 328 329 int total_driver_fw_local_wake; /* Total count of drive/fw wakes, for local reasons */ 330 int *driver_fw_local_wake_cnt; /* Individual wake count array, each index a reason */ 331 int driver_fw_local_wake_cnt_sz; /* Max number of local driver/fw wake reasons */ 332 int driver_fw_local_wake_cnt_used; /* Number of local driver/fw wake reasons specific to the driver */ 333 334 int total_rx_data_wake; /* total data rx packets, that woke up host */ 335 RX_DATA_WAKE_CNT_DETAILS rx_wake_details; 336 RX_WAKE_PKT_TYPE_CLASSFICATION rx_wake_pkt_classification_info; 337 RX_MULTICAST_WAKE_DATA_CNT rx_multicast_wake_pkt_info; 338 } WLAN_DRIVER_WAKE_REASON_CNT; 339 340 /* include various feature headers */ 341 342 #include "gscan.h" 343 #include "link_layer_stats.h" 344 #include "rtt.h" 345 #include "tdls.h" 346 #include "wifi_logger.h" 347 #include "wifi_config.h" 348 #include "wifi_nan.h" 349 #include "wifi_offload.h" 350 #include "roam.h" 351 352 //wifi HAL function pointer table 353 typedef struct { 354 wifi_error (* wifi_initialize) (wifi_handle *); 355 wifi_error (* wifi_wait_for_driver_ready) (void); 356 void (* wifi_cleanup) (wifi_handle, wifi_cleaned_up_handler); 357 void (*wifi_event_loop)(wifi_handle); 358 void (* wifi_get_error_info) (wifi_error , const char **); 359 wifi_error (* wifi_get_supported_feature_set) (wifi_interface_handle, feature_set *); 360 wifi_error (* wifi_get_concurrency_matrix) (wifi_interface_handle, int, feature_set *, int *); 361 wifi_error (* wifi_set_scanning_mac_oui) (wifi_interface_handle, unsigned char *); 362 wifi_error (* wifi_get_supported_channels)(wifi_handle, int *, wifi_channel *); 363 wifi_error (* wifi_is_epr_supported)(wifi_handle); 364 wifi_error (* wifi_get_ifaces) (wifi_handle , int *, wifi_interface_handle **); 365 wifi_error (* wifi_get_iface_name) (wifi_interface_handle, char *name, size_t); 366 wifi_error (* wifi_set_iface_event_handler) (wifi_request_id,wifi_interface_handle , 367 wifi_event_handler); 368 wifi_error (* wifi_reset_iface_event_handler) (wifi_request_id, wifi_interface_handle); 369 wifi_error (* wifi_start_gscan) (wifi_request_id, wifi_interface_handle, wifi_scan_cmd_params, 370 wifi_scan_result_handler); 371 wifi_error (* wifi_stop_gscan)(wifi_request_id, wifi_interface_handle); 372 wifi_error (* wifi_get_cached_gscan_results)(wifi_interface_handle, byte, int, 373 wifi_cached_scan_results *, int *); 374 wifi_error (* wifi_set_bssid_hotlist)(wifi_request_id, wifi_interface_handle, 375 wifi_bssid_hotlist_params, wifi_hotlist_ap_found_handler); 376 wifi_error (* wifi_reset_bssid_hotlist)(wifi_request_id, wifi_interface_handle); 377 wifi_error (* wifi_set_significant_change_handler)(wifi_request_id, wifi_interface_handle, 378 wifi_significant_change_params, wifi_significant_change_handler); 379 wifi_error (* wifi_reset_significant_change_handler)(wifi_request_id, wifi_interface_handle); 380 wifi_error (* wifi_get_gscan_capabilities)(wifi_interface_handle, wifi_gscan_capabilities *); 381 wifi_error (* wifi_set_link_stats) (wifi_interface_handle, wifi_link_layer_params); 382 wifi_error (* wifi_get_link_stats) (wifi_request_id,wifi_interface_handle, 383 wifi_stats_result_handler); 384 wifi_error (* wifi_clear_link_stats)(wifi_interface_handle,u32, u32 *, u8, u8 *); 385 wifi_error (* wifi_get_valid_channels)(wifi_interface_handle,int, int, wifi_channel *, int *); 386 wifi_error (* wifi_rtt_range_request)(wifi_request_id, wifi_interface_handle, unsigned, 387 wifi_rtt_config[], wifi_rtt_event_handler); 388 wifi_error (* wifi_rtt_range_cancel)(wifi_request_id, wifi_interface_handle, unsigned, 389 mac_addr[]); 390 wifi_error (* wifi_get_rtt_capabilities)(wifi_interface_handle, wifi_rtt_capabilities *); 391 wifi_error (* wifi_rtt_get_responder_info)(wifi_interface_handle iface, 392 wifi_rtt_responder *responder_info); 393 wifi_error (* wifi_enable_responder)(wifi_request_id id, wifi_interface_handle iface, 394 wifi_channel_info channel_hint, unsigned max_duration_seconds, 395 wifi_rtt_responder *responder_info); 396 wifi_error (* wifi_disable_responder)(wifi_request_id id, wifi_interface_handle iface); 397 wifi_error (* wifi_set_nodfs_flag)(wifi_interface_handle, u32); 398 wifi_error (* wifi_start_logging)(wifi_interface_handle, u32, u32, u32, u32, char *); 399 wifi_error (* wifi_set_epno_list)(wifi_request_id, wifi_interface_handle, 400 const wifi_epno_params *, wifi_epno_handler); 401 wifi_error (* wifi_reset_epno_list)(wifi_request_id, wifi_interface_handle); 402 wifi_error (* wifi_set_country_code)(wifi_interface_handle, const char *); 403 wifi_error (* wifi_get_firmware_memory_dump)( wifi_interface_handle iface, 404 wifi_firmware_memory_dump_handler handler); 405 wifi_error (* wifi_set_log_handler)(wifi_request_id id, wifi_interface_handle iface, 406 wifi_ring_buffer_data_handler handler); 407 wifi_error (* wifi_reset_log_handler)(wifi_request_id id, wifi_interface_handle iface); 408 wifi_error (* wifi_set_alert_handler)(wifi_request_id id, wifi_interface_handle iface, 409 wifi_alert_handler handler); 410 wifi_error (* wifi_reset_alert_handler)(wifi_request_id id, wifi_interface_handle iface); 411 wifi_error (* wifi_get_firmware_version)(wifi_interface_handle iface, char *buffer, 412 int buffer_size); 413 wifi_error (* wifi_get_ring_buffers_status)(wifi_interface_handle iface, 414 u32 *num_rings, wifi_ring_buffer_status *status); 415 wifi_error (* wifi_get_logger_supported_feature_set)(wifi_interface_handle iface, 416 unsigned int *support); 417 wifi_error (* wifi_get_ring_data)(wifi_interface_handle iface, char *ring_name); 418 wifi_error (* wifi_enable_tdls)(wifi_interface_handle, mac_addr, wifi_tdls_params *, 419 wifi_tdls_handler); 420 wifi_error (* wifi_disable_tdls)(wifi_interface_handle, mac_addr); 421 wifi_error (*wifi_get_tdls_status) (wifi_interface_handle, mac_addr, wifi_tdls_status *); 422 wifi_error (*wifi_get_tdls_capabilities)(wifi_interface_handle iface, 423 wifi_tdls_capabilities *capabilities); 424 wifi_error (* wifi_get_driver_version)(wifi_interface_handle iface, char *buffer, 425 int buffer_size); 426 wifi_error (* wifi_set_passpoint_list)(wifi_request_id id, wifi_interface_handle iface, 427 int num, wifi_passpoint_network *networks, wifi_passpoint_event_handler handler); 428 wifi_error (* wifi_reset_passpoint_list)(wifi_request_id id, wifi_interface_handle iface); 429 wifi_error (*wifi_set_lci) (wifi_request_id id, wifi_interface_handle iface, 430 wifi_lci_information *lci); 431 wifi_error (*wifi_set_lcr) (wifi_request_id id, wifi_interface_handle iface, 432 wifi_lcr_information *lcr); 433 wifi_error (*wifi_start_sending_offloaded_packet)(wifi_request_id id, 434 wifi_interface_handle iface, u16 ether_type, u8 *ip_packet, 435 u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr, 436 u32 period_msec); 437 wifi_error (*wifi_stop_sending_offloaded_packet)(wifi_request_id id, 438 wifi_interface_handle iface); 439 wifi_error (*wifi_start_rssi_monitoring)(wifi_request_id id, wifi_interface_handle 440 iface, s8 max_rssi, s8 min_rssi, wifi_rssi_event_handler eh); 441 wifi_error (*wifi_stop_rssi_monitoring)(wifi_request_id id, wifi_interface_handle iface); 442 wifi_error (*wifi_get_wake_reason_stats)(wifi_interface_handle iface, 443 WLAN_DRIVER_WAKE_REASON_CNT *wifi_wake_reason_cnt); 444 wifi_error (*wifi_configure_nd_offload)(wifi_interface_handle iface, u8 enable); 445 wifi_error (*wifi_get_driver_memory_dump)(wifi_interface_handle iface, 446 wifi_driver_memory_dump_callbacks callbacks); 447 wifi_error (*wifi_start_pkt_fate_monitoring)(wifi_interface_handle iface); 448 wifi_error (*wifi_get_tx_pkt_fates)(wifi_interface_handle handle, 449 wifi_tx_report *tx_report_bufs, 450 size_t n_requested_fates, 451 size_t *n_provided_fates); 452 wifi_error (*wifi_get_rx_pkt_fates)(wifi_interface_handle handle, 453 wifi_rx_report *rx_report_bufs, 454 size_t n_requested_fates, 455 size_t *n_provided_fates); 456 457 /* NAN functions */ 458 wifi_error (*wifi_nan_enable_request)(transaction_id id, 459 wifi_interface_handle iface, 460 NanEnableRequest* msg); 461 wifi_error (*wifi_nan_disable_request)(transaction_id id, 462 wifi_interface_handle iface); 463 wifi_error (*wifi_nan_publish_request)(transaction_id id, 464 wifi_interface_handle iface, 465 NanPublishRequest* msg); 466 wifi_error (*wifi_nan_publish_cancel_request)(transaction_id id, 467 wifi_interface_handle iface, 468 NanPublishCancelRequest* msg); 469 wifi_error (*wifi_nan_subscribe_request)(transaction_id id, 470 wifi_interface_handle iface, 471 NanSubscribeRequest* msg); 472 wifi_error (*wifi_nan_subscribe_cancel_request)(transaction_id id, 473 wifi_interface_handle iface, 474 NanSubscribeCancelRequest* msg); 475 wifi_error (*wifi_nan_transmit_followup_request)(transaction_id id, 476 wifi_interface_handle iface, 477 NanTransmitFollowupRequest* msg); 478 wifi_error (*wifi_nan_stats_request)(transaction_id id, 479 wifi_interface_handle iface, 480 NanStatsRequest* msg); 481 wifi_error (*wifi_nan_config_request)(transaction_id id, 482 wifi_interface_handle iface, 483 NanConfigRequest* msg); 484 wifi_error (*wifi_nan_tca_request)(transaction_id id, 485 wifi_interface_handle iface, 486 NanTCARequest* msg); 487 wifi_error (*wifi_nan_beacon_sdf_payload_request)(transaction_id id, 488 wifi_interface_handle iface, 489 NanBeaconSdfPayloadRequest* msg); 490 wifi_error (*wifi_nan_register_handler)(wifi_interface_handle iface, 491 NanCallbackHandler handlers); 492 wifi_error (*wifi_nan_get_version)(wifi_handle handle, 493 NanVersion* version); 494 wifi_error (*wifi_nan_get_capabilities)(transaction_id id, 495 wifi_interface_handle iface); 496 wifi_error (*wifi_nan_data_interface_create)(transaction_id id, 497 wifi_interface_handle iface, 498 char *iface_name); 499 wifi_error (*wifi_nan_data_interface_delete)(transaction_id id, 500 wifi_interface_handle iface, 501 char *iface_name); 502 wifi_error (*wifi_nan_data_request_initiator)( 503 transaction_id id, wifi_interface_handle iface, 504 NanDataPathInitiatorRequest *msg); 505 wifi_error (*wifi_nan_data_indication_response)( 506 transaction_id id, wifi_interface_handle iface, 507 NanDataPathIndicationResponse *msg); 508 wifi_error (*wifi_nan_data_end)(transaction_id id, 509 wifi_interface_handle iface, 510 NanDataPathEndRequest *msg); 511 wifi_error (*wifi_select_tx_power_scenario)(wifi_interface_handle iface, 512 wifi_power_scenario scenario); 513 wifi_error (*wifi_reset_tx_power_scenario)(wifi_interface_handle iface); 514 515 /** 516 * Returns the chipset's hardware filtering capabilities: 517 * @param version pointer to version of the packet filter interpreter 518 * supported, filled in upon return. 0 indicates no support. 519 * @param max_len pointer to maximum size of the filter bytecode, filled in 520 * upon return. 521 */ 522 wifi_error (*wifi_get_packet_filter_capabilities)(wifi_interface_handle handle, 523 u32 *version, u32 *max_len); 524 /** 525 * Programs the packet filter. 526 * @param program pointer to the program byte-code. 527 * @param len length of the program byte-code. 528 */ 529 wifi_error (*wifi_set_packet_filter)(wifi_interface_handle handle, 530 const u8 *program, u32 len); 531 wifi_error (*wifi_read_packet_filter)(wifi_interface_handle handle, 532 u32 src_offset, u8 *host_dst, 533 u32 length); 534 wifi_error (*wifi_get_roaming_capabilities)(wifi_interface_handle handle, 535 wifi_roaming_capabilities *caps); 536 wifi_error (*wifi_enable_firmware_roaming)(wifi_interface_handle handle, 537 fw_roaming_state_t state); 538 wifi_error (*wifi_configure_roaming)(wifi_interface_handle handle, 539 wifi_roaming_config *roaming_config); 540 wifi_error (*wifi_set_radio_mode_change_handler)(wifi_request_id id, wifi_interface_handle 541 iface, wifi_radio_mode_change_handler eh); 542 wifi_error (*wifi_set_latency_mode)(wifi_interface_handle iface, 543 wifi_latency_mode mode); 544 wifi_error (*wifi_set_thermal_mitigation_mode)(wifi_handle handle, 545 wifi_thermal_mode mode, 546 u32 completion_window); 547 wifi_error (*wifi_map_dscp_access_category)(wifi_handle handle, 548 u32 start, u32 end, 549 u32 access_category); 550 wifi_error (*wifi_reset_dscp_mapping)(wifi_handle handle); 551 552 wifi_error (*wifi_virtual_interface_create)(wifi_handle handle, const char* ifname, 553 wifi_interface_type iface_type); 554 wifi_error (*wifi_virtual_interface_delete)(wifi_handle handle, const char* ifname); 555 556 } wifi_hal_fn; 557 wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn); 558 #ifdef __cplusplus 559 } 560 #endif 561 562 #endif 563