diff options
author | Steve Kondik <steve@cyngn.com> | 2016-10-25 11:23:58 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-10-25 11:23:58 -0700 |
commit | ed62a2fce1cd8f891862ec342c4500de6d49da3c (patch) | |
tree | 7c6128ee04a9c83ae0a107c9d2493ce092c62817 | |
parent | 9b4eabffeac71d70c2c502ef22b3c92eca04f84c (diff) | |
parent | 6328a84d72ba44e23fea24fc129ac3ca09905f31 (diff) | |
download | android_hardware_qcom_wlan-cm-14.1.tar.gz android_hardware_qcom_wlan-cm-14.1.tar.bz2 android_hardware_qcom_wlan-cm-14.1.zip |
Merge tag 'android-7.1.0_r4' of https://android.googlesource.com/platform/hardware/qcom/wlan into 71cm-14.1
Android 7.1.0 release 4
29 files changed, 768 insertions, 262 deletions
diff --git a/qcwcn/wifi_hal/Android.mk b/qcwcn/wifi_hal/Android.mk index 9c7e5df..15d885d 100644 --- a/qcwcn/wifi_hal/Android.mk +++ b/qcwcn/wifi_hal/Android.mk @@ -73,7 +73,7 @@ include $(CLEAR_VARS) LOCAL_REQUIRED_MODULES := -LOCAL_CFLAGS += -Wno-unused-parameter +LOCAL_CFLAGS += -Wno-unused-parameter -Wall -Werror LOCAL_CPPFLAGS += -Wno-conversion-null ifeq ($(TARGET_BUILD_VARIANT),userdebug) LOCAL_CFLAGS += "-DLOG_NDEBUG=0" diff --git a/qcwcn/wifi_hal/common.cpp b/qcwcn/wifi_hal/common.cpp index 68b9130..324363c 100644 --- a/qcwcn/wifi_hal/common.cpp +++ b/qcwcn/wifi_hal/common.cpp @@ -243,24 +243,29 @@ void hexdump(void *buf, u16 len) { int i=0; char *bytes = (char *)buf; - ALOGV("******HexDump len:%d*********", len); - for (i = 0; ((i + 7) < len); i+=8) { - ALOGV("%02x %02x %02x %02x %02x %02x %02x %02x", - bytes[i], bytes[i+1], - bytes[i+2], bytes[i+3], - bytes[i+4], bytes[i+5], - bytes[i+6], bytes[i+7]); - } - if ((len - i) >= 4) { - ALOGV("%02x %02x %02x %02x", - bytes[i], bytes[i+1], - bytes[i+2], bytes[i+3]); - i+=4; - } - for (;i < len;i++) { - ALOGV("%02x", bytes[i]); + + if (len) { + ALOGV("******HexDump len:%d*********", len); + for (i = 0; ((i + 7) < len); i+=8) { + ALOGV("%02x %02x %02x %02x %02x %02x %02x %02x", + bytes[i], bytes[i+1], + bytes[i+2], bytes[i+3], + bytes[i+4], bytes[i+5], + bytes[i+6], bytes[i+7]); + } + if ((len - i) >= 4) { + ALOGV("%02x %02x %02x %02x", + bytes[i], bytes[i+1], + bytes[i+2], bytes[i+3]); + i+=4; + } + for (;i < len;i++) { + ALOGV("%02x", bytes[i]); + } + ALOGV("******HexDump End***********"); + } else { + return; } - ALOGV("******HexDump End***********"); } /* Firmware sends RSSI value without noise floor. diff --git a/qcwcn/wifi_hal/common.h b/qcwcn/wifi_hal/common.h index f0b8373..3185b08 100644 --- a/qcwcn/wifi_hal/common.h +++ b/qcwcn/wifi_hal/common.h @@ -86,6 +86,7 @@ typedef struct { } interface_info; struct gscan_event_handlers_s; +struct rssi_monitor_event_handler_s; typedef struct hal_info_s { @@ -139,6 +140,7 @@ typedef struct hal_info_s { packet_fate_monitor_info *pkt_fate_stats; /* mutex for the packet fate stats shared resource protection */ pthread_mutex_t pkt_fate_stats_lock; + struct rssi_monitor_event_handler_s *rssi_handlers; } hal_info; wifi_error wifi_register_handler(wifi_handle handle, int cmd, nl_recvmsg_msg_cb_t func, void *arg); @@ -160,6 +162,8 @@ wifi_handle getWifiHandle(hal_info *info); wifi_interface_handle getIfaceHandle(interface_info *info); wifi_error initializeGscanHandlers(hal_info *info); wifi_error cleanupGscanHandlers(hal_info *info); +wifi_error initializeRSSIMonitorHandler(hal_info *info); +wifi_error cleanupRSSIMonitorHandler(hal_info *info); lowi_cb_table_t *getLowiCallbackTable(u32 requested_lowi_capabilities); diff --git a/qcwcn/wifi_hal/cpp_bindings.cpp b/qcwcn/wifi_hal/cpp_bindings.cpp index f702d34..64aa317 100644 --- a/qcwcn/wifi_hal/cpp_bindings.cpp +++ b/qcwcn/wifi_hal/cpp_bindings.cpp @@ -38,7 +38,7 @@ #include "wifi_hal.h" #include "common.h" #include "cpp_bindings.h" -#include "qca-vendor.h" +#include "vendor_definitions.h" void appendFmt(char *buf, size_t buf_len, int &offset, const char *fmt, ...) { @@ -755,7 +755,6 @@ WifiVendorCommand::~WifiVendorCommand() int WifiVendorCommand::handleResponse(WifiEvent &reply) { struct nlattr **tb = reply.attributes(); - struct nlattr *attr = NULL; struct genlmsghdr *gnlh = reply.header(); if (gnlh->cmd == NL80211_CMD_VENDOR) { @@ -772,7 +771,6 @@ int WifiVendorCommand::handleResponse(WifiEvent &reply) int WifiVendorCommand::handleEvent(WifiEvent &event) { struct nlattr **tb = event.attributes(); - struct nlattr *attr = NULL; struct genlmsghdr *gnlh = event.header(); if (gnlh->cmd == NL80211_CMD_VENDOR) { @@ -966,7 +964,8 @@ wifi_error WifiVendorCommand::get_mac_addr(struct nlattr **tb_vendor, } memcpy(addr, (u8 *)nla_data(tb_vendor[attribute]), - nla_len(tb_vendor[attribute])); + nla_len(tb_vendor[attribute])); + return WIFI_SUCCESS; } diff --git a/qcwcn/wifi_hal/gscan.cpp b/qcwcn/wifi_hal/gscan.cpp index 3f36940..5adba77 100644 --- a/qcwcn/wifi_hal/gscan.cpp +++ b/qcwcn/wifi_hal/gscan.cpp @@ -86,12 +86,11 @@ wifi_error cleanupGscanHandlers(hal_info *info) wifi_error wifi_get_valid_channels(wifi_interface_handle handle, int band, int max_channels, wifi_channel *channels, int *num_channels) { - int requestId, ret = 0, i=0; + int requestId, ret = 0; GScanCommand *gScanCommand; struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(handle); wifi_handle wifiHandle = getWifiHandle(handle); - hal_info *info = getHalInfo(wifiHandle); lowi_cb_table_t *lowiWifiHalApi = NULL; /* Route GSCAN request through LOWI if supported */ @@ -179,7 +178,6 @@ wifi_error wifi_get_gscan_capabilities(wifi_interface_handle handle, int requestId, ret = 0; GScanCommand *gScanCommand; struct nlattr *nlData; - wifi_gscan_capabilities tCapabilities; interface_info *ifaceInfo = getIfaceInfo(handle); wifi_handle wifiHandle = getWifiHandle(handle); hal_info *info = getHalInfo(wifiHandle); @@ -286,7 +284,6 @@ wifi_error wifi_start_gscan(wifi_request_id id, u32 num_scan_buckets, numChannelSpecs; wifi_scan_bucket_spec bucketSpec; struct nlattr *nlBuckectSpecList; - bool previousGScanRunning = false; hal_info *info = getHalInfo(wifiHandle); lowi_cb_table_t *lowiWifiHalApi = NULL; gscan_event_handlers* event_handlers; @@ -601,7 +598,6 @@ wifi_error wifi_set_bssid_hotlist(wifi_request_id id, struct nlattr *nlData, *nlApThresholdParamList; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - bool previousGScanSetBssidRunning = false; hal_info *info = getHalInfo(wifiHandle); lowi_cb_table_t *lowiWifiHalApi = NULL; gscan_event_handlers* event_handlers; @@ -870,7 +866,6 @@ wifi_error wifi_set_significant_change_handler(wifi_request_id id, struct nlattr *nlData, *nlApThresholdParamList; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - bool previousGScanSetSigChangeRunning = false; hal_info *info = getHalInfo(wifiHandle); lowi_cb_table_t *lowiWifiHalApi = NULL; gscan_event_handlers* event_handlers; @@ -1151,14 +1146,8 @@ wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, int *num) { int requestId, ret = 0, retRequestRsp = 0; - wifi_cached_scan_results *result = results; - u32 j = 0; - int i = 0; - u8 moreData = 0; - u16 waitTime = GSCAN_EVENT_WAIT_TIME_SECONDS; GScanCommand *gScanCommand; struct nlattr *nlData; - wifi_cached_scan_results *cached_results; lowi_cb_table_t *lowiWifiHalApi = NULL; interface_info *ifaceInfo = getIfaceInfo(iface); @@ -1390,49 +1379,12 @@ out: return ret; } -/* Callback handlers registered for nl message send */ -static int error_handler_gscan(struct sockaddr_nl *nla, struct nlmsgerr *err, - void *arg) -{ - struct sockaddr_nl *tmp; - int *ret = (int *)arg; - tmp = nla; - *ret = err->error; - ALOGE("%s: Error code:%d (%s)", __FUNCTION__, *ret, strerror(-(*ret))); - return NL_STOP; -} - -/* Callback handlers registered for nl message send */ -static int ack_handler_gscan(struct nl_msg *msg, void *arg) -{ - int *ret = (int *)arg; - struct nl_msg * a; - - ALOGE("%s: called", __FUNCTION__); - a = msg; - *ret = 0; - return NL_STOP; -} - -/* Callback handlers registered for nl message send */ -static int finish_handler_gscan(struct nl_msg *msg, void *arg) -{ - int *ret = (int *)arg; - struct nl_msg * a; - - ALOGE("%s: called", __FUNCTION__); - a = msg; - *ret = 0; - return NL_SKIP; -} - int GScanCommand::requestResponse() { return WifiCommand::requestResponse(mMsg); } int GScanCommand::handleResponse(WifiEvent &reply) { - u32 status; int i = 0; int ret = WIFI_SUCCESS; u32 val; @@ -1474,10 +1426,10 @@ int GScanCommand::handleResponse(WifiEvent &reply) { QCA_WLAN_VENDOR_ATTR_GSCAN_RESULTS_CHANNELS], sizeof(wifi_channel) * (*mNumChannelsPtr)); } - char buf[100]; + char buf[256]; size_t len = 0; for (i = 0; i < *mNumChannelsPtr && len < sizeof(buf); i++) { - len += snprintf(buf + len, sizeof(buf)-len, "%u ", + len += snprintf(buf + len, sizeof(buf) - len, "%u ", *(mChannels + i)); } ALOGV("%s: Num Channels %d: List of valid channels are: %s", @@ -1526,7 +1478,6 @@ int GScanCommand::handleResponse(WifiEvent &reply) { { wifi_request_id id; u32 numResults = 0; - u32 startingIndex; int firstScanIdInPatch = -1; if (!tbVendor[ @@ -2093,7 +2044,6 @@ wifi_error wifi_set_epno_list(wifi_request_id id, struct nlattr *nlData, *nlPnoParamList; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - bool previousGScanSetEpnoListRunning = false; hal_info *info = getHalInfo(wifiHandle); gscan_event_handlers* event_handlers; GScanCommandEventHandler *gScanSetPnoListCmdEventHandler; @@ -2347,12 +2297,11 @@ wifi_error wifi_set_passpoint_list(wifi_request_id id, wifi_passpoint_network *networks, wifi_passpoint_event_handler handler) { - int i, numAp, ret = 0; + int i, ret = 0; GScanCommand *gScanCommand; struct nlattr *nlData, *nlPasspointNetworksParamList; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - bool previousGScanPnoSetPasspointListRunning = false; hal_info *info = getHalInfo(wifiHandle); gscan_event_handlers* event_handlers; GScanCommandEventHandler *gScanPnoSetPasspointListCmdEventHandler; @@ -2602,8 +2551,6 @@ cleanup: int GScanCommand::allocCachedResultsTemp(int max, wifi_cached_scan_results *cached_results) { - wifi_cached_scan_results *tempCachedResults = NULL; - /* Alloc memory for "max" number of cached results. */ mGetCachedResultsRspParams->cached_results = (wifi_cached_scan_results*) @@ -2664,9 +2611,6 @@ int GScanCommand::allocRspParams(eGScanRspRarams cmd) void GScanCommand::freeRspParams(eGScanRspRarams cmd) { - u32 i = 0; - wifi_cached_scan_results *cached_results = NULL; - switch(cmd) { case eGScanGetCapabilitiesRspParams: diff --git a/qcwcn/wifi_hal/gscan_event_handler.cpp b/qcwcn/wifi_hal/gscan_event_handler.cpp index a35a85b..a68f2e6 100644 --- a/qcwcn/wifi_hal/gscan_event_handler.cpp +++ b/qcwcn/wifi_hal/gscan_event_handler.cpp @@ -1041,7 +1041,6 @@ int GScanCommandEventHandler::handleEvent(WifiEvent &event) { unsigned i=0; int ret = WIFI_SUCCESS; - u32 status; wifi_scan_result *result = NULL; struct nlattr *tbVendor[QCA_WLAN_VENDOR_ATTR_GSCAN_RESULTS_MAX + 1]; @@ -1070,7 +1069,6 @@ int GScanCommandEventHandler::handleEvent(WifiEvent &event) ALOGV("Event QCA_NL80211_VENDOR_SUBCMD_GSCAN_FULL_SCAN_RESULT " "received."); - if (!tbVendor[ QCA_WLAN_VENDOR_ATTR_GSCAN_RESULTS_REQUEST_ID]) { @@ -1723,7 +1721,6 @@ int GScanCommandEventHandler::handleEvent(WifiEvent &event) case QCA_NL80211_VENDOR_SUBCMD_GSCAN_SCAN_EVENT: { wifi_scan_event scanEvent; - u32 scanEventStatus = 0; wifi_request_id reqId; if (!tbVendor[ diff --git a/qcwcn/wifi_hal/gscancommand.h b/qcwcn/wifi_hal/gscancommand.h index 012d819..99c52dd 100644 --- a/qcwcn/wifi_hal/gscancommand.h +++ b/qcwcn/wifi_hal/gscancommand.h @@ -26,7 +26,6 @@ #define PRINTF_FORMAT(a,b) #define STRUCT_PACKED #endif -#include "qca-vendor.h" #include "vendor_definitions.h" #include "gscan.h" @@ -131,11 +130,33 @@ public: wifi_cached_scan_results *cached_results); virtual int gscan_get_cached_results(wifi_cached_scan_results *results, struct nlattr **tb_vendor); + wifi_error validateGscanConfig(wifi_scan_cmd_params params); + wifi_error validateSignificantChangeParams( + wifi_significant_change_params params); virtual int allocCachedResultsTemp(int max, wifi_cached_scan_results *results); virtual int gscan_parse_capabilities(struct nlattr **tbVendor); }; +#define GSCAN_BASE_PERIOD_MIN 1 +#define GSCAN_MAX_AP_PER_SCAN_MIN 1 +#define GSCAN_REPORT_THRESHOLD_MIN 1 +#define GSCAN_NUM_BUCKETS_MIN 1 +#define GSCAN_BUCKET_INDEX_MIN 0 +#define GSCAN_REPORT_EVENT0 0 +#define GSCAN_REPORT_EVENT1 1 +#define GSCAN_REPORT_EVENT2 2 +#define GSCAN_MIN_CHANNELS 0 +#define GSCAN_ACTIVE_SCAN 0 +#define GSCAN_PASSIVE_SCAN 1 + +#define BSSID_HOTLIST_NUM_AP_MIN 1 + +#define RSSI_SAMPLE_SIZE_MIN 1 +#define LOSTAP_SAMPLE_SIZE_MIN 1 +#define MIN_BREACHING_MIN 1 +#define SIGNIFICANT_CHANGE_NUM_AP_MIN 1 + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/qcwcn/wifi_hal/ifaceeventhandler.cpp b/qcwcn/wifi_hal/ifaceeventhandler.cpp index 812c78d..88aa4d0 100755..100644 --- a/qcwcn/wifi_hal/ifaceeventhandler.cpp +++ b/qcwcn/wifi_hal/ifaceeventhandler.cpp @@ -41,8 +41,7 @@ wifi_error wifi_set_iface_event_handler(wifi_request_id id, wifi_interface_handle iface, wifi_event_handler eh) { - int i, numAp, ret = 0; - interface_info *ifaceInfo = getIfaceInfo(iface); + int ret = 0; wifi_handle wifiHandle = getWifiHandle(iface); /* Check if a similar request to set iface event handler was made earlier. @@ -73,7 +72,6 @@ wifi_error wifi_set_iface_event_handler(wifi_request_id id, } mwifiEventHandler->setCallbackHandler(eh); -cleanup: return (wifi_error)ret; } @@ -98,7 +96,6 @@ wifi_error wifi_reset_iface_event_handler(wifi_request_id id, ALOGV("Object mwifiEventHandler for id = %d already Deleted", id); } -cleanup: return (wifi_error)ret; } @@ -108,8 +105,6 @@ cleanup: */ int IfaceEventHandlerCommand::handleEvent(WifiEvent &event) { - int ret = WIFI_SUCCESS; - wifiEventHandler::handleEvent(event); switch(mSubcmd) @@ -222,7 +217,6 @@ int WifihalGeneric::handleResponse(WifiEvent &reply) { ALOGV("Got a Wi-Fi HAL module message from Driver"); int i = 0; - u32 status; WifiVendorCommand::handleResponse(reply); // Parse the vendordata and get the attribute diff --git a/qcwcn/wifi_hal/ifaceeventhandler.h b/qcwcn/wifi_hal/ifaceeventhandler.h index 3ad03ed..2aa5d9c 100755..100644 --- a/qcwcn/wifi_hal/ifaceeventhandler.h +++ b/qcwcn/wifi_hal/ifaceeventhandler.h @@ -38,7 +38,6 @@ #define PRINTF_FORMAT(a,b) #define STRUCT_PACKED #endif -#include "qca-vendor.h" #include "vendor_definitions.h" #include "wifi_hal.h" @@ -83,7 +82,6 @@ public: class WifihalGeneric: public WifiVendorCommand { private: - wifi_interface_handle mHandle; feature_set mSet; int mSetSizeMax; int *mSetSizePtr; diff --git a/qcwcn/wifi_hal/llstats.cpp b/qcwcn/wifi_hal/llstats.cpp index 419c3c0..2250987 100644 --- a/qcwcn/wifi_hal/llstats.cpp +++ b/qcwcn/wifi_hal/llstats.cpp @@ -32,7 +32,6 @@ LLStatsCommand* LLStatsCommand::mLLStatsCommandInstance = NULL; // This function implements creation of Vendor command // For LLStats just call base Vendor command create int LLStatsCommand::create() { - int ifindex; int ret = mMsg.create(NL80211_CMD_VENDOR, 0, 0); if (ret < 0) { return ret; @@ -110,7 +109,6 @@ static wifi_error get_wifi_interface_info(wifi_interface_link_layer_info *stats, struct nlattr **tb_vendor) { u32 len = 0; - u8 *data; if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE]) { @@ -686,7 +684,6 @@ static wifi_error get_wifi_radio_stats(wifi_radio_stat *stats, struct nlattr *chInfo; wifi_channel_stat *pChStats; int rem; - wifi_error ret = WIFI_SUCCESS; if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID]) { diff --git a/qcwcn/wifi_hal/llstatscommand.h b/qcwcn/wifi_hal/llstatscommand.h index b45deb7..e76ff2b 100644 --- a/qcwcn/wifi_hal/llstatscommand.h +++ b/qcwcn/wifi_hal/llstatscommand.h @@ -47,7 +47,6 @@ #define PRINTF_FORMAT(a,b) #define STRUCT_PACKED #endif -#include "qca-vendor.h" #ifdef __cplusplus extern "C" diff --git a/qcwcn/wifi_hal/nan.cpp b/qcwcn/wifi_hal/nan.cpp index f6cefaa..b07a760 100644 --- a/qcwcn/wifi_hal/nan.cpp +++ b/qcwcn/wifi_hal/nan.cpp @@ -22,7 +22,7 @@ #include "cpp_bindings.h" #include <utils/Log.h> #include "nancommand.h" - +#include "vendor_definitions.h" #ifdef __GNUC__ #define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b)))) #define STRUCT_PACKED __attribute__ ((packed)) @@ -31,8 +31,6 @@ #define STRUCT_PACKED #endif -#include "qca-vendor.h" - //Singleton Static Instance NanCommand* NanCommand::mNanCommandInstance = NULL; @@ -43,7 +41,6 @@ wifi_error nan_register_handler(wifi_interface_handle iface, // Obtain the singleton instance int ret = 0; NanCommand *nanCommand = NULL; - interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); nanCommand = NanCommand::instance(wifiHandle); @@ -55,7 +52,6 @@ wifi_error nan_register_handler(wifi_interface_handle iface, ret = nanCommand->setCallbackHandler(handlers); return (wifi_error)ret; -cleanup: return (wifi_error)ret; } @@ -257,6 +253,7 @@ wifi_error nan_subscribe_request(transaction_id id, goto cleanup; /* Set the interface Id of the message. */ + ret = nanCommand->set_iface_id(ifaceInfo->name); if (ret < 0) goto cleanup; @@ -537,7 +534,6 @@ wifi_error nan_get_sta_parameter(transaction_id id, { int ret = WIFI_ERROR_NOT_SUPPORTED; NanCommand *nanCommand = NULL; - interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); nanCommand = NanCommand::instance(wifiHandle); diff --git a/qcwcn/wifi_hal/nan_ind.cpp b/qcwcn/wifi_hal/nan_ind.cpp index af4a940..61608e7 100644 --- a/qcwcn/wifi_hal/nan_ind.cpp +++ b/qcwcn/wifi_hal/nan_ind.cpp @@ -20,7 +20,6 @@ #include "wifi_hal.h" #include "nan_i.h" #include "nancommand.h" -#include "qca-vendor.h" #include <errno.h> //Function which calls the necessaryIndication callback diff --git a/qcwcn/wifi_hal/qca-vendor_copy.h b/qcwcn/wifi_hal/qca-vendor_copy.h new file mode 100644 index 0000000..f3d185e --- /dev/null +++ b/qcwcn/wifi_hal/qca-vendor_copy.h @@ -0,0 +1,466 @@ +/* + * Qualcomm Atheros OUI and vendor specific assignments + * Copyright (c) 2014-2015, Qualcomm Atheros, Inc. + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ + +#ifndef QCA_VENDOR_H +#define QCA_VENDOR_H + +/* + * This file is a registry of identifier assignments from the Qualcomm Atheros + * OUI 00:13:74 for purposes other than MAC address assignment. New identifiers + * can be assigned through normal review process for changes to the upstream + * hostap.git repository. + */ + +#define OUI_QCA 0x001374 + +/** + * enum qca_radiotap_vendor_ids - QCA radiotap vendor namespace IDs + */ +enum qca_radiotap_vendor_ids { + QCA_RADIOTAP_VID_WLANTEST = 0, +}; + +/** + * enum qca_nl80211_vendor_subcmds - QCA nl80211 vendor command identifiers + * + * @QCA_NL80211_VENDOR_SUBCMD_UNSPEC: Reserved value 0 + * + * @QCA_NL80211_VENDOR_SUBCMD_TEST: Test command/event + * + * @QCA_NL80211_VENDOR_SUBCMD_ROAMING: Set roaming policy for drivers that use + * internal BSS-selection. This command uses + * @QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY to specify the new roaming policy + * for the current connection (i.e., changes policy set by the nl80211 + * Connect command). @QCA_WLAN_VENDOR_ATTR_MAC_ADDR may optionally be + * included to indicate which BSS to use in case roaming is disabled. + * + * @QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY: Recommendation of frequency + * ranges to avoid to reduce issues due to interference or internal + * co-existence information in the driver. The event data structure is + * defined in struct qca_avoid_freq_list. + * + * @QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY: Command to check driver support + * for DFS offloading. + * + * @QCA_NL80211_VENDOR_SUBCMD_NAN: NAN command/event which is used to pass + * NAN Request/Response and NAN Indication messages. These messages are + * interpreted between the framework and the firmware component. + * + * @QCA_NL80211_VENDOR_SUBCMD_KEY_MGMT_SET_KEY: Set key operation that can be + * used to configure PMK to the driver even when not connected. This can + * be used to request offloading of key management operations. Only used + * if device supports QCA_WLAN_VENDOR_FEATURE_KEY_MGMT_OFFLOAD. + * + * @QCA_NL80211_VENDOR_SUBCMD_KEY_MGMT_ROAM_AUTH: An extended version of + * NL80211_CMD_ROAM event with optional attributes including information + * from offloaded key management operation. Uses + * enum qca_wlan_vendor_attr_roam_auth attributes. Only used + * if device supports QCA_WLAN_VENDOR_FEATURE_KEY_MGMT_OFFLOAD. + * + * @QCA_NL80211_VENDOR_SUBCMD_DO_ACS: ACS command/event which is used to + * invoke the ACS function in device and pass selected channels to + * hostapd. + * + * @QCA_NL80211_VENDOR_SUBCMD_GET_FEATURES: Command to get the features + * supported by the driver. enum qca_wlan_vendor_features defines + * the possible features. + * + * @QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_CAC_STARTED: Event used by driver, + * which supports DFS offloading, to indicate a channel availability check + * start. + * + * @QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_CAC_FINISHED: Event used by driver, + * which supports DFS offloading, to indicate a channel availability check + * completion. + * + * @QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_CAC_ABORTED: Event used by driver, + * which supports DFS offloading, to indicate that the channel availability + * check aborted, no change to the channel status. + * + * @QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_CAC_NOP_FINISHED: Event used by + * driver, which supports DFS offloading, to indicate that the + * Non-Occupancy Period for this channel is over, channel becomes usable. + * + * @QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_RADAR_DETECTED: Event used by driver, + * which supports DFS offloading, to indicate a radar pattern has been + * detected. The channel is now unusable. + */ +enum qca_nl80211_vendor_subcmds { + QCA_NL80211_VENDOR_SUBCMD_UNSPEC = 0, + QCA_NL80211_VENDOR_SUBCMD_TEST = 1, + /* subcmds 2..8 not yet allocated */ + QCA_NL80211_VENDOR_SUBCMD_ROAMING = 9, + QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY = 10, + QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY = 11, + QCA_NL80211_VENDOR_SUBCMD_NAN = 12, + QCA_NL80211_VENDOR_SUBMCD_STATS_EXT = 13, + QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET = 14, + QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET = 15, + QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR = 16, + QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS = 17, + QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS = 18, + QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS = 19, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_START = 20, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_STOP = 21, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_GET_VALID_CHANNELS = 22, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_GET_CAPABILITIES = 23, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_GET_CACHED_RESULTS = 24, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_SCAN_RESULTS_AVAILABLE = 25, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_FULL_SCAN_RESULT = 26, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_SCAN_EVENT = 27, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_HOTLIST_AP_FOUND = 28, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_SET_BSSID_HOTLIST = 29, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_RESET_BSSID_HOTLIST = 30, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_SIGNIFICANT_CHANGE = 31, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_SET_SIGNIFICANT_CHANGE = 32, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_RESET_SIGNIFICANT_CHANGE = 33, + QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE = 34, + QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE = 35, + QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS = 36, + QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE = 37, + QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES = 38, + QCA_NL80211_VENDOR_SUBCMD_SCANNING_MAC_OUI = 39, + QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG = 40, + QCA_NL80211_VENDOR_SUBCMD_GSCAN_HOTLIST_AP_LOST = 41, + QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX = 42, + /* 43..49 - reserved for QCA */ + QCA_NL80211_VENDOR_SUBCMD_KEY_MGMT_SET_KEY = 50, + QCA_NL80211_VENDOR_SUBCMD_KEY_MGMT_ROAM_AUTH = 51, + QCA_NL80211_VENDOR_SUBCMD_APFIND = 52, + /* 53 - reserved - was used by QCA, but not in use anymore */ + QCA_NL80211_VENDOR_SUBCMD_DO_ACS = 54, + QCA_NL80211_VENDOR_SUBCMD_GET_FEATURES = 55, + QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_CAC_STARTED = 56, + QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_CAC_FINISHED = 57, + QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_CAC_ABORTED = 58, + QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_CAC_NOP_FINISHED = 59, + QCA_NL80211_VENDOR_SUBCMD_DFS_OFFLOAD_RADAR_DETECTED = 60, + /* 61-90 - reserved for QCA */ + QCA_NL80211_VENDOR_SUBCMD_DATA_OFFLOAD = 91, + QCA_NL80211_VENDOR_SUBCMD_OCB_SET_CONFIG = 92, + QCA_NL80211_VENDOR_SUBCMD_OCB_SET_UTC_TIME = 93, + QCA_NL80211_VENDOR_SUBCMD_OCB_START_TIMING_ADVERT = 94, + QCA_NL80211_VENDOR_SUBCMD_OCB_STOP_TIMING_ADVERT = 95, + QCA_NL80211_VENDOR_SUBCMD_OCB_GET_TSF_TIMER = 96, + QCA_NL80211_VENDOR_SUBCMD_DCC_GET_STATS = 97, + QCA_NL80211_VENDOR_SUBCMD_DCC_CLEAR_STATS = 98, + QCA_NL80211_VENDOR_SUBCMD_DCC_UPDATE_NDL = 99, + QCA_NL80211_VENDOR_SUBCMD_DCC_STATS_EVENT = 100, + QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES = 101, + QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG = 102, + QCA_NL80211_VENDOR_SUBCMD_GET_PREFERRED_FREQ_LIST = 103, + QCA_NL80211_VENDOR_SUBCMD_SET_PROBABLE_OPER_CHANNEL = 104, + QCA_NL80211_VENDOR_SUBCMD_SETBAND = 105, + QCA_NL80211_VENDOR_SUBCMD_TRIGGER_SCAN = 106, + QCA_NL80211_VENDOR_SUBCMD_SCAN_DONE = 107, + QCA_NL80211_VENDOR_SUBCMD_OTA_TEST = 108, + QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE = 109, + /* 110..114 - reserved for QCA */ + QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_DECR_DB = 115, + /* 116..118 - reserved for QCA */ +}; + + +enum qca_wlan_vendor_attr { + QCA_WLAN_VENDOR_ATTR_INVALID = 0, + /* used by QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY */ + QCA_WLAN_VENDOR_ATTR_DFS = 1, + /* used by QCA_NL80211_VENDOR_SUBCMD_NAN */ + QCA_WLAN_VENDOR_ATTR_NAN = 2, + /* used by QCA_NL80211_VENDOR_SUBCMD_STATS_EXT */ + QCA_WLAN_VENDOR_ATTR_STATS_EXT = 3, + /* used by QCA_NL80211_VENDOR_SUBCMD_STATS_EXT */ + QCA_WLAN_VENDOR_ATTR_IFINDEX = 4, + /* used by QCA_NL80211_VENDOR_SUBCMD_ROAMING, u32 with values defined + * by enum qca_roaming_policy. */ + QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY = 5, + QCA_WLAN_VENDOR_ATTR_MAC_ADDR = 6, + /* used by QCA_NL80211_VENDOR_SUBCMD_GET_FEATURES */ + QCA_WLAN_VENDOR_ATTR_FEATURE_FLAGS = 7, + QCA_WLAN_VENDOR_ATTR_TEST = 8, + /* used by QCA_NL80211_VENDOR_SUBCMD_GET_FEATURES */ + /* Unsigned 32-bit value. */ + QCA_WLAN_VENDOR_ATTR_CONCURRENCY_CAPA = 9, + /* Unsigned 32-bit value */ + QCA_WLAN_VENDOR_ATTR_MAX_CONCURRENT_CHANNELS_2_4_BAND = 10, + /* Unsigned 32-bit value */ + QCA_WLAN_VENDOR_ATTR_MAX_CONCURRENT_CHANNELS_5_0_BAND = 11, + /* Unsigned 32-bit value from enum qca_set_band. */ + QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE = 12, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_AFTER_LAST - 1, +}; + + +enum qca_roaming_policy { + QCA_ROAMING_NOT_ALLOWED, + QCA_ROAMING_ALLOWED_WITHIN_ESS, +}; + +enum qca_wlan_vendor_attr_roam_auth { + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_BSSID, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_REQ_IE, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_RESP_IE, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_AUTHORIZED, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_KEY_REPLAY_CTR, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_PTK_KCK, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_PTK_KEK, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_SUBNET_STATUS, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_MAX = + QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_AFTER_LAST - 1 +}; + +enum qca_wlan_vendor_attr_acs_offload { + QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_ACS_PRIMARY_CHANNEL, + QCA_WLAN_VENDOR_ATTR_ACS_SECONDARY_CHANNEL, + QCA_WLAN_VENDOR_ATTR_ACS_HW_MODE, + QCA_WLAN_VENDOR_ATTR_ACS_HT_ENABLED, + QCA_WLAN_VENDOR_ATTR_ACS_HT40_ENABLED, + QCA_WLAN_VENDOR_ATTR_ACS_VHT_ENABLED, + QCA_WLAN_VENDOR_ATTR_ACS_CHWIDTH, + QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST, + QCA_WLAN_VENDOR_ATTR_ACS_VHT_SEG0_CENTER_CHANNEL, + QCA_WLAN_VENDOR_ATTR_ACS_VHT_SEG1_CENTER_CHANNEL, + QCA_WLAN_VENDOR_ATTR_ACS_FREQ_LIST, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_ACS_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_ACS_MAX = + QCA_WLAN_VENDOR_ATTR_ACS_AFTER_LAST - 1 +}; + +enum qca_wlan_vendor_acs_hw_mode { + QCA_ACS_MODE_IEEE80211B, + QCA_ACS_MODE_IEEE80211G, + QCA_ACS_MODE_IEEE80211A, + QCA_ACS_MODE_IEEE80211AD, + QCA_ACS_MODE_IEEE80211ANY, +}; + +/** + * enum qca_wlan_vendor_features - Vendor device/driver feature flags + * + * @QCA_WLAN_VENDOR_FEATURE_KEY_MGMT_OFFLOAD: Device supports key + * management offload, a mechanism where the station's firmware + * does the exchange with the AP to establish the temporal keys + * after roaming, rather than having the user space wpa_supplicant do it. + * @QCA_WLAN_VENDOR_FEATURE_SUPPORT_HW_MODE_ANY: Device supports automatic + * band selection based on channel selection results. + * @QCA_WLAN_VENDOR_FEATURE_OFFCHANNEL_SIMULTANEOUS: Device supports + * simultaneous off-channel operations. + * @NUM_QCA_WLAN_VENDOR_FEATURES: Number of assigned feature bits + */ +enum qca_wlan_vendor_features { + QCA_WLAN_VENDOR_FEATURE_KEY_MGMT_OFFLOAD = 0, + QCA_WLAN_VENDOR_FEATURE_SUPPORT_HW_MODE_ANY = 1, + QCA_WLAN_VENDOR_FEATURE_OFFCHANNEL_SIMULTANEOUS = 2, + NUM_QCA_WLAN_VENDOR_FEATURES /* keep last */ +}; + +/** + * enum qca_wlan_vendor_attr_data_offload_ind - Vendor Data Offload Indication + * + * @QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_SESSION: Session corresponding to + * the offloaded data. + * @QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_PROTOCOL: Protocol of the offloaded + * data. + * @QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_EVENT: Event type for the data offload + * indication. + */ +enum qca_wlan_vendor_attr_data_offload_ind { + QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_SESSION, + QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_PROTOCOL, + QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_EVENT, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_MAX = + QCA_WLAN_VENDOR_ATTR_DATA_OFFLOAD_IND_AFTER_LAST - 1 +}; + +enum qca_vendor_attr_get_preferred_freq_list { + QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_INVALID, + /* A 32-unsigned value; the interface type/mode for which the preferred + * frequency list is requested (see enum qca_iface_type for possible + * values); used in GET_PREFERRED_FREQ_LIST command from user-space to + * kernel and in the kernel response back to user-space. + */ + QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_IFACE_TYPE, + /* An array of 32-unsigned values; values are frequency (MHz); sent + * from kernel space to user space. + */ + QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_MAX = + QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_AFTER_LAST - 1 +}; + +enum qca_vendor_attr_probable_oper_channel { + QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_INVALID, + /* 32-bit unsigned value; indicates the connection/iface type likely to + * come on this channel (see enum qca_iface_type). + */ + QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_IFACE_TYPE, + /* 32-bit unsigned value; the frequency (MHz) of the probable channel */ + QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_FREQ, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_MAX = + QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_AFTER_LAST - 1 +}; + +enum qca_iface_type { + QCA_IFACE_TYPE_STA, + QCA_IFACE_TYPE_AP, + QCA_IFACE_TYPE_P2P_CLIENT, + QCA_IFACE_TYPE_P2P_GO, + QCA_IFACE_TYPE_IBSS, + QCA_IFACE_TYPE_TDLS, +}; + +enum qca_set_band { + QCA_SETBAND_AUTO, + QCA_SETBAND_5G, + QCA_SETBAND_2G, +}; + +/* IEEE 802.11 Vendor Specific elements */ + +/** + * enum qca_vendor_element_id - QCA Vendor Specific element types + * + * These values are used to identify QCA Vendor Specific elements. The + * payload of the element starts with the three octet OUI (OUI_QCA) and + * is followed by a single octet type which is defined by this enum. + * + * @QCA_VENDOR_ELEM_P2P_PREF_CHAN_LIST: P2P preferred channel list. + * This element can be used to specify preference order for supported + * channels. The channels in this list are in preference order (the first + * one has the highest preference) and are described as a pair of + * (global) Operating Class and Channel Number (each one octet) fields. + * + * This extends the standard P2P functionality by providing option to have + * more than one preferred operating channel. When this element is present, + * it replaces the preference indicated in the Operating Channel attribute. + * For supporting other implementations, the Operating Channel attribute is + * expected to be used with the highest preference channel. Similarly, all + * the channels included in this Preferred channel list element are + * expected to be included in the Channel List attribute. + * + * This vendor element may be included in GO Negotiation Request, P2P + * Invitation Request, and Provision Discovery Request frames. + */ +enum qca_vendor_element_id { + QCA_VENDOR_ELEM_P2P_PREF_CHAN_LIST = 0, +}; + +/** + * enum qca_wlan_vendor_attr_scan - Specifies vendor scan attributes + * + * @QCA_WLAN_VENDOR_ATTR_SCAN_IE: IEs that should be included as part of scan + * @QCA_WLAN_VENDOR_ATTR_SCAN_FREQUENCIES: Nested unsigned 32-bit attributes + * with frequencies to be scanned (in MHz) + * @QCA_WLAN_VENDOR_ATTR_SCAN_SSIDS: Nested attribute with SSIDs to be scanned + * @QCA_WLAN_VENDOR_ATTR_SCAN_SUPP_RATES: Nested array attribute of supported + * rates to be included + * @QCA_WLAN_VENDOR_ATTR_SCAN_TX_NO_CCK_RATE: flag used to send probe requests + * at non CCK rate in 2GHz band + * @QCA_WLAN_VENDOR_ATTR_SCAN_FLAGS: Unsigned 32-bit scan flags + * @QCA_WLAN_VENDOR_ATTR_SCAN_COOKIE: Unsigned 64-bit cookie provided by the + * driver for the specific scan request + * @QCA_WLAN_VENDOR_ATTR_SCAN_STATUS: Unsigned 8-bit status of the scan + * request decoded as in enum scan_status + * @QCA_WLAN_VENDOR_ATTR_SCAN_MAC: 6-byte MAC address to use when randomisation + * scan flag is set + * @QCA_WLAN_VENDOR_ATTR_SCAN_MAC_MASK: 6-byte MAC address mask to be used with + * randomisation + */ +enum qca_wlan_vendor_attr_scan { + QCA_WLAN_VENDOR_ATTR_SCAN_INVALID_PARAM = 0, + QCA_WLAN_VENDOR_ATTR_SCAN_IE, + QCA_WLAN_VENDOR_ATTR_SCAN_FREQUENCIES, + QCA_WLAN_VENDOR_ATTR_SCAN_SSIDS, + QCA_WLAN_VENDOR_ATTR_SCAN_SUPP_RATES, + QCA_WLAN_VENDOR_ATTR_SCAN_TX_NO_CCK_RATE, + QCA_WLAN_VENDOR_ATTR_SCAN_FLAGS, + QCA_WLAN_VENDOR_ATTR_SCAN_COOKIE, + QCA_WLAN_VENDOR_ATTR_SCAN_STATUS, + QCA_WLAN_VENDOR_ATTR_SCAN_MAC, + QCA_WLAN_VENDOR_ATTR_SCAN_MAC_MASK, + QCA_WLAN_VENDOR_ATTR_SCAN_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_SCAN_MAX = + QCA_WLAN_VENDOR_ATTR_SCAN_AFTER_LAST - 1 +}; + +/** + * enum scan_status - Specifies the valid values the vendor scan attribute + * QCA_WLAN_VENDOR_ATTR_SCAN_STATUS can take + * + * @VENDOR_SCAN_STATUS_NEW_RESULTS: implies the vendor scan is successful with + * new scan results + * @VENDOR_SCAN_STATUS_ABORTED: implies the vendor scan was aborted in-between + */ +enum scan_status { + VENDOR_SCAN_STATUS_NEW_RESULTS, + VENDOR_SCAN_STATUS_ABORTED, + VENDOR_SCAN_STATUS_MAX, +}; + +/** + * enum qca_vendor_attr_ota_test - Specifies the values for vendor + * command QCA_NL80211_VENDOR_SUBCMD_OTA_TEST + * @QCA_WLAN_VENDOR_ATTR_OTA_TEST_ENABLE: enable ota test + */ +enum qca_vendor_attr_ota_test { + QCA_WLAN_VENDOR_ATTR_OTA_TEST_INVALID, + /* 8-bit unsigned value to indicate if OTA test is enabled */ + QCA_WLAN_VENDOR_ATTR_OTA_TEST_ENABLE, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_OTA_TEST_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_OTA_TEST_MAX = + QCA_WLAN_VENDOR_ATTR_OTA_TEST_AFTER_LAST - 1 +}; + +/** + * enum qca_vendor_attr_txpower_scale - vendor sub commands index + * + * @QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE: scaling value + */ +enum qca_vendor_attr_txpower_scale { + QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_INVALID, + /* 8-bit unsigned value to indicate the scaling of tx power */ + QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_MAX = + QCA_WLAN_VENDOR_ATTR_TXPOWER_SCALE_AFTER_LAST - 1 +}; + +/** + * enum qca_vendor_attr_txpower_decr_db - Attributes for TX power decrease + * + * These attributes are used with QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_DECR_DB. + */ +enum qca_vendor_attr_txpower_decr_db { + QCA_WLAN_VENDOR_ATTR_TXPOWER_DECR_DB_INVALID, + /* 8-bit unsigned value to indicate the reduction of TX power in dB for + * a virtual interface. */ + QCA_WLAN_VENDOR_ATTR_TXPOWER_DECR_DB, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_TXPOWER_DECR_DB_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_TXPOWER_DECR_DB_MAX = + QCA_WLAN_VENDOR_ATTR_TXPOWER_DECR_DB_AFTER_LAST - 1 +}; + +#endif /* QCA_VENDOR_H */ diff --git a/qcwcn/wifi_hal/rssi_monitor.cpp b/qcwcn/wifi_hal/rssi_monitor.cpp index aadda21..8cffe98 100644 --- a/qcwcn/wifi_hal/rssi_monitor.cpp +++ b/qcwcn/wifi_hal/rssi_monitor.cpp @@ -36,23 +36,90 @@ #include "common.h" #include "cpp_bindings.h" #include "rssi_monitor.h" -#include "qca-vendor.h" #include "vendor_definitions.h" -//Singleton Static Instance -RSSIMonitorCommand* RSSIMonitorCommand::mRSSIMonitorCommandInstance = NULL; +/* Used to handle rssi command events from driver/firmware.*/ +typedef struct rssi_monitor_event_handler_s { + RSSIMonitorCommand* mRSSIMonitorCommandInstance; +} rssi_monitor_event_handlers; + +wifi_error initializeRSSIMonitorHandler(hal_info *info) +{ + info->rssi_handlers = (rssi_monitor_event_handlers *)malloc(sizeof( + rssi_monitor_event_handlers)); + if (info->rssi_handlers) { + memset(info->rssi_handlers, 0, sizeof(rssi_monitor_event_handlers)); + } + else { + ALOGE("%s: Allocation of RSSI event handlers failed", + __FUNCTION__); + return WIFI_ERROR_OUT_OF_MEMORY; + } + return WIFI_SUCCESS; +} + +wifi_error cleanupRSSIMonitorHandler(hal_info *info) +{ + rssi_monitor_event_handlers* event_handlers; + if (info && info->rssi_handlers) { + event_handlers = (rssi_monitor_event_handlers*) info->rssi_handlers; + if (event_handlers->mRSSIMonitorCommandInstance) { + delete event_handlers->mRSSIMonitorCommandInstance; + } + memset(event_handlers, 0, sizeof(rssi_monitor_event_handlers)); + return WIFI_SUCCESS; + } + ALOGE ("%s: info or info->rssi_handlers NULL", __FUNCTION__); + return WIFI_ERROR_UNKNOWN; +} + +void RSSIMonitorCommand::enableEventHandling() +{ + pthread_mutex_lock(&rm_lock); + mEventHandlingEnabled = true; + pthread_mutex_unlock(&rm_lock); +} + +void RSSIMonitorCommand::disableEventHandling() +{ + pthread_mutex_lock(&rm_lock); + mEventHandlingEnabled = false; + pthread_mutex_unlock(&rm_lock); +} + +bool RSSIMonitorCommand::isEventHandlingEnabled() +{ + bool eventHandlingEnabled; + pthread_mutex_lock(&rm_lock); + eventHandlingEnabled = mEventHandlingEnabled; + pthread_mutex_unlock(&rm_lock); + + return eventHandlingEnabled; +} + +void RSSIMonitorCommand::setCallbackHandler(wifi_rssi_event_handler handler) +{ + mHandler = handler; +} RSSIMonitorCommand::RSSIMonitorCommand(wifi_handle handle, int id, u32 vendor_id, u32 subcmd) : WifiVendorCommand(handle, id, vendor_id, subcmd) { - mRSSIMonitorCommandInstance = NULL; memset(&mHandler, 0, sizeof(mHandler)); + 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); + } + pthread_mutex_init(&rm_lock, NULL); + disableEventHandling(); } RSSIMonitorCommand::~RSSIMonitorCommand() { - mRSSIMonitorCommandInstance = NULL; + unregisterVendorHandler(mVendor_id, mSubcmd); + pthread_mutex_destroy(&rm_lock); } void RSSIMonitorCommand::setReqId(wifi_request_id reqid) @@ -67,10 +134,20 @@ RSSIMonitorCommand* RSSIMonitorCommand::instance(wifi_handle handle, ALOGE("Interface Handle is invalid"); return NULL; } + hal_info *info = getHalInfo(handle); + if (!info || !info->rssi_handlers) { + ALOGE("rssi_handlers is invalid"); + return NULL; + } + + RSSIMonitorCommand* mRSSIMonitorCommandInstance = + info->rssi_handlers->mRSSIMonitorCommandInstance; + if (mRSSIMonitorCommandInstance == NULL) { mRSSIMonitorCommandInstance = new RSSIMonitorCommand(handle, id, OUI_QCA, QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI); + info->rssi_handlers->mRSSIMonitorCommandInstance = mRSSIMonitorCommandInstance; return mRSSIMonitorCommandInstance; } else @@ -93,6 +170,13 @@ RSSIMonitorCommand* RSSIMonitorCommand::instance(wifi_handle handle, int RSSIMonitorCommand::handleEvent(WifiEvent &event) { int ret = WIFI_SUCCESS; + + if (isEventHandlingEnabled() == false) { + ALOGE("%s: RSSI monitor isn't running or already stopped. " + "Nothing to do. Exit", __FUNCTION__); + return ret; + } + WifiVendorCommand::handleEvent(event); /* Parse the vendordata and get the attribute */ @@ -160,29 +244,9 @@ int RSSIMonitorCommand::handleEvent(WifiEvent &event) ALOGE("%s: Wrong subcmd received %d", __FUNCTION__, mSubcmd); } - return NL_SKIP; -} - -int RSSIMonitorCommand::setCallbackHandler(wifi_rssi_event_handler nHandler, - u32 event) -{ - int ret; - mHandler = nHandler; - ret = registerVendorHandler(mVendor_id, event); - if (ret != 0) { - /* Error case should not happen print log */ - ALOGE("%s: Unable to register Vendor Handler Vendor Id=0x%x subcmd=%u", - __FUNCTION__, mVendor_id, mSubcmd); - } return ret; } -wifi_error RSSIMonitorCommand::unregisterHandler(u32 subCmd) -{ - unregisterVendorHandler(mVendor_id, subCmd); - return WIFI_SUCCESS; -} - wifi_error wifi_start_rssi_monitoring(wifi_request_id id, wifi_interface_handle iface, s8 max_rssi, @@ -234,15 +298,14 @@ wifi_error wifi_start_rssi_monitoring(wifi_request_id id, return WIFI_ERROR_OUT_OF_MEMORY; } - ret = rssiCommand->setCallbackHandler(eh, - QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI); - if (ret < 0) - goto cleanup; + rssiCommand->setCallbackHandler(eh); ret = vCommand->requestResponse(); if (ret < 0) goto cleanup; + rssiCommand->enableEventHandling(); + cleanup: delete vCommand; return (wifi_error)ret; @@ -256,6 +319,18 @@ wifi_error wifi_stop_rssi_monitoring(wifi_request_id id, WifiVendorCommand *vCommand = NULL; wifi_handle wifiHandle = getWifiHandle(iface); RSSIMonitorCommand *rssiCommand; + rssi_monitor_event_handlers* event_handlers; + hal_info *info = getHalInfo(wifiHandle); + + event_handlers = (rssi_monitor_event_handlers*)info->rssi_handlers; + rssiCommand = event_handlers->mRSSIMonitorCommandInstance; + + if (rssiCommand == NULL || + rssiCommand->isEventHandlingEnabled() == false) { + ALOGE("%s: RSSI monitor isn't running or already stopped. " + "Nothing to do. Exit", __FUNCTION__); + return WIFI_ERROR_NOT_AVAILABLE; + } ret = initialize_vendor_cmd(iface, id, QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI, @@ -286,19 +361,8 @@ wifi_error wifi_stop_rssi_monitoring(wifi_request_id id, if (ret < 0) goto cleanup; - rssiCommand = RSSIMonitorCommand::instance(wifiHandle, id); - if (rssiCommand == NULL) { - ALOGE("%s: Error rssiCommand NULL", __FUNCTION__); - ret = WIFI_ERROR_OUT_OF_MEMORY; - goto cleanup; - } - - ret = rssiCommand->unregisterHandler( - QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI); - if (ret != WIFI_SUCCESS) - goto cleanup; + rssiCommand->disableEventHandling(); - delete rssiCommand; cleanup: delete vCommand; diff --git a/qcwcn/wifi_hal/rssi_monitor.h b/qcwcn/wifi_hal/rssi_monitor.h index bd3d88e..c6ea692 100644 --- a/qcwcn/wifi_hal/rssi_monitor.h +++ b/qcwcn/wifi_hal/rssi_monitor.h @@ -42,14 +42,19 @@ private: static RSSIMonitorCommand *mRSSIMonitorCommandInstance; wifi_rssi_event_handler mHandler; RSSIMonitorCommand(wifi_handle handle, int id, u32 vendor_id, u32 subcmd); + bool mEventHandlingEnabled; + /* mutex for the mEventHandlingEnabled access*/ + pthread_mutex_t rm_lock; public: virtual ~RSSIMonitorCommand(); static RSSIMonitorCommand* instance(wifi_handle handle, wifi_request_id id); - virtual int setCallbackHandler(wifi_rssi_event_handler nHandler, u32 event); virtual int handleEvent(WifiEvent &event); - virtual wifi_error unregisterHandler(u32 subCmd); virtual void setReqId(wifi_request_id reqid); + virtual void setCallbackHandler(wifi_rssi_event_handler nHandler); + void enableEventHandling(); + void disableEventHandling(); + bool isEventHandlingEnabled(); }; #ifdef __cplusplus diff --git a/qcwcn/wifi_hal/rtt.cpp b/qcwcn/wifi_hal/rtt.cpp index d929c3a..f3ca8e4 100644 --- a/qcwcn/wifi_hal/rtt.cpp +++ b/qcwcn/wifi_hal/rtt.cpp @@ -52,9 +52,6 @@ wifi_error wifi_get_rtt_capabilities(wifi_interface_handle iface, return WIFI_ERROR_INVALID_ARGS; } - interface_info *ifaceInfo = getIfaceInfo(iface); - wifi_handle wifiHandle = getWifiHandle(iface); - if (capabilities == NULL) { ALOGE("wifi_get_rtt_capabilities: NULL capabilities pointer provided." " Exit."); @@ -102,9 +99,6 @@ wifi_error wifi_rtt_range_request(wifi_request_id id, return WIFI_ERROR_INVALID_ARGS; } - interface_info *ifaceInfo = getIfaceInfo(iface); - wifi_handle wifiHandle = getWifiHandle(iface); - if (rtt_config == NULL) { ALOGE("wifi_rtt_range_request: NULL rtt_config pointer provided." " Exit."); @@ -167,9 +161,6 @@ wifi_error wifi_rtt_range_cancel(wifi_request_id id, return WIFI_ERROR_INVALID_ARGS; } - interface_info *ifaceInfo = getIfaceInfo(iface); - wifi_handle wifiHandle = getWifiHandle(iface); - if (addr == NULL) { ALOGE("wifi_rtt_range_cancel: NULL addr pointer provided." " Exit."); @@ -220,9 +211,6 @@ wifi_error wifi_set_lci(wifi_request_id id, wifi_interface_handle iface, return WIFI_ERROR_INVALID_ARGS; } - interface_info *ifaceInfo = getIfaceInfo(iface); - wifi_handle wifiHandle = getWifiHandle(iface); - if (lci == NULL) { ALOGE("%s: NULL lci pointer provided." " Exit.", __FUNCTION__); @@ -267,9 +255,6 @@ wifi_error wifi_set_lcr(wifi_request_id id, wifi_interface_handle iface, return WIFI_ERROR_INVALID_ARGS; } - interface_info *ifaceInfo = getIfaceInfo(iface); - wifi_handle wifiHandle = getWifiHandle(iface); - if (lcr == NULL) { ALOGE("%s: NULL lcr pointer provided." " Exit.", __FUNCTION__); diff --git a/qcwcn/wifi_hal/tdls.cpp b/qcwcn/wifi_hal/tdls.cpp index f42d3ef..a1b0936 100755..100644 --- a/qcwcn/wifi_hal/tdls.cpp +++ b/qcwcn/wifi_hal/tdls.cpp @@ -92,9 +92,6 @@ void TdlsCommand::setSubCmd(u32 subcmd) int TdlsCommand::handleEvent(WifiEvent &event) { ALOGV("Got a TDLS message from Driver"); - unsigned i=0; - u32 status; - int ret = WIFI_SUCCESS; WifiVendorCommand::handleEvent(event); /* Parse the vendordata and get the attribute */ @@ -102,12 +99,10 @@ int TdlsCommand::handleEvent(WifiEvent &event) { case QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE: { - wifi_request_id id; struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX + 1]; mac_addr addr; wifi_tdls_status status; - int rem; memset(&addr, 0, sizeof(mac_addr)); memset(&status, 0, sizeof(wifi_tdls_status)); @@ -187,18 +182,14 @@ int TdlsCommand::handleEvent(WifiEvent &event) int TdlsCommand::handleResponse(WifiEvent &reply) { - u32 status; - int i = 0; WifiVendorCommand::handleResponse(reply); switch(mSubcmd) { case QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS: { - wifi_request_id id; struct nlattr *tb_vendor[ QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; - int rem; nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, (struct nlattr *)mVendorData, mDataLen, NULL); diff --git a/qcwcn/wifi_hal/tdlsCommand.h b/qcwcn/wifi_hal/tdlsCommand.h index 1ee9e32..19a5e38 100755 --- a/qcwcn/wifi_hal/tdlsCommand.h +++ b/qcwcn/wifi_hal/tdlsCommand.h @@ -59,7 +59,6 @@ #define PRINTF_FORMAT(a,b) #define STRUCT_PACKED #endif -#include "qca-vendor.h" #ifdef __cplusplus extern "C" diff --git a/qcwcn/wifi_hal/vendor_definitions.h b/qcwcn/wifi_hal/vendor_definitions.h index e9180a1..46a1b83 100644 --- a/qcwcn/wifi_hal/vendor_definitions.h +++ b/qcwcn/wifi_hal/vendor_definitions.h @@ -17,6 +17,8 @@ #ifndef __VENDOR_DEFINITIONS_H__ #define __VENDOR_DEFINITIONS_H__ +#include "qca-vendor_copy.h" + #define WIFI_SCANNING_MAC_OUI_LENGTH 3 #define WIFI_MAC_ADDR_LENGTH 6 diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp index 49bf2b4..64c0143 100644 --- a/qcwcn/wifi_hal/wifi_hal.cpp +++ b/qcwcn/wifi_hal/wifi_hal.cpp @@ -97,15 +97,10 @@ wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name) void wifi_socket_set_local_port(struct nl_sock *sock, uint32_t port) { - uint32_t pid = getpid() & 0x3FFFFF; - - if (port == 0) { - sock->s_flags &= ~NL_OWN_PORT; - } else { - sock->s_flags |= NL_OWN_PORT; - } - - sock->s_local.nl_pid = pid + (port << 22); + /* Release local port pool maintained by libnl and assign a own port + * identifier to the socket. + */ + nl_socket_set_local_port(sock, ((uint32_t)getpid() & 0x3FFFFFU) | (port << 22)); } static nl_sock * wifi_create_nl_socket(int port, int protocol) @@ -119,16 +114,6 @@ static nl_sock * wifi_create_nl_socket(int port, int protocol) wifi_socket_set_local_port(sock, port); - struct sockaddr_nl *addr_nl = &(sock->s_local); - /* ALOGI("socket address is %d:%d:%d:%d", - addr_nl->nl_family, addr_nl->nl_pad, addr_nl->nl_pid, - addr_nl->nl_groups); */ - - struct sockaddr *addr = NULL; - // ALOGI("sizeof(sockaddr) = %d, sizeof(sockaddr_nl) = %d", sizeof(*addr), - // sizeof(*addr_nl)); - - // ALOGI("Connecting socket"); if (nl_connect(sock, protocol)) { ALOGE("Could not connect handle"); nl_socket_free(sock); @@ -570,6 +555,12 @@ wifi_error wifi_initialize(wifi_handle *handle) goto unload; } + ret = initializeRSSIMonitorHandler(info); + if (ret != WIFI_SUCCESS) { + ALOGE("Initializing RSSI Event Handler Failed"); + goto unload; + } + ALOGV("Initialized Wifi HAL Successfully; vendor cmd = %d Supported" " features : %x", NL80211_CMD_VENDOR, info->supported_feature_set); @@ -586,6 +577,7 @@ unload: if (info->pkt_stats) free(info->pkt_stats); if (info->rx_aggr_pkts) free(info->rx_aggr_pkts); cleanupGscanHandlers(info); + cleanupRSSIMonitorHandler(info); free(info); } } @@ -636,6 +628,7 @@ static void internal_cleaned_up_handler(wifi_handle handle) free(info->rx_aggr_pkts); wifi_logger_ring_buffers_deinit(info); cleanupGscanHandlers(info); + cleanupRSSIMonitorHandler(info); if (info->exit_sockets[0] >= 0) { close(info->exit_sockets[0]); @@ -725,7 +718,6 @@ void wifi_event_loop(wifi_handle handle) /* TODO: Add support for timeouts */ do { - int timeout = -1; /* Infinite timeout */ pfd[0].revents = 0; pfd[1].revents = 0; pfd[2].revents = 0; @@ -858,7 +850,6 @@ public: // ALOGI("handling reponse in %s", __func__); struct nlattr **tb = reply.attributes(); - struct genlmsghdr *gnlh = reply.header(); struct nlattr *mcgrp = NULL; int i; diff --git a/qcwcn/wifi_hal/wificonfig.cpp b/qcwcn/wifi_hal/wificonfig.cpp index c6a6a7c..8a09488 100644 --- a/qcwcn/wifi_hal/wificonfig.cpp +++ b/qcwcn/wifi_hal/wificonfig.cpp @@ -44,7 +44,6 @@ wifi_error wifi_extended_dtim_config_set(wifi_request_id id, struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - hal_info *info = getHalInfo(wifiHandle); ALOGV("%s: extended_dtim:%d", __FUNCTION__, extended_dtim); @@ -110,10 +109,7 @@ wifi_error wifi_set_country_code(wifi_interface_handle iface, { int requestId, ret = 0; WiFiConfigCommand *wifiConfigCommand; - struct nlattr *nlData; - interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - hal_info *info = getHalInfo(wifiHandle); ALOGV("%s: %s", __FUNCTION__, country_code); @@ -168,7 +164,6 @@ wifi_error wifi_set_beacon_wifi_iface_stats_averaging_factor( struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - hal_info *info = getHalInfo(wifiHandle); ALOGV("%s factor:%u", __FUNCTION__, factor); wifiConfigCommand = new WiFiConfigCommand( @@ -236,7 +231,6 @@ wifi_error wifi_set_guard_time(wifi_request_id id, struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - hal_info *info = getHalInfo(wifiHandle); ALOGV("%s : guard_time:%u", __FUNCTION__, guard_time); diff --git a/qcwcn/wifi_hal/wificonfigcommand.h b/qcwcn/wifi_hal/wificonfigcommand.h index b8c6142..f2bf329 100644 --- a/qcwcn/wifi_hal/wificonfigcommand.h +++ b/qcwcn/wifi_hal/wificonfigcommand.h @@ -38,7 +38,6 @@ #define PRINTF_FORMAT(a,b) #define STRUCT_PACKED #endif -#include "qca-vendor.h" #include "vendor_definitions.h" #include "wifi_config.h" diff --git a/qcwcn/wifi_hal/wifilogger.cpp b/qcwcn/wifi_hal/wifilogger.cpp index 87593bf..78185f5 100644 --- a/qcwcn/wifi_hal/wifilogger.cpp +++ b/qcwcn/wifi_hal/wifilogger.cpp @@ -163,7 +163,6 @@ wifi_error wifi_get_ring_buffers_status(wifi_interface_handle iface, wifi_ring_buffer_status *status) { int ret = 0; - interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); hal_info *info = getHalInfo(wifiHandle); wifi_ring_buffer_status *rbs; @@ -223,7 +222,6 @@ wifi_error wifi_get_logger_supported_feature_set(wifi_interface_handle iface, struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - hal_info *info = getHalInfo(wifiHandle); /* No request id from caller, so generate one and pass it on to the driver. * Generate one randomly. @@ -358,7 +356,6 @@ wifi_error wifi_get_firmware_version(wifi_interface_handle iface, struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - hal_info *info = getHalInfo(wifiHandle); /* No request id from caller, so generate one and pass it on to the driver. * Generate one randomly. @@ -422,7 +419,6 @@ wifi_error wifi_get_driver_version(wifi_interface_handle iface, struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - hal_info *info = getHalInfo(wifiHandle); /* No request id from caller, so generate one and pass it on to the driver. * Generate one randomly. @@ -485,7 +481,6 @@ wifi_error wifi_get_firmware_memory_dump(wifi_interface_handle iface, struct nlattr *nlData; interface_info *ifaceInfo = getIfaceInfo(iface); wifi_handle wifiHandle = getWifiHandle(iface); - hal_info *info = getHalInfo(wifiHandle); /* No request id from caller, so generate one and pass it on to the driver. * Generate one randomly. @@ -988,9 +983,6 @@ int WifiLoggerCommand::requestResponse() } int WifiLoggerCommand::handleResponse(WifiEvent &reply) { - u32 status; - int ret = WIFI_SUCCESS; - int i = 0; int len = 0, version; char version_type[20]; char* memBuffer = NULL; @@ -1052,7 +1044,6 @@ int WifiLoggerCommand::handleResponse(WifiEvent &reply) { case QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP: { - int id = 0; u32 memDumpSize = 0; int numRecordsRead = 0; u32 remaining = 0; @@ -1329,7 +1320,6 @@ int WifiLoggerCommand::handleEvent(WifiEvent &event) break; } -cleanup: return NL_SKIP; } @@ -1353,7 +1343,6 @@ void WifiLoggerCommand::unregisterHandler(u32 subCmd) int WifiLoggerCommand::timed_wait(u16 wait_time) { struct timespec absTime; - int res; absTime.tv_sec = wait_time; absTime.tv_nsec = 0; return mCondition.wait(absTime); diff --git a/qcwcn/wifi_hal/wifilogger_diag.cpp b/qcwcn/wifi_hal/wifilogger_diag.cpp index 1017357..88b9c5f 100644 --- a/qcwcn/wifi_hal/wifilogger_diag.cpp +++ b/qcwcn/wifi_hal/wifilogger_diag.cpp @@ -39,6 +39,11 @@ #include "wifilogger_vendor_tag_defs.h" #include "pkt_stats.h" +static uint32_t get_le32(const uint8_t *pos) +{ + return pos[0] | (pos[1] << 8) | (pos[2] << 16) | (pos[3] << 24); +} + #define MAX_CONNECTIVITY_EVENTS 18 // should match the value in wifi_logger.h static event_remap_t events[MAX_CONNECTIVITY_EVENTS] = { {WLAN_PE_DIAG_ASSOC_REQ_EVENT, WIFI_EVENT_ASSOCIATION_REQUESTED}, @@ -834,29 +839,46 @@ static wifi_error process_beacon_received_event(hal_info *info, static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) { - u16 count = 0, id, payloadlen; + u16 count = 0, id; + u16 payloadlen = 0; + u16 hdr_size = 0; wifi_error status; + fw_diag_msg_fixed_hdr_t *diag_msg_fixed_hdr; fw_diag_msg_hdr_t *diag_msg_hdr; + fw_diag_msg_hdr_v2_t *diag_msg_hdr_v2; + u8 *payload = NULL; buf += 4; length -= 4; - while (length > (count + sizeof(fw_diag_msg_hdr_t))) { - diag_msg_hdr = (fw_diag_msg_hdr_t *)(buf + count); - - id = diag_msg_hdr->diag_id; - payloadlen = diag_msg_hdr->u.payload_len; - - switch (diag_msg_hdr->diag_event_type) { + while (length > (count + sizeof(fw_diag_msg_fixed_hdr_t))) { + diag_msg_fixed_hdr = (fw_diag_msg_fixed_hdr_t *)(buf + count); + switch (diag_msg_fixed_hdr->diag_event_type) { case WLAN_DIAG_TYPE_EVENT: + case WLAN_DIAG_TYPE_EVENT_V2: { + if (WLAN_DIAG_TYPE_EVENT == + diag_msg_fixed_hdr->diag_event_type) { + diag_msg_hdr = (fw_diag_msg_hdr_t *)diag_msg_fixed_hdr; + id = diag_msg_hdr->diag_id; + payloadlen = diag_msg_hdr->u.payload_len; + hdr_size = sizeof(fw_diag_msg_hdr_t); + payload = diag_msg_hdr->payload; + } else { + diag_msg_hdr_v2 = + (fw_diag_msg_hdr_v2_t *)diag_msg_fixed_hdr; + id = diag_msg_hdr_v2->diag_id; + payloadlen = diag_msg_hdr_v2->u.payload_len; + hdr_size = sizeof(fw_diag_msg_hdr_v2_t); + payload = diag_msg_hdr_v2->payload; + } switch (id) { case EVENT_WLAN_BT_COEX_BT_SCO_START: case EVENT_WLAN_BT_COEX_BT_SCO_STOP: case EVENT_WLAN_BT_COEX_BT_HID_START: case EVENT_WLAN_BT_COEX_BT_HID_STOP: status = process_bt_coex_event(info, id, - diag_msg_hdr->payload, + payload, payloadlen); if (status != WIFI_SUCCESS) { ALOGE("Failed to process bt_coex event"); @@ -866,7 +888,7 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) case EVENT_WLAN_BT_COEX_BT_SCAN_START: case EVENT_WLAN_BT_COEX_BT_SCAN_STOP: status = process_bt_coex_scan_event(info, id, - diag_msg_hdr->payload, + payload, payloadlen); if (status != WIFI_SUCCESS) { ALOGE("Failed to process bt_coex_scan event"); @@ -880,7 +902,7 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) case EVENT_WLAN_EXTSCAN_FEATURE_STOP: case EVENT_WLAN_EXTSCAN_RESULTS_AVAILABLE: status = process_extscan_event(info, id, - diag_msg_hdr->payload, + payload, payloadlen); if (status != WIFI_SUCCESS) { ALOGE("Failed to process extscan event"); @@ -892,7 +914,7 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) case EVENT_WLAN_ROAM_CANDIDATE_FOUND: case EVENT_WLAN_ROAM_SCAN_CONFIG: status = process_roam_event(info, id, - diag_msg_hdr->payload, + payload, payloadlen); if (status != WIFI_SUCCESS) { ALOGE("Failed to process roam event"); @@ -901,7 +923,7 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) break; case EVENT_WLAN_ADD_BLOCK_ACK_SUCCESS: status = process_addba_success_event(info, - diag_msg_hdr->payload, + payload, payloadlen); if (status != WIFI_SUCCESS) { ALOGE("Failed to process addba success event"); @@ -910,7 +932,7 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) break; case EVENT_WLAN_ADD_BLOCK_ACK_FAILED: status = process_addba_failed_event(info, - diag_msg_hdr->payload, + payload, payloadlen); if (status != WIFI_SUCCESS) { ALOGE("Failed to process addba failed event"); @@ -919,7 +941,7 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) break; case EVENT_WLAN_BEACON_EVENT: status = process_beacon_received_event(info, - diag_msg_hdr->payload, + payload, payloadlen); if (status != WIFI_SUCCESS) { ALOGE("Failed to process beacon received event"); @@ -932,14 +954,25 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) } break; case WLAN_DIAG_TYPE_LOG: + case WLAN_DIAG_TYPE_LOG_V2: { - id = diag_msg_hdr->diag_id; - payloadlen = diag_msg_hdr->u.payload_len; - + if (WLAN_DIAG_TYPE_LOG == diag_msg_fixed_hdr->diag_event_type) { + diag_msg_hdr = (fw_diag_msg_hdr_t *)diag_msg_fixed_hdr; + id = diag_msg_hdr->diag_id; + payloadlen = diag_msg_hdr->u.payload_len; + hdr_size = sizeof(fw_diag_msg_hdr_t); + payload = diag_msg_hdr->payload; + } else { + diag_msg_hdr_v2 = (fw_diag_msg_hdr_v2_t *)diag_msg_fixed_hdr; + id = diag_msg_hdr_v2->diag_id; + payloadlen = diag_msg_hdr_v2->u.payload_len; + hdr_size = sizeof(fw_diag_msg_hdr_v2_t); + payload = diag_msg_hdr_v2->payload; + } switch (id) { case LOG_WLAN_EXTSCAN_CAPABILITIES: status = process_log_extscan_capabilities(info, - diag_msg_hdr->payload, + payload, payloadlen); if (status != WIFI_SUCCESS) { ALOGE("Failed to process extscan capabilities"); @@ -947,22 +980,46 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) } break; default: - return WIFI_SUCCESS; + break; } } break; case WLAN_DIAG_TYPE_MSG: - { + diag_msg_hdr = (fw_diag_msg_hdr_t *)diag_msg_fixed_hdr; + id = diag_msg_hdr->diag_id; /* Length field is only one byte for WLAN_DIAG_TYPE_MSG */ payloadlen = diag_msg_hdr->u.msg_hdr.payload_len; + hdr_size = sizeof(fw_diag_msg_hdr_t); + payload = diag_msg_hdr->payload; + process_firmware_prints(info, (u8 *)diag_msg_fixed_hdr, + payloadlen + hdr_size); + break; + case WLAN_DIAG_TYPE_MSG_V2: + diag_msg_hdr_v2 = (fw_diag_msg_hdr_v2_t *)diag_msg_fixed_hdr; + id = diag_msg_hdr_v2->diag_id; + /* Length field is only one byte for WLAN_DIAG_TYPE_MSG_V2 */ + payloadlen = diag_msg_hdr_v2->u.msg_hdr.payload_len; + hdr_size = sizeof(fw_diag_msg_hdr_v2_t); + payload = diag_msg_hdr_v2->payload; + process_firmware_prints(info, (u8 *)diag_msg_fixed_hdr, + payloadlen + hdr_size); + break; + case WLAN_DIAG_TYPE_CONFIG: + { + /* Base timestamp is part of this diag type */ + diag_msg_hdr = (fw_diag_msg_hdr_t *) diag_msg_fixed_hdr; + id = diag_msg_hdr->diag_id; + payload = diag_msg_hdr->payload; + payloadlen = diag_msg_hdr->u.payload_len; + hdr_size = sizeof(fw_diag_msg_hdr_t); process_firmware_prints(info, (u8 *)diag_msg_hdr, - payloadlen + sizeof(fw_diag_msg_hdr_t)); + payloadlen + hdr_size); } break; default: return WIFI_SUCCESS; } - count += payloadlen + sizeof(fw_diag_msg_hdr_t); + count += payloadlen + hdr_size; } return WIFI_SUCCESS; } @@ -1477,7 +1534,6 @@ static wifi_error parse_rx_stats(hal_info *info, u8 *buf, u16 size) static u16 get_tx_mcs(u8 series, struct tx_ppdu_start *ppdu_start) { - u16 tx_rate = 0; MCS mcs; struct series_bw *sbw = NULL; @@ -2137,7 +2193,6 @@ wifi_error diag_message_handler(hal_info *info, nl_msg *msg) } } else if (wnl->nlh.nlmsg_type == ANI_NL_MSG_CNSS_DIAG) { uint16_t diag_fw_type; - uint32_t event_id; buf = (uint8_t *)NLMSG_DATA(wnl); fw_event_hdr_t *event_hdr = @@ -2153,7 +2208,6 @@ wifi_error diag_message_handler(hal_info *info, nl_msg *msg) if (diag_fw_type == DIAG_TYPE_FW_MSG) { dbglog_slot *slot; u16 length = 0; - u32 version = 0; slot = (dbglog_slot *)buf; length = get_le32((u8 *)&slot->length); diff --git a/qcwcn/wifi_hal/wifilogger_diag.h b/qcwcn/wifi_hal/wifilogger_diag.h index 11f08c4..61740c9 100644 --- a/qcwcn/wifi_hal/wifilogger_diag.h +++ b/qcwcn/wifi_hal/wifilogger_diag.h @@ -78,18 +78,16 @@ enum wifilogger_host_diag_type { }; enum wlan_diag_frame_type { - WLAN_DIAG_TYPE_CONFIG, - WLAN_DIAG_TYPE_EVENT, /* Diag Events */ - WLAN_DIAG_TYPE_LOG, /* Diag Logs */ - WLAN_DIAG_TYPE_MSG, /* F3 messages */ - WLAN_DIAG_TYPE_LEGACY_MSG, + WLAN_DIAG_TYPE_CONFIG, + WLAN_DIAG_TYPE_EVENT, /* Diag Events */ + WLAN_DIAG_TYPE_LOG, /* Diag Logs */ + WLAN_DIAG_TYPE_MSG, /* F3 messages */ + WLAN_DIAG_TYPE_LEGACY_MSG, + WLAN_DIAG_TYPE_EVENT_V2, + WLAN_DIAG_TYPE_LOG_V2, + WLAN_DIAG_TYPE_MSG_V2, }; -static uint32_t get_le32(const uint8_t *pos) -{ - return pos[0] | (pos[1] << 8) | (pos[2] << 16) | (pos[3] << 24); -} - typedef struct event_remap { int q_event; int g_event; @@ -151,6 +149,12 @@ typedef struct fw_event_hdr_s typedef struct { + u32 reserved:24; + u32 diag_event_type:8; +}__attribute__((packed)) fw_diag_msg_fixed_hdr_t; + +typedef struct +{ u32 timestamp:24; u32 diag_event_type:8; /* Below 16-bit field has different formats based on event type */ @@ -166,6 +170,24 @@ typedef struct u8 payload[0]; }__attribute__((packed)) fw_diag_msg_hdr_t; +typedef struct +{ + u32 unused:24; + u32 diag_event_type:8; + u32 timestamp; + /* Below 16-bit field has different formats based on event type */ + union { + u16 payload_len; + struct { + u8 payload_len; + u8 vdev_level:3; + u8 vdev_id:5; + }__attribute__((packed)) msg_hdr; + }__attribute__((packed)) u; + u16 diag_id; + u8 payload[0]; +}__attribute__((packed)) fw_diag_msg_hdr_v2_t; + typedef struct wlan_wake_lock_event { u32 status; u32 reason; diff --git a/qcwcn/wifi_hal/wifiloggercmd.h b/qcwcn/wifi_hal/wifiloggercmd.h index 05954b4..bdeaec2 100644 --- a/qcwcn/wifi_hal/wifiloggercmd.h +++ b/qcwcn/wifi_hal/wifiloggercmd.h @@ -31,7 +31,6 @@ #include "common.h" #include "cpp_bindings.h" -#include "qca-vendor.h" #include "wifi_logger.h" #include "wifilogger_diag.h" #include "vendor_definitions.h" diff --git a/qcwcn/wpa_supplicant_8_lib/Android.mk b/qcwcn/wpa_supplicant_8_lib/Android.mk index 85d01ca..a573141 100644 --- a/qcwcn/wpa_supplicant_8_lib/Android.mk +++ b/qcwcn/wpa_supplicant_8_lib/Android.mk @@ -57,7 +57,7 @@ endif include $(CLEAR_VARS) LOCAL_MODULE := lib_driver_cmd_qcwcn LOCAL_SHARED_LIBRARIES := libc libcutils -LOCAL_CFLAGS := $(L_CFLAGS) +LOCAL_CFLAGS := $(L_CFLAGS) -Wall LOCAL_SRC_FILES := $(WPA_SRC_FILE) LOCAL_C_INCLUDES := $(WPA_SUPPL_DIR_INCLUDE) include $(BUILD_STATIC_LIBRARY) diff --git a/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c b/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c index a82b980..c5d1c93 100644 --- a/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c +++ b/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c @@ -26,6 +26,7 @@ #define WPA_PS_ENABLED 0 #define WPA_PS_DISABLED 1 +#define UNUSED(x) (void)(x) /* Return type for setBand*/ @@ -42,15 +43,6 @@ typedef struct android_wifi_priv_cmd { static int drv_errors = 0; -static void wpa_driver_send_hang_msg(struct wpa_driver_nl80211_data *drv) -{ - drv_errors++; - if (drv_errors > DRV_NUMBER_SEQUENTIAL_ERRORS) { - drv_errors = 0; - wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED"); - } -} - static void wpa_driver_notify_country_change(void *ctx, char *cmd) { if ((os_strncasecmp(cmd, "COUNTRY", 7) == 0) || @@ -134,7 +126,7 @@ int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf, } } else - wpa_printf(MSG_DEBUG, "%s %s len = %d, %lu", __func__, buf, ret, buf_len); + wpa_printf(MSG_DEBUG, "%s %s len = %d, %zu", __func__, buf, ret, buf_len); wpa_driver_notify_country_change(drv->ctx, cmd); } } @@ -153,6 +145,7 @@ int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration) int wpa_driver_get_p2p_noa(void *priv, u8 *buf, size_t len) { + UNUSED(priv), UNUSED(buf), UNUSED(len); /* Return 0 till we handle p2p_presence request completely in the driver */ return 0; } @@ -171,6 +164,6 @@ int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon, const struct wpabuf *proberesp, const struct wpabuf *assocresp) { - + UNUSED(priv), UNUSED(beacon), UNUSED(proberesp), UNUSED(assocresp); return 0; } |