diff mbox series

[v4,4/4] wifi: ath12k: Fill pdev id for fw test cmd

Message ID 20240617052903.2720292-5-quic_aarasahu@quicinc.com
State New
Headers show
Series wifi: ath12k: Factory test mode support | expand

Commit Message

Aaradhana Sahu June 17, 2024, 5:29 a.m. UTC
From: Rajat Soni <quic_rajson@quicinc.com>

Currently pdev id is not set properly that can cause crash
if pdev id is not equal to the pdev id when firmware test
command is run during AP bring up or ping.

Set pdev id in function ath12k_tm_cmd_wmi to resolve this
issue.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1

Signed-off-by: Rajat Soni <quic_rajson@quicinc.com>
Co-developed-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
Signed-off-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/testmode.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Jeff Johnson June 17, 2024, 9:41 p.m. UTC | #1
On 6/16/2024 10:29 PM, Aaradhana Sahu wrote:
> From: Rajat Soni <quic_rajson@quicinc.com>
> 
> Currently pdev id is not set properly that can cause crash

s/properly that/properly. That/
s/cause crash/cause a crash/

> if pdev id is not equal to the pdev id when firmware test
> command is run during AP bring up or ping.
> 
> Set pdev id in function ath12k_tm_cmd_wmi to resolve this
> issue.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Rajat Soni <quic_rajson@quicinc.com>
> Co-developed-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
> Signed-off-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
> ---
>  drivers/net/wireless/ath/ath12k/testmode.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/testmode.c b/drivers/net/wireless/ath/ath12k/testmode.c
> index aa9904de296f..f81564a4e6de 100644
> --- a/drivers/net/wireless/ath/ath12k/testmode.c
> +++ b/drivers/net/wireless/ath/ath12k/testmode.c
> @@ -320,9 +320,10 @@ static int ath12k_tm_cmd_wmi(struct ath12k *ar, struct nlattr *tb[])
>  {
>  	struct ath12k_wmi_pdev *wmi = ar->wmi;
>  	struct sk_buff *skb;
> -	u32 cmd_id, buf_len;
> -	int ret;
> +	struct wmi_pdev_set_param_cmd *cmd;
> +	int ret, tag;
>  	void *buf;
> +	u32 cmd_id, buf_len;
>  
>  	mutex_lock(&ar->conf_mutex);
>  
> @@ -347,6 +348,12 @@ static int ath12k_tm_cmd_wmi(struct ath12k *ar, struct nlattr *tb[])
>  
>  	cmd_id = nla_get_u32(tb[ATH_TM_ATTR_WMI_CMDID]);
>  
> +	cmd = buf;
> +	tag = le32_get_bits(cmd->tlv_header, WMI_TLV_TAG);
> +
> +	if (tag == WMI_TAG_PDEV_SET_PARAM_CMD)
> +		cmd->pdev_id = cpu_to_le32(ar->pdev->pdev_id);
> +
>  	ath12k_dbg(ar->ab, ATH12K_DBG_TESTMODE,
>  		   "testmode cmd wmi cmd_id %d  buf length %d\n",
>  		   cmd_id, buf_len);
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/testmode.c b/drivers/net/wireless/ath/ath12k/testmode.c
index aa9904de296f..f81564a4e6de 100644
--- a/drivers/net/wireless/ath/ath12k/testmode.c
+++ b/drivers/net/wireless/ath/ath12k/testmode.c
@@ -320,9 +320,10 @@  static int ath12k_tm_cmd_wmi(struct ath12k *ar, struct nlattr *tb[])
 {
 	struct ath12k_wmi_pdev *wmi = ar->wmi;
 	struct sk_buff *skb;
-	u32 cmd_id, buf_len;
-	int ret;
+	struct wmi_pdev_set_param_cmd *cmd;
+	int ret, tag;
 	void *buf;
+	u32 cmd_id, buf_len;
 
 	mutex_lock(&ar->conf_mutex);
 
@@ -347,6 +348,12 @@  static int ath12k_tm_cmd_wmi(struct ath12k *ar, struct nlattr *tb[])
 
 	cmd_id = nla_get_u32(tb[ATH_TM_ATTR_WMI_CMDID]);
 
+	cmd = buf;
+	tag = le32_get_bits(cmd->tlv_header, WMI_TLV_TAG);
+
+	if (tag == WMI_TAG_PDEV_SET_PARAM_CMD)
+		cmd->pdev_id = cpu_to_le32(ar->pdev->pdev_id);
+
 	ath12k_dbg(ar->ab, ATH12K_DBG_TESTMODE,
 		   "testmode cmd wmi cmd_id %d  buf length %d\n",
 		   cmd_id, buf_len);