浏览代码

qcacmn: Add INI for memory limit used by Tx capture

User can specify a limit and frames are dropped when the memory
used by packets in the queues goes beyond the limit. This is a
SoC level param.

Change-Id: Id2bd9caaa11d9ea9f9e04c635ff629190bb62916
Manoj Ekbote 3 年之前
父节点
当前提交
986121cc00
共有 3 个文件被更改,包括 63 次插入3 次删除
  1. 30 3
      wlan_cfg/cfg_dp.h
  2. 15 0
      wlan_cfg/wlan_cfg.c
  3. 18 0
      wlan_cfg/wlan_cfg.h

+ 30 - 3
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
+
+/*
+ * <ini>
+ * "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
+ *
+ * </ini>
+ */
+#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_ */

+ 15 - 0
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;
 }

+ 18 - 0
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*/