mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality
@ 2026-03-10 15:16 Jeff Johnson
  2026-03-10 15:16 ` [PATCH ath-next 1/2] wifi: ath12k: Clean up the WMI Unit Test command interface Jeff Johnson
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jeff Johnson @ 2026-03-10 15:16 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: linux-wireless, ath12k, linux-kernel, Jeff Johnson

Patch 1 updates the core Unit Test functionality to address multiple
existing issues, and patch 2 removes unused DFS Unit Test definitions.

---
Jeff Johnson (2):
      wifi: ath12k: Clean up the WMI Unit Test command interface
      wifi: ath12k: Remove unused DFS Unit Test definitions

 drivers/net/wireless/ath/ath12k/wmi.c | 58 ++++++++++++++++-------------------
 drivers/net/wireless/ath/ath12k/wmi.h | 14 ++++++---
 2 files changed, 36 insertions(+), 36 deletions(-)
---
base-commit: 9942b3f80f4ebe6852663e0d35ecaf6b7a97c8da
change-id: 20260305-ath12k-unit-test-cleanup-07622698c994


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

* [PATCH ath-next 1/2] wifi: ath12k: Clean up the WMI Unit Test command interface
  2026-03-10 15:16 [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Jeff Johnson
@ 2026-03-10 15:16 ` Jeff Johnson
  2026-03-10 15:16 ` [PATCH ath-next 2/2] wifi: ath12k: Remove unused DFS Unit Test definitions Jeff Johnson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeff Johnson @ 2026-03-10 15:16 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: linux-wireless, ath12k, linux-kernel, Jeff Johnson

Currently, ath12k_wmi_send_unit_test_cmd() provides the interface to
send a Unit Test command to firmware.  The payload for the command is
passed in two separate parameters, struct wmi_unit_test_cmd ut_cmd and
u32 *test_args.  This interface is strange in that it passes the
ut_cmd structure by value instead of by reference. But even worse,
this presents an interface that is not endian clean since the ut_cmd
structure is defined in little endian format while the test_args array
is defined to be in cpu endian format. Furthermore, the implementation
of this function passes the test_args directly to the firmware, without
performing cpu_to_le32() conversion, and hence this functionality will
not work correctly on big endian platforms.

In order to fix these issues, introduce a new wmi_unit_test_arg
structure which defines all of the parameters needed by the Unit Test
command in a single structure using cpu endian. Update
ath12k_wmi_send_unit_test_cmd() to take a pointer to this structure
and perform all cpu_to_le32() conversions needed while forming the
firmware command. Update the only existing Unit Test function,
ath12k_wmi_simulate_radar(), to properly fill and pass this new
structure to ath12k_wmi_send_unit_test_cmd().

Compile tested only.

Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/wmi.c | 58 ++++++++++++++++-------------------
 drivers/net/wireless/ath/ath12k/wmi.h | 11 +++++++
 2 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index b93e33edf369..65a05a9520ff 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -10017,50 +10017,46 @@ static int ath12k_connect_pdev_htc_service(struct ath12k_base *ab,
 
 static int
 ath12k_wmi_send_unit_test_cmd(struct ath12k *ar,
-			      struct wmi_unit_test_cmd ut_cmd,
-			      u32 *test_args)
+			      const struct wmi_unit_test_arg *ut)
 {
 	struct ath12k_wmi_pdev *wmi = ar->wmi;
 	struct wmi_unit_test_cmd *cmd;
+	int buf_len, arg_len;
 	struct sk_buff *skb;
 	struct wmi_tlv *tlv;
+	__le32 *ut_cmd_args;
 	void *ptr;
-	u32 *ut_cmd_args;
-	int buf_len, arg_len;
 	int ret;
 	int i;
 
-	arg_len = sizeof(u32) * le32_to_cpu(ut_cmd.num_args);
-	buf_len = sizeof(ut_cmd) + arg_len + TLV_HDR_SIZE;
+	arg_len = sizeof(*ut_cmd_args) * ut->num_args;
+	buf_len = sizeof(*cmd) + arg_len + TLV_HDR_SIZE;
 
 	skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, buf_len);
 	if (!skb)
 		return -ENOMEM;
 
-	cmd = (struct wmi_unit_test_cmd *)skb->data;
+	ptr = skb->data;
+	cmd = ptr;
 	cmd->tlv_header = ath12k_wmi_tlv_cmd_hdr(WMI_TAG_UNIT_TEST_CMD,
-						 sizeof(ut_cmd));
-
-	cmd->vdev_id = ut_cmd.vdev_id;
-	cmd->module_id = ut_cmd.module_id;
-	cmd->num_args = ut_cmd.num_args;
-	cmd->diag_token = ut_cmd.diag_token;
-
-	ptr = skb->data + sizeof(ut_cmd);
+						 sizeof(*cmd));
+	cmd->vdev_id = cpu_to_le32(ut->vdev_id);
+	cmd->module_id = cpu_to_le32(ut->module_id);
+	cmd->num_args = cpu_to_le32(ut->num_args);
+	cmd->diag_token = cpu_to_le32(ut->diag_token);
 
+	ptr += sizeof(*cmd);
 	tlv = ptr;
 	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_UINT32, arg_len);
 
 	ptr += TLV_HDR_SIZE;
-
 	ut_cmd_args = ptr;
-	for (i = 0; i < le32_to_cpu(ut_cmd.num_args); i++)
-		ut_cmd_args[i] = test_args[i];
+	for (i = 0; i < ut->num_args; i++)
+		ut_cmd_args[i] = cpu_to_le32(ut->args[i]);
 
 	ath12k_dbg(ar->ab, ATH12K_DBG_WMI,
 		   "WMI unit test : module %d vdev %d n_args %d token %d\n",
-		   cmd->module_id, cmd->vdev_id, cmd->num_args,
-		   cmd->diag_token);
+		   ut->module_id, ut->vdev_id, ut->num_args, ut->diag_token);
 
 	ret = ath12k_wmi_cmd_send(wmi, skb, WMI_UNIT_TEST_CMDID);
 
@@ -10076,8 +10072,7 @@ ath12k_wmi_send_unit_test_cmd(struct ath12k *ar,
 int ath12k_wmi_simulate_radar(struct ath12k *ar)
 {
 	struct ath12k_link_vif *arvif;
-	u32 dfs_args[DFS_MAX_TEST_ARGS];
-	struct wmi_unit_test_cmd wmi_ut;
+	struct wmi_unit_test_arg wmi_ut = {};
 	bool arvif_found = false;
 
 	list_for_each_entry(arvif, &ar->arvifs, list) {
@@ -10090,22 +10085,23 @@ int ath12k_wmi_simulate_radar(struct ath12k *ar)
 	if (!arvif_found)
 		return -EINVAL;
 
-	dfs_args[DFS_TEST_CMDID] = 0;
-	dfs_args[DFS_TEST_PDEV_ID] = ar->pdev->pdev_id;
-	/* Currently we could pass segment_id(b0 - b1), chirp(b2)
+	wmi_ut.args[DFS_TEST_CMDID] = 0;
+	wmi_ut.args[DFS_TEST_PDEV_ID] = ar->pdev->pdev_id;
+	/*
+	 * Currently we could pass segment_id(b0 - b1), chirp(b2)
 	 * freq offset (b3 - b10) to unit test. For simulation
 	 * purpose this can be set to 0 which is valid.
 	 */
-	dfs_args[DFS_TEST_RADAR_PARAM] = 0;
+	wmi_ut.args[DFS_TEST_RADAR_PARAM] = 0;
 
-	wmi_ut.vdev_id = cpu_to_le32(arvif->vdev_id);
-	wmi_ut.module_id = cpu_to_le32(DFS_UNIT_TEST_MODULE);
-	wmi_ut.num_args = cpu_to_le32(DFS_MAX_TEST_ARGS);
-	wmi_ut.diag_token = cpu_to_le32(DFS_UNIT_TEST_TOKEN);
+	wmi_ut.vdev_id = arvif->vdev_id;
+	wmi_ut.module_id = DFS_UNIT_TEST_MODULE;
+	wmi_ut.num_args = DFS_MAX_TEST_ARGS;
+	wmi_ut.diag_token = DFS_UNIT_TEST_TOKEN;
 
 	ath12k_dbg(ar->ab, ATH12K_DBG_REG, "Triggering Radar Simulation\n");
 
-	return ath12k_wmi_send_unit_test_cmd(ar, wmi_ut, dfs_args);
+	return ath12k_wmi_send_unit_test_cmd(ar, &wmi_ut);
 }
 
 int ath12k_wmi_send_tpc_stats_request(struct ath12k *ar,
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 0bf0a7941cd3..8d766dd5b304 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -4210,6 +4210,17 @@ struct wmi_dfs_unit_test_arg {
 	u32 radar_param;
 };
 
+/* update if another test command requires more */
+#define WMI_UNIT_TEST_ARGS_MAX DFS_MAX_TEST_ARGS
+
+struct wmi_unit_test_arg {
+	u32 vdev_id;
+	u32 module_id;
+	u32 diag_token;
+	u32 num_args;
+	u32 args[WMI_UNIT_TEST_ARGS_MAX];
+};
+
 struct wmi_unit_test_cmd {
 	__le32 tlv_header;
 	__le32 vdev_id;

-- 
2.43.0


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

* [PATCH ath-next 2/2] wifi: ath12k: Remove unused DFS Unit Test definitions
  2026-03-10 15:16 [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Jeff Johnson
  2026-03-10 15:16 ` [PATCH ath-next 1/2] wifi: ath12k: Clean up the WMI Unit Test command interface Jeff Johnson
