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_VOICE_CALL       = 0,
44     WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF = 1,
45     WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON  = 2,
46     WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF = 3,
47     WIFI_POWER_SCENARIO_ON_BODY_CELL_ON  = 4,
48 } wifi_power_scenario;
49 
50 /*
51  * enum wlan_mac_band - Band information corresponding to the WLAN MAC.
52  */
53 typedef enum {
54 /* WLAN MAC Operates in 2.4 GHz Band */
55     WLAN_MAC_2_4_BAND = 1 << 0,
56 /* WLAN MAC Operates in 5 GHz Band */
57     WLAN_MAC_5_0_BAND = 1 << 1
58 } wlan_mac_band;
59 
60 typedef int wifi_radio;
61 typedef int wifi_channel;
62 
63 typedef struct {
64     wifi_channel_width width;
65     int center_frequency0;
66     int center_frequency1;
67     int primary_frequency;
68 } wifi_channel_spec;
69 
70 typedef enum {
71     WIFI_SUCCESS = 0,
72     WIFI_ERROR_NONE = 0,
73     WIFI_ERROR_UNKNOWN = -1,
74     WIFI_ERROR_UNINITIALIZED = -2,
75     WIFI_ERROR_NOT_SUPPORTED = -3,
76     WIFI_ERROR_NOT_AVAILABLE = -4,              // Not available right now, but try later
77     WIFI_ERROR_INVALID_ARGS = -5,
78     WIFI_ERROR_INVALID_REQUEST_ID = -6,
79     WIFI_ERROR_TIMED_OUT = -7,
80     WIFI_ERROR_TOO_MANY_REQUESTS = -8,          // Too many instances of this request
81     WIFI_ERROR_OUT_OF_MEMORY = -9,
82     WIFI_ERROR_BUSY = -10,
83 } wifi_error;
84 
85 typedef unsigned char byte;
86 typedef unsigned char u8;
87 typedef signed char s8;
88 typedef uint16_t u16;
89 typedef uint32_t u32;
90 typedef int32_t s32;
91 typedef uint64_t u64;
92 typedef int64_t s64;
93 typedef int wifi_request_id;
94 typedef int wifi_channel;                       // indicates channel frequency in MHz
95 typedef int wifi_rssi;
96 typedef byte mac_addr[6];
97 typedef byte oui[3];
98 typedef int64_t wifi_timestamp;                 // In microseconds (us)
99 typedef int64_t wifi_timespan;                  // In picoseconds  (ps)
100 
101 struct wifi_info;
102 struct wifi_interface_info;
103 typedef struct wifi_info *wifi_handle;
104 typedef struct wifi_interface_info *wifi_interface_handle;
105 
106 /* Initialize/Cleanup */
107 
108 wifi_error wifi_initialize(wifi_handle *handle);
109 
110 /**
111  * wifi_wait_for_driver
112  * Function should block until the driver is ready to proceed.
113  * Any errors from this function is considered fatal & will fail the HAL startup sequence.
114  *
115  * on success returns WIFI_SUCCESS
116  * on failure returns WIFI_ERROR_TIMED_OUT
117  */
118 wifi_error wifi_wait_for_driver_ready(void);
119 
120 typedef void (*wifi_cleaned_up_handler) (wifi_handle handle);
121 void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler);
122 void wifi_event_loop(wifi_handle handle);
123 
124 /* Error handling */
125 void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer to a static string
126 
127 /* Feature enums */
128 #define WIFI_FEATURE_INFRA              0x0001      // Basic infrastructure mode
129 #define WIFI_FEATURE_INFRA_5G           0x0002      // Support for 5 GHz Band
130 #define WIFI_FEATURE_HOTSPOT            0x0004      // Support for GAS/ANQP
131 #define WIFI_FEATURE_P2P                0x0008      // Wifi-Direct
132 #define WIFI_FEATURE_SOFT_AP            0x0010      // Soft AP
133 #define WIFI_FEATURE_GSCAN              0x0020      // Google-Scan APIs
134 #define WIFI_FEATURE_NAN                0x0040      // Neighbor Awareness Networking
135 #define WIFI_FEATURE_D2D_RTT            0x0080      // Device-to-device RTT
136 #define WIFI_FEATURE_D2AP_RTT           0x0100      // Device-to-AP RTT
137 #define WIFI_FEATURE_BATCH_SCAN         0x0200      // Batched Scan (legacy)
138 #define WIFI_FEATURE_PNO                0x0400      // Preferred network offload
139 #define WIFI_FEATURE_ADDITIONAL_STA     0x0800      // Support for two STAs
140 #define WIFI_FEATURE_TDLS               0x1000      // Tunnel directed link setup
141 #define WIFI_FEATURE_TDLS_OFFCHANNEL    0x2000      // Support for TDLS off channel
142 #define WIFI_FEATURE_EPR                0x4000      // Enhanced power reporting
143 #define WIFI_FEATURE_AP_STA             0x8000      // Support for AP STA Concurrency
144 #define WIFI_FEATURE_LINK_LAYER_STATS   0x10000     // Link layer stats collection
145 #define WIFI_FEATURE_LOGGER             0x20000     // WiFi Logger
146 #define WIFI_FEATURE_HAL_EPNO           0x40000     // WiFi PNO enhanced
147 #define WIFI_FEATURE_RSSI_MONITOR       0x80000     // RSSI Monitor
148 #define WIFI_FEATURE_MKEEP_ALIVE        0x100000    // WiFi mkeep_alive
149 #define WIFI_FEATURE_CONFIG_NDO         0x200000    // ND offload configure
150 #define WIFI_FEATURE_TX_TRANSMIT_POWER  0x400000    // Capture Tx transmit power levels
151 #define WIFI_FEATURE_CONTROL_ROAMING    0x800000    // Enable/Disable firmware roaming
152 #define WIFI_FEATURE_IE_WHITELIST       0x1000000   // Support Probe IE white listing
153 #define WIFI_FEATURE_SCAN_RAND          0x2000000   // Support MAC & Probe Sequence Number randomization
154 #define WIFI_FEATURE_SET_TX_POWER_LIMIT 0x4000000   // Support Tx Power Limit setting
155 #define WIFI_FEATURE_USE_BODY_HEAD_SAR  0x8000000   // Support Using Body/Head Proximity for SAR
156 // Add more features here
157 
158 
159 typedef int feature_set;
160 
161 #define IS_MASK_SET(mask, flags)        (((flags) & (mask)) == (mask))
162 
163 #define IS_SUPPORTED_FEATURE(feature, featureSet)       IS_MASK_SET(feature, featureSet)
164 
165 /* Feature set */
166 wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_set *set);
167 
168 /*
169  * Each row represents a valid feature combination;
170  * all other combinations are invalid!
171  */
172 wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, int set_size_max,
173         feature_set set[], int *set_size);
174 
175 /* multiple interface support */
176 
177 wifi_error wifi_get_ifaces(wifi_handle handle, int *num_ifaces, wifi_interface_handle **ifaces);
178 wifi_error wifi_get_iface_name(wifi_interface_handle iface, char *name, size_t size);
179 wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name);
180 
181 /* Configuration events */
182 
183 typedef struct {
184     void (*on_country_code_changed)(char code[2]);      // We can get this from supplicant too
185 
186     // More event handlers
187 } wifi_event_handler;
188 
189 typedef struct {
190     char iface_name[IFNAMSIZ + 1];
191     wifi_channel channel;
192 } wifi_iface_info;
193 
194 typedef struct {
195     u32 wlan_mac_id;
196 /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */
197     u32 mac_band;
198 /* Represents the connected Wi-Fi interfaces associated with each MAC */
199     int num_iface;
200     wifi_iface_info *iface_info;
201 } wifi_mac_info;
202 
203 typedef struct {
204         void (*on_radio_mode_change)(wifi_request_id id, unsigned num_mac,
205                                      wifi_mac_info *mac_info);
206 } wifi_radio_mode_change_handler;
207 
208 typedef struct {
209         void (*on_rssi_threshold_breached)(wifi_request_id id, u8 *cur_bssid, s8 cur_rssi);
210 } wifi_rssi_event_handler;
211 
212 wifi_error wifi_set_iface_event_handler(wifi_request_id id, wifi_interface_handle iface, wifi_event_handler eh);
213 wifi_error wifi_reset_iface_event_handler(wifi_request_id id, wifi_interface_handle iface);
214 
215 wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs);
216 wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, wifi_power_scenario scenario);
217 wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle);
218 
219 typedef struct rx_data_cnt_details_t {
220     int rx_unicast_cnt;     /*Total rx unicast packet which woke up host */
221     int rx_multicast_cnt;   /*Total rx multicast packet which woke up host */
222     int rx_broadcast_cnt;   /*Total rx broadcast packet which woke up host */
223 } RX_DATA_WAKE_CNT_DETAILS;
224 
225 typedef struct rx_wake_pkt_type_classification_t {
226     int icmp_pkt;   /*wake icmp packet count */
227     int icmp6_pkt;  /*wake icmp6 packet count */
228     int icmp6_ra;   /*wake icmp6 RA packet count */
229     int icmp6_na;   /*wake icmp6 NA packet count */
230     int icmp6_ns;   /*wake icmp6 NS packet count */
231     //ToDo: Any more interesting classification to add?
232 } RX_WAKE_PKT_TYPE_CLASSFICATION;
233 
234 typedef struct rx_multicast_cnt_t{
235     int ipv4_rx_multicast_addr_cnt; /*Rx wake packet was ipv4 multicast */
236     int ipv6_rx_multicast_addr_cnt; /*Rx wake packet was ipv6 multicast */
237     int other_rx_multicast_addr_cnt;/*Rx wake packet was non-ipv4 and non-ipv6*/
238 } RX_MULTICAST_WAKE_DATA_CNT;
239 
240 /*
241  * Structure holding all the driver/firmware wake count reasons.
242  *
243  * Buffers for the array fields (cmd_event_wake_cnt/driver_fw_local_wake_cnt)
244  * are allocated and freed by the framework. The size of each allocated
245  * array is indicated by the corresponding |_cnt| field. HAL needs to fill in
246  * the corresponding |_used| field to indicate the number of elements used in
247  * the array.
248  */
249 typedef struct wlan_driver_wake_reason_cnt_t {
250     int total_cmd_event_wake;    /* Total count of cmd event wakes */
251     int *cmd_event_wake_cnt;     /* Individual wake count array, each index a reason */
252     int cmd_event_wake_cnt_sz;   /* Max number of cmd event wake reasons */
253     int cmd_event_wake_cnt_used; /* Number of cmd event wake reasons specific to the driver */
254 
255     int total_driver_fw_local_wake;    /* Total count of drive/fw wakes, for local reasons */
256     int *driver_fw_local_wake_cnt;     /* Individual wake count array, each index a reason */
257     int driver_fw_local_wake_cnt_sz;   /* Max number of local driver/fw wake reasons */
258     int driver_fw_local_wake_cnt_used; /* Number of local driver/fw wake reasons specific to the driver */
259 
260     int total_rx_data_wake;     /* total data rx packets, that woke up host */
261     RX_DATA_WAKE_CNT_DETAILS rx_wake_details;
262     RX_WAKE_PKT_TYPE_CLASSFICATION rx_wake_pkt_classification_info;
263     RX_MULTICAST_WAKE_DATA_CNT rx_multicast_wake_pkt_info;
264 } WLAN_DRIVER_WAKE_REASON_CNT;
265 
266 /* include various feature headers */
267 
268 #include "gscan.h"
269 #include "link_layer_stats.h"
270 #include "rtt.h"
271 #include "tdls.h"
272 #include "wifi_logger.h"
273 #include "wifi_config.h"
274 #include "wifi_nan.h"
275 #include "wifi_offload.h"
276 #include "roam.h"
277 
278 //wifi HAL function pointer table
279 typedef struct {
280     wifi_error (* wifi_initialize) (wifi_handle *);
281     wifi_error (* wifi_wait_for_driver_ready) (void);
282     void (* wifi_cleanup) (wifi_handle, wifi_cleaned_up_handler);
283     void (*wifi_event_loop)(wifi_handle);
284     void (* wifi_get_error_info) (wifi_error , const char **);
285     wifi_error (* wifi_get_supported_feature_set) (wifi_interface_handle, feature_set *);
286     wifi_error (* wifi_get_concurrency_matrix) (wifi_interface_handle, int, feature_set *, int *);
287     wifi_error (* wifi_set_scanning_mac_oui) (wifi_interface_handle, unsigned char *);
288     wifi_error (* wifi_get_supported_channels)(wifi_handle, int *, wifi_channel *);
289     wifi_error (* wifi_is_epr_supported)(wifi_handle);
290     wifi_error (* wifi_get_ifaces) (wifi_handle , int *, wifi_interface_handle **);
291     wifi_error (* wifi_get_iface_name) (wifi_interface_handle, char *name, size_t);
292     wifi_error (* wifi_set_iface_event_handler) (wifi_request_id,wifi_interface_handle ,
293             wifi_event_handler);
294     wifi_error (* wifi_reset_iface_event_handler) (wifi_request_id, wifi_interface_handle);
295     wifi_error (* wifi_start_gscan) (wifi_request_id, wifi_interface_handle, wifi_scan_cmd_params,
296             wifi_scan_result_handler);
297     wifi_error (* wifi_stop_gscan)(wifi_request_id, wifi_interface_handle);
298     wifi_error (* wifi_get_cached_gscan_results)(wifi_interface_handle, byte, int,
299             wifi_cached_scan_results *, int *);
300     wifi_error (* wifi_set_bssid_hotlist)(wifi_request_id, wifi_interface_handle,
301             wifi_bssid_hotlist_params, wifi_hotlist_ap_found_handler);
302     wifi_error (* wifi_reset_bssid_hotlist)(wifi_request_id, wifi_interface_handle);
303     wifi_error (* wifi_set_significant_change_handler)(wifi_request_id, wifi_interface_handle,
304             wifi_significant_change_params, wifi_significant_change_handler);
305     wifi_error (* wifi_reset_significant_change_handler)(wifi_request_id, wifi_interface_handle);
306     wifi_error (* wifi_get_gscan_capabilities)(wifi_interface_handle, wifi_gscan_capabilities *);
307     wifi_error (* wifi_set_link_stats) (wifi_interface_handle, wifi_link_layer_params);
308     wifi_error (* wifi_get_link_stats) (wifi_request_id,wifi_interface_handle,
309             wifi_stats_result_handler);
310     wifi_error (* wifi_clear_link_stats)(wifi_interface_handle,u32, u32 *, u8, u8 *);
311     wifi_error (* wifi_get_valid_channels)(wifi_interface_handle,int, int, wifi_channel *, int *);
312     wifi_error (* wifi_rtt_range_request)(wifi_request_id, wifi_interface_handle, unsigned,
313             wifi_rtt_config[], wifi_rtt_event_handler);
314     wifi_error (* wifi_rtt_range_cancel)(wifi_request_id,  wifi_interface_handle, unsigned,
315             mac_addr[]);
316     wifi_error (* wifi_get_rtt_capabilities)(wifi_interface_handle, wifi_rtt_capabilities *);
317     wifi_error (* wifi_rtt_get_responder_info)(wifi_interface_handle iface,
318             wifi_rtt_responder *responder_info);
319     wifi_error (* wifi_enable_responder)(wifi_request_id id, wifi_interface_handle iface,
320             wifi_channel_info channel_hint, unsigned max_duration_seconds,
321             wifi_rtt_responder *responder_info);
322     wifi_error (* wifi_disable_responder)(wifi_request_id id, wifi_interface_handle iface);
323     wifi_error (* wifi_set_nodfs_flag)(wifi_interface_handle, u32);
324     wifi_error (* wifi_start_logging)(wifi_interface_handle, u32, u32, u32, u32, char *);
325     wifi_error (* wifi_set_epno_list)(wifi_request_id, wifi_interface_handle,
326             const wifi_epno_params *, wifi_epno_handler);
327     wifi_error (* wifi_reset_epno_list)(wifi_request_id, wifi_interface_handle);
328     wifi_error (* wifi_set_country_code)(wifi_interface_handle, const char *);
329     wifi_error (* wifi_get_firmware_memory_dump)( wifi_interface_handle iface,
330             wifi_firmware_memory_dump_handler handler);
331     wifi_error (* wifi_set_log_handler)(wifi_request_id id, wifi_interface_handle iface,
332         wifi_ring_buffer_data_handler handler);
333     wifi_error (* wifi_reset_log_handler)(wifi_request_id id, wifi_interface_handle iface);
334     wifi_error (* wifi_set_alert_handler)(wifi_request_id id, wifi_interface_handle iface,
335         wifi_alert_handler handler);
336     wifi_error (* wifi_reset_alert_handler)(wifi_request_id id, wifi_interface_handle iface);
337     wifi_error (* wifi_get_firmware_version)(wifi_interface_handle iface, char *buffer,
338             int buffer_size);
339     wifi_error (* wifi_get_ring_buffers_status)(wifi_interface_handle iface,
340             u32 *num_rings, wifi_ring_buffer_status *status);
341     wifi_error (* wifi_get_logger_supported_feature_set)(wifi_interface_handle iface,
342             unsigned int *support);
343     wifi_error (* wifi_get_ring_data)(wifi_interface_handle iface, char *ring_name);
344     wifi_error (* wifi_enable_tdls)(wifi_interface_handle, mac_addr, wifi_tdls_params *,
345             wifi_tdls_handler);
346     wifi_error (* wifi_disable_tdls)(wifi_interface_handle, mac_addr);
347     wifi_error (*wifi_get_tdls_status) (wifi_interface_handle, mac_addr, wifi_tdls_status *);
348     wifi_error (*wifi_get_tdls_capabilities)(wifi_interface_handle iface,
349             wifi_tdls_capabilities *capabilities);
350     wifi_error (* wifi_get_driver_version)(wifi_interface_handle iface, char *buffer,
351             int buffer_size);
352     wifi_error (* wifi_set_passpoint_list)(wifi_request_id id, wifi_interface_handle iface,
353             int num, wifi_passpoint_network *networks, wifi_passpoint_event_handler handler);
354     wifi_error (* wifi_reset_passpoint_list)(wifi_request_id id, wifi_interface_handle iface);
355     wifi_error (*wifi_set_lci) (wifi_request_id id, wifi_interface_handle iface,
356 	                             wifi_lci_information *lci);
357     wifi_error (*wifi_set_lcr) (wifi_request_id id, wifi_interface_handle iface,
358 	                             wifi_lcr_information *lcr);
359     wifi_error (*wifi_start_sending_offloaded_packet)(wifi_request_id id,
360                                 wifi_interface_handle iface, u8 *ip_packet, u16 ip_packet_len,
361                                 u8 *src_mac_addr, u8 *dst_mac_addr, u32 period_msec);
362     wifi_error (*wifi_stop_sending_offloaded_packet)(wifi_request_id id,
363                                 wifi_interface_handle iface);
364     wifi_error (*wifi_start_rssi_monitoring)(wifi_request_id id, wifi_interface_handle
365                         iface, s8 max_rssi, s8 min_rssi, wifi_rssi_event_handler eh);
366     wifi_error (*wifi_stop_rssi_monitoring)(wifi_request_id id, wifi_interface_handle iface);
367     wifi_error (*wifi_get_wake_reason_stats)(wifi_interface_handle iface,
368                                 WLAN_DRIVER_WAKE_REASON_CNT *wifi_wake_reason_cnt);
369     wifi_error (*wifi_configure_nd_offload)(wifi_interface_handle iface, u8 enable);
370     wifi_error (*wifi_get_driver_memory_dump)(wifi_interface_handle iface,
371                                 wifi_driver_memory_dump_callbacks callbacks);
372     wifi_error (*wifi_start_pkt_fate_monitoring)(wifi_interface_handle iface);
373     wifi_error (*wifi_get_tx_pkt_fates)(wifi_interface_handle handle,
374         wifi_tx_report *tx_report_bufs,
375         size_t n_requested_fates,
376         size_t *n_provided_fates);
377     wifi_error (*wifi_get_rx_pkt_fates)(wifi_interface_handle handle,
378         wifi_rx_report *rx_report_bufs,
379         size_t n_requested_fates,
380         size_t *n_provided_fates);
381 
382     /* NAN functions */
383     wifi_error (*wifi_nan_enable_request)(transaction_id id,
384         wifi_interface_handle iface,
385         NanEnableRequest* msg);
386     wifi_error (*wifi_nan_disable_request)(transaction_id id,
387         wifi_interface_handle iface);
388     wifi_error (*wifi_nan_publish_request)(transaction_id id,
389         wifi_interface_handle iface,
390         NanPublishRequest* msg);
391     wifi_error (*wifi_nan_publish_cancel_request)(transaction_id id,
392         wifi_interface_handle iface,
393         NanPublishCancelRequest* msg);
394     wifi_error (*wifi_nan_subscribe_request)(transaction_id id,
395         wifi_interface_handle iface,
396         NanSubscribeRequest* msg);
397     wifi_error (*wifi_nan_subscribe_cancel_request)(transaction_id id,
398         wifi_interface_handle iface,
399         NanSubscribeCancelRequest* msg);
400     wifi_error (*wifi_nan_transmit_followup_request)(transaction_id id,
401         wifi_interface_handle iface,
402         NanTransmitFollowupRequest* msg);
403     wifi_error (*wifi_nan_stats_request)(transaction_id id,
404         wifi_interface_handle iface,
405         NanStatsRequest* msg);
406     wifi_error (*wifi_nan_config_request)(transaction_id id,
407         wifi_interface_handle iface,
408         NanConfigRequest* msg);
409     wifi_error (*wifi_nan_tca_request)(transaction_id id,
410         wifi_interface_handle iface,
411         NanTCARequest* msg);
412     wifi_error (*wifi_nan_beacon_sdf_payload_request)(transaction_id id,
413         wifi_interface_handle iface,
414         NanBeaconSdfPayloadRequest* msg);
415     wifi_error (*wifi_nan_register_handler)(wifi_interface_handle iface,
416         NanCallbackHandler handlers);
417     wifi_error (*wifi_nan_get_version)(wifi_handle handle,
418         NanVersion* version);
419     wifi_error (*wifi_nan_get_capabilities)(transaction_id id,
420         wifi_interface_handle iface);
421     wifi_error (*wifi_nan_data_interface_create)(transaction_id id,
422                                                  wifi_interface_handle iface,
423                                                  char *iface_name);
424     wifi_error (*wifi_nan_data_interface_delete)(transaction_id id,
425                                                  wifi_interface_handle iface,
426                                                  char *iface_name);
427     wifi_error (*wifi_nan_data_request_initiator)(
428         transaction_id id, wifi_interface_handle iface,
429         NanDataPathInitiatorRequest *msg);
430     wifi_error (*wifi_nan_data_indication_response)(
431         transaction_id id, wifi_interface_handle iface,
432         NanDataPathIndicationResponse *msg);
433     wifi_error (*wifi_nan_data_end)(transaction_id id,
434                                     wifi_interface_handle iface,
435                                     NanDataPathEndRequest *msg);
436     wifi_error (*wifi_select_tx_power_scenario)(wifi_interface_handle iface,
437                                                 wifi_power_scenario scenario);
438     wifi_error (*wifi_reset_tx_power_scenario)(wifi_interface_handle iface);
439 
440     /**
441      * Returns the chipset's hardware filtering capabilities:
442      * @param version pointer to version of the packet filter interpreter
443      *                supported, filled in upon return. 0 indicates no support.
444      * @param max_len pointer to maximum size of the filter bytecode, filled in
445      *                upon return.
446      */
447     wifi_error (*wifi_get_packet_filter_capabilities)(wifi_interface_handle handle,
448                                                       u32 *version, u32 *max_len);
449     /**
450      * Programs the packet filter.
451      * @param program pointer to the program byte-code.
452      * @param len length of the program byte-code.
453      */
454     wifi_error (*wifi_set_packet_filter)(wifi_interface_handle handle,
455                                          const u8 *program, u32 len);
456     wifi_error (*wifi_read_packet_filter)(wifi_interface_handle handle,
457                                           u32 src_offset, u8 *host_dst,
458                                           u32 length);
459     wifi_error (*wifi_get_roaming_capabilities)(wifi_interface_handle handle,
460                                                 wifi_roaming_capabilities *caps);
461     wifi_error (*wifi_enable_firmware_roaming)(wifi_interface_handle handle,
462                                                fw_roaming_state_t state);
463     wifi_error (*wifi_configure_roaming)(wifi_interface_handle handle,
464                                          wifi_roaming_config *roaming_config);
465     wifi_error (*wifi_set_radio_mode_change_handler)(wifi_request_id id, wifi_interface_handle
466                         iface, wifi_radio_mode_change_handler eh);
467 } wifi_hal_fn;
468 wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn);
469 #ifdef __cplusplus
470 }
471 #endif
472 
473 #endif
474