DPDK version bump
[csit.git] / dpdk-tests / dpdk_scripts / install_dpdk.sh
1 #!/bin/bash
2
3 set -x
4
5 # Setting variables
6 DPDK_VERSION=dpdk-17.05
7 DPDK_DIR=${DPDK_VERSION}
8 DPDK_PACKAGE=${DPDK_DIR}.tar.xz
9 ROOTDIR=/tmp/openvpp-testing
10 PWDDIR=$(pwd)
11
12 # Download the DPDK package
13 cd ${ROOTDIR}
14 wget "fast.dpdk.org/rel/${DPDK_PACKAGE}" || \
15     { echo "Failed to download $DPDK_PACKAGE"; exit 1; }
16 tar xJvf ${DPDK_PACKAGE} || \
17     { echo "Failed to extract $DPDK_PACKAGE"; exit 1; }
18
19 # Compile the DPDK
20 cd ./${DPDK_DIR}
21 make install T=x86_64-native-linuxapp-gcc -j || \
22     { echo "Failed to compile $DPDK_VERSION"; exit 1; }
23 cd ${PWDDIR}
24
25 # Compile the l3fwd
26 export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/
27 export RTE_TARGET=x86_64-native-linuxapp-gcc
28 cd ${RTE_SDK}/examples/l3fwd
29 make -j || \
30     { echo "Failed to compile l3fwd"; exit 1; }
31 cd ${PWDDIR}
32
33 # Check and setup the hugepages
34 SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages)
35 echo "  SYS_HUGEPAGE = ${SYS_HUGEPAGE}"
36 if [ ${SYS_HUGEPAGE} -lt 4096 ]; then
37     echo "  It is not enough, should be at least 4096"
38     MOUNT=$(mount | grep /mnt/huge)
39     while [ "${MOUNT}" != "" ]
40     do
41         sudo umount /mnt/huge
42         sleep 1
43         MOUNT=$(mount | grep /mnt/huge)
44     done
45
46     echo 2048 | sudo tee /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
47     echo 2048 | sudo tee /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
48
49     echo "  Mounting hugepages"
50     sudo mkdir -p /mnt/huge
51     sudo mount -t hugetlbfs nodev /mnt/huge/ || \
52         { echo "Failed to mount hugepages"; exit 1; }
53 fi
54
55 # Check and set the max map count
56 SYS_MAP=$(cat /proc/sys/vm/max_map_count)
57
58 if [ ${SYS_MAP} -lt 200000 ]; then
59     echo 200000 | sudo tee /proc/sys/vm/max_map_count
60 fi