Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: anthony.l.nguyen@intel.com
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@kernel.org, andrew+netdev@lunn.ch, willemb@google.com,
	netdev@vger.kernel.org, paweldembicki@gmail.com,
	dima.ruinskiy@intel.com, pavankumaryalagada@gmail.com,
	sx.rinitha@intel.com
Subject: Re: [PATCH net-next 3/4] igb: read SFP module EEPROM through igb_read_sfp_data_byte
Date: Fri, 04 Dec 2026 01:07:52 +0000	[thread overview]
Message-ID: <179634647206.3146.4055667285712409963@kernel.org> (raw)
In-Reply-To: <20261203005042.348952-4-anthony.l.nguyen@intel.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] Series ordering creates a bisect window, and the commit message
  gives no context for it.
- [Low] igb_get_module_eeprom()
  (drivers/net/ethernet/intel/igb/igb_ethtool.c) now does one I2CCMD…

--

igb: read SFP module EEPROM through igb_read_sfp_data_byte

This patch moves igb_get_module_info() and igb_get_module_eeprom() off
igb_read_phy_reg_i2c(), which addresses the external PHY register space.
They now use igb_read_sfp_data_byte(), which addresses the SFP module
EEPROM. The module EEPROM is read one byte at a time through I2CCMD.

> igb_get_module_info() and igb_get_module_eeprom() use
> igb_read_phy_reg_i2c(), which accesses the external PHY register space.
> On designs with an external SGMII PHY this returns PHY register contents
> instead of the SFP module EEPROM requested by ethtool -m.

[Severity: Low]
Can this problem be reached before the previous patch in this series,
"igb: detect M88E1112 100BASE-FX SGMII mode"?

Before that patch, igb_init_phy_params_82575() returned early for any
non-copper media. So phy->addr was never pointed at an external PHY while
media_type was serdes:

drivers/net/ethernet/intel/igb/e1000_82575.c:igb_init_phy_params_82575() {
    ...
	if (hw->phy.media_type != e1000_media_type_copper) {
		phy->type = e1000_phy_none;
		goto out;
	}
    ...
}

The previous patch adds a 100BASE-FX branch. It switches to serdes after
igb_get_phy_id_82575() has already set phy->addr to the M88E1112 address:

	} else if (data == E1000_M88E1112_100BASE_FX) {
		...
		hw->phy.media_type =
			e1000_media_type_internal_serdes;

igb_get_module_info() and igb_get_module_eeprom() return -EOPNOTSUPP for
copper and unknown media. So these external SGMII PHY designs seem to reach
the old igb_read_phy_reg_i2c() path only after that patch is applied.

Consider an M88E1112 strapped for 100BASE-FX at that intermediate commit.
ethtool -m would report M88E1112 registers as module EEPROM data. It would
also choose SFF-8079 or SFF-8472 based on PHY registers 0x5C/0x5E.

Could this patch come before the 100BASE-FX detection patch? Could the
commit message also say which change makes this path reachable?

One case is unconfirmed. After a MAS media swap, get_invariants runs again
and igb_init_phy_params_82575() returns early, which might leave a stale
phy->addr. If that path can reach ethtool -m, the problem is older than
this series, and a Fixes: tag for stable may be appropriate.

> diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
> index ccc7302dc7bdb..12d449bb062ee 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c

[ ... ]

> @@ -3250,36 +3254,17 @@ static int igb_get_module_eeprom(struct net_device *netdev,
>  	struct igb_adapter *adapter = netdev_priv(netdev);
>  	struct e1000_hw *hw = &adapter->hw;
>  	u32 status = 0;
> -	u16 *dataword;
> -	u16 first_word, last_word;
>  	int i = 0;
>  
>  	if (ee->len == 0)
>  		return -EINVAL;
>  
> -	first_word = ee->offset >> 1;
> -	last_word = (ee->offset + ee->len - 1) >> 1;
> -
> -	dataword = kmalloc_objs(u16, last_word - first_word + 1);
> -	if (!dataword)
> -		return -ENOMEM;
> -
> -	/* Read EEPROM block, SFF-8079/SFF-8472, word at a time */
> -	for (i = 0; i < last_word - first_word + 1; i++) {
> -		status = igb_read_phy_reg_i2c(hw, (first_word + i) * 2,
> -					      &dataword[i]);
> -		if (status) {
> -			/* Error occurred while reading module */
> -			kfree(dataword);
> +	for (i = 0; i < ee->len; i++) {
> +		status = igb_read_sfp_data_byte(hw, ee->offset + i, &data[i]);

[Severity: Low]
Does this double the number of busy-waited I2CCMD transactions in
igb_get_module_eeprom()?

For a full dump with ee->len = ETH_MODULE_SFF_8472_LEN (512), this loop
issues 512 I2CCMD reads. The old word loop issued 256. Each read polls in
igb_read_sfp_data_byte():

	for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) {
		udelay(50);
		data_local = rd32(E1000_I2CCMD);
		if (data_local & E1000_I2CCMD_READY)
			break;
	}

This ethtool op runs with RTNL held.

Each I2CCMD read returns two bytes. The old code used both, one from bits
7:0 and one from bits 15:8. igb_read_sfp_data_byte() keeps only bits 7:0
and drops the other byte.

Could the module EEPROM still be read a word at a time from the SFP
address space? That would avoid the extra busy-wait time for ethtool -m.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203005042.348952-1-anthony.l.nguyen%40intel.com

  reply	other threads:[~2026-12-04  1:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  0:50 [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) Tony Nguyen
2026-12-03  0:50 ` [PATCH net-next 1/4] igc: Support ACPI-based MAC passthrough Tony Nguyen
2026-12-04  1:07   ` netdev-bot+sashiko
2026-12-04  1:28     ` Andrew Lunn
2026-12-03  0:50 ` [PATCH net-next 2/4] igb: detect M88E1112 100BASE-FX SGMII mode Tony Nguyen
2026-12-04  1:07   ` netdev-bot+sashiko
2026-12-03  0:50 ` [PATCH net-next 3/4] igb: read SFP module EEPROM through igb_read_sfp_data_byte Tony Nguyen
2026-12-04  1:07   ` netdev-bot+sashiko [this message]
2026-12-03  0:50 ` [PATCH net-next 4/4] e100: prevent shift-out-of-bounds in EEPROM access Tony Nguyen
2026-12-04  1:07   ` netdev-bot+sashiko
2026-12-03  0:53 ` [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) netdev-bot+sinfo

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=179634647206.3146.4055667285712409963@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=dima.ruinskiy@intel.com \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavankumaryalagada@gmail.com \
    --cc=paweldembicki@gmail.com \
    --cc=sx.rinitha@intel.com \
    --cc=willemb@google.com \
    /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