2018-03-05 06:58:50

by Anilkumar Kolli

[permalink] [raw]
Subject: [PATCH 0/2] FWTEST command support in debugfs

Add WMI_FWTEST_CMD support.
This command is used to configure tx parameters

Sathishkumar Muruganandam (2):
ath10k: Add WMI FWTEST command support
ath10k: add debugfs support to configure fwtest parameters

drivers/net/wireless/ath/ath10k/core.h | 2 +
drivers/net/wireless/ath/ath10k/debug.c | 81 +++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath10k/wmi-ops.h | 17 ++++++
drivers/net/wireless/ath/ath10k/wmi.c | 23 +++++++-
drivers/net/wireless/ath/ath10k/wmi.h | 6 +++
5 files changed, 128 insertions(+), 1 deletion(-)

--
1.7.9.5


2018-03-05 07:42:55

by Sven Eckelmann

[permalink] [raw]
Subject: Re: [PATCH 2/2] ath10k: add debugfs support to configure fwtest parameters

On Montag, 5. M?rz 2018 12:29:08 CET Anilkumar Kolli wrote:
> @@ -496,6 +497,8 @@ struct ath10k_debug {
> u32 reg_addr;
> u32 nf_cal_period;
> void *cal_data;
> + u32 fw_test_param_id;
> + u32 fw_test_param_value;
> };

Why is it necessary to have these two values in ath10k_debug? They seem to be
used only in the context of ath10k_write_fw_test().

Where can we find the documentation of the possible param_id and param_values?

Kind regards,
Sven


Attachments:
signature.asc (833.00 B)
This is a digitally signed message part.

2018-03-05 19:31:36

by Sebastian Gottschall

[permalink] [raw]
Subject: Re: [PATCH 1/2] ath10k: Add WMI FWTEST command support

Am 05.03.2018 um 19:48 schrieb Peter Oh:
> From: Sathishkumar Muruganandam <[email protected]>
>> This patch adds support for WMI_FWTEST_CMD.
>> This command is used for setting the wifi parameters.
>
> It's too lack of information in commit message.
> You should add such what values are acceptable for which purpose by
> each param_id and param_value to make this changes meaningful to
> community.
i agree. i reviewed the firmware sourcecode to find out what its doing,
but also within the firmware is almost undocumented. its a bunch of
undocumented
numeric parameters with undocumented behaviour.
if qca is willig to document this feature it might be included.

Sebastian


--
Mit freundlichen Gr?ssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz: Stubenwaldallee 21a, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Gesch?ftsf?hrer: Peter Steinh?user, Christian Scheele
http://www.dd-wrt.com
email: [email protected]
Tel.: +496251-582650 / Fax: +496251-5826565

2018-03-05 06:59:01

by Anilkumar Kolli

[permalink] [raw]
Subject: [PATCH 1/2] ath10k: Add WMI FWTEST command support

From: Sathishkumar Muruganandam <[email protected]>

This patch adds support for WMI_FWTEST_CMD.
This command is used for setting the wifi parameters.

Signed-off-by: Sathishkumar Muruganandam <[email protected]>
Signed-off-by: Anilkumar Kolli <[email protected]>
---
drivers/net/wireless/ath/ath10k/wmi-ops.h | 18 ++++++++++++++++++
drivers/net/wireless/ath/ath10k/wmi.c | 24 +++++++++++++++++++++++-
drivers/net/wireless/ath/ath10k/wmi.h | 7 +++++++
3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 14093cfdc505..5b710c64493d 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2005-2011 Atheros Communications Inc.
* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -125,6 +126,8 @@ struct wmi_ops {
enum wmi_force_fw_hang_type type,
u32 delay_ms);
struct sk_buff *(*gen_mgmt_tx)(struct ath10k *ar, struct sk_buff *skb);
+ struct sk_buff *(*gen_fw_test)(struct ath10k *ar, u32 param_id,
+ u32 param_value);
struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u64 module_enable,
u32 log_level);
struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter);
@@ -959,6 +962,21 @@ struct wmi_ops {
}

