[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrU0jB+kg0mhV6A8mrHfTE1D1pr1SD_B9Eaa9aDPfgHdtA@mail.gmail.com>
Date: Thu, 8 Feb 2024 10:02:18 -0800
From: Andy Lutomirski <luto@...capital.net>
To: Vadim Fedorenko <vadfed@...a.com>, Willem de Bruijn <willemb@...gle.com>,
"David S. Miller" <davem@...emloft.net>, Network Development <netdev@...r.kernel.org>
Subject: SOF_TIMESTAMPING_OPT_ID is unreliable when sendmsg fails
I’ve been using OPT_ID-style timestamping for years, but for some
reason this issue only bit me last week: if sendmsg() fails on a UDP
or ping socket, sk_tskey is poorly. It may or may not get incremented
by the failed sendmsg().
I can think of at least three ways to improve this:
1. Make it so that the sequence number is genuinely only incremented
on success. This may be tedious to implement and may be nearly
impossible if there are multiple concurrent sendmsg() calls on the
same socket.
2. Allow the user program to specify an explicit ID. cmsg values are
variable length, so for datagram sockets, extending the
SO_TIMESTAMPING cmsg with 64 bits of sequence number to be used for
the TX timestamp on that particular packet might be a nice solution.
3. Add a getsockopt to read sk_tskey, which user code could use to
determine the next sequence number after a failed sendmsg() call.
Thanks,
Andy
Powered by blists - more mailing lists