On Wed, Nov 22, 2023 at 12:55 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote: > > On Wed, 22 Nov 2023 18:59:55 +0200 Vladimir Oltean wrote: > > I wouldn't be so sure. The alternative interpretation "for PTP, give me > > timestamps from both sources" also sounds reasonable for the distant > > future where that will be possible (with proper cmsg identification). > > But I don't see how to distinguish the two - the filters, expressed in > > these terms, would be the same. > > We can add an attribute that explicitly says that the configuration > is only requesting one stamp. But feels like jumping the gun at this > stage, given we have no other option to express there. > > > So the ptp4l source code would have to be modified to still work with > > the same precision as before? I'm not seeing this through. > > We can do the opposite and add a socket flag which says "DMA is okay". There already is a disconnect between configuring hardware timestamp generation. Through the ioctl, which is a global admin-only interface. And requesting timestamps with SO_TIMESTAMPING. Today the user of ptp4l already has to know that the admin has configured the right RX and TX filters. That is no different if multiple filters can be installed? (PHY for PTP, DMA for everything else). If attribution becomes important, we could add another cmsg alongside the timestamp. On TX this already happens with IP_RECVERR/IPV6_RECVERR/PACKET_TX_TIMESTAMP. Maybe the sock_extended_err struct even still has a field that can be (ab)used for this purpose. Being able to pass multiple timestamps up to userspace eventually will be interesting. A large blocker is where to store these values in the sk_buff on the path between the driver and the socket (skb_ext?). At Google we already have this scenario, where the local TCP stack and userspace both want converted hardware timestamps -- but converted from raw to different timebases.