Skip to content

Commit 46b6bc6

Browse files
authored
Change onvm-pktgen Submodule to Upstream Pktgen (#81)
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
1 parent b65db73 commit 46b6bc6

5 files changed

Lines changed: 160 additions & 6 deletions

File tree

.gitmodules

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
commit = 0da7f445df445630c794897347ee360d6fe6348b
66
[submodule "tools/Pktgen/pktgen-dpdk"]
77
path = tools/Pktgen/pktgen-dpdk
8-
url = ../../sdnfv/onvm-pktgen.git
9-
branch = onvm
8+
url = http://dpdk.org/git/apps/pktgen-dpdk
9+
branch = master
10+
commit = 4199555481cd08fe08e32986c94e59836ca1cd4f

tools/Pktgen/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ Script files are located in openNetVM-Scripts
9696
2.4 Run pktgen
9797
-------------
9898

99-
`$cd openNetVM-Scripts`
100-
101-
`$sudo bash run-pktgen.sh 1` or `$sudo bash run-pktgen.sh 2`
99+
```sh
100+
./openNetVM-Scripts/run-pktgen.sh 1
101+
```
102102

103103
If you got your result as below, then you are all set
104104
```
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
-- openNetVM
2+
-- https://github.com/sdnfv/openNetVM
3+
--
4+
-- BSD LICENSE
5+
--
6+
-- Copyright(c)
7+
-- 2015-2016 George Washington University
8+
-- 2015-2016 University of California Riverside
9+
-- All rights reserved.
10+
11+
-- Redistribution and use in source and binary forms, with or without
12+
-- modification, are permitted provided that the following conditions
13+
-- are met:
14+
15+
-- Redistributions of source code must retain the above copyright
16+
-- notice, this list of conditions and the following disclaimer.
17+
-- Redistributions in binary form must reproduce the above copyright
18+
-- notice, this list of conditions and the following disclaimer in
19+
-- the documentation and/or other materials provided with the
20+
-- distribution.
21+
-- The name of the author may not be used to endorse or promote
22+
-- products derived from this software without specific prior
23+
-- written permission.
24+
25+
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26+
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27+
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28+
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29+
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30+
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31+
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32+
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33+
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
37+
-- Change any of the settings below to configure Pktgen-DPDK
38+
39+
-- A list of the test script for Pktgen and Lua.
40+
-- Each command somewhat mirrors the pktgen command line versions.
41+
-- A couple of the arguments have be changed to be more like the others.
42+
43+
package.path = package.path ..";?.lua;test/?.lua;app/?.lua;"
44+
45+
require "Pktgen"
46+
47+
printf("Lua Version : %s\n", pktgen.info.Lua_Version);
48+
printf("Pktgen Version : %s\n", pktgen.info.Pktgen_Version);
49+
printf("Pktgen Copyright : %s\n", pktgen.info.Pktgen_Copyright);
50+
51+
prints("pktgen.info", pktgen.info);
52+
53+
printf("Port Count %d\n", pktgen.portCount());
54+
printf("Total port Count %d\n", pktgen.totalPorts());
55+
56+
57+
-- set up a mac address to set flow to
58+
--
59+
-- TO DO LIST:
60+
--
61+
-- Please update this part with the destination mac address, source and destination ip address you would like to sent packets to
62+
63+
pktgen.set_mac("0", "90:e2:ba:5e:73:6c");
64+
pktgen.set_ipaddr("0", "dst", "10.11.1.17");
65+
pktgen.set_ipaddr("0", "src", "10.11.1.16");
66+
67+
pktgen.set_proto("all", "udp");
68+
pktgen.set_type("all", "ipv4");
69+
70+
pktgen.set("all", "size", 64)
71+
pktgen.set("all", "burst", 32);
72+
pktgen.set("all", "sport", 1234);
73+
pktgen.set("all", "dport", 1234);
74+
pktgen.set("all", "count", 100000000);
75+
pktgen.set("all", "rate",100);
76+
77+
pktgen.vlan_id("all", "start", 1);
78+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/sh
2+
3+
# openNetVM
4+
# https://github.com/sdnfv/openNetVM
5+
#
6+
# BSD LICENSE
7+
#
8+
# Copyright(c)
9+
# 2015-2016 George Washington University
10+
# 2015-2016 University of California Riverside
11+
# 2010-2014 Intel Corporation.
12+
# All rights reserved.
13+
#
14+
# Redistribution and use in source and binary forms, with or without
15+
# modification, are permitted provided that the following conditions
16+
# are met:
17+
#
18+
# Redistributions of source code must retain the above copyright
19+
# notice, this list of conditions and the following disclaimer.
20+
# Redistributions in binary form must reproduce the above copyright
21+
# notice, this list of conditions and the following disclaimer in
22+
# the documentation and/or other materials provided with the
23+
# distribution.
24+
# The name of the author may not be used to endorse or promote
25+
# products derived from this software without specific prior
26+
# written permission.
27+
#
28+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39+
40+
# These are the interfaces that you do not want to use for Pktgen-DPDK
41+
BLACK_LIST="-b 0000:05:00.0 -b 0000:05:00.1"
42+
43+
SCRIPT=$(readlink -f "$0")
44+
SCRIPTPATH=$(dirname "$SCRIPT")
45+
46+
# Path for pktgen
47+
PKTGEN_HOME="$SCRIPTPATH/../pktgen-dpdk/"
48+
49+
# Path for pktgen binary
50+
PKTGEN_BUILD="./app/x86_64-native-linuxapp-gcc/pktgen"
51+
52+
# Path for pktgen config
53+
PKTGEN_CONFIG="$SCRIPTPATH/pktgen-config.lua"
54+
55+
if [ "$#" -lt 1 ] ; then
56+
echo "Pass an argument for port count"
57+
echo "Example usage: sudo bash run-pktgen.sh 1"
58+
exit 0
59+
fi
60+
61+
PORT_NUM=$1
62+
63+
echo "Starting pktgen"
64+
65+
# Pktgen has to be started from pktgen-dpdk/
66+
if [ $PORT_NUM -eq "2" ]; then
67+
(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)
68+
elif [ $PORT_NUM -eq "1" ]; then
69+
(cd $PKTGEN_HOME && sudo $PKTGEN_BUILD -c 0xff -n 3 $BLACK_LIST -- -p 0x1 $PORT_MASK -P -m "[1:2].0" -f $PKTGEN_CONFIG)
70+
else
71+
echo "Helper script only supports 1 or 2 ports"
72+
exit 0
73+
fi
74+
75+
echo "Pktgen done"

tools/Pktgen/pktgen-dpdk

Submodule pktgen-dpdk updated from 48067fb to 4199555

0 commit comments

Comments
 (0)