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

selftest: netdevsim: Add devlink rate grouping test

Test verifies that netdevsim correctly implements devlink ops callbacks
that set node as a parent of devlink leaf or node rate object.
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 f3d101b4
......@@ -563,6 +563,26 @@ rate_attr_tx_rate_check()
check_err $? "Unexpected $name attr value $api_value != $rate"
}
rate_attr_parent_check()
{
local handle=$1
local parent=$2
local debug_file=$3
rate_attr_set $handle parent $parent
check_err $? "Failed to set parent"
debug_value=$(cat $debug_file)
check_err $? "Failed to get parent debugfs value"
[ "$debug_value" == "$parent" ]
check_err $? "Unexpected parent debug value $debug_value != $parent"
api_value=$(rate_attr_get $r_obj parent)
check_err $? "Failed to get parent attr value"
[ "$api_value" == "$parent" ]
check_err $? "Unexpected parent attr value $api_value != $parent"
}
rate_node_add()
{
local handle=$1
......@@ -627,6 +647,28 @@ rate_test()
[ $num_nodes == 0 ]
check_err $? "Expected 0 rate node but got $num_nodes"
local node1_name='group1'
local node1="$DL_HANDLE/$node1_name"
rate_node_add "$node1"
check_err $? "Failed to add node $node1"
rate_attr_parent_check $r_obj $node1_name \
$DEBUGFS_DIR/ports/${r_obj##*/}/rate_parent
local node2_name='group2'
local node2="$DL_HANDLE/$node2_name"
rate_node_add "$node2"
check_err $? "Failed to add node $node2"
rate_attr_parent_check $node2 $node1_name \
$DEBUGFS_DIR/rate_nodes/$node2_name/rate_parent
rate_node_del "$node2"
check_err $? "Failed to delete node $node2"
rate_attr_set "$r_obj" noparent
check_err $? "Failed to unset $r_obj parent node"
rate_node_del "$node1"
check_err $? "Failed to delete node $node1"
log_test "rate test"
}
......
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