Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Cc: Christian Marangi <ansuelsmth@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	kernel@collabora.com, netdev@vger.kernel.org
Subject: Re: [PATCH net 13/14] net: phy: as21xxx: Fix speed and duplex reporting
Date: Mon, 30 Nov 2026 15:01:22 +0100	[thread overview]
Message-ID: <7ce66121-c353-4723-beb4-bb9234ff2671@lunn.ch> (raw)
In-Reply-To: <b2e18939-e254-4fe1-a81d-fcbf583fb0b3@collabora.com>

On Mon, Nov 30, 2026 at 02:21:12PM +0200, Cristian Ciocaltea wrote:
> On 11/30/26 5:50 AM, Andrew Lunn wrote:
> > On Mon, Nov 30, 2026 at 02:55:20AM +0200, Cristian Ciocaltea wrote:
> >> With autoneg enabled, as21xxx_read_status() derives the result purely in
> >> software via phy_resolve_aneg_linkmode().  That does not work reliably
> >> here: the advertisement is driven by the firmware over IPC, which
> >> ignores the Clause 45 AN registers phylib writes except for the maximum
> >> speed, and arbitrary subsets of speeds are not supported.
> > 
> > So the firmware is totally FUBAR?
> > 
> > So autoneg does not work, other than for a single link mode? This
> > suggests you are setting phydev->supported wrongly. It should have a
> > single link mode in it, the top speed the PHY supports.
> > 
> > phylib should then do the correct thing, it will only let the user
> > select that one link mode for advertisement.
> 
> As previously discussed, the root cause of all this unexpected behavior is the
> firmware limitation: it cannot handle arbitrary subsets of speeds and always
> advertises the full range, from the minimum supported speed up to the top one
> (the only limit that can be enforced).
> 
> aeon$ ethtool -s eth1 autoneg on advertise 0x800000000000   # 2.5G
> 
> peer$ ethtool enp0s13f0u1
> 	Link partner advertised link modes:  100baseT/Full
> 	                                     1000baseT/Full
> 	                                     2500baseT/Full

What happens if you return -EOPNOTSUPP here? Does it make it back to
userspace?

I don't think it is guaranteed to. This is probably the first PHY
which is broken like this, all other vendors are capable of reading
802.3. So we don't have support in phylib for this sort of brokenness.

Maybe add a new op to struct phy_device:

/**
 * @validate_aneg: Validate that the PHY can actually advertise this valid
 * combination of link modes.
 * Return 0 if it can, -EOPNOTSUPP if the PHY is broken and cannot.
 */
 int (validate_aneg)(struct phy_device *phydev, unsigned long *advertisement);

Call it in phy_ethtool_ksettings_set() when not NULL.

	Andrew

  reply	other threads:[~2026-11-30 14:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  0:55 [PATCH net 00/14] net: phy: as21xxx: Fix a batch of driver issues Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 01/14] net: phy: as21xxx: handle stale link status during autoneg Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 02/14] net: phy: as21xxx: handle odd firmware on loading Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 03/14] net: phy: as21xxx: Fix LED index bounds check Cristian Ciocaltea
2026-11-30  2:37   ` Andrew Lunn
2026-11-30 10:35     ` Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 04/14] net: phy: as21xxx: Use the correct mask for the speed status Cristian Ciocaltea
2026-11-30  2:39   ` Andrew Lunn
2026-11-30  0:55 ` [PATCH net 05/14] net: phy: as21xxx: Correct the 10M speed status value Cristian Ciocaltea
2026-11-30  2:40   ` Andrew Lunn
2026-11-30  0:55 ` [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer Cristian Ciocaltea
2026-11-30  2:49   ` Andrew Lunn
2026-11-30 10:53     ` Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 07/14] net: phy: as21xxx: Write IPC payload under ipc_lock Cristian Ciocaltea
2026-11-30  2:53   ` Andrew Lunn
2026-11-30 11:09     ` Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 08/14] net: phy: as21xxx: Handle IPC payload write errors Cristian Ciocaltea
2026-11-30  2:54   ` Andrew Lunn
2026-11-30  0:55 ` [PATCH net 09/14] net: phy: as21xxx: Reject odd IPC payload lengths Cristian Ciocaltea
2026-11-30  2:55   ` Andrew Lunn
2026-11-30  0:55 ` [PATCH net 10/14] net: phy: as21xxx: Fix LED hw control set for unsupported rules Cristian Ciocaltea
2026-11-30  3:01   ` Andrew Lunn
2026-11-30 11:29     ` Cristian Ciocaltea
2026-11-30 13:37       ` Andrew Lunn
2026-11-30  0:55 ` [PATCH net 11/14] net: phy: as21xxx: Read 10/100/1000 link modes from C22 advertisement Cristian Ciocaltea
2026-11-30  3:34   ` Andrew Lunn
2026-11-30 11:53     ` Cristian Ciocaltea
2026-11-30 13:39       ` Andrew Lunn
2026-11-30  0:55 ` [PATCH net 12/14] net: phy: as21xxx: Configure autoneg advertisement via IPC Cristian Ciocaltea
2026-11-30  3:43   ` Andrew Lunn
2026-11-30 12:05     ` Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 13/14] net: phy: as21xxx: Fix speed and duplex reporting Cristian Ciocaltea
2026-11-30  3:50   ` Andrew Lunn
2026-11-30 12:21     ` Cristian Ciocaltea
2026-11-30 14:01       ` Andrew Lunn [this message]
2026-11-30  0:55 ` [PATCH net 14/14] net: phy: as21xxx: Release reset before reading ID in match Cristian Ciocaltea
2026-11-30  3:53   ` Andrew Lunn
2026-11-30 12:22     ` Cristian Ciocaltea

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=7ce66121-c353-4723-beb4-bb9234ff2671@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@collabora.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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