Commit 467210a6 authored by SenthilKumar Jegadeesan's avatar SenthilKumar Jegadeesan Committed by Kalle Valo

ath10k: add log level configuration for fw_dbglog

Introduce an optional log level configuration for the existing debugfs fw_dbglog file. It
allows users to configure the desired log level for firmware dbglog messages.

To configure log level as WARN:

echo 0xffffffff  2 > /sys/kernel/debug/ieee80211/phy0/ath10k/fw_dbglog

The values are:

VERBOSE		0
INFO		1
WARN		2
ERR		3
Signed-off-by: default avatarSenthilKumar Jegadeesan <sjegadee@qti.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 75930d1a
...@@ -350,6 +350,7 @@ struct ath10k_debug { ...@@ -350,6 +350,7 @@ struct ath10k_debug {
/* protected by conf_mutex */ /* protected by conf_mutex */
u32 fw_dbglog_mask; u32 fw_dbglog_mask;
u32 fw_dbglog_level;
u32 pktlog_filter; u32 pktlog_filter;
u32 reg_addr; u32 reg_addr;
u32 nf_cal_period; u32 nf_cal_period;
......
...@@ -1318,10 +1318,10 @@ static ssize_t ath10k_read_fw_dbglog(struct file *file, ...@@ -1318,10 +1318,10 @@ static ssize_t ath10k_read_fw_dbglog(struct file *file,
{ {
struct ath10k *ar = file->private_data; struct ath10k *ar = file->private_data;
unsigned int len; unsigned int len;
char buf[32]; char buf[64];
len = scnprintf(buf, sizeof(buf), "0x%08x\n", len = scnprintf(buf, sizeof(buf), "0x%08x %u\n",
ar->debug.fw_dbglog_mask); ar->debug.fw_dbglog_mask, ar->debug.fw_dbglog_level);
return simple_read_from_buffer(user_buf, count, ppos, buf, len); return simple_read_from_buffer(user_buf, count, ppos, buf, len);
} }
...@@ -1331,19 +1331,32 @@ static ssize_t ath10k_write_fw_dbglog(struct file *file, ...@@ -1331,19 +1331,32 @@ static ssize_t ath10k_write_fw_dbglog(struct file *file,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct ath10k *ar = file->private_data; struct ath10k *ar = file->private_data;
unsigned long mask;
int ret; int ret;
char buf[64];
unsigned int log_level, mask;
ret = kstrtoul_from_user(user_buf, count, 0, &mask); simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
if (ret)
return ret; /* make sure that buf is null terminated */
buf[sizeof(buf) - 1] = 0;
ret = sscanf(buf, "%x %u", &mask, &log_level);
if (!ret)
return -EINVAL;
if (ret == 1)
/* default if user did not specify */
log_level = ATH10K_DBGLOG_LEVEL_WARN;
mutex_lock(&ar->conf_mutex); mutex_lock(&ar->conf_mutex);
ar->debug.fw_dbglog_mask = mask; ar->debug.fw_dbglog_mask = mask;
ar->debug.fw_dbglog_level = log_level;
if (ar->state == ATH10K_STATE_ON) { if (ar->state == ATH10K_STATE_ON) {
ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask); ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask,
ar->debug.fw_dbglog_level);
if (ret) { if (ret) {
ath10k_warn(ar, "dbglog cfg failed from debugfs: %d\n", ath10k_warn(ar, "dbglog cfg failed from debugfs: %d\n",
ret); ret);
...@@ -1685,7 +1698,8 @@ int ath10k_debug_start(struct ath10k *ar) ...@@ -1685,7 +1698,8 @@ int ath10k_debug_start(struct ath10k *ar)
ret); ret);
if (ar->debug.fw_dbglog_mask) { if (ar->debug.fw_dbglog_mask) {
ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask); ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask,
ATH10K_DBGLOG_LEVEL_WARN);
if (ret) if (ret)
/* not serious */ /* not serious */
ath10k_warn(ar, "failed to enable dbglog during start: %d", ath10k_warn(ar, "failed to enable dbglog during start: %d",
......
...@@ -116,7 +116,8 @@ struct wmi_ops { ...@@ -116,7 +116,8 @@ struct wmi_ops {
enum wmi_force_fw_hang_type type, enum wmi_force_fw_hang_type type,
u32 delay_ms); u32 delay_ms);
struct sk_buff *(*gen_mgmt_tx)(struct ath10k *ar, struct sk_buff *skb); struct sk_buff *(*gen_mgmt_tx)(struct ath10k *ar, struct sk_buff *skb);
struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u32 module_enable); struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u32 module_enable,
u32 log_level);
struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter); struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter);
struct sk_buff *(*gen_pktlog_disable)(struct ath10k *ar); struct sk_buff *(*gen_pktlog_disable)(struct ath10k *ar);
struct sk_buff *(*gen_pdev_set_quiet_mode)(struct ath10k *ar, struct sk_buff *(*gen_pdev_set_quiet_mode)(struct ath10k *ar,
...@@ -846,14 +847,14 @@ ath10k_wmi_force_fw_hang(struct ath10k *ar, ...@@ -846,14 +847,14 @@ ath10k_wmi_force_fw_hang(struct ath10k *ar,
} }
static inline int static inline int
ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable) ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable, u32 log_level)
{ {
struct sk_buff *skb; struct sk_buff *skb;
if (!ar->wmi.ops->gen_dbglog_cfg) if (!ar->wmi.ops->gen_dbglog_cfg)
return -EOPNOTSUPP; return -EOPNOTSUPP;
skb = ar->wmi.ops->gen_dbglog_cfg(ar, module_enable); skb = ar->wmi.ops->gen_dbglog_cfg(ar, module_enable, log_level);
if (IS_ERR(skb)) if (IS_ERR(skb))
return PTR_ERR(skb); return PTR_ERR(skb);
......
...@@ -2126,8 +2126,8 @@ ath10k_wmi_tlv_op_gen_force_fw_hang(struct ath10k *ar, ...@@ -2126,8 +2126,8 @@ ath10k_wmi_tlv_op_gen_force_fw_hang(struct ath10k *ar,
} }
static struct sk_buff * static struct sk_buff *
ath10k_wmi_tlv_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable) ath10k_wmi_tlv_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable,
{ u32 log_level) {
struct wmi_tlv_dbglog_cmd *cmd; struct wmi_tlv_dbglog_cmd *cmd;
struct wmi_tlv *tlv; struct wmi_tlv *tlv;
struct sk_buff *skb; struct sk_buff *skb;
......
...@@ -4991,7 +4991,8 @@ ath10k_wmi_op_gen_force_fw_hang(struct ath10k *ar, ...@@ -4991,7 +4991,8 @@ ath10k_wmi_op_gen_force_fw_hang(struct ath10k *ar,
} }
static struct sk_buff * static struct sk_buff *
ath10k_wmi_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable) ath10k_wmi_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable,
u32 log_level)
{ {
struct wmi_dbglog_cfg_cmd *cmd; struct wmi_dbglog_cfg_cmd *cmd;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -5004,7 +5005,7 @@ ath10k_wmi_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable) ...@@ -5004,7 +5005,7 @@ ath10k_wmi_op_gen_dbglog_cfg(struct ath10k *ar, u32 module_enable)
cmd = (struct wmi_dbglog_cfg_cmd *)skb->data; cmd = (struct wmi_dbglog_cfg_cmd *)skb->data;
if (module_enable) { if (module_enable) {
cfg = SM(ATH10K_DBGLOG_LEVEL_VERBOSE, cfg = SM(log_level,
ATH10K_DBGLOG_CFG_LOG_LVL); ATH10K_DBGLOG_CFG_LOG_LVL);
} else { } else {
/* set back defaults, all modules with WARN level */ /* set back defaults, all modules with WARN level */
......
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