diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h index 756ea15d76..a8a6a3dcd4 100644 --- a/core/cds/inc/cds_concurrency.h +++ b/core/cds/inc/cds_concurrency.h @@ -816,6 +816,8 @@ QDF_STATUS cds_register_sap_restart_channel_switch_cb( void (*sap_restart_chan_switch_cb)(void *, uint32_t, uint32_t)); QDF_STATUS cds_deregister_sap_restart_channel_switch_cb(void); #endif +bool cds_is_any_mode_active_on_band_along_with_session(uint8_t session_id, + enum cds_band band); QDF_STATUS cds_get_mac_id_by_session_id(uint8_t session_id, uint8_t *mac_id); QDF_STATUS cds_get_mcc_session_id_on_mac(uint8_t mac_id, uint8_t session_id, uint8_t *mcc_session_id); diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index da86a9454a..601e7f9994 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -8874,6 +8874,65 @@ void cds_dump_connection_status_info(void) } } +/** + * cds_is_any_mode_active_on_band_along_with_session() - Check if any connection + * mode is active on a band along with the given session + * @session_id: Session along which active sessions are looked for + * @band: Operating frequency band of the connection + * CDS_BAND_24: Looks for active connection on 2.4 GHz only + * CDS_BAND_5: Looks for active connection on 5 GHz only + * + * Checks if any of the connection mode is active on a given frequency band + * + * Return: True if any connection is active on a given band, false otherwise + */ +bool cds_is_any_mode_active_on_band_along_with_session(uint8_t session_id, + enum cds_band band) +{ + cds_context_type *cds_ctx; + uint32_t i; + bool status = false; + + cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); + if (!cds_ctx) { + cds_err("Invalid CDS Context"); + status = false; + goto send_status; + } + + qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock); + for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { + switch (band) { + case CDS_BAND_24: + if ((conc_connection_list[i].vdev_id != session_id) && + (conc_connection_list[i].in_use) && + (CDS_IS_CHANNEL_24GHZ( + conc_connection_list[i].chan))) { + status = true; + goto release_mutex_and_send_status; + } + break; + case CDS_BAND_5: + if ((conc_connection_list[i].vdev_id != session_id) && + (conc_connection_list[i].in_use) && + (CDS_IS_CHANNEL_5GHZ( + conc_connection_list[i].chan))) { + status = true; + goto release_mutex_and_send_status; + } + break; + default: + cds_err("Invalid band option:%d", band); + status = false; + goto release_mutex_and_send_status; + } + } +release_mutex_and_send_status: + qdf_mutex_release(&cds_ctx->qdf_conc_list_lock); +send_status: + return status; +} + /** * cds_get_mac_id_by_session_id() - Get MAC ID for a given session ID * @session_id: Session ID diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index edb3aa27ef..0523494e29 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -1660,9 +1660,10 @@ wlansap_set_channel_change_with_csa(void *p_cds_gctx, uint32_t targetChannel, pMac = PMAC_STRUCT(hHal); QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, - "%s: sap chan:%d target:%d conc:%d", + "%s: sap chan:%d target:%d conn on 5GHz:%d", __func__, sapContext->channel, targetChannel, - cds_concurrent_open_sessions_running()); + cds_is_any_mode_active_on_band_along_with_session( + sapContext->sessionId, CDS_BAND_5)); /* * Now, validate if the passed channel is valid in the @@ -1673,7 +1674,8 @@ wlansap_set_channel_change_with_csa(void *p_cds_gctx, uint32_t targetChannel, CHANNEL_STATE_ENABLE) || (cds_get_channel_state(targetChannel) == CHANNEL_STATE_DFS && - !cds_concurrent_open_sessions_running()))) { + !cds_is_any_mode_active_on_band_along_with_session( + sapContext->sessionId, CDS_BAND_5)))) { /* * validate target channel switch w.r.t various concurrency * rules set.