Commit 3f73c24f authored by Dinesh Karthikeyan's avatar Dinesh Karthikeyan Committed by Kalle Valo

wifi: ath12k: Add support to enable debugfs_htt_stats

Create debugfs_htt_stats file when ath12k debugfs support is enabled.
Add basic ath12k_debugfs_htt_stats_register and handle htt_stats_type
file operations.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Signed-off-by: default avatarDinesh Karthikeyan <quic_dinek@quicinc.com>
Co-developed-by: default avatarRamya Gnanasekar <quic_rgnanase@quicinc.com>
Signed-off-by: default avatarRamya Gnanasekar <quic_rgnanase@quicinc.com>
Acked-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240626085854.2500681-2-quic_rgnanase@quicinc.com
parent 9783e040
...@@ -23,7 +23,7 @@ ath12k-y += core.o \ ...@@ -23,7 +23,7 @@ ath12k-y += core.o \
fw.o \ fw.o \
p2p.o p2p.o
ath12k-$(CONFIG_ATH12K_DEBUGFS) += debugfs.o ath12k-$(CONFIG_ATH12K_DEBUGFS) += debugfs.o debugfs_htt_stats.o
ath12k-$(CONFIG_ACPI) += acpi.o ath12k-$(CONFIG_ACPI) += acpi.o
ath12k-$(CONFIG_ATH12K_TRACING) += trace.o ath12k-$(CONFIG_ATH12K_TRACING) += trace.o
ath12k-$(CONFIG_PM) += wow.o ath12k-$(CONFIG_PM) += wow.o
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "fw.h" #include "fw.h"
#include "acpi.h" #include "acpi.h"
#include "wow.h" #include "wow.h"
#include "debugfs_htt_stats.h"
#define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
...@@ -481,9 +482,15 @@ struct ath12k_fw_stats { ...@@ -481,9 +482,15 @@ struct ath12k_fw_stats {
struct list_head bcn; struct list_head bcn;
}; };
struct ath12k_dbg_htt_stats {
enum ath12k_dbg_htt_ext_stats_type type;
u32 cfg_param[4];
};
struct ath12k_debug { struct ath12k_debug {
struct dentry *debugfs_pdev; struct dentry *debugfs_pdev;
struct dentry *debugfs_pdev_symlink; struct dentry *debugfs_pdev_symlink;
struct ath12k_dbg_htt_stats htt_stats;
}; };
struct ath12k_per_peer_tx_stats { struct ath12k_per_peer_tx_stats {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "core.h" #include "core.h"
#include "debugfs.h" #include "debugfs.h"
#include "debugfs_htt_stats.h"
static ssize_t ath12k_write_simulate_radar(struct file *file, static ssize_t ath12k_write_simulate_radar(struct file *file,
const char __user *user_buf, const char __user *user_buf,
...@@ -89,6 +90,8 @@ void ath12k_debugfs_register(struct ath12k *ar) ...@@ -89,6 +90,8 @@ void ath12k_debugfs_register(struct ath12k *ar)
ar->debug.debugfs_pdev, ar, ar->debug.debugfs_pdev, ar,
&fops_simulate_radar); &fops_simulate_radar);
} }
ath12k_debugfs_htt_stats_register(ar);
} }
void ath12k_debugfs_unregister(struct ath12k *ar) void ath12k_debugfs_unregister(struct ath12k *ar)
......
// SPDX-License-Identifier: BSD-3-Clause-Clear
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/vmalloc.h>
#include "core.h"
#include "debug.h"
#include "debugfs_htt_stats.h"
static ssize_t ath12k_read_htt_stats_type(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath12k *ar = file->private_data;
enum ath12k_dbg_htt_ext_stats_type type;
char buf[32];
size_t len;
mutex_lock(&ar->conf_mutex);
type = ar->debug.htt_stats.type;
mutex_unlock(&ar->conf_mutex);
len = scnprintf(buf, sizeof(buf), "%u\n", type);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
static ssize_t ath12k_write_htt_stats_type(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath12k *ar = file->private_data;
enum ath12k_dbg_htt_ext_stats_type type;
unsigned int cfg_param[4] = {0};
const int size = 32;
int num_args;
char *buf __free(kfree) = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
if (copy_from_user(buf, user_buf, count))
return -EFAULT;
num_args = sscanf(buf, "%u %u %u %u %u\n", &type, &cfg_param[0],
&cfg_param[1], &cfg_param[2], &cfg_param[3]);
if (!num_args || num_args > 5)
return -EINVAL;
if (type == ATH12K_DBG_HTT_EXT_STATS_RESET ||
type >= ATH12K_DBG_HTT_NUM_EXT_STATS)
return -EINVAL;
mutex_lock(&ar->conf_mutex);
ar->debug.htt_stats.type = type;
ar->debug.htt_stats.cfg_param[0] = cfg_param[0];
ar->debug.htt_stats.cfg_param[1] = cfg_param[1];
ar->debug.htt_stats.cfg_param[2] = cfg_param[2];
ar->debug.htt_stats.cfg_param[3] = cfg_param[3];
mutex_unlock(&ar->conf_mutex);
return count;
}
static const struct file_operations fops_htt_stats_type = {
.read = ath12k_read_htt_stats_type,
.write = ath12k_write_htt_stats_type,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
void ath12k_debugfs_htt_stats_register(struct ath12k *ar)
{
debugfs_create_file("htt_stats_type", 0600, ar->debug.debugfs_pdev,
ar, &fops_htt_stats_type);
}
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef DEBUG_HTT_STATS_H
#define DEBUG_HTT_STATS_H
void ath12k_debugfs_htt_stats_register(struct ath12k *ar);
/* htt_dbg_ext_stats_type */
enum ath12k_dbg_htt_ext_stats_type {
ATH12K_DBG_HTT_EXT_STATS_RESET = 0,
/* keep this last */
ATH12K_DBG_HTT_NUM_EXT_STATS,
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment