Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: eric.joyner@amd.com
Cc: netdev@vger.kernel.org, brett.creeley@amd.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, vadim.fedorenko@linux.dev,
	nikhil.rao@amd.com, edumazet@kernel.org
Subject: Re: [PATCH net-next v4 4/6] ionic: map the FEC type through a helper in ionic_get_fecparam()
Date: Tue, 17 Nov 2026 23:10:28 +0000	[thread overview]
Message-ID: <179495702811.3136.11203317455960639884@kernel.org> (raw)
In-Reply-To: <20261116-ionic-get-fec-stats-v4-4-d25cae9f1e87@amd.com>

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] In drivers/net/ethernet/pensando/ionic/ionic_ethtool.c, the
  refactor changes ionic_get_fecparam() so that it reads the device-…

--

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

This patch moves the mapping from config.fec_type to the 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 says there
is no functional change.

> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index 13b5874fe5ad4..8f0f1585116bc 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]
Could active_fec and fec end up built from two different values of
port_info->config.fec_type here?

The old code loaded config.fec_type once, as the switch expression, and
set both fields from that one value. The new code does two separate
plain loads, one per ionic_fec_type_to_ethtool() call. There is no
local snapshot, no READ_ONCE() and no lock.

port_info is coherent DMA memory shared with the device:

ionic_main.c:ionic_port_init() {
    ...
	idev->port_info = dma_alloc_coherent(ionic->dev,
				     idev->port_info_sz,
				     &idev->port_info_pa,
				     GFP_KERNEL);
    ...
}

Its address is passed to firmware in ionic_dev_cmd_port_init():

	.port_init.info_pa = cpu_to_le64(idev->port_info_pa),

>From that point, firmware writes config.fec_type. RTNL does not
serialize those writes.

If firmware updates the field between the two loads, ethtool --show-fec
could report a configured/active pair that never existed together. The
compiler cannot merge the two loads either: with -fno-strict-aliasing,
the u32 store to fec->active_fec may alias the u8 source.

Given this, is "No functional change" in the commit message quite
accurate?

The later patch in this series, "ionic: report the operational FEC mode
from ethtool --show-fec", rewrites these lines but keeps the double
read. When autoneg is off, ionic_active_fec_type() returns
READ_ONCE(port_info->config.fec_type), and ionic_get_fecparam() then
reads READ_ONCE(port_info->config.fec_type) again for fec->fec.

Would it be simpler to read config.fec_type once into a local u8 and
use that for both fields?

>  
>  	return 0;
>  }

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-ionic-get-fec-stats-v4-0-d25cae9f1e87%40amd.com

  reply	other threads:[~2026-11-17 23:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 23:06 [PATCH net-next v4 0/6] ionic: FEC reporting fixes and .get_fec_stats handler Eric Joyner
2026-11-16 23:06 ` [PATCH net-next v4 1/6] ionic: write the extra_stats invalid markers one counter at a time Eric Joyner
2026-11-16 23:06 ` [PATCH net-next v4 2/6] ionic: report FEC off as a supported link mode Eric Joyner
2026-11-17 23:10   ` netdev-bot+sashiko
2026-11-16 23:06 ` [PATCH net-next v4 3/6] ionic: report the configured FEC mode in ethtool_fecparam.fec Eric Joyner
2026-11-16 23:06 ` [PATCH net-next v4 4/6] ionic: map the FEC type through a helper in ionic_get_fecparam() Eric Joyner
2026-11-17 23:10   ` netdev-bot+sashiko [this message]
2026-11-16 23:06 ` [PATCH net-next v4 5/6] ionic: report the operational FEC mode from ethtool --show-fec Eric Joyner
2026-11-17 23:10   ` netdev-bot+sashiko
2026-11-16 23:06 ` [PATCH net-next v4 6/6] ionic: Add .get_fec_stats ethtool handler Eric Joyner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179495702811.3136.11203317455960639884@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eric.joyner@amd.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikhil.rao@amd.com \
    --cc=pabeni@redhat.com \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox