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

From
Dong Yibo <dong100@mucse.com>
Date
2026-11-16 03:10:42
Also in
lkml
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/ (local)
---

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
Thread (17 messages) 17 messages, 3 authors, last reply 2d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help