From d0faedd65a57cf7cc9a905dd46490d5888910d71 Mon Sep 17 00:00:00 2001 From: Himanshu Batra Date: Tue, 22 Aug 2023 10:11:09 +0530 Subject: [PATCH] qcacmn: Add support for cfgmgr interactions Add support for cfgmgr interactions Change-Id: I9ac15639c61784e250318f290c47db4e840f8a13 CRs-Fixed: 3633890 --- dp/inc/cdp_txrx_cmn.h | 89 ++++++++++++++++++++-- dp/inc/cdp_txrx_ops.h | 14 +++- dp/wifi3.0/dp_main.c | 167 ++---------------------------------------- 3 files changed, 102 insertions(+), 168 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index c140aa5607..89f61f3ffe 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -32,6 +32,11 @@ #include "cdp_txrx_cmn_struct.h" #include "wlan_objmgr_global_obj.h" +#ifdef WLAN_SUPPORT_DPDK +#include +#include +#endif + #ifdef ENABLE_VERBOSE_DEBUG extern bool is_dp_verbose_debug_enabled; #endif @@ -3383,21 +3388,93 @@ QDF_STATUS cdp_mlo_dev_ctxt_detach(ol_txrx_soc_handle soc, * @soc: soc handle * @uio_info: pointer to fill dp ring info * - * Return: none + * Return: no. of mappings filled */ -static inline void cdp_dpdk_get_ring_info(ol_txrx_soc_handle soc, - qdf_uio_info_t *uio_info) +static inline uint8_t cdp_dpdk_get_ring_info(ol_txrx_soc_handle soc, + qdf_uio_info_t *uio_info) { if (!soc) { dp_cdp_debug("Invalid Instance"); - return; + return 0; } if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->dpdk_get_ring_info) - return; + return 0; - soc->ops->cmn_drv_ops->dpdk_get_ring_info(soc, uio_info); + return soc->ops->cmn_drv_ops->dpdk_get_ring_info(soc, uio_info); +} + +/* + * cdp_cfgmgr_get_soc_info - get soc info for dpdk + * @soc: soc handle + * @soc_id: soc id + * @ev_buf: pointer to fill soc info + * + * Return: 0 if info filled successful, error otherwise + */ +static inline +int cdp_cfgmgr_get_soc_info(struct cdp_soc_t *soc, uint8_t soc_id, + struct dpdk_wlan_soc_info_event *ev_buf) +{ + if (!soc) { + dp_cdp_debug("Invalid Instance"); + return -EINVAL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->cfgmgr_get_soc_info) + return -EINVAL; + + return soc->ops->cmn_drv_ops->cfgmgr_get_soc_info(soc, soc_id, ev_buf); +} + +/* + * cdp_cfgmgr_get_vdev_info - get vdev info of a soc for dpdk + * @soc: soc handle + * @soc_id: soc id + * @ev_buf: pointer to fill vdev info + * + * Return: 0 if info filled successful, error otherwise + */ +static inline +int cdp_cfgmgr_get_vdev_info(struct cdp_soc_t *soc, uint8_t soc_id, + struct dpdk_wlan_vdev_info_event *ev_buf) +{ + if (!soc) { + dp_cdp_debug("Invalid Instance"); + return -EINVAL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->cfgmgr_get_vdev_info) + return -EINVAL; + + return soc->ops->cmn_drv_ops->cfgmgr_get_vdev_info(soc, soc_id, ev_buf); +} + +/* + * cdp_cfgmgr_get_peer_info - get peer info of a soc for dpdk + * @soc: soc handle + * @soc_id: soc id + * @ev_buf: pointer to fill peer info + * + * Return: 0 if info filled successful, error otherwise + */ +static inline +int cdp_cfgmgr_get_peer_info(struct cdp_soc_t *soc, uint8_t soc_id, + struct dpdk_wlan_peer_info *ev_buf) +{ + if (!soc) { + dp_cdp_debug("Invalid Instance"); + return -EINVAL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->cfgmgr_get_peer_info) + return -EINVAL; + + return soc->ops->cmn_drv_ops->cfgmgr_get_peer_info(soc, soc_id, ev_buf); } #endif #endif /* _CDP_TXRX_CMN_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index b826260ecd..3f7a1eca5f 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -41,6 +41,10 @@ #include #endif #endif +#ifdef WLAN_SUPPORT_DPDK +#include +#include +#endif /* * bitmap values to indicate special handling of peer_delete @@ -746,8 +750,14 @@ struct cdp_cmn_ops { void (*txrx_get_tqm_offset)(struct cdp_soc_t *soc_hdl, uint64_t *value); uint64_t (*get_fst_cmem_base)(struct cdp_soc_t *soc_hdl, uint64_t size); #ifdef WLAN_SUPPORT_DPDK - void (*dpdk_get_ring_info)(struct cdp_soc_t *soc_hdl, - qdf_uio_info_t *uio_info); + uint8_t (*dpdk_get_ring_info)(struct cdp_soc_t *soc_hdl, + qdf_uio_info_t *uio_info); + int (*cfgmgr_get_soc_info)(struct cdp_soc_t *soc_hdl, uint8_t soc_id, + struct dpdk_wlan_soc_info_event *ev_buf); + int (*cfgmgr_get_vdev_info)(struct cdp_soc_t *soc_hdl, uint8_t soc_id, + struct dpdk_wlan_vdev_info_event *ev_buf); + int (*cfgmgr_get_peer_info)(struct cdp_soc_t *soc_hdl, uint8_t soc_id, + struct dpdk_wlan_peer_info *ev_buf); #endif }; diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 2fb9451021..eeeb75ae91 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -111,6 +111,10 @@ cdp_dump_flow_pool_info(struct cdp_soc_t *soc) #endif #include "qdf_ssr_driver_dump.h" +#ifdef WLAN_SUPPORT_DPDK +#include +#endif + #ifdef QCA_DP_ENABLE_TX_COMP_RING4 #define TXCOMP_RING4_NUM 3 #else @@ -12201,166 +12205,6 @@ update_tx_ilp: } #endif -#ifdef WLAN_SUPPORT_DPDK -static char *tcl_ring_name[] = { - "tcl_data_ring1", - "tcl_data_ring2", - "tcl_data_ring3", - "tcl_data_ring4", - "tcl_data_ring5", -}; - -static char *tcl_comp_ring_name[] = { - "tcl_comp_ring1", - "tcl_comp_ring2", - "tcl_comp_ring3", - "tcl_comp_ring4", - "tcl_comp_ring5", -}; - -static char *reo_dest_ring_name[] = { - "reo_dest_ring1", - "reo_dest_ring2", - "reo_dest_ring3", - "reo_dest_ring4", - "reo_dest_ring5", - "reo_dest_ring6", - "reo_dest_ring7", - "reo_dest_ring8", -}; - -static void dp_dpdk_get_ring_info(struct cdp_soc_t *soc_hdl, - qdf_uio_info_t *uio_info) -{ - struct dp_soc *soc = (struct dp_soc *)soc_hdl; - struct hal_soc *hal_soc = (struct hal_soc *)soc->hal_soc; - struct hal_srng *hal_srng; - uint8_t idx = 1, i; - - /* WBM Desc Release Ring */ - hal_srng = (struct hal_srng *) - soc->tcl_data_ring[0].hal_srng; - - hal_srng = (struct hal_srng *) - soc->wbm_desc_rel_ring.hal_srng; - uio_info->mem[idx].name = "wbm_desc_rel_ring"; - uio_info->mem[idx].addr = (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - - /* WBM Idle Link Ring */ - hal_srng = (struct hal_srng *) - soc->wbm_idle_link_ring.hal_srng; - uio_info->mem[idx].name = "wbm_idle_link_ring"; - uio_info->mem[idx].addr = (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - - /* TCL Data Rings */ - for (i = 0; i < soc->num_tcl_data_rings; i++) { - hal_srng = (struct hal_srng *) - soc->tcl_data_ring[i].hal_srng; - uio_info->mem[idx].name = tcl_ring_name[i]; - uio_info->mem[idx].addr = - (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - } - - /* TCL Completion Rings */ - for (i = 0; i < soc->num_tcl_data_rings; i++) { - hal_srng = (struct hal_srng *) - soc->tx_comp_ring[i].hal_srng; - uio_info->mem[idx].name = tcl_comp_ring_name[i]; - uio_info->mem[idx].addr = - (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - } - - /* Reo Dest Rings */ - for (i = 0; i < soc->num_reo_dest_rings; i++) { - hal_srng = (struct hal_srng *) - soc->reo_dest_ring[i].hal_srng; - uio_info->mem[idx].name = reo_dest_ring_name[i]; - uio_info->mem[idx].addr = - (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - } - - /* RXDMA Refill Ring */ - hal_srng = (struct hal_srng *) - soc->rx_refill_buf_ring[0].hal_srng; - uio_info->mem[idx].name = "rxdma_buf_ring"; - uio_info->mem[idx].addr = (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - - /* REO Exception Ring */ - hal_srng = (struct hal_srng *) - soc->reo_exception_ring.hal_srng; - uio_info->mem[idx].name = "reo_exception_ring"; - uio_info->mem[idx].addr = - (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - - /* RX Release Ring */ - hal_srng = (struct hal_srng *) - soc->rx_rel_ring.hal_srng; - uio_info->mem[idx].name = "rx_release_ring"; - uio_info->mem[idx].addr = (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - - /* Reo Reinject Ring */ - hal_srng = (struct hal_srng *) - soc->reo_reinject_ring.hal_srng; - uio_info->mem[idx].name = "reo_reinject_ring"; - uio_info->mem[idx].addr = - (unsigned long)hal_srng->ring_base_paddr; - uio_info->mem[idx].size = - (hal_srng->num_entries * hal_srng->entry_size) << 2; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - - /* Shadow Write Pointer for LMAC Ring */ - uio_info->mem[idx].name = "lmac_shadow_wrptr"; - uio_info->mem[idx].addr = - (unsigned long)hal_soc->shadow_wrptr_mem_paddr; - uio_info->mem[idx].size = - sizeof(*(hal_soc->shadow_wrptr_mem_vaddr)) * HAL_MAX_LMAC_RINGS; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - idx++; - - /* Shadow Write Pointer for LMAC Ring */ - uio_info->mem[idx].name = "lmac_shadow_rdptr"; - uio_info->mem[idx].addr = - (unsigned long)hal_soc->shadow_rdptr_mem_paddr; - uio_info->mem[idx].size = - sizeof(*(hal_soc->shadow_rdptr_mem_vaddr)) * HAL_SRNG_ID_MAX; - uio_info->mem[idx].memtype = UIO_MEM_PHYS; - -} -#endif - static struct cdp_cmn_ops dp_ops_cmn = { .txrx_soc_attach_target = dp_soc_attach_target_wifi3, .txrx_vdev_attach = dp_vdev_attach_wifi3, @@ -12499,6 +12343,9 @@ static struct cdp_cmn_ops dp_ops_cmn = { #endif #ifdef WLAN_SUPPORT_DPDK .dpdk_get_ring_info = dp_dpdk_get_ring_info, + .cfgmgr_get_soc_info = dp_cfgmgr_get_soc_info, + .cfgmgr_get_vdev_info = dp_cfgmgr_get_vdev_info, + .cfgmgr_get_peer_info = dp_cfgmgr_get_peer_info, #endif };