🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5742

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

#5742
From: "Daniel Zahka"
Date: Tue, 20 Oct 2026 21:34
66 lines
14356 bytes
On Tue Oct 20, 2026 at 5:21 PM EDT, Sebastian Andrzej Siewior wrote:
> On 2026-10-19 19:05:43 [-0700], Jakub Kicinski wrote:
>> 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.
>
> I don't mean to pre-allocate stats. If device-down removes queues then
> the stats gone, so what. The queues could remain.
>

hinic3 preallocates stats state for the max supported queues at
registration time. That's why it doesn't keep aggregated base stats. It
also doesn't implement the netdev_stat_ops API, and if it did, it would
need a bit of a redesign to be able to report historical device level
counters separately from live per-queue counters.

>> > > 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.
>
> The statistics is folded on device-down into a global counter. So on
> device-up the statistics is still available. At least that is my
> understanding. This means the per-queue stats are lost and global stats
> don't match the per queue stats anymore.
>

The per queue stats are kept in per-napi state that is freed after
folding in the down path and then zero allocated on the subsequent up.
Technical Details
Message-ID: <DM9ZLBSOWNZ5.282M34TDNA4IT@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349601-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> <20261019215405.OCzrrKYw@linutronix.de> <20261019190543.419e70bc@kernel.org> <20261020212155.47v0ot4g@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-349601-linux-kernel-netdev=dewy.ru
From: daniel.zahka@gmail.com ("Daniel Zahka")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 1/4] eth: mpnic: count packets, bytes, and
 drops per ring
Date: Tue, 20 Oct 2026 17:34:45 -0400
Organization: Usenet Network
Message-ID: <DM9ZLBSOWNZ5.282M34TDNA4IT@gmail.com>
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>
 <20261019190543.419e70bc@kernel.org>
 <20261020212155.47v0ot4g@linutronix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3970106"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:snLj91GfXzyYcAAvAvaYQpw37eg= sha256:LcQyXkasazu77GlktzG2Q0Ou/n2Q/sMZnt8tPCLKiEE=
	sha1:627yQmh17JhG4wztaxrBHCmQRns= sha256:DPp8QKliQ8ZpqzlO1fVYFq4JUp8Tu3Gxji2zHSONoww=
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 20C11110E6B; Wed, 21 Oct 2026 00:35:49 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.048
X-Spam-Status: No, score=-2.048 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, FORGED_GMAIL_RCVD=1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	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=gmail.com
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 C6IkjDib-x_n;
	Wed, 21 Oct 2026 00:35:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349601-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 2613C110E4E; Wed, 21 Oct 2026 00:35:38 +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 3FB08309A8; Tue, 20 Oct 2026 21:35:20 +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=1792532119;
	b=goroFi3WgaOIOhu3Yjp5HaHcfXIKbw4MdE9PYuPxYXLV4h7nAXveDlQevrF6k4qBrAWI
	 zdSyNv3iH2td1GLrduaHSvYbWP0b7HwmP9Hs6C9yg7l7f0u5MuO+kWeGHdWO6P2hdKyEj
	 YQ1kbyzF1DK60adxJtSMk/CceDOeeZ3jrdZuZA9rTiHgNhdh7gIZR68NnaJa17Xg+SUP2
	 iRUinXTIuxxQr6NZm8pfPhVFlDPrXuqJ4GU5IYkpbNMB1zIxU2QrGROxR/v8xMk9RDGch
	 ce3MGgHnW1JbpaAyxOlAW7p/VVu4cbOfOAjRBCXRkY27lo3OjTdXGm7l9mxTbNhJ3KA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792532119;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 Mime-Version:Content-Transfer-Encoding:Content-Type:Date:Message-Id:
	 Cc:Subject:From:To:X-Mailer:References:In-Reply-To;
	bh=bE6vWRivvrBn43khOiGweyP2UtaaaQ6ix75d+gSulIQ=;
	b=O/tQVd/gCsE5vzA6FuZS2hTunntE0MCIGmJAiT151TA0NCCPlt8bKqdORteh9kHth4CG
	 AmHZZN4QZycwJU2hbEYmAmcUbYI3keDfYAJW1im4J81f3w9KNWWy26/+Pborg5g4BhiOr
	 9UtcfbRmUGITdiTGh+xJMlbLCzV75QE4GyXwkJPLEzXeyDr/QHjaTiMjX13hhYaBDiQhd
	 2p6YRvibvVsvpe++tG+fF590L0mC033ggcfzHCAgImwIwYNzLjrxYq11oUuug1KQSj5Gf
	 BrgGN3C8MbLMb6JXW5jr5qU//BZH4/xgXFBR8XZjG39V6xKuZJcDYKo0s/s5KePT8ZA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=alDxpolL;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 998B9606A322;
	Tue, 20 Oct 2026 21:35:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=alDxpolL
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792532089;
	b=KimZ41O7a6GnfqjwsOqhfJ8Oyx6KgS0FtUcWOAteoawEXIal5GFWmY8OMko97Yv3b2IO
	 Qm2yueFwY4MDG9Gpr2w+UxTzr39u7vb5ej27MEN2rseTShYo4bWYOh2D58NYszYhZnQ9n
	 +yRdez+dEju3IA7PzCetBZbFv2RpxaXYI/5iphJpZSRu7IwPt4/PW3HekuoeyfgPKLlmh
	 J/TK5KE51tQlg6iickh16juMeo/ZRE9PvFdY0BlOX4H6gFxRRpJnpWE7bmpPQaljbeshb
	 4IcPTtN0pfNw0wsDZ6+nnXkGUGThj2hMUOLks9W+caRl3XP7FF3g5J/ThnBLGBM7tng==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792532089;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Mime-Version:Content-Transfer-Encoding:Content-Type:Date:Message-Id:
	 Cc:Subject:From:To:X-Mailer:References:In-Reply-To;
	bh=bE6vWRivvrBn43khOiGweyP2UtaaaQ6ix75d+gSulIQ=;
	b=xdtR3LeQdod8BizbTFQqlb4p6cS3NKnWUa3SJN3S8xvJSr/HzYh7SdmIJUgMG0fGVeN9
	 IC9BgUt07QtseLsL2T6va6WUmv7cEnh5GpSjFODw06qP7AhUJnt1cQFSLZaJDg45l01t7
	 I0gd4n/fqNcRgaDCIFhJkW1xKUjLGdCDbTDjaHwDNH5yJgKOPfyaE5R1z7XaQW3+xwN+x
	 nUpCK4/Y9wFkd6sA3WVzLF42/gqQVOUCDoG/BW92SYwnuqOyCMs9kiguQ0HXeqZIyzqDm
	 yo9l7kS4lv2dXPG+at7CFgx8rv9Fky5lPpxZoUxL+B35OudhQZgAOfls95c1k9JQ6iA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=alDxpolL;
	arc=none smtp.remote-ip=209.85.160.172
