~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/mlxsw/rif_counter_scale.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 # SPDX-License-Identifier: GPL-2.0
  2 
  3 RIF_COUNTER_NUM_NETIFS=2
  4 
  5 rif_counter_addr4()
  6 {
  7         local i=$1; shift
  8         local p=$1; shift
  9 
 10         printf 192.0.%d.%d $((i / 64)) $(((4 * i % 256) + p))
 11 }
 12 
 13 rif_counter_addr4pfx()
 14 {
 15         rif_counter_addr4 $@
 16         printf /30
 17 }
 18 
 19 rif_counter_h1_create()
 20 {
 21         simple_if_init $h1
 22 }
 23 
 24 rif_counter_h1_destroy()
 25 {
 26         simple_if_fini $h1
 27 }
 28 
 29 rif_counter_h2_create()
 30 {
 31         simple_if_init $h2
 32 }
 33 
 34 rif_counter_h2_destroy()
 35 {
 36         simple_if_fini $h2
 37 }
 38 
 39 rif_counter_setup_prepare()
 40 {
 41         h1=${NETIFS[p1]}
 42         h2=${NETIFS[p2]}
 43 
 44         vrf_prepare
 45 
 46         rif_counter_h1_create
 47         rif_counter_h2_create
 48 }
 49 
 50 rif_counter_cleanup()
 51 {
 52         local count=$1; shift
 53 
 54         pre_cleanup
 55 
 56         for ((i = 1; i <= count; i++)); do
 57                 vlan_destroy $h2 $i
 58         done
 59 
 60         rif_counter_h2_destroy
 61         rif_counter_h1_destroy
 62 
 63         vrf_cleanup
 64 
 65         if [[ -v RIF_COUNTER_BATCH_FILE ]]; then
 66                 rm -f $RIF_COUNTER_BATCH_FILE
 67         fi
 68 }
 69 
 70 
 71 rif_counter_test()
 72 {
 73         local count=$1; shift
 74         local should_fail=$1; shift
 75 
 76         RIF_COUNTER_BATCH_FILE="$(mktemp)"
 77 
 78         for ((i = 1; i <= count; i++)); do
 79                 vlan_create $h2 $i v$h2 $(rif_counter_addr4pfx $i 2)
 80         done
 81         for ((i = 1; i <= count; i++)); do
 82                 cat >> $RIF_COUNTER_BATCH_FILE <<-EOF
 83                         stats set dev $h2.$i l3_stats on
 84                 EOF
 85         done
 86 
 87         ip -b $RIF_COUNTER_BATCH_FILE
 88         check_err_fail $should_fail $? "RIF counter enablement"
 89 }
 90 
 91 rif_counter_traffic_test()
 92 {
 93         local count=$1; shift
 94         local i;
 95 
 96         for ((i = count; i > 0; i /= 2)); do
 97                 $MZ $h1 -Q $i -c 1 -d 20msec -p 100 -a own -b $(mac_get $h2) \
 98                     -A $(rif_counter_addr4 $i 1) \
 99                     -B $(rif_counter_addr4 $i 2) \
100                     -q -t udp sp=54321,dp=12345
101         done
102         for ((i = count; i > 0; i /= 2)); do
103                 busywait "$TC_HIT_TIMEOUT" until_counter_is "== 1" \
104                          hw_stats_get l3_stats $h2.$i rx packets > /dev/null
105                 check_err $? "Traffic not seen at RIF $h2.$i"
106         done
107 }

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php