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

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/mlxsw/qos_defprio.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 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 
  4 # Test for port-default priority. Non-IP packets ingress $swp1 and are
  5 # prioritized according to the default priority specified at the port.
  6 # rx_octets_prio_* counters are used to verify the prioritization.
  7 #
  8 # +----------------------------------+
  9 # | H1                               |
 10 # |    + $h1                         |
 11 # |    | 192.0.2.1/28                |
 12 # +----|-----------------------------+
 13 #      |
 14 # +----|-----------------------------+
 15 # | SW |                             |
 16 # |    + $swp1                       |
 17 # |      192.0.2.2/28                |
 18 # |      dcb app default-prio <prio> |
 19 # +----------------------------------+
 20 
 21 ALL_TESTS="
 22         ping_ipv4
 23         test_defprio
 24 "
 25 
 26 lib_dir=$(dirname $0)/../../../net/forwarding
 27 
 28 NUM_NETIFS=2
 29 : ${HIT_TIMEOUT:=1000} # ms
 30 source $lib_dir/lib.sh
 31 
 32 h1_create()
 33 {
 34         simple_if_init $h1 192.0.2.1/28
 35 }
 36 
 37 h1_destroy()
 38 {
 39         simple_if_fini $h1 192.0.2.1/28
 40 }
 41 
 42 switch_create()
 43 {
 44         ip link set dev $swp1 up
 45         ip addr add dev $swp1 192.0.2.2/28
 46 }
 47 
 48 switch_destroy()
 49 {
 50         dcb app flush dev $swp1 default-prio
 51         ip addr del dev $swp1 192.0.2.2/28
 52         ip link set dev $swp1 down
 53 }
 54 
 55 setup_prepare()
 56 {
 57         h1=${NETIFS[p1]}
 58         swp1=${NETIFS[p2]}
 59 
 60         vrf_prepare
 61 
 62         h1_create
 63         switch_create
 64 }
 65 
 66 cleanup()
 67 {
 68         pre_cleanup
 69 
 70         switch_destroy
 71         h1_destroy
 72 
 73         vrf_cleanup
 74 }
 75 
 76 ping_ipv4()
 77 {
 78         ping_test $h1 192.0.2.2
 79 }
 80 
 81 __test_defprio()
 82 {
 83         local prio_install=$1; shift
 84         local prio_observe=$1; shift
 85         local key
 86         local t1
 87         local i
 88 
 89         RET=0
 90 
 91         dcb app add dev $swp1 default-prio $prio_install
 92 
 93         local t0=$(ethtool_stats_get $swp1 rx_frames_prio_$prio_observe)
 94         mausezahn -q $h1 -d 100m -c 10 -t arp reply
 95         t1=$(busywait "$HIT_TIMEOUT" until_counter_is ">= $((t0 + 10))" \
 96                 ethtool_stats_get $swp1 rx_frames_prio_$prio_observe)
 97 
 98         check_err $? "Default priority $prio_install/$prio_observe: Expected to capture 10 packets, got $((t1 - t0))."
 99         log_test "Default priority $prio_install/$prio_observe"
100 
101         dcb app del dev $swp1 default-prio $prio_install
102 }
103 
104 test_defprio()
105 {
106         local prio
107 
108         for prio in {0..7}; do
109                 __test_defprio $prio $prio
110         done
111 
112         dcb app add dev $swp1 default-prio 3
113         __test_defprio 0 3
114         __test_defprio 1 3
115         __test_defprio 2 3
116         __test_defprio 4 4
117         __test_defprio 5 5
118         __test_defprio 6 6
119         __test_defprio 7 7
120         dcb app del dev $swp1 default-prio 3
121 }
122 
123 trap cleanup EXIT
124 
125 setup_prepare
126 setup_wait
127 
128 tests_run
129 
130 exit $EXIT_STATUS

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