|
@@ -59,6 +59,18 @@ static bool is_initial_mem_debug_disabled;
|
|
|
#define QDF_MEM_WARN_THRESHOLD 300 /* ms */
|
|
|
#define QDF_DEBUG_STRING_SIZE 512
|
|
|
|
|
|
+/**
|
|
|
+ * struct __qdf_mem_stat - qdf memory statistics
|
|
|
+ * @kmalloc: total kmalloc allocations
|
|
|
+ * @dma: total dma allocations
|
|
|
+ * @skb: total skb allocations
|
|
|
+ */
|
|
|
+static struct __qdf_mem_stat {
|
|
|
+ qdf_atomic_t kmalloc;
|
|
|
+ qdf_atomic_t dma;
|
|
|
+ qdf_atomic_t skb;
|
|
|
+} qdf_mem_stat;
|
|
|
+
|
|
|
#ifdef MEMORY_DEBUG
|
|
|
#include "qdf_debug_domain.h"
|
|
|
|
|
@@ -292,54 +304,11 @@ u_int8_t prealloc_disabled = 1;
|
|
|
qdf_declare_param(prealloc_disabled, byte);
|
|
|
qdf_export_symbol(prealloc_disabled);
|
|
|
|
|
|
-/**
|
|
|
- * struct __qdf_mem_stat - qdf memory statistics
|
|
|
- * @kmalloc: total kmalloc allocations
|
|
|
- * @dma: total dma allocations
|
|
|
- * @skb: total skb allocations
|
|
|
- */
|
|
|
-static struct __qdf_mem_stat {
|
|
|
- qdf_atomic_t kmalloc;
|
|
|
- qdf_atomic_t dma;
|
|
|
- qdf_atomic_t skb;
|
|
|
-} qdf_mem_stat;
|
|
|
-
|
|
|
-void qdf_mem_skb_inc(qdf_size_t size)
|
|
|
-{
|
|
|
- qdf_atomic_add(size, &qdf_mem_stat.skb);
|
|
|
-}
|
|
|
-
|
|
|
-void qdf_mem_skb_dec(qdf_size_t size)
|
|
|
-{
|
|
|
- qdf_atomic_sub(size, &qdf_mem_stat.skb);
|
|
|
-}
|
|
|
-
|
|
|
#if defined WLAN_DEBUGFS
|
|
|
|
|
|
/* Debugfs root directory for qdf_mem */
|
|
|
static struct dentry *qdf_mem_debugfs_root;
|
|
|
|
|
|
-void qdf_mem_kmalloc_inc(qdf_size_t size)
|
|
|
-{
|
|
|
- qdf_atomic_add(size, &qdf_mem_stat.kmalloc);
|
|
|
-}
|
|
|
-
|
|
|
-void qdf_mem_kmalloc_dec(qdf_size_t size)
|
|
|
-{
|
|
|
- qdf_atomic_sub(size, &qdf_mem_stat.kmalloc);
|
|
|
-}
|
|
|
-
|
|
|
-static void qdf_mem_dma_inc(qdf_size_t size)
|
|
|
-{
|
|
|
- qdf_atomic_add(size, &qdf_mem_stat.dma);
|
|
|
-}
|
|
|
-
|
|
|
-static inline void qdf_mem_dma_dec(qdf_size_t size)
|
|
|
-{
|
|
|
- qdf_atomic_sub(size, &qdf_mem_stat.dma);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
#ifdef MEMORY_DEBUG
|
|
|
static int qdf_err_printer(void *priv, const char *fmt, ...)
|
|
|
{
|
|
@@ -841,9 +810,6 @@ static QDF_STATUS qdf_mem_debugfs_init(void)
|
|
|
|
|
|
#else /* WLAN_DEBUGFS */
|
|
|
|
|
|
-static inline void qdf_mem_dma_inc(qdf_size_t size) {}
|
|
|
-static inline void qdf_mem_dma_dec(qdf_size_t size) {}
|
|
|
-
|
|
|
static QDF_STATUS qdf_mem_debugfs_init(void)
|
|
|
{
|
|
|
return QDF_STATUS_E_NOSUPPORT;
|
|
@@ -863,6 +829,38 @@ static QDF_STATUS qdf_mem_debug_debugfs_exit(void)
|
|
|
|
|
|
#endif /* WLAN_DEBUGFS */
|
|
|
|
|
|
+void qdf_mem_kmalloc_inc(qdf_size_t size)
|
|
|
+{
|
|
|
+ qdf_atomic_add(size, &qdf_mem_stat.kmalloc);
|
|
|
+}
|
|
|
+
|
|
|
+static void qdf_mem_dma_inc(qdf_size_t size)
|
|
|
+{
|
|
|
+ qdf_atomic_add(size, &qdf_mem_stat.dma);
|
|
|
+}
|
|
|
+
|
|
|
+#ifdef CONFIG_WLAN_SYSFS_MEM_STATS
|
|
|
+void qdf_mem_skb_inc(qdf_size_t size)
|
|
|
+{
|
|
|
+ qdf_atomic_add(size, &qdf_mem_stat.skb);
|
|
|
+}
|
|
|
+
|
|
|
+void qdf_mem_skb_dec(qdf_size_t size)
|
|
|
+{
|
|
|
+ qdf_atomic_sub(size, &qdf_mem_stat.skb);
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+void qdf_mem_kmalloc_dec(qdf_size_t size)
|
|
|
+{
|
|
|
+ qdf_atomic_sub(size, &qdf_mem_stat.kmalloc);
|
|
|
+}
|
|
|
+
|
|
|
+static inline void qdf_mem_dma_dec(qdf_size_t size)
|
|
|
+{
|
|
|
+ qdf_atomic_sub(size, &qdf_mem_stat.dma);
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* __qdf_mempool_init() - Create and initialize memory pool
|
|
|
*
|
|
@@ -2302,3 +2300,24 @@ void qdf_ether_addr_copy(void *dst_addr, const void *src_addr)
|
|
|
}
|
|
|
qdf_export_symbol(qdf_ether_addr_copy);
|
|
|
|
|
|
+int32_t qdf_dma_mem_stats_read(void)
|
|
|
+{
|
|
|
+ return qdf_atomic_read(&qdf_mem_stat.dma);
|
|
|
+}
|
|
|
+
|
|
|
+qdf_export_symbol(qdf_dma_mem_stats_read);
|
|
|
+
|
|
|
+int32_t qdf_heap_mem_stats_read(void)
|
|
|
+{
|
|
|
+ return qdf_atomic_read(&qdf_mem_stat.kmalloc);
|
|
|
+}
|
|
|
+
|
|
|
+qdf_export_symbol(qdf_heap_mem_stats_read);
|
|
|
+
|
|
|
+int32_t qdf_skb_mem_stats_read(void)
|
|
|
+{
|
|
|
+ return qdf_atomic_read(&qdf_mem_stat.skb);
|
|
|
+}
|
|
|
+
|
|
|
+qdf_export_symbol(qdf_skb_mem_stats_read);
|
|
|
+
|