From: Zvi Effron <zeffron@riotgames.com>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
Martin KaFai Lau <kafai@fb.com>,
Zvi Effron <zeffron@riotgames.com>
Subject: [PATCH bpf-next v4 0/3] bpf: support input xdp_md context in BPF_PROG_TEST_RUN
Date: Fri, 4 Jun 2021 22:02:32 +0000 [thread overview]
Message-ID: <20210604220235.6758-1-zeffron@riotgames.com> (raw)
This patchset adds support for passing an xdp_md via ctx_in/ctx_out in
bpf_attr for BPF_PROG_TEST_RUN of XDP programs.
Patch 1 adds initial support for passing XDP meta data in addition to
packet data.
Patch 2 adds support for also specifying the ingress interface and
rx queue.
Patch 3 adds selftests to ensure functionality is correct.
Changelog:
----------
v3->v4
v3: https://lore.kernel.org/bpf/20210602190815.8096-1-zeffron@riotgames.com/
* Clean up nits
* Validate xdp_md->data_end in bpf_prog_test_run_xdp
* Remove intermediate metalen variables
v2 -> v3
v2: https://lore.kernel.org/bpf/20210527201341.7128-1-zeffron@riotgames.com/
* Check errno first in selftests
* Use DECLARE_LIBBPF_OPTS
* Rename tattr to opts in selftests
* Remove extra new line
* Rename convert_xdpmd_to_xdpb to xdp_convert_md_to_buff
* Rename convert_xdpb_to_xdpmd to xdp_convert_buff_to_md
* Move declaration of device and rxqueue in xdp_convert_md_to_buff to
patch 2
* Reorder the kfree calls in bpf_prog_test_run_xdp
v1 -> v2
v1: https://lore.kernel.org/bpf/20210524220555.251473-1-zeffron@riotgames.com
* Fix null pointer dereference with no context
* Use the BPF skeleton and replace CHECK with ASSERT macros
Zvi Effron (3):
bpf: support input xdp_md context in BPF_PROG_TEST_RUN
bpf: support specifying ingress via xdp_md context in
BPF_PROG_TEST_RUN
selftests/bpf: Add test for xdp_md context in BPF_PROG_TEST_RUN
include/uapi/linux/bpf.h | 3 -
net/bpf/test_run.c | 91 ++++++++++++--
.../bpf/prog_tests/xdp_context_test_run.c | 114 ++++++++++++++++++
.../bpf/progs/test_xdp_context_test_run.c | 20 +++
4 files changed, 218 insertions(+), 10 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
create mode 100644 tools/testing/selftests/bpf/progs/test_xdp_context_test_run.c
base-commit: 56b8b7f9533b5c40cbc1266b5cc6a3b19dfd2aad
--
2.31.1
next reply other threads:[~2021-06-04 22:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 22:02 Zvi Effron [this message]
2021-06-04 22:02 ` [PATCH bpf-next v4 1/3] bpf: support input xdp_md context in BPF_PROG_TEST_RUN Zvi Effron
2021-06-06 3:17 ` Yonghong Song
2021-06-07 17:58 ` Martin KaFai Lau
2021-06-09 17:06 ` Zvi Effron
2021-06-10 0:07 ` Yonghong Song
2021-06-04 22:02 ` [PATCH bpf-next v4 2/3] bpf: support specifying ingress via " Zvi Effron
2021-06-06 3:36 ` Yonghong Song
2021-06-04 22:02 ` [PATCH bpf-next v4 3/3] selftests/bpf: Add test for " Zvi Effron
2021-06-06 4:18 ` Yonghong Song
2021-06-09 17:07 ` Zvi Effron
2021-06-10 0:11 ` Yonghong Song
2021-06-06 5:36 ` Yonghong Song
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=20210604220235.6758-1-zeffron@riotgames.com \
--to=zeffron@riotgames.com \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=kafai@fb.com \
--cc=maciej.fijalkowski@intel.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