فهرست منبع

qcacmn: Featurization of DP_TX_EXT_DESC_POOL_OPTIMIZE

This flag DP_TX_EXT_DESC_POOL_OPTIMIZE if enabled will reduce the number
of ext tx desc pool to 1.

1. Changes done to split the tx_desc and ext_tx_desc pool number
variables in alloc and free path. Based on this flag the reduced
ext_desc_pool count will be returned.

2. In Tx path, since the pool id is selected based on the CPU, changes done
to override the desc_pool_id of ext_desc_pool via new API
dp_tx_ext_desc_pool_override to 0 with which from whatever core the packets
comes from, pool 0 will be chosen for ext_desc.

Change-Id: Iae8bf9952a136ba2c55256d8f305b6d5fbde5d83
CRs-Fixed: 3552532
Hariharan Ramanathan 2 سال پیش
والد
کامیت
5ec64fb74d
3فایلهای تغییر یافته به همراه75 افزوده شده و 19 حذف شده
  1. 24 19
      dp/wifi3.0/dp_tx.c
  2. 48 0
      dp/wifi3.0/dp_tx.h
  3. 3 0
      dp/wifi3.0/dp_tx_desc.h

+ 24 - 19
dp/wifi3.0/dp_tx.c

@@ -6467,24 +6467,26 @@ static void dp_tx_tso_cmn_desc_pool_free(struct dp_soc *soc, uint8_t num_pool)
 #ifndef WLAN_SOFTUMAC_SUPPORT
 void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc)
 {
-	uint8_t num_pool;
+	uint8_t num_pool, num_ext_pool;
 
 	num_pool = wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
+	num_ext_pool = dp_get_ext_tx_desc_pool_num(soc);
 
 	dp_tx_tso_cmn_desc_pool_free(soc, num_pool);
-	dp_tx_ext_desc_pool_free(soc, num_pool);
+	dp_tx_ext_desc_pool_free(soc, num_ext_pool);
 	dp_tx_delete_static_pools(soc, num_pool);
 }
 
 void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc)
 {
-	uint8_t num_pool;
+	uint8_t num_pool, num_ext_pool;
 
 	num_pool = wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
+	num_ext_pool = dp_get_ext_tx_desc_pool_num(soc);
 
 	dp_tx_flow_control_deinit(soc);
 	dp_tx_tso_cmn_desc_pool_deinit(soc, num_pool);
-	dp_tx_ext_desc_pool_deinit(soc, num_pool);
+	dp_tx_ext_desc_pool_deinit(soc, num_ext_pool);
 	dp_tx_deinit_static_pools(soc, num_pool);
 }
 #else
@@ -6568,36 +6570,38 @@ static QDF_STATUS dp_tx_tso_cmn_desc_pool_init(struct dp_soc *soc,
 #ifndef WLAN_SOFTUMAC_SUPPORT
 QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc)
 {
-	uint8_t num_pool;
+	uint8_t num_pool, num_ext_pool;
 	uint32_t num_desc;
 	uint32_t num_ext_desc;
 
 	num_pool = wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
+	num_ext_pool = dp_get_ext_tx_desc_pool_num(soc);
 	num_desc = wlan_cfg_get_num_tx_desc(soc->wlan_cfg_ctx);
 	num_ext_desc = wlan_cfg_get_num_tx_ext_desc(soc->wlan_cfg_ctx);
 
 	dp_info("Tx Desc Alloc num_pool: %d descs: %d", num_pool, num_desc);
 
 	if ((num_pool > MAX_TXDESC_POOLS) ||
+	    (num_ext_pool > MAX_TXDESC_POOLS) ||
 	    (num_desc > WLAN_CFG_NUM_TX_DESC_MAX))
 		goto fail1;
 
 	if (dp_tx_alloc_static_pools(soc, num_pool, num_desc))
 		goto fail1;
 
-	if (dp_tx_ext_desc_pool_alloc(soc, num_pool, num_ext_desc))
+	if (dp_tx_ext_desc_pool_alloc(soc, num_ext_pool, num_ext_desc))
 		goto fail2;
 
 	if (wlan_cfg_is_tso_desc_attach_defer(soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
 
-	if (dp_tx_tso_cmn_desc_pool_alloc(soc, num_pool, num_ext_desc))
+	if (dp_tx_tso_cmn_desc_pool_alloc(soc, num_ext_pool, num_ext_desc))
 		goto fail3;
 
 	return QDF_STATUS_SUCCESS;
 
 fail3:
-	dp_tx_ext_desc_pool_free(soc, num_pool);
+	dp_tx_ext_desc_pool_free(soc, num_ext_pool);
 fail2:
 	dp_tx_delete_static_pools(soc, num_pool);
 fail1:
@@ -6606,24 +6610,25 @@ fail1:
 
 QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc)
 {
-	uint8_t num_pool;
+	uint8_t num_pool, num_ext_pool;
 	uint32_t num_desc;
 	uint32_t num_ext_desc;
 
 	num_pool = wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
+	num_ext_pool = dp_get_ext_tx_desc_pool_num(soc);
 	num_desc = wlan_cfg_get_num_tx_desc(soc->wlan_cfg_ctx);
 	num_ext_desc = wlan_cfg_get_num_tx_ext_desc(soc->wlan_cfg_ctx);
 
 	if (dp_tx_init_static_pools(soc, num_pool, num_desc))
 		goto fail1;
 
-	if (dp_tx_ext_desc_pool_init(soc, num_pool, num_ext_desc))
+	if (dp_tx_ext_desc_pool_init(soc, num_ext_pool, num_ext_desc))
 		goto fail2;
 
 	if (wlan_cfg_is_tso_desc_attach_defer(soc->wlan_cfg_ctx))
 		return QDF_STATUS_SUCCESS;
 
-	if (dp_tx_tso_cmn_desc_pool_init(soc, num_pool, num_ext_desc))
+	if (dp_tx_tso_cmn_desc_pool_init(soc, num_ext_pool, num_ext_desc))
 		goto fail3;
 
 	dp_tx_flow_control_init(soc);
@@ -6631,7 +6636,7 @@ QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc)
 	return QDF_STATUS_SUCCESS;
 
 fail3:
-	dp_tx_ext_desc_pool_deinit(soc, num_pool);
+	dp_tx_ext_desc_pool_deinit(soc, num_ext_pool);
 fail2:
 	dp_tx_deinit_static_pools(soc, num_pool);
 fail1:
@@ -6681,16 +6686,16 @@ QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc)
 QDF_STATUS dp_tso_soc_attach(struct cdp_soc_t *txrx_soc)
 {
 	struct dp_soc *soc = (struct dp_soc *)txrx_soc;
-	uint8_t num_pool;
+	uint8_t num_ext_desc_pool;
 	uint32_t num_ext_desc;
 
-	num_pool = wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
+	num_ext_desc_pool = dp_get_ext_tx_desc_pool_num(soc);
 	num_ext_desc = wlan_cfg_get_num_tx_ext_desc(soc->wlan_cfg_ctx);
 
-	if (dp_tx_tso_cmn_desc_pool_alloc(soc, num_pool, num_ext_desc))
+	if (dp_tx_tso_cmn_desc_pool_alloc(soc, num_ext_desc_pool, num_ext_desc))
 		return QDF_STATUS_E_FAILURE;
 
-	if (dp_tx_tso_cmn_desc_pool_init(soc, num_pool, num_ext_desc))
+	if (dp_tx_tso_cmn_desc_pool_init(soc, num_ext_desc_pool, num_ext_desc))
 		return QDF_STATUS_E_FAILURE;
 
 	return QDF_STATUS_SUCCESS;
@@ -6699,10 +6704,10 @@ QDF_STATUS dp_tso_soc_attach(struct cdp_soc_t *txrx_soc)
 QDF_STATUS dp_tso_soc_detach(struct cdp_soc_t *txrx_soc)
 {
 	struct dp_soc *soc = (struct dp_soc *)txrx_soc;
-	uint8_t num_pool = wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
+	uint8_t num_ext_desc_pool = dp_get_ext_tx_desc_pool_num(soc);
 
-	dp_tx_tso_cmn_desc_pool_deinit(soc, num_pool);
-	dp_tx_tso_cmn_desc_pool_free(soc, num_pool);
+	dp_tx_tso_cmn_desc_pool_deinit(soc, num_ext_desc_pool);
+	dp_tx_tso_cmn_desc_pool_free(soc, num_ext_desc_pool);
 
 	return QDF_STATUS_SUCCESS;
 }

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

@@ -429,6 +429,54 @@ dp_ppeds_tx_desc_free(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc)
 	return NULL;
 }
 #endif
+
+#ifdef DP_TX_EXT_DESC_POOL_OPTIMIZE
+/**
+ * dp_tx_ext_desc_pool_override() - Override tx ext desc pool Id
+ * @desc_pool_id: Desc pool Id
+ *
+ * For low mem profiles the number of ext_tx_desc_pool is reduced to 1.
+ * Since in Tx path the desc_pool_id is filled based on CPU core,
+ * dp_tx_ext_desc_pool_override will return the desc_pool_id as 0 for lowmem
+ * profiles.
+ *
+ * Return: updated tx_ext_desc_pool Id
+ */
+static inline uint8_t dp_tx_ext_desc_pool_override(uint8_t desc_pool_id)
+{
+	return 0;
+}
+
+/**
+ * dp_get_ext_tx_desc_pool_num() - get the number of ext_tx_desc pool
+ * @soc: core txrx main context
+ *
+ * For lowmem profiles the number of ext_tx_desc pool is reduced to 1 for
+ * memory optimizations.
+ * Based on this flag DP_TX_EXT_DESC_POOL_OPTIMIZE dp_get_ext_tx_desc_pool_num
+ * will return reduced desc_pool value 1 for low mem profile and for the other
+ * profiles it will return the same value as tx_desc pool.
+ *
+ * Return: number of ext_tx_desc pool
+ */
+
+static inline uint8_t dp_get_ext_tx_desc_pool_num(struct dp_soc *soc)
+{
+	return 1;
+}
+
+#else
+static inline uint8_t dp_tx_ext_desc_pool_override(uint8_t desc_pool_id)
+{
+	return desc_pool_id;
+}
+
+static inline uint8_t dp_get_ext_tx_desc_pool_num(struct dp_soc *soc)
+{
+	return wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
+}
+#endif
+
 #ifndef QCA_HOST_MODE_WIFI_DISABLED
 /**
  * dp_tso_soc_attach() - TSO Attach handler

+ 3 - 0
dp/wifi3.0/dp_tx_desc.h

@@ -1205,6 +1205,7 @@ struct dp_tx_ext_desc_elem_s *dp_tx_ext_desc_alloc(struct dp_soc *soc,
 {
 	struct dp_tx_ext_desc_elem_s *c_elem;
 
+	desc_pool_id = dp_tx_ext_desc_pool_override(desc_pool_id);
 	qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 	if (soc->tx_ext_desc[desc_pool_id].num_free <= 0) {
 		qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
@@ -1229,6 +1230,7 @@ struct dp_tx_ext_desc_elem_s *dp_tx_ext_desc_alloc(struct dp_soc *soc,
 static inline void dp_tx_ext_desc_free(struct dp_soc *soc,
 	struct dp_tx_ext_desc_elem_s *elem, uint8_t desc_pool_id)
 {
+	desc_pool_id = dp_tx_ext_desc_pool_override(desc_pool_id);
 	qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 	elem->next = soc->tx_ext_desc[desc_pool_id].freelist;
 	soc->tx_ext_desc[desc_pool_id].freelist = elem;
@@ -1269,6 +1271,7 @@ static inline void dp_tx_ext_desc_free_multiple(struct dp_soc *soc,
 	/* caller should always guarantee atleast list of num_free nodes */
 	qdf_assert_always(tail);
 
+	desc_pool_id = dp_tx_ext_desc_pool_override(desc_pool_id);
 	qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 	tail->next = soc->tx_ext_desc[desc_pool_id].freelist;
 	soc->tx_ext_desc[desc_pool_id].freelist = head;