Update HAL headers
authorSeonah Moon <seonah1.moon@samsung.com>
Thu, 9 Apr 2020 12:09:20 +0000 (21:09 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 9 Apr 2020 12:09:20 +0000 (21:09 +0900)
include/interface/roam.h [new file with mode: 0644]
include/interface/tdls.h [new file with mode: 0644]
include/interface/wifi_config.h [new file with mode: 0644]
include/interface/wifi_hal.h
include/interface/wifi_nan.h
include/interface/wifi_offload.h [new file with mode: 0644]

diff --git a/include/interface/roam.h b/include/interface/roam.h
new file mode 100644 (file)
index 0000000..13e3cd3
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2016 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_HAL_ROAM_H__
+#define __WIFI_HAL_ROAM_H__
+
+#include "wifi_hal.h"
+
+#define MAX_BLACKLIST_BSSID         16
+#define MAX_WHITELIST_SSID          8
+#define MAX_SSID_LENGTH             32
+
+typedef struct {
+    u32 max_blacklist_size;
+    u32 max_whitelist_size;
+} wifi_roaming_capabilities;
+
+typedef enum {
+    ROAMING_DISABLE,
+    ROAMING_ENABLE
+} fw_roaming_state_t;
+
+typedef struct {
+    u32 length;
+    char ssid_str[MAX_SSID_LENGTH];
+} ssid_t;
+
+typedef struct {
+    u32 num_blacklist_bssid;                       // Number of bssids valid in blacklist_bssid[].
+    mac_addr blacklist_bssid[MAX_BLACKLIST_BSSID]; // List of bssids which should not be considered
+                                                   // for romaing by firmware/driver.
+    u32 num_whitelist_ssid;                        // Number of ssids valid in whitelist_ssid[].
+    ssid_t whitelist_ssid[MAX_WHITELIST_SSID];     // List of ssids to which firmware/driver can
+                                                   // consider to roam to.
+} wifi_roaming_config;
+
+/* Get the chipset roaming capabilities. */
+wifi_error wifi_get_roaming_capabilities(wifi_interface_handle handle,
+                                         wifi_roaming_capabilities *caps);
+/* Enable/disable firmware roaming */
+wifi_error wifi_enable_firmware_roaming(wifi_interface_handle handle,
+                                        fw_roaming_state_t state);
+
+/* Pass down the blacklist BSSID and whitelist SSID to firmware. */
+wifi_error wifi_configure_roaming(wifi_interface_handle handle,
+                                  wifi_roaming_config *roaming_config);
+
+#endif /* __WIFI_HAL_ROAM_H__ */
diff --git a/include/interface/tdls.h b/include/interface/tdls.h
new file mode 100644 (file)
index 0000000..9ac225a
--- /dev/null
@@ -0,0 +1,85 @@
+
+#include "wifi_hal.h"
+
+#ifndef _TDLS_H_
+#define _TDLS_H_
+
+typedef enum {
+    WIFI_TDLS_DISABLED = 1,                 /* TDLS is not enabled, default status for all STAs */
+    WIFI_TDLS_ENABLED,                      /* TDLS is enabled, but not yet tried */
+    WIFI_TDLS_ESTABLISHED,                  /* Direct link is established */
+    WIFI_TDLS_ESTABLISHED_OFF_CHANNEL,      /* Direct link is established using MCC */
+    WIFI_TDLS_DROPPED,                      /* Direct link was established,
+                                             * but is temporarily dropped now */
+    WIFI_TDLS_FAILED                        /* TDLS permanent failed. Inform error to upper layer
+                                             * and go back to WIFI_TDLS_DISABLED */
+} wifi_tdls_state;
+
+typedef enum {
+    WIFI_TDLS_SUCCESS,                              /* Success */
+    WIFI_TDLS_UNSPECIFIED           = -1,           /* Unspecified reason */
+    WIFI_TDLS_NOT_SUPPORTED         = -2,           /* Remote side doesn't support TDLS */
+    WIFI_TDLS_UNSUPPORTED_BAND      = -3,           /* Remote side doesn't support this band */
+    WIFI_TDLS_NOT_BENEFICIAL        = -4,           /* Going to AP is better than going direct */
+    WIFI_TDLS_DROPPED_BY_REMOTE     = -5            /* Remote side doesn't want it anymore */
+} wifi_tdls_reason;
+
+typedef struct {
+    int channel;                        /* channel hint, in channel number (NOT frequency ) */
+    int global_operating_class;         /* operating class to use */
+    int max_latency_ms;                 /* max latency that can be tolerated by apps */
+    int min_bandwidth_kbps;             /* bandwidth required by apps, in kilo bits per second */
+} wifi_tdls_params;
+
+typedef struct {
+    int channel;
+    int global_operating_class;
+    wifi_tdls_state state;
+    wifi_tdls_reason reason;
+} wifi_tdls_status;
+
+typedef struct {
+    int max_concurrent_tdls_session_num;      /* Maximum TDLS session number can be supported by the
+                                              * Firmware and hardware*/
+    int is_global_tdls_supported;            /* 1 -- support,  0 -- not support */
+    int is_per_mac_tdls_supported;           /* 1 -- support,  0 -- not support */
+    int is_off_channel_tdls_supported;       /* 1 -- support,  0 -- not support */
+} wifi_tdls_capabilities;
+
+typedef struct {
+    /* on_tdls_state_changed - reports state of TDLS link to framework
+     * Report this event when the state of TDLS link changes */
+    void (*on_tdls_state_changed)(mac_addr addr, wifi_tdls_status status);
+} wifi_tdls_handler;
+
+
+/* wifi_enable_tdls - enables TDLS-auto mode for a specific route
+ *
+ * params specifies hints, which provide more information about
+ * why TDLS is being sought. The firmware should do its best to
+ * honor the hints before downgrading regular AP link
+ * If upper layer has no specific values, this should be NULL
+ *
+ * handler is used to inform the upper layer about the status change and the corresponding reason
+ */
+wifi_error wifi_enable_tdls(wifi_interface_handle iface, mac_addr addr,
+        wifi_tdls_params *params, wifi_tdls_handler handler);
+
+/* wifi_disable_tdls - disables TDLS-auto mode for a specific route
+ *
+ * This terminates any existing TDLS with addr device, and frees the
+ * device resources to make TDLS connections on new routes.
+ *
+ * DON'T fire any more events on 'handler' specified in earlier call to
+ * wifi_enable_tdls after this action.
+ */
+wifi_error wifi_disable_tdls(wifi_interface_handle iface, mac_addr addr);
+
+/* wifi_get_tdls_status - allows getting the status of TDLS for a specific route */
+wifi_error wifi_get_tdls_status(wifi_interface_handle iface, mac_addr addr,
+        wifi_tdls_status *status);
+
+/* return the current HW + Firmware combination's TDLS capabilities */
+wifi_error wifi_get_tdls_capabilities(wifi_interface_handle iface,
+        wifi_tdls_capabilities *capabilities);
+#endif
diff --git a/include/interface/wifi_config.h b/include/interface/wifi_config.h
new file mode 100644 (file)
index 0000000..8ad14f4
--- /dev/null
@@ -0,0 +1,47 @@
+#include "wifi_hal.h"\r
+\r
+#ifndef __WIFI_HAL_CONFIG_H\r
+#define __WIFI_HAL_CONFIG_H\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+#define CONFIG_MAJOR_VERSION      1\r
+#define CONFIG_MINOR_VERSION      0\r
+#define CONFIG_MICRO_VERSION      0\r
+\r
+typedef int wifi_radio;\r
+\r
+// whether the wifi chipset wakes at every dtim beacon or a multiple of the dtim period\r
+// if extended_dtim is set to 3, the STA shall wake up every 3 DTIM beacons\r
+wifi_error wifi_extended_dtim_config_set(wifi_request_id id,\r
+        wifi_interface_handle iface, int extended_dtim);\r
+\r
+//set the country code to driver\r
+wifi_error wifi_set_country_code(wifi_interface_handle iface, const char* country_code);\r
+\r
+//set the wifi_iface stats averaging factor used to calculate\r
+// statistics like average the TSF offset or average number of frame leaked\r
+// For instance, upon beacon reception:\r
+//    current_avg = ((beacon_TSF - TBTT) * factor + previous_avg * (0x10000 - factor) ) / 0x10000\r
+// For instance, when evaluating leaky APs:\r
+//    current_avg = ((num frame received within guard time) * factor + previous_avg * (0x10000 - factor)) / 0x10000\r
+\r
+wifi_error wifi_set_beacon_wifi_iface_stats_averaging_factor(wifi_request_id id, wifi_interface_handle iface,\r
+        u16 factor);\r
+\r
+// configure guard time, i.e. when implementing IEEE power management based on\r
+// frame control PM bit, how long driver waits before shutting down the radio and\r
+// after receiving an ACK for a data frame with PM bit set\r
+wifi_error wifi_set_guard_time(wifi_request_id id, wifi_interface_handle iface,\r
+        u32 guard_time);\r
+\r
+#ifdef __cplusplus\r
+}\r
+\r
+#endif /* __cplusplus */\r
+\r
+#endif /*__WIFI_HAL_STATS_ */\r
+\r
index 649658159f385981841ede95e401b1e0da97b6b7..cdc16dae105228d57701f4a282b6d3ab97712633 100644 (file)
@@ -23,9 +23,7 @@ extern "C"
 #endif
 #include <stdint.h>
 
