diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2014-10-10 17:56:12 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-10-10 17:56:12 -0700 |
commit | 6f642747421d41d3e19322dc60f662af9be5be66 (patch) | |
tree | 936d1cd4aeab1b3ec151aa39755c284081c0521d | |
parent | adcce3be6ee2b9472f9e1689d8dee84ddaec0491 (diff) | |
parent | 34c50d4a96b3f0df2e2d49f7f38f964f5cfec3d2 (diff) | |
download | android_hardware_qcom_wlan-6f642747421d41d3e19322dc60f662af9be5be66.tar.gz android_hardware_qcom_wlan-6f642747421d41d3e19322dc60f662af9be5be66.tar.bz2 android_hardware_qcom_wlan-6f642747421d41d3e19322dc60f662af9be5be66.zip |
Merge "Wi-Fi HAL: implement HAL part to support wifi_get_concurrency_matrix()"
-rw-r--r-- | qcwcn/wifi_hal/ifaceeventhandler.cpp | 79 | ||||
-rw-r--r-- | qcwcn/wifi_hal/ifaceeventhandler.h | 16 | ||||
-rw-r--r-- | qcwcn/wifi_hal/vendor_definitions.h | 22 | ||||
-rw-r--r-- | qcwcn/wifi_hal/wifi_hal.cpp | 68 |
4 files changed, 168 insertions, 17 deletions
diff --git a/qcwcn/wifi_hal/ifaceeventhandler.cpp b/qcwcn/wifi_hal/ifaceeventhandler.cpp index e77a0c9..3556450 100644 --- a/qcwcn/wifi_hal/ifaceeventhandler.cpp +++ b/qcwcn/wifi_hal/ifaceeventhandler.cpp @@ -196,29 +196,32 @@ int wifiEventHandler::handleEvent(WifiEvent &event) return NL_SKIP; } -SupportedFeatures::SupportedFeatures(wifi_handle handle, int id, u32 vendor_id, +WifihalGeneric::WifihalGeneric(wifi_handle handle, int id, u32 vendor_id, u32 subcmd) : WifiVendorCommand(handle, id, vendor_id, subcmd) { - ALOGD("SupportedFeatures %p constructed", this); + ALOGD("WifihalGeneric %p constructed", this); /* Initialize the member data variables here */ mSet = 0; + mSetSizeMax = 0; + mSetSizePtr = NULL; + mConcurrencySet = 0; } -SupportedFeatures::~SupportedFeatures() +WifihalGeneric::~WifihalGeneric() { - ALOGD("SupportedFeatures %p destructor", this); + ALOGD("WifihalGeneric %p destructor", this); } -int SupportedFeatures::requestResponse() +int WifihalGeneric::requestResponse() { return WifiCommand::requestResponse(mMsg); } -int SupportedFeatures::handleResponse(WifiEvent &reply) +int WifihalGeneric::handleResponse(WifiEvent &reply) { - ALOGI("Got a SupportedFeatures message from Driver"); - unsigned i=0; + ALOGI("Got a Wi-Fi HAL module message from Driver"); + int i = 0; u32 status; WifiVendorCommand::handleResponse(reply); @@ -242,13 +245,69 @@ int SupportedFeatures::handleResponse(WifiEvent &reply) break; } + case QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX: + { + struct nlattr *tb_vendor[ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; + nla_parse(tb_vendor, + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, + (struct nlattr *)mVendorData,mDataLen, NULL); + + if (tb_vendor[ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE]) { + u32 val; + val = nla_get_u32( + tb_vendor[ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE]); + + ALOGD("%s: Num of concurrency combinations: %d", + __func__, val); + val = val > (unsigned int)mSetSizeMax ? + (unsigned int)mSetSizeMax : val; + *mSetSizePtr = val; + + /* Extract the list of channels. */ + if (*mSetSizePtr > 0 && + tb_vendor[ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET]) { + nla_memcpy(mConcurrencySet, + tb_vendor[ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET], + sizeof(feature_set) * (*mSetSizePtr)); + } + + ALOGD("%s: Get concurrency matrix response received.", + __func__); + ALOGD("%s: Num of concurrency combinations : %d", + __func__, *mSetSizePtr); + ALOGD("%s: List of valid concurrency combinations is: ", + __func__); + for(i = 0; i < *mSetSizePtr; i++) + { + ALOGD("%x", *(mConcurrencySet + i)); + } + } + } + break; default : - ALOGE("%s: Wrong Supported stats subcmd received %d", __func__, mSubcmd); + ALOGE("%s: Wrong Wi-Fi HAL event received %d", __func__, mSubcmd); } return NL_SKIP; } -void SupportedFeatures::getResponseparams(feature_set *pset) +void WifihalGeneric::getResponseparams(feature_set *pset) { *pset = mSet; } + +void WifihalGeneric::setMaxSetSize(int set_size_max) { + mSetSizeMax = set_size_max; +} + +void WifihalGeneric::setConcurrencySet(feature_set set[]) { + mConcurrencySet = set; +} + +void WifihalGeneric::setSizePtr(int *set_size) { + mSetSizePtr = set_size; +} diff --git a/qcwcn/wifi_hal/ifaceeventhandler.h b/qcwcn/wifi_hal/ifaceeventhandler.h index 851447e..e30966b 100644 --- a/qcwcn/wifi_hal/ifaceeventhandler.h +++ b/qcwcn/wifi_hal/ifaceeventhandler.h @@ -40,6 +40,7 @@ #endif #include "qca-vendor.h" #include "vendor_definitions.h" +#include "wifi_hal.h" #ifdef __cplusplus extern "C" @@ -79,15 +80,24 @@ public: virtual int get_request_id(); }; -class SupportedFeatures: public WifiVendorCommand +class WifihalGeneric: public WifiVendorCommand { +private: + wifi_interface_handle mHandle; feature_set mSet; + int mSetSizeMax; + int *mSetSizePtr; + feature_set *mConcurrencySet; + public: - SupportedFeatures(wifi_handle handle, int id, u32 vendor_id, u32 subcmd); - virtual ~SupportedFeatures(); + WifihalGeneric(wifi_handle handle, int id, u32 vendor_id, u32 subcmd); + virtual ~WifihalGeneric(); virtual int requestResponse(); virtual int handleResponse(WifiEvent &reply); virtual void getResponseparams(feature_set *pset); + virtual void setMaxSetSize(int set_size_max); + virtual void setSizePtr(int *set_size); + virtual void setConcurrencySet(feature_set set[]); }; #ifdef __cplusplus } diff --git a/qcwcn/wifi_hal/vendor_definitions.h b/qcwcn/wifi_hal/vendor_definitions.h index 889f017..8f9aef7 100644 --- a/qcwcn/wifi_hal/vendor_definitions.h +++ b/qcwcn/wifi_hal/vendor_definitions.h @@ -62,6 +62,8 @@ enum vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG = 40, /* Indicates BSSID Hotlist AP lost. */ QCA_NL80211_VENDOR_SUBCMD_GSCAN_HOTLIST_AP_LOST = 41, + /* Get Concurrency Matrix */ + QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX = 42, }; enum qca_wlan_vendor_attr_ll_stats_set @@ -724,4 +726,24 @@ enum qca_wlan_vendor_attr_set_no_dfs_flag QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_AFTER_LAST - 1, }; +/* NL attributes for data used by + * QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX sub command. + */ +enum qca_wlan_vendor_attr_get_concurrency_matrix +{ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_INVALID = 0, + /* Unsigned 32-bit value */ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX = 1, + /* Unsigned 32-bit value */ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE = 2, + /* An array of SET_SIZE x Unsigned 32bit values representing + * concurrency combinations. + */ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET = 3, + /* keep last */ + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX = + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_AFTER_LAST - 1, +}; + #endif diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp index 25246e6..f1bf78c 100644 --- a/qcwcn/wifi_hal/wifi_hal.cpp +++ b/qcwcn/wifi_hal/wifi_hal.cpp @@ -164,7 +164,7 @@ static wifi_error acquire_supported_features(wifi_interface_handle iface, wifi_handle handle = getWifiHandle(iface); *set = 0; - SupportedFeatures supportedFeatures(handle, 0, + WifihalGeneric supportedFeatures(handle, 0, OUI_QCA, QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES); @@ -670,13 +670,73 @@ wifi_error wifi_get_supported_feature_set(wifi_interface_handle iface, } return WIFI_SUCCESS; } -///////////////////////////////////////////////////////////////////////////// wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, - int max_size, feature_set *matrix, int *size) { - return WIFI_ERROR_NOT_SUPPORTED; + int set_size_max, + feature_set set[], int *set_size) +{ + int ret = 0; + struct nlattr *nlData; + WifihalGeneric *vCommand = NULL; + interface_info *ifaceInfo = getIfaceInfo(handle); + wifi_handle wifiHandle = getWifiHandle(handle); + + if (set == NULL) { + ALOGE("%s: NULL set pointer provided. Exit.", + __func__); + return WIFI_ERROR_INVALID_ARGS; + } + + vCommand = new WifihalGeneric(wifiHandle, 0, + OUI_QCA, + QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX); + if (vCommand == NULL) { + ALOGE("%s: Error vCommand NULL", __func__); + return WIFI_ERROR_OUT_OF_MEMORY; + } + + /* Create the message */ + ret = vCommand->create(); + if (ret < 0) + goto cleanup; + + ret = vCommand->set_iface_id(ifaceInfo->name); + if (ret < 0) + goto cleanup; + + /* Add the vendor specific attributes for the NL command. */ + nlData = vCommand->attr_start(NL80211_ATTR_VENDOR_DATA); + if (!nlData) + goto cleanup; + + if (vCommand->put_u32( + QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX, + set_size_max)) + { + goto cleanup; + } + vCommand->attr_end(nlData); + + /* Populate the input received from caller/framework. */ + vCommand->setMaxSetSize(set_size_max); + vCommand->setSizePtr(set_size); + vCommand->setConcurrencySet(set); + + ret = vCommand->requestResponse(); + if (ret) { + ALOGE("%s: requestResponse() error: %d", __func__, ret); + } + +cleanup: + ALOGI("%s: Delete object.", __func__); + delete vCommand; + if (ret) { + *set_size = 0; + } + return (wifi_error)ret; } + wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs) { int ret = 0; |