diff options
author | 2016-04-01 12:34:24 +0200 | |
---|---|---|
committer | 2016-04-01 16:38:33 +0200 | |
commit | aa04a0ff8ee9aa7779b30e936f7fe1304c613d57 (patch) | |
tree | 6df3e0c635db20a4569ad651e9cfdfb4be76b086 /vpp | |
parent | 102ec52bc41c630f011884250e0f20ea49ac6d33 (diff) |
Add option to link DPDK dynamically
Change-Id: Ie2b47f9020c8260b199d141103318a0261e16832
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/Makefile.am | 4 | ||||
-rw-r--r-- | vpp/configure.ac | 22 | ||||
-rw-r--r-- | vpp/vnet/main.c | 10 |
3 files changed, 34 insertions, 2 deletions
diff --git a/vpp/Makefile.am b/vpp/Makefile.am index b66daec9..bd2d30a9 100644 --- a/vpp/Makefile.am +++ b/vpp/Makefile.am @@ -71,8 +71,12 @@ vpp_LDADD += -lsvm -lsvmdb -lrt vpp_LDADD += -lvnetplugin if WITH_DPDK +if ENABLE_DPDK_SHARED +vpp_LDADD += -ldpdk +else vpp_LDADD += -l:libdpdk.a endif +endif vpp_LDADD += -lvppinfra -lm -lpthread -ldl diff --git a/vpp/configure.ac b/vpp/configure.ac index 9a2d52e8..5b72eea6 100644 --- a/vpp/configure.ac +++ b/vpp/configure.ac @@ -11,6 +11,11 @@ AC_ARG_WITH(dpdk, [with_dpdk=1], [with_dpdk=0]) +AC_ARG_ENABLE(dpdk-shared, + AC_HELP_STRING([--enable-dpdk-shared],[Link with DPDK shared lib]), + [enable_dpdk_shared=1], + [enable_dpdk_shared=0]) + AC_ARG_WITH(ipsec, AC_HELP_STRING([--without-ipsec],[Disable ipsec]), [with_ipsec=0], @@ -27,7 +32,22 @@ AC_ARG_WITH(ipv6sr, [with_ipv6sr=1]) AM_CONDITIONAL(WITH_DPDK, test "$with_dpdk" = "1") -AC_SUBST(DPDK,[-DDPDK=${with_dpdk}]) +AM_CONDITIONAL(ENABLE_DPDK_SHARED, test "$enable_dpdk_shared" = "1") +AC_SUBST(DPDK,["-DDPDK=${with_dpdk} -DDPDK_SHARED_LIB=${enable_dpdk_shared}"]) + +AM_COND_IF( + [ENABLE_DPDK_SHARED], + [ + AC_CHECK_HEADERS( + [rte_config.h], + [], [AC_MSG_ERROR([DPDK header files not found])], + ) + AC_CHECK_LIB( + [dpdk], [rte_eal_init], + [], [AC_MSG_ERROR([DPDK shared library not found])], + ) + ], +) AM_CONDITIONAL(WITH_IPSEC, test "$with_ipsec" = "1") AC_SUBST(IPSEC,[-DIPSEC=${with_ipsec}]) diff --git a/vpp/vnet/main.c b/vpp/vnet/main.c index 03139c00..4659440f 100644 --- a/vpp/vnet/main.c +++ b/vpp/vnet/main.c @@ -19,6 +19,10 @@ #include <api/vpe_msg_enum.h> +#if DPDK +#include <vnet/devices/dpdk/dpdk.h> +#endif + /** \mainpage Virtual Packet Edge Documentation * \section intro_sec Introduction * @@ -197,7 +201,11 @@ defaulted: if (clib_mem_init (0, main_heap_size)) { vm->init_functions_called = hash_create (0, /* value bytes */ 0); vpe_main_init(vm); -#if ! DPDK +#if DPDK +#if !DPDK_SHARED_LIB + dpdk_pmd_constructor_init(); +#endif +#else unix_physmem_init(vm, 0 /* fail_if_physical_memory_not_present */); #endif vlib_set_get_handoff_structure_cb (&vnet_get_handoff_structure); |