mbox series

[RFC,net-next,0/2] net: phy: Extend sysfs to adjust PHY latency.

Message ID 20220419083704.48573-1-horatiu.vultur@microchip.com (mailing list archive)
Headers show
Series net: phy: Extend sysfs to adjust PHY latency. | expand

Message

Horatiu Vultur April 19, 2022, 8:37 a.m. UTC
The previous try of setting the PHY latency was here[1]. But this approach
could not work for multiple reasons:
- the interface was not generic enough so it would be hard to be extended
  in the future
- if there were multiple time stamper in the system then it was not clear
  to which one should adjust these values.

So the next try is to extend sysfs and configure exactly the desired PHY.
Therefore add a new entry in sysfs for the PHY('adjust_latency') which
will be shown only if the PHY implements the set/get_adj_latency.

[1] https://lore.kernel.org/netdev/20220401093909.3341836-1-horatiu.vultur@microchip.com/

Horatiu Vultur (2):
  net: phy: Add phy latency adjustment support in phy framework.
  net: phy: micrel: Implement set/get_adj_latency for lan8814

 .../ABI/testing/sysfs-class-net-phydev        | 10 +++
 drivers/net/phy/micrel.c                      | 87 +++++++++++++++++++
 drivers/net/phy/phy_device.c                  | 58 +++++++++++++
 include/linux/phy.h                           |  9 ++
 4 files changed, 164 insertions(+)

Comments

Andrew Lunn April 19, 2022, 12:17 p.m. UTC | #1
On Tue, Apr 19, 2022 at 10:37:02AM +0200, Horatiu Vultur wrote:
> The previous try of setting the PHY latency was here[1]. But this approach
> could not work for multiple reasons:
> - the interface was not generic enough so it would be hard to be extended
>   in the future
> - if there were multiple time stamper in the system then it was not clear
>   to which one should adjust these values.
> 
> So the next try is to extend sysfs and configure exactly the desired PHY.

What about timestampers which are not PHYs? Ideally you want one
interface which will work for any sort of stamper, be it MAC, PHY, or
a bump in the wire between the MAC and the PHY.

  Andrew
Horatiu Vultur April 20, 2022, 7:57 a.m. UTC | #2
The 04/19/2022 14:17, Andrew Lunn wrote:

Hi Andrew,

> 
> On Tue, Apr 19, 2022 at 10:37:02AM +0200, Horatiu Vultur wrote:
> > The previous try of setting the PHY latency was here[1]. But this approach
> > could not work for multiple reasons:
> > - the interface was not generic enough so it would be hard to be extended
> >   in the future
> > - if there were multiple time stamper in the system then it was not clear
> >   to which one should adjust these values.
> >
> > So the next try is to extend sysfs and configure exactly the desired PHY.
> 
> What about timestampers which are not PHYs? Ideally you want one
> interface which will work for any sort of stamper, be it MAC, PHY, or
> a bump in the wire between the MAC and the PHY.

My initial idea was that each of the timestampers will need to extend
the sysfs to add this file or multiple files. But from what I can see
this approach will not fly.

If we want an interface to be used by any sort of stamper, we could
create a new generic class (eth_tunable/eth_obj). Then each driver will
register a device that will use this generic class.
We will continue to use sysfs to expose all the modes supported by the
driver. But this time create a file for each mode.
The entire approach should be something similar with the ptp clocks.
What do you think, is this the right approach?

> 
>   Andrew