From b1954c63bc3e5c7653cfa57a30d2027f7a43de23 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Thu, 14 Feb 2019 10:18:28 +0530 Subject: [PATCH] qcacld-3.0: Force P2PGO to SCC only if other beacon entity is active In case SAP+P2PGO+STA interface are present, with SAP in down state and STA in conencted state and P2PGO is started, it uses API policy_mgr_concurrent_beaconing_sessions_running checks if multiple beaconing interface are present to force the P2PGO to SCC or DBS channel and as SAP and P2PGO interface are present it returns true. Now the API to get concurrent channel get the channel of STA which is active and thus P2PGO moves to STA channel. Thus use the api to get channel for concurrent beaconing interface instead of any interface to take care of beaconing interface concurrency scenareos. With this concurrent channel will be non 0 only if any other beaconing entity is present and in up state and thus P2PGO will move to SCC or DBS only in case any other beaconing interface is actually up and beaconing on a channel. Change-Id: Ic4bacc8cc45386499c11e09e79d095e926318400 CRs-Fixed: 2395530 --- core/sap/src/sap_fsm.c | 17 +++++++++++------ core/sme/inc/csr_internal.h | 28 +++++++++++++++++++++++++-- core/sme/inc/sme_api.h | 15 ++++++++++++++- core/sme/src/common/sme_api.c | 14 ++++++-------- core/sme/src/csr/csr_util.c | 36 +++++++++++++++++++++++++---------- 5 files changed, 83 insertions(+), 27 deletions(-) diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 6c13a5bad9ec..8469ce7fd37a 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -541,7 +541,9 @@ void sap_dfs_set_current_channel(void *ctx) uint16_t con_ch; mac_handle_t handle = MAC_HANDLE(mac_ctx); - con_ch = sme_get_concurrent_operation_channel(handle); + con_ch = + sme_get_beaconing_concurrent_operation_channel( + handle, sap_ctx->sessionId); if (!con_ch || !wlan_reg_is_dfs_ch(pdev, con_ch)) tgt_dfs_get_radars(pdev); } else { @@ -758,7 +760,8 @@ sap_validate_chan(struct sap_context *sap_context, policy_mgr_mode_specific_connection_count(mac_ctx->psoc, PM_P2P_GO_MODE, NULL)))) { con_ch = - sme_get_concurrent_operation_channel(mac_handle); + sme_get_beaconing_concurrent_operation_channel( + mac_handle, sap_context->sessionId); #ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE if (con_ch && sap_context->channel != con_ch && wlan_reg_is_dfs_ch(mac_ctx->pdev, @@ -769,8 +772,8 @@ sap_validate_chan(struct sap_context *sap_context, } #endif #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH - if (sap_context->cc_switch_mode != - QDF_MCC_TO_SCC_SWITCH_DISABLE) { + if (con_ch && (sap_context->cc_switch_mode != + QDF_MCC_TO_SCC_SWITCH_DISABLE)) { /* * For ACS request ,the sapContext->channel is 0, * we skip below overlap checking. When the ACS @@ -956,7 +959,8 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context) policy_mgr_mode_specific_connection_count(mac_ctx->psoc, PM_P2P_GO_MODE, NULL)))) { - con_ch = sme_get_concurrent_operation_channel(mac_handle); + con_ch = sme_get_beaconing_concurrent_operation_channel( + mac_handle, sap_context->sessionId); #ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE if (con_ch) sap_context->dfs_ch_disable = true; @@ -2087,7 +2091,8 @@ sap_goto_starting(struct sap_context *sap_ctx, if (policy_mgr_concurrent_beaconing_sessions_running(mac_ctx->psoc)) { uint16_t con_ch; - con_ch = sme_get_concurrent_operation_channel(mac_handle); + con_ch = sme_get_beaconing_concurrent_operation_channel( + mac_handle, sap_ctx->sessionId); if (con_ch && wlan_reg_is_dfs_ch(mac_ctx->pdev, con_ch)) { sap_ctx->channel = con_ch; wlan_reg_set_channel_params(mac_ctx->pdev, diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index 40b16cc3e62b..73152b197025 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -969,8 +969,32 @@ uint8_t csr_get_infra_operation_channel(struct mac_context *mac, uint8_t sessionId); bool csr_is_session_client_and_connected(struct mac_context *mac, uint8_t sessionId); -uint8_t csr_get_concurrent_operation_channel( - struct mac_context *mac); +/** + * csr_get_concurrent_operation_channel() - To get concurrent operating channel + * @mac_ctx: Pointer to mac context + * + * This routine will return operating channel on FIRST BSS that is + * active/operating to be used for concurrency mode. + * If other BSS is not up or not connected it will return 0 + * + * Return: uint8_t + */ +uint8_t csr_get_concurrent_operation_channel(struct mac_context *mac_ctx); + +/** + * csr_get_beaconing_concurrent_channel() - To get concurrent operating channel + * of beaconing interface + * @mac_ctx: Pointer to mac context + * @vdev_id_to_skip: channel of which vdev id to skip + * + * This routine will return operating channel of active AP/GO channel + * and will skip the channel of vdev_id_to_skip. + * If other no reqested mode is active it will return 0 + * + * Return: uint8_t + */ +uint8_t csr_get_beaconing_concurrent_channel(struct mac_context *mac_ctx, + uint8_t vdev_id_to_skip); #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH uint16_t csr_check_concurrent_channel_overlap( diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 8a0afe29068c..12f2f08c2602 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -685,7 +685,20 @@ QDF_STATUS sme_configure_app_type1_params(mac_handle_t mac_handle, QDF_STATUS sme_configure_app_type2_params(mac_handle_t mac_handle, tpSirAppType2Params wlanAppType2Params); #endif -uint8_t sme_get_concurrent_operation_channel(mac_handle_t mac_handle); +/** + * sme_get_beaconing_concurrent_operation_channel() - To get concurrent + * operating channel of beaconing interface + * @mac_handle: Pointer to mac context + * @vdev_id_to_skip: channel of which vdev id to skip + * + * This routine will return operating channel of active AP/GO channel + * and will skip the channel of vdev_id_to_skip. + * If other no reqested mode is active it will return 0 + * + * Return: uint8_t + */ +uint8_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 uint16_t sme_check_concurrent_channel_overlap(mac_handle_t mac_handle, uint16_t sap_ch, diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index c36d2157bd29..bf7bdd68f049 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -4940,11 +4940,8 @@ QDF_STATUS sme_configure_app_type2_params(mac_handle_t mac_handle, } #endif -/* This routine will return operating channel on which other BSS is operating - * to be used for concurrency mode. If other BSS is not up or not connected it - * will return 0 - */ -uint8_t sme_get_concurrent_operation_channel(mac_handle_t mac_handle) +uint8_t sme_get_beaconing_concurrent_operation_channel(mac_handle_t mac_handle, + uint8_t vdev_id_to_skip) { QDF_STATUS status = QDF_STATUS_E_FAILURE; struct mac_context *mac = MAC_CONTEXT(mac_handle); @@ -4953,9 +4950,10 @@ uint8_t sme_get_concurrent_operation_channel(mac_handle_t mac_handle) status = sme_acquire_global_lock(&mac->sme); if (QDF_IS_STATUS_SUCCESS(status)) { - channel = csr_get_concurrent_operation_channel(mac); - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, - "%s: Other Concurrent Channel: %d", __func__, channel); + channel = csr_get_beaconing_concurrent_channel(mac, + vdev_id_to_skip); + sme_info("Other Concurrent Channel: %d skipped vdev_id %d", + channel, vdev_id_to_skip); sme_release_global_lock(&mac->sme); } diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index db9e077a7867..fb7a32114236 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -708,16 +708,6 @@ bool csr_is_session_client_and_connected(struct mac_context *mac, uint8_t sessio return false; } -/** - * csr_get_concurrent_operation_channel() - To get concurrent operating channel - * @mac_ctx: Pointer to mac context - * - * This routine will return operating channel on FIRST BSS that is - * active/operating to be used for concurrency mode. - * If other BSS is not up or not connected it will return 0 - * - * Return: uint8_t - */ uint8_t csr_get_concurrent_operation_channel(struct mac_context *mac_ctx) { struct csr_roam_session *session = NULL; @@ -745,6 +735,32 @@ uint8_t csr_get_concurrent_operation_channel(struct mac_context *mac_ctx) return 0; } +uint8_t csr_get_beaconing_concurrent_channel(struct mac_context *mac_ctx, + uint8_t vdev_id_to_skip) +{ + struct csr_roam_session *session = NULL; + uint8_t i = 0; + enum QDF_OPMODE persona; + + for (i = 0; i < WLAN_MAX_VDEVS; i++) { + if (i == vdev_id_to_skip) + continue; + if (!CSR_IS_SESSION_VALID(mac_ctx, i)) + continue; + session = CSR_GET_SESSION(mac_ctx, i); + if (NULL == session->pCurRoamProfile) + continue; + persona = session->pCurRoamProfile->csrPersona; + if (((persona == QDF_P2P_GO_MODE) || + (persona == QDF_SAP_MODE)) && + (session->connectState != + eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED)) + return session->connectedProfile.operationChannel; + } + + return 0; +} + #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH #define HALF_BW_OF(eCSR_bw_val) ((eCSR_bw_val)/2)