Message ID | 20240103050926.14115-2-quic_lingbok@quicinc.com |
---|---|
State | New |
Headers | show |
Series | wifi: ath12k: add processing for TWT enable/disable event | expand |
On 1/2/2024 9:09 PM, 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 <quic_lingbok@quicinc.com> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Lingbo Kong <quic_lingbok@quicinc.com> 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 <quic_lingbok@quicinc.com> > Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com> Fails to compile: drivers/net/wireless/ath/ath12k/wmi.c: In function 'ath12k_wmi_twt_enable_event': drivers/net/wireless/ath/ath12k/wmi.c:6675:48: error: passing argument 2 of 'ath12k_wmi_tlv_parse_alloc' from incompatible pointer type [-Werror=incompatible-pointer-types] 6675 | tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); | ~~~^~~~~~ | | | unsigned char * drivers/net/wireless/ath/ath12k/wmi.c:367:44: note: expected 'struct sk_buff *' but argument is of type 'unsigned char *' 367 | struct sk_buff *skb, gfp_t gfp) | ~~~~~~~~~~~~~~~~^~~ drivers/net/wireless/ath/ath12k/wmi.c:6675:14: error: too many arguments to function 'ath12k_wmi_tlv_parse_alloc' 6675 | tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/ath/ath12k/wmi.c:366:1: note: declared here 366 | ath12k_wmi_tlv_parse_alloc(struct ath12k_base *ab, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/ath/ath12k/wmi.c: In function 'ath12k_wmi_twt_disable_event': drivers/net/wireless/ath/ath12k/wmi.c:6704:48: error: passing argument 2 of 'ath12k_wmi_tlv_parse_alloc' from incompatible pointer type [-Werror=incompatible-pointer-types] 6704 | tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); | ~~~^~~~~~ | | | unsigned char * drivers/net/wireless/ath/ath12k/wmi.c:367:44: note: expected 'struct sk_buff *' but argument is of type 'unsigned char *' 367 | struct sk_buff *skb, gfp_t gfp) | ~~~~~~~~~~~~~~~~^~~ drivers/net/wireless/ath/ath12k/wmi.c:6704:14: error: too many arguments to function 'ath12k_wmi_tlv_parse_alloc' 6704 | tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/ath/ath12k/wmi.c:366:1: note: declared here 366 | ath12k_wmi_tlv_parse_alloc(struct ath12k_base *ab, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[7]: *** [scripts/Makefile.build:243: drivers/net/wireless/ath/ath12k/wmi.o] Error 1 make[7]: *** Waiting for unfinished jobs.... make[6]: *** [scripts/Makefile.build:480: drivers/net/wireless/ath/ath12k] Error 2 make[5]: *** [scripts/Makefile.build:480: drivers/net/wireless/ath] Error 2 make[4]: *** [scripts/Makefile.build:480: drivers/net/wireless] Error 2 make[3]: *** [scripts/Makefile.build:480: drivers/net] Error 2 make[2]: *** [scripts/Makefile.build:480: drivers] Error 2 make[1]: *** [/home/kvalo/projects/atheros/ath10k/src/ath/Makefile:1911: .] Error 2 make: *** [Makefile:234: __sub-make] Error 2 2 patches set to Changes Requested. 13509671 [1/2] wifi: ath12k: add processing for TWT enable event 13509673 [2/2] wifi: ath12k: add processing for TWT disable event
On 1/11/2024 8:16 AM, Kalle Valo wrote: > Lingbo Kong <quic_lingbok@quicinc.com> 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 <quic_lingbok@quicinc.com> >> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com> > > Fails to compile: > > drivers/net/wireless/ath/ath12k/wmi.c: In function 'ath12k_wmi_twt_enable_event': > drivers/net/wireless/ath/ath12k/wmi.c:6675:48: error: passing argument 2 of 'ath12k_wmi_tlv_parse_alloc' from incompatible pointer type [-Werror=incompatible-pointer-types] > 6675 | tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); > | ~~~^~~~~~ > | | > | unsigned char * > drivers/net/wireless/ath/ath12k/wmi.c:367:44: note: expected 'struct sk_buff *' but argument is of type 'unsigned char *' > 367 | struct sk_buff *skb, gfp_t gfp) > | ~~~~~~~~~~~~~~~~^~~ > drivers/net/wireless/ath/ath12k/wmi.c:6675:14: error: too many arguments to function 'ath12k_wmi_tlv_parse_alloc' > 6675 | tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/wireless/ath/ath12k/wmi.c:366:1: note: declared here > 366 | ath12k_wmi_tlv_parse_alloc(struct ath12k_base *ab, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/wireless/ath/ath12k/wmi.c: In function 'ath12k_wmi_twt_disable_event': > drivers/net/wireless/ath/ath12k/wmi.c:6704:48: error: passing argument 2 of 'ath12k_wmi_tlv_parse_alloc' from incompatible pointer type [-Werror=incompatible-pointer-types] > 6704 | tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); > | ~~~^~~~~~ > | | > | unsigned char * > drivers/net/wireless/ath/ath12k/wmi.c:367:44: note: expected 'struct sk_buff *' but argument is of type 'unsigned char *' > 367 | struct sk_buff *skb, gfp_t gfp) > | ~~~~~~~~~~~~~~~~^~~ > drivers/net/wireless/ath/ath12k/wmi.c:6704:14: error: too many arguments to function 'ath12k_wmi_tlv_parse_alloc' > 6704 | tb = ath12k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/wireless/ath/ath12k/wmi.c:366:1: note: declared here > 366 | ath12k_wmi_tlv_parse_alloc(struct ath12k_base *ab, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > make[7]: *** [scripts/Makefile.build:243: drivers/net/wireless/ath/ath12k/wmi.o] Error 1 > make[7]: *** Waiting for unfinished jobs.... > make[6]: *** [scripts/Makefile.build:480: drivers/net/wireless/ath/ath12k] Error 2 > make[5]: *** [scripts/Makefile.build:480: drivers/net/wireless/ath] Error 2 > make[4]: *** [scripts/Makefile.build:480: drivers/net/wireless] Error 2 > make[3]: *** [scripts/Makefile.build:480: drivers/net] Error 2 > make[2]: *** [scripts/Makefile.build:480: drivers] Error 2 > make[1]: *** [/home/kvalo/projects/atheros/ath10k/src/ath/Makefile:1911: .] Error 2 > make: *** [Makefile:234: __sub-make] Error 2 > > 2 patches set to Changes Requested. > > 13509671 [1/2] wifi: ath12k: add processing for TWT enable event > 13509673 [2/2] wifi: ath12k: add processing for TWT disable event > This became a victim of the interface change in: wifi: ath12k: refactor ath12k_wmi_tlv_parse_alloc()
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index 11cc3005c0f9..3873a04a6ae1 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/skbuff.h> #include <linux/ctype.h> @@ -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) @@ -6662,6 +6664,35 @@ static void ath12k_rfkill_state_change_event(struct ath12k_base *ab, kfree(tb); } +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->data, skb->len, 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; @@ -6757,10 +6788,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..3546d19a04b6 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.h +++ b/drivers/net/wireless/ath/ath12k/wmi.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef 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,
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 <quic_lingbok@quicinc.com> --- drivers/net/wireless/ath/ath12k/wmi.c | 37 +++++++++++++++++++++++++-- drivers/net/wireless/ath/ath12k/wmi.h | 7 ++++- 2 files changed, 41 insertions(+), 3 deletions(-)