🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5165

Re: [PATCH net-next v2 1/4] eth: mpnic: count packets, bytes, and drops per ring

#5165
From: Sebastian Andrzej Siewior
Date: Mon, 19 Oct 2026 21:54
41 lines
11310 bytes
On 2026-10-19 09:04:38 [-0400], Daniel Zahka wrote:
> >> An RCU approach is used because ndo_get_stats64 is not called with the
> >> instance lock.
> >
> > 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).

> 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.
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.

> >> Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>

Sebastian
Technical Details
Message-ID: <20261019215405.OCzrrKYw@linutronix.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348868-linux-kernel-netdev=dewy.ru
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>

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-348868-linux-kernel-netdev=dewy.ru
From: bigeasy@linutronix.de (Sebastian Andrzej Siewior)
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 23:54:05 +0200
Organization: Usenet Network
Message-ID: <20261019215405.OCzrrKYw@linutronix.de>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="3722975"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Xs1hdhJw/PSA1mU8335JKAs4/FE= sha256:FE466p3zDOfvZOtrC37ibZlahNadNUwSPNPBhaUWA8E=
	sha1:RrBOrpxbfjC9PyamypFpjNfVeSk= sha256:Bqb4R/0IfPin7LOcgV1AKHiYGPCOE7DqB9kN9qI6ubg=
Content-Disposition: inline
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 6226B110B55; Tue, 20 Oct 2026 00:54:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	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=linutronix.de header.b=H7ONmosJ; dkim=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=linutronix.de header.b=izJT5KbY
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 kZP0sTmhPhsP;
	Tue, 20 Oct 2026 00:54:38 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348868-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linutronix.de
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 378D6110B47; Tue, 20 Oct 2026 00:54:24 +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 9D1D340F09; Mon, 19 Oct 2026 21:54:15 +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=1792446855;
	b=q5RLiycb0mgWqBTIjQYztQ+emwZD/6nzH50BiGasL5PFcTp9u+qgBb8yt/uLC5Jl4Hq+
	 ULkW/QCwuycqWkWBDsvdXRkF4PsM8XW03V3V8e8OEoDc57t566pxMxmus+aMUPHGh+1S1
	 9NUb7/cXJKy4Zl24waE3uDD+mBGfMGTXz3oBanlsvAkyucoGk3eGNnWDE51z12MhDXrNl
	 fHRC1OZiOj6XiXPaszxsJg1XWwfkd6L1QCKK+T5FJXVWpJmSNNjdsPrjtrlxIkv145uO2
	 YK1BViZSeXkYQ4T9nQN1Ve1/MmRuEyE8SDqMpBarwdnKHDt6KH6BcMHGsBEftFVzEjg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792446855;
	h=X-Original-To:Received:DMARC-Filter:Date:DKIM-Signature:
	 DKIM-Signature:From:To:Cc:Subject:Message-ID:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=REW/9j+OlAseSVUPZSaGZcgsaYuUzx8Jih/oiiyk91c=;
	b=yrMpq1o3GpILqEh66H0Zcq7dhBj0qycwvcwAA43ineZ8a/T9thpshHTha6H/7Jo5B3jA
	 SDoIhTLkjKQluIQhsd4g02FOEg5bhXNDu/UisGWTVqMU+8BF5Cx7IH7M4w/dzgxrmF0Gu
	 JupBPlanKky8vij3WyNwTgGUXDdgXjK2R2y+ltlAwEPrmx/S0JmGqGFETIAwlhoAsW3yA
	 ciiLiu1OSK0fjeGK1MngZKXzdofpFhj3ndo1cl9zLkuaUuZPeMOuRxkhnxFtnWukeUVfh
	 wdUjnaZvss/BTFxHvM9Yhz51ZCQuQTpPtkLpkOLLTXPMYwoD7ZwDuZ//vLFtVMxaZvQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=H7ONmosJ;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=izJT5KbY;
	dmarc=pass header.from=linutronix.de;
	spf=pass smtp.mailfrom=linutronix.de;
	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 5E48E606A324;
	Mon, 19 Oct 2026 21:54:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=H7ONmosJ;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=izJT5KbY
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792446849;
	b=ahfj6HDAwlq/AOkcGwtwezvGt2Yyc5yHCFDm7nhQ+ByX5USjQIkxfgSth8XYNsWwcfi2
	 p0g1kkQK8Nl57giiIrLT2C58YuOXNK5qKOlAtGKDJx0zw80YdQKV39F9ynbL8fHHe89a7
	 f7ySIblME2QwmqYFzQyQNmeVsM+0jMMaXRMFC47Lokd61gYl4yFr7N71qpXuKrpe3ZlLe
	 fWoVFz1h8FjETj5Avjjy2PBKNOUrpiHVO6ozXHsbt8+jYhMcXtMiiGszteAYe8USu9dJv
	 8me+01yrO5M1NG1Ujn7oU769UuVvpY8XwSQ1YtQvGAHR4Yfosfs5gJLFXks2PbNxw7w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792446849;
	h=DMARC-Filter:Date:DKIM-Signature:DKIM-Signature:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=REW/9j+OlAseSVUPZSaGZcgsaYuUzx8Jih/oiiyk91c=;
	b=caxF8sy51/nW52CjiXe7kh6PDLORowtwYhi+Rfi1jw+MoBl1wkRBB7emNT1jg71UxocD
	 E8G4p5p9ZCUgDT4aVeBPVkBxg1cDqmq8S/TVFjFhkXCUSKyT2cDpS/RqxjsBe7CYfFzBi
	 gdi+C1nMRkgiFQ5BQxj/hNHgpHRahlZMKPoNU1sN984+1QVkekE5TYzZlUVLi2QXPWA5o
	 KS3eQKu5blRXTCX+gtqrm8Ubm0PFZNDRozt4Zr4zK25GW0sSOu67/XkBK+uNcSF1gcVFa
	 Ot/ZLh5JI6J0IX9FMFF83V0GU+o7gMzgrAmMUnlHDWs9kUyaU8gMwEK+0+qOvLE+xeA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linutronix.de;
	spf=pass smtp.mailfrom=linutronix.de;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=H7ONmosJ;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=izJT5KbY;
	arc=none smtp.remote-ip=193.142.43.55
X-Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB2E1606A319;
	Mon, 19 Oct 2026 21:54:08 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DB2E1606A319
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020; t=1792446846;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=REW/9j+OlAseSVUPZSaGZcgsaYuUzx8Jih/oiiyk91c=;
	b=H7ONmosJ6zh6o9SpTnoFSdKuZJWBx2Yxqc+G+jHtUPhx7c7ud9ydR+LVE3+lN0RMh8C4KS
	8G3nCCbis88zqCsmMSaVdNcHGhP7wLEwCFalK2lFBg1ZBu+HqXebx/QtKf3a3g+YLfc4Lh
	jV/cE6BoOXG4Zs8W/cV3V90pkjzr0oqjs2acZbgyqKr9Yz069Kg7dPlLvmJSy4csDxNyun
	uL1+4pZlCS6DGRgIgrEel5QLllBEvfuCQjsxDEcEeoIJ/0A8NKgtNHFW+KBt0Vrpnrkz/B
	9VY8PfjKWnH4lBmJvus7ioEmA7P2iPj9Nf/IAhhUDL0kxyz2WT29JUYWkryHxw==
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020e; t=1792446846;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=REW/9j+OlAseSVUPZSaGZcgsaYuUzx8Jih/oiiyk91c=;
	b=izJT5KbYwxJdCKsI4l1Onn0ZAkS1NLhodI8dZ38boqdNTaLmtDi5UQr/YUzocMRSNfjxjt
	UeZZ20yI2vUpysCw==
X-Cc: Alexander Duyck <alexanderduyck@fb.com>,
	Jakub Kicinski <kuba@kernel.org>, 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-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
X-In-Reply-To: <DM8U47F4MNK3.2V54CCQ9YTNBY@gmail.com>