netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phylink: Improve error message when validate failed
@ 2020-03-01 23:55 Hauke Mehrtens
  2020-03-02 16:38 ` Russell King - ARM Linux admin
  2020-03-04  2:01 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Hauke Mehrtens @ 2020-03-01 23:55 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux, andrew, f.fainelli, hkallweit1, Hauke Mehrtens

This should improve the error message when the PHY validate in the MAC
driver failed. I ran into this problem multiple times that I put wrong
interface values into the device tree and was searching why it is
failing with -22 (-EINVAL). This should make it easier to spot the
problem.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/phy/phylink.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index b4367fab7899..5347275215be 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -797,8 +797,14 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
 		config.interface = interface;
 
 	ret = phylink_validate(pl, supported, &config);
-	if (ret)
+	if (ret) {
+		phylink_warn(pl, "validation of %s with support %*pb and advertisement %*pb failed: %d\n",
+			     phy_modes(config.interface),
+			     __ETHTOOL_LINK_MODE_MASK_NBITS, phy->supported,
+			     __ETHTOOL_LINK_MODE_MASK_NBITS, config.advertising,
+			     ret);
 		return ret;
+	}
 
 	phy->phylink = pl;
 	phy->phy_link_change = phylink_phy_change;
-- 
2.20.1


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

* Re: [PATCH] phylink: Improve error message when validate failed
  2020-03-01 23:55 [PATCH] phylink: Improve error message when validate failed Hauke Mehrtens
@ 2020-03-02 16:38 ` Russell King - ARM Linux admin
  2020-03-04  2:01 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux admin @ 2020-03-02 16:38 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: davem, netdev, andrew, f.fainelli, hkallweit1

On Mon, Mar 02, 2020 at 12:55:02AM +0100, Hauke Mehrtens wrote:
> This should improve the error message when the PHY validate in the MAC
> driver failed. I ran into this problem multiple times that I put wrong
> interface values into the device tree and was searching why it is
> failing with -22 (-EINVAL). This should make it easier to spot the
> problem.

Hi,

This will do as a stop-gap measure to make debugging of that easier,
but in the longer run I want MAC drivers to provide phylink with a
bitmap of the PHY_INTERFACE_MODE_*s they support.

So,

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/phy/phylink.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index b4367fab7899..5347275215be 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -797,8 +797,14 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
>  		config.interface = interface;
>  
>  	ret = phylink_validate(pl, supported, &config);
> -	if (ret)
> +	if (ret) {
> +		phylink_warn(pl, "validation of %s with support %*pb and advertisement %*pb failed: %d\n",
> +			     phy_modes(config.interface),
> +			     __ETHTOOL_LINK_MODE_MASK_NBITS, phy->supported,
> +			     __ETHTOOL_LINK_MODE_MASK_NBITS, config.advertising,
> +			     ret);
>  		return ret;
> +	}
>  
>  	phy->phylink = pl;
>  	phy->phy_link_change = phylink_phy_change;
> -- 
> 2.20.1
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

* Re: [PATCH] phylink: Improve error message when validate failed
  2020-03-01 23:55 [PATCH] phylink: Improve error message when validate failed Hauke Mehrtens
  2020-03-02 16:38 ` Russell King - ARM Linux admin
@ 2020-03-04  2:01 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-03-04  2:01 UTC (permalink / raw)
  To: hauke; +Cc: netdev, linux, andrew, f.fainelli, hkallweit1

From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon,  2 Mar 2020 00:55:02 +0100

> This should improve the error message when the PHY validate in the MAC
> driver failed. I ran into this problem multiple times that I put wrong
> interface values into the device tree and was searching why it is
> failing with -22 (-EINVAL). This should make it easier to spot the
> problem.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Applied, thank you.

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

end of thread, other threads:[~2020-03-04  2:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-01 23:55 [PATCH] phylink: Improve error message when validate failed Hauke Mehrtens
2020-03-02 16:38 ` Russell King - ARM Linux admin
2020-03-04  2:01 ` David Miller

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).