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
This commit is contained in:
Saket Jha
2020-01-28 16:53:34 -08:00
committed by nshrivas
parent ccb34ac40a
commit a4a994242f
6 changed files with 87 additions and 30 deletions

View File

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

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@@ -17,10 +17,10 @@
#ifndef _DP_IPA_H_ #ifndef _DP_IPA_H_
#define _DP_IPA_H_ #define _DP_IPA_H_
#define IPA_TCL_DATA_RING_IDX 2
#ifdef IPA_OFFLOAD #ifdef IPA_OFFLOAD
#define DP_IPA_MAX_IFACE 3 #define DP_IPA_MAX_IFACE 3
#define IPA_TCL_DATA_RING_IDX 2
#define IPA_TX_COMP_RING_IDX 2 #define IPA_TX_COMP_RING_IDX 2
#define IPA_REO_DEST_RING_IDX 3 #define IPA_REO_DEST_RING_IDX 3
#define IPA_RX_REFILL_BUF_RING_IDX 2 #define IPA_RX_REFILL_BUF_RING_IDX 2

View File

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

View File

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

View File

@@ -153,6 +153,20 @@ struct dp_tx_msdu_info_s {
uint8_t is_tx_sniffer; 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_attach(struct dp_vdev *vdev);
QDF_STATUS dp_tx_vdev_detach(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); void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev);

View File

@@ -829,10 +829,17 @@ int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
return cfg->per_pdev_lmac_ring; 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) int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
{ {
return cfg->num_tcl_data_rings; return cfg->num_tcl_data_rings;
} }
#endif
int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
{ {