aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/drivers/net
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2022-04-25 06:44:26 +0300
committerDavid S. Miller <davem@davemloft.net>2022-04-25 10:42:28 +0100
commit5e22298918258d8927b55604598c3ca37ef48e2f (patch)
tree06e65caf8b7a805443f70ecc1171cd285f9a4fff /tools/testing/selftests/drivers/net
parentmlxsw: core_linecards: Probe provisioned line cards for devices and attach them (diff)
downloadlinux-dev-5e22298918258d8927b55604598c3ca37ef48e2f.tar.xz
linux-dev-5e22298918258d8927b55604598c3ca37ef48e2f.zip
selftests: mlxsw: Check devices on provisioned line card
Once line card is provisioned, check the count of devices on it and print them out. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/drivers/net')
-rwxr-xr-xtools/testing/selftests/drivers/net/mlxsw/devlink_linecard.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_linecard.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_linecard.sh
index 08a922d8b86a..67b0e56cb413 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/devlink_linecard.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_linecard.sh
@@ -152,6 +152,7 @@ unprovision_test()
LC_16X100G_TYPE="16x100G"
LC_16X100G_PORT_COUNT=16
+LC_16X100G_DEVICE_COUNT=4
supported_types_check()
{
@@ -177,6 +178,26 @@ supported_types_check()
check_err $? "16X100G not found between supported types of linecard $lc"
}
+lc_devices_check()
+{
+ local lc=$1
+ local expected_device_count=$2
+ local device_count
+ local device
+
+ device_count=$(devlink lc show $DEVLINK_DEV lc $lc -j | \
+ jq -e -r ".[][][].devices |length")
+ check_err $? "Failed to get linecard $lc device count"
+ [ $device_count != 0 ]
+ check_err $? "No device found on linecard $lc"
+ [ $device_count == $expected_device_count ]
+ check_err $? "Unexpected device count on linecard $lc (got $expected_device_count, expected $device_count)"
+ for (( device=0; device<device_count; device++ ))
+ do
+ log_info "Linecard $lc device $device"
+ done
+}
+
ports_check()
{
local lc=$1
@@ -206,6 +227,7 @@ provision_test()
unprovision_one $lc
fi
provision_one $lc $LC_16X100G_TYPE
+ lc_devices_check $lc $LC_16X100G_DEVICE_COUNT
ports_check $lc $LC_16X100G_PORT_COUNT
log_test "Provision"
}