X-Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32734606A319
	for <netdev@vger.kernel.org>; Tue, 20 Oct 2026 21:34:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 32734606A319
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-5365b48238dso1066881cf.0
        for <netdev@vger.kernel.org>; Tue, 20 Oct 2026 14:34:49 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1792532088; x=1793136888; darn=vger.kernel.org;
        h=in-reply-to:references:to:from:subject:cc:message-id:date
         :content-type:content-transfer-encoding:mime-version:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=bE6vWRivvrBn43khOiGweyP2UtaaaQ6ix75d+gSulIQ=;
        b=alDxpolLRjyv8Gr5yFq8NLTMChM+lVDcXVYQzJwHg7JO3hJSHkKSVlGJeJbHDYvUL1
         U2I/CPb+UKPAANcywpFGexKhTjoCIQ2eq8vigx/02ZdOSuyUj3UzN1JozvoXad6Wjehr
         qlgfMATjoJSLqPLerfpv0kVF6NQuC/79gHZhAnrSOCHudzY6fC17JAByfhaj/3QS6IUF
         KfZAz3d3efzOVVeW4XWNb9xjo+qMltJ2jNXyKoAd82we9+LMaUvEq34w365i1n2qEWpW
         10/nENnNfvGb5ulq9w/uxOUfkpqgKxo6x4rYSLbs/x3gFp/CxfyRQOnw2XTtghzNLDPv
         PP1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792532088; x=1793136888;
        h=in-reply-to:references:to:from:subject:cc:message-id:date
         :content-type:content-transfer-encoding:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=bE6vWRivvrBn43khOiGweyP2UtaaaQ6ix75d+gSulIQ=;
        b=GxXRnba2oLJin2aYB/hdlqyXxy3X6O7KkUUvsCkxMWIiqzOunZ5YTx4yYXFpPUXvpT
         iHAIbcM7asRsxmbt2/ElPHsREAaTthcKFd9C5ARnWVMHSzYiSocSZgLB6JCugMx7ciy7
         9nzeJEGYL/COHQifp32e6+jRVkNMoz9GJQL5/JTu0veDt2EJUu1Va+Q0pbYx1okN5zo2
         HjFHx8rV5Qx6vHMCNr/hNpFhVF7AXIVhD/ME1zbSjxKdkYsU6IjgAzsln/kXKDctLspH
         Kz163WtayW5cPLRhWUzSQc0bFdMXBJp10ijzpzSrN3QpDvBm77PWnMfjhAxwBj0W7txM
         faIg==
X-Forwarded-Encrypted: i=1; AKwUvBz+UQE0z8j6gK0zJ2nMXVB0QYrZ/uR04Hx1YbLrNeT+/OOdoBwJBar5OLCtlfC6uBpJEP4d9R4=@vger.kernel.org
X-Gm-Message-State: AFq9FYIhqb5nglj6NS6SBFBEidGoqlz4b+pGROT22TX51SqOKvPi+fG8
	/YGi05rDdwvL7uVn0eT5TPUs//42dinfRqAxuWpkDmvaoRqyk9RWTJIE
X-Gm-Gg: AYBFou2HgrTgmF5hMl90ccewGGDX3c0Qb1d0wHOZM8JgKOAFyTCqTFqAOceHB/ZWGZI
	3Ykmz+d9BkL8QXWxAtIz5nHU3LEGEiYIDTpdnSfGKSIz09Bw6uF5Wwjlp9+UGj0kcYdTCQTvyrh
	ugPdMob4hv9WFC1mMHGIftIW9u2FS/UMCeQlBAObtXqoedCcg8yMIhdaxBMTGZbfFKmaXdlk5v7
	ii3USBvNUrySOcY1hE1kjWCzVtnMITahbTUtZOTakckqr8g5cyO6yCkwC45s0bwIRM6w8A5OZbb
	UVr7SEZrqPJ1DjQdtW9NFLxDEKdVGXgx/jybxrMzIi2uoT6q4d+BLgrQER6+fotV4OdCgyKAcPB
	/rkAgm2P95t7Bwu9HOw0hG+UK6eGqwWZt+BDQvN00cTXUyT5zAgEsnij+d8MeSS9HLgBTFavynd
	KoiEJf7f+R0FTSENIF4g+e8nYhQZjrEjDuxYbfY+rczBdVaj6kXpaV8mqgab2ZR+K0oYi4JgVPw
	tA=
X-Received: by 2002:ac8:5d46:0:b0:536:6378:c80d with SMTP id d75a77b69052e-5369b7cb970mr1892961cf.32.1792532088120;
        Tue, 20 Oct 2026 14:34:48 -0700 (PDT)
X-Received: from localhost ([2600:4040:9399:4000:e553:72e5:7d37:c7ef])
        by smtp.gmail.com with ESMTPSA id d75a77b69052e-53698bb3d39sm5326391cf.23.2026.10.20.14.34.45
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Tue, 20 Oct 2026 14:34:46 -0700 (PDT)
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-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-Mailer: aerc 0.21.0-threadmapfix
X-In-Reply-To: <20261020212155.47v0ot4g@linutronix.de>