From: Martin KaFai Lau <martin.lau@linux.dev>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
"Abhishek Chauhan (ABC)" <quic_abchauha@quicinc.com>
Cc: kernel@quicinc.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>,
bpf <bpf@vger.kernel.org>, Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [PATCH net-next v4] net: Re-use and set mono_delivery_time bit for userspace tstamp packets
Date: Thu, 14 Mar 2024 12:21:58 -0700 [thread overview]
Message-ID: <5692ddb3-9558-4440-a7bf-47fcc47401ed@linux.dev> (raw)
In-Reply-To: <65f2c81fc7988_3ee61729465@willemb.c.googlers.com.notmuch>
On 3/14/24 2:49 AM, Willem de Bruijn wrote:
>> The two bits could potentially only encode the delivery time that is allowed to
>> be forwarded without reset. 0 could mean refering back to sk_clockid and don't
>> forward. The final consumer of the forwarded skb->tstamp is the qdisc which
>> currently only has mono and tai.
>
> So the followinng meaning of bit pair
> { skb->mono_delivery_time, skb->user_delivery_time } ?
>
> - { 0, 0 } legacy skb->tstamp: realtime on rx
> - { 1, 0 } skb->tstamp is mono: existing behavior of mono_delivery_time bit
> - { 0, 1 } skb->tstamp is tai: analogous to mono case
> - { 1, 1 } skb->tstamp defined by skb->sk->sk_clockid
I was thinking only forward mono and tai until it is clearer how other clocks
will be useful for forwarding between e/ingress. By resetting all skb->tstamp
other than mono and tai, { 0, 0 } at ingress will mean realtime on rx and { 0, 0
} at egress will mean go look skb->sk->sk_clockid.
I do like your scheme such that it is much clearer what is in skb->tstamp
without depending on other bits like tc_at_ingress or not.
"{ 0, 1 } skb->tstamp is tai: analogous to mono case" can probably be dropped
for now until bpf_skb_set_tstamp(BPF_SKB_TSTAMP_DELIVERY_TAI) is needed.
Otherwise, it is mostly a duplicate of "{ 1, 1 } skb->tstamp defined by
skb->sk->sk_clockid".
The bpf_convert_tstamp_{read,write} and the helper bpf_skb_set_tstamp need to be
changed to handle the new "user_delivery_time" bit anyway, e.g.
bpf_skb_set_tstamp(BPF_SKB_TSTAMP_DELIVERY_MONO) needs to clear the
"user_delivery_time" bit.
I think the "struct inet_frag_queue" also needs a new "user_delivery_time"
field. "mono_delivery_time" is already in there.
It may as well be cleaner to combine mono_delivery_time and user_delivery_time
into a 2 bits field like:
struct sk_buff {
__u8 tstamp_type:2;
};
enum {
SKB_TSTAMP_TYPE_RX_REAL = 0, /* A RX (receive) time in real */
SKB_TSTAMP_TYPE_TX_MONO = 1, /* A TX (delivery) time in mono */
/* A TX (delivery) time and its clock is in skb->sk->sk_clockid.
*
* BPF_SKB_TSTAMP_DELIVERY_USER should be added
* such that reading __sk_buff->tstamp_type will match the
* SKB_TSTAMP_TYPE_TX_USER.
*
* The bpf program can learn the clockid by
* reading skb->sk->sk_clockid.
*
* bpf_skb_set_tstamp(BPF_SKB_TSTAMP_DELIVERY_USER)
* should be disallowed for now until the use case
* is more clear. Potentially, we could allow it
* in the future as long as
* the sock_flag(sk, SOCK_TXTIME) is true at that moment.
*/
SKB_TSTAMP_TYPE_TX_USER = 2,
/* UNUSED_FOR_FUTURE = 3, */
};
It will have more code churns in the first patch to rename
s/mono_delivery_time/tstamp_type/.
wdyt?
next prev parent reply other threads:[~2024-03-14 19:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 20:13 [PATCH net-next v4] net: Re-use and set mono_delivery_time bit for userspace tstamp packets Abhishek Chauhan
2024-03-01 22:21 ` Willem de Bruijn
2024-03-05 13:00 ` patchwork-bot+netdevbpf
2024-03-12 23:52 ` Martin KaFai Lau
2024-03-13 4:34 ` Abhishek Chauhan (ABC)
2024-03-13 5:32 ` Abhishek Chauhan (ABC)
2024-03-13 8:52 ` Willem de Bruijn
2024-03-13 18:42 ` Martin KaFai Lau
2024-03-13 19:36 ` Willem de Bruijn
2024-03-13 20:59 ` Abhishek Chauhan (ABC)
2024-03-13 21:19 ` Martin KaFai Lau
2024-03-13 21:41 ` Daniel Borkmann
2024-03-13 21:01 ` Martin KaFai Lau
2024-03-13 21:26 ` Abhishek Chauhan (ABC)
2024-03-13 21:40 ` Willem de Bruijn
2024-03-13 22:08 ` Martin KaFai Lau
2024-03-14 9:49 ` Willem de Bruijn
2024-03-14 19:21 ` Martin KaFai Lau [this message]
2024-03-14 20:28 ` Willem de Bruijn
2024-03-14 20:53 ` Abhishek Chauhan (ABC)
2024-03-14 21:48 ` Martin KaFai Lau
2024-03-14 21:54 ` Martin KaFai Lau
2024-03-14 22:29 ` Abhishek Chauhan (ABC)
2024-03-18 19:02 ` Abhishek Chauhan (ABC)
2024-03-19 19:46 ` Martin KaFai Lau
2024-03-19 20:12 ` Abhishek Chauhan (ABC)
2024-03-20 6:22 ` Abhishek Chauhan (ABC)
2024-03-20 20:30 ` Martin KaFai Lau
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=5692ddb3-9558-4440-a7bf-47fcc47401ed@linux.dev \
--to=martin.lau@linux.dev \
--cc=ahalaney@redhat.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--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=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=quic_abchauha@quicinc.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;
as well as URLs for NNTP newsgroup(s).