Skip to content

Commit 302e57f

Browse files
wangyufen316davem330
authored andcommitted
selftests/net: fix missing xdp_dummy
After commit afef88e ("selftests/bpf: Store BPF object files with .bpf.o extension"), we should use xdp_dummy.bpf.o instade of xdp_dummy.o. In addition, use the BPF_FILE variable to save the BPF object file name, which can be better identified and modified. Fixes: afef88e ("selftests/bpf: Store BPF object files with .bpf.o extension") Signed-off-by: Wang Yufen <[email protected]> Cc: Daniel Müller <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 40b9d1a commit 302e57f

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

tools/testing/selftests/net/udpgro.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
77

8+
BPF_FILE="../bpf/xdp_dummy.bpf.o"
9+
810
# set global exit status, but never reset nonzero one.
911
check_err()
1012
{
@@ -34,7 +36,7 @@ cfg_veth() {
3436
ip -netns "${PEER_NS}" addr add dev veth1 192.168.1.1/24
3537
ip -netns "${PEER_NS}" addr add dev veth1 2001:db8::1/64 nodad
3638
ip -netns "${PEER_NS}" link set dev veth1 up
37-
ip -n "${PEER_NS}" link set veth1 xdp object ../bpf/xdp_dummy.o section xdp
39+
ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp
3840
}
3941

4042
run_one() {
@@ -195,8 +197,8 @@ run_all() {
195197
return $ret
196198
}
197199

198-
if [ ! -f ../bpf/xdp_dummy.o ]; then
199-
echo "Missing xdp_dummy helper. Build bpf selftest first"
200+
if [ ! -f ${BPF_FILE} ]; then
201+
echo "Missing ${BPF_FILE}. Build bpf selftest first"
200202
exit -1
201203
fi
202204

tools/testing/selftests/net/udpgro_bench.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
77

8+
BPF_FILE="../bpf/xdp_dummy.bpf.o"
9+
810
cleanup() {
911
local -r jobs="$(jobs -p)"
1012
local -r ns="$(ip netns list|grep $PEER_NS)"
@@ -34,7 +36,7 @@ run_one() {
3436
ip -netns "${PEER_NS}" addr add dev veth1 2001:db8::1/64 nodad
3537
ip -netns "${PEER_NS}" link set dev veth1 up
3638

37-
ip -n "${PEER_NS}" link set veth1 xdp object ../bpf/xdp_dummy.o section xdp
39+
ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp
3840
ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -r &
3941
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -t ${rx_args} -r &
4042

@@ -80,8 +82,8 @@ run_all() {
8082
run_udp "${ipv6_args}"
8183
}
8284

83-
if [ ! -f ../bpf/xdp_dummy.o ]; then
84-
echo "Missing xdp_dummy helper. Build bpf selftest first"
85+
if [ ! -f ${BPF_FILE} ]; then
86+
echo "Missing ${BPF_FILE}. Build bpf selftest first"
8587
exit -1
8688
fi
8789

tools/testing/selftests/net/udpgro_frglist.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
77

8+
BPF_FILE="../bpf/xdp_dummy.bpf.o"
9+
810
cleanup() {
911
local -r jobs="$(jobs -p)"
1012
local -r ns="$(ip netns list|grep $PEER_NS)"
@@ -36,7 +38,7 @@ run_one() {
3638
ip netns exec "${PEER_NS}" ethtool -K veth1 rx-gro-list on
3739

3840

39-
ip -n "${PEER_NS}" link set veth1 xdp object ../bpf/xdp_dummy.o section xdp
41+
ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp
4042
tc -n "${PEER_NS}" qdisc add dev veth1 clsact
4143
tc -n "${PEER_NS}" filter add dev veth1 ingress prio 4 protocol ipv6 bpf object-file ../bpf/nat6to4.o section schedcls/ingress6/nat_6 direct-action
4244
tc -n "${PEER_NS}" filter add dev veth1 egress prio 4 protocol ip bpf object-file ../bpf/nat6to4.o section schedcls/egress4/snat4 direct-action
@@ -81,8 +83,8 @@ run_all() {
8183
run_udp "${ipv6_args}"
8284
}
8385

84-
if [ ! -f ../bpf/xdp_dummy.o ]; then
85-
echo "Missing xdp_dummy helper. Build bpf selftest first"
86+
if [ ! -f ${BPF_FILE} ]; then
87+
echo "Missing ${BPF_FILE}. Build bpf selftest first"
8688
exit -1
8789
fi
8890

tools/testing/selftests/net/udpgro_fwd.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: GPL-2.0
33

4+
BPF_FILE="../bpf/xdp_dummy.bpf.o"
45
readonly BASE="ns-$(mktemp -u XXXXXX)"
56
readonly SRC=2
67
readonly DST=1
@@ -46,7 +47,7 @@ create_ns() {
4647
ip -n $BASE$ns addr add dev veth$ns $BM_NET_V4$ns/24
4748
ip -n $BASE$ns addr add dev veth$ns $BM_NET_V6$ns/64 nodad
4849
done
49-
ip -n $NS_DST link set veth$DST xdp object ../bpf/xdp_dummy.o section xdp 2>/dev/null
50+
ip -n $NS_DST link set veth$DST xdp object ${BPF_FILE} section xdp 2>/dev/null
5051
}
5152

5253
create_vxlan_endpoint() {

tools/testing/selftests/net/veth.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
22
# SPDX-License-Identifier: GPL-2.0
33

4+
BPF_FILE="../bpf/xdp_dummy.bpf.o"
45
readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
56
readonly BASE=`basename $STATS`
67
readonly SRC=2
@@ -216,8 +217,8 @@ while getopts "hs:" option; do
216217
esac
217218
done
218219

219-
if [ ! -f ../bpf/xdp_dummy.o ]; then
220-
echo "Missing xdp_dummy helper. Build bpf selftest first"
220+
if [ ! -f ${BPF_FILE} ]; then
221+
echo "Missing ${BPF_FILE}. Build bpf selftest first"
221222
exit 1
222223
fi
223224

@@ -288,14 +289,14 @@ if [ $CPUS -gt 1 ]; then
288289
ip netns exec $NS_DST ethtool -L veth$DST rx 1 tx 2 2>/dev/null
289290
ip netns exec $NS_SRC ethtool -L veth$SRC rx 1 tx 2 2>/dev/null
290291
printf "%-60s" "bad setting: XDP with RX nr less than TX"
291-
ip -n $NS_DST link set dev veth$DST xdp object ../bpf/xdp_dummy.o \
292+
ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
292293
section xdp 2>/dev/null &&\
293294
echo "fail - set operation successful ?!?" || echo " ok "
294295

295296
# the following tests will run with multiple channels active
296297
ip netns exec $NS_SRC ethtool -L veth$SRC rx 2
297298
ip netns exec $NS_DST ethtool -L veth$DST rx 2
298-
ip -n $NS_DST link set dev veth$DST xdp object ../bpf/xdp_dummy.o \
299+
ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
299300
section xdp 2>/dev/null
300301
printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set"
301302
ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\
@@ -311,7 +312,7 @@ if [ $CPUS -gt 2 ]; then
311312
chk_channels "setting invalid channels nr" $DST 2 2
312313
fi
313314

314-
ip -n $NS_DST link set dev veth$DST xdp object ../bpf/xdp_dummy.o section xdp 2>/dev/null
315+
ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp 2>/dev/null
315316
chk_gro_flag "with xdp attached - gro flag" $DST on
316317
chk_gro_flag " - peer gro flag" $SRC off
317318
chk_tso_flag " - tso flag" $SRC off

0 commit comments

Comments
 (0)