gro.sh (6234219d7fe8bb709f1e9d5afcb420d9cb30beac) | gro.sh (9af771d2ec044ffc19192711ac29f1d5c31dc181) |
---|---|
1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 | 1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 |
4source setup_loopback.sh | |
5readonly SERVER_MAC="aa:00:00:00:00:02" 6readonly CLIENT_MAC="aa:00:00:00:00:01" 7readonly TESTS=("data" "ack" "flags" "tcp" "ip" "large") 8readonly PROTOS=("ipv4" "ipv6") | 4readonly SERVER_MAC="aa:00:00:00:00:02" 5readonly CLIENT_MAC="aa:00:00:00:00:01" 6readonly TESTS=("data" "ack" "flags" "tcp" "ip" "large") 7readonly PROTOS=("ipv4" "ipv6") |
9dev="eth0" | 8dev="" |
10test="all" 11proto="ipv4" 12 | 9test="all" 10proto="ipv4" 11 |
13setup_interrupt() { 14 # Use timer on host to trigger the network stack 15 # Also disable device interrupt to not depend on NIC interrupt 16 # Reduce test flakiness caused by unexpected interrupts 17 echo 100000 >"${FLUSH_PATH}" 18 echo 50 >"${IRQ_PATH}" 19} 20 21setup_ns() { 22 # Set up server_ns namespace and client_ns namespace 23 setup_macvlan_ns "${dev}" server_ns server "${SERVER_MAC}" 24 setup_macvlan_ns "${dev}" client_ns client "${CLIENT_MAC}" 25} 26 27cleanup_ns() { 28 cleanup_macvlan_ns server_ns server client_ns client 29} 30 31setup() { 32 setup_loopback_environment "${dev}" 33 setup_interrupt 34} 35 36cleanup() { 37 cleanup_loopback "${dev}" 38 39 echo "${FLUSH_TIMEOUT}" >"${FLUSH_PATH}" 40 echo "${HARD_IRQS}" >"${IRQ_PATH}" 41} 42 | |
43run_test() { 44 local server_pid=0 45 local exit_code=0 46 local protocol=$1 47 local test=$2 48 local ARGS=( "--${protocol}" "--dmac" "${SERVER_MAC}" \ 49 "--smac" "${CLIENT_MAC}" "--test" "${test}" "--verbose" ) 50 --- 59 unchanged lines hidden (view full) --- 110 proto="${OPTARG}" 111 ;; 112 *) 113 usage 114 ;; 115 esac 116done 117 | 12run_test() { 13 local server_pid=0 14 local exit_code=0 15 local protocol=$1 16 local test=$2 17 local ARGS=( "--${protocol}" "--dmac" "${SERVER_MAC}" \ 18 "--smac" "${CLIENT_MAC}" "--test" "${test}" "--verbose" ) 19 --- 59 unchanged lines hidden (view full) --- 79 proto="${OPTARG}" 80 ;; 81 *) 82 usage 83 ;; 84 esac 85done 86 |
118readonly FLUSH_PATH="/sys/class/net/${dev}/gro_flush_timeout" 119readonly IRQ_PATH="/sys/class/net/${dev}/napi_defer_hard_irqs" 120readonly FLUSH_TIMEOUT="$(< ${FLUSH_PATH})" 121readonly HARD_IRQS="$(< ${IRQ_PATH})" | 87if [ -n "$dev" ]; then 88 source setup_loopback.sh 89else 90 source setup_veth.sh 91fi 92 |
122setup 123trap cleanup EXIT 124if [[ "${test}" == "all" ]]; then 125 run_all_tests 126else 127 run_test "${proto}" "${test}" 128fi; | 93setup 94trap cleanup EXIT 95if [[ "${test}" == "all" ]]; then 96 run_all_tests 97else 98 run_test "${proto}" "${test}" 99fi; |