All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: tc35815: Fix phydev supported/advertising mask
@ 2020-04-27  2:00 Anthony Felice
  2020-04-27  9:10 ` Heiner Kallweit
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anthony Felice @ 2020-04-27  2:00 UTC (permalink / raw)
  Cc: Anthony Felice, Akshay Bhat, David S. Miller, Heiner Kallweit,
	Srinivas Kandagatla, Nathan Chancellor, Rob Herring,
	Suzuki K Poulose, Michael S. Tsirkin, Andrew Lunn, netdev,
	linux-kernel

Commit 3c1bcc8614db ("net: ethernet: Convert phydev advertize and
supported from u32 to link mode") updated ethernet drivers to use a
linkmode bitmap. It mistakenly dropped a bitwise negation in the
tc35815 ethernet driver on a bitmask to set the supported/advertising
flags.

Found by Anthony via code inspection, not tested as I do not have the
required hardware.

Fixes: 3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported from u32 to link mode")
Signed-off-by: Anthony Felice <tony.felice@timesys.com>
Reviewed-by: Akshay Bhat <akshay.bhat@timesys.com>
---
 drivers/net/ethernet/toshiba/tc35815.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
index 3fd43d30b20d..a1066fbb93b5 100644
--- a/drivers/net/ethernet/toshiba/tc35815.c
+++ b/drivers/net/ethernet/toshiba/tc35815.c
@@ -643,7 +643,7 @@ static int tc_mii_probe(struct net_device *dev)
 		linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, mask);
 		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, mask);
 	}
-	linkmode_and(phydev->supported, phydev->supported, mask);
+	linkmode_andnot(phydev->supported, phydev->supported, mask);
 	linkmode_copy(phydev->advertising, phydev->supported);
 
 	lp->link = 0;

base-commit: 55b2af1c23eb12663015998079992f79fdfa56c8
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: tc35815: Fix phydev supported/advertising mask
  2020-04-27  2:00 [PATCH] net: tc35815: Fix phydev supported/advertising mask Anthony Felice
@ 2020-04-27  9:10 ` Heiner Kallweit
  2020-04-27 12:37 ` Andrew Lunn
  2020-04-27 18:52 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2020-04-27  9:10 UTC (permalink / raw)
  To: Anthony Felice
  Cc: Akshay Bhat, David S. Miller, Srinivas Kandagatla,
	Nathan Chancellor, Rob Herring, Suzuki K Poulose,
	Michael S. Tsirkin, Andrew Lunn, netdev, linux-kernel

On 27.04.2020 04:00, Anthony Felice wrote:
> Commit 3c1bcc8614db ("net: ethernet: Convert phydev advertize and
> supported from u32 to link mode") updated ethernet drivers to use a
> linkmode bitmap. It mistakenly dropped a bitwise negation in the
> tc35815 ethernet driver on a bitmask to set the supported/advertising
> flags.
> 
> Found by Anthony via code inspection, not tested as I do not have the
> required hardware.
> 
> Fixes: 3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported from u32 to link mode")
> Signed-off-by: Anthony Felice <tony.felice@timesys.com>
> Reviewed-by: Akshay Bhat <akshay.bhat@timesys.com>
> ---
>  drivers/net/ethernet/toshiba/tc35815.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
> index 3fd43d30b20d..a1066fbb93b5 100644
> --- a/drivers/net/ethernet/toshiba/tc35815.c
> +++ b/drivers/net/ethernet/toshiba/tc35815.c
> @@ -643,7 +643,7 @@ static int tc_mii_probe(struct net_device *dev)
>  		linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, mask);
>  		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, mask);
>  	}
> -	linkmode_and(phydev->supported, phydev->supported, mask);
> +	linkmode_andnot(phydev->supported, phydev->supported, mask);
>  	linkmode_copy(phydev->advertising, phydev->supported);
>  
>  	lp->link = 0;
> 
> base-commit: 55b2af1c23eb12663015998079992f79fdfa56c8
> 
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>

The complete structure of this code is quite weird (e.g. using module
parameters to force a link mode), but the driver seems to be too old
that anybody would spend effort on refactoring it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: tc35815: Fix phydev supported/advertising mask
  2020-04-27  2:00 [PATCH] net: tc35815: Fix phydev supported/advertising mask Anthony Felice
  2020-04-27  9:10 ` Heiner Kallweit
@ 2020-04-27 12:37 ` Andrew Lunn
  2020-04-27 18:52 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2020-04-27 12:37 UTC (permalink / raw)
  To: Anthony Felice
  Cc: Akshay Bhat, David S. Miller, Heiner Kallweit,
	Srinivas Kandagatla, Nathan Chancellor, Rob Herring,
	Suzuki K Poulose, Michael S. Tsirkin, netdev, linux-kernel

On Sun, Apr 26, 2020 at 10:00:59PM -0400, Anthony Felice wrote:
> Commit 3c1bcc8614db ("net: ethernet: Convert phydev advertize and
> supported from u32 to link mode") updated ethernet drivers to use a
> linkmode bitmap. It mistakenly dropped a bitwise negation in the
> tc35815 ethernet driver on a bitmask to set the supported/advertising
> flags.
> 
> Found by Anthony via code inspection, not tested as I do not have the
> required hardware.
> 
> Fixes: 3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported from u32 to link mode")
> Signed-off-by: Anthony Felice <tony.felice@timesys.com>
> Reviewed-by: Akshay Bhat <akshay.bhat@timesys.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Thanks.

    Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: tc35815: Fix phydev supported/advertising mask
  2020-04-27  2:00 [PATCH] net: tc35815: Fix phydev supported/advertising mask Anthony Felice
  2020-04-27  9:10 ` Heiner Kallweit
  2020-04-27 12:37 ` Andrew Lunn
@ 2020-04-27 18:52 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-04-27 18:52 UTC (permalink / raw)
  To: tony.felice
  Cc: akshay.bhat, hkallweit1, srinivas.kandagatla, natechancellor,
	robh, suzuki.poulose, mst, andrew, netdev, linux-kernel

From: Anthony Felice <tony.felice@timesys.com>
Date: Sun, 26 Apr 2020 22:00:59 -0400

> Commit 3c1bcc8614db ("net: ethernet: Convert phydev advertize and
> supported from u32 to link mode") updated ethernet drivers to use a
> linkmode bitmap. It mistakenly dropped a bitwise negation in the
> tc35815 ethernet driver on a bitmask to set the supported/advertising
> flags.
> 
> Found by Anthony via code inspection, not tested as I do not have the
> required hardware.
> 
> Fixes: 3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported from u32 to link mode")
> Signed-off-by: Anthony Felice <tony.felice@timesys.com>
> Reviewed-by: Akshay Bhat <akshay.bhat@timesys.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-27 18:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27  2:00 [PATCH] net: tc35815: Fix phydev supported/advertising mask Anthony Felice
2020-04-27  9:10 ` Heiner Kallweit
2020-04-27 12:37 ` Andrew Lunn
2020-04-27 18:52 ` David Miller

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.