Re: [PATCH v2 1/2] ethtool: implement Energy Detect Powerdown support via phy-tunable

From: Florian Fainelli
Date: Thu Sep 05 2019 - 13:23:49 EST


On 9/4/19 11:25 PM, Ardelean, Alexandru wrote:
> On Wed, 2019-09-04 at 21:53 +0200, Andrew Lunn wrote:
>> [External]
>>
>> On Wed, Sep 04, 2019 at 07:23:21PM +0300, Alexandru Ardelean wrote:
>>
>> Hi Alexandru
>>
>> Somewhere we need a comment stating what EDPD means. Here would be a
>> good place.
>
> ack
>
>>
>>> +#define ETHTOOL_PHY_EDPD_DFLT_TX_INTERVAL 0x7fff
>>> +#define ETHTOOL_PHY_EDPD_NO_TX 0x8000
>>> +#define ETHTOOL_PHY_EDPD_DISABLE 0
>>
>> I think you are passing a u16. So why not 0xfffe and 0xffff? We also
>> need to make it clear what the units are for interval. This file
>
> I initially thought about keeping this u8 and going with 0xff & 0xfe.
> But 254 or 253 could be too small to specify the value of an interval.
>
> Also (maybe due ti all the coding-patterns that I saw over the course of some time), make me feel that I should add a
> flag somewhere.
>
> Bottom line is: 0xfffe and 0xffff also work from my side, if it is acceptable (by the community).
>
> Another approach I considered, was to maybe have this EDPD just do enable & disable (which is sufficient for the `adin`
> PHY & `micrel` as well).
> That would mean that if we would ever want to configure the TX interval (in the future), we would need an extra PHY-
> tunable parameter just for that; because changing the enable/disable behavior would be dangerous.
> And also, deferring the TX-interval configuration, does not sound like good design/pattern, since it can allow for tons
> of PHY-tunable parameters for every little knob.

It seems to me that the interval is a better way to deal with that, if
you specify a non zero interval, you enable EDPD, even if your PHY can
only act on an enable/disable bit. For PHYs that do support setting a TX
internal, the non-zero interval can be translated into whatever
appropriate unit. In all cases, a 0 interval means disable.

Andrew, does that work for you?
--
Florian