🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16918

[PATCH net-next v2 0/5] net: rnpgbe: Add basic management and statistics

#16918
From: Dong Yibo
Date: Mon, 16 Nov 2026 03:09
98 lines
12911 bytes
This patch series adds basic management and statistics support to the
RNPGBE driver.

The series introduces:
- Basic ethtool driver and link information
- Link settings reporting for copper, fibre and backplane ports
- Copper autonegotiation, speed/duplex and MDI/MDI-X configuration
- Primary MAC address changes
- Hardware and per-queue statistics

These changes allow users to inspect and configure the adapter and
monitor interface and queue statistics.

RX accounting follows the documented definitions of the two interfaces.
rtnl_link_stats64 includes good packets received by the host, including
those subsequently dropped by the driver. Netdev queue statistics count
packets successfully passed to the networking stack.

For example, an skb allocation failure increments rtnl RX packets/bytes
and rx_dropped, but does not increment queue RX packets/bytes. The
pkt_byte_sum selftest compares these totals directly, so its equality
check cannot hold after such a drop.

Native tests using the driver's RX and statistics functions verified
both accounting paths and reproduced this difference. The extracted
pkt_byte_sum function rejected the resulting counter values as expected.

Tested on N210 and N500 copper ports with firmware 1.1.8.0,
using an external module in a VM running Linux 7.3-rc6.

The unmodified stats.py selftest reports four passes, three skips and
one failure per device. The failure occurs because the driver does not
support the channel configuration query required by
procfs_downup_hammer.

Additional tests passed for link configuration, MDI-X, MAC address
changes, queue statistics, multicast counters and concurrent statistics
reads during interface down/up cycles.

LLM assisted with development, testing and code review.

---
Changelog:
v1 -> v2:
[patch 2/5]
1. Report an empty advertising bitmap for fixed fibre and backplane
   ports, while retaining their supported link modes and port type.
2. Document the firmware MDI-X status encoding.
   Remove the unused MUCSE_LINK_MDIX definition.
[patch 3/5]
1. Reject changes to the firmware-selected port type and PHY address.
2. Validate and cache requested copper advertisement settings even when
   autonegotiation is disabled.
3. Reject nonempty advertisement requests on fixed non-TP ports.
4. Document which parameters firmware ignores depending on autonegotiation.
5. Explain why runtime PHY_LINK_SET uses the event-coalescing mailbox
   transport.
[patch 4/5]
1. Mention open-time Ethernet address validation in the commit message.
   No code changes.
[patch 5/5]
1. Skip hardware sampling while the PCI channel is offline. Validate
   all-ones counter reads against the DMA version register and preserve
   previous snapshots and totals when sampling fails.
2. Fail probe if the initial hardware counter snapshots are unreadable.
3. Use %d for the signed queue index in ethtool statistics names.
4. Update the commit message to describe the final statistics semantics.

Links:
v1: https://lore.kernel.org/netdev/FB722C2F25FE9005+20261106112420.43050-1-dong100@mucse.com/
---

Dong Yibo (5):
  net: rnpgbe: Add basic ethtool support
  net: rnpgbe: Report link settings through ethtool
  net: rnpgbe: Support copper link configuration
  net: rnpgbe: Allow changing the primary MAC address
  net: rnpgbe: Add hardware and queue statistics

 drivers/net/ethernet/mucse/rnpgbe/Makefile    |   2 +
 drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h    |  24 ++
 .../net/ethernet/mucse/rnpgbe/rnpgbe_chip.c   |  51 +++-
 .../ethernet/mucse/rnpgbe/rnpgbe_ethtool.c    | 255 ++++++++++++++++++
 drivers/net/ethernet/mucse/rnpgbe/rnpgbe_hw.h |   3 +
 .../net/ethernet/mucse/rnpgbe/rnpgbe_lib.c    |  28 +-
 .../net/ethernet/mucse/rnpgbe/rnpgbe_main.c   |  21 +-
 .../net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c |  38 ++-
 .../net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.h |  26 ++
 .../net/ethernet/mucse/rnpgbe/rnpgbe_stats.c  | 241 +++++++++++++++++
 .../net/ethernet/mucse/rnpgbe/rnpgbe_stats.h  |  37 +++
 11 files changed, 716 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/ethernet/mucse/rnpgbe/rnpgbe_ethtool.c
 create mode 100644 drivers/net/ethernet/mucse/rnpgbe/rnpgbe_stats.c
 create mode 100644 drivers/net/ethernet/mucse/rnpgbe/rnpgbe_stats.h

