| From: |
| Eric Joyner <eric.joyner-AT-amd.com> |
| To: |
| <netdev-AT-vger.kernel.org> |
| Subject: |
| [PATCH net-next v5 0/5] ionic: Expose more port stats to ethtool |
| Date: |
| Sun, 14 Jun 2026 13:52:58 -0700 |
| Message-ID: |
| <20260614205303.48088-1-eric.joyner@amd.com> |
| Cc: |
| Brett Creeley <brett.creeley-AT-amd.com>, Andrew Lunn <andrew+netdev-AT-lunn.ch>, "David S. Miller" <davem-AT-davemloft.net>, "Eric Dumazet" <edumazet-AT-google.com>, Jakub Kicinski <kuba-AT-kernel.org>, Paolo Abeni <pabeni-AT-redhat.com>, Eric Joyner <eric.joyner-AT-amd.com>, "Nikhil P . Rao" <nikhil.rao-AT-amd.com>, Simon Horman <horms-AT-kernel.org> |
| Archive-link: |
| Article |
The primary aim of this patchset is to support the reporting of new port
statistics (and one old one) that firmware sends to the driver; these
include general FEC codeword stats and the FEC histogram. A scheme for
these extra stats is introduced in order to prevent devices that don't
support these new statistics from unconditionally setting them or
reporting them in ethtool.
---
v5:
Address new Sashiko AI comments and previous feedback
patch 2:
- Remove additional unused enums that were only used by struct
ionic_port_pb_stats
- Change IONIC_STAT_INVALID to use (~0ULL) instead of ((__le64)-1) to
avoid sparse warnings (and moved to patch 3)
patch 4:
- Change ethtool link_down_events count to use firmware-derived value;
handle overflow and set count to zero on driver load and resets. Finally
drop the driver-calculated value and ethtool general stat counter and
only report count in the ethtool extended link stat structure.
patch 5:
- Add check for NULL port_info in .get_fec_stats() callback in order to
prevent a potential NULL pointer dereference, similar to other ethtool
callbacks.
v4:
- A big addition is a new scheme where the driver will only report the
new statistics supported by firmware if the firmware sets the statistic
value to something that isn't invalid; more details in patch 3, and this
is used in patch 5 to prevent FEC stats from being unconditionally
reported on devices/firmware versions that don't support these stats.
- The link_down_count from firmware mentioned in v2 was moved back to an
entry in the general ethtool statistics; the existing driver-calculated
value for the ethtool ext link is more appropriate due to the firmware
value being a small size and not resetting between driver loads.
- Add netdev_err_once() call recommended by Sashiko for ethtool handler
- Drop devcmd retry logic patch from previous versions for now;
explicitly include Brett's patch from another patchset to fix the
ionic_get_link_ext_stats() PF/VF check
v3:
Address issues mostly found by Sashiko:
- Fix potential return of uninitialized variable in __ionic_dev_cmd_wait()
- Fix bounds of wait in __ionic_dev_cmd_wait() to prevent function from
giving up prematurely now that the wait period has changed
- Add NULL check to ionic_get_link_ext_stats(), following the example set by
ionic_get_link_ksettings()
- Add missing le16_to_cpu() when copying link_down_count from firmware
v2:
- Add missing cpu_to_le64() to FEC histogram stat assignment
- Remove unused pb_stats field that's replaced by the new FEC/extra stats
- Replace ethtool ext link stat with firmware stat instead of adding
the firmware stat to general ethtool statistics; remove old driver
calculated stat
- Add explanation for what EAGAIN return value could be used for in
commit message
Brett Creeley (1):
ionic: Fix check in ionic_get_link_ext_stats
Eric Joyner (4):
ionic: Update ionic_if.h with new extra port stats
ionic: Report "rx_bits_phy" stat to ethtool
ionic: Get "link_down_count" ext link stat from firmware
ionic: Add .get_fec_stats ethtool handler
.../net/ethernet/pensando/ionic/ionic_dev.c | 10 ++
.../net/ethernet/pensando/ionic/ionic_dev.h | 6 +
.../ethernet/pensando/ionic/ionic_ethtool.c | 104 +++++++++++++++++-
.../net/ethernet/pensando/ionic/ionic_if.h | 64 ++---------
.../net/ethernet/pensando/ionic/ionic_lif.c | 4 +-
.../net/ethernet/pensando/ionic/ionic_lif.h | 1 -
.../net/ethernet/pensando/ionic/ionic_main.c | 8 ++
.../net/ethernet/pensando/ionic/ionic_stats.c | 65 ++++++++++-
.../net/ethernet/pensando/ionic/ionic_stats.h | 2 +
9 files changed, 206 insertions(+), 58 deletions(-)
base-commit: 93790c374b9d77f3db15786d7d432872d92751cf
--
2.17.1