Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2921751lqo; Tue, 21 May 2024 00:55:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8aGbnmqPQYB5jjNeH2Y3GPH2rktLE3V+kAHPKztcOrYnNpwiGpJZup6Z1fUzm3hIWg4Q2U2kaOKPJ3hFbAzZBmt34vW3e0YpMZ1DcYw== X-Google-Smtp-Source: AGHT+IFvpw2zhVbSj4WFZDdE4yDRWNg2utLyROv+m2wE59M1ICHZSsbtt0byeybwL8iLM2iOP1I2 X-Received: by 2002:a05:6358:7246:b0:197:3d6f:cce3 with SMTP id e5c5f4694b2df-1973d6fce28mr458549055d.13.1716278140492; Tue, 21 May 2024 00:55:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716278140; cv=pass; d=google.com; s=arc-20160816; b=tCJmN1tmHIx0geGB3yH8prKNDIkH9DQpxUqpQjJFjIJKFRy55Ybqdau9CE2irxTtwZ 5s4066I7EcIdOBRQqs2JgfjYSJiKn3hCtCImjLL0qqXL0YwbGXg1+HfKtVPR6kgdG9Vu 3KiMdtILG6jadPOZp67UlOAl+Lk25mN0D9+BYA6VXl3sXmreEBxfFtZg/crxyec2c+0E IxsS/Yas9OiptyRQ5dSjPqbpWDzn5oGaPfV1Yf0bzBiG1gIMP1ImChNB00qHyX1VoaRE U3/Op7sf59GAmZwilTb95ovIrIICUfJV+aokXTGRvxsx9AJsXaEKSZ02rfUeZVBzgYxP NBEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=CEc0QuVBUd2o7X360MpDYm930EmDXJmlCM84QFnICZU=; fh=A7OfgHaee/FkrIX0pQzxdl5cv7BEN0yVGEblzOUO1QY=; b=RqB8Gl5aLeAR4nu2NHPxGYoWgw+hYuSS3qUzE0IOdvpxOXFp2iPilDzyj0vjqzvVsk QZ4wuzNWVVNhaaYesNA9ROujUn+5LxezEsisQYserjzyW6p4ysJvMdb64ROcjJyGkPa7 dkNKaY9Os8t9OFyPOVjMZ8Wr5LvP2kvrP3/5a9AelufcISNlrbGZlwq8/+4j/dJ33FHR MwjgxcwAVR9Vz+okuYjR4AYQ/6NmuAUJzVPnDMd4aUpYW58GnU5wwO457DkrDCso8O6m TVkZViMuBIJH8rJIOiyMjf70BYCnYzKf/NRL2aBYlQTDBJZgAmemegJdBlLlucpBR2A9 s11A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WjQL6Ekz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-7869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6340a34a65asi1532140a12.35.2024.05.21.00.55.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WjQL6Ekz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-7869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D78B92830DB for ; Tue, 21 May 2024 07:49:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83E03548EC; Tue, 21 May 2024 07:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WjQL6Ekz" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5F731548E0 for ; Tue, 21 May 2024 07:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716277779; cv=none; b=NVJbV3Ol4Ef2/ocF92OrABlwqNhCa/p17PXGWZlZJLAvN09RC/C7JVIfYvPxlzmINSfcINX+Ur2RM4UgApO/wh3hzvhmCCS36q3+IqF84+HPzuaxK2vhi4ZXiu1D7gzgRqojF76Z1CDZQ9+U/HBqRAzIxlZroedqV+JcnPza8yk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716277779; c=relaxed/simple; bh=1pUKTv82FJURgsr0jI314SPDaLC5Gow+Yuxa7TBb6gY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=Ek4jgaVdZU/cYMygtbU7EygV7VAUiO7xJQnAKLWr1+03ZA+jZyASlILtQcZcxHDfg85oCqc/8atqQjiRBLRuVSE0K6bWJV4EeADTD6B6iMibQO2mv4GIDFpVnQDy9BeHxBs7zZ0oz5patTbI/2yEeKdtg18MpMT7CAbIaMpN55A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WjQL6Ekz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 052A8C2BD11; Tue, 21 May 2024 07:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716277779; bh=1pUKTv82FJURgsr0jI314SPDaLC5Gow+Yuxa7TBb6gY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=WjQL6EkzTNzIp6IqPBUKkV7iuiiX5ozhGvm+nFryRRfFqIliH2UmoAk40dK9KLi4c j64vVj/QuaFRyyARbZXnKBifbEcF+xAGEBesPHmTQLupqGu083n8W0z7epYulcU/fj x4Cjkp1Ckm5vgUnBuRPJXZ3lPg6yJif9NbmmLUbS4ClDMm9+lwAjww8IMSQegtLSD4 EqiMLyFeN7gmDVuxtMkDIHCRha58MiVxLl0CXgDpAxaJQu5lOTXxHTRHKC/9Tnm0rq cbugK7PhfEkbO2a77xzn5JimRoxd6TBSOoAsWN2rpyphtru3zaW3vl7PTG8JfbOen/ oqEaVpMtJr34g== From: Kalle Valo To: Ramya Gnanasekar Cc: ath12k@lists.infradead.org, linux-wireless@vger.kernel.org, Dinesh Karthikeyan Subject: Re: [PATCH v2 1/5] wifi: ath12k: Add support to enable debugfs_htt_stats References: <20240510050806.514126-1-quic_rgnanase@quicinc.com> <20240510050806.514126-2-quic_rgnanase@quicinc.com> Date: Tue, 21 May 2024 10:49:36 +0300 In-Reply-To: <20240510050806.514126-2-quic_rgnanase@quicinc.com> (Ramya Gnanasekar's message of "Fri, 10 May 2024 10:38:02 +0530") Message-ID: <87y183d2pb.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain 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? > + > 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() > +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. > + > +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. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches