From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: "Abhishek Chauhan (ABC)" <quic_abchauha@quicinc.com>,
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 v1 3/3] net: Add additional bit to support userspace timestamp type
Date: Wed, 10 Apr 2024 18:58:30 -0400 [thread overview]
Message-ID: <66171996a10d2_2d123b29418@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <f28de1e7-4a9b-4a97-b4f9-723425725b58@quicinc.com>
Abhishek Chauhan (ABC) wrote:
>
>
> On 4/10/2024 8:42 AM, Willem de Bruijn wrote:
> > Abhishek Chauhan wrote:
> >> tstamp_type can be real, mono or userspace timestamp.
> >>
> >> This commit adds userspace timestamp and sets it if there is
> >> valid transmit_time available in socket coming from userspace.
> >>
> >> To make the design scalable for future needs this commit bring in
> >> the change to extend the tstamp_type:1 to tstamp_type:2 to support
> >> userspace timestamp.
> >>
> >> Link: https://lore.kernel.org/netdev/bc037db4-58bb-4861-ac31-a361a93841d3@linux.dev/
> >> Signed-off-by: Abhishek Chauhan <quic_abchauha@quicinc.com>
> > With pahole, does this have an effect on sk_buff layout?
> >
> I think it does and it also impacts BPF testing. Hence in my cover letter i have mentioned that these
> changes will impact BPF. My level of expertise is very limited to BPF hence the reason for RFC.
> That being said i am actually trying to understand/learn BPF instructions to know things better.
> I think we need to also change the offset SKB_MONO_DELIVERY_TIME_MASK and TC_AT_INGRESS_MASK
>
>
> #ifdef __BIG_ENDIAN_BITFIELD
> #define SKB_MONO_DELIVERY_TIME_MASK (1 << 7) //Suspecting changes here too
> #define TC_AT_INGRESS_MASK (1 << 6) // and here
> #else
> #define SKB_MONO_DELIVERY_TIME_MASK (1 << 0)
> #define TC_AT_INGRESS_MASK (1 << 1) (this might have to change to 1<<2 )
> #endif
> #define SKB_BF_MONO_TC_OFFSET offsetof(struct sk_buff, __mono_tc_offset)
>
> Also i suspect i change in /selftests/bpf/prog_tests/ctx_rewrite.c
> I am trying to figure out what this part of the code is doing.
> https://lore.kernel.org/all/20230321014115.997841-4-kuba@kernel.org/
>
> Please correct me if i am wrong here.
I broadly agree. We should convert all references to
SKB_MONO_DELIVERY_TIME_MASK to an skb_tstamp_type equivalent.
>
> >> @@ -4274,7 +4280,16 @@ static inline void skb_set_delivery_time(struct sk_buff *skb, ktime_t kt,
> >> enum skb_tstamp_type tstamp_type)
> >> {
> >> skb->tstamp = kt;
> >> - skb->tstamp_type = kt && tstamp_type;
> >> +
> >> + if (skb->tstamp_type)
> >> + return;
> >> +
> >
> I can put a warn on here incase if both MONO and TAI are set.
> OR
> Rather make it simple as you have mentioned below.
When might skb->tstamp_type already be non-zero when
skb_set_deliver_type is called?
In most cases, this is called for a fresh skb.
In br_ip6_fragment, it is called with a previous value. But this is
the value of skb->tstamp_type. It just clears it if kt is 0.
If skb->tstamp_type != tstamp_type is not a condition that can be
forced by an unprivileged user, then we can warn.
next prev parent reply other threads:[~2024-04-10 22:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 21:05 [RFC PATCH bpf-next v1 0/3] Rename mono_delivery_time to Abhishek Chauhan
2024-04-09 21:05 ` [RFC PATCH bpf-next v1 1/3] net: Rename mono_delivery_time to tstamp_type for scalabilty Abhishek Chauhan
2024-04-10 15:30 ` Willem de Bruijn
2024-04-10 19:04 ` Abhishek Chauhan (ABC)
2024-04-09 21:05 ` [RFC PATCH bpf-next v1 2/3] net: assign enum to skb->tstamp_type to distinguish between tstamp Abhishek Chauhan
2024-04-10 15:35 ` Willem de Bruijn
2024-04-10 19:07 ` Abhishek Chauhan (ABC)
2024-04-09 21:05 ` [RFC PATCH bpf-next v1 3/3] net: Add additional bit to support userspace timestamp type Abhishek Chauhan
2024-04-10 15:42 ` Willem de Bruijn
2024-04-10 20:25 ` Abhishek Chauhan (ABC)
2024-04-10 22:58 ` Willem de Bruijn [this message]
2024-04-10 23:25 ` Martin KaFai Lau
2024-04-10 23:39 ` Abhishek Chauhan (ABC)
2024-04-12 21:14 ` 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=66171996a10d2_2d123b29418@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.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=quic_abchauha@quicinc.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®