static inline int
+ath10k_wmi_fw_test(struct ath10k *ar, u32 param_id, u32 param_value)
+{
+ struct sk_buff *skb;
+
+ if (!ar->wmi.ops->gen_fw_test)
+ return -EOPNOTSUPP;
+
+ skb = ar->wmi.ops->gen_fw_test(ar, param_id, param_value);
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
+ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->fwtest_cmdid);
+}
+
+static inline int
ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level)
{
struct sk_buff *skb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 58dc2189ba49..09ffc188e5f5 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2005-2011 Atheros Communications Inc.
* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -511,7 +512,7 @@
.pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED,
.pdev_fips_cmdid = WMI_CMD_UNSUPPORTED,
.tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED,
- .fwtest_cmdid = WMI_CMD_UNSUPPORTED,
+ .fwtest_cmdid = WMI_10_2_FWTEST_CMDID,
.vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
.peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
.pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED,
@@ -7092,6 +7093,25 @@ void ath10k_wmi_set_wmm_param(struct wmi_wmm_params *params,
}

static struct sk_buff *
+ath10k_wmi_op_gen_fw_test(struct ath10k *ar, u32 param_id, u32 param_value)
+{
+ struct wmi_fw_test_cmd *cmd;
+ struct sk_buff *skb;
+
+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+ if (!skb)
+ return ERR_PTR(-ENOMEM);
+
+ cmd = (struct wmi_fw_test_cmd *)skb->data;
+ cmd->param_id = __cpu_to_le32(param_id);
+ cmd->param_value = __cpu_to_le32(param_value);
+
+ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi fw_test %d %d",
+ param_id, param_value);
+ return skb;
+}
+
+static struct sk_buff *
ath10k_wmi_op_gen_dbglog_cfg(struct ath10k *ar, u64 module_enable,
u32 log_level)
{
@@ -8368,6 +8388,7 @@ static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, u8 sp)
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
/* .gen_adaptive_qcs not implemented */
+ .gen_fw_test = ath10k_wmi_op_gen_fw_test,
};

static const struct wmi_ops wmi_10_4_ops = {
@@ -8418,6 +8439,7 @@ static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, u8 sp)
.gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm,
.gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang,
.gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx,
+ .gen_fw_test = ath10k_wmi_op_gen_fw_test,
.gen_dbglog_cfg = ath10k_wmi_10_4_op_gen_dbglog_cfg,
.gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
.gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index c7b30ed9015d..1cb410ab6f8f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2005-2011 Atheros Communications Inc.
* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -1558,6 +1559,7 @@ enum wmi_10_2_cmd_id {
WMI_10_2_SET_LTEU_CONFIG_CMDID,
WMI_10_2_SET_CCA_PARAMS,
WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
+ WMI_10_2_FWTEST_CMDID,
WMI_10_2_PDEV_UTF_CMDID = WMI_10_2_END_CMDID - 1,
};

@@ -6366,6 +6368,11 @@ struct wmi_force_fw_hang_cmd {
__le32 delay_ms;
} __packed;

