Skip to content

Instantly share code, notes, and snippets.

@bluca
Created July 25, 2017 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluca/eb779f347d05ff35e6e3bf65b29c156f to your computer and use it in GitHub Desktop.
Save bluca/eb779f347d05ff35e6e3bf65b29c156f to your computer and use it in GitHub Desktop.
dpdk pktgen quick hack
diff --git a/app/Makefile b/app/Makefile
index f7f5e2f..f837f43 100644
--- a/app/Makefile
+++ b/app/Makefile
@@ -62,15 +62,15 @@ BUILD_TYPE := v17
endif
ifeq ($(BUILD_TYPE),v17)
-COMMON_PRE := $(RTE_SRCDIR)/../lib/common
-LUA_PRE := $(RTE_SRCDIR)/../lib/lua/src
-CLI_PRE := $(RTE_SRCDIR)/../lib/cli
-GUI_PRE := $(RTE_SRCDIR)/../gui/gui
+COMMON_PRE := ../../lib/common
+LUA_PRE := ../../lib/lua/src
+CLI_PRE := ../../lib/cli
+GUI_PRE := ../../gui/gui
else
-COMMON_PRE := $(RTE_SRCDIR)/../lib/common/lib/common
-LUA_PRE := $(RTE_SRCDIR)/../lib/lua/src/lib/lua/src
-CLI_PRE := $(RTE_SRCDIR)/../lib/cli/lib/cli
-GUI_PRE := $(RTE_SRCDIR)/../gui
+COMMON_PRE := ../../lib/common
+LUA_PRE := ../../lib/lua/src
+CLI_PRE := ../../lib/cli
+GUI_PRE := ../../gui/gui
endif
COMMON_LIB := $(COMMON_PRE)/$(RTE_TARGET)
@@ -107,13 +107,7 @@ CFLAGS += -I$(RTE_SRCDIR)/../lib/lua/src
CLI_DEP := $(CLI_LIB)/$(CLI_NAME)
endif
-ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
- MYLIBS += -lrte_pmd_ixgbe
-ifeq ($(CONFIG_RTE_LIBRTE_LUA),)
- RPATHS += -rpath=$(LUA_LIB)
-endif
- RPATHS += -rpath=$(COMMON_LIB)
-endif
+MYLIBS += -lrte_pmd_ixgbe
# GUI support is a work in progress
ifeq ($(GUI),true)
@@ -124,10 +118,6 @@ ifeq ($(GUI),true)
$(shell pkg-config --libs glib-2.0) \
$(shell pkg-config --libs gtk+-2.0)
- ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
- RPATHS += -rpath=$(GUI_LIB)
- endif
-
DEPDIRS-y += ../gui
endif
diff --git a/app/pktgen.c b/app/pktgen.c
index d760897..7275ddc 100644
--- a/app/pktgen.c
+++ b/app/pktgen.c
@@ -460,7 +460,7 @@ pktgen_tx_flush(port_info_t *info, uint16_t qid)
#if RTE_VERSION >= RTE_VERSION_NUM(17, 5, 0, 0)
rte_delay_ms(250);
- rte_eth_tx_done_cleanup(info->pid, qid, 0);
+ //rte_eth_tx_done_cleanup(info->pid, qid, 0);
#endif
pktgen_clr_q_flags(info, qid, DO_TX_FLUSH);
diff --git a/lib/cli/Makefile b/lib/cli/Makefile
index 243c3a9..24f9084 100644
--- a/lib/cli/Makefile
+++ b/lib/cli/Makefile
@@ -34,6 +34,10 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_cli.a
+LIBABIVER := 1
+LDLIBS += -lrte_eal -lrte_timer -lrte_lua
+LDFLAGS += -L/../lua/src/$(RTE_TARGET)
+override CONFIG_RTE_BUILD_SHARED_LIB := n
CFLAGS += -O3 -D_GNU_SOURCE $(WERROR_FLAGS) -I$(SRCDIR)
CFLAGS += -DRTE_CLI_HOST_COMMANDS
diff --git a/lib/common/Makefile b/lib/common/Makefile
index 0312377..a8eb012 100644
--- a/lib/common/Makefile
+++ b/lib/common/Makefile
@@ -33,6 +33,8 @@
include $(RTE_SDK)/$(RTE_TARGET)/.config
include $(RTE_SDK)/mk/rte.vars.mk
+override CONFIG_RTE_BUILD_SHARED_LIB := n
+
# library name
LIB = libcommon.a
LIBABIVER := 1
@@ -50,4 +52,6 @@ SYMLINK-y-include := cksum.h copyright_info.h core_info.h coremap.h \
cmdline_parse_args.h cycles.h pg_ether.h pg_inet.h l2p.h lscpu.h mbuf.h _pcap.h \
port_config.h utils.h portlist.h
+LDLIBS += -lrte_eal -lrte_cmdline
+
include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/common/_pcap.c b/lib/common/_pcap.c
index e17beba..c42c2d2 100644
--- a/lib/common/_pcap.c
+++ b/lib/common/_pcap.c
@@ -112,7 +112,6 @@
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_hash.h>
-#include <rte_lpm.h>
#include <rte_string_fns.h>
#include <rte_byteorder.h>
#include <rte_errno.h>
diff --git a/lib/common/cksum.c b/lib/common/cksum.c
index dcd4914..94ebf5e 100644
--- a/lib/common/cksum.c
+++ b/lib/common/cksum.c
@@ -88,7 +88,6 @@
#include <rte_ring.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
-#include <rte_lpm.h>
#include <rte_string_fns.h>
#include <rte_byteorder.h>
#include <rte_errno.h>
diff --git a/lib/lua/src/Makefile b/lib/lua/src/Makefile
index 75e6eda..4ca77ae 100644
--- a/lib/lua/src/Makefile
+++ b/lib/lua/src/Makefile
@@ -32,6 +32,8 @@
include $(RTE_SDK)/mk/rte.vars.mk
+override CONFIG_RTE_BUILD_SHARED_LIB := n
+
# library name
LIB = librte_lua.a
@@ -68,4 +70,6 @@ SYMLINK-y-include := lapi.h lauxlib.h lcode.h lctype.h ldebug.h \
lparser.h lprefix.h lstate.h lstring.h ltable.h ltm.h luaconf.h \
lua.h lualib.h lua_shell.h lua-socket.h lundump.h lvm.h lzio.h
+LDLIBS += -lm -ldl -lpthread
+
include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/lua/src/luaconf.h b/lib/lua/src/luaconf.h
index c03cc52..3b80bdd 100644
--- a/lib/lua/src/luaconf.h
+++ b/lib/lua/src/luaconf.h
@@ -200,7 +200,7 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
+#define LUA_ROOT "/usr/"
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
#define LUA_PATH_DEFAULT \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment