1 #!/bin/sh 2 # SPDX-License-Identifier: GPL-2.0 3 # 4 # Run a series of udpgso regression tests 5 6 set -o errexit 7 set -o nounset 8 9 setup_loopback() { 10 ip addr add dev lo 10.0.0.1/32 11 ip addr add dev lo fd00::1/128 nodad noprefixroute 12 } 13 14 test_dev_mtu() { 15 setup_loopback 16 # Reduce loopback MTU 17 ip link set dev lo mtu 1500 18 } 19 20 test_route_mtu() { 21 setup_loopback 22 # Remove default local routes 23 ip route del local 10.0.0.1/32 table local dev lo 24 ip route del local fd00::1/128 table local dev lo 25 # Install local routes with reduced MTU 26 ip route add local 10.0.0.1/32 table local dev lo mtu 1500 27 ip route add local fd00::1/128 table local dev lo mtu 1500 28 } 29 30 setup_dummy_sink() { 31 ip link add name sink mtu 1500 type dummy 32 ip addr add dev sink 10.0.0.0/24 33 ip addr add dev sink fd00::2/64 nodad 34 ip link set dev sink up 35 } 36 37 test_hw_gso_hw_csum() { 38 setup_dummy_sink 39 ethtool -K sink tx-checksum-ip-generic on >/dev/null 40 ethtool -K sink tx-udp-segmentation on >/dev/null 41 } 42 43 test_sw_gso_hw_csum() { 44 setup_dummy_sink 45 ethtool -K sink tx-checksum-ip-generic on >/dev/null 46 ethtool -K sink tx-udp-segmentation off >/dev/null 47 } 48 49 test_sw_gso_sw_csum() { 50 setup_dummy_sink 51 ethtool -K sink tx-checksum-ip-generic off >/dev/null 52 ethtool -K sink tx-udp-segmentation off >/dev/null 53 } 54 55 if [ "$#" -gt 0 ]; then 56 "$1" 57 shift 2 # pop "test_*" arg and "--" delimiter 58 exec "$@" 59 fi 60 61 echo "ipv4 cmsg" 62 ./in_netns.sh "$0" test_dev_mtu -- ./udpgso -4 -C 63 64 echo "ipv4 setsockopt" 65 ./in_netns.sh "$0" test_dev_mtu -- ./udpgso -4 -C -s 66 67 echo "ipv6 cmsg" 68 ./in_netns.sh "$0" test_dev_mtu -- ./udpgso -6 -C 69 70 echo "ipv6 setsockopt" 71 ./in_netns.sh "$0" test_dev_mtu -- ./udpgso -6 -C -s 72 73 echo "ipv4 connected" 74 ./in_netns.sh "$0" test_route_mtu -- ./udpgso -4 -c 75 76 echo "ipv6 connected" 77 ./in_netns.sh "$0" test_route_mtu -- ./udpgso -6 -c 78 79 echo "ipv4 msg_more" 80 ./in_netns.sh "$0" test_dev_mtu -- ./udpgso -4 -C -m 81 82 echo "ipv6 msg_more" 83 ./in_netns.sh "$0" test_dev_mtu -- ./udpgso -6 -C -m 84 85 echo "ipv4 hw-gso hw-csum" 86 ./in_netns.sh "$0" test_hw_gso_hw_csum -- ./udpgso -4 -C -R 87 88 echo "ipv6 hw-gso hw-csum" 89 ./in_netns.sh "$0" test_hw_gso_hw_csum -- ./udpgso -6 -C -R 90 91 echo "ipv4 sw-gso hw-csum" 92 ./in_netns.sh "$0" test_sw_gso_hw_csum -- ./udpgso -4 -C -R 93 94 echo "ipv6 sw-gso hw-csum" 95 ./in_netns.sh "$0" test_sw_gso_hw_csum -- ./udpgso -6 -C -R 96 97 echo "ipv4 sw-gso sw-csum" 98 ./in_netns.sh "$0" test_sw_gso_sw_csum -- ./udpgso -4 -C -R 99 100 echo "ipv6 sw-gso sw-csum" 101 ./in_netns.sh "$0" test_sw_gso_sw_csum -- ./udpgso -6 -C -R
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.