diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-08-25 08:00:25 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-08-25 08:00:25 +0000 |
commit | 14f4aa3eadecdb257bb5b61105db86e1dfd0f1e3 (patch) | |
tree | 75048644db30ed9838e6957aa20255a77c4745c7 | |
parent | 9e5acdc1a062cb4bfc6b1953c5c821a145f78c09 (diff) | |
parent | 1dd37e0ea80e51a9c36a6fe0f61dbd7545dd6219 (diff) | |
download | wlan-14f4aa3eadecdb257bb5b61105db86e1dfd0f1e3.tar.gz |
Snap for 8992082 from 1dd37e0ea80e51a9c36a6fe0f61dbd7545dd6219 to gki13-boot-release
Change-Id: I0ef357fa6b3c77dab3eb569157822e55649d4771
-rw-r--r-- | Android.mk | 4 | ||||
-rw-r--r-- | OWNERS | 3 | ||||
-rw-r--r-- | qcwcn/wifi_hal/common.h | 2 | ||||
-rw-r--r-- | qcwcn/wifi_hal/roam.cpp | 18 | ||||
-rw-r--r-- | qcwcn/wifi_hal/wifi_hal.cpp | 70 | ||||
-rw-r--r-- | qcwcn/wifi_hal/wificonfig.cpp | 2 | ||||
-rw-r--r-- | qcwcn/wifi_hal/wifilogger.cpp | 83 |
7 files changed, 99 insertions, 83 deletions
@@ -1,4 +1,4 @@ -# TODO: Find a better way to separate build configs for ADP vs non-ADP devices -ifneq ($(BOARD_IS_AUTOMOTIVE),true) +#set TARGET_USES_HARDWARE_QCOM_WLAN to false to disable this project. +ifneq ($(TARGET_USES_HARDWARE_QCOM_WLAN),false) include $(call all-subdir-makefiles) endif @@ -1,2 +1,3 @@ -etancohen@google.com arabawy@google.com +etancohen@google.com +kumachang@google.com diff --git a/qcwcn/wifi_hal/common.h b/qcwcn/wifi_hal/common.h index 43b03ce..b0aca97 100644 --- a/qcwcn/wifi_hal/common.h +++ b/qcwcn/wifi_hal/common.h @@ -218,7 +218,9 @@ wifi_error wifi_virtual_interface_delete(wifi_handle handle, const char* ifname) #define max(x, y) ((x) > (y) ? (x) : (y)) #define REQUEST_ID_MAX 1000 +#define REQUEST_ID_U8_MAX 255 #define get_requestid() ((arc4random()%REQUEST_ID_MAX) + 1) +#define get_requestid_u8() ((arc4random()%REQUEST_ID_U8_MAX) + 1) #define WAIT_TIME_FOR_SET_REG_DOMAIN 50000 #ifndef UNUSED diff --git a/qcwcn/wifi_hal/roam.cpp b/qcwcn/wifi_hal/roam.cpp index 047df5a..f2678d0 100644 --- a/qcwcn/wifi_hal/roam.cpp +++ b/qcwcn/wifi_hal/roam.cpp @@ -19,6 +19,9 @@ #include "common.h" #include "roamcommand.h" +#define WLAN_ROAM_MAX_NUM_WHITE_LIST 8 +#define WLAN_ROAM_MAX_NUM_BLACK_LIST 16 + RoamCommand::RoamCommand(wifi_handle handle, int id, u32 vendor_id, u32 subcmd) : WifiVendorCommand(handle, id, vendor_id, subcmd) { @@ -65,8 +68,8 @@ wifi_error wifi_set_bssid_blacklist(wifi_request_id id, wifi_handle wifiHandle = getWifiHandle(iface); hal_info *info = getHalInfo(wifiHandle); - if (!(info->supported_feature_set & WIFI_FEATURE_GSCAN)) { - ALOGE("%s: GSCAN is not supported by driver", + if (!(info->supported_feature_set & WIFI_FEATURE_CONTROL_ROAMING)) { + ALOGE("%s: Roaming is not supported by driver", __FUNCTION__); return WIFI_ERROR_NOT_SUPPORTED; } @@ -246,6 +249,17 @@ wifi_error wifi_get_roaming_capabilities(wifi_interface_handle iface, return WIFI_ERROR_INVALID_ARGS; } + // Per WiFi HAL design, roaming feature should have nothing to do with Gscan + // But for current driver impl, roaming_capa is provided as part of + // GSCAN_GET_CAPABILITY query, so if Gscan is not supported, roaming_capa + // is not set (uses initial value 0). + // To de-couple roaming with Gscan, set default values for roaming_capa + // if Gscan is not supported. + // TODO: removes below if driver has new API to get roaming_capa. + if (!(info->supported_feature_set & WIFI_FEATURE_GSCAN)) { + info->capa.roaming_capa.max_whitelist_size = WLAN_ROAM_MAX_NUM_WHITE_LIST; + info->capa.roaming_capa.max_blacklist_size = WLAN_ROAM_MAX_NUM_BLACK_LIST; + } memcpy(caps, &info->capa.roaming_capa, sizeof(wifi_roaming_capabilities)); return WIFI_SUCCESS; diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp index f071dfc..372d9e1 100644 --- a/qcwcn/wifi_hal/wifi_hal.cpp +++ b/qcwcn/wifi_hal/wifi_hal.cpp @@ -473,6 +473,75 @@ static wifi_error wifi_init_cld80211_sock_cb(hal_info *info) return WIFI_SUCCESS; } +wifi_error wifi_set_dtim_config(wifi_interface_handle handle, u32 multiplier) +{ + wifi_error ret = WIFI_ERROR_INVALID_ARGS; + WifihalGeneric *cmd = NULL; + struct nlattr *nlData = NULL; + interface_info *ifaceInfo = NULL; + wifi_handle wifiHandle = NULL; + + if (!handle) { + ALOGE("%s: Error, wifi_interface_handle NULL", __FUNCTION__); + goto cleanup; + } + ALOGD("%s: multiplier:%d", __FUNCTION__, multiplier); + wifiHandle = getWifiHandle(handle); + cmd = new WifihalGeneric(wifiHandle, get_requestid(), OUI_QCA, + QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION); + if (cmd == NULL) { + ALOGE("%s: Error WifihalGeneric NULL", __FUNCTION__); + ret = WIFI_ERROR_OUT_OF_MEMORY; + goto cleanup; + } + + /* Create the NL message. */ + ret = cmd->create(); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: failed to create NL msg. Error:%d", __FUNCTION__, ret); + goto cleanup; + } + ifaceInfo = getIfaceInfo(handle); + if (!ifaceInfo) { + ALOGE("%s: getIfaceInfo is NULL", __FUNCTION__); + ret = WIFI_ERROR_OUT_OF_MEMORY; + goto cleanup; + } + + /* Set the interface Id of the message. */ + ret = cmd->set_iface_id(ifaceInfo->name); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: failed to set iface id. Error:%d", __FUNCTION__, ret); + goto cleanup; + } + + /* Add the vendor specific attributes for the NL command. */ + nlData = cmd->attr_start(NL80211_ATTR_VENDOR_DATA); + if (!nlData) { + ALOGE("%s: failed attr_start for VENDOR_DATA", __FUNCTION__); + ret = WIFI_ERROR_OUT_OF_MEMORY; + goto cleanup; + } + + ret = cmd->put_u32(QCA_WLAN_VENDOR_ATTR_CONFIG_DYNAMIC_DTIM, multiplier); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: failed to put vendor data. Error:%d", __FUNCTION__, ret); + goto cleanup; + } + cmd->attr_end(nlData); + + /* Send the NL msg. */ + ret = cmd->requestResponse(); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: requestResponse Error:%d", __FUNCTION__, ret); + goto cleanup; + } + +cleanup: + if (cmd) + delete cmd; + return ret; +} /*initialize function pointer table with Qualcomm HAL API*/ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn) { @@ -575,6 +644,7 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn) { fn->wifi_virtual_interface_delete = wifi_virtual_interface_delete; fn->wifi_set_latency_mode = wifi_set_latency_mode; fn->wifi_set_thermal_mitigation_mode = wifi_set_thermal_mitigation_mode; + fn->wifi_set_dtim_config = wifi_set_dtim_config; return WIFI_SUCCESS; } diff --git a/qcwcn/wifi_hal/wificonfig.cpp b/qcwcn/wifi_hal/wificonfig.cpp index c6ceb9d..7ff323c 100644 --- a/qcwcn/wifi_hal/wificonfig.cpp +++ b/qcwcn/wifi_hal/wificonfig.cpp @@ -534,7 +534,7 @@ wifi_error wifi_set_latency_mode(wifi_interface_handle handle, goto cleanup; } - if (wifiConfigCommand->put_u32( + if (wifiConfigCommand->put_u16( QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL, latency_mode)) { ALOGE("wifi_set_latency_mode: failed to put latency mode"); diff --git a/qcwcn/wifi_hal/wifilogger.cpp b/qcwcn/wifi_hal/wifilogger.cpp index 7e8efe6..ee9efa1 100644 --- a/qcwcn/wifi_hal/wifilogger.cpp +++ b/qcwcn/wifi_hal/wifilogger.cpp @@ -365,7 +365,7 @@ wifi_error wifi_get_firmware_version(wifi_interface_handle iface, /* No request id from caller, so generate one and pass it on to the driver. * Generate one randomly. */ - requestId = get_requestid(); + requestId = get_requestid_u8(); wifiLoggerCommand = new WifiLoggerCommand( wifiHandle, @@ -391,7 +391,7 @@ wifi_error wifi_get_firmware_version(wifi_interface_handle iface, if (!nlData) goto cleanup; - ret = wifiLoggerCommand->put_u32( + ret = wifiLoggerCommand->put_u8( QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION, requestId); if (ret != WIFI_SUCCESS) goto cleanup; @@ -426,7 +426,7 @@ wifi_error wifi_get_driver_version(wifi_interface_handle iface, /* No request id from caller, so generate one and pass it on to the driver. * Generate one randomly. */ - requestId = get_requestid(); + requestId = get_requestid_u8(); wifiLoggerCommand = new WifiLoggerCommand( wifiHandle, @@ -452,7 +452,7 @@ wifi_error wifi_get_driver_version(wifi_interface_handle iface, if (!nlData) goto cleanup; - ret = wifiLoggerCommand->put_u32( + ret = wifiLoggerCommand->put_u8( QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION, requestId); if (ret != WIFI_SUCCESS) goto cleanup; @@ -1164,60 +1164,9 @@ int WifiLoggerCommand::handleResponse(WifiEvent &reply) { (struct nlattr *)mVendorData, mDataLen, NULL); - if (!tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_TOTAL_CMD_EVENT_WAKE]) { - mGetWakeStats->total_cmd_event_wake = 0; - } else { - mGetWakeStats->total_cmd_event_wake = nla_get_u32( - tbVendor[QCA_WLAN_VENDOR_ATTR_WAKE_STATS_TOTAL_CMD_EVENT_WAKE]); - } + mGetWakeStats->cmd_event_wake_cnt_used = 0; - if (mGetWakeStats->total_cmd_event_wake && - mGetWakeStats->cmd_event_wake_cnt) { - if (!tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_CMD_EVENT_WAKE_CNT_PTR]) { - mGetWakeStats->cmd_event_wake_cnt_used = 0; - } else { - len = nla_len(tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_CMD_EVENT_WAKE_CNT_PTR]); - mGetWakeStats->cmd_event_wake_cnt_used = - (len < mGetWakeStats->cmd_event_wake_cnt_sz) ? len : - mGetWakeStats->cmd_event_wake_cnt_sz; - memcpy(mGetWakeStats->cmd_event_wake_cnt, - nla_data(tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_CMD_EVENT_WAKE_CNT_PTR]), - (mGetWakeStats->cmd_event_wake_cnt_used * sizeof(int))); - } - } else - mGetWakeStats->cmd_event_wake_cnt_used = 0; - - if (!tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_TOTAL_DRIVER_FW_LOCAL_WAKE]) { - mGetWakeStats->total_driver_fw_local_wake = 0; - } else { - mGetWakeStats->total_driver_fw_local_wake = nla_get_u32(tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_TOTAL_DRIVER_FW_LOCAL_WAKE]); - } - - if (mGetWakeStats->total_driver_fw_local_wake && - mGetWakeStats->driver_fw_local_wake_cnt) { - if (!tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_DRIVER_FW_LOCAL_WAKE_CNT_PTR]) { - mGetWakeStats->driver_fw_local_wake_cnt_used = 0; - } else { - len = nla_len(tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_DRIVER_FW_LOCAL_WAKE_CNT_PTR]); - mGetWakeStats->driver_fw_local_wake_cnt_used = - (len < mGetWakeStats->driver_fw_local_wake_cnt_sz) ? len : - mGetWakeStats->driver_fw_local_wake_cnt_sz; - - memcpy(mGetWakeStats->driver_fw_local_wake_cnt, - nla_data(tbVendor[ - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_DRIVER_FW_LOCAL_WAKE_CNT_PTR]), - (mGetWakeStats->driver_fw_local_wake_cnt_used * sizeof(int))); - } - } else - mGetWakeStats->driver_fw_local_wake_cnt_used = 0; + mGetWakeStats->driver_fw_local_wake_cnt_used = 0; if (!tbVendor[QCA_WLAN_VENDOR_ATTR_WAKE_STATS_TOTAL_RX_DATA_WAKE]) { ALOGE("%s: TOTAL_RX_DATA_WAKE not found", __FUNCTION__); @@ -1469,7 +1418,6 @@ wifi_error wifi_get_wake_reason_stats(wifi_interface_handle iface, int requestId; wifi_error ret; WifiLoggerCommand *wifiLoggerCommand; - struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); hal_info *info = getHalInfo(wifiHandle); @@ -1515,25 +1463,6 @@ wifi_error wifi_get_wake_reason_stats(wifi_interface_handle iface, wifiLoggerCommand->getWakeStatsRspParams(wifi_wake_reason_cnt); - /* Add the vendor specific attributes for the NL command. */ - nlData = wifiLoggerCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) - goto cleanup; - - ret = wifiLoggerCommand->put_u32( - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_CMD_EVENT_WAKE_CNT_SZ, - wifi_wake_reason_cnt->cmd_event_wake_cnt_sz); - if (ret != WIFI_SUCCESS) - goto cleanup; - - ret = wifiLoggerCommand->put_u32( - QCA_WLAN_VENDOR_ATTR_WAKE_STATS_DRIVER_FW_LOCAL_WAKE_CNT_SZ, - wifi_wake_reason_cnt->driver_fw_local_wake_cnt_sz); - if (ret != WIFI_SUCCESS) - goto cleanup; - - wifiLoggerCommand->attr_end(nlData); - /* Send the msg and wait for a response. */ ret = wifiLoggerCommand->requestResponse(); if (ret != WIFI_SUCCESS) |