Modify the DPDK compile configure for the 40G NIC.
[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 sudo sed -i 's/^CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n/CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=y/g' ./config/common_base
22 make install T=x86_64-native-linuxapp-gcc -j || \
23     { echo "Failed to compile $DPDK_VERSION"; exit 1; }
24 cd ${PWDDIR}
25
26 # Compile the l3fwd
27 export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/
28 export RTE_TARGET=x86_64-native-linuxapp-gcc
29 cd ${RTE_SDK}/examples/l3fwd
30 make -j || \
31     { echo "Failed to compile l3fwd"; exit 1; }
32 cd ${PWDDIR}
33
34 # Check and setup the hugepages
35 SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages)
36 echo "  SYS_HUGEPAGE = ${SYS_HUGEPAGE}"
37 if [ ${SYS_HUGEPAGE} -lt 4096 ]; then
38     echo "  It is not enough, should be at least 4096"
39     MOUNT=$(mount | grep /mnt/huge)
40     while [ "${MOUNT}" != "" ]
41     do
42         sudo umount /mnt/huge
43         sleep 1
44         MOUNT=$(mount | grep /mnt/huge)
45     done
46
47     echo 2048 | sudo tee /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
48     echo 2048 | sudo tee /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
49
50     echo "  Mounting hugepages"
51     sudo mkdir -p /mnt/huge
52     sudo mount -t hugetlbfs nodev /mnt/huge/ || \
53         { echo "Failed to mount hugepages"; exit 1; }
54 fi
55
56 # Check and set the max map count
57 SYS_MAP=$(cat /proc/sys/vm/max_map_count)
58
59 if [ ${SYS_MAP} -lt 200000 ]; then
60     echo 200000 | sudo tee /proc/sys/vm/max_map_count
61 fi

©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.