From 3dc2dab9041e966e441200dfe6d5495fb0646e64 Mon Sep 17 00:00:00 2001 From: Hsiu-Chang Chen Date: Mon, 5 Sep 2022 13:29:27 +0800 Subject: WifiHal: Set wifi_error return code when command/operation fails Setting the return value to corresponding error before returning from the APIs. Bug: 241058906 Test: VTS test CRs-Fixed: 3264767 Change-Id: Id77b3d64459f4957b6921be8ad8ad4d60f32a4cb --- wcn6740/qcwcn/wifi_hal/gscan.cpp | 82 ++++- wcn6740/qcwcn/wifi_hal/llstats.cpp | 24 +- wcn6740/qcwcn/wifi_hal/nan.cpp | 70 +++- wcn6740/qcwcn/wifi_hal/radio_mode.cpp | 10 +- wcn6740/qcwcn/wifi_hal/roam.cpp | 10 +- wcn6740/qcwcn/wifi_hal/rssi_monitor.cpp | 13 +- wcn6740/qcwcn/wifi_hal/tcp_params_update.cpp | 490 ++++++++++++++------------- wcn6740/qcwcn/wifi_hal/tdls.cpp | 17 +- wcn6740/qcwcn/wifi_hal/wifi_hal.cpp | 51 ++- wcn6740/qcwcn/wifi_hal/wificonfig.cpp | 34 +- wcn6740/qcwcn/wifi_hal/wifihal_vendor.cpp | 17 +- wcn6740/qcwcn/wifi_hal/wifilogger.cpp | 21 +- wcn6740/qcwcn/wifi_hal/wifilogger_diag.cpp | 2 +- 13 files changed, 532 insertions(+), 309 deletions(-) diff --git a/wcn6740/qcwcn/wifi_hal/gscan.cpp b/wcn6740/qcwcn/wifi_hal/gscan.cpp index 03a5fb4..fc76219 100644 --- a/wcn6740/qcwcn/wifi_hal/gscan.cpp +++ b/wcn6740/qcwcn/wifi_hal/gscan.cpp @@ -12,6 +12,11 @@ * 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. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include "sync.h" @@ -246,8 +251,10 @@ wifi_error wifi_start_gscan(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } num_scan_buckets = (unsigned int)params.num_buckets > MAX_BUCKETS ? MAX_BUCKETS : params.num_buckets; @@ -276,6 +283,7 @@ wifi_error wifi_start_gscan(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_GSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS, num_scan_buckets)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } @@ -320,6 +328,7 @@ wifi_error wifi_start_gscan(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_GSCAN_BUCKET_SPEC_STEP_COUNT, bucketSpec.step_count)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } @@ -345,6 +354,7 @@ wifi_error wifi_start_gscan(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_GSCAN_CHANNEL_SPEC_PASSIVE, channel_spec.passive) ) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } @@ -455,8 +465,10 @@ wifi_error wifi_stop_gscan(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = gScanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_GSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID, @@ -537,8 +549,10 @@ wifi_error wifi_set_bssid_hotlist(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } numAp = (unsigned int)params.num_bssid > MAX_HOTLIST_APS ? MAX_HOTLIST_APS : params.num_bssid; @@ -552,6 +566,7 @@ wifi_error wifi_set_bssid_hotlist(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_GSCAN_BSSID_HOTLIST_PARAMS_NUM_AP, numAp)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } @@ -561,15 +576,19 @@ wifi_error wifi_set_bssid_hotlist(wifi_request_id id, nlApThresholdParamList = gScanCommand->attr_start( QCA_WLAN_VENDOR_ATTR_GSCAN_AP_THRESHOLD_PARAM); - if (!nlApThresholdParamList) + if (!nlApThresholdParamList){ + ret = WIFI_ERROR_UNINITIALIZED; goto cleanup; + } /* Add nested NL attributes for AP Threshold Param. */ for (i = 0; i < numAp; i++) { ap_threshold_param apThreshold = params.ap[i]; struct nlattr *nlApThresholdParam = gScanCommand->attr_start(i); - if (!nlApThresholdParam) + if (!nlApThresholdParam){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } if (gScanCommand->put_addr( QCA_WLAN_VENDOR_ATTR_GSCAN_AP_THRESHOLD_PARAM_BSSID, apThreshold.bssid) || @@ -580,6 +599,7 @@ wifi_error wifi_set_bssid_hotlist(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_GSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH, apThreshold.high)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } ALOGV("%s: Index:%d BssId: %hhx:%hhx:%hhx:%hhx:%hhx:%hhx " @@ -697,8 +717,10 @@ wifi_error wifi_reset_bssid_hotlist(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = gScanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_GSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID, id); @@ -777,8 +799,10 @@ wifi_error wifi_set_significant_change_handler(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } numAp = (unsigned int)params.num_bssid > MAX_SIGNIFICANT_CHANGE_APS ? MAX_SIGNIFICANT_CHANGE_APS : params.num_bssid; @@ -799,6 +823,7 @@ wifi_error wifi_set_significant_change_handler(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_GSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP, numAp)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } @@ -811,15 +836,18 @@ wifi_error wifi_set_significant_change_handler(wifi_request_id id, nlApThresholdParamList = gScanCommand->attr_start( QCA_WLAN_VENDOR_ATTR_GSCAN_AP_THRESHOLD_PARAM); - if (!nlApThresholdParamList) + if (!nlApThresholdParamList){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; - + } /* Add nested NL attributes for AP Threshold Param list. */ for (i = 0; i < numAp; i++) { ap_threshold_param apThreshold = params.ap[i]; struct nlattr *nlApThresholdParam = gScanCommand->attr_start(i); - if (!nlApThresholdParam) + if (!nlApThresholdParam){ + ret = WIFI_ERROR_UNINITIALIZED; goto cleanup; + } if ( gScanCommand->put_addr( QCA_WLAN_VENDOR_ATTR_GSCAN_AP_THRESHOLD_PARAM_BSSID, apThreshold.bssid) || @@ -830,6 +858,7 @@ wifi_error wifi_set_significant_change_handler(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_GSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH, apThreshold.high)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } ALOGV("%s: ap[%d].bssid:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx " @@ -951,8 +980,10 @@ wifi_error wifi_reset_significant_change_handler(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = gScanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_GSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID, @@ -1046,8 +1077,10 @@ wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } if (gScanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_GSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID, @@ -1059,6 +1092,7 @@ wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, QCA_WLAN_VENDOR_ATTR_GSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX, max)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } @@ -1074,6 +1108,7 @@ wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, */ if (retRequestRsp != -ETIMEDOUT) { /* Proceed to cleanup & return no results */ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } } @@ -1129,8 +1164,10 @@ wifi_error wifi_set_scanning_mac_oui(wifi_interface_handle handle, oui scan_oui) /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ALOGV("%s: MAC_OUI - %02x:%02x:%02x", __FUNCTION__, scan_oui[0], scan_oui[1], scan_oui[2]); @@ -1209,7 +1246,7 @@ wifi_error GScanCommand::requestResponse() int GScanCommand::handleResponse(WifiEvent &reply) { int i = 0; - wifi_error ret = WIFI_SUCCESS; + wifi_error ret = WIFI_ERROR_UNKNOWN; u32 val; WifiVendorCommand::handleResponse(reply); @@ -1717,6 +1754,7 @@ wifi_error wifi_set_epno_list(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add attribute NL80211_ATTR_VENDOR_DATA. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1752,6 +1790,7 @@ wifi_error wifi_set_epno_list(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_NUM_NETWORKS, num_networks)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add vendor atributes. Error:%d", __FUNCTION__, ret); goto cleanup; } @@ -1761,6 +1800,7 @@ wifi_error wifi_set_epno_list(wifi_request_id id, gScanCommand->attr_start( QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORKS_LIST); if (!nlPnoParamList) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add attr. PNO_SET_LIST_PARAM_EPNO_NETWORKS_LIST. " "Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1771,6 +1811,7 @@ wifi_error wifi_set_epno_list(wifi_request_id id, wifi_epno_network pnoNetwork = epno_params->networks[i]; struct nlattr *nlPnoNetwork = gScanCommand->attr_start(i); if (!nlPnoNetwork) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed attr_start for nlPnoNetwork. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1785,6 +1826,7 @@ wifi_error wifi_set_epno_list(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_EPNO_NETWORK_AUTH_BIT, pnoNetwork.auth_bit_field)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add PNO_SET_LIST_PARAM_EPNO_NETWORK_*. " "Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1886,6 +1928,7 @@ wifi_error wifi_reset_epno_list(wifi_request_id id, wifi_interface_handle iface) /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add attribute NL80211_ATTR_VENDOR_DATA. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1898,6 +1941,7 @@ wifi_error wifi_reset_epno_list(wifi_request_id id, wifi_interface_handle iface) QCA_WLAN_VENDOR_ATTR_PNO_SET_LIST_PARAM_NUM_NETWORKS, EPNO_NO_NETWORKS)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add vendor atributes Error:%d", __FUNCTION__, ret); goto cleanup; } @@ -1974,6 +2018,7 @@ wifi_error wifi_set_passpoint_list(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add attribute NL80211_ATTR_VENDOR_DATA. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1986,6 +2031,7 @@ wifi_error wifi_set_passpoint_list(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_PNO_PASSPOINT_LIST_PARAM_NUM, num)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add vendor atributes. Error:%d", __FUNCTION__, ret); goto cleanup; } @@ -1995,6 +2041,7 @@ wifi_error wifi_set_passpoint_list(wifi_request_id id, gScanCommand->attr_start( QCA_WLAN_VENDOR_ATTR_PNO_PASSPOINT_LIST_PARAM_NETWORK_ARRAY); if (!nlPasspointNetworksParamList) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed attr_start for PASSPOINT_LIST_PARAM_NETWORK_ARRAY. " "Error:%d", __FUNCTION__, ret); goto cleanup; @@ -2005,6 +2052,7 @@ wifi_error wifi_set_passpoint_list(wifi_request_id id, wifi_passpoint_network passpointNetwork = networks[i]; struct nlattr *nlPasspointNetworkParam = gScanCommand->attr_start(i); if (!nlPasspointNetworkParam) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed attr_start for nlPasspointNetworkParam. " "Error:%d", __FUNCTION__, ret); goto cleanup; @@ -2023,6 +2071,7 @@ wifi_error wifi_set_passpoint_list(wifi_request_id id, QCA_WLAN_VENDOR_ATTR_PNO_PASSPOINT_NETWORK_PARAM_ROAM_PLMN, (char*)passpointNetwork.plmn, 3 * sizeof(u8))) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add PNO_PASSPOINT_NETWORK_PARAM_ROAM_* attr. " "Error:%d", __FUNCTION__, ret); goto cleanup; @@ -2141,6 +2190,7 @@ wifi_error wifi_reset_passpoint_list(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = gScanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to add attribute NL80211_ATTR_VENDOR_DATA. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -2149,6 +2199,7 @@ wifi_error wifi_reset_passpoint_list(wifi_request_id id, ret = gScanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_GSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID, id); if (ret != WIFI_SUCCESS) { + ret = WIFI_ERROR_OUT_OF_MEMORY; ALOGE("%s: Failed to add vendor data attributes. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -2242,7 +2293,7 @@ wifi_error GScanCommand::copyCachedScanResults( int *numResults, wifi_cached_scan_results *cached_results) { - wifi_error ret = WIFI_SUCCESS; + wifi_error ret = WIFI_ERROR_UNKNOWN; int i; wifi_cached_scan_results *cachedResultRsp; @@ -2270,6 +2321,7 @@ wifi_error GScanCommand::copyCachedScanResults( memcpy(cached_results[i].results, cachedResultRsp->results, cached_results[i].num_results * sizeof(wifi_scan_result)); + ret = WIFI_SUCCESS; } } else { ALOGE("%s: mGetCachedResultsRspParams is NULL", __FUNCTION__); diff --git a/wcn6740/qcwcn/wifi_hal/llstats.cpp b/wcn6740/qcwcn/wifi_hal/llstats.cpp index 3779b58..3bed31c 100644 --- a/wcn6740/qcwcn/wifi_hal/llstats.cpp +++ b/wcn6740/qcwcn/wifi_hal/llstats.cpp @@ -12,6 +12,11 @@ * 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. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include "sync.h" @@ -457,7 +462,7 @@ static wifi_error get_wifi_peer_info(wifi_peer_info *stats, int rem; wifi_rate_stat * pRateStats; struct nlattr *rateInfo; - wifi_error ret = WIFI_SUCCESS; + wifi_error ret = WIFI_ERROR_UNKNOWN; if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE]) { @@ -527,7 +532,7 @@ wifi_error LLStatsCommand::get_wifi_iface_stats(wifi_iface_stat *stats, struct nlattr *wmmInfo; wifi_wmm_ac_stat *pWmmStats; int i=0, rem; - wifi_error ret = WIFI_SUCCESS; + wifi_error ret = WIFI_ERROR_UNKNOWN; if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX]) { @@ -869,7 +874,7 @@ wifi_error LLStatsCommand::requestResponse() wifi_error LLStatsCommand::notifyResponse() { - wifi_error ret = WIFI_SUCCESS; + wifi_error ret = WIFI_ERROR_UNKNOWN; /* Indicate stats to framework only if both radio and iface stats * are present */ @@ -882,6 +887,7 @@ wifi_error LLStatsCommand::notifyResponse() mHandler.on_link_stats_results(mRequestId, mResultsParams.iface_stat, mNumRadios, mResultsParams.radio_stat); + ret = WIFI_SUCCESS; } else { ret = WIFI_ERROR_INVALID_ARGS; } @@ -1318,8 +1324,10 @@ wifi_error wifi_set_link_stats(wifi_interface_handle iface, /*add the attributes*/ nl_data = LLCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) + if (!nl_data){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } /**/ ret = LLCommand->put_u32(QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD, params.mpdu_size_threshold); @@ -1379,8 +1387,10 @@ wifi_error wifi_get_link_stats(wifi_request_id id, goto cleanup; /*add the attributes*/ nl_data = LLCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) + if (!nl_data){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = LLCommand->put_u32(QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID, id); if (ret != WIFI_SUCCESS) @@ -1446,8 +1456,10 @@ wifi_error wifi_clear_link_stats(wifi_interface_handle iface, goto cleanup; /*add the attributes*/ nl_data = LLCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) + if (!nl_data){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } /**/ ret = LLCommand->put_u32(QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK, stats_clear_req_mask); diff --git a/wcn6740/qcwcn/wifi_hal/nan.cpp b/wcn6740/qcwcn/wifi_hal/nan.cpp index adf73d2..1690a86 100644 --- a/wcn6740/qcwcn/wifi_hal/nan.cpp +++ b/wcn6740/qcwcn/wifi_hal/nan.cpp @@ -1243,8 +1243,10 @@ wifi_error nan_data_request_initiator(transaction_id id, /* Add the vendor specific attributes for the NL command. */ nlData = nanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } if (nanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD, @@ -1262,6 +1264,7 @@ wifi_error nan_data_request_initiator(transaction_id id, nanCommand->put_string( QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR, msg->ndp_iface)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } @@ -1271,8 +1274,10 @@ wifi_error nan_data_request_initiator(transaction_id id, msg->channel_request_type) || nanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL, - msg->channel)) + msg->channel)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } } if (msg->app_info.ndp_app_info_len != 0) { @@ -1280,6 +1285,7 @@ wifi_error nan_data_request_initiator(transaction_id id, QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO, (char *)msg->app_info.ndp_app_info, msg->app_info.ndp_app_info_len)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } } @@ -1287,31 +1293,39 @@ wifi_error nan_data_request_initiator(transaction_id id, if (msg->ndp_cfg.qos_cfg == NAN_DP_CONFIG_QOS) { nlCfgQos = nanCommand->attr_start(QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS); - if (!nlCfgQos) + if (!nlCfgQos){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } /* TBD Qos Info */ nanCommand->attr_end(nlCfgQos); } if (msg->cipher_type != NAN_CIPHER_SUITE_SHARED_KEY_NONE) { if (nanCommand->put_u32(QCA_WLAN_VENDOR_ATTR_NDP_CSID, - msg->cipher_type)) + msg->cipher_type)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } } if (msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PMK) { if (msg->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Invalid pmk len:%d", __FUNCTION__, msg->key_info.body.pmk_info.pmk_len); goto cleanup; } if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK, (char *)msg->key_info.body.pmk_info.pmk, - msg->key_info.body.pmk_info.pmk_len)) + msg->key_info.body.pmk_info.pmk_len)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } } else if (msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PASSPHRASE) { if (msg->key_info.body.passphrase_info.passphrase_len < NAN_SECURITY_MIN_PASSPHRASE_LEN || msg->key_info.body.passphrase_info.passphrase_len > NAN_SECURITY_MAX_PASSPHRASE_LEN) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Invalid passphrase len:%d", __FUNCTION__, msg->key_info.body.passphrase_info.passphrase_len); goto cleanup; @@ -1334,21 +1348,27 @@ wifi_error nan_data_request_initiator(transaction_id id, msg->key_info.body.pmk_info.pmk_len = NAN_PMK_INFO_LEN; if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK, (char *)msg->key_info.body.pmk_info.pmk, - msg->key_info.body.pmk_info.pmk_len)) + msg->key_info.body.pmk_info.pmk_len)){ if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE, (char *)msg->key_info.body.passphrase_info.passphrase, - msg->key_info.body.passphrase_info.passphrase_len)) + msg->key_info.body.passphrase_info.passphrase_len)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } + } } else if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE, (char *)msg->key_info.body.passphrase_info.passphrase, msg->key_info.body.passphrase_info.passphrase_len)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } } if (msg->service_name_len) { if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME, - (char *)msg->service_name, msg->service_name_len)) + (char *)msg->service_name, msg->service_name_len)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } } nanCommand->attr_end(nlData); @@ -1396,8 +1416,10 @@ wifi_error nan_data_indication_response(transaction_id id, /* Add the vendor specific attributes for the NL command. */ nlData = nanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } if (nanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD, @@ -1414,6 +1436,7 @@ wifi_error nan_data_indication_response(transaction_id id, nanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE, msg->rsp_code)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } if (msg->app_info.ndp_app_info_len != 0) { @@ -1421,38 +1444,47 @@ wifi_error nan_data_indication_response(transaction_id id, QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO, (char *)msg->app_info.ndp_app_info, msg->app_info.ndp_app_info_len)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } } if (msg->ndp_cfg.qos_cfg == NAN_DP_CONFIG_QOS) { nlCfgQos = nanCommand->attr_start(QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS); - if (!nlCfgQos) + if (!nlCfgQos){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } /* TBD Qos Info */ nanCommand->attr_end(nlCfgQos); } if (msg->cipher_type != NAN_CIPHER_SUITE_SHARED_KEY_NONE) { if (nanCommand->put_u32(QCA_WLAN_VENDOR_ATTR_NDP_CSID, - msg->cipher_type)) + msg->cipher_type)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } } if (msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PMK) { if (msg->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Invalid pmk len:%d", __FUNCTION__, msg->key_info.body.pmk_info.pmk_len); goto cleanup; } if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK, (char *)msg->key_info.body.pmk_info.pmk, - msg->key_info.body.pmk_info.pmk_len)) + msg->key_info.body.pmk_info.pmk_len)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } } else if (msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PASSPHRASE) { if (msg->key_info.body.passphrase_info.passphrase_len < NAN_SECURITY_MIN_PASSPHRASE_LEN || msg->key_info.body.passphrase_info.passphrase_len > NAN_SECURITY_MAX_PASSPHRASE_LEN) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Invalid passphrase len:%d", __FUNCTION__, msg->key_info.body.passphrase_info.passphrase_len); goto cleanup; @@ -1479,19 +1511,24 @@ wifi_error nan_data_indication_response(transaction_id id, msg->key_info.body.pmk_info.pmk_len)) if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE, (char *)msg->key_info.body.passphrase_info.passphrase, - msg->key_info.body.passphrase_info.passphrase_len)) + msg->key_info.body.passphrase_info.passphrase_len)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } } else if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE, (char *)msg->key_info.body.passphrase_info.passphrase, msg->key_info.body.passphrase_info.passphrase_len)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } } if (msg->service_name_len) { if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME, - (char *)msg->service_name, msg->service_name_len)) + (char *)msg->service_name, msg->service_name_len)){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } } nanCommand->attr_end(nlData); @@ -1525,8 +1562,10 @@ wifi_error nan_data_end(transaction_id id, /* Add the vendor specific attributes for the NL command. */ nlData = nanCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } if (nanCommand->put_u32( QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD, @@ -1538,6 +1577,7 @@ wifi_error nan_data_end(transaction_id id, QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY, (char *)msg->ndp_instance_id, msg->num_ndp_instances * sizeof(u32))) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } nanCommand->attr_end(nlData); diff --git a/wcn6740/qcwcn/wifi_hal/radio_mode.cpp b/wcn6740/qcwcn/wifi_hal/radio_mode.cpp index f758073..267d3f4 100644 --- a/wcn6740/qcwcn/wifi_hal/radio_mode.cpp +++ b/wcn6740/qcwcn/wifi_hal/radio_mode.cpp @@ -24,6 +24,11 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include "sync.h" @@ -136,7 +141,7 @@ RADIOModeCommand* RADIOModeCommand::instance(wifi_handle handle, */ int RADIOModeCommand::handleEvent(WifiEvent &event) { - wifi_error ret = WIFI_SUCCESS; + wifi_error ret = WIFI_ERROR_UNKNOWN; int num_of_mac = 0; wifi_mac_info mode_info; memset(&mode_info, 0, sizeof(mode_info)); @@ -259,7 +264,10 @@ int RADIOModeCommand::handleEvent(WifiEvent &event) } else { ALOGE("No Callback registered: on radio mode change"); + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; } + ret = WIFI_SUCCESS; } break; diff --git a/wcn6740/qcwcn/wifi_hal/roam.cpp b/wcn6740/qcwcn/wifi_hal/roam.cpp index 595fc60..bd93c3d 100644 --- a/wcn6740/qcwcn/wifi_hal/roam.cpp +++ b/wcn6740/qcwcn/wifi_hal/roam.cpp @@ -12,6 +12,11 @@ * 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. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include @@ -103,8 +108,10 @@ wifi_error wifi_set_bssid_blacklist(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = roamCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = roamCommand->put_u32(QCA_WLAN_VENDOR_ATTR_ROAMING_SUBCMD, QCA_WLAN_VENDOR_ROAMING_SUBCMD_SET_BLACKLIST_BSSID); @@ -188,6 +195,7 @@ wifi_error wifi_set_ssid_white_list(wifi_request_id id, wifi_interface_handle if /* Add the vendor specific attributes for the NL command. */ nlData = roamCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } diff --git a/wcn6740/qcwcn/wifi_hal/rssi_monitor.cpp b/wcn6740/qcwcn/wifi_hal/rssi_monitor.cpp index 832bbc3..a2038f8 100644 --- a/wcn6740/qcwcn/wifi_hal/rssi_monitor.cpp +++ b/wcn6740/qcwcn/wifi_hal/rssi_monitor.cpp @@ -24,6 +24,11 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include "sync.h" @@ -272,8 +277,10 @@ wifi_error wifi_start_rssi_monitoring(wifi_request_id id, max_rssi, min_rssi); /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL, QCA_WLAN_RSSI_MONITORING_START); @@ -345,8 +352,10 @@ wifi_error wifi_stop_rssi_monitoring(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL, QCA_WLAN_RSSI_MONITORING_STOP); diff --git a/wcn6740/qcwcn/wifi_hal/tcp_params_update.cpp b/wcn6740/qcwcn/wifi_hal/tcp_params_update.cpp index c13b1b0..c2c21e9 100644 --- a/wcn6740/qcwcn/wifi_hal/tcp_params_update.cpp +++ b/wcn6740/qcwcn/wifi_hal/tcp_params_update.cpp @@ -24,6 +24,11 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include "sync.h" @@ -40,32 +45,32 @@ #include "tcp_params_update.h" TCPParamCommand::TCPParamCommand(wifi_handle handle, int id, - u32 vendor_id, u32 subcmd) - : WifiVendorCommand(handle, id, vendor_id, subcmd) + u32 vendor_id, u32 subcmd) + : WifiVendorCommand(handle, id, vendor_id, subcmd) { - if (registerVendorHandler(vendor_id, subcmd)) { - /* Error case should not happen print log */ - ALOGE("%s: Unable to register Vendor Handler Vendor Id=0x%x subcmd=%u", - __FUNCTION__, vendor_id, subcmd); - } - memset(def_tcp_limit_output_bytes, 0, SIZE_TCP_PARAM); - memset(def_tcp_adv_win_scale, 0, SIZE_TCP_PARAM); - def_tcp_limit_output_bytes_valid = false; - def_tcp_adv_win_scale_valid = false; + if (registerVendorHandler(vendor_id, subcmd)) { + /* Error case should not happen print log */ + ALOGE("%s: Unable to register Vendor Handler Vendor Id=0x%x subcmd=%u", + __FUNCTION__, vendor_id, subcmd); + } + memset(def_tcp_limit_output_bytes, 0, SIZE_TCP_PARAM); + memset(def_tcp_adv_win_scale, 0, SIZE_TCP_PARAM); + def_tcp_limit_output_bytes_valid = false; + def_tcp_adv_win_scale_valid = false; } TCPParamCommand::~TCPParamCommand() { - unregisterVendorHandler(OUI_QCA, QCA_NL80211_VENDOR_SUBCMD_THROUGHPUT_CHANGE_EVENT); + unregisterVendorHandler(OUI_QCA, QCA_NL80211_VENDOR_SUBCMD_THROUGHPUT_CHANGE_EVENT); } TCPParamCommand *TCPParamCommand::instance(wifi_handle handle, wifi_request_id id) { - TCPParamCommand* mTCPParamCommandInstance; + TCPParamCommand* mTCPParamCommandInstance; - mTCPParamCommandInstance = new TCPParamCommand(handle, id, OUI_QCA, - QCA_NL80211_VENDOR_SUBCMD_THROUGHPUT_CHANGE_EVENT); - return mTCPParamCommandInstance; + mTCPParamCommandInstance = new TCPParamCommand(handle, id, OUI_QCA, + QCA_NL80211_VENDOR_SUBCMD_THROUGHPUT_CHANGE_EVENT); + return mTCPParamCommandInstance; } /* This function will be the main handler for incoming event. @@ -73,206 +78,211 @@ TCPParamCommand *TCPParamCommand::instance(wifi_handle handle, wifi_request_id i */ int TCPParamCommand::handleEvent(WifiEvent &event) { - wifi_error ret = WIFI_SUCCESS; - WifiVendorCommand::handleEvent(event); - - u8 tpDirection, tpLevel; - u32 tcpLimitOutputBytes; - u8 tcpLimitOutputBytesFlag = 0; - s8 tcpAdvWinScale; - u8 tcpAdvWinScaleFlag = 0; - u32 tcpDelackSeg; - u8 tcpDelackSegFlag = 0; - char value_to_str[100]; - int ret_val = 0; - - /* Parse the vendordata and get the attribute */ - switch(mSubcmd) { - case QCA_NL80211_VENDOR_SUBCMD_THROUGHPUT_CHANGE_EVENT: - { - struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_MAX + 1]; - - nla_parse(tb, QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_MAX, - (struct nlattr *)mVendorData, mDataLen, NULL); - - if (!tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_DIRECTION] || - !tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_THROUGHPUT_LEVEL]) { - ALOGE("Invalid event, didn't receive mandatory attributes"); - return WIFI_ERROR_INVALID_ARGS; - } - tpDirection = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_DIRECTION]); - tpLevel = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_THROUGHPUT_LEVEL]); - - if (tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_LIMIT_OUTPUT_BYTES]) { - tcpLimitOutputBytes = nla_get_u32(tb[ - QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_LIMIT_OUTPUT_BYTES]); - tcpLimitOutputBytesFlag = 1; - } - - if (tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_ADV_WIN_SCALE]) { - tcpAdvWinScale = *(s8 *)nla_data(tb[ - QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_ADV_WIN_SCALE]); - tcpAdvWinScaleFlag = 1; - } - - if (tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_DELACK_SEG]) { - tcpDelackSeg = nla_get_u32(tb[ - QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_DELACK_SEG]); - tcpDelackSegFlag = 1; - } - if (tpDirection == TP_CHANGE_RX) { - switch(tpLevel) { - case QCA_WLAN_THROUGHPUT_LEVEL_LOW: - { - if (def_tcp_adv_win_scale_valid) - wlan_service_set_tcp_adv_win_scale(def_tcp_adv_win_scale); - wlan_service_set_tcp_use_userconfig("0"); - } - break; - case QCA_WLAN_THROUGHPUT_LEVEL_MEDIUM: - case QCA_WLAN_THROUGHPUT_LEVEL_HIGH: - { - if (tcpAdvWinScaleFlag) { - ret_val = snprintf(value_to_str, sizeof(value_to_str), "%d", - tcpAdvWinScale); - if (ret_val < 0 || ret_val >= (int)sizeof(value_to_str)) { - ALOGE("Error in converting value to string: %d", ret_val); - ret = WIFI_ERROR_UNKNOWN; - break; - } - wlan_service_set_tcp_adv_win_scale(value_to_str); - } - if (tcpDelackSegFlag && wlan_service_set_tcp_use_userconfig("1") == 0) { - ret_val = snprintf(value_to_str, sizeof(value_to_str), "%d", - tcpDelackSeg); - if (ret_val < 0 || ret_val >= (int)sizeof(value_to_str)) { - ALOGE("Error in converting value to string: %d", ret_val); - ret = WIFI_ERROR_UNKNOWN; - break; - } - wlan_service_set_tcp_delack_seg(value_to_str); - } - } - break; - default: - { - /* Error case should not happen print log */ - ALOGE("%s: Invalid throughput level value", __FUNCTION__); - return WIFI_ERROR_INVALID_ARGS; - } - } - } else if (tpDirection == TP_CHANGE_TX) { - switch(tpLevel) { - case QCA_WLAN_THROUGHPUT_LEVEL_LOW: - { - if (def_tcp_limit_output_bytes_valid) - wlan_service_set_tcp_limit_output_bytes( - def_tcp_limit_output_bytes); - } - break; - case QCA_WLAN_THROUGHPUT_LEVEL_MEDIUM: - case QCA_WLAN_THROUGHPUT_LEVEL_HIGH: - { - if (tcpLimitOutputBytesFlag) { - ret_val = snprintf(value_to_str, sizeof(value_to_str), "%d", - tcpLimitOutputBytes); - if (ret_val < 0 || ret_val >= (int)sizeof(value_to_str)) { - ALOGE("Error in converting value to string: %d", ret_val); - ret = WIFI_ERROR_UNKNOWN; - break; - } - wlan_service_set_tcp_limit_output_bytes(value_to_str); - } - } - break; - default: - { - /* Error case should not happen print log */ - ALOGE("%s: Invalid throughput level value", __FUNCTION__); - return WIFI_ERROR_INVALID_ARGS; - } - } - } else { - /* Error case should not happen print log */ - ALOGE("%s: Invalid throughput change direction", __FUNCTION__); - return ret; - } - } - break; - default: - /* Error case should not happen print log */ - ALOGE("%s: Wrong subcmd received %d", __FUNCTION__, mSubcmd); - } - - return ret; + wifi_error ret = WIFI_ERROR_UNKNOWN; + WifiVendorCommand::handleEvent(event); + + u8 tpDirection, tpLevel; + u32 tcpLimitOutputBytes; + u8 tcpLimitOutputBytesFlag = 0; + s8 tcpAdvWinScale; + u8 tcpAdvWinScaleFlag = 0; + u32 tcpDelackSeg; + u8 tcpDelackSegFlag = 0; + char value_to_str[100]; + int ret_val = 0; + + /* Parse the vendordata and get the attribute */ + switch(mSubcmd) { + case QCA_NL80211_VENDOR_SUBCMD_THROUGHPUT_CHANGE_EVENT: + { + struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_MAX + 1]; + + nla_parse(tb, QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_MAX, + (struct nlattr *)mVendorData, mDataLen, NULL); + + if (!tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_DIRECTION] || + !tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_THROUGHPUT_LEVEL]) { + ALOGE("Invalid event, didn't receive mandatory attributes"); + return WIFI_ERROR_INVALID_ARGS; + } + tpDirection = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_DIRECTION]); + tpLevel = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_THROUGHPUT_LEVEL]); + + if (tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_LIMIT_OUTPUT_BYTES]) { + tcpLimitOutputBytes = nla_get_u32(tb[ + QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_LIMIT_OUTPUT_BYTES]); + tcpLimitOutputBytesFlag = 1; + } + + if (tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_ADV_WIN_SCALE]) { + tcpAdvWinScale = *(s8 *)nla_data(tb[ + QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_ADV_WIN_SCALE]); + tcpAdvWinScaleFlag = 1; + } + + if (tb[QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_DELACK_SEG]) { + tcpDelackSeg = nla_get_u32(tb[ + QCA_WLAN_VENDOR_ATTR_THROUGHPUT_CHANGE_TCP_DELACK_SEG]); + tcpDelackSegFlag = 1; + } + if (tpDirection == TP_CHANGE_RX) { + switch(tpLevel) { + case QCA_WLAN_THROUGHPUT_LEVEL_LOW: + { + if (def_tcp_adv_win_scale_valid) + wlan_service_set_tcp_adv_win_scale(def_tcp_adv_win_scale); + wlan_service_set_tcp_use_userconfig("0"); + } + break; + case QCA_WLAN_THROUGHPUT_LEVEL_MEDIUM: + case QCA_WLAN_THROUGHPUT_LEVEL_HIGH: + { + if (tcpAdvWinScaleFlag) { + ret_val = snprintf(value_to_str, sizeof(value_to_str), "%d", + tcpAdvWinScale); + if (ret_val < 0 || ret_val >= (int)sizeof(value_to_str)) { + ALOGE("Error in converting value to string: %d", ret_val); + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; + } + wlan_service_set_tcp_adv_win_scale(value_to_str); + } + if (tcpDelackSegFlag && wlan_service_set_tcp_use_userconfig("1") == 0) { + ret_val = snprintf(value_to_str, sizeof(value_to_str), "%d", + tcpDelackSeg); + if (ret_val < 0 || ret_val >= (int)sizeof(value_to_str)) { + ALOGE("Error in converting value to string: %d", ret_val); + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; + } + wlan_service_set_tcp_delack_seg(value_to_str); + } + } + break; + default: + { + /* Error case should not happen print log */ + ALOGE("%s: Invalid throughput level value", __FUNCTION__); + return WIFI_ERROR_INVALID_ARGS; + } + } + } else if (tpDirection == TP_CHANGE_TX) { + switch(tpLevel) { + case QCA_WLAN_THROUGHPUT_LEVEL_LOW: + { + if (def_tcp_limit_output_bytes_valid) + wlan_service_set_tcp_limit_output_bytes( + def_tcp_limit_output_bytes); + } + break; + case QCA_WLAN_THROUGHPUT_LEVEL_MEDIUM: + case QCA_WLAN_THROUGHPUT_LEVEL_HIGH: + { + if (tcpLimitOutputBytesFlag) { + ret_val = snprintf(value_to_str, sizeof(value_to_str), "%d", + tcpLimitOutputBytes); + if (ret_val < 0 || ret_val >= (int)sizeof(value_to_str)) { + ALOGE("Error in converting value to string: %d", ret_val); + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; + } + wlan_service_set_tcp_limit_output_bytes(value_to_str); + } + } + break; + default: + { + /* Error case should not happen print log */ + ALOGE("%s: Invalid throughput level value", __FUNCTION__); + return WIFI_ERROR_INVALID_ARGS; + } + } + } else { + /* Error case should not happen print log */ + ALOGE("%s: Invalid throughput change direction", __FUNCTION__); + return ret; + } + ret = WIFI_SUCCESS; + } + break; + default: + /* Error case should not happen print log */ + ALOGE("%s: Wrong subcmd received %d", __FUNCTION__, mSubcmd); + break; + } + + return ret; + +cleanup: + return ret; } wifi_error wifi_init_tcp_param_change_event_handler(wifi_interface_handle iface) { - wifi_handle wifiHandle = getWifiHandle(iface); - TCPParamCommand *tcpParamCommand; - - if (wifiHandle == NULL) { - ALOGE("%s: Interface Handle is invalid", __func__); - return WIFI_ERROR_UNKNOWN; - } - - hal_info *info = getHalInfo(wifiHandle); - if (!info) - return WIFI_ERROR_UNKNOWN; - - tcpParamCommand = TCPParamCommand::instance(wifiHandle, 0); - if (tcpParamCommand == NULL) { - ALOGE("%s: Error TcpParamCommand NULL", __FUNCTION__); - return WIFI_ERROR_OUT_OF_MEMORY; - } - - info->tcp_param_handler = (tcp_param_cmd_handler *)malloc(sizeof(tcp_param_cmd_handler)); - if (info->tcp_param_handler == NULL) { - ALOGE("%s: Allocation of tcp handler failed",__FUNCTION__); - delete tcpParamCommand; - return WIFI_ERROR_OUT_OF_MEMORY; - } - info->tcp_param_handler->tcpParamCommand = tcpParamCommand; - - if (wlan_service_read_sys_param("/proc/sys/net/ipv4/tcp_limit_output_bytes", - tcpParamCommand->def_tcp_limit_output_bytes, - SIZE_TCP_PARAM) == 0) { - tcpParamCommand->def_tcp_limit_output_bytes_valid = true; - } - - if (wlan_service_read_sys_param("/proc/sys/net/ipv4/tcp_adv_win_scale", - tcpParamCommand->def_tcp_adv_win_scale, - SIZE_TCP_PARAM) == 0) { - tcpParamCommand->def_tcp_adv_win_scale_valid = true; - } - - return WIFI_SUCCESS; + wifi_handle wifiHandle = getWifiHandle(iface); + TCPParamCommand *tcpParamCommand; + + if (wifiHandle == NULL) { + ALOGE("%s: Interface Handle is invalid", __func__); + return WIFI_ERROR_UNKNOWN; + } + + hal_info *info = getHalInfo(wifiHandle); + if (!info) + return WIFI_ERROR_UNKNOWN; + + tcpParamCommand = TCPParamCommand::instance(wifiHandle, 0); + if (tcpParamCommand == NULL) { + ALOGE("%s: Error TcpParamCommand NULL", __FUNCTION__); + return WIFI_ERROR_OUT_OF_MEMORY; + } + + info->tcp_param_handler = (tcp_param_cmd_handler *)malloc(sizeof(tcp_param_cmd_handler)); + if (info->tcp_param_handler == NULL) { + ALOGE("%s: Allocation of tcp handler failed",__FUNCTION__); + delete tcpParamCommand; + return WIFI_ERROR_OUT_OF_MEMORY; + } + info->tcp_param_handler->tcpParamCommand = tcpParamCommand; + + if (wlan_service_read_sys_param("/proc/sys/net/ipv4/tcp_limit_output_bytes", + tcpParamCommand->def_tcp_limit_output_bytes, + SIZE_TCP_PARAM) == 0) { + tcpParamCommand->def_tcp_limit_output_bytes_valid = true; + } + + if (wlan_service_read_sys_param("/proc/sys/net/ipv4/tcp_adv_win_scale", + tcpParamCommand->def_tcp_adv_win_scale, + SIZE_TCP_PARAM) == 0) { + tcpParamCommand->def_tcp_adv_win_scale_valid = true; + } + + return WIFI_SUCCESS; } void cleanupTCPParamCommand(hal_info *info) { - TCPParamCommand *tcpParamCommand; + TCPParamCommand *tcpParamCommand; - if (info == NULL || info->tcp_param_handler == NULL) - return; + if (info == NULL || info->tcp_param_handler == NULL) + return; - tcpParamCommand = info->tcp_param_handler->tcpParamCommand; + tcpParamCommand = info->tcp_param_handler->tcpParamCommand; - if (tcpParamCommand) { - if (tcpParamCommand->def_tcp_limit_output_bytes_valid) - wlan_service_update_sys_param("/proc/sys/net/ipv4/tcp_limit_output_bytes", - tcpParamCommand->def_tcp_limit_output_bytes); - wlan_service_update_sys_param("/proc/sys/net/ipv4/tcp_use_userconfig", "0"); - if (tcpParamCommand->def_tcp_adv_win_scale_valid) - wlan_service_update_sys_param("/proc/sys/net/ipv4/tcp_adv_win_scale", - tcpParamCommand->def_tcp_adv_win_scale); - delete tcpParamCommand; - } + if (tcpParamCommand) { + if (tcpParamCommand->def_tcp_limit_output_bytes_valid) + wlan_service_update_sys_param("/proc/sys/net/ipv4/tcp_limit_output_bytes", + tcpParamCommand->def_tcp_limit_output_bytes); + wlan_service_update_sys_param("/proc/sys/net/ipv4/tcp_use_userconfig", "0"); + if (tcpParamCommand->def_tcp_adv_win_scale_valid) + wlan_service_update_sys_param("/proc/sys/net/ipv4/tcp_adv_win_scale", + tcpParamCommand->def_tcp_adv_win_scale); + delete tcpParamCommand; + } - free(info->tcp_param_handler); + free(info->tcp_param_handler); - return; + return; } /** @@ -286,26 +296,26 @@ void cleanupTCPParamCommand(hal_info *info) { */ wifi_error wlan_service_update_sys_param(const char *path, const char *str) { - int ret; - FILE *fp; - fp = fopen(path, "w"); + int ret; + FILE *fp; + fp = fopen(path, "w"); - if (fp == NULL) { - ALOGE("%s: unable to open %s", __FUNCTION__, path); - return WIFI_ERROR_UNKNOWN; - } + if (fp == NULL) { + ALOGE("%s: unable to open %s", __FUNCTION__, path); + return WIFI_ERROR_UNKNOWN; + } - ALOGD("%s: %s %s", __FUNCTION__, path, str); + ALOGD("%s: %s %s", __FUNCTION__, path, str); - ret = fputs(str, fp); - fclose(fp); + ret = fputs(str, fp); + fclose(fp); - if (ret < 0) { - ALOGE("%s: failed to write %s to %s with err %d", __FUNCTION__, str, path, ret); - return mapKernelErrortoWifiHalError(ret); - } + if (ret < 0) { + ALOGE("%s: failed to write %s to %s with err %d", __FUNCTION__, str, path, ret); + return mapKernelErrortoWifiHalError(ret); + } - return WIFI_SUCCESS; + return WIFI_SUCCESS; } /** @@ -319,46 +329,46 @@ wifi_error wlan_service_update_sys_param(const char *path, const char *str) */ wifi_error wlan_service_read_sys_param(const char *path, char *str, size_t max_size) { - size_t ret_len; - FILE *fp = fopen(path, "r"); + size_t ret_len; + FILE *fp = fopen(path, "r"); - if (fp == NULL) { - ALOGE("%s: unable to open %s", __FUNCTION__, path); - return WIFI_ERROR_UNKNOWN; - } + if (fp == NULL) { + ALOGE("%s: unable to open %s", __FUNCTION__, path); + return WIFI_ERROR_UNKNOWN; + } - ret_len = fread(str, 1, max_size, fp); - fclose(fp); + ret_len = fread(str, 1, max_size, fp); + fclose(fp); - if (ret_len == 0 || ret_len == max_size) { - ALOGE("Faild to read %s, ret_len = %zu", path, ret_len); - return WIFI_ERROR_UNKNOWN; - } + if (ret_len == 0 || ret_len == max_size) { + ALOGE("Faild to read %s, ret_len = %zu", path, ret_len); + return WIFI_ERROR_UNKNOWN; + } - ALOGD("%s: %s %s", __FUNCTION__, path, str); - return WIFI_SUCCESS; + ALOGD("%s: %s %s", __FUNCTION__, path, str); + return WIFI_SUCCESS; } int TCPParamCommand::wlan_service_set_tcp_adv_win_scale(char *str) { - return wlan_service_update_sys_param( - "/proc/sys/net/ipv4/tcp_adv_win_scale", str); + return wlan_service_update_sys_param( + "/proc/sys/net/ipv4/tcp_adv_win_scale", str); } int TCPParamCommand::wlan_service_set_tcp_use_userconfig(const char *str) { - return wlan_service_update_sys_param( - "/proc/sys/net/ipv4/tcp_use_userconfig", str); + return wlan_service_update_sys_param( + "/proc/sys/net/ipv4/tcp_use_userconfig", str); } int TCPParamCommand::wlan_service_set_tcp_delack_seg(char *str) { - return wlan_service_update_sys_param( - "/proc/sys/net/ipv4/tcp_delack_seg", str); + return wlan_service_update_sys_param( + "/proc/sys/net/ipv4/tcp_delack_seg", str); } int TCPParamCommand::wlan_service_set_tcp_limit_output_bytes(char *str) { - return wlan_service_update_sys_param ( - "/proc/sys/net/ipv4/tcp_limit_output_bytes", str); + return wlan_service_update_sys_param ( + "/proc/sys/net/ipv4/tcp_limit_output_bytes", str); } diff --git a/wcn6740/qcwcn/wifi_hal/tdls.cpp b/wcn6740/qcwcn/wifi_hal/tdls.cpp index f12816f..2082fef 100644 --- a/wcn6740/qcwcn/wifi_hal/tdls.cpp +++ b/wcn6740/qcwcn/wifi_hal/tdls.cpp @@ -24,6 +24,11 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include "sync.h" @@ -374,8 +379,10 @@ wifi_error wifi_enable_tdls(wifi_interface_handle iface, /* Add the attributes */ nl_data = pTdlsCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) + if (!nl_data){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ALOGV("%s: MAC_ADDR: " MAC_ADDR_STR, __FUNCTION__, MAC_ADDR_ARRAY(addr)); ret = pTdlsCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR, (char *)addr, 6); @@ -460,8 +467,10 @@ wifi_error wifi_disable_tdls(wifi_interface_handle iface, mac_addr addr) /* Add the attributes */ nl_data = pTdlsCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) + if (!nl_data){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = pTdlsCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR, (char *)addr, 6); if (ret != WIFI_SUCCESS) @@ -508,8 +517,10 @@ wifi_error wifi_get_tdls_status(wifi_interface_handle iface, mac_addr addr, /* Add the attributes */ nl_data = pTdlsCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) + if (!nl_data){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = pTdlsCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR, (char *)addr, 6); if (ret != WIFI_SUCCESS) diff --git a/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp b/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp index f31c641..4e0d0da 100644 --- a/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp +++ b/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp @@ -144,7 +144,7 @@ wifi_error wifi_get_wake_reason_stats(wifi_interface_handle iface, 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_init_tcp_param_change_event_handler(wifi_interface_handle iface); /* Initialize/Cleanup */ @@ -1117,7 +1117,7 @@ static int wifi_get_iface_id(hal_info *info, const char *iface) wifi_error wifi_initialize(wifi_handle *handle) { - wifi_error ret = WIFI_SUCCESS; + wifi_error ret = WIFI_ERROR_UNKNOWN; wifi_interface_handle iface_handle; struct nl_sock *cmd_sock = NULL; struct nl_sock *event_sock = NULL; @@ -1292,6 +1292,7 @@ wifi_error wifi_initialize(wifi_handle *handle) free(info->interfaces[i]); } ALOGE("%s no iface with wlan0", __func__); + ret = WIFI_ERROR_UNKNOWN; goto unload; } iface_handle = (wifi_interface_handle)info->interfaces[index]; @@ -1448,7 +1449,7 @@ unload: cleanupGscanHandlers(info); cleanupRSSIMonitorHandler(info); cleanupRadioHandler(info); - cleanupTCPParamCommand(info); + cleanupTCPParamCommand(info); free(info->event_cb); if (info->driver_supported_features.flags) { free(info->driver_supported_features.flags); @@ -2523,8 +2524,10 @@ wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u32( QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX, @@ -2578,8 +2581,10 @@ wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs) /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } /* Add the fixed part of the mac_oui to the nl command */ ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG, nodfs); @@ -2626,8 +2631,10 @@ wifi_error wifi_start_sending_offloaded_packet(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u32( QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL, @@ -2699,8 +2706,10 @@ wifi_error wifi_stop_sending_offloaded_packet(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u32( QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL, @@ -2755,8 +2764,10 @@ static wifi_error wifi_set_packet_filter(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_SUB_CMD, QCA_WLAN_SET_PACKET_FILTER); @@ -2845,8 +2856,10 @@ static wifi_error wifi_get_packet_filter_capabilities( /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_SUB_CMD, QCA_WLAN_GET_PACKET_FILTER); @@ -2897,8 +2910,10 @@ static wifi_error wifi_configure_nd_offload(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u8(QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_FLAG, enable); if (ret != WIFI_SUCCESS) @@ -2966,8 +2981,10 @@ wifi_error wifi_write_packet_filter(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_SUB_CMD, QCA_WLAN_WRITE_PACKET_FILTER); @@ -3005,7 +3022,7 @@ wifi_error wifi_write_packet_filter(wifi_interface_handle iface, vCommand->attr_end(nlData); ret = vCommand->requestResponse(); - if (ret != WIFI_SUCCESS) { + if (ret != WIFI_SUCCESS) { ALOGE("%s: requestResponse Error:%d",__func__, ret); goto cleanup; } @@ -3044,8 +3061,10 @@ wifi_error wifi_enable_packet_filter(wifi_interface_handle handle, } /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } subcmd = enable ? QCA_WLAN_ENABLE_PACKET_FILTER : QCA_WLAN_DISABLE_PACKET_FILTER; @@ -3091,7 +3110,7 @@ cleanup: static wifi_error wifi_read_packet_filter(wifi_interface_handle handle, u32 src_offset, u8 *host_dst, u32 length) { - wifi_error ret = WIFI_SUCCESS; + wifi_error ret = WIFI_ERROR_UNKNOWN; struct nlattr *nlData; WifihalGeneric *vCommand = NULL; interface_info *ifaceInfo = getIfaceInfo(handle); @@ -3346,8 +3365,10 @@ wifi_error wifi_get_radar_history(wifi_interface_handle handle, /* Add the vendor specific attributes for the NL command. */ nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } vCommand->attr_end(nlData); diff --git a/wcn6740/qcwcn/wifi_hal/wificonfig.cpp b/wcn6740/qcwcn/wifi_hal/wificonfig.cpp index 3a47634..989399f 100644 --- a/wcn6740/qcwcn/wifi_hal/wificonfig.cpp +++ b/wcn6740/qcwcn/wifi_hal/wificonfig.cpp @@ -24,6 +24,11 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include "sync.h" @@ -89,6 +94,7 @@ wifi_error wifi_extended_dtim_config_set(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("wifi_extended_dtim_config_set: failed attr_start for " "VENDOR_DATA. Error:%d", ret); goto cleanup; @@ -237,6 +243,7 @@ wifi_error wifi_set_qpower(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("wifi_set_qpower: failed attr_start for " "VENDOR_DATA. Error:%d", ret); goto cleanup; @@ -244,6 +251,7 @@ wifi_error wifi_set_qpower(wifi_interface_handle iface, if (wifiConfigCommand->put_u8( QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER, powersave)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("wifi_set_qpower(): failed to put vendor data. " "Error:%d", ret); goto cleanup; @@ -305,6 +313,7 @@ wifi_error wifi_set_beacon_wifi_iface_stats_averaging_factor( /* Add the vendor specific attributes for the NL command. */ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("wifi_set_beacon_wifi_iface_stats_averaging_factor: failed " "attr_start for VENDOR_DATA. Error:%d", ret); goto cleanup; @@ -312,6 +321,7 @@ wifi_error wifi_set_beacon_wifi_iface_stats_averaging_factor( if (wifiConfigCommand->put_u32( QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR, factor)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("wifi_set_beacon_wifi_iface_stats_averaging_factor(): failed to " "put vendor data. Error:%d", ret); goto cleanup; @@ -371,6 +381,7 @@ wifi_error wifi_set_guard_time(wifi_request_id id, /* Add the vendor specific attributes for the NL command. */ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("wifi_set_guard_time: failed attr_start for VENDOR_DATA. " "Error:%d", ret); goto cleanup; @@ -378,6 +389,7 @@ wifi_error wifi_set_guard_time(wifi_request_id id, if (wifiConfigCommand->put_u32( QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME, guard_time)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("wifi_set_guard_time: failed to add vendor data."); goto cleanup; } @@ -485,6 +497,7 @@ wifi_error wifi_select_SARv01_tx_power_scenario(wifi_interface_handle handle, if (wifiConfigCommand->put_u32( QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SAR_ENABLE, bdf_file)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("failed to put SAR_ENABLE"); goto cleanup; } @@ -711,6 +724,7 @@ wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle) /* Add the vendor specific attributes for the NL command. */ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("wifi_reset_tx_power_scenario: failed attr_start for VENDOR_DATA. " "Error:%d", ret); goto cleanup; @@ -718,6 +732,7 @@ wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle) if (wifiConfigCommand->put_u32(QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SAR_ENABLE, QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_NONE)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("failed to put SAR_ENABLE or NUM_SPECS"); goto cleanup; } @@ -770,12 +785,14 @@ wifi_error wifi_set_thermal_mitigation_mode(wifi_handle handle, /* Set the interface Id of the message. */ if (wifiConfigCommand->put_u32(NL80211_ATTR_IFINDEX, info->interfaces[0]->id)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to put iface id", __FUNCTION__); - goto cleanup; + goto cleanup; } nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed in attr_start for VENDOR_DATA, Error:%d", __FUNCTION__, ret); goto cleanup; @@ -783,6 +800,7 @@ wifi_error wifi_set_thermal_mitigation_mode(wifi_handle handle, if (wifiConfigCommand->put_u32(QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_VALUE, QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_SET_LEVEL)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("Failed to put THERMAL_LEVEL command type"); goto cleanup; } @@ -815,6 +833,7 @@ wifi_error wifi_set_thermal_mitigation_mode(wifi_handle handle, if (wifiConfigCommand->put_u32( QCA_WLAN_VENDOR_ATTR_THERMAL_LEVEL, qca_vendor_thermal_level)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("Failed to put thermal level"); goto cleanup; } @@ -822,6 +841,7 @@ wifi_error wifi_set_thermal_mitigation_mode(wifi_handle handle, if (wifiConfigCommand->put_u32( QCA_WLAN_VENDOR_ATTR_THERMAL_COMPLETION_WINDOW, completion_window)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("Failed to put thermal completion window"); goto cleanup; } @@ -1110,6 +1130,7 @@ wifi_error wifi_virtual_interface_create(wifi_handle handle, if (iface_type == WIFI_INTERFACE_TYPE_STA) { int sock = socket(AF_INET, SOCK_DGRAM, 0); if(sock < 0) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s :socket error, Failed to bring up iface \n", __func__); goto done; } @@ -1117,11 +1138,13 @@ wifi_error wifi_virtual_interface_create(wifi_handle handle, memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s :Could not read interface %s flags \n", __func__, ifname); goto done; } ifr.ifr_flags |= IFF_UP; if (ioctl(sock, SIOCSIFFLAGS, &ifr) != 0) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s :Could not bring iface %s up \n", __func__, ifname); } } @@ -1233,6 +1256,7 @@ wifi_error wifi_set_latency_mode(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: failed attr_start for VENDOR_DATA. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1240,6 +1264,7 @@ wifi_error wifi_set_latency_mode(wifi_interface_handle iface, if (wifiConfigCommand->put_u16( QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL, level)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: failed to put vendor data. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1306,6 +1331,7 @@ wifi_error wifi_multi_sta_set_primary_connection(wifi_handle handle, /* Add the vendor specific attributes for the NL command. */ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: failed attr_start for VENDOR_DATA. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1313,6 +1339,7 @@ wifi_error wifi_multi_sta_set_primary_connection(wifi_handle handle, if (wifiConfigCommand->put_u8( QCA_WLAN_VENDOR_ATTR_CONFIG_CONCURRENT_STA_PRIMARY, 1)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: failed to put vendor data. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1391,13 +1418,15 @@ wifi_error wifi_multi_sta_set_use_case(wifi_handle handle, /* Set the interface Id of the message. */ if (wifiConfigCommand->put_u32(NL80211_ATTR_IFINDEX, info->interfaces[0]->id)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: Failed to put iface id", __FUNCTION__); - goto cleanup; + goto cleanup; } /* Add the vendor specific attributes for the NL command. */ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); if (!nlData) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: failed attr_start for VENDOR_DATA. Error:%d", __FUNCTION__, ret); goto cleanup; @@ -1405,6 +1434,7 @@ wifi_error wifi_multi_sta_set_use_case(wifi_handle handle, if (wifiConfigCommand->put_u8( QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_CONFIG, use_case)) { + ret = WIFI_ERROR_UNKNOWN; ALOGE("%s: failed to put use_case. Error:%d", __FUNCTION__, ret); goto cleanup; diff --git a/wcn6740/qcwcn/wifi_hal/wifihal_vendor.cpp b/wcn6740/qcwcn/wifi_hal/wifihal_vendor.cpp index e94506f..4837e63 100644 --- a/wcn6740/qcwcn/wifi_hal/wifihal_vendor.cpp +++ b/wcn6740/qcwcn/wifi_hal/wifihal_vendor.cpp @@ -25,6 +25,11 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * Changes from Qualcomm Innovation Center are provided under the following license: + + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause-Clear */ #include "sync.h" @@ -543,8 +548,10 @@ wifi_error wifi_get_nud_stats(wifi_interface_handle iface, goto cleanup; /*add the attributes*/ nl_data = NUDCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) + if (!nl_data){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } /**/ NUDCommand->attr_end(nl_data); @@ -593,13 +600,17 @@ wifi_error wifi_clear_nud_stats(wifi_interface_handle iface, /*add the attributes*/ nl_data = NUDCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) + if (!nl_data){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } if (mData.pkt_Type) { /*set the packet info attributes in nested*/ nl_pktInfo = NUDCommand->attr_start(QCA_ATTR_NUD_STATS_SET_DATA_PKT_INFO); - if (!nl_pktInfo) + if (!nl_pktInfo){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } else { ALOGV(" %s: pkt_type %d domain_name :%s" " src_port %d dst_port :%d" diff --git a/wcn6740/qcwcn/wifi_hal/wifilogger.cpp b/wcn6740/qcwcn/wifi_hal/wifilogger.cpp index 96e9911..384633a 100644 --- a/wcn6740/qcwcn/wifi_hal/wifilogger.cpp +++ b/wcn6740/qcwcn/wifi_hal/wifilogger.cpp @@ -156,8 +156,10 @@ wifi_error wifi_start_logging(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = wifiLoggerCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = wifiLoggerCommand->put_u32(QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID, ring_id); @@ -290,8 +292,10 @@ wifi_error wifi_get_logger_supported_feature_set(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = wifiLoggerCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = wifiLoggerCommand->put_u32(QCA_WLAN_VENDOR_ATTR_LOGGER_SUPPORTED, requestId); @@ -361,12 +365,15 @@ wifi_error wifi_get_ring_data(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = wifiLoggerCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } if (wifiLoggerCommand->put_u32( QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID, ring_id)) { + ret = WIFI_ERROR_UNKNOWN; goto cleanup; } wifiLoggerCommand->attr_end(nlData); @@ -484,8 +491,10 @@ wifi_error wifi_get_driver_version(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = wifiLoggerCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } ret = wifiLoggerCommand->put_u8( QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION, requestId); @@ -555,8 +564,10 @@ wifi_error wifi_get_firmware_memory_dump(wifi_interface_handle iface, /* Add the vendor specific attributes for the NL command. */ nlData = wifiLoggerCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nlData) + if (!nlData){ + ret = WIFI_ERROR_UNKNOWN; goto cleanup; + } wifiLoggerCommand->attr_end(nlData); diff --git a/wcn6740/qcwcn/wifi_hal/wifilogger_diag.cpp b/wcn6740/qcwcn/wifi_hal/wifilogger_diag.cpp index 50de781..f026a78 100644 --- a/wcn6740/qcwcn/wifi_hal/wifilogger_diag.cpp +++ b/wcn6740/qcwcn/wifi_hal/wifilogger_diag.cpp @@ -739,7 +739,7 @@ static wifi_error process_roam_event(hal_info *info, u32 id, wlan_roam_candidate_found_payload_type *pRoamCandidateFound; roam_candidate_found_vendor_data_t roamCandidateFoundVendata; memset(&roamCandidateFoundVendata, 0, - sizeof(roamCandidateFoundVendata)); + sizeof(roamCandidateFoundVendata)); pConnectEvent->event = WIFI_EVENT_ROAM_CANDIDATE_FOUND; pRoamCandidateFound = (wlan_roam_candidate_found_payload_type *)buf; pTlv = &pConnectEvent->tlvs[0]; -- cgit v1.2.3