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

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/hw/loopback.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 ] ~

Diff markup

Differences between /tools/testing/selftests/drivers/net/hw/loopback.sh (Architecture i386) and /tools/testing/selftests/drivers/net/hw/loopback.sh (Architecture alpha)


  1 #!/bin/bash                                         1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3                                                     3 
  4 # Kselftest framework requirement - SKIP code       4 # Kselftest framework requirement - SKIP code is 4.
  5 ksft_skip=4                                         5 ksft_skip=4
  6                                                     6 
  7 ALL_TESTS="loopback_test"                           7 ALL_TESTS="loopback_test"
  8 NUM_NETIFS=2                                        8 NUM_NETIFS=2
  9 lib_dir=$(dirname "$0")                             9 lib_dir=$(dirname "$0")
 10 source "$lib_dir"/../../../net/forwarding/tc_c     10 source "$lib_dir"/../../../net/forwarding/tc_common.sh
 11 source "$lib_dir"/../../../net/forwarding/lib.     11 source "$lib_dir"/../../../net/forwarding/lib.sh
 12                                                    12 
 13 h1_create()                                        13 h1_create()
 14 {                                                  14 {
 15         simple_if_init $h1 192.0.2.1/24            15         simple_if_init $h1 192.0.2.1/24
 16         tc qdisc add dev $h1 clsact                16         tc qdisc add dev $h1 clsact
 17 }                                                  17 }
 18                                                    18 
 19 h1_destroy()                                       19 h1_destroy()
 20 {                                                  20 {
 21         tc qdisc del dev $h1 clsact                21         tc qdisc del dev $h1 clsact
 22         simple_if_fini $h1 192.0.2.1/24            22         simple_if_fini $h1 192.0.2.1/24
 23 }                                                  23 }
 24                                                    24 
 25 h2_create()                                        25 h2_create()
 26 {                                                  26 {
 27         simple_if_init $h2                         27         simple_if_init $h2
 28 }                                                  28 }
 29                                                    29 
 30 h2_destroy()                                       30 h2_destroy()
 31 {                                                  31 {
 32         simple_if_fini $h2                         32         simple_if_fini $h2
 33 }                                                  33 }
 34                                                    34 
 35 loopback_test()                                    35 loopback_test()
 36 {                                                  36 {
 37         RET=0                                      37         RET=0
 38                                                    38 
 39         tc filter add dev $h1 ingress protocol     39         tc filter add dev $h1 ingress protocol arp pref 1 handle 101 flower \
 40                 skip_hw arp_op reply arp_tip 1     40                 skip_hw arp_op reply arp_tip 192.0.2.1 action drop
 41                                                    41 
 42         $MZ $h1 -c 1 -t arp -q                     42         $MZ $h1 -c 1 -t arp -q
 43                                                    43 
 44         tc_check_packets "dev $h1 ingress" 101     44         tc_check_packets "dev $h1 ingress" 101 1
 45         check_fail $? "Matched on a filter wit     45         check_fail $? "Matched on a filter without loopback setup"
 46                                                    46 
 47         ethtool -K $h1 loopback on                 47         ethtool -K $h1 loopback on
 48         check_err $? "Failed to enable loopbac     48         check_err $? "Failed to enable loopback"
 49                                                    49 
 50         setup_wait_dev $h1                         50         setup_wait_dev $h1
 51                                                    51 
 52         $MZ $h1 -c 1 -t arp -q                     52         $MZ $h1 -c 1 -t arp -q
 53                                                    53 
 54         tc_check_packets "dev $h1 ingress" 101     54         tc_check_packets "dev $h1 ingress" 101 1
 55         check_err $? "Did not match on filter      55         check_err $? "Did not match on filter with loopback"
 56                                                    56 
 57         ethtool -K $h1 loopback off                57         ethtool -K $h1 loopback off
 58         check_err $? "Failed to disable loopba     58         check_err $? "Failed to disable loopback"
 59                                                    59 
 60         $MZ $h1 -c 1 -t arp -q                     60         $MZ $h1 -c 1 -t arp -q
 61                                                    61 
 62         tc_check_packets "dev $h1 ingress" 101     62         tc_check_packets "dev $h1 ingress" 101 2
 63         check_fail $? "Matched on a filter aft     63         check_fail $? "Matched on a filter after loopback was removed"
 64                                                    64 
 65         tc filter del dev $h1 ingress protocol     65         tc filter del dev $h1 ingress protocol arp pref 1 handle 101 flower
 66                                                    66 
 67         log_test "loopback"                        67         log_test "loopback"
 68 }                                                  68 }
 69                                                    69 
 70 setup_prepare()                                    70 setup_prepare()
 71 {                                                  71 {
 72         h1=${NETIFS[p1]}                           72         h1=${NETIFS[p1]}
 73         h2=${NETIFS[p2]}                           73         h2=${NETIFS[p2]}
 74                                                    74 
 75         vrf_prepare                                75         vrf_prepare
 76                                                    76 
 77         h1_create                                  77         h1_create
 78         h2_create                                  78         h2_create
 79                                                    79 
 80         if ethtool -k $h1 | grep loopback | gr     80         if ethtool -k $h1 | grep loopback | grep -q fixed; then
 81                 log_test "SKIP: dev $h1 does n     81                 log_test "SKIP: dev $h1 does not support loopback feature"
 82                 exit $ksft_skip                    82                 exit $ksft_skip
 83         fi                                         83         fi
 84 }                                                  84 }
 85                                                    85 
 86 cleanup()                                          86 cleanup()
 87 {                                                  87 {
 88         pre_cleanup                                88         pre_cleanup
 89                                                    89 
 90         h2_destroy                                 90         h2_destroy
 91         h1_destroy                                 91         h1_destroy
 92                                                    92 
 93         vrf_cleanup                                93         vrf_cleanup
 94 }                                                  94 }
 95                                                    95 
 96 trap cleanup EXIT                                  96 trap cleanup EXIT
 97                                                    97 
 98 setup_prepare                                      98 setup_prepare
 99 setup_wait                                         99 setup_wait
100                                                   100 
101 tests_run                                         101 tests_run
102                                                   102 
103 exit $EXIT_STATUS                                 103 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