Skip to contentSkip to conversation

selftests: bpf: add check for ip XDP redirect

PATCH Superseded William Tu 2 participants 3 messages Aug 11, 2017

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

William Tu

author
#0 lore raw

PATCH 1/1 selftests: bpf: add check for ip XDP redirect

Kernel test robot reports error when running test_xdp_redirect.sh. Check if ip tool supports xdpgeneric, if not, skip the test.

Cc Daniel Borkmann <[email protected]>
Cc John Fastabend <[email protected]>
---
 tools/testing/selftests/bpf/test_xdp_redirect.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/bpf/test_xdp_redirect.sh +5 -0
index d8c73ed6e040..c5a8b7173c12 100755
@@ -23,6 +23,11 @@ cleanup()
 	ip netns del ns2 2> /dev/null
 }
 
+ip link set dev lo xdpgeneric off 2>/dev/null > /dev/null
+if [ $? -ne 0 ];then
+        echo "selftests: [SKIP] Could not run test without the ip xdpgeneric support"
+        exit 0
+fi
 set -e
 
 ip netns add ns1
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · William Tu

Kernel test robot reports error when running test_xdp_redirect.sh. Check if ip tool supports xdpgeneric, if not, skip the test.

Cc Daniel Borkmann <[email protected]>
Cc John Fastabend <[email protected]>
---
  tools/testing/selftests/bpf/test_xdp_redirect.sh | 5 +++++
  1 file changed, 5 insertions(+)
tools/testing/selftests/bpf/test_xdp_redirect.sh +0 -0
index d8c73ed6e040..c5a8b7173c12 100755

tools/testing/selftests/bpf/test_xdp_redirect.sh cleanup() · line 29

Quoted 7 lines
tools/testing/selftests/bpf/test_xdp_redirect.sh +4 -0
@@ -23,6 +23,11 @@ cleanup()
  	ip netns del ns2 2> /dev/null
  }
 
+ip link set dev lo xdpgeneric off 2>/dev/null > /dev/null
+if [ $? -ne 0 ];then
+        echo "selftests: [SKIP] Could not run test without the ip xdpgeneric support"
+        exit 0

Small nit: could you make that indent consistently as tabs like in your cleanup() function slightly further above?

Other than that (+ subject should also be [PATCH net-next]):

author
#2 lore raw

thanks! I will fix it and re-submit.
William

Quoted 34 lines · Daniel Borkmann
Quoted 23 lines · William Tu

Kernel test robot reports error when running test_xdp_redirect.sh. Check if ip tool supports xdpgeneric, if not, skip the test.

Cc Daniel Borkmann <[email protected]>
Cc John Fastabend <[email protected]>
---
  tools/testing/selftests/bpf/test_xdp_redirect.sh | 5 +++++
  1 file changed, 5 insertions(+)
tools/testing/selftests/bpf/test_xdp_redirect.sh +3 -0
index d8c73ed6e040..c5a8b7173c12 100755
@@ -23,6 +23,11 @@ cleanup()
        ip netns del ns2 2> /dev/null
  }
 
+ip link set dev lo xdpgeneric off 2>/dev/null > /dev/null
+if [ $? -ne 0 ];then
+        echo "selftests: [SKIP] Could not run test without the ip
Quoted 2 lines

xdpgeneric support"
+ exit 0

Small nit: could you make that indent consistently as tabs like in your cleanup() function slightly further above?

Other than that (+ subject should also be [PATCH net-next]):