add new topology parameter: arch
[csit.git] / tests / tldk / tldk_scripts / run_tldk.sh
1 #!/bin/bash
2
3 set -x
4
5 # set arch, default to x86_64 if none given
6 ARCH=${1:-"x86_64"}
7
8 # dpdk prefers "arm64" to "aarch64" and does not allow arm64 native target
9 if [ $ARCH == "aarch64" ]; then
10     ARCH="arm64"
11     MACHINE="armv8a"
12 else
13     MACHINE="native"
14 fi
15
16 ROOTDIR=/tmp/TLDK-testing
17 PWDDIR=$(pwd)
18
19 rx_file=$1
20 tx_file=$2
21 nic_pci=$3
22 fe_cfg=$4
23 be_cfg=$5
24 IPv4_addr=$6
25 IPv6_addr=$7
26
27 echo $IPv4_addr
28
29 # Try to kill the l4fwd
30 sudo pgrep l4fwd
31 if [ $? -eq "0" ]; then
32     success=false
33     sudo pkill l4fwd
34     echo "RC = $?"
35     for attempt in {1..5}; do
36         echo "Checking if l4fwd is still alive, attempt nr ${attempt}"
37         sudo pgrep l4fwd
38         if [ $? -eq "1" ]; then
39             echo "l4fwd is dead"
40             success=true
41             break
42         fi
43         echo "l4fwd is still alive, waiting 1 second"
44         sleep 1
45     done
46     if [ "$success" = false ]; then
47         echo "The command sudo pkill l4fwd failed"
48         sudo pkill -9 l4fwd
49         echo "RC = $?"
50         exit 1
51     fi
52 else
53     echo "l4fwd is not running"
54 fi
55
56 #mount the hugepages again
57 sudo umount /mnt/huge
58 sudo mount -t hugetlbfs nodev /mnt/huge/
59 test $? -eq 0 || exit 1
60
61 sleep 2
62
63 #run the l4fwd with tag U
64 # need to install libpcap, libpcap-dev to use --vdev
65 cd ${ROOTDIR}
66 if [ "$IPv6_addr" == "NONE" ]; then
67 sudo sh -c "nohup ./tldk/${ARCH}-${MACHINE}-linuxapp-gcc/app/l4fwd --lcore='0' \
68     -n 2 --vdev 'eth_pcap1,rx_pcap=${rx_file},tx_pcap=${tx_file}' \
69     -b ${nic_pci} -- -P -U -R 0x1000 -S 0x1000 -s 0x20 -f ${fe_cfg} -b ${be_cfg} \
70     port=0,lcore=0,rx_offload=0,tx_offload=0,ipv4=${IPv4_addr} &"
71 elif [ "$IPv4_addr" == "NONE" ]; then
72 sudo sh -c "nohup ./tldk/${ARCH}-${MACHINE}-linuxapp-gcc/app/l4fwd --lcore='0' \
73     -n 2 --vdev 'eth_pcap1,rx_pcap=${rx_file},tx_pcap=${tx_file}' \
74     -b ${nic_pci} -- -P -U -R 0x1000 -S 0x1000 -s 0x20 -f ${fe_cfg} -b ${be_cfg} \
75     port=0,lcore=0,rx_offload=0,tx_offload=0,ipv6=${IPv6_addr} &"
76 fi
77
78 cd ${PWDDIR}
79
80 ps -elf | grep l4fwd
81
82 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.