diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 879e0e2a0d59..d31de43473f0 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -2744,7 +2744,7 @@ typedef struct sSirChanChangeRequest { typedef struct sSirChanChangeResponse { uint8_t sessionId; - uint8_t newChannelNumber; + uint8_t new_op_freq; uint8_t channelChangeStatus; } tSirChanChangeResponse, *tpSirChanChangeResponse; diff --git a/core/mac/src/pe/lim/lim_send_messages.c b/core/mac/src/pe/lim/lim_send_messages.c index 9cb0ff04480d..605184f31f9d 100644 --- a/core/mac/src/pe/lim/lim_send_messages.c +++ b/core/mac/src/pe/lim/lim_send_messages.c @@ -34,6 +34,7 @@ #include "host_diag_core_log.h" #endif /* FEATURE_WLAN_DIAG_SUPPORT */ #include "lim_utils.h" +#include "wma.h" /** * lim_send_beacon_params() - updates bcn params to WMA @@ -118,8 +119,7 @@ QDF_STATUS lim_send_switch_chnl_params(struct mac_context *mac, uint32_t cac_duration_ms, uint32_t dfs_regdomain) { - tpSwitchChannelParams pChnlParams = NULL; - struct scheduler_msg msgQ = {0}; + struct wma_vdev_start_req req = {0}; struct pe_session *pe_session; pe_session = pe_find_session_by_session_id(mac, peSessionId); @@ -128,79 +128,69 @@ QDF_STATUS lim_send_switch_chnl_params(struct mac_context *mac, peSessionId); return QDF_STATUS_E_FAILURE; } - pChnlParams = qdf_mem_malloc(sizeof(tSwitchChannelParams)); - if (!pChnlParams) - return QDF_STATUS_E_NOMEM; - pChnlParams->ch_freq = wlan_reg_chan_to_freq(mac->pdev, chnlNumber); - pChnlParams->ch_center_freq_seg0 = - wlan_reg_chan_to_freq(mac->pdev, ch_center_freq_seg0); - pChnlParams->ch_center_freq_seg1 = - wlan_reg_chan_to_freq(mac->pdev, ch_center_freq_seg1); - pChnlParams->ch_width = ch_width; - qdf_mem_copy(pChnlParams->selfStaMacAddr, pe_session->self_mac_addr, - sizeof(tSirMacAddr)); - pChnlParams->maxTxPower = maxTxPower; - pChnlParams->peSessionId = peSessionId; - pChnlParams->vhtCapable = pe_session->vhtCapability; - if (lim_is_session_he_capable(pe_session)) - lim_update_chan_he_capable(mac, pChnlParams); - pChnlParams->dot11_mode = pe_session->dot11mode; - pChnlParams->nss = pe_session->nss; - pe_debug("dot11mode: %d, vht_capable: %d nss value: %d", - pChnlParams->dot11_mode, pChnlParams->vhtCapable, - pChnlParams->nss); + req.vdev_id = pe_session->vdev_id; + req.op_chan_freq = wlan_reg_chan_to_freq(mac->pdev, chnlNumber); + req.chan_width = ch_width; + if (cds_is_5_mhz_enabled()) + req.is_quarter_rate = 1; + else if (cds_is_10_mhz_enabled()) + req.is_half_rate = 1; + req.chan_freq_seg0 = + wlan_reg_chan_to_freq(mac->pdev, ch_center_freq_seg0); + req.chan_freq_seg1 = + wlan_reg_chan_to_freq(mac->pdev, ch_center_freq_seg1); + req.dot11_mode = pe_session->dot11mode; + req.cac_duration_ms = cac_duration_ms; /*Set DFS flag for DFS channel */ if (ch_width == CH_WIDTH_160MHZ) { - pChnlParams->isDfsChannel = true; + req.is_dfs = true; } else if (ch_width == CH_WIDTH_80P80MHZ) { - pChnlParams->isDfsChannel = false; + req.is_dfs = false; if (wlan_reg_get_channel_state(mac->pdev, chnlNumber) == CHANNEL_STATE_DFS || wlan_reg_get_channel_state(mac->pdev, - pChnlParams->ch_center_freq_seg1 - + ch_center_freq_seg1 - SIR_80MHZ_START_CENTER_CH_DIFF) == CHANNEL_STATE_DFS) - pChnlParams->isDfsChannel = true; + req.is_dfs = true; } else { if (wlan_reg_get_channel_state(mac->pdev, chnlNumber) == CHANNEL_STATE_DFS) - pChnlParams->isDfsChannel = true; + req.is_dfs = true; else - pChnlParams->isDfsChannel = false; + req.is_dfs = false; } + req.beacon_intval = 100; + req.dtim_period = 1; + req.max_txpow = maxTxPower; + req.ssid = pe_session->ssId; + req.hidden_ssid = pe_session->ssidHidden; + if (pe_session->nss == 2) { + req.preferred_rx_streams = 2; + req.preferred_tx_streams = 2; + } else { + req.preferred_rx_streams = 1; + req.preferred_tx_streams = 1; + } + if (lim_is_session_he_capable(pe_session)) + req.he_capable = true; + req.vht_capable = pe_session->vhtCapability; - pChnlParams->restart_on_chan_switch = is_restart; - pChnlParams->cac_duration_ms = cac_duration_ms; - pChnlParams->dfs_regdomain = dfs_regdomain; - pChnlParams->reduced_beacon_interval = - mac->sap.SapDfsInfo.reduced_beacon_interval; + pe_debug("dot11mode: %d, vht_capable: %d nss value: %d", + req.dot11_mode, req.vht_capable, + pe_session->nss); - pChnlParams->ssid_hidden = pe_session->ssidHidden; - pChnlParams->ssid = pe_session->ssId; - if (cds_is_5_mhz_enabled()) - pChnlParams->ch_width = CH_WIDTH_5MHZ; - else if (cds_is_10_mhz_enabled()) - pChnlParams->ch_width = CH_WIDTH_10MHZ; + pe_debug("ch width %d, freq %d, maxTxPower %d", + req.chan_width, req.op_chan_freq, req.max_txpow); + + pe_session->ch_switch_in_progress = true; /* we need to defer the message until we * get the response back from WMA */ SET_LIM_PROCESS_DEFD_MESGS(mac, false); - msgQ.type = WMA_CHNL_SWITCH_REQ; - msgQ.reserved = 0; - msgQ.bodyptr = pChnlParams; - msgQ.bodyval = 0; - pe_debug("Sending CH_SWITCH_REQ, ch_width %d, ch_freq %d, maxTxPower %d", - pChnlParams->ch_width, - pChnlParams->ch_freq, pChnlParams->maxTxPower); - MTRACE(mac_trace_msg_tx(mac, peSessionId, msgQ.type)); - if (QDF_STATUS_SUCCESS != wma_post_ctrl_msg(mac, &msgQ)) { - qdf_mem_free(pChnlParams); - pe_err("Posting CH_SWITCH_REQ to WMA failed"); - return QDF_STATUS_E_FAILURE; - } - pe_session->ch_switch_in_progress = true; + wma_set_channel(&req); return QDF_STATUS_SUCCESS; } diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index 1f8cf06853ec..7d6be0592d33 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -1931,7 +1931,7 @@ lim_send_sme_ap_channel_switch_resp(struct mac_context *mac, struct vdev_start_response *rsp) { struct scheduler_msg mmhMsg = {0}; - tpSwitchChannelParams pSmeSwithChnlParams; + struct sSirChanChangeResponse *chan_change_rsp; uint8_t channelId; bool is_ch_dfs = false; enum phy_ch_width ch_width; @@ -1940,30 +1940,27 @@ lim_send_sme_ap_channel_switch_resp(struct mac_context *mac, qdf_runtime_pm_allow_suspend(&pe_session->ap_ecsa_runtime_lock); qdf_wake_lock_release(&pe_session->ap_ecsa_wakelock, 0); - pSmeSwithChnlParams = qdf_mem_malloc(sizeof(tSwitchChannelParams)); - if (!pSmeSwithChnlParams) + chan_change_rsp = + qdf_mem_malloc(sizeof(struct sSirChanChangeResponse)); + if (!chan_change_rsp) return; - channelId = wlan_reg_freq_to_chan(mac->pdev, pe_session->curr_op_freq); - pSmeSwithChnlParams->ch_freq = pe_session->curr_op_freq; - pSmeSwithChnlParams->status = rsp->status; - - ch_width = pe_session->ch_width; - ch_center_freq_seg1 = pe_session->ch_center_freq_seg1; - + chan_change_rsp->new_op_freq = pe_session->curr_op_freq; + chan_change_rsp->channelChangeStatus = rsp->status; /* * Pass the sme sessionID to SME instead * PE session ID. */ - pSmeSwithChnlParams->peSessionId = rsp->vdev_id; + chan_change_rsp->sessionId = rsp->vdev_id; mmhMsg.type = eWNI_SME_CHANNEL_CHANGE_RSP; - mmhMsg.bodyptr = (void *)pSmeSwithChnlParams; + mmhMsg.bodyptr = (void *)chan_change_rsp; mmhMsg.bodyval = 0; lim_sys_process_mmh_msg_api(mac, &mmhMsg); if (QDF_IS_STATUS_ERROR(rsp->status)) { - pe_err("failed to change sap channel to %u", channelId); + pe_err("failed to change sap freq to %u", + pe_session->curr_op_freq); return; } @@ -1973,7 +1970,9 @@ lim_send_sme_ap_channel_switch_resp(struct mac_context *mac, * channel, PE will receive an explicit request from * upper layers to start the beacon transmission . */ - + ch_width = pe_session->ch_width; + ch_center_freq_seg1 = pe_session->ch_center_freq_seg1; + channelId = wlan_reg_freq_to_chan(mac->pdev, pe_session->curr_op_freq); if (ch_width == CH_WIDTH_160MHZ) { is_ch_dfs = true; } else if (ch_width == CH_WIDTH_80P80MHZ) { diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index ec83bc3b709c..89157d3c1986 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -7157,12 +7157,6 @@ void lim_update_session_he_capable(struct mac_context *mac, struct pe_session *s pe_debug("he_capable: %d", session->he_capable); } -void lim_update_chan_he_capable(struct mac_context *mac, tpSwitchChannelParams chan) -{ - chan->he_capable = true; - pe_debug("he_capable: %d", chan->he_capable); -} - void lim_set_he_caps(struct mac_context *mac, struct pe_session *session, uint8_t *ie_start, uint32_t num_bytes) { diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index f1cfcaf70f13..3b2499a9c435 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -1134,15 +1134,6 @@ void lim_update_stads_he_capable(tpDphHashNode sta_ds, tpSirAssocReq assoc_req); */ void lim_update_session_he_capable(struct mac_context *mac, struct pe_session *session); -/** - * lim_update_chan_he_capable(): Update he_capable in chan switch params - * @mac: pointer to MAC context - * @chan: pointer to channel switch params - * - * Return: None - */ -void lim_update_chan_he_capable(struct mac_context *mac, tpSwitchChannelParams chan); - /** * lim_set_he_caps() - update HE caps to be sent to FW as part of scan IE * @mac: pointer to MAC @@ -1293,11 +1284,6 @@ static inline void lim_update_session_he_capable(struct mac_context *mac, { } -static inline void lim_update_chan_he_capable(struct mac_context *mac, - tpSwitchChannelParams chan) -{ -} - static inline void lim_set_he_caps(struct mac_context *mac, struct pe_session *session, uint8_t *ie_start, uint32_t num_bytes) { diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 1d67b03d8034..a31acb8e146c 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -9091,50 +9091,33 @@ static QDF_STATUS sme_process_channel_change_resp(struct mac_context *mac, QDF_STATUS status = QDF_STATUS_SUCCESS; struct csr_roam_info *roam_info; eCsrRoamResult roamResult; - tpSwitchChannelParams pChnlParams = (tpSwitchChannelParams) msg_buf; - uint32_t SessionId = pChnlParams->peSessionId; + uint8_t session_id; roam_info = qdf_mem_malloc(sizeof(*roam_info)); if (!roam_info) return QDF_STATUS_E_NOMEM; roam_info->channelChangeRespEvent = - qdf_mem_malloc(sizeof(tSirChanChangeResponse)); - if (!roam_info->channelChangeRespEvent) { - status = QDF_STATUS_E_NOMEM; - qdf_mem_free(roam_info); - return status; - } - if (msg_type == eWNI_SME_CHANNEL_CHANGE_RSP) { - roam_info->channelChangeRespEvent->sessionId = SessionId; - roam_info->channelChangeRespEvent->newChannelNumber = - wlan_reg_freq_to_chan(mac->pdev, pChnlParams->ch_freq); + (struct sSirChanChangeResponse *)msg_buf; - if (pChnlParams->status == QDF_STATUS_SUCCESS) { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - "sapdfs: Received success eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", - SessionId); - roam_info->channelChangeRespEvent->channelChangeStatus = - 1; - roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS; - } else { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - "sapdfs: Received failure eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", - SessionId); - roam_info->channelChangeRespEvent->channelChangeStatus = - 0; - roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE; - } - - csr_roam_call_callback(mac, SessionId, roam_info, 0, - eCSR_ROAM_SET_CHANNEL_RSP, roamResult); + session_id = roam_info->channelChangeRespEvent->sessionId; + if (roam_info->channelChangeRespEvent->channelChangeStatus == + QDF_STATUS_SUCCESS) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, + "sapdfs: Received success eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", + session_id); + roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS; } else { - status = QDF_STATUS_E_FAILURE; - sme_err("Invalid Channel Change Resp Message: %d", - status); + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, + "sapdfs: Received failure eWNI_SME_CHANNEL_CHANGE_RSP for sessionId[%d]", + session_id); + roamResult = eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE; } - qdf_mem_free(roam_info->channelChangeRespEvent); + + csr_roam_call_callback(mac, session_id, roam_info, 0, + eCSR_ROAM_SET_CHANNEL_RSP, roamResult); + qdf_mem_free(roam_info); return status; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 5f0d8b6e3977..f742dcdd9413 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -3325,7 +3325,6 @@ QDF_STATUS csr_roam_call_callback(struct mac_context *mac, uint32_t sessionId, struct csr_roam_session *pSession; tDot11fBeaconIEs *beacon_ies = NULL; uint8_t chan1, chan2; - uint8_t new_chan_num; if (!CSR_IS_SESSION_VALID(mac, sessionId)) { sme_err("Session ID: %d is not valid", sessionId); @@ -3393,10 +3392,8 @@ QDF_STATUS csr_roam_call_callback(struct mac_context *mac, uint32_t sessionId, pSession->bRefAssocStartCnt--; } else if (roam_info && (u1 == eCSR_ROAM_SET_CHANNEL_RSP) && (u2 == eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS)) { - new_chan_num = - roam_info->channelChangeRespEvent->newChannelNumber; pSession->connectedProfile.op_freq = - wlan_reg_chan_to_freq(mac->pdev, new_chan_num); + roam_info->channelChangeRespEvent->new_op_freq; } else if (u1 == eCSR_ROAM_SESSION_OPENED) { ret = (u2 == eCSR_ROAM_RESULT_SUCCESS) ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE; diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index b444c01c52b6..3d1e4e300b74 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -2591,4 +2591,12 @@ QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss); */ QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g, uint32_t *chainmask_5g); + +/** + * wma_set_channel() - API to set or switch channel + * @req: channel switch request + * + * Return: None + */ +void wma_set_channel(struct wma_vdev_start_req *req); #endif diff --git a/core/wma/inc/wma_he.h b/core/wma/inc/wma_he.h index 78c9ca53f376..378d3b605b10 100644 --- a/core/wma/inc/wma_he.h +++ b/core/wma/inc/wma_he.h @@ -172,16 +172,6 @@ static inline bool wma_is_peer_he_capable(tpAddStaParams params) return params->he_capable; } -/** - * wma_update_vdev_he_capable() - update vdev start request he capability - * @req: pointer to vdev start request - * @params: pointer to chan switch params - * - * Return: None - */ -void wma_update_vdev_he_capable(struct wma_vdev_start_req *req, - tpSwitchChannelParams params); - /** * wma_update_he_ops_ie() - update the HE OPS IE to firmware * @wma: pointer to wma context @@ -304,11 +294,6 @@ static inline bool wma_is_peer_he_capable(tpAddStaParams params) return false; } -static inline void wma_update_vdev_he_capable(struct wma_vdev_start_req *req, - tpSwitchChannelParams params) -{ -} - static inline void wma_set_he_vdev_param(struct wma_txrx_node *intr, WMI_VDEV_PARAM param_id, uint32_t value) { diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h index c9a2a974527d..fa38ed052c8b 100644 --- a/core/wma/inc/wma_if.h +++ b/core/wma/inc/wma_if.h @@ -723,55 +723,6 @@ typedef struct { tSirMacAddr peer_mac; } tUpdateUserPos, *tpUpdateUserPos; -/** - * struct tSwitchChannelParams - switch channel request parameter - * @ch_freq: channel frequency ID - * @localPowerConstraint: local power constraint - * @secondaryChannelOffset: scondary channel offset - * @peSessionId: PE session id - * @txMgmtPower: TX mgmt power - * @maxTxPower: max tx power - * @selfStaMacAddr: self mac address - * @bssId: bssid - * @status: QDF status - * @chainMask: chanin mask - * @smpsMode: SMPS mode - * @isDfsChannel: is DFS channel - * @vhtCapable: VHT capable - * @ch_center_freq_seg0: ch freq segment for primary channel(center frequency) - * @ch_center_freq_seg1: ch freq segment for secondary channel(center frequency) - * @dot11_mode: 802.11 mode - * @cac_duration_ms: cac duration in milliseconds - * @dfs_regdomain: dfs region - * @reduced_beacon_interval: reduced beacon interval value - * @ssid_hidden: the sap ssid is hidden - * @ssid: sap ssid - */ -typedef struct { - uint32_t ch_freq; - uint8_t peSessionId; - int8_t maxTxPower; - tSirMacAddr selfStaMacAddr; - QDF_STATUS status; - uint8_t isDfsChannel; - uint8_t vhtCapable; - enum phy_ch_width ch_width; - uint32_t ch_center_freq_seg0; - uint32_t ch_center_freq_seg1; - uint8_t dot11_mode; - - uint8_t restart_on_chan_switch; - uint8_t nss; -#ifdef WLAN_FEATURE_11AX - bool he_capable; -#endif - uint32_t cac_duration_ms; - uint32_t dfs_regdomain; - uint16_t reduced_beacon_interval; - uint8_t ssid_hidden; - tSirMacSSid ssid; -} tSwitchChannelParams, *tpSwitchChannelParams; - /** * struct tEdcaParams - EDCA parameters * @bss_idx: BSSID index diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index f4b062f760fe..97d5c14a4ea9 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -291,8 +291,6 @@ QDF_STATUS wma_roam_scan_bmiss_cnt(tp_wma_handle wma_handle, QDF_STATUS wma_roam_scan_offload_command(tp_wma_handle wma_handle, uint32_t command, uint32_t vdev_id); -void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params); - #ifdef WLAN_FEATURE_ROAM_OFFLOAD void wma_set_ric_req(tp_wma_handle wma, void *msg, uint8_t is_add_ts); #endif diff --git a/core/wma/src/wma_he.c b/core/wma/src/wma_he.c index b1804692423e..aa7088f75596 100644 --- a/core/wma/src/wma_he.c +++ b/core/wma/src/wma_he.c @@ -1336,12 +1336,6 @@ void wma_vdev_set_he_config(tp_wma_handle wma, uint8_t vdev_id, pd_min, pd_max, sec_ch_ed, tx_pwr); } -void wma_update_vdev_he_capable(struct wma_vdev_start_req *req, - tpSwitchChannelParams params) -{ - req->he_capable = params->he_capable; -} - QDF_STATUS wma_update_he_ops_ie(tp_wma_handle wma, uint8_t vdev_id, tDot11fIEhe_op *he_op) { diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 36190b011175..cd018c2927e2 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -8443,11 +8443,6 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg) (tSirUpdateChanList *) msg->bodyptr); qdf_mem_free(msg->bodyptr); break; - case WMA_CHNL_SWITCH_REQ: - wma_set_channel(wma_handle, - (tpSwitchChannelParams) msg->bodyptr); - qdf_mem_free(msg->bodyptr); - break; case WMA_ADD_BSS_REQ: wma_add_bss(wma_handle, (struct bss_params *) msg->bodyptr); break; diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index 2ed4844220c0..42e691c75da9 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -3496,95 +3496,36 @@ void wma_process_roam_synch_complete(WMA_HANDLE handle, uint8_t vdev_id) } #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ -/** - * wma_set_channel() - set channel - * @wma: wma handle - * @params: switch channel parameters - * - * Return: none - */ -void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params) +void wma_set_channel(struct wma_vdev_start_req *req) { - struct wma_vdev_start_req req; QDF_STATUS status = QDF_STATUS_SUCCESS; - uint8_t vdev_id, peer_id; - void *peer; - struct cdp_pdev *pdev; - struct wma_txrx_node *intr = wma->interfaces; + uint8_t vdev_id = req->vdev_id; + tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); + struct cdp_pdev *pdev = cds_get_context(QDF_MODULE_ID_TXRX); + struct wma_txrx_node *intr = &wma->interfaces[vdev_id]; void *soc = cds_get_context(QDF_MODULE_ID_SOC); uint16_t beacon_interval_ori; uint8_t chan; struct vdev_start_response rsp = {0}; + bool restart; + uint16_t reduced_beacon_interval; - WMA_LOGD("%s: Enter", __func__); - if (!wma_find_vdev_by_addr(wma, params->selfStaMacAddr, &vdev_id)) { - WMA_LOGP("%s: Failed to find vdev id for %pM", - __func__, params->selfStaMacAddr); - status = QDF_STATUS_E_FAILURE; - goto send_resp; - } - pdev = cds_get_context(QDF_MODULE_ID_TXRX); if (!pdev) { WMA_LOGE("%s: Failed to get pdev", __func__); status = QDF_STATUS_E_FAILURE; goto send_resp; } - peer = cdp_peer_find_by_addr(soc, - pdev, - intr[vdev_id].bssid, &peer_id); + restart = + wma_get_channel_switch_in_progress(intr); + if (restart && intr->beacon_filter_enabled) + wma_remove_beacon_filter(wma, &intr->beacon_filter); - qdf_mem_zero(&req, sizeof(req)); - req.vdev_id = vdev_id; - req.op_chan_freq = params->ch_freq; - req.chan_width = params->ch_width; + reduced_beacon_interval = + wma->mac_context->sap.SapDfsInfo.reduced_beacon_interval; + if (wma_is_vdev_in_ap_mode(wma, vdev_id) && reduced_beacon_interval) { - if (params->ch_width == CH_WIDTH_10MHZ) - req.is_half_rate = 1; - else if (params->ch_width == CH_WIDTH_5MHZ) - req.is_quarter_rate = 1; - req.vht_capable = params->vhtCapable; - req.chan_freq_seg0 = params->ch_center_freq_seg0; - req.chan_freq_seg1 = params->ch_center_freq_seg1; - req.dot11_mode = params->dot11_mode; - wma_update_vdev_he_capable(&req, params); - - WMA_LOGI(FL("vht_capable: %d, dot11_mode: %d"), - req.vht_capable, req.dot11_mode); - - if (params->nss == 2) { - req.preferred_rx_streams = 2; - req.preferred_tx_streams = 2; - } else { - req.preferred_rx_streams = 1; - req.preferred_tx_streams = 1; - } - - req.max_txpow = params->maxTxPower; - req.beacon_intval = 100; - req.dtim_period = 1; - req.is_dfs = params->isDfsChannel; - req.cac_duration_ms = params->cac_duration_ms; - req.dfs_regdomain = params->dfs_regdomain; - req.ssid = params->ssid; - - /* In case of AP mode, once radar is detected, we need to - * issuse VDEV RESTART, so we making is_channel_switch as - * true - */ - if ((wma_is_vdev_in_ap_mode(wma, req.vdev_id) == true) || - (params->restart_on_chan_switch == true)) { - req.hidden_ssid = params->ssid_hidden; - } - - if (params->restart_on_chan_switch == true && - wma->interfaces[req.vdev_id].beacon_filter_enabled) - wma_remove_beacon_filter(wma, - &wma->interfaces[req.vdev_id].beacon_filter); - - if ((wma_is_vdev_in_ap_mode(wma, req.vdev_id) == true) && - (params->reduced_beacon_interval)) { /* Reduce the beacon interval just before the channel switch. * This would help in reducing the downtime on the STA side * (which is waiting for beacons from the AP to resume back @@ -3595,23 +3536,22 @@ void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params) */ WMA_LOGD("%s: Changing beacon interval to %d", - __func__, params->reduced_beacon_interval); + __func__, reduced_beacon_interval); /* Add a timer to reset the beacon interval back*/ - beacon_interval_ori = req.beacon_intval; - req.beacon_intval = params->reduced_beacon_interval; + beacon_interval_ori = req->beacon_intval; + req->beacon_intval = reduced_beacon_interval; if (wma_fill_beacon_interval_reset_req(wma, - req.vdev_id, + vdev_id, beacon_interval_ori, RESET_BEACON_INTERVAL_TIMEOUT)) { WMA_LOGD("%s: Failed to fill beacon interval reset req", - __func__); + __func__); } } - status = wma_vdev_start(wma, &req, wma_get_channel_switch_in_progress( - &wma->interfaces[req.vdev_id])); + status = wma_vdev_start(wma, req, restart); if (status != QDF_STATUS_SUCCESS) { WMA_LOGP("%s: vdev start failed status = %d", __func__, status); @@ -3622,18 +3562,14 @@ void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params) * Record monitor mode channel here in case HW * indicate RX PPDU TLV with invalid channel number. */ - if (intr[vdev_id].type == WMI_VDEV_TYPE_MONITOR) { - chan = wlan_reg_freq_to_chan(wma->pdev, req.op_chan_freq); + if (intr->type == WMI_VDEV_TYPE_MONITOR) { + chan = wlan_reg_freq_to_chan(wma->pdev, req->op_chan_freq); cdp_record_monitor_chan_num(soc, pdev, chan); } return; send_resp: - WMA_LOGD("%s: ch_freq %d ch_width %d txpower %d status %d", __func__, - params->ch_freq, params->ch_width, - params->maxTxPower, - status); - WMA_LOGI("%s: wma switch channel rsp,, status = 0x%x", + WMA_LOGI("%s: wma switch channel rsp, status = 0x%x", __func__, status); rsp.status = status; rsp.vdev_id = vdev_id;