From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Simon Horman <horms@kernel.org>
Cc: 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>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/2] net_tstamp: add SCM_TS_OPT_ID to provide OPT_ID in control message
Date: Mon, 2 Sep 2024 20:35:26 +0100 [thread overview]
Message-ID: <f2a5db09-decc-4e40-a6cc-d4f179a7ab68@linux.dev> (raw)
In-Reply-To: <20240902183833.GK23170@kernel.org>
On 02/09/2024 19:38, Simon Horman wrote:
> On Mon, Sep 02, 2024 at 06:09:35AM -0700, 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. This works fine for UDP
>> sockets only, and explicit check is added to control message parser.
>>
>> [1] https://lore.kernel.org/netdev/CALCETrU0jB+kg0mhV6A8mrHfTE1D1pr1SD_B9Eaa9aDPfgHdtA@mail.gmail.com/
>>
>> Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
>
> ...
>
>> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
>
> ...
>
>> @@ -1543,10 +1546,15 @@ static int __ip6_append_data(struct sock *sk,
>> flags &= ~MSG_SPLICE_PAGES;
>> }
>>
>> - hold_tskey = cork->tx_flags & SKBTX_ANY_TSTAMP &&
>> - READ_ONCE(sk->sk_tsflags) & SOF_TIMESTAMPING_OPT_ID;
>> - if (hold_tskey)
>> - tskey = atomic_inc_return(&sk->sk_tskey) - 1;
>> + if (cork->tx_flags & SKBTX_ANY_TSTAMP &&
>> + READ_ONCE(sk->sk_tsflags) & SOF_TIMESTAMPING_OPT_ID) {
>> + if (cork->flags & IPCORK_TS_OPT_ID) {
>> + tskey = cork->ts_opt_id;
>> + } else {
>> + tskey = atomic_inc_return(&sk->sk_tskey) - 1;
>> + hold_tskey = true;
>
> Hi Vadim,
>
> I think that hold_tskey also needs to be assigned a value in
> the cases where wither of the if conditions above are false.
Hi Simon!
Yes, you are right. I should probably init it with false to avoid
'else' statement.
Thanks,
Vadim
> Flagged by Smatch.
>
>> + }
>> + }
>>
>> /*
>> * Let's try using as much space as possible.
>
next prev parent reply other threads:[~2024-09-02 19:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 13:09 [PATCH net-next v2 1/2] net_tstamp: add SCM_TS_OPT_ID to provide OPT_ID in control message Vadim Fedorenko
2024-09-02 13:09 ` [PATCH net-next v2 2/2] selftests: txtimestamp: add SCM_TS_OPT_ID test Vadim Fedorenko
2024-09-02 14:24 ` Jason Xing
2024-09-08 20:04 ` Vadim Fedorenko
2024-09-08 23:36 ` Jason Xing
2024-09-02 14:29 ` [PATCH net-next v2 1/2] net_tstamp: add SCM_TS_OPT_ID to provide OPT_ID in control message Willem de Bruijn
2024-09-02 21:07 ` Vadim Fedorenko
2024-09-03 20:40 ` Willem de Bruijn
2024-09-02 15:19 ` Jason Xing
2024-09-02 15:51 ` Willem de Bruijn
2024-09-02 19:40 ` Vadim Fedorenko
2024-09-02 20:59 ` Willem de Bruijn
2024-09-02 21:10 ` Vadim Fedorenko
2024-09-03 16:01 ` Vadim Fedorenko
2024-09-03 20:46 ` Willem de Bruijn
2024-09-02 18:38 ` Simon Horman
2024-09-02 19:35 ` Vadim Fedorenko [this message]
2024-09-03 15:23 ` Simon Horman
2024-09-03 8:06 ` Dan Carpenter
2024-09-03 8:16 ` 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=f2a5db09-decc-4e40-a6cc-d4f179a7ab68@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).