Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: ath11k: update proper pdev/vdev id for testmode command
@ 2023-04-24  9:24 Raj Kumar Bhagat
  2023-04-26  7:29 ` Kalle Valo
  2024-08-06  7:45 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Raj Kumar Bhagat @ 2023-04-24  9:24 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Venkateswara Naralasetty, Raj Kumar Bhagat

From: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>

User can extend test mode command support to set vdev and pdev params
for debug purpose at run time by sending vdev/pdev param set command
through the testmode command interface.

Fill the proper pdev/vdev id in driver since, pdev/vdev id details may
not be available at user space. It will make sure that the proper
vdev/pdev ids are sent to firmware.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1

Depends-On:
	[v3,3/4] wifi: ath11k: factory test mode support

Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/testmode.c | 37 ++++++++++++++++++++--
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/testmode.c b/drivers/net/wireless/ath/ath11k/testmode.c
index bebd9c1776ba..e1edbc532eb6 100644
--- a/drivers/net/wireless/ath/ath11k/testmode.c
+++ b/drivers/net/wireless/ath/ath11k/testmode.c
@@ -250,13 +250,16 @@ static int ath11k_tm_cmd_testmode_start(struct ath11k *ar, struct nlattr *tb[])
 	return ret;
 }
 
-static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[])
+static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[],
+			     struct ieee80211_vif *vif)
 {
 	struct ath11k_pdev_wmi *wmi = ar->wmi;
 	struct sk_buff *skb;
+	struct ath11k_vif *arvif;
 	u32 cmd_id, buf_len;
-	int ret;
+	int ret, tag;
 	void *buf;
+	u32 *ptr;
 
 	mutex_lock(&ar->conf_mutex);
 
@@ -280,6 +283,34 @@ static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[])
 
 	cmd_id = nla_get_u32(tb[ATH11K_TM_ATTR_WMI_CMDID]);
 
+	/* Make sure that the buffer length is long enough to
+	 * hold TLV and pdev/vdev id.
+	 */
+	if (buf_len < sizeof(struct wmi_tlv) + sizeof(u32)) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ptr = buf;
+	tag = FIELD_GET(WMI_TLV_TAG, *ptr);
+
+	/* pdev/vdev id start after TLV header */
+	ptr++;
+
+	if (tag == WMI_TAG_PDEV_SET_PARAM_CMD)
+		*ptr = ar->pdev->pdev_id;
+
+	if (ar->ab->fw_mode != ATH11K_FIRMWARE_MODE_FTM &&
+	    (tag == WMI_TAG_VDEV_SET_PARAM_CMD || tag == WMI_TAG_UNIT_TEST_CMD)) {
+		if (vif) {
+			arvif = (struct ath11k_vif *)vif->drv_priv;
+			*ptr = arvif->vdev_id;
+		} else {
+			ret = -EINVAL;
+			goto out;
+		}
+	}
+
 	ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE,
 		   "testmode cmd wmi cmd_id %d buf length %d\n",
 		   cmd_id, buf_len);
@@ -411,7 +442,7 @@ int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	case ATH11K_TM_CMD_TESTMODE_START:
 		return ath11k_tm_cmd_testmode_start(ar, tb);
 	case ATH11K_TM_CMD_WMI:
-		return ath11k_tm_cmd_wmi(ar, tb);
+		return ath11k_tm_cmd_wmi(ar, tb, vif);
 	case ATH11K_TM_CMD_WMI_FTM:
 		set_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags);
 		return ath11k_tm_cmd_process_ftm(ar, tb);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] wifi: ath11k: update proper pdev/vdev id for testmode command
  2023-04-24  9:24 [PATCH] wifi: ath11k: update proper pdev/vdev id for testmode command Raj Kumar Bhagat
@ 2023-04-26  7:29 ` Kalle Valo
  2023-04-26  7:39   ` Raj Kumar Bhagat
  2024-08-06  7:45 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2023-04-26  7:29 UTC (permalink / raw)
  To: Raj Kumar Bhagat; +Cc: ath11k, linux-wireless, Venkateswara Naralasetty

Raj Kumar Bhagat <quic_rajkbhag@quicinc.com> writes:

> From: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
>
> User can extend test mode command support to set vdev and pdev params
> for debug purpose at run time by sending vdev/pdev param set command
> through the testmode command interface.
>
> Fill the proper pdev/vdev id in driver since, pdev/vdev id details may
> not be available at user space. It will make sure that the proper
> vdev/pdev ids are sent to firmware.
>
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
>
> Depends-On:
> 	[v3,3/4] wifi: ath11k: factory test mode support
>
> Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
> Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
> ---

Please add 'Depends-on' after the '---' line. This is for future
patches, no need to resend because of this.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wifi: ath11k: update proper pdev/vdev id for testmode command
  2023-04-26  7:29 ` Kalle Valo
@ 2023-04-26  7:39   ` Raj Kumar Bhagat
  0 siblings, 0 replies; 4+ messages in thread
From: Raj Kumar Bhagat @ 2023-04-26  7:39 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless, Venkateswara Naralasetty

On 4/26/2023 12:59 PM, Kalle Valo wrote:
> Raj Kumar Bhagat <quic_rajkbhag@quicinc.com> writes:
> 
>> From: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
>>
>> User can extend test mode command support to set vdev and pdev params
>> for debug purpose at run time by sending vdev/pdev param set command
>> through the testmode command interface.
>>
>> Fill the proper pdev/vdev id in driver since, pdev/vdev id details may
>> not be available at user space. It will make sure that the proper
>> vdev/pdev ids are sent to firmware.
>>
>> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
>>
>> Depends-On:
>> 	[v3,3/4] wifi: ath11k: factory test mode support
>>
>> Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
>> Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
>> ---
> 
> Please add 'Depends-on' after the '---' line. This is for future
> patches, no need to resend because of this.
> 

Thanks for pointing this. Will take care for future patches.

Thanks,
Raj

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wifi: ath11k: update proper pdev/vdev id for testmode command
  2023-04-24  9:24 [PATCH] wifi: ath11k: update proper pdev/vdev id for testmode command Raj Kumar Bhagat
  2023-04-26  7:29 ` Kalle Valo
@ 2024-08-06  7:45 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-08-06  7:45 UTC (permalink / raw)
  To: Raj Kumar Bhagat
  Cc: ath11k, linux-wireless, Venkateswara Naralasetty,
	Raj Kumar Bhagat

Raj Kumar Bhagat <quic_rajkbhag@quicinc.com> wrote:

> From: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
> 
> User can extend test mode command support to set vdev and pdev params
> for debug purpose at run time by sending vdev/pdev param set command
> through the testmode command interface.
> 
> Fill the proper pdev/vdev id in driver since, pdev/vdev id details may
> not be available at user space. It will make sure that the proper
> vdev/pdev ids are sent to firmware.
> 
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
> 
> Depends-On:
> 	[v3,3/4] wifi: ath11k: factory test mode support
> 
> Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
> Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>

Please rebase.

error: patch failed: drivers/net/wireless/ath/ath11k/testmode.c:250
error: drivers/net/wireless/ath/ath11k/testmode.c: patch does not apply
stg import: Diff does not apply cleanly

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230424092420.12794-1-quic_rajkbhag@quicinc.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-06  7:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-24  9:24 [PATCH] wifi: ath11k: update proper pdev/vdev id for testmode command Raj Kumar Bhagat
2023-04-26  7:29 ` Kalle Valo
2023-04-26  7:39   ` Raj Kumar Bhagat
2024-08-06  7:45 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox