CSIT-687: Directory structure reorganization
[csit.git] / tests / tldk / tldk_scripts / run_tldk.sh
1 #!/bin/bash
2
3 set -x
4
5 ROOTDIR=/tmp/TLDK-testing
6 PWDDIR=$(pwd)
7
8 rx_file=$1
9 tx_file=$2
10 nic_pci=$3
11 fe_cfg=$4
12 be_cfg=$5
13 IPv4_addr=$6
14 IPv6_addr=$7
15
16 echo $IPv4_addr
17
18 #kill the l4fwd
19 sudo killall -9 l4fwd 2>/dev/null
20
21 sleep 2
22
23 pid=`pgrep l4fwd`
24 if [ "$pid" != "" ]; then
25     echo "terminate the l4fwd failed!"
26     exit 1
27 fi
28
29 #mount the hugepages again
30 sudo umount /mnt/huge
31 sudo mount -t hugetlbfs nodev /mnt/huge/
32 test $? -eq 0 || exit 1
33
34 sleep 2
35
36 #run the l4fwd with tag U
37 # need to install libpcap, libpcap-dev to use --vdev
38 cd ${ROOTDIR}
39 if [ "$IPv6_addr" == "NONE" ]; then
40 sudo sh -c "nohup ./tldk/x86_64-native-linuxapp-gcc/app/l4fwd --lcore='0' \
41     -n 2 --vdev 'eth_pcap1,rx_pcap=${rx_file},tx_pcap=${tx_file}' \
42     -b ${nic_pci} -- -P -U -R 0x1000 -S 0x1000 -s 0x20 -f ${fe_cfg} -b ${be_cfg} \
43     port=0,lcore=0,rx_offload=0,tx_offload=0,ipv4=${IPv4_addr} &"
44 elif [ "$IPv4_addr" == "NONE" ]; then
45 sudo sh -c "nohup ./tldk/x86_64-native-linuxapp-gcc/app/l4fwd --lcore='0' \
46     -n 2 --vdev 'eth_pcap1,rx_pcap=${rx_file},tx_pcap=${tx_file}' \
47     -b ${nic_pci} -- -P -U -R 0x1000 -S 0x1000 -s 0x20 -f ${fe_cfg} -b ${be_cfg} \
48     port=0,lcore=0,rx_offload=0,tx_offload=0,ipv6=${IPv6_addr} &"
49 fi
50
51 cd ${PWDDIR}
52
53 sleep 10