* [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link
2024-07-03 13:28 [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Oleksij Rempel
@ 2024-07-03 13:28 ` Oleksij Rempel
2024-07-03 14:01 ` Michal Kubiak
2024-07-03 18:57 ` Andrew Lunn
2024-07-03 14:00 ` [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Michal Kubiak
` (3 subsequent siblings)
4 siblings, 2 replies; 9+ messages in thread
From: Oleksij Rempel @ 2024-07-03 13:28 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Woojung Huh, Arun Ramadoss,
Heiner Kallweit, Russell King, Yuiko Oshino
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver
Do not report SQI if no link is detected. Otherwise ethtool will show
non zero value even if no cable is attached.
Fixes: b649695248b15 ("net: phy: LAN87xx: add ethtool SQI support")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/phy/microchip_t1.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index a35528497a576..22530a5b76365 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -840,6 +840,9 @@ static int lan87xx_get_sqi(struct phy_device *phydev)
u8 sqi_value = 0;
int rc;
+ if (!phydev->link)
+ return 0;
+
rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE,
PHYACC_ATTR_BANK_DSP, T1_COEF_RW_CTL_CFG, 0x0301);
if (rc < 0)
--
2.39.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link
2024-07-03 13:28 ` [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link Oleksij Rempel
@ 2024-07-03 14:01 ` Michal Kubiak
2024-07-03 18:57 ` Andrew Lunn
1 sibling, 0 replies; 9+ messages in thread
From: Michal Kubiak @ 2024-07-03 14:01 UTC (permalink / raw)
To: Oleksij Rempel
Cc: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Woojung Huh, Arun Ramadoss,
Heiner Kallweit, Russell King, Yuiko Oshino, kernel, linux-kernel,
netdev, UNGLinuxDriver
On Wed, Jul 03, 2024 at 03:28:01PM +0200, Oleksij Rempel wrote:
> Do not report SQI if no link is detected. Otherwise ethtool will show
> non zero value even if no cable is attached.
>
> Fixes: b649695248b15 ("net: phy: LAN87xx: add ethtool SQI support")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/phy/microchip_t1.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
> index a35528497a576..22530a5b76365 100644
> --- a/drivers/net/phy/microchip_t1.c
> +++ b/drivers/net/phy/microchip_t1.c
> @@ -840,6 +840,9 @@ static int lan87xx_get_sqi(struct phy_device *phydev)
> u8 sqi_value = 0;
> int rc;
>
> + if (!phydev->link)
> + return 0;
> +
> rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE,
> PHYACC_ATTR_BANK_DSP, T1_COEF_RW_CTL_CFG, 0x0301);
> if (rc < 0)
> --
> 2.39.2
>
>
Thanks,
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link
2024-07-03 13:28 ` [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link Oleksij Rempel
2024-07-03 14:01 ` Michal Kubiak
@ 2024-07-03 18:57 ` Andrew Lunn
2024-07-03 19:26 ` Woojung.Huh
1 sibling, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2024-07-03 18:57 UTC (permalink / raw)
To: Oleksij Rempel
Cc: David S. Miller, Eric Dumazet, Florian Fainelli, Jakub Kicinski,
Paolo Abeni, Woojung Huh, Arun Ramadoss, Heiner Kallweit,
Russell King, Yuiko Oshino, kernel, linux-kernel, netdev,
UNGLinuxDriver
On Wed, Jul 03, 2024 at 03:28:01PM +0200, Oleksij Rempel wrote:
> Do not report SQI if no link is detected. Otherwise ethtool will show
> non zero value even if no cable is attached.
>
> Fixes: b649695248b15 ("net: phy: LAN87xx: add ethtool SQI support")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/phy/microchip_t1.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
> index a35528497a576..22530a5b76365 100644
> --- a/drivers/net/phy/microchip_t1.c
> +++ b/drivers/net/phy/microchip_t1.c
> @@ -840,6 +840,9 @@ static int lan87xx_get_sqi(struct phy_device *phydev)
> u8 sqi_value = 0;
> int rc;
>
> + if (!phydev->link)
> + return 0;
> +
Is this the correct place to fix this? Can any PHY report an SQI value
if there is no link? Maybe an automotive PHY using T1 and good old
fashioned CSMA/CD could report about background noise? But do they?
Maybe this should be fixed in linkstate_get_sqi()?
Also, maybe it should return -ENETDOWN, not 0. Do we want to say
"worse than class A SQI (unstable link)" when in fact the link is
"class G SQI (very good link)" once it is up?
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread* RE: [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link
2024-07-03 18:57 ` Andrew Lunn
@ 2024-07-03 19:26 ` Woojung.Huh
0 siblings, 0 replies; 9+ messages in thread
From: Woojung.Huh @ 2024-07-03 19:26 UTC (permalink / raw)
To: andrew, o.rempel
Cc: davem, edumazet, f.fainelli, kuba, pabeni, Arun.Ramadoss,
hkallweit1, linux, Yuiko.Oshino, kernel, linux-kernel, netdev,
UNGLinuxDriver
Hi Andrew & Oleksij,
> On Wed, Jul 03, 2024 at 03:28:01PM +0200, Oleksij Rempel wrote:
> > Do not report SQI if no link is detected. Otherwise ethtool will show
> > non zero value even if no cable is attached.
> >
> > Fixes: b649695248b15 ("net: phy: LAN87xx: add ethtool SQI support")
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> > drivers/net/phy/microchip_t1.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/phy/microchip_t1.c
> b/drivers/net/phy/microchip_t1.c
> > index a35528497a576..22530a5b76365 100644
> > --- a/drivers/net/phy/microchip_t1.c
> > +++ b/drivers/net/phy/microchip_t1.c
> > @@ -840,6 +840,9 @@ static int lan87xx_get_sqi(struct phy_device *phydev)
> > u8 sqi_value = 0;
> > int rc;
> >
> > + if (!phydev->link)
> > + return 0;
> > +
>
> Is this the correct place to fix this? Can any PHY report an SQI value
> if there is no link? Maybe an automotive PHY using T1 and good old
> fashioned CSMA/CD could report about background noise? But do they?
>
> Maybe this should be fixed in linkstate_get_sqi()?
>
> Also, maybe it should return -ENETDOWN, not 0. Do we want to say
> "worse than class A SQI (unstable link)" when in fact the link is
> "class G SQI (very good link)" once it is up?
I lean to Andew's idea because "SQI values are only valid
if link-up condition is present" per OpenAlliance specification of
100Base-T1 Interoperability Test suite. [1]
[1] https://opensig.org/automotive-ethernet-specifications/#
Thanks.
Woojung
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test
2024-07-03 13:28 [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Oleksij Rempel
2024-07-03 13:28 ` [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link Oleksij Rempel
@ 2024-07-03 14:00 ` Michal Kubiak
2024-07-03 18:48 ` Andrew Lunn
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Michal Kubiak @ 2024-07-03 14:00 UTC (permalink / raw)
To: Oleksij Rempel
Cc: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Woojung Huh, Arun Ramadoss,
Heiner Kallweit, Russell King, Yuiko Oshino, kernel, linux-kernel,
netdev, UNGLinuxDriver
On Wed, Jul 03, 2024 at 03:28:00PM +0200, Oleksij Rempel wrote:
> Reinit PHY after cable test, otherwise link can't be established on
> tested port. This issue is reproducible on LAN9372 switches with
> integrated 100BaseT1 PHYs.
>
> Fixes: 788050256c411 ("net: phy: microchip_t1: add cable test support for lan87xx phy")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/phy/microchip_t1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
> index a838b61cd844b..a35528497a576 100644
> --- a/drivers/net/phy/microchip_t1.c
> +++ b/drivers/net/phy/microchip_t1.c
> @@ -748,7 +748,7 @@ static int lan87xx_cable_test_report(struct phy_device *phydev)
> ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A,
> lan87xx_cable_test_report_trans(detect));
>
> - return 0;
> + return phy_init_hw(phydev);
> }
>
> static int lan87xx_cable_test_get_status(struct phy_device *phydev,
> --
> 2.39.2
>
>
Thanks,
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test
2024-07-03 13:28 [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Oleksij Rempel
2024-07-03 13:28 ` [PATCH net v1 2/2] net: phy: microchip: lan87xx: do not report SQI if no link Oleksij Rempel
2024-07-03 14:00 ` [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Michal Kubiak
@ 2024-07-03 18:48 ` Andrew Lunn
2024-07-04 14:52 ` Florian Fainelli
2024-07-04 14:54 ` Florian Fainelli
4 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2024-07-03 18:48 UTC (permalink / raw)
To: Oleksij Rempel
Cc: David S. Miller, Eric Dumazet, Florian Fainelli, Jakub Kicinski,
Paolo Abeni, Woojung Huh, Arun Ramadoss, Heiner Kallweit,
Russell King, Yuiko Oshino, kernel, linux-kernel, netdev,
UNGLinuxDriver
On Wed, Jul 03, 2024 at 03:28:00PM +0200, Oleksij Rempel wrote:
> Reinit PHY after cable test, otherwise link can't be established on
> tested port. This issue is reproducible on LAN9372 switches with
> integrated 100BaseT1 PHYs.
Since this is a patchset, a cover letter would be normal.
>
> Fixes: 788050256c411 ("net: phy: microchip_t1: add cable test support for lan87xx phy")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test
2024-07-03 13:28 [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Oleksij Rempel
` (2 preceding siblings ...)
2024-07-03 18:48 ` Andrew Lunn
@ 2024-07-04 14:52 ` Florian Fainelli
2024-07-04 14:54 ` Florian Fainelli
4 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2024-07-04 14:52 UTC (permalink / raw)
To: Oleksij Rempel, David S. Miller, Andrew Lunn, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Woojung Huh, Arun Ramadoss,
Heiner Kallweit, Russell King, Yuiko Oshino
Cc: kernel, linux-kernel, netdev, UNGLinuxDriver
On 7/3/2024 2:28 PM, Oleksij Rempel wrote:
> Reinit PHY after cable test, otherwise link can't be established on
> tested port. This issue is reproducible on LAN9372 switches with
> integrated 100BaseT1 PHYs.
>
> Fixes: 788050256c411 ("net: phy: microchip_t1: add cable test support for lan87xx phy")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test
2024-07-03 13:28 [PATCH net v1 1/2] net: phy: microchip: lan87xx: reinit PHY after cable test Oleksij Rempel
` (3 preceding siblings ...)
2024-07-04 14:52 ` Florian Fainelli
@ 2024-07-04 14:54 ` Florian Fainelli
4 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2024-07-04 14:54 UTC (permalink / raw)
To: Oleksij Rempel, David S. Miller, Andrew Lunn, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Woojung Huh, Arun Ramadoss,
Heiner Kallweit, Russell King, Yuiko Oshino
Cc: kernel, linux-kernel, netdev, UNGLinuxDriver
On 7/3/2024 2:28 PM, Oleksij Rempel wrote:
> Reinit PHY after cable test, otherwise link can't be established on
> tested port. This issue is reproducible on LAN9372 switches with
> integrated 100BaseT1 PHYs.
>
> Fixes: 788050256c411 ("net: phy: microchip_t1: add cable test support for lan87xx phy")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread