qcacmn: Add global context

Global context will contain fst context, fst ref count
and global desc count.

Change-Id: I272fa2c3b8945822268d29b6c329df3f659753d4
CRs-Fixed: 3392039
This commit is contained in:
Varsha Mishra
2023-02-10 17:40:00 +05:30
committed by Madan Koyyalamudi
parent 5cf8f4a9a4
commit d6afad86bc
13 changed files with 123 additions and 159 deletions

View File

@@ -161,9 +161,11 @@ 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 {
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
/* Global level structure for win contexts */
struct dp_global_context {
struct dp_rx_fst *fst_ctx;
qdf_atomic_t rx_fst_ref_cnt;
qdf_atomic_t global_descriptor_in_use;
};
@@ -174,22 +176,24 @@ struct dp_global_desc_context {
*/
static inline QDF_STATUS cdp_global_ctx_init(void)
{
struct dp_global_desc_context *dp_global;
struct dp_global_context *dp_global;
QDF_STATUS status = QDF_STATUS_SUCCESS;
if (wlan_objmgr_get_desc_ctx()) {
if (wlan_objmgr_get_global_ctx()) {
dp_err("Global object is already created");
return QDF_STATUS_SUCCESS;
}
dp_global = (struct dp_global_desc_context *)
dp_global = (struct dp_global_context *)
qdf_mem_malloc(sizeof(*dp_global));
if (!dp_global)
return QDF_STATUS_E_FAILURE;
wlan_objmgr_set_desc_ctx(dp_global);
wlan_objmgr_set_global_ctx(dp_global);
qdf_atomic_set(&dp_global->global_descriptor_in_use, 0);
dp_global->fst_ctx = NULL;
qdf_atomic_set(&dp_global->rx_fst_ref_cnt, 0);
return status;
}
@@ -201,14 +205,14 @@ static inline QDF_STATUS cdp_global_ctx_init(void)
*/
static inline QDF_STATUS cdp_global_ctx_deinit(void)
{
struct dp_global_desc_context *dp_global = wlan_objmgr_get_desc_ctx();
struct dp_global_context *dp_global = wlan_objmgr_get_global_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);
wlan_objmgr_set_global_ctx(NULL);
return status;
}

View File

@@ -722,6 +722,66 @@ static QDF_STATUS dp_soc_detach_be(struct dp_soc *soc)
return QDF_STATUS_SUCCESS;
}
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
static void dp_set_rx_fst_be(struct dp_rx_fst *fst)
{
struct dp_global_context *dp_global = wlan_objmgr_get_global_ctx();
if (dp_global)
dp_global->fst_ctx = fst;
}
static struct dp_rx_fst *dp_get_rx_fst_be(void)
{
struct dp_global_context *dp_global = wlan_objmgr_get_global_ctx();
if (dp_global)
return dp_global->fst_ctx;
return NULL;
}
static uint32_t dp_rx_fst_release_ref_be(void)
{
struct dp_global_context *dp_global = wlan_objmgr_get_global_ctx();
uint32_t rx_fst_ref_cnt;
if (dp_global) {
rx_fst_ref_cnt = qdf_atomic_read(&dp_global->rx_fst_ref_cnt);
qdf_atomic_dec(&dp_global->rx_fst_ref_cnt);
return rx_fst_ref_cnt;
}
return 1;
}
static void dp_rx_fst_get_ref_be(void)
{
struct dp_global_context *dp_global = wlan_objmgr_get_global_ctx();
if (dp_global)
qdf_atomic_inc(&dp_global->rx_fst_ref_cnt);
}
#else
static void dp_set_rx_fst_be(struct dp_rx_fst *fst)
{
}
static struct dp_rx_fst *dp_get_rx_fst_be(void)
{
return NULL;
}
static uint32_t dp_rx_fst_release_ref_be(void)
{
return 1;
}
static void dp_rx_fst_get_ref_be(void)
{
}
#endif
#ifdef WLAN_MLO_MULTI_CHIP
#ifdef WLAN_MCAST_MLO
static inline void
@@ -753,25 +813,6 @@ dp_mlo_mcast_deinit(struct dp_soc *soc, struct dp_vdev *vdev)
vdev->mlo_vdev = false;
}
static void dp_set_rx_fst_be(struct dp_soc *soc, struct dp_rx_fst *fst)
{
dp_mlo_set_rx_fst(soc, fst);
}
static struct dp_rx_fst *dp_get_rx_fst_be(struct dp_soc *soc)
{
return dp_mlo_get_rx_fst(soc);
}
static uint8_t dp_rx_fst_deref_be(struct dp_soc *soc)
{
return dp_mlo_rx_fst_deref(soc);
}
static void dp_rx_fst_ref_be(struct dp_soc *soc)
{
dp_mlo_rx_fst_ref(soc);
}
#else
static inline void
dp_mlo_mcast_init(struct dp_soc *soc, struct dp_vdev *vdev)
@@ -782,24 +823,6 @@ static inline void
dp_mlo_mcast_deinit(struct dp_soc *soc, struct dp_vdev *vdev)
{
}
static void dp_set_rx_fst_be(struct dp_soc *soc, struct dp_rx_fst *fst)
{
}
static struct dp_rx_fst *dp_get_rx_fst_be(struct dp_soc *soc)
{
return NULL;
}
static uint8_t dp_rx_fst_deref_be(struct dp_soc *soc)
{
return 1;
}
static void dp_rx_fst_ref_be(struct dp_soc *soc)
{
}
#endif
static void dp_mlo_init_ptnr_list(struct dp_vdev *vdev)
{
@@ -836,23 +859,6 @@ static void dp_get_rx_hash_key_be(struct dp_soc *soc,
dp_get_rx_hash_key_bytes(lro_hash);
}
static void dp_set_rx_fst_be(struct dp_soc *soc, struct dp_rx_fst *fst)
{
}
static struct dp_rx_fst *dp_get_rx_fst_be(struct dp_soc *soc)
{
return NULL;
}
static uint8_t dp_rx_fst_deref_be(struct dp_soc *soc)
{
return 1;
}
static void dp_rx_fst_ref_be(struct dp_soc *soc)
{
}
#endif
static QDF_STATUS dp_soc_attach_be(struct dp_soc *soc,
@@ -2667,8 +2673,8 @@ void dp_initialize_arch_ops_be(struct dp_arch_ops *arch_ops)
arch_ops->get_rx_hash_key = dp_get_rx_hash_key_be;
arch_ops->dp_set_rx_fst = dp_set_rx_fst_be;
arch_ops->dp_get_rx_fst = dp_get_rx_fst_be;
arch_ops->dp_rx_fst_deref = dp_rx_fst_deref_be;
arch_ops->dp_rx_fst_ref = dp_rx_fst_ref_be;
arch_ops->dp_rx_fst_deref = dp_rx_fst_release_ref_be;
arch_ops->dp_rx_fst_ref = dp_rx_fst_get_ref_be;
arch_ops->print_mlo_ast_stats = dp_print_mlo_ast_stats_be;
arch_ops->peer_get_reo_hash = dp_peer_get_reo_hash_be;
arch_ops->reo_remap_config = dp_reo_remap_config_be;

View File

@@ -756,50 +756,6 @@ void dp_mlo_get_rx_hash_key(struct dp_soc *soc,
LRO_IPV6_SEED_ARR_SZ));
}
void dp_mlo_set_rx_fst(struct dp_soc *soc, struct dp_rx_fst *fst)
{
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
struct dp_mlo_ctxt *ml_ctxt = be_soc->ml_ctxt;
if (be_soc->mlo_enabled && ml_ctxt)
ml_ctxt->rx_fst = fst;
}
struct dp_rx_fst *dp_mlo_get_rx_fst(struct dp_soc *soc)
{
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
struct dp_mlo_ctxt *ml_ctxt = be_soc->ml_ctxt;
if (be_soc->mlo_enabled && ml_ctxt)
return ml_ctxt->rx_fst;
return NULL;
}
void dp_mlo_rx_fst_ref(struct dp_soc *soc)
{
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
struct dp_mlo_ctxt *ml_ctxt = be_soc->ml_ctxt;
if (be_soc->mlo_enabled && ml_ctxt)
ml_ctxt->rx_fst_ref_cnt++;
}
uint8_t dp_mlo_rx_fst_deref(struct dp_soc *soc)
{
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
struct dp_mlo_ctxt *ml_ctxt = be_soc->ml_ctxt;
uint8_t rx_fst_ref_cnt;
if (be_soc->mlo_enabled && ml_ctxt) {
rx_fst_ref_cnt = ml_ctxt->rx_fst_ref_cnt;
ml_ctxt->rx_fst_ref_cnt--;
return rx_fst_ref_cnt;
}
return 1;
}
struct dp_soc *
dp_rx_replensih_soc_get(struct dp_soc *soc, uint8_t chip_id)
{

View File

@@ -64,8 +64,6 @@ struct dp_mlo_ctxt {
uint32_t toeplitz_hash_ipv6[LRO_IPV6_SEED_ARR_SZ];
struct dp_pdev_be *link_to_pdev_map[WLAN_MAX_MLO_CHIPS *
WLAN_MAX_MLO_LINKS_PER_SOC];
struct dp_rx_fst *rx_fst;
uint8_t rx_fst_ref_cnt;
};
/**

View File

@@ -2611,7 +2611,7 @@ dp_print_pdev_rx_stats(struct dp_pdev *pdev);
*/
void dp_print_soc_tx_stats(struct dp_soc *soc);
#ifdef QCA_SUPPORT_GLOBAL_DESC
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
/**
* dp_print_global_desc_count(): Print global desc in use
*

View File

@@ -5740,7 +5740,7 @@ dp_rx_fst_attach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
if (!soc->arch_ops.dp_get_rx_fst)
return dp_rx_fst_attach(soc, pdev);
rx_fst = soc->arch_ops.dp_get_rx_fst(soc);
rx_fst = soc->arch_ops.dp_get_rx_fst();
/* for BE the FST attach is called only once per
* ML context. if rx_fst is already registered
@@ -5749,15 +5749,15 @@ dp_rx_fst_attach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
if (rx_fst) {
soc->rx_fst = rx_fst;
pdev->rx_fst = rx_fst;
soc->arch_ops.dp_rx_fst_ref(soc);
soc->arch_ops.dp_rx_fst_ref();
} else {
ret = dp_rx_fst_attach(soc, pdev);
if ((ret != QDF_STATUS_SUCCESS) &&
(ret != QDF_STATUS_E_NOSUPPORT))
return ret;
soc->arch_ops.dp_set_rx_fst(soc, soc->rx_fst);
soc->arch_ops.dp_rx_fst_ref(soc);
soc->arch_ops.dp_set_rx_fst(soc->rx_fst);
soc->arch_ops.dp_rx_fst_ref();
}
return ret;
}
@@ -5775,13 +5775,13 @@ dp_rx_fst_detach_wrapper(struct dp_soc *soc, struct dp_pdev *pdev)
return;
}
rx_fst = soc->arch_ops.dp_get_rx_fst(soc);
rx_fst = soc->arch_ops.dp_get_rx_fst();
/* for BE the FST detach is called only when last
* ref count reaches 1.
*/
if (rx_fst) {
if (soc->arch_ops.dp_rx_fst_deref(soc) == 1)
if (soc->arch_ops.dp_rx_fst_deref() == 1)
dp_rx_fst_detach(soc, pdev);
}
pdev->rx_fst = NULL;

View File

@@ -7737,12 +7737,12 @@ void dp_print_tx_ppeds_stats(struct dp_soc *soc)
}
#endif
#ifdef QCA_SUPPORT_GLOBAL_DESC
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
void dp_print_global_desc_count(void)
{
struct dp_global_desc_context *dp_global;
struct dp_global_context *dp_global;
dp_global = wlan_objmgr_get_desc_ctx();
dp_global = wlan_objmgr_get_global_ctx();
DP_PRINT_STATS("Global Tx Descriptors in use = %u",
dp_tx_get_global_desc_in_use(dp_global));

View File

@@ -1161,7 +1161,7 @@ dp_update_tx_desc_stats(struct dp_pdev *pdev)
}
#endif /* CONFIG_WLAN_SYSFS_MEM_STATS */
#ifdef QCA_SUPPORT_GLOBAL_DESC
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
/**
* dp_tx_get_global_desc_in_use() - read global descriptors in usage
* @dp_global: Datapath global context
@@ -1169,7 +1169,7 @@ dp_update_tx_desc_stats(struct dp_pdev *pdev)
* Return: global descriptors in use
*/
static inline int32_t
dp_tx_get_global_desc_in_use(struct dp_global_desc_context *dp_global)
dp_tx_get_global_desc_in_use(struct dp_global_context *dp_global)
{
return qdf_atomic_read(&dp_global->global_descriptor_in_use);
}
@@ -1183,7 +1183,7 @@ static inline bool is_spl_packet(qdf_nbuf_t nbuf)
return false;
}
#ifdef QCA_SUPPORT_GLOBAL_DESC
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
/**
* 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
@@ -1198,10 +1198,10 @@ 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;
struct dp_global_context *dp_global;
uint32_t global_tx_desc_allowed;
dp_global = wlan_objmgr_get_desc_ctx();
dp_global = wlan_objmgr_get_global_ctx();
global_tx_desc_allowed =
wlan_cfg_get_num_global_tx_desc(soc->wlan_cfg_ctx);
@@ -1235,12 +1235,12 @@ 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;
struct dp_global_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();
dp_global = wlan_objmgr_get_global_ctx();
global_tx_desc_allowed =
wlan_cfg_get_num_global_tx_desc(soc->wlan_cfg_ctx);
global_tx_desc_spcl_allowed =
@@ -1362,7 +1362,7 @@ dp_tx_exception_limit_check(struct dp_vdev *vdev)
return false;
}
#ifdef QCA_SUPPORT_GLOBAL_DESC
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
/**
* dp_tx_outstanding_inc - Inc outstanding tx desc values on global and pdev
* @vdev: DP pdev handle
@@ -1372,9 +1372,9 @@ dp_tx_exception_limit_check(struct dp_vdev *vdev)
static inline void
dp_tx_outstanding_inc(struct dp_pdev *pdev)
{
struct dp_global_desc_context *dp_global;
struct dp_global_context *dp_global;
dp_global = wlan_objmgr_get_desc_ctx();
dp_global = wlan_objmgr_get_global_ctx();
qdf_atomic_inc(&dp_global->global_descriptor_in_use);
qdf_atomic_inc(&pdev->num_tx_outstanding);
@@ -1390,9 +1390,9 @@ dp_tx_outstanding_inc(struct dp_pdev *pdev)
static inline void
dp_tx_outstanding_dec(struct dp_pdev *pdev)
{
struct dp_global_desc_context *dp_global;
struct dp_global_context *dp_global;
dp_global = wlan_objmgr_get_desc_ctx();
dp_global = wlan_objmgr_get_global_ctx();
qdf_atomic_dec(&dp_global->global_descriptor_in_use);
qdf_atomic_dec(&pdev->num_tx_outstanding);
@@ -1431,7 +1431,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 */
#endif /* QCA_SUPPORT_DP_GLOBAL_CTX */
#else //QCA_TX_LIMIT_CHECK
static inline bool

View File

@@ -2359,10 +2359,10 @@ struct dp_arch_ops {
unsigned int tid);
void (*get_rx_hash_key)(struct dp_soc *soc,
struct cdp_lro_hash_config *lro_hash);
void (*dp_set_rx_fst)(struct dp_soc *soc, struct dp_rx_fst *fst);
struct dp_rx_fst *(*dp_get_rx_fst)(struct dp_soc *soc);
uint8_t (*dp_rx_fst_deref)(struct dp_soc *soc);
void (*dp_rx_fst_ref)(struct dp_soc *soc);
void (*dp_set_rx_fst)(struct dp_rx_fst *fst);
struct dp_rx_fst *(*dp_get_rx_fst)(void);
uint32_t (*dp_rx_fst_deref)(void);
void (*dp_rx_fst_ref)(void);
void (*txrx_print_peer_stats)(struct cdp_peer_stats *peer_stats,
enum peer_stats_type stats_type);
QDF_STATUS (*dp_peer_rx_reorder_queue_setup)(struct dp_soc *soc,

View File

@@ -1104,7 +1104,7 @@ QDF_STATUS dispatcher_init(void)
goto out;
if (QDF_STATUS_SUCCESS != cdp_global_ctx_init())
goto global_desc_init_fail;
goto global_init_fail;
if (QDF_STATUS_SUCCESS != wlan_mlo_mgr_init())
goto mgmt_mlo_mgr_fail;
@@ -1258,7 +1258,7 @@ mgmt_txrx_init_fail:
wlan_objmgr_global_obj_deinit();
mgmt_mlo_mgr_fail:
wlan_mlo_mgr_deinit();
global_desc_init_fail:
global_init_fail:
cdp_global_ctx_deinit();
out:

View File

@@ -557,25 +557,25 @@ 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
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
/**
* wlan_objmgr_get_desc_ctx() - Get global desc context from global umac object
* wlan_objmgr_get_global_ctx() - Get global context from global umac object
*
* This API is used to get desc context object from the global umac object
* This API is used to get global context object from the global umac object
*
* Return: Pointer to the desc context
* Return: Pointer to global context
*/
struct dp_global_desc_context *wlan_objmgr_get_desc_ctx(void);
struct dp_global_context *wlan_objmgr_get_global_ctx(void);
/**
* wlan_objmgr_set_desc_ctx() - Set global desc context in global umac object
* @ctx: desc context to be set
* wlan_objmgr_set_global_ctx() - Set global context in global umac object
* @ctx: global context to be set
*
* This API is used to set desc context object in the global umac object
* This API is used to set global context object in the global umac object
*
* Return:
*/
void wlan_objmgr_set_desc_ctx(struct dp_global_desc_context *ctx);
void wlan_objmgr_set_global_ctx(struct dp_global_context *ctx);
#endif
#ifdef WLAN_FEATURE_11BE_MLO

View File

@@ -900,20 +900,20 @@ 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)
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
struct dp_global_context *wlan_objmgr_get_global_ctx(void)
{
return g_umac_glb_obj->desc_ctx;
return g_umac_glb_obj->global_ctx;
}
qdf_export_symbol(wlan_objmgr_get_desc_ctx);
qdf_export_symbol(wlan_objmgr_get_global_ctx);
void wlan_objmgr_set_desc_ctx(struct dp_global_desc_context *ctx)
void wlan_objmgr_set_global_ctx(struct dp_global_context *ctx)
{
g_umac_glb_obj->desc_ctx = ctx;
g_umac_glb_obj->global_ctx = ctx;
}
qdf_export_symbol(wlan_objmgr_set_desc_ctx);
qdf_export_symbol(wlan_objmgr_set_global_ctx);
#endif
#ifdef WLAN_FEATURE_11BE_MLO

View File

@@ -34,7 +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
* @global_ctx: DP global context
* @psoc_create_handler: PSOC create handler array
* @psoc_create_handler_arg: PSOC create handler args array
* @psoc_destroy_handler: PSOC destroy handler array
@@ -68,8 +68,8 @@ struct wlan_objmgr_global {
#ifdef WLAN_FEATURE_11BE_MLO
struct mlo_mgr_context *mlo_ctx;
#endif
#ifdef QCA_SUPPORT_GLOBAL_DESC
struct dp_global_desc_context *desc_ctx;
#ifdef QCA_SUPPORT_DP_GLOBAL_CTX
struct dp_global_context *global_ctx;
#endif
wlan_objmgr_psoc_create_handler
psoc_create_handler[WLAN_UMAC_MAX_COMPONENTS];