Browse Source

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)
Manishekar Chandrasekaran 8 years ago
parent
commit
1004ad9cae
3 changed files with 66 additions and 3 deletions
  1. 2 0
      core/cds/inc/cds_concurrency.h
  2. 59 0
      core/cds/src/cds_concurrency.c
  3. 5 3
      core/sap/src/sap_module.c

+ 2 - 0
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);

+ 59 - 0
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

+ 5 - 3
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.