qcacmn: Create a wlan configuration table for ring types

1. Add config table to accommodate per ring type
   configuration to have a finer control over the
   ring.
2. Provide struct wlan_srng_cfg interface to add
   more parameters to control the ring.
3. Add interrupt threshold configuration parameters
   to wlan_srng_cfg structure.
4. Add WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING
   and WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING to have
   different timer values for REO and WBM ring.

Change-Id: Ied50e3241ab2cc181ca4ed7f126959cd5d9d2de5
CRs-Fixed: 2455297
This commit is contained in:
Venkata Sharath Chandra Manchala
2019-05-16 17:33:18 -07:00
committed by nshrivas
parent 95101bb281
commit cb6d0c0741
5 changed files with 227 additions and 40 deletions

View File

@@ -1189,9 +1189,95 @@ dp_srng_mem_alloc(struct dp_soc *soc, struct dp_srng *srng, uint32_t align,
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
#ifdef WLAN_DP_PER_RING_TYPE_CONFIG
/**
* dp_srng_configure_interrupt_thresholds() - Retrieve interrupt
* threshold values from the wlan_srng_cfg table for each ring type
* @soc: device handle
* @ring_params: per ring specific parameters
* @ring_type: Ring type
* @ring_num: Ring number for a given ring type
*
* Fill the ring params with the interrupt threshold
* configuration parameters available in the per ring type wlan_srng_cfg
* table.
*
* Return: None
*/
static void
dp_srng_configure_interrupt_thresholds(struct dp_soc *soc,
struct hal_srng_params *ring_params,
int ring_type, int ring_num,
int num_entries)
{
if (ring_type == WBM2SW_RELEASE && (ring_num == 3)) {
ring_params->intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_other(soc->wlan_cfg_ctx);
ring_params->intr_batch_cntr_thres_entries =
wlan_cfg_get_int_batch_threshold_other(soc->wlan_cfg_ctx);
} else {
ring_params->intr_timer_thres_us =
soc->wlan_srng_cfg[ring_type].timer_threshold;
ring_params->intr_batch_cntr_thres_entries =
soc->wlan_srng_cfg[ring_type].batch_count_threshold;
}
ring_params->low_threshold =
soc->wlan_srng_cfg[ring_type].low_threshold;
/* if (ring_params->low_threshold)
* dp_setup_srng - Internal function to setup SRNG rings used by data path ring_params->flags |= HAL_SRNG_LOW_THRES_INTR_ENABLE;
}
#else
static void
dp_srng_configure_interrupt_thresholds(struct dp_soc *soc,
struct hal_srng_params *ring_params,
int ring_type, int ring_num,
int num_entries)
{
if (ring_type == REO_DST) {
ring_params->intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx);
ring_params->intr_batch_cntr_thres_entries =
wlan_cfg_get_int_batch_threshold_rx(soc->wlan_cfg_ctx);
} else if (ring_type == WBM2SW_RELEASE && (ring_num < 3)) {
ring_params->intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_tx(soc->wlan_cfg_ctx);
ring_params->intr_batch_cntr_thres_entries =
wlan_cfg_get_int_batch_threshold_tx(soc->wlan_cfg_ctx);
} else {
ring_params->intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_other(soc->wlan_cfg_ctx);
ring_params->intr_batch_cntr_thres_entries =
wlan_cfg_get_int_batch_threshold_other(soc->wlan_cfg_ctx);
}
/* Enable low threshold interrupts for rx buffer rings (regular and
* monitor buffer rings.
* TODO: See if this is required for any other ring
*/
if ((ring_type == RXDMA_BUF) || (ring_type == RXDMA_MONITOR_BUF) ||
(ring_type == RXDMA_MONITOR_STATUS)) {
/* TODO: Setting low threshold to 1/8th of ring size
* see if this needs to be configurable
*/
ring_params->low_threshold = num_entries >> 3;
ring_params->intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx);
ring_params->flags |= HAL_SRNG_LOW_THRES_INTR_ENABLE;
ring_params->intr_batch_cntr_thres_entries = 0;
}
}
#endif
/**
* dp_srng_setup() - Internal function to setup SRNG rings used by data path
* @soc: datapath soc handle
* @srng: srng handle
* @ring_type: ring that needs to be configured
* @mac_id: mac number
* @num_entries: Total number of entries for a given ring
*
* Return: non-zero - failure/zero - success
*/ */
static int dp_srng_setup(struct dp_soc *soc, struct dp_srng *srng, static int dp_srng_setup(struct dp_soc *soc, struct dp_srng *srng,
int ring_type, int ring_num, int mac_id, int ring_type, int ring_num, int mac_id,
@@ -1254,42 +1340,9 @@ static int dp_srng_setup(struct dp_soc *soc, struct dp_srng *srng,
ring_type, ring_num); ring_type, ring_num);
} }
/* dp_srng_configure_interrupt_thresholds(soc, &ring_params,
* Setup interrupt timer and batch counter thresholds for ring_type, ring_num,
* interrupt mitigation based on ring type num_entries);
*/
if (ring_type == REO_DST) {
ring_params.intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx);
ring_params.intr_batch_cntr_thres_entries =
wlan_cfg_get_int_batch_threshold_rx(soc->wlan_cfg_ctx);
} else if (ring_type == WBM2SW_RELEASE && (ring_num < 3)) {
ring_params.intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_tx(soc->wlan_cfg_ctx);
ring_params.intr_batch_cntr_thres_entries =
wlan_cfg_get_int_batch_threshold_tx(soc->wlan_cfg_ctx);
} else {
ring_params.intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_other(soc->wlan_cfg_ctx);
ring_params.intr_batch_cntr_thres_entries =
wlan_cfg_get_int_batch_threshold_other(soc->wlan_cfg_ctx);
}
/* Enable low threshold interrupts for rx buffer rings (regular and
* monitor buffer rings.
* TODO: See if this is required for any other ring
*/
if ((ring_type == RXDMA_BUF) || (ring_type == RXDMA_MONITOR_BUF) ||
(ring_type == RXDMA_MONITOR_STATUS)) {
/* TODO: Setting low threshold to 1/8th of ring size
* see if this needs to be configurable
*/
ring_params.low_threshold = num_entries >> 3;
ring_params.flags |= HAL_SRNG_LOW_THRES_INTR_ENABLE;
ring_params.intr_timer_thres_us =
wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx);
ring_params.intr_batch_cntr_thres_entries = 0;
}
if (cached) { if (cached) {
ring_params.flags |= HAL_SRNG_CACHED_DESC; ring_params.flags |= HAL_SRNG_CACHED_DESC;
@@ -9407,6 +9460,8 @@ dp_soc_attach(void *ctrl_psoc, HTC_HANDLE htc_handle, qdf_device_t qdf_osdev,
soc->osdev = qdf_osdev; soc->osdev = qdf_osdev;
soc->num_hw_dscp_tid_map = HAL_MAX_HW_DSCP_TID_MAPS; soc->num_hw_dscp_tid_map = HAL_MAX_HW_DSCP_TID_MAPS;
wlan_set_srng_cfg(&soc->wlan_srng_cfg);
soc->wlan_cfg_ctx = wlan_cfg_soc_attach(soc->ctrl_psoc); soc->wlan_cfg_ctx = wlan_cfg_soc_attach(soc->ctrl_psoc);
if (!soc->wlan_cfg_ctx) { if (!soc->wlan_cfg_ctx) {
dp_err("wlan_cfg_ctx failed\n"); dp_err("wlan_cfg_ctx failed\n");

View File

@@ -1118,6 +1118,8 @@ struct dp_soc {
uint8_t pcp_tid_map[PCP_TID_MAP_MAX]; uint8_t pcp_tid_map[PCP_TID_MAP_MAX];
/* TID map priority value */ /* TID map priority value */
uint8_t tidmap_prty; uint8_t tidmap_prty;
/* Pointer to global per ring type specific configuration table */
struct wlan_srng_cfg *wlan_srng_cfg;
}; };
#ifdef IPA_OFFLOAD #ifdef IPA_OFFLOAD

View File

@@ -88,6 +88,9 @@
#define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER 8 #define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER 8
#endif #endif
#define WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING 256
#define WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING 256
#define WLAN_CFG_PER_PDEV_RX_RING_MIN 0 #define WLAN_CFG_PER_PDEV_RX_RING_MIN 0
#define WLAN_CFG_PER_PDEV_RX_RING_MAX 0 #define WLAN_CFG_PER_PDEV_RX_RING_MAX 0
@@ -112,6 +115,12 @@
#define WLAN_CFG_INT_BATCH_THRESHOLD_RX_MIN 1 #define WLAN_CFG_INT_BATCH_THRESHOLD_RX_MIN 1
#define WLAN_CFG_INT_BATCH_THRESHOLD_RX_MAX 128 #define WLAN_CFG_INT_BATCH_THRESHOLD_RX_MAX 128
#define WLAN_CFG_INT_BATCH_THRESHOLD_REO_RING_MIN 1
#define WLAN_CFG_INT_BATCH_THRESHOLD_REO_RING_MAX 128
#define WLAN_CFG_INT_BATCH_THRESHOLD_WBM_RELEASE_RING_MIN 1
#define WLAN_CFG_INT_BATCH_THRESHOLD_WBM_RELEASE_RING_MAX 128
#define WLAN_CFG_INT_BATCH_THRESHOLD_OTHER_MIN 1 #define WLAN_CFG_INT_BATCH_THRESHOLD_OTHER_MIN 1
#define WLAN_CFG_INT_BATCH_THRESHOLD_OTHER_MAX 1 #define WLAN_CFG_INT_BATCH_THRESHOLD_OTHER_MAX 1
@@ -124,6 +133,12 @@
#define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER_MIN 8 #define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER_MIN 8
#define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER_MAX 1000 #define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER_MAX 1000
#define WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING_MIN 8
#define WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING_MAX 500
#define WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING_MIN 8
#define WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING_MAX 500
#define WLAN_CFG_NSS_TX_COMP_RING_SIZE 0x2000 #define WLAN_CFG_NSS_TX_COMP_RING_SIZE 0x2000
#define WLAN_CFG_NSS_TX_COMP_RING_SIZE_MIN 0x2000 #define WLAN_CFG_NSS_TX_COMP_RING_SIZE_MIN 0x2000
#define WLAN_CFG_NSS_TX_COMP_RING_SIZE_MAX 0xc000 #define WLAN_CFG_NSS_TX_COMP_RING_SIZE_MAX 0xc000
@@ -257,14 +272,14 @@
WLAN_CFG_INT_BATCH_THRESHOLD_OTHER_MIN, \ WLAN_CFG_INT_BATCH_THRESHOLD_OTHER_MIN, \
WLAN_CFG_INT_BATCH_THRESHOLD_OTHER_MAX, \ WLAN_CFG_INT_BATCH_THRESHOLD_OTHER_MAX, \
WLAN_CFG_INT_BATCH_THRESHOLD_OTHER, \ WLAN_CFG_INT_BATCH_THRESHOLD_OTHER, \
CFG_VALUE_OR_DEFAULT, "DP INT threshold Other") CFG_VALUE_OR_DEFAULT, "DP INT batch threshold Other")
#define CFG_DP_INT_BATCH_THRESHOLD_RX \ #define CFG_DP_INT_BATCH_THRESHOLD_RX \
CFG_INI_UINT("dp_int_batch_threshold_rx", \ CFG_INI_UINT("dp_int_batch_threshold_rx", \
WLAN_CFG_INT_BATCH_THRESHOLD_RX_MIN, \ WLAN_CFG_INT_BATCH_THRESHOLD_RX_MIN, \
WLAN_CFG_INT_BATCH_THRESHOLD_RX_MAX, \ WLAN_CFG_INT_BATCH_THRESHOLD_RX_MAX, \
WLAN_CFG_INT_BATCH_THRESHOLD_RX, \ WLAN_CFG_INT_BATCH_THRESHOLD_RX, \
CFG_VALUE_OR_DEFAULT, "DP INT threshold Rx") CFG_VALUE_OR_DEFAULT, "DP INT batch threshold Rx")
#define CFG_DP_INT_BATCH_THRESHOLD_TX \ #define CFG_DP_INT_BATCH_THRESHOLD_TX \
CFG_INI_UINT("dp_int_batch_threshold_tx", \ CFG_INI_UINT("dp_int_batch_threshold_tx", \
@@ -287,6 +302,20 @@
WLAN_CFG_INT_TIMER_THRESHOLD_RX, \ WLAN_CFG_INT_TIMER_THRESHOLD_RX, \
CFG_VALUE_OR_DEFAULT, "DP INT timer threshold Rx") CFG_VALUE_OR_DEFAULT, "DP INT timer threshold Rx")
#define CFG_DP_INT_TIMER_THRESHOLD_REO_RING \
CFG_INI_UINT("dp_int_timer_threshold_reo_ring", \
WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING_MIN, \
WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING_MAX, \
WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING, \
CFG_VALUE_OR_DEFAULT, "DP INT timer threshold Reo ring")
#define CFG_DP_INT_TIMER_THRESHOLD_WBM_RELEASE_RING \
CFG_INI_UINT("dp_int_timer_threshold_wbm_release_ring", \
WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING_MIN, \
WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING_MAX, \
WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING, \
CFG_VALUE_OR_DEFAULT, "DP INT timer threshold wbm release ring")
#define CFG_DP_INT_TIMER_THRESHOLD_TX \ #define CFG_DP_INT_TIMER_THRESHOLD_TX \
CFG_INI_UINT("dp_int_timer_threshold_tx", \ CFG_INI_UINT("dp_int_timer_threshold_tx", \
WLAN_CFG_INT_TIMER_THRESHOLD_TX_MIN, \ WLAN_CFG_INT_TIMER_THRESHOLD_TX_MIN, \

View File

@@ -27,6 +27,7 @@
#include <cdp_txrx_ops.h> #include <cdp_txrx_ops.h>
#include "wlan_cfg.h" #include "wlan_cfg.h"
#include "cfg_ucfg_api.h" #include "cfg_ucfg_api.h"
#include "hal_api.h"
/* /*
* FIX THIS - * FIX THIS -
@@ -202,6 +203,82 @@ static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
WLAN_CFG_REO_STATUS_RING_MASK_3}; WLAN_CFG_REO_STATUS_RING_MASK_3};
#endif /*CONFIG_MCL*/ #endif /*CONFIG_MCL*/
/**
* g_wlan_srng_cfg[] - Per ring_type specific configuration
*
*/
struct wlan_srng_cfg g_wlan_srng_cfg[MAX_RING_TYPES];
/* REO_DST ring configuration */
struct wlan_srng_cfg wlan_srng_reo_cfg = {
.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING,
.batch_count_threshold = 0,
.low_threshold = 0,
};
/* WBM2SW_RELEASE ring configuration */
struct wlan_srng_cfg wlan_srng_wbm_release_cfg = {
.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING,
.batch_count_threshold = 0,
.low_threshold = 0,
};
/* RXDMA_BUF ring configuration */
struct wlan_srng_cfg wlan_srng_rxdma_buf_cfg = {
.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
.batch_count_threshold = 0,
.low_threshold = WLAN_CFG_RXDMA_REFILL_RING_SIZE >> 3,
};
/* RXDMA_MONITOR_BUF ring configuration */
struct wlan_srng_cfg wlan_srng_rxdma_monitor_buf_cfg = {
.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
.batch_count_threshold = 0,
.low_threshold = WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE >> 3,
};
/* RXDMA_MONITOR_STATUS ring configuration */
struct wlan_srng_cfg wlan_srng_rxdma_monitor_status_cfg = {
.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
.batch_count_threshold = 0,
.low_threshold = WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE >> 3,
};
/* DEFAULT_CONFIG ring configuration */
struct wlan_srng_cfg wlan_srng_default_cfg = {
.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_OTHER,
.batch_count_threshold = WLAN_CFG_INT_BATCH_THRESHOLD_OTHER,
.low_threshold = 0,
};
void wlan_set_srng_cfg(struct wlan_srng_cfg **wlan_cfg)
{
g_wlan_srng_cfg[REO_DST] = wlan_srng_reo_cfg;
g_wlan_srng_cfg[WBM2SW_RELEASE] = wlan_srng_wbm_release_cfg;
g_wlan_srng_cfg[REO_EXCEPTION] = wlan_srng_default_cfg;
g_wlan_srng_cfg[REO_REINJECT] = wlan_srng_default_cfg;
g_wlan_srng_cfg[REO_CMD] = wlan_srng_default_cfg;
g_wlan_srng_cfg[REO_STATUS] = wlan_srng_default_cfg;
g_wlan_srng_cfg[TCL_DATA] = wlan_srng_default_cfg;
g_wlan_srng_cfg[TCL_CMD] = wlan_srng_default_cfg;
g_wlan_srng_cfg[TCL_STATUS] = wlan_srng_default_cfg;
g_wlan_srng_cfg[WBM_IDLE_LINK] = wlan_srng_default_cfg;
g_wlan_srng_cfg[SW2WBM_RELEASE] = wlan_srng_default_cfg;
g_wlan_srng_cfg[RXDMA_BUF] = wlan_srng_rxdma_buf_cfg;
g_wlan_srng_cfg[RXDMA_DST] = wlan_srng_default_cfg;
g_wlan_srng_cfg[RXDMA_MONITOR_BUF] =
wlan_srng_rxdma_monitor_buf_cfg;
g_wlan_srng_cfg[RXDMA_MONITOR_STATUS] =
wlan_srng_rxdma_monitor_status_cfg;
g_wlan_srng_cfg[RXDMA_MONITOR_DST] = wlan_srng_default_cfg;
g_wlan_srng_cfg[RXDMA_MONITOR_DESC] = wlan_srng_default_cfg;
g_wlan_srng_cfg[DIR_BUF_RX_DMA_SRC] = wlan_srng_default_cfg;
#ifdef WLAN_FEATURE_CIF_CFR
g_wlan_srng_cfg[WIFI_POS_SRC] = wlan_srng_default_cfg;
#endif
*wlan_cfg = g_wlan_srng_cfg;
}
/** /**
* wlan_cfg_soc_attach() - Allocate and prepare SoC configuration * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
* @psoc - Object manager psoc * @psoc - Object manager psoc
@@ -241,6 +318,7 @@ struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void *psoc)
wlan_cfg_ctx->tx_comp_ring_size_nss = wlan_cfg_ctx->tx_comp_ring_size_nss =
cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE); cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
wlan_cfg_ctx->int_batch_threshold_tx = wlan_cfg_ctx->int_batch_threshold_tx =
cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX); cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
wlan_cfg_ctx->int_timer_threshold_tx = wlan_cfg_ctx->int_timer_threshold_tx =

View File

@@ -74,6 +74,19 @@
struct wlan_cfg_dp_pdev_ctxt; struct wlan_cfg_dp_pdev_ctxt;
/**
* struct wlan_srng_cfg - Per ring configuration parameters
* @timer_threshold: Config to control interrupts based on timer duration
* @batch_count_threshold: Config to control interrupts based on
* number of packets in the ring
* @low_threshold: Config to control low threshold interrupts for SRC rings
*/
struct wlan_srng_cfg {
uint32_t timer_threshold;
uint32_t batch_count_threshold;
uint32_t low_threshold;
};
/** /**
* struct wlan_cfg_dp_soc_ctxt - Configuration parameters for SoC (core TxRx) * struct wlan_cfg_dp_soc_ctxt - Configuration parameters for SoC (core TxRx)
* @num_int_ctxts: Number of NAPI/Interrupt contexts to be registered for DP * @num_int_ctxts: Number of NAPI/Interrupt contexts to be registered for DP
@@ -1002,6 +1015,16 @@ wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg);
bool bool
wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg, wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
enum cdp_capabilities dp_caps); enum cdp_capabilities dp_caps);
/**
* wlan_set_srng_cfg() - Fill per ring specific
* configuration parameters
* @wlan_cfg: global srng configuration table
*
* Return: None
*/
void wlan_set_srng_cfg(struct wlan_srng_cfg **wlan_cfg);
#ifdef QCA_LL_TX_FLOW_CONTROL_V2 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg); int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg);