[dpdk-dev] [PATCH 04/19] pcap: Convert pcap poll mode driver to use new PMD_INIT_NONPCI macro

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


Convert the pcap poll mode driver to link itself to libpcap and register a init
routine via the PMD_INIT_NONPCI macro

Signed-off-by: Neil Horman <nhorman at tuxdriver.com>
---
 lib/librte_eal/common/eal_common_nonpci_devs.c | 9 ---------
 lib/librte_pmd_pcap/Makefile                   | 2 ++
 lib/librte_pmd_pcap/rte_eth_pcap.c             | 2 ++
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_nonpci_devs.c b/lib/librte_eal/common/eal_common_nonpci_devs.c
index 0f94b65..d925b7f 100644
--- a/lib/librte_eal/common/eal_common_nonpci_devs.c
+++ b/lib/librte_eal/common/eal_common_nonpci_devs.c
@@ -40,9 +40,6 @@
 #ifdef RTE_LIBRTE_PMD_RING
 #include <rte_eth_ring.h>
 #endif
-#ifdef RTE_LIBRTE_PMD_PCAP
-#include <rte_eth_pcap.h>
-#endif
 #ifdef RTE_LIBRTE_PMD_XENVIRT
 #include <rte_eth_xenvirt.h>
 #endif
@@ -65,12 +62,6 @@ struct device_init dev_types[] = {
 			.init_fn = rte_pmd_ring_init
 		},
 #endif
-#ifdef RTE_LIBRTE_PMD_PCAP
-		{
-			.dev_prefix = RTE_ETH_PCAP_PARAM_NAME,
-			.init_fn = rte_pmd_pcap_init
-		},
-#endif
 #ifdef RTE_LIBRTE_PMD_XENVIRT
 		{
 			.dev_prefix = RTE_ETH_XENVIRT_PARAM_NAME,
diff --git a/lib/librte_pmd_pcap/Makefile b/lib/librte_pmd_pcap/Makefile
index 5218f28..f7653fb 100644
--- a/lib/librte_pmd_pcap/Makefile
+++ b/lib/librte_pmd_pcap/Makefile
@@ -37,6 +37,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_pcap.a
 
+CPU_LDFLAGS += -lpcap
+
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index fe94a79..5bc81f7 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -40,6 +40,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_kvargs.h>
+#include <rte_pmd.h>
 
 #include <net/if.h>
 
@@ -766,3 +767,4 @@ rte_pmd_pcap_init(const char *name, const char *params)
 
 }
 
+PMD_INIT_NONPCI(rte_pmd_pcap_init, RTE_ETH_PCAP_PARAM_NAME);
-- 
1.8.3.1



More information about the dev mailing list