qcacmn: Add memory stats pertaining to DP usage
Add sysfs node for DP level memory stats: /sys/kernel/wifi/wlan/wlan_dp_mem_stats These include Tx, Rx SKB memory allocated, Tx/Rx buffer count, outstanding Tx desc count. Add and subtract the skb memory for Rx/Tx when the map/unmap functions are invoked. Change-Id: If62cc47bb60f7eb63f60e861f755f3417248677f CRs-Fixed: 2724482
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <qdf_types.h>
|
||||
#include <i_qdf_mem.h>
|
||||
#include <i_qdf_trace.h>
|
||||
#include <qdf_atomic.h>
|
||||
|
||||
#define QDF_CACHE_LINE_SZ __qdf_cache_line_sz
|
||||
|
||||
@@ -604,7 +605,85 @@ void qdf_mem_skb_inc(qdf_size_t size);
|
||||
*/
|
||||
void qdf_mem_skb_dec(qdf_size_t size);
|
||||
|
||||
/**
|
||||
* qdf_mem_skb_total_inc() - increment total skb allocation size
|
||||
* in host driver in both debug and perf builds
|
||||
* @size: size to be added
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_skb_total_inc(qdf_size_t size);
|
||||
|
||||
/**
|
||||
* qdf_mem_skb_total_dec() - decrement total skb allocation size
|
||||
* in the host driver in debug and perf flavors
|
||||
* @size: size to be decremented
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_skb_total_dec(qdf_size_t size);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_tx_skb_inc() - Increment Tx skb allocation size
|
||||
* @size: size to be added
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_dp_tx_skb_inc(qdf_size_t size);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_tx_skb_dec() - Decrement Tx skb allocation size
|
||||
* @size: size to be decreased
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_dp_tx_skb_dec(qdf_size_t size);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_rx_skb_inc() - Increment Rx skb allocation size
|
||||
* @size: size to be added
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_dp_rx_skb_inc(qdf_size_t size);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_rx_skb_dec() - Decrement Rx skb allocation size
|
||||
* @size: size to be decreased
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_dp_rx_skb_dec(qdf_size_t size);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_tx_skb_cnt_inc() - Increment Tx buffer count
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_dp_tx_skb_cnt_inc(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_tx_skb_cnt_dec() - Decrement Tx buffer count
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_dp_tx_skb_cnt_dec(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_rx_skb_cnt_inc() - Increment Rx buffer count
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_dp_rx_skb_cnt_inc(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_rx_skb_cnt_dec() - Decrement Rx buffer count
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void qdf_mem_dp_rx_skb_cnt_dec(void);
|
||||
#else
|
||||
|
||||
static inline void qdf_mem_skb_inc(qdf_size_t size)
|
||||
{
|
||||
}
|
||||
@@ -612,6 +691,46 @@ static inline void qdf_mem_skb_inc(qdf_size_t size)
|
||||
static inline void qdf_mem_skb_dec(qdf_size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_skb_total_inc(qdf_size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_skb_total_dec(qdf_size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_dp_tx_skb_inc(qdf_size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_dp_tx_skb_dec(qdf_size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_dp_rx_skb_inc(qdf_size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_dp_rx_skb_dec(qdf_size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_dp_tx_skb_cnt_inc(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_dp_tx_skb_cnt_dec(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_dp_rx_skb_cnt_inc(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void qdf_mem_dp_rx_skb_cnt_dec(void)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_WLAN_SYSFS_MEM_STATS */
|
||||
|
||||
/**
|
||||
@@ -868,7 +987,7 @@ static inline void qdf_mem_shared_mem_free(qdf_device_t osdev,
|
||||
* qdf_dma_mem_stats_read() - Return the DMA memory allocated in
|
||||
* host driver
|
||||
*
|
||||
* Return: None
|
||||
* Return: Total DMA memory allocated
|
||||
*/
|
||||
int32_t qdf_dma_mem_stats_read(void);
|
||||
|
||||
@@ -876,7 +995,7 @@ int32_t qdf_dma_mem_stats_read(void);
|
||||
* qdf_heap_mem_stats_read() - Return the heap memory allocated
|
||||
* in host driver
|
||||
*
|
||||
* Return: None
|
||||
* Return: Total heap memory allocated
|
||||
*/
|
||||
int32_t qdf_heap_mem_stats_read(void);
|
||||
|
||||
@@ -884,8 +1003,127 @@ int32_t qdf_heap_mem_stats_read(void);
|
||||
* qdf_skb_mem_stats_read() - Return the SKB memory allocated in
|
||||
* host driver
|
||||
*
|
||||
* Return: None
|
||||
* Return: Total SKB memory allocated
|
||||
*/
|
||||
int32_t qdf_skb_mem_stats_read(void);
|
||||
|
||||
/**
|
||||
* qdf_skb_total_mem_stats_read() - Return the SKB memory allocated
|
||||
* in the host driver tracked in both debug and perf builds
|
||||
*
|
||||
* Return: Total SKB memory allocated
|
||||
*/
|
||||
int32_t qdf_skb_total_mem_stats_read(void);
|
||||
|
||||
/**
|
||||
* qdf_skb_max_mem_stats_read() - Return the max SKB memory
|
||||
* allocated in host driver. This is the high watermark for the
|
||||
* total SKB allocated in the host driver
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
int32_t qdf_skb_max_mem_stats_read(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_tx_desc_cnt_read() - Return the outstanding Tx descs
|
||||
* which are waiting on Tx completions
|
||||
*
|
||||
* Return: Outstanding Tx desc count
|
||||
*/
|
||||
int32_t qdf_mem_tx_desc_cnt_read(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_tx_desc_max_read() - Return the max outstanding Tx
|
||||
* descs which are waiting on Tx completions. This is the high
|
||||
* watermark for the pending desc count
|
||||
*
|
||||
* Return: Max outstanding Tx desc count
|
||||
*/
|
||||
int32_t qdf_mem_tx_desc_max_read(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_stats_init() - Initialize the qdf memstats fields on
|
||||
* creating the sysfs node
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void qdf_mem_stats_init(void);
|
||||
|
||||
/**
|
||||
* qdf_dp_tx_skb_mem_stats_read() - Return the SKB memory
|
||||
* allocated for Tx data path
|
||||
*
|
||||
* Return: Tx SKB memory allocated
|
||||
*/
|
||||
int32_t qdf_dp_tx_skb_mem_stats_read(void);
|
||||
|
||||
/**
|
||||
* qdf_dp_rx_skb_mem_stats_read() - Return the SKB memory
|
||||
* allocated for Rx data path
|
||||
*
|
||||
* Return: Rx SKB memory allocated
|
||||
*/
|
||||
int32_t qdf_dp_rx_skb_mem_stats_read(void);
|
||||
|
||||
/**
|
||||
* qdf_dp_tx_skb_max_mem_stats_read() - Return the high
|
||||
* watermark for the SKB memory allocated for Tx data path
|
||||
*
|
||||
* Return: Max Tx SKB memory allocated
|
||||
*/
|
||||
int32_t qdf_dp_tx_skb_max_mem_stats_read(void);
|
||||
|
||||
/**
|
||||
* qdf_dp_rx_skb_max_mem_stats_read() - Return the high
|
||||
* watermark for the SKB memory allocated for Rx data path
|
||||
*
|
||||
* Return: Max Rx SKB memory allocated
|
||||
*/
|
||||
int32_t qdf_dp_rx_skb_max_mem_stats_read(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_tx_skb_cnt_read() - Return number of buffers
|
||||
* allocated in the Tx data path by the host driver or
|
||||
* buffers coming from the n/w stack
|
||||
*
|
||||
* Return: Number of DP Tx buffers allocated
|
||||
*/
|
||||
int32_t qdf_mem_dp_tx_skb_cnt_read(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_tx_skb_max_cnt_read() - Return max number of
|
||||
* buffers allocated in the Tx data path
|
||||
*
|
||||
* Return: Max number of DP Tx buffers allocated
|
||||
*/
|
||||
int32_t qdf_mem_dp_tx_skb_max_cnt_read(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_rx_skb_cnt_read() - Return number of buffers
|
||||
* allocated in the Rx data path
|
||||
*
|
||||
* Return: Number of DP Rx buffers allocated
|
||||
*/
|
||||
int32_t qdf_mem_dp_rx_skb_cnt_read(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_dp_rx_skb_max_cnt_read() - Return max number of
|
||||
* buffers allocated in the Rx data path
|
||||
*
|
||||
* Return: Max number of DP Rx buffers allocated
|
||||
*/
|
||||
int32_t qdf_mem_dp_rx_skb_max_cnt_read(void);
|
||||
|
||||
/**
|
||||
* qdf_mem_tx_desc_cnt_update() - Update the pending tx desc
|
||||
* count and the high watermark for pending tx desc count
|
||||
*
|
||||
* @pending_tx_descs: outstanding Tx desc count
|
||||
* @tx_descs_max: high watermark for outstanding Tx desc count
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void qdf_mem_tx_desc_cnt_update(qdf_atomic_t pending_tx_descs,
|
||||
int32_t tx_descs_max);
|
||||
|
||||
#endif /* __QDF_MEMORY_H */
|
||||
|
Reference in New Issue
Block a user