From 1004ad9cae2aed4fb62f1065bf3de2f3209ecb6e Mon Sep 17 00:00:00 2001 From: Manishekar Chandrasekaran Date: Sun, 4 Sep 2016 22:01:47 +0530 Subject: qcacld-3.0: Check for active STA/SAP connections before SAP channel switch Check for active STA and SAP connections before switching the operating channel of SAP to a DFS channel. SAP moves to a DFS channel only if this movement ensures that the SAP does not go off the DFS channel which is needed for continuous radar detection. The existing check looks for the number of open sessions. But these sessions may or may not be active. So, replace this check with suitable APIs which will check for active sessions. Change-Id: Ib37427a9c62a785abb5e22c14ec23f09e60bf4b7 CRs-Fixed: 1063212 (cherry picked from commit d470e33f6d390b84dd98892a1b4526fd45348c2b) --- core/cds/src/cds_concurrency.c | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'core/cds/src') diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index da86a9454a65..601e7f999408 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 -- cgit v1.2.3