aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-08-18 13:42:28 +0200
committerDamjan Marion <damarion@cisco.com>2018-08-18 14:04:29 +0200
commit74dfaa665bd05e75bd44f5b18376dba053fef15f (patch)
tree9536dcfcd672b46d11e554dba974235c411375cc /src/plugins/dpdk
parent612dd6a955e44d2c0fed1801fb8de585ca695c63 (diff)
cmake: DPDK rte_config.h parsing
Change-Id: I53cad8e7787a132a5d6bacd5fda3fe67b7d59b44 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk')
-rw-r--r--src/plugins/dpdk/CMakeLists.txt48
1 files changed, 36 insertions, 12 deletions
diff --git a/src/plugins/dpdk/CMakeLists.txt b/src/plugins/dpdk/CMakeLists.txt
index e1494492628..5f468110e50 100644
--- a/src/plugins/dpdk/CMakeLists.txt
+++ b/src/plugins/dpdk/CMakeLists.txt
@@ -21,39 +21,60 @@ find_library(DPDK_LIB NAMES libdpdk.a HINTS ${DPDK_LIB_DIR_HINT})
##############################################################################
# Find DPDK Version
##############################################################################
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dpdk_version.c
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dpdk_vars.c
"
#include <stdio.h>
#include <rte_version.h>
int main()
{
- puts(strchr(rte_version(), ' ') + 1);
+ printf(\"VERSION=%s\\n\", strchr(rte_version(), ' ') + 1);
+ printf(\"RTE_PKTMBUF_HEADROOM=%u\\n\", RTE_PKTMBUF_HEADROOM);
+#ifdef RTE_LIBRTE_PMD_AESNI_MB
+ printf(\"RTE_LIBRTE_PMD_AESNI_MB=%u\\n\", RTE_LIBRTE_PMD_AESNI_MB);
+#endif
+#ifdef RTE_LIBRTE_PMD_AESNI_GCM
+ printf(\"RTE_LIBRTE_PMD_AESNI_GCM=%u\\n\", RTE_LIBRTE_PMD_AESNI_GCM);
+#endif
return 0;
}
")
-try_compile(DPDK_VERSION_COMPILED
+try_compile(DPDK_VARS_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/dpdk_version.c
+ ${CMAKE_CURRENT_BINARY_DIR}/dpdk_vars.c
CMAKE_FLAGS
-DINCLUDE_DIRECTORIES=${DPDK_INCLUDE_DIR}
- COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/dpdk_version.bin
+ COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/dpdk_vars.bin
)
-if(DPDK_VERSION_COMPILED)
+if(DPDK_VARS_COMPILED)
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND ./dpdk_version.bin
- OUTPUT_VARIABLE DPDK_VERSION
+ COMMAND ./dpdk_vars.bin
+ OUTPUT_VARIABLE DPDK_VARS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
+ string(REPLACE "\n" ";" DPDK_VARS ${DPDK_VARS})
+ foreach(v ${DPDK_VARS})
+ string(REPLACE "=" ";" v ${v})
+ list(GET v 0 name)
+ list(GET v 1 value)
+ set(DPDK_${name} ${value})
+ endforeach()
endif()
file(REMOVE
- ${CMAKE_CURRENT_BINARY_DIR}/dpdk_version.c
- ${CMAKE_CURRENT_BINARY_DIR}/dpdk_version.bin
+ ${CMAKE_CURRENT_BINARY_DIR}/dpdk_vars.c
+ ${CMAKE_CURRENT_BINARY_DIR}/dpdk_vars.bin
)
+if(NOT ${DPDK_RTE_PKTMBUF_HEADROOM} EQUAL ${PRE_DATA_SIZE})
+ message(
+ FATAL_ERROR
+ "DPDK RTE_PKTMBUF_HEADROOM (${DPDK_RTE_PKTMBUF_HEADROOM}) "
+ "must be equal to PRE_DATA_SIZE (${PRE_DATA_SIZE})"
+ )
+endif()
##############################################################################
# DPDK plugin
@@ -88,12 +109,15 @@ if(DPDK_INCLUDE_DIR AND DPDK_LIB)
device/node.c
)
+ message("-- Found DPDK ${DPDK_VERSION} in ${DPDK_INCLUDE_DIR}")
get_filename_component(DPDK_LIB_DIR ${DPDK_LIB} DIRECTORY)
set(DPDK_LINK_FLAGS "-L${DPDK_LIB_DIR} -Wl,--whole-archive,${DPDK_LIB},--no-whole-archive")
- set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,--exclude-libs,libIPSec_MB.a,-l:libIPSec_MB.a")
+ if(DPDK_RTE_LIBRTE_PMD_AESNI_MB OR DPDK_RTE_LIBRTE_PMD_AESNI_GCM)
+ set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,--exclude-libs,libIPSec_MB.a,-l:libIPSec_MB.a")
+ message("-- DPDK depends on IPSec MB library")
+ endif()
set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,-lnuma")
set_target_properties(dpdk_plugin PROPERTIES LINK_FLAGS "${DPDK_LINK_FLAGS}")
- message("-- Found DPDK ${DPDK_VERSION}: ${DPDK_INCLUDE_DIR} ${DPDK_LIB}")
else()
message("-- DPDK not found - dpdk_plugin disabled")
endif()