+struct wmi_fw_test_cmd {
+ __le32 param_id;
+ __le32 param_value;
+} __packed;
+
enum ath10k_dbglog_level {
ATH10K_DBGLOG_LEVEL_VERBOSE = 0,
ATH10K_DBGLOG_LEVEL_INFO = 1,
--
1.7.9.5

2018-03-05 18:48:24

by Peter Oh

[permalink] [raw]
Subject: Re: [PATCH 1/2] ath10k: Add WMI FWTEST command support

From: Sathishkumar Muruganandam <[email protected]>
> This patch adds support for WMI_FWTEST_CMD.
> This command is used for setting the wifi parameters.

It's too lack of information in commit message.
You should add such what values are acceptable for which purpose by each
param_id and param_value to make this changes meaningful to community.

Thanks,
Peter

2018-03-05 10:46:22

by Anilkumar Kolli

[permalink] [raw]
Subject: Re: [PATCH 2/2] ath10k: add debugfs support to configure fwtest parameters

On 2018-03-05 13:12, Sven Eckelmann wrote:
> On Montag, 5. März 2018 12:29:08 CET Anilkumar Kolli wrote:
>> @@ -496,6 +497,8 @@ struct ath10k_debug {
>> u32 reg_addr;
>> u32 nf_cal_period;
>> void *cal_data;
>> + u32 fw_test_param_id;
>> + u32 fw_test_param_value;
>> };
>
> Why is it necessary to have these two values in ath10k_debug? They seem
> to be
> used only in the context of ath10k_write_fw_test().
>
Yes. it is not reused, will remove this.

> Where can we find the documentation of the possible param_id and
> param_values?
>
All these parameters are for experimentation purpose.

Thanks,
Anil.

2018-03-05 06:59:11

by Anilkumar Kolli

[permalink] [raw]
Subject: [PATCH 2/2] ath10k: add debugfs support to configure fwtest parameters

From: Sathishkumar Muruganandam <[email protected]>

Added a debugfs file "fw_test" to configure the tx parameters
through WMI_FWTEST_CMD

Usage:
cat /sys/kernel/debug/ieee80211/phy0/ath10k/fw_test
echo <param id> <val> > /sys/kernel/debug/ieee80211/phy0/ath10k/fw_test

Signed-off-by: Sathishkumar Muruganandam <[email protected]>
Signed-off-by: Anilkumar Kolli <[email protected]>
---
drivers/net/wireless/ath/ath10k/core.h | 3 ++
drivers/net/wireless/ath/ath10k/debug.c | 81 +++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index fe6b30356d3b..2db734138877 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2005-2011 Atheros Communications Inc.
* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -496,6 +497,8 @@ struct ath10k_debug {
u32 reg_addr;
u32 nf_cal_period;
void *cal_data;
+ u32 fw_test_param_id;
+ u32 fw_test_param_value;
};

enum ath10k_state {
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 554cd7856cb6..245237a6660b 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2088,6 +2088,83 @@ static ssize_t ath10k_read_peer_stats(struct file *file, char __user *ubuf,
.open = simple_open
};

+static ssize_t ath10k_read_fops_fw_test(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ const char buf[] =
+ "Commands used for FW test'\n"
+ "Syntax example:\n"
+ "echo 5 0 > /sys/kernel/debug/ieee80211/phy0/ath10k/fw_test'\n";
+
+ return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
+}
+
+/* fw_test support
+ */
+static ssize_t ath10k_write_fw_test(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath10k *ar = file->private_data;
+ char buf[32] = {0};
+ ssize_t rc;
+ u32 param_id;
+ u32 param_value;
+ int ret;
+
+ rc = simple_write_to_buffer(buf, sizeof(buf) - 1,
+ ppos, user_buf, count);
+ if (rc < 0)
+ return rc;
+
+ buf[*ppos - 1] = '\0';
+
+ ret = sscanf(buf, "%u %x", &param_id, &param_value);
+
+ if (ret != 2)
+ return -EINVAL;
+
+ mutex_lock(&ar->conf_mutex);
+
+ if (ar->state != ATH10K_STATE_ON &&
+ ar->state != ATH10K_STATE_RESTARTED) {
+ ret = -ENETDOWN;
+ goto exit;
+ }
+
+ if (param_id) {
+ ar->debug.fw_test_param_id = param_id;
+ ar->debug.fw_test_param_value = param_value;
+ } else {
+ ath10k_warn(ar, "Enter a valid param ID!");
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ ret = ath10k_wmi_fw_test(ar, ar->debug.fw_test_param_id,
+ ar->debug.fw_test_param_value);
+
+ if (ret) {
+ ath10k_warn(ar, "failed to do fw_test: %d\n", ret);
+ goto exit;
+ }
+
+ ret = count;
+
+exit:
+ mutex_unlock(&ar->conf_mutex);
+ return ret;
+}
+
+static const struct file_operations fops_fw_test = {
+ .read = ath10k_read_fops_fw_test,
+ .write = ath10k_write_fw_test,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
static ssize_t ath10k_debug_fw_checksums_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
@@ -2258,6 +2335,10 @@ int ath10k_debug_register(struct ath10k *ar)
debugfs_create_file("fw_checksums", 0400, ar->debug.debugfs_phy, ar,
&fops_fw_checksums);

+ if (test_bit(WMI_SERVICE_FWTEST, ar->wmi.svc_map))
+ debugfs_create_file("fw_test", 0600, ar->debug.debugfs_phy, ar,
+ &fops_fw_test);
+
return 0;
}

--
1.7.9.5