lkml.org 
[lkml]   [2020]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next v1] net: phy: tja11xx: add cable-test support
On Thu, May 14, 2020 at 02:09:59PM +0200, Oleksij Rempel wrote:
> On Wed, May 13, 2020 at 08:01:40PM +0200, Andrew Lunn wrote:
> > > What would be the best place to do a test before the link is getting up?
> > > Can it be done in the phy core, or it should be done in the PHY driver?
> > >
> > > So far, no action except of logging these errors is needed.
> >
> > You could do it in the config_aneg callback.
>
> In this case I get two test cycles if the test was requested from user
> space: from .cable_test_get_status and from .config_aneg

Oh yes. Forgot about the restore after the test completes.

When do you want to run the test? When the interface is
administratively configured up, or when the link actually goes up?
You could do it in read_status(), when the link changes status.

> > A kernel log entry is not very easy to use. You might want to see how
> > easy it is to send a cable test result to userspace. Anything which is
> > interested in this information can then listen for it. All the needed
> > code is there, you will just need to rearrange it a bit.
>
> Indeed. I discovered" ethtool --monitor" for me. And the code is some
> thing like this:
> ethnl_cable_test_alloc(phydev);
> phydev->drv->cable_test_start(phydev);
> usleep_range(100, 200);
> phydev->drv->cable_test_get_status(phydev, &finished);
> if (finished)
> ethnl_cable_test_finished(phydev);

Yes, something like that.

> Beside, what do you think about new result codes:
> ETHTOOL_A_CABLE_RESULT_CODE_POLARITY - if cable polarity is wrong (-
> connected to +)

Polarity should be a whole new nested pair property, not a status
extension. I think most PHYs are happy to work with the polarity
swapped. So we don't want it to sounds like an error. So status should
be OK and then the polarity property should then indicate it i
swapped. And you can only detected swapped polarity when the link is
up. So in most cases, you would not even include the properties, since
cable tests is normally performed on a down'ed link.

> ETHTOOL_A_CABLE_RESULT_CODE_ACTIVE_PARTNER - the link partner is active.

> The TJA1102 is able to detect it if partner link is master.

master is not a cable diagnostics issue. This is a configuration
issue.

Andrew

\
 
 \ /
  Last update: 2020-05-14 15:38    [W:0.066 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site