Chetan Gaonker | 2d6473f | 2017-07-11 20:20:42 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | #Get system info |
| 4 | name=`uname -n` |
| 5 | |
| 6 | #Export env variables to inherit |
| 7 | export MY_DIR=$(pwd) |
| 8 | export DPDK_TAG=v16.11 |
| 9 | export OVS_TAG=branch-2.7 |
| 10 | |
| 11 | #Clone repo and build DPDK |
| 12 | git clone http://dpdk.org/git/dpdk -b $DPDK_TAG $MY_DIR/dpdk |
| 13 | cd $MY_DIR/dpdk |
| 14 | export RTE_SDK=$(pwd) |
| 15 | export RTE_TARGET=x86_64-native-linuxapp-gcc |
| 16 | make -j4 install T=$RTE_TARGET |
| 17 | |
| 18 | #Set for kernel mod |
| 19 | sudo apt-get install libpcap-dev |
| 20 | sudo apt-get install linux-headers-`uname -r` |
| 21 | |
| 22 | #Hugepage allocation |
| 23 | sudo -E sysctl -w vm.nr_hugepages=1024 |
| 24 | sudo -E umount /dev/hugepages |
| 25 | sudo -E mkdir -p /dev/hugepages |
| 26 | sudo -E mount -t hugetlbfs -o pagesize=2048k none /dev/hugepages |
| 27 | |
| 28 | #Traffic generator powered by DPDK |
| 29 | wget http://fast.dpdk.org/rel/dpdk-16.11.1.tar.xz |
| 30 | wget http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-dpdk-pktgen-3.1.2.tar.gz |
| 31 | tar -xf dpdk-16.11.1.tar.xz |
| 32 | tar -xf pktgen-dpdk-pktgen-3.1.2.tar.gz |
| 33 | |
| 34 | #Export env vars and make |
| 35 | export RTE_SDK=/home/ubuntu/dpdk-stable-16.11.1 |
| 36 | export PKTGEN=/home/ubuntu/pktgen-dpdk-pktgen-3.1.2 |
| 37 | export PKTGEN=/home/ubuntu/pktgen-dpdk-pktgen-3.1.2 |
| 38 | export RTE_TARGET=x86_64-native-linuxapp-gcc |
| 39 | cd $RTE_SDK |
| 40 | make install T=x86_64-native-linuxapp-gcc |
| 41 | cd $PKTGEN |
| 42 | make |
| 43 | |
| 44 | #Loads the UIO support module |
| 45 | if lsmod | grep "uio" &> /dev/null ; then |
| 46 | echo "uio module is loaded" |
| 47 | else |
| 48 | modprobe uio |
| 49 | fi |
| 50 | |
| 51 | #Loading the the igb-uio.ko module |
| 52 | if lsmod | grep "igb_uio" &> /dev/null ; then |
| 53 | echo "igb_uio module is loaded" |
| 54 | else |
| 55 | insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko |
| 56 | fi |
| 57 | |
| 58 | iface=`python $RTE_SDK/tools/dpdk-devbind.py -s | awk '/ens4/ {print $1}'` |
| 59 | python $RTE_SDK/tools/dpdk-devbind.py -b igb_uio $iface |
| 60 | |
| 61 | # RUN Pktgen |
| 62 | # -c COREMASK (0x3ff) (1111111111) 10 cores used with first core used for pktgen, |
| 63 | # -n Memory channels, -socket memory for each cpu, -m for memory allocation |
| 64 | # -P Promiscuous mode for all ports |
| 65 | ./app/x86_64-native-linuxapp-gcc/pktgen -c 0x3ff -n 2 --proc-type auto --socket-mem 4096 -- -T -P -m "[2-5:6-9].0" |