qcacmn: Add QDF debug capability to track total SKB allocation
Enhance existing SKB leak debug capability to track total SKB allocation by driver in SLUB debug enabled builds. Change-Id: I6bb19ab482961febd8bb5adebe8f71e732ff60dd CRs-Fixed: 2066205
This commit is contained in:
@@ -302,5 +302,20 @@ void qdf_mem_multi_pages_free(qdf_device_t osdev,
|
|||||||
int qdf_mem_multi_page_link(qdf_device_t osdev,
|
int qdf_mem_multi_page_link(qdf_device_t osdev,
|
||||||
struct qdf_mem_multi_page_t *pages,
|
struct qdf_mem_multi_page_t *pages,
|
||||||
uint32_t elem_size, uint32_t elem_count, uint8_t cacheable);
|
uint32_t elem_size, uint32_t elem_count, uint8_t cacheable);
|
||||||
|
/**
|
||||||
|
* qdf_mem_skb_inc() - increment total skb allocation size
|
||||||
|
* @size: size to be added
|
||||||
|
*
|
||||||
|
* Return: none
|
||||||
|
*/
|
||||||
|
void qdf_mem_skb_inc(qdf_size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_mem_skb_dec() - decrement total skb allocation size
|
||||||
|
* @size: size to be decremented
|
||||||
|
*
|
||||||
|
* Return: none
|
||||||
|
*/
|
||||||
|
void qdf_mem_skb_dec(qdf_size_t size);
|
||||||
|
|
||||||
#endif /* __QDF_MEMORY_H */
|
#endif /* __QDF_MEMORY_H */
|
||||||
|
@@ -107,10 +107,12 @@ static struct dentry *qdf_mem_debugfs_root;
|
|||||||
* struct __qdf_mem_stat - qdf memory statistics
|
* struct __qdf_mem_stat - qdf memory statistics
|
||||||
* @kmalloc: total kmalloc allocations
|
* @kmalloc: total kmalloc allocations
|
||||||
* @dma: total dma allocations
|
* @dma: total dma allocations
|
||||||
|
* @skb: total skb allocations
|
||||||
*/
|
*/
|
||||||
static struct __qdf_mem_stat {
|
static struct __qdf_mem_stat {
|
||||||
qdf_atomic_t kmalloc;
|
qdf_atomic_t kmalloc;
|
||||||
qdf_atomic_t dma;
|
qdf_atomic_t dma;
|
||||||
|
qdf_atomic_t skb;
|
||||||
} qdf_mem_stat;
|
} qdf_mem_stat;
|
||||||
|
|
||||||
static inline void qdf_mem_kmalloc_inc(qdf_size_t size)
|
static inline void qdf_mem_kmalloc_inc(qdf_size_t size)
|
||||||
@@ -123,6 +125,11 @@ static inline void qdf_mem_dma_inc(qdf_size_t size)
|
|||||||
qdf_atomic_add(size, &qdf_mem_stat.dma);
|
qdf_atomic_add(size, &qdf_mem_stat.dma);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qdf_mem_skb_inc(qdf_size_t size)
|
||||||
|
{
|
||||||
|
qdf_atomic_add(size, &qdf_mem_stat.skb);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void qdf_mem_kmalloc_dec(qdf_size_t size)
|
static inline void qdf_mem_kmalloc_dec(qdf_size_t size)
|
||||||
{
|
{
|
||||||
qdf_atomic_sub(size, &qdf_mem_stat.kmalloc);
|
qdf_atomic_sub(size, &qdf_mem_stat.kmalloc);
|
||||||
@@ -133,6 +140,11 @@ static inline void qdf_mem_dma_dec(qdf_size_t size)
|
|||||||
qdf_atomic_sub(size, &qdf_mem_stat.dma);
|
qdf_atomic_sub(size, &qdf_mem_stat.dma);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qdf_mem_skb_dec(qdf_size_t size)
|
||||||
|
{
|
||||||
|
qdf_atomic_sub(size, &qdf_mem_stat.skb);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MEMORY_DEBUG
|
#ifdef MEMORY_DEBUG
|
||||||
/**
|
/**
|
||||||
* struct __qdf_mem_info - memory statistics
|
* struct __qdf_mem_info - memory statistics
|
||||||
@@ -493,6 +505,11 @@ static QDF_STATUS qdf_mem_debugfs_init(void)
|
|||||||
qdf_mem_debugfs_root,
|
qdf_mem_debugfs_root,
|
||||||
&qdf_mem_stat.dma);
|
&qdf_mem_stat.dma);
|
||||||
|
|
||||||
|
debugfs_create_atomic_t("skb",
|
||||||
|
S_IRUSR,
|
||||||
|
qdf_mem_debugfs_root,
|
||||||
|
&qdf_mem_stat.skb);
|
||||||
|
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1539,6 +1539,7 @@ void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
|
|||||||
p_node->file_name = file_name;
|
p_node->file_name = file_name;
|
||||||
p_node->line_num = line_num;
|
p_node->line_num = line_num;
|
||||||
p_node->size = size;
|
p_node->size = size;
|
||||||
|
qdf_mem_skb_inc(size);
|
||||||
p_node->p_next = gp_qdf_net_buf_track_tbl[i];
|
p_node->p_next = gp_qdf_net_buf_track_tbl[i];
|
||||||
gp_qdf_net_buf_track_tbl[i] = p_node;
|
gp_qdf_net_buf_track_tbl[i] = p_node;
|
||||||
} else
|
} else
|
||||||
@@ -1601,6 +1602,7 @@ done:
|
|||||||
net_buf);
|
net_buf);
|
||||||
QDF_ASSERT(0);
|
QDF_ASSERT(0);
|
||||||
} else {
|
} else {
|
||||||
|
qdf_mem_skb_dec(p_node->size);
|
||||||
qdf_nbuf_track_free(p_node);
|
qdf_nbuf_track_free(p_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user