diff --git a/wlan_cfg/cfg_dp.h b/wlan_cfg/cfg_dp.h index af310805f6..6d23f622d0 100644 --- a/wlan_cfg/cfg_dp.h +++ b/wlan_cfg/cfg_dp.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021,2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 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 @@ -447,7 +447,33 @@ #define WLAN_CFG_MLO_RX_RING_MAP_MAX 0xFF #endif -/* DP INI Declerations */ +#define WLAN_CFG_TX_CAPT_MAX_MEM_MIN 0 +#define WLAN_CFG_TX_CAPT_MAX_MEM_MAX 512 +#define WLAN_CFG_TX_CAPT_MAX_MEM_DEFAULT 0 + +/* + * + * "dp_tx_capt_max_mem_mb"- maximum memory used by Tx capture + * @Min: 0 + * @Max: 512 MB + * @Default: 0 (disabled) + * + * This ini entry is used to set a max limit beyond which frames + * are dropped by Tx capture. User needs to set a non-zero value + * to enable it. + * + * Usage: External + * + * + */ +#define CFG_DP_TX_CAPT_MAX_MEM_MB \ + CFG_INI_UINT("dp_tx_capt_max_mem_mb", \ + WLAN_CFG_TX_CAPT_MAX_MEM_MIN, \ + WLAN_CFG_TX_CAPT_MAX_MEM_MAX, \ + WLAN_CFG_TX_CAPT_MAX_MEM_DEFAULT, \ + CFG_VALUE_OR_DEFAULT, "Max Memory (in MB) used by Tx Capture") + +/* DP INI Declarations */ #define CFG_DP_HTT_PACKET_TYPE \ CFG_INI_UINT("dp_htt_packet_type", \ WLAN_CFG_HTT_PKT_TYPE_MIN, \ @@ -1564,5 +1590,6 @@ CFG_DP_PPE_CONFIG \ CFG_DP_IPA_TX_ALT_RING_CFG \ CFG_DP_MLO_CONFIG \ - CFG_DP_VDEV_STATS_HW_OFFLOAD + CFG_DP_VDEV_STATS_HW_OFFLOAD \ + CFG(CFG_DP_TX_CAPT_MAX_MEM_MB) #endif /* _CFG_DP_H_ */ diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 26e5770725..0f46a7b886 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -1949,6 +1949,20 @@ wlan_soc_vdev_hw_stats_cfg_attach(struct cdp_ctrl_objmgr_psoc *psoc, } #endif +#ifdef WLAN_TX_PKT_CAPTURE_ENH +static void wlan_soc_tx_capt_cfg_attach(struct cdp_ctrl_objmgr_psoc *psoc, + struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx) +{ + wlan_cfg_ctx->tx_capt_max_mem_allowed = + cfg_get(psoc, CFG_DP_TX_CAPT_MAX_MEM_MB) * 1024 * 1024; +} +#else +static void wlan_soc_tx_capt_cfg_attach(struct cdp_ctrl_objmgr_psoc *psoc, + struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx) +{ +} +#endif + /** * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration * @psoc - Object manager psoc @@ -2147,6 +2161,7 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc) wlan_cfg_ctx->num_rxdma_dst_rings_per_pdev = NUM_RXDMA_RINGS_PER_PDEV; wlan_cfg_ctx->num_rxdma_status_rings_per_pdev = NUM_RXDMA_RINGS_PER_PDEV; + wlan_soc_tx_capt_cfg_attach(psoc, wlan_cfg_ctx); return wlan_cfg_ctx; } diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index b29b9d7d0f..a9456f392f 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -412,6 +412,9 @@ struct wlan_cfg_dp_soc_ctxt { uint8_t num_rxdma_dst_rings_per_pdev; bool txmon_hw_support; uint8_t num_rxdma_status_rings_per_pdev; +#ifdef WLAN_TX_PKT_CAPTURE_ENH + uint32_t tx_capt_max_mem_allowed; +#endif }; /** @@ -2089,4 +2092,19 @@ void wlan_cfg_set_txmon_hw_support(struct wlan_cfg_dp_soc_ctxt *cfg, * Return: txmon_hw_support */ bool wlan_cfg_get_txmon_hw_support(struct wlan_cfg_dp_soc_ctxt *cfg); + +#ifdef WLAN_TX_PKT_CAPTURE_ENH +/* + * wlan_cfg_get_tx_capt_max_mem - Get max memory allowed for TX capture feature + * @wlan_cfg_soc_ctx + * + * Return: user given size in bytes + */ +static inline int +wlan_cfg_get_tx_capt_max_mem(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->tx_capt_max_mem_allowed; +} +#endif /* WLAN_TX_PKT_CAPTURE_ENH */ + #endif /*__WLAN_CFG_H*/