diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 04b9e17635..e41a9fb43b 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -1504,7 +1504,7 @@ hdd_parse_set_roam_scan_channels(struct hdd_adapter *adapter, const char *comman * Return: 0 for success non-zero for failure */ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, - struct plm_req *req) + struct plm_req_params *req) { uint8_t *in_ptr = NULL; int count, content = 0, ret = 0; @@ -1598,8 +1598,8 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, if (content < 0) return QDF_STATUS_E_FAILURE; - req->numBursts = content; - hdd_debug("num burst %d", req->numBursts); + req->num_bursts = content; + hdd_debug("num bursts %d", req->num_bursts); in_ptr = strpbrk(in_ptr, " "); if (NULL == in_ptr) @@ -1621,8 +1621,8 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, if (content <= 0) return QDF_STATUS_E_FAILURE; - req->burstInt = content; - hdd_debug("burst Int %d", req->burstInt); + req->burst_int = content; + hdd_debug("burst int %d", req->burst_int); in_ptr = strpbrk(in_ptr, " "); if (NULL == in_ptr) @@ -1644,8 +1644,8 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, if (content <= 0) return QDF_STATUS_E_FAILURE; - req->measDuration = content; - hdd_debug("measDur %d", req->measDuration); + req->meas_duration = content; + hdd_debug("meas duration %d", req->meas_duration); in_ptr = strpbrk(in_ptr, " "); if (NULL == in_ptr) @@ -1667,8 +1667,8 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, if (content <= 0) return QDF_STATUS_E_FAILURE; - req->burstLen = content; - hdd_debug("burstLen %d", req->burstLen); + req->burst_len = content; + hdd_debug("burst len %d", req->burst_len); in_ptr = strpbrk(in_ptr, " "); if (NULL == in_ptr) @@ -1690,9 +1690,8 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, if (content <= 0) return QDF_STATUS_E_FAILURE; - req->desiredTxPwr = content; - hdd_debug("desiredTxPwr %d", - req->desiredTxPwr); + req->desired_tx_pwr = content; + hdd_debug("desired tx pwr %d", req->desired_tx_pwr); for (count = 0; count < QDF_MAC_ADDR_SIZE; count++) { in_ptr = strpbrk(in_ptr, " "); @@ -1716,8 +1715,8 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, req->mac_addr.bytes[count] = content; } - hdd_debug("MC addr " MAC_ADDRESS_STR, - MAC_ADDR_ARRAY(req->mac_addr.bytes)); + hdd_debug("MAC addr " MAC_ADDRESS_STR, + MAC_ADDR_ARRAY(req->mac_addr.bytes)); in_ptr = strpbrk(in_ptr, " "); @@ -1741,11 +1740,11 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, return QDF_STATUS_E_FAILURE; content = QDF_MIN(content, CFG_VALID_CHANNEL_LIST_LEN); - req->plmNumCh = content; - hdd_debug("numch: %d", req->plmNumCh); + req->plm_num_ch = content; + hdd_debug("num ch: %d", req->plm_num_ch); /* Channel numbers */ - for (count = 0; count < req->plmNumCh; count++) { + for (count = 0; count < req->plm_num_ch; count++) { in_ptr = strpbrk(in_ptr, " "); if (NULL == in_ptr) @@ -1765,8 +1764,8 @@ static QDF_STATUS hdd_parse_plm_cmd(uint8_t *command, content > WNI_CFG_CURRENT_CHANNEL_STAMAX) return QDF_STATUS_E_FAILURE; - req->plmChList[count] = content; - hdd_debug(" ch- %d", req->plmChList[count]); + req->plm_ch_list[count] = content; + hdd_debug(" ch- %d", req->plm_ch_list[count]); } } /* If PLM START */ @@ -5579,11 +5578,11 @@ exit: /** * drv_cmd_ccx_plm_req() - Set ESE PLM request - * @adapter: Pointer to the HDD adapter - * @hdd_ctx: Pointer to the HDD context - * @command: Driver command string + * @adapter: Pointer to the HDD adapter + * @hdd_ctx: Pointer to the HDD context + * @command: Driver command string * @command_len: Driver command string length - * @priv_data: Private data coming with the driver command. Unused here + * @priv_data: Private data coming with the driver command. Unused here * * This function handles driver command that sets the ESE PLM request * @@ -5595,36 +5594,21 @@ static int drv_cmd_ccx_plm_req(struct hdd_adapter *adapter, uint8_t command_len, struct hdd_priv_data *priv_data) { - int ret = 0; - uint8_t *value = command; - QDF_STATUS status = QDF_STATUS_SUCCESS; - struct plm_req *req = NULL; + QDF_STATUS status; + struct plm_req_params *req; - req = qdf_mem_malloc(sizeof(struct plm_req)); - if (NULL == req) { - ret = -ENOMEM; - goto exit; + req = qdf_mem_malloc(sizeof(*req)); + if (!req) + return -ENOMEM; + + status = hdd_parse_plm_cmd(command, req); + if (QDF_IS_STATUS_SUCCESS(status)) { + req->vdev_id = adapter->vdev_id; + status = sme_set_plm_request(hdd_ctx->mac_handle, req); } + qdf_mem_free(req); - status = hdd_parse_plm_cmd(value, req); - if (QDF_STATUS_SUCCESS != status) { - qdf_mem_free(req); - req = NULL; - ret = -EINVAL; - goto exit; - } - req->sessionId = adapter->vdev_id; - - status = sme_set_plm_request(hdd_ctx->mac_handle, req); - if (QDF_STATUS_SUCCESS != status) { - qdf_mem_free(req); - req = NULL; - ret = -EINVAL; - goto exit; - } - -exit: - return ret; + return qdf_status_to_os_return(status); } /** diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 165759a726..d65acd4017 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -869,24 +869,6 @@ typedef struct sEsePEContext { tEseTSMContext tsm; } tEsePEContext, *tpEsePEContext; -struct plm_req { - uint16_t diag_token; /* Dialog token */ - uint16_t meas_token; /* measurement token */ - uint16_t numBursts; /* total number of bursts */ - uint16_t burstInt; /* burst interval in seconds */ - uint16_t measDuration; /* in TU's,STA goes off-ch */ - /* no of times the STA should cycle through PLM ch list */ - uint8_t burstLen; - int8_t desiredTxPwr; /* desired tx power */ - struct qdf_mac_addr mac_addr; /* MC dest addr */ - /* no of channels */ - uint8_t plmNumCh; - /* channel numbers */ - uint8_t plmChList[CFG_VALID_CHANNEL_LIST_LEN]; - uint8_t sessionId; - bool enable; -}; - #endif /* FEATURE_WLAN_ESE */ /* / Definition for join request */ diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 574865d51b..a824dda377 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -627,8 +627,10 @@ QDF_STATUS sme_set_ese_beacon_request(mac_handle_t mac_handle, * * Return: QDF_STATUS enumeration */ -QDF_STATUS sme_set_plm_request(mac_handle_t mac_handle, struct plm_req *req); +QDF_STATUS sme_set_plm_request(mac_handle_t mac_handle, + struct plm_req_params *req); #endif /*FEATURE_WLAN_ESE */ + QDF_STATUS sme_get_modify_profile_fields(mac_handle_t mac_handle, uint8_t sessionId, tCsrRoamModifyProfileFields * diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 6efbb17d85..9c38746e13 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -1450,7 +1450,8 @@ QDF_STATUS sme_update_is_ese_feature_enabled(mac_handle_t mac_handle, return QDF_STATUS_SUCCESS; } -QDF_STATUS sme_set_plm_request(mac_handle_t mac_handle, struct plm_req *req) +QDF_STATUS sme_set_plm_request(mac_handle_t mac_handle, + struct plm_req_params *req) { QDF_STATUS status; bool ret = false; @@ -1458,71 +1459,80 @@ QDF_STATUS sme_set_plm_request(mac_handle_t mac_handle, struct plm_req *req) uint8_t ch_list[CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; uint8_t count, valid_count = 0; struct scheduler_msg msg = {0}; - struct csr_roam_session *pSession = CSR_GET_SESSION(mac, - req->sessionId); + struct csr_roam_session *session; + struct plm_req_params *body; status = sme_acquire_global_lock(&mac->sme); if (!QDF_IS_STATUS_SUCCESS(status)) return status; - if (!pSession) { - sme_err("session %d not found", req->sessionId); + session = CSR_GET_SESSION(mac, req->vdev_id); + if (!session) { + sme_err("session %d not found", req->vdev_id); sme_release_global_lock(&mac->sme); return QDF_STATUS_E_FAILURE; } - if (!pSession->sessionActive) { + if (!session->sessionActive) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, FL("Invalid Sessionid")); sme_release_global_lock(&mac->sme); return QDF_STATUS_E_FAILURE; } - if (!req->enable) + /* per contract must make a copy of the params when messaging */ + body = qdf_mem_malloc(sizeof(*body)); + if (!req) + return QDF_STATUS_E_NOMEM; + *body = *req; + + if (!body->enable) goto send_plm_start; /* validating channel numbers */ - for (count = 0; count < req->plmNumCh; count++) { - ret = csr_is_supported_channel(mac, req->plmChList[count]); - if (ret && req->plmChList[count] > 14) { - if (CHANNEL_STATE_DFS == wlan_reg_get_channel_state( - mac->pdev, - req->plmChList[count])) { + for (count = 0; count < body->plm_num_ch; count++) { + uint8_t ch = body->plm_ch_list[count]; + + ret = csr_is_supported_channel(mac, ch); + if (!ret) { + /* Not supported, ignore the channel */ + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, + FL("Unsupported channel %d ignored for PLM"), + ch); + continue; + } + + if (ch > 14) { + enum channel_state state = + wlan_reg_get_channel_state(mac->pdev, ch); + + if (state == CHANNEL_STATE_DFS) { /* DFS channel is provided, no PLM bursts can be * transmitted. Ignoring these channels. */ QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, FL("DFS channel %d ignored for PLM"), - req->plmChList[count]); + ch); continue; } - } else if (!ret) { - /* Not supported, ignore the channel */ - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - FL("Unsupported channel %d ignored for PLM"), - req->plmChList[count]); - continue; } - ch_list[valid_count] = req->plmChList[count]; - valid_count++; + ch_list[valid_count++] = ch; } /* End of for () */ /* Copying back the valid channel list to plm struct */ - qdf_mem_zero((void *)req->plmChList, - req->plmNumCh); + qdf_mem_zero(body->plm_ch_list, body->plm_num_ch); if (valid_count) - qdf_mem_copy(req->plmChList, ch_list, - valid_count); + qdf_mem_copy(body->plm_ch_list, ch_list, valid_count); /* All are invalid channels, FW need to send the PLM * report with "incapable" bit set. */ - req->plmNumCh = valid_count; + body->plm_num_ch = valid_count; send_plm_start: /* PLM START */ msg.type = WMA_SET_PLM_REQ; msg.reserved = 0; - msg.bodyptr = req; + msg.bodyptr = body; if (!QDF_IS_STATUS_SUCCESS(scheduler_post_message(QDF_MODULE_ID_SME, QDF_MODULE_ID_WMA, @@ -1531,11 +1541,12 @@ send_plm_start: QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, FL("Not able to post WMA_SET_PLM_REQ to WMA")); sme_release_global_lock(&mac->sme); + qdf_mem_free(body); return QDF_STATUS_E_FAILURE; } sme_release_global_lock(&mac->sme); - return status; + return QDF_STATUS_SUCCESS; } /** diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index 5a7ef8298c..2a1dd16147 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -1117,9 +1117,7 @@ void wma_add_ts_req(tp_wma_handle wma, struct add_ts_param *msg); #ifdef FEATURE_WLAN_ESE QDF_STATUS wma_process_tsm_stats_req(tp_wma_handle wma_handler, void *pTsmStatsMsg); -QDF_STATUS wma_plm_start(tp_wma_handle wma, const struct plm_req *plm); -QDF_STATUS wma_plm_stop(tp_wma_handle wma, const struct plm_req *plm); -void wma_config_plm(tp_wma_handle wma, struct plm_req *plm); +void wma_config_plm(tp_wma_handle wma, struct plm_req_params *plm); #endif QDF_STATUS wma_process_mcbc_set_filter_req(tp_wma_handle wma_handle, diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index d91e221b90..3e9d72bf33 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -3276,27 +3276,23 @@ send_resp: /** * wma_plm_start() - plm start request * @wma: wma handle - * @plm: plm request parameters + * @params: plm request parameters * * This function request FW to start PLM. * * Return: QDF status */ -QDF_STATUS wma_plm_start(tp_wma_handle wma, const struct plm_req *plm) +static QDF_STATUS wma_plm_start(tp_wma_handle wma, + struct plm_req_params *params) { - struct plm_req_params params = {0}; uint32_t num_channels; uint32_t *channel_list = NULL; uint32_t i; QDF_STATUS status; - if (NULL == plm || NULL == wma) { - WMA_LOGE("%s: input pointer is NULL ", __func__); - return QDF_STATUS_E_FAILURE; - } WMA_LOGD("PLM Start"); - num_channels = plm->plmNumCh; + num_channels = params->plm_num_ch; if (num_channels) { channel_list = qdf_mem_malloc(sizeof(uint32_t) * num_channels); @@ -3304,41 +3300,23 @@ QDF_STATUS wma_plm_start(tp_wma_handle wma, const struct plm_req *plm) return QDF_STATUS_E_FAILURE; for (i = 0; i < num_channels; i++) { - channel_list[i] = plm->plmChList[i]; + channel_list[i] = params->plm_ch_list[i]; if (channel_list[i] < WMA_NLO_FREQ_THRESH) channel_list[i] = cds_chan_to_freq(channel_list[i]); } } - - params.diag_token = plm->diag_token; - params.meas_token = plm->meas_token; - params.num_bursts = plm->numBursts; - params.burst_int = plm->burstInt; - params.meas_duration = plm->measDuration; - params.burst_len = plm->burstLen; - params.desired_tx_pwr = plm->desiredTxPwr; - params.plm_num_ch = plm->plmNumCh; - params.vdev_id = plm->sessionId; - params.enable = plm->enable; - qdf_mem_copy(¶ms.mac_addr, &plm->mac_addr, - sizeof(struct qdf_mac_addr)); - qdf_mem_copy(params.plm_ch_list, plm->plmChList, - WMI_CFG_VALID_CHANNEL_LIST_LEN); - - status = wmi_unified_plm_start_cmd(wma->wmi_handle, - ¶ms, channel_list); - if (QDF_IS_STATUS_ERROR(status)) { - qdf_mem_free(channel_list); - return status; - } - + status = wmi_unified_plm_start_cmd(wma->wmi_handle, params, + channel_list); qdf_mem_free(channel_list); - wma->interfaces[plm->sessionId].plm_in_progress = true; + if (QDF_IS_STATUS_ERROR(status)) + return status; + + wma->interfaces[params->vdev_id].plm_in_progress = true; WMA_LOGD("Plm start request sent successfully for vdev %d", - plm->sessionId); + params->vdev_id); return status; } @@ -3346,53 +3324,32 @@ QDF_STATUS wma_plm_start(tp_wma_handle wma, const struct plm_req *plm) /** * wma_plm_stop() - plm stop request * @wma: wma handle - * @plm: plm request parameters + * @params: plm request parameters * * This function request FW to stop PLM. * * Return: QDF status */ -QDF_STATUS wma_plm_stop(tp_wma_handle wma, const struct plm_req *plm) +static QDF_STATUS wma_plm_stop(tp_wma_handle wma, + struct plm_req_params *params) { - struct plm_req_params params = {0}; QDF_STATUS status; - if (NULL == plm || NULL == wma) { - WMA_LOGE("%s: input pointer is NULL ", __func__); - return QDF_STATUS_E_FAILURE; - } - - if (false == wma->interfaces[plm->sessionId].plm_in_progress) { + if (!wma->interfaces[params->vdev_id].plm_in_progress) { WMA_LOGE("No active plm req found, skip plm stop req"); return QDF_STATUS_E_FAILURE; } WMA_LOGD("PLM Stop"); - params.diag_token = plm->diag_token; - params.meas_token = plm->meas_token; - params.num_bursts = plm->numBursts; - params.burst_int = plm->burstInt; - params.meas_duration = plm->measDuration; - params.burst_len = plm->burstLen; - params.desired_tx_pwr = plm->desiredTxPwr; - params.plm_num_ch = plm->plmNumCh; - params.vdev_id = plm->sessionId; - params.enable = plm->enable; - qdf_mem_copy(¶ms.mac_addr, &plm->mac_addr, - sizeof(struct qdf_mac_addr)); - qdf_mem_copy(params.plm_ch_list, plm->plmChList, - WMI_CFG_VALID_CHANNEL_LIST_LEN); - - status = wmi_unified_plm_stop_cmd(wma->wmi_handle, - ¶ms); + status = wmi_unified_plm_stop_cmd(wma->wmi_handle, params); if (QDF_IS_STATUS_ERROR(status)) return status; - wma->interfaces[plm->sessionId].plm_in_progress = false; + wma->interfaces[params->vdev_id].plm_in_progress = false; WMA_LOGD("Plm stop request sent successfully for vdev %d", - plm->sessionId); + params->vdev_id); return status; } @@ -3400,25 +3357,25 @@ QDF_STATUS wma_plm_stop(tp_wma_handle wma, const struct plm_req *plm) /** * wma_config_plm() - config PLM * @wma: wma handle - * @plm: plm request parameters + * @params: plm request parameters * * Return: none */ -void wma_config_plm(tp_wma_handle wma, struct plm_req *plm) +void wma_config_plm(tp_wma_handle wma, struct plm_req_params *params) { QDF_STATUS ret; - if (NULL == plm || NULL == wma) + if (!params || !wma) return; - if (plm->enable) - ret = wma_plm_start(wma, plm); + if (params->enable) + ret = wma_plm_start(wma, params); else - ret = wma_plm_stop(wma, plm); + ret = wma_plm_stop(wma, params); if (ret) WMA_LOGE("%s: PLM %s failed %d", __func__, - plm->enable ? "start" : "stop", ret); + params->enable ? "start" : "stop", ret); } #endif