summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/devices/dpdk/dpdk.h83
-rw-r--r--vnet/vnet/devices/dpdk/init.c77
-rw-r--r--vpp/Makefile.am4
-rw-r--r--vpp/configure.ac22
-rw-r--r--vpp/vnet/main.c10
5 files changed, 117 insertions, 79 deletions
diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h
index 14f7b3e8518..e2bb1e2a107 100644
--- a/vnet/vnet/devices/dpdk/dpdk.h
+++ b/vnet/vnet/devices/dpdk/dpdk.h
@@ -575,4 +575,87 @@ format_function_t format_dpdk_rte_mbuf;
format_function_t format_dpdk_rx_rte_mbuf;
unformat_function_t unformat_socket_mem;
+
+static inline void
+dpdk_pmd_constructor_init()
+{
+ /* Add references to DPDK Driver Constructor functions to get the dynamic
+ * loader to pull in the driver library & run the constructors.
+ */
+#define _(d) \
+ do { \
+ void devinitfn_ ##d(void); \
+ __attribute__((unused)) void (* volatile pf)(void); \
+ pf = devinitfn_ ##d; \
+ } while(0);
+
+#ifdef RTE_LIBRTE_EM_PMD
+ _(em_pmd_drv)
+#endif
+
+#ifdef RTE_LIBRTE_IGB_PMD
+ _(pmd_igb_drv)
+#endif
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ _(rte_ixgbe_driver)
+#endif
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ _(rte_i40e_driver)
+ _(rte_i40evf_driver)
+#endif
+
+#ifdef RTE_LIBRTE_FM10K_PMD
+ _(rte_fm10k_driver)
+#endif
+
+#ifdef RTE_LIBRTE_VIRTIO_PMD
+ _(rte_virtio_driver)
+#endif
+
+#ifdef RTE_LIBRTE_VMXNET3_PMD
+ _(rte_vmxnet3_driver)
+#endif
+
+#ifdef RTE_LIBRTE_VICE_PMD
+ _(rte_vice_driver)
+#endif
+
+#ifdef RTE_LIBRTE_ENIC_PMD
+ _(rte_enic_driver)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_AF_PACKET
+ _(pmd_af_packet_drv)
+#endif
+
+#ifdef RTE_LIBRTE_CXGBE_PMD
+ _(rte_cxgbe_driver)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_BOND
+ _(bond_drv)
+#endif
+
+#undef _
+
+/*
+ * At the moment, the ThunderX NIC driver doesn't have
+ * an entry point named "devinitfn_rte_xxx_driver"
+ */
+#define _(d) \
+ do { \
+ void d(void); \
+ __attribute__((unused)) void (* volatile pf)(void); \
+ pf = d; \
+ } while(0);
+
+#ifdef RTE_LIBRTE_THUNDERVNIC_PMD
+ _(rte_nicvf_pmd_init)
+#endif
+#undef _
+
+}
+
#endif /* __included_dpdk_h__ */
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index d57f6c1a594..e84f0de569b 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -1720,83 +1720,6 @@ dpdk_init (vlib_main_t * vm)
ASSERT(offsetof(dpdk_worker_t, cacheline0) == 0);
ASSERT(offsetof(frame_queue_trace_t, cacheline0) == 0);
- /* Add references to DPDK Driver Constructor functions to get the dynamic
- * loader to pull in the driver library & run the constructors.
- */
-#define _(d) \
-do { \
- void devinitfn_ ##d(void); \
- __attribute__((unused)) void (* volatile pf)(void); \
- pf = devinitfn_ ##d; \
-} while(0);
-
-#ifdef RTE_LIBRTE_EM_PMD
- _(em_pmd_drv)
-#endif
-
-#ifdef RTE_LIBRTE_IGB_PMD
- _(pmd_igb_drv)
-#endif
-
-#ifdef RTE_LIBRTE_IXGBE_PMD
- _(rte_ixgbe_driver)
-#endif
-
-#ifdef RTE_LIBRTE_I40E_PMD
- _(rte_i40e_driver)
- _(rte_i40evf_driver)
-#endif
-
-#ifdef RTE_LIBRTE_FM10K_PMD
- _(rte_fm10k_driver)
-#endif
-
-#ifdef RTE_LIBRTE_VIRTIO_PMD
- _(rte_virtio_driver)
-#endif
-
-#ifdef RTE_LIBRTE_VMXNET3_PMD
- _(rte_vmxnet3_driver)
-#endif
-
-#ifdef RTE_LIBRTE_VICE_PMD
- _(rte_vice_driver)
-#endif
-
-#ifdef RTE_LIBRTE_ENIC_PMD
- _(rte_enic_driver)
-#endif
-
-#ifdef RTE_LIBRTE_PMD_AF_PACKET
- _(pmd_af_packet_drv)
-#endif
-
-#ifdef RTE_LIBRTE_CXGBE_PMD
- _(rte_cxgbe_driver)
-#endif
-
-#ifdef RTE_LIBRTE_PMD_BOND
- _(bond_drv)
-#endif
-
-#undef _
-
-/*
- * At the moment, the ThunderX NIC driver doesn't have
- * an entry point named "devinitfn_rte_xxx_driver"
- */
-#define _(d) \
-do { \
- void d(void); \
- __attribute__((unused)) void (* volatile pf)(void); \
- pf = d; \
-} while(0);
-
-#ifdef RTE_LIBRTE_THUNDERVNIC_PMD
-_(rte_nicvf_pmd_init)
-#endif
-#undef _
-
dm->vlib_main = vm;
dm->vnet_main = vnet_get_main();
diff --git a/vpp/Makefile.am b/vpp/Makefile.am
index b66daec9477..bd2d30a9b70 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 9a2d52e835a..5b72eea6e44 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 03139c00556..4659440fed1 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);