qcacmn: Add dp functionality to support stats sysfs

Add dp functionality to collect stats for sysfs buffer.
Add both host and fw stats.

Change-Id: I64f84804d36cccec9d701925d96cc7ee96943b7a
CRs-Fixed: 3035864
这个提交包含在:
sandhu
2021-09-09 10:14:46 -07:00
提交者 Madan Koyyalamudi
父节点 f2ec3b8c25
当前提交 18fe5c3f02
修改 6 个文件,包含 477 行新增31 行删除

查看文件

@@ -57,10 +57,13 @@ struct htt_dbgfs_cfg {
#define DBG_STATS_COOKIE_DEFAULT 0x0
/* Reserve for DP Stats: 3rd bit */
#define DBG_STATS_COOKIE_DP_STATS 0x8
#define DBG_STATS_COOKIE_DP_STATS BIT(3)
/* Reserve for HTT Stats debugfs support: 4th bit */
#define DBG_STATS_COOKIE_HTT_DBGFS 0x10
#define DBG_STATS_COOKIE_HTT_DBGFS BIT(4)
/*Reserve for HTT Stats debugfs support: 5th bit */
#define DBG_SYSFS_STATS_COOKIE BIT(5)
/**
* Bitmap of HTT PPDU TLV types for Default mode
@@ -612,6 +615,19 @@ void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
}
#endif
/**
* cdp_soc_t_to_dp_soc() - typecast cdp_soc_t to
* dp soc handle
* @psoc: CDP psoc handle
*
* Return: struct dp_soc pointer
*/
static inline
struct dp_soc *cdp_soc_t_to_dp_soc(struct cdp_soc_t *psoc)
{
return (struct dp_soc *)psoc;
}
#define DP_MAX_TIMER_EXEC_TIME_TICKS \
(QDF_LOG_TIMESTAMP_CYCLES_PER_10_US * 100 * 20)
@@ -666,6 +682,48 @@ while (0)
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \
fmt, ## args)
#ifdef WLAN_SYSFS_DP_STATS
static
inline void DP_PRINT_STATS(const char *fmt, ...)
{
void *soc_void = NULL;
va_list val;
uint16_t buf_written = 0;
uint16_t curr_len = 0;
uint16_t max_len = 0;
struct dp_soc *soc = NULL;
soc_void = cds_get_context(QDF_MODULE_ID_SOC);
soc = cdp_soc_t_to_dp_soc(soc_void);
va_start(val, fmt);
QDF_VTRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, (char *)fmt, val);
/* writing to the buffer */
if (soc->sysfs_config && soc->sysfs_config->printing_mode == PRINTING_MODE_ENABLED) {
if (soc->sysfs_config->process_id == qdf_get_current_pid()) {
curr_len = soc->sysfs_config->curr_buffer_length;
max_len = soc->sysfs_config->max_buffer_length;
if ((max_len - curr_len) <= 1)
return;
qdf_spinlock_acquire(&soc->sysfs_config->sysfs_write_user_buffer);
if (soc->sysfs_config->buf) {
buf_written = vscnprintf(soc->sysfs_config->buf + curr_len,
max_len - curr_len, fmt, val);
curr_len += buf_written;
if ((max_len - curr_len) <= 1)
return;
buf_written += scnprintf(soc->sysfs_config->buf + curr_len,
max_len - curr_len, "\n");
soc->sysfs_config->curr_buffer_length += buf_written;
}
qdf_spinlock_release(&soc->sysfs_config->sysfs_write_user_buffer);
}
}
va_end(val);
}
#else /* WLAN_SYSFS_DP_STATS */
#ifdef DP_PRINT_NO_CONSOLE
/* Stat prints should not go to console or kernel logs.*/
#define DP_PRINT_STATS(fmt, args ...)\
@@ -676,6 +734,8 @@ while (0)
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,\
fmt, ## args)
#endif
#endif /* WLAN_SYSFS_DP_STATS */
#define DP_STATS_INIT(_handle) \
qdf_mem_zero(&((_handle)->stats), sizeof((_handle)->stats))
@@ -2479,19 +2539,6 @@ struct cdp_soc_t *dp_soc_to_cdp_soc_t(struct dp_soc *psoc)
return (struct cdp_soc_t *)psoc;
}
/**
* cdp_soc_t_to_dp_soc() - typecast cdp_soc_t to
* dp soc handle
* @psoc: CDP psoc handle
*
* Return: struct dp_soc pointer
*/
static inline
struct dp_soc *cdp_soc_t_to_dp_soc(struct cdp_soc_t *psoc)
{
return (struct dp_soc *)psoc;
}
#if defined(WLAN_SUPPORT_RX_FLOW_TAG) || defined(WLAN_SUPPORT_RX_FISA)
/**
* dp_rx_flow_update_fse_stats() - Update a flow's statistics