Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1966257lqb; Mon, 27 May 2024 03:42:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU00tHVhBko70VNZRE4+BuAP8Q2VlqhS9eqUX/KLaAtD/yUo5hG+Ct1biZKXRckI79gQUP1D3Li+dlbg0oQmRz5Q9as55ivdMNgghMYjQ== X-Google-Smtp-Source: AGHT+IE4K6/K//3RBMLqLuYL0D6zD2QNACuOCcgx+QszxjJFlFLJTWbBEhCVbvZBVmP+W54EdlPN X-Received: by 2002:a17:906:1945:b0:a59:b807:330a with SMTP id a640c23a62f3a-a62641cf941mr619067466b.32.1716806565115; Mon, 27 May 2024 03:42:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716806565; cv=pass; d=google.com; s=arc-20160816; b=BHUBnkBVfxcoXtgJZsWhBJUeNqA5Ve/WAmsgCm9Zadd3RzyuIWozNvDZvsA7UfqQ1/ wtUP2fFrzzfR9KkzEMdygbfirwUuZDvCrNppxmUdbnhdcJzhvCs+5VCx/vTS0GjSQoue sU6nm6j3mz56uyZU8keye0IhSd2MEY2DFbTC9x2QI6C7LLr3zK2/kLfLKGJ1Nk4eX7Mk xbep+ZQZUKOhgky4Mifr9+rgDoJ+QxSbaS8+kEdQEPsvRQHWroOsi8MoU/xhxyqPyPzK 2AyrQHy6iVjvw4AohST35ZfZmGHUDo/8ykK46rftTAAG4r/6Jp7aBDJ3U9LbbdEeEN77 BcCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=k4cnGNkaK+HeyWfczK1r7lu3cwg2RZlYkGqsqhnn1c4=; fh=FMwqhX9gnIjCyRRZYvi8M4IjArk3rwe8fI1h0BUdZuQ=; b=gms9j4ZTstQHq6J0Gexed2XNHIhhTMC94LXNZZgTax6lHk9utB9E+HI6vfe5+/Dk8C AiNUnlpbsBQV9vZkWa+x3KKIZlATE15F1OdcAoaz+w/wRglsoFjDKRQbbZz/gevCNNVi +t0Oo9839JGUXNIIeuw7fuyE3jXXDrOOTUq8yfSAdDVPBsrZVbOw7BfNybHxI3f4GK+8 5K39hKWNdmAYDKeKw6QChp+gZbIEbCZDPE4qNF14/IpGZPf5Y9q+C8BAXNGfQo2vHfCv lW6RVexxeHJEl+556LdRuz4PxpW6oGTyBI1Z6Nj5hxqB9BJiLOT4Y9Yc1K/N3P1Q+AEM qgJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DW19be9B; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-8086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8086-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc682b6si376156866b.646.2024.05.27.03.42.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 03:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DW19be9B; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-8086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8086-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 am.mirrors.kernel.org (Postfix) with ESMTPS id AEC841F2165B for ; Mon, 27 May 2024 10:42:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0565313AA4C; Mon, 27 May 2024 10:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="DW19be9B" 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 1199813AA3F for ; Mon, 27 May 2024 10:42:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716806560; cv=none; b=Pu0pgHvKeSVUfCrHP5tU31y7QbDL6g/u6/8HuVVOBAHRfxTgOHIWMnRK+9ZzDeE+UyLDla9xXJEJXdq05I9Q0/Tt6Tg91SPe4r3lJ9KzK2nGn606s/R3cvhYz5NZkWZxzd4GvnaMcJe21yGrWMmJJUlDUxi77du+lVHtR1fDYtE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716806560; c=relaxed/simple; bh=JA7oM9jNWZMzk4mfAc2X7KGM3P0Dl9I5HgE+58oBPHk=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=cAJd7KQxr52iKFrbHcllsbeE5sFy6IiRxXTIFxpsBjIL6txLyi4FlTgLpJKNOTehFqrkUwO/vq43uGlNMNbYstSRo7H6kwyK2aGqANCJAvHG7YxuZS2zeKCTMknwWdp1zEa7g5BBR6uBgc2zEsqbREBbO/hnawDLQyQJ1QWP4rI= 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=DW19be9B; arc=none smtp.client-ip=205.220.168.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 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44R0QCMu020371; Mon, 27 May 2024 10:42:33 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= k4cnGNkaK+HeyWfczK1r7lu3cwg2RZlYkGqsqhnn1c4=; b=DW19be9BjFayDPqx wXS4CxeAu9LZVembPgzgmEBsN05c2ciAT8VSvhxJ64s4cKoM7XtzDwiUmBKkYlAO B7HWSBKPj61nFxbIe+zn35m54MNnqaeRKfGMPw5TWZwYnTPfUvfAdeLPX96qmuu5 plucyFKW7NErQdMjn8ykHmvwFCouL7jwkPqdb3JGwK8nQqfUEj1+Dz+dU7V2grVW DcU1QoEGd8kVtKxZoGGw2h1MPmTsaieQEi6YjclfS1w4vVK7TD2NYsRdzqhY3pP3 JD/xVzmm5E7Er9p55qtrCzIGd380H4e2A6isSl+BvLfJPyhHaN42bayuq89dxzT2 3DMv9Q== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yba2h3ajg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 May 2024 10:42:32 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44RAgUBm014665 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 May 2024 10:42:30 GMT Received: from [10.152.203.249] (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; Mon, 27 May 2024 03:42:28 -0700 Message-ID: <9117445e-10b8-4872-903d-fa23f7733f8f@quicinc.com> Date: Mon, 27 May 2024 16:12:25 +0530 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/5] wifi: ath12k: Add support to enable debugfs_htt_stats To: Kalle Valo CC: , , Dinesh Karthikeyan References: <20240510050806.514126-1-quic_rgnanase@quicinc.com> <20240510050806.514126-2-quic_rgnanase@quicinc.com> <87y183d2pb.fsf@kernel.org> Content-Language: en-US From: Ramya Gnanasekar In-Reply-To: <87y183d2pb.fsf@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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: 5i9and1Z1nqKg8neKbKRtRjQx7bT_xBl X-Proofpoint-ORIG-GUID: 5i9and1Z1nqKg8neKbKRtRjQx7bT_xBl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-26_09,2024-05-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2405270087 On 5/21/2024 1:19 PM, Kalle Valo wrote: > Ramya Gnanasekar writes: > >> From: Dinesh Karthikeyan >> >> Create debugfs_htt_stats file when ath12k debugfs support is enabled. >> Add basic ath12k_debugfs_htt_stats_init and handle htt_stats_type >> file operations. >> >> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 >> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 >> >> Signed-off-by: Dinesh Karthikeyan >> Co-developed-by: Ramya Gnanasekar >> Signed-off-by: Ramya Gnanasekar > > [...] > >> +struct ath12k_dbg_htt_stats { >> + enum ath12k_dbg_htt_ext_stats_type type; >> + u32 cfg_param[4]; >> + /* protects shared stats req buffer */ >> + spinlock_t lock; >> +}; > > Is there a specific reason why a new lock is needed? Why not just use > struct ath12k::data_lock? We can use ath12k::data_lock as well since that is also per radio. I will check and address in next version. > >> + >> struct ath12k_debug { >> struct dentry *debugfs_pdev; >> + struct ath12k_dbg_htt_stats htt_stats; >> }; >> >> struct ath12k_per_peer_tx_stats { >> diff --git a/drivers/net/wireless/ath/ath12k/debugfs.c b/drivers/net/wireless/ath/ath12k/debugfs.c >> index 8d8ba951093b..30a80f04d824 100644 >> --- a/drivers/net/wireless/ath/ath12k/debugfs.c >> +++ b/drivers/net/wireless/ath/ath12k/debugfs.c >> @@ -6,6 +6,7 @@ >> >> #include "core.h" >> #include "debugfs.h" >> +#include "debugfs_htt_stats.h" >> >> static ssize_t ath12k_write_simulate_radar(struct file *file, >> const char __user *user_buf, >> @@ -87,4 +88,6 @@ void ath12k_debugfs_register(struct ath12k *ar) >> ar->debug.debugfs_pdev, ar, >> &fops_simulate_radar); >> } >> + >> + ath12k_debugfs_htt_stats_init(ar); > > Let's try to have consistent naming: ath12k_debugfs_htt_stats_register() Sure Kalle. I will take care in next version. > >> +static ssize_t ath12k_read_htt_stats_type(struct file *file, >> + char __user *user_buf, >> + size_t count, loff_t *ppos) >> +{ >> + struct ath12k *ar = file->private_data; >> + char buf[32]; >> + size_t len; >> + >> + len = scnprintf(buf, sizeof(buf), "%u\n", ar->debug.htt_stats.type); >> + >> + return simple_read_from_buffer(user_buf, count, ppos, buf, len); >> +} > > Access to ar->debug.htt_stats.type isn't protected in any way. I will check and address this. > >> + >> +static ssize_t ath12k_write_htt_stats_type(struct file *file, >> + const char __user *user_buf, >> + size_t count, loff_t *ppos) >> +{ >> + struct ath12k *ar = file->private_data; >> + enum ath12k_dbg_htt_ext_stats_type type; >> + unsigned int cfg_param[4] = {0}; >> + int num_args; >> + >> + char *buf __free(kfree) = kzalloc(count, GFP_KERNEL); >> + if (!buf) >> + return -ENOMEM; >> + >> + if (copy_from_user(buf, user_buf, count)) >> + return -EFAULT; >> + >> + num_args = sscanf(buf, "%u %u %u %u %u\n", &type, &cfg_param[0], >> + &cfg_param[1], &cfg_param[2], &cfg_param[3]); >> + if (!num_args || num_args > 5) >> + return -EINVAL; >> + >> + if (type >= ATH12K_DBG_HTT_NUM_EXT_STATS) >> + return -E2BIG; >> + >> + if (type == ATH12K_DBG_HTT_EXT_STATS_RESET) >> + return -EPERM; >> + >> + ar->debug.htt_stats.type = type; >> + ar->debug.htt_stats.cfg_param[0] = cfg_param[0]; >> + ar->debug.htt_stats.cfg_param[1] = cfg_param[1]; >> + ar->debug.htt_stats.cfg_param[2] = cfg_param[2]; >> + ar->debug.htt_stats.cfg_param[3] = cfg_param[3]; >> + >> + return count; >> +} > > Same here with both type and cfg_param. Maybe it's ok to skip > protection, I didn't do analysis yet, but this makes me suspicious.> Sure Kalle. I will check and address the same.