mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-29 17:35:36 -04:00
Merge branch 'selftests-net-a-few-fixes'
Paolo Abeni says: ==================== selftests: net: a few fixes This series address self-tests failures for udp gro-related tests. The first patch addresses the main problem I observe locally - the XDP program required by such tests, xdp_dummy, is currently build in the ebpf self-tests directory, not available if/when the user targets net only. Arguably is more a refactor than a fix, but still targeting net to hopefully The second patch fixes the integration of such tests with the build system. Patch 3/3 fixes sporadic failures due to races. Tested with: make -C tools/testing/selftests/ TARGETS=net install ./tools/testing/selftests/kselftest_install/run_kselftest.sh \ -t "net:udpgro_bench.sh net:udpgro.sh net:udpgro_fwd.sh \ net:udpgro_frglist.sh net:veth.sh" no failures. ==================== Link: https://lore.kernel.org/r/cover.1706131762.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -55,6 +55,7 @@ TEST_PROGS += rps_default_mask.sh
|
||||
TEST_PROGS += big_tcp.sh
|
||||
TEST_PROGS_EXTENDED := in_netns.sh setup_loopback.sh setup_veth.sh
|
||||
TEST_PROGS_EXTENDED += toeplitz_client.sh toeplitz.sh lib.sh
|
||||
TEST_PROGS_EXTENDED += net_helper.sh
|
||||
TEST_GEN_FILES = socket nettest
|
||||
TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any
|
||||
TEST_GEN_FILES += tcp_mmap tcp_inq psock_snd txring_overwrite
|
||||
@@ -84,6 +85,7 @@ TEST_PROGS += sctp_vrf.sh
|
||||
TEST_GEN_FILES += sctp_hello
|
||||
TEST_GEN_FILES += csum
|
||||
TEST_GEN_FILES += nat6to4.o
|
||||
TEST_GEN_FILES += xdp_dummy.o
|
||||
TEST_GEN_FILES += ip_local_port_range
|
||||
TEST_GEN_FILES += bind_wildcard
|
||||
TEST_PROGS += test_vxlan_mdb.sh
|
||||
@@ -104,7 +106,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread
|
||||
$(OUTPUT)/bind_bhash: LDLIBS += -lpthread
|
||||
$(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/
|
||||
|
||||
# Rules to generate bpf obj nat6to4.o
|
||||
# Rules to generate bpf objs
|
||||
CLANG ?= clang
|
||||
SCRATCH_DIR := $(OUTPUT)/tools
|
||||
BUILD_DIR := $(SCRATCH_DIR)/build
|
||||
@@ -139,7 +141,7 @@ endif
|
||||
|
||||
CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
|
||||
|
||||
$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS)
|
||||
$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS)
|
||||
$(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@
|
||||
|
||||
$(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
|
||||
|
||||
@@ -7,7 +7,7 @@ source net_helper.sh
|
||||
|
||||
readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
|
||||
|
||||
BPF_FILE="../bpf/xdp_dummy.bpf.o"
|
||||
BPF_FILE="xdp_dummy.o"
|
||||
|
||||
# set global exit status, but never reset nonzero one.
|
||||
check_err()
|
||||
@@ -197,7 +197,7 @@ run_all() {
|
||||
}
|
||||
|
||||
if [ ! -f ${BPF_FILE} ]; then
|
||||
echo "Missing ${BPF_FILE}. Build bpf selftest first"
|
||||
echo "Missing ${BPF_FILE}. Run 'make' first"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ source net_helper.sh
|
||||
|
||||
readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
|
||||
|
||||
BPF_FILE="../bpf/xdp_dummy.bpf.o"
|
||||
BPF_FILE="xdp_dummy.o"
|
||||
|
||||
cleanup() {
|
||||
local -r jobs="$(jobs -p)"
|
||||
@@ -84,7 +84,7 @@ run_all() {
|
||||
}
|
||||
|
||||
if [ ! -f ${BPF_FILE} ]; then
|
||||
echo "Missing ${BPF_FILE}. Build bpf selftest first"
|
||||
echo "Missing ${BPF_FILE}. Run 'make' first"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ source net_helper.sh
|
||||
|
||||
readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
|
||||
|
||||
BPF_FILE="../bpf/xdp_dummy.bpf.o"
|
||||
BPF_FILE="xdp_dummy.o"
|
||||
|
||||
cleanup() {
|
||||
local -r jobs="$(jobs -p)"
|
||||
@@ -85,12 +85,12 @@ run_all() {
|
||||
}
|
||||
|
||||
if [ ! -f ${BPF_FILE} ]; then
|
||||
echo "Missing ${BPF_FILE}. Build bpf selftest first"
|
||||
echo "Missing ${BPF_FILE}. Run 'make' first"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ ! -f nat6to4.o ]; then
|
||||
echo "Missing nat6to4 helper. Build bpf nat6to4.o selftest first"
|
||||
echo "Missing nat6to4 helper. Run 'make' first"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
BPF_FILE="../bpf/xdp_dummy.bpf.o"
|
||||
source net_helper.sh
|
||||
|
||||
BPF_FILE="xdp_dummy.o"
|
||||
readonly BASE="ns-$(mktemp -u XXXXXX)"
|
||||
readonly SRC=2
|
||||
readonly DST=1
|
||||
@@ -119,7 +121,7 @@ run_test() {
|
||||
ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000
|
||||
ip netns exec $NS_DST ./udpgso_bench_rx -C 1000 -R 10 -n 10 -l 1300 $rx_args &
|
||||
local spid=$!
|
||||
sleep 0.1
|
||||
wait_local_port_listen "$NS_DST" 8000 udp
|
||||
ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst
|
||||
local retc=$?
|
||||
wait $spid
|
||||
@@ -168,7 +170,7 @@ run_bench() {
|
||||
ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus"
|
||||
ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 1000 -R 10 &
|
||||
local spid=$!
|
||||
sleep 0.1
|
||||
wait_local_port_listen "$NS_DST" 8000 udp
|
||||
ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst
|
||||
local retc=$?
|
||||
wait $spid
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
BPF_FILE="../bpf/xdp_dummy.bpf.o"
|
||||
BPF_FILE="xdp_dummy.o"
|
||||
readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
|
||||
readonly BASE=`basename $STATS`
|
||||
readonly SRC=2
|
||||
@@ -218,7 +218,7 @@ while getopts "hs:" option; do
|
||||
done
|
||||
|
||||
if [ ! -f ${BPF_FILE} ]; then
|
||||
echo "Missing ${BPF_FILE}. Build bpf selftest first"
|
||||
echo "Missing ${BPF_FILE}. Run 'make' first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
13
tools/testing/selftests/net/xdp_dummy.c
Normal file
13
tools/testing/selftests/net/xdp_dummy.c
Normal file
@@ -0,0 +1,13 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#define KBUILD_MODNAME "xdp_dummy"
|
||||
#include <linux/bpf.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
|
||||
SEC("xdp")
|
||||
int xdp_dummy_prog(struct xdp_md *ctx)
|
||||
{
|
||||
return XDP_PASS;
|
||||
}
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
Reference in New Issue
Block a user