🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by netdev-bot+sashiko Mon, 23 Nov 2026 04:25
Re: [PATCH net-next v5 5/6] ionic: report the operational FEC mode from ethtool --show-fec
#20710
Author: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 04:25
89 lines
11275 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] ionic_active_fec_type()
  (drivers/net/ethernet/pensando/ionic/ionic_ethtool.c) returns…

--

ionic: report the operational FEC mode from ethtool --show-fec

This patch changes ionic_get_fecparam() so that, on an autoneg link,
active_fec is taken from status.fec_type (the mode firmware reports as
operational) and not from config.fec_type. With autoneg disabled it
still reports config.fec_type. The commit message expects firmware older
than c4e7a75a096c to leave status.fec_type zero, so that it reads as
FEC off.

> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index c55148f3ae8fa..d406d090d0eb7 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> @@ -440,6 +440,18 @@ static u32 ionic_fec_type_to_ethtool(u8 fec_type)
>  	}
>  }
>
> +/* Firmware that predates status.fec_type leaves it zero, which reads as
> + * FEC off.  With autoneg disabled the port runs the configured mode, so
> + * only trust status.fec_type on an autoneg link.
> + */
> +static u8 ionic_active_fec_type(const struct ionic_port_info *port_info)
> +{
> +	if (READ_ONCE(port_info->config.an_enable))
> +		return READ_ONCE(port_info->status.fec_type);

[Severity: Low]
Is status.fec_type always zero on firmware that predates it? That seems
to hold only right after port_info is first allocated, because
dma_alloc_coherent() returns zeroed memory.

ionic_port_init() allocates port_info only when it is NULL. After that
the same buffer is reused:

drivers/net/ethernet/pensando/ionic/ionic_main.c:ionic_port_init() {
    ...
	if (!idev->port_info) {
		idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
		idev->port_info = dma_alloc_coherent(ionic->dev,
    ...
	stat = (__le64 *)&idev->port_info->extra_stats;
	for (i = 0; i < sizeof(idev->port_info->extra_stats) / sizeof(*stat); i++)
		WRITE_ONCE(stat[i], IONIC_STAT_INVALID);
    ...
}

The firmware reset recovery path runs port init again on that buffer:

ionic_lif_handle_fw_up()
    ionic_port_identify()
    ionic_port_init()

The extra_stats reset above guards against firmware that does not know
about newer fields. It does not clear status.fec_type, though.

Suppose firmware that fills status.fec_type (with RS, for example) is
running. A firmware reset then brings the device back on firmware older
than c4e7a75a096c, which treats that byte as reserved. Wouldn't
ethtool --show-fec on an autoneg link then report the stale RS value as
the active mode, even though the running firmware never reported it?

The later patch "ionic: Add .get_fec_stats ethtool handler" also uses
ionic_active_fec_type(). There it decides whether to report RS-FEC
stats, but it also requires IONIC_DEV_CAP_EXTRA_STATS. Nothing later in
the series clears status.fec_type.

Could ionic_port_init() zero status.fec_type before issuing PORT_INIT,
the same way extra_stats is reset?

> +
> +	return READ_ONCE(port_info->config.fec_type);
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118-ionic-get-fec-stats-v5-0-c9c0ee63df4c%40amd.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads