From: "Abhishek Chauhan (ABC)" <quic_abchauha@quicinc.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Andrew Halaney <ahalaney@redhat.com>,
"Martin KaFai Lau" <martin.lau@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>
Cc: <kernel@quicinc.com>
Subject: Re: [RFC PATCH bpf-next v3 1/2] net: Rename mono_delivery_time to tstamp_type for scalabilty
Date: Mon, 15 Apr 2024 14:26:10 -0700 [thread overview]
Message-ID: <83dbc057-be42-41d6-95a3-af4b01d64afb@quicinc.com> (raw)
In-Reply-To: <661d9a8bb862c_314dd2942c@willemb.c.googlers.com.notmuch>
On 4/15/2024 2:22 PM, Willem de Bruijn wrote:
>>>>>> static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt,
>>>>>> - bool mono)
>>>>>> + u8 tstamp_type)
>>>>>> {
>>>>>> skb->tstamp = kt;
>>>>>> - skb->mono_delivery_time = kt && mono;
>>>>>> +
>>>>>> + switch (tstamp_type) {
>>>>>> + case CLOCK_REAL:
>>>>>> + skb->tstamp_type = CLOCK_REAL;
>>>>>> + break;
>>>>>> + case CLOCK_MONO:
>>>>>> + skb->tstamp_type = kt && tstamp_type;
>>>>>> + break;
>>>>>> + }
>>>>>
>>>>> Technically this leaves the tstamp_type undefined if (skb, 0, CLOCK_REAL)
>>>> Do you think i should be checking for valid value of tstamp before setting the tstamp_type ? Only then set it.
>>>
>>> A kt of 0 is interpreted as resetting the type. That should probably
>>> be maintained.
>>>
>>> For SO_TIMESTAMPING, a mono delivery time of 0 does have some meaning.
>>> In __sock_recv_timestamp:
>>>
>>> /* Race occurred between timestamp enabling and packet
>>> receiving. Fill in the current time for now. */
>>> if (need_software_tstamp && skb->tstamp == 0) {
>>> __net_timestamp(skb);
>>> false_tstamp = 1;
>>> }
>>
>> Well in that case the above logic still resets the tstamp and sets the tstamp_type to CLOCK_REAL(value 0).
>> Anyway the tstamp_type will be 0 to begin with.
>> The logic is still inline with previous implementation, because previously if kt was 0 then kt && mono sets the tstamp_type (previously called as mono_delivery_time) to 0 (i.e SKB_CLOCK_REAL).
>
> Sorry, I got my defaults confused. If we maintain that a zero tstamp
> resets the type, then here should be no case with skb->tstamp 0 and
> skb->tstamp_type SKB_CLOCK_REAL (or SKB_CLOCK_TAI or whatever). I
> think it's preferable to make that obvious in the
> skb_set_delivery_time implementation, rather than depend on knowledge
> of its callers.
Noted!. I will do the same as part of the next patchset.
next prev parent reply other threads:[~2024-04-15 21:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 21:01 [RFC PATCH bpf-next v3 0/2] Replace mono_delivery_time with tstamp_type Abhishek Chauhan
2024-04-12 21:01 ` [RFC PATCH bpf-next v3 1/2] net: Rename mono_delivery_time to tstamp_type for scalabilty Abhishek Chauhan
2024-04-13 0:37 ` Abhishek Chauhan (ABC)
2024-04-13 18:54 ` Willem de Bruijn
2024-04-15 20:27 ` Abhishek Chauhan (ABC)
2024-04-15 20:46 ` Willem de Bruijn
2024-04-15 21:06 ` Abhishek Chauhan (ABC)
2024-04-15 21:22 ` Willem de Bruijn
2024-04-15 21:26 ` Abhishek Chauhan (ABC) [this message]
2024-04-12 21:01 ` [RFC PATCH bpf-next v3 2/2] net: Add additional bit to support userspace timestamp type Abhishek Chauhan
2024-04-13 19:07 ` Willem de Bruijn
2024-04-15 20:00 ` Martin KaFai Lau
2024-04-16 23:40 ` Abhishek Chauhan (ABC)
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=83dbc057-be42-41d6-95a3-af4b01d64afb@quicinc.com \
--to=quic_abchauha@quicinc.com \
--cc=ahalaney@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel@quicinc.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@gmail.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
all inboxes | Powered by JetHome®