diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 8c65f5d615..5e5fd22b82 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -22571,6 +22571,28 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy, adapter->vdev_id, &roam_profile.ch_params, &roam_profile); +#else + qdf_mem_zero(&ch_params, sizeof(struct ch_params)); + + req = qdf_mem_malloc(sizeof(struct channel_change_req)); + if (!req) + return -ENOMEM; + + req->vdev_id = adapter->vdev_id; + req->target_chan_freq = ch_info->freq; + req->ch_width = ch_width; + + ch_params.ch_width = ch_width; + hdd_select_cbmode(adapter, chandef->chan->center_freq, sec_ch_2g_freq, + &ch_params); + + req->sec_ch_offset = ch_params.sec_ch_offset; + req->center_freq_seg0 = ch_params.center_freq_seg0; + req->center_freq_seg1 = ch_params.center_freq_seg1; + + sme_fill_channel_change_request(mac_handle, req, ch_info->phy_mode); + status = sme_send_channel_change_req(mac_handle, req); + qdf_mem_free(req); #endif if (status) { hdd_err_rl("Failed to set sme_RoamChannel for monitor mode status: %d", diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index c2314aa3e2..b5b627b5e6 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -8741,6 +8741,8 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, qdf_freq_t freq, /* To be removed after SAP CSR cleanup changes */ #ifndef SAP_CP_CLEANUP struct csr_roam_profile roam_profile; +#else + struct channel_change_req *req; #endif struct ch_params ch_params; enum phy_ch_width max_fw_bw; @@ -8827,6 +8829,27 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, qdf_freq_t freq, bssid, adapter->vdev_id, &roam_profile.ch_params, &roam_profile); +#else + qdf_mem_zero(&ch_params, sizeof(struct ch_params)); + + req = qdf_mem_malloc(sizeof(struct channel_change_req)); + if (!req) + return -ENOMEM; + req->vdev_id = adapter->vdev_id; + req->target_chan_freq = ch_info->freq; + req->ch_width = ch_width; + + ch_params.ch_width = ch_width; + hdd_select_cbmode(adapter, freq, 0, &ch_params); + + req->sec_ch_offset = ch_params.sec_ch_offset; + req->center_freq_seg0 = ch_params.center_freq_seg0; + req->center_freq_seg1 = ch_params.center_freq_seg1; + + sme_fill_channel_change_request(hdd_ctx->mac_handle, req, + ch_info->phy_mode); + status = sme_send_channel_change_req(hdd_ctx->mac_handle, req); + qdf_mem_free(req); #endif if (status) { hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode", diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 3bdbc1be25..317efe934b 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -8112,6 +8112,7 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx, tpSirChanChangeRequest ch_change_req; #else struct channel_change_req *ch_change_req; + struct qdf_mac_addr bssid; #endif struct pe_session *session_entry; uint8_t session_id; /* PE session_id */ @@ -8126,6 +8127,8 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx, /* To be removed after SAP CSR cleanup changes */ #ifndef SAP_CP_CLEANUP ch_change_req = (tpSirChanChangeRequest)msg_buf; +#else + ch_change_req = (struct channel_change_req *)msg_buf; #endif target_freq = ch_change_req->target_chan_freq; @@ -8138,14 +8141,29 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx, pe_err("Invalid Request/max_tx_pwr"); return; } -#endif session_entry = pe_find_session_by_bssid(mac_ctx, ch_change_req->bssid, &session_id); + if (!session_entry) { lim_print_mac_addr(mac_ctx, ch_change_req->bssid, LOGE); pe_err("Session does not exist for given bssId"); return; } +#else + if (max_tx_pwr == WMA_MAX_TXPOWER_INVALID) { + pe_err("Invalid max tx power"); + return; + } + wlan_mlme_get_mac_vdev_id(mac_ctx->pdev, + ch_change_req->vdev_id, &bssid); + session_entry = pe_find_session_by_bssid(mac_ctx, bssid.bytes, + &session_id); + if (!session_entry) { + pe_err("Session does not exist for bssid " QDF_MAC_ADDR_FMT, + QDF_MAC_ADDR_REF(bssid.bytes)); + return; + } +#endif if (session_entry->curr_op_freq == target_freq && session_entry->ch_width == ch_change_req->ch_width) { @@ -8229,10 +8247,18 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx, /* Store the New Channel Params in session_entry */ session_entry->ch_width = ch_change_req->ch_width; +/* To be removed after SAP CSR cleanup changes */ +#ifndef SAP_CP_CLEANUP session_entry->ch_center_freq_seg0 = ch_change_req->center_freq_seg_0; session_entry->ch_center_freq_seg1 = ch_change_req->center_freq_seg_1; +#else + session_entry->ch_center_freq_seg0 = + ch_change_req->center_freq_seg0; + session_entry->ch_center_freq_seg1 = + ch_change_req->center_freq_seg1; +#endif session_entry->htSecondaryChannelOffset = ch_change_req->sec_ch_offset; session_entry->htSupportedChannelWidthSet = (ch_change_req->ch_width ? 1 : 0); @@ -8261,13 +8287,22 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx, session_entry->dot11mode = ch_change_req->dot11mode; session_entry->nwType = ch_change_req->nw_type; +/* To be removed after SAP CSR cleanup changes */ +#ifndef SAP_CP_CLEANUP qdf_mem_copy(&session_entry->rateSet, &ch_change_req->operational_rateset, sizeof(session_entry->rateSet)); qdf_mem_copy(&session_entry->extRateSet, &ch_change_req->extended_rateset, sizeof(session_entry->extRateSet)); - +#else + qdf_mem_copy(&session_entry->rateSet, + &ch_change_req->opr_rates, + sizeof(session_entry->rateSet)); + qdf_mem_copy(&session_entry->extRateSet, + &ch_change_req->ext_rates, + sizeof(session_entry->extRateSet)); +#endif lim_change_channel(mac_ctx, session_entry); } diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 2b9939ca53..f18d0f492d 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -1808,6 +1808,95 @@ static void wlansap_fill_channel_change_request(struct sap_context *sap_ctx, struct channel_change_req *req) { + struct mac_context *mac_ctx = sap_get_mac_context(); + struct bss_dot11_config dot11_cfg = {0}; + uint8_t h2e; + + dot11_cfg.vdev_id = sap_ctx->sessionId; + dot11_cfg.bss_op_ch_freq = sap_ctx->chan_freq; + dot11_cfg.phy_mode = sap_ctx->phyMode; + dot11_cfg.privacy = sap_ctx->sap_bss_cfg.privacy; + + /* Rates configured from start_bss will have + * hostapd rates if hostapd chan rates are enabled + */ + qdf_mem_copy(dot11_cfg.opr_rates.rate, + sap_ctx->sap_bss_cfg.operationalRateSet.rate, + sap_ctx->sap_bss_cfg.operationalRateSet.numRates); + dot11_cfg.opr_rates.numRates = + sap_ctx->sap_bss_cfg.operationalRateSet.numRates; + + qdf_mem_copy(dot11_cfg.ext_rates.rate, + sap_ctx->sap_bss_cfg.extendedRateSet.rate, + sap_ctx->sap_bss_cfg.extendedRateSet.numRates); + dot11_cfg.ext_rates.numRates = + sap_ctx->sap_bss_cfg.extendedRateSet.numRates; + sme_get_network_params(mac_ctx, &dot11_cfg); + + req->vdev_id = sap_ctx->sessionId; + req->target_chan_freq = sap_ctx->chan_freq; + req->sec_ch_offset = sap_ctx->ch_params.sec_ch_offset; + req->ch_width = sap_ctx->ch_params.ch_width; + req->center_freq_seg0 = sap_ctx->ch_params.center_freq_seg0; + req->center_freq_seg1 = sap_ctx->ch_params.center_freq_seg1; + req->dot11mode = dot11_cfg.dot11_mode; + req->nw_type = dot11_cfg.nw_type; + + sap_get_cac_dur_dfs_region(sap_ctx, + &req->cac_duration_ms, + &req->dfs_regdomain, + sap_ctx->chan_freq, + &sap_ctx->ch_params); + mlme_set_cac_required(sap_ctx->vdev, + !!req->cac_duration_ms); + + /* Update the rates in sap_bss_cfg for subsequent channel switch */ + if (dot11_cfg.opr_rates.numRates) { + qdf_mem_copy(req->opr_rates.rate, + dot11_cfg.opr_rates.rate, + dot11_cfg.opr_rates.numRates); + qdf_mem_copy(sap_ctx->sap_bss_cfg.operationalRateSet.rate, + dot11_cfg.opr_rates.rate, + dot11_cfg.opr_rates.numRates); + req->opr_rates.numRates = dot11_cfg.opr_rates.numRates; + sap_ctx->sap_bss_cfg.operationalRateSet.numRates = + dot11_cfg.opr_rates.numRates; + } else { + qdf_mem_zero(&sap_ctx->sap_bss_cfg.operationalRateSet, + sizeof(tSirMacRateSet)); + } + + if (dot11_cfg.ext_rates.numRates) { + qdf_mem_copy(req->ext_rates.rate, + dot11_cfg.ext_rates.rate, + sizeof(dot11_cfg.ext_rates.numRates)); + qdf_mem_copy(sap_ctx->sap_bss_cfg.extendedRateSet.rate, + dot11_cfg.ext_rates.rate, + dot11_cfg.ext_rates.numRates); + req->ext_rates.numRates = dot11_cfg.ext_rates.numRates; + sap_ctx->sap_bss_cfg.extendedRateSet.numRates = + dot11_cfg.ext_rates.numRates; + } else { + qdf_mem_zero(&sap_ctx->sap_bss_cfg.extendedRateSet, + sizeof(tSirMacRateSet)); + } + + if (sap_ctx->require_h2e) { + h2e = WLAN_BASIC_RATE_MASK | + WLAN_BSS_MEMBERSHIP_SELECTOR_SAE_H2E; + if (req->ext_rates.numRates < SIR_MAC_MAX_NUMBER_OF_RATES) { + req->ext_rates.rate[req->ext_rates.numRates] = h2e; + req->ext_rates.numRates++; + sap_debug("H2E bss membership add to ext support rate"); + } else if (req->opr_rates.numRates < + SIR_MAC_MAX_NUMBER_OF_RATES) { + req->opr_rates.rate[req->opr_rates.numRates] = h2e; + req->opr_rates.numRates++; + sap_debug("H2E bss membership add to support rate"); + } else { + sap_err("rates full, can not add H2E bss membership"); + } + } return; } #endif @@ -1819,6 +1908,10 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx, struct mac_context *mac_ctx; eCsrPhyMode phy_mode; struct ch_params *ch_params; +/* To be removed after SAP CSR cleanup changes */ +#ifdef SAP_CP_CLEANUP + struct channel_change_req *ch_change_req; +#endif if (!target_chan_freq) { sap_err("channel 0 requested"); @@ -1895,6 +1988,16 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx, sap_ctx->sessionId, ch_params, &sap_ctx->csr_roamProfile); +#else + ch_change_req = qdf_mem_malloc(sizeof(struct channel_change_req)); + if (!ch_change_req) + return QDF_STATUS_E_FAILURE; + + wlansap_fill_channel_change_request(sap_ctx, ch_change_req); + + status = sme_send_channel_change_req(MAC_HANDLE(mac_ctx), + ch_change_req); + qdf_mem_free(ch_change_req); #endif sap_debug("chan_freq:%d phy_mode %d width:%d offset:%d seg0:%d seg1:%d", sap_ctx->chan_freq, phy_mode, ch_params->ch_width, diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 7b1e7d6ea3..c86f65eb20 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -8619,10 +8619,18 @@ QDF_STATUS sme_roam_channel_change_req(mac_handle_t mac_handle, return status; } #else -QDF_STATUS sme_sap_channel_change_req(mac_handle_t mac_handle, +QDF_STATUS sme_send_channel_change_req(mac_handle_t mac_handle, struct channel_change_req *req) { - return QDF_STATUS_SUCCESS; + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct mac_context *mac = MAC_CONTEXT(mac_handle); + + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + status = csr_send_channel_change_req(mac, req); + sme_release_global_lock(&mac->sme); + } + return status; } #endif @@ -16485,6 +16493,32 @@ void sme_fill_channel_change_request(mac_handle_t mac_handle, struct channel_change_req *req, eCsrPhyMode phy_mode) { - return; + struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle); + struct bss_dot11_config dot11_cfg = {0}; + + dot11_cfg.vdev_id = req->vdev_id; + dot11_cfg.bss_op_ch_freq = req->target_chan_freq; + dot11_cfg.phy_mode = phy_mode; + + sme_get_network_params(mac_ctx, &dot11_cfg); + + req->dot11mode = dot11_cfg.dot11_mode; + req->nw_type = dot11_cfg.nw_type; + + if (dot11_cfg.opr_rates.numRates) { + qdf_mem_copy(req->opr_rates.rate, + dot11_cfg.opr_rates.rate, + dot11_cfg.opr_rates.numRates); + req->opr_rates.numRates = + dot11_cfg.opr_rates.numRates; + } + + if (dot11_cfg.ext_rates.numRates) { + qdf_mem_copy(req->ext_rates.rate, + dot11_cfg.ext_rates.rate, + dot11_cfg.ext_rates.numRates); + req->ext_rates.numRates = + dot11_cfg.ext_rates.numRates; + } } #endif diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index a6e519dedc..d7cfbb8d11 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -8232,10 +8232,33 @@ QDF_STATUS csr_roam_channel_change_req(struct mac_context *mac, return status; } #else -QDF_STATUS csr_sap_channel_change_req(struct mac_context *mac, +QDF_STATUS csr_send_channel_change_req(struct mac_context *mac, struct channel_change_req *req) { - return QDF_STATUS_SUCCESS; + struct scheduler_msg msg = {0}; + struct channel_change_req *ch_change_req; + QDF_STATUS status; + + ch_change_req = qdf_mem_malloc(sizeof(*ch_change_req)); + if (!ch_change_req) + return QDF_STATUS_E_NOMEM; + + qdf_mem_copy(ch_change_req, req, sizeof(*ch_change_req)); + msg.type = eWNI_SME_CHANNEL_CHANGE_REQ; + msg.bodyptr = ch_change_req; + msg.reserved = 0; + + status = scheduler_post_message(QDF_MODULE_ID_SME, + QDF_MODULE_ID_PE, + QDF_MODULE_ID_PE, + &msg); + if (QDF_IS_STATUS_ERROR(status)) { + sme_err("Failed to send channel change request with status : %d", + status); + qdf_mem_free(ch_change_req); + } + + return status; } #endif /*