Skip to content

Commit ffd3e9b

Browse files
idoschdavem330
authored andcommitted
selftests: mlxsw: Add resilient nexthop groups configuration tests
Test that unsupported resilient nexthop group configurations are rejected and that offload / trap indication is correctly set on nexthop buckets in a resilient group. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8615847 commit ffd3e9b

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

‎tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh‎

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ALL_TESTS="
3333
nexthop_obj_invalid_test
3434
nexthop_obj_offload_test
3535
nexthop_obj_group_offload_test
36+
nexthop_obj_bucket_offload_test
3637
nexthop_obj_blackhole_offload_test
3738
nexthop_obj_route_offload_test
3839
devlink_reload_test
@@ -739,11 +740,28 @@ nexthop_obj_invalid_test()
739740

740741
ip nexthop add id 1 dev $swp1
741742
ip nexthop add id 2 dev $swp1
743+
ip nexthop add id 3 via 192.0.2.3 dev $swp1
742744
ip nexthop add id 10 group 1/2
743745
check_fail $? "managed to configure a nexthop group with device-only nexthops when should not"
744746

747+
ip nexthop add id 10 group 3 type resilient buckets 7
748+
check_fail $? "managed to configure a too small resilient nexthop group when should not"
749+
750+
ip nexthop add id 10 group 3 type resilient buckets 129
751+
check_fail $? "managed to configure a resilient nexthop group with invalid number of buckets when should not"
752+
753+
ip nexthop add id 10 group 1/2 type resilient buckets 32
754+
check_fail $? "managed to configure a resilient nexthop group with device-only nexthops when should not"
755+
756+
ip nexthop add id 10 group 3 type resilient buckets 32
757+
check_err $? "failed to configure a valid resilient nexthop group"
758+
ip nexthop replace id 3 dev $swp1
759+
check_fail $? "managed to populate a nexthop bucket with a device-only nexthop when should not"
760+
745761
log_test "nexthop objects - invalid configurations"
746762

763+
ip nexthop del id 10
764+
ip nexthop del id 3
747765
ip nexthop del id 2
748766
ip nexthop del id 1
749767

@@ -858,6 +876,70 @@ nexthop_obj_group_offload_test()
858876
simple_if_fini $swp1 192.0.2.1/24 2001:db8:1::1/64
859877
}
860878

879+
nexthop_obj_bucket_offload_test()
880+
{
881+
# Test offload indication of nexthop buckets
882+
RET=0
883+
884+
simple_if_init $swp1 192.0.2.1/24 2001:db8:1::1/64
885+
simple_if_init $swp2
886+
setup_wait
887+
888+
ip nexthop add id 1 via 192.0.2.2 dev $swp1
889+
ip nexthop add id 2 via 2001:db8:1::2 dev $swp1
890+
ip nexthop add id 10 group 1/2 type resilient buckets 32 idle_timer 0
891+
ip neigh replace 192.0.2.2 lladdr 00:11:22:33:44:55 nud reachable \
892+
dev $swp1
893+
ip neigh replace 192.0.2.3 lladdr 00:11:22:33:44:55 nud reachable \
894+
dev $swp1
895+
ip neigh replace 2001:db8:1::2 lladdr 00:11:22:33:44:55 nud reachable \
896+
dev $swp1
897+
898+
busywait "$TIMEOUT" wait_for_offload \
899+
ip nexthop bucket show nhid 1
900+
check_err $? "IPv4 nexthop buckets not marked as offloaded when should"
901+
busywait "$TIMEOUT" wait_for_offload \
902+
ip nexthop bucket show nhid 2
903+
check_err $? "IPv6 nexthop buckets not marked as offloaded when should"
904+
905+
# Invalidate nexthop id 1
906+
ip neigh replace 192.0.2.2 nud failed dev $swp1
907+
busywait "$TIMEOUT" wait_for_trap \
908+
ip nexthop bucket show nhid 1
909+
check_err $? "IPv4 nexthop buckets not marked with trap when should"
910+
911+
# Invalidate nexthop id 2
912+
ip neigh replace 2001:db8:1::2 nud failed dev $swp1
913+
busywait "$TIMEOUT" wait_for_trap \
914+
ip nexthop bucket show nhid 2
915+
check_err $? "IPv6 nexthop buckets not marked with trap when should"
916+
917+
# Revalidate nexthop id 1 by changing its configuration
918+
ip nexthop replace id 1 via 192.0.2.3 dev $swp1
919+
busywait "$TIMEOUT" wait_for_offload \
920+
ip nexthop bucket show nhid 1
921+
check_err $? "nexthop bucket not marked as offloaded after revalidating nexthop"
922+
923+
# Revalidate nexthop id 2 by changing its neighbour
924+
ip neigh replace 2001:db8:1::2 lladdr 00:11:22:33:44:55 nud reachable \
925+
dev $swp1
926+
busywait "$TIMEOUT" wait_for_offload \
927+
ip nexthop bucket show nhid 2
928+
check_err $? "nexthop bucket not marked as offloaded after revalidating neighbour"
929+
930+
log_test "nexthop bucket offload indication"
931+
932+
ip neigh del 2001:db8:1::2 dev $swp1
933+
ip neigh del 192.0.2.3 dev $swp1
934+
ip neigh del 192.0.2.2 dev $swp1
935+
ip nexthop del id 10
936+
ip nexthop del id 2
937+
ip nexthop del id 1
938+
939+
simple_if_fini $swp2
940+
simple_if_fini $swp1 192.0.2.1/24 2001:db8:1::1/64
941+
}
942+
861943
nexthop_obj_blackhole_offload_test()
862944
{
863945
# Test offload indication of blackhole nexthop objects

‎tools/testing/selftests/net/forwarding/lib.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ wait_for_offload()
353353
"$@" | grep -q offload
354354
}
355355

356+
wait_for_trap()
357+
{
358+
"$@" | grep -q trap
359+
}
360+
356361
until_counter_is()
357362
{
358363
local expr=$1; shift

0 commit comments

Comments
 (0)