diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 6bd397d2fd6a7..ec5b94b59384d 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -52,6 +52,7 @@ #include #include #include +#include #define MAX_PWR_FCC_CHAN_12 8 #define MAX_PWR_FCC_CHAN_13 2 @@ -114,6 +115,43 @@ /* Static Type declarations */ static struct csr_roam_session csr_roam_roam_session[CSR_ROAM_SESSION_MAX]; +/** + * csr_get_ielen_from_bss_description() - to get IE length + * from tSirBssDescription structure + * @pBssDescr: pBssDescr + * + * This function is called in various places to get IE length + * from tSirBssDescription structure + * + * @Return: total IE length + */ +static inline uint16_t +csr_get_ielen_from_bss_description(tpSirBssDescription pBssDescr) +{ + uint16_t ielen; + + if (!pBssDescr) + return 0; + + /* + * Length of BSS desription is without length of + * length itself and length of pointer + * that holds ieFields + * + * <------------sizeof(tSirBssDescription)--------------------> + * +--------+---------------------------------+---------------+ + * | length | other fields | pointer to IEs| + * +--------+---------------------------------+---------------+ + * ^ + * ieFields + */ + + ielen = (uint16_t)(pBssDescr->length + sizeof(pBssDescr->length) - + GET_FIELD_OFFSET(tSirBssDescription, ieFields)); + + return ielen; +} + #ifdef WLAN_FEATURE_SAE /** * csr_sae_callback - Update SAE info to CSR roam session @@ -11867,6 +11905,8 @@ csr_roam_chk_lnk_swt_ch_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) QDF_STATUS status; tpSirSmeSwitchChannelInd pSwitchChnInd; struct csr_roam_info roamInfo; + tSirMacDsParamSetIE *ds_params_ie; + tDot11fIEHTInfo *ht_info_ie; /* in case of STA, the SWITCH_CHANNEL originates from its AP */ sme_debug("eWNI_SME_SWITCH_CHL_IND from SME"); @@ -11889,6 +11929,29 @@ csr_roam_chk_lnk_swt_ch_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) (uint8_t) pSwitchChnInd->newChannelId; } + ds_params_ie = (tSirMacDsParamSetIE *)wlan_get_ie_ptr_from_eid( + DOT11F_EID_DSPARAMS, + (uint8_t *)session->pConnectBssDesc-> + ieFields, + csr_get_ielen_from_bss_description( + session->pConnectBssDesc)); + if (ds_params_ie) + ds_params_ie->channelNumber = + (uint8_t)pSwitchChnInd->newChannelId; + + ht_info_ie = (tDot11fIEHTInfo *)wlan_get_ie_ptr_from_eid( + DOT11F_EID_HTINFO, + (uint8_t *)session->pConnectBssDesc-> + ieFields, + csr_get_ielen_from_bss_description( + session->pConnectBssDesc)); + if (ht_info_ie) { + ht_info_ie->primaryChannel = + (uint8_t)pSwitchChnInd->newChannelId; + ht_info_ie->secondaryChannelOffset = + pSwitchChnInd->chan_params.sec_ch_offset; + } + qdf_mem_set(&roamInfo, sizeof(struct csr_roam_info), 0); roamInfo.chan_info.chan_id = pSwitchChnInd->newChannelId; roamInfo.chan_info.ch_width =