From f8204f99b1e1937f964d3a36ae553a2f4239000b Mon Sep 17 00:00:00 2001 From: Abhishek Chaudhary Date: Wed, 31 Jul 2019 16:09:43 +0530 Subject: [PATCH] [APR-1563] wlbt: HAL changes for wifi low latency mode When Wi-Fi Low latency lock is enabled: - PS will be disabled - Soft roam will be disabled Change-Id: I4efbcb8eac4c442a36214875af6f10007ae4efa9 SCSC-Bug-Id: HOST-10487 Signed-off-by: Abhishek Chaudhary --- common.h | 1 + wifi_hal.cpp | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/common.h b/common.h index c100b4d..2ebf763 100755 --- a/common.h +++ b/common.h @@ -156,6 +156,7 @@ typedef enum { SLSI_NL80211_VENDOR_SUBCMD_CONFIGURE_ND_OFFLOAD, SLSI_NL80211_VENDOR_SUBCMD_GET_ROAMING_CAPABILITIES, SLSI_NL80211_VENDOR_SUBCMD_SET_ROAMING_STATE, + SLSI_NL80211_VENDOR_SUBCMD_SET_LATENCY_MODE, SLSI_NL80211_VENDOR_SUBCMD_NAN_ENABLE = ANDROID_NL80211_SUBCMD_NAN_RANGE_START, SLSI_NL80211_VENDOR_SUBCMD_NAN_DISABLE, diff --git a/wifi_hal.cpp b/wifi_hal.cpp index d48e814..6e0ab1c 100755 --- a/wifi_hal.cpp +++ b/wifi_hal.cpp @@ -40,6 +40,7 @@ #define FEATURE_SET_MATRIX 1 #define ATTR_NODFS_VALUE 3 #define ATTR_COUNTRY_CODE 4 +#define ATTR_LOW_LATENCY_MODE 5 static int internal_no_seq_check(nl_msg *msg, void *arg); static int internal_valid_message_handler(nl_msg *msg, void *arg); @@ -408,6 +409,7 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn) fn->wifi_get_packet_filter_capabilities = wifi_get_packet_filter_capabilities; fn->wifi_set_packet_filter = wifi_set_packet_filter; fn->wifi_read_packet_filter = wifi_read_packet_filter; + fn->wifi_set_latency_mode = wifi_set_latency_mode; return WIFI_SUCCESS; } @@ -1059,7 +1061,33 @@ protected: }; +class SetLatencyLockCommand : public WifiCommand { +private: + wifi_latency_mode mMode; +public: + SetLatencyLockCommand(wifi_interface_handle handle, wifi_latency_mode mode) + : WifiCommand(handle, 0) { + mMode = mode; + } + virtual int create() { + int ret; + + ret = mMsg.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_LATENCY_MODE); + if (ret < 0) { + ALOGE("Can't create message to send to driver - %d", ret); + return ret; + } + nlattr *data = mMsg.attr_start(NL80211_ATTR_VENDOR_DATA); + ret = mMsg.put_u8(ATTR_LOW_LATENCY_MODE, mMode); + if (ret < 0) { + return ret; + } + + mMsg.attr_end(data); + return WIFI_SUCCESS; + } +}; static int wifi_get_multicast_id(wifi_handle handle, const char *name, const char *group) { @@ -1218,6 +1246,9 @@ wifi_error wifi_set_country_code(wifi_interface_handle handle, const char *count return (wifi_error) command.requestResponse(); } - +wifi_error wifi_set_latency_mode(wifi_interface_handle handle, wifi_latency_mode mode) { + SetLatencyLockCommand cmd(handle, mode); + return (wifi_error) cmd.requestResponse(); +} ///////////////////////////////////////////////////////////////////////////// -- 2.20.1