[dpdk-dev] [PATCH 06/19] xenvert: Convert xenvirt pmd to use PMD_INIT_NONPCI macro

Neil Horman nhorman at tuxdriver.com
Thu Apr 10 22:49:56 CEST 2014


Convert the xenvirt driver to use the PMD_INIT_NONPCI macro so that we can break
the linkages between it and the core library to avoid unnneded loading when
built as a DSO

Signed-off-by: Neil Horman <nhorman at tuxdriver.com>
---
 lib/librte_eal/common/eal_common_nonpci_devs.c | 9 ---------
 lib/librte_pmd_xenvirt/Makefile                | 2 ++
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c       | 3 +++
 mk/rte.app.mk                                  | 6 ------
 4 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_nonpci_devs.c b/lib/librte_eal/common/eal_common_nonpci_devs.c
index 51497fd..c65621e 100644
--- a/lib/librte_eal/common/eal_common_nonpci_devs.c
+++ b/lib/librte_eal/common/eal_common_nonpci_devs.c
@@ -38,9 +38,6 @@
 #include <string.h>
 #include <sys/queue.h>
 #include <rte_string_fns.h>
-#ifdef RTE_LIBRTE_PMD_XENVIRT
-#include <rte_eth_xenvirt.h>
-#endif
 #include <rte_debug.h>
 #include <rte_devargs.h>
 #include <rte_pmd.h>
@@ -54,12 +51,6 @@ struct device_init {
 
 #define NUM_DEV_TYPES (sizeof(dev_types)/sizeof(dev_types[0]))
 struct device_init dev_types[] = {
-#ifdef RTE_LIBRTE_PMD_XENVIRT
-		{
-			.dev_prefix = RTE_ETH_XENVIRT_PARAM_NAME,
-			.init_fn = rte_pmd_xenvirt_init
-		},
-#endif
 		{
 			.dev_prefix = "-nodev-",
 			.init_fn = NULL
diff --git a/lib/librte_pmd_xenvirt/Makefile b/lib/librte_pmd_xenvirt/Makefile
index bf6d432..d5fff3b 100644
--- a/lib/librte_pmd_xenvirt/Makefile
+++ b/lib/librte_pmd_xenvirt/Makefile
@@ -39,6 +39,8 @@ LIB = librte_pmd_xenvirt.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
+CPU_LDFLAGS += -lxenvirt
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
index bad8dd4..20d35dc 100644
--- a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
+++ b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
@@ -53,6 +53,7 @@
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
+#include <rte_pmd.h>
 #include <cmdline_parse.h>
 #include <cmdline_parse_etheraddr.h>
 
@@ -704,3 +705,5 @@ rte_pmd_xenvirt_init(const char *name, const char *params)
 	eth_dev_xenvirt_create(name, params, rte_socket_id(), DEV_CREATE);
 	return 0;
 }
+
+PMD_INIT_NONPCI(rte_pmd_xenvirt_init, RTE_ETH_XENVIRT_PARAM_NAME);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index cf8b942..d6fdf9e 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -158,12 +158,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
 LDLIBS += -lrte_eal
 endif
 
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
-LDLIBS += -lrte_pmd_xenvirt
-LDLIBS += -lxenstore
-endif
-
 ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
 LDLIBS += -lrte_cmdline
 endif
-- 
1.8.3.1



More information about the dev mailing list