diff options
| author | David S. Miller <davem@davemloft.net> | 2022-04-25 12:42:29 +0300 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2022-04-25 12:42:29 +0300 |
| commit | 5e927a9f4b9f29d78a7c7d66ea717bb5c8bbad8e (patch) | |
| tree | fe6c72661e8e5b21a85390f31cf6e6abbb5afb52 /tools | |
| parent | cfc1d91a7d78cf9de25b043d81efcc16966d55b3 (diff) | |
| parent | 002defd576a3eb5d0f8bf11d27f0581ed0f34dd4 (diff) | |
| download | linux-5e927a9f4b9f29d78a7c7d66ea717bb5c8bbad8e.tar.xz | |
Merge branch 'mlxsw-line-card-model'
Ido Schimmel says:
====================
mlxsw: extend line card model by devices and info
Jiri says:
This patchset is extending the line card model by three items:
1) line card devices
2) line card info
3) line card device info
First three patches are introducing the necessary changes in devlink
core.
Then, all three extensions are implemented in mlxsw alongside with
selftest.
Examples:
$ devlink lc show pci/0000:01:00.0 lc 8
pci/0000:01:00.0:
lc 8 state active type 16x100G
supported_types:
16x100G
devices:
device 0
device 1
device 2
device 3
$ devlink lc info pci/0000:01:00.0 lc 8
pci/0000:01:00.0:
lc 8
versions:
fixed:
hw.revision 0
running:
ini.version 4
devices:
device 0
versions:
running:
fw 19.2010.1310
device 1
versions:
running:
fw 19.2010.1310
device 2
versions:
running:
fw 19.2010.1310
device 3
versions:
running:
fw 19.2010.1310
Note that device FW flashing is going to be implemented in the follow-up
patchset.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/testing/selftests/drivers/net/mlxsw/devlink_linecard.sh | 61 |
1 files changed, 61 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..53a65f416770 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,42 @@ supported_types_check() check_err $? "16X100G not found between supported types of linecard $lc" } +lc_info_check() +{ + local lc=$1 + local fixed_hw_revision + local running_ini_version + + fixed_hw_revision=$(devlink lc -v info $DEVLINK_DEV lc $lc -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 lc -v info $DEVLINK_DEV lc $lc -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\"" +} + +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 +243,8 @@ provision_test() unprovision_one $lc fi provision_one $lc $LC_16X100G_TYPE + lc_devices_check $lc $LC_16X100G_DEVICE_COUNT + lc_info_check $lc ports_check $lc $LC_16X100G_PORT_COUNT log_test "Provision" } @@ -220,6 +259,26 @@ interface_check() setup_wait } +lc_devices_info_check() +{ + local lc=$1 + local expected_device_count=$2 + local device_count + local device + local running_device_fw + + device_count=$(devlink lc info $DEVLINK_DEV lc $lc -j | \ + jq -e -r ".[][][].devices |length") + check_err $? "Failed to get linecard $lc device count" + for (( device=0; device<device_count; device++ )) + do + running_device_fw=$(devlink lc -v info $DEVLINK_DEV lc $lc -j | \ + jq -e -r ".[][][].devices[$device].versions.running.fw") + check_err $? "Failed to get linecard $lc device $device running fw version" + log_info "Linecard $lc device $device running.fw: \"$running_device_fw\"" + done +} + activation_16x100G_test() { RET=0 @@ -236,6 +295,8 @@ activation_16x100G_test() $ACTIVATION_TIMEOUT) check_err $? "Failed to get linecard $lc activated (timeout)" + lc_devices_info_check $lc $LC_16X100G_DEVICE_COUNT + interface_check log_test "Activation 16x100G" |
