2021-10-18 03:47:16

by Erik Ekman

[permalink] [raw]
Subject: [PATCH] sfc: Fix reading non-legacy supported link modes

Everything except the first 32 bits was lost when the pause flags were
added. This makes the 50000baseCR2 mode flag (bit 34) not appear.

I have tested this with a 10G card (SFN5122F-R7) by modifying it to
return a non-legacy link mode (10000baseCR).

Signed-off-by: Erik Ekman <[email protected]>
---
drivers/net/ethernet/sfc/ethtool_common.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ethtool_common.c b/drivers/net/ethernet/sfc/ethtool_common.c
index bf1443539a1a..bd552c7dffcb 100644
--- a/drivers/net/ethernet/sfc/ethtool_common.c
+++ b/drivers/net/ethernet/sfc/ethtool_common.c
@@ -563,20 +563,14 @@ int efx_ethtool_get_link_ksettings(struct net_device *net_dev,
{
struct efx_nic *efx = netdev_priv(net_dev);
struct efx_link_state *link_state = &efx->link_state;
- u32 supported;

mutex_lock(&efx->mac_lock);
efx_mcdi_phy_get_link_ksettings(efx, cmd);
mutex_unlock(&efx->mac_lock);

/* Both MACs support pause frames (bidirectional and respond-only) */
- ethtool_convert_link_mode_to_legacy_u32(&supported,
- cmd->link_modes.supported);
-
- supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
-
- ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
- supported);
+ ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
+ ethtool_link_ksettings_add_link_mode(cmd, supported, Asym_Pause);

if (LOOPBACK_INTERNAL(efx)) {
cmd->base.speed = link_state->speed;
--
2.31.1


2021-10-18 13:35:30

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH] sfc: Fix reading non-legacy supported link modes

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <[email protected]>:

On Sun, 17 Oct 2021 19:16:57 +0200 you wrote:
> Everything except the first 32 bits was lost when the pause flags were
> added. This makes the 50000baseCR2 mode flag (bit 34) not appear.
>
> I have tested this with a 10G card (SFN5122F-R7) by modifying it to
> return a non-legacy link mode (10000baseCR).
>
> Signed-off-by: Erik Ekman <[email protected]>
>
> [...]

Here is the summary with links:
- sfc: Fix reading non-legacy supported link modes
https://git.kernel.org/netdev/net-next/c/041c61488236

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html


2021-10-19 15:25:18

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH] sfc: Fix reading non-legacy supported link modes

On Sun, Oct 17, 2021 at 07:16:57PM +0200, Erik Ekman wrote:
> Everything except the first 32 bits was lost when the pause flags were
> added. This makes the 50000baseCR2 mode flag (bit 34) not appear.
>
> I have tested this with a 10G card (SFN5122F-R7) by modifying it to
> return a non-legacy link mode (10000baseCR).

Does this need a Fixes: tag? Should it be added to stable?

Andrew

2021-10-19 17:47:26

by Erik Ekman

[permalink] [raw]
Subject: Re: [PATCH] sfc: Fix reading non-legacy supported link modes

On Tue, 19 Oct 2021 at 17:21, Andrew Lunn <[email protected]> wrote:
>
> On Sun, Oct 17, 2021 at 07:16:57PM +0200, Erik Ekman wrote:
> > Everything except the first 32 bits was lost when the pause flags were
> > added. This makes the 50000baseCR2 mode flag (bit 34) not appear.
> >
> > I have tested this with a 10G card (SFN5122F-R7) by modifying it to
> > return a non-legacy link mode (10000baseCR).
>
> Does this need a Fixes: tag? Should it be added to stable?
>

The speed flags in use that can be lost are for 50G and 100G.
The affected devices are ones based on the Solarflare EF100 networking
IP in Xilinx FPGAs supporting 10/25/40/100-gigabit.
I don't know how widespread these are, and if there might be enough
users for adding this to stable.

The gsettings api code for sfc was added in 7cafe8f82438ced6d ("net:
sfc: use new api ethtool_{get|set}_link_ksettings")
and the bug was introduced then, but bits would only be lost after
support for 25/50/100G was added in
5abb5e7f916ee8d2d ("sfc: add bits for 25/50/100G supported/advertised speeds").
Not sure which of these should be used for a Fixes tag.

I only noticed this because I was using newer flags for signaling
1G/10G fibre support in my other patch.

Thanks
/Erik

2021-10-19 18:31:28

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH] sfc: Fix reading non-legacy supported link modes

