wl18xx: add support to clear FW statistics
This patch calls ACX_CLEAR_STATISTICS to clear the firmware statistics. The trigger is a new debugfs file called clear_fw_statistics in the fw_stats directory. Signed-off-by: Luciano Coelho <coelho@ti.com>
This commit is contained in:
@@ -85,3 +85,27 @@ out:
|
|||||||
kfree(acx);
|
kfree(acx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wl18xx_acx_clear_statistics(struct wl1271 *wl)
|
||||||
|
{
|
||||||
|
struct wl18xx_acx_clear_statistics *acx;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
wl1271_debug(DEBUG_ACX, "acx clear statistics");
|
||||||
|
|
||||||
|
acx = kzalloc(sizeof(*acx), GFP_KERNEL);
|
||||||
|
if (!acx) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = wl1271_cmd_configure(wl, ACX_CLEAR_STATISTICS, acx, sizeof(*acx));
|
||||||
|
if (ret < 0) {
|
||||||
|
wl1271_warning("failed to clear firmware statistics: %d", ret);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
kfree(acx);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@@ -25,6 +25,10 @@
|
|||||||
#include "../wlcore/wlcore.h"
|
#include "../wlcore/wlcore.h"
|
||||||
#include "../wlcore/acx.h"
|
#include "../wlcore/acx.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ACX_CLEAR_STATISTICS = 0x0047,
|
||||||
|
};
|
||||||
|
|
||||||
/* numbers of bits the length field takes (add 1 for the actual number) */
|
/* numbers of bits the length field takes (add 1 for the actual number) */
|
||||||
#define WL18XX_HOST_IF_LEN_SIZE_FIELD 15
|
#define WL18XX_HOST_IF_LEN_SIZE_FIELD 15
|
||||||
|
|
||||||
@@ -253,9 +257,14 @@ struct wl18xx_acx_statistics {
|
|||||||
struct wl18xx_acx_mem_stats mem;
|
struct wl18xx_acx_mem_stats mem;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
struct wl18xx_acx_clear_statistics {
|
||||||
|
struct acx_header header;
|
||||||
|
};
|
||||||
|
|
||||||
int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap,
|
int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap,
|
||||||
u32 sdio_blk_size, u32 extra_mem_blks,
|
u32 sdio_blk_size, u32 extra_mem_blks,
|
||||||
u32 len_field_size);
|
u32 len_field_size);
|
||||||
int wl18xx_acx_set_checksum_state(struct wl1271 *wl);
|
int wl18xx_acx_set_checksum_state(struct wl1271 *wl);
|
||||||
|
int wl18xx_acx_clear_statistics(struct wl1271 *wl);
|
||||||
|
|
||||||
#endif /* __WL18XX_ACX_H__ */
|
#endif /* __WL18XX_ACX_H__ */
|
||||||
|
@@ -158,6 +158,34 @@ WL18XX_DEBUGFS_FWSTATS_FILE(mem, tx_free_mem_blks, "%u");
|
|||||||
WL18XX_DEBUGFS_FWSTATS_FILE(mem, fwlog_free_mem_blks, "%u");
|
WL18XX_DEBUGFS_FWSTATS_FILE(mem, fwlog_free_mem_blks, "%u");
|
||||||
WL18XX_DEBUGFS_FWSTATS_FILE(mem, fw_gen_free_mem_blks, "%u");
|
WL18XX_DEBUGFS_FWSTATS_FILE(mem, fw_gen_free_mem_blks, "%u");
|
||||||
|
|
||||||
|
static ssize_t clear_fw_stats_write(struct file *file,
|
||||||
|
const char __user *user_buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct wl1271 *wl = file->private_data;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
mutex_lock(&wl->mutex);
|
||||||
|
|
||||||
|
if (wl->state == WL1271_STATE_OFF)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
ret = wl18xx_acx_clear_statistics(wl);
|
||||||
|
if (ret < 0) {
|
||||||
|
count = ret;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
out:
|
||||||
|
mutex_unlock(&wl->mutex);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations clear_fw_stats_ops = {
|
||||||
|
.write = clear_fw_stats_write,
|
||||||
|
.open = simple_open,
|
||||||
|
.llseek = default_llseek,
|
||||||
|
};
|
||||||
|
|
||||||
int wl18xx_debugfs_add_files(struct wl1271 *wl,
|
int wl18xx_debugfs_add_files(struct wl1271 *wl,
|
||||||
struct dentry *rootdir)
|
struct dentry *rootdir)
|
||||||
{
|
{
|
||||||
@@ -176,6 +204,8 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUGFS_ADD(clear_fw_stats, stats);
|
||||||
|
|
||||||
DEBUGFS_FWSTATS_ADD(debug, debug1);
|
DEBUGFS_FWSTATS_ADD(debug, debug1);
|
||||||
DEBUGFS_FWSTATS_ADD(debug, debug2);
|
DEBUGFS_FWSTATS_ADD(debug, debug2);
|
||||||
DEBUGFS_FWSTATS_ADD(debug, debug3);
|
DEBUGFS_FWSTATS_ADD(debug, debug3);
|
||||||
|
Reference in New Issue
Block a user