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

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/mlxsw/port_range_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 PORT_RANGE_NUM_NETIFS=2
  4 
  5 port_range_h1_create()
  6 {
  7         simple_if_init $h1
  8 }
  9 
 10 port_range_h1_destroy()
 11 {
 12         simple_if_fini $h1
 13 }
 14 
 15 port_range_switch_create()
 16 {
 17         simple_if_init $swp1
 18         tc qdisc add dev $swp1 clsact
 19 }
 20 
 21 port_range_switch_destroy()
 22 {
 23         tc qdisc del dev $swp1 clsact
 24         simple_if_fini $swp1
 25 }
 26 
 27 port_range_rules_create()
 28 {
 29         local count=$1; shift
 30         local should_fail=$1; shift
 31         local batch_file="$(mktemp)"
 32 
 33         for ((i = 0; i < count; ++i)); do
 34                 cat >> $batch_file <<-EOF
 35                         filter add dev $swp1 ingress \
 36                                 prot ipv4 \
 37                                 pref 1000 \
 38                                 flower skip_sw \
 39                                 ip_proto udp dst_port 1-$((100 + i)) \
 40                                 action pass
 41                 EOF
 42         done
 43 
 44         tc -b $batch_file
 45         check_err_fail $should_fail $? "Rule insertion"
 46 
 47         rm -f $batch_file
 48 }
 49 
 50 __port_range_test()
 51 {
 52         local count=$1; shift
 53         local should_fail=$1; shift
 54 
 55         port_range_rules_create $count $should_fail
 56 
 57         offload_count=$(tc -j filter show dev $swp1 ingress |
 58                         jq "[.[] | select(.options.in_hw == true)] | length")
 59         ((offload_count == count))
 60         check_err_fail $should_fail $? "port range offload count"
 61 }
 62 
 63 port_range_test()
 64 {
 65         local count=$1; shift
 66         local should_fail=$1; shift
 67 
 68         if ! tc_offload_check $PORT_RANGE_NUM_NETIFS; then
 69                 check_err 1 "Could not test offloaded functionality"
 70                 return
 71         fi
 72 
 73         __port_range_test $count $should_fail
 74 }
 75 
 76 port_range_setup_prepare()
 77 {
 78         h1=${NETIFS[p1]}
 79         swp1=${NETIFS[p2]}
 80 
 81         vrf_prepare
 82 
 83         port_range_h1_create
 84         port_range_switch_create
 85 }
 86 
 87 port_range_cleanup()
 88 {
 89         pre_cleanup
 90 
 91         port_range_switch_destroy
 92         port_range_h1_destroy
 93 
 94         vrf_cleanup
 95 }

~ [ 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