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

From: Ardelean, Alexandru
Date: Thu Sep 05 2019 - 02:25:24 EST


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.

> specifies the contract between the kernel and user space. So we need
> to clearly define what we mean here. Lots of comments are better than
> no comments.

Will come back with more comments.

>
> Andrew