-- 
2.50.1
Technical Details
Message-ID: <BD205A7832D36E7D+20261116030917.1329989-1-dong100@mucse.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364023-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364023-linux-kernel-netdev=dewy.ru
From: dong100@mucse.com (Dong Yibo)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 0/5] net: rnpgbe: Add basic management and statistics
Date: Mon, 16 Nov 2026 11:09:17 +0800
Organization: Usenet Network
Message-ID: <BD205A7832D36E7D+20261116030917.1329989-1-dong100@mucse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1965672"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:zvwVNw3K9NVeu3R20H+4xNbI0F0= sha256:vFblHaFQncBdnXrtItwECTLosX94UW6jvB3PA6f/AJA=
	sha1:KYFRmTKdsCTCB6fnwPR97Sq4cNI= sha256:iB3jfnuJYB5zRCV5Ypzg0Vn0BLOZowpIq6VPd44x0aQ=
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 2CCFE114B08; Mon, 16 Nov 2026 06:11:26 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.95
X-Spam-Status: No, score=-2.95 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 Ilk75oRqtbzb;
	Mon, 16 Nov 2026 06:11:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364023-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mucse.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 7B2BB113927; Mon, 16 Nov 2026 06:11:13 +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 136CA32A7F; Mon, 16 Nov 2026 03:10:56 +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=1794798647;
	b=tCeVz7ySk/g1WRyASkFq11iPnPzebjJ2ZywPQ3LH1JTgsJ8gkSuUnRF8TxNjhuHXvxI3
	 hVYXqaNRCA2fVXjOd4dijPEDPRij7AVdE5obvAHao0KZouvGDLLhe7i/c2haxrQ1/z//5
	 NcoMUioSAwxeKLkpR4/KhEsG0jTWweM+r700a5EMIh8zg2nEXLsXDbAOqzgZ0Yo5POp2N
	 bFOv93OMR/pP119KAVzqeAjY1hhvFXI43mGofjYzzCV1z5JgiAMawbXNX25JwZfSK9Ln4
	 nmJ01MLKfgOzAh8DolyASOpbTRun503PsGhhjH9iNYpNsXQY1X+7qOT9RGIIO0To+EQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794798647;
	h=X-Original-To:Received:DMARC-Filter:X-QQ-mid:X-QQ-Originating-IP:
	 Received:X-QQ-SSF:X-QQ-GoodBg:X-BIZMAIL-ID:EX-QQ-RecipientCnt:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding:X-QQ-SENDSIZE:Feedback-ID:
	 X-QQ-XMAILINFO:X-QQ-XMRINFO:X-QQ-RECHKSPAM;
	bh=dcHg9dDG9rGiE77LkO2AMF7X6VJM2cN20sOJdtGTmww=;
	b=bHU8WX6cqZXtWL0UsU/wVWHU4z194IFMG3Ffc5wn6zlvPY0UzQFm5GToOo6YSbpgRtlO
	 xc+5I0S/V3LoPJZMPCdUyzfdFF0CQT5YKV318uiZ9NkZL7Dp/2lUf3VekfSVstAg8dEjw
	 LsN1/O+872i9fzF0WCKdNcJp/fnU6eIDsG2yclvh6ZIXU4Q2z6rLVG1v61+mqvr4zsx5p
	 9jzEr51ny/bzqbouWudvs/P7vKn5AECSuRfFrln/9uDHXB6dD4TR4+dFKSUpCq8rYVYnD
	 o3vAcNdXC2YoFVreRgQtpUzduAP8MD5zD2pNJgs5kZbWcbUKBEQV5q9UYqKnxZwUiCg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=mucse.com;
	spf=pass smtp.mailfrom=mucse.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 22DD7606A33A;
	Mon, 16 Nov 2026 03:10:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=54.92.39.34
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794798646;
	b=TN/NxZ9UXxFmVOsKRhTyglq+B7ghveW9MUy01n2vVw7xwqqQZlXFPxPxYdna1GvbkQN/
	 G2XWY7JMeQcmXBR8/+qM4058rHYZ88sZu8AkJYhszOn5LknfkHKSzkBpfN7htvWA4dOKa
	 TYxo67/KOejMlEhQHrsHOOwsluig6t19jOAsIUrpNGrUoqmDP4hihSkX9gXhn+vv4KJDD
	 VA7AS0evROINWpYuS8GMr/0S8O8B/3QRhev8lHOKY7M1lK6xMSstSNCPYEcpU6w6PDjTw
	 MNZ16veQ/PlDURwgsDn93Bi9jGKOoWTMlFnuNTMBIBHvPKf/nTgAWa5VBoo0mawrRtQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794798646;
	h=DMARC-Filter:X-QQ-mid:X-QQ-Originating-IP:Received:X-QQ-SSF:
	 X-QQ-GoodBg:X-BIZMAIL-ID:EX-QQ-RecipientCnt:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-QQ-SENDSIZE:Feedback-ID:X-QQ-XMAILINFO:X-QQ-XMRINFO:X-QQ-RECHKSPAM;
	bh=dcHg9dDG9rGiE77LkO2AMF7X6VJM2cN20sOJdtGTmww=;
	b=L7RjQP8pqoDTx0QtLgrDrtNHSVsQ36x2X7S19snX7Q/K6WQWi+xVF1LIrhhB6U7x6w/W
	 HGKx7KSqsUvqp+F4MbgmdeK//SqeY5atib7EhBGmCiqbEsDLB8O7S40qZEPlEKVKWgfjz
	 yXTV/oDI9yL3JC4I4ZJVyZfrfFog/XfaHZm8x8ee8QM62BypohwzK9cul4rAyjUnsKmiW
	 WTBrNmSG33g1TpogwDl9cr5U95vJ7wxV9B0/ki65g+RF9PX42IVhxT+sWHVSP/XhZq1nh
	 VWJW24gxAOsSUvozgVXsjnl9pLjJJ2b2bddWXUhu/eJHeWui3yUOvmdTrKcTrHNp+jw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mucse.com;
	spf=pass smtp.mailfrom=mucse.com;
	arc=none smtp.remote-ip=54.92.39.34
