All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh
@ 2023-01-25 17:08 Andrei Gherzan
  2023-01-25 17:08 ` [PATCH 2/2] selftests: net: .gitignore the scratch directory of bpf Andrei Gherzan
  2023-01-25 21:17 ` [PATCH 1/2] selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh Andrei Gherzan
  0 siblings, 2 replies; 3+ messages in thread
From: Andrei Gherzan @ 2023-01-25 17:08 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan
  Cc: Andrei, netdev, linux-kselftest, linux-kernel, bpf

From: Andrei <andrei.gherzan@canonical.com>

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.

Signed-off-by: Andrei <andrei.gherzan@canonical.com>
---
 tools/testing/selftests/net/udpgro_frglist.sh | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/net/udpgro_frglist.sh b/tools/testing/selftests/net/udpgro_frglist.sh
index c9c4b9d65839..1fdf2d53944d 100755
--- a/tools/testing/selftests/net/udpgro_frglist.sh
+++ b/tools/testing/selftests/net/udpgro_frglist.sh
@@ -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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] selftests: net: .gitignore the scratch directory of bpf
  2023-01-25 17:08 [PATCH 1/2] selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh Andrei Gherzan
@ 2023-01-25 17:08 ` Andrei Gherzan
  2023-01-25 21:17 ` [PATCH 1/2] selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh Andrei Gherzan
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Gherzan @ 2023-01-25 17:08 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan
  Cc: netdev, linux-kselftest, linux-kernel, 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")

Signed-off-by: Andrei Gherzan <andrei.gherzan@canonical.com>
---
 tools/testing/selftests/net/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/net/.gitignore b/tools/testing/selftests/net/.gitignore
index a6911cae368c..0d07dd13c973 100644
--- a/tools/testing/selftests/net/.gitignore
+++ b/tools/testing/selftests/net/.gitignore
@@ -40,6 +40,7 @@ test_unix_oob
 timestamping
 tls
 toeplitz
+/tools
 tun
 txring_overwrite
 txtimestamp
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh
  2023-01-25 17:08 [PATCH 1/2] selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh Andrei Gherzan
  2023-01-25 17:08 ` [PATCH 2/2] selftests: net: .gitignore the scratch directory of bpf Andrei Gherzan
@ 2023-01-25 21:17 ` Andrei Gherzan
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Gherzan @ 2023-01-25 21:17 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan
  Cc: netdev, linux-kselftest, linux-kernel, bpf

On Wed, Jan 25, 2023 at 05:08:44PM +0000, Andrei Gherzan wrote:
> From: Andrei <andrei.gherzan@canonical.com>
> 
> 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.
> 
> Signed-off-by: Andrei <andrei.gherzan@canonical.com>

I have sent a v2 that fixes SoB and From.

-- 
Andrei Gherzan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-25 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 17:08 [PATCH 1/2] selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh Andrei Gherzan
2023-01-25 17:08 ` [PATCH 2/2] selftests: net: .gitignore the scratch directory of bpf Andrei Gherzan
2023-01-25 21:17 ` [PATCH 1/2] selftests: net: Fix missing nat6to4.o when running udpgro_frglist.sh Andrei Gherzan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.