All of lore.kernel.org
 help / color / mirror / Atom feed
* Extending socket timestamping API for NTP
@ 2017-02-07 14:01 Miroslav Lichvar
  2017-02-07 17:45 ` Keller, Jacob E
                   ` (6 more replies)
  0 siblings, 7 replies; 47+ messages in thread
From: Miroslav Lichvar @ 2017-02-07 14:01 UTC (permalink / raw)
  To: netdev
  Cc: Richard Cochran, Jiri Benc, Keller, Jacob E, Denny Page,
	Willem de Bruijn

I'd like to propose some changes and new options for the timestamping
interface that I think would be useful for NTP implementations and
maybe also other applications. Before I or someone else tries to
implement them, do you think they would actually make sense and fit
well in the current code?

1) new rx_filter for NTP

   Some NICs can't timestamp all received packets and are currently
   unusable for NTP with HW timestamping. The new filter would allow
   NTP support in new NICs and adding support to existing NICs with
   firmware/driver updates. The filter would apply to IPv4 and IPv6
   UDP packets received from or sent to the port number 123.

   Should be the current drivers of HW that can timestamp all packets
   updated to fall back to HWTSTAMP_FILTER_ALL?

2) new SO_TIMESTAMPING option to receive from the error queue only
   user data as was passed to sendmsg() instead of Ethernet frames

   Parsing Ethernet and IP headers (especially IPv6 options) is not
   fun and SOF_TIMESTAMPING_OPT_ID is not always practical, e.g. in
   applications which process messages from the error queue
   asynchronously and don't bind/connect their sockets.

3) target address in msg_name of messages from the error queue

   With 2) and unconnected sockets, there needs to be a way to get the
   address to which the packet was sent. Is it ok to always fill
   msg_name, or does it need to be a new option?

4) allow sockets to use both SW and HW TX timestamping at the same time

   When using a socket which is not bound to a specific interface, it
   would be nice to get transmit SW timestamps when HW timestamps are
   missing. I suspect it's difficult to predict if a HW timestamp will
   be available. Maybe it would be acceptable to get from the error
   queue two messages per transmission if the interface supports both
   SW and HW timestamping?

5) new SO_TIMESTAMPING options to get transposed RX timestamps

   PTP uses preamble RX timestamps, but NTP works with trailer RX
   timestamps. This means NTP implementations currently need to
   transpose HW RX timestamps. The calculation requires the link speed
   and the length of the packet at layer 2. It seems this can be
   reliably done only using raw sockets. It would be very nice if the
   kernel could tranpose the timestamps automatically.

   The existing SOF_TIMESTAMPING_RX_HARDWARE flag could be aliased to
   SOF_TIMESTAMPING_RX_HARDWARE_PREAMBLE and the new flag could be
   SOF_TIMESTAMPING_RX_HARDWARE_TRAILER.

   PTP has a similar problem with SW RX timestamps, which are closer
   to the trailer timestamps rather than preamble timestamps. A new
   SOF_TIMESTAMPING_RX_SOFTWARE_PREAMBLE flag could be added for PTP
   implementations to get transposed timestamps in order to improve
   accuracy.

6) new SO_TIMESTAMPING option to get PHC index with HW timestamps

   With bridges, bonding and other things it's difficult to determine
   which PHC timestamped the packet. It would be very useful if the
   PHC index was provided with each HW timestamp.

   I'm not sure what would be the best place to put it. I guess the
   second timespec in scm_timestamping could be reused for this, but
   that sounds like a gross hack. Do we need to define a new struct?

Thoughts?

-- 
Miroslav Lichvar

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2017-03-27 21:20 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 14:01 Extending socket timestamping API for NTP Miroslav Lichvar
2017-02-07 17:45 ` Keller, Jacob E
2017-02-07 22:32   ` Willem de Bruijn
2017-02-08 14:18     ` Soheil Hassas Yeganeh
2017-02-27 15:23     ` Miroslav Lichvar
2017-02-28  0:01       ` Willem de Bruijn
2017-02-28  8:26         ` Miroslav Lichvar
2017-02-28 21:05           ` Willem de Bruijn
2017-02-08  1:52   ` Denny Page
2017-02-08  5:27     ` Richard Cochran
2017-02-08  5:48       ` Denny Page
2017-02-08 17:27       ` Denny Page
2017-02-07 18:54 ` Soheil Hassas Yeganeh
2017-02-08 10:14   ` Miroslav Lichvar
2017-02-07 20:37 ` sdncurious
2017-02-08 10:26   ` Miroslav Lichvar
2017-02-08 23:27     ` sdncurious
2017-02-08 23:34     ` sdncurious
2017-02-08  1:18 ` Denny Page
     [not found] ` <CAHoNx58u=Fze4e5V2Wb_LiBhka1Mzny3zOVNfvuzjnmQ4wBO=Q@mail.gmail.com>
2017-02-08  3:06   ` Denny Page
2017-02-09  0:45 ` Denny Page
2017-02-09 11:15   ` Miroslav Lichvar
2017-02-09 20:25   ` Denny Page
2017-02-09  8:02 ` Richard Cochran
2017-02-09 11:09   ` Miroslav Lichvar
2017-02-09 19:42     ` sdncurious
2017-02-09 20:37       ` Denny Page
2017-02-10  0:33       ` Denny Page
2017-02-10 18:55         ` Denny Page
2017-03-23 16:21     ` Miroslav Lichvar
2017-03-23 18:54       ` Denny Page
2017-03-23 19:07       ` Richard Cochran
2017-03-24  7:25         ` Miroslav Lichvar
     [not found]       ` <6121D504-288F-4C9B-9AB3-D1C8292965D5@me.com>
2017-03-24  9:45         ` Miroslav Lichvar
2017-03-24 17:17           ` Denny Page
2017-03-24 18:52             ` Keller, Jacob E
2017-03-27 10:13             ` Miroslav Lichvar
2017-03-27 14:29               ` Richard Cochran
2017-03-27 16:25                 ` Denny Page
2017-03-27 18:28                   ` Richard Cochran
2017-03-27 19:18                     ` Denny Page
2017-03-27 20:58                       ` Richard Cochran
2017-03-27 21:20                         ` Denny Page
2017-03-27 19:21                     ` Denny Page
2017-03-27 19:21                     ` Denny Page
     [not found]                     ` <5FD283AB-39DE-4A9D-902A-BA5F0F0B62A3@me.com>
2017-03-27 21:00                       ` Richard Cochran
2017-03-24  9:55         ` Jiri Benc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.