X-Received: from smtpbgjp3.qq.com (smtpbgjp3.qq.com [54.92.39.34])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB7D5606A323;
	Mon, 16 Nov 2026 03:10:42 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EB7D5606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mucse.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mucse.com
X-QQ-mid: zesmtpsz9t1794798563tb9eb3508
X-QQ-Originating-IP: F4xlWzjrtbULJWfvi/PGVfWeQknFmYGrajYRSl3Y6/Q=
X-Received: from nic-Precision-5820-Tower.tail7b ( [203.174.112.180])
	by bizesmtp.qq.com (ESMTP) with 
	id ; Mon, 16 Nov 2026 11:09:21 +0800 (CST)
X-QQ-SSF: 0000000000000000000000000000000
X-QQ-GoodBg: 0
X-BIZMAIL-ID: 17076663165220972437
X-EX-QQ-RecipientCnt: 10
X-Cc: linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org,
	dong100@mucse.com,
	yaojun@mucse.com
X-Mailer: git-send-email 2.50.1
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-QQ-SENDSIZE: 520
X-Feedback-ID: zesmtpsz:mucse.com:qybglogicsvrgz:qybglogicsvrgz3a-1
X-QQ-XMAILINFO: MGIHRVWp0RD3LnDoI69HIrrVWz7II9D9M7/AOQA/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