summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Wiles <keith.wiles@intel.com>2019-06-27 22:45:31 -0500
committerKeith Wiles <keith.wiles@intel.com>2019-06-27 22:45:31 -0500
commit900e54986f3fa3c6f0981bd13cb75e57d5161cd7 (patch)
tree26d0126eb46fd0c007da0d5a03db2bb3e41dbe88
parentae5a88bf89e421ea84d680a7e5613af959243a4b (diff)
parentd0c329cc4e5ef70fc663885bac9e2e7efa2455b1 (diff)
downloadpktgen-dpdk-master.zip
pktgen-dpdk-master.tar.gz
pktgen-dpdk-master.tar.xz
Merge branch 'master' of ssh://linksys/~rkwiles/projects/Repos/pktgenHEADmaster
-rw-r--r--.gitignore1
-rw-r--r--INSTALL.md10
-rw-r--r--Makefile4
-rw-r--r--README.md37
-rw-r--r--app/Makefile4
-rw-r--r--app/cli-functions.c195
-rw-r--r--app/lpktgenlib.c207
-rw-r--r--app/meson.build22
-rw-r--r--app/pktgen-arp.c24
-rw-r--r--app/pktgen-capture.c2
-rw-r--r--app/pktgen-cfg.c2
-rw-r--r--app/pktgen-cmds.c360
-rw-r--r--app/pktgen-cmds.h24
-rw-r--r--app/pktgen-cpu.c2
-rw-r--r--app/pktgen-display.c2
-rw-r--r--app/pktgen-dump.c4
-rw-r--r--app/pktgen-ether.c28
-rw-r--r--app/pktgen-ether.h2
-rw-r--r--app/pktgen-gre.c16
-rw-r--r--app/pktgen-gtpu.c8
-rw-r--r--app/pktgen-ipv4.c30
-rw-r--r--app/pktgen-ipv6.c32
-rw-r--r--app/pktgen-latency.c10
-rw-r--r--app/pktgen-log.c2
-rw-r--r--app/pktgen-log.h2
-rw-r--r--app/pktgen-main.c7
-rw-r--r--app/pktgen-pcap.c18
-rw-r--r--app/pktgen-port-cfg.c99
-rw-r--r--app/pktgen-port-cfg.h8
-rw-r--r--app/pktgen-random.c2
-rw-r--r--app/pktgen-range.c104
-rw-r--r--app/pktgen-seq.c8
-rw-r--r--app/pktgen-seq.h4
-rw-r--r--app/pktgen-stats.c29
-rw-r--r--app/pktgen-tcp.c20
-rw-r--r--app/pktgen-udp.c16
-rw-r--r--app/pktgen-vlan.c18
-rw-r--r--app/pktgen.c147
-rw-r--r--app/pktgen.h14
-rw-r--r--cfg/bond.cfg12
-rw-r--r--cfg/default.cfg8
-rw-r--r--changelog.txt3
-rw-r--r--dnet-echo2
-rw-r--r--docs/source/getting_started.rst22
-rw-r--r--docs/source/usage_pktgen.rst2
-rw-r--r--gui/pktgen-gui-streams.c24
-rw-r--r--gui/pktgen-gui.c8
-rw-r--r--lib/cli/Makefile4
-rw-r--r--lib/cli/cli.c2
-rw-r--r--lib/cli/cli.rst18
-rw-r--r--lib/cli/cli_auto_complete.c2
-rw-r--r--lib/cli/cli_cmap.c23
-rw-r--r--lib/cli/cli_cmds.c3
-rw-r--r--lib/cli/cli_input.c2
-rw-r--r--lib/cli/cli_lib.rst18
-rw-r--r--lib/cli/cli_map.c2
-rw-r--r--lib/cli/cli_search.c2
-rw-r--r--lib/cli/cli_vt100.c2
-rw-r--r--lib/cli/meson.build7
-rw-r--r--lib/common/Makefile6
-rw-r--r--lib/common/_delay.h51
-rw-r--r--lib/common/_pcap.c16
-rw-r--r--lib/common/_strings.c (renamed from lib/utils/rte_strings.c)2
-rw-r--r--lib/common/_strings.h (renamed from lib/utils/rte_strings.h)29
-rw-r--r--lib/common/meson.build30
-rw-r--r--lib/common/pg_compat.h84
-rw-r--r--lib/common/pg_ether.h18
-rw-r--r--lib/common/pg_inet.h43
-rw-r--r--lib/lua/Makefile15
-rw-r--r--lib/lua/lua_config.c (renamed from lib/lua/rte_lua.c)8
-rw-r--r--lib/lua/lua_config.h (renamed from lib/lua/rte_lua.h)6
-rw-r--r--lib/lua/lua_dapi.c (renamed from lib/lua/rte_lua_dapi.c)16
-rw-r--r--lib/lua/lua_dapi.h (renamed from lib/lua/rte_lua_dapi.h)0
-rw-r--r--lib/lua/lua_dpdk.c (renamed from lib/lua/rte_lua_dpdk.c)45
-rw-r--r--lib/lua/lua_dpdk.h (renamed from lib/lua/rte_lua_dpdk.h)10
-rw-r--r--lib/lua/lua_pktmbuf.c (renamed from lib/lua/rte_lua_pktmbuf.c)16
-rw-r--r--lib/lua/lua_pktmbuf.h (renamed from lib/lua/rte_lua_pktmbuf.h)0
-rw-r--r--lib/lua/lua_socket.c (renamed from lib/lua/rte_lua_socket.c)8
-rw-r--r--lib/lua/lua_socket.h (renamed from lib/lua/rte_lua_socket.h)0
-rw-r--r--lib/lua/lua_stdio.c (renamed from lib/lua/rte_lua_stdio.c)4
-rw-r--r--lib/lua/lua_stdio.h (renamed from lib/lua/rte_lua_stdio.h)0
-rw-r--r--lib/lua/lua_utils.c (renamed from lib/lua/rte_lua_utils.c)8
-rw-r--r--lib/lua/lua_utils.h (renamed from lib/lua/rte_lua_utils.h)4
-rw-r--r--lib/lua/lua_vec.c (renamed from lib/lua/rte_lua_vec.c)44
-rw-r--r--lib/lua/lua_vec.h (renamed from lib/lua/rte_lua_vec.h)2
-rw-r--r--lib/lua/meson.build41
-rw-r--r--lib/meson.build32
-rw-r--r--lib/plugin/meson.build4
-rw-r--r--lib/utils/Makefile14
-rw-r--r--lib/utils/_atoip.c (renamed from lib/utils/rte_atoip.c)6
-rw-r--r--lib/utils/_atoip.h (renamed from lib/utils/rte_atoip.h)8
-rw-r--r--lib/utils/heap.c (renamed from lib/utils/rte_heap.c)64
-rw-r--r--lib/utils/heap.h (renamed from lib/utils/rte_heap.h)26
-rw-r--r--lib/utils/link.c (renamed from lib/utils/rte_link.c)23
-rw-r--r--lib/utils/link.h (renamed from lib/utils/rte_link.h)18
-rw-r--r--lib/utils/meson.build26
-rw-r--r--lib/utils/portlist.c (renamed from lib/utils/rte_portlist.c)12
-rw-r--r--lib/utils/portlist.h (renamed from lib/utils/rte_portlist.h)17
-rw-r--r--lib/utils/utils_version.map6
-rw-r--r--lib/vec/Makefile4
-rw-r--r--lib/vec/meson.build7
-rw-r--r--lib/vec/vec.c (renamed from lib/vec/rte_vec.c)34
-rw-r--r--lib/vec/vec.h (renamed from lib/vec/rte_vec.h)210
-rw-r--r--lib/vec/vec_version.map12
-rw-r--r--meson.build24
-rw-r--r--meson_options.txt4
-rwxr-xr-xmk_meson36
-rw-r--r--test/test_save.lua2
-rwxr-xr-xtools/pktgen-master.sh5
-rwxr-xr-xtools/pktgen-run.sh4
-rwxr-xr-xtools/pktgen-slave.sh5
-rwxr-xr-xtools/run.py13
112 files changed, 1726 insertions, 1086 deletions
diff --git a/.gitignore b/.gitignore
index b421c3c..9218d49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,4 +15,5 @@ node_modules
.vscode
gulpfile.js
x86_64-native-linuxapp-gcc
+x86_64-native-linux-gcc
lib/lua/build
diff --git a/INSTALL.md b/INSTALL.md
index 9e5ec9c..dbeda66 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -300,7 +300,7 @@ the environment.
Before you run the script you will need to run:
# export RTE_SDK=<DPDKinstallDir>
- # export RTE_TARGET=x86_64-native-linuxapp-gcc
+ # export RTE_TARGET=x86_64-native-linux-gcc
Make sure you run the setup script as root via `./tools/setup.sh`. The setup
script is a bash script and tries to setup the system correctly, but you may have to
@@ -320,18 +320,18 @@ directory. Your SDK directory maybe named differently, but should point to the D
SDK directory.
# export RTE_SDK=<DPDKinstallDir>
- # export RTE_TARGET=x86_64-native-linuxapp-gcc
+ # export RTE_TARGET=x86_64-native-linux-gcc
or use clang if you have it installed
- # export RTE_TARGET=x86_64-native-linuxapp-clang
+ # export RTE_TARGET=x86_64-native-linux-clang
Create the DPDK build tree if you haven't already:
# cd $RTE_SDK
- # make install T=x86_64-native-linuxapp-gcc -j
+ # make install T=x86_64-native-linux-gcc -j
-The above command will create the x86_64-native-linuxapp-gcc directory in the
+The above command will create the x86_64-native-linux-gcc directory in the
top level of the current-dkdp directory. The above command will build the basic
DPDK libraries and build tree.
diff --git a/Makefile b/Makefile
index b359069..81acbcf 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ $(error "Please define RTE_SDK environment variable")
endif
# Default target, can be overriden by command line or environment
-RTE_TARGET ?= x86_64-native-linuxapp-gcc
+RTE_TARGET ?= x86_64-native-linux-gcc
include $(RTE_SDK)/mk/rte.vars.mk
@@ -40,7 +40,7 @@ realclean:
@if [ -n "$(clean_objs)" ]; then \
rm -fr $(clean_objs); \
fi
- rm -fr app/build
+ @rm -fr app/build
docs:
@make -C docs html
diff --git a/README.md b/README.md
index 02c24f5..3d3a161 100644
--- a/README.md
+++ b/README.md
@@ -42,13 +42,17 @@ SPDX-License-Identifier: BSD-3-Clause
Pktgen: Created 2010-2018 by Keith Wiles @ Intel.com
---
-
+Note: In DPKD 19.08-rc0 a large number of defines and function names were
+ changed. In Pktgen 3.7.0 I added a pg_compat.h header to help
+ compatibility issues with these name changes. This means versions
+ 3.6.6 and below will have trouble builging with DPDK starting with
+ 19.08-rc0 or just after the 19.05 release.
*** Pktgen command line directory format ***
``
--- Pktgen Ver: 3.2.0 (DPDK 17.05.0-rc0) Powered by DPDK ---------------
+-- Pktgen Ver: 3.7.0 (DPDK 19.08.0-rc0) Powered by DPDK ---------------
@@ -176,7 +180,7 @@ fi
** Note: As of DPDK 18.05 using -m or --socket-mem is not required as memory is now
dynamically allocated.
-The pktgen program follows the same format as a standard DPDK linuxapp, meaning
+The pktgen program follows the same format as a standard DPDK linux, meaning
the first set of arguments '-l 0-4' are the standard DPDK arguments. This option
defines the number of logical cores to be used by pktgen. The 1f states 5 lcores
are used and the '3c' is just a bit array for each lcore to be used. The '-P' enables
@@ -253,14 +257,14 @@ Here is an example of the default.cfg file:
'proc': 'auto',
'log': '7',
'prefix': 'pg',
-
+
'blacklist': (
#'81:00.0', '81:00.1', '81:00.2', '81:00.3',
#'83:00.0', '83:00.1', '83:00.2', '83:00.3',
'81:00.2', '81:00.3',
'83:00.2', '83:00.3'
),
-
+
'opts': (
'-T',
'-P',
@@ -280,11 +284,11 @@ Here is an example of the default.cfg file:
Usage: ./app/pktgen -l CORELIST [-n NUM] [-m NB] [-r NUM] [-b <domain:bus:devid.func>][--proc-type primary|secondary|auto]
Copyright (c) <2010-2019>, Intel Corporation. All rights reserved. Powered by DPDK
-./app/app/x86_64-dnet-linuxapp-gcc/pktgen: invalid option -- 'x'
+./app/app/x86_64-dnet-linux-gcc/pktgen: invalid option -- 'x'
EAL: Detected 72 lcore(s)
-./app/app/x86_64-dnet-linuxapp-gcc/pktgen: invalid option -- 'x'
+./app/app/x86_64-dnet-linux-gcc/pktgen: invalid option -- 'x'
-Usage: ./app/app/x86_64-dnet-linuxapp-gcc/pktgen [options]
+Usage: ./app/app/x86_64-dnet-linux-gcc/pktgen [options]
EAL common options:
-c COREMASK Hexadecimal bitmask of cores to run on
@@ -342,7 +346,7 @@ EAL Linux options:
===== Application Usage =====
-Usage: ./app/app/x86_64-dnet-linuxapp-gcc/pktgen [EAL options] -- [-h] [-v] [-P] [-G] [-T] [-f cmd_file] [-l log_file] [-s P:PCAP_file[,PCap_file]] [-m <string>]
+Usage: ./app/app/x86_64-dnet-linux-gcc/pktgen [EAL options] -- [-h] [-v] [-P] [-G] [-T] [-f cmd_file] [-l log_file] [-s P:PCAP_file[,PCap_file]] [-m <string>]
-s P:file1,file2 PCAP packet stream file per queue, 'P' is the port number
-f filename Command file (.pkt) to execute or a Lua script (.lua) file
-l filename Write log to filename
@@ -405,13 +409,13 @@ name=`uname -n`
if [ -z ${RTE_SDK} ] ; then
echo "*** RTE_SDK is not set, did you forget to do 'sudo -E ./tools/setup.sh'"
export RTE_SDK=/work/home/rkwiles/projects/intel/dpdk
- export RTE_TARGET=x86_64-native-linuxapp-clang
+ export RTE_TARGET=x86_64-native-linux-clang
fi
sdk=${RTE_SDK}
if [ -z ${RTE_TARGET} ]; then
echo "*** RTE_TARGET is not set, did you forget to do 'sudo -E ./tools/setup.sh'"
-target=x86_64-pktgen-linuxapp-gcc
+target=x86_64-pktgen-linux-gcc
else
target=${RTE_TARGET}
fi
@@ -456,13 +460,13 @@ if [ -z ${RTE_SDK} ] ; then
echo "*** RTE_SDK is not set, did you forget to do 'sudo -E ./tools/setup.sh'"
echo "Using "${RTE_SDK}
export RTE_SDK=/work/home/rkwiles/projects/intel/dpdk
- export RTE_TARGET=x86_64-native-linuxapp-clang
+ export RTE_TARGET=x86_64-native-linux-clang
fi
sdk=${RTE_SDK}
if [ -z ${RTE_TARGET} ]; then
echo "*** RTE_TARGET is not set, did you forget to do 'sudo -E ./tools/setup.sh'"
- target=x86_64-pktgen-linuxapp-gcc
+ target=x86_64-pktgen-linux-gcc
else
target=${RTE_TARGET}
fi
@@ -526,9 +530,9 @@ Running the run.sh script produces output as follows, but maybe different on you
system configuration.
``
rkwiles@broadwell (dev):~/.../intel/pktgen$ ./tools/run.py default
->>> sdk '/work/home/rkwiles/projects/intel/dpdk.org', target 'x86_64-native-linuxapp-gcc'
- Trying ./app/x86_64-native-linuxapp-gcc/pktgen
-sudo -E ./app/x86_64-native-linuxapp-gcc/pktgen -l 14,15-22 -n 4 --proc-type auto --log-level 7 --file-prefix pg -b 81:00.2 -b 81:00.3 -b 85:00.2 -b 85:00.3 -b 83:00.0 -- -T -P --crc-strip -m [15:16].0 -m [17:18].1 -m [19:20].2 -m [21:22].3 -f themes/black-yellow.theme
+>>> sdk '/work/home/rkwiles/projects/intel/dpdk.org', target 'x86_64-native-linux-gcc'
+ Trying ./app/x86_64-native-linux-gcc/pktgen
+sudo -E ./app/x86_64-native-linux-gcc/pktgen -l 14,15-22 -n 4 --proc-type auto --log-level 7 --file-prefix pg -b 81:00.2 -b 81:00.3 -b 85:00.2 -b 85:00.3 -b 83:00.0 -- -T -P --crc-strip -m [15:16].0 -m [17:18].1 -m [19:20].2 -m [21:22].3 -f themes/black-yellow.theme
Copyright (c) <2010-2019>, Intel Corporation. All rights reserved. Powered by DPDK
EAL: Detected 56 lcore(s)
@@ -792,6 +796,7 @@ theme save <filename> - Save the current color theme to a file
G - Perform GRE with Ethernet payload
C - Capture received packets
R - Random bitfield(s) are applied
+ B- Bonding enabled for LACP 802.3ad
Notes: <state> - Use enable|disable or on|off to set the state.
<portlist> - a list of ports (no spaces) as 2,4,6-9,12 or 3-5,8 or 5 or the word 'all'
Color best seen on a black background for now
diff --git a/app/Makefile b/app/Makefile
index 5c70f63..cee7de2 100644
--- a/app/Makefile
+++ b/app/Makefile
@@ -11,7 +11,7 @@ $(error "Please define RTE_SDK environment variable")
endif
# Default target, can be overriden by command line or environment
-RTE_TARGET ?= x86_64-native-linuxapp-gcc
+RTE_TARGET ?= x86_64-native-linux-gcc
include $(RTE_SDK)/mk/rte.vars.mk
@@ -156,7 +156,7 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
endif
CFLAGS += $(__CFLAGS)
-LDFLAGS += $(__LDFLAGS) $(__LIBS) -lpcap -lm
+LDFLAGS += $(__LIBS) --start-group $(__LDFLAGS) --end-group -lpcap -lm
#$(info __CLFAGS = $(__CFLAGS))
#$(info __LIBS = $(__LIBS))
diff --git a/app/cli-functions.c b/app/cli-functions.c
index 21e5231..fb23ba5 100644
--- a/app/cli-functions.c
+++ b/app/cli-functions.c
@@ -20,12 +20,12 @@
#include <rte_devargs.h>
#include <rte_ether.h>
#include <rte_string_fns.h>
-#include <rte_strings.h>
+#include <_strings.h>
#include <rte_hexdump.h>
#include <rte_cycles.h>
#include <rte_malloc.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen.h"
@@ -41,6 +41,10 @@
#include "pktgen-random.h"
#include "pktgen-log.h"
#include "pg_ether.h"
+#ifdef RTE_LIBRTE_PMD_BOND
+#include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
+#endif
static inline uint16_t
valid_pkt_size(port_info_t *info, char *val)
@@ -48,20 +52,30 @@ valid_pkt_size(port_info_t *info, char *val)
uint16_t pkt_size;
if (!val)
- return (MIN_PKT_SIZE + ETHER_CRC_LEN);
+ return (MIN_PKT_SIZE + PG_ETHER_CRC_LEN);
pkt_size = atoi(val);
if (!(rte_atomic32_read(&info->port_flags) & SEND_SHORT_PACKETS)) {
- if (pkt_size < (MIN_PKT_SIZE + ETHER_CRC_LEN))
- pkt_size = (MIN_PKT_SIZE + ETHER_CRC_LEN);
+ if (pkt_size < (MIN_PKT_SIZE + PG_ETHER_CRC_LEN))
+ pkt_size = (MIN_PKT_SIZE + PG_ETHER_CRC_LEN);
}
- if (pkt_size > (MAX_PKT_SIZE + ETHER_CRC_LEN))
- pkt_size = MAX_PKT_SIZE + ETHER_CRC_LEN;
+ if (pkt_size > (MAX_PKT_SIZE + PG_ETHER_CRC_LEN))
+ pkt_size = MAX_PKT_SIZE + PG_ETHER_CRC_LEN;
return pkt_size;
}
+static inline uint16_t
+valid_gtpu_teid(port_info_t *info __rte_unused, char *val)
+{
+ uint16_t gtpu_teid;
+
+ gtpu_teid = atoi(val);
+
+ return gtpu_teid;
+}
+
/**********************************************************/
static const char *title_help[] = {
" *** Pktgen Help information ***",
@@ -91,6 +105,7 @@ static const char *status_help[] = {
" G - Perform GRE with Ethernet payload",
" C - Capture received packets",
" R - Random bitfield(s) are applied",
+ " B- Bonding enabled LACP 802.3ad",
"Notes: <state> - Use enable|disable or on|off to set the state.",
" <portlist> - a list of ports (no spaces) as 2,4,6-9,12 or 3-5,8 or 5 or the word 'all'",
" Color best seen on a black background for now",
@@ -120,6 +135,8 @@ static struct cli_map range_map[] = {
{ 80, "range %P mpls entry %h" },
{ 85, "range %P qinq index %d %d" },
{ 90, "range %P gre key %d" },
+ { 100, "range %P gtpu "SMMI" %d" },
+ { 101, "range %P gtpu %d %d %d %d" },
{ 160, "range %P cos "SMMI" %d" },
{ 161, "range %P cos %d %d %d %d" },
{ 170, "range %P tos "SMMI" %d" },
@@ -174,7 +191,7 @@ range_cmd(int argc, char **argv)
if (!m)
return cli_cmd_error("Range command error", "Range", argc, argv);
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
what = argv[4];
val = (const char*)argv[5];
@@ -208,7 +225,7 @@ range_cmd(int argc, char **argv)
p = strchr(argv[4], '/');
if (p)
*p = '\0';
- rte_atoip(val, PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(val, PG_IPADDR_V4, &ip, sizeof(ip));
foreach_port(portlist,
range_set_dst_ip(info, what, &ip));
break;
@@ -217,31 +234,31 @@ range_cmd(int argc, char **argv)
p = strchr(argv[4], '/');
if (p)
*p = '\0';
- rte_atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));
foreach_port(portlist,
range_set_src_ip(info, what, &ip));
break;
case 32:
foreach_port(portlist,
- rte_atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
range_set_dst_ip(info, (char *)(uintptr_t)"start", &ip);
- rte_atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));
range_set_dst_ip(info, (char *)(uintptr_t)"min", &ip);
- rte_atoip(argv[6], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[6], PG_IPADDR_V4, &ip, sizeof(ip));
range_set_dst_ip(info, (char *)(uintptr_t)"max", &ip);
- rte_atoip(argv[7], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[7], PG_IPADDR_V4, &ip, sizeof(ip));
range_set_dst_ip(info, (char *)(uintptr_t)"inc", &ip)
);
break;
case 33:
foreach_port(portlist,
- rte_atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
range_set_src_ip(info, (char *)(uintptr_t)"start", &ip);
- rte_atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));
range_set_src_ip(info, (char *)(uintptr_t)"min", &ip);
- rte_atoip(argv[6], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[6], PG_IPADDR_V4, &ip, sizeof(ip));
range_set_src_ip(info, (char *)(uintptr_t)"max", &ip);
- rte_atoip(argv[7], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[7], PG_IPADDR_V4, &ip, sizeof(ip));
range_set_src_ip(info, (char *)(uintptr_t)"inc", &ip)
);
break;
@@ -309,6 +326,18 @@ range_cmd(int argc, char **argv)
foreach_port(portlist,
range_set_gre_key(info, strtoul(what, NULL, 10)) );
break;
+ case 100:
+ foreach_port(portlist,
+ range_set_gtpu_teid(info, argv[3], strcmp("inc", argv[3])? valid_gtpu_teid(info, what) : atoi(what)));
+ break;
+ case 101:
+ foreach_port(portlist,
+ range_set_gtpu_teid(info, (char *)(uintptr_t)"start", valid_gtpu_teid(info, argv[3]));
+ range_set_gtpu_teid(info, (char *)(uintptr_t)"min", valid_gtpu_teid(info, argv[4]));
+ range_set_gtpu_teid(info, (char *)(uintptr_t)"max", valid_gtpu_teid(info, argv[5]));
+ range_set_gtpu_teid(info, (char *)(uintptr_t)"inc", atoi(argv[6]));
+ );
+ break;
case 160:
foreach_port(portlist,
range_set_cos_id(info, argv[3], atoi(what)) );
@@ -432,7 +461,7 @@ set_cmd(int argc, char **argv)
if (!m)
return cli_cmd_error("Set command is invalid", "Set", argc, argv);
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
what = argv[2];
value = atoi(argv[3]);
@@ -492,9 +521,9 @@ set_cmd(int argc, char **argv)
char buf[32];
snprintf(buf, sizeof(buf), "%s/32", argv[4]);
cli_printf("src IP address should contain /NN subnet value, default /32\n");
- rte_atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &ip, sizeof(ip));
+ _atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &ip, sizeof(ip));
} else
- rte_atoip(argv[4], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &ip, sizeof(ip));
+ _atoip(argv[4], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &ip, sizeof(ip));
foreach_port(portlist, single_set_ipaddr(info, 's', &ip));
break;
case 31:
@@ -504,7 +533,7 @@ set_cmd(int argc, char **argv)
cli_printf("Subnet mask not required, removing subnet mask value\n");
*p = '\0';
}
- rte_atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
+ _atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
foreach_port(portlist, single_set_ipaddr(info, 'd', &ip));
break;
case 40:
@@ -611,7 +640,7 @@ pcap_cmd(int argc, char **argv)
pktgen.portNum);
break;
case 30:
- rte_parse_portlist(argv[2], &portlist);
+ portlist_parse(argv[2], &portlist);
foreach_port(portlist,
pcap_filter(info, argv[3]) );
break;
@@ -653,7 +682,7 @@ start_stop_cmd(int argc, char **argv)
if (!m)
return cli_cmd_error("Start/Stop command invalid", "Start", argc, argv);
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
switch (m->index) {
case 10:
@@ -785,7 +814,7 @@ en_dis_cmd(int argc, char **argv)
if (!m)
return cli_cmd_error("Enable/Disable invalid command", "Enable", argc, argv);
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
switch (m->index) {
case 10:
@@ -849,7 +878,9 @@ en_dis_cmd(int argc, char **argv)
foreach_port(portlist, pktgen_set_capture(info, state));
break;
case 16:
+#ifdef RTE_LIBRTE_PMD_BOND
foreach_port(portlist, enable_bonding(info, state));
+#endif
break;
case 17:
foreach_port(portlist, enable_short_pkts(info, state));
@@ -885,6 +916,7 @@ en_dis_cmd(int argc, char **argv)
static struct cli_map dbg_map[] = {
{ 10, "dbg l2p" },
{ 20, "dbg tx_dbg" },
+ { 21, "dbg tx_rate %P" },
{ 30, "dbg %|mempool|dump %P %s" },
{ 40, "dbg pdump %P" },
{ 50, "dbg memzone" },
@@ -904,6 +936,7 @@ static const char *dbg_help[] = {
"",
"dbg l2p - Dump out internal lcore to port mapping",
"dbg tx_dbg - Enable tx debug output",
+ "dbg tx_rate <portlist> - Show packet rate for all ports",
"dbg mempool|dump <portlist> <type> - Dump out the mempool info for a given type",
"dbg pdump <portlist> - Hex dump the first packet to be sent, single packet mode only",
"dbg memzone - List all of the current memzones",
@@ -983,13 +1016,18 @@ dbg_cmd(int argc, char **argv)
pktgen.flags &= ~TX_DEBUG_FLAG;
pktgen_clear_display();
break;
+ case 21:
+ portlist_parse(argv[2], &portlist);
+ foreach_port(portlist,
+ debug_tx_rate(info));
+ break;
case 30:
- rte_parse_portlist(argv[2], &portlist);
+ portlist_parse(argv[2], &portlist);
foreach_port(portlist,
debug_mempool_dump(info, argv[3]) );
break;
case 40:
- rte_parse_portlist(argv[2], &portlist);
+ portlist_parse(argv[2], &portlist);
foreach_port(portlist, debug_pdump(info));
pktgen_update_display();
break;
@@ -1051,7 +1089,7 @@ seq_1_set_cmd(int argc __rte_unused, char **argv)
int seqnum = atoi(argv[1]);
portlist_t portlist;
struct pg_ipaddr dst, src;
- struct ether_addr dmac, smac;
+ struct pg_ether_addr dmac, smac;
uint32_t teid;
if ( (proto[0] == 'i') && (eth[3] == '6') ) {
@@ -1068,16 +1106,16 @@ seq_1_set_cmd(int argc __rte_unused, char **argv)
p = strchr(argv[5], '/'); /* remove subnet if found */
if (p)
*p = '\0';
- rte_atoip(argv[5], PG_IPADDR_V4, &dst, sizeof(dst));
+ _atoip(argv[5], PG_IPADDR_V4, &dst, sizeof(dst));
p = strchr(argv[6], '/');
if (!p) {
char buf[32];
cli_printf("src IP address should contain /NN subnet value, default /32\n");
snprintf(buf, sizeof(buf), "%s/32", argv[6]);
- rte_atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));
+ _atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));
} else
- rte_atoip(argv[6], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));
- rte_parse_portlist(argv[2], &portlist);
+ _atoip(argv[6], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));
+ portlist_parse(argv[2], &portlist);
rte_ether_aton(argv[3], &dmac);
rte_ether_aton(argv[4], &smac);
foreach_port(portlist,
@@ -1114,7 +1152,7 @@ seq_2_set_cmd(int argc __rte_unused, char **argv)
int seqnum = atoi(argv[1]);
portlist_t portlist;
struct pg_ipaddr dst, src;
- struct ether_addr dmac, smac;
+ struct pg_ether_addr dmac, smac;
uint32_t teid;
if ( (proto[0] == 'i') && (eth[3] == '6') ) {
@@ -1131,16 +1169,16 @@ seq_2_set_cmd(int argc __rte_unused, char **argv)
p = strchr(argv[8], '/'); /* remove subnet if found */
if (p)
*p = '\0';
- rte_atoip(argv[8], PG_IPADDR_V4, &dst, sizeof(dst));
+ _atoip(argv[8], PG_IPADDR_V4, &dst, sizeof(dst));
p = strchr(argv[10], '/');
if (p == NULL) {
char buf[32];
snprintf(buf, sizeof(buf), "%s/32", argv[10]);
cli_printf("src IP address should contain /NN subnet value, default /32");
- rte_atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));
+ _atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));
} else
- rte_atoip(argv[10], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));
- rte_parse_portlist(argv[2], &portlist);
+ _atoip(argv[10], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));
+ portlist_parse(argv[2], &portlist);
rte_ether_aton(argv[4], &dmac);
rte_ether_aton(argv[6], &smac);
foreach_port(portlist,
@@ -1184,7 +1222,7 @@ seq_3_set_cmd(int argc __rte_unused, char **argv)
cos = strtoul(argv[4], NULL, 10);
tos = strtoul(argv[6], NULL, 10);
- rte_parse_portlist(argv[2], &portlist);
+ portlist_parse(argv[2], &portlist);
foreach_port(portlist,
pktgen_set_cos_tos_seq(info, seqnum, cos, tos) );
@@ -1222,7 +1260,7 @@ seq_4_set_cmd(int argc __rte_unused, char **argv)
gid = strtoul(argv[6], NULL, 10);
vid = strtoul(argv[8], NULL, 10);
- rte_parse_portlist(argv[2], &portlist);
+ portlist_parse(argv[2], &portlist);
foreach_port(portlist,
pktgen_set_vxlan_seq(info, seqnum, flag, gid, vid) );
@@ -1414,7 +1452,7 @@ misc_cmd(int argc, char **argv)
switch(m->index) {
case 10:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
foreach_port(portlist,
pktgen_clear_stats(info) );
pktgen_clear_display();
@@ -1448,25 +1486,25 @@ misc_cmd(int argc, char **argv)
case 60: pktgen_save(argv[1]); break;
case 70: pktgen_clear_display(); break;
case 100:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
foreach_port(portlist,
pktgen_reset(info) );
break;
case 110:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
foreach_port(portlist,
pktgen_port_restart(info) );
break;
case 120:
case 130: pktgen_set_port_number((uint16_t)atoi(argv[1])); break;
case 140:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
foreach_port(portlist, pktgen_ping4(info));
pktgen_force_update();
break;
#ifdef INCLUDE_PING6
case 141:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
foreach_port(portlist, pktgen_ping6(info));
pktgen_update_display();
break;
@@ -1579,6 +1617,69 @@ plugin_cmd(int argc, char **argv)
return 0;
}
+#ifdef RTE_LIBRTE_PMD_BOND
+static struct cli_map bonding_map[] = {
+ { 10, "bonding %P show" },
+ { 20, "bonding show" },
+ { -1, NULL }
+};
+
+static const char *bonding_help[] = {
+ "",
+ "bonding <portlist> show - Show the bonding configuration for <portlist>",
+ "bonding show - Show all bonding configurations",
+ CLI_HELP_PAUSE,
+ NULL
+};
+
+static void
+bonding_dump(port_info_t *info)
+{
+ uint16_t pid;
+
+ RTE_ETH_FOREACH_DEV(pid) {
+ struct rte_eth_bond_8023ad_conf conf;
+
+ if (info->pid != pid)
+ continue;
+
+ if (rte_eth_bond_8023ad_conf_get(pid, &conf) < 0)
+ continue;
+
+ printf("Port %d information:\n", pid);
+ show_bonding_mode(info);
+ printf("\n");
+ }
+}
+
+static int
+bonding_cmd(int argc, char **argv)
+{
+ struct cli_map *m;
+ portlist_t portlist;
+
+ m = cli_mapping(bonding_map, argc, argv);
+ if (!m)
+ return cli_cmd_error("bonding invalid command", "Bonding", argc, argv);
+
+ switch(m->index) {
+ case 10:
+ portlist_parse(argv[1], &portlist);
+ foreach_port(portlist,
+ bonding_dump(info));
+ break;
+ case 20:
+ portlist = 0xFFFFFFFF;
+ foreach_port(portlist,
+ bonding_dump(info));
+ break;
+ default:
+ return cli_cmd_error("Bonding invalid command", "Bonding", argc, argv);
+ }
+ return 0;
+}
+#endif
+
/**********************************************************/
/**********************************************************/
/****** CONTEXT (list of instruction) */
@@ -1624,6 +1725,9 @@ static struct cli_tree default_tree[] = {
c_cmd("set", set_cmd, "set a number of options"),
c_cmd("dbg", dbg_cmd, "debug commands"),
c_cmd("plugin", plugin_cmd, "Plugin a shared object file"),
+#ifdef RTE_LIBRTE_PMD_BOND
+ c_cmd("bonding", bonding_cmd, "Bonding commands"),
+#endif
c_alias("on", "enable screen", "Enable screen updates"),
c_alias("off", "disable screen", "Disable screen updates"),
@@ -1654,6 +1758,9 @@ init_tree(void)
cli_help_add("Misc", misc_map, misc_help);
cli_help_add("Theme", theme_map, theme_help);
cli_help_add("Plugin", plugin_map, plugin_help);
+#ifdef RTE_LIBRTE_PMD_BOND
+ cli_help_add("Bonding", bonding_map, bonding_help);
+#endif
cli_help_add("Status", NULL, status_help);
/* Make sure the pktgen commands are executable in search path */
diff --git a/app/lpktgenlib.c b/app/lpktgenlib.c
index d5a5cf3..c64efac 100644
--- a/app/lpktgenlib.c
+++ b/app/lpktgenlib.c
@@ -17,9 +17,9 @@
#include <stdint.h>
#include <netinet/in.h>
-#include <rte_lua.h>
-#include <rte_lua_stdio.h>
-#include <rte_lua_utils.h>
+#include <lua_config.h>
+#include <lua_stdio.h>
+#include <lua_utils.h>
#include "pktgen-cmds.h"
#include <cli.h>
@@ -27,9 +27,10 @@
#include <lualib.h>
#include <rte_net.h>
-#include <rte_lua.h>
-#include <rte_lua_stdio.h>
-#include <rte_strings.h>
+#include <lua_config.h>
+#include <lua_stdio.h>
+#include <_delay.h>
+#include <_strings.h>
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0)
#include <rte_bus_pci.h>
@@ -153,7 +154,7 @@ setf_udata(lua_State *L, const char *name, void *value)
#endif
static __inline__ void
-getf_etheraddr(lua_State *L, const char *field, struct ether_addr *value)
+getf_etheraddr(lua_State *L, const char *field, struct pg_ether_addr *value)
{
lua_getfield(L, 3, field);
if (lua_isstring(L, -1) )
@@ -166,7 +167,7 @@ getf_ipaddr(lua_State *L, const char *field, void *value, uint32_t flags)
{
lua_getfield(L, 3, field);
if (lua_isstring(L, -1) ) {
- rte_atoip((char *)(uintptr_t)luaL_checkstring(L, -1), flags, value,
+ _atoip((char *)(uintptr_t)luaL_checkstring(L, -1), flags, value,
sizeof(struct pg_ipaddr));
}
lua_pop(L, 1);
@@ -221,7 +222,7 @@ pktgen_set(lua_State *L) {
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
what = (char *)luaL_checkstring(L, 2);
value = luaL_checknumber(L, 3);
@@ -277,13 +278,13 @@ set_seq(lua_State *L, uint32_t seqnum)
uint32_t pktsize, sport, dport, gtpu_teid;
uint16_t vlanid;
uint8_t cos, tos;
- struct ether_addr daddr;
- struct ether_addr saddr;
+ struct pg_ether_addr daddr;
+ struct pg_ether_addr saddr;
struct pg_ipaddr ip_daddr;
struct pg_ipaddr ip_saddr;
char *proto, *ip;
- rte_parse_portlist(luaL_checkstring(L, 2), &portlist);
+ portlist_parse(luaL_checkstring(L, 2), &portlist);
rte_ether_aton(luaL_checkstring(L, 3), &daddr);
rte_ether_aton(luaL_checkstring(L, 4), &saddr);
@@ -293,15 +294,15 @@ set_seq(lua_State *L, uint32_t seqnum)
/* Determine if we are IPv4 or IPv6 packets */
ip = (char *)luaL_checkstring(L, 9);
if (ip[3] == '6') {
- rte_atoip(luaL_checkstring(L, 5), PG_IPADDR_V6,
+ _atoip(luaL_checkstring(L, 5), PG_IPADDR_V6,
&ip_daddr, sizeof(struct pg_ipaddr));
- rte_atoip(luaL_checkstring(L, 6),
+ _atoip(luaL_checkstring(L, 6),
PG_IPADDR_NETWORK | PG_IPADDR_V6,
&ip_saddr, sizeof(struct pg_ipaddr));
} else {
- rte_atoip(luaL_checkstring(L, 5), PG_IPADDR_V4,
+ _atoip(luaL_checkstring(L, 5), PG_IPADDR_V4,
&ip_daddr, sizeof(struct pg_ipaddr));
- rte_atoip(luaL_checkstring(L, 6),
+ _atoip(luaL_checkstring(L, 6),
PG_IPADDR_NETWORK | PG_IPADDR_V4,
&ip_saddr, sizeof(struct pg_ipaddr));
}
@@ -385,13 +386,13 @@ set_seqTable(lua_State *L, uint32_t seqnum)
uint32_t pktSize, sport, dport, gtpu_teid;
uint16_t vlanid;
uint8_t cos, tos;
- struct ether_addr daddr;
- struct ether_addr saddr;
+ struct pg_ether_addr daddr;
+ struct pg_ether_addr saddr;
struct pg_ipaddr ip_daddr;
struct pg_ipaddr ip_saddr;
char *ipProto, *ethType;
- rte_parse_portlist(luaL_checkstring(L, 2), &portlist);
+ portlist_parse(luaL_checkstring(L, 2), &portlist);
getf_etheraddr(L, "eth_dst_addr", &daddr);
getf_etheraddr(L, "eth_src_addr", &saddr);
@@ -500,7 +501,7 @@ pktgen_icmp(lua_State *L) {
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_icmp_echo(info,
estate((char *)luaL_checkstring(L,
@@ -531,7 +532,7 @@ pktgen_sendARP(lua_State *L) {
break;
}
what = (char *)luaL_checkstring(L, 2);
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_send_arp_requests(info,
(what[0] == 'g') ? GRATUITOUS_ARP : 0) );
@@ -554,14 +555,14 @@ static int
pktgen_set_mac(lua_State *L)
{
portlist_t portlist;
- struct ether_addr mac;
+ struct pg_ether_addr mac;
switch (lua_gettop(L) ) {
default: return luaL_error(L, "set_mac, wrong number of arguments");
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
rte_ether_aton(luaL_checkstring(L, 2), &mac);
foreach_port(portlist,
@@ -627,7 +628,7 @@ pktgen_prototype(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
type = (char *)luaL_checkstring(L, 2);
foreach_port(portlist,
@@ -661,11 +662,11 @@ pktgen_set_ip_addr(lua_State *L) {
break;
}
type = (char *)luaL_checkstring(L, 2);
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
flags = PG_IPADDR_V4;
if (type[0] == 's')
flags |= PG_IPADDR_NETWORK;
- rte_atoip(luaL_checkstring(L, 3), flags,
+ _atoip(luaL_checkstring(L, 3), flags,
&ipaddr, sizeof(struct pg_ipaddr));
foreach_port(portlist,
@@ -699,7 +700,7 @@ pktgen_set_type(lua_State *L)
break;
}
type = (char *)luaL_checkstring(L, 2);
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
single_set_pkt_type(info, type) );
@@ -730,7 +731,7 @@ pktgen_send_ping4(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_ping4(info) );
@@ -761,7 +762,7 @@ pktgen_send_ping6(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_ping6(info) );
@@ -794,7 +795,7 @@ pktgen_pcap(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
what = (char *)luaL_checkstring(L, 2);
foreach_port(portlist,
@@ -825,7 +826,7 @@ pktgen_start(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_start_transmitting(info) );
@@ -854,7 +855,7 @@ pktgen_stop(lua_State *L) {
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_stop_transmitting(info) );
@@ -907,7 +908,7 @@ pktgen_prime(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_prime_ports(info) );
@@ -1169,7 +1170,7 @@ pktgen_clear(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_clear_stats(info) );
@@ -1261,7 +1262,7 @@ pktgen_reset_config(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_reset(info) );
@@ -1291,7 +1292,7 @@ pktgen_restart(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pktgen_port_restart(info) );
@@ -1315,14 +1316,14 @@ static int
range_dst_mac(lua_State *L)
{
portlist_t portlist;
- struct ether_addr mac;
+ struct pg_ether_addr mac;
switch (lua_gettop(L) ) {
default: return luaL_error(L, "dst_mac, wrong number of arguments");
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
rte_ether_aton(luaL_checkstring(L, 3), &mac);
foreach_port(portlist,
@@ -1348,14 +1349,14 @@ static int
range_src_mac(lua_State *L)
{
portlist_t portlist;
- struct ether_addr mac;
+ struct pg_ether_addr mac;
switch (lua_gettop(L) ) {
default: return luaL_error(L, "src_mac, wrong number of arguments");
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
rte_ether_aton(luaL_checkstring(L, 3), &mac);
foreach_port(portlist,
@@ -1389,8 +1390,8 @@ range_dst_ip(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
- rte_atoip(luaL_checkstring(L, 3), PG_IPADDR_V4,
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
+ _atoip(luaL_checkstring(L, 3), PG_IPADDR_V4,
&ipaddr, sizeof(struct pg_ipaddr));
type = (char *)luaL_checkstring(L, 2);
@@ -1425,8 +1426,8 @@ range_src_ip(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
- rte_atoip(luaL_checkstring(L, 3), PG_IPADDR_V4,
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
+ _atoip(luaL_checkstring(L, 3), PG_IPADDR_V4,
&ipaddr, sizeof(ipaddr));
type = (char *)luaL_checkstring(L, 2);
@@ -1459,7 +1460,7 @@ range_dst_port(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
range_set_dst_port(info, (char *)luaL_checkstring(L, 2),
@@ -1492,7 +1493,7 @@ range_ip_proto(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
ip = luaL_checkstring(L, 2);
foreach_port(portlist,
@@ -1524,7 +1525,7 @@ range_src_port(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
range_set_src_port(info, (char *)luaL_checkstring(L, 2),
@@ -1556,7 +1557,7 @@ range_gtpu_teid(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
range_set_gtpu_teid(info, (char *)luaL_checkstring(L, 2),
@@ -1589,7 +1590,7 @@ range_vlan_id(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
vlan_id = luaL_checkinteger(L, 3);
foreach_port(portlist,
@@ -1623,7 +1624,7 @@ range_cos(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
cos = luaL_checkinteger(L, 3);
foreach_port(portlist,
@@ -1657,7 +1658,7 @@ range_tos(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
tos = luaL_checkinteger(L, 3);
foreach_port(portlist,
@@ -1691,7 +1692,7 @@ single_vlan_id(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
vlanid = luaL_checkinteger(L, 2);
if ( (vlanid < MIN_VLAN_ID) || (vlanid > MAX_VLAN_ID) )
vlanid = 1;
@@ -1725,7 +1726,7 @@ single_cos(lua_State *L) {
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
cos = luaL_checkinteger(L, 3);
if (cos > MAX_COS)
cos = 0;
@@ -1760,7 +1761,7 @@ single_tos(lua_State *L) {
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
tos = luaL_checkinteger(L, 2);
foreach_port(portlist,
@@ -1793,7 +1794,7 @@ single_vxlan_id(lua_State *L) {
case 4:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
flags = luaL_checkinteger(L, 2);
group_id = luaL_checkinteger(L, 3);
vxlan_id = luaL_checkinteger(L, 4);
@@ -1827,7 +1828,7 @@ single_vlan(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_vlan(info, estate(luaL_checkstring(L, 2))) );
@@ -1858,7 +1859,7 @@ single_vxlan(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_vxlan(info, estate(luaL_checkstring(L, 2))) );
@@ -1890,7 +1891,7 @@ range_mpls_entry(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
mpls_entry = strtoul(luaL_checkstring(L, 2), NULL, 16);
foreach_port(portlist,
@@ -1922,7 +1923,7 @@ pktgen_mpls(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_mpls(info,
@@ -1955,7 +1956,7 @@ range_qinqids(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
qinq_id1 = luaL_checkinteger(L, 2);
if ( (qinq_id1 < MIN_VLAN_ID) || (qinq_id1 > MAX_VLAN_ID) )
qinq_id1 = 1;
@@ -1993,7 +1994,7 @@ pktgen_qinq(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_qinq(info,
@@ -2026,7 +2027,7 @@ range_gre_key(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
gre_key = luaL_checkinteger(L, 2);
foreach_port(portlist,
@@ -2057,7 +2058,7 @@ pktgen_gre(lua_State *L) {
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_gre(info, estate(luaL_checkstring(L, 2))) );
@@ -2088,7 +2089,7 @@ pktgen_gre_eth(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_gre_eth(info, estate(luaL_checkstring(L,
@@ -2122,7 +2123,7 @@ range_pkt_size(lua_State *L)
case 3:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
type = (char *)luaL_checkstring(L, 2);
size = luaL_checkinteger(L, 3);
@@ -2155,7 +2156,7 @@ range(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_range(info, estate((const char *)luaL_checkstring(L, 2))));
@@ -2186,7 +2187,7 @@ pktgen_latency(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_latency(info, estate((const char *)luaL_checkstring(L, 2))));
@@ -2217,7 +2218,7 @@ pktgen_jitter(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
single_set_jitter(info, luaL_checkinteger(L, 2)) );
@@ -2248,7 +2249,7 @@ pktgen_pattern(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pattern_set_type(info,
@@ -2281,7 +2282,7 @@ pktgen_user_pattern(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
pattern_set_user_pattern(info, (char *)luaL_checkstring(L, 2)) );
@@ -2360,7 +2361,7 @@ pktgen_process(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_process(info, estate((const char *)luaL_checkstring(L, 2))));
@@ -2391,7 +2392,7 @@ pktgen_capture(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_capture(info, estate((const char *)luaL_checkstring(L, 2))) );
@@ -2400,6 +2401,7 @@ pktgen_capture(lua_State *L)
return 0;
}
+#ifdef RTE_LIBRTE_PMD_BOND
/**************************************************************************//**
*
* pktgen_bonding - Enable or Disable bonding to send zero packets
@@ -2422,7 +2424,7 @@ pktgen_bonding(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_bonding(info, estate((const char *)luaL_checkstring(L, 2))) );
@@ -2430,6 +2432,7 @@ pktgen_bonding(lua_State *L)
pktgen_update_display();
return 0;
}
+#endif
/**************************************************************************//**
*
@@ -2453,7 +2456,7 @@ pktgen_rxtap(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_rx_tap(info, estate((char *)luaL_checkstring(L, 2))));
@@ -2484,7 +2487,7 @@ pktgen_txtap(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_tx_tap(info, estate((char *)luaL_checkstring(L, 2))));
@@ -2515,7 +2518,7 @@ pktgen_garp(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
enable_garp(info, estate((const char *)luaL_checkstring(L, 2))));
@@ -2546,7 +2549,7 @@ pktgen_blink(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
foreach_port(portlist,
debug_blink(info, estate((const char *)luaL_checkstring(L, 2))));
@@ -2605,7 +2608,7 @@ pktgen_isSending(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
lua_newtable(L);
@@ -2666,7 +2669,7 @@ pktgen_linkState(lua_State *L)
break;
}
portlist = 0;
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
lua_newtable(L);
@@ -2740,7 +2743,7 @@ pktgen_portSizes(lua_State *L)
break;
}
portlist = 0;
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
lua_newtable(L);
@@ -2768,7 +2771,7 @@ pktgen_portSizes(lua_State *L)
static void
pkt_stats(lua_State *L, port_info_t *info)
{
- struct ether_addr ethaddr;
+ struct pg_ether_addr ethaddr;
char mac_buf[32];
pkt_stats_t stats;
uint64_t avg_lat, ticks, jitter;
@@ -2790,7 +2793,7 @@ pkt_stats(lua_State *L, port_info_t *info)
rte_eth_macaddr_get(info->pid, &ethaddr);
- ether_format_addr(mac_buf, sizeof(mac_buf), &ethaddr);
+ pg_ether_format_addr(mac_buf, sizeof(mac_buf), &ethaddr);
setf_string(L, "mac_addr", mac_buf);
avg_lat = 0;
@@ -2849,7 +2852,7 @@ pktgen_pktStats(lua_State *L)
break;
}
portlist = 0;
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
lua_newtable(L);
@@ -2929,7 +2932,7 @@ pktgen_portStats(lua_State *L)
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
type = (char *)luaL_checkstring(L, 2);
lua_newtable(L);
@@ -3054,13 +3057,13 @@ port_info(lua_State *L, port_info_t *info)
setf_integer(L, "tx_count", rte_atomic64_read(&info->transmit_count));
setf_integer(L, "tx_rate", info->tx_rate);
- setf_integer(L, "pkt_size", pkt->pktSize + ETHER_CRC_LEN);
+ setf_integer(L, "pkt_size", pkt->pktSize + PG_ETHER_CRC_LEN);
setf_integer(L, "tx_burst", info->tx_burst);
setf_string(L, "eth_type",
- (pkt->ethType == ETHER_TYPE_IPv4) ? "IPv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "IPv6" :
- (pkt->ethType == ETHER_TYPE_ARP) ? "ARP" : "Other");
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "IPv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "IPv6" :
+ (pkt->ethType == PG_ETHER_TYPE_ARP) ? "ARP" : "Other");
setf_string(L, "proto_type",
(pkt->ipProto == PG_IPPROTO_TCP) ? "TCP" :
(pkt->ipProto == PG_IPPROTO_ICMP) ? "ICMP" :
@@ -3172,7 +3175,7 @@ pktgen_portInfo(lua_State *L)
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
lua_newtable(L);
@@ -3278,7 +3281,7 @@ decompile_pkt(lua_State *L, port_info_t *info, uint32_t seqnum)
inet_mtoa(buff, sizeof(buff), &p->eth_dst_addr));
setf_string(L, "eth_src_addr",
inet_mtoa(buff, sizeof(buff), &p->eth_src_addr));
- if (p->ethType == ETHER_TYPE_IPv4) {
+ if (p->ethType == PG_ETHER_TYPE_IPv4) {
setf_string(L, "ip_dst_addr",
inet_ntop4(buff, sizeof(buff),
htonl(p->ip_dst_addr.addr.ipv4.s_addr),
@@ -3303,15 +3306,15 @@ decompile_pkt(lua_State *L, port_info_t *info, uint32_t seqnum)
setf_string(L,
"ethType",
(char *)(
- (p->ethType == ETHER_TYPE_IPv4) ? "ipv4" :
- (p->ethType == ETHER_TYPE_IPv6) ? "ipv6" :
+ (p->ethType == PG_ETHER_TYPE_IPv4) ? "ipv4" :
+ (p->ethType == PG_ETHER_TYPE_IPv6) ? "ipv6" :
(p->ethType ==
- ETHER_TYPE_VLAN) ? "vlan" : "unknown"));
+ PG_ETHER_TYPE_VLAN) ? "vlan" : "unknown"));
setf_string(L, "ipProto", (char *)(
(p->ipProto == PG_IPPROTO_TCP) ? "tcp" :
(p->ipProto == PG_IPPROTO_ICMP) ? "icmp" : "udp"));
- setf_integer(L, "pktSize", p->pktSize + ETHER_CRC_LEN);
+ setf_integer(L, "pktSize", p->pktSize + PG_ETHER_CRC_LEN);
setf_integer(L, "gtpu_teid", p->gtpu_teid);
/* Now set the table as an array with pid as the index. */
@@ -3344,7 +3347,7 @@ pktgen_decompile(lua_State *L)
seqnum = luaL_checkinteger(L, 1);
if (seqnum >= NUM_SEQ_PKTS)
return 0;
- rte_parse_portlist(luaL_checkstring(L, 2), &portlist);
+ portlist_parse(luaL_checkstring(L, 2), &portlist);
lua_newtable(L);
@@ -3380,7 +3383,7 @@ pktgen_sendPkt(lua_State *L)
case 2:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
seqnum = luaL_checkinteger(L, 2);
if ( (seqnum >= NUM_EXTRA_TX_PKTS) || (portlist == 0) )
@@ -3454,7 +3457,7 @@ pktgen_recvPkt(lua_State *L)
case 1:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
if (portlist == 0)
return 0;
@@ -3490,7 +3493,7 @@ pktgen_rnd(lua_State *L)
case 4:
break;
}
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
if (portlist == 0)
return 0;
@@ -3577,7 +3580,7 @@ pktgen_rnd_list(lua_State *L) {
break;
}
if (lua_gettop(L) == 1)
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
else
portlist = -1;
@@ -3878,7 +3881,9 @@ static const luaL_Reg pktgenlib[] = {
{"port", pktgen_port}, /* select a different port number used for sequence and range pages. */
{"process", pktgen_process}, /* Enable or disable input packet processing on a port */
{"capture", pktgen_capture}, /* Enable or disable capture on a port */
+#ifdef RTE_LIBRTE_PMD_BOND
{"bonding", pktgen_bonding}, /* Enable or disable bonding on a port */
+#endif
{"garp", pktgen_garp}, /* Enable or disable GARP packet processing on a port */
{"blink", pktgen_blink}, /* Blink an led on a port */
{"help", pktgen_help}, /* Return the help text */
@@ -3959,8 +3964,8 @@ luaopen_pktgen(lua_State *L)
setf_integer(L, "numExtraTxPkts", NUM_EXTRA_TX_PKTS);
setf_integer(L, "numTotalPkts", NUM_TOTAL_PKTS);
- setf_integer(L, "minPktSize", MIN_PKT_SIZE + ETHER_CRC_LEN);
- setf_integer(L, "maxPktSize", MAX_PKT_SIZE + ETHER_CRC_LEN);
+ setf_integer(L, "minPktSize", MIN_PKT_SIZE + PG_ETHER_CRC_LEN);
+ setf_integer(L, "maxPktSize", MAX_PKT_SIZE + PG_ETHER_CRC_LEN);
setf_integer(L, "minVlanID", MIN_VLAN_ID);
setf_integer(L, "maxVlanID", MAX_VLAN_ID);
setf_integer(L, "vlanTagSize", VLAN_TAG_SIZE);
diff --git a/app/meson.build b/app/meson.build
index 8c7247e..0ca38c9 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -8,17 +8,29 @@ sources = files(
'pktgen-latency.c'
)
+message('Process the app directory')
+
#TODO fixme - assumes previously build lua using make
-lua_dir = '../lib/lua/x86_64-native-linuxapp-gcc'
+lua_dir = '../lib/lua/build'
lua_inc = include_directories(join_paths(lua_dir, 'include'))
-lua = declare_dependency(include_directories: lua_inc, link_args: ['-L' + lua_dir, '-lrte_lua'])
+lua = declare_dependency(include_directories: lua_inc, link_args: ['-L' + lua_dir, '-llua5.3'])
+cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ cflags += '-Wno-format-truncation'
+endif
pktgen = executable('dpdk-pktgen',
sources,
- c_args: '-Wno-format-truncation',
- dependencies: [dep_cli, lua,
+ c_args: cflags,
+ dependencies: [lua,
+ cc.find_library('pcap', required: true),
+ get_variable('static_pktgen_cli'),
+ get_variable('static_pktgen_common'),
+ get_variable('static_pktgen_lua'),
+ get_variable('static_pktgen_plugin'),
+ get_variable('static_pktgen_utils'),
+ get_variable('static_pktgen_vec'),
dependency('threads'),
cc.find_library('dl', required: false),
cc.find_library('m', required: false)],
install: true)
-
diff --git a/app/pktgen-arp.c b/app/pktgen-arp.c
index b076dc9..d9e7ae6 100644
--- a/app/pktgen-arp.c
+++ b/app/pktgen-arp.c
@@ -7,7 +7,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
#include <cli_scrn.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include <rte_arp.h>
#include "pktgen-arp.h"
@@ -34,8 +34,8 @@ pktgen_send_arp(uint32_t pid, uint32_t type, uint8_t seq_idx)
port_info_t *info = &pktgen.info[pid];
pkt_seq_t *pkt;
struct rte_mbuf *m;
- struct ether_hdr *eth;
- struct arp_hdr *arp;
+ struct pg_ether_hdr *eth;
+ struct pg_arp_hdr *arp;
uint32_t addr;
uint8_t qid = 0;
@@ -45,15 +45,15 @@ pktgen_send_arp(uint32_t pid, uint32_t type, uint8_t seq_idx)
pktgen_log_warning("No packet buffers found");
return;
}
- eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
- arp = (struct arp_hdr *)&eth[1];
+ eth = rte_pktmbuf_mtod(m, struct pg_ether_hdr *);
+ arp = (struct pg_arp_hdr *)&eth[1];
/* src and dest addr */
memset(&eth->d_addr, 0xFF, 6);
- ether_addr_copy(&pkt->eth_src_addr, &eth->s_addr);
- eth->ether_type = htons(ETHER_TYPE_ARP);
+ pg_ether_addr_copy(&pkt->eth_src_addr, &eth->s_addr);
+ eth->ether_type = htons(PG_ETHER_TYPE_ARP);
- memset(arp, 0, sizeof(struct arp_hdr));
+ memset(arp, 0, sizeof(struct pg_arp_hdr));
rte_memcpy(&arp->arp_data.arp_sha, &pkt->eth_src_addr, 6);
addr = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);
@@ -71,7 +71,7 @@ pktgen_send_arp(uint32_t pid, uint32_t type, uint8_t seq_idx)
/* Fill in the rest of the ARP packet header */
arp->arp_hrd = htons(ETH_HW_TYPE);
- arp->arp_pro = htons(ETHER_TYPE_IPv4);
+ arp->arp_pro = htons(PG_ETHER_TYPE_IPv4);
arp->arp_hln = 6;
arp->arp_pln = 4;
arp->arp_op = htons(ARP_REQUEST);
@@ -101,12 +101,12 @@ pktgen_process_arp(struct rte_mbuf *m, uint32_t pid, uint32_t vlan)
{
port_info_t *info = &pktgen.info[pid];
pkt_seq_t *pkt;
- struct ether_hdr *eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
- struct arp_hdr *arp = (struct arp_hdr *)&eth[1];
+ struct pg_ether_hdr *eth = rte_pktmbuf_mtod(m, struct pg_ether_hdr *);
+ struct pg_arp_hdr *arp = (struct pg_arp_hdr *)&eth[1];
/* Adjust for a vlan header if present */
if (vlan)
- arp = (struct arp_hdr *)((char *)arp + sizeof(struct vlan_hdr));
+ arp = (struct pg_arp_hdr *)((char *)arp + sizeof(struct pg_vlan_hdr));
/* Process all ARP requests if they are for us. */
if (arp->arp_op == htons(ARP_REQUEST) ) {
diff --git a/app/pktgen-capture.c b/app/pktgen-capture.c
index 0f3f42b..7e13682 100644
--- a/app/pktgen-capture.c
+++ b/app/pktgen-capture.c
@@ -12,7 +12,7 @@
#include <rte_memzone.h>
#include <rte_string_fns.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen-cmds.h"
#include "pktgen-log.h"
diff --git a/app/pktgen-cfg.c b/app/pktgen-cfg.c
index a3cc318..90e8aa9 100644
--- a/app/pktgen-cfg.c
+++ b/app/pktgen-cfg.c
@@ -6,7 +6,7 @@
/* Created 2018 by Keith Wiles @ intel.com */
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen-display.h"
#include "pktgen-cpu.h"
diff --git a/app/pktgen-cmds.c b/app/pktgen-cmds.c
index 08760ee..6997eed 100644
--- a/app/pktgen-cmds.c
+++ b/app/pktgen-cmds.c
@@ -9,7 +9,7 @@
#include <string.h>
#include <sys/stat.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen.h"
@@ -17,11 +17,15 @@
#include "pktgen-display.h"
-#include <rte_version.h>
+#include <_delay.h>
#if RTE_VERSION >= RTE_VERSION_NUM(17,2,0,0)
#include <rte_net.h>
#endif
+#ifdef RTE_LIBRTE_PMD_BOND
+#include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
+#endif
static char hash_line[] = "#######################################################################";
@@ -74,7 +78,7 @@ pktgen_script_save(char *path)
FILE *fd;
int i, j;
uint64_t lcore;
- struct ether_addr eaddr;
+ struct pg_ether_addr eaddr;
fd = fopen(path, "w");
if (fd == NULL)
@@ -158,17 +162,17 @@ pktgen_script_save(char *path)
fprintf(fd, "#\n# Set up the primary port information:\n");
fprintf(fd, "set %d count %" PRIu64 "\n", info->pid,
rte_atomic64_read(&info->transmit_count));
- fprintf(fd, "set %d size %d\n", info->pid, pkt->pktSize + ETHER_CRC_LEN);
+ fprintf(fd, "set %d size %d\n", info->pid, pkt->pktSize + PG_ETHER_CRC_LEN);
fprintf(fd, "set %d rate %g\n", info->pid, info->tx_rate);
fprintf(fd, "set %d burst %d\n", info->pid, info->tx_burst);
fprintf(fd, "set %d sport %d\n", info->pid, pkt->sport);
fprintf(fd, "set %d dport %d\n", info->pid, pkt->dport);
fprintf(fd, "set %d prime %d\n", info->pid, info->prime_cnt);
fprintf(fd, "set %d type %s\n", i,
- (pkt->ethType == ETHER_TYPE_IPv4) ? "ipv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "ipv6" :
- (pkt->ethType == ETHER_TYPE_VLAN) ? "vlan" :
- (pkt->ethType == ETHER_TYPE_ARP) ? "arp" : "unknown");
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "ipv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "ipv6" :
+ (pkt->ethType == PG_ETHER_TYPE_VLAN) ? "vlan" :
+ (pkt->ethType == PG_ETHER_TYPE_ARP) ? "arp" : "unknown");
fprintf(fd, "set %d proto %s\n", i,
(pkt->ipProto == PG_IPPROTO_TCP) ? "tcp" :
(pkt->ipProto == PG_IPPROTO_ICMP) ? "icmp" : "udp");
@@ -334,11 +338,11 @@ pktgen_script_save(char *path)
fprintf(fd, "\n");
fprintf(fd, "range %d size start %d\n", i,
- range->pkt_size + ETHER_CRC_LEN);
+ range->pkt_size + PG_ETHER_CRC_LEN);
fprintf(fd, "range %d size min %d\n", i,
- range->pkt_size_min + ETHER_CRC_LEN);
+ range->pkt_size_min + PG_ETHER_CRC_LEN);
fprintf(fd, "range %d size max %d\n", i,
- range->pkt_size_max + ETHER_CRC_LEN);
+ range->pkt_size_max + PG_ETHER_CRC_LEN);
fprintf(fd, "range %d size inc %d\n\n", i, range->pkt_size_inc);
fprintf(fd, "#\n# Set up the sequence data for the port.\n");
@@ -366,15 +370,15 @@ pktgen_script_save(char *path)
fprintf(fd, "%d %d %s %s %d %d %d\n",
pkt->sport,
pkt->dport,
- (pkt->ethType == ETHER_TYPE_IPv4) ? "ipv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "ipv6" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "ipv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "ipv6" :
(pkt->ethType ==
- ETHER_TYPE_VLAN) ? "vlan" : "Other",
+ PG_ETHER_TYPE_VLAN) ? "vlan" : "Other",
(pkt->ipProto == PG_IPPROTO_TCP) ? "tcp" :
(pkt->ipProto ==
PG_IPPROTO_ICMP) ? "icmp" : "udp",
pkt->vlanid,
- pkt->pktSize + ETHER_CRC_LEN,
+ pkt->pktSize + PG_ETHER_CRC_LEN,
pkt->gtpu_teid);
}
@@ -430,7 +434,7 @@ pktgen_lua_save(char *path)
FILE *fd;
int i, j;
uint64_t lcore;
- struct ether_addr eaddr;
+ struct pg_ether_addr eaddr;
fd = fopen(path, "w");
if (fd == NULL)
@@ -505,17 +509,17 @@ pktgen_lua_save(char *path)
fprintf(fd, "--\n-- Set up the primary port information:\n");
fprintf(fd, "pktgen.set('%d', 'count', %" PRIu64 ");\n", info->pid,
rte_atomic64_read(&info->transmit_count));
- fprintf(fd, "pktgen.set('%d', 'size', %d);\n", info->pid, pkt->pktSize + ETHER_CRC_LEN);
+ fprintf(fd, "pktgen.set('%d', 'size', %d);\n", info->pid, pkt->pktSize + PG_ETHER_CRC_LEN);
fprintf(fd, "pktgen.set('%d', 'rate', %g);\n", info->pid, info->tx_rate);
fprintf(fd, "pktgen.set('%d', 'burst', %d);\n", info->pid, info->tx_burst);
fprintf(fd, "pktgen.set('%d', 'sport', %d);\n", info->pid, pkt->sport);
fprintf(fd, "pktgen.set('%d', 'dport', %d);\n", info->pid, pkt->dport);
fprintf(fd, "pktgen.set('%d', 'prime', %d);\n", info->pid, info->prime_cnt);
fprintf(fd, "pktgen.set_type('%d', '%s');\n", i,
- (pkt->ethType == ETHER_TYPE_IPv4) ? "ipv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "ipv6" :
- (pkt->ethType == ETHER_TYPE_VLAN) ? "vlan" :
- (pkt->ethType == ETHER_TYPE_ARP) ? "arp" : "unknown");
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "ipv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "ipv6" :
+ (pkt->ethType == PG_ETHER_TYPE_VLAN) ? "vlan" :
+ (pkt->ethType == PG_ETHER_TYPE_ARP) ? "arp" : "unknown");
fprintf(fd, "pktgen.set_proto('%d', '%s');\n", i,
(pkt->ipProto == PG_IPPROTO_TCP) ? "tcp" :
(pkt->ipProto == PG_IPPROTO_ICMP) ? "icmp" : "udp");
@@ -680,11 +684,11 @@ pktgen_lua_save(char *path)
fprintf(fd, "\n");
fprintf(fd, "pktgen.pkt_size('%d', 'start', %d);\n", i,
- range->pkt_size + ETHER_CRC_LEN);
+ range->pkt_size + PG_ETHER_CRC_LEN);
fprintf(fd, "pktgen.pkt_size('%d', 'min', %d);\n", i,
- range->pkt_size_min + ETHER_CRC_LEN);
+ range->pkt_size_min + PG_ETHER_CRC_LEN);
fprintf(fd, "pktgen.pkt_size('%d', 'max', %d);\n", i,
- range->pkt_size_max + ETHER_CRC_LEN);
+ range->pkt_size_max + PG_ETHER_CRC_LEN);
fprintf(fd, "pktgen.pkt_size('%d', 'inc', %d);\n\n", i, range->pkt_size_inc);
fprintf(fd, "--\n-- Set up the sequence data for the port.\n");
@@ -717,15 +721,15 @@ pktgen_lua_save(char *path)
fprintf(fd, "%d, %d, '%s', '%s', %d, %d, %d);\n",
pkt->sport,
pkt->dport,
- (pkt->ethType == ETHER_TYPE_IPv4) ? "ipv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "ipv6" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "ipv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "ipv6" :
(pkt->ethType ==
- ETHER_TYPE_VLAN) ? "vlan" : "Other",
+ PG_ETHER_TYPE_VLAN) ? "vlan" : "Other",
(pkt->ipProto == PG_IPPROTO_TCP) ? "tcp" :
(pkt->ipProto ==
PG_IPPROTO_ICMP) ? "icmp" : "udp",
pkt->vlanid,
- pkt->pktSize + ETHER_CRC_LEN,
+ pkt->pktSize + PG_ETHER_CRC_LEN,
pkt->gtpu_teid);
}
fflush(fd);
@@ -748,9 +752,9 @@ pktgen_lua_save(char *path)
fprintf(fd, " ['sport'] = %d,\n", pkt->sport);
fprintf(fd, " ['dport'] = %d,\n", pkt->dport);
fprintf(fd, " ['ethType'] = '%s',\n",
- (pkt->ethType == ETHER_TYPE_IPv4) ? "ipv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "ipv6" :
- (pkt->ethType == ETHER_TYPE_VLAN) ? "vlan" : "Other");
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "ipv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "ipv6" :
+ (pkt->ethType == PG_ETHER_TYPE_VLAN) ? "vlan" : "Other");
fprintf(fd, " ['ipProto'] = '%s',\n",
(pkt->ipProto == PG_IPPROTO_TCP) ? "tcp" :
(pkt->ipProto == PG_IPPROTO_ICMP) ? "icmp" : "udp");
@@ -975,7 +979,7 @@ pktgen_flags_string(port_info_t *info)
static char buff[32];
uint32_t flags = rte_atomic32_read(&info->port_flags);
- snprintf(buff, sizeof(buff), "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
+ snprintf(buff, sizeof(buff), "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
(pktgen.flags & PROMISCUOUS_ON_FLAG) ? 'P' : '-',
(flags & ICMP_ECHO_ENABLE_FLAG) ? 'E' : '-',
(flags & SEND_ARP_REQUEST) ? 'A' : '-',
@@ -994,7 +998,8 @@ pktgen_flags_string(port_info_t *info)
(flags & SEND_GRE_IPv4_HEADER) ? 'g' :
(flags & SEND_GRE_ETHER_HEADER) ? 'G' : '-',
(flags & CAPTURE_PKTS) ? 'C' : '-',
- (flags & SEND_RANDOM_PKTS) ? 'r' : '-');
+ (flags & SEND_RANDOM_PKTS) ? 'r' : '-',
+ (flags & BONDING_TX_PACKETS) ? 'B' : '-');
return buff;
}
@@ -1336,6 +1341,15 @@ enable_random(port_info_t *info, uint32_t onOff)
pktgen_clr_port_flags(info, SEND_RANDOM_PKTS);
}
+void
+debug_tx_rate(port_info_t *info)
+{
+ printf(" %d: rate %.2f, tx_cycles %ld, tx_pps %ld, link %s-%d-%s\n",
+ info->pid, info->tx_rate, info->tx_cycles, info->tx_pps,
+ (info->link.link_status)? "UP" : "Down", info->link.link_speed,
+ (info->link.link_duplex == ETH_LINK_FULL_DUPLEX)? "FD" : "HD");
+}
+
/*
* Local wrapper function to test mp is NULL and return or continue
* to call rte_mempool_dump() routine.
@@ -1492,7 +1506,7 @@ single_set_proto(port_info_t *info, char *type)
/* ICMP only works on IPv4 packets. */
if (type[0] == 'i')
- info->seq_pkt[SINGLE_PKT].ethType = ETHER_TYPE_IPv4;
+ info->seq_pkt[SINGLE_PKT].ethType = PG_ETHER_TYPE_IPv4;
pktgen_packet_ctor(info, SINGLE_PKT, -1);
}
@@ -1520,7 +1534,7 @@ range_set_proto(port_info_t *info, const char *type)
/* ICMP only works on IPv4 packets. */
if (type[0] == 'i')
- info->seq_pkt[RANGE_PKT].ethType = ETHER_TYPE_IPv4;
+ info->seq_pkt[RANGE_PKT].ethType = PG_ETHER_TYPE_IPv4;
}
/**************************************************************************//**
@@ -1545,7 +1559,6 @@ enable_pcap(port_info_t *info, uint32_t state)
pktgen_set_port_flags(info, SEND_PCAP_PKTS);
} else
pktgen_clr_port_flags(info, SEND_PCAP_PKTS);
- pktgen_packet_rate(info);
}
}
@@ -1637,6 +1650,7 @@ enable_capture(port_info_t *info, uint32_t state)
pktgen_set_capture(info, state);
}
+#ifdef RTE_LIBRTE_PMD_BOND
/**************************************************************************//**
*
* enable_bonding - Enable or disable bonding TX zero packet processing.
@@ -1652,11 +1666,187 @@ enable_capture(port_info_t *info, uint32_t state)
void
enable_bonding(port_info_t *info, uint32_t state)
{
- if (state == ENABLE_STATE)
- pktgen_set_port_flags(info, BONDING_TX_PACKETS);
- else
- pktgen_clr_port_flags(info, BONDING_TX_PACKETS);
+ struct rte_eth_bond_8023ad_conf conf;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
+ uint16_t active_slaves[RTE_MAX_ETHPORTS];
+ int i, num_slaves, num_active_slaves;
+
+ if (rte_eth_bond_8023ad_conf_get(info->pid, &conf) < 0) {
+ printf("Port %d is not a bonding port\n", info->pid);
+ return;
+ }
+
+ num_slaves = rte_eth_bond_slaves_get(info->pid, slaves, RTE_MAX_ETHPORTS);
+ if (num_slaves < 0) {
+ printf("Failed to get slave list for port = %d\n", info->pid);
+ return;
+ }
+
+ num_active_slaves = rte_eth_bond_active_slaves_get(info->pid, active_slaves,
+ RTE_MAX_ETHPORTS);
+ if (num_active_slaves < 0) {
+ printf("Failed to get active slave list for port = %d\n", info->pid);
+ return;
+ }
+
+ printf("Port %d:\n", info->pid);
+ for(i = 0; i < num_slaves; i++) {
+ if (state == ENABLE_STATE) {
+ pktgen_set_port_flags(info, BONDING_TX_PACKETS);
+ rte_eth_bond_8023ad_ext_distrib(info->pid, slaves[i], 1);
+ printf(" Enable slave %u 802.3ad distributing\n", slaves[i]);
+ rte_eth_bond_8023ad_ext_collect(info->pid, slaves[i], 1);
+ printf(" Enable slave %u 802.3ad collecting\n", slaves[i]);
+ } else {
+ pktgen_clr_port_flags(info, BONDING_TX_PACKETS);
+ rte_eth_bond_8023ad_ext_distrib(info->pid, slaves[i], 0);
+ printf(" Disable slave %u 802.3ad distributing\n", slaves[i]);
+ rte_eth_bond_8023ad_ext_collect(info->pid, slaves[i], 1);
+ printf(" Enable slave %u 802.3ad collecting\n", slaves[i]);
+ }
+ }
+}
+
+static void
+show_states(uint8_t state)
+{
+ const char *states[] = {
+ "LACP_Active",
+ "LACP_Short_timeout",
+ "Aggregation",
+ "Synchronization",
+ "Collecting",
+ "Distributing",
+ "Defaulted",
+ "Expired",
+ NULL
+ };
+ int j;
+
+ for(j = 0; states[j]; j++) {
+ if (state & (1 << j))
+ printf("%s ", states[j]);
+ }
+}
+
+void
+show_bonding_mode(port_info_t *info)
+{
+ int bonding_mode, agg_mode;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
+ int num_slaves, num_active_slaves;
+ int primary_id;
+ int i;
+ uint16_t port_id = info->pid;
+
+ /* Display the bonding mode.*/
+ bonding_mode = rte_eth_bond_mode_get(port_id);
+ if (bonding_mode < 0) {
+ printf("Failed to get bonding mode for port = %d\n", port_id);
+ return;
+ } else
+ printf("\tBonding mode: %d, ", bonding_mode);
+
+ if (bonding_mode == BONDING_MODE_BALANCE) {
+ int balance_xmit_policy;
+
+ balance_xmit_policy = rte_eth_bond_xmit_policy_get(port_id);
+ if (balance_xmit_policy < 0) {
+ printf("\nFailed to get balance xmit policy for port = %d\n",
+ port_id);
+ return;
+ } else {
+ printf("Balance Xmit Policy: ");
+
+ switch (balance_xmit_policy) {
+ case BALANCE_XMIT_POLICY_LAYER2:
+ printf("BALANCE_XMIT_POLICY_LAYER2");
+ break;
+ case BALANCE_XMIT_POLICY_LAYER23:
+ printf("BALANCE_XMIT_POLICY_LAYER23");
+ break;
+ case BALANCE_XMIT_POLICY_LAYER34:
+ printf("BALANCE_XMIT_POLICY_LAYER34");
+ break;
+ }
+ printf(", ");
+ }
+ }
+
+ if (bonding_mode == BONDING_MODE_8023AD) {
+ agg_mode = rte_eth_bond_8023ad_agg_selection_get(port_id);
+ printf("IEEE802.3AD Aggregator Mode: ");
+ switch (agg_mode) {
+ case AGG_BANDWIDTH:
+ printf("bandwidth");
+ break;
+ case AGG_STABLE:
+ printf("stable");
+ break;
+ case AGG_COUNT:
+ printf("count");
+ break;
+ }
+ printf("\n");
+ }
+
+ num_slaves = rte_eth_bond_slaves_get(port_id, slaves, RTE_MAX_ETHPORTS);
+
+ if (num_slaves < 0) {
+ printf("\tFailed to get slave list for port = %d\n", port_id);
+ return;
+ }
+ if (num_slaves > 0) {
+ printf("\tSlaves (%d): [", num_slaves);
+ for (i = 0; i < num_slaves - 1; i++)
+ printf("%d ", slaves[i]);
+
+ printf("%d]\n", slaves[num_slaves - 1]);
+ } else {
+ printf("\tSlaves: []\n");
+
+ }
+
+ num_active_slaves = rte_eth_bond_active_slaves_get(port_id, slaves,
+ RTE_MAX_ETHPORTS);
+
+ if (num_active_slaves < 0) {
+ printf("\tFailed to get active slave list for port = %d\n", port_id);
+ return;
+ }
+ if (num_active_slaves > 0) {
+ printf("\tActive Slaves (%d): [", num_active_slaves);
+ for (i = 0; i < num_active_slaves - 1; i++)
+ printf("%d ", slaves[i]);
+
+ printf("%d]\n", slaves[num_active_slaves - 1]);
+
+ } else {
+ printf("\tActive Slaves: []\n");
+
+ }
+
+ for (i = 0; i < num_active_slaves; i++) {
+ struct rte_eth_bond_8023ad_slave_info conf;
+
+ printf("\t\tSlave %u\n", slaves[i]);
+ rte_eth_bond_8023ad_slave_info(info->pid, slaves[i], &conf);
+ printf("\t\t %sSelected\n\t\t Actor States ( ", conf.selected? "" : "Not ");
+ show_states(conf.actor_state);
+ printf(")\n\t\t Partner States( ");
+ show_states(conf.partner_state);
+ printf(")\n\t\t AGG Port %u\n", conf.agg_port_id);
+ }
+
+ primary_id = rte_eth_bond_primary_get(port_id);
+ if (primary_id < 0) {
+ printf("\tFailed to get primary slave for port = %d\n", port_id);
+ return;
+ } else
+ printf("\tPrimary: [%d]\n", primary_id);
+
}
+#endif
/**************************************************************************//**
*
@@ -1717,10 +1907,10 @@ enable_garp(port_info_t *info, uint32_t state)
void
range_set_pkt_type(port_info_t *info, const char *type)
{
- info->seq_pkt[RANGE_PKT].ethType = (type[0] == 'a') ? ETHER_TYPE_ARP :
- (type[3] == '4') ? ETHER_TYPE_IPv4 :
- (type[3] == '6') ? ETHER_TYPE_IPv6 :
- /* TODO print error: unknown type */ ETHER_TYPE_IPv4;
+ info->seq_pkt[RANGE_PKT].ethType = (type[0] == 'a') ? PG_ETHER_TYPE_ARP :
+ (type[3] == '4') ? PG_ETHER_TYPE_IPv4 :
+ (type[3] == '6') ? PG_ETHER_TYPE_IPv6 :
+ /* TODO print error: unknown type */ PG_ETHER_TYPE_IPv4;
}
/**************************************************************************//**
@@ -1742,18 +1932,18 @@ single_set_pkt_type(port_info_t *info, const char *type)
uint16_t ethtype = pkt->ethType;
pkt->ethType =
- (type[0] == 'a') ? ETHER_TYPE_ARP :
- (type[3] == '4') ? ETHER_TYPE_IPv4 :
- (type[3] == '6') ? ETHER_TYPE_IPv6 :
- (type[2] == '4') ? ETHER_TYPE_IPv4 :
- (type[2] == '6') ? ETHER_TYPE_IPv6 :
- /* TODO print error: unknown type */ ETHER_TYPE_IPv4;
-
- if ((ethtype == ETHER_TYPE_IPv6) && (pkt->ethType == ETHER_TYPE_IPv4)) {
+ (type[0] == 'a') ? PG_ETHER_TYPE_ARP :
+ (type[3] == '4') ? PG_ETHER_TYPE_IPv4 :
+ (type[3] == '6') ? PG_ETHER_TYPE_IPv6 :
+ (type[2] == '4') ? PG_ETHER_TYPE_IPv4 :
+ (type[2] == '6') ? PG_ETHER_TYPE_IPv6 :
+ /* TODO print error: unknown type */ PG_ETHER_TYPE_IPv4;
+
+ if ((ethtype == PG_ETHER_TYPE_IPv6) && (pkt->ethType == PG_ETHER_TYPE_IPv4)) {
if (pkt->pktSize >= MIN_v6_PKT_SIZE)
pkt->pktSize = MIN_PKT_SIZE + (pkt->pktSize - MIN_v6_PKT_SIZE);
}
- if ((ethtype == ETHER_TYPE_IPv4) && (pkt->ethType == ETHER_TYPE_IPv6)) {
+ if ((ethtype == PG_ETHER_TYPE_IPv4) && (pkt->ethType == PG_ETHER_TYPE_IPv6)) {
if (pkt->pktSize < MIN_v6_PKT_SIZE)
pkt->pktSize = MIN_v6_PKT_SIZE + (pkt->pktSize - MIN_PKT_SIZE);
}
@@ -2141,7 +2331,7 @@ pktgen_port_defaults(uint32_t pid, uint8_t seq)
pkt->sport = DEFAULT_SRC_PORT;
pkt->dport = DEFAULT_DST_PORT;
pkt->ipProto = PG_IPPROTO_TCP;
- pkt->ethType = ETHER_TYPE_IPv4;
+ pkt->ethType = PG_ETHER_TYPE_IPv4;
pkt->vlanid = DEFAULT_VLAN_ID;
pkt->cos = DEFAULT_COS;
pkt->tos = DEFAULT_TOS;
@@ -2158,8 +2348,6 @@ pktgen_port_defaults(uint32_t pid, uint8_t seq)
info->prime_cnt = DEFAULT_PRIME_COUNT;
info->delta = 0;
- pktgen_packet_rate(info);
-
pkt->ip_mask = DEFAULT_NETMASK;
if ( (pid & 1) == 0) {
pkt->ip_src_addr.addr.ipv4.s_addr = DEFAULT_IP_ADDR |
@@ -2176,7 +2364,7 @@ pktgen_port_defaults(uint32_t pid, uint8_t seq)
}
if (dst_info->seq_pkt != NULL)
- ether_addr_copy(&dst_info->seq_pkt[SINGLE_PKT].eth_src_addr,
+ pg_ether_addr_copy(&dst_info->seq_pkt[SINGLE_PKT].eth_src_addr,
&pkt->eth_dst_addr);
else
memset(&pkt->eth_dst_addr, 0, sizeof(pkt->eth_dst_addr));
@@ -2391,7 +2579,6 @@ pktgen_set_port_seqCnt(port_info_t *info, uint32_t cnt)
pktgen_set_port_flags(info, SEND_SEQ_PKTS);
} else
pktgen_clr_port_flags(info, SEND_SEQ_PKTS);
- pktgen_packet_rate(info);
}
/**************************************************************************//**
@@ -2471,7 +2658,6 @@ single_set_tx_burst(port_info_t *info, uint32_t burst)
else if (burst > DEFAULT_PKT_BURST)
burst = DEFAULT_PKT_BURST;
info->tx_burst = burst;
- pktgen_packet_rate(info);
}
/**************************************************************************//**
@@ -2509,23 +2695,22 @@ single_set_pkt_size(port_info_t *info, uint16_t size)
{
pkt_seq_t * pkt = &info->seq_pkt[SINGLE_PKT];
- if (size < ETHER_CRC_LEN)
- size = ETHER_CRC_LEN;
+ if (size < PG_ETHER_CRC_LEN)
+ size = PG_ETHER_CRC_LEN;
if (!(rte_atomic32_read(&info->port_flags) & SEND_SHORT_PACKETS)) {
- if ( (size - ETHER_CRC_LEN) < MIN_PKT_SIZE)
- size = (MIN_PKT_SIZE + ETHER_CRC_LEN);
+ if ( (size - PG_ETHER_CRC_LEN) < MIN_PKT_SIZE)
+ size = (MIN_PKT_SIZE + PG_ETHER_CRC_LEN);
}
- if ( (size - ETHER_CRC_LEN) > MAX_PKT_SIZE)
- size = MAX_PKT_SIZE + ETHER_CRC_LEN;
+ if ( (size - PG_ETHER_CRC_LEN) > MAX_PKT_SIZE)
+ size = MAX_PKT_SIZE + PG_ETHER_CRC_LEN;
- if ((pkt->ethType == ETHER_TYPE_IPv6) && (size < (MIN_v6_PKT_SIZE + ETHER_CRC_LEN)))
- size = MIN_v6_PKT_SIZE + ETHER_CRC_LEN;
+ if ((pkt->ethType == PG_ETHER_TYPE_IPv6) && (size < (MIN_v6_PKT_SIZE + PG_ETHER_CRC_LEN)))
+ size = MIN_v6_PKT_SIZE + PG_ETHER_CRC_LEN;
- pkt->pktSize = (size - ETHER_CRC_LEN);
+ pkt->pktSize = (size - PG_ETHER_CRC_LEN);
pktgen_packet_ctor(info, SINGLE_PKT, -1);
- pktgen_packet_rate(info);
}
/**************************************************************************//**
@@ -2572,8 +2757,6 @@ single_set_tx_rate(port_info_t *info, const char *r)
else if (rate > 100.00)
rate = 100.00;
info->tx_rate = rate;
-
- pktgen_packet_rate(info);
}
/**************************************************************************//**
@@ -2614,7 +2797,7 @@ single_set_ipaddr(port_info_t *info, char type, struct pg_ipaddr *ip)
*/
void
-single_set_dst_mac(port_info_t *info, struct ether_addr *mac)
+single_set_dst_mac(port_info_t *info, struct pg_ether_addr *mac)
{
memcpy(&info->seq_pkt[SINGLE_PKT].eth_dst_addr, mac, 6);
pktgen_packet_ctor(info, SINGLE_PKT, -1);
@@ -2633,7 +2816,7 @@ single_set_dst_mac(port_info_t *info, struct ether_addr *mac)
*/
void
-single_set_src_mac(port_info_t *info, struct ether_addr *mac)
+single_set_src_mac(port_info_t *info, struct pg_ether_addr *mac)
{
memcpy(&info->seq_pkt[SINGLE_PKT].eth_src_addr, mac, 6);
pktgen_packet_ctor(info, SINGLE_PKT, -1);
@@ -2664,7 +2847,6 @@ enable_range(port_info_t *info, uint32_t state)
pktgen_set_port_flags(info, SEND_RANGE_PKTS);
} else
pktgen_clr_port_flags(info, SEND_RANGE_PKTS);
- pktgen_packet_rate(info);
}
/**************************************************************************//**
@@ -2780,7 +2962,7 @@ pattern_set_user_pattern(port_info_t *info, char *str)
void
range_set_dest_mac(port_info_t *info,
const char *what,
- struct ether_addr *mac)
+ struct pg_ether_addr *mac)
{
if (!strcmp(what, "min") || !strcmp(what, "minimum"))
inet_mtoh64(mac, &info->range.dst_mac_min);
@@ -2809,7 +2991,7 @@ range_set_dest_mac(port_info_t *info,
void
range_set_src_mac(port_info_t *info, const char *what,
- struct ether_addr *mac)
+ struct pg_ether_addr *mac)
{
if (!strcmp(what, "min") || !strcmp(what, "minimum"))
inet_mtoh64(mac, &info->range.src_mac_min);
@@ -3068,16 +3250,16 @@ void
range_set_pkt_size(port_info_t *info, char *what, uint16_t size)
{
if (!strcmp(what, "inc") || !strcmp(what, "increment")) {
- if (size > ETHER_MAX_LEN)
- size = ETHER_MAX_LEN;
+ if (size > PG_ETHER_MAX_LEN)
+ size = PG_ETHER_MAX_LEN;
info->range.pkt_size_inc = size;
} else {
- if (size < ETHER_MIN_LEN)
+ if (size < PG_ETHER_MIN_LEN)
size = MIN_PKT_SIZE;
- else if (size > ETHER_MAX_LEN)
+ else if (size > PG_ETHER_MAX_LEN)
size = MAX_PKT_SIZE;
else
- size -= ETHER_CRC_LEN;
+ size -= PG_ETHER_CRC_LEN;
if (!strcmp(what, "start") )
info->range.pkt_size = size;
@@ -3218,7 +3400,7 @@ pktgen_set_page(char *str)
void
pktgen_set_seq(port_info_t *info, uint32_t seqnum,
- struct ether_addr *daddr, struct ether_addr *saddr,
+ struct pg_ether_addr *daddr, struct pg_ether_addr *saddr,
struct pg_ipaddr *ip_daddr, struct pg_ipaddr *ip_saddr,
uint32_t sport, uint32_t dport, char type, char proto,
uint16_t vlanid, uint32_t pktsize, uint32_t gtpu_teid)
@@ -3244,13 +3426,13 @@ pktgen_set_seq(port_info_t *info, uint32_t seqnum,
}
pkt->dport = dport;
pkt->sport = sport;
- pkt->pktSize = pktsize - ETHER_CRC_LEN;
+ pkt->pktSize = pktsize - PG_ETHER_CRC_LEN;
pkt->ipProto = (proto == 'u') ? PG_IPPROTO_UDP :
(proto == 'i') ? PG_IPPROTO_ICMP : PG_IPPROTO_TCP;
/* Force the IP protocol to IPv4 if this is a ICMP packet. */
if (proto == 'i')
type = '4';
- pkt->ethType = (type == '6') ? ETHER_TYPE_IPv6 : ETHER_TYPE_IPv4;
+ pkt->ethType = (type == '6') ? PG_ETHER_TYPE_IPv6 : PG_ETHER_TYPE_IPv4;
pkt->vlanid = vlanid;
pkt->gtpu_teid = gtpu_teid;
pktgen_packet_ctor(info, seqnum, -1);
@@ -3293,7 +3475,7 @@ pktgen_set_vxlan_seq(port_info_t *info, uint32_t seqnum, uint32_t flag, uint32_t
void
pktgen_compile_pkt(port_info_t *info, uint32_t seqnum,
- struct ether_addr *daddr, struct ether_addr *saddr,
+ struct pg_ether_addr *daddr, struct pg_ether_addr *saddr,
struct pg_ipaddr *ip_daddr, struct pg_ipaddr *ip_saddr,
uint32_t sport, uint32_t dport, char type, char proto,
uint16_t vlanid, uint32_t pktsize, uint32_t gtpu_teid)
@@ -3312,15 +3494,15 @@ pktgen_compile_pkt(port_info_t *info, uint32_t seqnum,
pkt->ip_dst_addr.addr.ipv4.s_addr = htonl(ip_daddr->ipv4.s_addr);
pkt->dport = dport;
pkt->sport = sport;
- pkt->pktSize = pktsize - ETHER_CRC_LEN;
+ pkt->pktSize = pktsize - PG_ETHER_CRC_LEN;
pkt->ipProto = (proto == 'u') ? PG_IPPROTO_UDP :
(proto == 'i') ? PG_IPPROTO_ICMP : PG_IPPROTO_TCP;
/* Force the IP protocol to IPv4 if this is a ICMP packet. */
if (proto == 'i')
type = '4';
- pkt->ethType = (type == '4') ? ETHER_TYPE_IPv4 :
- (type == '6') ? ETHER_TYPE_IPv6 :
- (type == 'n') ? ETHER_TYPE_VLAN : ETHER_TYPE_IPv4;
+ pkt->ethType = (type == '4') ? PG_ETHER_TYPE_IPv4 :
+ (type == '6') ? PG_ETHER_TYPE_IPv6 :
+ (type == 'n') ? PG_ETHER_TYPE_VLAN : PG_ETHER_TYPE_IPv4;
pkt->vlanid = vlanid;
pkt->gtpu_teid = gtpu_teid;
pktgen_packet_ctor(info, seqnum, -1);
diff --git a/app/pktgen-cmds.h b/app/pktgen-cmds.h
index a4bf87a..2542106 100644
--- a/app/pktgen-cmds.h
+++ b/app/pktgen-cmds.h
@@ -17,7 +17,7 @@
#include "pktgen.h"
#include <rte_string_fns.h>
-#include <rte_portlist.h>
+#include <portlist.h>
#ifdef __cplusplus
"C" {
@@ -71,8 +71,8 @@ void single_set_proto(port_info_t *info, char *type);
void single_set_vlan_id(port_info_t *info, uint16_t vlanid);
void single_set_cos(port_info_t *info, uint8_t cos);
void single_set_tos(port_info_t *info, uint8_t tos);
-void single_set_dst_mac(port_info_t *info, struct ether_addr *mac);
-void single_set_src_mac(port_info_t *info, struct ether_addr *mac);
+void single_set_dst_mac(port_info_t *info, struct pg_ether_addr *mac);
+void single_set_src_mac(port_info_t *info, struct pg_ether_addr *mac);
void single_set_pkt_type(port_info_t *info, const char *type);
void single_set_tx_count(port_info_t *info, uint32_t cnt);
void single_set_tx_burst(port_info_t *info, uint32_t burst);
@@ -96,6 +96,10 @@ void debug_set_rx_cycles(port_info_t *info, uint32_t cycles);
void debug_matrix_dump(void);
void debug_mempool_dump(port_info_t *info, char *name);
void debug_set_port_dump(port_info_t *info, uint32_t cnt);
+void debug_tx_rate(port_info_t *info);
+#ifdef RTE_LIBRTE_PMD_BOND
+void show_bonding_mode(port_info_t *info);
+#endif
/* Enable or toggle types */
void enable_rx_tap(port_info_t *info, uint32_t state);
@@ -113,7 +117,9 @@ void enable_garp(port_info_t *info, uint32_t state);
void enable_mac_from_arp(uint32_t state);
void enable_process(port_info_t *info, int state);
void enable_capture(port_info_t *info, uint32_t state);
+#ifdef RTE_LIBRTE_PMD_BOND
void enable_bonding(port_info_t *info, uint32_t state);
+#endif
void enable_range(port_info_t *info, uint32_t state);
void enable_pcap(port_info_t *info, uint32_t state);
void enable_short_pkts(port_info_t *info, uint32_t state);
@@ -124,10 +130,10 @@ void pcap_filter(port_info_t *info, char *str);
/* Range commands */
void range_set_dest_mac(port_info_t *info,
const char *what,
- struct ether_addr *mac);
+ struct pg_ether_addr *mac);
void range_set_src_mac(port_info_t *info,
const char *what,
- struct ether_addr *mac);
+ struct pg_ether_addr *mac);
void range_set_src_ip(port_info_t *info,
char *what,
struct pg_ipaddr *ip);
@@ -155,8 +161,8 @@ void range_set_gre_key(port_info_t *info, uint32_t gre_key);
void pktgen_set_port_seqCnt(port_info_t *info, uint32_t cnt);
void pktgen_set_seq(port_info_t *info,
uint32_t seqnum,
- struct ether_addr *daddr,
- struct ether_addr *saddr,
+ struct pg_ether_addr *daddr,
+ struct pg_ether_addr *saddr,
struct pg_ipaddr *ip_daddr,
struct pg_ipaddr *ip_saddr,
uint32_t sport,
@@ -178,8 +184,8 @@ void pktgen_recv_pkt(port_info_t *info);
void pktgen_compile_pkt(port_info_t *info,
uint32_t seqnum,
- struct ether_addr *daddr,
- struct ether_addr *saddr,
+ struct pg_ether_addr *daddr,
+ struct pg_ether_addr *saddr,
struct pg_ipaddr *ip_daddr,
struct pg_ipaddr *ip_saddr,
uint32_t sport,
diff --git a/app/pktgen-cpu.c b/app/pktgen-cpu.c
index c5f013a..b1c1c15 100644
--- a/app/pktgen-cpu.c
+++ b/app/pktgen-cpu.c
@@ -6,7 +6,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen-display.h"
#include "pktgen-cpu.h"
diff --git a/app/pktgen-display.c b/app/pktgen-display.c
index 0dfed0e..3499a4c 100644
--- a/app/pktgen-display.c
+++ b/app/pktgen-display.c
@@ -7,7 +7,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
#include <sys/stat.h>
-#include "rte_lua.h"
+#include "lua_config.h"
#include "pktgen-display.h"
#include "pktgen-cmds.h"
diff --git a/app/pktgen-dump.c b/app/pktgen-dump.c
index c915761..9e56c56 100644
--- a/app/pktgen-dump.c
+++ b/app/pktgen-dump.c
@@ -7,7 +7,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
#include <cli_scrn.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen.h"
#include "pktgen-log.h"
@@ -28,7 +28,7 @@ void
pktgen_packet_dump(struct rte_mbuf *m, int pid)
{
port_info_t *info = &pktgen.info[pid];
- int plen = (m->pkt_len + ETHER_CRC_LEN);
+ int plen = (m->pkt_len + PG_ETHER_CRC_LEN);
unsigned char *curr_data;
struct rte_mbuf *curr_mbuf;
diff --git a/app/pktgen-ether.c b/app/pktgen-ether.c
index 998556a..654addd 100644
--- a/app/pktgen-ether.c
+++ b/app/pktgen-ether.c
@@ -22,30 +22,30 @@
*/
char *
-pktgen_ether_hdr_ctor(port_info_t *info, pkt_seq_t *pkt, struct ether_hdr *eth)
+pktgen_ether_hdr_ctor(port_info_t *info, pkt_seq_t *pkt, struct pg_ether_hdr *eth)
{
uint32_t flags;
uint16_t vlan_id;
/* src and dest addr */
- ether_addr_copy(&pkt->eth_src_addr, &eth->s_addr);
- ether_addr_copy(&pkt->eth_dst_addr, &eth->d_addr);
+ pg_ether_addr_copy(&pkt->eth_src_addr, &eth->s_addr);
+ pg_ether_addr_copy(&pkt->eth_dst_addr, &eth->d_addr);
flags = rte_atomic32_read(&info->port_flags);
if (flags & SEND_VLAN_ID) {
/* vlan ethernet header */
- eth->ether_type = htons(ETHER_TYPE_VLAN);
+ eth->ether_type = htons(PG_ETHER_TYPE_VLAN);
/* only set the TCI field for now; don't bother with PCP/DEI */
- struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth + 1);
+ struct pg_vlan_hdr *pg_vlan_hdr = (struct pg_vlan_hdr *)(eth + 1);
vlan_id = (pkt->vlanid | (pkt->cos << 13));
- vlan_hdr->vlan_tci = htons(vlan_id);
- vlan_hdr->eth_proto = htons(pkt->ethType);
+ pg_vlan_hdr->vlan_tci = htons(vlan_id);
+ pg_vlan_hdr->eth_proto = htons(pkt->ethType);
/* adjust header size for VLAN tag */
- pkt->ether_hdr_size = sizeof(struct ether_hdr) +
- sizeof(struct vlan_hdr);
+ pkt->ether_hdr_size = sizeof(struct pg_ether_hdr) +
+ sizeof(struct pg_vlan_hdr);
- return (char *)(vlan_hdr + 1);
+ return (char *)(pg_vlan_hdr + 1);
} else if (flags & SEND_MPLS_LABEL) {
/* MPLS unicast ethernet header */
eth->ether_type = htons(ETHER_TYPE_MPLS_UNICAST);
@@ -60,7 +60,7 @@ pktgen_ether_hdr_ctor(port_info_t *info, pkt_seq_t *pkt, struct ether_hdr *eth)
mpls_hdr->label = htonl(mpls_label);
/* Adjust header size for MPLS label */
- pkt->ether_hdr_size = sizeof(struct ether_hdr) +
+ pkt->ether_hdr_size = sizeof(struct pg_ether_hdr) +
sizeof(mplsHdr_t);
return (char *)(mpls_hdr + 1);
@@ -73,20 +73,20 @@ pktgen_ether_hdr_ctor(port_info_t *info, pkt_seq_t *pkt, struct ether_hdr *eth)
/* only set the TCI field for now; don't bother with PCP/DEI */
qinq_hdr->qinq_tci = htons(pkt->qinq_outerid);
- qinq_hdr->vlan_tpid = htons(ETHER_TYPE_VLAN);
+ qinq_hdr->vlan_tpid = htons(PG_ETHER_TYPE_VLAN);
qinq_hdr->vlan_tci = htons(pkt->qinq_innerid);
qinq_hdr->eth_proto = htons(pkt->ethType);
/* Adjust header size for Q-in-Q header */
- pkt->ether_hdr_size = sizeof(struct ether_hdr) +
+ pkt->ether_hdr_size = sizeof(struct pg_ether_hdr) +
sizeof(qinqHdr_t);
return (char *)(qinq_hdr + 1);
} else {
/* normal ethernet header */
eth->ether_type = htons(pkt->ethType);
- pkt->ether_hdr_size = sizeof(struct ether_hdr);
+ pkt->ether_hdr_size = sizeof(struct pg_ether_hdr);
}
return (char *)(eth + 1);
diff --git a/app/pktgen-ether.h b/app/pktgen-ether.h
index 1d9d986..da433d3 100644
--- a/app/pktgen-ether.h
+++ b/app/pktgen-ether.h
@@ -22,7 +22,7 @@ struct port_info_s;
char *pktgen_ether_hdr_ctor(struct port_info_s *info,
pkt_seq_t *pkt,
- struct ether_hdr *eth);
+ struct pg_ether_hdr *eth);
#ifdef __cplusplus
}
diff --git a/app/pktgen-gre.c b/app/pktgen-gre.c
index 7511518..804a132 100644
--- a/app/pktgen-gre.c
+++ b/app/pktgen-gre.c
@@ -7,7 +7,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
#include <cli_scrn.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include <rte_net.h>
#include "pktgen-gre.h"
@@ -33,7 +33,7 @@ pktgen_gre_hdr_ctor(port_info_t *info __rte_unused, pkt_seq_t *pkt,
memset((char *)gre, 0, sizeof(greIp_t));
/* Create the IP header */
- gre->ip.version_ihl = (IPv4_VERSION << 4) | (sizeof(struct ipv4_hdr) / 4);
+ gre->ip.version_ihl = (IPv4_VERSION << 4) | (sizeof(struct pg_ipv4_hdr) / 4);
gre->ip.type_of_service = 0;
gre->ip.total_length = htons(pkt->pktSize - pkt->ether_hdr_size);
@@ -63,7 +63,7 @@ pktgen_gre_hdr_ctor(port_info_t *info __rte_unused, pkt_seq_t *pkt,
gre->gre.reserved0_1 = 0;
gre->gre.version = 0;
- gre->gre.eth_type = htons(ETHER_TYPE_IPv4); /* FIXME get EtherType of the actual encapsulated packet instead of
+ gre->gre.eth_type = htons(PG_ETHER_TYPE_IPv4); /* FIXME get EtherType of the actual encapsulated packet instead of
* defaulting to IPv4 */
int extra_count = 0;
@@ -112,7 +112,7 @@ pktgen_gre_ether_hdr_ctor(port_info_t *info __rte_unused,
memset((char *)gre, 0, sizeof(greEther_t));
/* Create the IP header */
- gre->ip.version_ihl = (IPv4_VERSION << 4) | (sizeof(struct ipv4_hdr) / 4);
+ gre->ip.version_ihl = (IPv4_VERSION << 4) | (sizeof(struct pg_ipv4_hdr) / 4);
gre->ip.type_of_service = 0;
gre->ip.total_length = htons(pkt->pktSize - pkt->ether_hdr_size);
@@ -165,13 +165,13 @@ pktgen_gre_ether_hdr_ctor(port_info_t *info __rte_unused,
/* Inner Ethernet header. Exact offset of start of ethernet header depends
* on the presence of optional fields in the GRE header. */
- struct ether_hdr *eth_hdr = (struct ether_hdr *)((char *)&gre->gre
+ struct pg_ether_hdr *eth_hdr = (struct pg_ether_hdr *)((char *)&gre->gre
+ 2 /* Flags and version */
+ 2 /* Protocol type */
+ 4 * extra_count); /* 4 bytes per optional field */
- ether_addr_copy(&pkt->eth_src_addr, &eth_hdr->s_addr); /* FIXME get inner Ethernet parameters from user */
- ether_addr_copy(&pkt->eth_dst_addr, &eth_hdr->d_addr); /* FIXME get inner Ethernet parameters from user */
- eth_hdr->ether_type = htons(ETHER_TYPE_IPv4); /* FIXME get Ethernet type from actual encapsulated
+ pg_ether_addr_copy(&pkt->eth_src_addr, &eth_hdr->s_addr); /* FIXME get inner Ethernet parameters from user */
+ pg_ether_addr_copy(&pkt->eth_dst_addr, &eth_hdr->d_addr); /* FIXME get inner Ethernet parameters from user */
+ eth_hdr->ether_type = htons(PG_ETHER_TYPE_IPv4); /* FIXME get Ethernet type from actual encapsulated
* packet instead of hardcoding */
/* 4 * (3 - extra_count) is the amount of bytes that are not used by */
diff --git a/app/pktgen-gtpu.c b/app/pktgen-gtpu.c
index 0774c67..6722c6a 100644
--- a/app/pktgen-gtpu.c
+++ b/app/pktgen-gtpu.c
@@ -7,7 +7,7 @@
/* Created 2015 by abhinandan.gujjar@intel.com */
#include <cli_scrn.h>
-#include "rte_lua.h"
+#include "lua_config.h"
#include "pktgen.h"
@@ -36,11 +36,11 @@ pktgen_gtpu_hdr_ctor(pkt_seq_t *pkt, void *hdr, uint16_t ipProto,
void *p;
if (ipProto == PG_IPPROTO_UDP)
- l4HdrSize = sizeof(struct udp_hdr);
+ l4HdrSize = sizeof(struct pg_udp_hdr);
else
- l4HdrSize = sizeof(struct tcp_hdr);
+ l4HdrSize = sizeof(struct pg_tcp_hdr);
- gtppHdr = (gtpuHdr_t *)RTE_PTR_ADD(hdr, sizeof(struct ipv4_hdr) + l4HdrSize);
+ gtppHdr = (gtpuHdr_t *)RTE_PTR_ADD(hdr, sizeof(struct pg_ipv4_hdr) + l4HdrSize);
/* Zero out the header space */
memset((char *)gtppHdr, 0, sizeof(gtpuHdr_t));
diff --git a/app/pktgen-ipv4.c b/app/pktgen-ipv4.c
index 5794c05..8cd7637 100644
--- a/app/pktgen-ipv4.c
+++ b/app/pktgen-ipv4.c
@@ -9,7 +9,7 @@
#include <arpa/inet.h>
#include <cli_scrn.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen.h"
#include "pktgen-log.h"
@@ -30,16 +30,16 @@
void
pktgen_ipv4_ctor(pkt_seq_t *pkt, void *hdr)
{
- struct ipv4_hdr *ip = hdr;
+ struct pg_ipv4_hdr *ip = hdr;
uint16_t tlen;
/* IPv4 Header constructor */
tlen = pkt->pktSize - pkt->ether_hdr_size;
/* Zero out the header space */
- memset((char *)ip, 0, sizeof(struct ipv4_hdr));
+ memset((char *)ip, 0, sizeof(struct pg_ipv4_hdr));
- ip->version_ihl = (IPv4_VERSION << 4) | (sizeof(struct ipv4_hdr) / 4);
+ ip->version_ihl = (IPv4_VERSION << 4) | (sizeof(struct pg_ipv4_hdr) / 4);
ip->total_length = htons(tlen);
ip->time_to_live = 4;
@@ -52,7 +52,7 @@ pktgen_ipv4_ctor(pkt_seq_t *pkt, void *hdr)
ip->src_addr = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);
ip->dst_addr = htonl(pkt->ip_dst_addr.addr.ipv4.s_addr);
ip->hdr_checksum = 0;
- ip->hdr_checksum = rte_ipv4_cksum((const struct ipv4_hdr *)ip);
+ ip->hdr_checksum = rte_ipv4_cksum((const struct pg_ipv4_hdr *)ip);
}
/**************************************************************************//**
@@ -111,24 +111,24 @@ pktgen_process_ping4(struct rte_mbuf *m, uint32_t pid, uint32_t vlan)
{
port_info_t *info = &pktgen.info[pid];
pkt_seq_t *pkt;
- struct ether_hdr *eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
- struct ipv4_hdr *ip = (struct ipv4_hdr *)&eth[1];
+ struct pg_ether_hdr *eth = rte_pktmbuf_mtod(m, struct pg_ether_hdr *);
+ struct pg_ipv4_hdr *ip = (struct pg_ipv4_hdr *)&eth[1];
char buff[24];
/* Adjust for a vlan header if present */
if (vlan)
- ip = (struct ipv4_hdr *)((char *)ip + sizeof(struct vlan_hdr));
+ ip = (struct pg_ipv4_hdr *)((char *)ip + sizeof(struct pg_vlan_hdr));
/* Look for a ICMP echo requests, but only if enabled. */
if ( (rte_atomic32_read(&info->port_flags) & ICMP_ECHO_ENABLE_FLAG) &&
(ip->next_proto_id == PG_IPPROTO_ICMP) ) {
- struct icmp_hdr *icmp =
- (struct icmp_hdr *)((uintptr_t)ip + sizeof(struct ipv4_hdr));
+ struct pg_icmp_hdr *icmp =
+ (struct pg_icmp_hdr *)((uintptr_t)ip + sizeof(struct pg_ipv4_hdr));
/* We do not handle IP options, which will effect the IP header size. */
if (unlikely(rte_raw_cksum(icmp,
- (m->data_len - sizeof(struct ether_hdr) -
- sizeof(struct ipv4_hdr)))) ) {
+ (m->data_len - sizeof(struct pg_ether_hdr) -
+ sizeof(struct pg_ipv4_hdr)))) ) {
pktgen_log_error("ICMP checksum failed");
return;
}
@@ -164,8 +164,8 @@ pktgen_process_ping4(struct rte_mbuf *m, uint32_t pid, uint32_t vlan)
icmp->icmp_cksum = 0;
icmp->icmp_cksum =
rte_raw_cksum(icmp,
- (m->data_len - sizeof(struct ether_hdr) -
- sizeof(struct ipv4_hdr)));
+ (m->data_len - sizeof(struct pg_ether_hdr) -
+ sizeof(struct pg_ipv4_hdr)));
/* Swap the IP addresses. */
inetAddrSwap(&ip->src_addr, &ip->dst_addr);
@@ -175,7 +175,7 @@ pktgen_process_ping4(struct rte_mbuf *m, uint32_t pid, uint32_t vlan)
/* Recompute the IP checksum */
ip->hdr_checksum = 0;
- ip->hdr_checksum = rte_raw_cksum(ip, sizeof(struct ipv4_hdr));
+ ip->hdr_checksum = rte_raw_cksum(ip, sizeof(struct pg_ipv4_hdr));
/* Swap the MAC addresses */
ethAddrSwap(&eth->d_addr, &eth->s_addr);
diff --git a/app/pktgen-ipv6.c b/app/pktgen-ipv6.c
index 4c587db..2e16b60 100644
--- a/app/pktgen-ipv6.c
+++ b/app/pktgen-ipv6.c
@@ -7,7 +7,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
#include <cli_scrn.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen.h"
@@ -28,14 +28,14 @@
void
pktgen_ipv6_ctor(pkt_seq_t *pkt, void *hdr)
{
- struct ipv6_hdr *ip = hdr;
+ struct pg_ipv6_hdr *ip = hdr;
uint16_t tlen;
/* IPv6 Header constructor */
- memset(ip, 0, sizeof(struct ipv6_hdr));
+ memset(ip, 0, sizeof(struct pg_ipv6_hdr));
ip->vtc_flow = htonl(IPv6_VERSION << 28);
- tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct ipv6_hdr));
+ tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct pg_ipv6_hdr));
ip->payload_len = htons(tlen);
ip->hop_limits = 4;
@@ -67,27 +67,27 @@ pktgen_process_ping6(struct rte_mbuf *m __rte_unused,
{
#if 0 /* Broken needs to be updated to do IPv6 packets */
port_info_t *info = &pktgen.info[pid];
- struct ether_hdr *eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
- struct ipv6_hdr *ip = (struct ipv6_hdr *)&eth[1];
+ struct pg_ether_hdr *eth = rte_pktmbuf_mtod(m, struct pg_ether_hdr *);
+ struct pg_ipv6_hdr *ip = (struct pg_ipv6_hdr *)&eth[1];
/* Adjust for a vlan header if present */
if (vlan)
- ip = (struct ipv6_hdr *)((char *)ip + sizeof(struct vlan_hdr));
+ ip = (struct pg_ipv6_hdr *)((char *)ip + sizeof(struct pg_vlan_hdr));
/* Look for a ICMP echo requests, but only if enabled. */
if ( (rte_atomic32_read(&info->port_flags) & ICMP_ECHO_ENABLE_FLAG) &&
(ip->next_header == PG_IPPROTO_ICMPV6) ) {
#if !defined(RTE_ARCH_X86_64)
- struct icmp_hdr *icmp =
- (struct icmp_hdr *)((uint32_t)ip + sizeof(struct ipv4_hdr));
+ struct pg_icmp_hdr *icmp =
+ (struct pg_icmp_hdr *)((uint32_t)ip + sizeof(struct pg_ipv4_hdr));
#else
- struct icmp_hdr *icmp =
- (struct icmp_hdr *)((uint64_t)ip + sizeof(struct ipv4_hdr));
+ struct pg_icmp_hdr *icmp =
+ (struct pg_icmp_hdr *)((uint64_t)ip + sizeof(struct pg_ipv4_hdr));
#endif
/* We do not handle IP options, which will effect the IP header size. */
if (rte_ipv6_cksum(icmp,
- (m->pkt.data_len - sizeof(struct ether_hdr) -
- sizeof(struct ipv4_hdr))) ) {
+ (m->pkt.data_len - sizeof(struct pg_ether_hdr) -
+ sizeof(struct pg_ipv4_hdr))) ) {
rte_printf_status("ICMP checksum failed\n");
goto leave :
}
@@ -118,8 +118,8 @@ pktgen_process_ping6(struct rte_mbuf *m __rte_unused,
icmp->cksum =
rte_raw_cksum(icmp,
(m->pkt.data_len -
- sizeof(struct ether_hdr) -
- sizeof(struct ipv4_hdr)));
+ sizeof(struct pg_ether_hdr) -
+ sizeof(struct pg_ipv4_hdr)));
/* Swap the IP addresses. */
inetAddrSwap(&ip->src, &ip->dst);
@@ -129,7 +129,7 @@ pktgen_process_ping6(struct rte_mbuf *m __rte_unused,
/* Recompute the IP checksum */
ip->cksum = 0;
- ip->cksum = rte_raw_cksum(ip, sizeof(struct ipv4_hdr));
+ ip->cksum = rte_raw_cksum(ip, sizeof(struct pg_ipv4_hdr));
/* Swap the MAC addresses */
ethAddrSwap(&eth->d_addr, &eth->s_addr);
diff --git a/app/pktgen-latency.c b/app/pktgen-latency.c
index f786eb4..db42d29 100644
--- a/app/pktgen-latency.c
+++ b/app/pktgen-latency.c
@@ -8,7 +8,7 @@
#include <stdio.h>
-#include "rte_lua.h"
+#include "lua_config.h"
#include "pktgen-cmds.h"
#include "pktgen-display.h"
@@ -114,14 +114,14 @@ pktgen_print_static_data(void)
pktgen_transmit_count_rate(pid, buff, sizeof(buff));
scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff);
- snprintf(buff, sizeof(buff), "%d /%5d", pkt->pktSize + ETHER_CRC_LEN, info->tx_burst);
+ snprintf(buff, sizeof(buff), "%d /%5d", pkt->pktSize + PG_ETHER_CRC_LEN, info->tx_burst);
scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff);
snprintf(buff, sizeof(buff), "%d /%5d", pkt->sport, pkt->dport);
scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff);
snprintf(buff, sizeof(buff), "%s / %s:%04x",
- (pkt->ethType == ETHER_TYPE_IPv4) ? "IPv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "IPv6" :
- (pkt->ethType == ETHER_TYPE_ARP) ? "ARP" : "Other",
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "IPv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "IPv6" :
+ (pkt->ethType == PG_ETHER_TYPE_ARP) ? "ARP" : "Other",
(pkt->ipProto == PG_IPPROTO_TCP) ? "TCP" :
(pkt->ipProto == PG_IPPROTO_ICMP) ? "ICMP" : "UDP",
pkt->vlanid);
diff --git a/app/pktgen-log.c b/app/pktgen-log.c
index 4e15117..9862396 100644
--- a/app/pktgen-log.c
+++ b/app/pktgen-log.c
@@ -16,7 +16,7 @@
#include <libgen.h>
#include <sys/stat.h>
-#include "rte_lua.h"
+#include "lua_config.h"
#include "pktgen-display.h"
#include <rte_rwlock.h>
diff --git a/app/pktgen-log.h b/app/pktgen-log.h
index 8d132d8..0373716 100644
--- a/app/pktgen-log.h
+++ b/app/pktgen-log.h
@@ -97,7 +97,7 @@ extern "C" {
#define pktgen_log_panic(fmt, ...) do { \
pktgen_log(LOG_LEVEL_PANIC, __FILE__, __LINE__, __FUNCTION__, \
fmt, ## __VA_ARGS__); \
- rte_panic(fmt, ## __VA_ARGS__); \
+ rte_panic(fmt "\n", ## __VA_ARGS__); \
} while (0)
#else
#define pktgen_log_panic(fmt, ...) rte_panic(fmt, ## __VA_ARGS__)
diff --git a/app/pktgen-main.c b/app/pktgen-main.c
index 6b9d90e..e529a9c 100644
--- a/app/pktgen-main.c
+++ b/app/pktgen-main.c
@@ -9,8 +9,9 @@
#include <execinfo.h>
#include <signal.h>
-#include <rte_lua.h>
-#include <rte_lua_socket.h>
+#include <lua_config.h>
+#include <lua_socket.h>
+#include <_delay.h>
#include "pktgen-main.h"
@@ -252,7 +253,7 @@ pktgen_parse_args(int argc, char **argv)
pktgen.flags |= ENABLE_THEME_FLAG;
break;
case 'v':
- pktgen.verbose =- 1;
+ pktgen.verbose = 1;
break;
case 'h': /* print out the help message */
diff --git a/app/pktgen-pcap.c b/app/pktgen-pcap.c
index fbd2bd4..dcb650f 100644
--- a/app/pktgen-pcap.c
+++ b/app/pktgen-pcap.c
@@ -5,7 +5,7 @@
*/
/* Created 2010 by Keith Wiles @ intel.com */
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen-display.h"
#include "pktgen-log.h"
@@ -98,7 +98,7 @@ pktgen_print_pcap(uint16_t pid)
}
/* Skip packets that are not normal IP packets. */
type = ntohs( ((uint16_t *)pkt_buff)[6]);
- if (unlikely(type == ETHER_TYPE_VLAN) )
+ if (unlikely(type == PG_ETHER_TYPE_VLAN) )
type = ntohs( ((uint16_t *)pkt_buff)[8]);
if (unlikely(type < MAX_ETHER_TYPE_SIZE) )
@@ -120,13 +120,13 @@ pktgen_print_pcap(uint16_t pid)
type = ntohs(hdr->eth.ether_type);
proto = hdr->u.ipv4.next_proto_id;
vlan = 0;
- if (type == ETHER_TYPE_VLAN) {
+ if (type == PG_ETHER_TYPE_VLAN) {
vlan = ntohs( ((uint16_t *)&hdr->eth.ether_type)[1]);
type = ntohs( ((uint16_t *)&hdr->eth.ether_type)[2]);
- proto = ((struct ipv4_hdr *)((char *)&hdr->u.ipv4 + 4))->next_proto_id;
+ proto = ((struct pg_ipv4_hdr *)((char *)&hdr->u.ipv4 + 4))->next_proto_id;
}
- if (type == ETHER_TYPE_IPv4) {
+ if (type == PG_ETHER_TYPE_IPv4) {
scrn_printf(row,
col,
"%*s",
@@ -154,8 +154,8 @@ pktgen_print_pcap(uint16_t pid)
col += ((2 * COLUMN_WIDTH_1) + 2 + 12);
}
snprintf(buff, sizeof(buff), "%s/%s:%4d",
- (type == ETHER_TYPE_IPv4) ? "IPv4" :
- (type == ETHER_TYPE_IPv6) ? "IPv6" : "Other",
+ (type == PG_ETHER_TYPE_IPv4) ? "IPv4" :
+ (type == PG_ETHER_TYPE_IPv6) ? "IPv6" : "Other",
(type == PG_IPPROTO_TCP) ? "TCP" :
(proto == PG_IPPROTO_ICMP) ? "ICMP" : "UDP",
(vlan & 0xFFF));
@@ -163,9 +163,9 @@ pktgen_print_pcap(uint16_t pid)
col += 15;
scrn_printf(row, col, "%5d", len);
- if (skip && (type < ETHER_TYPE_IPv4) )
+ if (skip && (type < PG_ETHER_TYPE_IPv4) )
scrn_printf(row, col + 7, "<<< Skip %04x", type);
- else if (skip && (type != ETHER_TYPE_IPv4) )
+ else if (skip && (type != PG_ETHER_TYPE_IPv4) )
scrn_printf(row, col + 7, " EthType %04x", type);
row++;
}
diff --git a/app/pktgen-port-cfg.c b/app/pktgen-port-cfg.c
index fb2873e..f9ab1b5 100644
--- a/app/pktgen-port-cfg.c
+++ b/app/pktgen-port-cfg.c
@@ -6,8 +6,9 @@
/* Created 2010 by Keith Wiles @ intel.com */
+#include <_delay.h>
#include <cli_scrn.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen-port-cfg.h"
@@ -15,15 +16,14 @@
#include "pktgen-cmds.h"
#include "pktgen-log.h"
-#include <rte_link.h>
-
-#if RTE_VERSION >= RTE_VERSION_NUM(18, 5, 0, 0)
-#define rte_eth_dev_count rte_eth_dev_count_avail
-#endif
+#include <link.h>
#ifdef RTE_LIBRTE_BONDING_PMD
#include <rte_eth_bond_8023ad.h>
#endif
+#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0)
+#include <rte_bus_pci.h>
+#endif
enum {
RX_PTHRESH = 8, /**< Default values of RX prefetch threshold reg. */
@@ -42,7 +42,7 @@ static struct rte_eth_conf default_port_conf = {
#if RTE_VERSION <= RTE_VERSION_NUM(18, 5, 0, 0)
.rxmode = {
.mq_mode = ETH_MQ_RX_RSS,
- .max_rx_pkt_len = ETHER_MAX_LEN,
+ .max_rx_pkt_len = PG_ETHER_MAX_LEN,
.split_hdr_size = 0,
.ignore_offload_bitfield = 1,
.offloads = (DEV_RX_OFFLOAD_CRC_STRIP |
@@ -64,6 +64,12 @@ static struct rte_eth_conf default_port_conf = {
.offloads = DEV_RX_OFFLOAD_CRC_STRIP,
#endif
},
+ .rx_adv_conf = {
+ .rss_conf = {
+ .rss_key = NULL,
+ .rss_hf = ETH_RSS_IP,
+ },
+ },
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
},
@@ -79,7 +85,7 @@ pktgen_set_hw_strip_crc(uint8_t val)
int
pktgen_get_hw_strip_crc(void)
{
- return (hw_strip_crc)? ETHER_CRC_LEN : 0;
+ return (hw_strip_crc)? PG_ETHER_CRC_LEN : 0;
}
/**************************************************************************//**
@@ -141,6 +147,7 @@ pktgen_mbuf_pool_create(const char *type, uint8_t pid, uint8_t queue_id,
void
pktgen_config_ports(void)
{
+ struct rte_eth_conf conf;
uint32_t lid, pid, i, s, q, sid;
rxtx_t rt;
pkt_seq_t *pkt;
@@ -152,10 +159,53 @@ pktgen_config_ports(void)
/* Find out the total number of ports in the system. */
/* We have already blacklisted the ones we needed to in main routine. */
- pktgen.nb_ports = rte_eth_dev_count();
+ pktgen.nb_ports = pg_eth_dev_count_avail();
if (pktgen.nb_ports > RTE_MAX_ETHPORTS)
pktgen.nb_ports = RTE_MAX_ETHPORTS;
+ printf(" %-4s %-12s %-6s %-12s %-5s %s\n", "Port:", "Name", "IfIndex", "Alias", "NUMA", "PCI");
+ for(i = 0; i < pktgen.nb_ports; i++) {
+ struct rte_eth_dev_info dev;
+ char buff[64];
+
+ rte_eth_dev_info_get(i, &dev);
+
+ buff[0] = 0;
+ printf(" %2d: %-12s %2d %-12s %2d ", i, dev.driver_name,
+ dev.if_index,
+ (dev.device->driver->alias)? dev.device->driver->alias : "",
+ dev.device->numa_node);
+#if RTE_VERSION < RTE_VERSION_NUM(18, 4, 0, 0)
+ if (dev.pci_dev) {
+ snprintf(buff, sizeof(buff), "%04x:%04x/%02x:%02d.%d",
+ dev.pci_dev->id.vendor_id,
+ dev.pci_dev->id.device_id,
+ dev.pci_dev->addr.bus,
+ dev.pci_dev->addr.devid,
+ dev.pci_dev->addr.function);
+ }
+#else
+ {
+ struct rte_bus *bus;
+ if (dev.device)
+ bus = rte_bus_find_by_device(dev.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev.device);
+ snprintf(buff, sizeof(buff), "%04x:%04x/%02x:%02d.%d",
+ pci_dev->id.vendor_id,
+ pci_dev->id.device_id,
+ pci_dev->addr.bus,
+ pci_dev->addr.devid,
+ pci_dev->addr.function);
+ }
+ }
+#endif
+ printf("%s\n", buff);
+ }
+ printf("\n");
+
if (pktgen.nb_ports == 0)
pktgen_log_panic("*** Did not find any ports to use ***");
@@ -241,11 +291,31 @@ pktgen_config_ports(void)
if (pktgen.verbose)
rte_eth_dev_info_dump(NULL, pid);
+ /* Get a clean copy of the configuration structure */
+ rte_memcpy(&conf, &default_port_conf, sizeof(struct rte_eth_conf));
+
if (info->dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
- default_port_conf.txmode.offloads |=
- DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+ conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+
+ if (rt.rx > 1) {
+ conf.rx_adv_conf.rss_conf.rss_key = NULL;
+ conf.rx_adv_conf.rss_conf.rss_hf &=
+ info->dev_info.flow_type_rss_offloads;
+ } else {
+ conf.rx_adv_conf.rss_conf.rss_key = NULL;
+ conf.rx_adv_conf.rss_conf.rss_hf = 0;
+ }
+
+ /* May need to add DCB configuration
+ if (port->dcb_flag == 0) {
+ if( port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
+ port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
+ else
+ port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
+ }
+ */
- if ( (ret = rte_eth_dev_configure(pid, rt.rx, rt.tx, &default_port_conf)) < 0)
+ if ( (ret = rte_eth_dev_configure(pid, rt.rx, rt.tx, &conf)) < 0)
pktgen_log_panic(
"Cannot configure device: port=%d, Num queues %d,%d (%d)%s",
pid, rt.rx, rt.tx, -ret, rte_strerror(-ret));
@@ -329,7 +399,7 @@ pktgen_config_ports(void)
pktgen_log_panic("Cannot load PCAP file for port %d", pid);
/* Find out the link speed to program the WTHRESH value correctly. */
- rte_link_status_check(pid, &info->link);
+ pktgen_get_link_status(&pktgen.info[pid], pid, 0);
txconf = &info->dev_info.default_txconf;
#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
@@ -390,7 +460,8 @@ pktgen_config_ports(void)
info = get_port_private(pktgen.l2p, pid);
- rte_link_status_check(pid, &info->link);
+ /* Find out the link speed to program the WTHRESH value correctly. */
+ pktgen_get_link_status(&pktgen.info[pid], pid, 0);
if (info->link.link_status)
snprintf(output_buff, sizeof(output_buff),
diff --git a/app/pktgen-port-cfg.h b/app/pktgen-port-cfg.h
index 04edc1b..5233761 100644
--- a/app/pktgen-port-cfg.h
+++ b/app/pktgen-port-cfg.h
@@ -382,9 +382,13 @@ rte_get_rx_capa_list(uint64_t rx_capa, char *buf, size_t len)
{ DEV_RX_OFFLOAD_SCATTER, _(SCATTER) },
{ DEV_RX_OFFLOAD_TIMESTAMP, _(TIMESTAMP) },
{ DEV_RX_OFFLOAD_SECURITY, _(SECURITY) },
+#if RTE_VERSION < RTE_VERSION_NUM(18,11,0,0)
+ { DEV_RX_OFFLOAD_KEEP_CRC, _(KEEP_CRC) }
+#else
{ DEV_RX_OFFLOAD_KEEP_CRC, _(KEEP_CRC) },
{ DEV_RX_OFFLOAD_SCTP_CKSUM, _(SCTP_CKSUM) },
{ DEV_RX_OFFLOAD_OUTER_UDP_CKSUM, _(OUTER_UDP_CKSUM) }
+#endif
};
#undef _
@@ -436,9 +440,13 @@ rte_get_tx_capa_list(uint64_t tx_capa, char *buf, size_t len)
{ DEV_TX_OFFLOAD_MBUF_FAST_FREE, _(MBUF_FAST_FREE) },
{ DEV_TX_OFFLOAD_SECURITY, _(SECURITY) },
{ DEV_TX_OFFLOAD_UDP_TNL_TSO, _(UDP_TNL_TSO) },
+#if RTE_VERSION < RTE_VERSION_NUM(18,11,0,0)
+ { DEV_TX_OFFLOAD_IP_TNL_TSO, _(IP_TNL_TSO) }
+#else
{ DEV_TX_OFFLOAD_IP_TNL_TSO, _(IP_TNL_TSO) },
{ DEV_TX_OFFLOAD_OUTER_UDP_CKSUM, _(OUTER_UDP_CKSUM) },
{ DEV_TX_OFFLOAD_MATCH_METADATA, _(MATCH_METADATA) },
+#endif
};
#undef _
diff --git a/app/pktgen-random.c b/app/pktgen-random.c
index 0759e0a..46c03df 100644
--- a/app/pktgen-random.c
+++ b/app/pktgen-random.c
@@ -14,7 +14,7 @@
#include <rte_malloc.h>
-#include "rte_lua.h"
+#include "lua_config.h"
#include "pktgen-display.h"
#include "pktgen-log.h"
diff --git a/app/pktgen-range.c b/app/pktgen-range.c
index a8f62cd..663bb2d 100644
--- a/app/pktgen-range.c
+++ b/app/pktgen-range.c
@@ -5,7 +5,7 @@
*/
/* Created 2010 by Keith Wiles @ intel.com */
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen-display.h"
#include "pktgen-log.h"
@@ -27,7 +27,7 @@ void
pktgen_range_ctor(range_info_t *range, pkt_seq_t *pkt)
{
switch (pkt->ethType) {
- case ETHER_TYPE_IPv4:
+ case PG_ETHER_TYPE_IPv4:
switch (pkt->ipProto) {
case PG_IPPROTO_TCP:
case PG_IPPROTO_UDP:
@@ -215,7 +215,7 @@ pktgen_range_ctor(range_info_t *range, pkt_seq_t *pkt)
break;
}
break;
- case ETHER_TYPE_IPv6:
+ case PG_ETHER_TYPE_IPv6:
switch (pkt->ipProto) {
case PG_IPPROTO_UDP:
case PG_IPPROTO_TCP:
@@ -254,7 +254,7 @@ pktgen_print_range(void)
char buff[32];
int32_t row;
int32_t col_0 = COLUMN_WIDTH_0 + 1, col_1 = COLUMN_WIDTH_1 + 4;
- struct ether_addr eaddr;
+ struct pg_ether_addr eaddr;
char str[64];
pktgen_display_set_color("top.page");
@@ -271,38 +271,38 @@ pktgen_print_range(void)
row++;
scrn_printf(row++, 1, "%-*s", col_0, "dst.ip");
- scrn_printf(row++, 1, "%-*s", col_0, " inc");
scrn_printf(row++, 1, "%-*s", col_0, " min");
scrn_printf(row++, 1, "%-*s", col_0, " max");
+ scrn_printf(row++, 1, "%-*s", col_0, " inc");
row++;
scrn_printf(row++, 1, "%-*s", col_0, "src.ip");
- scrn_printf(row++, 1, "%-*s", col_0, " inc");
scrn_printf(row++, 1, "%-*s", col_0, " min");
scrn_printf(row++, 1, "%-*s", col_0, " max");
+ scrn_printf(row++, 1, "%-*s", col_0, " inc");
row++;
- scrn_printf(row++, 1, "%-*s", col_0, "dst.port :inc/min/max");
- scrn_printf(row++, 1, "%-*s", col_0, "src.port :inc/min/max");
- scrn_printf(row++, 1, "%-*s", col_0, "vlan.id :inc/min/max");
- scrn_printf(row++, 1, "%-*s", col_0, "cos :inc/min/max");
- scrn_printf(row++, 1, "%-*s", col_0, "tos :inc/min/max");
- scrn_printf(row++, 1, "%-*s", col_0, "pkt.size :inc/min/max");
- scrn_printf(row++, 1, "%-*s", col_0, "gtpu.teid:inc/min/max");
- scrn_printf(row++, 1, "%-*s", col_0, "vxlan.gid:inc/min/max");
- scrn_printf(row++, 1, "%-*s", col_0, " vid:inc/min/max");
+ scrn_printf(row++, 1, "%-*s", col_0, "dst.port :min/max/inc");
+ scrn_printf(row++, 1, "%-*s", col_0, "src.port :min/max/inc");
+ scrn_printf(row++, 1, "%-*s", col_0, "vlan.id :min/max/inc");
+ scrn_printf(row++, 1, "%-*s", col_0, "cos :min/max/inc");
+ scrn_printf(row++, 1, "%-*s", col_0, "tos :min/max/inc");
+ scrn_printf(row++, 1, "%-*s", col_0, "pkt.size :min/max/inc");
+ scrn_printf(row++, 1, "%-*s", col_0, "gtpu.teid:min/max/inc");
+ scrn_printf(row++, 1, "%-*s", col_0, "vxlan.gid:min/max/inc");
+ scrn_printf(row++, 1, "%-*s", col_0, " vid:min/max/inc");
row++;
scrn_printf(row++, 1, "%-*s", col_0, "dst.mac");
- scrn_printf(row++, 1, "%-*s", col_0, " inc");
scrn_printf(row++, 1, "%-*s", col_0, " min");
scrn_printf(row++, 1, "%-*s", col_0, " max");
+ scrn_printf(row++, 1, "%-*s", col_0, " inc");
row++;
scrn_printf(row++, 1, "%-*s", col_0, "src.mac");
- scrn_printf(row++, 1, "%-*s", col_0, " inc");
scrn_printf(row++, 1, "%-*s", col_0, " min");
scrn_printf(row++, 1, "%-*s", col_0, " max");
+ scrn_printf(row++, 1, "%-*s", col_0, " inc");
/* Get the last location to use for the window starting row. */
pktgen.last_row = ++row;
@@ -342,15 +342,15 @@ pktgen_print_range(void)
0xFFFFFFFF));
scrn_printf(row++, col, "%*s", col_1,
inet_ntop4(buff, sizeof(buff),
- htonl(range->dst_ip_inc),
+ htonl(range->dst_ip_min),
0xFFFFFFFF));
scrn_printf(row++, col, "%*s", col_1,
inet_ntop4(buff, sizeof(buff),
- htonl(range->dst_ip_min),
+ htonl(range->dst_ip_max),
0xFFFFFFFF));
scrn_printf(row++, col, "%*s", col_1,
inet_ntop4(buff, sizeof(buff),
- htonl(range->dst_ip_max),
+ htonl(range->dst_ip_inc),
0xFFFFFFFF));
row++;
@@ -360,15 +360,15 @@ pktgen_print_range(void)
0xFFFFFFFF));
scrn_printf(row++, col, "%*s", col_1,
inet_ntop4(buff, sizeof(buff),
- htonl(range->src_ip_inc),
+ htonl(range->src_ip_min),
0xFFFFFFFF));
scrn_printf(row++, col, "%*s", col_1,
inet_ntop4(buff, sizeof(buff),
- htonl(range->src_ip_min),
+ htonl(range->src_ip_max),
0xFFFFFFFF));
scrn_printf(row++, col, "%*s", col_1,
inet_ntop4(buff, sizeof(buff),
- htonl(range->src_ip_max),
+ htonl(range->src_ip_inc),
0xFFFFFFFF));
row++;
@@ -376,73 +376,81 @@ pktgen_print_range(void)
sizeof(str),
"%5d:%5d/%5d/%5d",
range->dst_port,
- range->dst_port_inc,
range->dst_port_min,
- range->dst_port_max);
+ range->dst_port_max,
+ range->dst_port_inc);
scrn_printf(row++, col, "%*s", col_1, str);
snprintf(str,
sizeof(str),
"%5d:%5d/%5d/%5d",
range->src_port,
- range->src_port_inc,
- range->src_port_min,
- range->src_port_max);
+ range->src_port_min,
+ range->src_port_max,
+ range->src_port_inc);
scrn_printf(row++, col, "%*s", col_1, str);
snprintf(str,
sizeof(str),
"%5d:%5d/%5d/%5d",
range->vlan_id,
- range->vlan_id_inc,
range->vlan_id_min,
- range->vlan_id_max);
+ range->vlan_id_max,
+ range->vlan_id_inc);
scrn_printf(row++, col, "%*s", col_1, str);
snprintf(str,
sizeof(str),
"%5d:%5d/%5d/%5d",
range->cos,
- range->cos_inc,
range->cos_min,
- range->cos_max);
+ range->cos_max,
+ range->cos_inc);
scrn_printf(row++, col, "%*s", col_1, str);
snprintf(str,
sizeof(str),
"%5d:%5d/%5d/%5d",
range->tos,
- range->tos_inc,
range->tos_min,
- range->tos_max);
+ range->tos_max,
+ range->tos_inc);
scrn_printf(row++, col, "%*s", col_1, str);
+ snprintf(str,
+ sizeof(str),
+ "%5d:%5d/%5d/%5d",
+ range->pkt_size + PG_ETHER_CRC_LEN,
+ range->pkt_size_min + PG_ETHER_CRC_LEN,
+ range->pkt_size_max + PG_ETHER_CRC_LEN,
+ range->pkt_size_inc);
+ scrn_printf(row++, col, "%*s", col_1, str);
snprintf(str,
sizeof(str),
"%5d:%5d/%5d/%5d",
- range->pkt_size + ETHER_CRC_LEN,
- range->pkt_size_inc,
- range->pkt_size_min + ETHER_CRC_LEN,
- range->pkt_size_max + ETHER_CRC_LEN);
+ range->gtpu_teid,
+ range->gtpu_teid_min,
+ range->gtpu_teid_max,
+ range->gtpu_teid_inc);
scrn_printf(row++, col, "%*s", col_1, str);
snprintf(str,
sizeof(str),
"%5d:%5d/%5d/%5d",
range->vxlan_gid,
- range->vxlan_gid_inc,
range->vxlan_gid_min,
- range->vxlan_gid_max);
+ range->vxlan_gid_max,
+ range->vxlan_gid_inc);
scrn_printf(row++, col, "%*s", col_1, str);
snprintf(str,
sizeof(str),
"%5d:%5d/%5d/%5d",
range->vxlan_vid,
- range->vxlan_vid_inc,
range->vxlan_vid_min,
- range->vxlan_vid_max);
+ range->vxlan_vid_max,
+ range->vxlan_vid_inc);
scrn_printf(row++, col, "%*s", col_1, str);
row++;
@@ -451,15 +459,15 @@ pktgen_print_range(void)
inet_h64tom(range->dst_mac, &eaddr)));
scrn_printf(row++, col, "%*s", col_1,
inet_mtoa(buff, sizeof(buff),
- inet_h64tom(range->dst_mac_inc,
+ inet_h64tom(range->dst_mac_min,
&eaddr)));
scrn_printf(row++, col, "%*s", col_1,
inet_mtoa(buff, sizeof(buff),
- inet_h64tom(range->dst_mac_min,
+ inet_h64tom(range->dst_mac_max,
&eaddr)));
scrn_printf(row++, col, "%*s", col_1,
inet_mtoa(buff, sizeof(buff),
- inet_h64tom(range->dst_mac_max,
+ inet_h64tom(range->dst_mac_inc,
&eaddr)));
row++;
@@ -468,15 +476,15 @@ pktgen_print_range(void)
inet_h64tom(range->src_mac, &eaddr)));
scrn_printf(row++, col, "%*s", col_1,
inet_mtoa(buff, sizeof(buff),
- inet_h64tom(range->src_mac_inc,
+ inet_h64tom(range->src_mac_min,
&eaddr)));
scrn_printf(row++, col, "%*s", col_1,
inet_mtoa(buff, sizeof(buff),
- inet_h64tom(range->src_mac_min,
+ inet_h64tom(range->src_mac_max,
&eaddr)));
scrn_printf(row++, col, "%*s", col_1,
inet_mtoa(buff, sizeof(buff),
- inet_h64tom(range->src_mac_max,
+ inet_h64tom(range->src_mac_inc,
&eaddr)));
}
diff --git a/app/pktgen-seq.c b/app/pktgen-seq.c
index 7956719..f0ab407 100644
--- a/app/pktgen-seq.c
+++ b/app/pktgen-seq.c
@@ -5,7 +5,7 @@
*/
/* Created 2010 by Keith Wiles @ intel.com */
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen-display.h"
#include "pktgen.h"
@@ -114,8 +114,8 @@ pktgen_page_seq(uint32_t pid)
col += 12;
snprintf(buff, sizeof(buff), "%s/%s:%04x",
- (pkt->ethType == ETHER_TYPE_IPv4) ? "IPv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "IPv6" : "Other",
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "IPv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "IPv6" : "Other",
(pkt->ipProto == PG_IPPROTO_TCP) ? "TCP" :
(pkt->ipProto == PG_IPPROTO_ICMP) ? "ICMP" : "UDP",
pkt->vlanid);
@@ -134,7 +134,7 @@ pktgen_page_seq(uint32_t pid)
scrn_printf(row, col, "%*s", 16, buff);
col += 16;
- scrn_printf(row, col, "%6d", pkt->pktSize + ETHER_CRC_LEN);
+ scrn_printf(row, col, "%6d", pkt->pktSize + PG_ETHER_CRC_LEN);
row++;
}
diff --git a/app/pktgen-seq.h b/app/pktgen-seq.h
index 09e06b7..02ae4d8 100644
--- a/app/pktgen-seq.h
+++ b/app/pktgen-seq.h
@@ -24,8 +24,8 @@ typedef void *MARKER[0]; /**< generic marker for a point in a structure */
typedef struct pkt_seq_s {
/* Packet type and information */
- struct ether_addr eth_dst_addr; /**< Destination Ethernet address */
- struct ether_addr eth_src_addr; /**< Source Ethernet address */
+ struct pg_ether_addr eth_dst_addr; /**< Destination Ethernet address */
+ struct pg_ether_addr eth_src_addr; /**< Source Ethernet address */
struct cmdline_ipaddr ip_src_addr; /**< Source IPv4 address also used for IPv6 */
struct cmdline_ipaddr ip_dst_addr; /**< Destination IPv4 address */
diff --git a/app/pktgen-stats.c b/app/pktgen-stats.c
index b706d46..11ba904 100644
--- a/app/pktgen-stats.c
+++ b/app/pktgen-stats.c
@@ -8,7 +8,8 @@
#include <stdio.h>
-#include <rte_lua.h>
+#include <_delay.h>
+#include <lua_config.h>
#include "pktgen-cmds.h"
#include "pktgen-display.h"
@@ -141,14 +142,14 @@ pktgen_print_static_data(void)
scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff);
pktgen_display_set_color("stats.stat.values");
- snprintf(buff, sizeof(buff), "%d /%5d", pkt->pktSize + ETHER_CRC_LEN, info->tx_burst);
+ snprintf(buff, sizeof(buff), "%d /%5d", pkt->pktSize + PG_ETHER_CRC_LEN, info->tx_burst);
scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff);
snprintf(buff, sizeof(buff), "%d /%5d", pkt->sport, pkt->dport);
scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1, buff);
snprintf(buff, sizeof(buff), "%s / %s:%04x",
- (pkt->ethType == ETHER_TYPE_IPv4) ? "IPv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "IPv6" :
- (pkt->ethType == ETHER_TYPE_ARP) ? "ARP" : "Other",
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "IPv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "IPv6" :
+ (pkt->ethType == PG_ETHER_TYPE_ARP) ? "ARP" : "Other",
(pkt->ipProto == PG_IPPROTO_TCP) ? "TCP" :
(pkt->ipProto == PG_IPPROTO_ICMP) ? "ICMP" :
(rte_atomic32_read(&info->port_flags) & SEND_VXLAN_PACKETS) ? "VXLAN" : "UDP",
@@ -218,7 +219,7 @@ pktgen_print_static_data(void)
pktgen.flags &= ~PRINT_LABELS_FLAG;
}
-#define LINK_RETRY 16
+#define LINK_RETRY 8
/**************************************************************************//**
*
* pktgen_get_link_status - Get the port link status.
@@ -236,20 +237,25 @@ void
pktgen_get_link_status(port_info_t *info, int pid, int wait)
{
int i;
+ uint64_t prev_status = info->link.link_status;
/* get link status */
for (i = 0; i < LINK_RETRY; i++) {
memset(&info->link, 0, sizeof(info->link));
+
rte_eth_link_get_nowait(pid, &info->link);
- if (info->link.link_status && info->link.link_speed)
+
+ if (info->link.link_status && info->link.link_speed) {
+ if (prev_status == 0)
+ pktgen_packet_rate(info);
return;
+ }
if (!wait)
break;
+
rte_delay_us_sleep(100 * 1000);
}
- if (wait)
- printf("**** Failed to get link UP and speed, use defaults!\n");
/* Setup a few default values to prevent problems later. */
#if RTE_VERSION >= RTE_VERSION_NUM(17,2,0,0)
info->link.link_speed = ETH_SPEED_NUM_10G;
@@ -295,7 +301,6 @@ pktgen_page_stats(void)
info = &pktgen.info[pid];
rate = &info->rate_stats;
- prev = &info->prev_stats;
cumm->ipackets += rate->ipackets;
cumm->opackets += rate->opackets;
@@ -538,7 +543,7 @@ pktgen_page_phys_stats(uint16_t pid)
{
unsigned int col, row, q, hdr;
struct rte_eth_stats stats, *s, *r;
- struct ether_addr ethaddr;
+ struct pg_ether_addr ethaddr;
char buff[32], mac_buf[32];
s = &stats;
@@ -588,7 +593,7 @@ pktgen_page_phys_stats(uint16_t pid)
col = (COLUMN_WIDTH_0 + (COLUMN_WIDTH_3 * 3)) - 3;
rte_eth_macaddr_get(pid, &ethaddr);
- ether_format_addr(mac_buf, sizeof(mac_buf), &ethaddr);
+ pg_ether_format_addr(mac_buf, sizeof(mac_buf), &ethaddr);
snprintf(buff, sizeof(buff), "%s", mac_buf);
scrn_printf(row, col, "%*s", COLUMN_WIDTH_3, buff);
row++;
diff --git a/app/pktgen-tcp.c b/app/pktgen-tcp.c
index 4c09e70..a06241f 100644
--- a/app/pktgen-tcp.c
+++ b/app/pktgen-tcp.c
@@ -6,7 +6,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
#include <cli_scrn.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include "pktgen.h"
@@ -29,15 +29,15 @@ pktgen_tcp_hdr_ctor(pkt_seq_t *pkt, void * hdr, int type)
{
uint16_t tlen;
- if (type == ETHER_TYPE_IPv4) {
- struct ipv4_hdr *ipv4 = (struct ipv4_hdr *)hdr;
- struct tcp_hdr *tcp = (struct tcp_hdr *)&ipv4[1];
+ if (type == PG_ETHER_TYPE_IPv4) {
+ struct pg_ipv4_hdr *ipv4 = (struct pg_ipv4_hdr *)hdr;
+ struct pg_tcp_hdr *tcp = (struct pg_tcp_hdr *)&ipv4[1];
/* Create the TCP header */
ipv4->src_addr = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);
ipv4->dst_addr = htonl(pkt->ip_dst_addr.addr.ipv4.s_addr);
- tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct ipv4_hdr));
+ tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct pg_ipv4_hdr));
ipv4->total_length = htons(tlen);
ipv4->next_proto_id = pkt->ipProto;
@@ -45,7 +45,7 @@ pktgen_tcp_hdr_ctor(pkt_seq_t *pkt, void * hdr, int type)
tcp->dst_port = htons(pkt->dport);
tcp->sent_seq = htonl(DEFAULT_PKT_NUMBER);
tcp->recv_ack = htonl(DEFAULT_ACK_NUMBER);
- tcp->data_off = ((sizeof(struct tcp_hdr) / sizeof(uint32_t)) << 4); /* Offset in words */
+ tcp->data_off = ((sizeof(struct pg_tcp_hdr) / sizeof(uint32_t)) << 4); /* Offset in words */
tcp->tcp_flags = ACK_FLAG; /* ACK */
tcp->rx_win = htons(DEFAULT_WND_SIZE);
tcp->tcp_urp = 0;
@@ -54,8 +54,8 @@ pktgen_tcp_hdr_ctor(pkt_seq_t *pkt, void * hdr, int type)
tcp->cksum = rte_raw_cksum(tcp, tlen);
} else {
- struct ipv6_hdr *ipv6 = (struct ipv6_hdr *)hdr;
- struct tcp_hdr *tcp = (struct tcp_hdr *)&ipv6[1];
+ struct pg_ipv6_hdr *ipv6 = (struct pg_ipv6_hdr *)hdr;
+ struct pg_tcp_hdr *tcp = (struct pg_tcp_hdr *)&ipv6[1];
/* Create the pseudo header and TCP information */
(void)rte_memcpy(ipv6->dst_addr, &pkt->ip_dst_addr.addr.ipv4.s_addr,
@@ -63,7 +63,7 @@ pktgen_tcp_hdr_ctor(pkt_seq_t *pkt, void * hdr, int type)
(void)rte_memcpy(ipv6->src_addr, &pkt->ip_src_addr.addr.ipv4.s_addr,
sizeof(struct in6_addr));
- tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct ipv6_hdr));
+ tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct pg_ipv6_hdr));
ipv6->payload_len = htonl(tlen);
ipv6->proto = pkt->ipProto;
@@ -72,7 +72,7 @@ pktgen_tcp_hdr_ctor(pkt_seq_t *pkt, void * hdr, int type)
tcp->sent_seq = htonl(DEFAULT_PKT_NUMBER);
tcp->recv_ack = htonl(DEFAULT_ACK_NUMBER);
tcp->data_off =
- ((sizeof(struct tcp_hdr) / sizeof(uint32_t)) << 4); /* Offset in words */
+ ((sizeof(struct pg_tcp_hdr) / sizeof(uint32_t)) << 4); /* Offset in words */
tcp->tcp_flags = ACK_FLAG; /* ACK */
tcp->rx_win = htons(DEFAULT_WND_SIZE);
tcp->tcp_urp = 0;
diff --git a/app/pktgen-udp.c b/app/pktgen-udp.c
index 195527d..e2751d0 100644
--- a/app/pktgen-udp.c
+++ b/app/pktgen-udp.c
@@ -6,7 +6,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
#include <cli_scrn.h>
-#include "rte_lua.h"
+#include "lua_config.h"
#include "pktgen.h"
@@ -29,9 +29,9 @@ pktgen_udp_hdr_ctor(pkt_seq_t *pkt, void *hdr, int type)
{
uint16_t tlen;
- if (type == ETHER_TYPE_IPv4) {
- struct ipv4_hdr *ipv4 = hdr;
- struct udp_hdr *udp = (struct udp_hdr *)&ipv4[1];
+ if (type == PG_ETHER_TYPE_IPv4) {
+ struct pg_ipv4_hdr *ipv4 = hdr;
+ struct pg_udp_hdr *udp = (struct pg_udp_hdr *)&ipv4[1];
/* Create the UDP header */
ipv4->src_addr = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);
@@ -41,7 +41,7 @@ pktgen_udp_hdr_ctor(pkt_seq_t *pkt, void *hdr, int type)
ipv4->total_length = htons(tlen);
ipv4->next_proto_id = pkt->ipProto;
- tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct ipv4_hdr));
+ tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct pg_ipv4_hdr));
udp->dgram_len = htons(tlen);
udp->src_port = htons(pkt->sport);
udp->dst_port = htons(pkt->dport);
@@ -60,8 +60,8 @@ pktgen_udp_hdr_ctor(pkt_seq_t *pkt, void *hdr, int type)
udp->dgram_cksum = 0xFFFF;
} else {
uint32_t addr;
- struct ipv6_hdr *ipv6 = hdr;
- struct udp_hdr *udp = (struct udp_hdr *)&ipv6[1];
+ struct pg_ipv6_hdr *ipv6 = hdr;
+ struct pg_udp_hdr *udp = (struct pg_udp_hdr *)&ipv6[1];
/* Create the pseudo header and TCP information */
addr = htonl(pkt->ip_dst_addr.addr.ipv4.s_addr);
@@ -73,7 +73,7 @@ pktgen_udp_hdr_ctor(pkt_seq_t *pkt, void *hdr, int type)
ipv6->payload_len = htonl(tlen);
ipv6->proto = pkt->ipProto;
- tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct ipv6_hdr));
+ tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct pg_ipv6_hdr));
udp->dgram_len = htons(tlen);
udp->src_port = htons(pkt->sport);
udp->dst_port = htons(pkt->dport);
diff --git a/app/pktgen-vlan.c b/app/pktgen-vlan.c
index 451b2c0..05620a6 100644
--- a/app/pktgen-vlan.c
+++ b/app/pktgen-vlan.c
@@ -6,7 +6,7 @@
/* Created 2010 by Keith Wiles @ intel.com */
#include <cli_scrn.h>
-#include "rte_lua.h"
+#include "lua_config.h"
#include "pktgen.h"
#include "pktgen-arp.h"
@@ -30,28 +30,28 @@ void
pktgen_process_vlan(struct rte_mbuf *m, uint32_t pid)
{
pktType_e pType;
- struct ether_hdr *eth;
- struct vlan_hdr *vlan_hdr;
+ struct pg_ether_hdr *eth;
+ struct pg_vlan_hdr *pg_vlan_hdr;
port_info_t *info = &pktgen.info[pid];
- eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
+ eth = rte_pktmbuf_mtod(m, struct pg_ether_hdr *);
/* Now dealing with the inner header */
- vlan_hdr = (struct vlan_hdr *)(eth + 1);
+ pg_vlan_hdr = (struct pg_vlan_hdr *)(eth + 1);
- pType = ntohs(vlan_hdr->eth_proto);
+ pType = ntohs(pg_vlan_hdr->eth_proto);
/* No support for nested tunnel */
switch ((int)pType) {
- case ETHER_TYPE_ARP:
+ case PG_ETHER_TYPE_ARP:
info->stats.arp_pkts++;
pktgen_process_arp(m, pid, 1);
break;
- case ETHER_TYPE_IPv4:
+ case PG_ETHER_TYPE_IPv4:
info->stats.ip_pkts++;
pktgen_process_ping4(m, pid, 1);
break;
- case ETHER_TYPE_IPv6:
+ case PG_ETHER_TYPE_IPv6:
info->stats.ipv6_pkts++;
pktgen_process_ping6(m, pid, 1);
break;
diff --git a/app/pktgen.c b/app/pktgen.c
index 26de8eb..8fb475c 100644
--- a/app/pktgen.c
+++ b/app/pktgen.c
@@ -9,8 +9,9 @@
#include <stdint.h>
#include <time.h>
+#include <_delay.h>
#include <rte_lcore.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#include <rte_net.h>
#include <rte_arp.h>
@@ -210,13 +211,13 @@ pktgen_latency_pointer(port_info_t *info, struct rte_mbuf *m, int32_t seq_idx)
p = rte_pktmbuf_mtod(m, char *);
- p += sizeof(struct ether_hdr);
+ p += sizeof(struct pg_ether_hdr);
- p += (info->seq_pkt[seq_idx].ethType == ETHER_TYPE_IPv4) ?
- sizeof(struct ipv4_hdr) : sizeof(struct ipv6_hdr);
+ p += (info->seq_pkt[seq_idx].ethType == PG_ETHER_TYPE_IPv4) ?
+ sizeof(struct pg_ipv4_hdr) : sizeof(struct pg_ipv6_hdr);
p += (info->seq_pkt[seq_idx].ipProto == PG_IPPROTO_UDP) ?
- sizeof(struct udp_hdr) : sizeof(struct tcp_hdr);
+ sizeof(struct pg_udp_hdr) : sizeof(struct pg_tcp_hdr);
/* Force pointer to be aligned correctly */
p = RTE_PTR_ALIGN_CEIL(p, sizeof(uint64_t));
@@ -230,6 +231,9 @@ static inline void
pktgen_latency_apply(port_info_t *info __rte_unused,
struct rte_mbuf **mbufs, int cnt, int32_t seq_idx)
{
+ pkt_seq_t *pkt = &info->seq_pkt[seq_idx];
+ struct pg_ether_hdr *eth = (struct pg_ether_hdr *)&pkt->hdr.eth;
+ char *l3_hdr = (char *)&eth[1]; /* Point to l3 hdr location */
int i;
for (i = 0; i < cnt; i++) {
@@ -239,6 +243,12 @@ pktgen_latency_apply(port_info_t *info __rte_unused,
latency->timestamp = rte_rdtsc_precise();
latency->magic = LATENCY_MAGIC;
+
+ /* Construct the UDP header */
+ pktgen_udp_hdr_ctor(pkt, l3_hdr, PG_ETHER_TYPE_IPv4);
+
+ /* IPv4 Header constructor */
+ pktgen_ipv4_ctor(pkt, l3_hdr);
}
}
@@ -549,7 +559,7 @@ void
pktgen_packet_ctor(port_info_t *info, int32_t seq_idx, int32_t type)
{
pkt_seq_t *pkt = &info->seq_pkt[seq_idx];
- struct ether_hdr *eth = (struct ether_hdr *)&pkt->hdr.eth;
+ struct pg_ether_hdr *eth = (struct pg_ether_hdr *)&pkt->hdr.eth;
uint32_t flags;
char *l3_hdr = (char *)&eth[1]; /* Point to l3 hdr location for GRE header */
@@ -560,7 +570,7 @@ pktgen_packet_ctor(port_info_t *info, int32_t seq_idx, int32_t type)
flags = rte_atomic32_read(&info->port_flags);
- /* Add GRE header and adjust ether_hdr pointer if requested */
+ /* Add GRE header and adjust pg_ether_hdr pointer if requested */
if (flags & SEND_GRE_IPv4_HEADER)
l3_hdr = pktgen_gre_hdr_ctor(info, pkt, (greIp_t *)l3_hdr);
else if (flags & SEND_GRE_ETHER_HEADER)
@@ -568,11 +578,11 @@ pktgen_packet_ctor(port_info_t *info, int32_t seq_idx, int32_t type)
else
l3_hdr = pktgen_ether_hdr_ctor(info, pkt, eth);
- if (likely(pkt->ethType == ETHER_TYPE_IPv4)) {
+ if (likely(pkt->ethType == PG_ETHER_TYPE_IPv4)) {
if (likely(pkt->ipProto == PG_IPPROTO_TCP)) {
if (pkt->dport != PG_IPPROTO_L4_GTPU_PORT) {
/* Construct the TCP header */
- pktgen_tcp_hdr_ctor(pkt, l3_hdr, ETHER_TYPE_IPv4);
+ pktgen_tcp_hdr_ctor(pkt, l3_hdr, PG_ETHER_TYPE_IPv4);
/* IPv4 Header constructor */
pktgen_ipv4_ctor(pkt, l3_hdr);
@@ -582,7 +592,7 @@ pktgen_packet_ctor(port_info_t *info, int32_t seq_idx, int32_t type)
GTPu_VERSION | GTPu_PT_FLAG, 0, 0, 0);
/* Construct the TCP header */
- pktgen_tcp_hdr_ctor(pkt, l3_hdr, ETHER_TYPE_IPv4);
+ pktgen_tcp_hdr_ctor(pkt, l3_hdr, PG_ETHER_TYPE_IPv4);
/* IPv4 Header constructor */
pktgen_ipv4_ctor(pkt, l3_hdr);
@@ -591,13 +601,13 @@ pktgen_packet_ctor(port_info_t *info, int32_t seq_idx, int32_t type)
if (flags & SEND_VXLAN_PACKETS) {
/* Construct the UDP header */
pkt->dport = VXLAN_PORT_ID;
- pktgen_udp_hdr_ctor(pkt, l3_hdr, ETHER_TYPE_IPv4);
+ pktgen_udp_hdr_ctor(pkt, l3_hdr, PG_ETHER_TYPE_IPv4);
/* IPv4 Header constructor */
pktgen_ipv4_ctor(pkt, l3_hdr);
} else if (pkt->dport != PG_IPPROTO_L4_GTPU_PORT) {
/* Construct the UDP header */
- pktgen_udp_hdr_ctor(pkt, l3_hdr, ETHER_TYPE_IPv4);
+ pktgen_udp_hdr_ctor(pkt, l3_hdr, PG_ETHER_TYPE_IPv4);
/* IPv4 Header constructor */
pktgen_ipv4_ctor(pkt, l3_hdr);
@@ -607,30 +617,30 @@ pktgen_packet_ctor(port_info_t *info, int32_t seq_idx, int32_t type)
GTPu_VERSION | GTPu_PT_FLAG, 0, 0, 0);
/* Construct the UDP header */
- pktgen_udp_hdr_ctor(pkt, l3_hdr, ETHER_TYPE_IPv4);
+ pktgen_udp_hdr_ctor(pkt, l3_hdr, PG_ETHER_TYPE_IPv4);
/* IPv4 Header constructor */
pktgen_ipv4_ctor(pkt, l3_hdr);
}
} else if (pkt->ipProto == PG_IPPROTO_ICMP) {
- struct ipv4_hdr *ipv4;
- struct udp_hdr *udp;
- struct icmp_hdr *icmp;
+ struct pg_ipv4_hdr *ipv4;
+ struct pg_udp_hdr *udp;
+ struct pg_icmp_hdr *icmp;
uint16_t tlen;
/* Start from Ethernet header */
- ipv4 = (struct ipv4_hdr *)l3_hdr;
- udp = (struct udp_hdr *)&ipv4[1];
+ ipv4 = (struct pg_ipv4_hdr *)l3_hdr;
+ udp = (struct pg_udp_hdr *)&ipv4[1];
/* Create the ICMP header */
ipv4->src_addr = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);
ipv4->dst_addr = htonl(pkt->ip_dst_addr.addr.ipv4.s_addr);
- tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct ipv4_hdr));
+ tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct pg_ipv4_hdr));
ipv4->total_length = htons(tlen);
ipv4->next_proto_id = pkt->ipProto;
- icmp = (struct icmp_hdr *)&udp[1];
+ icmp = (struct pg_icmp_hdr *)&udp[1];
icmp->icmp_code = 0;
if ( (type == -1) || (type == ICMP4_TIMESTAMP)) {
union icmp_data *data = (union icmp_data *)&udp[1];
@@ -651,7 +661,7 @@ pktgen_packet_ctor(port_info_t *info, int32_t seq_idx, int32_t type)
}
icmp->icmp_cksum = 0;
/* ICMP4_TIMESTAMP_SIZE */
- tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct ipv4_hdr));
+ tlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct pg_ipv4_hdr));
icmp->icmp_cksum = rte_raw_cksum(icmp, tlen);
if (icmp->icmp_cksum == 0)
icmp->icmp_cksum = 0xFFFF;
@@ -659,38 +669,38 @@ pktgen_packet_ctor(port_info_t *info, int32_t seq_idx, int32_t type)
/* IPv4 Header constructor */
pktgen_ipv4_ctor(pkt, l3_hdr);
}
- } else if (pkt->ethType == ETHER_TYPE_IPv6) {
+ } else if (pkt->ethType == PG_ETHER_TYPE_IPv6) {
if (pkt->ipProto == PG_IPPROTO_TCP) {
/* Construct the TCP header */
- pktgen_tcp_hdr_ctor(pkt, l3_hdr, ETHER_TYPE_IPv6);
+ pktgen_tcp_hdr_ctor(pkt, l3_hdr, PG_ETHER_TYPE_IPv6);
/* IPv6 Header constructor */
pktgen_ipv6_ctor(pkt, l3_hdr);
} else if (pkt->ipProto == PG_IPPROTO_UDP) {
/* Construct the UDP header */
- pktgen_udp_hdr_ctor(pkt, l3_hdr, ETHER_TYPE_IPv6);
+ pktgen_udp_hdr_ctor(pkt, l3_hdr, PG_ETHER_TYPE_IPv6);
/* IPv6 Header constructor */
pktgen_ipv6_ctor(pkt, l3_hdr);
}
- } else if (pkt->ethType == ETHER_TYPE_ARP) {
+ } else if (pkt->ethType == PG_ETHER_TYPE_ARP) {
/* Start from Ethernet header */
- struct arp_hdr *arp = (struct arp_hdr *)l3_hdr;
+ struct pg_arp_hdr *arp = (struct pg_arp_hdr *)l3_hdr;
arp->arp_hrd = htons(1);
- arp->arp_pro = htons(ETHER_TYPE_IPv4);
- arp->arp_hln = ETHER_ADDR_LEN;
+ arp->arp_pro = htons(PG_ETHER_TYPE_IPv4);
+ arp->arp_hln = PG_ETHER_ADDR_LEN;
arp->arp_pln = 4;
/* make request/reply operation selectable by user */
arp->arp_op = htons(2);
- ether_addr_copy(&pkt->eth_src_addr,
- (struct ether_addr *)&arp->arp_data.arp_sha);
+ pg_ether_addr_copy(&pkt->eth_src_addr,
+ (struct pg_ether_addr *)&arp->arp_data.arp_sha);
*((uint32_t *)&arp->arp_data.arp_sha) = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);
- ether_addr_copy(&pkt->eth_dst_addr,
- (struct ether_addr *)&arp->arp_data.arp_tha);
+ pg_ether_addr_copy(&pkt->eth_dst_addr,
+ (struct pg_ether_addr *)&arp->arp_data.arp_tha);
*((uint32_t *)&arp->arp_data.arp_tip) = htonl(pkt->ip_dst_addr.addr.ipv4.s_addr);
} else
pktgen_log_error("Unknown EtherType 0x%04x", pkt->ethType);
@@ -740,9 +750,9 @@ static __inline__ pktType_e
pktgen_packet_type(struct rte_mbuf *m)
{
pktType_e ret;
- struct ether_hdr *eth;
+ struct pg_ether_hdr *eth;
- eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
+ eth = rte_pktmbuf_mtod(m, struct pg_ether_hdr *);
ret = ntohs(eth->ether_type);
@@ -783,19 +793,19 @@ pktgen_packet_classify(struct rte_mbuf *m, int pid)
pid);
switch ((int)pType) {
- case ETHER_TYPE_ARP:
+ case PG_ETHER_TYPE_ARP:
info->stats.arp_pkts++;
pktgen_process_arp(m, pid, 0);
break;
- case ETHER_TYPE_IPv4:
+ case PG_ETHER_TYPE_IPv4:
info->stats.ip_pkts++;
pktgen_process_ping4(m, pid, 0);
break;
- case ETHER_TYPE_IPv6:
+ case PG_ETHER_TYPE_IPv6:
info->stats.ipv6_pkts++;
pktgen_process_ping6(m, pid, 0);
break;
- case ETHER_TYPE_VLAN:
+ case PG_ETHER_TYPE_VLAN:
info->stats.vlan_pkts++;
pktgen_process_vlan(m, pid);
break;
@@ -806,16 +816,16 @@ pktgen_packet_classify(struct rte_mbuf *m, int pid)
} else
/* Count the type of packets found. */
switch ((int)pType) {
- case ETHER_TYPE_ARP:
+ case PG_ETHER_TYPE_ARP:
info->stats.arp_pkts++;
break;
- case ETHER_TYPE_IPv4:
+ case PG_ETHER_TYPE_IPv4:
info->stats.ip_pkts++;
break;
- case ETHER_TYPE_IPv6:
+ case PG_ETHER_TYPE_IPv6:
info->stats.ipv6_pkts++;
break;
- case ETHER_TYPE_VLAN:
+ case PG_ETHER_TYPE_VLAN:
info->stats.vlan_pkts++;
break;
default:
@@ -825,9 +835,9 @@ pktgen_packet_classify(struct rte_mbuf *m, int pid)
plen += pktgen_get_hw_strip_crc();
/* Count the size of each packet. */
- if (plen == ETHER_MIN_LEN)
+ if (plen == PG_ETHER_MIN_LEN)
info->sizes._64++;
- else if ( (plen >= (ETHER_MIN_LEN + 1)) && (plen <= 127))
+ else if ( (plen >= (PG_ETHER_MIN_LEN + 1)) && (plen <= 127))
info->sizes._65_127++;
else if ( (plen >= 128) && (plen <= 255))
info->sizes._128_255++;
@@ -835,11 +845,11 @@ pktgen_packet_classify(struct rte_mbuf *m, int pid)
info->sizes._256_511++;
else if ( (plen >= 512) && (plen <= 1023))
info->sizes._512_1023++;
- else if ( (plen >= 1024) && (plen <= ETHER_MAX_LEN))
+ else if ( (plen >= 1024) && (plen <= PG_ETHER_MAX_LEN))
info->sizes._1024_1518++;
- else if (plen < ETHER_MIN_LEN)
+ else if (plen < PG_ETHER_MIN_LEN)
info->sizes.runt++;
- else if (plen > ETHER_MAX_LEN)
+ else if (plen > PG_ETHER_MAX_LEN)
info->sizes.jumbo++;
else
info->sizes.unknown++;
@@ -991,16 +1001,16 @@ pktgen_setup_cb(struct rte_mempool *mp,
d->data_len = m->data_len;
switch(pkt->ethType) {
- case ETHER_TYPE_IPv4:
+ case PG_ETHER_TYPE_IPv4:
if (info->dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM)
pkt->ol_flags = PKT_TX_IP_CKSUM | PKT_TX_IPV4;
break;
- case ETHER_TYPE_IPv6:
+ case PG_ETHER_TYPE_IPv6:
pkt->ol_flags = PKT_TX_IP_CKSUM | PKT_TX_IPV6;
break;
- case ETHER_TYPE_VLAN:
+ case PG_ETHER_TYPE_VLAN:
if (info->dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) {
/* TODO */
}
@@ -1107,7 +1117,6 @@ pktgen_send_pkts(port_info_t *info, uint16_t qid, struct rte_mempool *mp)
nb_pkts);
if (rc == 0) {
info->q[qid].tx_mbufs.len = info->tx_burst;
-
pktgen_send_burst(info, qid);
}
} else {
@@ -1264,7 +1273,7 @@ port_map_info(uint8_t lid, port_info_t **infos, uint8_t *qids,
pid = get_tx_pid(pktgen.l2p, lid, idx);
if ((infos[idx] = get_port_private(pktgen.l2p, pid)) == NULL)
- rte_panic("Config error: No port %d found at %d lcore\n", pid, lid);
+ rte_panic("Config error: No port %d found at lcore %d\n", pid, lid);
if (qids)
qids[idx] = get_txque(pktgen.l2p, lid, pid);
@@ -1307,6 +1316,7 @@ pktgen_main_rxtx_loop(uint8_t lid)
}
port_map_info(lid, infos, qids, &txcnt, &rxcnt, "RX/TX");
+ curr_tsc = rte_get_tsc_cycles();
tx_next_cycle = rte_get_tsc_cycles() + infos[0]->tx_cycles;
tx_bond_cycle = rte_get_tsc_cycles() + rte_get_timer_hz()/10;
@@ -1334,8 +1344,10 @@ pktgen_main_rxtx_loop(uint8_t lid)
for (idx = 0; idx < rxcnt; idx++) {
uint16_t pid = infos[idx]->pid;
- if (rte_eth_dev_socket_id(pid) != (int)rte_socket_id())
- rte_panic("*** port %u socket ID %u has different socket ID for lcore %u socket ID %d\n",
+ int dev_sock = rte_eth_dev_socket_id(pid);
+
+ if (dev_sock != SOCKET_ID_ANY && dev_sock != (int)rte_socket_id())
+ rte_panic("*** port %u on socket ID %u has different socket ID for lcore %u socket ID %d\n",
pid, rte_eth_dev_socket_id(pid),
rte_lcore_id(), rte_socket_id());
}
@@ -1400,6 +1412,7 @@ pktgen_main_tx_loop(uint8_t lid)
port_map_info(lid, infos, qids, &txcnt, NULL, "TX");
+ curr_tsc = rte_get_tsc_cycles();
tx_next_cycle = rte_get_tsc_cycles() + infos[0]->tx_cycles;
tx_bond_cycle = rte_get_tsc_cycles() + rte_get_timer_hz()/10;
@@ -1418,24 +1431,36 @@ pktgen_main_tx_loop(uint8_t lid)
for (idx = 0; idx < txcnt; idx++) {
uint16_t pid = infos[idx]->pid;
- if (rte_eth_dev_socket_id(pid) != (int)rte_socket_id())
- rte_panic("*** port %u socket ID %u has different socket ID for lcore %u socket ID %d\n",
+ int dev_sock = rte_eth_dev_socket_id(pid);
+
+ if (dev_sock != SOCKET_ID_ANY && dev_sock != (int)rte_socket_id())
+ rte_panic("*** port %u on socket ID %u has different socket ID for lcore %u on socket ID %d\n",
pid, rte_eth_dev_socket_id(pid),
rte_lcore_id(), rte_socket_id());
}
+
idx = 0;
while (pg_lcore_is_running(pktgen.l2p, lid)) {
curr_tsc = rte_get_tsc_cycles();
+ if (infos[0]->tx_cycles == 0) {
+ pktgen_get_link_status(infos[0], infos[0]->pid, 0);
+ if (infos[0]->link.link_status) {
+ pktgen_packet_rate(infos[0]);
+ tx_next_cycle = curr_tsc + infos[0]->tx_cycles;
+ }
+ }
+
/* Determine when is the next time to send packets */
if (curr_tsc >= tx_next_cycle) {
tx_next_cycle = curr_tsc + infos[0]->tx_cycles;
- for (idx = 0; idx < txcnt; idx++) /* Transmit packets */
+ for (idx = 0; idx < txcnt; idx++) { /* Transmit packets */
pktgen_main_transmit(infos[idx], qids[idx]);
+ }
} else if (curr_tsc >= tx_bond_cycle) {
tx_bond_cycle = curr_tsc + rte_get_timer_hz()/10;
- for (idx = 0; idx < txcnt; idx++) { /* Transmit zero pkts for Bonding PMD */
+ for (idx = 0; idx < txcnt; idx++) { /* Transmit pkts for Bonding PMD */
flags = rte_atomic32_read(&infos[idx]->port_flags);
if (flags & BONDING_TX_PACKETS) {
rte_eth_tx_burst(infos[idx]->pid, qids[idx], NULL, 0);
@@ -1491,8 +1516,10 @@ pktgen_main_rx_loop(uint8_t lid)
for (idx = 0; idx < rxcnt; idx++) {
uint16_t pid = infos[idx]->pid;
- if (rte_eth_dev_socket_id(pid) != (int)rte_socket_id())
- rte_panic("*** port %u socket ID %u has different socket ID for lcore %u socket ID %d\n",
+ int dev_sock = rte_eth_dev_socket_id(pid);
+
+ if (dev_sock != SOCKET_ID_ANY && dev_sock != (int)rte_socket_id())
+ rte_panic("*** port %u on socket ID %u has different socket ID for lcore %u socket ID %d\n",
pid, rte_eth_dev_socket_id(pid),
rte_lcore_id(), rte_socket_id());
}
diff --git a/app/pktgen.h b/app/pktgen.h
index 0488b3c..b844a9f 100644
--- a/app/pktgen.h
+++ b/app/pktgen.h
@@ -35,7 +35,7 @@
#include <assert.h>
#include <time.h>
-#include <rte_version.h>
+#include <pg_compat.h>
#include <rte_config.h>
#include <rte_errno.h>
@@ -92,7 +92,7 @@
extern "C" {
#endif
-#define PKTGEN_VERSION "3.6.6"
+#define PKTGEN_VERSION "3.7.0"
#define PKTGEN_APP_NAME "Pktgen"
#define PKTGEN_CREATED_BY "Keith Wiles"
@@ -231,11 +231,11 @@ enum {
START_FRAME_DELIMITER = 1,
PKT_PREAMBLE_SIZE = 7, /**< in bytes */
PKT_OVERHEAD_SIZE = (INTER_FRAME_GAP + START_FRAME_DELIMITER +
- PKT_PREAMBLE_SIZE + ETHER_CRC_LEN),
+ PKT_PREAMBLE_SIZE + PG_ETHER_CRC_LEN),
- MIN_PKT_SIZE = (ETHER_MIN_LEN - ETHER_CRC_LEN),
- MAX_PKT_SIZE = (ETHER_MAX_LEN - ETHER_CRC_LEN),
- MIN_v6_PKT_SIZE = (78 - ETHER_CRC_LEN),
+ MIN_PKT_SIZE = (PG_ETHER_MIN_LEN - PG_ETHER_CRC_LEN),
+ MAX_PKT_SIZE = (PG_ETHER_MAX_LEN - PG_ETHER_CRC_LEN),
+ MIN_v6_PKT_SIZE = (78 - PG_ETHER_CRC_LEN),
MAX_RX_QUEUES = 16, /**< RX Queues per port */
MAX_TX_QUEUES = 16, /**< TX Queues per port */
@@ -248,7 +248,7 @@ enum {
typedef struct rte_mbuf rte_mbuf_t;
typedef union {
- struct ether_addr addr;
+ struct pg_ether_addr addr;
uint64_t u64;
} ethaddr_t;
diff --git a/cfg/bond.cfg b/cfg/bond.cfg
index c6dbeec..9be7627 100644
--- a/cfg/bond.cfg
+++ b/cfg/bond.cfg
@@ -11,7 +11,7 @@ setup = {
'83:00.0', '83:00.1', '83:00.2', '83:00.3',
),
- 'uio': 'vfio-pci'
+ 'uio': 'igb_uio'
}
# Run command and options
@@ -32,18 +32,18 @@ run = {
'./app/%(target)s/%(app_name)s',
),
- 'cores': '1,2-3,18-19',
+ 'cores': '1,2-5',
'nrank': '4',
'proc': 'auto',
'log': '7',
'prefix': 'pg',
'vdev': (
- 'net_bonding0,mode=4,xmit_policy=l23,slave=0000:04:00.0,slave=0000:04:00.1,slave=0000:04:00.2,slave=0000:04:00.3',
- 'net_bonding1,mode=4,xmit_policy=l23,slave=0000:81:00.0,slave=0000:81:00.1,slave=0000:81:00.2,slave=0000:81:00.3',
+ 'net_bonding0,mode=4,xmit_policy=l23,slave=0000:81:00.0,slave=0000:81:00.1,slave=0000:81:00.2,slave=0000:81:00.3',
+ 'net_bonding1,mode=4,xmit_policy=l23,slave=0000:83:00.0,slave=0000:83:00.1,slave=0000:83:00.2,slave=0000:83:00.3',
),
'blacklist': (
- '81:00.0', '83:00.0'
+# '83:00.0', '83:00.1', '83:00.2', '83:00.3',
),
'opts': (
@@ -52,7 +52,7 @@ run = {
),
'map': (
'[2:3].8',
- '[18:19].9'
+ '[4:5].9'
),
'theme': 'themes/black-yellow.theme'
diff --git a/cfg/default.cfg b/cfg/default.cfg
index 8c993fa..0f66087 100644
--- a/cfg/default.cfg
+++ b/cfg/default.cfg
@@ -11,7 +11,7 @@ setup = {
'83:00.0', '83:00.1', '83:00.2', '83:00.3'
),
# UIO module type, igb_uio, vfio-pci or uio_pci_generic
- 'uio': 'vfio-pci'
+ 'uio': 'igb_uio'
}
# Run command and options
@@ -36,14 +36,14 @@ run = {
'proc': 'auto',
'log': '7',
'prefix': 'pg',
-
+
'blacklist': (
#'81:00.0', '81:00.1', '81:00.2', '81:00.3',
#'83:00.0', '83:00.1', '83:00.2', '83:00.3',
'81:00.2', '81:00.3',
'83:00.2', '83:00.3'
),
-
+
'opts': (
'-T',
'-P',
@@ -54,6 +54,6 @@ run = {
'[19:20].2',
'[21:22].3'
),
-
+
'theme': 'themes/black-yellow.theme'
}
diff --git a/changelog.txt b/changelog.txt
index 0ad02b5..2c0200b 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -6,6 +6,9 @@ Pktgen-DPDK - Traffic Generator powered by DPDK
** (Pktgen) Sounds like 'Packet-Gen'**
**=== Modifications ===**
+ - 3.7.0 - Fixed build issues with DPDK 19.08 as DPDK renamed a lot of defines
+ Fixed up the meson files to build pktgen with meson and ninja
+ Minor cleanup
- 3.6.6 - Add portInfo() function in lua to return most of the port info in
one structure.
- 3.6.5 - Fix ldflags order for RHEL, CentOS and other systems to include lua in build
diff --git a/dnet-echo b/dnet-echo
index 638ed6e..987f9af 100644
--- a/dnet-echo
+++ b/dnet-echo
@@ -3,7 +3,7 @@
# Copyright (c) <2010-2019>, Intel Corporation. All rights reserved., Powered by DPDK
# Command line arguments: (DPDK args are defaults)
-# ./app/x86_64-native-linuxapp-gcc/pktgen -c 7c000 -n 3 -m 512 --proc-type primary -- -T -P -m [15:16].0 -m [17:18].1 -f themes/black-yellow.theme
+# ./app/x86_64-native-linux-gcc/pktgen -c 7c000 -n 3 -m 512 --proc-type primary -- -T -P -m [15:16].0 -m [17:18].1 -f themes/black-yellow.theme
#######################################################################
# Pktgen Configuration script information:
diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst
index 6dfcc05..61bf21e 100644
--- a/docs/source/getting_started.rst
+++ b/docs/source/getting_started.rst
@@ -163,17 +163,23 @@ Build DPDK and Pktgen
Set up the environmental variables required by DPDK::
export RTE_SDK=<DPDKInstallDir>
+ export RTE_TARGET=x86_64-native-linux-gcc
+ or
export RTE_TARGET=x86_64-native-linuxapp-gcc
# or use clang if you have it installed:
+ export RTE_TARGET=x86_64-native-linux-clang
+ or
export RTE_TARGET=x86_64-native-linuxapp-clang
Create the DPDK build tree::
$ cd $RTE_SDK
+ $ make install T=x86_64-native-linux-gcc
+ or
$ make install T=x86_64-native-linuxapp-gcc
-This above command will create the `x86_64-pktgen-linuxapp-gcc` directory in
+This above command will create the `x86_64-pktgen-linux-gcc` directory in
the top level of the ``$RTE_SDK`` directory. It will also build the basic DPDK
libraries, kernel modules and build tree.
@@ -223,12 +229,12 @@ Here is the default.cfg file::
'85:00.0 85:00.1 85:00.2 85:00.3',
'83:00.0'
],
-
+
'opts': [
'-b igb_uio'
]
}
-
+
# Run command and options
run = {
'dpdk': [
@@ -239,7 +245,7 @@ Here is the default.cfg file::
'--socket-mem 2048,2048',
'--file-prefix pg'
],
-
+
'blacklist': [
#'-b 81:00.0 -b 81:00.1 -b 81:00.2 -b 81:00.3',
#'-b 85:00.0 -b 85:00.1 -b 85:00.2 -b 85:00.3',
@@ -247,7 +253,7 @@ Here is the default.cfg file::
'-b 85:00.0 -b 85:00.1',
'-b 83:00.0'
],
-
+
'pktgen': [
'-T',
'-P',
@@ -257,7 +263,7 @@ Here is the default.cfg file::
'-m [10:11].2',
'-m [12:13].3',
],
-
+
'misc': [
'-f themes/black-yellow.theme'
]
@@ -277,7 +283,9 @@ You may also wish to edit your ``.bashrc``, ``.profile`` or ``.cshrc`` files to
permanently add the environment variables that you set up above::
export RTE_SDK=<DPDKInstallDir>
- export RTE_TARGET=x86_64-native-linuxapp-gcc
+ export RTE_TARGET=x86_64-native-linux-gcc
+ or
+ export RTE_TARGET=x86_64-native-linux-appgcc
Running the application
diff --git a/docs/source/usage_pktgen.rst b/docs/source/usage_pktgen.rst
index e28b355..287e0e6 100644
--- a/docs/source/usage_pktgen.rst
+++ b/docs/source/usage_pktgen.rst
@@ -13,7 +13,7 @@ The :ref:`usage_eal` were shown in the previous section.
The ``pktgen`` arguments are::
-Usage: ./app/app/x86_64-dnet-linuxapp-gcc/pktgen [EAL options] -- [-h] [-P] [-G] [-T] [-f cmd_file] [-l log_file] [-s P:PCAP_file] [-m <string>]
+Usage: ./app/app/x86_64-dnet-linux-gcc/pktgen [EAL options] -- [-h] [-P] [-G] [-T] [-f cmd_file] [-l log_file] [-s P:PCAP_file] [-m <string>]
-s P:file PCAP packet stream file, 'P' is the port number
-f filename Command file (.pkt) to execute or a Lua script (.lua) file
-l filename Write log to filename
diff --git a/gui/pktgen-gui-streams.c b/gui/pktgen-gui-streams.c
index fbb05bc..8f15a2d 100644
--- a/gui/pktgen-gui-streams.c
+++ b/gui/pktgen-gui-streams.c
@@ -39,7 +39,7 @@ fill_proto_field_info(proto_type type, unsigned int pid, unsigned int seq_id)
pkt = &info->seq_pkt[SINGLE_PKT];
if (type == TYPE_ETH) {
- struct ether_addr *eaddr = &pkt->eth_dst_addr;
+ struct pg_ether_addr *eaddr = &pkt->eth_dst_addr;
val.name = g_strdup(pktgen_ethernet_fields[i++]);
snprintf(buff, sizeof(buff), "%02x%02x%02x%02x%02x%02x",
eaddr->addr_bytes[0], eaddr->addr_bytes[1],
@@ -75,7 +75,7 @@ fill_proto_field_info(proto_type type, unsigned int pid, unsigned int seq_id)
val.value = g_strdup(buff);
g_array_append_vals(packet_info, &val, 1);
- size = (pkt->pktSize + ETHER_CRC_LEN);
+ size = (pkt->pktSize + PG_ETHER_CRC_LEN);
sprintf(buff, "%d", size);
gtk_entry_set_text(GTK_ENTRY(pktsize_entry), buff);
@@ -607,8 +607,8 @@ pktsize_enter_callback(GtkWidget *widget, gpointer *data)
entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
size = atoi(entry_text);
- if (( (size - ETHER_CRC_LEN) < MIN_PKT_SIZE) ||
- ( (size - ETHER_CRC_LEN) > MAX_PKT_SIZE)) {
+ if (( (size - PG_ETHER_CRC_LEN) < MIN_PKT_SIZE) ||
+ ( (size - PG_ETHER_CRC_LEN) > MAX_PKT_SIZE)) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new(
GTK_WINDOW(stream_window),
@@ -616,8 +616,8 @@ pktsize_enter_callback(GtkWidget *widget, gpointer *data)
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Acceptable range is [%d - %d]\nAlphabets/special characters are not allowed",
- (MIN_PKT_SIZE + ETHER_CRC_LEN),
- (MAX_PKT_SIZE + ETHER_CRC_LEN));
+ (MIN_PKT_SIZE + PG_ETHER_CRC_LEN),
+ (MAX_PKT_SIZE + PG_ETHER_CRC_LEN));
gtk_window_set_title(GTK_WINDOW(dialog),
"Pktgen");
gtk_dialog_run(GTK_DIALOG(dialog));
@@ -880,8 +880,8 @@ set_stream_info(unsigned int pid, unsigned int seq_id)
port_info_t *info = NULL;
pkt_seq_t *pkt = NULL;
uint8_t *usr_def = NULL;
- unsigned int l4_and_payload[MAX_PKT_SIZE - ETHER_CRC_LEN];
- gchar usr_def_str[MAX_PKT_SIZE - ETHER_CRC_LEN];
+ unsigned int l4_and_payload[MAX_PKT_SIZE - PG_ETHER_CRC_LEN];
+ gchar usr_def_str[MAX_PKT_SIZE - PG_ETHER_CRC_LEN];
GtkTextIter start;
GtkTextIter end;
unsigned int size;
@@ -905,7 +905,7 @@ set_stream_info(unsigned int pid, unsigned int seq_id)
entry_text = gtk_entry_get_text(GTK_ENTRY(pktsize_entry));
size = atoi(entry_text);
- pkt->pktSize = (size - ETHER_CRC_LEN);
+ pkt->pktSize = (size - PG_ETHER_CRC_LEN);
ip_proto_str = gtk_entry_get_text(GTK_ENTRY(ip_proto_entry));
ascii_to_number(ip_proto_str, ip_proto_value, 1);
@@ -985,10 +985,10 @@ set_stream_info(unsigned int pid, unsigned int seq_id)
ascii_to_number(usr_def_str, l4_and_payload, strlen(usr_def_str));
for (i = 0; i < strlen(usr_def_str) / 2; i++)
- usr_def[i + sizeof(struct ether_hdr) +
- sizeof(struct ipv4_hdr)] = l4_and_payload[i];
+ usr_def[i + sizeof(struct pg_ether_hdr) +
+ sizeof(struct pg_ipv4_hdr)] = l4_and_payload[i];
- usr_def[sizeof(struct ether_hdr) + 9] = ip_proto_value[0]; /* Overwrite the IPv4 protocol field */
+ usr_def[sizeof(struct pg_ether_hdr) + 9] = ip_proto_value[0]; /* Overwrite the IPv4 protocol field */
pkt->ipProto = ip_proto_value[0];
}
diff --git a/gui/pktgen-gui.c b/gui/pktgen-gui.c
index e3c5fea..4ed671b 100644
--- a/gui/pktgen-gui.c
+++ b/gui/pktgen-gui.c
@@ -190,7 +190,7 @@ update_port_static_info(unsigned int pid)
case 3:
g_snprintf(buf, sizeof(buf), "%d",
- (pkt->pktSize + ETHER_CRC_LEN));
+ (pkt->pktSize + PG_ETHER_CRC_LEN));
break;
case 4:
@@ -206,9 +206,9 @@ update_port_static_info(unsigned int pid)
break;
case 7:
g_snprintf(buf, sizeof(buf), "%s",
- (pkt->ethType == ETHER_TYPE_IPv4) ? "IPv4" :
- (pkt->ethType == ETHER_TYPE_IPv6) ? "IPv6" :
- (pkt->ethType == ETHER_TYPE_ARP) ? "ARP" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv4) ? "IPv4" :
+ (pkt->ethType == PG_ETHER_TYPE_IPv6) ? "IPv6" :
+ (pkt->ethType == PG_ETHER_TYPE_ARP) ? "ARP" :
(pkt->ipProto == PG_IPPROTO_TCP) ? "TCP" :
(pkt->ipProto == PG_IPPROTO_ICMP) ? "ICMP" : "UDP");
break;
diff --git a/lib/cli/Makefile b/lib/cli/Makefile
index 649bfdc..ba6c8f6 100644
--- a/lib/cli/Makefile
+++ b/lib/cli/Makefile
@@ -16,10 +16,10 @@ CFLAGS += -I$(RTE_SRCDIR)/../lua/src
endif
ifeq ($(CONFIG_RTE_LIBRTE_UTILS),y)
else
-CFLAGS += -I$(RTE_SRCDIR)/../utils
+CFLAGS += -I$(RTE_SRCDIR)/../common
endif
-LDLIBS += -L$(RTE_SRCDIR)/../utils/$(RTE_TARGET)/lib -lrte_eal -lrte_mempool -lrte_mbuf -lrte_timer
+LDLIBS += -L$(RTE_SRCDIR)/../common/$(RTE_TARGET)/lib -lrte_eal -lrte_mempool -lrte_mbuf -lrte_timer
ifeq ($(CONFIG_RTE_LIBRTE_UTILS),y)
else
LDLIBS += -lutils
diff --git a/lib/cli/cli.c b/lib/cli/cli.c
index aa6e433..58ca815 100644
--- a/lib/cli/cli.c
+++ b/lib/cli/cli.c
@@ -11,7 +11,7 @@
#include <rte_timer.h>
#include <rte_log.h>
#include <rte_string_fns.h>
-#include <rte_strings.h>
+#include <_strings.h>
#include <rte_pause.h>
#include "cli.h"
diff --git a/lib/cli/cli.rst b/lib/cli/cli.rst
index b02a602..094fa8a 100644
--- a/lib/cli/cli.rst
+++ b/lib/cli/cli.rst
@@ -213,6 +213,8 @@ Compiling the Application
.. code-block:: console
+ export RTE_TARGET=x86_64-native-linux-gcc
+ or
export RTE_TARGET=x86_64-native-linuxapp-gcc
Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
@@ -226,7 +228,7 @@ Compiling the Application
Running the Application
-----------------------
-To run the application in linuxapp environment, issue the following command:
+To run the application in linux environment, issue the following command:
.. code-block:: console
@@ -435,8 +437,8 @@ Example:
static const char *show_help[] = {
"show <portlist>",
- "show <portlist> mac <ether_addr>",
- "show <portlist> vlan <vlanid> mac <ether_addr>",
+ "show <portlist> mac <pg_ether_addr>",
+ "show <portlist> vlan <vlanid> mac <pg_ether_addr>",
"show <portlist> [vlan|mac]",
NULL
};
@@ -446,7 +448,7 @@ Example:
{
struct cli_map *m;
uint32_t portlist;
- struct ether_addr mac;
+ struct pg_ether_addr mac;
m = cli_mapping(Show_info.map, argc, argv);
if (!m)
@@ -454,11 +456,11 @@ Example:
switch(m->index) {
case 10:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
cli_printf(" Show Portlist: %08x\n", portlist);
break;
case 20:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
rte_ether_aton(argv[3], &mac);
cli_printf(" Show Portlist: %08x, MAC: "
"%02x:%02x:%02x:%02x:%02x:%02x\n",
@@ -471,7 +473,7 @@ Example:
mac.addr_bytes[5]);
break;
case 30:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
rte_ether_aton(argv[5], &mac);
cli_printf(" Show Portlist: %08x vlan %d MAC: "
"%02x:%02x:%02x:%02x:%02x:%02x\n",
@@ -485,7 +487,7 @@ Example:
mac.addr_bytes[5]);
break;
case 40:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
rte_ether_aton("1234:4567:8901", &mac);
cli_printf(" Show Portlist: %08x %s: ",
portlist, argv[2]);
diff --git a/lib/cli/cli_auto_complete.c b/lib/cli/cli_auto_complete.c
index 3976e8a..eceb1df 100644
--- a/lib/cli/cli_auto_complete.c
+++ b/lib/cli/cli_auto_complete.c
@@ -5,7 +5,7 @@
#include <fnmatch.h>
#include <rte_string_fns.h>
-#include <rte_strings.h>
+#include <_strings.h>
#include "cli.h"
#include "cli_input.h"
diff --git a/lib/cli/cli_cmap.c b/lib/cli/cli_cmap.c
index 66638b7..1c932d6 100644
--- a/lib/cli/cli_cmap.c
+++ b/lib/cli/cli_cmap.c
@@ -285,26 +285,3 @@ cmap_free(struct cmap *cmap)
{
free(cmap);
}
-
-/* Helper for building log strings.
- * The macro takes an existing string, a printf-like format string and optional
- * arguments. It formats the string and appends it to the existing string,
- * while avoiding possible buffer overruns.
- */
-#define strncatf(dest, fmt, ...) do { \
- char _buff[1024]; \
- snprintf(_buff, sizeof(_buff), fmt, ## __VA_ARGS__); \
- strncat(dest, _buff, sizeof(dest) - strlen(dest) - 1); \
-} while (0)
-
-static __inline__ uint8_t
-sct(struct cmap *cm, uint8_t s, uint8_t c, uint8_t t) {
- lc_info_t *lc = cm->linfo;
- uint8_t i;
-
- for (i = 0; i < cm->num_cores; i++, lc++)
- if (lc->sid == s && lc->cid == c && lc->tid == t)
- return lc->lid;
-
- return 0;
-}
diff --git a/lib/cli/cli_cmds.c b/lib/cli/cli_cmds.c
index 81d229f..71b3fc5 100644
--- a/lib/cli/cli_cmds.c
+++ b/lib/cli/cli_cmds.c
@@ -12,7 +12,8 @@
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_string_fns.h>
-#include <rte_strings.h>
+#include <_strings.h>
+#include <_delay.h>
#include "cli.h"
#include "cli_input.h"
diff --git a/lib/cli/cli_input.c b/lib/cli/cli_input.c
index 7cab278..23a0eea 100644
--- a/lib/cli/cli_input.c
+++ b/lib/cli/cli_input.c
@@ -10,7 +10,7 @@
#include <rte_timer.h>
#include <rte_log.h>
#include <rte_string_fns.h>
-#include <rte_strings.h>
+#include <_strings.h>
#include "cli.h"
#include "cli_input.h"
diff --git a/lib/cli/cli_lib.rst b/lib/cli/cli_lib.rst
index 46d3406..2bed57e 100644
--- a/lib/cli/cli_lib.rst
+++ b/lib/cli/cli_lib.rst
@@ -293,6 +293,8 @@ Compiling the Application
.. code-block:: console
+ export RTE_TARGET=x86_64-native-linux-gcc
+ or
export RTE_TARGET=x86_64-native-linuxapp-gcc
Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
@@ -306,7 +308,7 @@ Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
Running the Application
-----------------------
-To run the application in linuxapp environment, issue the following command:
+To run the application in linux environment, issue the following command:
.. code-block:: console
@@ -513,8 +515,8 @@ Example:
static const char *show_help[] = {
"show <portlist>",
- "show <portlist> mac <ether_addr>",
- "show <portlist> vlan <vlanid> mac <ether_addr>",
+ "show <portlist> mac <pg_ether_addr>",
+ "show <portlist> vlan <vlanid> mac <pg_ether_addr>",
"show <portlist> [vlan|mac]",
CLI_HELP_PAUSE,
NULL
@@ -525,7 +527,7 @@ Example:
{
struct cli_map *m;
uint32_t portlist;
- struct ether_addr mac;
+ struct pg_ether_addr mac;
m = cli_mapping(Show_info.map, argc, argv);
if (!m)
@@ -533,11 +535,11 @@ Example:
switch(m->index) {
case 10:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
cli_printf(" Show Portlist: %08x\n", portlist);
break;
case 20:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
rte_ether_aton(argv[3], &mac);
cli_printf(" Show Portlist: %08x, MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
portlist,
@@ -549,7 +551,7 @@ Example:
mac.addr_bytes[5]);
break;
case 30:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
rte_ether_aton(argv[5], &mac);
cli_printf(" Show Portlist: %08x vlan %d MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
portlist,
@@ -562,7 +564,7 @@ Example:
mac.addr_bytes[5]);
break;
case 40:
- rte_parse_portlist(argv[1], &portlist);
+ portlist_parse(argv[1], &portlist);
rte_ether_aton("1234:4567:8901", &mac);
cli_printf(" Show Portlist: %08x %s: ",
portlist, argv[2]);
diff --git a/lib/cli/cli_map.c b/lib/cli/cli_map.c
index 62509aa..b972ec8 100644
--- a/lib/cli/cli_map.c
+++ b/lib/cli/cli_map.c
@@ -3,7 +3,7 @@
*/
#include <rte_string_fns.h>
-#include <rte_strings.h>
+#include <_strings.h>
#include "cli.h"
diff --git a/lib/cli/cli_search.c b/lib/cli/cli_search.c
index 66b5779..3a3c4b2 100644
--- a/lib/cli/cli_search.c
+++ b/lib/cli/cli_search.c
@@ -3,7 +3,7 @@
*/
#include <rte_string_fns.h>
-#include <rte_strings.h>
+#include <_strings.h>
#include "cli.h"
diff --git a/lib/cli/cli_vt100.c b/lib/cli/cli_vt100.c
index b27f9c2..9943fda 100644
--- a/lib/cli/cli_vt100.c
+++ b/lib/cli/cli_vt100.c
@@ -255,7 +255,7 @@ key_invalid(void)
{
}
-/* Order must be maintained see cli_vt100.h */
+/* Order must be maintained see cli_scrn.h */
static struct vt100_cmds vt100_cmd_list[] = {
{ "Invalid", key_invalid },
{ vt100_up_arr, key_up_arr }, /* Move cursor up one line */
diff --git a/lib/cli/meson.build b/lib/cli/meson.build
index e578d87..56b9e31 100644
--- a/lib/cli/meson.build
+++ b/lib/cli/meson.build
@@ -32,4 +32,9 @@ headers = files(
'cli_map.h',
'cli_scrn.h',
'cli_search.h')
-deps += ['ethdev', 'timer', 'pci']
+deps += ['common', 'utils']
+
+libs = ['timer']
+foreach lib:libs
+ ext_deps += cc.find_library('rte_' + lib, required: true, dirs: [dpdk_libdir])
+endforeach
diff --git a/lib/common/Makefile b/lib/common/Makefile
index 616fe7f..c7fc5e7 100644
--- a/lib/common/Makefile
+++ b/lib/common/Makefile
@@ -15,16 +15,16 @@ CFLAGS += -O3 -g $(WERROR_FLAGS) -I$(RTE_SRCDIR) -D_GNU_SOURCE
CFLAGS += -DALLOW_EXPERIMENTAL_API
LDLIBS += -lrte_eal -lrte_mempool -lrte_kvargs -lrte_cmdline
-
+
EXPORT_MAP := common_version.map
LIBABIVER := 1
# all source are stored in SRCS-y
SRCS-y := copyright_info.c port_config.c core_info.c cmdline_parse_args.c \
- lscpu.c utils.c coremap.c _pcap.c cksum.c l2p.c
+ lscpu.c utils.c coremap.c _pcap.c cksum.c l2p.c _strings.c
SYMLINK-y-include := cksum.h copyright_info.h core_info.h coremap.h \
cmdline_parse_args.h pg_ether.h l2p.h lscpu.h mbuf.h _pcap.h \
- port_config.h utils.h
+ port_config.h utils.h _delay.h _strings.h pg_compat.h
include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/common/_delay.h b/lib/common/_delay.h
new file mode 100644
index 0000000..b923917
--- /dev/null
+++ b/lib/common/_delay.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation.
+ */
+
+/**
+ * @file
+ *
+ * Compat file for pktgen
+ */
+
+#ifndef __DELAY_H_
+#define __DELAY_H_
+
+#include <time.h>
+#include <rte_version.h>
+#include <rte_cycles.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if RTE_VERSION < RTE_VERSION_NUM(18,11,0,0)
+static inline void
+rte_delay_us_sleep(unsigned int us)
+{
+ struct timespec wait[2];
+ int ind = 0;
+
+ wait[0].tv_sec = 0;
+ if (us >= US_PER_S) {
+ wait[0].tv_sec = us / US_PER_S;
+ us -= wait[0].tv_sec * US_PER_S;
+ }
+ wait[0].tv_nsec = 1000 * us;
+
+ while (nanosleep(&wait[ind], &wait[1 - ind]) && errno == EINTR) {
+ /*
+ * Sleep was interrupted. Flip the index, so the 'remainder'
+ * will become the 'request' for a next call.
+ */
+ ind = 1 - ind;
+ }
+}
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DELAY_H_ */
diff --git a/lib/common/_pcap.c b/lib/common/_pcap.c
index fe59ae4..09e162b 100644
--- a/lib/common/_pcap.c
+++ b/lib/common/_pcap.c
@@ -21,7 +21,7 @@
#include <assert.h>
#include <netinet/in.h>
-#include <rte_version.h>
+#include <pg_compat.h>
#include <rte_config.h>
#include <rte_log.h>
@@ -276,9 +276,9 @@ _pcap_close(pcap_info_t *pcap)
int
_pcap_payloadOffset(const unsigned char *pkt_data, unsigned int *offset,
unsigned int *length) {
- const struct ipv4_hdr *iph =
- (const struct ipv4_hdr *)(pkt_data + sizeof(struct ether_hdr));
- const struct tcp_hdr *th = NULL;
+ const struct pg_ipv4_hdr *iph =
+ (const struct pg_ipv4_hdr *)(pkt_data + sizeof(struct pg_ether_hdr));
+ const struct pg_tcp_hdr *th = NULL;
/* Ignore packets that aren't IPv4 */
if ( (iph->version_ihl & 0xF0) != 0x40)
@@ -294,18 +294,18 @@ _pcap_payloadOffset(const unsigned char *pkt_data, unsigned int *offset,
switch (iph->next_proto_id) {
case PG_IPPROTO_TCP:
- th = (const struct tcp_hdr *)((const char *)iph + ihlen);
+ th = (const struct pg_tcp_hdr *)((const char *)iph + ihlen);
thlen = (th->data_off >> 4) * 4;
break;
case PG_IPPROTO_UDP:
- thlen = sizeof(struct udp_hdr);
+ thlen = sizeof(struct pg_udp_hdr);
break;
default:
return -1;
}
- *offset = sizeof(struct ether_hdr) + ihlen + thlen;
- *length = sizeof(struct ether_hdr) + ntohs(iph->total_length) - *offset;
+ *offset = sizeof(struct pg_ether_hdr) + ihlen + thlen;
+ *length = sizeof(struct pg_ether_hdr) + ntohs(iph->total_length) - *offset;
return *length != 0;
}
diff --git a/lib/utils/rte_strings.c b/lib/common/_strings.c
index 8c3fd18..634a3e4 100644
--- a/lib/utils/rte_strings.c
+++ b/lib/common/_strings.c
@@ -2,7 +2,7 @@
* Copyright(c) 2019 Intel Corporation.
*/
-#include "rte_strings.h"
+#include "_strings.h"
#define SIZE_OF_PORTLIST (sizeof(portlist_t) * 8)
diff --git a/lib/utils/rte_strings.h b/lib/common/_strings.h
index 3a2e589..ff56bd6 100644
--- a/lib/utils/rte_strings.h
+++ b/lib/common/_strings.h
@@ -8,8 +8,8 @@
* String-related utility functions
*/
-#ifndef _RTE_STRINGS_H_
-#define _RTE_STRINGS_H_
+#ifndef __STRINGS_H_
+#define __STRINGS_H_
#include <stdio.h>
#include <string.h>
@@ -17,6 +17,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <pg_compat.h>
#include <rte_compat.h>
#include <rte_ether.h>
#include <rte_string_fns.h>
@@ -173,21 +174,21 @@ rte_strcnt(char *s, char c)
* String containing the MAC address in two forms
* XX:XX:XX:XX:XX:XX or XXXX:XXXX:XXX
* @param e
- * pointer to a struct ether_addr to place the return value. If the value
+ * pointer to a struct pg_ether_addr to place the return value. If the value
* is null then use a static location instead.
* @return
- * Pointer to the struct ether_addr structure;
+ * Pointer to the struct pg_ether_addr structure;
*/
-static inline struct ether_addr *
-rte_ether_aton(const char *a, struct ether_addr *e)
+static inline struct pg_ether_addr *
+rte_ether_aton(const char *a, struct pg_ether_addr *e)
{
int i;
char *end;
- unsigned long o[ETHER_ADDR_LEN];
- static struct ether_addr ether_addr;
+ unsigned long o[PG_ETHER_ADDR_LEN];
+ static struct pg_ether_addr pg_ether_addr;
if (!e)
- e = &ether_addr;
+ e = &pg_ether_addr;
i = 0;
do {
@@ -203,14 +204,14 @@ rte_ether_aton(const char *a, struct ether_addr *e)
return NULL;
/* Support the format XX:XX:XX:XX:XX:XX */
- if (i == ETHER_ADDR_LEN) {
+ if (i == PG_ETHER_ADDR_LEN) {
while (i-- != 0) {
if (o[i] > UINT8_MAX)
return NULL;
e->addr_bytes[i] = (uint8_t)o[i];
}
/* Support the format XXXX:XXXX:XXXX */
- } else if (i == ETHER_ADDR_LEN / 2) {
+ } else if (i == PG_ETHER_ADDR_LEN / 2) {
while (i-- != 0) {
if (o[i] > UINT16_MAX)
return NULL;
@@ -226,9 +227,9 @@ rte_ether_aton(const char *a, struct ether_addr *e)
#ifndef _MTOA_
#define _MTOA_
-/* char * inet_mtoa(char * buff, int len, struct ether_addr * eaddr) - Convert MAC address to ascii */
+/* char * inet_mtoa(char * buff, int len, struct pg_ether_addr * eaddr) - Convert MAC address to ascii */
static __inline__ char *
-inet_mtoa(char *buff, int len, struct ether_addr *eaddr) {
+inet_mtoa(char *buff, int len, struct pg_ether_addr *eaddr) {
snprintf(buff, len, "%02x:%02x:%02x:%02x:%02x:%02x",
eaddr->addr_bytes[0], eaddr->addr_bytes[1],
eaddr->addr_bytes[2], eaddr->addr_bytes[3],
@@ -282,4 +283,4 @@ inet_ntop4(char *buff, int len, unsigned long ip_addr, unsigned long mask) {
}
#endif
-#endif /* _RTE_STRINGS_H_ */
+#endif /* __STRINGS_H_ */
diff --git a/lib/common/meson.build b/lib/common/meson.build
index 18a807b..f8ef73d 100644
--- a/lib/common/meson.build
+++ b/lib/common/meson.build
@@ -7,7 +7,35 @@ sources = files(
'utils.c',
'coremap.c',
'_pcap.c',
+ '_strings.c',
'cksum.c',
'l2p.c'
)
-deps += dpdk_dep
+
+headers = files(
+ 'cksum.h',
+ 'cmdline_parse_args.h',
+ 'pg_compat.h',
+ 'copyright_info.h',
+ 'core_info.h',
+ 'coremap.h',
+ '_delay.h',
+ 'l2p.h',
+ 'lscpu.h',
+ 'mbuf.h',
+ '_pcap.h',
+ 'pg_ether.h',
+ 'pg_inet.h',
+ 'port_config.h',
+ '_strings.h',
+ 'utils.h'
+)
+
+libs = ['eal', 'cmdline']
+foreach lib:libs
+ ext_deps += cc.find_library('rte_' + lib,
+ required: true,
+ dirs: [dpdk_libdir])
+endforeach
+
+ext_deps += cc.find_library('bsd', required: true) \ No newline at end of file
diff --git a/lib/common/pg_compat.h b/lib/common/pg_compat.h
new file mode 100644
index 0000000..ec97c92
--- /dev/null
+++ b/lib/common/pg_compat.h
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation.
+ */
+
+/**
+ * @file
+ *
+ * Compat file for pktgen
+ */
+
+#ifndef PG_COMPAT_H_
+#define PG_COMPAT_H_
+
+#include <rte_version.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if RTE_VERSION >= RTE_VERSION_NUM(19,5,0,0)
+#define pg_ether_addr rte_ether_addr
+#define pg_ether_hdr rte_ether_hdr
+#define pg_ipv4_hdr rte_ipv4_hdr
+#define pg_ipv6_hdr rte_ipv6_hdr
+#define pg_tcp_hdr rte_tcp_hdr
+#define pg_udp_hdr rte_udp_hdr
+#define pg_icmp_hdr rte_icmp_hdr
+#define pg_arp_hdr rte_arp_hdr
+#define pg_vlan_hdr rte_vlan_hdr
+#define arp_hrd arp_hardware
+#define arp_pro arp_protocol
+#define arp_hln arp_hlen
+#define arp_pln arp_plen
+#define arp_op arp_opcode
+#define PG_ETHER_ADDR_LEN RTE_ETHER_ADDR_LEN
+#define PG_ETHER_CRC_LEN RTE_ETHER_CRC_LEN
+#define PG_ETHER_MIN_LEN RTE_ETHER_MIN_LEN
+#define PG_ETHER_MAX_LEN RTE_ETHER_MAX_LEN
+#if RTE_VERSION == RTE_VERSION_NUM(19,5,0,0)
+#define PG_ETHER_TYPE_IPv4 RTE_ETHER_TYPE_IPv4
+#define PG_ETHER_TYPE_IPv6 RTE_ETHER_TYPE_IPv6
+#else
+#define PG_ETHER_TYPE_IPv4 RTE_ETHER_TYPE_IPV4
+#define PG_ETHER_TYPE_IPv6 RTE_ETHER_TYPE_IPV6
+#endif
+#define PG_ETHER_TYPE_VLAN RTE_ETHER_TYPE_VLAN
+#define PG_ETHER_TYPE_ARP RTE_ETHER_TYPE_ARP
+#define pg_ether_format_addr rte_ether_format_addr
+#define pg_ether_addr_copy rte_ether_addr_copy
+#else
+#define pg_ether_addr ether_addr
+#define pg_ether_hdr ether_hdr
+#define pg_ipv4_hdr ipv4_hdr
+#define pg_ipv6_hdr ipv6_hdr
+#define pg_tcp_hdr tcp_hdr
+#define pg_udp_hdr udp_hdr
+#define pg_icmp_hdr icmp_hdr
+#define pg_arp_hdr arp_hdr
+#define pg_vlan_hdr vlan_hdr
+#define PG_ETHER_ADDR_LEN ETHER_ADDR_LEN
+#define PG_ETHER_CRC_LEN ETHER_CRC_LEN
+#define PG_ETHER_MIN_LEN ETHER_MIN_LEN
+#define PG_ETHER_MAX_LEN ETHER_MAX_LEN
+#define PG_ETHER_TYPE_IPv4 ETHER_TYPE_IPv4
+#define PG_ETHER_TYPE_IPv6 ETHER_TYPE_IPv6
+#define PG_ETHER_TYPE_VLAN ETHER_TYPE_VLAN
+#define PG_ETHER_TYPE_ARP ETHER_TYPE_ARP
+#define pg_ether_format_addr ether_format_addr
+#define pg_ether_addr_copy ether_addr_copy
+#endif
+
+#if RTE_VERSION >= RTE_VERSION_NUM(18, 5, 0, 0)
+#define pg_eth_dev_count_avail rte_eth_dev_count_avail
+#define pg_eth_dev_count_total rte_eth_dev_count_total
+#else
+#define pg_eth_dev_count_avail rte_eth_dev_count
+#define pg_eth_dev_count_total rte_eth_dev_count
+#endif
+
+#ifdef PG_cplusplus
+}
+#endif
+
+#endif /* PG_COMPAT_H_ */
diff --git a/lib/common/pg_ether.h b/lib/common/pg_ether.h
index c27b98f..44a99d0 100644
--- a/lib/common/pg_ether.h
+++ b/lib/common/pg_ether.h
@@ -27,21 +27,21 @@ extern "C" {
* String containing the MAC address in two forms
* XX:XX:XX:XX:XX:XX or XXXX:XXXX:XXX
* @param e
- * pointer to a struct ether_addr to place the return value. If the value
+ * pointer to a struct pg_ether_addr to place the return value. If the value
* is null then use a static location instead.
* @return
- * Pointer to the struct ether_addr structure;
+ * Pointer to the struct pg_ether_addr structure;
*/
-static inline struct ether_addr *
-rte_ether_aton(const char *a, struct ether_addr *e)
+static inline struct pg_ether_addr *
+rte_ether_aton(const char *a, struct pg_ether_addr *e)
{
int i;
char *end;
- unsigned long o[ETHER_ADDR_LEN];
- static struct ether_addr ether_addr;
+ unsigned long o[PG_ETHER_ADDR_LEN];
+ static struct pg_ether_addr pg_ether_addr;
if (!e)
- e = &ether_addr;
+ e = &pg_ether_addr;
i = 0;
do {
@@ -57,14 +57,14 @@ rte_ether_aton(const char *a, struct ether_addr *e)
return NULL;
/* Support the format XX:XX:XX:XX:XX:XX */
- if (i == ETHER_ADDR_LEN) {
+ if (i == PG_ETHER_ADDR_LEN) {
while (i-- != 0) {
if (o[i] > UINT8_MAX)
return NULL;
e->addr_bytes[i] = (uint8_t)o[i];
}
/* Support the format XXXX:XXXX:XXXX */
- } else if (i == ETHER_ADDR_LEN / 2) {
+ } else if (i == PG_ETHER_ADDR_LEN / 2) {
while (i-- != 0) {
if (o[i] > UINT16_MAX)
return NULL;
diff --git a/lib/common/pg_inet.h b/lib/common/pg_inet.h
index 2c71dd6..1d2ebea 100644
--- a/lib/common/pg_inet.h
+++ b/lib/common/pg_inet.h
@@ -18,6 +18,7 @@
#include <arpa/inet.h>
+#include <pg_compat.h>
#include <rte_ether.h>
#include <rte_net.h>
#include <rte_icmp.h>
@@ -53,7 +54,7 @@ struct pg_ipaddr {
#define PG_OFF_DF 0x4000
/******************************************************************************
- * struct ipv4_hdr.proto values in the IP Header.
+ * struct pg_ipv4_hdr.proto values in the IP Header.
* 1 ICMP Internet Control Message [RFC792]
* 2 IGMP Internet Group Management [RFC1112]
* 4 IP IP in IP (encapsulation) [RFC2003]
@@ -151,20 +152,20 @@ typedef unsigned int seq_t; /* TCP Sequence type */
/* The UDP/IP Pseudo header */
typedef struct udpip_s {
ipOverlay_t ip; /* IPv4 overlay header */
- struct udp_hdr udp; /* UDP header for protocol */
+ struct pg_udp_hdr udp; /* UDP header for protocol */
} __attribute__((__packed__)) udpip_t;
/* The GTP-U/UDP/IP Pseudo header */
typedef struct gtpuUdpIp_s {
ipOverlay_t ip; /* IPv4 overlay header */
- struct udp_hdr udp; /* UDP header for protocol */
+ struct pg_udp_hdr udp; /* UDP header for protocol */
gtpuHdr_t gtpu; /* GTP-U header */
} __attribute__((__packed__)) gtpuUdpIp_t;
/* The UDP/IPv6 Pseudo header */
typedef struct udpipv6_s {
ipv6Overlay_t ip; /* IPv6 overlay header */
- struct udp_hdr udp; /* UDP header for protocol */
+ struct pg_udp_hdr udp; /* UDP header for protocol */
} __attribute__((__packed__)) udpipv6_t;
enum { URG_FLAG = 0x20, ACK_FLAG = 0x10, PSH_FLAG = 0x08, RST_FLAG = 0x04,
@@ -173,20 +174,20 @@ enum { URG_FLAG = 0x20, ACK_FLAG = 0x10, PSH_FLAG = 0x08, RST_FLAG = 0x04,
/* The TCP/IPv4 Pseudo header */
typedef struct tcpip_s {
ipOverlay_t ip; /* IPv4 overlay header */
- struct tcp_hdr tcp; /* TCP header for protocol */
+ struct pg_tcp_hdr tcp; /* TCP header for protocol */
} __attribute__((__packed__)) tcpip_t;
/* The GTPu/TCP/IPv4 Pseudo header */
typedef struct gtpuTcpIp_s {
ipOverlay_t ip; /* IPv4 overlay header */
- struct tcp_hdr tcp; /* TCP header for protocol */
+ struct pg_tcp_hdr tcp; /* TCP header for protocol */
gtpuHdr_t gtpu; /* GTP-U header */
} __attribute__((__packed__)) gtpuTcpIp_t;
/* The TCP/IPv6 Pseudo header */
typedef struct tcpipv6_s {
ipv6Overlay_t ip; /* IPv6 overlay header */
- struct tcp_hdr tcp; /* TCP header for protocol */
+ struct pg_tcp_hdr tcp; /* TCP header for protocol */
} __attribute__((__packed__)) tcpipv6_t;
/* ICMPv4 Packet data structures */
@@ -309,7 +310,7 @@ typedef struct mplsHdr_s {
*/
typedef struct qinqHdr_s {
uint16_t qinq_tci; /**< Outer tag PCP, DEI, VID */
- uint16_t vlan_tpid; /**< Must be ETHER_TYPE_VLAN (0x8100) */
+ uint16_t vlan_tpid; /**< Must be PG_ETHER_TYPE_VLAN (0x8100) */
uint16_t vlan_tci; /**< Inner tag PCP, DEI, VID */
uint16_t eth_proto; /**< EtherType of encapsulated frame */
} __attribute__ ((__packed__)) qinqHdr_t;
@@ -360,15 +361,15 @@ typedef struct greHdr_s {
/* the GRE/IPv4 header */
typedef struct greIp_s {
- struct ipv4_hdr ip; /* Outer IPv4 header */
+ struct pg_ipv4_hdr ip; /* Outer IPv4 header */
greHdr_t gre; /* GRE header for protocol */
} __attribute__ ((__packed__)) greIp_t;
/* the GRE/Ethernet header */
typedef struct greEther_s {
- struct ipv4_hdr ip; /* Outer IPv4 header */
+ struct pg_ipv4_hdr ip; /* Outer IPv4 header */
greHdr_t gre; /* GRE header */
- struct ether_hdr ether; /* Inner Ethernet header */
+ struct pg_ether_hdr ether; /* Inner Ethernet header */
} __attribute__ ((__packed__)) greEther_t;
/* Common defines for Ethernet */
@@ -404,14 +405,14 @@ typedef union {
} ip4_e;
typedef struct pkt_hdr_s {
- struct ether_hdr eth; /**< Ethernet header */
+ struct pg_ether_hdr eth; /**< Ethernet header */
union {
- struct ipv4_hdr ipv4; /**< IPv4 Header */
- struct ipv6_hdr ipv6; /**< IPv6 Header */
+ struct pg_ipv4_hdr ipv4; /**< IPv4 Header */
+ struct pg_ipv6_hdr ipv6; /**< IPv6 Header */
tcpip_t tip; /**< TCP + IPv4 Headers */
udpip_t uip; /**< UDP + IPv4 Headers */
gtpuUdpIp_t guip; /**< GTP-U + UDP + IPv4 Header */
- struct icmp_hdr icmp; /**< ICMP + IPv4 Headers */
+ struct pg_icmp_hdr icmp; /**< ICMP + IPv4 Headers */
tcpipv6_t tip6; /**< TCP + IPv6 Headers */
udpipv6_t uip6; /**< UDP + IPv6 Headers */
uint64_t pad[8]; /**< Length of structures */
@@ -592,9 +593,9 @@ inet_ntop6(char *buff, int len, uint8_t *ip6) {
#ifndef _MTOA_
#define _MTOA_
-/* char * inet_mtoa(char * buff, int len, struct ether_addr * eaddr) - Convert MAC address to ascii */
+/* char * inet_mtoa(char * buff, int len, struct pg_ether_addr * eaddr) - Convert MAC address to ascii */
static __inline__ char *
-inet_mtoa(char *buff, int len, struct ether_addr *eaddr) {
+inet_mtoa(char *buff, int len, struct pg_ether_addr *eaddr) {
snprintf(buff, len, "%02x:%02x:%02x:%02x:%02x:%02x",
eaddr->addr_bytes[0], eaddr->addr_bytes[1],
eaddr->addr_bytes[2], eaddr->addr_bytes[3],
@@ -605,7 +606,7 @@ inet_mtoa(char *buff, int len, struct ether_addr *eaddr) {
/* convert a MAC address from network byte order to host 64bit number */
static __inline__ uint64_t
-inet_mtoh64(struct ether_addr *eaddr, uint64_t *value) {
+inet_mtoh64(struct pg_ether_addr *eaddr, uint64_t *value) {
*value = ((uint64_t)eaddr->addr_bytes[5] << 0)
+ ((uint64_t)eaddr->addr_bytes[4] << 8)
+ ((uint64_t)eaddr->addr_bytes[3] << 16)
@@ -616,8 +617,8 @@ inet_mtoh64(struct ether_addr *eaddr, uint64_t *value) {
}
/* convert a host 64bit number to MAC address in network byte order */
-static __inline__ struct ether_addr *
-inet_h64tom(uint64_t value, struct ether_addr *eaddr) {
+static __inline__ struct pg_ether_addr *
+inet_h64tom(uint64_t value, struct pg_ether_addr *eaddr) {
eaddr->addr_bytes[5] = ((value >> 0) & 0xFF);
eaddr->addr_bytes[4] = ((value >> 8) & 0xFF);
eaddr->addr_bytes[3] = ((value >> 16) & 0xFF);
@@ -641,7 +642,7 @@ inet_h64tom(uint64_t value, struct ether_addr *eaddr) {
* @return
* 0 on OK and -1 on error
*/
-int rte_atoip(const char *buf, int flags, void *res, unsigned ressize);
+int _atoip(const char *buf, int flags, void *res, unsigned ressize);
#ifdef __cplusplus
}
diff --git a/lib/lua/Makefile b/lib/lua/Makefile
index fab51c2..2ea5b03 100644
--- a/lib/lua/Makefile
+++ b/lib/lua/Makefile
@@ -28,9 +28,10 @@ WERROR_FLAGS += -Wno-cast-align
CFLAGS += -O3 -g -DLUA_USE_LINUX -DUSE_64_BIT -DALLOW_EXPERIMENTAL_API
CFLAGS += -D_GNU_SOURCE $(WERROR_FLAGS) -I$(RTE_SRCDIR) -fno-stack-protector
+CFLAGS += -I$(SRCDIR)/../common/$(RTE_TARGET)/include
LDLIBS += -lrte_eal -lrte_mempool -lrte_ethdev -lrte_mbuf -lrte_timer
-LDLIBS += -L/work/projects/intel/pktgen/lib/utils/x86_64-native-linuxapp-gcc/lib -lutils
+LDLIBS += -L/work/projects/intel/pktgen/lib/utils/$(RTE_TARGET)/lib -lutils
ifeq ($(CONFIG_RTE_LIBRTE_VEC),y)
else
@@ -88,12 +89,12 @@ endif
LDLIBS += -pthread
# all source are stored in SRCS-y
-SRCS-y := rte_lua.c rte_lua_stdio.c rte_lua_utils.c rte_lua_socket.c
-SRCS-y += rte_lua_dpdk.c rte_lua_pktmbuf.c rte_lua_vec.c
-SRCS-y += rte_lua_dapi.c
+SRCS-y := lua_config.c lua_stdio.c lua_utils.c lua_socket.c
+SRCS-y += lua_dpdk.c lua_pktmbuf.c lua_vec.c
+SRCS-y += lua_dapi.c
-SYMLINK-y-include := rte_lua.h rte_lua_stdio.h rte_lua_utils.h rte_lua_socket.h
-SYMLINK-y-include += rte_lua_dpdk.h rte_lua_pktmbuf.h rte_lua_vec.h
-SYMLINK-y-include += rte_lua_dapi.h
+SYMLINK-y-include := lua_config.h lua_stdio.h lua_utils.h lua_socket.h
+SYMLINK-y-include += lua_dpdk.h lua_pktmbuf.h lua_vec.h
+SYMLINK-y-include += lua_dapi.h
include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/lua/rte_lua.c b/lib/lua/lua_config.c
index ebfbe9f..77f16dd 100644
--- a/lib/lua/rte_lua.c
+++ b/lib/lua/lua_config.c
@@ -24,9 +24,9 @@
#include <rte_eal_memconfig.h>
#include <rte_rwlock.h>
-#include "rte_lua.h"
-#include "rte_lua_stdio.h"
-#include "rte_lua_utils.h"
+#include "lua_config.h"
+#include "lua_stdio.h"
+#include "lua_utils.h"
TAILQ_HEAD(rte_luaData_list, rte_tailq_entry);
@@ -334,7 +334,7 @@ lua_execute_string(luaData_t *ld, char *buffer )
if (!L)
return -1;
- buffer = rte_lua_strtrim(buffer);
+ buffer = lua_strtrim(buffer);
if (!buffer)
return -1;
diff --git a/lib/lua/rte_lua.h b/lib/lua/lua_config.h
index b8bc2bd..9085f5f 100644
--- a/lib/lua/rte_lua.h
+++ b/lib/lua/lua_config.h
@@ -4,8 +4,8 @@
/* Created 2018 by Keith Wiles @ intel.com */
-#ifndef _RTE_LUA_H_
-#define _RTE_LUA_H_
+#ifndef _LUA_CONFIG_H_
+#define _LUA_CONFIG_H_
#include <stdio.h>
#include <stdlib.h>
@@ -99,4 +99,4 @@ luaData_t *lua_find_luaData(lua_State *L);
}
#endif
-#endif /* _RTE_LUA_H_ */
+#endif /* _LUA_CONFIG_H_ */
diff --git a/lib/lua/rte_lua_dapi.c b/lib/lua/lua_dapi.c
index 9a2ed53..b1ca701 100644
--- a/lib/lua/rte_lua_dapi.c
+++ b/lib/lua/lua_dapi.c
@@ -3,7 +3,7 @@
*/
/* Created 2018 by Keith Wiles @ intel.com */
-#define rte_lua_dpdk_c
+#define lua_dpdk_c
#define LUA_LIB
#define lua_c
@@ -11,18 +11,18 @@
#include <rte_ethdev.h>
#include <rte_mbuf.h>
#include <rte_cycles.h>
-#include <rte_vec.h>
+#include <vec.h>
#include <rte_timer.h>
-#include <rte_strings.h>
+#include <_strings.h>
#include <rte_version.h>
#include <dapi.h>
-#include "rte_lua.h"
-#include "rte_lua_stdio.h"
-#include "rte_lua_dpdk.h"
-#include "rte_lua_dapi.h"
-#include "rte_lua_utils.h"
+#include "lua_config.h"
+#include "lua_stdio.h"
+#include "lua_dpdk.h"
+#include "lua_dapi.h"
+#include "lua_utils.h"
#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wcast-qual"
diff --git a/lib/lua/rte_lua_dapi.h b/lib/lua/lua_dapi.h
index 69fbadc..69fbadc 100644
--- a/lib/lua/rte_lua_dapi.h
+++ b/lib/lua/lua_dapi.h
diff --git a/lib/lua/rte_lua_dpdk.c b/lib/lua/lua_dpdk.c
index db93d7a..e4a7c6d 100644
--- a/lib/lua/rte_lua_dpdk.c
+++ b/lib/lua/lua_dpdk.c
@@ -3,7 +3,7 @@
*/
/* Created 2018 by Keith Wiles @ intel.com */
-#define rte_lua_dpdk_c
+#define lua_dpdk_c
#define LUA_LIB
#define lua_c
@@ -11,23 +11,25 @@
#include <rte_ethdev.h>
#include <rte_mbuf.h>
#include <rte_cycles.h>
-#include <rte_vec.h>
+#include <vec.h>
#include <rte_timer.h>
-#include <rte_strings.h>
#include <rte_version.h>
-#include <rte_portlist.h>
-#include "rte_lua.h"
-#include "rte_lua_stdio.h"
-#include "rte_lua_dpdk.h"
-#include "rte_lua_pktmbuf.h"
+#include <_delay.h>
+#include <_strings.h>
+#include <portlist.h>
+
+#include "lua_config.h"
+#include "lua_stdio.h"
+#include "lua_dpdk.h"
+#include "lua_pktmbuf.h"
#ifdef RTE_LIBRTE_DAPI
-#include <rte_lua_dapi.h>
+#include <lua_dapi.h>
#else
int luaopen_dapi(lua_State *L);
#endif
-#include "rte_lua_vec.h"
-#include "rte_lua_utils.h"
+#include "lua_vec.h"
+#include "lua_utils.h"
#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wcast-qual"
@@ -168,7 +170,7 @@ dpdk_linkState(lua_State *L)
validate_arg_count(L, 1);
portlist = 0;
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
lua_newtable(L);
@@ -211,7 +213,7 @@ dpdk_portStats(lua_State *L)
validate_arg_count(L, 1);
- rte_parse_portlist(luaL_checkstring(L, 1), &portlist);
+ portlist_parse(luaL_checkstring(L, 1), &portlist);
lua_newtable(L);
@@ -246,7 +248,7 @@ decompile_pkt(lua_State *L, uint16_t pid)
inet_mtoa(buff, sizeof(buff), &p->eth_dst_addr));
setf_string(L, "eth_src_addr",
inet_mtoa(buff, sizeof(buff), &p->eth_src_addr));
- if (p->ethType == ETHER_TYPE_IPv4) {
+ if (p->ethType == PG_ETHER_TYPE_IPv4) {
setf_string(L, "ip_dst_addr",
inet_ntop4(buff, sizeof(buff),
htonl(p->ip_dst_addr),
@@ -268,16 +270,15 @@ decompile_pkt(lua_State *L, uint16_t pid)
setf_string(L,
"ethType",
(char *)(
- (p->ethType == ETHER_TYPE_IPv4) ? "ipv4" :
- (p->ethType == ETHER_TYPE_IPv6) ? "ipv6" :
+ (p->ethType == PG_ETHER_TYPE_IPv4) ? "ipv4" :
+ (p->ethType == PG_ETHER_TYPE_IPv6) ? "ipv6" :
(p->ethType ==
- ETHER_TYPE_VLAN) ? "vlan" : "unknown"));
+ PG_ETHER_TYPE_VLAN) ? "vlan" : "unknown"));
setf_string(L, "ipProto", (char *)(
(p->ipProto == IPPROTO_TCP) ? "tcp" :
(p->ipProto == IPPROTO_ICMP) ? "icmp" : "udp"));
- setf_integer(L, "pktSize", p->pktSize + ETHER_CRC_LEN);
-
+ setf_integer(L, "pktSize", p->pktSize + PG_ETHER_CRC_LEN);
/* Now set the table as an array with pid as the index. */
lua_rawset(L, -3);
}
@@ -290,7 +291,7 @@ dpdk_decompile(lua_State *L)
validate_arg_count(L, 2);
- rte_parse_portlist(luaL_checkstring(L, 2), &portlist);
+ portlist_parse(luaL_checkstring(L, 2), &portlist);
lua_newtable(L);
@@ -330,7 +331,7 @@ dpdk_portCount(lua_State *L)
{
validate_arg_count(L, 0);
- lua_pushinteger(L, rte_eth_dev_count_avail());
+ lua_pushinteger(L, pg_eth_dev_count_avail());
return 1;
}
@@ -340,7 +341,7 @@ dpdk_totalPorts(lua_State *L)
{
validate_arg_count(L, 0);
- lua_pushinteger(L, rte_eth_dev_count_total());
+ lua_pushinteger(L, pg_eth_dev_count_total());
return 1;
}
diff --git a/lib/lua/rte_lua_dpdk.h b/lib/lua/lua_dpdk.h
index 7ddb15a..6572452 100644
--- a/lib/lua/rte_lua_dpdk.h
+++ b/lib/lua/lua_dpdk.h
@@ -53,8 +53,8 @@ extern "C" {
struct pkt_data {
/* Packet type and information */
- struct ether_addr eth_dst_addr; /**< Destination Ethernet address */
- struct ether_addr eth_src_addr; /**< Source Ethernet address */
+ struct pg_ether_addr eth_dst_addr; /**< Destination Ethernet address */
+ struct pg_ether_addr eth_src_addr; /**< Source Ethernet address */
uint32_t ip_src_addr; /**< Source IPv4 address also used for IPv6 */
uint32_t ip_dst_addr; /**< Destination IPv4 address */
@@ -73,7 +73,7 @@ struct pkt_data {
typedef struct rte_mempool pktmbuf_t;
typedef struct rte_mempool mempool_t;
-typedef struct rte_vec vec_t;
+typedef struct vec vec_t;
/**************************************************************************//**
*
@@ -172,7 +172,7 @@ setf_udata(lua_State *L, const char *name, void *value)
#if 0
static __inline__ void
-getf_etheraddr(lua_State *L, const char *field, struct ether_addr *value)
+getf_etheraddr(lua_State *L, const char *field, struct pg_ether_addr *value)
{
lua_getfield(L, 3, field);
if (lua_isstring(L, -1) )
@@ -185,7 +185,7 @@ getf_ipaddr(lua_State *L, const char *field, void *value, uint32_t flags)
{
lua_getfield(L, 3, field);
if (lua_isstring(L, -1) ) {
- rte_atoip((char *)(uintptr_t)luaL_checkstring(L, -1), flags, value,
+ _atoip((char *)(uintptr_t)luaL_checkstring(L, -1), flags, value,
sizeof(struct pg_ipaddr));
}
lua_pop(L, 1);
diff --git a/lib/lua/rte_lua_pktmbuf.c b/lib/lua/lua_pktmbuf.c
index bd7ad8a..103c847 100644
--- a/lib/lua/rte_lua_pktmbuf.c
+++ b/lib/lua/lua_pktmbuf.c
@@ -3,23 +3,23 @@
*/
/* Created 2018 by Keith Wiles @ intel.com */
-#define rte_lua_dpdk_c
+#define lua_dpdk_c
#define LUA_LIB
#define lua_c
#include <rte_ethdev.h>
#include <rte_mbuf.h>
#include <rte_cycles.h>
-#include <rte_vec.h>
+#include <vec.h>
#include <rte_timer.h>
-#include <rte_strings.h>
#include <rte_version.h>
-#include "rte_lua.h"
-#include "rte_lua_stdio.h"
-#include "rte_lua_dpdk.h"
-#include "rte_lua_pktmbuf.h"
-#include "rte_lua_utils.h"
+#include <_strings.h>
+#include "lua_config.h"
+#include "lua_stdio.h"
+#include "lua_dpdk.h"
+#include "lua_pktmbuf.h"
+#include "lua_utils.h"
#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wcast-qual"
diff --git a/lib/lua/rte_lua_pktmbuf.h b/lib/lua/lua_pktmbuf.h
index e317808..e317808 100644
--- a/lib/lua/rte_lua_pktmbuf.h
+++ b/lib/lua/lua_pktmbuf.h
diff --git a/lib/lua/rte_lua_socket.c b/lib/lua/lua_socket.c
index 3a8d3e9..69e78eb 100644
--- a/lib/lua/rte_lua_socket.c
+++ b/lib/lua/lua_socket.c
@@ -20,10 +20,10 @@
#include <netdb.h>
#include <assert.h>
-#include "rte_lua.h"
-#include "rte_lua_stdio.h"
-#include "rte_lua_utils.h"
-#include "rte_lua_socket.h"
+#include "lua_config.h"
+#include "lua_stdio.h"
+#include "lua_utils.h"
+#include "lua_socket.h"
static int
server_startup(luaData_t *ld)
diff --git a/lib/lua/rte_lua_socket.h b/lib/lua/lua_socket.h
index ea29a98..ea29a98 100644
--- a/lib/lua/rte_lua_socket.h
+++ b/lib/lua/lua_socket.h
diff --git a/lib/lua/rte_lua_stdio.c b/lib/lua/lua_stdio.c
index 0b223c8..5c10ae3 100644
--- a/lib/lua/rte_lua_stdio.c
+++ b/lib/lua/lua_stdio.c
@@ -20,8 +20,8 @@
#include <netdb.h>
#include <assert.h>
-#include "rte_lua.h"
-#include "rte_lua_stdio.h"
+#include "lua_config.h"
+#include "lua_stdio.h"
#define tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE))
diff --git a/lib/lua/rte_lua_stdio.h b/lib/lua/lua_stdio.h
index acb160c..acb160c 100644
--- a/lib/lua/rte_lua_stdio.h
+++ b/lib/lua/lua_stdio.h
diff --git a/lib/lua/rte_lua_utils.c b/lib/lua/lua_utils.c
index 2718d59..a6d3fce 100644
--- a/lib/lua/rte_lua_utils.c
+++ b/lib/lua/lua_utils.c
@@ -20,12 +20,12 @@
#include <netdb.h>
#include <assert.h>
-#include "rte_lua.h"
-#include "rte_lua_stdio.h"
-#include "rte_lua_utils.h"
+#include "lua_config.h"
+#include "lua_stdio.h"
+#include "lua_utils.h"
char *
-rte_lua_strtrim(char *str)
+lua_strtrim(char *str)
{
if (!str || !*str)
return str;
diff --git a/lib/lua/rte_lua_utils.h b/lib/lua/lua_utils.h
index a204929..db5489f 100644
--- a/lib/lua/rte_lua_utils.h
+++ b/lib/lua/lua_utils.h
@@ -17,7 +17,7 @@
#include <string.h>
#include <pthread.h>
-#include <rte_lua.h>
+#include <lua_config.h>
#define lua_c
@@ -29,7 +29,7 @@
extern "C" {
#endif
-char *rte_lua_strtrim(char *str);
+char *lua_strtrim(char *str);
static inline void
lua_putstring(const char *s)
diff --git a/lib/lua/rte_lua_vec.c b/lib/lua/lua_vec.c
index 73df8ee..b922723 100644
--- a/lib/lua/rte_lua_vec.c
+++ b/lib/lua/lua_vec.c
@@ -3,23 +3,23 @@
*/
/* Created 2018 by Keith Wiles @ intel.com */
-#define rte_lua_dpdk_c
+#define lua_dpdk_c
#define LUA_LIB
#define lua_c
#include <rte_ethdev.h>
#include <rte_mbuf.h>
#include <rte_cycles.h>
-#include <rte_vec.h>
+#include <vec.h>
#include <rte_timer.h>
-#include <rte_strings.h>
#include <rte_version.h>
-#include "rte_lua.h"
-#include "rte_lua_stdio.h"
-#include "rte_lua_dpdk.h"
-#include "rte_lua_vec.h"
-#include "rte_lua_utils.h"
+#include <_strings.h>
+#include "lua_config.h"
+#include "lua_stdio.h"
+#include "lua_dpdk.h"
+#include "lua_vec.h"
+#include "lua_utils.h"
#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wcast-qual"
@@ -39,11 +39,11 @@ vec_new(lua_State *L)
if (top >= 1)
size = luaL_checkint(L, 1);
if (size == 0)
- size = rte_vec_calc_size(0);
+ size = vec_calc_size(0);
- v = (struct rte_vec *)lua_newuserdata(L,
- (sizeof(struct rte_vec) * (size * sizeof(void *))));
- rte_vec_init(v, size, VEC_CREATE_FLAG);
+ v = (struct vec *)lua_newuserdata(L,
+ (sizeof(struct vec) * (size * sizeof(void *))));
+ vec_init(v, size, VEC_CREATE_FLAG);
luaL_getmetatable(L, Vec);
lua_setmetatable(L, -2);
@@ -52,13 +52,13 @@ vec_new(lua_State *L)
}
static int
-vec_add1(lua_State *L)
+lvec_add1(lua_State *L)
{
- struct rte_vec *v;
+ struct vec *v;
validate_arg_count(L, 2);
- v = (struct rte_vec *)luaL_checkudata(L, 1, Vec);
+ v = (struct vec *)luaL_checkudata(L, 1, Vec);
if (v->len >= v->tlen)
return 0;
@@ -71,10 +71,10 @@ vec_add1(lua_State *L)
static int
vec_tostring(lua_State *L)
{
- struct rte_vec *v;
+ struct vec *v;
char buff[64];
- v = (struct rte_vec *)luaL_checkudata(L, 1, Vec);
+ v = (struct vec *)luaL_checkudata(L, 1, Vec);
lua_getmetatable(L, 1);
lua_getfield(L, -1, "__name");
@@ -91,25 +91,25 @@ vec_tostring(lua_State *L)
static int
vec_gc(lua_State *L)
{
- struct rte_vec *v;
+ struct vec *v;
struct rte_mbuf *m;
int i;
if (lua_gettop(L) != 1)
return luaL_error(L, "vec.gc, Invalid arg count should be 1");
- v = (struct rte_vec *)lua_touserdata(L, 1);
+ v = (struct vec *)lua_touserdata(L, 1);
- rte_vec_foreach(i, m, v) {
+ vec_foreach(i, m, v) {
if (m)
rte_pktmbuf_free(m);
}
- rte_vec_free(v);
+ vec_free(v);
return 0;
}
static const struct luaL_Reg vec_methods[] = {
- { "add1", vec_add1 },
+ { "add1", lvec_add1 },
{ NULL, NULL }
};
diff --git a/lib/lua/rte_lua_vec.h b/lib/lua/lua_vec.h
index b329f1a..8eaf83c 100644
--- a/lib/lua/rte_lua_vec.h
+++ b/lib/lua/lua_vec.h
@@ -4,7 +4,7 @@
/* Created 2018 by Keith Wiles @ intel.com */
#ifndef _RTE_LUA_VEC_H_
-#define _RTE_LUAVEC_H_
+#define _RTE_LUA_VEC_H_
#include <stdint.h>
#include <netinet/in.h>
diff --git a/lib/lua/meson.build b/lib/lua/meson.build
index ceeadfd..a73c08e 100644
--- a/lib/lua/meson.build
+++ b/lib/lua/meson.build
@@ -4,22 +4,29 @@
version = 1
allow_experimental_apis = true
sources = files(
- 'rte_lua.c',
- 'rte_lua_dapi.c',
- 'rte_lua_dpdk.c',
- 'rte_lua_pktmbuf.c',
- 'rte_lua_socket.c',
- 'rte_lua_stdio.c',
- 'rte_lua_utils.c',
- 'rte_lua_vec.c')
+ 'lua_config.c',
+ 'lua_dapi.c',
+ 'lua_dpdk.c',
+ 'lua_pktmbuf.c',
+ 'lua_socket.c',
+ 'lua_stdio.c',
+ 'lua_utils.c',
+ 'lua_vec.c')
headers = files(
- 'rte_lua_dapi.h',
- 'rte_lua_dpdk.h',
- 'rte_lua.h',
- 'rte_lua_pktmbuf.h',
- 'rte_lua_socket.h',
- 'rte_lua_stdio.h',
- 'rte_lua_utils.h',
- 'rte_lua_vec.h')
-#deps += ['eal', 'ethdev', 'mempool']
+ 'lua_dapi.h',
+ 'lua_dpdk.h',
+ 'lua_config.h',
+ 'lua_pktmbuf.h',
+ 'lua_socket.h',
+ 'lua_stdio.h',
+ 'lua_utils.h',
+ 'lua_vec.h')
+deps += ['common', 'vec']
+libs = ['eal', 'mbuf']
+foreach lib:libs
+ ext_deps += cc.find_library('rte_' + lib, required: true, dirs: [dpdk_libdir])
+endforeach
+
+ext_deps += cc.find_library('lua5.3', required: true)
+ext_deps += cc.find_library('pthread', required: true)
diff --git a/lib/meson.build b/lib/meson.build
index 9ec0305..f2de2ba 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -1,12 +1,17 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2019 Intel Corporation
-libraries = ['common', 'utils', 'vec', 'plugin', 'lua']
+libraries = ['common', 'utils', 'vec', 'plugin', 'cli', 'lua']
+
+default_cflags = machine_args
+if cc.has_argument('-Wno-format-truncation')
+ default_cflags += '-Wno-format-truncation'
+endif
# Set default cflags
-#default_cflags = glb_default_cflags
-default_cflags = []
+default_cflags += '-D_GNU_SOURCE'
+enabled_libs = []
foreach l:libraries
build = true
name = l
@@ -14,13 +19,12 @@ foreach l:libraries
allow_experimental_apis = false
sources = []
headers = []
- enabled_libs = []
- includes = [global_inc]
+ includes = []
cflags = default_cflags
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
- # use "deps" for internal PMDK dependencies, and "ext_deps" for
+ # use "deps" for internal Pktgen dependencies, and "ext_deps" for
# external package/library requirements
ext_deps = []
deps = []
@@ -31,11 +35,11 @@ foreach l:libraries
if build
enabled_libs += name
- # pmdk_conf.set('PME_LIB' + name.to_upper(), 1)
install_headers(headers)
libname = name
includes += include_directories(dir_name)
+ includes += dpdk_incs
if sources.length() == 0
message(' No sources in '+ libname)
@@ -47,14 +51,14 @@ foreach l:libraries
shared_deps = ext_deps
static_deps = ext_deps
foreach d:deps
- if not is_variable('static_pme_' + d)
+ if not is_variable('static_pktgen_' + d)
error('Missing dependency ' + d +
' for library ' + libname)
else
message(' === Found dependency ' + d)
endif
- shared_deps += [get_variable('shared_pme_' + d)]
- static_deps += [get_variable('static_pme_' + d)]
+ shared_deps += [get_variable('shared_pktgen_' + d)]
+ static_deps += [get_variable('static_pktgen_' + d)]
endforeach
if allow_experimental_apis
@@ -92,11 +96,11 @@ foreach l:libraries
include_directories: includes,
dependencies: shared_deps)
- pmdk_shared_libraries = [shared_lib] + pmdk_shared_libraries
- pmdk_static_libraries = [static_lib] + pmdk_static_libraries
+ pktgen_shared_libraries = [shared_lib] + pktgen_shared_libraries
+ pktgen_static_libraries = [static_lib] + pktgen_static_libraries
endif # sources.length() > 0
- set_variable('shared_pme_' + libname, shared_dep)
- set_variable('static_pme_' + libname, static_dep)
+ set_variable('shared_pktgen_' + libname, shared_dep)
+ set_variable('static_pktgen_' + libname, static_dep)
endif # if build
endforeach
diff --git a/lib/plugin/meson.build b/lib/plugin/meson.build
index a8cca4b..c7279a0 100644
--- a/lib/plugin/meson.build
+++ b/lib/plugin/meson.build
@@ -5,4 +5,6 @@ version = 1
sources = files('plugin.c')
headers = files('plugin.h')
-#deps +=['hash']
+deps += ['common']
+
+ext_deps += cc.find_library('dl', required: true)
diff --git a/lib/utils/Makefile b/lib/utils/Makefile
index 9ddff6c..b095c89 100644
--- a/lib/utils/Makefile
+++ b/lib/utils/Makefile
@@ -7,7 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
LIB = libutils.a
CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_GNU_SOURCE
-CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -DALLOW_EXPERIMENTAL_API -I$(SRCDIR)/../common/$(RTE_TARGET)/include
LDLIBS += -lrte_ethdev -lrte_eal
@@ -16,13 +16,13 @@ EXPORT_MAP := utils_version.map
LIBABIVER := 1
# all source are stored in SRCS-y
-SRCS-y += rte_strings.c rte_link.c parson_json.c
-SRCS-y += rte_atoip.c rte_portlist.c inet_pton.c
-SRCS-y += rte_heap.c
+SRCS-y += link.c parson_json.c
+SRCS-y += _atoip.c portlist.c inet_pton.c
+SRCS-y += heap.c
# install includes
-SYMLINK-y-include += rte_strings.h rte_link.h
-SYMLINK-y-include += rte_atoip.h rte_portlist.h parson_json.h
-SYMLINK-y-include += rte_heap.h
+SYMLINK-y-include += link.h
+SYMLINK-y-include += _atoip.h portlist.h parson_json.h
+SYMLINK-y-include += heap.h
include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/utils/rte_atoip.c b/lib/utils/_atoip.c
index 7946228..80f13e7 100644
--- a/lib/utils/rte_atoip.c
+++ b/lib/utils/_atoip.c
@@ -2,8 +2,8 @@
* Copyright(c) 2019 Intel Corporation.
*/
-#include "rte_strings.h"
-#include "rte_atoip.h"
+#include "_strings.h"
+#include "_atoip.h"
/* isblank() needs _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE, so use our own. */
static int
@@ -221,7 +221,7 @@ inet_ipton(int af, const char *src, void *dst)
}
int
-rte_atoip(const char *buf, int flags, void *res, unsigned ressize)
+_atoip(const char *buf, int flags, void *res, unsigned ressize)
{
unsigned int token_len = 0;
char ip_str[INET6_ADDRSTRLEN+4+1]; /* '+4' is for prefixlen (if any) */
diff --git a/lib/utils/rte_atoip.h b/lib/utils/_atoip.h
index 7e61e84..c03093a 100644
--- a/lib/utils/rte_atoip.h
+++ b/lib/utils/_atoip.h
@@ -8,8 +8,8 @@
* String-related utility functions for IP addresses
*/
-#ifndef _RTE_ATOIP_H_
-#define _RTE_ATOIP_H_
+#ifndef __ATOIP_H_
+#define __ATOIP_H_
#include <netinet/in.h>
@@ -51,10 +51,10 @@ struct rte_ipaddr {
* @return
* 0 on OK and -1 on error
*/
-int __rte_experimental rte_atoip(const char *buf, int flags, void *res, unsigned ressize);
+int _atoip(const char *buf, int flags, void *res, unsigned ressize);
#ifdef __cplusplus
}
#endif
-#endif /* _RTE_ATOIP_H_ */
+#endif /* __ATOIP_H_ */
diff --git a/lib/utils/rte_heap.c b/lib/utils/heap.c
index 5737851..06313a8 100644
--- a/lib/utils/rte_heap.c
+++ b/lib/utils/heap.c
@@ -7,19 +7,19 @@
#include <rte_spinlock.h>
-#include "rte_heap.h"
+#include "heap.h"
-rte_heap_t *
-rte_heap_create(void *addr, size_t size)
+heap_t *
+heap_create(void *addr, size_t size)
{
- rte_heap_t *heap = NULL;
- rte_heap_entry_t *entry;
+ heap_t *heap = NULL;
+ heap_entry_t *entry;
/* Make sure the size is greater or equal to sizeof(rte_heap_entry_t) */
- if (size < sizeof(rte_heap_entry_t))
+ if (size < sizeof(heap_entry_t))
return NULL;
- heap = calloc(1, sizeof(rte_heap_t));
+ heap = calloc(1, sizeof(heap_t));
if (!heap)
return NULL;
@@ -45,7 +45,7 @@ rte_heap_create(void *addr, size_t size)
* heap - is the free heap structure pointer.
*/
int
-rte_heap_destroy(rte_heap_t *heap)
+heap_destroy(heap_t *heap)
{
/* Free the rte_heap_t structure */
if ( heap )
@@ -55,10 +55,10 @@ rte_heap_destroy(rte_heap_t *heap)
}
int
-rte_heap_free(rte_heap_t *heap, void *addr, size_t size)
+heap_free(heap_t *heap, void *addr, size_t size)
{
- rte_heap_entry_t *p;
- rte_heap_entry_t *q;
+ heap_entry_t *p;
+ heap_entry_t *q;
/* the size can not be zero */
if (!heap || !addr || size == 0)
@@ -117,30 +117,30 @@ rte_heap_free(rte_heap_t *heap, void *addr, size_t size)
* size - is the size of the requested memory.
*/
void *
-rte_heap_alloc(rte_heap_t *heap, size_t size)
+heap_alloc(heap_t *heap, size_t size)
{
- rte_heap_entry_t *hd; /* pointer to entry free space */
- rte_heap_entry_t *phd; /* prev head pointer to free list */
- rte_heap_entry_t *nxt_hd; /* temp space for pointer to entry */
- rte_heap_entry_t *ret_ptr; /* return pointer to free space */
+ heap_entry_t *hd; /* pointer to entry free space */
+ heap_entry_t *phd; /* prev head pointer to free list */
+ heap_entry_t *nxt_hd; /* temp space for pointer to entry */
+ heap_entry_t *ret_ptr; /* return pointer to free space */
if (!heap || size == 0)
return NULL;
rte_spinlock_lock(&heap->sl);
- size = RTE_ALIGN_CEIL(size, sizeof(rte_heap_entry_t));
+ size = RTE_ALIGN_CEIL(size, sizeof(heap_entry_t));
/*
* If the requested size is less then sizeof(rte_heap_entry_t) then set
* the requested size to sizeof(rte_heap_entry_t)
*/
- if ( size < sizeof(rte_heap_entry_t) )
- size = sizeof(rte_heap_entry_t);
+ if ( size < sizeof(heap_entry_t) )
+ size = sizeof(heap_entry_t);
ret_ptr = NULL;
hd = STAILQ_FIRST(&heap->list);
- phd = (rte_heap_entry_t *)&heap->list;
+ phd = (heap_entry_t *)&heap->list;
if (hd) {
if (size <= heap->total_space) {
do {
@@ -163,7 +163,7 @@ rte_heap_alloc(rte_heap_t *heap, size_t size)
* in the left over space in this section.
* nxt_hd is the new pointer to the structure after size.
*/
- if ( size <= (hd->size - sizeof(rte_heap_entry_t)) ) {
+ if ( size <= (hd->size - sizeof(heap_entry_t)) ) {
/* take size out of total free space */
heap->total_space -= size;
@@ -191,17 +191,17 @@ rte_heap_alloc(rte_heap_t *heap, size_t size)
* simpleMemMalloc - Wrapper routine for simpleMemAlloc insert size into buffer.
*/
void *
-rte_heap_malloc(rte_heap_t *heap, size_t size)
+heap_malloc(heap_t *heap, size_t size)
{
uint64_t *addr;
if (!heap || size == 0)
return NULL;
- if (size < sizeof(rte_heap_entry_t))
- size = sizeof(rte_heap_entry_t);
+ if (size < sizeof(heap_entry_t))
+ size = sizeof(heap_entry_t);
- addr = (uint64_t *)rte_heap_alloc(heap, size + sizeof(uint64_t));
+ addr = (uint64_t *)heap_alloc(heap, size + sizeof(uint64_t));
if ( addr == NULL )
return NULL;
@@ -214,7 +214,7 @@ rte_heap_malloc(rte_heap_t *heap, size_t size)
* simpleMemMFree - Wrapper routine for simpleMemFree extract size from buffer.
*/
int
-rte_heap_mfree(rte_heap_t *heap, void *addr)
+heap_mfree(heap_t *heap, void *addr)
{
uint64_t *p;
uint64_t size;
@@ -235,19 +235,19 @@ rte_heap_mfree(rte_heap_t *heap, void *addr)
if (size == 0)
return -1;
- return rte_heap_free(heap, p, size);
+ return heap_free(heap, p, size);
}
/******************************************************************************
* debug function
*/
void
-rte_heap_dump(FILE *f, rte_heap_t *heap)
+heap_dump(FILE *f, heap_t *heap)
{
- rte_heap_entry_t *p;
- uint64_t total;
- uint64_t largest;
- uint64_t segCount;
+ heap_entry_t *p;
+ uint64_t total;
+ uint64_t largest;
+ uint64_t segCount;
if (!f)
f = stdout;
diff --git a/lib/utils/rte_heap.h b/lib/utils/heap.h
index bdaf930..8bca1bc 100644
--- a/lib/utils/rte_heap.h
+++ b/lib/utils/heap.h
@@ -2,8 +2,8 @@
* Copyright(c) 2019 Intel Corporation.
*/
-#ifndef __RTE_HEAP_H
-#define __RTE_HEAP_H
+#ifndef __HEAP_H
+#define __HEAP_H
#include <stdio.h>
#include <unistd.h>
@@ -19,36 +19,36 @@ extern "C" {
typedef struct heap_entry {
STAILQ_ENTRY(heap_entry) next; /**< pointer to next entry */
size_t size; /**< size of free entry */
-} rte_heap_entry_t;
+} heap_entry_t;
-typedef struct rte_heap {
+typedef struct heap {
STAILQ_HEAD(, heap_entry) list; /**< Heap entry list */
void *addr; /**< Base Heap address pointer */
size_t total_space; /**< total space in heap */
rte_spinlock_t sl; /**< Spinlocl for this heap */
-} rte_heap_t;
+} heap_t;
/**
* FUNCTION PROTOTYPES.
*/
/* prototypes */
-rte_heap_t *rte_heap_create(void *addr, size_t size);
-int rte_heap_destroy(rte_heap_t *si);
+heap_t *heap_create(void *addr, size_t size);
+int heap_destroy(heap_t *si);
-void *rte_heap_alloc(rte_heap_t *si, size_t size);
-int rte_heap_free(rte_heap_t *si, void *addr, size_t size);
+void *heap_alloc(heap_t *si, size_t size);
+int heap_free(heap_t *si, void *addr, size_t size);
-void *rte_heap_malloc(rte_heap_t *si, size_t size);
-int rte_heap_mfree(rte_heap_t *si, void *addr);
+void *heap_malloc(heap_t *si, size_t size);
+int heap_mfree(heap_t *si, void *addr);
/**
* Debug Utility Functions
*/
-void rte_heap_dump(FILE *f, rte_heap_t *si);
+void heap_dump(FILE *f, heap_t *si);
#ifdef __cplusplus
}
#endif
-#endif /* __RTE_HEAP_H */
+#endif /* __HEAP_H */
diff --git a/lib/utils/rte_link.c b/lib/utils/link.c
index 64cbb25..229d801 100644
--- a/lib/utils/rte_link.c
+++ b/lib/utils/link.c
@@ -6,11 +6,13 @@
#include <fcntl.h>
#include <stdbool.h>
+#include <rte_version.h>
#include <rte_ethdev.h>
#include <rte_cycles.h>
+#include <_delay.h>
-#include "rte_portlist.h"
-#include "rte_link.h"
+#include "portlist.h"
+#include "link.h"
static volatile bool lsc_cancel = 0;
@@ -30,7 +32,7 @@ get_link_status(uint16_t portid, struct rte_eth_link *link)
}
int
-rte_link_status_print(FILE *f, uint16_t portid)
+link_status_print(FILE *f, uint16_t portid)
{
struct rte_eth_link link;
@@ -55,7 +57,7 @@ rte_link_status_print(FILE *f, uint16_t portid)
}
void
-rte_link_status_show(FILE *f, uint64_t port_list)
+link_status_show(FILE *f, uint64_t port_list)
{
uint16_t portid;
@@ -66,19 +68,19 @@ rte_link_status_show(FILE *f, uint64_t port_list)
if ((port_list & (1 << portid)) == 0)
continue;
- rte_link_status_print(f, portid);
+ link_status_print(f, portid);
}
}
int
-rte_link_status_check(uint16_t portid, struct rte_eth_link *link)
+link_status_check(uint16_t portid, struct rte_eth_link *link)
{
return get_link_status(portid, link);
}
/* Check the link status of all ports in up to 9s, and print them finally */
void
-rte_link_status_wait(FILE *f, uint64_t port_list, int secs)
+link_status_wait(FILE *f, uint64_t port_list, int secs)
{
#define CHECK_INTERVAL 100 /* 100ms */
#define DEFAULT_WAIT_TIME 9 /* 9 seconds */
@@ -99,7 +101,7 @@ rte_link_status_wait(FILE *f, uint64_t port_list, int secs)
secs /= CHECK_INTERVAL; /* Convert to 100ms intervals or ticks */
fprintf(f, "\nChecking portlist %s link status: ",
- rte_print_portlist(NULL, port_list, buf, sizeof(buf)));
+ portlist_print(NULL, port_list, buf, sizeof(buf)));
lsc_cancel = 0;
@@ -120,18 +122,17 @@ rte_link_status_wait(FILE *f, uint64_t port_list, int secs)
fprintf(f, ".");
fflush(f);
-
rte_delay_us_sleep(CHECK_INTERVAL * 1000);
}
fprintf(f, "done\n");
fflush(f);
- rte_link_status_show(f, port_list);
+ link_status_show(f, port_list);
}
void
-rte_link_status_check_cancel(void)
+link_status_check_cancel(void)
{
lsc_cancel = 1;
}
diff --git a/lib/utils/rte_link.h b/lib/utils/link.h
index d791f96..f47fad0 100644
--- a/lib/utils/rte_link.h
+++ b/lib/utils/link.h
@@ -8,8 +8,8 @@
* String-related utility functions
*/
-#ifndef _RTE_LINK_H_
-#define _RTE_LINK_H_
+#ifndef __LINK_H_
+#define __LINK_H_
#include <rte_compat.h>
@@ -27,7 +27,7 @@ extern "C" {
* @return
* -1 if portid is greater then RTE_MAX_ETHPORTS or 0 if OK
*/
-int __rte_experimental rte_link_status_print(FILE *f, uint16_t portid);
+int link_status_print(FILE *f, uint16_t portid);
/**
* Show the link status of all ports in the port_list variable.
@@ -37,7 +37,7 @@ int __rte_experimental rte_link_status_print(FILE *f, uint16_t portid);
* @param port_list
* A 64bit mask of ports to display link status information.
*/
-void __rte_experimental rte_link_status_show(FILE *f, uint64_t port_list);
+void link_status_show(FILE *f, uint64_t port_list);
/**
* Given the list of port return true is all ports are UP.
@@ -47,7 +47,7 @@ void __rte_experimental rte_link_status_show(FILE *f, uint64_t port_list);
* @return
* If all of the ports in the port_list are up return 1 or 0 if not
*/
-int __rte_experimental rte_link_status_check(uint16_t portid, struct rte_eth_link *link);
+int link_status_check(uint16_t portid, struct rte_eth_link *link);
/**
* Wait for ports to be up and then display link status information. Using
@@ -60,16 +60,16 @@ int __rte_experimental rte_link_status_check(uint16_t portid, struct rte_eth_lin
* @param secs
* Number of seconds to wait for all port, if zero then use 9 seconds.
*/
-void __rte_experimental rte_link_status_wait(FILE *f, uint64_t port_list, int secs);
+void link_status_wait(FILE *f, uint64_t port_list, int secs);
/**
- * Attempt to set the link status cancel flag to force rte_link_status_wait()
+ * Attempt to set the link status cancel flag to force link_status_wait()
* break out of the waiting loop. Normally used inside a signal hander routine.
*/
-void __rte_experimental rte_link_status_check_cancel(void);
+void link_status_check_cancel(void);
#ifdef __cplusplus
}
#endif
-#endif /* _RTE_LINK_H */
+#endif /* __LINK_H */
diff --git a/lib/utils/meson.build b/lib/utils/meson.build
index e0455ef..c5d854b 100644
--- a/lib/utils/meson.build
+++ b/lib/utils/meson.build
@@ -4,17 +4,19 @@
version = 1
allow_experimental_apis = true
headers = files(
- 'rte_atoip.h',
- 'rte_link.h',
- 'rte_portlist.h',
- 'rte_strings.h',
- 'rte_heap.h')
+ '_atoip.h',
+ 'link.h',
+ 'portlist.h',
+ 'heap.h')
sources = files(
- 'rte_atoip.c',
- 'rte_link.c',
- 'rte_portlist.c',
- 'rte_strings.c',
- 'rte_heap.c')
-#deps += ['ethdev']
-#deps += ['mbuf', 'dbuf']
+ '_atoip.c',
+ 'link.c',
+ 'portlist.c',
+ 'heap.c')
+deps += ['common']
+
+libs = ['eal', 'ethdev', 'mempool']
+foreach lib:libs
+ ext_deps += cc.find_library('rte_' + lib, required: true, dirs: [dpdk_libdir])
+endforeach
diff --git a/lib/utils/rte_portlist.c b/lib/utils/portlist.c
index cc1a9ba..7ffe3de 100644
--- a/lib/utils/rte_portlist.c
+++ b/lib/utils/portlist.c
@@ -2,13 +2,13 @@
* Copyright(c) 2019 Intel Corporation.
*/
-#include "rte_strings.h"
-#include "rte_portlist.h"
+#include "_strings.h"
+#include "portlist.h"
#define SIZE_OF_PORTLIST (sizeof(portlist_t) * 8)
int
-rte_parse_portmask(const char *str, portlist_t *portmask)
+portmask_parse(const char *str, portlist_t *portmask)
{
char *end = NULL;
portlist_t pm;
@@ -38,7 +38,7 @@ set_portlist_bits(size_t low, size_t high, uint64_t *map)
#define MAX_SPLIT 64
/* portlist = N,N,N-M,N, ... */
int
-rte_parse_portlist(const char *str, portlist_t *portlist)
+portlist_parse(const char *str, portlist_t *portlist)
{
size_t ps, pe, n, i;
char *split[MAX_SPLIT], *s, *p;
@@ -93,7 +93,7 @@ rte_parse_portlist(const char *str, portlist_t *portlist)
}
char *
-rte_portlist_string(uint64_t portlist, char *buf, int len)
+portlist_string(uint64_t portlist, char *buf, int len)
{
int i, k, j, cnt = 0;
@@ -119,7 +119,7 @@ rte_portlist_string(uint64_t portlist, char *buf, int len)
return buf;
}
char *
-rte_print_portlist(FILE *f, uint64_t portlist, char *buf, int len)
+portlist_print(FILE *f, uint64_t portlist, char *buf, int len)
{
int i, k;
diff --git a/lib/utils/rte_portlist.h b/lib/utils/portlist.h
index b6b25a7..8d92d52 100644
--- a/lib/utils/rte_portlist.h
+++ b/lib/utils/portlist.h
@@ -8,8 +8,8 @@
* String-related utility function for parsing port mask.
*/
-#ifndef _RTE_PORTLIST_H_
-#define _RTE_PORTLIST_H_
+#ifndef __PORTLIST_H_
+#define __PORTLIST_H_
#include <stdint.h>
#include <sys/types.h>
@@ -33,7 +33,7 @@ typedef uint64_t portlist_t;
* @return
* -1 on error or 0 on success.
*/
-int __rte_experimental rte_parse_portlist(const char *str, portlist_t *portlist);
+int portlist_parse(const char *str, portlist_t *portlist);
/**
* Parse a portmasl string into a mask or bitmap value.
@@ -45,16 +45,13 @@ int __rte_experimental rte_parse_portlist(const char *str, portlist_t *portlist)
* @return
* -1 on error or 0 on success.
*/
-int __rte_experimental rte_parse_portmask(const char *str, portlist_t *portmask);
-
-char * __rte_experimental rte_portlist_string(uint64_t portlist, char *buf, int len);
-char * __rte_experimental rte_print_portlist(FILE *f, uint64_t portlist,
- char *buf, int len);
-
+int portmask_parse(const char *str, portlist_t *portmask);
+char *portlist_string(uint64_t portlist, char *buf, int len);
+char *portlist_print(FILE *f, uint64_t portlist, char *buf, int len);
#ifdef __cplusplus
}
#endif
-#endif /* _RTE_PORTLIST_H_ */
+#endif /* __PORTLIST_H_ */
diff --git a/lib/utils/utils_version.map b/lib/utils/utils_version.map
index 0429ee4..1244486 100644
--- a/lib/utils/utils_version.map
+++ b/lib/utils/utils_version.map
@@ -1,13 +1,13 @@
DPDK_18.11 {
- global:
+ global:
rte_strtrimset;
rte_strtrim;
rte_strtok;
rte_strqtok;
rte_stropt;
- rte_parse_portlist;
- rte_atoip;
+ parse_portlist;
+ _atoip;
local: *;
};
diff --git a/lib/vec/Makefile b/lib/vec/Makefile
index cfec32b..917de84 100644
--- a/lib/vec/Makefile
+++ b/lib/vec/Makefile
@@ -19,9 +19,9 @@ EXPORT_MAP := vec_version.map
LIBABIVER := 1
# all source are stored in SRCS-y
-SRCS-y := rte_vec.c
+SRCS-y := vec.c
# install includes
-SYMLINK-y-include += rte_vec.h
+SYMLINK-y-include += vec.h
include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/vec/meson.build b/lib/vec/meson.build
index 8831264..2b35deb 100644
--- a/lib/vec/meson.build
+++ b/lib/vec/meson.build
@@ -2,6 +2,7 @@
# Copyright(c) 2019 Intel Corporation
version = 1
-sources = files('rte_vec.c')
-headers = files('rte_vec.h')
-#rte_deps += ['ethdev']
+sources = files('vec.c')
+headers = files('vec.h')
+
+deps = ['utils']
diff --git a/lib/vec/rte_vec.c b/lib/vec/vec.c
index 368fea3..5316bfc 100644
--- a/lib/vec/rte_vec.c
+++ b/lib/vec/vec.c
@@ -8,23 +8,23 @@
#include <rte_prefetch.h>
#include <rte_mbuf.h>
-#include "rte_vec.h"
+#include "vec.h"
static void
vec_obj_init(struct rte_mempool *mp, void *uarg __rte_unused,
void *obj, unsigned idx __rte_unused)
{
- struct rte_vec *v = (struct rte_vec *)obj;
+ struct vec *v = (struct vec *)obj;
- rte_vec_reset(mp, v);
+ vec_reset(mp, v);
}
struct rte_mempool *
-rte_vec_create_pool(const char *name, unsigned int n,
+vec_create_pool(const char *name, unsigned int n,
unsigned int entires, unsigned int cache_size)
{
struct rte_mempool *mp = NULL;
- unsigned int size = rte_vec_calc_size(entires);
+ unsigned int size = vec_calc_size(entires);
mp = rte_mempool_create(name, n, size, cache_size, 0,
NULL, NULL, NULL, NULL, rte_socket_id(), 0);
@@ -35,18 +35,18 @@ rte_vec_create_pool(const char *name, unsigned int n,
}
void
-rte_vec_destroy_pool(struct rte_mempool *obj)
+vec_destroy_pool(struct rte_mempool *obj)
{
rte_mempool_free(obj);
}
-struct rte_vec *
-rte_vec_create(const char *name, unsigned int n, uint16_t flags)
+struct vec *
+vec_create(const char *name, unsigned int n, uint16_t flags)
{
- struct rte_vec *vec;
+ struct vec *vec;
uint32_t vec_size;
- vec_size = rte_vec_calc_size(n);
+ vec_size = vec_calc_size(n);
vec = rte_zmalloc_socket(name, vec_size,
RTE_CACHE_LINE_SIZE,
@@ -61,21 +61,21 @@ rte_vec_create(const char *name, unsigned int n, uint16_t flags)
}
void
-rte_vec_destroy(struct rte_vec *vec)
+vec_destroy(struct vec *vec)
{
rte_free(vec);
}
int
-rte_vec_to_data(struct rte_vec *v, char *buf, size_t len)
+vec_to_data(struct vec *v, char *buf, size_t len)
{
size_t count = 0, cnt;
uint16_t vlen;
int i;
- vlen = rte_vec_len(v);
+ vlen = vec_len(v);
for(i = 0; i < vlen && len; i++) {
- struct rte_mbuf *m = rte_vec_at_index(v, i);
+ struct rte_mbuf *m = vec_at_index(v, i);
/* set cnt to number of bytes that will fit in buffer */
cnt = RTE_MIN(rte_pktmbuf_pkt_len(m), len);
@@ -90,17 +90,17 @@ rte_vec_to_data(struct rte_vec *v, char *buf, size_t len)
buf += cnt;
if (rte_pktmbuf_pkt_len(m) == 0)
- rte_vec_free_mbuf_at_index(v, i);
+ vec_free_mbuf_at_index(v, i);
else
break;
}
- rte_vec_compact(v);
+ vec_compact(v);
return count;
}
void
-rte_vec_print(FILE *f, const char *msg, struct rte_vec *v)
+vec_print(FILE *f, const char *msg, struct vec *v)
{
int i, k;
diff --git a/lib/vec/rte_vec.h b/lib/vec/vec.h
index b465525..4fd3093 100644
--- a/lib/vec/rte_vec.h
+++ b/lib/vec/vec.h
@@ -3,8 +3,8 @@
*/
/* Created 2018 by Keith Wiles @ intel.com */
-#ifndef __RTE_VEC_H
-#define __RTE_VEC_H
+#ifndef __VEC_H
+#define __VEC_H
#include <rte_malloc.h>
@@ -14,7 +14,7 @@ extern "C" {
#define VEC_DEFAULT_SIZE 8
-struct rte_vec {
+struct vec {
uint16_t flags; /**< Flags for Vec structure */
uint16_t len; /**< Number of pointers in vector list */
uint16_t tlen; /**< Total number of vectors */
@@ -33,13 +33,13 @@ enum {
VEC_CLEAR_FLAGS = 0x0000
};
-#define rte_vec_foreach(idx, var, vec) \
- for(idx = 0, var = rte_vec_at_index((vec), idx); \
- idx < rte_vec_len((vec)); \
- idx++, var = rte_vec_at_index((vec), idx))
+#define vec_foreach(idx, var, vec) \
+ for(idx = 0, var = vec_at_index((vec), idx); \
+ idx < vec_len((vec)); \
+ idx++, var = vec_at_index((vec), idx))
static inline void
-rte_vec_init(struct rte_vec *v, unsigned int n, uint16_t flags)
+vec_init(struct vec *v, unsigned int n, uint16_t flags)
{
v->len = 0;
v->tlen = n;
@@ -48,101 +48,101 @@ rte_vec_init(struct rte_vec *v, unsigned int n, uint16_t flags)
}
static inline unsigned int
-rte_vec_calc_size(unsigned int cnt)
+vec_calc_size(unsigned int cnt)
{
unsigned int size;
if (cnt == 0)
cnt = VEC_DEFAULT_SIZE;
- size = (cnt * sizeof(void *)) + sizeof(struct rte_vec);
+ size = (cnt * sizeof(void *)) + sizeof(struct vec);
return RTE_ALIGN_CEIL(size, RTE_CACHE_LINE_SIZE);
}
static inline uint32_t
-rte_vec_calc_count(struct rte_mempool *mp)
+vec_calc_count(struct rte_mempool *mp)
{
uint32_t size = mp->elt_size;
- size = (size - sizeof(struct rte_vec) - sizeof(void *)) / sizeof(void *);
+ size = (size - sizeof(struct vec) - sizeof(void *)) / sizeof(void *);
return size;
}
static inline void
-rte_vec_set_free(struct rte_vec *v)
+vec_set_free(struct vec *v)
{
v->flags |= VEC_FREE_FLAG;
}
static inline int
-rte_vec_is_free(struct rte_vec *v)
+vec_is_free(struct vec *v)
{
return v->flags & VEC_FREE_FLAG;
}
static inline int
-rte_vec_is_dont_free(struct rte_vec *vec)
+vec_is_dont_free(struct vec *vec)
{
return vec->flags & VEC_DONT_FREE_FLAG;
}
static inline void
-rte_vec_set_dont_free(struct rte_vec *vec)
+vec_set_dont_free(struct vec *vec)
{
vec->flags |= VEC_DONT_FREE_FLAG;
}
static inline void
-rte_vec_clr_dont_free(struct rte_vec *vec)
+vec_clr_dont_free(struct vec *vec)
{
vec->flags &= ~VEC_DONT_FREE_FLAG;
}
-static inline __rte_always_inline uint16_t
-rte_vec_len(struct rte_vec *v)
+static __rte_always_inline uint16_t
+vec_len(struct vec *v)
{
return v->len;
}
-static inline __rte_always_inline int
-rte_vec_byte_len(struct rte_vec *v)
+static __rte_always_inline int
+vec_byte_len(struct vec *v)
{
return v->len * sizeof(void *);
}
-static inline __rte_always_inline void
-rte_vec_set_len(struct rte_vec *v, uint16_t n)
+static __rte_always_inline void
+vec_set_len(struct vec *v, uint16_t n)
{
v->len = n;
}
-static inline __rte_always_inline void
-rte_vec_set_max_len(struct rte_vec *v, uint16_t n)
+static __rte_always_inline void
+vec_set_max_len(struct vec *v, uint16_t n)
{
v->tlen = n;
}
-static inline __rte_always_inline void
-rte_vec_dec_len(struct rte_vec *v)
+static __rte_always_inline void
+vec_dec_len(struct vec *v)
{
v->len--;
}
-static inline __rte_always_inline void
-rte_vec_inc_len(struct rte_vec *v)
+static __rte_always_inline void
+vec_inc_len(struct vec *v)
{
v->len++;
}
-static inline __rte_always_inline uint16_t
-rte_vec_max_len(struct rte_vec *v)
+static __rte_always_inline uint16_t
+vec_max_len(struct vec *v)
{
return v->tlen;
}
-static inline __rte_always_inline struct rte_mbuf **
-rte_vec_list(struct rte_vec *v)
+static __rte_always_inline struct rte_mbuf **
+vec_list(struct vec *v)
{
return (struct rte_mbuf * *)&v->list[0];
}
@@ -151,8 +151,8 @@ rte_vec_list(struct rte_vec *v)
#pragma GCC diagnostic ignored "-Warray-bounds"
/* return -1 on full and index value if OK */
-static inline __rte_always_inline int
-rte_vec_add1(struct rte_vec *vec, void *val)
+static __rte_always_inline int
+vec_add1(struct vec *vec, void *val)
{
if (vec->len >= vec->tlen)
return -1;
@@ -161,8 +161,8 @@ rte_vec_add1(struct rte_vec *vec, void *val)
return vec->len - 1;
}
-static inline __rte_always_inline int
-rte_vec_add_at_index(struct rte_vec *vec, void *val, uint16_t n)
+static __rte_always_inline int
+vec_add_at_index(struct vec *vec, void *val, uint16_t n)
{
if (vec->len >= vec->tlen)
return -1;
@@ -171,41 +171,41 @@ rte_vec_add_at_index(struct rte_vec *vec, void *val, uint16_t n)
return 0;
}
-static inline __rte_always_inline void *
-rte_vec_at_index(struct rte_vec *vec, uint16_t n)
+static __rte_always_inline void *
+vec_at_index(struct vec *vec, uint16_t n)
{
if (n >= vec->len)
return NULL;
return vec->list[n];
}
-static inline __rte_always_inline void
-rte_vec_set_at_index(struct rte_vec *vec, uint16_t idx, void *val)
+static __rte_always_inline void
+vec_set_at_index(struct vec *vec, uint16_t idx, void *val)
{
if (idx < vec->tlen)
vec->list[idx] = val;
}
-static inline __rte_always_inline struct rte_mbuf **
-rte_vec_addr(struct rte_vec *vec, uint16_t n)
+static __rte_always_inline struct rte_mbuf **
+vec_addr(struct vec *vec, uint16_t n)
{
return (struct rte_mbuf * *)&vec->list[n];
}
-static inline __rte_always_inline struct rte_mbuf **
-rte_vec_end(struct rte_vec *vec)
+static __rte_always_inline struct rte_mbuf **
+vec_end(struct vec *vec)
{
return (struct rte_mbuf * *)&vec->list[vec->len];
}
-static inline __rte_always_inline int
-rte_vec_len_remaining(struct rte_vec *vec)
+static __rte_always_inline int
+vec_len_remaining(struct vec *vec)
{
return vec->tlen - vec->len;
}
-static inline __rte_always_inline int
-rte_vec_is_full(struct rte_vec *v)
+static __rte_always_inline int
+vec_is_full(struct vec *v)
{
return (v->len == v->tlen);
}
@@ -213,32 +213,32 @@ rte_vec_is_full(struct rte_vec *v)
#pragma GCC diagnostic pop
static inline void
-rte_vec_reset(struct rte_mempool *mp, struct rte_vec *vec)
+vec_reset(struct rte_mempool *mp, struct vec *vec)
{
uint16_t flags = vec->flags;
vec->flags = (flags & VEC_RESET_MASK);
vec->vpool = mp;
- rte_vec_set_max_len(vec, rte_vec_calc_count(mp));
- rte_vec_set_len(vec, 0);
+ vec_set_max_len(vec, vec_calc_count(mp));
+ vec_set_len(vec, 0);
}
static inline int
-rte_vec_find_index(struct rte_vec *vec, void *v)
+vec_find_index(struct vec *vec, void *v)
{
int i;
- for (i = 0; i < rte_vec_len(vec); i++) {
- if (rte_vec_at_index(vec, i) == v)
+ for (i = 0; i < vec_len(vec); i++) {
+ if (vec_at_index(vec, i) == v)
return i;
}
return -1;
}
-static inline struct rte_vec *
-rte_vec_alloc(struct rte_mempool *mp)
+static inline struct vec *
+vec_alloc(struct rte_mempool *mp)
{
- struct rte_vec *vec;
+ struct vec *vec;
if (rte_mempool_get(mp, (void * *)&vec))
return NULL;
@@ -247,17 +247,17 @@ rte_vec_alloc(struct rte_mempool *mp)
}
static inline void
-rte_vec_free(struct rte_vec *vec)
+vec_free(struct vec *vec)
{
struct rte_mempool *mp;
if (!vec)
return;
- if (rte_vec_is_free(vec))
+ if (vec_is_free(vec))
return;
- rte_vec_set_len(vec, 0);
+ vec_set_len(vec, 0);
if (vec->flags & VEC_RESET_MASK) {
vec->flags = (vec->flags & VEC_RESET_MASK);
return;
@@ -268,7 +268,7 @@ rte_vec_free(struct rte_vec *vec)
mp = vec->vpool;
- rte_vec_reset(mp, vec);
+ vec_reset(mp, vec);
rte_mempool_put(mp, vec);
}
@@ -286,8 +286,8 @@ rte_vec_free(struct rte_vec *vec)
* - 0: Success
*/
static inline int
-rte_vec_alloc_bulk(struct rte_mempool *mp,
- struct rte_vec **vecs, unsigned count)
+vec_alloc_bulk(struct rte_mempool *mp,
+ struct vec **vecs, unsigned count)
{
unsigned idx = 0;
int rc;
@@ -304,16 +304,16 @@ rte_vec_alloc_bulk(struct rte_mempool *mp,
switch (count % 4) {
case 0:
while (idx != count) {
- rte_vec_reset(mp, vecs[idx++]);
+ vec_reset(mp, vecs[idx++]);
/* fall-through */
case 3:
- rte_vec_reset(mp, vecs[idx++]);
+ vec_reset(mp, vecs[idx++]);
/* fall-through */
case 2:
- rte_vec_reset(mp, vecs[idx++]);
+ vec_reset(mp, vecs[idx++]);
/* fall-through */
case 1:
- rte_vec_reset(mp, vecs[idx++]);
+ vec_reset(mp, vecs[idx++]);
/* fall-through */
}
}
@@ -321,25 +321,25 @@ rte_vec_alloc_bulk(struct rte_mempool *mp,
}
static inline void
-rte_vec_free_bulk(struct rte_vec **vecs, uint32_t n)
+vec_free_bulk(struct vec **vecs, uint32_t n)
{
uint32_t i;
for (i = 0; i < n; i++)
- rte_vec_free(vecs[i]);
+ vec_free(vecs[i]);
}
static inline void
-rte_vec_free_mbufs(struct rte_vec *vec)
+vec_free_mbufs(struct vec *vec)
{
unsigned idx = 0, count;
struct rte_mbuf **mbufs;
if (!vec)
return;
- count = rte_vec_len(vec);
- mbufs = rte_vec_list(vec);
- rte_vec_set_len(vec, 0);
+ count = vec_len(vec);
+ mbufs = vec_list(vec);
+ vec_set_len(vec, 0);
/* To understand duff's device on loop unwinding optimization, see
* https://en.wikipedia.org/wiki/Duff's_device.
@@ -365,7 +365,7 @@ rte_vec_free_mbufs(struct rte_vec *vec)
}
static inline void
-rte_vec_clr_at_index(struct rte_vec *vec, uint16_t idx)
+vec_clr_at_index(struct vec *vec, uint16_t idx)
{
/* Assume idx and vec are valid for vec array */
vec->list[idx] = NULL;
@@ -373,7 +373,7 @@ rte_vec_clr_at_index(struct rte_vec *vec, uint16_t idx)
}
static inline void
-rte_vec_compact(struct rte_vec *vec)
+vec_compact(struct vec *vec)
{
void **l1, **l2;
uint16_t len;
@@ -406,32 +406,32 @@ rte_vec_compact(struct rte_vec *vec)
}
static inline void
-rte_vec_find_delete(struct rte_vec *vec, void *val)
+vec_find_delete(struct vec *vec, void *val)
{
- int idx = rte_vec_find_index(vec, val);
+ int idx = vec_find_index(vec, val);
if (idx != -1) {
- rte_vec_clr_at_index(vec, idx);
- rte_vec_compact(vec);
+ vec_clr_at_index(vec, idx);
+ vec_compact(vec);
}
}
static inline int
-rte_vec_pop(struct rte_vec *vec, void **val)
+vec_pop(struct vec *vec, void **val)
{
RTE_ASSERT(vec && val);
if (vec->len) {
- *val = rte_vec_at_index(vec, 0);
- rte_vec_clr_at_index(vec, 0);
- rte_vec_compact(vec);
+ *val = vec_at_index(vec, 0);
+ vec_clr_at_index(vec, 0);
+ vec_compact(vec);
return 1;
}
return 0;
}
static inline void
-rte_vec_free_mbuf_at_index(struct rte_vec *vec, uint16_t idx)
+vec_free_mbuf_at_index(struct vec *vec, uint16_t idx)
{
void *val;
@@ -449,59 +449,59 @@ rte_vec_free_mbuf_at_index(struct rte_vec *vec, uint16_t idx)
}
static inline int
-rte_vec_move_at_index(struct rte_vec *to, struct rte_vec *from, uint16_t idx)
+vec_move_at_index(struct vec *to, struct vec *from, uint16_t idx)
{
void *v;
int rc;
- v = rte_vec_at_index(from, idx);
- rc = rte_vec_add1(to, v);
+ v = vec_at_index(from, idx);
+ rc = vec_add1(to, v);
if (rc >= 0)
- rte_vec_clr_at_index(from, idx);
+ vec_clr_at_index(from, idx);
return rc;
}
static inline void
-rte_vec_copy_at_index(struct rte_vec *to, struct rte_vec *from, uint16_t idx)
+vec_copy_at_index(struct vec *to, struct vec *from, uint16_t idx)
{
void *v;
- v = rte_vec_at_index(from, idx);
- rte_vec_add1(to, v);
+ v = vec_at_index(from, idx);
+ vec_add1(to, v);
}
static inline void
-rte_vec_move_mbuf(struct rte_vec *to, struct rte_vec *from, uint16_t idx)
+vec_move_mbuf(struct vec *to, struct vec *from, uint16_t idx)
{
- if (rte_vec_move_at_index(to, from, idx))
- rte_pktmbuf_free(rte_vec_at_index(from, idx));
+ if (vec_move_at_index(to, from, idx))
+ rte_pktmbuf_free(vec_at_index(from, idx));
}
static inline struct rte_mbuf *
-rte_vec_get_and_clr(struct rte_vec *vec, uint16_t idx)
+vec_get_and_clr(struct vec *vec, uint16_t idx)
{
struct rte_mbuf *m;
- m = rte_vec_at_index(vec, idx);
- rte_vec_clr_at_index(vec, idx);
+ m = vec_at_index(vec, idx);
+ vec_clr_at_index(vec, idx);
return m;
}
-struct rte_vec *rte_vec_create(const char *name, unsigned int n, uint16_t flags);
-void rte_vec_destroy(struct rte_vec *vec);
+struct vec *vec_create(const char *name, unsigned int n, uint16_t flags);
+void vec_destroy(struct vec *vec);
-struct rte_mempool *rte_vec_create_pool(const char *name, unsigned int n,
+struct rte_mempool *vec_create_pool(const char *name, unsigned int n,
unsigned int entries, unsigned int cache_size);
-void rte_vec_destroy_pool(struct rte_mempool *obj);
+void vec_destroy_pool(struct rte_mempool *obj);
-int rte_vec_to_data(struct rte_vec *v, char *buf, size_t len);
+int vec_to_data(struct vec *v, char *buf, size_t len);
-void rte_vec_print(FILE *f, const char *msg, struct rte_vec *vec);
+void vec_print(FILE *f, const char *msg, struct vec *vec);
#ifdef __cplusplus
}
#endif
-#endif /* __RTE_VEC_H */
+#endif /* __VEC_H */
diff --git a/lib/vec/vec_version.map b/lib/vec/vec_version.map
index ecc583a..c25911c 100644
--- a/lib/vec/vec_version.map
+++ b/lib/vec/vec_version.map
@@ -1,13 +1,13 @@
DPDK_17.05 {
global:
- rte_vec_create;
- rte_vec_create_pool;
- rte_vec_destroy_pool;
- rte_vec_print;
+ vec_create;
+ vec_create_pool;
+ vec_destroy_pool;
+ vec_print;
- rte_vec_qadd;
- rte_vec_qpop;
+ vec_qadd;
+ vec_qpop;
local: *;
};
diff --git a/meson.build b/meson.build
index 33c810a..039fc49 100644
--- a/meson.build
+++ b/meson.build
@@ -32,14 +32,16 @@ dpdk_static_libraries = []
dpdk_drivers = []
dpdk_extra_ldflags = []
dpdk_app_link_libraries = []
-global_inc = []
dpdk_dep = []
-pmdk_shared_libraries = []
-pmdk_static_libraries = []
+pktgen_shared_libraries = []
+pktgen_static_libraries = []
+machine_args = ['-mavx']
pver = meson.project_version().split('.')
major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
+add_project_arguments('-include', 'rte_config.h', language: 'c')
+add_project_arguments('-DALLOW_EXPERIMENTAL_API', language: 'c')
add_project_arguments('-D_GNU_SOURCE', '-O3', '-g', language: 'c')
dpdk_incs = include_directories(rte_sdk + '/' + rte_target + '/include')
@@ -83,19 +85,3 @@ foreach lib:enabled_libs
endif
endforeach
message(output_message + '\n')
-
-output_message = '\n===============\nDrivers Enabled\n===============\n'
-foreach class:driver_classes
- class_drivers = get_variable(class + '_drivers')
- output_message += '\n' + class + ':\n\t'
- output_count = 0
- foreach drv:class_drivers
- output_message += drv + ', '
- output_count += 1
- if output_count == 8
- output_message += '\n\t'
- output_count = 0
- endif
- endforeach
-endforeach
-message(output_message + '\n')
diff --git a/meson_options.txt b/meson_options.txt
index 98f729c..62ff8a8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,4 @@
option('lib_dir', type: 'string', value: 'x86_64-linux-gnu',
- description: 'Set the directory where the libs are located in x86_64-native-linuxapp-gcc')
+ description: 'Set the directory where the libs are located in x86_64-native-linux-gcc')
+option('include_subdir_arch', type: 'string', value: '',
+ description: 'subdirectory where to install arch-dependent headers')
diff --git a/mk_meson b/mk_meson
new file mode 100755
index 0000000..bd1f197
--- /dev/null
+++ b/mk_meson
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+function meson_bld() {
+ echo "Clean Pktgen"
+ rm -fr build
+
+ meson build
+}
+
+function ninja_build() {
+ echo "Do Pktgen build"
+
+ ninja -C build
+
+ if [ $? -ne 0 ] ; then
+ return 1;
+ fi
+ return 0
+}
+
+ninja_install() {
+ echo "Do install to $RTE_SDK/$RTE_TARGET"
+
+ DESTDIR=$RTE_SDK ninja -C build install > /dev/null
+
+ if [ $? -ne 0 ] ; then
+ echo "Install failed!!"
+ return 1;
+ fi
+ return 0
+}
+
+if [ $# -gt 0 ]; then
+ meson_bld
+fi
+ninja_build
diff --git a/test/test_save.lua b/test/test_save.lua
index e00ee57..8880f06 100644
--- a/test/test_save.lua
+++ b/test/test_save.lua
@@ -3,7 +3,7 @@
-- Copyright (c) <2010-2019>, Intel Corporation. All rights reserved., Powered by DPDK
-- Command line arguments: (DPDK args are defaults)
--- ./app/app/x86_64-native-linuxapp-gcc/app/pktgen -c 3fffe -n 3 -m 512 --proc-type primary -- -T -P -m [2-5:6-9].0 -m [10-13:14-17].1 -f themes/black-yellow.theme
+-- ./app/app/x86_64-native-linux-gcc/app/pktgen -c 3fffe -n 3 -m 512 --proc-type primary -- -T -P -m [2-5:6-9].0 -m [10-13:14-17].1 -f themes/black-yellow.theme
-- #######################################################################
-- Pktgen Configuration script information:
diff --git a/tools/pktgen-master.sh b/tools/pktgen-master.sh
index 8a51b8e..2c6ff66 100755
--- a/tools/pktgen-master.sh
+++ b/tools/pktgen-master.sh
@@ -12,13 +12,13 @@ name=`uname -n`
if [ -z ${RTE_SDK} ] ; then
echo "*** RTE_SDK is not set, did you forget to do 'sudo -E ./setup.sh'"
export RTE_SDK=/work/home/rkwiles/projects/intel/dpdk
- export RTE_TARGET=x86_64-native-linuxapp-clang
+ export RTE_TARGET=x86_64-native-linux-clang
fi
sdk=${RTE_SDK}
if [ -z ${RTE_TARGET} ]; then
echo "*** RTE_TARGET is not set, did you forget to do 'sudo -E ./setup.sh'"
- target=x86_64-native-linuxapp-gcc
+ target=x86_64-native-linux-gcc
else
target=${RTE_TARGET}
fi
@@ -82,4 +82,3 @@ if [ $name == "rkwiles-DESK1.intel.com" ]; then
# Restore the screen and keyboard to a sane state
stty sane
fi
-
diff --git a/tools/pktgen-run.sh b/tools/pktgen-run.sh
index fa12017..462dc2c 100755
--- a/tools/pktgen-run.sh
+++ b/tools/pktgen-run.sh
@@ -9,13 +9,13 @@ name=`uname -n`
if [ -z ${RTE_SDK} ] ; then
echo "*** RTE_SDK is not set, did you forget to do 'sudo -E ./setup.sh'"
export RTE_SDK=/work/home/rkwiles/projects/intel/dpdk
- export RTE_TARGET=x86_64-native-linuxapp-clang
+ export RTE_TARGET=x86_64-native-linux-clang
fi
sdk=${RTE_SDK}
if [ -z ${RTE_TARGET} ]; then
echo "*** RTE_TARGET is not set, did you forget to do 'sudo -E ./setup.sh'"
- target=x86_64-native-linuxapp-gcc
+ target=x86_64-native-linux-gcc
else
target=${RTE_TARGET}
fi
diff --git a/tools/pktgen-slave.sh b/tools/pktgen-slave.sh
index b3e900b..b9ef5f4 100755
--- a/tools/pktgen-slave.sh
+++ b/tools/pktgen-slave.sh
@@ -12,13 +12,13 @@ name=`uname -n`
if [ -z ${RTE_SDK} ] ; then
echo "*** RTE_SDK is not set, did you forget to do 'sudo -E ./setup.sh'"
export RTE_SDK=/work/home/rkwiles/projects/intel/dpdk
- export RTE_TARGET=x86_64-native-linuxapp-clang
+ export RTE_TARGET=x86_64-native-linux-clang
fi
sdk=${RTE_SDK}
if [ -z ${RTE_TARGET} ]; then
echo "*** RTE_TARGET is not set, did you forget to do 'sudo -E ./setup.sh'"
- target=x86_64-native-linuxapp-gcc
+ target=x86_64-native-linux-gcc
else
target=${RTE_TARGET}
fi
@@ -82,4 +82,3 @@ if [ $name == "rkwiles-DESK1.intel.com" ]; then
# Restore the screen and keyboard to a sane state
stty sane
fi
-
diff --git a/tools/run.py b/tools/run.py
index 04d61a1..0bcebdd 100755
--- a/tools/run.py
+++ b/tools/run.py
@@ -211,6 +211,7 @@ def run_cfg(cfg_file):
add_run_options('proc', args, '--proc-type')
add_run_options('log', args, '--log-level')
add_run_options('prefix', args, '--file-prefix')
+ add_run_options('shared', args, '-d')
add_run_options('blacklist', args, '-b')
add_run_options('whitelist', args, '-w')
add_run_options('vdev', args, '--vdev')
@@ -234,7 +235,7 @@ def run_cfg(cfg_file):
return
if verbose:
- print("Command line as a set:")
+ print("Command line:")
print(args)
subprocess.call(args)
@@ -415,21 +416,21 @@ def parse_args():
def main():
'''program main function'''
- global sdk, target, pmdk
+ global sdk, target, pme
sdk = os.getenv('RTE_SDK')
if sdk == None:
err_exit("Set RTE_SDK environment variable or use 'sudo -E ...'")
- pmdk = os.getenv('PMDK_SDK')
- if pmdk == None:
- pmdk = 'pmdk-not-set';
+ pme = os.getenv('PME_SDK')
+ if pme == None:
+ pme = 'pme-sdk-not-set';
target = os.getenv('RTE_TARGET')
if target == None:
err_exit("Set the RTE_TARET environment variable or use 'sudo -E ...'")
- print(">>> sdk '%s', target '%s'" % (sdk, target))
+ print(">>> sdk '%s', target '%s', pme '%s'" % (sdk, target, pme))
cfg_file = parse_args()