From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Willem de Bruijn <willemb@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>,
Jason Xing <kerneljasonxing@gmail.com>,
Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v3 0/4] Add option to provide OPT_ID value via cmsg
Date: Wed, 4 Sep 2024 12:36:45 +0100 [thread overview]
Message-ID: <8a50a1f2-3b99-4030-9a96-6aecdd2841b7@linux.dev> (raw)
In-Reply-To: <20240904113153.2196238-1-vadfed@meta.com>
On 04/09/2024 12:31, Vadim Fedorenko wrote:
> SOF_TIMESTAMPING_OPT_ID socket option flag gives a way to correlate TX
> timestamps and packets sent via socket. Unfortunately, there is no way
> to reliably predict socket timestamp ID value in case of error returned
> by sendmsg. For UDP sockets it's impossible because of lockless
> nature of UDP transmit, several threads may send packets in parallel. In
> case of RAW sockets MSG_MORE option makes things complicated. More
> details are in the conversation [1].
> This patch adds new control message type to give user-space
> software an opportunity to control the mapping between packets and
> values by providing ID with each sendmsg.
>
> The first patch in the series adds all needed definitions and implements
> the function for UDP sockets. The explicit check of socket's type is not
> added because subsequent patches in the series will add support for other
> types of sockets. The documentation is also included into the first
> patch.
>
> Patch 2/4 adds support for TCP sockets. This part is simple and straight
> forward.
>
> Patch 3/4 adds support for RAW sockets. It's a bit tricky because
> sock_tx_timestamp functions has to be refactored to receive full socket
> cookie information to fill in ID. The commit b534dc46c8ae ("net_tstamp:
> add SOF_TIMESTAMPING_OPT_ID_TCP") did the conversion of sk_tsflags to
> u32 but sock_tx_timestamp functions were not converted and still receive
> 16b flags. It wasn't a problem because SOF_TIMESTAMPING_OPT_ID_TCP was
> not checked in these functions, that's why no backporting is needed.
>
> Patch 4/4 adds selftests for new feature.
>
> Changelog:
> v2 -> v3:
> - remove SOF_TIMESTAMPING_OPT_ID_CMSG UAPI value and use kernel-internal
> SOCKCM_FLAG_TS_OPT_ID which uses the highest bit of tsflags.
> - add support for TCP and RAW sockets
> v1 -> v2:
> - add more selftests
> - add documentation for the feature
> - refactor UDP send function
> RFC -> v1:
> - add selftests
> - add SOF_TIMESTAMPING_OPT_ID_CMSG to signal of custom ID provided by
> user-space instead of reserving value of 0 for this.
>
> [1] https://lore.kernel.org/netdev/CALCETrU0jB+kg0mhV6A8mrHfTE1D1pr1SD_B9Eaa9aDPfgHdtA@mail.gmail.com/
>
> Vadim Fedorenko (4):
> net_tstamp: add SCM_TS_OPT_ID to provide OPT_ID in control message
> net_tstamp: add SCM_TS_OPT_ID for TCP sockets
> net_tstamp: add SCM_TS_OPT_ID for RAW sockets
> selftests: txtimestamp: add SCM_TS_OPT_ID test
>
> Documentation/networking/timestamping.rst | 13 ++++++
> arch/alpha/include/uapi/asm/socket.h | 2 +
> arch/mips/include/uapi/asm/socket.h | 2 +
> arch/parisc/include/uapi/asm/socket.h | 2 +
> arch/sparc/include/uapi/asm/socket.h | 2 +
> include/net/inet_sock.h | 4 +-
> include/net/sock.h | 29 +++++++++----
> include/uapi/asm-generic/socket.h | 2 +
> include/uapi/linux/net_tstamp.h | 7 ++++
> net/can/raw.c | 2 +-
> net/core/sock.c | 9 ++++
> net/ipv4/ip_output.c | 20 ++++++---
> net/ipv4/raw.c | 2 +-
> net/ipv4/tcp.c | 15 ++++---
> net/ipv6/ip6_output.c | 20 ++++++---
> net/ipv6/raw.c | 2 +-
> net/packet/af_packet.c | 6 +--
> net/socket.c | 2 +-
> tools/include/uapi/asm-generic/socket.h | 2 +
> tools/testing/selftests/net/txtimestamp.c | 48 +++++++++++++++++-----
> tools/testing/selftests/net/txtimestamp.sh | 12 +++---
> 21 files changed, 154 insertions(+), 49 deletions(-)
>
Oh, sorry for the mess, patches:
[PATCH v3 2/3] selftests: txtimestamp: add SCM_TS_OPT_ID test
[PATCH v3 3/3] net_tstamp: add SCM_TS_OPT_ID for TCP sockets
should be ignored.
If it too messy I can resend the series.
Sorry again,
Vadim
next prev parent reply other threads:[~2024-09-04 11:36 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 11:31 [PATCH net-next v3 0/4] Add option to provide OPT_ID value via cmsg Vadim Fedorenko
2024-09-04 11:31 ` [PATCH net-next v3 1/4] net_tstamp: add SCM_TS_OPT_ID to provide OPT_ID in control message Vadim Fedorenko
2024-09-04 13:56 ` Jason Xing
2024-09-04 14:01 ` Vadim Fedorenko
2024-09-04 20:54 ` Willem de Bruijn
2024-09-05 10:10 ` Vadim Fedorenko
2024-09-05 13:29 ` Willem de Bruijn
2024-09-05 8:24 ` Jason Xing
2024-09-05 8:34 ` Vadim Fedorenko
2024-09-05 8:49 ` Jason Xing
2024-09-06 9:22 ` kernel test robot
2024-09-06 12:58 ` kernel test robot
2024-09-04 11:31 ` [PATCH net-next v3 2/4] net_tstamp: add SCM_TS_OPT_ID for TCP sockets Vadim Fedorenko
2024-09-05 14:58 ` Vadim Fedorenko
2024-09-05 15:37 ` Jason Xing
2024-09-05 16:39 ` Willem de Bruijn
2024-09-06 12:20 ` Vadim Fedorenko
2024-09-06 15:25 ` Willem de Bruijn
2024-09-06 16:33 ` Willem de Bruijn
2024-09-06 17:27 ` Vadim Fedorenko
2024-09-06 23:50 ` Willem de Bruijn
2024-09-06 17:27 ` Vadim Fedorenko
2024-09-06 23:48 ` Willem de Bruijn
2024-09-07 21:55 ` Vadim Fedorenko
2024-09-08 19:19 ` Willem de Bruijn
2024-09-08 19:55 ` Vadim Fedorenko
2024-09-04 11:31 ` [PATCH net-next v3 3/4] net_tstamp: add SCM_TS_OPT_ID for RAW sockets Vadim Fedorenko
2024-09-04 11:31 ` [PATCH net-next v3 4/4] selftests: txtimestamp: add SCM_TS_OPT_ID test Vadim Fedorenko
2024-09-04 11:36 ` Vadim Fedorenko [this message]
2024-09-04 21:04 ` [PATCH net-next v3 0/4] Add option to provide OPT_ID value via cmsg Willem de Bruijn
2024-09-04 22:50 ` Vadim Fedorenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8a50a1f2-3b99-4030-9a96-6aecdd2841b7@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=dsahern@kernel.org \
--cc=horms@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).