summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsiu-Chang Chen <hsiuchangchen@google.com>2022-11-25 14:51:10 +0530
committerHsiu-Chang Chen <hsiuchangchen@google.com>2022-12-01 18:15:30 +0800
commit52b7165a3c8580dc5c8c584477af2cd634cf33a0 (patch)
tree296509f2879cb2fa63e343f9b79a35124fb8713a
parentd1af76e8d7577358d03fd9045e18942e21e0a82e (diff)
downloadwlan-android13-qpr3-c-s7-release.tar.gz
Framework invokes wifi_set_voip_mode (hal api) to configure wifi calling (wfc) state in underlying wlan driver/firmware. Later driver/firmware uses this information to optimize power, rate adaption etc. Bug: 251265470 Test: Regression Test Change-Id: I0858147d932797030e51addb29649e1b6bc67780 CRs:Fixed: 3346100
-rw-r--r--wcn6740/qcwcn/wifi_hal/wifi_hal.cpp3
-rw-r--r--wcn6740/qcwcn/wifi_hal/wificonfig.cpp75
2 files changed, 78 insertions, 0 deletions
diff --git a/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp b/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp
index 4e0d0da..ae4c91c 100644
--- a/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp
+++ b/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp
@@ -146,6 +146,8 @@ static int wifi_is_nan_ext_cmd_supported(wifi_interface_handle handle);
wifi_error
wifi_init_tcp_param_change_event_handler(wifi_interface_handle iface);
+wifi_error wifi_set_voip_mode(wifi_interface_handle iface, wifi_voip_mode mode);
+
/* Initialize/Cleanup */
wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name)
@@ -1086,6 +1088,7 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn) {
fn->wifi_multi_sta_set_use_case = wifi_multi_sta_set_use_case;
fn->wifi_set_coex_unsafe_channels = wifi_set_coex_unsafe_channels;
fn->wifi_set_dtim_config = wifi_set_dtim_config;
+ fn->wifi_set_voip_mode = wifi_set_voip_mode;
fn->wifi_get_usable_channels = wifi_get_usable_channels;
return WIFI_SUCCESS;
diff --git a/wcn6740/qcwcn/wifi_hal/wificonfig.cpp b/wcn6740/qcwcn/wifi_hal/wificonfig.cpp
index 989399f..5aec138 100644
--- a/wcn6740/qcwcn/wifi_hal/wificonfig.cpp
+++ b/wcn6740/qcwcn/wifi_hal/wificonfig.cpp
@@ -1453,3 +1453,78 @@ cleanup:
delete wifiConfigCommand;
return (wifi_error)ret;
}
+
+/**
+ * Invoked to set voip optimization mode for the provided STA iface
+ */
+ wifi_error wifi_set_voip_mode(wifi_interface_handle iface, wifi_voip_mode mode)
+{
+ int requestId, ret = 0;
+ WiFiConfigCommand *wifiConfigCommand;
+
+ struct nlattr *nlData;
+ interface_info *ifaceInfo = getIfaceInfo(iface);
+
+ wifi_handle wifiHandle = getWifiHandle(iface);
+ if (!wifiHandle) {
+ ALOGE("%s: Error wifi_handle NULL", __FUNCTION__);
+ return WIFI_ERROR_UNKNOWN;
+ }
+
+ requestId = get_requestid();
+ ALOGV("%s: voip mode=%d", __FUNCTION__, mode);
+ wifiConfigCommand = new WiFiConfigCommand(
+ wifiHandle,
+ requestId,
+ OUI_QCA,
+ QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION);
+
+ if (wifiConfigCommand == NULL) {
+ ALOGE("%s: Error wifiConfigCommand NULL", __FUNCTION__);
+ return WIFI_ERROR_UNKNOWN;
+ }
+
+ /* Create the NL message. */
+ ret = wifiConfigCommand->create();
+ if (ret < 0) {
+ ALOGE("%s: failed to create NL msg. Error:%d",
+ __FUNCTION__, ret);
+ goto cleanup;
+ }
+
+ /* Set the interface Id of the message. */
+ ret = wifiConfigCommand->set_iface_id(ifaceInfo->name);
+ if (ret < 0) {
+ ALOGE("%s: failed to set iface id. Error:%d",
+ __FUNCTION__, ret);
+ goto cleanup;
+ }
+
+ /* Add the vendor specific attributes for the NL command. */
+ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA);
+ if (!nlData) {
+ ALOGE("%s: failed attr_start for VENDOR_DATA. Error:%d",
+ __FUNCTION__, ret);
+ goto cleanup;
+ }
+
+ if (wifiConfigCommand->put_u8(
+ QCA_WLAN_VENDOR_ATTR_CONFIG_WFC_STATE, (u8)mode)) {
+ ALOGE("%s: failed to put vendor data. Error:%d",
+ __FUNCTION__, ret);
+ goto cleanup;
+ }
+ wifiConfigCommand->attr_end(nlData);
+
+ /* Send the NL msg. */
+ wifiConfigCommand->waitForRsp(false);
+ ret = wifiConfigCommand->requestEvent();
+ if (ret != 0) {
+ ALOGE("%s: requestEvent Error:%d", __FUNCTION__, ret);
+ goto cleanup;
+ }
+
+cleanup:
+ delete wifiConfigCommand;
+ return (wifi_error)ret;
+}