Browse Source

qcacld-3.0: Use a dedicated rx refill ring for Direct Link

Allocate a dedicated rx refill ring for use by LPASS
WiFi driver to provide buffers back to FW in the
Direct Link datapath.

Change-Id: I3b59e2fd3973f37fc2cc77898c4dcf09fc5def57
CRs-Fixed: 3317972
Yeshwanth Sriram Guntuka 2 years ago
parent
commit
e8b18e43b9
2 changed files with 69 additions and 1 deletions
  1. 2 0
      components/dp/core/inc/wlan_dp_priv.h
  2. 67 1
      components/dp/core/src/wlan_dp_main.c

+ 2 - 0
components/dp/core/inc/wlan_dp_priv.h

@@ -366,10 +366,12 @@ enum RX_OFFLOAD {
  * struct dp_direct_link_context - Datapath Direct Link context
  * @dp_ctx: pointer to DP psoc priv context
  * @lpass_ep_id: LPASS data msg service endpoint id
+ * @direct_link_refill_ring_hdl: Direct Link refill ring handle
  */
 struct dp_direct_link_context {
 	struct wlan_dp_psoc_context *dp_ctx;
 	HTC_ENDPOINT_ID lpass_ep_id;
+	struct dp_srng *direct_link_refill_ring_hdl;
 };
 #endif
 

+ 67 - 1
components/dp/core/src/wlan_dp_main.c

@@ -34,6 +34,10 @@
 #include "target_if_dp_comp.h"
 #include "wlan_dp_txrx.h"
 
+#ifdef FEATURE_DIRECT_LINK
+#include "dp_internal.h"
+#endif
+
 /* Global DP context */
 static struct wlan_dp_psoc_context *gp_dp_ctx;
 
@@ -1608,6 +1612,56 @@ dp_lpass_connect_htc_service(struct dp_direct_link_context *dp_direct_link_ctx)
 	return status;
 }
 
+/**
+ * dp_direct_link_refill_ring_init() - Initialize refill ring that would be used
+ *  for Direct Link DP
+ * @direct_link_ctx: DP Direct Link context
+ *
+ * Return: QDF status
+ */
+static QDF_STATUS
+dp_direct_link_refill_ring_init(struct dp_direct_link_context *direct_link_ctx)
+{
+	struct cdp_soc_t *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	uint8_t pdev_id;
+
+	if (!soc)
+		return QDF_STATUS_E_FAILURE;
+
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(direct_link_ctx->dp_ctx->pdev);
+
+	direct_link_ctx->direct_link_refill_ring_hdl =
+				dp_setup_direct_link_refill_ring(soc,
+								 pdev_id);
+	if (!direct_link_ctx->direct_link_refill_ring_hdl) {
+		dp_err("Refill ring init for Direct Link failed");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * dp_direct_link_refill_ring_deinit() - De-initialize refill ring that would be
+ *  used for Direct Link DP
+ * @direct_link_ctx: DP Direct Link context
+ *
+ * Return: None
+ */
+static void
+dp_direct_link_refill_ring_deinit(struct dp_direct_link_context *dlink_ctx)
+{
+	struct cdp_soc_t *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	uint8_t pdev_id;
+
+	if (!soc)
+		return;
+
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(dlink_ctx->dp_ctx->pdev);
+	dp_destroy_direct_link_refill_ring(soc, pdev_id);
+	dlink_ctx->direct_link_refill_ring_hdl = NULL;
+}
+
 QDF_STATUS dp_direct_link_init(struct wlan_dp_psoc_context *dp_ctx)
 {
 	struct dp_direct_link_context *dp_direct_link_ctx;
@@ -1621,6 +1675,8 @@ QDF_STATUS dp_direct_link_init(struct wlan_dp_psoc_context *dp_ctx)
 		return QDF_STATUS_E_NOMEM;
 	}
 
+	dp_direct_link_ctx->dp_ctx = dp_ctx;
+
 	status = dp_lpass_connect_htc_service(dp_direct_link_ctx);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		dp_err("Failed to connect to LPASS data msg service");
@@ -1628,14 +1684,24 @@ QDF_STATUS dp_direct_link_init(struct wlan_dp_psoc_context *dp_ctx)
 		return status;
 	}
 
+	status = dp_direct_link_refill_ring_init(dp_direct_link_ctx);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		qdf_mem_free(dp_direct_link_ctx);
+		return status;
+	}
+
 	dp_ctx->dp_direct_link_ctx = dp_direct_link_ctx;
-	dp_direct_link_ctx->dp_ctx = dp_ctx;
 
 	return status;
 }
 
 void dp_direct_link_deinit(struct wlan_dp_psoc_context *dp_ctx)
 {
+	if (dp_ctx->dp_direct_link_ctx)
+		return;
+
+	dp_direct_link_refill_ring_deinit(dp_ctx->dp_direct_link_ctx);
+
 	qdf_mem_free(dp_ctx->dp_direct_link_ctx);
 	dp_ctx->dp_direct_link_ctx = NULL;
 }