Skip to content

eth: mpnic: add basic netdev statistics

Daniel Zahka bpf lkml netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected] change-id 20261002-mpnic-counters3-d08883b96372

Versions newest first

  1. v2 Latest4 patches 14 repliesApplied 4/4
  2. v14 patches 1 replySuperseded

Changes in v2 from the cover letter

- eth: mpnic: count packets, bytes, and drops per ring
- count Rx frames dropped by the driver in rx_packets and rx_bytes
- disable BH instead of preemption around the Tx flush stats update
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 All 4 applied

#Subject and filesSizeRepliesApplied
1/4eth: mpnic: count packets, bytes, and drops per ringdrivers/net/ethernet/meta/mpnic/mpnic_netdev.c drivers/net/ethernet/meta/mpnic/mpnic_netdev.h drivers/net/ethernet/meta/mpnic/mpnic_txrx.c +1 more+241 -812 repliesApplied
2/4eth: mpnic: report per-queue statsdrivers/net/ethernet/meta/mpnic/mpnic_netdev.c+73 -02 repliesApplied
3/4eth: mpnic: count Tx queue stops and wakesdrivers/net/ethernet/meta/mpnic/mpnic_netdev.c drivers/net/ethernet/meta/mpnic/mpnic_netdev.h drivers/net/ethernet/meta/mpnic/mpnic_txrx.c +1 more+44 -100 repliesApplied
4/4eth: mpnic: count Rx allocation failuresdrivers/net/ethernet/meta/mpnic/mpnic_netdev.c drivers/net/ethernet/meta/mpnic/mpnic_netdev.h drivers/net/ethernet/meta/mpnic/mpnic_txrx.c +1 more+52 -40 repliesApplied

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchJakub Kicinski
1/4A-b
2/4A-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

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

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.

---
Changes in v2:
- eth: mpnic: count packets, bytes, and drops per ring
- count Rx frames dropped by the driver in rx_packets and rx_bytes
- disable BH instead of preemption around the Tx flush stats update
- Link to v1: https://lore.kernel.org/r/[email protected]

---
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   | 183 ++++++++++++++++++++++---
 drivers/net/ethernet/meta/mpnic/mpnic_txrx.h   |  30 ++++
 4 files changed, 406 insertions(+), 18 deletions(-)

---
base-commit: d8674294aefef02266c4d47ad10131f1bffbe534
change-id: 20261002-mpnic-counters3-d08883b96372

Best regards,

Signature · 1 line
Daniel Zahka <[email protected]>