netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net] net: phylink: actually fix ksettings_set() ethtool call
Date: Thu, 1 Jun 2023 10:05:42 +0100	[thread overview]
Message-ID: <ZHhfZo3ktuRe1CjK@shell.armlinux.org.uk> (raw)
In-Reply-To: <E1q4eC7-00AyAn-6d@rmk-PC.armlinux.org.uk>

Please ignore this, wrong version of the patch. :/ More coffee needed.

On Thu, Jun 01, 2023 at 10:02:07AM +0100, Russell King (Oracle) wrote:
> Raju Lakkaraju reported that the below commit caused a regression
> with Lan743x drivers and a 2.5G SFP. Sadly, this is because the commit
> was utterly wrong. Let's fix this properly by not moving the
> linkmode_and(), but instead copying the link ksettings and then
> modifying the advertising mask before passing the modified link
> ksettings to phylib.
> 
> Fixes: df0acdc59b09 ("net: phylink: fix ksettings_set() ethtool call")
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/phy/phylink.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index e237949deee6..cf4e51e48cdd 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -2225,11 +2225,13 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
>  
>  	ASSERT_RTNL();
>  
> -	/* Mask out unsupported advertisements */
> -	linkmode_and(config.advertising, kset->link_modes.advertising,
> -		     pl->supported);
> -
>  	if (pl->phydev) {
> +		struct ethtool_link_ksettings phy_kset = *kset;
> +
> +		linkmode_and(phy_kset.link_modes.advertising,
> +			     phy_kset.link_modes.advertising,
> +			     pl->supported);
> +
>  		/* We can rely on phylib for this update; we also do not need
>  		 * to update the pl->link_config settings:
>  		 * - the configuration returned via ksettings_get() will come
> @@ -2252,6 +2254,9 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
>  	}
>  
>  	config = pl->link_config;
> +	/* Mask out unsupported advertisements */
> +	linkmode_and(config.advertising, kset->link_modes.advertising,
> +		     pl->supported);
>  
>  	/* FIXME: should we reject autoneg if phy/mac does not support it? */
>  	switch (kset->base.autoneg) {
> -- 
> 2.30.2
> 
> 

-- 
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:[~2023-06-01  9:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01  9:02 [PATCH net] net: phylink: actually fix ksettings_set() ethtool call Russell King (Oracle)
2023-06-01  9:05 ` Russell King (Oracle) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-01  9:12 Russell King (Oracle)
2023-06-03  7:00 ` patchwork-bot+netdevbpf
2023-06-05  5:34 ` Raju Lakkaraju

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=ZHhfZo3ktuRe1CjK@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).