From: Daniel Borkmann <daniel@iogearbox.net>
To: Martin KaFai Lau <kafai@fb.com>,
bpf@vger.kernel.org, netdev@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
David Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
kernel-team@fb.com, Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH v4 net-next 3/8] net: Set skb->mono_delivery_time and clear it after sch_handle_ingress()
Date: Tue, 15 Feb 2022 22:04:05 +0100 [thread overview]
Message-ID: <ea27aeb8-e983-c22c-1217-0a38dceaec1c@iogearbox.net> (raw)
In-Reply-To: <20220211071251.887078-1-kafai@fb.com>
On 2/11/22 8:12 AM, Martin KaFai Lau wrote:
[...]
> +
> +DECLARE_STATIC_KEY_FALSE(netstamp_needed_key);
> +
> +/* It is used in the ingress path to clear the delivery_time.
> + * If needed, set the skb->tstamp to the (rcv) timestamp.
> + */
> +static inline void skb_clear_delivery_time(struct sk_buff *skb)
> +{
> + if (unlikely(skb->mono_delivery_time)) {
> + skb->mono_delivery_time = 0;
> + if (static_branch_unlikely(&netstamp_needed_key))
> + skb->tstamp = ktime_get_real();
> + else
> + skb->tstamp = 0;
> + }
> }
>
> static inline void skb_clear_tstamp(struct sk_buff *skb)
> @@ -3946,6 +3961,14 @@ static inline void skb_clear_tstamp(struct sk_buff *skb)
> skb->tstamp = 0;
> }
>
> +static inline ktime_t skb_tstamp(const struct sk_buff *skb)
> +{
> + if (unlikely(skb->mono_delivery_time))
> + return 0;
> +
> + return skb->tstamp;
> +}
> +
> static inline u8 skb_metadata_len(const struct sk_buff *skb)
> {
Just small nit, but I don't think here and in other patches as well the conditional
for skb->mono_delivery_time should be marked unlikely(). For container workloads
this is very likely.
next prev parent reply other threads:[~2022-02-15 21:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 7:12 [PATCH v4 net-next 0/8] Preserve mono delivery time (EDT) in skb->tstamp Martin KaFai Lau
2022-02-11 7:12 ` [PATCH v4 net-next 1/8] net: Add skb->mono_delivery_time to distinguish mono delivery_time from (rcv) timestamp Martin KaFai Lau
2022-02-12 19:13 ` Cong Wang
2022-02-12 23:27 ` Martin KaFai Lau
2022-02-15 20:49 ` Daniel Borkmann
2022-02-16 6:11 ` Martin KaFai Lau
2022-02-11 7:12 ` [PATCH v4 net-next 2/8] net: Add skb_clear_tstamp() to keep the mono delivery_time Martin KaFai Lau
2022-02-11 7:12 ` [PATCH v4 net-next 3/8] net: Set skb->mono_delivery_time and clear it after sch_handle_ingress() Martin KaFai Lau
2022-02-15 21:04 ` Daniel Borkmann [this message]
2022-02-11 7:12 ` [PATCH v4 net-next 4/8] net: Postpone skb_clear_delivery_time() until knowing the skb is delivered locally Martin KaFai Lau
2022-02-11 7:13 ` [PATCH v4 net-next 5/8] bpf: Keep the (rcv) timestamp behavior for the existing tc-bpf@ingress Martin KaFai Lau
2022-02-15 23:30 ` Daniel Borkmann
2022-02-16 5:51 ` Martin KaFai Lau
2022-02-17 0:03 ` Daniel Borkmann
2022-02-17 1:50 ` Martin KaFai Lau
2022-02-17 6:52 ` Martin KaFai Lau
2022-02-11 7:13 ` [PATCH v4 net-next 6/8] bpf: Clear skb->mono_delivery_time bit if needed after running tc-bpf@egress Martin KaFai Lau
2022-02-11 7:13 ` [PATCH v4 net-next 7/8] bpf: Add __sk_buff->delivery_time_type and bpf_skb_set_delivery_time() Martin KaFai Lau
2022-02-11 7:13 ` [PATCH v4 net-next 8/8] bpf: selftests: test skb->tstamp in redirect_neigh 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=ea27aeb8-e983-c22c-1217-0a38dceaec1c@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kafai@fb.com \
--cc=kernel-team@fb.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--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