selftest: netdevsim: Add devlink rate nodes test
Test verifies that it is possible to create, delete and set min/max tx rate of devlink rate node on netdevsim VF. Co-developed-by: Vlad Buslov <vladbu@nvidia.com> Signed-off-by: Vlad Buslov <vladbu@nvidia.com> Signed-off-by: Dmytro Linkin <dlinkin@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
885226f568
commit
413ee943d7
@ -516,6 +516,14 @@ rate_leafs_get()
|
|||||||
'.[] | to_entries | .[] | select(.value.type == "leaf") | .key | select(contains("'$handle'"))'
|
'.[] | to_entries | .[] | select(.value.type == "leaf") | .key | select(contains("'$handle'"))'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rate_nodes_get()
|
||||||
|
{
|
||||||
|
local handle=$1
|
||||||
|
|
||||||
|
cmd_jq "devlink port function rate show -j" \
|
||||||
|
'.[] | to_entries | .[] | select(.value.type == "node") | .key | select(contains("'$handle'"))'
|
||||||
|
}
|
||||||
|
|
||||||
rate_attr_set()
|
rate_attr_set()
|
||||||
{
|
{
|
||||||
local handle=$1
|
local handle=$1
|
||||||
@ -555,6 +563,20 @@ rate_attr_tx_rate_check()
|
|||||||
check_err $? "Unexpected $name attr value $api_value != $rate"
|
check_err $? "Unexpected $name attr value $api_value != $rate"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rate_node_add()
|
||||||
|
{
|
||||||
|
local handle=$1
|
||||||
|
|
||||||
|
devlink port function rate add $handle
|
||||||
|
}
|
||||||
|
|
||||||
|
rate_node_del()
|
||||||
|
{
|
||||||
|
local handle=$1
|
||||||
|
|
||||||
|
devlink port function rate del $handle
|
||||||
|
}
|
||||||
|
|
||||||
rate_test()
|
rate_test()
|
||||||
{
|
{
|
||||||
RET=0
|
RET=0
|
||||||
@ -582,6 +604,29 @@ rate_test()
|
|||||||
rate=$(($rate+100))
|
rate=$(($rate+100))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
local node1_name='group1'
|
||||||
|
local node1="$DL_HANDLE/$node1_name"
|
||||||
|
rate_node_add "$node1"
|
||||||
|
check_err $? "Failed to add node $node1"
|
||||||
|
|
||||||
|
local num_nodes=`rate_nodes_get $DL_HANDLE | wc -w`
|
||||||
|
[ $num_nodes == 1 ]
|
||||||
|
check_err $? "Expected 1 rate node in output but got $num_nodes"
|
||||||
|
|
||||||
|
local node_tx_share=10
|
||||||
|
rate_attr_tx_rate_check $node1 tx_share $node_tx_share \
|
||||||
|
$DEBUGFS_DIR/rate_nodes/${node1##*/}/tx_share
|
||||||
|
|
||||||
|
local node_tx_max=100
|
||||||
|
rate_attr_tx_rate_check $node1 tx_max $node_tx_max \
|
||||||
|
$DEBUGFS_DIR/rate_nodes/${node1##*/}/tx_max
|
||||||
|
|
||||||
|
rate_node_del "$node1"
|
||||||
|
check_err $? "Failed to delete node $node1"
|
||||||
|
local num_nodes=`rate_nodes_get $DL_HANDLE | wc -w`
|
||||||
|
[ $num_nodes == 0 ]
|
||||||
|
check_err $? "Expected 0 rate node but got $num_nodes"
|
||||||
|
|
||||||
log_test "rate test"
|
log_test "rate test"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user