diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index b263ca24fb..5d9416ead9 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -1189,9 +1189,95 @@ dp_srng_mem_alloc(struct dp_soc *soc, struct dp_srng *srng, uint32_t align, 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; -/* - * dp_setup_srng - Internal function to setup SRNG rings used by data path + if (ring_params->low_threshold) + 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, 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); } - /* - * Setup interrupt timer and batch counter thresholds for - * interrupt mitigation based on ring type - */ - 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; - } + dp_srng_configure_interrupt_thresholds(soc, &ring_params, + ring_type, ring_num, + num_entries); if (cached) { 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->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); if (!soc->wlan_cfg_ctx) { dp_err("wlan_cfg_ctx failed\n"); diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index fc0ed82e3f..8bab926be9 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1118,6 +1118,8 @@ struct dp_soc { uint8_t pcp_tid_map[PCP_TID_MAP_MAX]; /* TID map priority value */ uint8_t tidmap_prty; + /* Pointer to global per ring type specific configuration table */ + struct wlan_srng_cfg *wlan_srng_cfg; }; #ifdef IPA_OFFLOAD diff --git a/wlan_cfg/cfg_dp.h b/wlan_cfg/cfg_dp.h index 452e67f01a..402bba6cf5 100644 --- a/wlan_cfg/cfg_dp.h +++ b/wlan_cfg/cfg_dp.h @@ -88,6 +88,9 @@ #define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER 8 #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_MAX 0 @@ -112,6 +115,12 @@ #define WLAN_CFG_INT_BATCH_THRESHOLD_RX_MIN 1 #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_MAX 1 @@ -124,6 +133,12 @@ #define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER_MIN 8 #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_MIN 0x2000 #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_MAX, \ 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 \ CFG_INI_UINT("dp_int_batch_threshold_rx", \ WLAN_CFG_INT_BATCH_THRESHOLD_RX_MIN, \ WLAN_CFG_INT_BATCH_THRESHOLD_RX_MAX, \ 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 \ CFG_INI_UINT("dp_int_batch_threshold_tx", \ @@ -287,6 +302,20 @@ WLAN_CFG_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 \ CFG_INI_UINT("dp_int_timer_threshold_tx", \ WLAN_CFG_INT_TIMER_THRESHOLD_TX_MIN, \ diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 9de7abd8b2..44a5ffb8e6 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -27,6 +27,7 @@ #include #include "wlan_cfg.h" #include "cfg_ucfg_api.h" +#include "hal_api.h" /* * 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}; #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 * @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 = cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE); + wlan_cfg_ctx->int_batch_threshold_tx = cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX); wlan_cfg_ctx->int_timer_threshold_tx = diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index a4928cbb8c..a50fcc016f 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -74,6 +74,19 @@ 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) * @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 wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg, 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 int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg);