Przeglądaj źródła

qcacmn: TX Optimization

Memory optimization of unused TX rings by not configuring rings that are
not being used. Configure 2 rings for host in the case of IPA, instead
of configuring 3. If IPA is disabled then configure only 1 set of TX
rings for host.

Change-Id: I251606c728f3020a13e45e8c8386970c8a641f0a
CRs-Fixed: 2530572
Saket Jha 5 lat temu
rodzic
commit
a4a994242f

+ 1 - 0
dp/inc/cdp_txrx_mob_def.h

@@ -23,6 +23,7 @@
 
 #define TX_WMM_AC_NUM	4
 #define ENABLE_DP_HIST_STATS
+#define DP_MEMORY_OPT
 #define DP_RX_DISABLE_NDI_MDNS_FORWARDING
 
 #define OL_TXQ_PAUSE_REASON_FW                (1 << 0)

+ 2 - 2
dp/wifi3.0/dp_ipa.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  * 
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -17,10 +17,10 @@
 #ifndef _DP_IPA_H_
 #define _DP_IPA_H_
 
+#define IPA_TCL_DATA_RING_IDX	2
 #ifdef IPA_OFFLOAD
 
 #define DP_IPA_MAX_IFACE	3
-#define IPA_TCL_DATA_RING_IDX	2
 #define IPA_TX_COMP_RING_IDX	2
 #define IPA_REO_DEST_RING_IDX	3
 #define IPA_RX_REFILL_BUF_RING_IDX	2

+ 58 - 27
dp/wifi3.0/dp_main.c

@@ -2883,6 +2883,40 @@ static inline void dp_create_ext_stats_event(struct dp_soc *soc)
 }
 #endif
 
+static
+QDF_STATUS dp_setup_tx_ring_pair_by_index(struct dp_soc *soc, uint8_t index)
+{
+	int tx_ring_size;
+	int tx_comp_ring_size;
+	struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx = soc->wlan_cfg_ctx;
+	int cached;
+
+	tx_ring_size = wlan_cfg_tx_ring_size(soc_cfg_ctx);
+	if (dp_srng_setup(soc, &soc->tcl_data_ring[index], TCL_DATA,
+			  index, 0, tx_ring_size, 0)) {
+		dp_err("dp_srng_setup failed for tcl_data_ring");
+		goto fail1;
+	}
+
+	tx_comp_ring_size = wlan_cfg_tx_comp_ring_size(soc_cfg_ctx);
+	/* Disable cached desc if NSS offload is enabled */
+	cached = WLAN_CFG_DST_RING_CACHED_DESC;
+	if (wlan_cfg_get_dp_soc_nss_cfg(soc_cfg_ctx))
+		cached = 0;
+
+	if (dp_srng_setup(soc, &soc->tx_comp_ring[index],
+			  WBM2SW_RELEASE, index, 0, tx_comp_ring_size,
+			cached)) {
+		dp_err("dp_srng_setup failed for tx_comp_ring");
+		goto fail1;
+	}
+
+	return QDF_STATUS_SUCCESS;
+
+fail1:
+	return QDF_STATUS_E_FAILURE;
+}
+
 /*
  * dp_soc_cmn_setup() - Common SoC level initializion
  * @soc:		Datapath SOC handle
@@ -2899,6 +2933,7 @@ static int dp_soc_cmn_setup(struct dp_soc *soc)
 	int reo_dst_ring_size;
 	uint32_t entries;
 	struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
+	QDF_STATUS status;
 
 	if (qdf_atomic_read(&soc->cmn_init_done))
 		return 0;
@@ -2934,32 +2969,17 @@ static int dp_soc_cmn_setup(struct dp_soc *soc)
 			wlan_cfg_tx_comp_ring_size(soc_cfg_ctx);
 		tx_ring_size =
 			wlan_cfg_tx_ring_size(soc_cfg_ctx);
+
 		for (i = 0; i < soc->num_tcl_data_rings; i++) {
-			if (dp_srng_setup(soc, &soc->tcl_data_ring[i],
-					  TCL_DATA, i, 0, tx_ring_size, 0)) {
-				QDF_TRACE(QDF_MODULE_ID_DP,
-					QDF_TRACE_LEVEL_ERROR,
-					FL("dp_srng_setup failed for tcl_data_ring[%d]"), i);
+			status = dp_setup_tx_ring_pair_by_index(soc, i);
+			if (status != QDF_STATUS_SUCCESS)
 				goto fail1;
-			}
-
-			/* Disable cached desc if NSS offload is enabled */
-			cached = WLAN_CFG_DST_RING_CACHED_DESC;
-			if (wlan_cfg_get_dp_soc_nss_cfg(soc_cfg_ctx))
-				cached = 0;
-			/*
-			 * TBD: Set IPA WBM ring size with ini IPA UC tx buffer
-			 * count
-			 */
-			if (dp_srng_setup(soc, &soc->tx_comp_ring[i],
-					  WBM2SW_RELEASE, i, 0,
-					  tx_comp_ring_size,
-					  cached)) {
-				QDF_TRACE(QDF_MODULE_ID_DP,
-					QDF_TRACE_LEVEL_ERROR,
-					FL("dp_srng_setup failed for tx_comp_ring[%d]"), i);
+		}
+		if (wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx)) {
+			status = dp_setup_tx_ring_pair_by_index(soc,
+						IPA_TCL_DATA_RING_IDX);
+			if (status != QDF_STATUS_SUCCESS)
 				goto fail1;
-			}
 		}
 	} else {
 		/* This will be incremented during per pdev ring setup */
@@ -4349,11 +4369,10 @@ static void dp_soc_deinit(void *txrx_soc)
 	/* Tx data rings */
 	if (!wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) {
 		for (i = 0; i < soc->num_tcl_data_rings; i++) {
-			dp_srng_deinit(soc, &soc->tcl_data_ring[i],
-				       TCL_DATA, i);
-			dp_srng_deinit(soc, &soc->tx_comp_ring[i],
-				       WBM2SW_RELEASE, i);
+			dp_tx_deinit_pair_by_index(soc, i);
 		}
+		if (wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
+			dp_tx_deinit_pair_by_index(soc, IPA_TCL_DATA_RING_IDX);
 	}
 
 	/* TCL command and status rings */
@@ -4402,6 +4421,12 @@ static void dp_soc_deinit(void *txrx_soc)
 	dp_soc_mem_reset(soc);
 }
 
+void dp_tx_deinit_pair_by_index(struct dp_soc *soc, int index)
+{
+	dp_srng_deinit(soc, &soc->tcl_data_ring[index], TCL_DATA, index);
+	dp_srng_deinit(soc, &soc->tx_comp_ring[index], WBM2SW_RELEASE, index);
+}
+
 /**
  * dp_soc_deinit_wifi3() - Deinitialize txrx SOC
  * @txrx_soc: Opaque DP SOC handle
@@ -4456,6 +4481,12 @@ static void dp_soc_detach(struct cdp_soc_t *txrx_soc)
 			dp_srng_cleanup(soc, &soc->tx_comp_ring[i],
 				WBM2SW_RELEASE, i);
 		}
+		if (wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx)) {
+			dp_srng_cleanup(soc, &soc->tcl_data_ring[IPA_TCL_DATA_RING_IDX],
+				TCL_DATA, IPA_TCL_DATA_RING_IDX);
+			dp_srng_cleanup(soc, &soc->tx_comp_ring[IPA_TCL_DATA_RING_IDX],
+				WBM2SW_RELEASE, IPA_TCL_DATA_RING_IDX);
+		}
 	}
 
 	/* TCL command and status rings */

+ 4 - 0
dp/wifi3.0/dp_tx.c

@@ -28,6 +28,7 @@
 #include "qdf_nbuf.h"
 #include "qdf_net_types.h"
 #include <wlan_cfg.h>
+#include "dp_ipa.h"
 #if defined(MESH_MODE_SUPPORT) || defined(FEATURE_PERPKT_INFO)
 #include "if_meta_hdr.h"
 #endif
@@ -4327,6 +4328,9 @@ QDF_STATUS dp_tx_soc_attach(struct dp_soc *soc)
 			hal_tx_init_data_ring(soc->hal_soc,
 					soc->tcl_data_ring[i].hal_srng);
 		}
+		if (wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
+			hal_tx_init_data_ring(soc->hal_soc,
+					soc->tcl_data_ring[IPA_TCL_DATA_RING_IDX].hal_srng);
 	}
 
 	/*

+ 14 - 0
dp/wifi3.0/dp_tx.h

@@ -153,6 +153,20 @@ struct dp_tx_msdu_info_s {
 	uint8_t is_tx_sniffer;
 };
 
+/**
+ * dp_tx_deinit_pair_by_index() - Deinit TX rings based on index
+ * @soc: core txrx context
+ * @index: index of ring to deinit
+ *
+ * Deinit 1 TCL and 1 WBM2SW release ring on as needed basis using
+ * index of the respective TCL/WBM2SW release in soc structure.
+ * For example, if the index is 2 then &soc->tcl_data_ring[2]
+ * and &soc->tx_comp_ring[2] will be deinitialized.
+ *
+ * Return: none
+ */
+void dp_tx_deinit_pair_by_index(struct dp_soc *soc, int index);
+
 QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
 QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
 void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev);

+ 7 - 0
wlan_cfg/wlan_cfg.c

@@ -829,10 +829,17 @@ int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
 	return cfg->per_pdev_lmac_ring;
 }
 
+#ifdef DP_MEMORY_OPT
+int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
+{
+	return 1;
+}
+#else
 int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
 {
 	return cfg->num_tcl_data_rings;
 }
+#endif
 
 int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
 {