2024-01-22 08:57:03

by Lingbo Kong

[permalink] [raw]
Subject: [PATCH v2 0/2] wifi: ath12k: add processing for TWT enable/disable event

This patch set is used for processing TWT enable/disable event. It can be
more convenient to debug TWT.

The patches work with WCN7850 and QCN9274.

v2:
1.Change the call way of ath12k_wmi_tlv_parse_alloc() based on
wifi: ath12k: refactor ath12k_wmi_tlv_parse_alloc()

Lingbo Kong (2):
wifi: ath12k: add processing for TWT enable event
wifi: ath12k: add processing for TWT disable event

drivers/net/wireless/ath/ath12k/wmi.c | 70 ++++++++++++++++++++++++++-
drivers/net/wireless/ath/ath12k/wmi.h | 10 ++++
2 files changed, 78 insertions(+), 2 deletions(-)


base-commit: 8ff464a183f92836d7fd99edceef50a89d8ea797
--
2.34.1



2024-01-22 08:57:06

by Lingbo Kong

[permalink] [raw]
Subject: [PATCH v2 1/2] wifi: ath12k: add processing for TWT enable event

When ath12k send TWT enable command to firmware, firmware will return a TWT
enable event to ath12k. Through the analysis of TWT enable event status, we
can easily obtain the status of TWT enable command. It can be more
convenient to debug TWT.

This patch works with WCN7850 and QCN9274.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Lingbo Kong <[email protected]>
---
v2:
1.Change the call way of ath12k_wmi_tlv_parse_alloc() based on
wifi: ath12k: refactor ath12k_wmi_tlv_parse_alloc()

drivers/net/wireless/ath/ath12k/wmi.c | 35 ++++++++++++++++++++++++++-
drivers/net/wireless/ath/ath12k/wmi.h | 5 ++++
2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 2fa724e5851a..e6276d92ea73 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -162,6 +162,8 @@ static const struct ath12k_wmi_tlv_policy ath12k_wmi_tlv_policies[] = {
.min_len = sizeof(struct wmi_probe_resp_tx_status_event) },
[WMI_TAG_VDEV_DELETE_RESP_EVENT] = {
.min_len = sizeof(struct wmi_vdev_delete_resp_event) },
+ [WMI_TAG_TWT_ENABLE_COMPLETE_EVENT] = {
+ .min_len = sizeof(struct wmi_twt_enable_event) },
};

static __le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len)
@@ -6670,6 +6672,35 @@ ath12k_wmi_diag_event(struct ath12k_base *ab, struct sk_buff *skb)
trace_ath12k_wmi_diag(ab, skb->data, skb->len);
}

