qcacmn: Add global context for maintaining descriptor count

Add global context to maintain descriptor count at global level.

Change-Id: Ibfe3379bb4a747530794956cc0cba31e423598d3
CRs-Fixed: 3334340
This commit is contained in:
Neha Bisht
2022-11-08 13:55:03 +05:30
committato da Madan Koyyalamudi
parent fbc9c86186
commit 30bc8285d2
12 ha cambiato i file con 347 aggiunte e 1 eliminazioni

Vedi File

@@ -30,6 +30,7 @@
#include "cdp_txrx_ops.h"
#include "cdp_txrx_handle.h"
#include "cdp_txrx_cmn_struct.h"
#include "wlan_objmgr_global_obj.h"
#ifdef ENABLE_VERBOSE_DEBUG
extern bool is_dp_verbose_debug_enabled;
@@ -160,6 +161,69 @@ enum rx_tlv_bw {
typedef void (*ipa_uc_op_cb_type)(uint8_t *op_msg,
void *osif_ctxt);
#ifdef QCA_SUPPORT_GLOBAL_DESC
/* Global level structure for total descriptors in use */
struct dp_global_desc_context {
qdf_atomic_t global_descriptor_in_use;
};
/**
* cdp_global_ctx_init() - to initialise global context for tx descriptors
*
* Return: QDF_STATUS on success
*/
static inline QDF_STATUS cdp_global_ctx_init(void)
{
struct dp_global_desc_context *dp_global;
QDF_STATUS status = QDF_STATUS_SUCCESS;
if (wlan_objmgr_get_desc_ctx()) {
dp_err("Global object is already created");
return QDF_STATUS_SUCCESS;
}
dp_global = (struct dp_global_desc_context *)
qdf_mem_malloc(sizeof(*dp_global));
if (!dp_global)
return QDF_STATUS_E_FAILURE;
wlan_objmgr_set_desc_ctx(dp_global);
qdf_atomic_set(&dp_global->global_descriptor_in_use, 0);
return status;
}
/**
* cdp_global_ctx_deinit() - to deinitialise global context for tx descriptors
*
* Return: SUCCESS status on success
*/
static inline QDF_STATUS cdp_global_ctx_deinit(void)
{
struct dp_global_desc_context *dp_global = wlan_objmgr_get_desc_ctx();
QDF_STATUS status = QDF_STATUS_SUCCESS;
if (!dp_global)
return QDF_STATUS_SUCCESS;
qdf_mem_free(dp_global);
wlan_objmgr_set_desc_ctx(NULL);
return status;
}
#else
static inline QDF_STATUS cdp_global_ctx_init(void)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS cdp_global_ctx_deinit(void)
{
return QDF_STATUS_SUCCESS;
}
#endif
static inline QDF_STATUS
cdp_soc_attach_target(ol_txrx_soc_handle soc)
{

Vedi File

@@ -2605,6 +2605,25 @@ dp_print_pdev_rx_stats(struct dp_pdev *pdev);
*/
void dp_print_soc_tx_stats(struct dp_soc *soc);
#ifdef QCA_SUPPORT_GLOBAL_DESC
/**
* dp_print_global_desc_count(): Print global desc in use
*
* Return: void
*/
void dp_print_global_desc_count(void);
#else
/**
* dp_print_global_desc_count(): Print global desc in use
*
* Return: void
*/
static inline
void dp_print_global_desc_count(void)
{
}
#endif
/**
* dp_print_soc_interrupt_stats() - Print interrupt stats for the soc
* @soc: dp_soc handle

Vedi File

@@ -10256,6 +10256,7 @@ dp_print_host_stats(struct dp_vdev *vdev,
case TXRX_TX_HOST_STATS:
dp_print_pdev_tx_stats(pdev);
dp_print_soc_tx_stats(pdev->soc);
dp_print_global_desc_count();
break;
case TXRX_RX_HOST_STATS:
dp_print_pdev_rx_stats(pdev);

Vedi File

@@ -20,6 +20,7 @@
#include "qdf_module.h"
#include "dp_peer.h"
#include "dp_types.h"
#include "dp_tx.h"
#include "dp_internal.h"
#include "htt_stats.h"
#include "htt_ppdu_stats.h"
@@ -7732,6 +7733,18 @@ void dp_print_tx_ppeds_stats(struct dp_soc *soc)
}
#endif
#ifdef QCA_SUPPORT_GLOBAL_DESC
void dp_print_global_desc_count(void)
{
struct dp_global_desc_context *dp_global;
dp_global = wlan_objmgr_get_desc_ctx();
DP_PRINT_STATS("Global Tx Descriptors in use = %u",
dp_tx_get_global_desc_in_use(dp_global));
}
#endif
void
dp_print_soc_tx_stats(struct dp_soc *soc)
{

Vedi File

@@ -1151,6 +1151,20 @@ dp_update_tx_desc_stats(struct dp_pdev *pdev)
}
#endif /* CONFIG_WLAN_SYSFS_MEM_STATS */
#ifdef QCA_SUPPORT_GLOBAL_DESC
/**
* dp_tx_get_global_desc_in_use() - read global descriptors in usage
* @dp_global: Datapath global context
*
* Return: global descriptors in use
*/
static inline int32_t
dp_tx_get_global_desc_in_use(struct dp_global_desc_context *dp_global)
{
return qdf_atomic_read(&dp_global->global_descriptor_in_use);
}
#endif
#ifdef QCA_TX_LIMIT_CHECK
static inline bool is_spl_packet(qdf_nbuf_t nbuf)
{
@@ -1159,6 +1173,92 @@ static inline bool is_spl_packet(qdf_nbuf_t nbuf)
return false;
}
#ifdef QCA_SUPPORT_GLOBAL_DESC
/**
* is_dp_spl_tx_limit_reached - Check if the packet is a special packet to allow
* allocation if allocated tx descriptors are within the global max limit
* and pdev max limit.
* @vdev: DP vdev handle
*
* Return: true if allocated tx descriptors reached max configured value, else
* false
*/
static inline bool
is_dp_spl_tx_limit_reached(struct dp_vdev *vdev, qdf_nbuf_t nbuf)
{
struct dp_pdev *pdev = vdev->pdev;
struct dp_soc *soc = pdev->soc;
struct dp_global_desc_context *dp_global;
uint32_t global_tx_desc_allowed;
dp_global = wlan_objmgr_get_desc_ctx();
global_tx_desc_allowed =
wlan_cfg_get_num_global_tx_desc(soc->wlan_cfg_ctx);
if (is_spl_packet(nbuf)) {
if (dp_tx_get_global_desc_in_use(dp_global) >=
global_tx_desc_allowed)
return true;
if (qdf_atomic_read(&pdev->num_tx_outstanding) >=
pdev->num_tx_allowed)
return true;
return false;
}
return true;
}
/**
* dp_tx_limit_check - Check if allocated tx descriptors reached
* global max reg limit and pdev max reg limit for regular packets. Also check
* if the limit is reached for special packets.
* @vdev: DP vdev handle
*
* Return: true if allocated tx descriptors reached max limit for regular
* packets and in case of special packets, if the limit is reached max
* configured vale for the soc/pdev, else false
*/
static inline bool
dp_tx_limit_check(struct dp_vdev *vdev, qdf_nbuf_t nbuf)
{
struct dp_pdev *pdev = vdev->pdev;
struct dp_soc *soc = pdev->soc;
struct dp_global_desc_context *dp_global;
uint32_t global_tx_desc_allowed;
uint32_t global_tx_desc_reg_allowed;
uint32_t global_tx_desc_spcl_allowed;
dp_global = wlan_objmgr_get_desc_ctx();
global_tx_desc_allowed =
wlan_cfg_get_num_global_tx_desc(soc->wlan_cfg_ctx);
global_tx_desc_spcl_allowed =
wlan_cfg_get_num_global_spcl_tx_desc(soc->wlan_cfg_ctx);
global_tx_desc_reg_allowed = global_tx_desc_allowed -
global_tx_desc_spcl_allowed;
if (dp_tx_get_global_desc_in_use(dp_global) >= global_tx_desc_reg_allowed) {
if (is_dp_spl_tx_limit_reached(vdev, nbuf)) {
dp_tx_info("queued packets are more than max tx, drop the frame");
DP_STATS_INC(vdev, tx_i.dropped.desc_na.num, 1);
return true;
}
}
if (qdf_atomic_read(&pdev->num_tx_outstanding) >=
pdev->num_reg_tx_allowed) {
if (is_dp_spl_tx_limit_reached(vdev, nbuf)) {
dp_tx_info("queued packets are more than max tx, drop the frame");
DP_STATS_INC(vdev, tx_i.dropped.desc_na.num, 1);
DP_STATS_INC(vdev,
tx_i.dropped.desc_na_exc_outstand.num, 1);
return true;
}
}
return false;
}
#else
/**
* is_dp_spl_tx_limit_reached - Check if the packet is a special packet to allow
* allocation if allocated tx descriptors are within the soc max limit
@@ -1226,6 +1326,7 @@ dp_tx_limit_check(struct dp_vdev *vdev, qdf_nbuf_t nbuf)
}
return false;
}
#endif
/**
* dp_tx_exception_limit_check - Check if allocated tx exception descriptors
@@ -1251,6 +1352,44 @@ dp_tx_exception_limit_check(struct dp_vdev *vdev)
return false;
}
#ifdef QCA_SUPPORT_GLOBAL_DESC
/**
* dp_tx_outstanding_inc - Inc outstanding tx desc values on global and pdev
* @vdev: DP pdev handle
*
* Return: void
*/
static inline void
dp_tx_outstanding_inc(struct dp_pdev *pdev)
{
struct dp_global_desc_context *dp_global;
dp_global = wlan_objmgr_get_desc_ctx();
qdf_atomic_inc(&dp_global->global_descriptor_in_use);
qdf_atomic_inc(&pdev->num_tx_outstanding);
dp_update_tx_desc_stats(pdev);
}
/**
* dp_tx_outstanding__dec - Dec outstanding tx desc values on global and pdev
* @vdev: DP pdev handle
*
* Return: void
*/
static inline void
dp_tx_outstanding_dec(struct dp_pdev *pdev)
{
struct dp_global_desc_context *dp_global;
dp_global = wlan_objmgr_get_desc_ctx();
qdf_atomic_dec(&dp_global->global_descriptor_in_use);
qdf_atomic_dec(&pdev->num_tx_outstanding);
dp_update_tx_desc_stats(pdev);
}
#else
/**
* dp_tx_outstanding_inc - Increment outstanding tx desc values on pdev and soc
* @vdev: DP pdev handle
@@ -1282,6 +1421,7 @@ dp_tx_outstanding_dec(struct dp_pdev *pdev)
qdf_atomic_dec(&soc->num_tx_outstanding);
dp_update_tx_desc_stats(pdev);
}
#endif /* QCA_SUPPORT_GLOBAL_DESC */
#else //QCA_TX_LIMIT_CHECK
static inline bool
@@ -1310,6 +1450,7 @@ dp_tx_outstanding_dec(struct dp_pdev *pdev)
dp_update_tx_desc_stats(pdev);
}
#endif //QCA_TX_LIMIT_CHECK
/**
* dp_tx_get_pkt_len() - Get the packet length of a msdu
* @tx_desc: tx descriptor

Vedi File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. 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
@@ -28,6 +28,7 @@
#include <wlan_serialization_api.h>
#include "wlan_psoc_mlme_api.h"
#include <include/wlan_mlme_cmn.h>
#include "cdp_txrx_cmn.h"
#ifdef WLAN_ATF_ENABLE
#include <wlan_atf_utils_api.h>
#endif
@@ -1102,6 +1103,9 @@ QDF_STATUS dispatcher_init(void)
if (QDF_STATUS_SUCCESS != wlan_objmgr_global_obj_init())
goto out;
if (QDF_STATUS_SUCCESS != cdp_global_ctx_init())
goto global_desc_init_fail;
if (QDF_STATUS_SUCCESS != wlan_mlo_mgr_init())
goto mgmt_mlo_mgr_fail;
@@ -1254,6 +1258,8 @@ mgmt_txrx_init_fail:
wlan_objmgr_global_obj_deinit();
mgmt_mlo_mgr_fail:
wlan_mlo_mgr_deinit();
global_desc_init_fail:
cdp_global_ctx_deinit();
out:
return QDF_STATUS_E_FAILURE;
@@ -1323,6 +1329,8 @@ QDF_STATUS dispatcher_deinit(void)
QDF_BUG(QDF_STATUS_SUCCESS == wlan_mlo_mgr_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == cdp_global_ctx_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == wlan_objmgr_global_obj_deinit());
return QDF_STATUS_SUCCESS;

Vedi File

@@ -557,6 +557,27 @@ QDF_STATUS wlan_objmgr_iterate_psoc_list(
struct wlan_objmgr_psoc
*wlan_objmgr_get_psoc_by_id(uint8_t psoc_id, wlan_objmgr_ref_dbgid dbg_id);
#ifdef QCA_SUPPORT_GLOBAL_DESC
/**
* wlan_objmgr_get_desc_ctx() - Get global desc context from global umac object
*
* This API is used to get desc context object from the global umac object
*
* Return: Pointer to the desc context
*/
struct dp_global_desc_context *wlan_objmgr_get_desc_ctx(void);
/**
* wlan_objmgr_set_desc_ctx() - Set global desc context in global umac object
* @ctx: desc context to be set
*
* This API is used to set desc context object in the global umac object
*
* Return:
*/
void wlan_objmgr_set_desc_ctx(struct dp_global_desc_context *ctx);
#endif
#ifdef WLAN_FEATURE_11BE_MLO
/**
* wlan_objmgr_get_mlo_ctx() - Get MLO context from global umac object

Vedi File

@@ -900,6 +900,22 @@ struct wlan_objmgr_psoc
qdf_export_symbol(wlan_objmgr_get_psoc_by_id);
#ifdef QCA_SUPPORT_GLOBAL_DESC
struct dp_global_desc_context *wlan_objmgr_get_desc_ctx(void)
{
return g_umac_glb_obj->desc_ctx;
}
qdf_export_symbol(wlan_objmgr_get_desc_ctx);
void wlan_objmgr_set_desc_ctx(struct dp_global_desc_context *ctx)
{
g_umac_glb_obj->desc_ctx = ctx;
}
qdf_export_symbol(wlan_objmgr_set_desc_ctx);
#endif
#ifdef WLAN_FEATURE_11BE_MLO
struct mlo_mgr_context *wlan_objmgr_get_mlo_ctx(void)
{

Vedi File

@@ -34,6 +34,7 @@ struct wlan_objmgr_debug_info;
* @psoc: Array of PSOCs to maintain PSOC's list,
* its optional
* @mlo_ctx: MLO manager global context
* @desc_ctx: DP global desc context
* @psoc_create_handler: PSOC create handler array
* @psoc_create_handler_arg: PSOC create handler args array
* @psoc_destroy_handler: PSOC destroy handler array
@@ -66,6 +67,9 @@ struct wlan_objmgr_global {
struct wlan_objmgr_psoc *psoc[WLAN_OBJMGR_MAX_DEVICES];
#ifdef WLAN_FEATURE_11BE_MLO
struct mlo_mgr_context *mlo_ctx;
#endif
#ifdef QCA_SUPPORT_GLOBAL_DESC
struct dp_global_desc_context *desc_ctx;
#endif
wlan_objmgr_psoc_create_handler
psoc_create_handler[WLAN_UMAC_MAX_COMPONENTS];

Vedi File

@@ -372,6 +372,14 @@
#define WLAN_CFG_TX_SW_INTERNODE_QUEUE_MIN 128
#define WLAN_CFG_TX_SW_INTERNODE_QUEUE_MAX 1024
#define WLAN_CFG_TX_DESC_GLOBAL_COUNT 0xC000
#define WLAN_CFG_TX_DESC_GLOBAL_COUNT_MIN 0x8000
#define WLAN_CFG_TX_DESC_GLOBAL_COUNT_MAX 0x60000
#define WLAN_CFG_SPCL_TX_DESC_GLOBAL_COUNT 0x400
#define WLAN_CFG_SPCL_TX_DESC_GLOBAL_COUNT_MIN 0x400
#define WLAN_CFG_SPCL_TX_DESC_GLOBAL_COUNT_MAX 0x1000
#define WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE 4096
#define WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE_MIN 16
#define WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE_MAX 8192
@@ -1194,6 +1202,20 @@
WLAN_CFG_TX_SW_INTERNODE_QUEUE, \
CFG_VALUE_OR_DEFAULT, "DP TX SW internode queue")
#define CFG_DP_TX_DESC_GLOBAL_COUNT \
CFG_INI_UINT("dp_tx_desc_global", \
WLAN_CFG_TX_DESC_GLOBAL_COUNT_MIN, \
WLAN_CFG_TX_DESC_GLOBAL_COUNT_MAX, \
WLAN_CFG_TX_DESC_GLOBAL_COUNT, \
CFG_VALUE_OR_DEFAULT, "DP Global TX descriptor count")
#define CFG_DP_SPCL_TX_DESC_GLOBAL_COUNT \
CFG_INI_UINT("dp_spcl_tx_desc_global", \
WLAN_CFG_SPCL_TX_DESC_GLOBAL_COUNT_MIN, \
WLAN_CFG_SPCL_TX_DESC_GLOBAL_COUNT_MAX, \
WLAN_CFG_SPCL_TX_DESC_GLOBAL_COUNT, \
CFG_VALUE_OR_DEFAULT, "DP Global special TX descriptor count")
#define CFG_DP_RXDMA_MONITOR_BUF_RING \
CFG_INI_UINT("dp_rxdma_monitor_buf_ring", \
WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE_MIN, \
@@ -1898,6 +1920,8 @@
CFG(CFG_DP_TX_DEVICE_LIMIT) \
CFG(CFG_DP_TX_SPL_DEVICE_LIMIT) \
CFG(CFG_DP_TX_SW_INTERNODE_QUEUE) \
CFG(CFG_DP_TX_DESC_GLOBAL_COUNT) \
CFG(CFG_DP_SPCL_TX_DESC_GLOBAL_COUNT) \
CFG(CFG_DP_RXDMA_MONITOR_BUF_RING) \
CFG(CFG_DP_RXDMA_MONITOR_DST_RING) \
CFG(CFG_DP_RXDMA_MONITOR_STATUS_RING) \

Vedi File

@@ -3053,6 +3053,10 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
cfg_get(psoc, CFG_DP_WOW_CHECK_RX_PENDING);
wlan_cfg_ctx->delay_mon_replenish = cfg_get(psoc,
CFG_DP_DELAY_MON_REPLENISH);
wlan_cfg_ctx->num_global_tx_desc = cfg_get(psoc,
CFG_DP_TX_DESC_GLOBAL_COUNT);
wlan_cfg_ctx->num_global_spcl_tx_desc = cfg_get(psoc,
CFG_DP_SPCL_TX_DESC_GLOBAL_COUNT);
wlan_cfg_ctx->rx_mon_buf_ring_size = cfg_get(psoc,
CFG_DP_RXDMA_MONITOR_BUF_RING);
wlan_cfg_ctx->tx_mon_buf_ring_size = cfg_get(psoc,
@@ -3549,6 +3553,16 @@ bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
return cfg->raw_mode_war;
}
int wlan_cfg_get_num_global_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
{
return cfg->num_global_tx_desc;
}
int wlan_cfg_get_num_global_spcl_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
{
return cfg->num_global_spcl_tx_desc;
}
int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
{
return cfg->num_tx_desc;

Vedi File

@@ -153,6 +153,8 @@ struct wlan_srng_cfg {
* @num_nss_reo_dest_rings:
* @num_tx_desc_pool: Number of Tx Descriptor pools
* @num_tx_ext_desc_pool: Number of Tx MSDU extension Descriptor pools
* @num_global_tx_desc: Number of Global Tx Descriptors allowed
* @num_global_spcl_tx_desc: Number of Global special Tx Descriptors allowed
* @num_tx_desc: Number of Tx Descriptors per pool
* @num_tx_spl_desc: Number of Tx Descriptors per pool to handle special frames
* @min_tx_desc: Minimum number of Tx Descriptors per pool
@@ -344,6 +346,8 @@ struct wlan_cfg_dp_soc_ctxt {
int num_nss_reo_dest_rings;
int num_tx_desc_pool;
int num_tx_ext_desc_pool;
int num_global_tx_desc;
int num_global_spcl_tx_desc;
int num_tx_desc;
int num_tx_spl_desc;
int min_tx_desc;
@@ -1185,6 +1189,23 @@ bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg);
*/
void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool);
/**
* wlan_cfg_get_num_global_tx_desc() - Number of global Tx Descriptors allowed
* @wlan_cfg_ctx: Configuration Handle
*
* Return: num_global_tx_desc
*/
int wlan_cfg_get_num_global_tx_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
/**
* wlan_cfg_get_num_global_spcl_tx_desc() - Number of global special Tx Descriptors
* allowed
* @wlan_cfg_ctx: Configuration Handle
*
* Return: num_global_spcl_tx_desc
*/
int wlan_cfg_get_num_global_spcl_tx_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
/**
* wlan_cfg_get_num_tx_desc() - Number of Tx Descriptors per pool
* @wlan_cfg_ctx: Configuration Handle