selftests: mlxsw: Check line card info on provisioned line card
authorJiri Pirko <jiri@nvidia.com>
Mon, 25 Jul 2022 08:29:24 +0000 (10:29 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 26 Jul 2022 20:56:44 +0000 (13:56 -0700)
Once line card is provisioned, check if HW revision and INI version
are exposed on associated nested auxiliary device.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/mlxsw/devlink_linecard.sh

index 08a922d..ca4e9b0 100755 (executable)
@@ -84,6 +84,13 @@ lc_wait_until_port_count_is()
        busywait "$timeout" until_lc_port_count_is "$port_count" lc_port_count_get "$lc"
 }
 
+lc_nested_devlink_dev_get()
+{
+       local lc=$1
+
+       devlink lc show $DEVLINK_DEV lc $lc -j | jq -e -r ".[][][].nested_devlink"
+}
+
 PROV_UNPROV_TIMEOUT=8000 # ms
 POST_PROV_ACT_TIMEOUT=2000 # ms
 PROV_PORTS_INSTANTIATION_TIMEOUT=15000 # ms
@@ -191,12 +198,30 @@ ports_check()
        check_err $? "Unexpected port count linecard $lc (got $port_count, expected $expected_port_count)"
 }
 
+lc_dev_info_provisioned_check()
+{
+       local lc=$1
+       local nested_devlink_dev=$2
+       local fixed_hw_revision
+       local running_ini_version
+
+       fixed_hw_revision=$(devlink dev info $nested_devlink_dev -j | \
+                           jq -e -r '.[][].versions.fixed."hw.revision"')
+       check_err $? "Failed to get linecard $lc fixed.hw.revision"
+       log_info "Linecard $lc fixed.hw.revision: \"$fixed_hw_revision\""
+       running_ini_version=$(devlink dev info $nested_devlink_dev -j | \
+                             jq -e -r '.[][].versions.running."ini.version"')
+       check_err $? "Failed to get linecard $lc running.ini.version"
+       log_info "Linecard $lc running.ini.version: \"$running_ini_version\""
+}
+
 provision_test()
 {
        RET=0
        local lc
        local type
        local state
+       local nested_devlink_dev
 
        lc=$LC_SLOT
        supported_types_check $lc
@@ -207,6 +232,11 @@ provision_test()
        fi
        provision_one $lc $LC_16X100G_TYPE
        ports_check $lc $LC_16X100G_PORT_COUNT
+
+       nested_devlink_dev=$(lc_nested_devlink_dev_get $lc)
+       check_err $? "Failed to get nested devlink handle of linecard $lc"
+       lc_dev_info_provisioned_check $lc $nested_devlink_dev
+
        log_test "Provision"
 }