All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: mv88e6xxx: Fix 6095/6097/6185 ports in non-SERDES CMODE
@ 2021-04-26 16:17 Tobias Waldekranz
  2021-04-27 12:41 ` Andrew Lunn
  2021-04-27 21:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Tobias Waldekranz @ 2021-04-26 16:17 UTC (permalink / raw)
  To: davem, kuba; +Cc: andrew, vivien.didelot, f.fainelli, olteanv, netdev

The .serdes_get_lane op used the magic value 0xff to indicate a valid
SERDES lane and 0 signaled that a non-SERDES mode was set on the port.

Unfortunately, "0" is also a valid lane ID, so even when these ports
where configured to e.g. RGMII the driver would set them up as SERDES
ports.

- Replace 0xff with 0 to indicate a valid lane ID. The number is on
  the one hand just as arbitrary, but it is at least the first valid one
  and therefore less of a surprise.

- Follow the other .serdes_get_lane implementations and return -ENODEV
  in the case where no SERDES is assigned to the port.

Fixes: f5be107c3338 ("net: dsa: mv88e6xxx: Support serdes ports on MV88E6097/6095/6185")
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 drivers/net/dsa/mv88e6xxx/serdes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c
index 470856bcd2f3..e4fbef81bc52 100644
--- a/drivers/net/dsa/mv88e6xxx/serdes.c
+++ b/drivers/net/dsa/mv88e6xxx/serdes.c
@@ -443,15 +443,15 @@ int mv88e6185_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane,
 int mv88e6185_serdes_get_lane(struct mv88e6xxx_chip *chip, int port)
 {
 	/* There are no configurable serdes lanes on this switch chip but we
-	 * need to return non-zero so that callers of
+	 * need to return a non-negative lane number so that callers of
 	 * mv88e6xxx_serdes_get_lane() know this is a serdes port.
 	 */
 	switch (chip->ports[port].cmode) {
 	case MV88E6185_PORT_STS_CMODE_SERDES:
 	case MV88E6185_PORT_STS_CMODE_1000BASE_X:
-		return 0xff;
-	default:
 		return 0;
+	default:
+		return -ENODEV;
 	}
 }
 
-- 
2.25.1


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

* Re: [PATCH net-next] net: dsa: mv88e6xxx: Fix 6095/6097/6185 ports in non-SERDES CMODE
  2021-04-26 16:17 [PATCH net-next] net: dsa: mv88e6xxx: Fix 6095/6097/6185 ports in non-SERDES CMODE Tobias Waldekranz
@ 2021-04-27 12:41 ` Andrew Lunn
  2021-04-27 21:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2021-04-27 12:41 UTC (permalink / raw)
  To: Tobias Waldekranz
  Cc: davem, kuba, vivien.didelot, f.fainelli, olteanv, netdev

On Mon, Apr 26, 2021 at 06:17:34PM +0200, Tobias Waldekranz wrote:
> The .serdes_get_lane op used the magic value 0xff to indicate a valid
> SERDES lane and 0 signaled that a non-SERDES mode was set on the port.
> 
> Unfortunately, "0" is also a valid lane ID, so even when these ports
> where configured to e.g. RGMII the driver would set them up as SERDES
> ports.
> 
> - Replace 0xff with 0 to indicate a valid lane ID. The number is on
>   the one hand just as arbitrary, but it is at least the first valid one
>   and therefore less of a surprise.
> 
> - Follow the other .serdes_get_lane implementations and return -ENODEV
>   in the case where no SERDES is assigned to the port.
> 
> Fixes: f5be107c3338 ("net: dsa: mv88e6xxx: Support serdes ports on MV88E6097/6095/6185")
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>

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

    Andrew

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

* Re: [PATCH net-next] net: dsa: mv88e6xxx: Fix 6095/6097/6185 ports in non-SERDES CMODE
  2021-04-26 16:17 [PATCH net-next] net: dsa: mv88e6xxx: Fix 6095/6097/6185 ports in non-SERDES CMODE Tobias Waldekranz
  2021-04-27 12:41 ` Andrew Lunn
@ 2021-04-27 21:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-27 21:10 UTC (permalink / raw)
  To: Tobias Waldekranz
  Cc: davem, kuba, andrew, vivien.didelot, f.fainelli, olteanv, netdev

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 26 Apr 2021 18:17:34 +0200 you wrote:
> The .serdes_get_lane op used the magic value 0xff to indicate a valid
> SERDES lane and 0 signaled that a non-SERDES mode was set on the port.
> 
> Unfortunately, "0" is also a valid lane ID, so even when these ports
> where configured to e.g. RGMII the driver would set them up as SERDES
> ports.
> 
> [...]

Here is the summary with links:
  - [net-next] net: dsa: mv88e6xxx: Fix 6095/6097/6185 ports in non-SERDES CMODE
    https://git.kernel.org/netdev/net-next/c/6066234aa338

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] 3+ messages in thread

end of thread, other threads:[~2021-04-27 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 16:17 [PATCH net-next] net: dsa: mv88e6xxx: Fix 6095/6097/6185 ports in non-SERDES CMODE Tobias Waldekranz
2021-04-27 12:41 ` Andrew Lunn
2021-04-27 21:10 ` patchwork-bot+netdevbpf

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.