Преглед на файлове

qcacld-3.0: Add CDS APIs to manipulate connection update event

Add CDS connection manager APIs to manipulate the connection
update event. These APIs can be used to initialize, reset,
set and wait for connection update event.

Change-Id: I5689711d4bdc0e39b2456573158943ebda9cbc2a
CRs-Fixed: 939026
Chandrasekaran, Manishekar преди 9 години
родител
ревизия
eceb811625
променени са 4 файла, в които са добавени 131 реда и са изтрити 64 реда
  1. 6 0
      core/cds/inc/cds_concurrency.h
  2. 119 26
      core/cds/src/cds_concurrency.c
  3. 4 25
      core/hdd/src/wlan_hdd_cfg80211.c
  4. 2 13
      core/hdd/src/wlan_hdd_hostapd.c

+ 6 - 0
core/cds/inc/cds_concurrency.h

@@ -41,6 +41,7 @@
 #define MAX_NUMBER_OF_CONC_CONNECTIONS 3
 #define MAX_NUM_CHAN    128
 #define DBS_OPPORTUNISTIC_TIME    10
+#define CONNECTION_UPDATE_TIMEOUT 500
 
 /**
  * enum cds_chain_mode - Chain Mask tx & rx combination.
@@ -786,4 +787,9 @@ static inline bool cds_concurrent_beaconing_sessions_running(void)
 	return true;
 }
 #endif
+
+CDF_STATUS cdf_wait_for_connection_update(void);
+CDF_STATUS cdf_reset_connection_update(void);
+CDF_STATUS cdf_set_connection_update(void);
+CDF_STATUS cdf_init_connection_update(void);
 #endif /* __CDS_CONCURRENCY_H */

+ 119 - 26
core/cds/src/cds_concurrency.c

