1*49cdfc7eSAndroid Build Coastguard Worker#!/bin/sh 2*49cdfc7eSAndroid Build Coastguard Worker# SPDX-License-Identifier: GPL-2.0-or-later 3*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) 2021 Oracle and/or its affiliates. All Rights Reserved. 4*49cdfc7eSAndroid Build Coastguard Worker 5*49cdfc7eSAndroid Build Coastguard WorkerTST_TESTFUNC=virt_netperf_rand_sizes 6*49cdfc7eSAndroid Build Coastguard WorkerTST_SETUP=do_setup 7*49cdfc7eSAndroid Build Coastguard WorkerTST_CLEANUP=do_cleanup 8*49cdfc7eSAndroid Build Coastguard WorkerTST_NEEDS_TMPDIR=1 9*49cdfc7eSAndroid Build Coastguard WorkerTST_OPTS="t:" 10*49cdfc7eSAndroid Build Coastguard WorkerTST_PARSE_ARGS="parse_args" 11*49cdfc7eSAndroid Build Coastguard Worker 12*49cdfc7eSAndroid Build Coastguard Workervirt_type="fou" 13*49cdfc7eSAndroid Build Coastguard Worker 14*49cdfc7eSAndroid Build Coastguard WorkerGRE_IP_PROTO=47 15*49cdfc7eSAndroid Build Coastguard Worker 16*49cdfc7eSAndroid Build Coastguard Workerparse_args() 17*49cdfc7eSAndroid Build Coastguard Worker{ 18*49cdfc7eSAndroid Build Coastguard Worker case $1 in 19*49cdfc7eSAndroid Build Coastguard Worker t) virt_type="$2";; 20*49cdfc7eSAndroid Build Coastguard Worker esac 21*49cdfc7eSAndroid Build Coastguard Worker} 22*49cdfc7eSAndroid Build Coastguard Worker 23*49cdfc7eSAndroid Build Coastguard Workerdo_cleanup() 24*49cdfc7eSAndroid Build Coastguard Worker{ 25*49cdfc7eSAndroid Build Coastguard Worker if [ "$FOU_PORT" ]; then 26*49cdfc7eSAndroid Build Coastguard Worker tst_net_run -l $FOU_PORT -r $FOU_PORT_RMT \ 27*49cdfc7eSAndroid Build Coastguard Worker "ip fou del $FOU_PROTO ${TST_IPV6_FLAG} port" 28*49cdfc7eSAndroid Build Coastguard Worker fi 29*49cdfc7eSAndroid Build Coastguard Worker 30*49cdfc7eSAndroid Build Coastguard Worker virt_cleanup_rmt 31*49cdfc7eSAndroid Build Coastguard Worker virt_cleanup 32*49cdfc7eSAndroid Build Coastguard Worker} 33*49cdfc7eSAndroid Build Coastguard Worker 34*49cdfc7eSAndroid Build Coastguard Workerdo_setup() 35*49cdfc7eSAndroid Build Coastguard Worker{ 36*49cdfc7eSAndroid Build Coastguard Worker local get_port_cmd="tst_get_unused_port ipv${TST_IPVER} dgram" 37*49cdfc7eSAndroid Build Coastguard Worker local encap_cmd="encap $virt_type encap-sport auto encap-dport" 38*49cdfc7eSAndroid Build Coastguard Worker local loc_ip=$(tst_ipaddr) 39*49cdfc7eSAndroid Build Coastguard Worker local rmt_ip=$(tst_ipaddr rhost) 40*49cdfc7eSAndroid Build Coastguard Worker local fou="fou$TST_IPV6" 41*49cdfc7eSAndroid Build Coastguard Worker 42*49cdfc7eSAndroid Build Coastguard Worker case $virt_type in 43*49cdfc7eSAndroid Build Coastguard Worker fou) FOU_PROTO="ipproto $GRE_IP_PROTO";; 44*49cdfc7eSAndroid Build Coastguard Worker gue) FOU_PROTO="gue";; 45*49cdfc7eSAndroid Build Coastguard Worker esac 46*49cdfc7eSAndroid Build Coastguard Worker 47*49cdfc7eSAndroid Build Coastguard Worker tst_require_drivers $fou 48*49cdfc7eSAndroid Build Coastguard Worker tst_net_run -s modprobe $fou 49*49cdfc7eSAndroid Build Coastguard Worker 50*49cdfc7eSAndroid Build Coastguard Worker FOU_PORT=$($get_port_cmd) 51*49cdfc7eSAndroid Build Coastguard Worker FOU_PORT_RMT=$(tst_rhost_run -c "$get_port_cmd") 52*49cdfc7eSAndroid Build Coastguard Worker 53*49cdfc7eSAndroid Build Coastguard Worker tst_net_run -s -l $FOU_PORT -r $FOU_PORT_RMT \ 54*49cdfc7eSAndroid Build Coastguard Worker "ip fou add $FOU_PROTO ${TST_IPV6_FLAG} port" 55*49cdfc7eSAndroid Build Coastguard Worker 56*49cdfc7eSAndroid Build Coastguard Worker virt_setup "local $loc_ip remote $rmt_ip $encap_cmd $FOU_PORT_RMT" \ 57*49cdfc7eSAndroid Build Coastguard Worker "local $rmt_ip remote $loc_ip $encap_cmd $FOU_PORT" 58*49cdfc7eSAndroid Build Coastguard Worker} 59*49cdfc7eSAndroid Build Coastguard Worker 60*49cdfc7eSAndroid Build Coastguard Worker. virt_lib.sh 61*49cdfc7eSAndroid Build Coastguard Workertst_run 62