* [PATCH net-next] ionic: Add .get_fec_stats ethtool handler
@ 2026-07-31 21:40 Eric Joyner
2026-08-04 10:27 ` Vadim Fedorenko
2026-08-14 19:05 ` Jakub Kicinski
0 siblings, 2 replies; 7+ messages in thread
From: Eric Joyner @ 2026-07-31 21:40 UTC (permalink / raw)
To: netdev
Cc: Brett Creeley, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Nikhil P . Rao, Eric Joyner
Reports FEC statistics totals and an 802.3ck FEC histogram. Per-lane counts
currently aren't supported, and the only expected histogram format from
firmware is the one with 16 bins from RS(544,514) FEC.
These are physical port counters, so virtual functions are skipped the
same way ionic_get_link_ext_stats() skips them, rather than reporting the
port's counters as if they belonged to the VF.
The reporting of these statistics is gated by DEV_CAP_EXTRA_STATS and
checks for IONIC_STAT_INVALID, since only the newest devices support
reporting all of these stats. Older devices can only report some of the
statistics or not at all, and so the output will properly exclude those
unsupported statistics.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Eric Joyner <eric.joyner@amd.com>
---
v1: This is an updated version of the last patch that was not applied in
the series "ionic: Add .get_fec_stats ethtool handler", see:
https://lore.kernel.org/netdev/20260615182732.7d28e31a@kernel.org/
.../ethernet/pensando/ionic/ionic_ethtool.c | 85 +++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
index c4ab4b5caa0a..0d4bd49cf935 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
@@ -441,6 +441,90 @@ static int ionic_get_fecparam(struct net_device *netdev,
return 0;
}
+#define IONIC_FEC_STAT(dst, src) \
+ do { \
+ __le64 __val = (src); \
+ \
+ if (__val != IONIC_STAT_INVALID) \
+ (dst) = le64_to_cpu(__val); \
+ } while (0)
+
+static const struct ethtool_fec_hist_range ionic_fec_hist_ranges[] = {
+ { 0, 0},
+ { 1, 1},
+ { 2, 2},
+ { 3, 3},
+ { 4, 4},
+ { 5, 5},
+ { 6, 6},
+ { 7, 7},
+ { 8, 8},
+ { 9, 9},
+ { 10, 10},
+ { 11, 11},
+ { 12, 12},
+ { 13, 13},
+ { 14, 14},
+ { 15, 15},
+ { 0, 0},
+};
+
+static void
+ionic_fill_fec_hist(const struct ionic_port_extra_stats *port_extra_stats,
+ struct ethtool_fec_hist *hist)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(port_extra_stats->fec_codeword_error_bin); i++) {
+ if (port_extra_stats->fec_codeword_error_bin[i] == IONIC_STAT_INVALID)
+ return;
+
+ hist->values[i].sum =
+ le64_to_cpu(port_extra_stats->fec_codeword_error_bin[i]);
+ }
+
+ hist->ranges = ionic_fec_hist_ranges;
+}
+
+static void ionic_get_fec_stats(struct net_device *netdev,
+ struct ethtool_fec_stats *fec_stats,
+ struct ethtool_fec_hist *hist)
+{
+ struct ionic_port_extra_stats port_extra_stats;
+ struct ionic_lif *lif = netdev_priv(netdev);
+ struct ionic_port_info *port_info;
+
+ if (lif->ionic->pdev->is_virtfn)
+ return;
+
+ if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
+ return;
+
+ if (!(lif->ionic->ident.dev.capabilities &
+ cpu_to_le64(IONIC_DEV_CAP_EXTRA_STATS)))
+ return;
+
+ port_info = lif->ionic->idev.port_info;
+ if (!port_info) {
+ netdev_err_once(netdev, "port_info not initialized\n");
+ return;
+ }
+
+ if (port_info->config.fec_type != IONIC_PORT_FEC_TYPE_RS)
+ return;
+
+ port_extra_stats = port_info->extra_stats;
+
+ IONIC_FEC_STAT(fec_stats->corrected_blocks.total,
+ port_extra_stats.rsfec_correctable_blocks);
+ IONIC_FEC_STAT(fec_stats->uncorrectable_blocks.total,
+ port_extra_stats.rsfec_uncorrectable_blocks);
+ IONIC_FEC_STAT(fec_stats->corrected_bits.total,
+ port_extra_stats.fec_corrected_bits_total);
+
+ ionic_fill_fec_hist(&port_extra_stats, hist);
+}
+
static int ionic_set_fecparam(struct net_device *netdev,
struct ethtool_fecparam *fec)
{
@@ -1177,6 +1261,7 @@ static const struct ethtool_ops ionic_ethtool_ops = {
.get_module_eeprom_by_page = ionic_get_module_eeprom_by_page,
.get_pauseparam = ionic_get_pauseparam,
.set_pauseparam = ionic_set_pauseparam,
+ .get_fec_stats = ionic_get_fec_stats,
.get_fecparam = ionic_get_fecparam,
.set_fecparam = ionic_set_fecparam,
.get_ts_info = ionic_get_ts_info,
base-commit: 2fbade66245059c78daeaccfce13ecf499fffb51
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] ionic: Add .get_fec_stats ethtool handler
2026-07-31 21:40 [PATCH net-next] ionic: Add .get_fec_stats ethtool handler Eric Joyner
@ 2026-08-04 10:27 ` Vadim Fedorenko
2026-08-14 4:42 ` Eric Joyner
2026-08-14 19:05 ` Jakub Kicinski
1 sibling, 1 reply; 7+ messages in thread
From: Vadim Fedorenko @ 2026-08-04 10:27 UTC (permalink / raw)
To: Eric Joyner, netdev
Cc: Brett Creeley, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Nikhil P . Rao
On 31/07/2026 22:40, Eric Joyner wrote:
> Reports FEC statistics totals and an 802.3ck FEC histogram. Per-lane counts
> currently aren't supported, and the only expected histogram format from
> firmware is the one with 16 bins from RS(544,514) FEC.
does it mean the FW will return IONIC_STAT_INVALID for 100G CWDM4 mode
on newest devices?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] ionic: Add .get_fec_stats ethtool handler
2026-08-04 10:27 ` Vadim Fedorenko
@ 2026-08-14 4:42 ` Eric Joyner
2026-08-14 12:14 ` vadim.fedorenko
0 siblings, 1 reply; 7+ messages in thread
From: Eric Joyner @ 2026-08-14 4:42 UTC (permalink / raw)
To: Vadim Fedorenko, netdev
Cc: Brett Creeley, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Nikhil P . Rao
On 8/4/2026 3:27 AM, Vadim Fedorenko wrote:
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On 31/07/2026 22:40, Eric Joyner wrote:
>> Reports FEC statistics totals and an 802.3ck FEC histogram. Per-lane counts
>> currently aren't supported, and the only expected histogram format from
>> firmware is the one with 16 bins from RS(544,514) FEC.
>
> does it mean the FW will return IONIC_STAT_INVALID for 100G CWDM4 mode
> on newest devices?
>
>
The only device we have that supports reporting these FEC histograms doesn't
have a PHY that supports 100G CWDM4; the IP block for it only supports PAM4
media types and not NRZ. So for now, it would return IONIC_STAT_INVALID for
that mode.
Though, I don't know if that'll be the case for future devices; maybe they will
support FEC histogram stat collection with NRZ media that has fewer than 16
histogram bins. I just don't know if it's worth supporting that possibility
right now since I don't know when or if that will happen.
- Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] ionic: Add .get_fec_stats ethtool handler
2026-08-14 4:42 ` Eric Joyner
@ 2026-08-14 12:14 ` vadim.fedorenko
0 siblings, 0 replies; 7+ messages in thread
From: vadim.fedorenko @ 2026-08-14 12:14 UTC (permalink / raw)
To: Eric Joyner, netdev
Cc: Brett Creeley, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Nikhil P . Rao
On 14/08/2026 05:42, Eric Joyner wrote:
> On 8/4/2026 3:27 AM, Vadim Fedorenko wrote:
>> Caution: This message originated from an External Source. Use proper caution
>> when opening attachments, clicking links, or responding.
>>
>>
>> On 31/07/2026 22:40, Eric Joyner wrote:
>>> Reports FEC statistics totals and an 802.3ck FEC histogram. Per-lane counts
>>> currently aren't supported, and the only expected histogram format from
>>> firmware is the one with 16 bins from RS(544,514) FEC.
>>
>> does it mean the FW will return IONIC_STAT_INVALID for 100G CWDM4 mode
>> on newest devices?
>>
>>
> > The only device we have that supports reporting these FEC histograms doesn't
> have a PHY that supports 100G CWDM4; the IP block for it only supports PAM4
> media types and not NRZ. So for now, it would return IONIC_STAT_INVALID for
> that mode.
> > Though, I don't know if that'll be the case for future devices; maybe they will
> support FEC histogram stat collection with NRZ media that has fewer than 16
> histogram bins. I just don't know if it's worth supporting that possibility
> right now since I don't know when or if that will happen.
Ok, thanks for explaining.
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] ionic: Add .get_fec_stats ethtool handler
2026-07-31 21:40 [PATCH net-next] ionic: Add .get_fec_stats ethtool handler Eric Joyner
2026-08-04 10:27 ` Vadim Fedorenko
@ 2026-08-14 19:05 ` Jakub Kicinski
2026-08-14 20:21 ` Eric Joyner
1 sibling, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2026-08-14 19:05 UTC (permalink / raw)
To: Eric Joyner
Cc: netdev, Brett Creeley, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Nikhil P . Rao
On Fri, 31 Jul 2026 14:40:21 -0700 Eric Joyner wrote:
> Reports FEC statistics totals and an 802.3ck FEC histogram. Per-lane counts
> currently aren't supported, and the only expected histogram format from
> firmware is the one with 16 bins from RS(544,514) FEC.
To be clear this patch is now too old for us to process, you need to
repost. Before you do - double check the 'shiko, it has things to say:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260731214021.15279-1-eric.joyner@amd.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] ionic: Add .get_fec_stats ethtool handler
2026-08-14 19:05 ` Jakub Kicinski
@ 2026-08-14 20:21 ` Eric Joyner
2026-08-14 20:41 ` Jakub Kicinski
0 siblings, 1 reply; 7+ messages in thread
From: Eric Joyner @ 2026-08-14 20:21 UTC (permalink / raw)
To: Jakub Kicinski
Cc: netdev, Brett Creeley, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Nikhil P . Rao
On 8/14/2026 12:05 PM, Jakub Kicinski wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Fri, 31 Jul 2026 14:40:21 -0700 Eric Joyner wrote:
>> Reports FEC statistics totals and an 802.3ck FEC histogram. Per-lane counts
>> currently aren't supported, and the only expected histogram format from
>> firmware is the one with 16 bins from RS(544,514) FEC.
>
> To be clear this patch is now too old for us to process, you need to
> repost. Before you do - double check the 'shiko, it has things to say:
> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260731214021.15279-1-eric.joyner@amd.com
Ok, I'll address the Sashiko review comments and resubmit.
But a couple questions: the Sashiko instance at this site looks like it's doing
more review than what the Sashiko bot at sashiko.dev does; should I be checking
this site for Sashiko reviews instead? As well, I don't think the upstream
Sashiko repository has support for cross-reviewing; is this site running on a
custom version or some early unreleased code?
- Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] ionic: Add .get_fec_stats ethtool handler
2026-08-14 20:21 ` Eric Joyner
@ 2026-08-14 20:41 ` Jakub Kicinski
0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2026-08-14 20:41 UTC (permalink / raw)
To: Eric Joyner
Cc: netdev, Brett Creeley, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Nikhil P . Rao
On Fri, 14 Aug 2026 13:21:41 -0700 Eric Joyner wrote:
> But a couple questions: the Sashiko instance at this site looks like it's doing
> more review than what the Sashiko bot at sashiko.dev does; should I be checking
> this site for Sashiko reviews instead?
Probably as well more than instead
> As well, I don't think the upstream Sashiko repository has support
> for cross-reviewing; is this site running on a custom version or some
> early unreleased code?
Yes
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-08-14 20:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 21:40 [PATCH net-next] ionic: Add .get_fec_stats ethtool handler Eric Joyner
2026-08-04 10:27 ` Vadim Fedorenko
2026-08-14 4:42 ` Eric Joyner
2026-08-14 12:14 ` vadim.fedorenko
2026-08-14 19:05 ` Jakub Kicinski
2026-08-14 20:21 ` Eric Joyner
2026-08-14 20:41 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox