Browse Source

qcacld-3.0: Vote link based on config change

Currently, based on config_direct_link variable, link is voted
up or down which can result in same multiple votes.
To fix this, vote link up or down if there is a change in
previous config and incoming config_direct_link argument.
Also, return status success when direct link is not enabled
but dp_config_direct_link is called.

Change-Id: I4f54d74a9d4921f27f247450f89a03d6dabc838e
CRs-Fixed: 3375395
Ananya Gupta 2 years ago
parent
commit
9ef4a35d86
1 changed files with 8 additions and 4 deletions
  1. 8 4
      components/dp/core/src/wlan_dp_main.c

+ 8 - 4
components/dp/core/src/wlan_dp_main.c

@@ -1731,7 +1731,7 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf,
 	struct wlan_dp_psoc_context *dp_ctx = dp_intf->dp_ctx;
 	struct direct_link_info *config = &dp_intf->direct_link_config;
 	void *htc_handle;
-	bool prev_ll, update_ll;
+	bool prev_ll, update_ll, vote_link;
 	cdp_config_param_type vdev_param = {0};
 	QDF_STATUS status;
 
@@ -1742,7 +1742,7 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf,
 
 	if (!dp_ctx->dp_direct_link_ctx) {
 		dp_err("Direct link not enabled");
-		return QDF_STATUS_E_NOSUPPORT;
+		return QDF_STATUS_SUCCESS;
 	}
 
 	htc_handle = lmac_get_htc_hdl(dp_ctx->psoc);
@@ -1754,6 +1754,7 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf,
 	qdf_spin_lock(&dp_intf->vdev_lock);
 	prev_ll = config->low_latency;
 	update_ll = config_direct_link ? enable_low_latency : prev_ll;
+	vote_link = config->config_set ^ config_direct_link;
 	config->config_set = config_direct_link;
 	config->low_latency = enable_low_latency;
 	vdev_param.cdp_vdev_tx_to_fw = config_direct_link;
@@ -1763,7 +1764,8 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf,
 	qdf_spin_unlock(&dp_intf->vdev_lock);
 
 	if (config_direct_link) {
-		htc_vote_link_up(htc_handle, HTC_LINK_VOTE_SAP_USER_ID);
+		if (vote_link)
+			htc_vote_link_up(htc_handle, HTC_LINK_VOTE_SAP_USER_ID);
 		if (update_ll)
 			hif_prevent_link_low_power_states(
 						htc_get_hif_device(htc_handle));
@@ -1773,7 +1775,9 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf,
 		dp_info("Direct link config set. Low link latency enabled: %d",
 			enable_low_latency);
 	} else {
-		htc_vote_link_down(htc_handle, HTC_LINK_VOTE_SAP_USER_ID);
+		if (vote_link)
+			htc_vote_link_down(htc_handle,
+					   HTC_LINK_VOTE_SAP_USER_ID);
 		if (update_ll)
 			hif_allow_link_low_power_states(
 						htc_get_hif_device(htc_handle));