public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: <markus.stockhausen@gmx.de>
To: "'Andrew Lunn'" <andrew@lunn.ch>
Cc: <linux@armlinux.org.uk>, <hkallweit1@gmail.com>,
	<netdev@vger.kernel.org>,
	"'Jonas Jelonek'" <jelonek.jonas@gmail.com>, <jan@3e8.eu>,
	<nbd@nbd.name>, "'Daniel Golle'" <daniel@makrotopia.org>
Subject: AW: pre-boot plugged SFP autoneg advertisement
Date: Mon, 20 Apr 2026 18:16:34 +0200	[thread overview]
Message-ID: <007701dcd0e1$11c45210$354cf630$@gmx.de> (raw)
In-Reply-To: 

> Von: markus.stockhausen@gmx.de <markus.stockhausen@gmx.de> 
> Gesendet: Sonntag, 19. April 2026 10:49
> An: 'Andrew Lunn' <andrew@lunn.ch>
> Betreff: AW: pre-boot plugged SFP autoneg advertisement
>
> Took that hint/question and digged deeper. Added further debug
> to each and every linkmode_copy. I think I found the culprit in 
> a userspace ethtool call. For now I assume OpenWrt netifd.

Hi Andrew,

once again thanks for your help. After further investigation I hopefully can
add 
more details. I think I got the whole picture now. So some additional
background 
information about the environment. 

- Realtek RTL930x devices with SFP+ module slots
- These are driven directly by a SerDes (controlled by downstream PCS
driver)
- The DTS reads

	port11: port@11 { 
		reg = <11>;
		label = "lan12" ;
		pcs-handle = <&serdes8>;
		phy-mode = "1000base-x";
		sfp = <&sfp1>;
		managed = "in-band-status";
	};

Sequence of events during boot is as follows:

- SFP module is already inserted (in my case 1G)
- phylink_sfp_config_phy() runs long before any network config starts
- OpenWrt netifd daemon starts and wants to configure the network interfaces
- It reads current settings via ethtool ioctl and gets autoneg=off
- It writes basic config values via ethtool ioctl including autneg=off
- Later on it starts the interface and phylink_start() is issued

With my limited knowledge I would patch phylink_ethtool_ksettings_get().

		/* The MAC is reporting the link results from its own PCS
		 * layer via in-band status. Report these as the current
		 * link settings.
		 */
		phylink_get_ksettings(&link_state, kset);
		break;

+	case MLO_AN_PHY:
+		/* SFP module present at boot but phylink not yet started.
+		 * Return autonegotiation as set by
phylink_sfp_config_phy().
+		 */
+		if (pl->sfp_bus && !pl->phydev)
+			kset->base.autoneg =
+
linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
+
pl->link_config.advertising)
+				? AUTONEG_ENABLE : AUTONEG_DISABLE;
+		break;
	}

	return 0;
}

This comes from the observation that

- pl->link_config.advertising is filled by phylink_sfp_set_config()
- state MLO_AN_PHY is reported before phylink_start()
- state MLO_AN_INBAND is reported after phylink_start()

Is this reasonable or am I totally off?

Markus



  parent reply	other threads:[~2026-04-20 16:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-18  9:27 pre-boot plugged SFP autoneg advertisement markus.stockhausen
2026-04-18 15:25 ` Andrew Lunn
2026-04-19  8:49   ` AW: " markus.stockhausen
2026-04-20 16:16   ` markus.stockhausen [this message]
2026-04-20 17:57     ` Andrew Lunn
2026-04-20 19:10       ` AW: " markus.stockhausen

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='007701dcd0e1$11c45210$354cf630$@gmx.de' \
    --to=markus.stockhausen@gmx.de \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=hkallweit1@gmail.com \
    --cc=jan@3e8.eu \
    --cc=jelonek.jonas@gmail.com \
    --cc=linux@armlinux.org.uk \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    /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