qcacld-3.0: Refine the extscan get capabilities logic

Make the following updates to the extscan get capabilities logic:
1) Exclusively use the Unified WMI data structures.
2) Update the HDD<=>SME interface to enforce the contract that SME
   must not make any assumptions about the buffers provided by HDD.

Change-Id: I9e57c86a3da0924af01d82d626b61c28f7d520bf
CRs-Fixed: 2330211
This commit is contained in:
Jeff Johnson
2018-07-18 12:18:03 -07:00
committed by nshrivas
vanhempi e9c491b749
commit fed9a730dd
7 muutettua tiedostoa jossa 75 lisäystä ja 88 poistoa

Näytä tiedosto

@@ -1614,19 +1614,19 @@ nla_put_failure:
*
* Return: none
*/
static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
static int
__wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
int ret;
int id, ret;
unsigned long rc;
struct hdd_ext_scan_context *context;
tpSirGetExtScanCapabilitiesReqParams pReqMsg = NULL;
struct extscan_capabilities_params params;
struct net_device *dev = wdev->netdev;
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX +
1];
struct nlattr *tb[EXTSCAN_PARAM_MAX + 1];
QDF_STATUS status;
hdd_enter_dev(dev);
@@ -1649,43 +1649,34 @@ static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
hdd_err("extscan not supported");
return -ENOTSUPP;
}
if (wlan_cfg80211_nla_parse(tb,
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, data_len, wlan_hdd_extscan_config_policy)) {
if (wlan_cfg80211_nla_parse(tb, EXTSCAN_PARAM_MAX, data, data_len,
wlan_hdd_extscan_config_policy)) {
hdd_err("Invalid ATTR");
return -EINVAL;
}
pReqMsg = qdf_mem_malloc(sizeof(*pReqMsg));
if (!pReqMsg) {
hdd_err("qdf_mem_malloc failed");
return -ENOMEM;
}
/* Parse and fetch request Id */
if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) {
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID;
if (!tb[id]) {
hdd_err("attr request id failed");
goto fail;
return -EINVAL;
}
pReqMsg->requestId =
nla_get_u32(tb
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
pReqMsg->sessionId = adapter->session_id;
hdd_debug("Req Id %d Session Id %d",
pReqMsg->requestId, pReqMsg->sessionId);
params.request_id = nla_get_u32(tb[id]);
params.vdev_id = adapter->session_id;
hdd_debug("Req Id %d Vdev Id %d", params.request_id, params.vdev_id);
context = &ext_scan_context;
spin_lock(&context->context_lock);
context->request_id = pReqMsg->requestId;
context->request_id = params.request_id;
INIT_COMPLETION(context->response_event);
spin_unlock(&context->context_lock);
status = sme_ext_scan_get_capabilities(hdd_ctx->mac_handle, pReqMsg);
status = sme_ext_scan_get_capabilities(hdd_ctx->mac_handle, &params);
if (!QDF_IS_STATUS_SUCCESS(status)) {
hdd_err("sme_ext_scan_get_capabilities failed(err=%d)",
status);
goto fail;
return -EINVAL;
}
rc = wait_for_completion_timeout(&context->response_event,
@@ -1700,9 +1691,6 @@ static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
hdd_err("Failed to send ext scan capability to user space");
hdd_exit();
return ret;
fail:
qdf_mem_free(pReqMsg);
return -EINVAL;
}
/**

Näytä tiedosto

@@ -3882,11 +3882,6 @@ enum extscan_configuration_flags {
EXTSCAN_LP_EXTENDED_BATCHING = 0x00000001,
};
typedef struct {
uint32_t requestId;
uint8_t sessionId;
} tSirGetExtScanCapabilitiesReqParams, *tpSirGetExtScanCapabilitiesReqParams;
/**
* struct ext_scan_capabilities_response - extscan capabilities response data
* @requestId: request identifier

Näytä tiedosto

@@ -1001,8 +1001,18 @@ uint8_t sme_get_dfs_scan_mode(tHalHandle hHal);
QDF_STATUS sme_get_valid_channels_by_band(tHalHandle hHal, uint8_t wifiBand,
uint32_t *aValidChannels,
uint8_t *pNumChannels);
QDF_STATUS sme_ext_scan_get_capabilities(tHalHandle hHal,
tSirGetExtScanCapabilitiesReqParams *pReq);
/**
* sme_ext_scan_get_capabilities() - SME API to fetch extscan capabilities
* @mac_handle: Opaque handle to the MAC context
* @params: extscan capabilities request structure
*
* Return: QDF_STATUS
*/
QDF_STATUS
sme_ext_scan_get_capabilities(mac_handle_t mac_handle,
struct extscan_capabilities_params *params);
QDF_STATUS sme_ext_scan_start(tHalHandle hHal,
tSirWifiScanCmdReqParams *pStartCmd);
QDF_STATUS sme_ext_scan_stop(tHalHandle hHal,

Näytä tiedosto

@@ -11173,38 +11173,38 @@ QDF_STATUS sme_get_valid_channels_by_band(tHalHandle hHal,
return status;
}
/*
* sme_ext_scan_get_capabilities() -
* SME API to fetch extscan capabilities
*
* hHal
* pReq: extscan capabilities structure
* Return QDF_STATUS
*/
QDF_STATUS sme_ext_scan_get_capabilities(tHalHandle hHal,
tSirGetExtScanCapabilitiesReqParams *
pReq)
QDF_STATUS
sme_ext_scan_get_capabilities(mac_handle_t mac_handle,
struct extscan_capabilities_params *params)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
QDF_STATUS status;
tpAniSirGlobal mac = MAC_CONTEXT(mac_handle);
struct scheduler_msg message = {0};
struct extscan_capabilities_params *bodyptr;
status = sme_acquire_global_lock(&pMac->sme);
/* per contract must make a copy of the params when messaging */
bodyptr = qdf_mem_malloc(sizeof(*bodyptr));
if (!bodyptr)
return QDF_STATUS_E_NOMEM;
*bodyptr = *params;
status = sme_acquire_global_lock(&mac->sme);
if (QDF_IS_STATUS_SUCCESS(status)) {
/* Serialize the req through MC thread */
message.bodyptr = pReq;
message.bodyptr = bodyptr;
message.type = WMA_EXTSCAN_GET_CAPABILITIES_REQ;
MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG,
NO_SESSION, message.type));
qdf_status = scheduler_post_message(QDF_MODULE_ID_SME,
QDF_MODULE_ID_WMA,
QDF_MODULE_ID_WMA,
&message);
if (!QDF_IS_STATUS_SUCCESS(qdf_status))
status = QDF_STATUS_E_FAILURE;
qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG,
NO_SESSION, message.type);
status = scheduler_post_message(QDF_MODULE_ID_SME,
QDF_MODULE_ID_WMA,
QDF_MODULE_ID_WMA,
&message);
sme_release_global_lock(&mac->sme);
}
sme_release_global_lock(&pMac->sme);
if (QDF_IS_STATUS_ERROR(status)) {
sme_err("failure: %d", status);
qdf_mem_free(bodyptr);
}
return status;
}

Näytä tiedosto

@@ -425,9 +425,19 @@ QDF_STATUS
wma_extscan_get_cached_results(tp_wma_handle wma,
struct extscan_cached_result_params *params);
QDF_STATUS wma_extscan_get_capabilities(tp_wma_handle wma,
tSirGetExtScanCapabilitiesReqParams *
pgetcapab);
/**
* wma_extscan_get_capabilities() - extscan get capabilities
* @wma: wma handle
* @params: get capabilities params
*
* This function sends request to fw to get extscan capabilities.
*
* Return: QDF status
*/
QDF_STATUS
wma_extscan_get_capabilities(tp_wma_handle wma,
struct extscan_capabilities_params *params);
QDF_STATUS wma_set_epno_network_list(tp_wma_handle wma,
struct wifi_epno_params *req);

Näytä tiedosto

@@ -8243,8 +8243,7 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
qdf_mem_free(msg->bodyptr);
break;
case WMA_EXTSCAN_GET_CAPABILITIES_REQ:
wma_extscan_get_capabilities(wma_handle,
(tSirGetExtScanCapabilitiesReqParams *) msg->bodyptr);
wma_extscan_get_capabilities(wma_handle, msg->bodyptr);
qdf_mem_free(msg->bodyptr);
break;
case WMA_SET_EPNO_LIST_REQ:

Näytä tiedosto

@@ -4769,36 +4769,21 @@ wma_extscan_get_cached_results(tp_wma_handle wma,
params);
}
/**
* wma_extscan_get_capabilities() - extscan get capabilities
* @wma: wma handle
* @pgetcapab: get capabilities params
*
* This function send request to fw to get extscan capabilities.
*
* Return: QDF status
*/
QDF_STATUS wma_extscan_get_capabilities(tp_wma_handle wma,
tSirGetExtScanCapabilitiesReqParams *
pgetcapab)
QDF_STATUS
wma_extscan_get_capabilities(tp_wma_handle wma,
struct extscan_capabilities_params *params)
{
struct extscan_capabilities_params params = {0};
if (!wma || !wma->wmi_handle) {
WMA_LOGE("%s: WMA is closed, can not issue cmd", __func__);
WMA_LOGE("%s: WMA is closed, can not issue cmd", __func__);
return QDF_STATUS_E_INVAL;
}
if (!wmi_service_enabled(wma->wmi_handle,
wmi_service_extscan)) {
if (!wmi_service_enabled(wma->wmi_handle, wmi_service_extscan)) {
WMA_LOGE("%s: extscan not enabled", __func__);
return QDF_STATUS_E_FAILURE;
}
params.request_id = pgetcapab->requestId;
params.vdev_id = pgetcapab->sessionId;
return wmi_unified_extscan_get_capabilities_cmd(wma->wmi_handle,
&params);
params);
}
/** wma_set_epno_network_list() - set epno network list