diff --git a/Kbuild b/Kbuild index 92df1223d19f..6247d447b43e 100644 --- a/Kbuild +++ b/Kbuild @@ -3011,6 +3011,7 @@ cppflags-$(CONFIG_LTE_COEX) += -DLTE_COEX #Flag to enable/disable HOST_OPCLASS cppflags-$(CONFIG_HOST_OPCLASS) += -DHOST_OPCLASS +cppflags-$(CONFIG_HOST_OPCLASS) += -DHOST_OPCLASS_EXT #Flag to enable/disable TARGET_11D_SCAN cppflags-$(CONFIG_TARGET_11D_SCAN) += -DTARGET_11D_SCAN diff --git a/configs/qcs40x.snoc.perf_defconfig b/configs/qcs40x.snoc.perf_defconfig index 6d87eeceb127..0dd909d814c0 100644 --- a/configs/qcs40x.snoc.perf_defconfig +++ b/configs/qcs40x.snoc.perf_defconfig @@ -26,6 +26,7 @@ CONFIG_AGEIE_ON_SCAN_RESULTS := y CONFIG_CONVERGED_P2P_ENABLE := y CONFIG_WLAN_POLICY_MGR_ENABLE := y CONFIG_SUPPORT_11AX := n +CONFIG_HOST_OPCLASS := y CONFIG_HDD_INIT_WITH_RTNL_LOCK := y CONFIG_CONVERGED_TDLS_ENABLE := y CONFIG_WLAN_CONV_SPECTRAL_ENABLE := y diff --git a/core/mac/src/pe/rrm/rrm_api.c b/core/mac/src/pe/rrm/rrm_api.c index f24dc24344c2..ef60356811e1 100644 --- a/core/mac/src/pe/rrm/rrm_api.c +++ b/core/mac/src/pe/rrm/rrm_api.c @@ -465,6 +465,44 @@ rrm_process_neighbor_report_req(struct mac_context *mac, return status; } +/** + * rrm_get_country_code_from_connected_profile() - Get country code + * from connected profile + * @mac: Mac context + * @pe_session: pe session + * @country_code: country code + * + * Return: void + */ +static inline void +rrm_get_country_code_from_connected_profile( + struct mac_context *mac, + struct pe_session *pe_session, + uint8_t country_code[WNI_CFG_COUNTRY_CODE_LEN]) +{ + uint8_t id; + uint8_t *country; + + qdf_mem_zero(country_code, sizeof(country_code[0]) * + WNI_CFG_COUNTRY_CODE_LEN); + if (!pe_session) { + pe_err("pe_session is NULL"); + return; + } + id = pe_session->smeSessionId; + if (!CSR_IS_SESSION_VALID(mac, id)) { + pe_err("smeSessionId %d is invalid", id); + return; + } + country = + mac->roam.roamSession[id].connectedProfile.country_code; + if (country[0]) + qdf_mem_copy(country_code, country, sizeof(country_code[0]) * + WNI_CFG_COUNTRY_CODE_LEN); + else + country_code[2] = OP_CLASS_GLOBAL; +} + #define ABS(x) ((x < 0) ? -x : x) /* -------------------------------------------------------------------- */ /** @@ -501,6 +539,12 @@ rrm_process_beacon_report_req(struct mac_context *mac, char req_ssid[WLAN_SSID_MAX_LEN] = {0}; char ch_buf[RRM_CH_BUF_LEN]; char *tmp_buf = NULL; + uint8_t country[WNI_CFG_COUNTRY_CODE_LEN]; + + if (!pe_session) { + pe_err("pe_session is NULL"); + return eRRM_INCAPABLE; + } if (pBeaconReq->measurement_request.Beacon.BeaconReporting.present && (pBeaconReq->measurement_request.Beacon.BeaconReporting. @@ -625,14 +669,36 @@ rrm_process_beacon_report_req(struct mac_context *mac, return eRRM_FAILURE; } + rrm_get_country_code_from_connected_profile(mac, pe_session, + country); psbrr->channel_info.chan_num = pBeaconReq->measurement_request.Beacon.channel; psbrr->channel_info.reg_class = pBeaconReq->measurement_request.Beacon.regClass; - psbrr->channel_info.chan_freq = - wlan_reg_chan_opclass_to_freq(psbrr->channel_info.chan_num, - psbrr->channel_info.reg_class, - false); + if (psbrr->channel_info.chan_num && + psbrr->channel_info.chan_num != 255) { + psbrr->channel_info.chan_freq = + wlan_reg_country_chan_opclass_to_freq( + mac->pdev, + country, + psbrr->channel_info.chan_num, + psbrr->channel_info.reg_class, + false); + if (!psbrr->channel_info.chan_freq) { + pe_debug("invalid ch freq, chan_num %d", + psbrr->channel_info.chan_num); + qdf_mem_free(psbrr); + return eRRM_FAILURE; + } + } else { + psbrr->channel_info.chan_freq = 0; + } + sme_debug("opclass %d, ch %d freq %d AP's country code %c%c 0x%x", + psbrr->channel_info.reg_class, + psbrr->channel_info.chan_num, + psbrr->channel_info.chan_freq, + country[0], country[1], country[2]); + psbrr->measurementDuration[0] = measDuration; psbrr->fMeasurementtype[0] = pBeaconReq->measurement_request.Beacon.meas_mode;