On Tue, Oct 19, 2021 at 07:41:46PM +0200, Erik Ekman wrote:
> On Tue, 19 Oct 2021 at 17:21, Andrew Lunn <[email protected]> wrote:
> >
> > On Sun, Oct 17, 2021 at 07:16:57PM +0200, Erik Ekman wrote:
> > > Everything except the first 32 bits was lost when the pause flags were
> > > added. This makes the 50000baseCR2 mode flag (bit 34) not appear.
> > >
> > > I have tested this with a 10G card (SFN5122F-R7) by modifying it to
> > > return a non-legacy link mode (10000baseCR).
> >
> > Does this need a Fixes: tag? Should it be added to stable?
> >
>
> The speed flags in use that can be lost are for 50G and 100G.
> The affected devices are ones based on the Solarflare EF100 networking
> IP in Xilinx FPGAs supporting 10/25/40/100-gigabit.
> I don't know how widespread these are, and if there might be enough
> users for adding this to stable.
>
> The gsettings api code for sfc was added in 7cafe8f82438ced6d ("net:
> sfc: use new api ethtool_{get|set}_link_ksettings")
> and the bug was introduced then, but bits would only be lost after
> support for 25/50/100G was added in
> 5abb5e7f916ee8d2d ("sfc: add bits for 25/50/100G supported/advertised speeds").
> Not sure which of these should be used for a Fixes tag.

I would you this second one, since that is when it becomes visible to
users.

Andrew

2021-10-25 20:13:22

by Erik Ekman

[permalink] [raw]
Subject: Re: [PATCH] sfc: Fix reading non-legacy supported link modes

On Mon, 25 Oct 2021 at 20:58, Erik Ekman <[email protected]> wrote:
>
> On Tue, 19 Oct 2021 at 20:29, Andrew Lunn <[email protected]> wrote:
> >
> > On Tue, Oct 19, 2021 at 07:41:46PM +0200, Erik Ekman wrote:
> > > On Tue, 19 Oct 2021 at 17:21, Andrew Lunn <[email protected]> wrote:
> > > >
> > > > On Sun, Oct 17, 2021 at 07:16:57PM +0200, Erik Ekman wrote:
> > > > > Everything except the first 32 bits was lost when the pause flags were
> > > > > added. This makes the 50000baseCR2 mode flag (bit 34) not appear.
> > > > >
> > > > > I have tested this with a 10G card (SFN5122F-R7) by modifying it to
> > > > > return a non-legacy link mode (10000baseCR).
> > > >
> > > > Does this need a Fixes: tag? Should it be added to stable?
> > > >
> > >
> > > The speed flags in use that can be lost are for 50G and 100G.
> > > The affected devices are ones based on the Solarflare EF100 networking
> > > IP in Xilinx FPGAs supporting 10/25/40/100-gigabit.
> > > I don't know how widespread these are, and if there might be enough
> > > users for adding this to stable.
> > >
> > > The gsettings api code for sfc was added in 7cafe8f82438ced6d ("net:
> > > sfc: use new api ethtool_{get|set}_link_ksettings")
> > > and the bug was introduced then, but bits would only be lost after
> > > support for 25/50/100G was added in
> > > 5abb5e7f916ee8d2d ("sfc: add bits for 25/50/100G supported/advertised speeds").
> > > Not sure which of these should be used for a Fixes tag.
> >
> > I would you this second one, since that is when it becomes visible to
> > users.
> >
> Thanks
>
> I found that the SFC9250 is also affected (it supports 10/25/40/50/100G)
>
> Fixes: 5abb5e7f916ee8 ("sfc: add bits for 25/50/100G
> supported/advertised speeds")
>
> /Erik

I see that the other patch adding new modes (c62041c5baa9d, "sfc:
Export fibre-specific supported link mode") has been merged to net
(and upstream), so this is needed there as well.

/Erik

2021-10-25 21:51:49

by Erik Ekman

[permalink] [raw]
Subject: Re: [PATCH] sfc: Fix reading non-legacy supported link modes

On Tue, 19 Oct 2021 at 20:29, Andrew Lunn <[email protected]> wrote:
>
> On Tue, Oct 19, 2021 at 07:41:46PM +0200, Erik Ekman wrote:
> > On Tue, 19 Oct 2021 at 17:21, Andrew Lunn <[email protected]> wrote:
> > >
> > > On Sun, Oct 17, 2021 at 07:16:57PM +0200, Erik Ekman wrote:
> > > > Everything except the first 32 bits was lost when the pause flags were
> > > > added. This makes the 50000baseCR2 mode flag (bit 34) not appear.
> > > >
> > > > I have tested this with a 10G card (SFN5122F-R7) by modifying it to
> > > > return a non-legacy link mode (10000baseCR).
> > >
> > > Does this need a Fixes: tag? Should it be added to stable?
> > >
> >
> > The speed flags in use that can be lost are for 50G and 100G.
> > The affected devices are ones based on the Solarflare EF100 networking
> > IP in Xilinx FPGAs supporting 10/25/40/100-gigabit.
> > I don't know how widespread these are, and if there might be enough
> > users for adding this to stable.
> >
> > The gsettings api code for sfc was added in 7cafe8f82438ced6d ("net:
> > sfc: use new api ethtool_{get|set}_link_ksettings")
> > and the bug was introduced then, but bits would only be lost after
> > support for 25/50/100G was added in
> > 5abb5e7f916ee8d2d ("sfc: add bits for 25/50/100G supported/advertised speeds").
> > Not sure which of these should be used for a Fixes tag.
>
> I would you this second one, since that is when it becomes visible to
> users.
>
Thanks

I found that the SFC9250 is also affected (it supports 10/25/40/50/100G)

Fixes: 5abb5e7f916ee8 ("sfc: add bits for 25/50/100G
supported/advertised speeds")

/Erik