From 3b030913ce1965ff96f2ed4bdee315600b7e09b6 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Sun, 22 Nov 2015 12:44:55 +0300 Subject: added skeleton of accel-dpdk daemon --- accel-dpdk/CMakeLists.txt | 17 +++++++++++++++++ accel-dpdk/main.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 accel-dpdk/CMakeLists.txt create mode 100644 accel-dpdk/main.c (limited to 'accel-dpdk') diff --git a/accel-dpdk/CMakeLists.txt b/accel-dpdk/CMakeLists.txt new file mode 100644 index 00000000..14913bda --- /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 00000000..ecca086a --- /dev/null +++ b/accel-dpdk/main.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +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; +} -- cgit v1.2.3