From 5cf9805bc3c259b50b554a3e18d4474deb2b77c1 Mon Sep 17 00:00:00 2001 From: Sathish Kumar Date: Wed, 20 Jun 2018 10:36:40 +0530 Subject: [PATCH] qcacmn: Changes in direct buffer Rx module 1. Add support upto 2048 buffers in the ring 2. Add API to print current ring status per module per pdev 3. Start module ID numbering from 0 Change-Id: I7954007c6c486877ffb2ab91724885af2fbaab8c CRs-Fixed: 2263968 --- .../src/target_if_direct_buf_rx_api.c | 2 + .../src/target_if_direct_buf_rx_main.c | 60 ++++++++++++++++++- .../src/target_if_direct_buf_rx_main.h | 12 +++- .../lmac_if/inc/wlan_lmac_if_def.h | 3 + wmi/inc/wmi_unified_param.h | 2 +- 5 files changed, 74 insertions(+), 5 deletions(-) diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c index 75adb50227e2..3b1151578e06 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c +++ b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c @@ -171,5 +171,7 @@ void target_if_direct_buf_rx_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) target_if_direct_buf_rx_register_events; tx_ops->dbr_tx_ops.direct_buf_rx_unregister_events = target_if_direct_buf_rx_unregister_events; + tx_ops->dbr_tx_ops.direct_buf_rx_print_ring_stat = + target_if_direct_buf_rx_print_ring_stat; } qdf_export_symbol(target_if_direct_buf_rx_register_tx_ops); diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c index db1bccbd9d29..2c2bdf82a33f 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c +++ b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c @@ -25,6 +25,18 @@ #include #include +/** + * struct module_name : Module name information structure + * @module_name_str : Module name subscribing to DBR + */ +struct module_name { + unsigned char module_name_str[QDF_MAX_NAME_SIZE]; +}; + +static const struct module_name g_dbr_module_name[DBR_MODULE_MAX] = { + [DBR_MODULE_SPECTRAL] = {"SPECTRAL"}, +}; + static uint8_t get_num_dbr_modules_per_pdev(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_psoc *psoc; @@ -293,7 +305,7 @@ QDF_STATUS target_if_direct_buf_rx_psoc_destroy_handler( static QDF_STATUS target_if_dbr_replenish_ring(struct wlan_objmgr_pdev *pdev, struct direct_buf_rx_module_param *mod_param, - void *aligned_vaddr, uint8_t cookie) + void *aligned_vaddr, uint32_t cookie) { uint64_t *ring_entry; uint32_t dw_lo, dw_hi = 0, map_status; @@ -364,7 +376,7 @@ static QDF_STATUS target_if_dbr_replenish_ring(struct wlan_objmgr_pdev *pdev, static QDF_STATUS target_if_dbr_fill_ring(struct wlan_objmgr_pdev *pdev, struct direct_buf_rx_module_param *mod_param) { - uint8_t idx; + uint32_t idx; void *buf, *buf_aligned; struct direct_buf_rx_ring_cfg *dbr_ring_cfg; struct direct_buf_rx_ring_cap *dbr_ring_cap; @@ -898,7 +910,7 @@ static QDF_STATUS target_if_dbr_empty_ring(struct wlan_objmgr_pdev *pdev, struct direct_buf_rx_psoc_obj *dbr_psoc_obj, struct direct_buf_rx_module_param *mod_param) { - uint8_t idx; + uint32_t idx; struct direct_buf_rx_ring_cfg *dbr_ring_cfg; struct direct_buf_rx_ring_cap *dbr_ring_cap; struct direct_buf_rx_buf_info *dbr_buf_pool; @@ -1037,3 +1049,45 @@ QDF_STATUS target_if_direct_buf_rx_unregister_events( return QDF_STATUS_SUCCESS; } + +QDF_STATUS target_if_direct_buf_rx_print_ring_stat( + struct wlan_objmgr_pdev *pdev) +{ + struct direct_buf_rx_psoc_obj *dbr_psoc_obj; + struct direct_buf_rx_pdev_obj *dbr_pdev_obj; + struct wlan_objmgr_psoc *psoc; + void *srng, *hal_soc; + uint32_t hp = 0, tp = 0; + struct direct_buf_rx_module_param *mod_param; + struct direct_buf_rx_ring_cfg *dbr_ring_cfg; + uint8_t num_modules, mod_idx; + + if (!pdev) { + direct_buf_rx_err("pdev is null"); + return QDF_STATUS_E_INVAL; + } + + psoc = wlan_pdev_get_psoc(pdev); + dbr_pdev_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, + WLAN_TARGET_IF_COMP_DIRECT_BUF_RX); + dbr_psoc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc, + WLAN_TARGET_IF_COMP_DIRECT_BUF_RX); + hal_soc = dbr_psoc_obj->hal_soc; + num_modules = dbr_pdev_obj->num_modules; + direct_buf_rx_err("--------------------------------------------------"); + direct_buf_rx_err("| Module ID | Module | Head Idx | Tail Idx |"); + direct_buf_rx_err("--------------------------------------------------"); + for (mod_idx = 0; mod_idx < num_modules; mod_idx++) { + mod_param = &dbr_pdev_obj->dbr_mod_param[mod_idx]; + dbr_ring_cfg = mod_param->dbr_ring_cfg; + srng = dbr_ring_cfg->srng; + hal_api_get_tphp(hal_soc, srng, &tp, &hp); + direct_buf_rx_err("|%11d|%14s|%10x|%10x|", + mod_idx, + g_dbr_module_name[mod_idx].module_name_str, + hp, tp); + } + direct_buf_rx_err("--------------------------------------------------"); + + return QDF_STATUS_SUCCESS; +} diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.h b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.h index 73e875d3b1e1..a80cf22ac3df 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.h +++ b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.h @@ -36,7 +36,7 @@ struct direct_buf_rx_data; * @DBR_MODULE_MAX: Max module ID */ enum DBR_MODULE { - DBR_MODULE_SPECTRAL = 1, + DBR_MODULE_SPECTRAL = 0, DBR_MODULE_MAX, }; @@ -148,6 +148,16 @@ QDF_STATUS target_if_direct_buf_rx_register_events( QDF_STATUS target_if_direct_buf_rx_unregister_events( struct wlan_objmgr_psoc *psoc); +/** + * target_if_direct_buf_rx_print_ring_stat() - Print ring status for each + * module in the pdev + * @pdev: pointer to pdev object + * + * Return : QDF status of operation + */ +QDF_STATUS target_if_direct_buf_rx_print_ring_stat( + struct wlan_objmgr_pdev *pdev); + /** * target_if_direct_buf_rx_pdev_create_handler() - Handler to be invoked for * direct buffer rx module diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index 698d9412434e..47931d1a725f 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -433,6 +433,7 @@ struct wlan_lmac_if_wifi_pos_tx_ops { * buffer rx framework * @direct_buf_rx_unregister_events: Unregistraton of WMI events for direct * buffer rx framework + * @direct_buf_rx_print_ring_stat: Print ring status per module per pdev */ struct wlan_lmac_if_direct_buf_rx_tx_ops { QDF_STATUS (*direct_buf_rx_module_register)( @@ -443,6 +444,8 @@ struct wlan_lmac_if_direct_buf_rx_tx_ops { struct wlan_objmgr_psoc *psoc); QDF_STATUS (*direct_buf_rx_unregister_events)( struct wlan_objmgr_psoc *psoc); + QDF_STATUS (*direct_buf_rx_print_ring_stat)( + struct wlan_objmgr_pdev *pdev); }; #endif diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index f1cbfd3370e8..01eecbe4e247 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -8282,7 +8282,7 @@ struct wdsentry { WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_HI) #define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_S 12 -#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA 0xfffff +#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA 0x7fffff #define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_GET(dword) \ WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA)