Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6937987rdb; Tue, 2 Jan 2024 21:18:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtNHVmSP0lxYUxOAmvPYalQ2+85bG45WcofusLH57uISjy4FJ3KdYAd/Sb44oy/iMGyuYf X-Received: by 2002:a05:6808:1454:b0:3b8:b063:9b5d with SMTP id x20-20020a056808145400b003b8b0639b5dmr27013096oiv.79.1704259086742; Tue, 02 Jan 2024 21:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704259086; cv=none; d=google.com; s=arc-20160816; b=JE492FM8LxNPYyMPWy+gSpnHcESW3prwPn0fYEM5bOkTOAeEKWADCvZB2L87vu1TZ+ Ml/NO7OiRTNTB2EHtBqfqxOomFge8NcMiA4ht4EzJ3SUbFlPi+quvJxFhjL1w8ZvbVrY l1jkxMLy8GoehNKGS48w8vei2KWX+zptFBywioVVEnV1Ct08vHj+q3qGxdqD9QHZs6NF +AiRzvBh67xly5FEznehl4nyM9IeggfgNpg47JO3D3gByvP695hClKJ6ck5IbKK3xzNG aKeG+sKrjg8wLzL4LGx/7J2u5XDoKt+hlN3AwzlK0p6IkVysAQPgQ2yqA87tl9n1euFg Sn3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TjfPVXl1GnCuSUCFb+AA6Jay6wbZkr4JFE7JBasplUI=; fh=iuT7hybwPTwRgORCXDEfziFycsbMl38R7mEpaqq+Y78=; b=wkNMfIW/hW7uc1RC1GjNufoxmMjHlmurnrzOrq8GcivvOx72pVXeK0o8RPO3qH4sAv s3ewtQ5kkV08FyyLnbj7FiFwtipj5eNs8RZk07ENT3Ku8UYjvNlD64anN5I1q/ZIsXMM b8KYkzdVL0g4AfnYisPLDGRDOe5eZgs0KS4obNHCZOvAaawqd4A2iyKJtzu/Fadsn36O lEgBAChWlrobvZIasSUiBY0GlGwunWym5TSWqPvz3zIiSN3PGp6La+LoOz+GbdVoq+/I PROUTwvA+ygF/2rGmHpS7p68GlpsJckTBLoUKWlYdui6UeldTBpmnpMY4hrc2V0psR3B JQJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ont16npI; spf=pass (google.com: domain of linux-wireless+bounces-1421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1421-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c22-20020a62e816000000b006d9b65b8908si15009174pfi.398.2024.01.02.21.18.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 21:18:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ont16npI; spf=pass (google.com: domain of linux-wireless+bounces-1421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1421-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 767A6B232A2 for ; Wed, 3 Jan 2024 05:15:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAADB18043; Wed, 3 Jan 2024 05:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Ont16npI" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3405718032 for ; Wed, 3 Jan 2024 05:10:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4031ismR007431; Wed, 3 Jan 2024 05:10:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=TjfPVXl1GnCuSUCFb+AA6Jay6wbZkr4JFE7JBasplUI=; b=On t16npIZSv+vURMPkdlWas7HG2CEdSXhOWPuCyztt2fC++UelfFUI8KnNWsTglVFH i0NTEOZQSnnupsWPcAsVr5ASkT0rTnVtaUMK9bqWI5o+20WPPaRCeHZSn8CtUApx hIp00LivyUHM41Pg4USKtdxIjIXml//9NSh7dbC+2bFsJknxUXgPtFL7T3H5a0mp PpuyMYYZi4T1/3HEu2L3SBFcmd0V+vJdhhM8jTiuFXQbLn4GlEaTWhXJWZdEph8Q dbpIqm/aNQMdbUFdrhAm1LPFJZcYEV/d6MhL5gqnfefAuuQecR5c4maO0cI6Ahie LeZq26KCItXwZDX6eZ6A== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vcguba2cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 03 Jan 2024 05:10:28 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4035ARZ6003104 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 3 Jan 2024 05:10:27 GMT Received: from lingbok-Latitude-E5440.qca.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 2 Jan 2024 21:10:26 -0800 From: Lingbo Kong To: CC: Subject: [PATCH 1/2] wifi: ath12k: add processing for TWT enable event Date: Wed, 3 Jan 2024 00:09:25 -0500 Message-ID: <20240103050926.14115-2-quic_lingbok@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103050926.14115-1-quic_lingbok@quicinc.com> References: <20240103050926.14115-1-quic_lingbok@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: JtnDUc15Nn2qB9-YLcAzHELwhwz8GLGX X-Proofpoint-GUID: JtnDUc15Nn2qB9-YLcAzHELwhwz8GLGX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 impostorscore=0 adultscore=0 spamscore=0 mlxscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401030039 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 --- drivers/net/wireless/ath/ath12k/wmi.c | 37 +++++++++++++++++++++++++-- drivers/net/wireless/ath/ath12k/wmi.h | 7 ++++- 2 files changed, 41 insertions(+), 3 deletions(-) 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 #include @@ -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, -- 2.34.1