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