@@ -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+
861943nexthop_obj_blackhole_offload_test ()
862944{
863945 # Test offload indication of blackhole nexthop objects
0 commit comments