๐Ÿš€ 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 4/6] ionic: map the FEC type through a helper in ionic_get_fecparam()
#20708
Author: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 04:25
85 lines
11068 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] This commit replaces the single `switch
  (port_info->config.fec_type)` in ionic_get_fecparam()โ€ฆ

--

ionic: map the FEC type through a helper in ionic_get_fecparam()

This patch moves the mapping from config.fec_type to ethtool FEC values
out of ionic_get_fecparam() and into a new helper,
ionic_fec_type_to_ethtool(). The helper is then called once for
fec->active_fec and once for fec->fec. The commit message describes
this as "No functional change".

> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index a192302c5e19b..c55148f3ae8fa 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c

[ ... ]

> +static int ionic_get_fecparam(struct net_device *netdev,
> +			      struct ethtool_fecparam *fec)
> +{
> +	struct ionic_port_info *port_info;
> +	struct ionic_lif *lif;
> +
> +	lif = netdev_priv(netdev);
> +	port_info = lif->ionic->idev.port_info;
> +
> +	fec->active_fec = ionic_fec_type_to_ethtool(port_info->config.fec_type);
> +	fec->fec = ionic_fec_type_to_ethtool(port_info->config.fec_type);

[Severity: Low]
Can these two loads of port_info->config.fec_type return different
values?

Before this patch the switch loaded the field once and set both fields
from that one value, so active_fec and fec always matched. Now there
are two separate plain loads.

port_info is DMA-coherent memory that the firmware writes. It is
allocated in ionic_port_init():

    idev->port_info = dma_alloc_coherent(ionic->dev,
                                         idev->port_info_sz,
                                         &idev->port_info_pa,
                                         GFP_KERNEL);

The store to fec->active_fec sits between the two loads, so the
compiler has to reload the field.

One concurrent writer is ionic_lif_handle_fw_up()->ionic_port_init().
That path sends the PORT_INIT dev command without RTNL, and the
firmware refreshes port_info while it runs. ionic_get_fecparam() also
does not check IONIC_LIF_F_FW_RESET.

If fec_type changes between the two reads, ethtool --show-fec could
report something like active_fec=RS with fec=OFF. The old code could
never produce that.

Would it make sense to read the field once into a local and pass that
to both calls? For example:

    u8 fec_type = READ_ONCE(port_info->config.fec_type);

It also looks like the later patch in this series, "ionic: report the
operational FEC mode from ethtool --show-fec", still reads the field
twice in the non-autoneg case. When an_enable == 0,
ionic_active_fec_type() returns READ_ONCE(port_info->config.fec_type),
and fec->fec does a second READ_ONCE() of the same field. So the window
seems to remain at the end of the series.

>  
>  	return 0;
>  }

-- 
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