From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <nhorman@tuxdriver.com>
Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58])
 by dpdk.org (Postfix) with ESMTP id D68EB68F2
 for <dev@dpdk.org>; Thu, 10 Apr 2014 22:49:09 +0200 (CEST)
Received: from hmsreliant.think-freely.org
 ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost)
 by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63)
 (envelope-from <nhorman@tuxdriver.com>)
 id 1WYLvo-0004OF-G4; Thu, 10 Apr 2014 16:50:46 -0400
From: Neil Horman <nhorman@tuxdriver.com>
To: dev@dpdk.org
Date: Thu, 10 Apr 2014 16:49:56 -0400
Message-Id: <1397163009-29950-6-git-send-email-nhorman@tuxdriver.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1397163009-29950-1-git-send-email-nhorman@tuxdriver.com>
References: <1397162846-28912-1-git-send-email-nhorman@tuxdriver.com>
 <1397163009-29950-1-git-send-email-nhorman@tuxdriver.com>
X-Spam-Score: -2.9 (--)
X-Spam-Status: No
Subject: [dpdk-dev] [PATCH 06/19] xenvert: Convert xenvirt pmd to use
	PMD_INIT_NONPCI macro
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Apr 2014 20:49:10 -0000

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@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