Lines Matching +full:1 +full:- +full:2
2 # SPDX-License-Identifier: GPL-2.0
58 local nharg="$1"; shift
59 local expected="$1"; shift
61 out=$($IP nexthop show ${nharg} | sed -e 's/ *$//')
63 return 1
71 local group_id=$1; shift
78 nhid=$1; shift
79 expected=$1; shift
82 grep "trap" | wc -l)
84 return 1
93 local expected_occ=$1; shift
95 occ=$($DEVLINK -jp resource show $DEVLINK_DEV \
98 if [ $expected_occ -ne $occ ]; then
99 return 1
107 local size=$1; shift
117 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
118 nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
121 nexthop_resource_check 1
124 $IP nexthop del id 1
135 nexthop_resource_set 1
137 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
139 $IP nexthop add id 2 via 192.0.2.3 dev dummy1 &> /dev/null
142 nexthop_resource_check 1
155 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
156 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
158 $IP nexthop add id 10 group 1/2
159 nexthop_check "id 10" "id 10 group 1/2 trap"
166 nexthop_resource_check 2
169 $IP nexthop add id 10 group 1,20/2,39
170 nexthop_check "id 10" "id 10 group 1,20/2,39 trap"
177 nexthop_resource_check 2
189 nexthop_resource_set 2
191 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
192 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
194 $IP nexthop add id 10 group 1/2 &> /dev/null
197 nexthop_resource_check 2
210 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
211 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
213 $IP nexthop add id 10 group 1/2 type resilient buckets 4
214 …nexthop_check "id 10" "id 10 group 1/2 type resilient buckets 4 idle_timer 120 unbalanced_timer 0 …
217 nexthop_bucket_nhid_count_check 10 1 2
219 nexthop_bucket_nhid_count_check 10 2 2
226 nexthop_resource_check 2
229 $IP nexthop add id 10 group 1,3/2,2 type resilient buckets 5
230 …nexthop_check "id 10" "id 10 group 1,3/2,2 type resilient buckets 5 idle_timer 120 unbalanced_time…
233 nexthop_bucket_nhid_count_check 10 1 3
235 nexthop_bucket_nhid_count_check 10 2 2
242 nexthop_resource_check 2
254 nexthop_resource_set 2
256 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
257 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
259 $IP nexthop add id 10 group 1/2 type resilient buckets 4 &> /dev/null
262 nexthop_resource_check 2
275 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
276 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
278 $IP nexthop add id 10 group 1/2
280 $IP nexthop replace id 10 group 1/2/3
281 nexthop_check "id 10" "id 10 group 1/2/3 trap"
298 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
299 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
301 $IP nexthop add id 10 group 1/2
303 $IP nexthop replace id 10 group 1/2/3 &> /dev/null
306 nexthop_check "id 10" "id 10 group 1/2 trap"
322 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
323 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
325 $IP nexthop add id 10 group 1/2 type resilient buckets 6
327 $IP nexthop replace id 10 group 1/2/3 type resilient
328 …nexthop_check "id 10" "id 10 group 1/2/3 type resilient buckets 6 idle_timer 120 unbalanced_timer …
331 nexthop_bucket_nhid_count_check 10 1 2
333 nexthop_bucket_nhid_count_check 10 2 2
335 nexthop_bucket_nhid_count_check 10 3 2
350 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
351 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
353 $IP nexthop add id 10 group 1/2 type resilient buckets 6
356 echo 1 > $DEBUGFS_NET_DIR/fib/fail_res_nexthop_group_replace
357 $IP nexthop replace id 10 group 1/2/3 type resilient &> /dev/null
360 …nexthop_check "id 10" "id 10 group 1/2 type resilient buckets 6 idle_timer 120 unbalanced_timer 0 …
363 nexthop_bucket_nhid_count_check 10 1 3
365 nexthop_bucket_nhid_count_check 10 2 3
380 local group_id=$1; shift
381 local nhid=$1; shift
382 local count=$1; shift
385 for index in $($IP -j nexthop bucket show id $group_id nhid $nhid |
386 jq '.[].bucket.index' | head -n ${count:--0})
395 local group_id=$1; shift
396 local nhid=$1; shift
398 $IP -j nexthop bucket show id $group_id nhid $nhid | jq length
403 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
404 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
408 $IP nexthop add id 10 group 1/2 type resilient buckets 8 idle_timer 4
409 nexthop_res_mark_buckets_busy 10 1
410 $IP nexthop replace id 10 group 1/2,3 type resilient
412 nexthop_bucket_nhid_count_check 10 1 4 2 4
417 nexthop_bucket_nhid_count_check 10 1 2 2 6
427 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
428 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
433 $IP nexthop add id 10 group 1,50/2,50/3,1 \
435 nexthop_res_mark_buckets_busy 10 1
436 $IP nexthop replace id 10 group 1,50/2,150/3,1 type resilient
438 nexthop_bucket_nhid_count_check 10 1 4 2 4 3 0
447 nexthop_bucket_nhid_count_check 10 1 4 2 4
452 nexthop_bucket_nhid_count_check 10 1 2 2 6
462 local timer=$1; shift
464 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
465 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
469 $IP nexthop add id 10 group 1/2 type resilient buckets 8 $timer 4
470 nexthop_res_mark_buckets_busy 10 1
471 $IP nexthop replace id 10 group 1/2,3 type resilient
473 nexthop_bucket_nhid_count_check 10 2 6
476 sleep 2
477 $IP nexthop replace id 10 group 1/2,3 type resilient $timer 8
481 nexthop_bucket_nhid_count_check 10 2 6
487 nexthop_bucket_nhid_count_check 10 2 6
497 local timer=$1; shift
499 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
500 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
504 $IP nexthop add id 10 group 1/2 type resilient buckets 8 $timer 8
505 nexthop_res_mark_buckets_busy 10 1
506 $IP nexthop replace id 10 group 1/2,3 type resilient
508 nexthop_bucket_nhid_count_check 10 2 6
511 sleep 2
512 $IP nexthop replace id 10 group 1/2,3 type resilient $timer 4
516 nexthop_bucket_nhid_count_check 10 2 6
526 local timer=$1; shift
528 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
529 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
534 $IP nexthop add id 10 group 1,100/2,100/3,1 \
536 nexthop_res_mark_buckets_busy 10 1
537 $IP nexthop replace id 10 group 1,100/2,300/3,1 type resilient
539 nexthop_bucket_nhid_count_check 10 2 6
542 sleep 2
543 $IP nexthop replace id 10 group 1/2,3 type resilient $timer 8
547 nexthop_bucket_nhid_count_check 10 2 6
553 nexthop_bucket_nhid_count_check 10 2 6
575 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
576 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
580 $IP nexthop add id 10 group 1/2 type resilient \
582 nexthop_res_mark_buckets_busy 10 1
583 $IP nexthop replace id 10 group 1/2,3 type resilient
585 for i in 1 2; do
587 nexthop_bucket_nhid_count_check 10 1 4 2 4
589 nexthop_res_mark_buckets_busy 10 1
594 nexthop_bucket_nhid_count_check 10 1 2 2 6
606 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
607 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
612 $IP nexthop add id 10 group 1,50/2,50/3,1 type resilient \
614 nexthop_res_mark_buckets_busy 10 1
615 $IP nexthop replace id 10 group 1,50/2,150/3,1 type resilient
620 nexthop_bucket_nhid_count_check 10 1 4 2 4
621 check_err $? "1: Group expected to be unbalanced"
622 nexthop_res_mark_buckets_busy 10 1
625 nexthop_bucket_nhid_count_check 10 1 4 2 4
626 check_err $? "2: Group expected to be unbalanced"
627 nexthop_res_mark_buckets_busy 10 1
631 nexthop_bucket_nhid_count_check 10 1 2 2 6
643 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
644 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
648 $IP nexthop add id 10 group 1/2 type resilient buckets 8
649 nexthop_res_mark_buckets_busy 10 1
650 $IP nexthop replace id 10 group 1/2,3 type resilient
654 nexthop_bucket_nhid_count_check 10 2 6
656 nexthop_res_mark_buckets_busy 10 1
659 log_test "Buckets never force-migrated without unbalanced timer"
666 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
667 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
671 $IP nexthop add id 10 group 1/2 type resilient \
673 nexthop_res_mark_buckets_busy 10 1
674 $IP nexthop replace id 10 group 1/2,3 type resilient
676 nexthop_bucket_nhid_count_check 10 2 6
681 nexthop_bucket_nhid_count_check 10 2 6
701 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
702 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
706 $IP nexthop add id 10 group 1/2 type resilient \
708 nexthop_res_mark_buckets_busy 10 1
709 $IP nexthop replace id 10 group 1/2,3 type resilient
711 nexthop_bucket_nhid_count_check 10 2 6
714 $IP nexthop replace id 10 group 2 type resilient
715 nexthop_bucket_nhid_count_check 10 2 8
718 log_test "Busy buckets force-migrated when NH removed"
727 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
729 $IP nexthop replace id 1 via 192.0.2.3 dev dummy1
730 nexthop_check "id 1" "id 1 via 192.0.2.3 dev dummy1 scope link trap"
733 nexthop_resource_check 1
747 nexthop_resource_set 1
749 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
751 $IP nexthop replace id 1 via 192.0.2.3 dev dummy1 &> /dev/null
754 nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
757 nexthop_resource_check 1
770 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
771 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
772 $IP nexthop add id 10 group 1/2
774 $IP nexthop replace id 1 via 192.0.2.4 dev dummy1
777 nexthop_check "id 10" "id 10 group 1/2 trap"
794 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
795 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
796 $IP nexthop add id 10 group 1/2
798 $IP nexthop replace id 1 via 192.0.2.4 dev dummy1 &> /dev/null
801 nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
804 nexthop_check "id 10" "id 10 group 1/2 trap"
820 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
821 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
822 $IP nexthop add id 10 group 1/2 type resilient buckets 4
824 $IP nexthop replace id 1 via 192.0.2.4 dev dummy1
827 …nexthop_check "id 10" "id 10 group 1/2 type resilient buckets 4 idle_timer 120 unbalanced_timer 0 …
830 nexthop_bucket_nhid_count_check 10 1 2 2 2
845 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
846 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
847 $IP nexthop add id 10 group 1/2 type resilient buckets 4
850 echo 1 > $DEBUGFS_NET_DIR/fib/fail_nexthop_bucket_replace
851 $IP nexthop replace id 1 via 192.0.2.4 dev dummy1 &> /dev/null
854 nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
857 …nexthop_check "id 10" "id 10 group 1/2 type resilient buckets 4 idle_timer 120 unbalanced_timer 0 …
860 nexthop_bucket_nhid_count_check 10 1 2 2 2
877 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
878 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
879 $IP nexthop add id 10 group 1/2
881 $IP nexthop del id 1
882 nexthop_check "id 10" "id 10 group 2 trap"
885 nexthop_resource_check 2
897 # First, nexthop 1 will be deleted, which will reduce the occupancy to
904 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
905 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
907 $IP nexthop add id 10 group 1/2/3
909 $IP nexthop del id 1
924 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
925 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
926 $IP nexthop add id 10 group 1/2 type resilient buckets 4
928 $IP nexthop del id 1
929 …nexthop_check "id 10" "id 10 group 2 type resilient buckets 4 idle_timer 120 unbalanced_timer 0 un…
932 nexthop_bucket_nhid_count_check 10 2 4
947 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
948 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
950 $IP nexthop add id 10 group 1/2/3 type resilient buckets 6
953 echo 1 > $DEBUGFS_NET_DIR/fib/fail_nexthop_bucket_replace
954 $IP nexthop del id 1
957 # assigned to nhid 1.
958 nexthop_bucket_nhid_count_check 10 2 2 3 2
975 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
976 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
977 $IP nexthop add id 10 group 1/2
982 nexthop_check "id 1" "id 1 via 192.0.2.2 dev dummy1 scope link trap"
985 nexthop_check "id 2" "id 2 via 192.0.2.3 dev dummy1 scope link trap"
988 nexthop_check "id 10" "id 10 group 1/2 trap"
1003 $IP nexthop add id 1 via 192.0.2.2 dev dummy1
1004 $IP nexthop add id 2 via 192.0.2.3 dev dummy1
1005 $IP nexthop add id 10 group 1/2
1027 echo "$DEV_ADDR 1" > ${NETDEVSIM_PATH}/new_device
1028 while [ ! -d $SYSFS_NET_DIR ] ; do :; done
1030 set -e
1035 IP="ip -netns testns1"
1036 DEVLINK="devlink -N testns1"
1049 modprobe -r netdevsim &> /dev/null