🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #1193

[PATCH net-next 0/4] eth: mpnic: add basic netdev statistics

#1193
From: Daniel Zahka
Date: Fri, 09 Oct 2026 11:35
40 lines
9488 bytes
Add basic netdev statistics and report them via ndo_get_stats64 and
netdev_stat_ops.

Track per queue netdev statistics such as Tx/Rx: packets, bytes, drops,
etc. The driver keeps per-queue state for statistics that is updated
mostly from the NAPI poll and ndo_start_xmit paths. The stats are made
available through the usual driver APIs.

When the netif is transitioned down, the per-queue stat counters are
folded into a global per-device set of counters, and then when the netif
is brought back up, the per-queue counters start counting again from 0.

Extra care is needed for implementing ndo_get_stats64 since the instance
lock is not taken. When ndo_get_stats64 races against ndo_stop and
ndo_open, the reader can attempt to read per-queue stats while the queue
count is changing. To deal with this, the writer publishes the
aggregated base stats and the active queue counts in a single RCU
versioned object.

Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
Daniel Zahka (4):
      eth: mpnic: count packets, bytes, and drops per ring
      eth: mpnic: report per-queue stats
      eth: mpnic: count Tx queue stops and wakes
      eth: mpnic: count Rx allocation failures

 drivers/net/ethernet/meta/mpnic/mpnic_netdev.c | 182 ++++++++++++++++++++++++
 drivers/net/ethernet/meta/mpnic/mpnic_netdev.h |  29 ++++
 drivers/net/ethernet/meta/mpnic/mpnic_txrx.c   | 185 ++++++++++++++++++++++---
 drivers/net/ethernet/meta/mpnic/mpnic_txrx.h   |  30 ++++
 4 files changed, 408 insertions(+), 18 deletions(-)
---
base-commit: d8674294aefef02266c4d47ad10131f1bffbe534
change-id: 20261002-mpnic-counters3-d08883b96372

Best regards,
-- 
Daniel Zahka <daniel.zahka@gmail.com>
Technical Details
Message-ID: <20261009-mpnic-counters3-v1-0-7dc7644cc500@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-343597-linux-kernel-netdev=dewy.ru

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-343597-linux-kernel-netdev=dewy.ru
From: daniel.zahka@gmail.com (Daniel Zahka)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 0/4] eth: mpnic: add basic netdev statistics
Date: Fri, 09 Oct 2026 04:35:03 -0700
Organization: Usenet Network
Message-ID: <20261009-mpnic-counters3-v1-0-7dc7644cc500@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1093562"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:VyTvvAU2cFdQruUNgQvI3yBBdiI= sha256:uU/jHRA7qOsY5iHDSaRg8sZQ3201lse5ROhrmbY3u3c=
	sha1:1FHQsceEzqCEgjsf6ZRpTc2phig= sha256:u4WS5ije/YsaAi3zGL66AMXNFuZOEWQHQ2U7hxIrWnA=
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 A8CD610F666; Fri,  9 Oct 2026 14:38:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.749
X-Spam-Status: No, score=-0.749 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, 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 0oNK7nJkwDzD;
	Fri,  9 Oct 2026 14:38:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-343597-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 5F80110F5B8; Fri,  9 Oct 2026 14:38:00 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 2155E2AF43; Fri,  9 Oct 2026 11:35:30 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C6A84D0CD9;
	Fri,  9 Oct 2026 11:35:23 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HO2gQITE"
