From: John Fastabend <john.fastabend@gmail.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>, bpf@vger.kernel.org
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
netdev@vger.kernel.org, Daniel Borkmann <borkmann@iogearbox.net>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>
Subject: RE: [PATCH bpf-next V1 1/2] bpf: BPF-helper for MTU checking add length input
Date: Wed, 17 Feb 2021 12:20:55 -0800 [thread overview]
Message-ID: <602d7aa7bfbb5_ddd220836@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <161340436275.1234345.10317671988851040002.stgit@firesoul>
Jesper Dangaard Brouer wrote:
> The FIB lookup example[1] show how the IP-header field tot_len
> (iph->tot_len) is used as input to perform the MTU check.
>
> This patch extend the BPF-helper bpf_check_mtu() with the same ability
> to provide the length as user parameter input, via mtu_len parameter.
>
> [1] samples/bpf/xdp_fwd_kern.c
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> ---
> include/uapi/linux/bpf.h | 17 +++++++++++------
> net/core/filter.c | 12 ++++++++++--
> 2 files changed, 21 insertions(+), 8 deletions(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 4c24daa43bac..9c8aa50dc8a5 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -3850,8 +3850,7 @@ union bpf_attr {
> *
> * long bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_diff, u64 flags)
> * Description
> -
> - * Check ctx packet size against exceeding MTU of net device (based
> + * Check packet size against exceeding MTU of net device (based
> * on *ifindex*). This helper will likely be used in combination
> * with helpers that adjust/change the packet size.
> *
> @@ -3868,6 +3867,14 @@ union bpf_attr {
> * against the current net device. This is practical if this isn't
> * used prior to redirect.
> *
> + * On input *mtu_len* must be a valid pointer, else verifier will
> + * reject BPF program. If the value *mtu_len* is initialized to
> + * zero then the ctx packet size is use. When value *mtu_len* is
> + * provided as input this specify the L3 length that the MTU check
> + * is done against. Remeber XDP and TC length operate at L2, but
^^^^^^^
typo, Remember
Acked-by: John Fastabend <john.fastabend@gmail.com>
next prev parent reply other threads:[~2021-02-17 20:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-15 15:52 [PATCH bpf-next V1 0/2] bpf: Updates for BPF-helper bpf_check_mtu Jesper Dangaard Brouer
2021-02-15 15:52 ` [PATCH bpf-next V1 1/2] bpf: BPF-helper for MTU checking add length input Jesper Dangaard Brouer
2021-02-17 20:20 ` John Fastabend [this message]
2021-02-15 15:52 ` [PATCH bpf-next V1 2/2] selftests/bpf: Tests using bpf_check_mtu BPF-helper input mtu_len param Jesper Dangaard Brouer
2021-02-17 20:27 ` John Fastabend
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=602d7aa7bfbb5_ddd220836@john-XPS-13-9370.notmuch \
--to=john.fastabend@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=borkmann@iogearbox.net \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=netdev@vger.kernel.org \
/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).