wlan: Enhance EXTScan to Separate data between HDD and SME
This commit enhances EXTScan implementation to ensure SME does a
separate copy of HDD data.Also, this commit checks for this feature
capability before functioning and returns failure if not enabled.
Change-Id: I7f226e480c538fcfc4be0f5d7d9a084d1dbe5c89
CRs-Fixed: 689684
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index f7323f0..fe5b2de 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -2886,7 +2886,7 @@
struct wireless_dev *wdev,
void *data, int dataLen)
{
- tpSirGetEXTScanCapabilitiesReqParams pReqMsg = NULL;
+ tSirGetEXTScanCapabilitiesReqParams reqMsg;
struct net_device *dev = wdev->netdev;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
@@ -2902,6 +2902,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -2915,25 +2924,18 @@
return -EINVAL;
}
- pReqMsg = (tpSirGetEXTScanCapabilitiesReqParams)
- vos_mem_malloc(sizeof(*pReqMsg));
- if (!pReqMsg) {
- hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
- return -ENOMEM;
- }
- pReqMsg->requestId = nla_get_u32(
+ reqMsg.requestId = nla_get_u32(
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId);
- pReqMsg->sessionId = pAdapter->sessionId;
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId);
+ reqMsg.sessionId = pAdapter->sessionId;
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
- status = sme_EXTScanGetCapabilities(pHddCtx->hHal, pReqMsg);
+ status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg);
if (!HAL_STATUS_SUCCESS(status)) {
hddLog(VOS_TRACE_LEVEL_ERROR,
FL("sme_EXTScanGetCapabilities failed(err=%d)"), status);
- vos_mem_free(pReqMsg);
return -EINVAL;
}
@@ -2945,7 +2947,7 @@
struct wireless_dev *wdev,
void *data, int dataLen)
{
- tpSirEXTScanGetCachedResultsReqParams pReqMsg = NULL;
+ tSirEXTScanGetCachedResultsReqParams reqMsg;
struct net_device *dev = wdev->netdev;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
@@ -2960,6 +2962,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -2971,20 +2982,14 @@
hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed"));
return -EINVAL;
}
- pReqMsg = (tpSirEXTScanGetCachedResultsReqParams)
- vos_mem_malloc(sizeof(*pReqMsg));
- if (!pReqMsg) {
- hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
- return -ENOMEM;
- }
- pReqMsg->requestId = nla_get_u32(
+ reqMsg.requestId = nla_get_u32(
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId);
- pReqMsg->sessionId = pAdapter->sessionId;
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId);
+ reqMsg.sessionId = pAdapter->sessionId;
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
/* Parse and fetch flush parameter */
if (!tb
@@ -2993,22 +2998,20 @@
hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed"));
goto failed;
}
- pReqMsg->flush = nla_get_u8(
+ reqMsg.flush = nla_get_u8(
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]);
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), pReqMsg->flush);
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush);
- status = sme_getCachedResults(pHddCtx->hHal, pReqMsg);
+ status = sme_getCachedResults(pHddCtx->hHal, &reqMsg);
if (!HAL_STATUS_SUCCESS(status)) {
hddLog(VOS_TRACE_LEVEL_ERROR,
FL("sme_getCachedResults failed(err=%d)"), status);
- vos_mem_free(pReqMsg);
return -EINVAL;
}
return 0;
failed:
- vos_mem_free(pReqMsg);
return -EINVAL;
}
@@ -3036,6 +3039,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -3048,7 +3060,6 @@
hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed"));
return -EINVAL;
}
-
pReqMsg = (tpSirEXTScanSetBssidHotListReqParams)
vos_mem_malloc(sizeof(*pReqMsg));
if (!pReqMsg) {
@@ -3056,6 +3067,7 @@
return -ENOMEM;
}
+
pReqMsg->requestId = nla_get_u32(
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
@@ -3130,6 +3142,8 @@
return -EINVAL;
}
+ vos_mem_free(pReqMsg);
+
return 0;
fail:
@@ -3161,6 +3175,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -3173,14 +3196,15 @@
hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed"));
return -EINVAL;
}
-
pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams)
- vos_mem_malloc(sizeof(*pReqMsg));
+ vos_mem_malloc(sizeof(*pReqMsg));
if (!pReqMsg) {
- hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
- return -ENOMEM;
+ hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
+ return -ENOMEM;
}
+
+
pReqMsg->requestId = nla_get_u32(
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
@@ -3285,7 +3309,7 @@
vos_mem_free(pReqMsg);
return -EINVAL;
}
-
+ vos_mem_free(pReqMsg);
hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting"));
return 0;
@@ -3316,6 +3340,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -3381,7 +3414,7 @@
struct wireless_dev *wdev,
void *data, int dataLen)
{
- tpSirEXTScanStartReqParams pReqMsg = NULL;
+ tpSirEXTScanStartReqParams pReqMsg = NULL;
struct net_device *dev = wdev->netdev;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
@@ -3403,6 +3436,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -3416,10 +3458,11 @@
return -EINVAL;
}
- pReqMsg = (tpSirEXTScanStartReqParams) vos_mem_malloc(sizeof(*pReqMsg));
+ pReqMsg = (tpSirEXTScanStartReqParams)
+ vos_mem_malloc(sizeof(*pReqMsg));
if (!pReqMsg) {
- hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
- return -ENOMEM;
+ hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
+ return -ENOMEM;
}
pReqMsg->requestId = nla_get_u32(
@@ -3595,6 +3638,7 @@
return -EINVAL;
}
+ vos_mem_free(pReqMsg);
return 0;
fail:
@@ -3606,7 +3650,7 @@
struct wireless_dev *wdev,
void *data, int dataLen)
{
- tpSirEXTScanStopReqParams pReqMsg = NULL;
+ tSirEXTScanStopReqParams reqMsg;
struct net_device *dev = wdev->netdev;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
@@ -3620,6 +3664,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -3633,24 +3686,17 @@
return -EINVAL;
}
- pReqMsg = (tpSirEXTScanStopReqParams) vos_mem_malloc(sizeof(*pReqMsg));
- if (!pReqMsg) {
- hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
- return -ENOMEM;
- }
-
- pReqMsg->requestId = nla_get_u32(
+ reqMsg.requestId = nla_get_u32(
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId);
- pReqMsg->sessionId = pAdapter->sessionId;
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId);
+ reqMsg.sessionId = pAdapter->sessionId;
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
- status = sme_EXTScanStop(pHddCtx->hHal, pReqMsg);
+ status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg);
if (!HAL_STATUS_SUCCESS(status)) {
hddLog(VOS_TRACE_LEVEL_ERROR,
FL("sme_EXTScanStop failed(err=%d)"), status);
- vos_mem_free(pReqMsg);
return -EINVAL;
}
@@ -3661,7 +3707,7 @@
struct wireless_dev *wdev,
void *data, int dataLen)
{
- tpSirEXTScanResetBssidHotlistReqParams pReqMsg = NULL;
+ tSirEXTScanResetBssidHotlistReqParams reqMsg;
struct net_device *dev = wdev->netdev;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
@@ -3675,6 +3721,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -3688,25 +3743,17 @@
return -EINVAL;
}
- pReqMsg = (tpSirEXTScanResetBssidHotlistReqParams)
- vos_mem_malloc(sizeof(*pReqMsg));
- if (!pReqMsg) {
- hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
- return -ENOMEM;
- }
-
- pReqMsg->requestId = nla_get_u32(
+ reqMsg.requestId = nla_get_u32(
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId);
- pReqMsg->sessionId = pAdapter->sessionId;
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId);
+ reqMsg.sessionId = pAdapter->sessionId;
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
- status = sme_ResetBssHotlist(pHddCtx->hHal, pReqMsg);
+ status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg);
if (!HAL_STATUS_SUCCESS(status)) {
hddLog(VOS_TRACE_LEVEL_ERROR,
FL("sme_ResetBssHotlist failed(err=%d)"), status);
- vos_mem_free(pReqMsg);
return -EINVAL;
}
@@ -3718,7 +3765,7 @@
struct wireless_dev *wdev,
void *data, int dataLen)
{
- tpSirEXTScanResetSignificantChangeReqParams pReqMsg = NULL;
+ tSirEXTScanResetSignificantChangeReqParams reqMsg;
struct net_device *dev = wdev->netdev;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
@@ -3733,6 +3780,15 @@
FL("HDD context is not valid"));
return -EINVAL;
}
+ /* check the EXTScan Capability */
+ if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) ||
+ (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)))
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ FL("EXTScan not enabled/supported by Firmware"));
+ return -EINVAL;
+ }
+
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, dataLen,
wlan_hdd_extscan_config_policy)) {
@@ -3746,25 +3802,18 @@
return -EINVAL;
}
- pReqMsg = (tpSirEXTScanResetSignificantChangeReqParams)
- vos_mem_malloc(sizeof(*pReqMsg));
- if (!pReqMsg) {
- hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed"));
- return -ENOMEM;
- }
- pReqMsg->requestId = nla_get_u32(
+ reqMsg.requestId = nla_get_u32(
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId);
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId);
- pReqMsg->sessionId = pAdapter->sessionId;
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId);
+ reqMsg.sessionId = pAdapter->sessionId;
+ hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId);
- status = sme_ResetSignificantChange(pHddCtx->hHal, pReqMsg);
+ status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg);
if (!HAL_STATUS_SUCCESS(status)) {
hddLog(VOS_TRACE_LEVEL_ERROR,
FL("sme_ResetSignificantChange failed(err=%d)"), status);
- vos_mem_free(pReqMsg);
return -EINVAL;
}