Re: [PATCH net-next 5/5] ionic: Add .get_fec_stats ethtool handler

Vadim Fedorenko
2026-05-05T13:54:49Z

On 01/05/2026 04:15, Eric Joyner wrote:
> Several FEC error statistics being collected can be reported in a
> dedicated ethtool callback for FEC errors, so implement the handler that
> does so. This includes 802.3ck FEC histogram data that some newer
> hardware collects.
>
> Assisted-by: Claude:claude-4.6-sonnet
> Signed-off-by: Eric Joyner <eric.joyner@amd.com>
> ---
> .../ethernet/pensando/ionic/ionic_ethtool.c | 51 +++++++++++++++++++
> 1 file changed, 51 insertions(+)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index 78a802eb159f..fe1f753b6115 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> @@ -418,6 +418,56 @@ static int ionic_get_fecparam(struct net_device *netdev,
> return 0;
> }
>
> +static const struct ethtool_fec_hist_range ionic_fec_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 *extra_stats,
> + struct ethtool_fec_hist *hist)
> +{
> + int i;
> +
> + hist->ranges = ionic_fec_ranges;
> + for (i = 0; i < ETHTOOL_FEC_HIST_MAX - 1; i++)
> + hist->values[i].sum = extra_stats->fec_codeword_error_bin[i];
> +}

ETHTOOL_FEC_HIST_MAX = 17, you defined 16 bins, but iterating over 15 of
them. Looks like bin {15, 15} will be lost in stats.