Re: [RFC PATCH net-next 1/2] ethtool: Extend to allow to set PHY latencies

From: Horatiu Vultur
Date: Fri Apr 01 2022 - 09:38:00 EST


The 04/01/2022 14:36, Andrew Lunn wrote:
>
> On Fri, Apr 01, 2022 at 11:39:08AM +0200, Horatiu Vultur wrote:
> > Extend ethtool uapi to allow to configure the latencies for the PHY.
> > Allow to configure the latency per speed and per direction.
> >
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
> > ---
> > include/uapi/linux/ethtool.h | 6 ++++++
> > net/ethtool/common.c | 6 ++++++
> > net/ethtool/ioctl.c | 10 ++++++++++
> > 3 files changed, 22 insertions(+)
> >
> > diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> > index 7bc4b8def12c..f120904a4e43 100644
> > --- a/include/uapi/linux/ethtool.h
> > +++ b/include/uapi/linux/ethtool.h
> > @@ -296,6 +296,12 @@ enum phy_tunable_id {
> > ETHTOOL_PHY_DOWNSHIFT,
> > ETHTOOL_PHY_FAST_LINK_DOWN,
> > ETHTOOL_PHY_EDPD,
> > + ETHTOOL_PHY_LATENCY_RX_10MBIT,
> > + ETHTOOL_PHY_LATENCY_TX_10MBIT,
> > + ETHTOOL_PHY_LATENCY_RX_100MBIT,
> > + ETHTOOL_PHY_LATENCY_TX_100MBIT,
> > + ETHTOOL_PHY_LATENCY_RX_1000MBIT,
> > + ETHTOOL_PHY_LATENCY_TX_1000MBIT,
>
> How does this scale with 2.5G, 5G, 10G, 14G, 40G, etc.
>
> Could half duplex differ to full duplex? What about 1000BaseT vs
> 1000BaseT1 and 1000BaseT2? The Aquantia/Marvell PHY can do both
> 1000BaseT and 1000BaseT2 and will downshift from 4 pairs to 2 pairs if
> you have the correct magic in its firmware blobs.
>
> A more generic API would pass a link mode, a direction and a
> latency. The driver can then return -EOPNOTSUPP for a mode it does not
> support.

Yes, I can see your point, the proposed solution is not scalable.
I will try implement something like you suggested.

>
> Andrew

--
/Horatiu