-#ifndef IFNAMSIZ
 #define IFNAMSIZ 16
-#endif
 
 /* WiFi Common definitions */
 /* channel operating width */
@@ -42,13 +40,21 @@ typedef enum {
 
 /* Pre selected Power scenarios to be applied from BDF file */
 typedef enum {
+    WIFI_POWER_SCENARIO_INVALID          = -2,
+    WIFI_POWER_SCENARIO_DEFAULT          = -1,
     WIFI_POWER_SCENARIO_VOICE_CALL       = 0,
     WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF = 1,
     WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON  = 2,
     WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF = 3,
     WIFI_POWER_SCENARIO_ON_BODY_CELL_ON  = 4,
+    WIFI_POWER_SCENARIO_ON_BODY_BT       = 5,
 } wifi_power_scenario;
 
+typedef enum {
+  WIFI_LATENCY_MODE_NORMAL    = 0,
+  WIFI_LATENCY_MODE_LOW       = 1,
+} wifi_latency_mode;
+
 /*
  * enum wlan_mac_band - Band information corresponding to the WLAN MAC.
  */
@@ -155,6 +161,8 @@ void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer
 #define WIFI_FEATURE_SCAN_RAND          0x2000000   // Support MAC & Probe Sequence Number randomization
 #define WIFI_FEATURE_SET_TX_POWER_LIMIT 0x4000000   // Support Tx Power Limit setting
 #define WIFI_FEATURE_USE_BODY_HEAD_SAR  0x8000000   // Support Using Body/Head Proximity for SAR
+#define WIFI_FEATURE_SET_LATENCY_MODE   0x40000000  // Support Latency mode setting
+#define WIFI_FEATURE_P2P_RAND_MAC       0x80000000  // Support Support P2P MAC randomization
 // Add more features here
 
 
@@ -217,6 +225,7 @@ wifi_error wifi_reset_iface_event_handler(wifi_request_id id, wifi_interface_han
 wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs);
 wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, wifi_power_scenario scenario);
 wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle);
