Commit a27d8e35 authored by Dmytro Linkin's avatar Dmytro Linkin Committed by David S. Miller

selftest: netdevsim: Add devlink rate test

Test verifies that all netdevsim VF ports have rate leaf object created
by default.
Co-developed-by: default avatarVlad Buslov <vladbu@nvidia.com>
Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
Signed-off-by: default avatarDmytro Linkin <dlinkin@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 885dfe12
...@@ -5,12 +5,13 @@ lib_dir=$(dirname $0)/../../../net/forwarding ...@@ -5,12 +5,13 @@ lib_dir=$(dirname $0)/../../../net/forwarding
ALL_TESTS="fw_flash_test params_test regions_test reload_test \ ALL_TESTS="fw_flash_test params_test regions_test reload_test \
netns_reload_test resource_test dev_info_test \ netns_reload_test resource_test dev_info_test \
empty_reporter_test dummy_reporter_test" empty_reporter_test dummy_reporter_test rate_test"
NUM_NETIFS=0 NUM_NETIFS=0
source $lib_dir/lib.sh source $lib_dir/lib.sh
BUS_ADDR=10 BUS_ADDR=10
PORT_COUNT=4 PORT_COUNT=4
VF_COUNT=4
DEV_NAME=netdevsim$BUS_ADDR DEV_NAME=netdevsim$BUS_ADDR
SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/ SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/
DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/ DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/
...@@ -507,6 +508,28 @@ dummy_reporter_test() ...@@ -507,6 +508,28 @@ dummy_reporter_test()
log_test "dummy reporter test" log_test "dummy reporter test"
} }
rate_leafs_get()
{
local handle=$1
cmd_jq "devlink port function rate show -j" \
'.[] | to_entries | .[] | select(.value.type == "leaf") | .key | select(contains("'$handle'"))'
}
rate_test()
{
RET=0
echo $VF_COUNT > /sys/bus/netdevsim/devices/$DEV_NAME/sriov_numvfs
devlink dev eswitch set $DL_HANDLE mode switchdev
local leafs=`rate_leafs_get $DL_HANDLE`
local num_leafs=`echo $leafs | wc -w`
[ "$num_leafs" == "$VF_COUNT" ]
check_err $? "Expected $VF_COUNT rate leafs but got $num_leafs"
log_test "rate test"
}
setup_prepare() setup_prepare()
{ {
modprobe netdevsim modprobe netdevsim
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment