Commit 4b808f44 authored by Petr Machata's avatar Petr Machata Committed by Jakub Kicinski

selftests: fib_nexthops: Test 16-bit next hop weights

Add tests that attempt to create NH groups that use full 16 bits of NH
weight.
Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/101cdd3f2bfd9511c9bec95f909d20ff56f70ba5.1723036486.git.petrm@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent dce0765c
......@@ -78,7 +78,12 @@ log_test()
else
ret=1
nfail=$((nfail+1))
printf "TEST: %-60s [FAIL]\n" "${msg}"
if [[ $rc -eq $ksft_skip ]]; then
printf "TEST: %-60s [SKIP]\n" "${msg}"
else
printf "TEST: %-60s [FAIL]\n" "${msg}"
fi
if [ "$VERBOSE" = "1" ]; then
echo " rc=$rc, expected $expected"
fi
......@@ -923,6 +928,29 @@ ipv6_grp_fcnal()
ipv6_grp_refs
log_test $? 0 "Nexthop group replace refcounts"
#
# 16-bit weights.
#
run_cmd "$IP nexthop add id 62 via 2001:db8:91::2 dev veth1"
run_cmd "$IP nexthop add id 63 via 2001:db8:91::3 dev veth1"
run_cmd "$IP nexthop add id 64 via 2001:db8:91::4 dev veth1"
run_cmd "$IP nexthop add id 65 via 2001:db8:91::5 dev veth1"
run_cmd "$IP nexthop add id 66 dev veth1"
run_cmd "$IP nexthop add id 103 group 62,1000"
if [[ $? == 0 ]]; then
local GRP="id 103 group 62,254/63,255/64,256/65,257/66,65535"
run_cmd "$IP nexthop replace $GRP"
check_nexthop "id 103" "$GRP"
rc=$?
else
rc=$ksft_skip
fi
$IP nexthop flush >/dev/null 2>&1
log_test $rc 0 "16-bit weights"
}
ipv6_res_grp_fcnal()
......@@ -987,6 +1015,31 @@ ipv6_res_grp_fcnal()
check_nexthop_bucket "list id 102" \
"id 102 index 0 nhid 63 id 102 index 1 nhid 62 id 102 index 2 nhid 62 id 102 index 3 nhid 62"
log_test $? 0 "Nexthop buckets updated after replace - nECMP"
#
# 16-bit weights.
#
run_cmd "$IP nexthop add id 62 via 2001:db8:91::2 dev veth1"
run_cmd "$IP nexthop add id 63 via 2001:db8:91::3 dev veth1"
run_cmd "$IP nexthop add id 64 via 2001:db8:91::4 dev veth1"
run_cmd "$IP nexthop add id 65 via 2001:db8:91::5 dev veth1"
run_cmd "$IP nexthop add id 66 dev veth1"
run_cmd "$IP nexthop add id 103 group 62,1000 type resilient buckets 32"
if [[ $? == 0 ]]; then
local GRP="id 103 group 62,254/63,255/64,256/65,257/66,65535 $(:
)type resilient buckets 32 idle_timer 0 $(:
)unbalanced_timer 0"
run_cmd "$IP nexthop replace $GRP"
check_nexthop "id 103" "$GRP unbalanced_time 0"
rc=$?
else
rc=$ksft_skip
fi
$IP nexthop flush >/dev/null 2>&1
log_test $rc 0 "16-bit weights"
}
ipv6_fcnal_runtime()
......
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