diff options
Diffstat (limited to 'platform/linux-generic/m4/odp_dpdk.m4')
-rw-r--r-- | platform/linux-generic/m4/odp_dpdk.m4 | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/platform/linux-generic/m4/odp_dpdk.m4 b/platform/linux-generic/m4/odp_dpdk.m4 index cebf10287..2e101df30 100644 --- a/platform/linux-generic/m4/odp_dpdk.m4 +++ b/platform/linux-generic/m4/odp_dpdk.m4 @@ -1,64 +1,72 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2016 Linaro Limited +# + ########################################################################## # Enable DPDK support ########################################################################## pktio_dpdk_support=no + +AC_ARG_ENABLE([dpdk], + [AS_HELP_STRING([--enable-dpdk], + [enable DPDK support for Packet I/O [default=disabled] (linux-generic)])], + [pktio_dpdk_support=$enableval + DPDK_PATH=system]) + AC_ARG_WITH([dpdk-path], -AC_HELP_STRING([--with-dpdk-path=DIR path to dpdk build directory]), +[AS_HELP_STRING([--with-dpdk-path=DIR], + [path to DPDK build directory [default=system] (linux-generic)])], [DPDK_PATH="$withval" - DPDK_CPPFLAGS="-msse4.2 -isystem $DPDK_PATH/include" - pktio_dpdk_support=yes],[]) + pktio_dpdk_support=yes],[]) + +########################################################################## +# Use shared DPDK library +########################################################################## +dpdk_shared=no +AC_ARG_ENABLE([dpdk-shared], + [AS_HELP_STRING([--enable-dpdk-shared], + [use shared DPDK library [default=disabled] (linux-generic)])], + [if test x$enableval = xyes; then + dpdk_shared=yes + fi]) ########################################################################## # Enable zero-copy DPDK pktio ########################################################################## zero_copy=0 AC_ARG_ENABLE([dpdk-zero-copy], - [ --enable-dpdk-zero-copy enable experimental zero-copy DPDK pktio mode], + [AS_HELP_STRING([--enable-dpdk-zero-copy], + [enable experimental zero-copy DPDK pktio mode [default=disabled] (linux-generic)])], [if test x$enableval = xyes; then zero_copy=1 fi]) ########################################################################## -# Save and set temporary compilation flags -########################################################################## -OLD_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$DPDK_CPPFLAGS $CPPFLAGS" - -########################################################################## # Check for DPDK availability # # DPDK pmd drivers are not linked unless the --whole-archive option is -# used. No spaces are allowed between the --whole-arhive flags. +# used. No spaces are allowed between the --whole-archive flags. ########################################################################## if test x$pktio_dpdk_support = xyes then - AC_CHECK_HEADERS([rte_config.h], [], - [AC_MSG_FAILURE(["can't find DPDK header"])]) + ODP_DPDK([$DPDK_PATH], [$dpdk_shared], [], + [AC_MSG_FAILURE([can't find DPDK])]) - AS_VAR_SET([DPDK_PMDS], [-Wl,--whole-archive,]) - for filename in "$DPDK_PATH"/lib/librte_pmd_*.a; do - cur_driver=`basename "$filename" .a | sed -e 's/^lib//'` - # rte_pmd_nfp has external dependencies which break linking - if test "$cur_driver" = "rte_pmd_nfp"; then - echo "skip linking rte_pmd_nfp" - else - AS_VAR_APPEND([DPDK_PMDS], [-l$cur_driver,]) - fi - done - AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive]) + case "${host}" in + i?86* | x86*) + DPDK_CFLAGS="${DPDK_CFLAGS} -msse4.2" + ;; + esac - ODP_CFLAGS="$ODP_CFLAGS -DODP_PKTIO_DPDK -DODP_DPDK_ZERO_COPY=$zero_copy" - DPDK_LIBS="-L$DPDK_PATH/lib -ldpdk -lpthread -ldl -lpcap -lm" - AC_SUBST([DPDK_CPPFLAGS]) - AC_SUBST([DPDK_LIBS]) - AC_SUBST([DPDK_PMDS]) + ODP_CHECK_CFLAG([-Wno-error=cast-align]) + AC_DEFINE([_ODP_PKTIO_DPDK], [1], + [Define to 1 to enable DPDK packet I/O support]) + AC_DEFINE_UNQUOTED([_ODP_DPDK_ZERO_COPY], [$zero_copy], + [Define to 1 to enable DPDK zero copy support]) else pktio_dpdk_support=no fi -########################################################################## -# Restore old saved variables -########################################################################## -CPPFLAGS=$OLD_CPPFLAGS - +AC_CONFIG_COMMANDS_PRE([dnl AM_CONDITIONAL([PKTIO_DPDK], [test x$pktio_dpdk_support = xyes ]) +]) |