X-Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B78CA4CDDD6
	for <netdev@vger.kernel.org>; Fri,  9 Oct 2026 11:35:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.53
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791545723; cv=none; b=BqQj1jw2B4xAOndGLddo1vrad3fUnvsJiCtAGbGNW3aAlG9r9CuNTBBbw6/SfI/bnxrpXK+CPqMCfqQ7VLcNp+oWUgpEE80FRF3rbMjeGIid5JuJ1V/f/vl5G25DG+A8GVT4AusAE/iGPL4J86gZ/FnXBryXzJ2YM9mae8Cj2fw=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791545723; c=relaxed/simple;
	bh=2R2FAHfjSDMObepA1OdjpbsG4zBRUy4e93IUDKml36g=;
	h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=TWzrTUpS5eRnKooFR3q3wHfLiyDm+hxzIEeczMbogmfzgbzMORuBjZhNI24zAn5YaNmYXvZdAbrWGOc0t4u8bzP0199ik2R1F03CeoXrMVWmMfht8SfVR4o1tuPuky3t5u36WSvj8o7dSoeSZe30Jg2jSK5EuUX2+ymGdlHBlME=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HO2gQITE; arc=none smtp.client-ip=209.85.160.53
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-oa1-f53.google.com with SMTP id 586e51a60fabf-49e1dbfe15eso1799442fac.2
        for <netdev@vger.kernel.org>; Fri, 09 Oct 2026 04:35:12 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1791545711; x=1792150511; darn=vger.kernel.org;
        h=cc:to:content-transfer-encoding:content-type:mime-version
         :message-id:date:subject:from:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=q8+wh/N/g5AwFI5ghv77Z+PvaYgxRtZHcThuJwPsrFA=;
        b=HO2gQITE6M1SH9xUCNzNQJmFKHcCDtSeBKmKu45Dg9SGlPa+718IEjjg/aP4uf4XZ0
         o3WQLWzTAlJ6TsN71f7APaoYDH+0o1RX8p7bdHLjvjPtgOxkBFllEu4wUYKDrI2xCswi
         AV3EiFtx0wsLzloyqgptEPzQbfgamq/lquZBSR8KyZ7PxQSAc2U/HFG+I2tP+MEaI/cC
         UZH5sGdQhxvvo21Ls6xEAIhG6dizoj3PC9dvrr8k+ALc5qkzF5ldppdtMd9o+B1YFJpV
         vpOSiBak8qySBJfz8ul6zhgUlQEC/tD+bz/NGAsecC/Nw/OYedNQo/hOKGWEFIAj97B7
         Yk9w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1791545711; x=1792150511;
        h=cc:to:content-transfer-encoding:content-type:mime-version
         :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=q8+wh/N/g5AwFI5ghv77Z+PvaYgxRtZHcThuJwPsrFA=;
        b=niFLwKdINI1Z9s8alaVRHt4OJGitZIxIXGELAIprARrlYuP/wvMbu1FJoOBcyV/+Gb
         tR4N16zTnoPyk4V5Ict/MZShpKeB2Izaq16Dc69gRZ3IIBd626ON/hBFJkRHXVNUfhtS
         gZIQ6pPDsSh0syw22xKpDDHMFsBi3l9ljYvAWEdc9LCiHjFz9fNdGhjoTgHpFOB/upr6
         iih4T9g90TklMTvuOIxsH23SdhJEhLAIYbIal4luTaS3vCNBsSalES+9R028t8y7+9Xl
         lxpVVH4/P40NkFchDx0e5+X+qYty27Lm1Lpb+amjmqKO+if9YmsoFU07p45lHhJqWfRw
         Lrjg==
X-Gm-Message-State: AFq9FYJrvVhyMXr2/x3jp1jNnOCmcttw4wJRjRA/k4yeXy/KRmSVDLuA
	QnYAhRYGuuCARNrl4VCU/qgM34Ki7JUZ5AUDrmn91FbNbYEiSK5YKTWK
X-Gm-Gg: AYBFou1hkcXZlRuBvqQd1BQpFPCdbDAFUbYuQGCYlvBbZAv7jjG3BHbOBgPJ9382gWZ
	VjoH/8sbRKRkLx5C3L5NMEfXNJ0tY84+xjV1YFVuUfmFPQ1OSKEqLp773uWs2XuzT4X3qtx1vhl
	CIVg70nr/K8JLJHd3/4rFjSAmf85ilSPN3u1oCKmjg00xcEhiY5QRkELy5XH0BRg5BVNd8c4sQi
	5w1PqpYCAgahjh6Zhrz06HNi2jsYX3NiohlC+4mvhTsKMr51MhU+vFfHyRCUwSdYN6Jy6L1hUxz
	kAvwEXv+7msgyI9AbmDZXcVIhKBTwjB/Rdjb5BADZQBA9u8i7HtYNEibdK67Y8unkE7zrxdqOiC
	EoUA11SuZGEJK332nCJnwcqKR56Iy8hSSZyxZlf+ZzFYbipeGDLrOl2iIjRXJ2cC+r7VHjVZ/7/
	BRYNFXt3whp33BLe0sq91IWTPpVyuW16uatzuoDXqu/I7DhBxSKADc/vhrFf/5+kVm3k7n
X-Received: by 2002:a05:6870:2803:b0:49d:6a41:29ff with SMTP id 586e51a60fabf-4a2a89b4321mr1308706fac.51.1791545711234;
        Fri, 09 Oct 2026 04:35:11 -0700 (PDT)
X-Received: from localhost ([2a03:2880:30ff:71::])
        by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4a2a84a1457sm1374829fac.4.2026.10.09.04.35.08
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 09 Oct 2026 04:35:09 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-B4-Tracking: v=1; b=H4sIAGjRyGoC/x3MQQ5AMBBA0avIrE1SbUK5ilhQg1kY0pY0EXfXW
 L7F/w8E8kwBuuIBTzcHPiSjKgtw2ygrIc/ZoJWuK6U07qewQ3dcEskHg7Oy1pqprU2jIVenp4X
 Tf+xBKKJQijC87wd+6+YgawAAAA==
X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 
 bpf@vger.kernel.org
X-Mailer: b4 0.13.0