diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-10-03 23:26:32 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-10-03 23:26:32 +0000 |
commit | cffc5298147079ba93a41846734b9b3ef696e0a8 (patch) | |
tree | afa3e52ff77ff24a93039d6dbed131e8f8ad12ab | |
parent | 7ecdf23eccadac177efa843060ef34cb6888c0d9 (diff) | |
parent | 00825b3dbed416bb0f84e5de421cda2d7ee43a50 (diff) | |
download | wlan-cffc5298147079ba93a41846734b9b3ef696e0a8.tar.gz |
Snap for 9133013 from 00825b3dbed416bb0f84e5de421cda2d7ee43a50 to tm-qpr2-release
Change-Id: I19011ff4ee3777d12fac4c53bdee164ecc297606
23 files changed, 2261 insertions, 518 deletions
@@ -1,6 +1,6 @@ #set TARGET_USES_HARDWARE_QCOM_WLAN to false to disable this project. ifneq ($(TARGET_USES_HARDWARE_QCOM_WLAN),false) - ifneq ($(filter lynx,$(TARGET_DEVICE)),) + ifneq ($(filter wcn6740,$(BOARD_WLAN_CHIP)),) include $(call all-named-subdir-makefiles,wcn6740) else include $(call all-named-subdir-makefiles,legacy) @@ -1,3 +1,4 @@ arabawy@google.com etancohen@google.com kumachang@google.com +hsuvictor@google.com diff --git a/wcn6740/qcwcn/wifi_hal/common.h b/wcn6740/qcwcn/wifi_hal/common.h index a48605a..8816f5f 100644 --- a/wcn6740/qcwcn/wifi_hal/common.h +++ b/wcn6740/qcwcn/wifi_hal/common.h @@ -213,6 +213,7 @@ typedef struct hal_info_s { bool apf_enabled; bool support_nan_ext_cmd; pkt_log_version pkt_log_ver; + qca_wlan_vendor_sar_version sar_version; } hal_info; typedef struct { 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/ifaceeventhandler.cpp b/wcn6740/qcwcn/wifi_hal/ifaceeventhandler.cpp index ef582e0..0c44e25 100644 --- a/wcn6740/qcwcn/wifi_hal/ifaceeventhandler.cpp +++ b/wcn6740/qcwcn/wifi_hal/ifaceeventhandler.cpp @@ -33,6 +33,7 @@ #include <errno.h> #include "ifaceeventhandler.h" +#include "common.h" /* Used to handle NL command events from driver/firmware. */ IfaceEventHandlerCommand *mwifiEventHandler = NULL; @@ -560,6 +561,21 @@ int WifihalGeneric::handleResponse(WifiEvent &reply) wifiParseRadarHistory(); } break; + case QCA_NL80211_VENDOR_SUBCMD_GET_SAR_CAPABILITY: + { + struct nlattr *tb_vendor[ + QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_MAX + 1]; + nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_MAX, + (struct nlattr *)mVendorData,mDataLen, NULL); + + if (tb_vendor[QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_VERSION]) + { + mInfo->sar_version = (qca_wlan_vendor_sar_version) nla_get_u32(tb_vendor[ + QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_VERSION]); + } + ALOGV("%s: sar_version return %d", __func__, mInfo->sar_version); + } + break; default : ALOGE("%s: Wrong Wi-Fi HAL event received %d", __func__, mSubcmd); } @@ -912,3 +928,31 @@ void WifihalGeneric::freeCachedRadarHistory() { mRadarResultParams.num_entries = 0; } } + +wifi_error WifihalGeneric::getSarVersion(wifi_interface_handle handle) +{ + wifi_error ret; + interface_info *ifaceInfo = getIfaceInfo(handle); + + + /* Create the NL message. */ + ret = create(); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: Failed to create NL message, Error:%d", __FUNCTION__, ret); + return ret; + } + + /* Set the interface Id of the message. */ + ret = set_iface_id(ifaceInfo->name); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: Failed to set interface Id of message, Error:%d", __FUNCTION__, ret); + return ret; + } + + ret = requestResponse(); + if (ret != WIFI_SUCCESS) + ALOGE("%s: Failed to send request, Error:%d", __FUNCTION__, ret); + + return ret; +} + diff --git a/wcn6740/qcwcn/wifi_hal/ifaceeventhandler.h b/wcn6740/qcwcn/wifi_hal/ifaceeventhandler.h index f0b681a..eef9624 100644 --- a/wcn6740/qcwcn/wifi_hal/ifaceeventhandler.h +++ b/wcn6740/qcwcn/wifi_hal/ifaceeventhandler.h @@ -126,6 +126,7 @@ public: virtual wifi_error copyCachedRadarHistory(radar_history_result *resultBuf, int resultBufSize, int *numResults); virtual void freeCachedRadarHistory(); + virtual wifi_error getSarVersion(wifi_interface_handle handle); }; /** 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/qca-vendor_copy.h b/wcn6740/qcwcn/wifi_hal/qca-vendor_copy.h index c13815b..f56e645 100644 --- a/wcn6740/qcwcn/wifi_hal/qca-vendor_copy.h +++ b/wcn6740/qcwcn/wifi_hal/qca-vendor_copy.h @@ -742,10 +742,10 @@ enum qca_radiotap_vendor_ids { * This event contains Tx VDEV group information, other VDEVs * interface index, and status information. * - * @QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY: Vendor command to - * configure the concurrent session policies when multiple STA interfaces + * @QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_POLICY: Vendor command to + * configure the concurrent session policies when multiple interfaces * are (getting) active. The attributes used by this command are defined - * in enum qca_wlan_vendor_attr_concurrent_sta_policy. + * in enum qca_wlan_vendor_attr_concurrent_policy. * * @QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS: Userspace can use this command * to query usable channels for different interface types such as STA, @@ -819,6 +819,58 @@ enum qca_radiotap_vendor_ids { * * The attributes used with this command are defined in * enum qca_wlan_vendor_attr_mcc_quota. + * + * @QCA_NL80211_VENDOR_SUBCMD_GET_RADIO_COMBINATION_MATRIX: Vendor command to + * get the WLAN radio combinations matrix supported by the device which + * provides the device simultaneous radio configurations such as + * standalone, dual band simultaneous, and single band simultaneous. + * + * The attributes used with this command are defined in + * enum qca_wlan_vendor_attr_radio_combination_matrix. + * + * @QCA_NL80211_VENDOR_SUBCMD_DRIVER_READY: Event indicating to the user space + * that the driver is ready for operations again after recovering from + * internal failures. This occurs following a failure that was indicated by + * @QCA_NL80211_VENDOR_SUBCMD_HANG. + * + * @QCA_NL80211_VENDOR_SUBCMD_PASN: Subcommand used to offload preassociation + * security negotiation and key generation to user space. + * + * When used as an event, the driver requests userspace to trigger the PASN + * authentication or dropping of a PTKSA for the indicated peer devices. + * When used as a command response, userspace indicates a consolidated + * status report for all the peers that were requested for. + * + * The attributes used with this command are defined in + * enum qca_wlan_vendor_attr_pasn. + * + * @QCA_NL80211_VENDOR_SUBCMD_SECURE_RANGING_CONTEXT: Subcommand used to set + * secure ranging context such as TK and LTF keyseed for each peer + * requested by the driver with a @QCA_NL80211_VENDOR_SUBCMD_PASN event. + * + * The attributes used with this command are defined in + * enum qca_wlan_vendor_attr_secure_ranging_ctx. + * + * @QCA_NL80211_VENDOR_SUBCMD_COAP_OFFLOAD: This vendor subcommand is used to + * enable/disable offload processing in firmware during system/runtime + * suspend for CoAP messages (see RFC7252: The Constrained Application + * Protocol) and fetch information of the CoAP messages cached during + * offload processing. + * + * The attributes used with this command are defined in + * enum qca_wlan_vendor_attr_coap_offload. + * + * @QCA_NL80211_VENDOR_SUBCMD_SCS_RULE_CONFIG: Subcommand to configure + * (add, remove, or change) a Stream Classification Service (SCS) rule. + * + * The attributes used with this event are defined in + * enum qca_wlan_vendor_attr_scs_rule_config. + * + * @QCA_NL80211_VENDOR_SUBCMD_GET_SAR_CAPABILITY: Fetch SAR capabilities + * supported by the WLAN firmware. + * + * The attributes used with this command are defined in + * enum qca_wlan_vendor_attr_sar_capability. */ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_UNSPEC = 0, @@ -1005,7 +1057,7 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_UPDATE_SSID = 194, QCA_NL80211_VENDOR_SUBCMD_WIFI_FW_STATS = 195, QCA_NL80211_VENDOR_SUBCMD_MBSSID_TX_VDEV_STATUS = 196, - QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY = 197, + QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_POLICY = 197, QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS = 198, QCA_NL80211_VENDOR_SUBCMD_GET_RADAR_HISTORY = 199, QCA_NL80211_VENDOR_SUBCMD_MDNS_OFFLOAD = 200, @@ -1014,8 +1066,22 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_ROAM_EVENTS = 203, QCA_NL80211_VENDOR_SUBCMD_RATEMASK_CONFIG = 204, QCA_NL80211_VENDOR_SUBCMD_MCC_QUOTA = 205, + /* 206..212 - reserved for QCA */ + QCA_NL80211_VENDOR_SUBCMD_GET_RADIO_COMBINATION_MATRIX = 213, + QCA_NL80211_VENDOR_SUBCMD_DRIVER_READY = 214, + QCA_NL80211_VENDOR_SUBCMD_PASN = 215, + QCA_NL80211_VENDOR_SUBCMD_SECURE_RANGING_CONTEXT = 216, + QCA_NL80211_VENDOR_SUBCMD_COAP_OFFLOAD = 217, + QCA_NL80211_VENDOR_SUBCMD_SCS_RULE_CONFIG = 218, + QCA_NL80211_VENDOR_SUBCMD_GET_SAR_CAPABILITY = 219, }; +/* Compatibility defines for previously used subcmd names. + * These values should not be used in any new implementation. + */ +#define QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY \ + QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_POLICY + enum qca_wlan_vendor_attr { QCA_WLAN_VENDOR_ATTR_INVALID = 0, /* used by QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY */ @@ -1301,6 +1367,9 @@ enum qca_roam_reason { enum qca_wlan_vendor_attr_roam_auth { QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_INVALID = 0, + /* Indicates BSSID of the roamed AP for non-MLO roaming and MLD address + * of the roamed AP for MLO roaming. + */ QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_BSSID, QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_REQ_IE, QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_RESP_IE, @@ -1345,6 +1414,11 @@ enum qca_wlan_vendor_attr_roam_auth { * Defined by enum qca_roam_reason. */ QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_REASON = 14, + /* A nested attribute containing per-link information of all the links + * of MLO connection done while roaming. The attributes used inside this + * nested attribute are defined in enum qca_wlan_vendor_attr_mlo_links. + */ + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_MLO_LINKS = 15, /* keep last */ QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_AFTER_LAST, @@ -1526,6 +1600,12 @@ enum qca_wlan_vendor_attr_p2p_listen_offload { * Used with command to configure ACS operation for EHT mode. * Disable (flag attribute not present) - EHT disabled and * Enable (flag attribute present) - EHT enabled. + * + * @QCA_WLAN_VENDOR_ATTR_ACS_LAST_SCAN_AGEOUT_TIME: Optional (u32). + * Used with command to configure how older scan can be considered for ACS + * scoring. In case scan was performed on a partial set of channels configured + * with this command within last QCA_WLAN_VENDOR_ATTR_ACS_LAST_SCAN_AGEOUT_TIME + * (in ms), scan only the remaining channels. */ enum qca_wlan_vendor_attr_acs_offload { QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_INVALID = 0, @@ -1548,6 +1628,7 @@ enum qca_wlan_vendor_attr_acs_offload { QCA_WLAN_VENDOR_ATTR_ACS_EDMG_CHANNEL = 17, QCA_WLAN_VENDOR_ATTR_ACS_PUNCTURE_BITMAP = 18, QCA_WLAN_VENDOR_ATTR_ACS_EHT_ENABLED = 19, + QCA_WLAN_VENDOR_ATTR_ACS_LAST_SCAN_AGEOUT_TIME = 20, /* keep last */ QCA_WLAN_VENDOR_ATTR_ACS_AFTER_LAST, @@ -1631,17 +1712,41 @@ enum qca_wlan_vendor_acs_hw_mode { * operation is specifically mentioned (against its respective * documentation) to support either of these or both modes. * @QCA_WLAN_VENDOR_FEATURE_USE_ADD_DEL_VIRTUAL_INTF_FOR_NDI: Flag indicates - * that the driver requires add/del virtual interface path using the + * that the driver requires add/del virtual interface path using the * generic nl80211 commands for NDP interface create/delete and to * register/unregister the netdev instead of creating/deleting the NDP * interface using the vendor commands * QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE and * QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE. With the latest kernel - * (5.12 version onward), interface creation/deletion is not allowed using - * vendor commands as it leads to a deadlock while acquiring the RTNL_LOCK - * during the register/unregister of netdev. Create and delete NDP - * interface using NL80211_CMD_NEW_INTERFACE and NL80211_CMD_DEL_INTERFACE - * commands respectively if the driver advertises this capability set. + * (5.12 version onward), interface creation/deletion is not allowed using + * vendor commands as it leads to a deadlock while acquiring the RTNL_LOCK + * during the register/unregister of netdev. Create and delete NDP + * interface using NL80211_CMD_NEW_INTERFACE and NL80211_CMD_DEL_INTERFACE + * commands respectively if the driver advertises this capability set. + * @QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_STA: Flag indicates that the device in + * station mode supports secure LTF. If NL80211_EXT_FEATURE_SECURE_LTF is + * set, then QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_STA will be ignored. + * @QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_AP: Flag indicates that the device in AP + * mode supports secure LTF. If NL80211_EXT_FEATURE_SECURE_LTF is set, then + * QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_AP will be ignored. + * @QCA_WLAN_VENDOR_FEATURE_SECURE_RTT_STA: Flag indicates that the device in + * station mode supports secure RTT measurement exchange. If + * NL80211_EXT_FEATURE_SECURE_RTT is set, + * QCA_WLAN_VENDOR_FEATURE_SECURE_RTT_STA will be ignored. + * @QCA_WLAN_VENDOR_FEATURE_SECURE_RTT_AP: Flag indicates that the device in AP + * mode supports secure RTT measurement exchange. If + * NL80211_EXT_FEATURE_SECURE_RTT is set, + * QCA_WLAN_VENDOR_FEATURE_SECURE_RTT_AP will be ignored. + * @QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_STA: Flag indicates that + * the device in station mode supports protection of range negotiation and + * measurement management frames. If + * NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE is set, then + * QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_STA will be ignored. + * @QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_AP: Flag indicates that + * the device in AP mode supports protection of range negotiation and + * measurement management frames. If + * NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE is set, then + * QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_AP will be ignored. * @NUM_QCA_WLAN_VENDOR_FEATURES: Number of assigned feature bits */ enum qca_wlan_vendor_features { @@ -1653,7 +1758,7 @@ enum qca_wlan_vendor_features { QCA_WLAN_VENDOR_FEATURE_OCE_AP = 5, QCA_WLAN_VENDOR_FEATURE_OCE_STA_CFON = 6, QCA_WLAN_VENDOR_FEATURE_SELF_MANAGED_REGULATORY = 7, - QCA_WLAN_VENDOR_FEATURE_TWT = 8, + QCA_WLAN_VENDOR_FEATURE_TWT = 8, QCA_WLAN_VENDOR_FEATURE_11AX = 9, QCA_WLAN_VENDOR_FEATURE_6GHZ_SUPPORT = 10, QCA_WLAN_VENDOR_FEATURE_THERMAL_CONFIG = 11, @@ -1661,6 +1766,12 @@ enum qca_wlan_vendor_features { QCA_WLAN_VENDOR_FEATURE_CONCURRENT_BAND_SESSIONS = 13, QCA_WLAN_VENDOR_FEATURE_TWT_ASYNC_SUPPORT = 14, QCA_WLAN_VENDOR_FEATURE_USE_ADD_DEL_VIRTUAL_INTF_FOR_NDI = 15, + QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_STA = 16, + QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_AP = 17, + QCA_WLAN_VENDOR_FEATURE_SECURE_RTT_STA = 18, + QCA_WLAN_VENDOR_FEATURE_SECURE_RTT_AP = 19, + QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_STA = 20, + QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_AP = 21, NUM_QCA_WLAN_VENDOR_FEATURES /* keep last */ }; @@ -2434,7 +2545,10 @@ enum qca_wlan_vendor_attr_config { QCA_WLAN_VENDOR_ATTR_CONFIG_DISCONNECT_IES = 58, /* 8-bit unsigned value for ELNA bypass. - * 1-Enable, 0-Disable + * 0 - Disable eLNA bypass. + * 1 - Enable eLNA bypass. + * 2 - Reset eLNA bypass configuration, the driver should + * revert to the default configuration of eLNA bypass. */ QCA_WLAN_VENDOR_ATTR_CONFIG_ELNA_BYPASS = 59, @@ -2671,6 +2785,20 @@ enum qca_wlan_vendor_attr_config { */ QCA_WLAN_VENDOR_ATTR_CONFIG_ARP_NS_OFFLOAD = 81, + /* + * 8-bit unsigned value. This attribute can be used to configure the + * data path mode to be followed for audio traffic. Possible values + * are defined in enum qca_wlan_audio_data_path. + */ + QCA_WLAN_VENDOR_ATTR_CONFIG_AUDIO_DATA_PATH = 82, + + /* + * 8-bit unsigned value. This attribute can be used to configure the + * Dedicated Bluetooth Antenna Mode (DBAM) feature. Possible values for + * this attribute are defined in the enum qca_wlan_dbam_config. + */ + QCA_WLAN_VENDOR_ATTR_CONFIG_DBAM = 83, + /* keep last */ QCA_WLAN_VENDOR_ATTR_CONFIG_AFTER_LAST, QCA_WLAN_VENDOR_ATTR_CONFIG_MAX = @@ -2686,6 +2814,19 @@ enum qca_wlan_vendor_attr_config { QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_REPORT_FAIL /** + * enum qca_dbam_config - Specifies DBAM config mode + * @QCA_DBAM_DISABLE: Firmware disables DBAM + * @QCA_DBAM_ENABLE: Firmware enables DBAM opportunistically when + * internal criteria are met. + * @QCA_DBAM_FORCE_ENABLE: Firmware enables DBAM forcefully. + */ +enum qca_dbam_config { + QCA_DBAM_DISABLE = 0, + QCA_DBAM_ENABLE = 1, + QCA_DBAM_FORCE_ENABLE = 2, +}; + +/** * enum qca_wlan_ani_setting - ANI setting type * @QCA_WLAN_ANI_SETTING_AUTO: Automatically determine ANI level * @QCA_WLAN_ANI_SETTING_FIXED: Fix ANI level to the dBm parameter @@ -4098,6 +4239,22 @@ enum qca_wlan_vendor_attr_ll_stats_results { * Possible values are 0-100. */ QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_TS_DUTY_CYCLE = 87, + /* Unsigned 32 bit value. The number of Beacon frames which are received + * from the associated AP and indicate buffered unicast frame(s) for us + * in the TIM element. + */ + QCA_WLAN_VENDOR_ATTR_LL_STATS_TIM_BEACON = 88, + /* Unsigned 32 bit value. The total number of Beacon frames received + * from the associated AP that have wrongly indicated buffered unicast + * traffic in the TIM element for us. + * Below scenarios will be considered as wrong TIM element beacon: + * 1) The related TIM element is set in the beacon for STA but STA + * doesn’t receive any unicast data after this beacon. + * 2) The related TIM element is still set in the beacon for STA + * after STA has indicated power save exit by QoS Null Data frame. + */ + QCA_WLAN_VENDOR_ATTR_LL_STATS_TIM_BEACON_ERR = 89, + /* keep last */ QCA_WLAN_VENDOR_ATTR_LL_STATS_AFTER_LAST, QCA_WLAN_VENDOR_ATTR_LL_STATS_MAX = @@ -4711,7 +4868,7 @@ enum qca_vendor_attr_roam_candidate_selection_criteria { /** * enum qca_vendor_attr_roam_control - Attributes to carry roam configuration - * The following attributes are used to set/get/clear the respective + * The following attributes are used to set/get/clear the respective * configurations to/from the driver. * For the get, the attribute for the configuration to be queried shall * carry any of its acceptable values to the driver. In return, the driver @@ -4913,6 +5070,12 @@ enum qca_vendor_attr_roam_candidate_selection_criteria { * Optional parameter. Scan dwell time for 6G Non Preferred Scanning * Channels. If this attribute is not configured, the driver shall proceed * with default behavior. + * + * @QCA_ATTR_ROAM_CONTROL_RX_LINKSPEED_THRESHOLD: u16 value in Mbps. + * Optional parameter. RX link speed threshold to disable roaming. + * If the current RX link speed is above the threshold, roaming is not + * needed. If this attribute is not configured, or if it is set to 0, the + * driver will not consider the RX link speed in the roaming decision. */ enum qca_vendor_attr_roam_control { QCA_ATTR_ROAM_CONTROL_ENABLE = 1, @@ -4938,6 +5101,7 @@ enum qca_vendor_attr_roam_control { QCA_ATTR_ROAM_CONTROL_MAXIMUM_AWAY_TIME = 21, QCA_ATTR_ROAM_CONTROL_SCAN_6G_PSC_DWELL_TIME = 22, QCA_ATTR_ROAM_CONTROL_SCAN_6G_NON_PSC_DWELL_TIME = 23, + QCA_ATTR_ROAM_CONTROL_LINKSPEED_THRESHOLD = 24, /* keep last */ QCA_ATTR_ROAM_CONTROL_AFTER_LAST, @@ -8663,6 +8827,18 @@ enum qca_wlan_vendor_attr_wifi_test_config { */ QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_BCAST_TWT_SUPPORT = 57, + /* 8-bit unsigned value to configure the driver/firmware to allow eMLSR + * mode for IEEE 802.11be MLO capable devices. If the attribute is set + * to 1, and if the firmware supports this capability too, the STA + * advertises this capability to the AP over Association Request frame. + * This attribute will not have any effect on legacy devices with no + * IEEE 802.11be support. + * 0 - Default behavior + * 1 - Enable eMLSR (Enhanced Multi-link Single-Radio) mode + * This attribute is used to configure the testbed device. + */ + QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_11BE_EMLSR_MODE = 58, + /* keep last */ QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_AFTER_LAST, QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_MAX = @@ -10673,14 +10849,21 @@ enum qca_wlan_vendor_attr_add_sta_node_params { * These values are used by attribute %QCA_VENDOR_ATTR_BTC_CHAIN_MODE of * %QCA_NL80211_VENDOR_SUBCMD_BTC_CHAIN_MODE. * - * @QCA_BTC_CHAIN_SHARED: chains of BT and WLAN 2.4G are shared. - * @QCA_BTC_CHAIN_SEPARATED: chains of BT and WLAN 2.4G are separated. + * @QCA_BTC_CHAIN_SHARED: chains of BT and WLAN 2.4 GHz are shared. + * @QCA_BTC_CHAIN_SEPARATED_HYBRID: chains of BT and WLAN 2.4 GHz are + * separated, hybrid mode. + * @QCA_BTC_CHAIN_SEPARATED_FDD: chains of BT and WLAN 2.4 GHz are + * separated, fixed FDD mode. */ enum qca_btc_chain_mode { QCA_BTC_CHAIN_SHARED = 0, - QCA_BTC_CHAIN_SEPARATED = 1, + QCA_BTC_CHAIN_SEPARATED_HYBRID = 1, + QCA_BTC_CHAIN_SEPARATED_FDD = 2, }; +/* deprecated legacy name */ +#define QCA_BTC_CHAIN_SEPARATED QCA_BTC_CHAIN_SEPARATED_HYBRID + /** * enum qca_vendor_attr_btc_chain_mode - Specifies attributes for BT coex * chain mode. @@ -11589,24 +11772,58 @@ enum qca_wlan_concurrent_sta_policy_config { }; /** - * enum qca_wlan_vendor_attr_concurrent_sta_policy - Defines attributes - * used by QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY vendor command. + * enum qca_wlan_concurrent_ap_policy_config - Concurrent AP policies + * + * @QCA_WLAN_CONCURRENT_AP_POLICY_UNSPECIFIED: No specific policy for this AP + * interface. + * + * @QCA_WLAN_CONCURRENT_AP_POLICY_GAMING_AUDIO: Select interface concurrencies + * to meet gaming audio latency requirements. + * + * @QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING: Select interface + * concurrencies to meet lossless audio streaming requirements. + */ +enum qca_wlan_concurrent_ap_policy_config { + QCA_WLAN_CONCURRENT_AP_POLICY_UNSPECIFIED = 0, + QCA_WLAN_CONCURRENT_AP_POLICY_GAMING_AUDIO = 1, + QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING = 2, +}; + +/** + * enum qca_wlan_vendor_attr_concurrent_policy - Defines attributes + * used by QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_POLICY vendor command. * - * @QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_CONFIG: + * @QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_STA_CONFIG: * u8 attribute. Configures the concurrent STA policy configuration. * Possible values are defined in enum qca_wlan_concurrent_sta_policy_config. + + * @QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AP_CONFIG: + * u8 attribute. Configures the concurrent AP policy configuration. + * Possible values are defined in enum qca_wlan_concurrent_ap_policy_config. */ -enum qca_wlan_vendor_attr_concurrent_sta_policy { - QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_INVALID = 0, - QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_CONFIG = 1, +enum qca_wlan_vendor_attr_concurrent_policy { + QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_STA_CONFIG = 1, + QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AP_CONFIG = 2, /* keep last */ - QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_AFTER_LAST, - QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_MAX = - QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_AFTER_LAST - 1, + QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_MAX = + QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AFTER_LAST - 1, }; +/* Compatibility defines for previously used enum + * qca_wlan_vendor_attr_concurrent_policy names. These values should not be used + * in any new implementation. + */ +#define QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_CONFIG \ + QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_STA_CONFIG +#define QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_MAX \ + QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_MAX +#define qca_wlan_vendor_attr_concurrent_sta_policy \ + qca_wlan_vendor_attr_concurrent_policy + /** * enum qca_sta_connect_fail_reason_codes - Defines values carried * by QCA_WLAN_VENDOR_ATTR_GET_STA_INFO_CONNECT_FAIL_REASON_CODE vendor @@ -11837,6 +12054,82 @@ enum qca_wlan_vendor_attr_mcc_quota { }; /** + * enum qca_wlan_vendor_attr_supported_radio_cfg - Attributes for + * radio configurations present in each radio combination. + * + * @QCA_WLAN_VENDOR_ATTR_SUPPORTED_RADIO_CFG_BAND: u32 attribute indicates + * the band info in the radio configuration. Uses the enum qca_set_band values. + * + * @QCA_WLAN_VENDOR_ATTR_SUPPORTED_RADIO_CFG_ANTENNA: u8 attribute indicates + * the number of antennas info in the radio configuration. + */ +enum qca_wlan_vendor_attr_supported_radio_cfg { + QCA_WLAN_VENDOR_ATTR_SUPPORTED_RADIO_CFG_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_SUPPORTED_RADIO_CFG_BAND = 1, + QCA_WLAN_VENDOR_ATTR_SUPPORTED_RADIO_CFG_ANTENNA = 2, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_SUPPORTED_RADIO_CFG_LAST, + QCA_WLAN_VENDOR_ATTR_SUPPORTED_RADIO_CFG_MAX = + QCA_WLAN_VENDOR_ATTR_SUPPORTED_RADIO_CFG_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_radio_combination - Attributes for + * radio combinations supported by the device. + * + * @QCA_WLAN_VENDOR_ATTR_RADIO_COMBINATIONS_CFGS: Nested attribute + * provides the radio configurations present in the radio combination. + * Uses the enum qca_wlan_vendor_attr_supported_radio_cfg attributes. + * This attribute provides the values for radio combination matrix. + * For standalone config, the number of config values is one and the config + * carries the band and antenna information for standalone configuration. For + * Dual Band Simultaneous (DBS)/Single Band Simultaneous (SBS) mode + * configuration the number of config values is two and the config carries the + * band and antenna information for each simultaneous radio. + */ +enum qca_wlan_vendor_attr_radio_combination { + QCA_WLAN_VENDOR_ATTR_RADIO_COMBINATIONS_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_RADIO_COMBINATIONS_CFGS = 1, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_RADIO_COMBINATIONS_LAST, + QCA_WLAN_VENDOR_ATTR_RADIO_COMBINATIONS_MAX = + QCA_WLAN_VENDOR_ATTR_RADIO_COMBINATIONS_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_radio_combination_matrix - Attributes used by + * %QCA_NL80211_VENDOR_SUBCMD_GET_RADIO_COMBINATION_MATRIX + * + * @QCA_WLAN_VENDOR_ATTR_RADIO_MATRIX_SUPPORTED_CFGS: Nested attribute + * provides the radio combinations supported by the device. + * Uses the enum qca_wlan_vendor_attr_radio_combination attributes. + * For example, in the radio combination matrix for a device which has two + * radios, where one radio is capable of 2.4 GHz 2X2 only and another radio is + * capable of either 5 GHz or 6 GHz 2X2, the possible number of radio + * combinations is 5 and the radio combinations are + * {{{2.4 GHz 2X2}}, //Standalone 2.4 GHz + * {{5 GHz 2X2}}, //Standalone 5 GHz + * {{6 GHz 2X2}}, //Standalone 6 GHz + * {{2.4 GHz 2X2}, {5 GHz 2X2}}, //2.4 GHz + 5 GHz DBS + * {{2.4 GHz 2X2}, {6 GHz 2X2}}} //2.4 GHz + 6 GHz DBS + * The band and antenna info together as nested data provides one radio config. + * Standalone configuration has one config with band and antenna nested data. + * Dual Band Simultaneous (DBS)/Single Band Simultaneous (SBS) configuration + * have two nested band and antenna info data. + */ +enum qca_wlan_vendor_attr_radio_combination_matrix { + QCA_WLAN_VENDOR_ATTR_RADIO_MATRIX_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_RADIO_MATRIX_SUPPORTED_CFGS = 1, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_RADIO_MATRIX_LAST, + QCA_WLAN_VENDOR_ATTR_RADIO_MATRIX_MAX = + QCA_WLAN_VENDOR_ATTR_RADIO_MATRIX_LAST - 1, +}; + +/** * enum qca_wlan_vendor_attr_mdns_offload - Attributes used by * %QCA_NL80211_VENDOR_SUBCMD_MDNS_OFFLOAD vendor command. * @@ -12214,4 +12507,791 @@ enum qca_wlan_vendor_attr_ratemask_params { QCA_WLAN_VENDOR_ATTR_RATEMASK_PARAMS_AFTER_LAST - 1, }; +/** + * enum qca_wlan_audio_data_path - Defines the data path to be used for audio + * traffic. + * + * @QCA_WLAN_AUDIO_DATA_PATH_VIA_HOST_PROCESSOR: + * Send audio traffic through the host processor. + * @QCA_WLAN_AUDIO_DATA_PATH_VIA_LOW_POWER_DSP: + * Send audio traffic using the low power DSP to/from the encoder. + */ +enum qca_wlan_audio_data_path { + QCA_WLAN_AUDIO_DATA_PATH_VIA_HOST_PROCESSOR = 0, + QCA_WLAN_AUDIO_DATA_PATH_VIA_LOW_POWER_DSP = 1, +}; + +/** + * enum qca_wlan_vendor_pasn_action - Action to authenticate (and generate keys + * for) or drop existing PASN security association for the listed the + * peers. Used by QCA_WLAN_VENDOR_ATTR_PASN_ACTION and sent from the driver + * to userspace. + * + * @QCA_WLAN_VENDOR_PASN_ACTION_AUTH: Initiate PASN handshake with the peer + * devices indicated with %QCA_WLAN_VENDOR_ATTR_PASN_PEER_MAC_ADDR. + * @QCA_WLAN_VENDOR_PASN_ACTION_DELETE_SECURE_RANGING_CONTEXT: Indication from + * the driver to userspace to inform that the existing PASN keys of the + * peer devices specified with %QCA_WLAN_VENDOR_ATTR_PASN_PEER_MAC_ADDR are + * not valid anymore. + */ +enum qca_wlan_vendor_pasn_action { + QCA_WLAN_VENDOR_PASN_ACTION_AUTH, + QCA_WLAN_VENDOR_PASN_ACTION_DELETE_SECURE_RANGING_CONTEXT, +}; + +/** + * enum qca_wlan_vendor_attr_pasn_peer: Defines the nested attributes used in + * QCA_WLAN_VENDOR_ATTR_PASN_PEERS. + * + * @QCA_WLAN_VENDOR_ATTR_PASN_PEER_SRC_ADDR: This attribute is optional in the + * event from the driver to userspace and represents the local MAC address + * to be used for PASN handshake. When this attribute is present, userspace + * shall use the source address specified in this attribute by the driver + * for PASN handshake with peer device. + * This attribute is required in a command response from userspace to the + * driver and represents the MAC address that was used in PASN handshake + * with the peer device. + * @QCA_WLAN_VENDOR_ATTR_PASN_PEER_MAC_ADDR: Indicates the MAC address of the + * peer device to which PASN handshake is requested in an event from the + * driver to userspace when QCA_WLAN_VENDOR_ATTR_PASN_ACTION is set to + * QCA_WLAN_VENDOR_PASN_ACTION_AUTH. + * Indicates the MAC address of the peer device for which the keys are to + * be invalidated in an event from the driver to userspace when + * QCA_WLAN_VENDOR_ATTR_PASN_ACTION is set to + * QCA_WLAN_VENDOR_PASN_ACTION_DELETE_SECURE_RANGING_CONTEXT. + * Indicates the MAC address of the peer device for which the status is + * being sent in a status report from userspace to the driver. + * @QCA_WLAN_VENDOR_ATTR_PASN_PEER_LTF_KEYSEED_REQUIRED: NLA_FLAG attribute used + * in the event from the driver to userspace. When set, userspace is + * required to derive LTF key seed from KDK and set it to the driver. + * @QCA_WLAN_VENDOR_ATTR_PASN_PEER_STATUS_SUCCESS: NLA_FLAG attribute. This + * attribute is used in the command response from userspace to the driver. + * If present, it indicates the successful PASN handshake with the peer. If + * this flag is not present, it indicates that the PASN handshake with the + * peer device failed. + */ +enum qca_wlan_vendor_attr_pasn_peer { + QCA_WLAN_VENDOR_ATTR_PASN_PEER_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_PASN_PEER_SRC_ADDR = 1, + QCA_WLAN_VENDOR_ATTR_PASN_PEER_MAC_ADDR = 2, + QCA_WLAN_VENDOR_ATTR_PASN_PEER_LTF_KEYSEED_REQUIRED = 3, + QCA_WLAN_VENDOR_ATTR_PASN_PEER_STATUS_SUCCESS = 4, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_PASN_PEER_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_PASN_PEER_MAX = + QCA_WLAN_VENDOR_ATTR_PASN_PEER_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_pasn: Defines the attributes used in the + * QCA_NL80211_VENDOR_SUBCMD_PASN command. + * + * @QCA_WLAN_VENDOR_ATTR_PASN_ACTION: u32 attribute, possible values are + * defined in enum qca_wlan_vendor_pasn_action and used only in an event + * from the driver to userspace. + * @QCA_WLAN_VENDOR_ATTR_PASN_PEERS: Nested attribute, used to pass PASN peer + * details for each peer and used in both an event and a command response. + * The nested attributes used inside QCA_WLAN_VENDOR_ATTR_PASN_PEERS are + * defined in enum qca_wlan_vendor_attr_pasn_peer. + */ +enum qca_wlan_vendor_attr_pasn { + QCA_WLAN_VENDOR_ATTR_PASN_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_PASN_ACTION = 1, + QCA_WLAN_VENDOR_ATTR_PASN_PEERS = 2, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_PASN_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_PASN_MAX = + QCA_WLAN_VENDOR_ATTR_PASN_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_secure_ranging_ctx_action - Used to add or delete + * the ranging security context derived from PASN for each peer. Used in + * QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_ACTION. + * + * @QCA_WLAN_VENDOR_SECURE_RANGING_CTX_ACTION_ADD: Add the secure ranging + * context for the peer. + * @QCA_WLAN_VENDOR_SECURE_RANGING_CTX_ACTION_DELETE: Delete the secure ranging + * context for the peer. + */ +enum qca_wlan_vendor_secure_ranging_ctx_action { + QCA_WLAN_VENDOR_SECURE_RANGING_CTX_ACTION_ADD, + QCA_WLAN_VENDOR_SECURE_RANGING_CTX_ACTION_DELETE, +}; + +/** + * enum qca_wlan_vendor_sha_type - SHA types. Used to configure the SHA type + * used for deriving PASN keys to the driver. Used in + * QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_SHA_TYPE + * @QCA_WLAN_VENDOR_SHA_256: SHA-256 + * @QCA_WLAN_VENDOR_SHA_384: SHA-384 + */ +enum qca_wlan_vendor_sha_type { + QCA_WLAN_VENDOR_SHA_256, + QCA_WLAN_VENDOR_SHA_384, +}; + +/** + * enum qca_wlan_vendor_attr_secure_ranging_ctx: Defines the attributes used + * to set security context for the PASN peer from userspace to the driver. + * Used with QCA_NL80211_VENDOR_SUBCMD_SECURE_RANGING_CONTEXT. + * + * @QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_ACTION: u32 attribute, possible + * values are defined in enum qca_wlan_vendor_secure_ranging_ctx_action + * @QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_SRC_ADDR: The local MAC address that + * was used during the PASN handshake. + * @QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_PEER_MAC_ADDR: The MAC address of + * the peer device for which secure ranging context is being configured. + * @QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_SHA_TYPE: u32 attribute, defines the + * hash algorithm to be used, possible values are defined in enum + * qca_wlan_vendor_sha_type. + * @QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_TK: Variable length attribute, holds + * the temporal key generated from the PASN handshake. The length of this + * attribute is dependent on the value of + * %QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_CIPHER. + * @QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_CIPHER: cipher suite to use with the + * TK, u32, as defined in IEEE Std 802.11-2020, 9.4.2.24.2 (Cipher suites) + * (e.g., 0x000FAC04). + * @QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_LTF_KEYSEED: Variable length + * attribute, holds the LTF keyseed derived from KDK of PASN handshake. + * The length of this attribute is dependent on the value of + * %QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_SHA_TYPE. + + */ +enum qca_wlan_vendor_attr_secure_ranging_ctx { + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_ACTION = 1, + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_SRC_ADDR = 2, + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_PEER_MAC_ADDR = 3, + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_SHA_TYPE = 4, + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_TK = 5, + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_CIPHER = 6, + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_LTF_KEYSEED = 7, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_MAX = + QCA_WLAN_VENDOR_ATTR_SECURE_RANGING_CTX_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_coap_offload_filter - Attributes used + * inside %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_FILTER + * nested attribute. The packets that match a filter will be replied with + * attributes configured in %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV4: + * u32 attribute. Destination IPv4 address in network byte order, the + * IPv4 packets with different address will be filtered out. + * This attribute is optional. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV4_IS_BC: + * Flag attribute. If it's present, indicates that + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV4 is a broadcast + * address; while if not, indicates that the address is a unicast/multicast + * address. + * This attribute is optional. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV6: + * NLA_BINARY attribute, length is 16 bytes. + * Destination IPv6 address in network byte order, the IPv6 packets + * with different destination address will be filtered out. + * This attribute is optional. + * + * At least one of %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV4 and + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV6 must be configured. + * Packets on both IPv4 and IPv6 will be processed if both are configured. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_PORT: + * u16 attribute. Destination UDP port, the packets with different destination + * UDP port will be filtered out. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_MATCH_OFFSET: + * u32 attribute. Represents the offset (in UDP payload) of the data + * to be matched. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_MATCH_DATA: + * NLA_BINARY attribute, the maximum allowed size is 16 bytes. + * Binary data that is compared bit-by-bit against the data (specified + * by %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_MATCH_OFFSET) in UDP + * payload, the packets don't match will be filtered out. + * This attribute is mandatory. + */ +enum qca_wlan_vendor_attr_coap_offload_filter { + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV4 = 1, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV4_IS_BC = 2, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_IPV6 = 3, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_DEST_PORT = 4, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_MATCH_OFFSET = 5, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_MATCH_DATA = 6, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_MAX = + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_FILTER_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_coap_offload_reply - Attributes used + * inside %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY nested attribute. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_SRC_IPV4: + * u32 attribute. Source address (in network byte order) for replying + * the matching broadcast/multicast IPv4 packets. + * This attribute is optional. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_SRC_IPV6: + * NLA_BINARY attribute, length is 16 bytes. + * Source address (in network byte order) for replying the matching + * multicast IPv6 packets. + * This attribute is optional. + * + * For broadcast/multicast offload reply, one of + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_SRC_IPV4 and + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_SRC_IPV6 or both must be + * configured according to version of the IP address(es) configured in + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_FILTER; + * while for unicast case, firmware will take the destination IP address + * in the received matching packet as the source address for replying. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_FILTER: + * Nested attribute. Filter for the received UDP packets, only the matching + * packets will be replied and cached. + * See enum qca_wlan_vendor_attr_coap_offload_filter for list of supported + * attributes. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_MSG: + * NLA_BINARY attribute, the maximum allowed size is 1152 bytes. + * CoAP message (UDP payload) to be sent upon receiving matching packets. + * Firmware is responsible for adding any necessary protocol headers. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_CACHE_EXPTIME: + * u32 attribute. Expiration time in milliseconds of the cached CoAP messages. + * A cached message will be dropped by firmware if it's expired. + * This attribute is optional. A default value of 40000 will be used in the + * absence of it. + */ +enum qca_wlan_vendor_attr_coap_offload_reply { + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_SRC_IPV4 = 1, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_SRC_IPV6 = 2, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_FILTER = 3, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_MSG = 4, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_CACHE_EXPTIME = 5, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_MAX = + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_coap_offload_tx_ipv4 - Represents parameters for + * CoAP message (UDP) transmitting on IPv4. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_SRC_ADDR: + * u32 attribute. Source address (in network byte order) for transmitting + * packets on IPv4. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_SRC_PORT: + * u16 attribute. Source UDP port. + * This attribute is optional, a random port is taken if it's not present. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_DEST_ADDR: + * u32 attribute. Destination IPv4 address (in network byte order). + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_DEST_IS_BC: + * Flag attribute. If it's present, indicates that + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_DEST_ADDR is a broadcast + * address; while if not, indicates that the address is unicast/multicast + * address. + * This attribute is optional. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_DEST_PORT: + * u16 attribute. Destination UDP port. + * This attribute is mandatory. + */ +enum qca_wlan_vendor_attr_coap_offload_tx_ipv4 { + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_SRC_ADDR = 1, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_SRC_PORT = 2, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_DEST_ADDR = 3, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_DEST_IS_BC = 4, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_DEST_PORT = 5, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_MAX = + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV4_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_coap_offload_tx_ipv6 - Represents parameters for + * CoAP message (UDP) transmitting on IPv6. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_SRC_ADDR: + * NLA_BINARY attribute, length is 16 bytes. + * Source address (in network byte order) for transmitting packets on IPv6. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_SRC_PORT: + * u16 attribute. Source UDP port. + * This attribute is optional, a random port is taken if it's not present. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_DEST_ADDR: + * NLA_BINARY attribute, length is 16 bytes. + * Destination IPv6 address (in network byte order). + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_DEST_PORT: + * u16 attribute. Destination UDP port. + * This attribute is mandatory. + */ +enum qca_wlan_vendor_attr_coap_offload_tx_ipv6 { + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_SRC_ADDR = 1, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_SRC_PORT = 2, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_DEST_ADDR = 3, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_DEST_PORT = 4, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_MAX = + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_TX_IPV6_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_coap_offload_periodic_tx - Attributes used + * inside %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX nested attribute. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_IPV4: + * Nested attribute. The IPv4 source/destination address/port for offload + * transmitting. See enum qca_wlan_vendor_attr_coap_offload_tx_ipv4 for the list + * of supported attributes. + * This attribute is optional. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_IPV6: + * Nested attribute. The IPv6 source/destination address/port for offload + * transmitting. See enum qca_wlan_vendor_attr_coap_offload_tx_ipv6 for the list + * of supported attributes. + * This attribute is optional. + * + * At least one of %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_IPV4 and + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_IPV6 must be configured. + * Firmware will transmit the packets on both IPv4 and IPv6 if both are + * configured. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_PERIOD: + * u32 attribute. Period in milliseconds for the periodic transmitting. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_MSG: + * NLA_BINARY attribute, the maximum allowed size is 1152 bytes. + * CoAP message (UDP payload) to be periodically transmitted. Firmware + * is responsible for adding any necessary protocol headers. + * This attribute is mandatory. + */ +enum qca_wlan_vendor_attr_coap_offload_periodic_tx { + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_IPV4 = 1, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_IPV6 = 2, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_PERIOD = 3, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_MSG = 4, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_MAX = + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_coap_offload_cache_info - Attributes used + * inside %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHES nested attribute. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_TS: + * u64 attribute. Received time (since system booted in microseconds) of + * the cached CoAP message. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_SRC_IPV4: + * u32 attribute. Source IPv4 address (in network byte order) of the cached + * CoAP message. + * This attribute is optional. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_SRC_IPV6: + * NLA_BINARY attribute, length is 16 bytes. + * Source IPv6 address (in network byte order) of the cached CoAP message. + * This attribute is optional. + * + * At most and at least one of + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_SRC_IPV4 and + * %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_SRC_IPV6 is given for + * an entry. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_MSG: + * NLA_BINARY attribute, the maximum allowed size is 1152 bytes. + * The cached CoAP message (UDP payload). If the actual message size is + * greater than the maximum size, it will be truncated and leaving only + * the first 1152 bytes. + * This attribute is mandatory. + */ +enum qca_wlan_vendor_attr_coap_offload_cache_info { + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_TS = 1, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_SRC_IPV4 = 2, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_SRC_IPV6 = 3, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_MSG = 4, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_MAX = + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHE_INFO_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_coap_offload_action - Actions for + * vendor command QCA_NL80211_VENDOR_SUBCMD_COAP_OFFLOAD. + * + * @QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_REPLY_ENABLE: + * Enable CoAP offload reply. + * If it's enabled, firmware will start offload processing on each suspend + * and stop on each resume. + * + * Offload reply on match works as follows: + * Reply the packets that match the filter with the given CoAP + * message (with necessary protocol headers), increase the CoAP message + * ID in the given CoAP message by one for the next use after each successful + * transmission, and try to store the information of the received packet, + * including the received time, source IP address, and CoAP message (UDP + * payload). + * + * Firmware has a limit to the maximum stored entries, it takes the source IP + * address as the key of an entry, and keeps at most one entry for each key. + * A packet won't be stored if no entry for the same key is present and the + * total number of the existing unexpired entries reaches the maximum value. + * + * If any configured item is changed, user space should disable offload reply + * first and then issue a new enable request. + * + * @QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_REPLY_DISABLE: + * Disable CoAP offload reply and return information of any cached CoAP + * messages. + * + * @QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_PERIODIC_TX_ENABLE: + * Enable CoAP offload periodic transmitting. + * If it's enabled, firmware will start offload periodic transmitting on + * each suspend and stop on each resume. + * + * Offload periodic transmitting works as follows: + * Send the given CoAP message (with necessary protocol headers) with the given + * source/destination IP address/UDP port periodically based on the given + * period and increase the CoAP message ID in the given CoAP message by one + * for the next use after each successful transmission. + * + * If any configured item is changed, user space should disable offload + * periodic transmitting first and then issue a new enable request. + * + * @QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_PERIODIC_TX_DISABLE: + * Disable CoAP offload periodic transmitting. + * + * @QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_CACHE_GET: + * Get information of the CoAP messages cached during offload reply + * processing. The cache is cleared after retrieval. + */ +enum qca_wlan_vendor_coap_offload_action { + QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_REPLY_ENABLE = 0, + QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_REPLY_DISABLE = 1, + QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_PERIODIC_TX_ENABLE = 2, + QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_PERIODIC_TX_DISABLE = 3, + QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_CACHE_GET = 4, +}; + +/** + * enum qca_wlan_vendor_attr_coap_offload - Used by the + * vendor command QCA_NL80211_VENDOR_SUBCMD_COAP_OFFLOAD. + * This is used to set parameters for CoAP offload processing, or get + * cached CoAP messages from firmware. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_ACTION: + * u32 attribute. Action to take in this vendor command. + * See enum qca_wlan_vendor_coap_offload_action for supported actions. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REQ_ID: + * u32 attribute. Represents the Request ID for the CoAP offload + * configuration, which can help to identify the user entity starting + * the CoAP offload processing and accordingly stop the respective + * ones/get the cached CoAP messages with the matching ID. + * This attribute is mandatory. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY: + * Nested attribute. Parameters for offload reply. + * See enum qca_wlan_vendor_attr_coap_offload_reply for the list of + * supported attributes. + * This attribute is mandatory if %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_ACTION + * is QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_REPLY_ENABLE, and is ignored + * otherwise. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX: + * Nested attribute. Parameters for offload periodic transmitting. + * See enum qca_wlan_vendor_attr_coap_offload_periodic_tx for the list of + * supported attributes. + * This attribute is mandatory if %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_ACTION is + * QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_PERIODIC_TX_ENABLE, and is ignored + * otherwise. + * + * @QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHES: + * Array of nested attributes. Information of the cached CoAP messages, + * where each entry is taken from + * enum qca_wlan_vendor_attr_coap_offload_cache_info. + * This attribute is used for reporting the cached CoAP messages + * in reply for command in which %QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_ACTION + * is QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_CACHE_GET or + * QCA_WLAN_VENDOR_COAP_OFFLOAD_ACTION_REPLY_DISABLE. It means there is no + * cached item if this attribute is not present. + */ +enum qca_wlan_vendor_attr_coap_offload { + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_ACTION = 1, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REQ_ID = 2, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_REPLY = 3, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_PERIODIC_TX = 4, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_CACHES = 5, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_MAX = + QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_scs_rule_config - Used by the vendor command + * QCA_NL80211_VENDOR_SUBCMD_SCS_RULE_CONFIG to configure Stream Classification + * Service (SCS) rule. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_RULE_ID: Mandatory u32 attribute. + * Represents the unique id of SCS rule to be configured. + + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_REQUEST_TYPE: Mandatory u8 attribute. + * Represents the request type: add, remove, or change. + * Values as defined in IEEE Std 802.11-2020, Table 9-246 (SCS Request + * Type definitions). + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_OUTPUT_TID: Mandatory u8 attribute + * in case of add/change request type. + * Represents the output traffic identifier (TID) to be assigned to the flow + * matching the rule. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_CLASSIFIER_TYPE: Mandatory u8 + * attribute in case of add/change request type. + * Represents type of classifier parameters present in SCS rule. + * Refer IEEE Std 802.11-2020 Table 9-164 (Frame classifier type). + * Only classifier types 4 and 10 are supported for SCS. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_VERSION: Mandatory u8 attribute + * in case of add/change request type when classifier type is TCLAS4. + * Represents the IP version (4: IPv4, 6: IPv6) of the rule. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_SRC_IPV4_ADDR: Optional + * attribute in case of add/change request type when classifier type is TCLAS4 + * and version attribute is IPv4. + * Represents the source IPv4 address in the rule which is to be compared + * against the source IP address in the IPv4 header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_DST_IPV4_ADDR: Optional + * attribute in case of add/change request type when classifier type is TCLAS4 + * and version attribute is IPv4. + * Represents the destination IPv4 address in the rule which is to be compared + * against the destination IP address in the IPv4 header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_SRC_IPV6_ADDR: Optional + * attribute in case of add/change request type when classifier type is TCLAS4 + * and version attribute is IPv6. + * Represents the source IPv6 address in the rule which is to be compared + * against the source IP address in the IPv6 header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_DST_IPV6_ADDR: Optional + * attribute in case of add/change request type when classifier type is TCLAS4 + * and version attribute is IPv6. + * Represents the destination IPv6 address in the rule which is to be compared + * against the destination IP address in the IPv6 header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_SRC_PORT: Optional u16 attribute + * in case of add/change request type when classifier type is TCLAS4. + * Represents the source port number in the rule which is to be compared against + * the source port number in the protocol header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_DST_PORT: Optional u16 attribute + * in case of add/change request type when classifier type is TCLAS4. + * Represents the destination port number in the rule which is to be compared + * against the destination port number in the protocol header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_DSCP: Optional u8 attribute + * in case of add/change request type when classifier type is TCLAS4. + * Represents the DSCP value in the rule which is to be compared against the + * DSCP field present in the IP header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_NEXT_HEADER: Optional u8 + * attribute in case of add/change request type when classifier type is TCLAS4. + * Represents the protocol/next header in the rule which is to be compared + * against the protocol/next header field present in the IPv4/IPv6 header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_FLOW_LABEL: Optional + * attribute of size 3 bytes present in case of add/change request type + * when classifier type is TCLAS4 and version is IPv6. + * Represents the flow label value in the rule which is to be compared against + * the flow label field present in the IPv6 header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_PROTOCOL_INSTANCE: Optional u8 + * attribute in case of add/change request type when classifier type is TCLAS10. + * Represents the protocol instance number in the rule. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_NEXT_HEADER: Optional u8 + * attribute in case of add/change request type when classifier type is TCLAS10. + * Represents the protocol/next header in the rule which is to be compared + * against the protocol/next header field present in the IPv4/IPv6 header. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_FILTER_MASK: Optional + * attribute of variable length present when request type is add/change and + * classifier type is TCLAS10. + * Represents the mask to be used for masking the header contents of the header + * specified by QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_NEXT_HEADER + * attribute. + * + * @QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_FILTER_VALUE: Optional + * attribute of variable length present when request type is add/change and + * classifier type is TCLAS10. + * Represents the value to be compared against after masking the header contents + * of the header specified by the + * QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_NEXT_HEADER attribute with the + * filter mask specified by the + * QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_FILTER_MASK attribute. + */ +enum qca_wlan_vendor_attr_scs_rule_config { + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_RULE_ID = 1, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_REQUEST_TYPE = 2, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_OUTPUT_TID = 3, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_CLASSIFIER_TYPE = 4, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_VERSION = 5, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_SRC_IPV4_ADDR = 6, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_DST_IPV4_ADDR = 7, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_SRC_IPV6_ADDR = 8, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_DST_IPV6_ADDR = 9, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_SRC_PORT = 10, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_DST_PORT = 11, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_DSCP = 12, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_NEXT_HEADER = 13, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS4_FLOW_LABEL = 14, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_PROTOCOL_INSTANCE = 15, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_NEXT_HEADER = 16, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_FILTER_MASK = 17, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_TCLAS10_FILTER_VALUE = 18, + + /* Keep last */ + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_MAX = + QCA_WLAN_VENDOR_ATTR_SCS_RULE_CONFIG_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_mlo_links - Definition of attributes used inside + * nested attribute QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_MLO_LINKS. + * + * @QCA_WLAN_VENDOR_ATTR_MLO_LINK_ID: u8 attribute, link ID of this MLO link. + * @QCA_WLAN_VENDOR_ATTR_MLO_LINK_MAC_ADDR: Own MAC address of this MLO link. + * @QCA_WLAN_VENDOR_ATTR_MLO_LINK_BSSID: AP link MAC address of this MLO link. + */ +enum qca_wlan_vendor_attr_mlo_links { + QCA_WLAN_VENDOR_ATTR_MLO_LINK_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_MLO_LINK_ID = 1, + QCA_WLAN_VENDOR_ATTR_MLO_LINK_MAC_ADDR = 2, + QCA_WLAN_VENDOR_ATTR_MLO_LINK_BSSID = 3, + + /* Keep last */ + QCA_WLAN_VENDOR_ATTR_MLO_LINK_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_MLO_LINK_MAX = + QCA_WLAN_VENDOR_ATTR_MLO_LINK_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_sar_version - This describes the current SAR version + * used in the firmware. + * + * @QCA_WLAN_VENDOR_SAR_VERSION_1: The firmware supports legacy SAR. + * In legacy SAR, the firmware supports 5 static and 1 user defined SAR limits. + * + * @QCA_WLAN_VENDOR_SAR_VERSION_2: The firmware supports SAR version 2, + * i.e., SAR Non DBS mode. In SAR version 2, the firmware has 6 SAR tables for + * each CTL group. So user can select up to 6 SAR indexes from the current CTL + * groups. + * + * @QCA_WLAN_VENDOR_SAR_VERSION_3: The firmware supports SAR version 3, + * i.e., SAR DBS mode. In SAR version 3, the firmware has 6 SAR tables for each + * CTL group but user can choose up to 3 SAR set index only, as the top half + * of the SAR index (0 to 2) is used for non DBS purpose and the bottom half of + * the SAR index (3 to 5) is used for DBS mode. + */ +enum qca_wlan_vendor_sar_version { + QCA_WLAN_VENDOR_SAR_VERSION_INVALID = 0, + QCA_WLAN_VENDOR_SAR_VERSION_1 = 1, + QCA_WLAN_VENDOR_SAR_VERSION_2 = 2, + QCA_WLAN_VENDOR_SAR_VERSION_3 = 3, +}; + +/** + * enum qca_wlan_vendor_sar_ctl_group_state - This describes whether + * CTL grouping is enabled or disabled in the firmware. + * + * @QCA_WLAN_VENDOR_SAR_CTL_GROUP_STATE_ENABLED: CTL grouping + * is enabled in firmware. + * + * @QCA_WLAN_VENDOR_SAR_CTL_GROUP_STATE_DISABLED: CTL grouping + * is disabled in firmware. + * + */ +enum qca_wlan_vendor_sar_ctl_group_state { + QCA_WLAN_VENDOR_SAR_CTL_GROUP_STATE_INVALID = 0, + QCA_WLAN_VENDOR_SAR_CTL_GROUP_STATE_ENABLED = 1, + QCA_WLAN_VENDOR_SAR_CTL_GROUP_STATE_DISABLED = 2, +}; + +/** + * enum qca_wlan_vendor_attr_sar_capability - Used by the vendor command + * QCA_NL80211_VENDOR_SUBCMD_GET_SAR_CAPABILITY to get SAR capabilities + * supported by the firmware. + + * @QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_VERSION: + * u32 attribute. This field describes current SAR version supported by the + * firmware. + * See enum qca_wlan_vendor_sar_version for more information. + * This attribute is mandatory. + + * @QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_CTL_GROUP_STATE: + * u32 attribute. This field describes whether CTL groups are enabled + * or disabled in the firmware. + * See enum qca_wlan_vendor_sar_ctl_group_state for more information. + * This attribute is optional. + */ + +enum qca_wlan_vendor_attr_sar_capability { + QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_VERSION = 1, + QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_CTL_GROUP_STATE = 2, + + /* Keep last */ + QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_MAX = + QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_AFTER_LAST - 1, +}; + #endif /* QCA_VENDOR_H */ diff --git a/wcn6740/qcwcn/wifi_hal/radio_mode.cpp b/wcn6740/qcwcn/wifi_hal/radio_mode.cpp index 913ddfd..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)); @@ -169,7 +174,8 @@ int RADIOModeCommand::handleEvent(WifiEvent &event) { ALOGE("%s: QCA_WLAN_VENDOR_ATTR_MAC_INFO_MAC_ID" " not found", __FUNCTION__); - return WIFI_ERROR_INVALID_ARGS; + ret = WIFI_ERROR_INVALID_ARGS; + goto cleanup; } mode_info.wlan_mac_id = nla_get_u32(tb2[QCA_WLAN_VENDOR_ATTR_MAC_INFO_MAC_ID]); ALOGV("mac_id[%d]: %d ", num_of_mac, mode_info.wlan_mac_id); @@ -178,7 +184,8 @@ int RADIOModeCommand::handleEvent(WifiEvent &event) { ALOGE("%s: QCA_WLAN_VENDOR_ATTR_MAC_INFO_BAND" " NOT FOUND", __FUNCTION__); - return WIFI_ERROR_INVALID_ARGS; + ret = WIFI_ERROR_INVALID_ARGS; + goto cleanup; } mode_info.mac_band = (wlan_mac_band) nla_get_u32(tb2[QCA_WLAN_VENDOR_ATTR_MAC_INFO_BAND]); ALOGV("mac_band[%d]: %d ", num_of_mac, mode_info.mac_band); @@ -203,7 +210,8 @@ int RADIOModeCommand::handleEvent(WifiEvent &event) { ALOGE("%s: QCA_WLAN_VENDOR_ATTR_MAC_IFACE_INFO_IFINDEX" " NOT FOUND", __FUNCTION__); - return WIFI_ERROR_INVALID_ARGS; + ret = WIFI_ERROR_INVALID_ARGS; + goto cleanup; } if (if_indextoname(nla_get_u32(tb3[QCA_WLAN_VENDOR_ATTR_MAC_IFACE_INFO_IFINDEX]), miface_info.iface_name) == NULL) @@ -217,7 +225,8 @@ int RADIOModeCommand::handleEvent(WifiEvent &event) { ALOGE("%s: QCA_WLAN_VENDOR_ATTR_MAC_IFACE_INFO_FREQ" " NOT FOUND", __FUNCTION__); - return WIFI_ERROR_INVALID_ARGS; + ret = WIFI_ERROR_INVALID_ARGS; + goto cleanup; } miface_info.channel = nla_get_u32(tb3[QCA_WLAN_VENDOR_ATTR_MAC_IFACE_INFO_FREQ]); ALOGV("channel[%d]: %d ", num_of_iface, miface_info.channel); @@ -252,14 +261,13 @@ int RADIOModeCommand::handleEvent(WifiEvent &event) if (mHandler.on_radio_mode_change && num_of_mac) { (*mHandler.on_radio_mode_change)(mreqId, num_of_mac, mwifi_iface_mac_info); - free(mwifi_iface_mac_info); - mwifi_iface_mac_info = NULL; } else { ALOGE("No Callback registered: on radio mode change"); - free(mwifi_iface_mac_info); - mwifi_iface_mac_info = NULL; + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; } + ret = WIFI_SUCCESS; } break; @@ -268,6 +276,16 @@ int RADIOModeCommand::handleEvent(WifiEvent &event) ALOGE("%s: Wrong subcmd received %d", __FUNCTION__, mSubcmd); } +cleanup: + if (mode_info.iface_info != NULL) { + free(mode_info.iface_info); + mode_info.iface_info = NULL; + } + if (mwifi_iface_mac_info != NULL) { + free(mwifi_iface_mac_info); + mwifi_iface_mac_info = NULL; + } + return ret; } 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 <errno.h> @@ -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 e43b770..4e0d0da 100644 --- a/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp +++ b/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp @@ -144,12 +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_error wifi_get_usable_channels(wifi_handle handle, u32 band_mask, - u32 iface_mode_mask, u32 filter_mask, - u32 max_size, u32* size, - wifi_usable_channel* channels); + wifi_init_tcp_param_change_event_handler(wifi_interface_handle iface); /* Initialize/Cleanup */ @@ -420,6 +415,28 @@ static wifi_error wifi_get_capabilities(wifi_interface_handle handle) return ret; } +static wifi_error wifi_get_sar_version(wifi_interface_handle handle) +{ + wifi_error ret; + wifi_handle wifiHandle = getWifiHandle(handle); + + WifihalGeneric *sarVersion = new WifihalGeneric( + wifiHandle, + 0, + OUI_QCA, + QCA_NL80211_VENDOR_SUBCMD_GET_SAR_CAPABILITY); + if (!sarVersion) { + ALOGE("%s: Failed to create object of WifihalGeneric class", __FUNCTION__); + return WIFI_ERROR_OUT_OF_MEMORY; + } + + + ret = sarVersion->getSarVersion(handle); + + delete sarVersion; + return ret; +} + static wifi_error get_firmware_bus_max_size_supported( wifi_interface_handle iface) { @@ -807,6 +824,161 @@ cleanup: return ret; } +static u32 get_nl_band_mask(u32 in_mask) +{ + u32 op_mask = 0; + + if (in_mask & WLAN_MAC_2_4_BAND) + op_mask |= BIT(NL80211_BAND_2GHZ); + if (in_mask & WLAN_MAC_5_0_BAND) + op_mask |= BIT(NL80211_BAND_5GHZ); + if (in_mask & WLAN_MAC_6_0_BAND) + op_mask |= BIT(NL80211_BAND_6GHZ); + if (in_mask & WLAN_MAC_60_0_BAND) + op_mask |= BIT(NL80211_BAND_60GHZ); + + return op_mask; +} + +static u32 get_nl_iftype_mode_masks(u32 in_mask) +{ + u32 op_mask = 0; + + if (in_mask & BIT(WIFI_INTERFACE_STA) || + in_mask & BIT(WIFI_INTERFACE_TDLS)) + op_mask |= BIT(NL80211_IFTYPE_STATION); + if (in_mask & BIT(WIFI_INTERFACE_SOFTAP)) + op_mask |= BIT(NL80211_IFTYPE_AP); + if (in_mask & BIT(WIFI_INTERFACE_P2P_CLIENT)) + op_mask |= BIT(NL80211_IFTYPE_P2P_CLIENT); + if (in_mask & BIT(WIFI_INTERFACE_P2P_GO)) + op_mask |= BIT(NL80211_IFTYPE_P2P_GO); + if (in_mask & BIT(WIFI_INTERFACE_NAN)) + op_mask |= BIT(NL80211_IFTYPE_NAN); + + return op_mask; +} + +static u32 get_vendor_filter_mask(u32 in_mask) +{ + u32 op_mask = 0; + + if (in_mask & WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE) + op_mask |= BIT(QCA_WLAN_VENDOR_FILTER_CELLULAR_COEX); + if (in_mask & WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY) + op_mask |= BIT(QCA_WLAN_VENDOR_FILTER_WLAN_CONCURRENCY); + + return op_mask; +} + +wifi_error wifi_get_usable_channels(wifi_handle handle, u32 band_mask, + u32 iface_mode_mask, u32 filter_mask, + u32 max_size, u32* size, + wifi_usable_channel* channels) +{ + wifi_error ret = WIFI_ERROR_UNKNOWN; + WifihalGeneric *cmd = NULL; + struct nlattr *nl_data = NULL; + hal_info *info = NULL; + u32 band = 0, iface_mask = 0, filter = 0; + + if (!handle) { + ALOGE("%s: Error, wifi_handle NULL", __FUNCTION__); + goto cleanup; + } + + info = getHalInfo(handle); + if (!info || info->num_interfaces < 1) { + ALOGE("%s: Error, wifi_handle NULL or base wlan interface not present", + __FUNCTION__); + goto cleanup; + } + + if (!max_size) { + ALOGE("%s: max channel size is zero", __FUNCTION__); + ret = WIFI_ERROR_INVALID_ARGS; + goto cleanup; + } + + if (!channels) { + ALOGE("%s: user input channel buffer NULL", __FUNCTION__); + ret = WIFI_ERROR_INVALID_ARGS; + goto cleanup; + } + + cmd = new WifihalGeneric(handle, get_requestid(), OUI_QCA, + QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS); + if (cmd == NULL) { + ALOGE("%s: Error, created command NULL", __FUNCTION__); + ret = WIFI_ERROR_OUT_OF_MEMORY; + goto cleanup; + } + + /* Create the NL message. */ + ret = cmd->create(); + if (ret < 0) { + ALOGE("%s: failed to create NL msg due to error: (%d)", + __FUNCTION__, ret); + goto cleanup; + } + + /* Add the vendor specific attributes for the NL command. */ + nl_data = cmd->attr_start(NL80211_ATTR_VENDOR_DATA); + if (!nl_data) { + ALOGE("%s: failed attr_start for VENDOR_DATA due to error", + __FUNCTION__); + ret = WIFI_ERROR_OUT_OF_MEMORY; + goto cleanup; + } + + band = get_nl_band_mask(band_mask); + ret = cmd->put_u32(QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_BAND_MASK, + band); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: failed to put vendor data due to error:%d", + __FUNCTION__, ret); + goto cleanup; + } + + iface_mask = get_nl_iftype_mode_masks(iface_mode_mask); + ret = cmd->put_u32(QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_IFACE_MODE_MASK, + iface_mask); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: failed to put vendor data due to error:%d", + __FUNCTION__, ret); + goto cleanup; + } + + filter = get_vendor_filter_mask(filter_mask); + ret = cmd->put_u32(QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_FILTER_MASK, + filter); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: failed to put vendor data due to error:%d", + __FUNCTION__, ret); + goto cleanup; + } + + cmd->attr_end(nl_data); + + /* Populate the input received from caller/framework. */ + cmd->setMaxSetSize(max_size); + cmd->set_channels_buff(channels); + + /* Send the msg and wait for a response. */ + ret = cmd->requestResponse(); + if (ret != WIFI_SUCCESS) { + ALOGE("%s: Error %d waiting for response.", __FUNCTION__, ret); + goto cleanup; + } + + *size = cmd->get_results_size(); + +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) { if (fn == NULL) { @@ -914,6 +1086,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_get_usable_channels = wifi_get_usable_channels; return WIFI_SUCCESS; } @@ -944,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; @@ -1119,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]; @@ -1244,6 +1418,13 @@ wifi_error wifi_initialize(wifi_handle *handle) ALOGV("support_nan_ext_cmd is %d", info->support_nan_ext_cmd); + ret = wifi_get_sar_version(iface_handle); + if (ret != WIFI_SUCCESS) { + ALOGE("Failed to get SAR Version, Setting it to default."); + info->sar_version = QCA_WLAN_VENDOR_SAR_VERSION_1; + ret = WIFI_SUCCESS; + } + cld80211_cleanup: if (status != 0 || ret != WIFI_SUCCESS) { ret = WIFI_ERROR_UNKNOWN; @@ -1263,11 +1444,12 @@ unload: } if (info->pkt_stats) free(info->pkt_stats); if (info->rx_aggr_pkts) free(info->rx_aggr_pkts); + if (info->wifihal_ctrl_sock.s) close(info->wifihal_ctrl_sock.s); wifi_logger_ring_buffers_deinit(info); 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); @@ -1300,12 +1482,14 @@ static int wifi_update_driver_state(const char *state) { if (fd < 0) { ALOGE("Failed to open driver state control param at %s", WIFI_DRIVER_STATE_CTRL_PARAM); + close(fd); return -1; } len = strlen(state) + 1; if (TEMP_FAILURE_RETRY(write(fd, state, len)) != len) { ALOGE("Failed to write driver state control param at %s", WIFI_DRIVER_STATE_CTRL_PARAM); + close(fd); ret = -1; } close(fd); @@ -2340,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, @@ -2395,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); @@ -2443,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, @@ -2516,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, @@ -2572,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); @@ -2662,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); @@ -2714,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) @@ -2783,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); @@ -2822,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; } @@ -2861,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; @@ -2908,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); @@ -3111,158 +3313,6 @@ static int wifi_is_nan_ext_cmd_supported(wifi_interface_handle iface_handle) } } -static u32 get_nl_band_mask(u32 in_mask) -{ - u32 op_mask = 0; - - if (in_mask & WLAN_MAC_2_4_BAND) - op_mask |= BIT(NL80211_BAND_2GHZ); - if (in_mask & WLAN_MAC_5_0_BAND) - op_mask |= BIT(NL80211_BAND_5GHZ); - if (in_mask & WLAN_MAC_6_0_BAND) - op_mask |= BIT(NL80211_BAND_6GHZ); - if (in_mask & WLAN_MAC_60_0_BAND) - op_mask |= BIT(NL80211_BAND_60GHZ); - - return op_mask; -} - -static u32 get_nl_iftype_mode_masks(u32 in_mask) -{ - u32 op_mask = 0; - - if (in_mask & BIT(WIFI_INTERFACE_STA) || - in_mask & BIT(WIFI_INTERFACE_TDLS)) - op_mask |= BIT(NL80211_IFTYPE_STATION); - if (in_mask & BIT(WIFI_INTERFACE_SOFTAP)) - op_mask |= BIT(NL80211_IFTYPE_AP); - if (in_mask & BIT(WIFI_INTERFACE_P2P_CLIENT)) - op_mask |= BIT(NL80211_IFTYPE_P2P_CLIENT); - if (in_mask & BIT(WIFI_INTERFACE_P2P_GO)) - op_mask |= BIT(NL80211_IFTYPE_P2P_GO); - if (in_mask & BIT(WIFI_INTERFACE_NAN)) - op_mask |= BIT(NL80211_IFTYPE_NAN); - - return op_mask; -} - -static u32 get_vendor_filter_mask(u32 in_mask) -{ - u32 op_mask = 0; - - if (in_mask & WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE) - op_mask |= BIT(QCA_WLAN_VENDOR_FILTER_CELLULAR_COEX); - if (in_mask & WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY) - op_mask |= BIT(QCA_WLAN_VENDOR_FILTER_WLAN_CONCURRENCY); - - return op_mask; -} - -wifi_error wifi_get_usable_channels(wifi_handle handle, u32 band_mask, - u32 iface_mode_mask, u32 filter_mask, - u32 max_size, u32* size, - wifi_usable_channel* channels) -{ - wifi_error ret; - WifihalGeneric *cmd = NULL; - struct nlattr *nl_data; - hal_info *info = NULL; - u32 band = 0, iface_mask = 0, filter = 0; - - if (!handle) { - ALOGE("%s: Error, wifi_handle NULL", __FUNCTION__); - return WIFI_ERROR_UNKNOWN; - } - - info = getHalInfo(handle); - if (!info || info->num_interfaces < 1) { - ALOGE("%s: Error, wifi_handle NULL or base wlan interface not present", - __FUNCTION__); - return WIFI_ERROR_UNKNOWN; - } - - if (!max_size) { - ALOGE("%s: max channel size is zero", __FUNCTION__); - ret = WIFI_ERROR_INVALID_ARGS; - goto cleanup; - } - - if (!channels) { - ALOGE("%s: user input channel buffer NULL", __FUNCTION__); - ret = WIFI_ERROR_INVALID_ARGS; - goto cleanup; - } - - cmd = new WifihalGeneric(handle, get_requestid(), OUI_QCA, - QCA_NL80211_VENDOR_SUBCMD_USABLE_CHANNELS); - if (cmd == NULL) { - ALOGE("%s: Error, created command NULL", __FUNCTION__); - return WIFI_ERROR_OUT_OF_MEMORY; - } - - /* Create the NL message. */ - ret = cmd->create(); - if (ret < 0) { - ALOGE("%s: failed to create NL msg due to error: (%d)", - __FUNCTION__, ret); - goto cleanup; - } - - /* Add the vendor specific attributes for the NL command. */ - nl_data = cmd->attr_start(NL80211_ATTR_VENDOR_DATA); - if (!nl_data) { - ALOGE("%s: failed attr_start for VENDOR_DATA due to error: (%d)", - __FUNCTION__, ret); - goto cleanup; - } - - band = get_nl_band_mask(band_mask); - ret = cmd->put_u32(QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_BAND_MASK, - band); - if (ret != WIFI_SUCCESS) { - ALOGE("%s: failed to put vendor data due to error:%d", - __FUNCTION__, ret); - goto cleanup; - } - - iface_mask = get_nl_iftype_mode_masks(iface_mode_mask); - ret = cmd->put_u32(QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_IFACE_MODE_MASK, - iface_mask); - if (ret != WIFI_SUCCESS) { - ALOGE("%s: failed to put vendor data due to error:%d", - __FUNCTION__, ret); - goto cleanup; - } - - filter = get_vendor_filter_mask(filter_mask); - ret = cmd->put_u32(QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_FILTER_MASK, - filter); - if (ret != WIFI_SUCCESS) { - ALOGE("%s: failed to put vendor data due to error:%d", - __FUNCTION__, ret); - goto cleanup; - } - - cmd->attr_end(nl_data); - - /* Populate the input received from caller/framework. */ - cmd->setMaxSetSize(max_size); - cmd->set_channels_buff(channels); - - /* Send the msg and wait for a response. */ - ret = cmd->requestResponse(); - if (ret != WIFI_SUCCESS) { - ALOGE("%s: Error %d waiting for response.", __FUNCTION__, ret); - goto cleanup; - } - - *size = cmd->get_results_size(); - -cleanup: - delete cmd; - return ret; -} - wifi_error wifi_get_radar_history(wifi_interface_handle handle, radar_history_result *resultBuf, int resultBufSize, int *numResults) { @@ -3315,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/wifi_hal_ctrl/wifi_hal_ctrl.c b/wcn6740/qcwcn/wifi_hal/wifi_hal_ctrl/wifi_hal_ctrl.c index ddc0062..2ad9c38 100644 --- a/wcn6740/qcwcn/wifi_hal/wifi_hal_ctrl/wifi_hal_ctrl.c +++ b/wcn6740/qcwcn/wifi_hal/wifi_hal_ctrl/wifi_hal_ctrl.c @@ -114,9 +114,7 @@ try_again: pwd_system = getpwnam("system"); uid_system = pwd_system ? pwd_system->pw_uid : 0; if (!gid_wifi || !uid_system) { - close(ctrl->s); - unlink(ctrl->local.sun_path); - free(ctrl); + wifihal_ctrl_close(ctrl); return NULL; } chown(ctrl->local.sun_path, -1, gid_wifi); @@ -124,7 +122,7 @@ try_again: if (*ctrl_path != '/') { - free(ctrl); + wifihal_ctrl_close(ctrl); return NULL; } #endif /* ANDROID */ @@ -133,15 +131,12 @@ try_again: res = strlcpy(ctrl->dest.sun_path, ctrl_path, sizeof(ctrl->dest.sun_path)); if (res >= sizeof(ctrl->dest.sun_path)) { - close(ctrl->s); - free(ctrl); + wifihal_ctrl_close(ctrl); return NULL; } if (connect(ctrl->s, (struct sockaddr *) &ctrl->dest, sizeof(ctrl->dest)) < 0) { - close(ctrl->s); - unlink(ctrl->local.sun_path); - free(ctrl); + wifihal_ctrl_close(ctrl); return NULL; } /* diff --git a/wcn6740/qcwcn/wifi_hal/wificonfig.cpp b/wcn6740/qcwcn/wifi_hal/wificonfig.cpp index fc34a8e..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" @@ -41,6 +46,10 @@ #include <net/if_arp.h> #include <sys/socket.h> #include "wificonfigcommand.h" +#include "ifaceeventhandler.h" + +#define NUM_OF_SAR_LIMITS_SPECS 2 +#define NUM_OF_SPEC_CHAINS 2 /* Implementation of the API functions exposed in wifi_config.h */ wifi_error wifi_extended_dtim_config_set(wifi_request_id id, @@ -85,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; @@ -233,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; @@ -240,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; @@ -301,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; @@ -308,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; @@ -367,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; @@ -374,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; } @@ -392,7 +408,7 @@ cleanup: return ret; } -wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, +wifi_error wifi_select_SARv01_tx_power_scenario(wifi_interface_handle handle, wifi_power_scenario scenario) { wifi_error ret; @@ -431,12 +447,17 @@ wifi_error wifi_select_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_select_tx_power_scenario: failed attr_start for VENDOR_DATA. " "Error:%d", ret); goto cleanup; } switch (scenario) { + /* WIFI_POWER_SCENARIO_VOICE_CALL is used by VTS test to check this API. + * We should not remove this scenario even we don't use it in new projects. + */ + case WIFI_POWER_SCENARIO_VOICE_CALL: case WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON: case WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT: case WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW: @@ -476,6 +497,7 @@ wifi_error wifi_select_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; } @@ -492,6 +514,181 @@ cleanup: return ret; } +wifi_error wifi_select_SARv02_tx_power_scenario(wifi_interface_handle handle, + wifi_power_scenario scenario) +{ + wifi_error ret; + WiFiConfigCommand *wifiConfigCommand; + struct nlattr *nlData, *nlSpecList, *nlSpec; + interface_info *ifaceInfo = getIfaceInfo(handle); + wifi_handle wifiHandle = getWifiHandle(handle); + u32 power_lim_idx = 0; + + ALOGV("%s : power scenario SARV2:%d", __FUNCTION__, scenario); + + wifiConfigCommand = new WiFiConfigCommand( + wifiHandle, + 1, + OUI_QCA, + QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS); + if (wifiConfigCommand == NULL) { + ALOGE("%s: Error wifiConfigCommand NULL", __FUNCTION__); + return WIFI_ERROR_UNKNOWN; + } + + /* Create the NL message. */ + ret = wifiConfigCommand->create(); + if (ret != WIFI_SUCCESS) { + ALOGE("wifi_select_tx_power_scenario: failed to create NL msg. Error:%d", ret); + goto cleanup; + } + + /* Set the interface Id of the message. */ + ret = wifiConfigCommand->set_iface_id(ifaceInfo->name); + if (ret != WIFI_SUCCESS) { + ALOGE("wifi_select_tx_power_scenario: failed to set iface id. Error:%d", ret); + 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("wifi_select_tx_power_scenario: failed attr_start for VENDOR_DATA."); + goto cleanup; + } + + if (wifiConfigCommand->put_u32( + QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SAR_ENABLE, + QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0)) { + ret = WIFI_ERROR_UNKNOWN; + ALOGE("failed to put SAR_ENABLE"); + goto cleanup; + } + + if (wifiConfigCommand->put_u32( + QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_NUM_SPECS, + NUM_OF_SAR_LIMITS_SPECS)) { + ret = WIFI_ERROR_UNKNOWN; + ALOGE("failed to put SAR_LIMITS_NUM_SPECS"); + goto cleanup; + } + + switch (scenario) { + case WIFI_POWER_SCENARIO_VOICE_CALL: + case WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON: + case WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT: + case WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW: + + power_lim_idx = 0; + break; + + case WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF: + power_lim_idx = 1; + break; + + case WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT: + case WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT: + case WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW: + case WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW: + power_lim_idx = 2; + break; + + case WIFI_POWER_SCENARIO_ON_BODY_CELL_ON: + power_lim_idx = 3; + break; + + case WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT: + power_lim_idx = 4; + break; + + case WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF: + case WIFI_POWER_SCENARIO_ON_BODY_BT: + power_lim_idx = 5; + break; + default: + ALOGE("wifi_select_tx_power_scenario: invalid scenario %d", scenario); + ret = WIFI_ERROR_INVALID_ARGS; + goto cleanup; + } + + + nlSpecList = wifiConfigCommand->attr_start(QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC); + if (!nlSpecList) + { + ALOGE("Cannot create spec list"); + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; + } + + + for (int i = 0; i < NUM_OF_SPEC_CHAINS; i++) { + nlSpec = wifiConfigCommand->attr_start(0); + if (!nlSpec) { + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; + } + if (wifiConfigCommand->put_u32( + QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_CHAIN, + i)) + { + ALOGE("Failed to put: QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_CHAIN"); + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; + } + + if (wifiConfigCommand->put_u32( + QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX, + power_lim_idx)) + { + ALOGE("Failed to put: QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX"); + ret = WIFI_ERROR_UNKNOWN; + goto cleanup; + } + + wifiConfigCommand->attr_end(nlSpec); + } + + + + wifiConfigCommand->attr_end(nlSpecList); + + wifiConfigCommand->attr_end(nlData); + ALOGV("wifi_select_tx_power_scenario %u selected", power_lim_idx); + ret = wifiConfigCommand->requestEvent(); + if (ret != WIFI_SUCCESS) { + ALOGE("wifi_select_tx_power_scenario(): requestEvent Error:%d", ret); + goto cleanup; + } + +cleanup: + delete wifiConfigCommand; + return ret; +} + + +wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, + wifi_power_scenario scenario) +{ + + wifi_handle wifiHandle = getWifiHandle(handle); + hal_info *info = getHalInfo(wifiHandle); + if (info == NULL) { + ALOGE("%s: Error hal_info NULL", __FUNCTION__); + return WIFI_ERROR_UNKNOWN; + } + ALOGV("wifi_select_tx_power_scenario: sarVer%u", (u32)info->sar_version); + if (info->sar_version == QCA_WLAN_VENDOR_SAR_VERSION_1) + return wifi_select_SARv01_tx_power_scenario(handle,scenario); + else if (info->sar_version == QCA_WLAN_VENDOR_SAR_VERSION_2) + return wifi_select_SARv02_tx_power_scenario(handle,scenario); + else { + ALOGE("wifi_select_tx_power_scenario %u invalid or not supported", (u32)info->sar_version); + return WIFI_ERROR_UNKNOWN; + } +} + + wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle) { wifi_error ret; @@ -527,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; @@ -534,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; } @@ -586,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; @@ -599,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; } @@ -631,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; } @@ -638,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; } @@ -926,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; } @@ -933,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); } } @@ -1049,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; @@ -1056,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; @@ -1122,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; @@ -1129,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; @@ -1207,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; @@ -1221,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]; diff --git a/wcn6740/qcwcn/wpa_supplicant_8_lib/Makefile.am b/wcn6740/qcwcn/wpa_supplicant_8_lib/Makefile.am index e314452..8c09e3e 100644 --- a/wcn6740/qcwcn/wpa_supplicant_8_lib/Makefile.am +++ b/wcn6740/qcwcn/wpa_supplicant_8_lib/Makefile.am @@ -20,6 +20,17 @@ library_include_HEADERS = $(h_sources) libwpa_supplicant_8_lib_la_SOURCES = driver_cmd_nl80211.c libwpa_supplicant_8_lib_la_SOURCES += driver_cmd_nl80211_extn.c libwpa_supplicant_8_lib_la_CFLAGS = ${AM_CFLAGS} ${LIBNL_CFLAGS} + +libwpa_supplicant_8_lib_la_CFLAGS += "-I${WPA_SUPPLICANT_DIR}/src" +libwpa_supplicant_8_lib_la_CFLAGS += "-I${WPA_SUPPLICANT_DIR}/src/common" +libwpa_supplicant_8_lib_la_CFLAGS += "-I${WPA_SUPPLICANT_DIR}/src/drivers" +libwpa_supplicant_8_lib_la_CFLAGS += "-I${WPA_SUPPLICANT_DIR}/src/l2_packet" +libwpa_supplicant_8_lib_la_CFLAGS += "-I${WPA_SUPPLICANT_DIR}/src/utils" +libwpa_supplicant_8_lib_la_CFLAGS += "-I${WPA_SUPPLICANT_DIR}/src/wps" +libwpa_supplicant_8_lib_la_CFLAGS += "-I${WPA_SUPPLICANT_DIR}/wpa_supplicant" +libwpa_supplicant_8_lib_la_CFLAGS += "-DLINUX_EMBEDDED" + + libwpa_supplicant_8_lib_la_LIBADD = ${LIBNL_LIBS} lib_LTLIBRARIES = libwpa_supplicant_8_lib.la diff --git a/wcn6740/qcwcn/wpa_supplicant_8_lib/configure.ac b/wcn6740/qcwcn/wpa_supplicant_8_lib/configure.ac index 2be9651..76eda02 100644 --- a/wcn6740/qcwcn/wpa_supplicant_8_lib/configure.ac +++ b/wcn6740/qcwcn/wpa_supplicant_8_lib/configure.ac @@ -42,13 +42,9 @@ if (test "$has_libnl_ver" -eq 0); then AC_MSG_ERROR(libnl and libnl-genl are required but were not found) fi -if (test "$has_libnl_ver" -gt 1); then - AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher]) -fi -if (test "$has_libnl_ver" -gt 2); then - AC_DEFINE([HAVE_LIBNL30], [1], [Define if you have libnl-3.0 or higher]) -fi +AC_ARG_VAR(WPA_SUPPLICANT_DIR,[Path to Wpa-supplicant-dir ]) +AS_IF([test "${WPA_SUPPLICANT_DIR}" = ""],[AC_MSG_ERROR("Provide WPA_SUPPLICANT_DIR=path to wpa_supplicant dir")]) AC_SUBST([LIBNL_CFLAGS]) AC_SUBST([LIBNL_LIBS]) diff --git a/wcn6740/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c b/wcn6740/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c index 7315a54..9656710 100644 --- a/wcn6740/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c +++ b/wcn6740/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c @@ -4021,6 +4021,12 @@ static int wpa_get_twt_setup_resp_val(struct nlattr **tb2, char *buf, if (!buf) return -EINVAL; + /* In case of failure only status is updated */ + if (val != QCA_WLAN_VENDOR_TWT_STATUS_OK) { + *buf = '\0'; + return 0; + } + cmd_id = QCA_WLAN_VENDOR_ATTR_TWT_SETUP_RESP_TYPE; if (!tb2[cmd_id]) { wpa_printf(MSG_ERROR, "TWT resp type missing"); @@ -5199,7 +5205,7 @@ static int wpa_driver_form_clear_mcc_quota_msg(struct i802_bss *bss, if (ret) { wpa_printf(MSG_ERROR, "mcc_quota: Error sending nlmsg %d", ret); - goto fail; + return ret; } return 0; @@ -5340,7 +5346,7 @@ static int wpa_driver_form_set_mcc_quota_msg(struct i802_bss *bss, if (ret) { wpa_printf(MSG_ERROR, "mcc_quota: Error sending nlmsg %d", ret); - goto fail; + return ret; } return 0; @@ -5372,6 +5378,159 @@ int wpa_driver_cmd_send_mcc_quota(struct i802_bss *bss, return -EINVAL; } +static int wpa_driver_form_flush_queue_config_msg(struct i802_bss *bss, char *cmd) +{ + uint32_t tid_mask = 0, flush_policy = 0; + u8 mac[MAC_ADDR_LEN], ac_mask = 0; + struct nl_msg *nlmsg = NULL; + struct nlattr *nl_attr; + char *ptr = cmd; + int ret; + + wpa_printf(MSG_DEBUG, "flush_queue_config: %s", cmd); + + /* First parameter: MAC address of peer */ + if (os_strncasecmp(cmd, "peer", 4) == 0) { + cmd = move_to_next_str(cmd); + if ((strlen(cmd) < (MAC_ADDR_LEN * 2 + MAC_ADDR_LEN - 1)) || + convert_string_to_bytes(mac, cmd, MAC_ADDR_LEN) != + MAC_ADDR_LEN) { + wpa_printf(MSG_ERROR, "flush_queue_config: Invalid MAC address"); + wpa_printf(MSG_ERROR, "flush_queue_config cmd: %s", ptr); + return -EINVAL; + } + cmd = move_to_next_str(cmd); + } else { + wpa_printf(MSG_ERROR, "flush_queue_config: peer MAC address is missing"); + wpa_printf(MSG_ERROR, "flush_queue_config cmd: %s", ptr); + return -EINVAL; + } + + /* Second parameter: flush config */ + if (os_strncasecmp(cmd, "policy", 6) == 0) { + cmd = move_to_next_str(cmd); + flush_policy = get_u32_from_string(cmd, &ret); + if (ret < 0) { + wpa_printf(MSG_ERROR, "flush_queue_config: Invalid flush policy"); + wpa_printf(MSG_ERROR, "flush_queue_config cmd: %s", ptr); + return ret; + } + cmd = move_to_next_str(cmd); + } + + /* Third parameter: Follow QCA_WLAN_VENDOR_ATTR_AC for ac bit mask */ + if (os_strncasecmp(cmd, "ac", 2) == 0) { + cmd = move_to_next_str(cmd); + ac_mask = get_u8_from_string(cmd, &ret); + if (ret < 0) { + wpa_printf(MSG_ERROR, "flush_queue_config: AC mask error"); + wpa_printf(MSG_ERROR, "flush_queue_config cmd: %s", ptr); + return ret; + } + + if (!(ac_mask & (BIT(QCA_WLAN_VENDOR_TOS_BK) | BIT(QCA_WLAN_VENDOR_TOS_BE) | + BIT(QCA_WLAN_VENDOR_TOS_VI) | BIT(QCA_WLAN_VENDOR_TOS_VO)))) { + wpa_printf(MSG_ERROR, "flush_queue_config: Invalid AC mask"); + wpa_printf(MSG_ERROR, "flush_queue_config cmd: %s", ptr); + return -EINVAL; + } + cmd = move_to_next_str(cmd); + } + + /* Fourth parameter: tid mask */ + if (os_strncasecmp(cmd, "tid", 3) == 0) { + cmd = move_to_next_str(cmd); + tid_mask = get_u32_from_string(cmd, &ret); + if (ret < 0) { + wpa_printf(MSG_ERROR, "flush_queue_config: TID mask error"); + wpa_printf(MSG_ERROR, "flush_queue_config cmd: %s", ptr); + return ret; + } + cmd = move_to_next_str(cmd); + } + + if (!tid_mask && !ac_mask) { + wpa_printf(MSG_ERROR, "flush_queue_config: Neither TID not AC mask provided"); + wpa_printf(MSG_ERROR, "flush_queue_config cmd: %s", ptr); + return -EINVAL; + } + + nlmsg = + prepare_vendor_nlmsg(bss->drv, bss->ifname, + QCA_NL80211_VENDOR_SUBCMD_PEER_FLUSH_PENDING); + if (!nlmsg) { + wpa_printf(MSG_ERROR, "flush_queue_config: Failed to allocate nl message"); + return -ENOMEM; + } + + nl_attr = nla_nest_start(nlmsg, NL80211_ATTR_VENDOR_DATA); + if (!nl_attr) { + wpa_printf(MSG_ERROR, "flush_queue_config: Failed to alloc nlattr"); + ret = -ENOMEM; + goto fail; + } + + /* Put the peer MAC address */ + ret = nla_put(nlmsg, QCA_WLAN_VENDOR_ATTR_PEER_ADDR, MAC_ADDR_LEN, mac); + if (ret) { + wpa_printf(MSG_ERROR, "flush_queue_config: Error add hw addr attr %d", ret); + goto fail; + } + + /* Put the flush_policy */ + ret = nla_put_u32(nlmsg, QCA_WLAN_VENDOR_ATTR_FLUSH_PENDING_POLICY, + flush_policy); + if (ret) { + wpa_printf(MSG_ERROR, + "flush_queue_config: Error add policy attr %d", ret); + goto fail; + } + + if (tid_mask) { + /* Put the tid mask */ + ret = nla_put_u32(nlmsg, QCA_WLAN_VENDOR_ATTR_TID_MASK, + tid_mask); + if (ret) { + wpa_printf(MSG_ERROR, "flush_queue_config: Error add tid mask attr %d", ret); + goto fail; + } + } else { + /* Put the ac mask */ + ret = nla_put_u8(nlmsg, QCA_WLAN_VENDOR_ATTR_AC, ac_mask); + if (ret) { + wpa_printf(MSG_ERROR, "flush_queue_config: Error add ac attr %d", ret); + goto fail; + } + } + + nla_nest_end(nlmsg, nl_attr); + ret = send_nlmsg((struct nl_sock *)bss->drv->global->nl, nlmsg, + NULL, NULL); + if (ret) { + wpa_printf(MSG_ERROR, "flush_queue_config: Error sending nlmsg %d", ret); + return ret; + } + return 0; +fail: + if (nlmsg) + nlmsg_free(nlmsg); + return ret; +} + +int wpa_driver_cmd_send_peer_flush_queue_config(struct i802_bss *bss, char *cmd) +{ + int ret; + + if (os_strncasecmp(cmd, "set", 3) == 0) { + cmd = move_to_next_str(cmd); + ret = wpa_driver_form_flush_queue_config_msg(bss, cmd); + return ret; + } + + wpa_printf(MSG_ERROR, "peer_flush_config: Unknown operation"); + return -EINVAL; +} + int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf, size_t buf_len ) { @@ -5671,6 +5830,13 @@ int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf, /* Move cmd by string len and space */ cmd += 10; return wpa_driver_cmd_send_mcc_quota(priv, cmd); + } else if (os_strncasecmp(cmd, "FLUSH_QUEUE_CONFIG", 18) == 0) { + /* DRIVER FLUSH_QUEUE_CONFIG set peer <mac addr> policy <val> + * tid <tid mask> ac <ac mask> + */ + /* Move cmd by string len and space */ + cmd += 19; + return wpa_driver_cmd_send_peer_flush_queue_config(priv, cmd); } else { /* Use private command */ memset(&ifr, 0, sizeof(ifr)); memset(&priv_cmd, 0, sizeof(priv_cmd)); |