Skip to content

bng_en: add link management and statistics support

Vikas Gupta lkml netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest10 patches 8 repliesIn review
  2. v710 patches 2 repliesSuperseded

Changes in v8 from the cover letter

- Fix the smatch warnings reported by Dan Carpenter

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10bng_en: add per-PF workqueue, timer, and slow-path taskdrivers/net/ethernet/broadcom/bnge/bnge_netdev.c drivers/net/ethernet/broadcom/bnge/bnge_netdev.h+84 -20 replies
2/10bng_en: query PHY capabilities and report link statusdrivers/net/ethernet/broadcom/bnge/Makefile drivers/net/ethernet/broadcom/bnge/bnge.h drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c +5 more+962 -30 replies
3/10bng_en: add ethtool link settings, get_link, and nway_resetdrivers/net/ethernet/broadcom/bnge/bnge.h drivers/net/ethernet/broadcom/bnge/bnge_core.c drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c +2 more+827 -02 replies
4/10bng_en: implement ethtool pauseparam operationsdrivers/net/ethernet/broadcom/bnge/bnge_ethtool.c+58 -00 replies
5/10bng_en: add support for link async eventsdrivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c drivers/net/ethernet/broadcom/bnge/bnge_link.c drivers/net/ethernet/broadcom/bnge/bnge_link.h +2 more+115 -50 replies
6/10bng_en: add HW stats infra and structured ethtool opsdrivers/net/ethernet/broadcom/bnge/bnge_ethtool.c drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.h +2 more+546 -110 replies
7/10bng_en: periodically fetch and accumulate hardware statisticsdrivers/net/ethernet/broadcom/bnge/bnge_netdev.c drivers/net/ethernet/broadcom/bnge/bnge_netdev.h+91 -00 replies
8/10bng_en: implement ndo_get_stats64drivers/net/ethernet/broadcom/bnge/bnge_netdev.c drivers/net/ethernet/broadcom/bnge/bnge_netdev.h+102 -00 replies
9/10bng_en: implement netdev_stat_opsdrivers/net/ethernet/broadcom/bnge/bnge_netdev.c+76 -03 replies
10/10bng_en: add support for ethtool -S stats displaydrivers/net/ethernet/broadcom/bnge/bnge_ethtool.c+481 -03 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchVikas Gupta
1/10R-b
2/10R-b
3/10R-b
4/10R-b
5/10R-b
6/10R-b
7/10R-b
8/10R-b
9/10R-b
10/10R-b

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

Read the v8 thread

Cover letter [PATCH net-next v8 00/10] bng_en: add link management and statistics support

Hi,

This series enhances the bng_en driver by adding:
1. Link/PHY support
a. Link query
b. Async Link events
c. Ethtool link set/get functionality
2. Hardware statistics reporting via ethtool -S

This version incorporates feedback received prior to splitting the original series into two parts.

Addressed following comments from Andrew Lunn
- Apply Rev-xmas fix in several places.
- Correct ethtool-speed comment to reflect accurate behavior.
https://lore.kernel.org/netdev/[email protected]/
https://lore.kernel.org/netdev/CANXQDtb5XuLKOOorCMYDUpVz6aFuQgvmQZ4pS6RJGkAgeM8n1A@mail.gmail.com/

Addressed following comments from Jakub Kicinski
- Took care of missing mutex_init()
https://lore.kernel.org/netdev/[email protected]/#t
https://lore.kernel.org/netdev/CANXQDtYy2JziaaVi=Cqt+gAJNt4NjFFs8NbhrS=RBV61ORwinA@mail.gmail.com/

Addressed following comments from ALOK TIWARI
- Add newline for clarity/formatting.
https://lore.kernel.org/netdev/CANXQDtZbLhdwEtN+kKg1OVLV+uy-gsNfX+rU4MR77QPuO6_y9A@mail.gmail.com/

v8:
- Fix the smatch warnings reported by Dan Carpenter

    https://lore.kernel.org/r/[email protected]/

v7:
- Addressed the two valid issues reported by AI (Jakub Kicinski).
- Fixed minor issues reported by Alok Tiwari.
- Addressed the concern of statistics duplication raised by Jakub Kicinski. A few statistics (discards/errors) have been made part of the standard netdev statistics and removed from ethtool -S. Additionally, a few statistics that require proper implementation have been removed and will be addressed in a later series, for example, get_pause_stats and get_fec_stats.
https://lore.kernel.org/netdev/[email protected]/#t

v6:
- Resending the full series due to an SMTP failure during v5 submission.
- No functional changes from v5.

v5:
Address Jakub Kicinski's comments by holding the instance lock across the entire service task (instead of flag-based locking) and checking the OPEN bit under the lock to resolve the close-path deadlock.

v4:
Addressed comments from Jakub Kicinski:
- Explicitly size speed mask arrays to remove the need for manual sentinels in the hardware configuration.
- Fix an off-by-one error in the queue index bound check.
- Standardize ethtool -S per-ring stat naming to "rxq$id_$name" (e.g., rxq0_errors). Removed spaces and brackets to ensure compatibility with parsing scripts.
- Exclude ethtool -S global counters (tx_err, tx_fifo_underruns, tx_total_collisions) already covered by rtnl_link_stats64.

v3:
Addressed comments from Andrew Lunn:
- Fix a comment and refactor bnge_hwrm_set_pause() to improve code readability.

Addressed comments from Jakub Kicinski:
- Switch to RCU for stats synchronization and drop the BNGE_STATE_READ_STATS state bit.

Fix checkpatch warning by switching to kzalloc_node().

v2:
Addressed comments from Andrew Lunn:
- Add implementation for .get_pauseparam and .set_pauseparam to support
a full flow control configuration, covering global autoneg,
independent
pause autoneg, and forced RX/TX pause functionality.
- Move MAC, PHY, Control, Pause, and RMON statistics from .get_ethtool_stats to their respective structured ethtool callbacks (e.g., .get_eth_mac_stats, .get_rmon_stats).

Addressed comments from Jakub Kicinski:
- Fix potential out-of-bounds read in speed mask array by adding the missing sentinel.
- Simplify timer synchronization by removing the redundant intr_sem.
- Replace link_lock with the netdev instance lock, as it is sufficient to handle the required synchronization.

v1:
https://lore.kernel.org/all/[email protected]/

Bhargava Marreddy (10):
bng_en: add per-PF workqueue, timer, and slow-path task
bng_en: query PHY capabilities and report link status
bng_en: add ethtool link settings, get_link, and nway_reset
bng_en: implement ethtool pauseparam operations
bng_en: add support for link async events
bng_en: add HW stats infra and structured ethtool ops
bng_en: periodically fetch and accumulate hardware statistics
bng_en: implement ndo_get_stats64
bng_en: implement netdev_stat_ops
bng_en: add support for ethtool -S stats display

 drivers/net/ethernet/broadcom/bnge/Makefile   |    3 +-
 drivers/net/ethernet/broadcom/bnge/bnge.h     |   12 +
 .../net/ethernet/broadcom/bnge/bnge_core.c    |    1 +
 .../net/ethernet/broadcom/bnge/bnge_ethtool.c |  723 +++++++++
 .../ethernet/broadcom/bnge/bnge_hwrm_lib.c    |  386 ++++-
 .../ethernet/broadcom/bnge/bnge_hwrm_lib.h    |    8 +
 .../net/ethernet/broadcom/bnge/bnge_link.c    | 1303 +++++++++++++++++
 .../net/ethernet/broadcom/bnge/bnge_link.h    |  204 +++
 .../net/ethernet/broadcom/bnge/bnge_netdev.c  |  597 +++++++-
 .../net/ethernet/broadcom/bnge/bnge_netdev.h  |   87 +-
 .../net/ethernet/broadcom/bnge/bnge_txrx.c    |   35 +-
 11 files changed, 3340 insertions(+), 19 deletions(-)
 create mode 100644 drivers/net/ethernet/broadcom/bnge/bnge_link.c
 create mode 100644 drivers/net/ethernet/broadcom/bnge/bnge_link.h
Signature · 1 line
2.47.1