From patchwork Thu Jun 12 01:31:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baochen Qiang X-Patchwork-Id: 896249 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 17E26847B; Thu, 12 Jun 2025 01:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749691931; cv=none; b=DnxsoOKRA1rpnsXVjPTcVrjSaDj9icgIvyyFnHkteSRSxAjFcaAdNiEzBnPcdB0YSo04SAnMlSSxGgdDPhmFlPdjhOGq9aofyxA+Ev+1Lq/ZL/VEYwMsgwjJ13eha7fil6M9mU3CCgAJujgOCJ+fPeOhVufsF8cX2t0zifpVMfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749691931; c=relaxed/simple; bh=HWCkbxMgjAoLsZ1Gl3Xp7a1xv8OeGMZlBxx47ZdiqrI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=RK+SDliI6PmgLnJMcdMjHZnOkySdiODnrk49cbVwlIB3nCzZ+9+VIhAfPS+ZdNbkswbrO37qnw+0xofrLATEq93KS1ypdwKb4+Kl0D9b8/bPBB9QYRSzf6UCnPtOhBxMwNWnL69dz6BRkpqF9n64xWfUh1h1tRdngL3I5R5d1xg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=W9OX/VWs; arc=none smtp.client-ip=205.220.180.131 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="W9OX/VWs" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55BM9rEb002604; Thu, 12 Jun 2025 01:32:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Wq5v0ddsvOvcqNyeuQqlmLxX8cKI76Ec7FRGgFxQFyw=; b=W9OX/VWsRuS+v2Ci CJkGpJdvqeIz0X1XTaFukDbqeMh2aSTpcEB3INQDjTJHCiKyQL8gk6vAdxlNuZx5 +oNf25gr32zSFqq+aKY2NWP2+wzyk45EyBfSTx38Quz2IUsqBy1U4soLLOJ8kWlX 1Fsn29adXSy9tcyUf4vgGKLNs34M2ksTGXQ0tdqEuNIZTY77jSx7KQR/FS5EsFYq khURkni/ujemlmFsuL3vp6bmqm3ybLMNNqdTMr5Ji+xPf6cQ/I66YRyzYBiLuycL vj7WC09s5mbPGf10pIESnxI/at+N97rI9r1sEe3Y6zFybYOIsk15VAAlFPajnmEb YwPOIw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 477jbpgbte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Jun 2025 01:32:04 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 55C1W31I012568 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Jun 2025 01:32:03 GMT Received: from [127.0.1.1] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 11 Jun 2025 18:32:01 -0700 From: Baochen Qiang Date: Thu, 12 Jun 2025 09:31:49 +0800 Subject: [PATCH ath-current 1/4] wifi: ath12k: fix documentation on firmware stats Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20250612-ath12k-fw-fixes-v1-1-12f594f3b857@quicinc.com> References: <20250612-ath12k-fw-fixes-v1-0-12f594f3b857@quicinc.com> In-Reply-To: <20250612-ath12k-fw-fixes-v1-0-12f594f3b857@quicinc.com> To: Jeff Johnson , Ramya Gnanasekar , Aditya Kumar Singh CC: Jeff Johnson , , , , Baochen Qiang X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: aOfRtIkimQI4GD_GUCZgGTCEZgaz4yxi X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjEyMDAxMCBTYWx0ZWRfX3ALXOqJG2jGt 85KqDRCws9kw+N47kErQrskeSFMQG4ZbPMXHsByrYTbayWbniTjP0FQT8ajua5on1evYhVKdcTK w9vFQCyPS6O3H9CorRaozxLhplUZGMLESh3wsS5c93ZJ5U4C3yYjyYDpgL159dFsx9E6wn65uO+ S/RwMoJLo45dsu8TOUo0eFc0Q6vqRahzuRfxLrPIE7E1Z8MwoEZKBai6slQXzKK+1qN0atdQkK1 2NwJCUrAwkMN/8/VQhhxSkYv2z/lTxCWUwgZkOgtKDKpaLCnWAUOGP2jjd5Bx+oT4r8biomWJvv 4KwVNbp3h9dqGbuNsx3PZVhnEtHkKm386dpaNGIlDvmaPgT9lEmHKb0+zfpO1uuT0aIw8Bx8KPF xmaieFkJhtye55nD+LMH8iId8uShkajb6TU6syyYlQ1Dbn2qwAe8gXdKawDD58wLMVHhDsDT X-Proofpoint-ORIG-GUID: aOfRtIkimQI4GD_GUCZgGTCEZgaz4yxi X-Authority-Analysis: v=2.4 cv=OLgn3TaB c=1 sm=1 tr=0 ts=684a2e14 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=COk6AnOGAAAA:8 a=8tjGaqDP5q2GUWaB4ncA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-12_01,2025-06-10_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 impostorscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 malwarescore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506120010 Regarding the firmware stats events handling, the comment in ath12k_mac_get_fw_stats() says host determines whether all events have been received based on 'end' tag in TLV. This is wrong as there is no such tag at all, actually host makes the decision totally by itself based on the stats type and active pdev/vdev counts etc. Fix it to correctly reflect the logic. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284.1-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1 Signed-off-by: Baochen Qiang --- drivers/net/wireless/ath/ath12k/mac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 88b59f3ff87af8b48cb3fafcd364fd9ced4ff197..15dc99992f271f3ec81ecedaf1f6a81fbeb03f79 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -4400,9 +4400,8 @@ int ath12k_mac_get_fw_stats(struct ath12k *ar, /* Firmware sends WMI_UPDATE_STATS_EVENTID back-to-back * when stats data buffer limit is reached. fw_stats_complete * is completed once host receives first event from firmware, but - * still end might not be marked in the TLV. - * Below loop is to confirm that firmware completed sending all the event - * and fw_stats_done is marked true when end is marked in the TLV. + * still there could be more events following. Below loop is to wait + * until firmware completes sending all the events. */ for (;;) { if (time_after(jiffies, timeout)) From patchwork Thu Jun 12 01:31:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baochen Qiang X-Patchwork-Id: 895918 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 93E101632DD; Thu, 12 Jun 2025 01:32:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749691936; cv=none; b=oqygZS3mugy1KiBZcPLwfZ6s6VKcRHthY8YF7fI/FHMZjRrOFXZm74KRBQn/mIQwjzK7uA5ucW2qFZ2AIN0MSnoMiBIK7RXMOHDaQrl5mYlja4oZrf/bxdvL1LTrRLtb2GA1asQsxgZitMwCKT7FrW/1BvJnB7FyIgpfVeoqp9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749691936; c=relaxed/simple; bh=NeNaBOKDN4HCZe37+/9v4S7kIlAhZQyv6BaFL4yrKSk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=iRkCsr8xTOGXl0gtqMJgWvHu2gmkWuFGs6vUNdyHocv8VgsJlZwHkNCo4oEdXxVF5uDH8IjxdQVJ+CSutSTus/hxOIoBFxRR4nC+PUx7TfTSFcNG/4Zv8OgV/vvKG9eLEMv1gfbRsT2bgNmlnj21igBalRZaSpB07AkFxdr10GI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=o2W4oqwM; arc=none smtp.client-ip=205.220.180.131 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="o2W4oqwM" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55BMA23V002792; Thu, 12 Jun 2025 01:32:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= b4DmcTjzf3Ae/K8nsQUa4j3M4XtbNzVicLcLtqjo7v0=; b=o2W4oqwMXGcrOXHj buca6/DZpOa0vz0OBS2J9G9LeFxp5LqLxerJhfwk8zuJNmb2HtMB/4aEpP89kPkz K8rTRV59lOwhjDYGByZGGCOSLqxJvi0wzLrTo5T1v40mKwsQeIQ0zUPVyxKLCuOj V8ftUqpu3wGCGXnFXfBBGci+bm9ORZFPLrPlTVioXpOfTx5bdW9YVdFi65vx6Mcf vP2lYWO3kpHD9SWjf03dKR0/8O64scdwCO8MrAA6P+0AmlSLufznDH2i6pAGmNqu pf4xjctAQn0S/UUniYG3Ch9NkltOQt5sUjGrAxTMiaKdw9ngDy4OKdH4R7oS7XbN mKgziA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 477jbpgbtk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Jun 2025 01:32:07 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 55C1W6Bv014910 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Jun 2025 01:32:06 GMT Received: from [127.0.1.1] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 11 Jun 2025 18:32:03 -0700 From: Baochen Qiang Date: Thu, 12 Jun 2025 09:31:50 +0800 Subject: [PATCH ath-current 2/4] wifi: ath12k: avoid burning CPU while waiting for firmware stats Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20250612-ath12k-fw-fixes-v1-2-12f594f3b857@quicinc.com> References: <20250612-ath12k-fw-fixes-v1-0-12f594f3b857@quicinc.com> In-Reply-To: <20250612-ath12k-fw-fixes-v1-0-12f594f3b857@quicinc.com> To: Jeff Johnson , Ramya Gnanasekar , Aditya Kumar Singh CC: Jeff Johnson , , , , Baochen Qiang , g X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 8T_TLr6KviAYdfEozFpnwyxEbQk3X8HW X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjEyMDAxMCBTYWx0ZWRfXzYX0McvvDsCH 1aC4PlUsnnEz7tV2NPYdKRUe23+V+mkY02vPmuy/0cLw2mSW3dPjDuuTt0bsjDuEbgfDwpxqwrB GUdLohUU2i9ChVnp3iGyW3KNkJY78RTFS6LqC/+ibet9IrYcKYFEeJUqaYgVJAwXr+MZA5wy7Ke FG9m43M+N1o1REtCK1dhVLHVG+jFddEFhya9twWIYSkq3O8sJKCZnO4qF14L7yjhdgnKPm7pAqL 4jExUm7MyDH0vkc57oTp607GLsQWXhxHPYzNph8g5BcLh3rx7QYLuhs4LHRQIMNJp0x33p4/eTi qaB1CpUvHx3IX3bOG8ZqKhb30bWddmKKaxDzdqKdCtZYllu8u4pVZyQPhd49TJ4jOGU2TnbXGwV VuyNaxZ0RYeI73EHsf+crZesuS0D+5E7HCiL+pdHcCYRu4Z0bsk0RBSqUP5w+4qsIh0EM8qW X-Proofpoint-ORIG-GUID: 8T_TLr6KviAYdfEozFpnwyxEbQk3X8HW X-Authority-Analysis: v=2.4 cv=OLgn3TaB c=1 sm=1 tr=0 ts=684a2e17 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=VwQbUJbxAAAA:8 a=UqCG9HQmAAAA:8 a=COk6AnOGAAAA:8 a=2UbTJNZUCKH_85_BNbUA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-12_01,2025-06-10_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 impostorscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 malwarescore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506120010 ath12k_mac_get_fw_stats() is busy polling fw_stats_done flag while waiting firmware finishing sending all events. This is not good as CPU is monopolized and kept burning during the wait. Change to the completion mechanism to fix it. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284.1-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1 Fixes: e367c924768b ("wifi: ath12k: Request vdev stats from firmware") Reported-by: g Closes: https://lore.kernel.org/ath12k/AS8P190MB120575BBB25FCE697CD7D4988763A@AS8P190MB1205.EURP190.PROD.OUTLOOK.COM/ Signed-off-by: Baochen Qiang --- drivers/net/wireless/ath/ath12k/core.c | 2 +- drivers/net/wireless/ath/ath12k/core.h | 2 +- drivers/net/wireless/ath/ath12k/mac.c | 27 ++++++++------------------- drivers/net/wireless/ath/ath12k/wmi.c | 7 ++++--- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index ebc0560d40e3419130e4caf01c9b91bd9affb3bd..fbc62209086fe5fde007193755f6116bfa72ab77 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1216,6 +1216,7 @@ void ath12k_fw_stats_init(struct ath12k *ar) INIT_LIST_HEAD(&ar->fw_stats.pdevs); INIT_LIST_HEAD(&ar->fw_stats.bcn); init_completion(&ar->fw_stats_complete); + init_completion(&ar->fw_stats_done); } void ath12k_fw_stats_free(struct ath12k_fw_stats *stats) @@ -1228,7 +1229,6 @@ void ath12k_fw_stats_free(struct ath12k_fw_stats *stats) void ath12k_fw_stats_reset(struct ath12k *ar) { spin_lock_bh(&ar->data_lock); - ar->fw_stats.fw_stats_done = false; ath12k_fw_stats_free(&ar->fw_stats); spin_unlock_bh(&ar->data_lock); } diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 941db6e49d6eaeb03783f7714d433259d887820b..c9584c4d85fd77150ff30af6d406dadbd87a8050 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -626,7 +626,6 @@ struct ath12k_fw_stats { struct list_head pdevs; struct list_head vdevs; struct list_head bcn; - bool fw_stats_done; }; struct ath12k_dbg_htt_stats { @@ -806,6 +805,7 @@ struct ath12k { bool regdom_set_by_user; struct completion fw_stats_complete; + struct completion fw_stats_done; struct completion mlo_setup_done; u32 mlo_setup_status; diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 15dc99992f271f3ec81ecedaf1f6a81fbeb03f79..8ad6fb358700cf06335748f885877305445b981f 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -4360,7 +4360,7 @@ int ath12k_mac_get_fw_stats(struct ath12k *ar, { struct ath12k_base *ab = ar->ab; struct ath12k_hw *ah = ath12k_ar_to_ah(ar); - unsigned long timeout, time_left; + unsigned long time_left; int ret; guard(mutex)(&ah->hw_mutex); @@ -4368,19 +4368,13 @@ int ath12k_mac_get_fw_stats(struct ath12k *ar, if (ah->state != ATH12K_HW_STATE_ON) return -ENETDOWN; - /* FW stats can get split when exceeding the stats data buffer limit. - * In that case, since there is no end marking for the back-to-back - * received 'update stats' event, we keep a 3 seconds timeout in case, - * fw_stats_done is not marked yet - */ - timeout = jiffies + msecs_to_jiffies(3 * 1000); ath12k_fw_stats_reset(ar); reinit_completion(&ar->fw_stats_complete); + reinit_completion(&ar->fw_stats_done); ret = ath12k_wmi_send_stats_request_cmd(ar, param->stats_id, param->vdev_id, param->pdev_id); - if (ret) { ath12k_warn(ab, "failed to request fw stats: %d\n", ret); return ret; @@ -4391,7 +4385,6 @@ int ath12k_mac_get_fw_stats(struct ath12k *ar, param->pdev_id, param->vdev_id, param->stats_id); time_left = wait_for_completion_timeout(&ar->fw_stats_complete, 1 * HZ); - if (!time_left) { ath12k_warn(ab, "time out while waiting for get fw stats\n"); return -ETIMEDOUT; @@ -4400,19 +4393,15 @@ int ath12k_mac_get_fw_stats(struct ath12k *ar, /* Firmware sends WMI_UPDATE_STATS_EVENTID back-to-back * when stats data buffer limit is reached. fw_stats_complete * is completed once host receives first event from firmware, but - * still there could be more events following. Below loop is to wait + * still there could be more events following. Below is to wait * until firmware completes sending all the events. */ - for (;;) { - if (time_after(jiffies, timeout)) - break; - spin_lock_bh(&ar->data_lock); - if (ar->fw_stats.fw_stats_done) { - spin_unlock_bh(&ar->data_lock); - break; - } - spin_unlock_bh(&ar->data_lock); + time_left = wait_for_completion_timeout(&ar->fw_stats_done, 3 * HZ); + if (!time_left) { + ath12k_warn(ab, "time out while waiting for fw stats done\n"); + return -ETIMEDOUT; } + return 0; } diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index 2d2444417e2b2d9281754d113f2b073034e27739..1e6074456725f45c2bab69aa43ae4ff0b9ce5e8f 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -7658,11 +7658,12 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar, &ar->fw_stats.vdevs); if (is_end) { - ar->fw_stats.fw_stats_done = true; + complete(&ar->fw_stats_done); num_vdev = 0; } return; } + if (stats->stats_id == WMI_REQUEST_BCN_STAT) { if (list_empty(&stats->bcn)) { ath12k_warn(ab, "empty beacon stats"); @@ -7677,7 +7678,7 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar, &ar->fw_stats.bcn); if (is_end) { - ar->fw_stats.fw_stats_done = true; + complete(&ar->fw_stats_done); num_bcn = 0; } } @@ -7715,7 +7716,7 @@ static void ath12k_update_stats_event(struct ath12k_base *ab, struct sk_buff *sk /* Handle WMI_REQUEST_PDEV_STAT status update */ if (stats.stats_id == WMI_REQUEST_PDEV_STAT) { list_splice_tail_init(&stats.pdevs, &ar->fw_stats.pdevs); - ar->fw_stats.fw_stats_done = true; + complete(&ar->fw_stats_done); goto complete; } From patchwork Thu Jun 12 01:31:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baochen Qiang X-Patchwork-Id: 896248 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 5B9D015E5C2; Thu, 12 Jun 2025 01:32:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749691935; cv=none; b=iqyUcEovO5BYR3wNb7YjBXD+4qLTdqGIKuHAoLeu6jNsdEre1BN3R83u5HjvETzApOK6Dko65P7kqtMVOPvK8LaBM/7lYLeVyDwETTWwOIoBUo9l+H+OXTKVjbiENk36JxQ0zvrOIIlGYeV40BWIBDLsu9k9a6rRpVjkGf/gjd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749691935; c=relaxed/simple; bh=tu+JCfApbjm53ZuOr6EnWh3rxEnOf5j4krxKb4NrS9U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=AauYW5KHuDF6ntuHcAeya84CJ/XHLNVjeob6BghbL5mq5ExNF3G+aVne53ohfzUrrK30J5wKbONpx/eaN+LmNK4XLzJXadvxZRj4oaNJx3CO7WAxU6xbu7W0IvQ0J+krxYWO+TP5n51/CwxU/YLfh0lKZf+F/lDsfV7k0SiF/O8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=jZW2LfTH; arc=none smtp.client-ip=205.220.180.131 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="jZW2LfTH" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55BJM6uh027397; Thu, 12 Jun 2025 01:32:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= S9pVwJ+1y6kZ2fG9YatLdeD61USRI/vjDQt86SR00a8=; b=jZW2LfTHeir9l0WS wPfaiK03W67D7PZrJQQmiYMv0NGPrUU9oY2X3cQQOXyWIOHYGz3X111ZxVO8zvqg YP/Cno6lerCEEZTbCnYN+vQ4Iq1FQ2Pc9lequlHg/pRt9R5LPqI0pRj3fPtjBccI QShLh9jYvgWALZvBsJzHZy1EfRY5DUaKuTkKj2Q1BRp/HCsghwlfNAt9MzorKsvT evmZbCu+c6D3a/sDkRexEYoF0xCPPdVcVmjgCG3i6jOb6T6c+f5FLBrV1/keIWjY NVmHhUvItPGnsJckSt9dlZm+N+c1zgpYQbginchml+i23pFE2UFKgbzr+0kghaSF 1IDf1g== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 476jrhdtca-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Jun 2025 01:32:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 55C1W8BS014969 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Jun 2025 01:32:08 GMT Received: from [127.0.1.1] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 11 Jun 2025 18:32:06 -0700 From: Baochen Qiang Date: Thu, 12 Jun 2025 09:31:51 +0800 Subject: [PATCH ath-current 3/4] wifi: ath12k: don't use static variables in ath12k_wmi_fw_stats_process() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20250612-ath12k-fw-fixes-v1-3-12f594f3b857@quicinc.com> References: <20250612-ath12k-fw-fixes-v1-0-12f594f3b857@quicinc.com> In-Reply-To: <20250612-ath12k-fw-fixes-v1-0-12f594f3b857@quicinc.com> To: Jeff Johnson , Ramya Gnanasekar , Aditya Kumar Singh CC: Jeff Johnson , , , , Baochen Qiang X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=EovSrTcA c=1 sm=1 tr=0 ts=684a2e19 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=COk6AnOGAAAA:8 a=2UppwYiRmKxTrJ6QviAA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: 0Luo3K5GE9CSdmj6fF0BbttEyoPKnVey X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjEyMDAxMCBTYWx0ZWRfXwrMmy11vT2F2 6ENLVayLXxAEv54c2ssLXFo7m5h8O4RX1gvA1mG+7naM+P/wbni+0pkBWZboNQ2qGw4l1XFEOOY UswO+ob76CdcgVtOn3yUwn/6JGv14doiZi/tbwf/jP/m9mFuCRxHBJ7g93tLdRN6p7WV1c0aS+V cd2gpX4S7sCQ8w6UT3uoy/uSAEOPQReHBlIgtJVQgzP5afjr9iWQF00rboWPmfLMGYszN8Nq+6J j46mVKfya4GL22QJ/zaCPEV3Orf40EU2CTDp4N0zJogvz/DDgxi8OSABnxtyEuSakwzN8Y/5WVP EbgQaScb0TOiNItD0f4kyV3TuzOFIcnUTx5qtILznQQoKYfbgTPrdisTA1RwHP0NI796DjHhaYU Hix7fQVq6/0ySX246pLZzeODLRiAkmT39LWE6+bXJLFhfbOfZw0TaElTjuw4qzNAmvSZlfgm X-Proofpoint-GUID: 0Luo3K5GE9CSdmj6fF0BbttEyoPKnVey X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-12_01,2025-06-10_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 clxscore=1015 malwarescore=0 adultscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506120010 Currently ath12k_wmi_fw_stats_process() is using static variables to count firmware stat events. Taking num_vdev as an example, if for whatever reason (say ar->num_started_vdevs is 0 or firmware bug etc.) the following condition (++num_vdev) == total_vdevs_started is not met, is_end is not set thus num_vdev won't be cleared. Next time when firmware stats is requested again, even if everything is working fine, failure is expected due to the condition above will never be satisfied. The same applies to num_bcn as well. Change to use non-static counters and reset them each time before firmware stats is requested. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284.1-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1 Fixes: e367c924768b ("wifi: ath12k: Request vdev stats from firmware") Signed-off-by: Baochen Qiang --- drivers/net/wireless/ath/ath12k/core.c | 2 ++ drivers/net/wireless/ath/ath12k/core.h | 2 ++ drivers/net/wireless/ath/ath12k/wmi.c | 14 +++++--------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index fbc62209086fe5fde007193755f6116bfa72ab77..89ae80934b3048f850939c25c160af0e2d05b8e2 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1230,6 +1230,8 @@ void ath12k_fw_stats_reset(struct ath12k *ar) { spin_lock_bh(&ar->data_lock); ath12k_fw_stats_free(&ar->fw_stats); + ar->fw_stats.num_vdev_recvd = 0; + ar->fw_stats.num_bcn_recvd = 0; spin_unlock_bh(&ar->data_lock); } diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index c9584c4d85fd77150ff30af6d406dadbd87a8050..df5f4a934d8da7f15107d6a4bdeb3b21a421a514 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -626,6 +626,8 @@ struct ath12k_fw_stats { struct list_head pdevs; struct list_head vdevs; struct list_head bcn; + u32 num_vdev_recvd; + u32 num_bcn_recvd; }; struct ath12k_dbg_htt_stats { diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index 1e6074456725f45c2bab69aa43ae4ff0b9ce5e8f..dc6a2ad63663d988e495b115a1fc24a6408df600 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -7632,7 +7632,6 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar, struct ath12k_base *ab = ar->ab; struct ath12k_pdev *pdev; bool is_end; - static unsigned int num_vdev, num_bcn; size_t total_vdevs_started = 0; int i; @@ -7652,15 +7651,14 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar, } rcu_read_unlock(); - is_end = ((++num_vdev) == total_vdevs_started); + is_end = ((++ar->fw_stats.num_vdev_recvd) == total_vdevs_started); list_splice_tail_init(&stats->vdevs, &ar->fw_stats.vdevs); - if (is_end) { + if (is_end) complete(&ar->fw_stats_done); - num_vdev = 0; - } + return; } @@ -7672,15 +7670,13 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar, /* Mark end until we reached the count of all started VDEVs * within the PDEV */ - is_end = ((++num_bcn) == ar->num_started_vdevs); + is_end = ((++ar->fw_stats.num_bcn_recvd) == ar->num_started_vdevs); list_splice_tail_init(&stats->bcn, &ar->fw_stats.bcn); - if (is_end) { + if (is_end) complete(&ar->fw_stats_done); - num_bcn = 0; - } } } From patchwork Thu Jun 12 01:31:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baochen Qiang X-Patchwork-Id: 896247 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 4EA3A17A318; Thu, 12 Jun 2025 01:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749691937; cv=none; b=oZ5O6R0DdPS09f0wpmc6xwsP7qDyZdqQ74fe2+NBUNjB2fEs6t64iRrxyQoZPr+xsWNP1FKlHTwNzai+poLOxzY74UOXDdnjzHBIdv+YaUTtdx/QUp7lQytm19A1LQah5kt+ovlSVEZVogpFTz3iMqYQ1PJJ1uXmnvs0pb0xVys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749691937; c=relaxed/simple; bh=cThSd7K6kDqnRvLv9v0D7k0r1SuhKfyhgqtlJhe8gH0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=WA9gY33kcu15Q3J4vOP8ey5FTtGGHyNyJCnRzOdSUDC/ctHKUwGkhvAQlY1Y4RPvWFk4sm+XqdfOdjjy1uHfR2/CMPKlcGsogOAO4s0OnlHc0aJppLBzVYWz7iLbgW5gYISVkb0+pNbUmRgfDtXNU61J3bx6bl00B7NGswOg7Kw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=oqxfdpYR; arc=none smtp.client-ip=205.220.180.131 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="oqxfdpYR" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55BK880f002374; Thu, 12 Jun 2025 01:32:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= eiLd07SJCxjZopKuS4ArzooclGq9tE02D1+OJO7qByQ=; b=oqxfdpYR3R5DvdBs dL7suAVTiDyUSpESYQvdH4UOe2CvIpfGeA12cbR5v0crR6wv9S+ew0L0f5Uq4yfV +/vliMNyYc8gU2qfSUYw5r2fQWrfrW6YMvBGd8wFhxnZ7EuYumNGsBNUyWpYWl5q dcXs8IshDOMKqeZ1ckqzyNNNiXu6tyZoAdUHLgH7uDJomtTfMwUTgkEqmPXQuSTZ m+aNs5sYSzU6ow4oLuvek0M/niZaH2b7JSYteicAObF5pDdTYhHHu+zvCZkHpPYL aw0WtxenpE6NgcATrm3aPD5GXVwUgtt2SVa67+NH2M6XzgdxvdgJPsPze/u2GrLx GI8GYg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 474dgxy3cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Jun 2025 01:32:11 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 55C1WA77014395 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Jun 2025 01:32:10 GMT Received: from [127.0.1.1] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 11 Jun 2025 18:32:08 -0700 From: Baochen Qiang Date: Thu, 12 Jun 2025 09:31:52 +0800 Subject: [PATCH ath-current 4/4] wifi: ath12k: don't wait when there is no vdev started Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20250612-ath12k-fw-fixes-v1-4-12f594f3b857@quicinc.com> References: <20250612-ath12k-fw-fixes-v1-0-12f594f3b857@quicinc.com> In-Reply-To: <20250612-ath12k-fw-fixes-v1-0-12f594f3b857@quicinc.com> To: Jeff Johnson , Ramya Gnanasekar , Aditya Kumar Singh CC: Jeff Johnson , , , , Baochen Qiang X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: G3xTwWwCMzPHJg20oIZc-V-RCnUtMHky X-Authority-Analysis: v=2.4 cv=HMbDFptv c=1 sm=1 tr=0 ts=684a2e1b cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=zPWCEbQWmxFCawYx:21 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=COk6AnOGAAAA:8 a=LKi86vrQLEXAMEGEImwA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: G3xTwWwCMzPHJg20oIZc-V-RCnUtMHky X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjEyMDAxMCBTYWx0ZWRfX2zCZL5Opj+Zg PSAimMoy6ITBV+BnO1IzcNo3KGgWzaPkk0mB7hob5ALdCUC/sRGypoRWFLeRvh6+3XKetXJRHdG 5MGiI5Mh5d2gf9tEf5Tv5GzFnhiQSoCrwEN4W3InItpZLBK6GAK7TRT6fN0/LEVnp2hB1szSgVJ cVOy/vWtG+A1nVRiVpmWqyr1ffrZ0P3nW+5662EpQKh8HTlt2LurOi1Am0VtD2PNNaENi1bpQCa TX/3eSps1ANsib0NGB1qRScmkDIVDHi3h3lkV3MgfUBqi24D4YRjpIYfdWK9MR55A8kscde+SNX uqElAGqMHr0QUD0TpfiC7ZxqPqbMcNvwe9MZKJHQ5bXvLOEaoVloX6uh7IW6tiC9WpDISiVO/Om B7zRs2uDholfwpFAqeXsNwLpN4ZnblsMzgfayyedj/VmGaL3PkBfITB4yHr276MmWtjUHbqi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-12_01,2025-06-10_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 impostorscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506120010 For WMI_REQUEST_VDEV_STAT request, firmware might split response into multiple events dut to buffer limit, hence currently in ath12k_wmi_fw_stats_process() host waits until all events received. In case there is no vdev started, this results in that below condition would never get satisfied ((++ar->fw_stats.num_vdev_recvd) == total_vdevs_started) consequently the requestor would be blocked until time out. The same applies to WMI_REQUEST_BCN_STAT request as well due to: ((++ar->fw_stats.num_bcn_recvd) == ar->num_started_vdevs) Change to check the number of started vdev first: if it is zero, finish directly; if not, follow the old way. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284.1-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1 Fixes: e367c924768b ("wifi: ath12k: Request vdev stats from firmware") Signed-off-by: Baochen Qiang --- drivers/net/wireless/ath/ath12k/wmi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index dc6a2ad63663d988e495b115a1fc24a6408df600..bd04dd98f5f47a4a7d773d3b707a7e53b8f9b29e 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -7631,7 +7631,7 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar, { struct ath12k_base *ab = ar->ab; struct ath12k_pdev *pdev; - bool is_end; + bool is_end = true; size_t total_vdevs_started = 0; int i; @@ -7651,7 +7651,9 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar, } rcu_read_unlock(); - is_end = ((++ar->fw_stats.num_vdev_recvd) == total_vdevs_started); + if (total_vdevs_started) + is_end = ((++ar->fw_stats.num_vdev_recvd) == + total_vdevs_started); list_splice_tail_init(&stats->vdevs, &ar->fw_stats.vdevs); @@ -7670,7 +7672,9 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar, /* Mark end until we reached the count of all started VDEVs * within the PDEV */ - is_end = ((++ar->fw_stats.num_bcn_recvd) == ar->num_started_vdevs); + if (ar->num_started_vdevs) + is_end = ((++ar->fw_stats.num_bcn_recvd) == + ar->num_started_vdevs); list_splice_tail_init(&stats->bcn, &ar->fw_stats.bcn);