From: Lorenzo Bianconi <lorenzo@kernel.org>
To: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org, lorenzo.bianconi@redhat.com,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, joamaki@gmail.com
Subject: [PATCH bpf] selftests/bpf: fix xdp_redirect xdp-features for xdp_bonding selftest
Date: Fri, 14 Apr 2023 23:21:43 +0200 [thread overview]
Message-ID: <73f0028461c4f3fa577e24d8d797ddd76f1d17c6.1681507058.git.lorenzo@kernel.org> (raw)
NETDEV_XDP_ACT_NDO_XMIT is not enabled by default for veth driver but it
depends on the device configuration. Fix XDP_REDIRECT xdp-features in
xdp_bonding selftest loading a dummy XDP program on veth2_2 device.
Fixes: fccca038f300 ("veth: take into account device reconfiguration for xdp_features flag")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
tools/testing/selftests/bpf/prog_tests/xdp_bonding.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
index 5e3a26b15ec6..dcbe30c81291 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
@@ -168,6 +168,17 @@ static int bonding_setup(struct skeletons *skeletons, int mode, int xmit_policy,
if (xdp_attach(skeletons, skeletons->xdp_dummy->progs.xdp_dummy_prog, "veth1_2"))
return -1;
+
+ if (!ASSERT_OK(setns_by_name("ns_dst"), "set netns to ns_dst"))
+ return -1;
+
+ /* Load a dummy XDP program on veth2_2 in order to enable
+ * NETDEV_XDP_ACT_NDO_XMIT feature
+ */
+ if (xdp_attach(skeletons, skeletons->xdp_dummy->progs.xdp_dummy_prog, "veth2_2"))
+ return -1;
+
+ restore_root_netns();
}
SYS("ip -netns ns_dst link set veth2_1 master bond2");
--
2.39.2
next reply other threads:[~2023-04-14 21:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 21:21 Lorenzo Bianconi [this message]
2023-04-14 21:59 ` [PATCH bpf] selftests/bpf: fix xdp_redirect xdp-features for xdp_bonding selftest Daniel Borkmann
2023-04-14 22:10 ` Lorenzo Bianconi
2023-04-14 22:15 ` Daniel Borkmann
2023-04-15 11:06 ` Lorenzo Bianconi
2023-04-17 20:20 ` Alexei Starovoitov
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=73f0028461c4f3fa577e24d8d797ddd76f1d17c6.1681507058.git.lorenzo@kernel.org \
--to=lorenzo@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=joamaki@gmail.com \
--cc=lorenzo.bianconi@redhat.com \
--cc=martin.lau@linux.dev \
--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