Re: [PATCH net-next v5 08/16] net: ethtool: Add a command to expose current time stamping layer
From: Köry Maincent
Date: Tue Oct 17 2023 - 05:21:50 EST
On Mon, 16 Oct 2023 16:03:13 -0700
Jacob Keller <jacob.e.keller@xxxxxxxxx> wrote:
> On 10/16/2023 10:03 AM, Jakub Kicinski wrote:
> > On Mon, 16 Oct 2023 18:23:07 +0200 Köry Maincent wrote:
> >>> What's the reason for timestamp precision differences?
> >>> My understanding so far was the the differences come from:
> >>> 1. different stamping device (i.e. separate "piece of silicon",
> >>> accessed over a different bus, with different PHC etc.)
> >>> 2. different stamping point (MAC vs DMA)
> >>>
> >>> I don't think any "integrated" device would support stamps which
> >>> differ under category 1.
> >>
> >> It was a case reported by Maxime on v3:
> >> https://lore.kernel.org/netdev/20230324112541.0b3dd38a@xxxxxxxxx/
> >
> > IMHO this talks about how clock control/disciplining works which
> > is a somewhat independent topic of timestamping.
>
> The thread in question mentions that the device has two modes, one which
> has higher precision for the timestamps, and one which has better
> precision on frequency adjustments. I don't know the details for why the
> hardware has this behavior, but being able to switch between the two
> timestamp modes has value as described by the thread.
>
> I'm not sure how to represent that in such an API because both modes
> seem to capture the timestamp at the MAC.
After some thought, indeed moving back to MAC/PHY_TIMESTAMPING seems better.
This case of several timestamp modes in MAC is currently only for the special
stmmac case.
We could support it the same way we could support multiPHY by saving the
source id of the timestamp like this in net_device:
struct {
enum ts_layer layer,
int source_id,
} ts