From e52b31fd1a567718a1af1a166c86c078c099b140 Mon Sep 17 00:00:00 2001 From: Mohit Ghuley Date: Tue, 11 Aug 2020 18:45:37 +0530 Subject: [PATCH] wlbt: Fix for nl attribute index match for Batch-1 commands. Changes are done to match index of nl attribute in scsc driver and wifi-hal. SCSC-Bug-Id: HOST-13256 Signed-off-by: Mohit Ghuley Change-Id: Id97f25aff0a3b92374cf4633705e9e676c4a97f6 --- Android.bp | 10 +++++- common.h | 6 ++++ roam.cpp | 3 +- soong/Android.bp | 13 ++++++++ soong/slsi_wifi_hal.go | 69 ++++++++++++++++++++++++++++++++++++++++++ wifi_hal.cpp | 14 +++++++++ wifi_offload.cpp | 5 +-- 7 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 soong/Android.bp create mode 100644 soong/slsi_wifi_hal.go diff --git a/Android.bp b/Android.bp index 0ba125c..32c68e6 100644 --- a/Android.bp +++ b/Android.bp @@ -9,10 +9,18 @@ // Make the HAL library // ============================================================ + +slsi_wifi_hal_defaults { + name: "slsiwifihal-defaults-instance", + cppflags: [ + "-Wno-unused-parameter", + ], +} + cc_library_static { name: "libwifi-hal-slsi", - cflags: ["-Wno-unused-parameter"], + defaults: ["slsiwifihal-defaults-instance"], include_dirs: [ "system/core/include/", diff --git a/common.h b/common.h index e9ea548..f607535 100755 --- a/common.h +++ b/common.h @@ -19,6 +19,12 @@ #define DEFAULT_CMD_SIZE (64) #define DOT11_OUI_LEN 3 +#ifdef SLSI_WIFI_HAL_NL_ATTR_CONFIG +#define WIFI_HAL_ATTR_START 1 +#else +#define WIFI_HAL_ATTR_START 0 +#endif + typedef struct { int num_bssid; mac_addr bssids[MAX_BLACKLIST_BSSID]; diff --git a/roam.cpp b/roam.cpp index 1d79b9d..d3b8f41 100755 --- a/roam.cpp +++ b/roam.cpp @@ -32,7 +32,8 @@ enum roam_attributes { SLSI_ATTR_ROAM_CAPABILITY_BLACKLIST_SIZE, SLSI_ATTR_ROAM_CAPABILITY_WHITELIST_SIZE, - SLSI_ATTR_ROAM_STATE + SLSI_ATTR_ROAM_STATE, + SLSI_ATTR_ROAM_MAX }; class BssidBlacklistCommand : public WifiCommand diff --git a/soong/Android.bp b/soong/Android.bp new file mode 100644 index 0000000..25ac12e --- /dev/null +++ b/soong/Android.bp @@ -0,0 +1,13 @@ +bootstrap_go_package { + name: "soong-slsi-wifi-hal", + pkgPath: "android/soong/hardware/samsung_slsi/scsc_wifibt/wifi_hal", + deps: [ + "soong", + "soong-android", + "soong-cc" + ], + srcs: [ + "slsi_wifi_hal.go" + ], + pluginFor: ["soong_build"] +} diff --git a/soong/slsi_wifi_hal.go b/soong/slsi_wifi_hal.go new file mode 100644 index 0000000..fb8b747 --- /dev/null +++ b/soong/slsi_wifi_hal.go @@ -0,0 +1,69 @@ +package slsi_wifi_hal + +import ( + "android/soong/android" + "android/soong/cc" +) + +func globalFlags(ctx android.BaseContext) []string { + var cflags []string + + slsiwifihalconfig := ctx.DeviceConfig().WifiHalConfig() + if (slsiwifihalconfig == "true") { + cflags = append(cflags, "-DSLSI_WIFI_HAL_NL_ATTR_CONFIG") + } + return cflags +} + +func deviceFlags(ctx android.BaseContext) []string { + var cflags []string + + return cflags +} + +func hostFlags(ctx android.BaseContext) []string { + var cflags []string + + return cflags +} + +func slsiWifiHalDefaults(ctx android.LoadHookContext) { + type props struct { + Target struct { + Android struct { + Cflags []string + Enabled *bool + } + Host struct { + Enabled *bool + } + Linux struct { + Cflags []string + } + Darwin struct { + Cflags []string + } + } + Cflags []string + } + + p := &props{} + p.Cflags = globalFlags(ctx) + p.Target.Android.Cflags = deviceFlags(ctx) + h := hostFlags(ctx) + p.Target.Linux.Cflags = h + p.Target.Darwin.Cflags = h + + ctx.AppendProperties(p) +} + +func init() { + android.RegisterModuleType("slsi_wifi_hal_defaults", slsiWifiHalDefaultsFactory) +} + +func slsiWifiHalDefaultsFactory() android.Module { + module := cc.DefaultsFactory() + android.AddLoadHook(module, slsiWifiHalDefaults) + + return module +} diff --git a/wifi_hal.cpp b/wifi_hal.cpp index 11d32f0..1cf3116 100755 --- a/wifi_hal.cpp +++ b/wifi_hal.cpp @@ -39,8 +39,10 @@ #define FEATURE_SET 0 #define FEATURE_SET_MATRIX 1 #define ATTR_NODFS_VALUE 3 +#ifndef SLSI_WIFI_HAL_NL_ATTR_CONFIG #define ATTR_COUNTRY_CODE 4 #define ATTR_LOW_LATENCY_MODE 5 +#endif static int internal_no_seq_check(nl_msg *msg, void *arg); static int internal_valid_message_handler(nl_msg *msg, void *arg); @@ -72,6 +74,18 @@ enum apf_request_type { READ_APF_PROGRAM }; +#ifdef SLSI_WIFI_HAL_NL_ATTR_CONFIG +enum wifi_low_latency_attr { + ATTR_LOW_LATENCY_MODE = 1, + ATTR_LOW_LATENCY_MAX +}; + +enum country_code_attr { + ATTR_COUNTRY_CODE = 1, + ATTR_COUNTRY_CODE_MAX +}; +#endif + static wifi_error wifi_start_rssi_monitoring(wifi_request_id id, wifi_interface_handle iface, s8 max_rssi, s8 min_rssi, wifi_rssi_event_handler eh); static wifi_error wifi_stop_rssi_monitoring(wifi_request_id id, wifi_interface_handle iface); diff --git a/wifi_offload.cpp b/wifi_offload.cpp index f20ce46..a58bf38 100755 --- a/wifi_offload.cpp +++ b/wifi_offload.cpp @@ -27,12 +27,13 @@ #include "cpp_bindings.h" typedef enum { - MKEEP_ALIVE_ATTRIBUTE_ID, + MKEEP_ALIVE_ATTRIBUTE_ID = WIFI_HAL_ATTR_START, MKEEP_ALIVE_ATTRIBUTE_IP_PKT, MKEEP_ALIVE_ATTRIBUTE_IP_PKT_LEN, MKEEP_ALIVE_ATTRIBUTE_SRC_MAC_ADDR, MKEEP_ALIVE_ATTRIBUTE_DST_MAC_ADDR, - MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC + MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC, + MKEEP_ALIVE_ATTRIBUTE_MAX } WIFI_MKEEP_ALIVE_ATTRIBUTE; typedef enum { -- 2.20.1