@ 2026-03-10 15:16 ` Jeff Johnson
  2026-03-16  1:55 ` [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Baochen Qiang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeff Johnson @ 2026-03-10 15:16 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: linux-wireless, ath12k, linux-kernel, Jeff Johnson

The following are unused, so remove them:
struct wmi_dfs_unit_test_arg
macro DFS_PHYERR_UNIT_TEST_CMD

Compile tested only.

Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/wmi.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 8d766dd5b304..5ba9b7d3a888 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -4193,7 +4193,6 @@ struct wmi_addba_clear_resp_cmd {
 	struct ath12k_wmi_mac_addr_params peer_macaddr;
 } __packed;
 
-#define DFS_PHYERR_UNIT_TEST_CMD 0
 #define DFS_UNIT_TEST_MODULE	0x2b
 #define DFS_UNIT_TEST_TOKEN	0xAA
 
@@ -4204,12 +4203,6 @@ enum dfs_test_args_idx {
 	DFS_MAX_TEST_ARGS,
 };
 
-struct wmi_dfs_unit_test_arg {
-	u32 cmd_id;
-	u32 pdev_id;
-	u32 radar_param;
-};
-
 /* update if another test command requires more */
 #define WMI_UNIT_TEST_ARGS_MAX DFS_MAX_TEST_ARGS
 

-- 
2.43.0


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

* Re: [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality
  2026-03-10 15:16 [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Jeff Johnson
  2026-03-10 15:16 ` [PATCH ath-next 1/2] wifi: ath12k: Clean up the WMI Unit Test command interface Jeff Johnson
  2026-03-10 15:16 ` [PATCH ath-next 2/2] wifi: ath12k: Remove unused DFS Unit Test definitions Jeff Johnson
@ 2026-03-16  1:55 ` Baochen Qiang
  2026-03-16  3:48 ` Rameshkumar Sundaram
  2026-03-16 15:37 ` Jeff Johnson
  4 siblings, 0 replies; 6+ messages in thread
From: Baochen Qiang @ 2026-03-16  1:55 UTC (permalink / raw)
  To: Jeff Johnson, Jeff Johnson; +Cc: linux-wireless, ath12k, linux-kernel



On 3/10/2026 11:16 PM, Jeff Johnson wrote:
> Patch 1 updates the core Unit Test functionality to address multiple
> existing issues, and patch 2 removes unused DFS Unit Test definitions.
> 
> ---
> Jeff Johnson (2):
>       wifi: ath12k: Clean up the WMI Unit Test command interface
>       wifi: ath12k: Remove unused DFS Unit Test definitions
> 
>  drivers/net/wireless/ath/ath12k/wmi.c | 58 ++++++++++++++++-------------------
>  drivers/net/wireless/ath/ath12k/wmi.h | 14 ++++++---
>  2 files changed, 36 insertions(+), 36 deletions(-)
> ---
> base-commit: 9942b3f80f4ebe6852663e0d35ecaf6b7a97c8da
> change-id: 20260305-ath12k-unit-test-cleanup-07622698c994
> 

Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>

> 


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

* Re: [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality
  2026-03-10 15:16 [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Jeff Johnson
                   ` (2 preceding siblings ...)
  2026-03-16  1:55 ` [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Baochen Qiang
@ 2026-03-16  3:48 ` Rameshkumar Sundaram
  2026-03-16 15:37 ` Jeff Johnson
  4 siblings, 0 replies; 6+ messages in thread
From: Rameshkumar Sundaram @ 2026-03-16  3:48 UTC (permalink / raw)
  To: Jeff Johnson, Jeff Johnson; +Cc: linux-wireless, ath12k, linux-kernel



On 3/10/2026 8:46 PM, Jeff Johnson wrote:
> Patch 1 updates the core Unit Test functionality to address multiple
> existing issues, and patch 2 removes unused DFS Unit Test definitions.
> 
> ---
> Jeff Johnson (2):
>        wifi: ath12k: Clean up the WMI Unit Test command interface
>        wifi: ath12k: Remove unused DFS Unit Test definitions
> 
>   drivers/net/wireless/ath/ath12k/wmi.c | 58 ++++++++++++++++-------------------
>   drivers/net/wireless/ath/ath12k/wmi.h | 14 ++++++---
>   2 files changed, 36 insertions(+), 36 deletions(-)
> ---
> base-commit: 9942b3f80f4ebe6852663e0d35ecaf6b7a97c8da
> change-id: 20260305-ath12k-unit-test-cleanup-07622698c994
> 

Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>

> 


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

* Re: [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality
  2026-03-10 15:16 [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Jeff Johnson
                   ` (3 preceding siblings ...)
  2026-03-16  3:48 ` Rameshkumar Sundaram
@ 2026-03-16 15:37 ` Jeff Johnson
  4 siblings, 0 replies; 6+ messages in thread
From: Jeff Johnson @ 2026-03-16 15:37 UTC (permalink / raw)
  To: Jeff Johnson, Jeff Johnson; +Cc: linux-wireless, ath12k, linux-kernel


On Tue, 10 Mar 2026 08:16:11 -0700, Jeff Johnson wrote:
> Patch 1 updates the core Unit Test functionality to address multiple
> existing issues, and patch 2 removes unused DFS Unit Test definitions.
> 

Applied, thanks!

[1/2] wifi: ath12k: Clean up the WMI Unit Test command interface
      commit: e570593b568f74b8d8367d094400d71bc398118f
[2/2] wifi: ath12k: Remove unused DFS Unit Test definitions
      commit: 7bbb578fc43e7dcb8690cfc98844bd67bc311e8a

Best regards,
-- 
Jeff Johnson <jeff.johnson@oss.qualcomm.com>


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

end of thread, other threads:[~2026-03-16 15:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-10 15:16 [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Jeff Johnson
2026-03-10 15:16 ` [PATCH ath-next 1/2] wifi: ath12k: Clean up the WMI Unit Test command interface Jeff Johnson
2026-03-10 15:16 ` [PATCH ath-next 2/2] wifi: ath12k: Remove unused DFS Unit Test definitions Jeff Johnson
2026-03-16  1:55 ` [PATCH ath-next 0/2] wifi: ath12k: Clean up the WMI Unit Test functionality Baochen Qiang
2026-03-16  3:48 ` Rameshkumar Sundaram
2026-03-16 15:37 ` Jeff Johnson

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

all inboxes | Powered by JetHome®