netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Petr Machata <petrm@mellanox.com>
Cc: Amit Cohen <amitc@mellanox.com>, mlxsw <mlxsw@mellanox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"o.rempel@pengutronix.de" <o.rempel@pengutronix.de>
Subject: Re: Link down reasons
Date: Thu, 28 May 2020 20:37:03 +0200	[thread overview]
Message-ID: <20200528183703.GB849697@lunn.ch> (raw)
In-Reply-To: <87r1v4t2yn.fsf@mellanox.com>

On Thu, May 28, 2020 at 06:54:24PM +0200, Petr Machata wrote:
> 
> Andrew Lunn <andrew@lunn.ch> writes:
> 
> >> Andrew, pardon my ignorance in these matters, can a PHY driver in
> >> general determine that the issue is with the cable, even without running
> >> the fairly expensive cable test?
> >
> > No. To diagnose a problem, you need the link to be idle. If the link
> > peer is sending frames, they interfere with TDR. So all the cable
> > testing i've seen first manipulates the auto-negotiation to make the
> > link peer go quiet. That takes 1 1/2 seconds. There are some
> > optimizations possible, e.g. if the cable is so broken it never
> > establishes link, you can skip this. But Ethernet tends to be robust,
> > it drops back to 100Mbps only using two pairs if one of the four pairs
> > is broken, for example.
> 
> OK, thanks. I suspect our FW is doing this behind the scenes, because it
> can report a shorted cable.
> 
> In another e-mail you suggested this:
> 
>     Link detected: no (cable issue)
> 
> But if the link just silently falls back to 100Mbps, there would never
> be an opportunity for phy to actually report a down reason. So there
> probably is no way for the phy layer to make use of this particular
> down reason.

It is called downshift. And we have support for it in the phylib core,
if the PHY has the needed vendor register.

https://elixir.bootlin.com/linux/v5.7-rc7/source/drivers/net/phy/phy-core.c#L341
https://elixir.bootlin.com/linux/v5.7-rc7/source/drivers/net/phy/phy.c#L95

There are also standard phylib/ethtool ways to configure it, how many
times the PHY should try to establish a 1G link before downshifting to
100M.

So in theory we could report:

Link detected: yes (downshifted)

Assuming your proposed API support a reason why it is up, not just a
reason why it is down?

	Andrew

  parent reply	other threads:[~2020-05-28 18:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AM0PR0502MB38261D4F4F7A3BB5E0FDCD10D7B10@AM0PR0502MB3826.eurprd05.prod.outlook.com>
2020-05-27 21:38 ` Link down reasons Andrew Lunn
2020-05-28  5:56   ` Amit Cohen
2020-05-28  9:12     ` Petr Machata
2020-05-28 15:40       ` Andrew Lunn
2020-05-28 16:54         ` Petr Machata
2020-05-28 17:17           ` Michal Kubecek
2020-05-28 18:37           ` Andrew Lunn [this message]
2020-05-29  9:03             ` Petr Machata
2020-05-28  8:40 ` Oleksij Rempel
2020-05-28  9:22   ` Petr Machata
2020-05-28 10:28     ` Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200528183703.GB849697@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=amitc@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=petrm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).