Article View: linux.kernel.netdev
Article #5244Re: [PATCH net-next v2 1/4] eth: mpnic: count packets, bytes, and drops per ring
From: Jakub Kicinski
Date: Tue, 20 Oct 2026 02:05
Date: Tue, 20 Oct 2026 02:05
55 lines
10699 bytes
10699 bytes
On Mon, 19 Oct 2026 23:54:05 +0200 Sebastian Andrzej Siewior wrote: > On 2026-10-19 09:04:38 [-0400], Daniel Zahka wrote: > > > Why do you have the two mpnic_base_stats and fold the stats into into > > > it? My guess would be that on stop the counters are reset and you want > > > to preserve the stats. > > > > > > > Not sure I understand. I think you are asking about two things: > > > > 1. Why have two mpnic_base_stats? > > > > To avoid a separate heap allocation that can fail. Handling an > > allocation failure in the ndo_stop path when doing the aggregation into > > the base stats is tricky. > > Right. But looking at hinic3_get_stats64() for instance (I just grabbed > a random one) it simply does query the stats for each queue, add up, > return. It probably does not drop the queues on down, just reallocates > them while changing the number of queues (and maybe MTU). I don't think pre-allocating stats for chips which supports thousands of queues is reasonable. > > 2. Why split stats into base stats and per queue stats, and why reset > > the per queue counts when the device transitions down? > > > > This is the way the stats in netdev.yaml are exposed depending on the > > 'scope' request attribute. My reading of the relevant kernel docs is > > that the per queue counters are counting events for the current live > > queue, so it makes sense to reset them and fold those counts into the > > base stats when the interface is transitioned down. > > Is there any other driver doing this? > There is ::get_sset_count() and so on for the per-queue stats. You may be mixing up queue stats (netlink) with the old ethtool -S kitchen sink / garbage dump. > If the interface goes down and frees all its queues, then the stats are > gone, true. But preserving them at the price of two (down+up) forced RCU > grace period, I don't know. It looks like a bit too much. This is a modern driver, the down / up path is not taken when interface is reconfigured. It's only taken when the interface is actually taken down or bought up. Which virtually never happens for a datacenter NIC. I don't mean to dismiss your concerns, we agonized over this off-list for a week, and don't love the resulting flow, either. But I strongly prefer the RCU grace period that never really runs, but is easy to reason about, to more advanced fixes which use memory barriers etc. Anyway, I'll punt to Paolo for the final call but I think this is fine. Acked-by: Jakub Kicinski <kuba@kernel.org>
Technical Details
Message-ID:
<20261019190543.419e70bc@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348972-linux-kernel-netdev=dewy.ruReferences:
<20261012-mpnic-counters3-v2-0-8afba81c2d5a@gmail.com> <20261012-mpnic-counters3-v2-1-8afba81c2d5a@gmail.com> <20261016220930.i32JEcqe@linutronix.de> <DM8U47F4MNK3.2V54CCQ9YTNBY@gmail.com> <20261019215405.OCzrrKYw@linutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348972-linux-kernel-netdev=dewy.ru From: kuba@kernel.org (Jakub Kicinski) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 1/4] eth: mpnic: count packets, bytes, and drops per ring Date: Mon, 19 Oct 2026 19:05:43 -0700 Organization: Usenet Network Message-ID: <20261019190543.419e70bc@kernel.org> References: <20261012-mpnic-counters3-v2-0-8afba81c2d5a@gmail.com> <20261012-mpnic-counters3-v2-1-8afba81c2d5a@gmail.com> <20261016220930.i32JEcqe@linutronix.de> <DM8U47F4MNK3.2V54CCQ9YTNBY@gmail.com> <20261019215405.OCzrrKYw@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3763713"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:OVVMgFSAm+bNbEJ5cmCAgbIOSO0= sha256:vx2Yf7XxFQxew0F95fcPj9h80EgyboadhsTzg3a0LCE= sha1:5MU8J14aStgN2sl+QLQRvaozSZ4= sha256:Vf2t5Bx6teiPLcawuIZBtLzNc6v3fgkZUix7SCeWO6g= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id F26DC110BBC; Tue, 20 Oct 2026 05:08:05 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.729 X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qMXKkXnJLySp; Tue, 20 Oct 2026 05:08:03 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348972-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id C4290110B86; Tue, 20 Oct 2026 05:07:52 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id DDA6C49C99; Tue, 20 Oct 2026 02:05:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792461946; b=MZ4fbCUE0QQajmotS3gx9urpp5vIAjIBtcut6jlW1vVkz4tJONaEQyXN2Sxq4bRR6tJo 3fMzS7/rPD65cYuIoJy1WkpLHIvLu5qBdT5OW9wDB+8mJiZ3GYA2r+CytE377fNYNMGBZ SSsI8vOzu7rmy1AiprV3H/zNi++j1AXeT5zMQHpUrmUuClZ3ZzMWY+60+TXqAnf2EVTJx pM8NQxgNEaRa3IARb351m10nzHy3xdJ5CUyHUgUqob+5X2v2mnhmbwYpQJ2TsQo+KSlcy JZZNYzXxoXv518ovbq60W1qeF341ZSiJ0oTTGJ04Hwfh3OW7dkm6vhkTWsXKW6UiElw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792461946; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:In-Reply-To:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=jBHDSbYOOr/pJH/I3PqMtcm89cA/njOWz0J8cUaUEs0=; b=oY3JG+HBfzfgVWEq1UVF15VEpSEPIbWhAlffFANCHjDdms+vZ4xabAG44cNSxQfqYLIb eUrlyDjfM18L1TYTAxfw14x29jxop/QsXO0+y7BRBCdP1isRb36b2LuBtqt8PJhQIw0/C h4vbtBdxtf7E1+AlLdHx45p8g/2NmcQoKLZty/UKa/C3JlUYvM+wjFs2SlsP6Val/aON5 AeUYCn/yXGkIQ1tqDip7jmJ85kODM5GK827E1Kijb976MfgYClDIfsIUU5kl57NvH6QQP B02XVAg5K9HVCWrFrz6pl+UnBODuZKbAEZkXxYB19I3VwIdtHlcQu+DCMCjStdSbUgw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="g2wvuYL/"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B4ED606A329; Tue, 20 Oct 2026 02:05:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=g2wvuYL/ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792461945; b=btM39cTX2gVDgfSN6kPNC6+RXFR1CmXQ1v61iTw0tW7eGkkpaoutglA+GYWw1vbWr6eh V8RmD9B5QG0VLT+c7seXnjGMdjodXAY20s/TLuITnkYYxLqV4Nwx3DE/2qCI8G32TEMse UwjCVqR0aWp7zp+DokVsfcS1ZJ6QrElHdNKcArbodMvpcDeIGMgTf2YZ56PG1/L/YgsOc X/vXPa/PmNc/mCNOwz1om2aGwZDJ5hXjUGbC8YjTx+rCGVEj1wti6msLxp6XpC7tv0XSK B7uEqldiNFPN6Ty+e9Zh5T4ayTmM66I8ZoLWJ+S1uNSZC08UbZJawRPxQmJndajMlmQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792461945; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=jBHDSbYOOr/pJH/I3PqMtcm89cA/njOWz0J8cUaUEs0=; b=g0V61S+fYvQbJiEpMBoRYEWymRP6M/CjDVs4uNsF+Lpwsg2Jr74hMZbR1UoC06qyln6V OmDmXx1NaY8LWdw8SJJyjV2FrJP0zRviU3q1YMPaOAUYqkwyoop2y3djExWldfpRuwajv nbAt/MeDfa/Xs4pRKEX7s46tIYiL9z8ugQ4L3Hjh5Gvb2r7efJqvr3SldyTLaM57FhS0R I03QKtlP4XMjWyTE+g1j28d6r+wYFLqMoJl1uDQAv3HZKaQGCDFvZZN7z6wco2IoWiqqE JbRapvsgGOfq8HgpbUosOgiPjigGPszYFnm2z5fjL45z6HNSmfHvA0frGOfGGgEUZmA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="g2wvuYL/"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02960606A31A; Tue, 20 Oct 2026 02:05:44 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23B901F000CB; Tue, 20 Oct 2026 02:05:44 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792461944; bh=jBHDSbYOOr/pJH/I3PqMtcm89cA/njOWz0J8cUaUEs0=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=g2wvuYL/xgH/RkAw0lMi5R+WvVYsCYInK6TCW7IuYIwxx2k9LB4wZJhjgYns3wWyh MjrVLgiuq1HFuDpUk3pGtPCDm4iWt+s8LkvMckvenssQERLHc2ti6TchP0isHCrUeN Yg8ZehenCJjO/7GJhfMWX/5SbNOkF7bN4jeMoXtCK77sme/P4E1GWN5YPRkHKbbmqw S49+GmStdLpn3qe7kPvrchh5lWQ92c//trLRwINWJXG8MypCelEFIX4Cf8LZQ1Lg/r tHZyFK5PpAJ00vivIRTg1XizX9eV/FzJh8L5wsqI/MxWKJdokPYfVk1osnWD49DFuS zacu3fZLeXfyA== X-Cc: Daniel Zahka <daniel.zahka@gmail.com>, Alexander Duyck <alexanderduyck@fb.com>, kernel-team@meta.com, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Paolo Abeni <pabeni@redhat.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, Eric Dumazet <edumazet@kernel.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org X-In-Reply-To: <20261019215405.OCzrrKYw@linutronix.de> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list