From 10054b9f9ed85dfcf23991ecf7191995a884b09e Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Fri, 29 Nov 2019 18:44:14 +0800 Subject: [PATCH] qcacld-3.0: Channel to Freq conversion for channel overlap API Use frequency as parameter for channel overlap handling APIs - csr_check_concurrent_channel_overlap, csr_calc_chb_for_sap_phymode, csr_get_ch_from_ht_profile, csr_handle_conc_chnl_overlap_for_sap_go. Change-Id: Ie3c9d466f21d7313998328432c063b1f6c7e5d0f CRs-Fixed: 2577706 --- core/hdd/src/wlan_hdd_hostapd.c | 11 +- core/mac/inc/sir_api.h | 2 +- core/sap/inc/sap_api.h | 4 +- core/sap/src/sap_fsm.c | 33 +++--- core/sap/src/sap_module.c | 26 +++-- core/sme/inc/csr_internal.h | 2 +- core/sme/inc/sme_api.h | 11 ++ core/sme/src/common/sme_api.c | 22 ++-- core/sme/src/csr/csr_util.c | 185 +++++++++++++++++--------------- 9 files changed, 150 insertions(+), 146 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index c404223d157a..f096d1f7685d 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -3086,7 +3086,6 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart( { mac_handle_t mac_handle; struct hdd_ap_ctx *hdd_ap_ctx; - uint8_t intf_ch = 0, sap_ch = 0; struct hdd_context *hdd_ctx; uint8_t mcc_to_scc_switch = 0; struct ch_params ch_params; @@ -3130,9 +3129,8 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart( */ if (policy_mgr_is_sap_restart_required_after_sta_disconnect( psoc, vdev_id, &intf_ch_freq)) { - intf_ch = wlan_freq_to_chan(intf_ch_freq); hdd_debug("Move the sap (vdev %d) to user configured channel %u", - vdev_id, intf_ch); + vdev_id, intf_ch_freq); goto sap_restart; } @@ -3144,11 +3142,10 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart( * supported, return from here if DBS is not supported. * Need to take care of 3 port cases with 2 STA iface in future. */ - intf_ch = wlansap_check_cc_intf(hdd_ap_ctx->sap_context); - intf_ch_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev, intf_ch); + intf_ch_freq = wlansap_check_cc_intf(hdd_ap_ctx->sap_context); policy_mgr_get_chan_by_session_id(psoc, vdev_id, &sap_ch_freq); hdd_info("sap_vdev %d intf_ch: %d, orig freq: %d", - vdev_id, intf_ch, sap_ch_freq); + vdev_id, intf_ch_freq, sap_ch_freq); if (QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION != mcc_to_scc_switch) { if (QDF_IS_STATUS_ERROR( @@ -3158,8 +3155,6 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart( intf_ch_freq); return QDF_STATUS_E_FAILURE; } - sap_ch = wlan_freq_to_chan(sap_ch_freq); - intf_ch = wlan_freq_to_chan(intf_ch_freq); } sap_restart: diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 0cfdf78cef2f..b06bf29a9fc0 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -2759,7 +2759,7 @@ typedef struct sSirChanChangeRequest { typedef struct sSirChanChangeResponse { uint8_t sessionId; - uint8_t new_op_freq; + uint32_t new_op_freq; uint8_t channelChangeStatus; } tSirChanChangeResponse, *tpSirChanChangeResponse; diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 83bdc7c97885..b6294e12cd42 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -865,9 +865,9 @@ QDF_STATUS wlan_sap_get_pre_cac_vdev_id(mac_handle_t handle, uint8_t *vdev_id); * wlansap_check_cc_intf() - Get interfering concurrent channel * @sap_ctx: SAP context pointer * - * Determine if a Concurrent Channel is interfering. + * Determine if a concurrent channel is interfering. * - * Return: Channel number of the interfering channel, or 0 if none. + * Return: Channel freq (Mhz) of the interfering channel, or 0 if none. */ uint16_t wlansap_check_cc_intf(struct sap_context *sap_ctx); #endif diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 4bbcaf7a81b6..fd78e8015a68 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -708,13 +708,12 @@ sap_validate_chan(struct sap_context *sap_context, QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; struct mac_context *mac_ctx; mac_handle_t mac_handle; - uint8_t con_ch; + uint32_t con_ch_freq; bool sta_sap_scc_on_dfs_chan; uint32_t sta_go_bit_mask = QDF_STA_MASK | QDF_P2P_GO_MASK; uint32_t sta_sap_bit_mask = QDF_STA_MASK | QDF_SAP_MASK; uint32_t concurrent_state; bool go_force_scc; - uint8_t sap_ch; mac_handle = cds_get_context(QDF_MODULE_ID_SME); mac_ctx = MAC_CONTEXT(mac_handle); @@ -735,13 +734,13 @@ sap_validate_chan(struct sap_context *sap_context, (wlan_vdev_mlme_get_opmode(sap_context->vdev) == QDF_P2P_GO_MODE)) goto validation_done; - sap_ch = wlan_reg_freq_to_chan(mac_ctx->pdev, sap_context->chan_freq); concurrent_state = policy_mgr_get_concurrency_mode(mac_ctx->psoc); if (policy_mgr_concurrent_beaconing_sessions_running(mac_ctx->psoc) || ((concurrent_state & sta_sap_bit_mask) == sta_sap_bit_mask) || ((concurrent_state & sta_go_bit_mask) == sta_go_bit_mask)) { #ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE - if (wlan_reg_is_dfs_ch(mac_ctx->pdev, sap_ch)) { + if (wlan_reg_is_dfs_for_freq(mac_ctx->pdev, + sap_context->chan_freq)) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_WARN, FL("DFS not supported in STA_AP Mode")); return QDF_STATUS_E_ABORTED; @@ -754,18 +753,16 @@ sap_validate_chan(struct sap_context *sap_context, FL("check for overlap: chan freq:%d mode:%d"), sap_context->chan_freq, sap_context->csr_roamProfile.phyMode); - con_ch = sme_check_concurrent_channel_overlap( + con_ch_freq = sme_check_concurrent_channel_overlap( mac_handle, sap_context->chan_freq, sap_context->csr_roamProfile.phyMode, sap_context->cc_switch_mode); QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG, FL("After check overlap: con_ch:%d"), - con_ch); + con_ch_freq); if (sap_context->cc_switch_mode != QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) { - uint32_t con_ch_freq = - wlan_reg_chan_to_freq(mac_ctx->pdev, con_ch); if (QDF_IS_STATUS_ERROR( policy_mgr_valid_sap_conc_channel_check( mac_ctx->psoc, &con_ch_freq, @@ -776,33 +773,31 @@ sap_validate_chan(struct sap_context *sap_context, FL("SAP can't start (no MCC)")); return QDF_STATUS_E_ABORTED; } - con_ch = wlan_freq_to_chan(con_ch_freq); } QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG, FL("After check concurrency: con_ch:%d"), - con_ch); + con_ch_freq); sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan( mac_ctx->psoc); - if (con_ch && + if (con_ch_freq && (policy_mgr_sta_sap_scc_on_lte_coex_chan( - mac_ctx->psoc) || - policy_mgr_is_safe_channel( - mac_ctx->psoc, wlan_chan_to_freq(con_ch))) && - (!wlan_reg_is_dfs_ch(mac_ctx->pdev, con_ch) || + mac_ctx->psoc) || + policy_mgr_is_safe_channel( + mac_ctx->psoc, con_ch_freq)) && + (!wlan_reg_is_dfs_for_freq( + mac_ctx->pdev, con_ch_freq) || sta_sap_scc_on_dfs_chan)) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, "%s: Override ch freq %d to %d due to CC Intf", __func__, sap_context->chan_freq, - con_ch); - sap_context->chan_freq = wlan_reg_chan_to_freq( - mac_ctx->pdev, con_ch); + con_ch_freq); + sap_context->chan_freq = con_ch_freq; if (WLAN_REG_IS_24GHZ_CH_FREQ( sap_context->chan_freq)) sap_context->ch_params.ch_width = CH_WIDTH_20MHZ; - wlan_reg_set_channel_params_for_freq( mac_ctx->pdev, sap_context->chan_freq, diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index c35a71314f26..d1e88733893b 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -485,7 +485,7 @@ bool wlansap_is_channel_leaking_in_nol(struct sap_context *sap_ctx, uint16_t wlansap_check_cc_intf(struct sap_context *sap_ctx) { struct mac_context *mac; - uint16_t intf_ch; + uint16_t intf_ch_freq; eCsrPhyMode phy_mode; mac = sap_get_mac_context(); @@ -494,11 +494,12 @@ uint16_t wlansap_check_cc_intf(struct sap_context *sap_ctx) return 0; } phy_mode = sap_ctx->csr_roamProfile.phyMode; - intf_ch = sme_check_concurrent_channel_overlap(MAC_HANDLE(mac), - sap_ctx->chan_freq, - phy_mode, - sap_ctx->cc_switch_mode); - return intf_ch; + intf_ch_freq = sme_check_concurrent_channel_overlap( + MAC_HANDLE(mac), + sap_ctx->chan_freq, + phy_mode, + sap_ctx->cc_switch_mode); + return intf_ch_freq; } #endif @@ -3153,10 +3154,9 @@ err: qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx) { - uint8_t restart_chan; uint32_t restart_freq; enum phy_ch_width restart_ch_width; - uint8_t intf_ch; + uint16_t intf_ch_freq; uint32_t phy_mode; struct mac_context *mac; uint8_t cc_mode; @@ -3204,20 +3204,18 @@ qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx) return 0; } - restart_chan = wlan_reg_freq_to_chan(mac->pdev, restart_freq); cc_mode = sap_ctx->cc_switch_mode; phy_mode = sap_ctx->csr_roamProfile.phyMode; - intf_ch = sme_check_concurrent_channel_overlap(MAC_HANDLE(mac), + intf_ch_freq = sme_check_concurrent_channel_overlap( + MAC_HANDLE(mac), restart_freq, phy_mode, cc_mode); - if (intf_ch) - restart_chan = intf_ch; + if (intf_ch_freq) + restart_freq = intf_ch_freq; vdev_id = sap_ctx->vdev->vdev_objmgr.vdev_id; - restart_freq = wlan_reg_chan_to_freq(mac->pdev, restart_chan); sap_debug("vdev: %d, CSA target freq: %d", vdev_id, restart_freq); sap_ctx->csa_reason = CSA_REASON_BAND_RESTRICTED; - return restart_freq; } diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index 5dc4aae53679..1d502c84fa7d 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -1004,7 +1004,7 @@ uint32_t csr_get_beaconing_concurrent_channel(struct mac_context *mac_ctx, #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH uint16_t csr_check_concurrent_channel_overlap( struct mac_context *mac, - uint16_t sap_ch, eCsrPhyMode sap_phymode, + uint32_t sap_ch_freq, eCsrPhyMode sap_phymode, uint8_t cc_switch_mode); #endif QDF_STATUS csr_roam_copy_connect_profile(struct mac_context *mac, diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index adec3a0c4fc7..63f58945d0ba 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -768,6 +768,17 @@ QDF_STATUS sme_configure_app_type2_params(mac_handle_t mac_handle, uint32_t sme_get_beaconing_concurrent_operation_channel(mac_handle_t mac_handle, uint8_t vdev_id_to_skip); #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH +/** + * sme_check_concurrent_channel_overlap() - Get interfering concurrent channel + * @mac_handle: SAP context pointer + * @sap_ch_freq: SAP home channel frequency + * @sapPhyMode: sap phymode + * @cc_switch_mode: force scc channel switch mode + * + * Determine if a concurrent channel is interfering. + * + * Return: Channel freq (Mhz) of the interfering channel, or 0 if none. + */ uint16_t sme_check_concurrent_channel_overlap(mac_handle_t mac_handle, uint16_t sap_ch_freq, eCsrPhyMode sapPhyMode, diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index e6994358116a..17f1719e1662 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -5141,20 +5141,16 @@ uint16_t sme_check_concurrent_channel_overlap(mac_handle_t mac_handle, { QDF_STATUS status = QDF_STATUS_E_FAILURE; struct mac_context *mac = MAC_CONTEXT(mac_handle); - uint16_t channel = 0; + uint16_t intf_ch_freq = 0; status = sme_acquire_global_lock(&mac->sme); if (QDF_IS_STATUS_SUCCESS(status)) { - channel = csr_check_concurrent_channel_overlap(mac, - wlan_reg_freq_to_chan( - mac->pdev, - sap_ch_freq), - sapPhyMode, - cc_switch_mode); + intf_ch_freq = csr_check_concurrent_channel_overlap( + mac, sap_ch_freq, sapPhyMode, cc_switch_mode); sme_release_global_lock(&mac->sme); } - return channel; + return intf_ch_freq; } #endif @@ -10971,7 +10967,7 @@ bool sme_validate_sap_channel_switch(mac_handle_t mac_handle, QDF_STATUS status = QDF_STATUS_E_FAILURE; struct mac_context *mac = MAC_CONTEXT(mac_handle); struct csr_roam_session *session = CSR_GET_SESSION(mac, session_id); - uint16_t intf_channel = 0; + uint16_t intf_channel_freq = 0; if (!session) return false; @@ -10979,10 +10975,8 @@ bool sme_validate_sap_channel_switch(mac_handle_t mac_handle, session->ch_switch_in_progress = true; status = sme_acquire_global_lock(&mac->sme); if (QDF_IS_STATUS_SUCCESS(status)) { - intf_channel = csr_check_concurrent_channel_overlap(mac, - wlan_reg_freq_to_chan(mac->pdev, sap_ch_freq), - sap_phy_mode, - cc_switch_mode); + intf_channel_freq = csr_check_concurrent_channel_overlap( + mac, sap_ch_freq, sap_phy_mode, cc_switch_mode); sme_release_global_lock(&mac->sme); } else { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, @@ -10992,7 +10986,7 @@ bool sme_validate_sap_channel_switch(mac_handle_t mac_handle, } session->ch_switch_in_progress = false; - return (intf_channel == 0) ? true : false; + return (intf_channel_freq == 0) ? true : false; } #endif diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index 159e14c6bacb..f3d2a86ef4da 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -764,19 +764,19 @@ uint32_t csr_get_beaconing_concurrent_channel(struct mac_context *mac_ctx, /* calculation of center channel based on V/HT BW and WIFI channel bw=5MHz) */ -#define CSR_GET_HT40_PLUS_CCH(och) ((och)+2) -#define CSR_GET_HT40_MINUS_CCH(och) ((och)-2) +#define CSR_GET_HT40_PLUS_CCH(och) ((och) + 10) +#define CSR_GET_HT40_MINUS_CCH(och) ((och) - 10) -#define CSR_GET_HT80_PLUS_LL_CCH(och) ((och)+6) -#define CSR_GET_HT80_PLUS_HL_CCH(och) ((och)+2) -#define CSR_GET_HT80_MINUS_LH_CCH(och) ((och)-2) -#define CSR_GET_HT80_MINUS_HH_CCH(och) ((och)-6) +#define CSR_GET_HT80_PLUS_LL_CCH(och) ((och) + 30) +#define CSR_GET_HT80_PLUS_HL_CCH(och) ((och) + 30) +#define CSR_GET_HT80_MINUS_LH_CCH(och) ((och) - 10) +#define CSR_GET_HT80_MINUS_HH_CCH(och) ((och) - 30) /** * csr_get_ch_from_ht_profile() - to get channel from HT profile * @mac: pointer to Mac context * @htp: pointer to HT profile - * @och: operating channel + * @och_freq: operating channel frequency * @cfreq: channel frequency * @hbw: half bandwidth * @@ -787,17 +787,17 @@ uint32_t csr_get_beaconing_concurrent_channel(struct mac_context *mac_ctx, */ static void csr_get_ch_from_ht_profile(struct mac_context *mac, tCsrRoamHTProfile *htp, - uint16_t och, uint16_t *cfreq, - uint16_t *hbw) + uint32_t och_freq, uint32_t *cfreq, + uint32_t *hbw) { - uint16_t cch, ch_bond; + uint32_t ch_bond; + struct ch_params chan_params = {0}; - if (och > 14) + if (!WLAN_REG_IS_24GHZ_CH_FREQ(och_freq)) ch_bond = mac->roam.configParam.channelBondingMode5GHz; else ch_bond = mac->roam.configParam.channelBondingMode24GHz; - cch = och; *hbw = HALF_BW_OF(eCSR_BW_20MHz_VAL); if (!ch_bond) @@ -811,7 +811,6 @@ static void csr_get_ch_from_ht_profile(struct mac_context *mac, ); if (htp->vhtCapability) { - cch = htp->apCenterChan; if (htp->apChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) *hbw = HALF_BW_OF(eCSR_BW_80MHz_VAL); else if (htp->apChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ) @@ -828,20 +827,29 @@ static void csr_get_ch_from_ht_profile(struct mac_context *mac, if (htp->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_40MHZ) { *hbw = HALF_BW_OF(eCSR_BW_40MHz_VAL); - if (htp->htSecondaryChannelOffset == - PHY_DOUBLE_CHANNEL_LOW_PRIMARY) - cch = CSR_GET_HT40_PLUS_CCH(och); - else if (htp->htSecondaryChannelOffset == - PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) - cch = CSR_GET_HT40_MINUS_CCH(och); } else { - cch = och; *hbw = HALF_BW_OF(eCSR_BW_20MHz_VAL); } } - ret: - *cfreq = cds_chan_to_freq(cch); + switch (*hbw * 2) { + case eCSR_BW_40MHz_VAL: + chan_params.ch_width = CH_WIDTH_40MHZ; + break; + case eCSR_BW_80MHz_VAL: + chan_params.ch_width = CH_WIDTH_80MHZ; + break; + case eCSR_BW_160MHz_VAL: + chan_params.ch_width = CH_WIDTH_160MHZ; + break; + default: + chan_params.ch_width = CH_WIDTH_20MHZ; + break; + } + wlan_reg_set_channel_params_for_freq(mac->pdev, och_freq, 0, + &chan_params); + + *cfreq = chan_params.mhz_freq_seg0; } /** @@ -858,8 +866,8 @@ ret: * Return: none */ static void csr_calc_chb_for_sap_phymode(struct mac_context *mac_ctx, - uint16_t *sap_ch, eCsrPhyMode *sap_phymode, - uint16_t *sap_cch, uint16_t *sap_hbw, uint8_t *chb) + uint32_t *sap_ch, eCsrPhyMode *sap_phymode, + uint32_t *sap_cch, uint32_t *sap_hbw, uint8_t *chb) { if (*sap_phymode == eCSR_DOT11_MODE_11n || *sap_phymode == eCSR_DOT11_MODE_11n_ONLY) { @@ -918,10 +926,10 @@ static void csr_calc_chb_for_sap_phymode(struct mac_context *mac_ctx, * csr_handle_conc_chnl_overlap_for_sap_go - To handle overlap for AP+AP * @mac_ctx: pointer to mac context * @session: Current session - * @sap_ch: SAP/GO operating channel + * @sap_ch_freq: SAP/GO operating channel frequency * @sap_hbw: SAP/GO half bw * @sap_cfreq: SAP/GO channel frequency - * @intf_ch: concurrent SAP/GO operating channel + * @intf_ch_freq: concurrent SAP/GO operating channel frequency * @intf_hbw: concurrent SAP/GO half bw * @intf_cfreq: concurrent SAP/GO channel frequency * @@ -930,15 +938,16 @@ static void csr_calc_chb_for_sap_phymode(struct mac_context *mac_ctx, * * Return: none */ -static void csr_handle_conc_chnl_overlap_for_sap_go(struct mac_context *mac_ctx, +static void csr_handle_conc_chnl_overlap_for_sap_go( + struct mac_context *mac_ctx, struct csr_roam_session *session, - uint16_t *sap_ch, uint16_t *sap_hbw, uint16_t *sap_cfreq, - uint16_t *intf_ch, uint16_t *intf_hbw, uint16_t *intf_cfreq) + uint32_t *sap_ch_freq, uint32_t *sap_hbw, uint32_t *sap_cfreq, + uint32_t *intf_ch_freq, uint32_t *intf_hbw, + uint32_t *intf_cfreq) { - uint8_t op_chan; + uint32_t op_chan_freq; - op_chan = wlan_reg_freq_to_chan(mac_ctx->pdev, - session->connectedProfile.op_freq); + op_chan_freq = session->connectedProfile.op_freq; /* * if conc_custom_rule1 is defined then we don't * want p2pgo to follow SAP's channel or SAP to @@ -946,24 +955,24 @@ static void csr_handle_conc_chnl_overlap_for_sap_go(struct mac_context *mac_ctx, */ if (0 == mac_ctx->roam.configParam.conc_custom_rule1 && 0 == mac_ctx->roam.configParam.conc_custom_rule2) { - if (*sap_ch == 0) { - *sap_ch = op_chan; + if (*sap_ch_freq == 0) { + *sap_ch_freq = op_chan_freq; csr_get_ch_from_ht_profile(mac_ctx, &session->connectedProfile.ht_profile, - *sap_ch, sap_cfreq, sap_hbw); - } else if (*sap_ch != op_chan) { - *intf_ch = op_chan; + *sap_ch_freq, sap_cfreq, sap_hbw); + } else if (*sap_ch_freq != op_chan_freq) { + *intf_ch_freq = op_chan_freq; csr_get_ch_from_ht_profile(mac_ctx, &session->connectedProfile.ht_profile, - *intf_ch, intf_cfreq, intf_hbw); + *intf_ch_freq, intf_cfreq, intf_hbw); } - } else if (*sap_ch == 0 && + } else if (*sap_ch_freq == 0 && (session->pCurRoamProfile->csrPersona == QDF_SAP_MODE)) { - *sap_ch = op_chan; + *sap_ch_freq = op_chan_freq; csr_get_ch_from_ht_profile(mac_ctx, &session->connectedProfile.ht_profile, - *sap_ch, sap_cfreq, sap_hbw); + *sap_ch_freq, sap_cfreq, sap_hbw); } } @@ -980,40 +989,39 @@ static void csr_handle_conc_chnl_overlap_for_sap_go(struct mac_context *mac_ctx, * Return: uint16_t */ uint16_t csr_check_concurrent_channel_overlap(struct mac_context *mac_ctx, - uint16_t sap_ch, eCsrPhyMode sap_phymode, + uint32_t sap_ch_freq, eCsrPhyMode sap_phymode, uint8_t cc_switch_mode) { struct csr_roam_session *session = NULL; uint8_t i = 0, chb = PHY_SINGLE_CHANNEL_CENTERED; - uint16_t intf_ch = 0, sap_hbw = 0, intf_hbw = 0, intf_cfreq = 0; - uint16_t sap_cfreq = 0; - uint16_t sap_lfreq, sap_hfreq, intf_lfreq, intf_hfreq, sap_cch = 0; + uint32_t intf_ch_freq = 0, sap_hbw = 0, intf_hbw = 0, intf_cfreq = 0; + uint32_t sap_cfreq = 0; + uint32_t sap_lfreq, sap_hfreq, intf_lfreq, intf_hfreq; QDF_STATUS status; - uint32_t intf_ch_freq; - sme_debug("sap_ch: %d sap_phymode: %d", sap_ch, sap_phymode); + sme_debug("sap_ch_freq: %d sap_phymode: %d", sap_ch_freq, sap_phymode); if (mac_ctx->roam.configParam.cc_switch_mode == QDF_MCC_TO_SCC_SWITCH_DISABLE) return 0; - if (sap_ch != 0) { - sap_cch = sap_ch; + if (sap_ch_freq != 0) { + sap_cfreq = sap_ch_freq; sap_hbw = HALF_BW_OF(eCSR_BW_20MHz_VAL); - if (sap_ch > 14) + if (!WLAN_REG_IS_24GHZ_CH_FREQ(sap_ch_freq)) chb = mac_ctx->roam.configParam.channelBondingMode5GHz; else chb = mac_ctx->roam.configParam.channelBondingMode24GHz; if (chb) - csr_calc_chb_for_sap_phymode(mac_ctx, &sap_ch, - &sap_phymode, &sap_cch, &sap_hbw, &chb); - sap_cfreq = cds_chan_to_freq(sap_cch); + csr_calc_chb_for_sap_phymode(mac_ctx, &sap_ch_freq, + &sap_phymode, &sap_cfreq, + &sap_hbw, &chb); } sme_debug("sap_ch:%d sap_phymode:%d sap_cch:%d sap_hbw:%d chb:%d", - sap_ch, sap_phymode, sap_cch, sap_hbw, chb); + sap_ch_freq, sap_phymode, sap_cfreq, sap_hbw, chb); for (i = 0; i < WLAN_MAX_VDEVS; i++) { if (!CSR_IS_SESSION_VALID(mac_ctx, i)) @@ -1027,14 +1035,12 @@ uint16_t csr_check_concurrent_channel_overlap(struct mac_context *mac_ctx, QDF_P2P_CLIENT_MODE)) && (session->connectState == eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED)) { - intf_ch = wlan_reg_freq_to_chan( - mac_ctx->pdev, - session->connectedProfile.op_freq); + intf_ch_freq = session->connectedProfile.op_freq; csr_get_ch_from_ht_profile(mac_ctx, &session->connectedProfile.ht_profile, - intf_ch, &intf_cfreq, &intf_hbw); + intf_ch_freq, &intf_cfreq, &intf_hbw); sme_debug("%d: intf_ch:%d intf_cfreq:%d intf_hbw:%d", - i, intf_ch, intf_cfreq, intf_hbw); + i, intf_ch_freq, intf_cfreq, intf_hbw); } else if (((session->pCurRoamProfile->csrPersona == QDF_P2P_GO_MODE) || (session->pCurRoamProfile->csrPersona == @@ -1045,49 +1051,55 @@ uint16_t csr_check_concurrent_channel_overlap(struct mac_context *mac_ctx, continue; csr_handle_conc_chnl_overlap_for_sap_go(mac_ctx, - session, &sap_ch, &sap_hbw, &sap_cfreq, - &intf_ch, &intf_hbw, &intf_cfreq); + session, &sap_ch_freq, &sap_hbw, + &sap_cfreq, &intf_ch_freq, &intf_hbw, + &intf_cfreq); - sme_debug("%d: sap_ch:%d sap_hbw:%d sap_cfreq:%d intf_ch:%d intf_hbw:%d, intf_cfreq:%d", - i, sap_ch, sap_hbw, sap_cfreq, - intf_ch, intf_hbw, intf_cfreq); + sme_debug("%d: sap_ch:%d sap_hbw:%d sap_cfreq:%d" + " intf_ch:%d intf_hbw:%d, intf_cfreq:%d", + i, sap_ch_freq, sap_hbw, sap_cfreq, + intf_ch_freq, intf_hbw, intf_cfreq); } - if (intf_ch && ((intf_ch > 14 && sap_ch > 14) || - (intf_ch <= 14 && sap_ch <= 14))) + if (intf_ch_freq && + ((intf_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_2484) && + sap_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_2484)) || + (intf_ch_freq > wlan_reg_ch_to_freq(CHAN_ENUM_2484) && + sap_ch_freq > wlan_reg_ch_to_freq(CHAN_ENUM_2484)))) break; } sme_debug("intf_ch:%d sap_ch:%d cc_switch_mode:%d, dbs:%d", - intf_ch, sap_ch, cc_switch_mode, + intf_ch_freq, sap_ch_freq, cc_switch_mode, policy_mgr_is_dbs_enable(mac_ctx->psoc)); - if (intf_ch && sap_ch != intf_ch && + if (intf_ch_freq && sap_ch_freq != intf_ch_freq && !policy_mgr_is_force_scc(mac_ctx->psoc)) { sap_lfreq = sap_cfreq - sap_hbw; sap_hfreq = sap_cfreq + sap_hbw; intf_lfreq = intf_cfreq - intf_hbw; intf_hfreq = intf_cfreq + intf_hbw; - sme_err("SAP: OCH: %03d OCF: %d CCH: %03d CF: %d BW: %d LF: %d HF: %d INTF: OCH: %03d OCF: %d CCH: %03d CF: %d BW: %d LF: %d HF: %d", - sap_ch, cds_chan_to_freq(sap_ch), - cds_freq_to_chan(sap_cfreq), sap_cfreq, sap_hbw * 2, - sap_lfreq, sap_hfreq, intf_ch, - cds_chan_to_freq(intf_ch), cds_freq_to_chan(intf_cfreq), + sme_err("SAP: OCH: %03d CCH: %03d BW: %d LF: %d HF: %d" + " INTF: OCH: %03d CF: %d BW: %d LF: %d HF: %d", + sap_ch_freq, sap_cfreq, sap_hbw * 2, + sap_lfreq, sap_hfreq, intf_ch_freq, intf_cfreq, intf_hbw * 2, intf_lfreq, intf_hfreq); if (!(((sap_lfreq > intf_lfreq && sap_lfreq < intf_hfreq) || (sap_hfreq > intf_lfreq && sap_hfreq < intf_hfreq)) || ((intf_lfreq > sap_lfreq && intf_lfreq < sap_hfreq) || (intf_hfreq > sap_lfreq && intf_hfreq < sap_hfreq)))) - intf_ch = 0; - } else if (intf_ch && sap_ch != intf_ch && - (policy_mgr_is_force_scc(mac_ctx->psoc))) { - if (!((intf_ch <= 14 && sap_ch <= 14) || - (intf_ch > 14 && sap_ch > 14))) { + intf_ch_freq = 0; + } else if (intf_ch_freq && sap_ch_freq != intf_ch_freq && + (policy_mgr_is_force_scc(mac_ctx->psoc))) { + if (!((intf_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_2484) && + sap_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_2484)) || + (intf_ch_freq > wlan_reg_ch_to_freq(CHAN_ENUM_2484) && + sap_ch_freq > wlan_reg_ch_to_freq(CHAN_ENUM_2484)))) { if (policy_mgr_is_dbs_enable(mac_ctx->psoc) || cc_switch_mode == QDF_MCC_TO_SCC_WITH_PREFERRED_BAND) - intf_ch = 0; + intf_ch_freq = 0; } else if (cc_switch_mode == QDF_MCC_TO_SCC_SWITCH_WITH_FAVORITE_CHANNEL) { status = policy_mgr_get_sap_mandatory_channel( @@ -1095,26 +1107,25 @@ uint16_t csr_check_concurrent_channel_overlap(struct mac_context *mac_ctx, &intf_ch_freq); if (QDF_IS_STATUS_ERROR(status)) sme_err("no mandatory channel"); - intf_ch = wlan_freq_to_chan(intf_ch_freq); } - } else if ((intf_ch == sap_ch) && (cc_switch_mode == + } else if ((intf_ch_freq == sap_ch_freq) && (cc_switch_mode == QDF_MCC_TO_SCC_SWITCH_WITH_FAVORITE_CHANNEL)) { - if (cds_chan_to_band(intf_ch) == CDS_BAND_2GHZ) { + if (WLAN_REG_IS_24GHZ_CH_FREQ(intf_ch_freq)) { status = policy_mgr_get_sap_mandatory_channel( mac_ctx->psoc, &intf_ch_freq); if (QDF_IS_STATUS_ERROR(status)) sme_err("no mandatory channel"); - intf_ch = wlan_freq_to_chan(intf_ch_freq); } } - if (intf_ch == sap_ch) - intf_ch = 0; + if (intf_ch_freq == sap_ch_freq) + intf_ch_freq = 0; sme_err("##Concurrent Channels %s Interfering", - intf_ch == 0 ? "Not" : "Are"); - return intf_ch; + intf_ch_freq == 0 ? "Not" : "Are"); + + return intf_ch_freq; } #endif