Subject: Re: [PATCH net-next v1 2/9] net: phy: Add support for polling cable test

From: Andrew Lunn <[email-masked]>
Date: Sat, 25 Apr 2020 22:10:14 +0200

On Sat, Apr 25, 2020 at 12:49:46PM -0700, Florian Fainelli wrote:
> Hi Andrew,
> 
> On 4/25/2020 11:06 AM, Andrew Lunn wrote:
> > Some PHYs are not capable of generating interrupts when a cable test
> > finished. They do however support interrupts for normal operations,
> > like link up/down. As such, the PHY state machine would normally not
> > poll the PHY.
> > 
> > Add support for indicating the PHY state machine must poll the PHY
> > when performing a cable test.
> > 
> > Signed-off-by: Andrew Lunn <[email-masked]>
> 
> If you started a cable test and killed the ethtool process before the
> cable diagnostics are available, the state machine gets stuck in that
> state, so we should find a way to propagate the signal all the way to
> the PHY library somehow.

Hi Florian

It should not matter if the user space tool goes away. As you read
later patches you will see why. But:

ETHTOOL_MSG_CABLE_TEST_ACT is an action to trigger cable
test. Assuming the driver supports it etc, the cable test is started,
and user space immediately gets a ETHTOOL_MSG_CABLE_TEST_ACT_REPLY.
The state is changed to PHY_CABLETEST.

Sometime later, the driver indicates the cable test has
completed. This can be an interrupt, or because it is being polled.  A
ETHTOOL_MSG_CABLE_TEST_NTF is multicast to user space with the
results. And the PHY then leaves state PHY_CABLETEST. If there is no
user space listening for the ETHTOOL_MSG_CABLE_TEST_NTF, it does not
matter.

At least with the Marvell PHY, there is no documented way to tell it
to abort a cable test. So knowing the user space has lost interest in
the results does not help us.

    Andrew