Skip to content

Commit

Permalink
Change onvm-pktgen Submodule to Upstream Pktgen (#81)
Browse files Browse the repository at this point in the history
The onvm-pktgen submodule was only adding an example lua config and a simplified `run-pktgen.sh` script. As there were no changes to actual pktgen code we have moved those scripts into `/tools/Pktgen/openNetVM-Scripts`. Because of this we no longer need to maintain our own `onvm-pktgen` repo, instead we can use upstream pktgen.

Commit Log:

* Changing pktgen submodule

* Fix run_pktgen.sh script

* Readme, script docs updates

* Fix pointer ot master branch
  • Loading branch information
koolzz authored Mar 13, 2019
1 parent b65db73 commit 46b6bc6
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
commit = 0da7f445df445630c794897347ee360d6fe6348b
[submodule "tools/Pktgen/pktgen-dpdk"]
path = tools/Pktgen/pktgen-dpdk
url = ../../sdnfv/onvm-pktgen.git
branch = onvm
url = http://dpdk.org/git/apps/pktgen-dpdk
branch = master
commit = 4199555481cd08fe08e32986c94e59836ca1cd4f
6 changes: 3 additions & 3 deletions tools/Pktgen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ Script files are located in openNetVM-Scripts
2.4 Run pktgen
-------------

`$cd openNetVM-Scripts`

`$sudo bash run-pktgen.sh 1` or `$sudo bash run-pktgen.sh 2`
```sh
./openNetVM-Scripts/run-pktgen.sh 1
```

If you got your result as below, then you are all set
```
Expand Down
78 changes: 78 additions & 0 deletions tools/Pktgen/openNetVM-Scripts/pktgen-config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
-- openNetVM
-- https://github.com/sdnfv/openNetVM
--
-- BSD LICENSE
--
-- Copyright(c)
-- 2015-2016 George Washington University
-- 2015-2016 University of California Riverside
-- All rights reserved.

-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions
-- are met:

-- Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in
-- the documentation and/or other materials provided with the
-- distribution.
-- The name of the author may not be used to endorse or promote
-- products derived from this software without specific prior
-- written permission.

-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-- Change any of the settings below to configure Pktgen-DPDK

-- A list of the test script for Pktgen and Lua.
-- Each command somewhat mirrors the pktgen command line versions.
-- A couple of the arguments have be changed to be more like the others.

package.path = package.path ..";?.lua;test/?.lua;app/?.lua;"

require "Pktgen"

printf("Lua Version : %s\n", pktgen.info.Lua_Version);
printf("Pktgen Version : %s\n", pktgen.info.Pktgen_Version);
printf("Pktgen Copyright : %s\n", pktgen.info.Pktgen_Copyright);

prints("pktgen.info", pktgen.info);

printf("Port Count %d\n", pktgen.portCount());
printf("Total port Count %d\n", pktgen.totalPorts());


-- set up a mac address to set flow to
--
-- TO DO LIST:
--
-- Please update this part with the destination mac address, source and destination ip address you would like to sent packets to

pktgen.set_mac("0", "90:e2:ba:5e:73:6c");
pktgen.set_ipaddr("0", "dst", "10.11.1.17");
pktgen.set_ipaddr("0", "src", "10.11.1.16");

pktgen.set_proto("all", "udp");
pktgen.set_type("all", "ipv4");

pktgen.set("all", "size", 64)
pktgen.set("all", "burst", 32);
pktgen.set("all", "sport", 1234);
pktgen.set("all", "dport", 1234);
pktgen.set("all", "count", 100000000);
pktgen.set("all", "rate",100);

pktgen.vlan_id("all", "start", 1);

75 changes: 75 additions & 0 deletions tools/Pktgen/openNetVM-Scripts/run-pktgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/sh

# openNetVM
# https://github.com/sdnfv/openNetVM
#
# BSD LICENSE
#
# Copyright(c)
# 2015-2016 George Washington University
# 2015-2016 University of California Riverside
# 2010-2014 Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# The name of the author may not be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# These are the interfaces that you do not want to use for Pktgen-DPDK
BLACK_LIST="-b 0000:05:00.0 -b 0000:05:00.1"

SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")

# Path for pktgen
PKTGEN_HOME="$SCRIPTPATH/../pktgen-dpdk/"

# Path for pktgen binary
PKTGEN_BUILD="./app/x86_64-native-linuxapp-gcc/pktgen"

# Path for pktgen config
PKTGEN_CONFIG="$SCRIPTPATH/pktgen-config.lua"

if [ "$#" -lt 1 ] ; then
echo "Pass an argument for port count"
echo "Example usage: sudo bash run-pktgen.sh 1"
exit 0
fi

PORT_NUM=$1

echo "Starting pktgen"

# Pktgen has to be started from pktgen-dpdk/
if [ $PORT_NUM -eq "2" ]; then
(cd $PKTGEN_HOME && sudo $PKTGEN_BUILD -c 0xff -n 3 $BLACK_LIST -- -p 0x3 $PORT_MASK -P -m "[1:2].0, [3:4].1" -f $PKTGEN_CONFIG)
elif [ $PORT_NUM -eq "1" ]; then
(cd $PKTGEN_HOME && sudo $PKTGEN_BUILD -c 0xff -n 3 $BLACK_LIST -- -p 0x1 $PORT_MASK -P -m "[1:2].0" -f $PKTGEN_CONFIG)
else
echo "Helper script only supports 1 or 2 ports"
exit 0
fi

echo "Pktgen done"
2 changes: 1 addition & 1 deletion tools/Pktgen/pktgen-dpdk
Submodule pktgen-dpdk updated from 48067f to 419955

0 comments on commit 46b6bc6

Please sign in to comment.