qcacmn: Implementation of SKB Frag Debug Framework

SKB frag debug framework is required for debug purpose of frag based
approach in monitor mode

Change-Id: Ic7a5a2c3d7397c4d7dd2c5db32802b0f694e6101
CRs-Fixed: 2736136
Dieser Commit ist enthalten in:
Harsh Kumar Bijlani
2020-07-13 20:02:31 +05:30
committet von snandini
Ursprung ffaafd74ef
Commit d47e448d58
8 geänderte Dateien mit 1299 neuen und 37 gelöschten Zeilen

Datei anzeigen

@@ -3756,6 +3756,80 @@ static inline void qdf_nbuf_trim_add_frag_size(qdf_nbuf_t nbuf, uint8_t idx,
__qdf_nbuf_trim_add_frag_size(nbuf, idx, size, truesize);
}
#ifdef NBUF_FRAG_MEMORY_DEBUG
#define qdf_nbuf_move_frag_page_offset(f, i, o) \
qdf_nbuf_move_frag_page_offset_debug(f, i, o, __func__, __LINE__)
/**
* qdf_nbuf_move_frag_page_offset_debug() - Move frag page_offset by size
* and adjust length by size.
* @nbuf: qdf_nbuf_t
* @idx: Frag index
* @offset: Frag page offset should be moved by offset.
* +Ve - Move offset forward.
* -Ve - Move offset backward.
* @func: Caller function name
* @line: Caller function line no.
*
* Return: QDF_STATUS
*/
QDF_STATUS qdf_nbuf_move_frag_page_offset_debug(qdf_nbuf_t nbuf, uint8_t idx,
int offset, const char *func,
uint32_t line);
#define qdf_nbuf_add_rx_frag(f, b, o, l, s, r) \
qdf_nbuf_add_rx_frag_debug(f, b, o, l, s, r, __func__, __LINE__)
/**
* qdf_nbuf_add_rx_frag_debug() - Add frag to nbuf at index frag_idx
* @buf: Frag pointer needs to be added in nbuf
* @nbuf: qdf_nbuf_t where frag will be added
* @offset: Offset in frag to be added to nbuf_frags
* @frag_len: Frag length
* @truesize: truesize
* @take_frag_ref: Whether to take ref for frag or not
* This bool must be set as per below comdition:
* 1. False: If this frag is being added in any nbuf
* for the first time after allocation
* 2. True: If frag is already attached part of any
* nbuf
* @func: Caller function name
* @line: Caller function line no.
*
* Return: none
*/
void qdf_nbuf_add_rx_frag_debug(qdf_frag_t buf, qdf_nbuf_t nbuf,
int offset, int frag_len,
unsigned int truesize, bool take_frag_ref,
const char *func, uint32_t line);
/**
* qdf_net_buf_debug_acquire_frag() - Add frag nodes to frag debug tracker
* when nbuf is received from network stack
* @buf: qdf_nbuf_t
* @func: Caller function name
* @line: Caller function line no.
*
* Return: none
*/
void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf, const char *func,
uint32_t line);
/**
* qdf_net_buf_debug_release_frag() - Update frag nodes in frag debug tracker
* when nbuf is sent to network stack
* @buf: qdf_nbuf_t
* @func: Caller function name
* @line: Caller function line no.
*
* Return: none
*/
void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf, const char *func,
uint32_t line);
#else /* NBUF_FRAG_MEMORY_DEBUG */
/**
* qdf_nbuf_move_frag_page_offset() - Move frag page_offset by size
* and adjust length by size.
@@ -3797,6 +3871,19 @@ static inline void qdf_nbuf_add_rx_frag(qdf_frag_t buf, qdf_nbuf_t nbuf,
frag_len, truesize, take_frag_ref);
}
static inline void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf,
const char *func,
uint32_t line)
{
}
static inline void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf,
const char *func,
uint32_t line)
{
}
#endif /* NBUF_FRAG_MEMORY_DEBUG */
#ifdef CONFIG_NBUF_AP_PLATFORM
#include <i_qdf_nbuf_api_w.h>
#else

Datei anzeigen

@@ -24,6 +24,7 @@
#ifndef _QDF_NBUF_FRAG_H
#define _QDF_NBUF_FRAG_H
#include <qdf_util.h>
#include <i_qdf_trace.h>
#include <i_qdf_nbuf_frag.h>
@@ -37,6 +38,222 @@ typedef __qdf_frag_t qdf_frag_t;
*/
#define QDF_NBUF_MAX_FRAGS __QDF_NBUF_MAX_FRAGS
#ifdef NBUF_FRAG_MEMORY_DEBUG
/**
* qdf_frag_debug_init() - Initialize frag debug tracker
*
* Return: none
*/
void qdf_frag_debug_init(void);
/**
* qdf_frag_debug_exit() - Destroy frag debug tracker
*
* Return: none
*/
void qdf_frag_debug_exit(void);
/**
* qdf_frag_debug_add_node() - Add frag node in the debug hash table
* @fragp: Pointer to frag
* @func_name: Caller function name
* @line_num: Caller function line no.
*
* Return: none
*/
void qdf_frag_debug_add_node(qdf_frag_t fragp, const char *func_name,
uint32_t line_num);
/**
* qdf_frag_debug_refcount_inc() - Increment refcount for frag node
* @fragp: Pointer to frag
* @func_name: Caller function name
* @line_num: Caller function line no.
*
* Return: none
*/
void qdf_frag_debug_refcount_inc(qdf_frag_t fragp, const char *func_name,
uint32_t line_num);
/**
* qdf_frag_debug_refcount_dec() - Decrement refcount for frag node
* @fragp: Pointer to frag
* @func_name: Caller function name
* @line_num: Caller function line no.
*
* Return: none
*/
void qdf_frag_debug_refcount_dec(qdf_frag_t fragp, const char *func_name,
uint32_t line_num);
/**
* qdf_frag_debug_delete_node() - Remove frag node from debug hash table
* @fragp: Pointer to frag
* @func_name: Caller function name
* @line_num: Caller function line no.
*
* Return: none
*/
void qdf_frag_debug_delete_node(qdf_frag_t fragp, const char *func_name,
uint32_t line_num);
/**
* qdf_frag_debug_update_addr() - Update frag address in debug tracker
* @p_fragp: Previous frag address
* @n_fragp: New frag address
* @func_name: Caller function name
* @line_num: Caller function line no.
*
* Return: none
*/
void qdf_frag_debug_update_addr(qdf_frag_t p_fragp, qdf_frag_t n_fragp,
const char *func_name, uint32_t line_num);
#define qdf_frag_alloc(s) \
qdf_frag_alloc_debug(s, __func__, __LINE__)
/**
* qdf_frag_alloc_debug() - Allocate frag memory
* @fragsz: Size of frag memory to be allocated
* @func_name: Caller function name
* @line_num: Caller function line no.
*
* Return: Allocated frag address
*/
qdf_frag_t qdf_frag_alloc_debug(unsigned int fragsz, const char *func_name,
uint32_t line_num);
#define qdf_frag_free(p) \
qdf_frag_free_debug(p, __func__, __LINE__)
/**
* qdf_frag_free_debug() - Free allocated frag memory
* @vaddr: Frag address to be freed
* @func_name: Caller function name
* @line_num: Caller function line no.
*
* Return: none
*/
void qdf_frag_free_debug(qdf_frag_t vaddr, const char *func_name,
uint32_t line_num);
#else /* NBUF_FRAG_MEMORY_DEBUG */
static inline void qdf_frag_debug_init(void)
{
}
static inline void qdf_frag_debug_exit(void)
{
}
static inline void qdf_frag_debug_add_node(qdf_frag_t fragp,
const char *func_name,
uint32_t line_num)
{
}
static inline void qdf_frag_debug_refcount_inc(qdf_frag_t fragp,
const char *func_name,
uint32_t line_num)
{
}
static inline void qdf_frag_debug_refcount_dec(qdf_frag_t fragp,
const char *func_name,
uint32_t line_num)
{
}
static inline void qdf_frag_debug_delete_node(qdf_frag_t fragp,
const char *func_name,
uint32_t line_num)
{
}
static inline void qdf_frag_debug_update_addr(qdf_frag_t p_fragp,
qdf_frag_t n_fragp,
const char *func_name,
uint32_t line_num)
{
}
/**
* qdf_frag_alloc() - Allocate frag memory
* @fragsz: Size of frag memory to be allocated
*
* Return: Allocated frag address
*/
static inline qdf_frag_t qdf_frag_alloc(unsigned int fragsz)
{
return __qdf_frag_alloc(fragsz);
}
/**
* qdf_frag_free() - Free allocated frag memory
* @vaddr: Frag address to be freed
*
* Return: none
*/
static inline void qdf_frag_free(qdf_frag_t vaddr)
{
__qdf_frag_free(vaddr);
}
#endif /* NBUF_FRAG_MEMORY_DEBUG */
/**
* qdf_frag_count_get() - Get global frag gauge
*
* Return: Global frag gauge
*/
static inline uint32_t qdf_frag_count_get(void)
{
return __qdf_frag_count_get();
}
/**
* qdf_frag_count_inc() - Increment global frag count
* @value: Increment value
*
* Return: none
*/
static inline void qdf_frag_count_inc(uint32_t value)
{
return __qdf_frag_count_inc(value);
}
/**
* qdf_frag_count_dec() - Decrement global frag count
* @value: Decrement value
*
* Return: none
*/
static inline void qdf_frag_count_dec(uint32_t value)
{
return __qdf_frag_count_dec(value);
}
/**
* qdf_frag_mod_init() - Initialization routine for qdf_frag
*
* Return: none
*/
static inline void qdf_frag_mod_init(void)
{
return __qdf_frag_mod_init();
}
/**
* qdf_frag_mod_exit() - Unintialization routine for qdf_frag
*
* Return: none
*/
static inline void qdf_frag_mod_exit(void)
{
return __qdf_frag_mod_exit();
}
/**
* qdf_mem_map_page() - Map Page
* @osdev: qdf_device_t
@@ -67,23 +284,4 @@ static inline void qdf_mem_unmap_page(qdf_device_t osdev, qdf_dma_addr_t paddr,
__qdf_mem_unmap_page(osdev, paddr, nbytes, dir);
}
/**
* qdf_frag_free() - Free allocated frag memory
* @vaddr: Frag address to be freed.
*/
static inline void qdf_frag_free(qdf_frag_t vaddr)
{
__qdf_frag_free(vaddr);
}
/**
* qdf_frag_alloc() - Allocate frag memory
* @fragsz: Size of frag memory to be allocated
*
* Return: Allcated frag address
*/
static inline qdf_frag_t qdf_frag_alloc(unsigned int fragsz)
{
return __qdf_frag_alloc(fragsz);
}
#endif /* _QDF_NBUF_FRAG_H */