+wifi_error wifi_set_latency_mode(wifi_interface_handle handle, wifi_latency_mode mode);
 
 typedef struct rx_data_cnt_details_t {
     int rx_unicast_cnt;     /*Total rx unicast packet which woke up host */
@@ -270,8 +279,12 @@ typedef struct wlan_driver_wake_reason_cnt_t {
 #include "gscan.h"
 #include "link_layer_stats.h"
 #include "rtt.h"
+#include "tdls.h"
 #include "wifi_logger.h"
+#include "wifi_config.h"
 #include "wifi_nan.h"
+#include "wifi_offload.h"
+#include "roam.h"
 
 //wifi HAL function pointer table
 typedef struct {
@@ -339,14 +352,12 @@ typedef struct {
     wifi_error (* wifi_get_logger_supported_feature_set)(wifi_interface_handle iface,
             unsigned int *support);
     wifi_error (* wifi_get_ring_data)(wifi_interface_handle iface, char *ring_name);
-
-       // TLDS features: not used.
-    wifi_error (* wifi_enable_tdls)(wifi_interface_handle, mac_addr, void *, void *);
+    wifi_error (* wifi_enable_tdls)(wifi_interface_handle, mac_addr, wifi_tdls_params *,
+            wifi_tdls_handler);
     wifi_error (* wifi_disable_tdls)(wifi_interface_handle, mac_addr);
-    wifi_error (*wifi_get_tdls_status) (wifi_interface_handle, mac_addr, void *);
+    wifi_error (*wifi_get_tdls_status) (wifi_interface_handle, mac_addr, wifi_tdls_status *);
     wifi_error (*wifi_get_tdls_capabilities)(wifi_interface_handle iface,
-            void *capabilities);
-
+            wifi_tdls_capabilities *capabilities);
     wifi_error (* wifi_get_driver_version)(wifi_interface_handle iface, char *buffer,
             int buffer_size);
     wifi_error (* wifi_set_passpoint_list)(wifi_request_id id, wifi_interface_handle iface,
@@ -357,8 +368,9 @@ typedef struct {
     wifi_error (*wifi_set_lcr) (wifi_request_id id, wifi_interface_handle iface,
                                     wifi_lcr_information *lcr);
     wifi_error (*wifi_start_sending_offloaded_packet)(wifi_request_id id,
-                                wifi_interface_handle iface, u8 *ip_packet, u16 ip_packet_len,
-                                u8 *src_mac_addr, u8 *dst_mac_addr, u32 period_msec);
+                                wifi_interface_handle iface, u8 *ip_packet,
+                                u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr,
+                                u32 period_msec);
     wifi_error (*wifi_stop_sending_offloaded_packet)(wifi_request_id id,
                                 wifi_interface_handle iface);
     wifi_error (*wifi_start_rssi_monitoring)(wifi_request_id id, wifi_interface_handle
@@ -456,16 +468,16 @@ typedef struct {
     wifi_error (*wifi_read_packet_filter)(wifi_interface_handle handle,
                                           u32 src_offset, u8 *host_dst,
                                           u32 length);
-
-       // NOT USED.
     wifi_error (*wifi_get_roaming_capabilities)(wifi_interface_handle handle,
-                                                void *caps);
+                                                wifi_roaming_capabilities *caps);
     wifi_error (*wifi_enable_firmware_roaming)(wifi_interface_handle handle,
-                                               int state);
+                                               fw_roaming_state_t state);
     wifi_error (*wifi_configure_roaming)(wifi_interface_handle handle,
-                                         void *roaming_config);
+                                         wifi_roaming_config *roaming_config);
     wifi_error (*wifi_set_radio_mode_change_handler)(wifi_request_id id, wifi_interface_handle
                         iface, wifi_radio_mode_change_handler eh);
+    wifi_error (*wifi_set_latency_mode)(wifi_interface_handle iface,
+                                        wifi_latency_mode mode);
 } wifi_hal_fn;
 wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn);
 #ifdef __cplusplus
index b1c216fbd29bc080c942fb11201a96fc97167051..334e37a88ce699f0fe9006bd7114062015b70d07 100644 (file)
@@ -42,7 +42,7 @@ typedef u32 NanDataPathId;
 #define NAN_MAC_ADDR_LEN                6
 #define NAN_MAJOR_VERSION               2
 #define NAN_MINOR_VERSION               0
-#define NAN_MICRO_VERSION               0
+#define NAN_MICRO_VERSION               1
 #define NAN_MAX_SOCIAL_CHANNELS         3
 
 /* NAN Maximum Lengths */
@@ -388,6 +388,7 @@ typedef struct {
     bool is_ndp_security_supported;
     u32 max_sdea_service_specific_info_len;
     u32 max_subscribe_address;
+    u32 ndpe_attr_supported;
 } NanCapabilities;
 
 /*
@@ -1023,6 +1024,15 @@ typedef struct {
     */
     u8 config_dw_early_termination;
     u32 enable_dw_termination;
+    /*
+       Indicate whether to use NDPE attribute to bring-up TCP/IP connection.
+       If config_ndpe_attr is not configured, the default behavior is
+       not using NDPE attr, and the capability is not advertised.
+       0 - Not use
+       1 - Use
+    */
+    u8 config_ndpe_attr;
+    u32 use_ndpe_attr;
 } NanEnableRequest;
 
 /*
@@ -1499,6 +1509,15 @@ typedef struct {
     */
     u8 config_dw_early_termination;
     u32 enable_dw_termination;