@@ -2269,13 +2269,6 @@ static void cds_soc_set_hw_mode_cb(uint32_t status,
 	CDF_STATUS ret;
 	struct sir_hw_mode_params hw_mode;
 	uint32_t i;
-	p_cds_contextType cds_context;
-
-	cds_context = cds_get_global_context();
-	if (!cds_context) {
-		cds_err("Invalid CDS context");
-		return;
-	}
 
 	if (status != SET_HW_MODE_STATUS_OK) {
 		cds_err("Set HW mode failed with status %d", status);
@@ -2312,7 +2305,7 @@ static void cds_soc_set_hw_mode_cb(uint32_t status,
 			vdev_mac_map,
 			hw_mode);
 
-	ret = cdf_event_set(&cds_context->connection_update_done_evt);
+	ret = cdf_set_connection_update();
 	if (!CDF_IS_STATUS_SUCCESS(ret))
 		cds_err("ERROR: set connection_update_done event failed");
 
@@ -3641,16 +3634,9 @@ void cds_dbs_opportunistic_timer_handler(void *data)
 CDF_STATUS cds_init_policy_mgr(hdd_context_t *hdd_ctx)
 {
 	CDF_STATUS status;
-	p_cds_contextType p_cds_context;
 
 	cds_debug("Initializing the policy manager");
 
-	p_cds_context = cds_get_global_context();
-	if (!p_cds_context) {
-		cds_err("Invalid CDS context");
-		return CDF_STATUS_E_FAILURE;
-	}
-
 	/* init conc_connection_list */
 	cdf_mem_zero(conc_connection_list, sizeof(conc_connection_list));
 
@@ -3672,7 +3658,7 @@ CDF_STATUS cds_init_policy_mgr(hdd_context_t *hdd_ctx)
 		return status;
 	}
 
-	status = cdf_event_init(&p_cds_context->connection_update_done_evt);
+	status = cdf_init_connection_update();
 	if (!CDF_IS_STATUS_SUCCESS(status)) {
 		cds_err("connection_update_done_evt init failed");
 		return status;
@@ -6261,20 +6247,13 @@ bool cds_handle_conc_multiport(uint8_t session_id,
 		uint8_t channel)
 {
 	CDF_STATUS status;
-	p_cds_contextType cds_context;
-
-	cds_context = cds_get_global_context();
-	if (!cds_context) {
-		cds_err("Invalid CDS context");
-		return false;
-	}
 
 	if (!cds_check_for_session_conc(session_id, channel)) {
 		cds_err("Conc not allowed for the session %d", session_id);
 		return false;
 	}
 
-	status = cdf_event_reset(&cds_context->connection_update_done_evt);
+	status = cdf_reset_connection_update();
 	if (!CDF_IS_STATUS_SUCCESS(status))
 		cds_err("clearing event failed");
 
@@ -6290,8 +6269,7 @@ bool cds_handle_conc_multiport(uint8_t session_id,
 	 * will return success only in case if DBS update is required.
 	 */
 	if (CDF_STATUS_SUCCESS == status) {
-		status = cdf_wait_single_event(
-			    &cds_context->connection_update_done_evt, 500);
+		status = cdf_wait_for_connection_update();
 		if (!CDF_IS_STATUS_SUCCESS(status)) {
 			cds_err("wait for event failed");
 			return false;
@@ -7386,3 +7364,118 @@ bool cds_is_sta_active_connection_exists(void)
 
 	return j ? true : false;
 }
+
+/**
+ * cdf_wait_for_connection_update() - Wait for hw mode command to get processed
+ *
+ * Waits for CONNECTION_UPDATE_TIMEOUT duration until the set hw mode
+ * response sets the event connection_update_done_evt
+ *
+ * Return: CDF_STATUS
+ */
+CDF_STATUS cdf_wait_for_connection_update(void)
+{
+	CDF_STATUS status;
+	p_cds_contextType cds_context;
+
+	cds_context = cds_get_global_context();
+	if (!cds_context) {
+		cds_err("Invalid CDS context");
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	status = cdf_wait_single_event(
+			&cds_context->connection_update_done_evt,
+			CONNECTION_UPDATE_TIMEOUT);
+
+	if (!CDF_IS_STATUS_SUCCESS(status)) {
+		cds_err("wait for event failed");
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	return CDF_STATUS_SUCCESS;
+}
+
+/**
+ * cdf_reset_connection_update() - Reset connection update event
+ *
+ * Resets the concurrent connection update event
+ *
+ * Return: CDF_STATUS
+ */
+CDF_STATUS cdf_reset_connection_update(void)
+{
+	CDF_STATUS status;
+	p_cds_contextType cds_context;
+
+	cds_context = cds_get_global_context();
+	if (!cds_context) {
+		cds_err("Invalid CDS context");
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	status = cdf_event_reset(&cds_context->connection_update_done_evt);
+
+	if (!CDF_IS_STATUS_SUCCESS(status)) {
+		cds_err("clear event failed");
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	return CDF_STATUS_SUCCESS;
+}
+
+/**
+ * cdf_set_connection_update() - Set connection update event
+ *
+ * Sets the concurrent connection update event
+ *
+ * Return: CDF_STATUS
+ */
+CDF_STATUS cdf_set_connection_update(void)
+{
+	CDF_STATUS status;
+	p_cds_contextType cds_context;
+
+	cds_context = cds_get_global_context();
+	if (!cds_context) {
+		cds_err("Invalid CDS context");
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	status = cdf_event_set(&cds_context->connection_update_done_evt);
+
+	if (!CDF_IS_STATUS_SUCCESS(status)) {
+		cds_err("set event failed");
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	return CDF_STATUS_SUCCESS;
+}
+
+/**
+ * cdf_init_connection_update() - Initialize connection update event
+ *
+ * Initializes the concurrent connection update event
+ *
+ * Return: CDF_STATUS
+ */
+CDF_STATUS cdf_init_connection_update(void)
+{
+	CDF_STATUS status;
+	p_cds_contextType cds_context;
+
+	cds_context = cds_get_global_context();
+	if (!cds_context) {
+		cds_err("Invalid CDS context");
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	status = cdf_event_init(&cds_context->connection_update_done_evt);
+
+	if (!CDF_IS_STATUS_SUCCESS(status)) {
+		cds_err("init event failed");
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	return CDF_STATUS_SUCCESS;
+}

+ 4 - 25
core/hdd/src/wlan_hdd_cfg80211.c

@@ -136,7 +136,6 @@
 #endif
 
 #define HDD_CHANNEL_14 14
-#define CONNECTION_UPDATE_TIMEOUT 500
 
 static const u32 hdd_cipher_suites[] = {
 	WLAN_CIPHER_SUITE_WEP40,
@@ -4133,18 +4132,11 @@ static int __wlan_hdd_cfg80211_set_probable_oper_channel(struct wiphy *wiphy,
 	enum cds_con_mode intf_mode;
 	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_MAX + 1];
 	uint32_t channel_hint;
-	p_cds_contextType p_cds_context;
 
 	ret = wlan_hdd_validate_context(hdd_ctx);
 	if (ret)
 		return ret;
 
-	p_cds_context = cds_get_global_context();
-	if (!p_cds_context) {
-		hdd_err("Invalid CDS context");
-		return -EINVAL;
-	}
-
 	if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_MAX,
 		      data, data_len, NULL)) {
 		hdd_err("Invalid ATTR");
@@ -4180,8 +4172,7 @@ static int __wlan_hdd_cfg80211_set_probable_oper_channel(struct wiphy *wiphy,
 	}
 
 	if (hdd_ctx->config->policy_manager_enabled) {
-		ret = cdf_event_reset(
-				&p_cds_context->connection_update_done_evt);
+		ret = cdf_reset_connection_update();
 		if (!CDF_IS_STATUS_SUCCESS(ret))
 			hdd_err("clearing event failed");
 
@@ -4201,9 +4192,7 @@ static int __wlan_hdd_cfg80211_set_probable_oper_channel(struct wiphy *wiphy,
 			 * For any other return value it should be a pass
 			 * through
 			 */
-			ret = cdf_wait_single_event(
-				&p_cds_context->connection_update_done_evt,
-				CONNECTION_UPDATE_TIMEOUT);
+			ret = cdf_wait_for_connection_update();
 			if (!CDF_IS_STATUS_SUCCESS(ret)) {
 				hdd_err("ERROR: cdf wait for event failed!!");
 				return -EINVAL;
@@ -8745,16 +8734,9 @@ static int __wlan_hdd_cfg80211_join_ibss(struct wiphy *wiphy,
 	hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 	struct cdf_mac_addr bssid;
 	u8 channelNum = 0;
-	p_cds_contextType p_cds_context;
 
 	ENTER();
 
-	p_cds_context = cds_get_global_context();
-	if (!p_cds_context) {
-		hdd_err("Invalid CDS context");
-		return -EINVAL;
-	}
-
 	if (CDF_FTM_MODE == hdd_get_conparam()) {
 		hddLog(LOGE, FL("Command not allowed in FTM mode"));
 		return -EINVAL;
@@ -8823,8 +8805,7 @@ static int __wlan_hdd_cfg80211_join_ibss(struct wiphy *wiphy,
 		return -ECONNREFUSED;
 	}
 	if (pHddCtx->config->policy_manager_enabled) {
-		status = cdf_event_reset(
-				&p_cds_context->connection_update_done_evt);
+		status = cdf_reset_connection_update();
 		if (!CDF_IS_STATUS_SUCCESS(status))
 			hdd_err("ERR: clear event failed");
 
@@ -8837,9 +8818,7 @@ static int __wlan_hdd_cfg80211_join_ibss(struct wiphy *wiphy,
 		}
 
 		if (CDF_STATUS_SUCCESS == status) {
-			status = cdf_wait_single_event(
-				    &p_cds_context->connection_update_done_evt,
-				    CONNECTION_UPDATE_TIMEOUT);
+			status = cdf_wait_for_connection_update();
 			if (!CDF_IS_STATUS_SUCCESS(status)) {
 				hdd_err("ERROR: cdf wait for event failed!!");
 				return -EINVAL;

+ 2 - 13
core/hdd/src/wlan_hdd_hostapd.c

@@ -94,7 +94,6 @@
 
 #define SAP_24GHZ_CH_COUNT (14)
 #define ACS_SCAN_EXPIRY_TIMEOUT_S 4
-#define CONNECTION_UPDATE_TIMEOUT 500
 
 #define DUMP_DP_TRACE       0
 
@@ -8184,16 +8183,9 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 	tSirWifiChannelWidth channel_width;
 	int status;
 	uint8_t channel;
-	p_cds_contextType p_cds_context;
 
 	ENTER();
 
-	p_cds_context = cds_get_global_context();
-	if (!p_cds_context) {
-		hdd_err("Invalid CDS context");
-		return -EINVAL;
-	}
-
 	if (CDF_FTM_MODE == hdd_get_conparam()) {
 		hddLog(LOGE, FL("Command not allowed in FTM mode"));
 		return -EINVAL;
@@ -8237,8 +8229,7 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 	if (pHddCtx->config->policy_manager_enabled) {
-		status = cdf_event_reset(
-				&p_cds_context->connection_update_done_evt);
+		status = cdf_reset_connection_update();
 		if (!CDF_IS_STATUS_SUCCESS(status))
 			hdd_err("ERR: clear event failed");
 
@@ -8251,9 +8242,7 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 		}
 
 		if (CDF_STATUS_SUCCESS == status) {
-			status = cdf_wait_single_event(
-				    &p_cds_context->connection_update_done_evt,
-				    CONNECTION_UPDATE_TIMEOUT);
+			status = cdf_wait_for_connection_update();
 			if (!CDF_IS_STATUS_SUCCESS(status)) {
 				hdd_err("ERROR: cdf wait for event failed!!");
 				return -EINVAL;