aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/xdp_tx.c
diff options
context:
space:
mode:
authorToshiaki Makita <toshiaki.makita1@gmail.com>2019-06-20 11:23:23 +0900
committerAlexei Starovoitov <ast@kernel.org>2019-06-24 18:18:30 -0700
commit88091ff56b71d73c5577ebefcd4f0f721a359077 (patch)
treec549ab6304d16f4d6423b161980c0070d730496d /tools/testing/selftests/bpf/progs/xdp_tx.c
parentxsk: sample kernel code is now in libbpf (diff)
downloadlinux-dev-88091ff56b71d73c5577ebefcd4f0f721a359077.tar.xz
linux-dev-88091ff56b71d73c5577ebefcd4f0f721a359077.zip
selftests, bpf: Add test for veth native XDP
Add a test case for veth native XDP. It checks if XDP_PASS, XDP_TX and XDP_REDIRECT work properly. $ cd tools/testing/selftests/bpf $ make \ TEST_CUSTOM_PROGS= \ TEST_GEN_PROGS= \ TEST_GEN_PROGS_EXTENDED= \ TEST_PROGS_EXTENDED= \ TEST_PROGS="test_xdp_veth.sh" \ run_tests TAP version 13 1..1 # selftests: bpf: test_xdp_veth.sh # PING 10.1.1.33 (10.1.1.33) 56(84) bytes of data. # 64 bytes from 10.1.1.33: icmp_seq=1 ttl=64 time=0.073 ms # # --- 10.1.1.33 ping statistics --- # 1 packets transmitted, 1 received, 0% packet loss, time 0ms # rtt min/avg/max/mdev = 0.073/0.073/0.073/0.000 ms # selftests: xdp_veth [PASS] ok 1 selftests: bpf: test_xdp_veth.sh Signed-off-by: Toshiaki Makita <toshiaki.makita1@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/xdp_tx.c')
-rw-r--r--tools/testing/selftests/bpf/progs/xdp_tx.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/xdp_tx.c b/tools/testing/selftests/bpf/progs/xdp_tx.c
new file mode 100644
index 000000000000..57912e7c94b0
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/xdp_tx.c
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/bpf.h>
+#include "bpf_helpers.h"
+
+SEC("tx")
+int xdp_tx(struct xdp_md *xdp)
+{
+ return XDP_TX;
+}
+
+char _license[] SEC("license") = "GPL";