blob: a9ca83d796196a138545a3db7e18294f393059bd [file] [log] [blame]
A R Karthick1fa66542017-08-10 14:15:29 -07001#!/bin/bash
Matteo Scandolo48d3d2d2017-08-08 13:05:27 -07002# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Chetan Gaonker2d6473f2017-07-11 20:20:42 +000017
18#Get system info
19name=`uname -n`
20
21#Export env variables to inherit
22export MY_DIR=$(pwd)
23export DPDK_TAG=v16.11
24export OVS_TAG=branch-2.7
25
26#Clone repo and build DPDK
27git clone http://dpdk.org/git/dpdk -b $DPDK_TAG $MY_DIR/dpdk
28cd $MY_DIR/dpdk
29export RTE_SDK=$(pwd)
30export RTE_TARGET=x86_64-native-linuxapp-gcc
31make -j4 install T=$RTE_TARGET
32
33#Set for kernel mod
34sudo apt-get install libpcap-dev
35sudo apt-get install linux-headers-`uname -r`
36
37#Hugepage allocation
38sudo -E sysctl -w vm.nr_hugepages=1024
39sudo -E umount /dev/hugepages
40sudo -E mkdir -p /dev/hugepages
41sudo -E mount -t hugetlbfs -o pagesize=2048k none /dev/hugepages
42
43#Traffic generator powered by DPDK
44wget http://fast.dpdk.org/rel/dpdk-16.11.1.tar.xz
45wget http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-dpdk-pktgen-3.1.2.tar.gz
46tar -xf dpdk-16.11.1.tar.xz
47tar -xf pktgen-dpdk-pktgen-3.1.2.tar.gz
48
49#Export env vars and make
50export RTE_SDK=/home/ubuntu/dpdk-stable-16.11.1
51export PKTGEN=/home/ubuntu/pktgen-dpdk-pktgen-3.1.2
52export PKTGEN=/home/ubuntu/pktgen-dpdk-pktgen-3.1.2
53export RTE_TARGET=x86_64-native-linuxapp-gcc
54cd $RTE_SDK
55make install T=x86_64-native-linuxapp-gcc
56cd $PKTGEN
57make
58
59#Loads the UIO support module
60if lsmod | grep "uio" &> /dev/null ; then
61echo "uio module is loaded"
62else
63modprobe uio
64fi
65
66#Loading the the igb-uio.ko module
67if lsmod | grep "igb_uio" &> /dev/null ; then
68echo "igb_uio module is loaded"
69else
70insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
71fi
72
73iface=`python $RTE_SDK/tools/dpdk-devbind.py -s | awk '/ens4/ {print $1}'`
74python $RTE_SDK/tools/dpdk-devbind.py -b igb_uio $iface
75
76# RUN Pktgen
77# -c COREMASK (0x3ff) (1111111111) 10 cores used with first core used for pktgen,
78# -n Memory channels, -socket memory for each cpu, -m for memory allocation
79# -P Promiscuous mode for all ports
80./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"