+    /*
+       Indicate whether to use NDPE attribute to bring-up TCP/IP connection
+       If config_ndpe_attr is not configured, the default behavior is
+       not using NDPE attr, and the capability is not advertised.
+       0 - Not use
+       1 - Use
+    */
+    u8 config_ndpe_attr;
+    u32 use_ndpe_attr;
 } NanConfigRequest;
 
 /*
diff --git a/include/interface/wifi_offload.h b/include/interface/wifi_offload.h
new file mode 100644 (file)
index 0000000..f0326f1
--- /dev/null
@@ -0,0 +1,31 @@
+#include "wifi_hal.h"
+
+#ifndef __WIFI_HAL_OFFLOAD_H
+#define __WIFI_HAL_OFFLOAD_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#define ETHER_ADDR_LEN         6       // Ethernet frame address length
+#define N_AVAIL_ID             3       // available mkeep_alive IDs from 1 to 3
+#define MKEEP_ALIVE_IP_PKT_MAX 256     // max size of IP packet for keep alive
+
+/**
+ * Send specified keep alive packet periodically.
+ */
+wifi_error wifi_start_sending_offloaded_packet(wifi_request_id id, wifi_interface_handle iface,
+        u8 *ip_packet, u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr, u32 period_msec);
+
+/**
+ * Stop sending keep alive packet.
+ */
+wifi_error wifi_stop_sending_offloaded_packet(wifi_request_id id, wifi_interface_handle iface);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /*__WIFI_HAL_OFFLOAD_H */