Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: name bpf objects consistently and simplify Makefile

The BPF sources moved with bpf_offload.py have a suffix of .bpf.c
which seems to be useful convention. Rename the 2 other BPF sources
we had. Use wildcard in the Makefile, since we can match all those
files easily now.

Link: https://lore.kernel.org/r/20240423183542.3807234-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+11 -14
+3 -6
tools/testing/selftests/net/Makefile
··· 82 82 TEST_PROGS += sctp_vrf.sh 83 83 TEST_GEN_FILES += sctp_hello 84 84 TEST_GEN_FILES += csum 85 - TEST_GEN_FILES += nat6to4.o 86 - TEST_GEN_FILES += xdp_dummy.o 87 - TEST_GEN_FILES += sample_ret0.bpf.o 88 - TEST_GEN_FILES += sample_map_ret0.bpf.o 89 85 TEST_GEN_FILES += ip_local_port_range 90 86 TEST_GEN_FILES += bind_wildcard 91 87 TEST_PROGS += test_vxlan_mdb.sh ··· 95 99 96 100 TEST_FILES := settings 97 101 TEST_FILES += in_netns.sh lib.sh net_helper.sh setup_loopback.sh setup_veth.sh 102 + 103 + TEST_GEN_FILES += $(patsubst %.c,%.o,$(wildcard *.bpf.c)) 98 104 99 105 TEST_INCLUDES := forwarding/lib.sh 100 106 ··· 144 146 145 147 CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) 146 148 147 - BPF_PROG_OBJS := $(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o \ 148 - $(OUTPUT)/sample_map_ret0.bpf.o $(OUTPUT)/sample_ret0.bpf.o 149 + BPF_PROG_OBJS := $(patsubst %.c,$(OUTPUT)/%.o,$(wildcard *.bpf.c)) 149 150 150 151 $(BPF_PROG_OBJS): $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) 151 152 $(call msg,BPF_PROG,,$@)
tools/testing/selftests/net/nat6to4.c tools/testing/selftests/net/nat6to4.bpf.c
+1 -1
tools/testing/selftests/net/udpgro.sh
··· 7 7 8 8 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" 9 9 10 - BPF_FILE="xdp_dummy.o" 10 + BPF_FILE="xdp_dummy.bpf.o" 11 11 12 12 # set global exit status, but never reset nonzero one. 13 13 check_err()
+1 -1
tools/testing/selftests/net/udpgro_bench.sh
··· 7 7 8 8 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" 9 9 10 - BPF_FILE="xdp_dummy.o" 10 + BPF_FILE="xdp_dummy.bpf.o" 11 11 12 12 cleanup() { 13 13 local -r jobs="$(jobs -p)"
+4 -4
tools/testing/selftests/net/udpgro_frglist.sh
··· 7 7 8 8 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" 9 9 10 - BPF_FILE="xdp_dummy.o" 10 + BPF_FILE="xdp_dummy.bpf.o" 11 11 12 12 cleanup() { 13 13 local -r jobs="$(jobs -p)" ··· 42 42 43 43 ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp 44 44 tc -n "${PEER_NS}" qdisc add dev veth1 clsact 45 - tc -n "${PEER_NS}" filter add dev veth1 ingress prio 4 protocol ipv6 bpf object-file nat6to4.o section schedcls/ingress6/nat_6 direct-action 46 - tc -n "${PEER_NS}" filter add dev veth1 egress prio 4 protocol ip bpf object-file nat6to4.o section schedcls/egress4/snat4 direct-action 45 + tc -n "${PEER_NS}" filter add dev veth1 ingress prio 4 protocol ipv6 bpf object-file nat6to4.bpf.o section schedcls/ingress6/nat_6 direct-action 46 + tc -n "${PEER_NS}" filter add dev veth1 egress prio 4 protocol ip bpf object-file nat6to4.bpf.o section schedcls/egress4/snat4 direct-action 47 47 echo ${rx_args} 48 48 ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -r & 49 49 ··· 89 89 exit -1 90 90 fi 91 91 92 - if [ ! -f nat6to4.o ]; then 92 + if [ ! -f nat6to4.bpf.o ]; then 93 93 echo "Missing nat6to4 helper. Run 'make' first" 94 94 exit -1 95 95 fi
+1 -1
tools/testing/selftests/net/udpgro_fwd.sh
··· 3 3 4 4 source net_helper.sh 5 5 6 - BPF_FILE="xdp_dummy.o" 6 + BPF_FILE="xdp_dummy.bpf.o" 7 7 readonly BASE="ns-$(mktemp -u XXXXXX)" 8 8 readonly SRC=2 9 9 readonly DST=1
+1 -1
tools/testing/selftests/net/veth.sh
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 - BPF_FILE="xdp_dummy.o" 4 + BPF_FILE="xdp_dummy.bpf.o" 5 5 readonly STATS="$(mktemp -p /tmp ns-XXXXXX)" 6 6 readonly BASE=`basename $STATS` 7 7 readonly SRC=2
tools/testing/selftests/net/xdp_dummy.c tools/testing/selftests/net/xdp_dummy.bpf.c