6a0311b9746ef67c7cf15e28caf85335e4e3b17e
[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 # Try to kill the l4fwd
19 sudo pgrep l4fwd
20 if [ $? -eq "0" ]; then
21     success=false
22     sudo pkill l4fwd
23     echo "RC = $?"
24     for attempt in {1..5}; do
25         echo "Checking if l4fwd is still alive, attempt nr ${attempt}"
26         sudo pgrep l4fwd
27         if [ $? -eq "1" ]; then
28             echo "l4fwd is dead"
29             success=true
30             break
31         fi
32         echo "l4fwd is still alive, waiting 1 second"
33         sleep 1
34     done
35     if [ "$success" = false ]; then
36         echo "The command sudo pkill l4fwd failed"
37         sudo pkill -9 l4fwd
38         echo "RC = $?"
39         exit 1
40     fi
41 else
42     echo "l4fwd is not running"
43 fi
44
45 #mount the hugepages again
46 sudo umount /mnt/huge
47 sudo mount -t hugetlbfs nodev /mnt/huge/
48 test $? -eq 0 || exit 1
49
50 sleep 2
51
52 #run the l4fwd with tag U
53 # need to install libpcap, libpcap-dev to use --vdev
54 cd ${ROOTDIR}
55 if [ "$IPv6_addr" == "NONE" ]; then
56 sudo sh -c "nohup ./tldk/x86_64-native-linuxapp-gcc/app/l4fwd --lcore='0' \
57     -n 2 --vdev 'eth_pcap1,rx_pcap=${rx_file},tx_pcap=${tx_file}' \
58     -b ${nic_pci} -- -P -U -R 0x1000 -S 0x1000 -s 0x20 -f ${fe_cfg} -b ${be_cfg} \
59     port=0,lcore=0,rx_offload=0,tx_offload=0,ipv4=${IPv4_addr} &"
60 elif [ "$IPv4_addr" == "NONE" ]; then
61 sudo sh -c "nohup ./tldk/x86_64-native-linuxapp-gcc/app/l4fwd --lcore='0' \
62     -n 2 --vdev 'eth_pcap1,rx_pcap=${rx_file},tx_pcap=${tx_file}' \
63     -b ${nic_pci} -- -P -U -R 0x1000 -S 0x1000 -s 0x20 -f ${fe_cfg} -b ${be_cfg} \
64     port=0,lcore=0,rx_offload=0,tx_offload=0,ipv6=${IPv6_addr} &"
65 fi
66
67 cd ${PWDDIR}
68
69 ps -elf | grep l4fwd
70
71 sleep 10

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.