Skip to contentSkip to conversation

selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh

PATCH In review Andrei Gherzan 2 participants 6 messages Jan 25, 2023 – Jan 27, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh

The udpgro_frglist.sh uses nat6to4.o which is tested for existence in bpf/nat6to4.o (relative to the script). This is where the object is compiled. Even so, the script attempts to use it as part of tc with a different path (../bpf/nat6to4.o). As a consequence, this fails the script:

Error opening object ../bpf/nat6to4.o: No such file or directory Cannot initialize ELF context!
Unable to load program

This change refactors these references to use a variable for consistency and also reformats two long lines.

---
 tools/testing/selftests/net/udpgro_frglist.sh | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
tools/testing/selftests/net/udpgro_frglist.sh +8 -3
index c9c4b9d65839..1fdf2d53944d 100755
@@ -6,6 +6,7 @@
 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
 
 BPF_FILE="../bpf/xdp_dummy.bpf.o"
+BPF_NAT6TO4_FILE="./bpf/nat6to4.o"
 
 cleanup() {
 	local -r jobs="$(jobs -p)"
@@ -40,8 +41,12 @@ run_one() {
 
 	ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp
 	tc -n "${PEER_NS}" qdisc add dev veth1 clsact
-	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
-	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
+	tc -n "${PEER_NS}" filter add dev veth1 ingress prio 4 protocol \
+		ipv6 bpf object-file "$BPF_NAT6TO4_FILE" section \
+		schedcls/ingress6/nat_6 direct-action
+	tc -n "${PEER_NS}" filter add dev veth1 egress prio 4 protocol \
+		ip bpf object-file "$BPF_NAT6TO4_FILE" section \
+		schedcls/egress4/snat4 direct-action
         echo ${rx_args}
 	ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -r &
 
@@ -88,7 +93,7 @@ if [ ! -f ${BPF_FILE} ]; then
 	exit -1
 fi
 
-if [ ! -f bpf/nat6to4.o ]; then
+if [ ! -f "$BPF_NAT6TO4_FILE" ]; then
 	echo "Missing nat6to4 helper. Build bpfnat6to4.o selftest first"
 	exit -1
 fi
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/2 selftests: net: .gitignore the scratch directory of bpf

The net/bpf Makefile uses a similar build infrastructure to BPF[1] while building libbpf as a dependency of nat6to4. This change adds a .gitignore entry for SCRATCH_DIR where libbpf and its headers end up built/installed.

[1] Introduced in commit 837a3d66d698 ("selftests: net: Add cross-compilation support for BPF programs")

---
 tools/testing/selftests/net/.gitignore | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/net/.gitignore +1 -0
index a6911cae368c..0d07dd13c973 100644
@@ -40,6 +40,7 @@ test_unix_oob
 timestamping
 tls
 toeplitz
+/tools
 tun
 txring_overwrite
 txtimestamp
Signature · 1 line
2.34.1
maintainer
#2 lore raw
In reply to Andrei Gherzan
Quoted 4 lines · On Wed, 25 Jan 2023 21:13:49 +0000 Andrei Gherzan wrote:

The udpgro_frglist.sh uses nat6to4.o which is tested for existence in bpf/nat6to4.o (relative to the script). This is where the object is compiled. Even so, the script attempts to use it as part of tc with a different path (../bpf/nat6to4.o). As a consequence, this fails the script:

Is this a recent regression? Can you add a Fixes tag?

What tree did you base this patch on? Doesn't seem to apply

Quoted 8 lines

Error opening object ../bpf/nat6to4.o: No such file or directory Cannot initialize ELF context!
Unable to load program

This change refactors these references to use a variable for consistency and also reformats two long lines.

#3 lore raw

Hi Jakub,

Thanks for taking a look at this.

Quoted 7 lines · Jakub Kicinski
Quoted 4 lines · On Wed, 25 Jan 2023 21:13:49 +0000 Andrei Gherzan wrote:

The udpgro_frglist.sh uses nat6to4.o which is tested for existence in bpf/nat6to4.o (relative to the script). This is where the object is compiled. Even so, the script attempts to use it as part of tc with a different path (../bpf/nat6to4.o). As a consequence, this fails the script:

Is this a recent regression? Can you add a Fixes tag?

This issue seems to be included from the beginning (edae34a3ed92). I can't say why this was not seen before upstream but on our side, this test was disabled internally due to lack of CC support in BPF programs. This was fixed in the meanwhile in 837a3d66d698 (selftests: net: Add cross-compilation support for BPF programs) and we found this issue while trying to reenable the test.

So if you think that is reasonable, I could add a Fixes tag for the initial script commit edae34a3ed92 (selftests net: add UDP GRO fraglist + bpf self-tests) and push a v3.

Quoted 1 line

What tree did you base this patch on? Doesn't seem to apply

The patches were done on top of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git, the master branch - 948ef7bb70c4 (Merge tag 'modules-6.2-rc6' of
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux). There is another merge that happened in the meanwhile but the rebase works without issues. I can send a rebased v3 if needed.

Quoted 9 lines
Quoted 9 lines

Error opening object ../bpf/nat6to4.o: No such file or directory Cannot initialize ELF context!
Unable to load program

This change refactors these references to use a variable for consistency and also reformats two long lines.

Signature · 1 line
Andrei Gherzan
maintainer
#4 lore raw
Quoted 15 lines · On Thu, 26 Jan 2023 10:01:44 +0000 Andrei Gherzan wrote:
Quoted 7 lines · Jakub Kicinski
Quoted 4 lines · On Wed, 25 Jan 2023 21:13:49 +0000 Andrei Gherzan wrote:

The udpgro_frglist.sh uses nat6to4.o which is tested for existence in bpf/nat6to4.o (relative to the script). This is where the object is compiled. Even so, the script attempts to use it as part of tc with a different path (../bpf/nat6to4.o). As a consequence, this fails the script:

Is this a recent regression? Can you add a Fixes tag?

This issue seems to be included from the beginning (edae34a3ed92). I can't say why this was not seen before upstream but on our side, this test was disabled internally due to lack of CC support in BPF programs. This was fixed in the meanwhile in 837a3d66d698 (selftests: net: Add cross-compilation support for BPF programs) and we found this issue while trying to reenable the test.

Quoted 3 lines

So if you think that is reasonable, I could add a Fixes tag for the initial script commit edae34a3ed92 (selftests net: add UDP GRO fraglist + bpf self-tests) and push a v3.

We have queued commit 3c107f36db06 ("selftests/net: mv bpf/nat6to4.c to net folder") in net-next, I think that should fix it, too?

Quoted 8 lines
Quoted 1 line

What tree did you base this patch on? Doesn't seem to apply

The patches were done on top of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git, the master branch - 948ef7bb70c4 (Merge tag 'modules-6.2-rc6' of
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux). There is another merge that happened in the meanwhile but the rebase works without issues. I can send a rebased v3 if needed.

Could you try linux-next or net-next ?

#5 lore raw
Quoted 16 lines · Jakub Kicinski
Quoted 15 lines · On Thu, 26 Jan 2023 10:01:44 +0000 Andrei Gherzan wrote:
Quoted 7 lines · Jakub Kicinski
Quoted 4 lines · On Wed, 25 Jan 2023 21:13:49 +0000 Andrei Gherzan wrote:

The udpgro_frglist.sh uses nat6to4.o which is tested for existence in bpf/nat6to4.o (relative to the script). This is where the object is compiled. Even so, the script attempts to use it as part of tc with a different path (../bpf/nat6to4.o). As a consequence, this fails the script:

Is this a recent regression? Can you add a Fixes tag?

This issue seems to be included from the beginning (edae34a3ed92). I can't say why this was not seen before upstream but on our side, this test was disabled internally due to lack of CC support in BPF programs. This was fixed in the meanwhile in 837a3d66d698 (selftests: net: Add cross-compilation support for BPF programs) and we found this issue while trying to reenable the test.

Quoted 6 lines
Quoted 3 lines

So if you think that is reasonable, I could add a Fixes tag for the initial script commit edae34a3ed92 (selftests net: add UDP GRO fraglist + bpf self-tests) and push a v3.

We have queued commit 3c107f36db06 ("selftests/net: mv bpf/nat6to4.c to net folder") in net-next, I think that should fix it, too?

That would fix it indeed. Thanks for the pointer.

Quoted 11 lines
Quoted 9 lines
Quoted 2 lines

What tree did you base this patch on? Doesn't seem to apply

The patches were done on top of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git, the master branch - 948ef7bb70c4 (Merge tag 'modules-6.2-rc6' of
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux). There is another merge that happened in the meanwhile but the rebase works without issues. I can send a rebased v3 if needed.

Could you try linux-next or net-next ?

I have sent a v3 rebased on linux-next, split out the remaining changes and added a commit to fix some shellcheck warnings/errors.

Signature · 1 line
Andrei Gherzan