+static void ath12k_wmi_twt_enable_event(struct ath12k_base *ab,
+ struct sk_buff *skb)
+{
+ const void **tb;
+ const struct wmi_twt_enable_event *ev;
+ int ret;
+
+ tb = ath12k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC);
+ if (IS_ERR(tb)) {
+ ret = PTR_ERR(tb);
+ ath12k_warn(ab, "failed to parse wmi twt enable status event tlv: %d\n",
+ ret);
+ return;
+ }
+
+ ev = tb[WMI_TAG_TWT_ENABLE_COMPLETE_EVENT];
+ if (!ev) {
+ ath12k_warn(ab, "failed to fetch twt enable wmi event\n");
+ goto exit;
+ }
+
+ ath12k_dbg(ab, ATH12K_DBG_MAC, "wmi twt enable event pdev id %u status %u\n",
+ le32_to_cpu(ev->pdev_id),
+ le32_to_cpu(ev->status));
+
+exit:
+ kfree(tb);
+}
+
static void ath12k_wmi_op_rx(struct ath12k_base *ab, struct sk_buff *skb)
{
struct wmi_cmd_hdr *cmd_hdr;
@@ -6765,10 +6796,12 @@ static void ath12k_wmi_op_rx(struct ath12k_base *ab, struct sk_buff *skb)
case WMI_RFKILL_STATE_CHANGE_EVENTID:
ath12k_rfkill_state_change_event(ab, skb);
break;
+ case WMI_TWT_ENABLE_EVENTID:
+ ath12k_wmi_twt_enable_event(ab, skb);
+ break;
/* add Unsupported events here */
case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID:
case WMI_PEER_OPER_MODE_CHANGE_EVENTID:
- case WMI_TWT_ENABLE_EVENTID:
case WMI_TWT_DISABLE_EVENTID:
case WMI_PDEV_DMA_RING_CFG_RSP_EVENTID:
ath12k_dbg(ab, ATH12K_DBG_WMI,
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 06e5b9b4049b..7570ef7be38d 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -4797,6 +4797,11 @@ struct wmi_rfkill_state_change_event {
__le32 radio_state;
} __packed;

+struct wmi_twt_enable_event {
+ __le32 pdev_id;
+ __le32 status;
+} __packed;
+
void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
struct ath12k_wmi_resource_config_arg *config);
void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
--
2.34.1


2024-01-22 08:58:30

by Lingbo Kong

[permalink] [raw]
Subject: [PATCH v2 2/2] wifi: ath12k: add processing for TWT disable event

When ath12k send TWT disable command to firmware, firmware will return a
TWT disable event to ath12k. Through the analysis of TWT disable event
status, we can easily obtain the status of TWT disable command. It can be
more convenient to debug TWT.

This patch works with WCN7850 and QCN9274.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Lingbo Kong <[email protected]>
---
v2:
1.Change the call way of ath12k_wmi_tlv_parse_alloc() based on
wifi: ath12k: refactor ath12k_wmi_tlv_parse_alloc()

drivers/net/wireless/ath/ath12k/wmi.c | 35 ++++++++++++++++++++++++++-
drivers/net/wireless/ath/ath12k/wmi.h | 5 ++++
2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index e6276d92ea73..0ed1eaee1a75 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -164,6 +164,8 @@ static const struct ath12k_wmi_tlv_policy ath12k_wmi_tlv_policies[] = {
.min_len = sizeof(struct wmi_vdev_delete_resp_event) },
[WMI_TAG_TWT_ENABLE_COMPLETE_EVENT] = {
.min_len = sizeof(struct wmi_twt_enable_event) },
+ [WMI_TAG_TWT_DISABLE_COMPLETE_EVENT] = {
+ .min_len = sizeof(struct wmi_twt_disable_event) },
};

static __le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len)
@@ -6701,6 +6703,35 @@ static void ath12k_wmi_twt_enable_event(struct ath12k_base *ab,
kfree(tb);
}

+static void ath12k_wmi_twt_disable_event(struct ath12k_base *ab,
+ struct sk_buff *skb)
+{
+ const void **tb;
+ const struct wmi_twt_disable_event *ev;
+ int ret;
+
+ tb = ath12k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC);
+ if (IS_ERR(tb)) {
+ ret = PTR_ERR(tb);
+ ath12k_warn(ab, "failed to parse wmi twt disable status event tlv: %d\n",
+ ret);
+ return;
+ }
+
+ ev = tb[WMI_TAG_TWT_DISABLE_COMPLETE_EVENT];
+ if (!ev) {
+ ath12k_warn(ab, "failed to fetch twt disable wmi event\n");
+ goto exit;
+ }
+
+ ath12k_dbg(ab, ATH12K_DBG_MAC, "wmi twt disable event pdev id %d status %u\n",
+ le32_to_cpu(ev->pdev_id),
+ le32_to_cpu(ev->status));
+
+exit:
+ kfree(tb);
+}
+
static void ath12k_wmi_op_rx(struct ath12k_base *ab, struct sk_buff *skb)
{
struct wmi_cmd_hdr *cmd_hdr;
@@ -6799,10 +6830,12 @@ static void ath12k_wmi_op_rx(struct ath12k_base *ab, struct sk_buff *skb)
case WMI_TWT_ENABLE_EVENTID:
ath12k_wmi_twt_enable_event(ab, skb);
break;
+ case WMI_TWT_DISABLE_EVENTID:
+ ath12k_wmi_twt_disable_event(ab, skb);
+ break;
/* add Unsupported events here */
case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID:
case WMI_PEER_OPER_MODE_CHANGE_EVENTID:
- case WMI_TWT_DISABLE_EVENTID:
case WMI_PDEV_DMA_RING_CFG_RSP_EVENTID:
ath12k_dbg(ab, ATH12K_DBG_WMI,
"ignoring unsupported event 0x%x\n", id);
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 7570ef7be38d..d9e8b10a3c3c 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -4802,6 +4802,11 @@ struct wmi_twt_enable_event {
__le32 status;
} __packed;

+struct wmi_twt_disable_event {
+ __le32 pdev_id;
+ __le32 status;
+} __packed;
+
void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
struct ath12k_wmi_resource_config_arg *config);
void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
--
2.34.1


