summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-11-22 12:44:55 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-12-04 21:30:40 +0300
commit3b030913ce1965ff96f2ed4bdee315600b7e09b6 (patch)
treee9167d5d21ddd3e370b64d1afab5206182cfdfbb
parent939ff04fb80605e688720f64c824be3d21dad07e (diff)
downloadaccel-ppp-3b030913ce1965ff96f2ed4bdee315600b7e09b6.tar.gz
accel-ppp-3b030913ce1965ff96f2ed4bdee315600b7e09b6.zip
added skeleton of accel-dpdk daemon
-rw-r--r--CMakeLists.txt1
-rw-r--r--accel-dpdk/CMakeLists.txt17
-rw-r--r--accel-dpdk/main.c45
3 files changed, 63 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93889cd..c4f4ed8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,6 +66,7 @@ if (NOT BUILD_DRIVER_ONLY)
add_subdirectory(accel-pppd)
add_subdirectory(crypto)
add_subdirectory(accel-cmd)
+ add_subdirectory(accel-dpdk)
endif (NOT BUILD_DRIVER_ONLY)
if (BUILD_PPTP_DRIVER)
diff --git a/accel-dpdk/CMakeLists.txt b/accel-dpdk/CMakeLists.txt
new file mode 100644
index 0000000..14913bd
--- /dev/null
+++ b/accel-dpdk/CMakeLists.txt
@@ -0,0 +1,17 @@
+include_directories(${DPDK}/build/include)
+
+find_library(rte_eal NAMES librte_eal.a PATHS ${DPDK}/build/lib)
+find_library(rte_malloc NAMES librte_malloc.a PATHS ${DPDK}/build/lib)
+find_library(rte_mempool NAMES librte_mempool.a PATHS ${DPDK}/build/lib)
+find_library(rte_ring NAMES librte_ring.a PATHS ${DPDK}/build/lib)
+
+add_executable(accel-dpdk main.c)
+target_link_libraries(accel-dpdk dl pthread
+ -Wl,-whole-archive
+ ${rte_eal}
+ ${rte_mempool}
+ ${rte_ring}
+ ${rte_malloc}
+ -Wl,-no-whole-archive
+)
+
diff --git a/accel-dpdk/main.c b/accel-dpdk/main.c
new file mode 100644
index 0000000..ecca086
--- /dev/null
+++ b/accel-dpdk/main.c
@@ -0,0 +1,45 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <errno.h>
+#include <sys/queue.h>
+
+#include <rte_config.h>
+#include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_launch.h>
+#include <rte_eal.h>
+#include <rte_per_lcore.h>
+#include <rte_lcore.h>
+#include <rte_debug.h>
+
+static int
+lcore_hello(__attribute__((unused)) void *arg)
+{
+ unsigned lcore_id;
+ lcore_id = rte_lcore_id();
+ printf("hello from core %u\n", lcore_id);
+ return 0;
+}
+
+int
+main(int argc, char **argv)
+{
+ int ret;
+ unsigned lcore_id;
+
+ ret = rte_eal_init(argc, argv);
+ if (ret < 0)
+ rte_panic("Cannot init EAL\n");
+
+ /* call lcore_hello() on every slave lcore */
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ rte_eal_remote_launch(lcore_hello, NULL, lcore_id);
+ }
+
+ /* call it on master lcore too */
+ lcore_hello(NULL);
+
+ rte_eal_mp_wait_lcore();
+ return 0;
+}