* [PATCH net] net: phylink: actually fix ksettings_set() ethtool call
@ 2023-06-01 9:02 Russell King (Oracle)
2023-06-01 9:05 ` Russell King (Oracle)
0 siblings, 1 reply; 5+ messages in thread
From: Russell King (Oracle) @ 2023-06-01 9:02 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] net: phylink: actually fix ksettings_set() ethtool call
2023-06-01 9:02 Russell King (Oracle)
@ 2023-06-01 9:05 ` Russell King (Oracle)
0 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2023-06-01 9:05 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
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!
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net] net: phylink: actually fix ksettings_set() ethtool call
@ 2023-06-01 9:12 Russell King (Oracle)
2023-06-03 7:00 ` patchwork-bot+netdevbpf
2023-06-05 5:34 ` Raju Lakkaraju
0 siblings, 2 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2023-06-01 9:12 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Raju.Lakkaraju
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
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>
---
Raju,
Given the number of cockups I've made with this so far, it would be a
really good idea if you can explicitly test this patch and provide a
tested-by. Also it would be good to have a reported-by as well.
Thanks.
drivers/net/phy/phylink.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index e237949deee6..b4831110003c 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
@@ -2248,10 +2250,13 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
* the presence of a PHY, this should not be changed as that
* should be determined from the media side advertisement.
*/
- return phy_ethtool_ksettings_set(pl->phydev, kset);
+ return phy_ethtool_ksettings_set(pl->phydev, &phy_kset);
}
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] net: phylink: actually fix ksettings_set() ethtool call
2023-06-01 9:12 [PATCH net] net: phylink: actually fix ksettings_set() ethtool call Russell King (Oracle)
@ 2023-06-03 7:00 ` patchwork-bot+netdevbpf
2023-06-05 5:34 ` Raju Lakkaraju
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-03 7:00 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, Raju.Lakkaraju, davem, edumazet, kuba, pabeni,
netdev
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 01 Jun 2023 10:12:06 +0100 you 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.
>
> [...]
Here is the summary with links:
- [net] net: phylink: actually fix ksettings_set() ethtool call
https://git.kernel.org/netdev/net/c/03c44a21d033
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net: phylink: actually fix ksettings_set() ethtool call
2023-06-01 9:12 [PATCH net] net: phylink: actually fix ksettings_set() ethtool call Russell King (Oracle)
2023-06-03 7:00 ` patchwork-bot+netdevbpf
@ 2023-06-05 5:34 ` Raju Lakkaraju
1 sibling, 0 replies; 5+ messages in thread
From: Raju Lakkaraju @ 2023-06-05 5:34 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev
The 06/01/2023 10:12, Russell King (Oracle) wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> 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>
> ---
> Raju,
>
> Given the number of cockups I've made with this so far, it would be a
> really good idea if you can explicitly test this patch and provide a
> tested-by. Also it would be good to have a reported-by as well.
Tested this patch with 1G Speed Cu SFP (Axcen Photonics - AXGT-R1T4-05I1) with
different speeds (1G/100M/10M bps) changes.. Working as expected.
Tested-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Reported-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Thanks,
Raju
>
> Thanks.
>
> drivers/net/phy/phylink.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index e237949deee6..b4831110003c 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
> @@ -2248,10 +2250,13 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
> * the presence of a PHY, this should not be changed as that
> * should be determined from the media side advertisement.
> */
> - return phy_ethtool_ksettings_set(pl->phydev, kset);
> + return phy_ethtool_ksettings_set(pl->phydev, &phy_kset);
> }
>
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-05 5:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-01 9:12 [PATCH net] net: phylink: actually fix ksettings_set() ethtool call Russell King (Oracle)
2023-06-03 7:00 ` patchwork-bot+netdevbpf
2023-06-05 5:34 ` Raju Lakkaraju
-- strict thread matches above, loose matches on Subject: below --
2023-06-01 9:02 Russell King (Oracle)
2023-06-01 9:05 ` Russell King (Oracle)
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).