2024-01-22 18:19:36

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] wifi: ath12k: add processing for TWT enable event

On 1/22/2024 12:53 AM, Lingbo Kong wrote:
> When ath12k send TWT enable command to firmware, firmware will return a TWT
> enable event to ath12k. Through the analysis of TWT enable event status, we
> can easily obtain the status of TWT enable command. It can be more
> convenient to debug TWT.
>
> This patch works with WCN7850 and QCN9274.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
>
> Signed-off-by: Lingbo Kong <[email protected]>
> ---
[...snip...]
> diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
> index 06e5b9b4049b..7570ef7be38d 100644
> --- a/drivers/net/wireless/ath/ath12k/wmi.h
> +++ b/drivers/net/wireless/ath/ath12k/wmi.h

Qualcomm Innovation Center copyright missing 2024

Kalle can probably address this in "pending"

Acked-by: Jeff Johnson <[email protected]>


2024-01-22 18:29:04

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] wifi: ath12k: add processing for TWT disable event

On 1/22/2024 12:53 AM, Lingbo Kong wrote:
> When ath12k send TWT disable command to firmware, firmware will return a
> TWT disable event to ath12k. Through the analysis of TWT disable event
> status, we can easily obtain the status of TWT disable command. It can be
> more convenient to debug TWT.
>
> This patch works with WCN7850 and QCN9274.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
>
> Signed-off-by: Lingbo Kong <[email protected]>
Acked-by: Jeff Johnson <[email protected]>


2024-02-02 12:37:02

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] wifi: ath12k: add processing for TWT enable event

Jeff Johnson <[email protected]> writes:

> On 1/22/2024 12:53 AM, Lingbo Kong wrote:
>> When ath12k send TWT enable command to firmware, firmware will return a TWT
>> enable event to ath12k. Through the analysis of TWT enable event status, we
>> can easily obtain the status of TWT enable command. It can be more
>> convenient to debug TWT.
>>
>> This patch works with WCN7850 and QCN9274.
>>
>> Tested-on: WCN7850 hw2.0 PCI
>> WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
>>
>> Signed-off-by: Lingbo Kong <[email protected]>
>> ---
> [...snip...]
>> diff --git a/drivers/net/wireless/ath/ath12k/wmi.h
>> b/drivers/net/wireless/ath/ath12k/wmi.h
>> index 06e5b9b4049b..7570ef7be38d 100644
>> --- a/drivers/net/wireless/ath/ath12k/wmi.h
>> +++ b/drivers/net/wireless/ath/ath12k/wmi.h
>
> Qualcomm Innovation Center copyright missing 2024
>
> Kalle can probably address this in "pending"

Actually the year 2024 was already there, most likely some other patch
added that.

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

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

2024-02-02 12:38:27

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] wifi: ath12k: add processing for TWT enable event

Lingbo Kong <[email protected]> wrote:

> When ath12k send TWT enable command to firmware, firmware will return a TWT
> enable event to ath12k. Through the analysis of TWT enable event status, we
> can easily obtain the status of TWT enable command. It can be more
> convenient to debug TWT.
>
> This patch works with WCN7850 and QCN9274.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
>
> Signed-off-by: Lingbo Kong <[email protected]>
> Acked-by: Jeff Johnson <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

2 patches applied to ath-next branch of ath.git, thanks.

2f92b22beef7 wifi: ath12k: add processing for TWT enable event
ad2b29ad94c3 wifi: ath12k: add processing for TWT disable event

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

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