aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/testing/selftests/net/forwarding/devlink_lib.sh26
1 files changed, 14 insertions, 12 deletions
diff --git a/tools/testing/selftests/net/forwarding/devlink_lib.sh b/tools/testing/selftests/net/forwarding/devlink_lib.sh
index 8553a67a2322..2b9296f6aa07 100644
--- a/tools/testing/selftests/net/forwarding/devlink_lib.sh
+++ b/tools/testing/selftests/net/forwarding/devlink_lib.sh
@@ -4,19 +4,21 @@
4############################################################################## 4##############################################################################
5# Defines 5# Defines
6 6
7DEVLINK_DEV=$(devlink port show "${NETIFS[p1]}" -j \ 7if [[ ! -v DEVLINK_DEV ]]; then
8 | jq -r '.port | keys[]' | cut -d/ -f-2) 8 DEVLINK_DEV=$(devlink port show "${NETIFS[p1]}" -j \
9if [ -z "$DEVLINK_DEV" ]; then 9 | jq -r '.port | keys[]' | cut -d/ -f-2)
10 echo "SKIP: ${NETIFS[p1]} has no devlink device registered for it" 10 if [ -z "$DEVLINK_DEV" ]; then
11 exit 1 11 echo "SKIP: ${NETIFS[p1]} has no devlink device registered for it"
12fi 12 exit 1
13if [[ "$(echo $DEVLINK_DEV | grep -c pci)" -eq 0 ]]; then 13 fi
14 echo "SKIP: devlink device's bus is not PCI" 14 if [[ "$(echo $DEVLINK_DEV | grep -c pci)" -eq 0 ]]; then
15 exit 1 15 echo "SKIP: devlink device's bus is not PCI"
16fi 16 exit 1
17 fi
17 18
18DEVLINK_VIDDID=$(lspci -s $(echo $DEVLINK_DEV | cut -d"/" -f2) \ 19 DEVLINK_VIDDID=$(lspci -s $(echo $DEVLINK_DEV | cut -d"/" -f2) \
19 -n | cut -d" " -f3) 20 -n | cut -d" " -f3)
21fi
20 22
21############################################################################## 23##############################################################################
22# Sanity checks 24# Sanity checks