All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Simon Horman <horms@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 3/9] net: phy: c45: don't accept disabled EEE modes in genphy_c45_ethtool_set_eee
Date: Sat, 11 Jan 2025 15:13:15 +0000	[thread overview]
Message-ID: <Z4KKi2WxSrben9-Z@shell.armlinux.org.uk> (raw)
In-Reply-To: <0212f9e8-8f60-461b-a7fe-bd4054f3689b@gmail.com>

On Sat, Jan 11, 2025 at 02:19:04PM +0100, Heiner Kallweit wrote:
> On 11.01.2025 11:01, Russell King (Oracle) wrote:
> > On Sat, Jan 11, 2025 at 10:44:25AM +0100, Heiner Kallweit wrote:
> >> On 11.01.2025 10:21, Russell King (Oracle) wrote:
> >>> On Sat, Jan 11, 2025 at 10:06:02AM +0100, Heiner Kallweit wrote:
> >>>> Link modes in phydev->eee_disabled_modes are filtered out by
> >>>> genphy_c45_write_eee_adv() and won't be advertised. Therefore
> >>>> don't accept such modes from userspace.
> >>>
> >>> Why do we need this? Surely if the MAC doesn't support modes, then they
> >>> should be filtered out of phydev->supported_eee so that userspace knows
> >>> that the mode is not supported by the network interface as a whole, just
> >>> like we do for phydev->supported.
> >>>
> >>> That would give us the checking here.
> >>>
> >> Removing EEE modes to be disabled from supported_eee is problematic
> >> because of how genphy_c45_write_eee_adv() works.
> >>
> >> Let's say we have a 2.5Gbps PHY and want to disable EEE at 2.5Gbps. If we
> >> remove 2.5Gbps from supported_eee, then the following check is false:
> >> if (linkmode_intersects(phydev->supported_eee, PHY_EEE_CAP2_FEATURES))
> >> What would result in the 2.5Gbps mode not getting disabled.
> > 
> > Ok. Do we at least remove the broken modes from the supported mask
> > reported to userspace?
> > 
> I think that's something we could do in addition, to provide a hint to the
> user about unavailable modes. It wouldn't remove the need for the check here.
> ethtool doesn't check the advertisement against the supported modes.
> And even if it would, we must not rely on input from user space being sane.

I disagree with some of this. Userspace should expect:

- read current settings
- copy supported modes to advertised modes
- write current settings

to work. If it fails, then how does ethtool, or even the user, work out
which link modes are actually supported or not.

If we're introducing a failure on the "disabled" modes, then that is
a user-breaking change, and we need to avoid that. The current code
silently ignored the broken modes, your new code would error out on
the above action - and that's a bug.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2025-01-11 15:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11  9:01 [PATCH net-next 0/9] net: phy: improve phylib EEE handling Heiner Kallweit
2025-01-11  9:02 ` [PATCH net-next 1/9] net: phy: rename eee_broken_modes to eee_disabled_modes Heiner Kallweit
2025-01-11  9:04 ` [PATCH net-next 2/9] net: phy: rename phy_set_eee_broken to phy_disable_eee_mode Heiner Kallweit
2025-01-11  9:06 ` [PATCH net-next 3/9] net: phy: c45: don't accept disabled EEE modes in genphy_c45_ethtool_set_eee Heiner Kallweit
2025-01-11  9:21   ` Russell King (Oracle)
2025-01-11  9:44     ` Heiner Kallweit
2025-01-11 10:01       ` Russell King (Oracle)
2025-01-11 13:19         ` Heiner Kallweit
2025-01-11 15:13           ` Russell King (Oracle) [this message]
2025-01-11 15:33             ` Heiner Kallweit
2025-01-11 17:31               ` Andrew Lunn
2025-01-11 17:52                 ` Heiner Kallweit
2025-01-11  9:06 ` [PATCH net-next 4/9] net: phy: move definition of phy_is_started before phy_disable_eee_mode Heiner Kallweit
2025-01-11  9:07 ` [PATCH net-next 5/9] net: phy: improve phy_disable_eee_mode Heiner Kallweit
2025-01-11 17:38   ` Andrew Lunn
2025-01-11 17:45     ` Russell King (Oracle)
2025-01-11  9:08 ` [PATCH net-next 6/9] net: phy: remove disabled EEE modes from advertising in phy_probe Heiner Kallweit
2025-01-11  9:09 ` [PATCH net-next 7/9] net: phy: c45: Don't silently remove disabled EEE modes any longer when writing advertisement register Heiner Kallweit
2025-01-11  9:10 ` [PATCH net-next 8/9] net: phy: c45: use cached EEE advertisement in genphy_c45_ethtool_get_eee Heiner Kallweit
2025-01-11  9:12 ` [PATCH net-next 9/9] net: phy: c45: remove local advertisement parameter from genphy_c45_eee_is_active Heiner Kallweit

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=Z4KKi2WxSrben9-Z@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.