Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'forwarding-selftest-fixes'

David Ahern says:

====================
selftests: forwarding: misc bug fixes and enhancements

Bug fixes and an enhancement for the recent forwarding tests:
- only check tc version on tc tests
- handle multipath tests failing with 0 packet count
- fix ping command for IPv6 on Debian jessie
- improve summary of multipath tests

v2
- add CHECK_TC to bridge_vlan_aware.sh (Ido)
- dropped patch 2; always check for mz given its use
- fixed commit message for the last patch (Multipath: was dropped)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+53 -33
+1
tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 NUM_NETIFS=4 5 + CHECK_TC="yes" 5 6 source lib.sh 6 7 7 8 h1_create()
+18 -11
tools/testing/selftests/net/forwarding/lib.sh
··· 19 19 ############################################################################## 20 20 # Sanity checks 21 21 22 + check_tc_version() 23 + { 24 + tc -j &> /dev/null 25 + if [[ $? -ne 0 ]]; then 26 + echo "SKIP: iproute2 too old; tc is missing JSON support" 27 + exit 1 28 + fi 29 + 30 + tc filter help 2>&1 | grep block &> /dev/null 31 + if [[ $? -ne 0 ]]; then 32 + echo "SKIP: iproute2 too old; tc is missing shared block support" 33 + exit 1 34 + fi 35 + } 36 + 22 37 if [[ "$(id -u)" -ne 0 ]]; then 23 38 echo "SKIP: need root privileges" 24 39 exit 0 25 40 fi 26 41 27 - tc -j &> /dev/null 28 - if [[ $? -ne 0 ]]; then 29 - echo "SKIP: iproute2 too old, missing JSON support" 30 - exit 0 31 - fi 32 - 33 - tc filter help 2>&1 | grep block &> /dev/null 34 - if [[ $? -ne 0 ]]; then 35 - echo "SKIP: iproute2 too old, missing shared block support" 36 - exit 0 42 + if [[ "$CHECK_TC" = "yes" ]]; then 43 + check_tc_version 37 44 fi 38 45 39 46 if [[ ! -x "$(command -v jq)" ]]; then 40 47 echo "SKIP: jq not installed" 41 - exit 0 48 + exit 1 42 49 fi 43 50 44 51 if [[ ! -x "$(command -v $MZ)" ]]; then
+28 -18
tools/testing/selftests/net/forwarding/router_multipath.sh
··· 160 160 161 161 multipath_eval() 162 162 { 163 - local weight_rp12=$1 164 - local weight_rp13=$2 165 - local packets_rp12=$3 166 - local packets_rp13=$4 163 + local desc="$1" 164 + local weight_rp12=$2 165 + local weight_rp13=$3 166 + local packets_rp12=$4 167 + local packets_rp13=$5 167 168 local weights_ratio packets_ratio diff 168 169 169 170 RET=0 171 + 172 + if [[ "$packets_rp12" -eq "0" || "$packets_rp13" -eq "0" ]]; then 173 + check_err 1 "Packet difference is 0" 174 + log_test "Multipath" 175 + log_info "Expected ratio $weights_ratio" 176 + return 177 + fi 170 178 171 179 if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then 172 180 weights_ratio=$(echo "scale=2; $weight_rp12 / $weight_rp13" \ ··· 193 185 194 186 test "$(echo "$diff / $weights_ratio > 0.1" | bc -l)" -eq 0 195 187 check_err $? "Too large discrepancy between expected and measured ratios" 196 - log_test "Multipath" 188 + log_test "$desc" 197 189 log_info "Expected ratio $weights_ratio Measured ratio $packets_ratio" 198 190 } 199 191 200 192 multipath4_test() 201 193 { 202 - local weight_rp12=$1 203 - local weight_rp13=$2 194 + local desc="$1" 195 + local weight_rp12=$2 196 + local weight_rp13=$3 204 197 local t0_rp12 t0_rp13 t1_rp12 t1_rp13 205 198 local packets_rp12 packets_rp13 206 199 local hash_policy ··· 226 217 227 218 let "packets_rp12 = $t1_rp12 - $t0_rp12" 228 219 let "packets_rp13 = $t1_rp13 - $t0_rp13" 229 - multipath_eval $weight_rp12 $weight_rp13 $packets_rp12 $packets_rp13 220 + multipath_eval "$desc" $weight_rp12 $weight_rp13 $packets_rp12 $packets_rp13 230 221 231 222 # Restore settings. 232 223 ip route replace 198.51.100.0/24 vrf vrf-r1 \ ··· 237 228 238 229 multipath6_test() 239 230 { 240 - local weight_rp12=$1 241 - local weight_rp13=$2 231 + local desc="$1" 232 + local weight_rp12=$2 233 + local weight_rp13=$3 242 234 local t0_rp12 t0_rp13 t1_rp12 t1_rp13 243 235 local packets_rp12 packets_rp13 244 236 ··· 252 242 253 243 # Generate 16384 echo requests, each with a random flow label. 254 244 for _ in $(seq 1 16384); do 255 - ip vrf exec vrf-h1 ping 2001:db8:2::2 -F 0 -c 1 -q &> /dev/null 245 + ip vrf exec vrf-h1 $PING6 2001:db8:2::2 -F 0 -c 1 -q &> /dev/null 256 246 done 257 247 258 248 t1_rp12=$(link_stats_tx_packets_get $rp12) ··· 260 250 261 251 let "packets_rp12 = $t1_rp12 - $t0_rp12" 262 252 let "packets_rp13 = $t1_rp13 - $t0_rp13" 263 - multipath_eval $weight_rp12 $weight_rp13 $packets_rp12 $packets_rp13 253 + multipath_eval "$desc" $weight_rp12 $weight_rp13 $packets_rp12 $packets_rp13 264 254 265 255 ip route replace 2001:db8:2::/64 vrf vrf-r1 \ 266 256 nexthop via fe80:2::22 dev $rp12 \ ··· 270 260 multipath_test() 271 261 { 272 262 log_info "Running IPv4 multipath tests" 273 - multipath4_test 1 1 274 - multipath4_test 2 1 275 - multipath4_test 11 45 263 + multipath4_test "ECMP" 1 1 264 + multipath4_test "Weighted MP 2:1" 2 1 265 + multipath4_test "Weighted MP 11:45" 11 45 276 266 277 267 log_info "Running IPv6 multipath tests" 278 - multipath6_test 1 1 279 - multipath6_test 2 1 280 - multipath6_test 11 45 268 + multipath6_test "ECMP" 1 1 269 + multipath6_test "Weighted MP 2:1" 2 1 270 + multipath6_test "Weighted MP 11:45" 11 45 281 271 } 282 272 283 273 setup_prepare()
+1 -1
tools/testing/selftests/net/forwarding/tc_actions.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 NUM_NETIFS=4 5 - source lib.sh 6 5 source tc_common.sh 6 + source lib.sh 7 7 8 8 tcflags="skip_hw" 9 9
+1 -1
tools/testing/selftests/net/forwarding/tc_chains.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 NUM_NETIFS=2 5 - source lib.sh 6 5 source tc_common.sh 6 + source lib.sh 7 7 8 8 tcflags="skip_hw" 9 9
+2
tools/testing/selftests/net/forwarding/tc_common.sh
··· 1 1 #!/bin/bash 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 + CHECK_TC="yes" 5 + 4 6 tc_check_packets() 5 7 { 6 8 local id=$1
+1 -1
tools/testing/selftests/net/forwarding/tc_flower.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 NUM_NETIFS=2 5 - source lib.sh 6 5 source tc_common.sh 6 + source lib.sh 7 7 8 8 tcflags="skip_hw" 9 9
+1 -1
tools/testing/selftests/net/forwarding/tc_shblocks.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 NUM_NETIFS=4 5 - source lib.sh 6 5 source tc_common.sh 6 + source lib.sh 7 7 8 8 tcflags="skip_hw" 9 9