* [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's
@ 2014-04-15 18:05 Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error Neil Horman
` (15 more replies)
0 siblings, 16 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:05 UTC (permalink / raw)
To: dev
Disconnect compile time linkage between eal library / applications and pmd's
I noticed that, while tinkering with dpdk, building for shared libraries still
resulted in all the test applications linking to all the built pmd's, despite
not actually needing them all. We are able to tell an application at run time
(via the -d/--blacklist/--whitelist/--vdev options) which pmd's we want to use,
and so have no need to link them at all. The only reason they get pulled in is
because rte_eal_non_pci_init_etherdev and rte_pmd_init_all contain static lists
to the individual pmd init functions. The result is that, even when building as
DSO's, we have to load all the pmd libraries, which is space inefficient and
defeating of some of the purpose of shared objects.
To correct this, I developed this patch series, which introduces a new macro,
PMD_REGISTER_DRIVER, which wraps up Oliviers work using constructors on the
virtual device pmds, then expands on it to include the physical device pmds,
allowing us to break linkages between dpdk applications and pmd's almost
entirely (save for the ring and xenvirt drivers, which have additional api's
outside of the standard dpdk code that we need to further fix). This also
allows us to completely remove the rte_pmd_init_all routine, hiding its function
internally to the rte_eal_init path.
I've tested this feature using the igb and pcap pmd's, both statically and
dynamically linked with the test and testpmd sample applications, and it seems
to work well.
Note, I encountered a few bugs along the way, which I fixed and noted in the
series.
Regards
Neil
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
@ 2014-04-15 18:05 ` Neil Horman
2014-04-16 9:22 ` Thomas Monjalon
2014-04-16 13:51 ` [dpdk-dev] [PATCH 01/15 v2] " Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 02/15] make: include whole archive on static link Neil Horman
` (14 subsequent siblings)
15 siblings, 2 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:05 UTC (permalink / raw)
To: dev
The shared libraries built with the current makefile set produce static
libraries rather than actual shared objects. This is due to several missing
options that are required to correctly build shared objects using ld, as well as
a mis-specified -share option (which should be -shared). Switching to the use of
CC rather than LD and fixing the -shared option corrects these problems and
builds the DSOs correctly.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
mk/rte.lib.mk | 4 ++--
mk/rte.sharelib.mk | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index f75ca92..8a914db 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -68,7 +68,7 @@ O_TO_A_DO = @set -e; \
$(O_TO_A) && \
echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))
-O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -share $(OBJS-y) -o $(LIB)
+O_TO_S = $(CC) $(CPU_LDFLAGS) -z muldefs -shared $(OBJS-y) -o $(LIB)
O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
O_TO_S_DO = @set -e; \
@@ -84,7 +84,7 @@ O_TO_C_DO = @set -e; \
$(lib_dir) \
$(copy_obj)
else
-O_TO_C = $(LD) -z muldefs -share $(OBJS-y) -o $(LIB_ONE)
+O_TO_C = $(CC) -z muldefs -shared $(OBJS-y) -o $(LIB_ONE)
O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight
O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)"," LD_C $(@)")
O_TO_C_DO = @set -e; \
diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk
index 3967b51..8e821e0 100644
--- a/mk/rte.sharelib.mk
+++ b/mk/rte.sharelib.mk
@@ -45,7 +45,7 @@ sharelib: $(LIB_ONE) FORCE
OBJS = $(wildcard $(RTE_OUTPUT)/build/lib/*.o)
-O_TO_S = $(LD) $(CPU_LDFLAGS) -share $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
+O_TO_S = $(CC) $(CPU_LDFLAGS) -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
O_TO_S_CMD = "cmd_$@ = $(O_TO_S_STR)"
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 02/15] make: include whole archive on static link
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error Neil Horman
@ 2014-04-15 18:05 ` Neil Horman
2014-04-16 9:26 ` Thomas Monjalon
2014-04-15 18:05 ` [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro Neil Horman
` (13 subsequent siblings)
15 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:05 UTC (permalink / raw)
To: dev
This happens automatically on dyanmic linking, but when linking an archive we
need to to include the whole archive to make sure we call all the constructors.
Not doing this causes them to be discarded due to the fact theres no symbolic
reference connecting the pmds to the application.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
mk/rte.app.mk | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 072718a..5a0ef0c 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -206,6 +206,8 @@ endif
ifeq ($(LINK_USING_CC),1)
comma := ,
LDLIBS := $(addprefix -Wl$(comma),$(LDLIBS))
+LDLIBS := -Wl$(comma)--whole-archive $(LDLIBS)
+LDLIBS += -Wl,--no-whole-archive -Wl,-z -Wl,muldefs
LDFLAGS := $(addprefix -Wl$(comma),$(LDFLAGS))
override EXTRA_LDFLAGS := $(addprefix -Wl$(comma),$(EXTRA_LDFLAGS))
O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 02/15] make: include whole archive on static link Neil Horman
@ 2014-04-15 18:05 ` Neil Horman
2014-04-16 11:52 ` Thomas Monjalon
2014-04-18 11:42 ` Thomas Monjalon
2014-04-15 18:05 ` [dpdk-dev] [PATCH 04/15] pcap: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
` (12 subsequent siblings)
15 siblings, 2 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:05 UTC (permalink / raw)
To: dev
Rather than have each driver have to remember to add a constructor to it to make
sure its gets registered properly, wrap that process up in a macro to make
registration a one line affair. This also sets the stage for us to make
registration of vdev pmds and physical pmds a uniform process
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/include/rte_pmd.h | 69 +++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 1 deletion(-)
create mode 100644 lib/librte_eal/common/include/rte_pmd.h
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 2f99bf4..b918a73 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -37,7 +37,7 @@ INC += rte_log.h rte_memcpy.h rte_memory.h rte_memzone.h rte_pci.h
INC += rte_pci_dev_ids.h rte_per_lcore.h rte_prefetch.h rte_random.h
INC += rte_rwlock.h rte_spinlock.h rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_cpuflags.h rte_version.h rte_tailq_elem.h
-INC += rte_eal_memconfig.h rte_malloc_heap.h
+INC += rte_eal_memconfig.h rte_malloc_heap.h rte_pmd.h
INC += rte_hexdump.h rte_devargs.h rte_vdev.h
ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)
diff --git a/lib/librte_eal/common/include/rte_pmd.h b/lib/librte_eal/common/include/rte_pmd.h
new file mode 100644
index 0000000..b37fa28
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_pmd.h
@@ -0,0 +1,69 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2010-2014 Neil Horman <nhorman@tuxdriver.com.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ *
+ * API for error cause tracking
+ */
+
+#ifndef _RTE_PMD_H_
+#define _RTE_PMD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum rte_pmd_driver_type {
+ PMD_VDEV = 1
+};
+
+extern void rte_eal_nonpci_dev_init_register(const char *name, int (*dev_initfn)(const char *, const char *));
+#define PMD_REGISTER_DRIVER(d, t)\
+void devinitfn_ ##d(void);\
+void __attribute__((constructor, used)) devinitfn_ ##d(void)\
+{\
+ enum rte_pmd_driver_type _t = (t);\
+ switch(_t)\
+ {\
+ case PMD_VDEV:\
+ rte_eal_vdev_driver_register(&d);\
+ break;\
+ };\
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_H_ */
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 04/15] pcap: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (2 preceding siblings ...)
2014-04-15 18:05 ` [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro Neil Horman
@ 2014-04-15 18:05 ` Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 05/15] ring: " Neil Horman
` (11 subsequent siblings)
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:05 UTC (permalink / raw)
To: dev
convert the pcap driver to use the PMD_REGISTER_DRIVER macro and fix up the
Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the pcap library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_pmd_pcap/rte_eth_pcap.c | 8 ++------
mk/rte.app.mk | 2 ++
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index 680dfdc..4167a26 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -41,6 +41,7 @@
#include <rte_cycles.h>
#include <rte_kvargs.h>
#include <rte_vdev.h>
+#include <rte_pmd.h>
#include <net/if.h>
@@ -772,9 +773,4 @@ static struct rte_vdev_driver pmd_pcap_drv = {
.init = rte_pmd_pcap_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_pcap_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_pcap_drv);
-}
+PMD_REGISTER_DRIVER(pmd_pcap_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 5a0ef0c..e6d09b8 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -172,9 +172,11 @@ ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
LDLIBS += -lrte_cmdline
endif
+ifeq ($(RTE_BUILD_SHARED_LIB),n)
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lrte_pmd_pcap -lpcap
endif
+endif
LDLIBS += $(EXECENV_LDLIBS)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 05/15] ring: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (3 preceding siblings ...)
2014-04-15 18:05 ` [dpdk-dev] [PATCH 04/15] pcap: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
@ 2014-04-15 18:05 ` Neil Horman
2014-04-16 13:53 ` [dpdk-dev] [PATCH 05/15 v2] " Neil Horman
2014-04-17 9:50 ` [dpdk-dev] [PATCH 05/15] " Ananyev, Konstantin
2014-04-15 18:06 ` [dpdk-dev] [PATCH 06/15] xenvirt: " Neil Horman
` (10 subsequent siblings)
15 siblings, 2 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:05 UTC (permalink / raw)
To: dev
convert the ring driver to use the PMD_REGISTER_DRIVER macro and fix up the
Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the ring library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Note that the ring driver was also written in such a way that it violated some
general layering principles, several functions were contained in the pmd which
were being called by example from the test application in the app/test
directory. Specifically it was calling eth_ring_pair_attach,
eth_ring_pair_create and rte_eth_ring_devinit, which should only be called
internally to the dpdk core library. To correct this I've removed those
functions, and instead allowed them to be called indirectly at initalization
time using the vdev command line argument key nodeaction=<name>:<node>:<action>
where action is one of ATTACH or CREATE. I've tested out the functionality of
the command line with the testpmd utility, with success, and have removed the
called functions from the test utility. This will affect how the test utility
is invoked (the -d and --vdev option will need to be specified on the command
line now), but honestly, given the way it was coded, I think the testing of the
ring pmd was not the best example of how to code with dpdk to begin with. I
have also left the two layer violating functions in place, so as not to break
existing applications, but added deprecation warnings to them so that apps can
migrate off them.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
app/test/test_pmd_ring.c | 95 ----------------------------
lib/librte_pmd_ring/Makefile | 1 +
lib/librte_pmd_ring/rte_eth_ring.c | 123 ++++++++++++++++++++++++++++++++++---
mk/rte.app.mk | 14 +++--
4 files changed, 124 insertions(+), 109 deletions(-)
diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
index 4d9c2ba..1fe38fa 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -42,7 +42,6 @@
/* two test rings, r1 is used by two ports, r2 just by one */
static struct rte_ring *r1[2], *r2;
-static struct rte_ring *nullring = NULL;
static struct rte_mempool *mp;
static uint8_t start_idx; /* will store the port id of the first of our new ports */
@@ -59,58 +58,6 @@ static uint8_t start_idx; /* will store the port id of the first of our new port
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 512
-
-static int
-test_ring_ethdev_create(void)
-{
- int retval;
- printf("Testing ring pmd create\n");
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create zero-sized RXTX ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, RTE_MAX_NUMA_NODES);
- if (retval >= 0) {
- printf("Failure, can create ring pmd on socket %d\n", RTE_MAX_NUMA_NODES);
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 1, &r2, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null rx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, NULL, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null tx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&nullring, 1, r1, 2, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create TX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, &nullring, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&r2, 1, &r2, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RXTX ring pmd\n");
- return -1;
- }
-
- return 0;
-}
-
static int
test_ethdev_configure(void)
{
@@ -305,26 +252,12 @@ test_stats_reset(void)
static int
test_pmd_ring_init(void)
{
- const char * name1 = "R3";
- const char * name2 = "R4";
- const char * params_null = NULL;
- const char * params = "PARAMS";
struct rte_eth_stats stats;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
printf("Testing ring pmd init\n");
- if (rte_pmd_ring_devinit(name1, params_null) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
- if (rte_pmd_ring_devinit(name2, params) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -371,24 +304,16 @@ test_pmd_ring_init(void)
rte_eth_dev_stop(RXTX_PORT2);
- /* Test init same name pmd ring */
- rte_pmd_ring_devinit(name1, params_null);
return 0;
}
static int
test_pmd_ring_pair_create(void)
{
- const char * name1 = "_RNG_P0";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_create(name1, SOCKET0) < 0) {
- printf("Create ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -447,28 +372,16 @@ test_pmd_ring_pair_create(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test create same name ring pair */
- if (rte_eth_ring_pair_create(name1, SOCKET0) == 0) {
- printf("Create same name ring pair error\n");
- return -1;
- }
return 0;
}
static int
test_pmd_ring_pair_attach(void)
{
- const char * name1 = "_RNG_P0";
- const char * name2 = "_RNG_P1";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_attach(name1, SOCKET0) < 0) {
- printf("Attach ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -529,11 +442,6 @@ test_pmd_ring_pair_attach(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test attach non-existing ring pair */
- if (rte_eth_ring_pair_attach(name2, SOCKET0) == 0) {
- printf("Attach non-existing ring pair error\n");
- return -1;
- }
return 0;
}
@@ -568,9 +476,6 @@ test_pmd_ring(void)
return -1;
}
- if (test_ring_ethdev_create() < 0)
- return -1;
-
if (test_ethdev_configure() < 0)
return -1;
diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
index 73b2d38..a62f805 100644
--- a/lib/librte_pmd_ring/Makefile
+++ b/lib/librte_pmd_ring/Makefile
@@ -52,5 +52,6 @@ SYMLINK-y-include += rte_eth_ring.h
# this lib depends upon:
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_kvargs
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index cee3fff..266cfc0 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -38,6 +38,15 @@
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_vdev.h>
+#include <rte_pmd.h>
+#include <rte_kvargs.h>
+
+#define ETH_RING_NUMA_NODE_ACTION_ARG "nodeaction"
+
+static const char *valid_arguments[] = {
+ ETH_RING_NUMA_NODE_ACTION_ARG,
+ NULL
+};
struct ring_queue {
struct rte_ring *rng;
@@ -373,28 +382,127 @@ eth_dev_ring_pair_create(const char *name, const unsigned numa_node,
int
rte_eth_ring_pair_create(const char *name, const unsigned numa_node)
{
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_create is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_CREATE);
}
int
rte_eth_ring_pair_attach(const char *name, const unsigned numa_node)
{
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_attach is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_ATTACH);
}
+struct node_action_pair {
+ char name[PATH_MAX];
+ unsigned node;
+ enum dev_action action;
+};
+
+struct node_action_list {
+ unsigned total;
+ unsigned count;
+ struct node_action_pair *list;
+};
+
+static int parse_kvlist (const char *key __rte_unused, const char *value, void *data)
+{
+ struct node_action_list *info = data;
+ int ret;
+ char *name;
+ char *action;
+ char *node;
+
+ name = strdup(value);
+
+ ret = -1;
+
+ if (!name)
+ goto out;
+
+ node = strchr(name, ':');
+ *node = '\0';
+ node++;
+
+ action = strchr(node, ':');
+ *action = '\0';
+ action++;
+
+ /*
+ * Need to do some sanity checking here
+ */
+
+ if (strcmp(action, "ATTACH"))
+ if (strcmp(action, "CREATE"))
+ goto out;
+
+ info->list[info->count].node = strtol(node, NULL, 10);
+
+ info->list[info->count].action = strcmp(action, "ATTACH") ? DEV_CREATE : DEV_ATTACH;
+
+ strncpy(info->list[info->count].name, name, PATH_MAX);
+
+ info->count++;
+
+ ret = 0;
+out:
+ free(name);
+ return ret;
+}
+
int
rte_pmd_ring_devinit(const char *name, const char *params)
{
+ struct rte_kvargs *kvlist;
+ int ret = 0;
+ struct node_action_list *info = NULL;
+
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
+
if (params == NULL || params[0] == '\0')
eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
else {
- RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
- " rings-backed ethernet device\n");
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ printf("Parsing kvargs\n");
+ kvlist = rte_kvargs_parse(params, valid_arguments);
+
+ if (!kvlist) {
+ RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
+ " rings-backed ethernet device\n");
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ return 0;
+ } else {
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ printf("counting kvargs\n");
+ ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
+ info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
+ (sizeof(struct node_action_pair) * ret), 0);
+ if (!info)
+ goto out;
+
+ info->total = ret;
+ info->list = (struct node_action_pair*)(info + 1);
+
+ printf("We have %d nodeaction pairs\n", info->total);
+ ret = rte_kvargs_process(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG,
+ parse_kvlist, info);
+
+ if (ret < 0)
+ goto out_free;
+
+ for (info->count = 0; info->count < info->total; info->count++) {
+ printf("Doing something with a ring\n");
+ eth_dev_ring_pair_create(name, info->list[info->count].node,
+ info->list[info->count].action);
+ }
+
+ }
}
- return 0;
+
+out_free:
+ rte_free(info);
+out:
+ return ret;
}
static struct rte_vdev_driver pmd_ring_drv = {
@@ -402,9 +510,4 @@ static struct rte_vdev_driver pmd_ring_drv = {
.init = rte_pmd_ring_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_ring_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_ring_drv);
-}
+PMD_REGISTER_DRIVER(pmd_ring_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index e6d09b8..4f167aa 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -133,10 +133,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
LDLIBS += -lethdev
endif
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-LDLIBS += -lrte_pmd_ring
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
LDLIBS += -lrte_malloc
endif
@@ -173,9 +169,19 @@ LDLIBS += -lrte_cmdline
endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lrte_pmd_pcap -lpcap
endif
+
endif
LDLIBS += $(EXECENV_LDLIBS)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 06/15] xenvirt: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (4 preceding siblings ...)
2014-04-15 18:05 ` [dpdk-dev] [PATCH 05/15] ring: " Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 07/15] eal: Make vdev init path generic for both virtual and physcial devices Neil Horman
` (9 subsequent siblings)
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
convert the xenvirt driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the xenvirt library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
A few notes:
xenvirt was unbuildable as of commit 4c39baf297d10c217e7d3e7370f26a1fede58308..
That commit neglected to include the rte_vdev.h header, so several structs were
left undefined. This patch includes a fix for that as well.
Also, The linkage for xenvirt is broken in much the same way pmd_ring was, in
that the xenvirt pmd has a function that is called directly from applications
(the example being the testpmd application). The function is
rte_mempool_gntalloc_create, and should clearly be moved into the rte_mempool
library, with the supporting code in the function implementation moved to a new
xenvirt library separate from the pmd. This is a large undertaking that
detracts from the purpose of this series however, and so for now, I'm leaving
the linkage to the application in place, and will address this issue in a later
series
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 9 +++------
mk/rte.app.mk | 7 +++----
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
index 533aa76..df19d07 100644
--- a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
+++ b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
@@ -53,6 +53,8 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
+#include <rte_vdev.h>
+#include <rte_pmd.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@ -710,9 +712,4 @@ static struct rte_vdev_driver pmd_xenvirt_drv = {
.init = rte_pmd_xenvirt_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_xenvirt_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_xenvirt_drv);
-}
+PMD_REGISTER_DRIVER(pmd_xenvirt_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 4f167aa..e77bf39 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -158,16 +158,15 @@ ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
LDLIBS += -lrte_eal
endif
+ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
+LDLIBS += -lrte_cmdline
+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
-
ifeq ($(RTE_BUILD_SHARED_LIB),n)
ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 07/15] eal: Make vdev init path generic for both virtual and physcial devices
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (5 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 06/15] xenvirt: " Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-18 12:02 ` Thomas Monjalon
2014-04-15 18:06 ` [dpdk-dev] [PATCH 08/15] igb: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
` (8 subsequent siblings)
15 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
Currently, physical device pmds use a separate initalization path
(rte_pmd_init_all) while virtual devices use a constructor registration and
rte_eal_dev_init. Theres no reason to have them be separate. This patch
removes the vdev specific nomenclature from the vdev init path and makes it more
generic for use with all pmds. This is the first step in converting the
physical device pmds to using the same constructor based registration path that
the virtual devices use
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_eal/bsdapp/eal/Makefile | 2 +-
lib/librte_eal/bsdapp/eal/eal.c | 2 +-
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 108 ++++++++++++++++++++++++++++
lib/librte_eal/common/eal_common_vdev.c | 97 -------------------------
lib/librte_eal/common/include/eal_private.h | 2 +-
lib/librte_eal/common/include/rte_dev.h | 104 +++++++++++++++++++++++++++
lib/librte_eal/common/include/rte_pmd.h | 16 +----
lib/librte_eal/common/include/rte_vdev.h | 90 -----------------------
lib/librte_eal/linuxapp/eal/Makefile | 2 +-
lib/librte_eal/linuxapp/eal/eal.c | 2 +-
lib/librte_pmd_pcap/rte_eth_pcap.c | 7 +-
lib/librte_pmd_ring/rte_eth_ring.c | 7 +-
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 7 +-
14 files changed, 233 insertions(+), 215 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_dev.c
delete mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_dev.h
delete mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 4c2a4f1..abf1ad2 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -69,7 +69,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_errno.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_cpuflags.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_whitelist.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_vdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
CFLAGS_eal.o := -D_GNU_SOURCE
#CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index e944aba..4f5baef 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -854,7 +854,7 @@ rte_eal_init(int argc, char **argv)
rte_eal_mcfg_complete();
- if (rte_eal_vdev_init() < 0)
+ if (rte_eal_dev_init() < 0)
rte_panic("Cannot init virtual devices\n");
RTE_LCORE_FOREACH_SLAVE(i) {
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index b918a73..9b6ea78 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -38,7 +38,7 @@ INC += rte_pci_dev_ids.h rte_per_lcore.h rte_prefetch.h rte_random.h
INC += rte_rwlock.h rte_spinlock.h rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_cpuflags.h rte_version.h rte_tailq_elem.h
INC += rte_eal_memconfig.h rte_malloc_heap.h rte_pmd.h
-INC += rte_hexdump.h rte_devargs.h rte_vdev.h
+INC += rte_hexdump.h rte_devargs.h rte_dev.h
ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)
INC += rte_warnings.h
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
new file mode 100644
index 0000000..8b0cfa4
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -0,0 +1,108 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2014 6WIND S.A.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <sys/queue.h>
+
+#include <rte_dev.h>
+#include <rte_devargs.h>
+#include <rte_debug.h>
+#include <rte_devargs.h>
+
+#include "eal_private.h"
+
+/** Global list of virtual device drivers. */
+static struct rte_driver_list dev_driver_list =
+ TAILQ_HEAD_INITIALIZER(dev_driver_list);
+
+/* register a driver */
+void
+rte_eal_driver_register(struct rte_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&dev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_eal_driver_unregister(struct rte_driver *driver)
+{
+ TAILQ_REMOVE(&dev_driver_list, driver, next);
+}
+
+int
+rte_eal_dev_init(void)
+{
+ struct rte_devargs *devargs;
+ struct rte_driver *driver;
+
+ /* No need to register drivers that are embeded in DPDK
+ * (pmd_pcap, pmd_ring, ...). The initialization function have
+ * the ((constructor)) attribute so they will register at
+ * startup. */
+
+ /* call the init function for each virtual device */
+ TAILQ_FOREACH(devargs, &devargs_list, next) {
+
+ if (devargs->type != RTE_DEVTYPE_VIRTUAL)
+ continue;
+
+ TAILQ_FOREACH(driver, &dev_driver_list, next) {
+ if (driver->type != PMD_VDEV)
+ continue;
+
+ /* search a driver prefix in virtual device name */
+ if (!strncmp(driver->name, devargs->virtual.drv_name,
+ strlen(driver->name))) {
+ driver->init(devargs->virtual.drv_name,
+ devargs->args);
+ break;
+ }
+ }
+
+ if (driver == NULL) {
+ rte_panic("no driver found for %s\n",
+ devargs->virtual.drv_name);
+ }
+ }
+
+ /* Once the vdevs are initalized, start calling all the pdev drivers */
+ TAILQ_FOREACH(driver, &dev_driver_list, next) {
+ if (driver->type != PMD_PDEV)
+ continue;
+ /* PDEV drivers don't get passed any parameters */
+ driver->init(NULL, NULL);
+ }
+ return 0;
+}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
deleted file mode 100644
index 62d0302..0000000
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2014 6WIND S.A.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <sys/queue.h>
-
-#include <rte_vdev.h>
-#include <rte_devargs.h>
-#include <rte_debug.h>
-#include <rte_devargs.h>
-
-#include "eal_private.h"
-
-/** Global list of virtual device drivers. */
-static struct rte_vdev_driver_list vdev_driver_list =
- TAILQ_HEAD_INITIALIZER(vdev_driver_list);
-
-/* register a driver */
-void
-rte_eal_vdev_driver_register(struct rte_vdev_driver *driver)
-{
- TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
-}
-
-/* unregister a driver */
-void
-rte_eal_vdev_driver_unregister(struct rte_vdev_driver *driver)
-{
- TAILQ_REMOVE(&vdev_driver_list, driver, next);
-}
-
-int
-rte_eal_vdev_init(void)
-{
- struct rte_devargs *devargs;
- struct rte_vdev_driver *driver;
-
- /* No need to register drivers that are embeded in DPDK
- * (pmd_pcap, pmd_ring, ...). The initialization function have
- * the ((constructor)) attribute so they will register at
- * startup. */
-
- /* call the init function for each virtual device */
- TAILQ_FOREACH(devargs, &devargs_list, next) {
-
- if (devargs->type != RTE_DEVTYPE_VIRTUAL)
- continue;
-
- TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- /* search a driver prefix in virtual device name */
- if (!strncmp(driver->name, devargs->virtual.drv_name,
- strlen(driver->name))) {
- driver->init(devargs->virtual.drv_name,
- devargs->args);
- break;
- }
- }
-
- if (driver == NULL) {
- rte_panic("no driver found for %s\n",
- devargs->virtual.drv_name);
- }
- }
- return 0;
-}
diff --git a/lib/librte_eal/common/include/eal_private.h b/lib/librte_eal/common/include/eal_private.h
index 22d8b08..b99ad23 100644
--- a/lib/librte_eal/common/include/eal_private.h
+++ b/lib/librte_eal/common/include/eal_private.h
@@ -201,6 +201,6 @@ int rte_eal_alarm_init(void);
*
* This function is private to the EAL.
*/
-int rte_eal_vdev_init(void);
+int rte_eal_dev_init(void);
#endif /* _EAL_PRIVATE_H_ */
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
new file mode 100644
index 0000000..5f982c7
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -0,0 +1,104 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 6WIND S.A.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of 6WIND S.A. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTE_VDEV_H_
+#define _RTE_VDEV_H_
+
+/**
+ * @file
+ *
+ * RTE Virtual Devices Interface
+ *
+ * This file manages the list of the virtual device drivers.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(rte_driver_list, rte_driver);
+
+/**
+ * Initialization function called for each virtual device probing.
+ */
+typedef int (rte_dev_init_t)(const char *name, const char *args);
+
+/**
+ * Driver type enumeration
+ */
+enum pmd_type {
+ PMD_VDEV = 0,
+ PMD_PDEV = 1,
+};
+
+/**
+ * A structure describing a virtual device driver.
+ */
+struct rte_driver {
+ TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+ enum pmd_type type; /**< PMD Driver type */
+ const char *name; /**< Driver name. */
+ rte_dev_init_t *init; /**< Device init. function. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_dev structure describing the driver
+ * to be registered.
+ */
+void rte_eal_driver_register(struct rte_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_dev structure describing the driver
+ * to be unregistered.
+ */
+void rte_eal_driver_unregister(struct rte_driver *driver);
+
+/**
+ * Initalize all the registered drivers in this process
+ */
+int rte_eal_dev_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VDEV_H_ */
diff --git a/lib/librte_eal/common/include/rte_pmd.h b/lib/librte_eal/common/include/rte_pmd.h
index b37fa28..8a76dcf 100644
--- a/lib/librte_eal/common/include/rte_pmd.h
+++ b/lib/librte_eal/common/include/rte_pmd.h
@@ -43,23 +43,13 @@
#ifdef __cplusplus
extern "C" {
#endif
+#include <rte_dev.h>
-enum rte_pmd_driver_type {
- PMD_VDEV = 1
-};
-
-extern void rte_eal_nonpci_dev_init_register(const char *name, int (*dev_initfn)(const char *, const char *));
-#define PMD_REGISTER_DRIVER(d, t)\
+#define PMD_REGISTER_DRIVER(d)\
void devinitfn_ ##d(void);\
void __attribute__((constructor, used)) devinitfn_ ##d(void)\
{\
- enum rte_pmd_driver_type _t = (t);\
- switch(_t)\
- {\
- case PMD_VDEV:\
- rte_eal_vdev_driver_register(&d);\
- break;\
- };\
+ rte_eal_driver_register(&d);\
}
#ifdef __cplusplus
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
deleted file mode 100644
index 48f71b7..0000000
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2014 6WIND S.A.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of 6WIND S.A. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RTE_VDEV_H_
-#define _RTE_VDEV_H_
-
-/**
- * @file
- *
- * RTE Virtual Devices Interface
- *
- * This file manages the list of the virtual device drivers.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/queue.h>
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(rte_vdev_driver_list, rte_vdev_driver);
-
-/**
- * Initialization function called for each virtual device probing.
- */
-typedef int (rte_vdev_init_t)(const char *name, const char *args);
-
-/**
- * A structure describing a virtual device driver.
- */
-struct rte_vdev_driver {
- TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
- const char *name; /**< Driver name. */
- rte_vdev_init_t *init; /**< Device init. function. */
-};
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev structure describing the driver
- * to be registered.
- */
-void rte_eal_vdev_driver_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev structure describing the driver
- * to be unregistered.
- */
-void rte_eal_vdev_driver_unregister(struct rte_vdev_driver *driver);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RTE_VDEV_H_ */
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 00f7367..e800e60 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -77,7 +77,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_errno.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_cpuflags.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_hexdump.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_vdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
CFLAGS_eal.o := -D_GNU_SOURCE
CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 3ded563..49f7596 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -1059,7 +1059,7 @@ rte_eal_init(int argc, char **argv)
RTE_LOG(WARNING, EAL, "%s\n", dlerror());
}
- if (rte_eal_vdev_init() < 0)
+ if (rte_eal_dev_init() < 0)
rte_panic("Cannot init virtual devices\n");
RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n",
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index 4167a26..fa5c8aa 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -40,7 +40,7 @@
#include <rte_string_fns.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_dev.h>
#include <rte_pmd.h>
#include <net/if.h>
@@ -768,9 +768,10 @@ rte_pmd_pcap_devinit(const char *name, const char *params)
}
-static struct rte_vdev_driver pmd_pcap_drv = {
+static struct rte_driver pmd_pcap_drv = {
.name = "eth_pcap",
+ .type = PMD_VDEV,
.init = rte_pmd_pcap_devinit,
};
-PMD_REGISTER_DRIVER(pmd_pcap_drv, PMD_VDEV);
+PMD_REGISTER_DRIVER(pmd_pcap_drv);
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index 266cfc0..c918141 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -37,7 +37,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_vdev.h>
+#include <rte_dev.h>
#include <rte_pmd.h>
#include <rte_kvargs.h>
@@ -505,9 +505,10 @@ out:
return ret;
}
-static struct rte_vdev_driver pmd_ring_drv = {
+static struct rte_driver pmd_ring_drv = {
.name = "eth_ring",
+ .type = PMD_VDEV,
.init = rte_pmd_ring_devinit,
};
-PMD_REGISTER_DRIVER(pmd_ring_drv, PMD_VDEV);
+PMD_REGISTER_DRIVER(pmd_ring_drv);
diff --git a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
index df19d07..4392a9e 100644
--- a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
+++ b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
@@ -53,7 +53,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_vdev.h>
+#include <rte_dev.h>
#include <rte_pmd.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@ -707,9 +707,10 @@ rte_pmd_xenvirt_devinit(const char *name, const char *params)
return 0;
}
-static struct rte_vdev_driver pmd_xenvirt_drv = {
+static struct rte_driver pmd_xenvirt_drv = {
.name = "eth_xenvirt",
+ .type = PMD_VDEV,
.init = rte_pmd_xenvirt_devinit,
};
-PMD_REGISTER_DRIVER(pmd_xenvirt_drv, PMD_VDEV);
+PMD_REGISTER_DRIVER(pmd_xenvirt_drv);
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 08/15] igb: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (6 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 07/15] eal: Make vdev init path generic for both virtual and physcial devices Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 09/15] igbvf: " Neil Horman
` (7 subsequent siblings)
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
convert the igb pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the igb library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
examples/dpdk_qat/main.c | 4 ----
lib/librte_ether/rte_ethdev.h | 13 -------------
lib/librte_pmd_e1000/igb_ethdev.c | 13 +++++++++++--
3 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c
index cdf6832..64cb610 100644
--- a/examples/dpdk_qat/main.c
+++ b/examples/dpdk_qat/main.c
@@ -697,10 +697,6 @@ MAIN(int argc, char **argv)
return -1;
/* init driver */
-#ifdef RTE_LIBRTE_IGB_PMD
- if (rte_igb_pmd_init() < 0)
- rte_panic("Cannot init igb pmd\n");
-#endif
#ifdef RTE_LIBRTE_IXGBE_PMD
if (rte_ixgbe_pmd_init() < 0)
rte_panic("Cannot init ixgbe pmd\n");
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index dea7471..e50ed48 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1317,15 +1317,6 @@ extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
* The initialization function of the driver for
- * Intel(r) IGB Gigabit Ethernet Controller devices.
- * This function is invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_igb_pmd_init(void);
-
-/**
- * The initialization function of the driver for
* Intel(r) EM Gigabit Ethernet Controller devices.
* This function is invoked once at EAL start time.
* @return
@@ -1402,10 +1393,6 @@ int rte_pmd_init_all(void)
int ret = -ENODEV;
#ifdef RTE_LIBRTE_IGB_PMD
- if ((ret = rte_igb_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init igb PMD\n");
- return (ret);
- }
if ((ret = rte_igbvf_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init igbvf PMD\n");
return (ret);
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index 673b4de..246474d 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -51,6 +51,8 @@
#include <rte_eal.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
+#include <rte_dev.h>
+#include <rte_pmd.h>
#include "e1000_logs.h"
#include "e1000/e1000_api.h"
@@ -619,8 +621,8 @@ static struct eth_driver rte_igbvf_pmd = {
.dev_private_size = sizeof(struct e1000_adapter),
};
-int
-rte_igb_pmd_init(void)
+static int
+rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
rte_eth_driver_register(&rte_igb_pmd);
return 0;
@@ -2182,3 +2184,10 @@ eth_igb_rss_reta_query(struct rte_eth_dev *dev,
return 0;
}
+
+static struct rte_driver pmd_igb_drv = {
+ .type = PMD_PDEV,
+ .init = rte_igb_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(pmd_igb_drv);
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 09/15] igbvf: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (7 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 08/15] igb: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 10/15] e1000: " Neil Horman
` (6 subsequent siblings)
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
convert the igbvf pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the igbvf library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 16 ----------------
lib/librte_pmd_e1000/igb_ethdev.c | 10 ++++++++--
2 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index e50ed48..d13cc4f 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1325,15 +1325,6 @@ extern void rte_eth_driver_register(struct eth_driver *eth_drv);
extern int rte_em_pmd_init(void);
/**
- * The initialization function of the driver for 1Gbps Intel IGB_VF
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_igbvf_pmd_init(void);
-
-/**
* The initialization function of the driver for 10Gbps Intel IXGBE
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1392,13 +1383,6 @@ int rte_pmd_init_all(void)
{
int ret = -ENODEV;
-#ifdef RTE_LIBRTE_IGB_PMD
- if ((ret = rte_igbvf_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init igbvf PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_IGB_PMD */
-
#ifdef RTE_LIBRTE_EM_PMD
if ((ret = rte_em_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init em PMD\n");
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index 246474d..5cf14c2 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -644,8 +644,8 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
* Invoked one at EAL init time.
* Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
*/
-int
-rte_igbvf_pmd_init(void)
+static int
+rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
DEBUGFUNC("rte_igbvf_pmd_init");
@@ -2190,4 +2190,10 @@ static struct rte_driver pmd_igb_drv = {
.init = rte_igb_pmd_init,
};
+static struct rte_driver pmd_igbvf_drv = {
+ .type = PMD_PDEV,
+ .init = rte_igbvf_pmd_init,
+};
+
PMD_REGISTER_DRIVER(pmd_igb_drv);
+PMD_REGISTER_DRIVER(pmd_igbvf_drv);
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 10/15] e1000: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (8 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 09/15] igbvf: " Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 11/15] ixgbe: " Neil Horman
` (5 subsequent siblings)
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
convert the e1000 pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the e1000 library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 16 ----------------
lib/librte_pmd_e1000/em_ethdev.c | 13 +++++++++++--
mk/rte.app.mk | 8 ++++----
3 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index d13cc4f..9e32f56 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,15 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for
- * Intel(r) EM Gigabit Ethernet Controller devices.
- * This function is invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_em_pmd_init(void);
-
-/**
* The initialization function of the driver for 10Gbps Intel IXGBE
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1383,13 +1374,6 @@ int rte_pmd_init_all(void)
{
int ret = -ENODEV;
-#ifdef RTE_LIBRTE_EM_PMD
- if ((ret = rte_em_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init em PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_EM_PMD */
-
#ifdef RTE_LIBRTE_IXGBE_PMD
if ((ret = rte_ixgbe_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init ixgbe PMD\n");
diff --git a/lib/librte_pmd_e1000/em_ethdev.c b/lib/librte_pmd_e1000/em_ethdev.c
index d8c9a9b..858aa7c 100644
--- a/lib/librte_pmd_e1000/em_ethdev.c
+++ b/lib/librte_pmd_e1000/em_ethdev.c
@@ -51,6 +51,8 @@
#include <rte_eal.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
+#include <rte_dev.h>
+#include <rte_pmd.h>
#include "e1000_logs.h"
#include "e1000/e1000_api.h"
@@ -285,8 +287,8 @@ static struct eth_driver rte_em_pmd = {
.dev_private_size = sizeof(struct e1000_adapter),
};
-int
-rte_em_pmd_init(void)
+static int
+rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
rte_eth_driver_register(&rte_em_pmd);
return 0;
@@ -1433,3 +1435,10 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index)
e1000_rar_set(hw, addr, index);
}
+
+struct rte_driver em_pmd_drv = {
+ .type = PMD_PDEV,
+ .init = rte_em_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(em_pmd_drv);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index e77bf39..f5f137c 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -73,10 +73,6 @@ LDLIBS += -lrte_ivshmem
endif
endif
-ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y)
-LDLIBS += -lrte_pmd_e1000
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
LDLIBS += -lrte_pmd_ixgbe
endif
@@ -169,6 +165,10 @@ endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y)
+LDLIBS += -lrte_pmd_e1000
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
LDLIBS += -lrte_pmd_ring
endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 11/15] ixgbe: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (9 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 10/15] e1000: " Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 12/15] ixgbevf: " Neil Horman
` (4 subsequent siblings)
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
convert the ixgbe pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the ixgbe library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
examples/dpdk_qat/main.c | 6 ------
examples/vmdq_dcb/main.c | 4 ----
lib/librte_ether/rte_ethdev.h | 13 -------------
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 13 +++++++++++--
4 files changed, 11 insertions(+), 25 deletions(-)
diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c
index 64cb610..741d3f3 100644
--- a/examples/dpdk_qat/main.c
+++ b/examples/dpdk_qat/main.c
@@ -696,12 +696,6 @@ MAIN(int argc, char **argv)
if (ret < 0)
return -1;
- /* init driver */
-#ifdef RTE_LIBRTE_IXGBE_PMD
- if (rte_ixgbe_pmd_init() < 0)
- rte_panic("Cannot init ixgbe pmd\n");
-#endif
-
if (rte_eal_pci_probe() < 0)
rte_panic("Cannot probe PCI\n");
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 844f334..1626ba5 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -455,10 +455,6 @@ MAIN(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid VMDQ argument\n");
- if (rte_ixgbe_pmd_init() != 0 ||
- rte_eal_pci_probe() != 0)
- rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
-
cores = rte_lcore_count();
if ((cores & (cores - 1)) != 0 || cores > 128) {
rte_exit(EXIT_FAILURE,"This program can only run on an even"
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9e32f56..9621be7 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,15 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for 10Gbps Intel IXGBE
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_ixgbe_pmd_init(void);
-
-/**
* The initialization function of the driver for 10Gbps Intel IXGBE_VF
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1375,10 +1366,6 @@ int rte_pmd_init_all(void)
int ret = -ENODEV;
#ifdef RTE_LIBRTE_IXGBE_PMD
- if ((ret = rte_ixgbe_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init ixgbe PMD\n");
- return (ret);
- }
if ((ret = rte_ixgbevf_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init ixgbevf PMD\n");
return (ret);
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index a5a7f9a..92ba064 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -58,6 +58,8 @@
#include <rte_ethdev.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
+#include <rte_dev.h>
+#include <rte_pmd.h>
#include "ixgbe_logs.h"
#include "ixgbe/ixgbe_api.h"
@@ -955,8 +957,8 @@ static struct eth_driver rte_ixgbevf_pmd = {
* Invoked once at EAL init time.
* Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
*/
-int
-rte_ixgbe_pmd_init(void)
+static int
+rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
@@ -3060,3 +3062,10 @@ ixgbe_mirror_rule_reset(struct rte_eth_dev *dev, uint8_t rule_id)
return 0;
}
+
+struct rte_driver rte_ixgbe_driver = {
+ .type = PMD_PDEV,
+ .init = rte_ixgbe_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_ixgbe_driver);
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 12/15] ixgbevf: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (10 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 11/15] ixgbe: " Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 13/15] virtio: " Neil Horman
` (3 subsequent siblings)
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
convert the ixgbevf pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the ixgbevf library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 16 ----------------
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 12 +++++++++---
mk/rte.app.mk | 8 ++++----
3 files changed, 13 insertions(+), 23 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9621be7..ba535dc 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,15 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for 10Gbps Intel IXGBE_VF
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_ixgbevf_pmd_init(void);
-
-/**
* The initialization function of the driver for Qumranet virtio-net
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1365,13 +1356,6 @@ int rte_pmd_init_all(void)
{
int ret = -ENODEV;
-#ifdef RTE_LIBRTE_IXGBE_PMD
- if ((ret = rte_ixgbevf_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init ixgbevf PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_IXGBE_PMD */
-
#ifdef RTE_LIBRTE_VIRTIO_PMD
if ((ret = rte_virtio_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init virtio PMD\n");
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 92ba064..58e3ddc 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -971,8 +971,8 @@ rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unuse
* Invoked one at EAL init time.
* Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
*/
-int
-rte_ixgbevf_pmd_init(void)
+static int
+rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
{
DEBUGFUNC("rte_ixgbevf_pmd_init");
@@ -3063,9 +3063,15 @@ ixgbe_mirror_rule_reset(struct rte_eth_dev *dev, uint8_t rule_id)
return 0;
}
-struct rte_driver rte_ixgbe_driver = {
+static struct rte_driver rte_ixgbe_driver = {
.type = PMD_PDEV,
.init = rte_ixgbe_pmd_init,
};
+static struct rte_driver rte_ixgbevf_driver = {
+ .type = PMD_PDEV,
+ .init = rte_ixgbevf_pmd_init,
+};
+
PMD_REGISTER_DRIVER(rte_ixgbe_driver);
+PMD_REGISTER_DRIVER(rte_ixgbevf_driver);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index f5f137c..8cd1aa2 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -73,10 +73,6 @@ LDLIBS += -lrte_ivshmem
endif
endif
-ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
-LDLIBS += -lrte_pmd_ixgbe
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
LDLIBS += -lrte_pmd_virtio_uio
endif
@@ -165,6 +161,10 @@ endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y)
LDLIBS += -lrte_pmd_e1000
endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 13/15] virtio: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (11 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 12/15] ixgbevf: " Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 14/15] vmxnet3: " Neil Horman
` (2 subsequent siblings)
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
convert the virtio pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the virtio library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 16 ----------------
lib/librte_pmd_virtio/virtio_ethdev.c | 13 +++++++++++--
mk/rte.app.mk | 8 ++++----
3 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ba535dc..7126f95 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,15 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for Qumranet virtio-net
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_virtio_pmd_init(void);
-
-/**
* The initialization function of the driver for VMware VMXNET3
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1356,13 +1347,6 @@ int rte_pmd_init_all(void)
{
int ret = -ENODEV;
-#ifdef RTE_LIBRTE_VIRTIO_PMD
- if ((ret = rte_virtio_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init virtio PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_VIRTIO_PMD */
-
#ifdef RTE_LIBRTE_VMXNET3_PMD
if ((ret = rte_vmxnet3_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init vmxnet3 PMD\n");
diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index f107161..ff3a6cf 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -50,6 +50,8 @@
#include <rte_memory.h>
#include <rte_eal.h>
+#include <rte_dev.h>
+#include <rte_pmd.h>
#include "virtio_ethdev.h"
#include "virtio_pci.h"
@@ -486,8 +488,8 @@ static struct eth_driver rte_virtio_pmd = {
* Register itself as the [Poll Mode] Driver of PCI virtio devices.
* Returns 0 on success.
*/
-int
-rte_virtio_pmd_init(void)
+static int
+rte_virtio_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
{
rte_eth_driver_register(&rte_virtio_pmd);
return (0);
@@ -643,3 +645,10 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_pktlen = VIRTIO_MAX_RX_PKTLEN;
dev_info->max_mac_addrs = VIRTIO_MAX_MAC_ADDRS;
}
+
+static struct rte_driver rte_virtio_driver = {
+ .type = PMD_PDEV,
+ .init = rte_virtio_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_virtio_driver);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 8cd1aa2..827b8e3 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -73,10 +73,6 @@ LDLIBS += -lrte_ivshmem
endif
endif
-ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
-LDLIBS += -lrte_pmd_virtio_uio
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
LDLIBS += -lrte_pmd_vmxnet3_uio
endif
@@ -161,6 +157,10 @@ endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
+LDLIBS += -lrte_pmd_virtio_uio
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
LDLIBS += -lrte_pmd_ixgbe
endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 14/15] vmxnet3: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (12 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 13/15] virtio: " Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 15/15] pmd: Remove rte_pmd_init_all Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
convert the vmxnet3 pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the vmxnet3 library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 19 +------------------
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 13 +++++++++++--
mk/rte.app.mk | 8 ++++----
3 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 7126f95..24288f8 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,16 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for VMware VMXNET3
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_vmxnet3_pmd_init(void);
-
-
-/**
* The initialization function of *all* supported and enabled drivers.
* Right now, the following PMDs are supported:
* - igb
@@ -1345,14 +1335,7 @@ extern int rte_vmxnet3_pmd_init(void);
static inline
int rte_pmd_init_all(void)
{
- int ret = -ENODEV;
-
-#ifdef RTE_LIBRTE_VMXNET3_PMD
- if ((ret = rte_vmxnet3_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init vmxnet3 PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_VMXNET3_PMD */
+ int ret = 0;
if (ret == -ENODEV)
RTE_LOG(ERR, PMD, "No PMD(s) are configured\n");
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
index 8259cfe..19ac3eb 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
@@ -60,6 +60,8 @@
#include <rte_atomic.h>
#include <rte_string_fns.h>
#include <rte_malloc.h>
+#include <rte_dev.h>
+#include <rte_pmd.h>
#include "vmxnet3/vmxnet3_defs.h"
@@ -278,8 +280,8 @@ static struct eth_driver rte_vmxnet3_pmd = {
* Invoked once at EAL init time.
* Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
*/
-int
-rte_vmxnet3_pmd_init(void)
+static int
+rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
{
PMD_INIT_FUNC_TRACE();
@@ -763,3 +765,10 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
+
+static struct rte_driver rte_vmxnet3_driver = {
+ .type = PMD_PDEV,
+ .init = rte_vmxnet3_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_vmxnet3_driver);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 827b8e3..afc45b2 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -73,10 +73,6 @@ LDLIBS += -lrte_ivshmem
endif
endif
-ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
-LDLIBS += -lrte_pmd_vmxnet3_uio
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
LDLIBS += -lrte_timer
endif
@@ -157,6 +153,10 @@ endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
+LDLIBS += -lrte_pmd_vmxnet3_uio
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
LDLIBS += -lrte_pmd_virtio_uio
endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 15/15] pmd: Remove rte_pmd_init_all
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (13 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 14/15] vmxnet3: " Neil Horman
@ 2014-04-15 18:06 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
15 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-15 18:06 UTC (permalink / raw)
To: dev
Now that we've converted all the pmds in dpdk to use the driver registration
macro, rte_pmd_init_all has become empty. As theres no reason to keep it around
anymore, just remove it and fix up all the eample callers.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
app/test-pmd/testpmd.c | 3 ---
app/test/test_kni.c | 5 ----
examples/exception_path/main.c | 5 ----
examples/ip_reassembly/main.c | 4 ----
examples/ipv4_frag/main.c | 4 ----
examples/ipv4_multicast/main.c | 4 ----
examples/kni/main.c | 5 ----
examples/l2fwd-ivshmem/host/host.c | 4 ----
examples/l2fwd/main.c | 4 ----
examples/l3fwd-power/main.c | 4 ----
examples/l3fwd-vf/main.c | 4 ----
examples/l3fwd/main.c | 4 ----
examples/link_status_interrupt/main.c | 4 ----
examples/load_balancer/init.c | 6 -----
.../client_server_mp/shared/init_drivers.h | 2 +-
examples/multi_process/l2fwd_fork/main.c | 4 ----
examples/multi_process/symmetric_mp/main.c | 2 --
examples/netmap_compat/bridge/bridge.c | 4 ----
examples/qos_meter/main.c | 4 ----
examples/qos_sched/init.c | 4 ----
examples/quota_watermark/qw/init.c | 5 ----
examples/vhost/main.c | 2 +-
examples/vhost_xen/main.c | 2 +-
examples/vmdq/main.c | 2 +-
lib/librte_ether/rte_ethdev.h | 27 ----------------------
25 files changed, 4 insertions(+), 114 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 04dca57..7f2dcde 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1755,9 +1755,6 @@ main(int argc, char** argv)
if (diag < 0)
rte_panic("Cannot init EAL\n");
- if (rte_pmd_init_all())
- rte_panic("Cannot init PMD\n");
-
if (rte_eal_pci_probe())
rte_panic("Cannot probe PCI\n");
diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index e0fe44e..d37758b 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -509,11 +509,6 @@ test_kni(void)
printf("fail to create mempool for kni\n");
return -1;
}
- ret = rte_pmd_init_all();
- if (ret < 0) {
- printf("fail to initialize PMD\n");
- return -1;
- }
ret = rte_eal_pci_probe();
if (ret < 0) {
printf("fail to probe PCI devices\n");
diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index 0bc149d..d73b413 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -566,11 +566,6 @@ main(int argc, char** argv)
return -1;
}
- /* Initialise PMD driver(s) */
- ret = rte_pmd_init_all();
- if (ret < 0)
- FATAL_ERROR("Could not probe PMD (%d)", ret);
-
/* Scan PCI bus for recognised devices */
ret = rte_eal_pci_probe();
if (ret < 0)
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 4880a5f..bafa8d9 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -1553,10 +1553,6 @@ MAIN(int argc, char **argv)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/ipv4_frag/main.c b/examples/ipv4_frag/main.c
index 93664c8..329f2ce 100644
--- a/examples/ipv4_frag/main.c
+++ b/examples/ipv4_frag/main.c
@@ -608,10 +608,6 @@ MAIN(int argc, char **argv)
if (pool_indirect == NULL)
rte_panic("Cannot init indirect mbuf pool\n");
- /* init driver */
- if (rte_pmd_init_all() < 0)
- rte_panic("Cannot init PMD\n");
-
if (rte_eal_pci_probe() < 0)
rte_panic("Cannot probe PCI\n");
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index 3bd37e4..da4e09d 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -753,10 +753,6 @@ MAIN(int argc, char **argv)
if (clone_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n");
- /* init driver */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 274990b..fe823b3 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -889,11 +889,6 @@ main(int argc, char** argv)
return -1;
}
- /* Initialise PMD driver(s) */
- ret = rte_pmd_init_all();
- if (ret < 0)
- rte_exit(EXIT_FAILURE, "Could not initialise PMD (%d)\n", ret);
-
/* Scan PCI bus for recognised devices */
ret = rte_eal_pci_probe();
if (ret < 0)
diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c
index 6aaa082..e0627a4 100644
--- a/examples/l2fwd-ivshmem/host/host.c
+++ b/examples/l2fwd-ivshmem/host/host.c
@@ -716,10 +716,6 @@ int main(int argc, char **argv)
if (l2fwd_ivshmem_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 2d94366..d04e27a 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -615,10 +615,6 @@ MAIN(int argc, char **argv)
if (l2fwd_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 219f802..598b7a2 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1547,10 +1547,6 @@ MAIN(int argc, char **argv)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c
index fb811fa..793cacc 100644
--- a/examples/l3fwd-vf/main.c
+++ b/examples/l3fwd-vf/main.c
@@ -1007,10 +1007,6 @@ MAIN(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- /* init driver */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 1ba4ca2..8ee1af9 100755
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1841,10 +1841,6 @@ MAIN(int argc, char **argv)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index de6c87f..8d17b01 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -663,10 +663,6 @@ MAIN(int argc, char **argv)
if (lsi_pktmbuf_pool == NULL)
rte_panic("Cannot init mbuf pool\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_panic("Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_panic("Cannot probe PCI\n");
diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c
index 6a2f218..e997238 100644
--- a/examples/load_balancer/init.c
+++ b/examples/load_balancer/init.c
@@ -450,12 +450,6 @@ app_init_nics(void)
int ret;
uint32_t n_rx_queues, n_tx_queues;
- /* Init driver */
- printf("Initializing the PMD driver ...\n");
- if (rte_pmd_init_all() < 0) {
- rte_panic("Cannot init PMD\n");
- }
-
if (rte_eal_pci_probe() < 0) {
rte_panic("Cannot probe PCI\n");
}
diff --git a/examples/multi_process/client_server_mp/shared/init_drivers.h b/examples/multi_process/client_server_mp/shared/init_drivers.h
index afa03bd..5d9a90f 100644
--- a/examples/multi_process/client_server_mp/shared/init_drivers.h
+++ b/examples/multi_process/client_server_mp/shared/init_drivers.h
@@ -40,7 +40,7 @@
static inline int
init_drivers(void)
{
- if (rte_pmd_init_all() < 0 || rte_eal_pci_probe() < 0)
+ if (rte_eal_pci_probe() < 0)
return -1;
return 0;
diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c
index 3dd2b2a..a34f420 100644
--- a/examples/multi_process/l2fwd_fork/main.c
+++ b/examples/multi_process/l2fwd_fork/main.c
@@ -1050,10 +1050,6 @@ MAIN(int argc, char **argv)
for (i = 0; i < RTE_MAX_LCORE; i++)
lcore_resource[i].lcore_id = i;
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 12fa28d..028f98d 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -463,8 +463,6 @@ main(int argc, char **argv)
/* probe to determine the NIC devices available */
proc_type = rte_eal_process_type();
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
if (rte_eth_dev_count() == 0)
diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c
index ecf5757..e0cef57 100644
--- a/examples/netmap_compat/bridge/bridge.c
+++ b/examples/netmap_compat/bridge/bridge.c
@@ -294,10 +294,6 @@ int main(int argc, char *argv[])
if (ports.num == 0)
rte_exit(EXIT_FAILURE, "no ports specified\n");
- err = rte_pmd_init_all();
- if (err < 0)
- rte_exit(EXIT_FAILURE, "rte_pmd_init_all(): error %d\n", err);
-
err = rte_eal_pci_probe();
if (err < 0)
rte_exit(EXIT_FAILURE, "rte_eal_pci_probe(): error %d\n", err);
diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c
index bc76703..e1698cc 100755
--- a/examples/qos_meter/main.c
+++ b/examples/qos_meter/main.c
@@ -386,10 +386,6 @@ MAIN(int argc, char **argv)
if (pool == NULL)
rte_exit(EXIT_FAILURE, "Buffer pool creation error\n");
- /* PMD init */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "PMD init error\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "PCI probe error\n");
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index 7c5c62e..e021815 100755
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -305,10 +305,6 @@ int app_init(void)
char ring_name[MAX_NAME_LEN];
char pool_name[MAX_NAME_LEN];
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init PMD\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c
index f42eb8b..44455b2 100644
--- a/examples/quota_watermark/qw/init.c
+++ b/examples/quota_watermark/qw/init.c
@@ -138,11 +138,6 @@ init_dpdk(void)
{
int ret;
- /* Initialize the PMD */
- ret = rte_pmd_init_all();
- if (ret < 0)
- rte_exit(EXIT_FAILURE, "Failed to initialize poll mode drivers (error %d)\n", ret);
-
/* Bind the drivers to usable devices */
ret = rte_eal_pci_probe();
if (ret < 0)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 816a71a..b86d57d 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1657,7 +1657,7 @@ MAIN(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid argument\n");
- if (rte_pmd_init_all() != 0 || rte_eal_pci_probe() != 0)
+ if (rte_eal_pci_probe() != 0)
rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index eafc0aa..2ec44ee 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -1464,7 +1464,7 @@ MAIN(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid argument\n");
- if (rte_pmd_init_all() != 0 || rte_eal_pci_probe() != 0)
+ if (rte_eal_pci_probe() != 0)
rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index fac24aa..0f52bdd 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -597,7 +597,7 @@ MAIN(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid VMDQ argument\n");
- if (rte_pmd_init_all() != 0 || rte_eal_pci_probe() != 0)
+ if (rte_eal_pci_probe() != 0)
rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 24288f8..d5ea46b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,33 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of *all* supported and enabled drivers.
- * Right now, the following PMDs are supported:
- * - igb
- * - igbvf
- * - em
- * - ixgbe
- * - ixgbevf
- * - virtio
- * - vmxnet3
- * This function is invoked once at EAL start time.
- * @return
- * 0 on success.
- * Error code of the device initialization failure,
- * -ENODEV if there are no drivers available
- * (e.g. if all driver config options are = n).
- */
-static inline
-int rte_pmd_init_all(void)
-{
- int ret = 0;
-
- if (ret == -ENODEV)
- RTE_LOG(ERR, PMD, "No PMD(s) are configured\n");
- return (ret);
-}
-
-/**
* Configure an Ethernet device.
* This function must be invoked first before any other function in the
* Ethernet API. This function can also be re-invoked when a device is in the
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error
2014-04-15 18:05 ` [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error Neil Horman
@ 2014-04-16 9:22 ` Thomas Monjalon
2014-04-16 11:00 ` Neil Horman
2014-04-16 13:51 ` [dpdk-dev] [PATCH 01/15 v2] " Neil Horman
1 sibling, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-16 9:22 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
Hi,
2014-04-15 14:05, Neil Horman:
> The shared libraries built with the current makefile set produce static
> libraries rather than actual shared objects. This is due to several missing
> options that are required to correctly build shared objects using ld, as
> well as a mis-specified -share option (which should be -shared). Switching
> to the use of CC rather than LD and fixing the -shared option corrects
> these problems and builds the DSOs correctly.
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Thanks for fixing -shared option.
Regarding switch to CC linking, please have a look at LINK_USING_CC option.
Maybe you should use it for rte.lib.mk and rte.sharelib.mk.
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 02/15] make: include whole archive on static link
2014-04-15 18:05 ` [dpdk-dev] [PATCH 02/15] make: include whole archive on static link Neil Horman
@ 2014-04-16 9:26 ` Thomas Monjalon
2014-04-16 11:02 ` Neil Horman
0 siblings, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-16 9:26 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-15 14:05, Neil Horman:
> This happens automatically on dyanmic linking, but when linking an archive
> we need to to include the whole archive to make sure we call all the
> constructors. Not doing this causes them to be discarded due to the fact
> theres no symbolic reference connecting the pmds to the application.
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This patch conflicts with Olivier's one:
http://dpdk.org/browse/dpdk/commit/?id=20afd76a504155e947
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error
2014-04-16 9:22 ` Thomas Monjalon
@ 2014-04-16 11:00 ` Neil Horman
2014-04-16 11:37 ` Thomas Monjalon
0 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-16 11:00 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Wed, Apr 16, 2014 at 11:22:35AM +0200, Thomas Monjalon wrote:
> Hi,
>
> 2014-04-15 14:05, Neil Horman:
> > The shared libraries built with the current makefile set produce static
> > libraries rather than actual shared objects. This is due to several missing
> > options that are required to correctly build shared objects using ld, as
> > well as a mis-specified -share option (which should be -shared). Switching
> > to the use of CC rather than LD and fixing the -shared option corrects
> > these problems and builds the DSOs correctly.
> >
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>
> Thanks for fixing -shared option.
>
> Regarding switch to CC linking, please have a look at LINK_USING_CC option.
> Maybe you should use it for rte.lib.mk and rte.sharelib.mk.
>
Yeah, I can do that. Would you like the whole series reposted, or just the
specific patch?
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 02/15] make: include whole archive on static link
2014-04-16 9:26 ` Thomas Monjalon
@ 2014-04-16 11:02 ` Neil Horman
2014-04-16 11:40 ` Thomas Monjalon
0 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-16 11:02 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Wed, Apr 16, 2014 at 11:26:48AM +0200, Thomas Monjalon wrote:
> 2014-04-15 14:05, Neil Horman:
> > This happens automatically on dyanmic linking, but when linking an archive
> > we need to to include the whole archive to make sure we call all the
> > constructors. Not doing this causes them to be discarded due to the fact
> > theres no symbolic reference connecting the pmds to the application.
> >
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>
> This patch conflicts with Olivier's one:
> http://dpdk.org/browse/dpdk/commit/?id=20afd76a504155e947
>
How does it conflict? I've got it in my dpdk tree here, based off commit
396b69e56a3462ff80537deccebcdecb2771d8ca, which includes Oliviers patch, and
mine is applied on top of it cleanly.
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error
2014-04-16 11:00 ` Neil Horman
@ 2014-04-16 11:37 ` Thomas Monjalon
0 siblings, 0 replies; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-16 11:37 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-16 07:00, Neil Horman:
> On Wed, Apr 16, 2014 at 11:22:35AM +0200, Thomas Monjalon wrote:
> > Hi,
> >
> > 2014-04-15 14:05, Neil Horman:
> > > The shared libraries built with the current makefile set produce static
> > > libraries rather than actual shared objects. This is due to several
> > > missing options that are required to correctly build shared objects
> > > using ld, as well as a mis-specified -share option (which should be
> > > -shared). Switching to the use of CC rather than LD and fixing the
> > > -shared option corrects these problems and builds the DSOs correctly.
> > >
> > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> >
> > Thanks for fixing -shared option.
> >
> > Regarding switch to CC linking, please have a look at LINK_USING_CC
> > option.
> > Maybe you should use it for rte.lib.mk and rte.sharelib.mk.
>
> Yeah, I can do that. Would you like the whole series reposted, or just the
> specific patch?
Just sending this patch should be enough.
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 02/15] make: include whole archive on static link
2014-04-16 11:02 ` Neil Horman
@ 2014-04-16 11:40 ` Thomas Monjalon
2014-04-16 13:02 ` Neil Horman
0 siblings, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-16 11:40 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-16 07:02, Neil Horman:
> On Wed, Apr 16, 2014 at 11:26:48AM +0200, Thomas Monjalon wrote:
> > 2014-04-15 14:05, Neil Horman:
> > > This happens automatically on dyanmic linking, but when linking an
> > > archive
> > > we need to to include the whole archive to make sure we call all the
> > > constructors. Not doing this causes them to be discarded due to the fact
> > > theres no symbolic reference connecting the pmds to the application.
> > >
> > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> >
> > This patch conflicts with Olivier's one:
> > http://dpdk.org/browse/dpdk/commit/?id=20afd76a504155e947
>
> How does it conflict? I've got it in my dpdk tree here, based off commit
> 396b69e56a3462ff80537deccebcdecb2771d8ca, which includes Oliviers patch, and
> mine is applied on top of it cleanly.
It's not a git conflict.
I mean --whole-archive is set twice.
Maybe that your patch is not needed.
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-15 18:05 ` [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro Neil Horman
@ 2014-04-16 11:52 ` Thomas Monjalon
2014-04-16 12:59 ` John W. Linville
2014-04-16 13:08 ` Neil Horman
2014-04-18 11:42 ` Thomas Monjalon
1 sibling, 2 replies; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-16 11:52 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-15 14:05, Neil Horman:
> Rather than have each driver have to remember to add a constructor to it to
> make sure its gets registered properly, wrap that process up in a macro to
> make registration a one line affair. This also sets the stage for us to
> make registration of vdev pmds and physical pmds a uniform process
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Could you explain why having a macro is better than an explicit constructor
function?
> +enum rte_pmd_driver_type {
> + PMD_VDEV = 1
> +};
> +
> +extern void rte_eal_nonpci_dev_init_register(const char *name, int
> (*dev_initfn)(const char *, const char *)); +#define PMD_REGISTER_DRIVER(d,
> t)\
> +void devinitfn_ ##d(void);\
> +void __attribute__((constructor, used)) devinitfn_ ##d(void)\
> +{\
> + enum rte_pmd_driver_type _t = (t);\
> + switch(_t)\
> + {\
> + case PMD_VDEV:\
> + rte_eal_vdev_driver_register(&d);\
> + break;\
> + };\
Are you sure this switch is needed?
You are removing it in patch 7.
If someone else think this macro is a good idea, or not, speak now :)
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-16 11:52 ` Thomas Monjalon
@ 2014-04-16 12:59 ` John W. Linville
2014-04-16 13:08 ` Neil Horman
1 sibling, 0 replies; 77+ messages in thread
From: John W. Linville @ 2014-04-16 12:59 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Wed, Apr 16, 2014 at 01:52:49PM +0200, Thomas Monjalon wrote:
> 2014-04-15 14:05, Neil Horman:
> > Rather than have each driver have to remember to add a constructor to it to
> > make sure its gets registered properly, wrap that process up in a macro to
> > make registration a one line affair. This also sets the stage for us to
> > make registration of vdev pmds and physical pmds a uniform process
> >
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>
> Could you explain why having a macro is better than an explicit constructor
> function?
>
> > +enum rte_pmd_driver_type {
> > + PMD_VDEV = 1
> > +};
> > +
> > +extern void rte_eal_nonpci_dev_init_register(const char *name, int
> > (*dev_initfn)(const char *, const char *)); +#define PMD_REGISTER_DRIVER(d,
> > t)\
> > +void devinitfn_ ##d(void);\
> > +void __attribute__((constructor, used)) devinitfn_ ##d(void)\
> > +{\
> > + enum rte_pmd_driver_type _t = (t);\
> > + switch(_t)\
> > + {\
> > + case PMD_VDEV:\
> > + rte_eal_vdev_driver_register(&d);\
> > + break;\
> > + };\
>
> Are you sure this switch is needed?
> You are removing it in patch 7.
>
> If someone else think this macro is a good idea, or not, speak now :)
I don't understand your objection to it? It makes for a nice clean
declaration, rather than error-prone cut-n-pasted boilerplate code
in every driver. Even more benefits accrue if/when the constructors
need to be changed...
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 02/15] make: include whole archive on static link
2014-04-16 11:40 ` Thomas Monjalon
@ 2014-04-16 13:02 ` Neil Horman
2014-04-16 13:33 ` Neil Horman
0 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-16 13:02 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Wed, Apr 16, 2014 at 01:40:19PM +0200, Thomas Monjalon wrote:
> 2014-04-16 07:02, Neil Horman:
> > On Wed, Apr 16, 2014 at 11:26:48AM +0200, Thomas Monjalon wrote:
> > > 2014-04-15 14:05, Neil Horman:
> > > > This happens automatically on dyanmic linking, but when linking an
> > > > archive
> > > > we need to to include the whole archive to make sure we call all the
> > > > constructors. Not doing this causes them to be discarded due to the fact
> > > > theres no symbolic reference connecting the pmds to the application.
> > > >
> > > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > >
> > > This patch conflicts with Olivier's one:
> > > http://dpdk.org/browse/dpdk/commit/?id=20afd76a504155e947
> >
> > How does it conflict? I've got it in my dpdk tree here, based off commit
> > 396b69e56a3462ff80537deccebcdecb2771d8ca, which includes Oliviers patch, and
> > mine is applied on top of it cleanly.
>
> It's not a git conflict.
> I mean --whole-archive is set twice.
> Maybe that your patch is not needed.
>
Yeah, I think you're right, its can probably just be dropped. Let me test quick
and I'll confirm
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-16 11:52 ` Thomas Monjalon
2014-04-16 12:59 ` John W. Linville
@ 2014-04-16 13:08 ` Neil Horman
2014-04-16 16:11 ` Olivier MATZ
1 sibling, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-16 13:08 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Wed, Apr 16, 2014 at 01:52:49PM +0200, Thomas Monjalon wrote:
> 2014-04-15 14:05, Neil Horman:
> > Rather than have each driver have to remember to add a constructor to it to
> > make sure its gets registered properly, wrap that process up in a macro to
> > make registration a one line affair. This also sets the stage for us to
> > make registration of vdev pmds and physical pmds a uniform process
> >
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>
> Could you explain why having a macro is better than an explicit constructor
> function?
>
Because its a one line declaration inside a driver function that points to the
structure used to initilze the pmd? Having to append ((__constructor__)) to
each initalization function is both error prone during entry and exposes the
possibiilty of developers doing "too much" in their constructor. It also allows
for easy updating to all drivers, if additional boilerplate work needs to be
done in the future for all pmds.
> > +enum rte_pmd_driver_type {
> > + PMD_VDEV = 1
> > +};
> > +
> > +extern void rte_eal_nonpci_dev_init_register(const char *name, int
> > (*dev_initfn)(const char *, const char *)); +#define PMD_REGISTER_DRIVER(d,
> > t)\
> > +void devinitfn_ ##d(void);\
> > +void __attribute__((constructor, used)) devinitfn_ ##d(void)\
> > +{\
> > + enum rte_pmd_driver_type _t = (t);\
> > + switch(_t)\
> > + {\
> > + case PMD_VDEV:\
> > + rte_eal_vdev_driver_register(&d);\
> > + break;\
> > + };\
>
> Are you sure this switch is needed?
> You are removing it in patch 7.
>
I think you answered your own question :). It was needed when this patch was
written because the physical pmd regitration differed from the virtual pmd. As
you note though, its removed in patch 7 because we merged the registration
methods. Could I merge them earlier? sure, but its not at all needed. It
works in this invocation, and it works (better in the final version at the end
of the series).
> If someone else think this macro is a good idea, or not, speak now :)
>
I'm speaking up, its a good idea :)
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 02/15] make: include whole archive on static link
2014-04-16 13:02 ` Neil Horman
@ 2014-04-16 13:33 ` Neil Horman
0 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-16 13:33 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Wed, Apr 16, 2014 at 09:02:04AM -0400, Neil Horman wrote:
> On Wed, Apr 16, 2014 at 01:40:19PM +0200, Thomas Monjalon wrote:
> > 2014-04-16 07:02, Neil Horman:
> > > On Wed, Apr 16, 2014 at 11:26:48AM +0200, Thomas Monjalon wrote:
> > > > 2014-04-15 14:05, Neil Horman:
> > > > > This happens automatically on dyanmic linking, but when linking an
> > > > > archive
> > > > > we need to to include the whole archive to make sure we call all the
> > > > > constructors. Not doing this causes them to be discarded due to the fact
> > > > > theres no symbolic reference connecting the pmds to the application.
> > > > >
> > > > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > > >
> > > > This patch conflicts with Olivier's one:
> > > > http://dpdk.org/browse/dpdk/commit/?id=20afd76a504155e947
> > >
> > > How does it conflict? I've got it in my dpdk tree here, based off commit
> > > 396b69e56a3462ff80537deccebcdecb2771d8ca, which includes Oliviers patch, and
> > > mine is applied on top of it cleanly.
> >
> > It's not a git conflict.
> > I mean --whole-archive is set twice.
> > Maybe that your patch is not needed.
> >
> Yeah, I think you're right, its can probably just be dropped. Let me test quick
> and I'll confirm
> Neil
>
Confirmed, its redundant. You can just drop this one patch.
Thanks
Neil
> > --
> > Thomas
> >
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-04-15 18:05 ` [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error Neil Horman
2014-04-16 9:22 ` Thomas Monjalon
@ 2014-04-16 13:51 ` Neil Horman
2014-04-18 11:23 ` Thomas Monjalon
2014-04-29 23:42 ` Thomas Monjalon
1 sibling, 2 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-16 13:51 UTC (permalink / raw)
To: dev
The shared libraries built with the current makefile set produce static
libraries rather than actual shared objects. This is due to several missing
options that are required to correctly build shared objects using ld, as well as
a mis-specified -share option (which should be -shared). Switching to the use of
CC rather than LD and fixing the -shared option corrects these problems and
builds the DSOs correctly.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
Change notes:
v2) Added test for LINK_USING_CC to convert to link with gcc
---
mk/rte.lib.mk | 9 +++++++--
mk/rte.sharelib.mk | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index f75ca92..f5d2789 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -59,6 +59,11 @@ build: _postbuild
exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
+ifeq ($(LINK_USING_CC),1)
+# Override the definition of LD here, since we're linking with CC
+LD := $(CC)
+endif
+
O_TO_A = $(AR) crus $(LIB) $(OBJS-y)
O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight
O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")
@@ -68,7 +73,7 @@ O_TO_A_DO = @set -e; \
$(O_TO_A) && \
echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))
-O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -share $(OBJS-y) -o $(LIB)
+O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -shared $(OBJS-y) -o $(LIB)
O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
O_TO_S_DO = @set -e; \
@@ -84,7 +89,7 @@ O_TO_C_DO = @set -e; \
$(lib_dir) \
$(copy_obj)
else
-O_TO_C = $(LD) -z muldefs -share $(OBJS-y) -o $(LIB_ONE)
+O_TO_C = $(LD) -z muldefs -shared $(OBJS-y) -o $(LIB_ONE)
O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight
O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)"," LD_C $(@)")
O_TO_C_DO = @set -e; \
diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk
index 3967b51..429309f 100644
--- a/mk/rte.sharelib.mk
+++ b/mk/rte.sharelib.mk
@@ -45,7 +45,7 @@ sharelib: $(LIB_ONE) FORCE
OBJS = $(wildcard $(RTE_OUTPUT)/build/lib/*.o)
-O_TO_S = $(LD) $(CPU_LDFLAGS) -share $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
+O_TO_S = $(LD) $(CPU_LDFLAGS) -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
O_TO_S_CMD = "cmd_$@ = $(O_TO_S_STR)"
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 05/15 v2] ring: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 ` [dpdk-dev] [PATCH 05/15] ring: " Neil Horman
@ 2014-04-16 13:53 ` Neil Horman
2014-04-17 9:50 ` [dpdk-dev] [PATCH 05/15] " Ananyev, Konstantin
1 sibling, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-16 13:53 UTC (permalink / raw)
To: dev
convert the ring driver to use the PMD_REGISTER_DRIVER macro and fix up the
Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the ring library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Note that the ring driver was also written in such a way that it violated some
general layering principles, several functions were contained in the pmd which
were being called by example from the test application in the app/test
directory. Specifically it was calling eth_ring_pair_attach,
eth_ring_pair_create and rte_eth_ring_devinit, which should only be called
internally to the dpdk core library. To correct this I've removed those
functions, and instead allowed them to be called indirectly at initalization
time using the vdev command line argument key nodeaction=<name>:<node>:<action>
where action is one of ATTACH or CREATE. I've tested out the functionality of
the command line with the testpmd utility, with success, and have removed the
called functions from the test utility. This will affect how the test utility
is invoked (the -d and --vdev option will need to be specified on the command
line now), but honestly, given the way it was coded, I think the testing of the
ring pmd was not the best example of how to code with dpdk to begin with. I
have also left the two layer violating functions in place, so as not to break
existing applications, but added deprecation warnings to them so that apps can
migrate off them.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
Change notes
v2) fixed DEPDIR specifcation, should depend on RING not PCAP
---
app/test/test_pmd_ring.c | 95 ----------------------------
lib/librte_pmd_ring/Makefile | 1 +
lib/librte_pmd_ring/rte_eth_ring.c | 123 ++++++++++++++++++++++++++++++++++---
mk/rte.app.mk | 14 +++--
4 files changed, 124 insertions(+), 109 deletions(-)
diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
index 4d9c2ba..1fe38fa 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -42,7 +42,6 @@
/* two test rings, r1 is used by two ports, r2 just by one */
static struct rte_ring *r1[2], *r2;
-static struct rte_ring *nullring = NULL;
static struct rte_mempool *mp;
static uint8_t start_idx; /* will store the port id of the first of our new ports */
@@ -59,58 +58,6 @@ static uint8_t start_idx; /* will store the port id of the first of our new port
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 512
-
-static int
-test_ring_ethdev_create(void)
-{
- int retval;
- printf("Testing ring pmd create\n");
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create zero-sized RXTX ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, RTE_MAX_NUMA_NODES);
- if (retval >= 0) {
- printf("Failure, can create ring pmd on socket %d\n", RTE_MAX_NUMA_NODES);
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 1, &r2, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null rx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, NULL, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null tx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&nullring, 1, r1, 2, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create TX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, &nullring, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&r2, 1, &r2, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RXTX ring pmd\n");
- return -1;
- }
-
- return 0;
-}
-
static int
test_ethdev_configure(void)
{
@@ -305,26 +252,12 @@ test_stats_reset(void)
static int
test_pmd_ring_init(void)
{
- const char * name1 = "R3";
- const char * name2 = "R4";
- const char * params_null = NULL;
- const char * params = "PARAMS";
struct rte_eth_stats stats;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
printf("Testing ring pmd init\n");
- if (rte_pmd_ring_devinit(name1, params_null) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
- if (rte_pmd_ring_devinit(name2, params) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -371,24 +304,16 @@ test_pmd_ring_init(void)
rte_eth_dev_stop(RXTX_PORT2);
- /* Test init same name pmd ring */
- rte_pmd_ring_devinit(name1, params_null);
return 0;
}
static int
test_pmd_ring_pair_create(void)
{
- const char * name1 = "_RNG_P0";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_create(name1, SOCKET0) < 0) {
- printf("Create ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -447,28 +372,16 @@ test_pmd_ring_pair_create(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test create same name ring pair */
- if (rte_eth_ring_pair_create(name1, SOCKET0) == 0) {
- printf("Create same name ring pair error\n");
- return -1;
- }
return 0;
}
static int
test_pmd_ring_pair_attach(void)
{
- const char * name1 = "_RNG_P0";
- const char * name2 = "_RNG_P1";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_attach(name1, SOCKET0) < 0) {
- printf("Attach ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -529,11 +442,6 @@ test_pmd_ring_pair_attach(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test attach non-existing ring pair */
- if (rte_eth_ring_pair_attach(name2, SOCKET0) == 0) {
- printf("Attach non-existing ring pair error\n");
- return -1;
- }
return 0;
}
@@ -568,9 +476,6 @@ test_pmd_ring(void)
return -1;
}
- if (test_ring_ethdev_create() < 0)
- return -1;
-
if (test_ethdev_configure() < 0)
return -1;
diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
index 73b2d38..35d40cb 100644
--- a/lib/librte_pmd_ring/Makefile
+++ b/lib/librte_pmd_ring/Makefile
@@ -52,5 +52,6 @@ SYMLINK-y-include += rte_eth_ring.h
# this lib depends upon:
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index cee3fff..266cfc0 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -38,6 +38,15 @@
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_vdev.h>
+#include <rte_pmd.h>
+#include <rte_kvargs.h>
+
+#define ETH_RING_NUMA_NODE_ACTION_ARG "nodeaction"
+
+static const char *valid_arguments[] = {
+ ETH_RING_NUMA_NODE_ACTION_ARG,
+ NULL
+};
struct ring_queue {
struct rte_ring *rng;
@@ -373,28 +382,127 @@ eth_dev_ring_pair_create(const char *name, const unsigned numa_node,
int
rte_eth_ring_pair_create(const char *name, const unsigned numa_node)
{
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_create is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_CREATE);
}
int
rte_eth_ring_pair_attach(const char *name, const unsigned numa_node)
{
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_attach is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_ATTACH);
}
+struct node_action_pair {
+ char name[PATH_MAX];
+ unsigned node;
+ enum dev_action action;
+};
+
+struct node_action_list {
+ unsigned total;
+ unsigned count;
+ struct node_action_pair *list;
+};
+
+static int parse_kvlist (const char *key __rte_unused, const char *value, void *data)
+{
+ struct node_action_list *info = data;
+ int ret;
+ char *name;
+ char *action;
+ char *node;
+
+ name = strdup(value);
+
+ ret = -1;
+
+ if (!name)
+ goto out;
+
+ node = strchr(name, ':');
+ *node = '\0';
+ node++;
+
+ action = strchr(node, ':');
+ *action = '\0';
+ action++;
+
+ /*
+ * Need to do some sanity checking here
+ */
+
+ if (strcmp(action, "ATTACH"))
+ if (strcmp(action, "CREATE"))
+ goto out;
+
+ info->list[info->count].node = strtol(node, NULL, 10);
+
+ info->list[info->count].action = strcmp(action, "ATTACH") ? DEV_CREATE : DEV_ATTACH;
+
+ strncpy(info->list[info->count].name, name, PATH_MAX);
+
+ info->count++;
+
+ ret = 0;
+out:
+ free(name);
+ return ret;
+}
+
int
rte_pmd_ring_devinit(const char *name, const char *params)
{
+ struct rte_kvargs *kvlist;
+ int ret = 0;
+ struct node_action_list *info = NULL;
+
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
+
if (params == NULL || params[0] == '\0')
eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
else {
- RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
- " rings-backed ethernet device\n");
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ printf("Parsing kvargs\n");
+ kvlist = rte_kvargs_parse(params, valid_arguments);
+
+ if (!kvlist) {
+ RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
+ " rings-backed ethernet device\n");
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ return 0;
+ } else {
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ printf("counting kvargs\n");
+ ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
+ info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
+ (sizeof(struct node_action_pair) * ret), 0);
+ if (!info)
+ goto out;
+
+ info->total = ret;
+ info->list = (struct node_action_pair*)(info + 1);
+
+ printf("We have %d nodeaction pairs\n", info->total);
+ ret = rte_kvargs_process(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG,
+ parse_kvlist, info);
+
+ if (ret < 0)
+ goto out_free;
+
+ for (info->count = 0; info->count < info->total; info->count++) {
+ printf("Doing something with a ring\n");
+ eth_dev_ring_pair_create(name, info->list[info->count].node,
+ info->list[info->count].action);
+ }
+
+ }
}
- return 0;
+
+out_free:
+ rte_free(info);
+out:
+ return ret;
}
static struct rte_vdev_driver pmd_ring_drv = {
@@ -402,9 +510,4 @@ static struct rte_vdev_driver pmd_ring_drv = {
.init = rte_pmd_ring_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_ring_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_ring_drv);
-}
+PMD_REGISTER_DRIVER(pmd_ring_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index e6d09b8..4f167aa 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -133,10 +133,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
LDLIBS += -lethdev
endif
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-LDLIBS += -lrte_pmd_ring
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
LDLIBS += -lrte_malloc
endif
@@ -173,9 +169,19 @@ LDLIBS += -lrte_cmdline
endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lrte_pmd_pcap -lpcap
endif
+
endif
LDLIBS += $(EXECENV_LDLIBS)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-16 13:08 ` Neil Horman
@ 2014-04-16 16:11 ` Olivier MATZ
2014-04-16 17:15 ` John W. Linville
2014-04-16 17:29 ` Neil Horman
0 siblings, 2 replies; 77+ messages in thread
From: Olivier MATZ @ 2014-04-16 16:11 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
Hi Neil,
On 04/16/2014 03:08 PM, Neil Horman wrote:
> On Wed, Apr 16, 2014 at 01:52:49PM +0200, Thomas Monjalon wrote:
>> 2014-04-15 14:05, Neil Horman:
>>> Rather than have each driver have to remember to add a constructor to it to
>>> make sure its gets registered properly, wrap that process up in a macro to
>>> make registration a one line affair. This also sets the stage for us to
>>> make registration of vdev pmds and physical pmds a uniform process
>>>
>>> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>>
>> Could you explain why having a macro is better than an explicit constructor
>> function?
>>
> Because its a one line declaration inside a driver function that points to the
> structure used to initilze the pmd? Having to append ((__constructor__)) to
> each initalization function is both error prone during entry and exposes the
> possibiilty of developers doing "too much" in their constructor. It also allows
> for easy updating to all drivers, if additional boilerplate work needs to be
> done in the future for all pmds.
Even if it's not critical, in my opinion, the following code is easier
to understand:
__attribute__((constructor))
static void
rte_pmd_ring_init(void)
{
rte_eal_dev_driver_register(&pmd_ring_drv);
}
Than:
PMD_REGISTER_DRIVER(pmd_ring_drv);
The first version explicitly shows what you are doing: defining a
static function called at initialization that registers a driver
structure.
With the second, we're tempted to check what this macro does...
My 2 cents,
Olivier
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-16 16:11 ` Olivier MATZ
@ 2014-04-16 17:15 ` John W. Linville
2014-04-16 17:29 ` Neil Horman
1 sibling, 0 replies; 77+ messages in thread
From: John W. Linville @ 2014-04-16 17:15 UTC (permalink / raw)
To: Olivier MATZ; +Cc: dev
On Wed, Apr 16, 2014 at 06:11:32PM +0200, Olivier MATZ wrote:
> Hi Neil,
>
> On 04/16/2014 03:08 PM, Neil Horman wrote:
> >On Wed, Apr 16, 2014 at 01:52:49PM +0200, Thomas Monjalon wrote:
> >>2014-04-15 14:05, Neil Horman:
> >>>Rather than have each driver have to remember to add a constructor to it to
> >>>make sure its gets registered properly, wrap that process up in a macro to
> >>>make registration a one line affair. This also sets the stage for us to
> >>>make registration of vdev pmds and physical pmds a uniform process
> >>>
> >>>Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> >>
> >>Could you explain why having a macro is better than an explicit constructor
> >>function?
> >>
> >Because its a one line declaration inside a driver function that points to the
> >structure used to initilze the pmd? Having to append ((__constructor__)) to
> >each initalization function is both error prone during entry and exposes the
> >possibiilty of developers doing "too much" in their constructor. It also allows
> >for easy updating to all drivers, if additional boilerplate work needs to be
> >done in the future for all pmds.
>
> Even if it's not critical, in my opinion, the following code is easier
> to understand:
>
> __attribute__((constructor))
> static void
> rte_pmd_ring_init(void)
> {
> rte_eal_dev_driver_register(&pmd_ring_drv);
> }
>
> Than:
>
> PMD_REGISTER_DRIVER(pmd_ring_drv);
>
>
> The first version explicitly shows what you are doing: defining a
> static function called at initialization that registers a driver
> structure.
>
> With the second, we're tempted to check what this macro does...
Which you will do once, and then forever be thankful that ever after
you will only have to read the simple macro rather than all that
nasty boilerplate and __attribute__ gorp...
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-16 16:11 ` Olivier MATZ
2014-04-16 17:15 ` John W. Linville
@ 2014-04-16 17:29 ` Neil Horman
2014-04-17 8:08 ` Olivier MATZ
1 sibling, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-16 17:29 UTC (permalink / raw)
To: Olivier MATZ; +Cc: dev
On Wed, Apr 16, 2014 at 06:11:32PM +0200, Olivier MATZ wrote:
> Hi Neil,
>
> On 04/16/2014 03:08 PM, Neil Horman wrote:
> >On Wed, Apr 16, 2014 at 01:52:49PM +0200, Thomas Monjalon wrote:
> >>2014-04-15 14:05, Neil Horman:
> >>>Rather than have each driver have to remember to add a constructor to it to
> >>>make sure its gets registered properly, wrap that process up in a macro to
> >>>make registration a one line affair. This also sets the stage for us to
> >>>make registration of vdev pmds and physical pmds a uniform process
> >>>
> >>>Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> >>
> >>Could you explain why having a macro is better than an explicit constructor
> >>function?
> >>
> >Because its a one line declaration inside a driver function that points to the
> >structure used to initilze the pmd? Having to append ((__constructor__)) to
> >each initalization function is both error prone during entry and exposes the
> >possibiilty of developers doing "too much" in their constructor. It also allows
> >for easy updating to all drivers, if additional boilerplate work needs to be
> >done in the future for all pmds.
>
> Even if it's not critical, in my opinion, the following code is easier
> to understand:
>
> __attribute__((constructor))
> static void
> rte_pmd_ring_init(void)
> {
> rte_eal_dev_driver_register(&pmd_ring_drv);
> }
>
> Than:
>
> PMD_REGISTER_DRIVER(pmd_ring_drv);
>
>
> The first version explicitly shows what you are doing: defining a
> static function called at initialization that registers a driver
> structure.
>
> With the second, we're tempted to check what this macro does...
>
Ok, so look it up. DPDK is open source and cscope is easy to use. A
module initilization macro is a common method for doing init time binding in
modular programming (the best examples are the module_init() and module_exit()
macros in the linux kernel). It wraps up what you need to do to tie a modular
piece of your software into the larger main component, without having to know
all the boilerplate behind it.
Also, if you expose the use of the constructor, then you've
broken out the initalization phase to every pmd you implement, and as a result,
if you ever need to add code to the initilization step, you have to add it in
every pmd, instead of just updating the macro.
The bottom line is, your method is 5 lines of boilerplate code thats going to
have to get repeated as nauseum for every pmd that gets written giving every PMD
author the opportunity to miscode the constructor, vs my one line that, if it
compiles, will be correct every time.
Neil
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-16 17:29 ` Neil Horman
@ 2014-04-17 8:08 ` Olivier MATZ
2014-04-17 10:59 ` Neil Horman
0 siblings, 1 reply; 77+ messages in thread
From: Olivier MATZ @ 2014-04-17 8:08 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
Hi Neil,
On 04/16/2014 07:29 PM, Neil Horman wrote:
> Ok, so look it up. DPDK is open source and cscope is easy to use. A
> module initilization macro is a common method for doing init time binding in
> modular programming (the best examples are the module_init() and module_exit()
> macros in the linux kernel). It wraps up what you need to do to tie a modular
> piece of your software into the larger main component, without having to know
> all the boilerplate behind it.
>
> Also, if you expose the use of the constructor, then you've
> broken out the initalization phase to every pmd you implement, and as a result,
> if you ever need to add code to the initilization step, you have to add it in
> every pmd, instead of just updating the macro.
>
> The bottom line is, your method is 5 lines of boilerplate code thats going to
> have to get repeated as nauseum for every pmd that gets written giving every PMD
> author the opportunity to miscode the constructor, vs my one line that, if it
> compiles, will be correct every time.
OK, some of your arguments are legitimate and it's a detail point of
your patches that are globally a nice improvement of the DPDK code.
But I'd be happy to continue this discussion over a beer ;)
Regards,
Olivier
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] ring: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-15 18:05 ` [dpdk-dev] [PATCH 05/15] ring: " Neil Horman
2014-04-16 13:53 ` [dpdk-dev] [PATCH 05/15 v2] " Neil Horman
@ 2014-04-17 9:50 ` Ananyev, Konstantin
2014-04-17 11:06 ` Neil Horman
2014-04-17 15:16 ` [dpdk-dev] [PATCH 05/15 v3] " Neil Horman
1 sibling, 2 replies; 77+ messages in thread
From: Ananyev, Konstantin @ 2014-04-17 9:50 UTC (permalink / raw)
To: Neil Horman, dev
Hi Neil,
Few comments from me there.
Thanks
Konstantin
- parse_kvlist():
1)
node = strchr(name, ':');
...
action = strchr(node, ':');
We can't expect that input parameter will always be valid.
So need to check that strchr() doesn't return NULL.
2)
if (strcmp(action, "ATTACH"))
if (strcmp(action, "CREATE"))
goto out;
...
info->list[info->count].action = strcmp(action, "ATTACH") ? DEV_CREATE : DEV_ATTACH;
Can you create a macros for these 2 string constants and use them instead.
Another thing, probably better to reorder it that way:
if (strcmp(action, "ATTACH") == 0)
info->list[info->count].action = DEV_ATTACH;
else if (strcmp(action, "CREATE") == 0)
info->list[info->count].action = DEV_CREATE;
else
goto out;
Would save you one strcmp() and looks a bit cleaner.
3)
info->list[info->count].node = strtol(node, NULL, 10);
Again we can't assume that input string will always be valid.
Something like that should do, I think:
char *end;
...
errno = 0;
info->list[info->count].node = strtoul(node, &end, 10);
if (errno != 0 || *end != 0) {
ret = -EINVAL;
goto out;
}
4)
strncpy(info->list[info->count].name, name, PATH_MAX);
When RTE_INSECURE_FUNCTION_WARNING is defined, strncpy() (and some other functions) are marked as poisoned.
Another thing - as I remember, if strlen(name) >= PATH_MAX, then destination string will not be null terminated.
So probably something like that instead:
rte_snprintf(info->list[info->count].name, sizeof(info->list[info->count].name), "%s", name);
- rte_pmd_ring_devinit():
5)
printf("Parsing kvargs\n");
Here and everywhere - please use RTE_LOG() instead.
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Neil Horman
Sent: Tuesday, April 15, 2014 7:06 PM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 05/15] ring: Convert to use of PMD_REGISTER_DRIVER and fix linking
convert the ring driver to use the PMD_REGISTER_DRIVER macro and fix up the Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the ring library when building DSO's and must specify its use on the command line with the -d option. Static linking will still initalize the driver automatically.
Note that the ring driver was also written in such a way that it violated some general layering principles, several functions were contained in the pmd which were being called by example from the test application in the app/test directory. Specifically it was calling eth_ring_pair_attach, eth_ring_pair_create and rte_eth_ring_devinit, which should only be called internally to the dpdk core library. To correct this I've removed those functions, and instead allowed them to be called indirectly at initalization time using the vdev command line argument key nodeaction=<name>:<node>:<action> where action is one of ATTACH or CREATE. I've tested out the functionality of the command line with the testpmd utility, with success, and have removed the called functions from the test utility. This will affect how the test utility is invoked (the -d and --vdev option will need to be specified on the command line now), but honestly, given the way it was coded, I think the testing of the ring pmd was not the best example of how to code with dpdk to begin with. I have also left the two layer violating functions in place, so as not to break existing applications, but added deprecation warnings to them so that apps can migrate off them.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
app/test/test_pmd_ring.c | 95 ----------------------------
lib/librte_pmd_ring/Makefile | 1 +
lib/librte_pmd_ring/rte_eth_ring.c | 123 ++++++++++++++++++++++++++++++++++---
mk/rte.app.mk | 14 +++--
4 files changed, 124 insertions(+), 109 deletions(-)
diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c index 4d9c2ba..1fe38fa 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -42,7 +42,6 @@
/* two test rings, r1 is used by two ports, r2 just by one */ static struct rte_ring *r1[2], *r2;
-static struct rte_ring *nullring = NULL; static struct rte_mempool *mp; static uint8_t start_idx; /* will store the port id of the first of our new ports */
@@ -59,58 +58,6 @@ static uint8_t start_idx; /* will store the port id of the first of our new port #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 512
-
-static int
-test_ring_ethdev_create(void)
-{
- int retval;
- printf("Testing ring pmd create\n");
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create zero-sized RXTX ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, RTE_MAX_NUMA_NODES);
- if (retval >= 0) {
- printf("Failure, can create ring pmd on socket %d\n", RTE_MAX_NUMA_NODES);
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 1, &r2, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null rx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, NULL, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null tx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&nullring, 1, r1, 2, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create TX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, &nullring, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&r2, 1, &r2, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RXTX ring pmd\n");
- return -1;
- }
-
- return 0;
-}
-
static int
test_ethdev_configure(void)
{
@@ -305,26 +252,12 @@ test_stats_reset(void) static int
test_pmd_ring_init(void)
{
- const char * name1 = "R3";
- const char * name2 = "R4";
- const char * params_null = NULL;
- const char * params = "PARAMS";
struct rte_eth_stats stats;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
printf("Testing ring pmd init\n");
- if (rte_pmd_ring_devinit(name1, params_null) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
- if (rte_pmd_ring_devinit(name2, params) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -371,24 +304,16 @@ test_pmd_ring_init(void)
rte_eth_dev_stop(RXTX_PORT2);
- /* Test init same name pmd ring */
- rte_pmd_ring_devinit(name1, params_null);
return 0;
}
static int
test_pmd_ring_pair_create(void)
{
- const char * name1 = "_RNG_P0";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_create(name1, SOCKET0) < 0) {
- printf("Create ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -447,28 +372,16 @@ test_pmd_ring_pair_create(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test create same name ring pair */
- if (rte_eth_ring_pair_create(name1, SOCKET0) == 0) {
- printf("Create same name ring pair error\n");
- return -1;
- }
return 0;
}
static int
test_pmd_ring_pair_attach(void)
{
- const char * name1 = "_RNG_P0";
- const char * name2 = "_RNG_P1";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_attach(name1, SOCKET0) < 0) {
- printf("Attach ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -529,11 +442,6 @@ test_pmd_ring_pair_attach(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test attach non-existing ring pair */
- if (rte_eth_ring_pair_attach(name2, SOCKET0) == 0) {
- printf("Attach non-existing ring pair error\n");
- return -1;
- }
return 0;
}
@@ -568,9 +476,6 @@ test_pmd_ring(void)
return -1;
}
- if (test_ring_ethdev_create() < 0)
- return -1;
-
if (test_ethdev_configure() < 0)
return -1;
diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile index 73b2d38..a62f805 100644
--- a/lib/librte_pmd_ring/Makefile
+++ b/lib/librte_pmd_ring/Makefile
@@ -52,5 +52,6 @@ SYMLINK-y-include += rte_eth_ring.h # this lib depends upon:
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_kvargs
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index cee3fff..266cfc0 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -38,6 +38,15 @@
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_vdev.h>
+#include <rte_pmd.h>
+#include <rte_kvargs.h>
+
+#define ETH_RING_NUMA_NODE_ACTION_ARG "nodeaction"
+
+static const char *valid_arguments[] = {
+ ETH_RING_NUMA_NODE_ACTION_ARG,
+ NULL
+};
struct ring_queue {
struct rte_ring *rng;
@@ -373,28 +382,127 @@ eth_dev_ring_pair_create(const char *name, const unsigned numa_node, int rte_eth_ring_pair_create(const char *name, const unsigned numa_node) {
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_create is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_CREATE); }
int
rte_eth_ring_pair_attach(const char *name, const unsigned numa_node) {
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_attach is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_ATTACH); }
+struct node_action_pair {
+ char name[PATH_MAX];
+ unsigned node;
+ enum dev_action action;
+};
+
+struct node_action_list {
+ unsigned total;
+ unsigned count;
+ struct node_action_pair *list;
+};
+
+static int parse_kvlist (const char *key __rte_unused, const char
+*value, void *data) {
+ struct node_action_list *info = data;
+ int ret;
+ char *name;
+ char *action;
+ char *node;
+
+ name = strdup(value);
+
+ ret = -1;
+
+ if (!name)
+ goto out;
+
+ node = strchr(name, ':');
+ *node = '\0';
+ node++;
+
+ action = strchr(node, ':');
+ *action = '\0';
+ action++;
+
+ /*
+ * Need to do some sanity checking here
+ */
+
+ if (strcmp(action, "ATTACH"))
+ if (strcmp(action, "CREATE"))
+ goto out;
+
+ info->list[info->count].node = strtol(node, NULL, 10);
+
+ info->list[info->count].action = strcmp(action, "ATTACH") ? DEV_CREATE
+: DEV_ATTACH;
+
+ strncpy(info->list[info->count].name, name, PATH_MAX);
+
+ info->count++;
+
+ ret = 0;
+out:
+ free(name);
+ return ret;
+}
+
int
rte_pmd_ring_devinit(const char *name, const char *params) {
+ struct rte_kvargs *kvlist;
+ int ret = 0;
+ struct node_action_list *info = NULL;
+
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
+
if (params == NULL || params[0] == '\0')
eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
else {
- RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
- " rings-backed ethernet device\n");
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ printf("Parsing kvargs\n");
+ kvlist = rte_kvargs_parse(params, valid_arguments);
+
+ if (!kvlist) {
+ RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
+ " rings-backed ethernet device\n");
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ return 0;
+ } else {
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ printf("counting kvargs\n");
+ ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
+ info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
+ (sizeof(struct node_action_pair) * ret), 0);
+ if (!info)
+ goto out;
+
+ info->total = ret;
+ info->list = (struct node_action_pair*)(info + 1);
+
+ printf("We have %d nodeaction pairs\n", info->total);
+ ret = rte_kvargs_process(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG,
+ parse_kvlist, info);
+
+ if (ret < 0)
+ goto out_free;
+
+ for (info->count = 0; info->count < info->total; info->count++) {
+ printf("Doing something with a ring\n");
+ eth_dev_ring_pair_create(name, info->list[info->count].node,
+ info->list[info->count].action);
+ }
+
+ }
}
- return 0;
+
+out_free:
+ rte_free(info);
+out:
+ return ret;
}
static struct rte_vdev_driver pmd_ring_drv = { @@ -402,9 +510,4 @@ static struct rte_vdev_driver pmd_ring_drv = {
.init = rte_pmd_ring_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_ring_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_ring_drv);
-}
+PMD_REGISTER_DRIVER(pmd_ring_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk index e6d09b8..4f167aa 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -133,10 +133,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y) LDLIBS += -lethdev endif
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-LDLIBS += -lrte_pmd_ring
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
LDLIBS += -lrte_malloc
endif
@@ -173,9 +169,19 @@ LDLIBS += -lrte_cmdline endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lrte_pmd_pcap -lpcap
endif
+
endif
LDLIBS += $(EXECENV_LDLIBS)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-17 8:08 ` Olivier MATZ
@ 2014-04-17 10:59 ` Neil Horman
0 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-17 10:59 UTC (permalink / raw)
To: Olivier MATZ; +Cc: dev
On Thu, Apr 17, 2014 at 10:08:29AM +0200, Olivier MATZ wrote:
> Hi Neil,
>
> On 04/16/2014 07:29 PM, Neil Horman wrote:
> >Ok, so look it up. DPDK is open source and cscope is easy to use. A
> >module initilization macro is a common method for doing init time binding in
> >modular programming (the best examples are the module_init() and module_exit()
> >macros in the linux kernel). It wraps up what you need to do to tie a modular
> >piece of your software into the larger main component, without having to know
> >all the boilerplate behind it.
> >
> >Also, if you expose the use of the constructor, then you've
> >broken out the initalization phase to every pmd you implement, and as a result,
> >if you ever need to add code to the initilization step, you have to add it in
> >every pmd, instead of just updating the macro.
> >
> >The bottom line is, your method is 5 lines of boilerplate code thats going to
> >have to get repeated as nauseum for every pmd that gets written giving every PMD
> >author the opportunity to miscode the constructor, vs my one line that, if it
> >compiles, will be correct every time.
> OK, some of your arguments are legitimate and it's a detail point of
> your patches that are globally a nice improvement of the DPDK code.
>
> But I'd be happy to continue this discussion over a beer ;)
>
Sure, I'll be in dusseldorf for plumbers this october I think. Perfect place for
a beer :)
Neil
> Regards,
> Olivier
>
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] ring: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-17 9:50 ` [dpdk-dev] [PATCH 05/15] " Ananyev, Konstantin
@ 2014-04-17 11:06 ` Neil Horman
2014-04-17 15:16 ` [dpdk-dev] [PATCH 05/15 v3] " Neil Horman
1 sibling, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-17 11:06 UTC (permalink / raw)
To: Ananyev, Konstantin; +Cc: dev
On Thu, Apr 17, 2014 at 09:50:02AM +0000, Ananyev, Konstantin wrote:
> Hi Neil,
> Few comments from me there.
> Thanks
> Konstantin
>
> - parse_kvlist():
>
> 1)
> node = strchr(name, ':');
> ...
> action = strchr(node, ':');
>
> We can't expect that input parameter will always be valid.
> So need to check that strchr() doesn't return NULL.
>
> 2)
> if (strcmp(action, "ATTACH"))
> if (strcmp(action, "CREATE"))
> goto out;
> ...
> info->list[info->count].action = strcmp(action, "ATTACH") ? DEV_CREATE : DEV_ATTACH;
>
> Can you create a macros for these 2 string constants and use them instead.
> Another thing, probably better to reorder it that way:
>
> if (strcmp(action, "ATTACH") == 0)
> info->list[info->count].action = DEV_ATTACH;
> else if (strcmp(action, "CREATE") == 0)
> info->list[info->count].action = DEV_CREATE;
> else
> goto out;
>
> Would save you one strcmp() and looks a bit cleaner.
>
> 3)
> info->list[info->count].node = strtol(node, NULL, 10);
> Again we can't assume that input string will always be valid.
> Something like that should do, I think:
>
> char *end;
> ...
> errno = 0;
> info->list[info->count].node = strtoul(node, &end, 10);
> if (errno != 0 || *end != 0) {
> ret = -EINVAL;
> goto out;
> }
>
> 4)
> strncpy(info->list[info->count].name, name, PATH_MAX);
> When RTE_INSECURE_FUNCTION_WARNING is defined, strncpy() (and some other functions) are marked as poisoned.
> Another thing - as I remember, if strlen(name) >= PATH_MAX, then destination string will not be null terminated.
> So probably something like that instead:
> rte_snprintf(info->list[info->count].name, sizeof(info->list[info->count].name), "%s", name);
>
> - rte_pmd_ring_devinit():
>
> 5)
> printf("Parsing kvargs\n");
> Here and everywhere - please use RTE_LOG() instead.
>
>
Thank you Anayev, I'll square these all up and submit a v2 of this patch.
Neil
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 05/15 v3] ring: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-17 9:50 ` [dpdk-dev] [PATCH 05/15] " Ananyev, Konstantin
2014-04-17 11:06 ` Neil Horman
@ 2014-04-17 15:16 ` Neil Horman
2014-06-13 13:28 ` De Lara Guarch, Pablo
1 sibling, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-17 15:16 UTC (permalink / raw)
To: dev
convert the ring driver to use the PMD_REGISTER_DRIVER macro and fix up the
Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the ring library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Note that the ring driver was also written in such a way that it violated some
general layering principles, several functions were contained in the pmd which
were being called by example from the test application in the app/test
directory. Specifically it was calling eth_ring_pair_attach,
eth_ring_pair_create and rte_eth_ring_devinit, which should only be called
internally to the dpdk core library. To correct this I've removed those
functions, and instead allowed them to be called indirectly at initalization
time using the vdev command line argument key nodeaction=<name>:<node>:<action>
where action is one of ATTACH or CREATE. I've tested out the functionality of
the command line with the testpmd utility, with success, and have removed the
called functions from the test utility. This will affect how the test utility
is invoked (the -d and --vdev option will need to be specified on the command
line now), but honestly, given the way it was coded, I think the testing of the
ring pmd was not the best example of how to code with dpdk to begin with. I
have also left the two layer violating functions in place, so as not to break
existing applications, but added deprecation warnings to them so that apps can
migrate off them.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
Change notes
v2) fixed DEPDIR specifcation, should depend on RING not PCAP
v3) Cleaned up strcmp error checking, printfs, and other parsing issues as
pointed out by Konstantin Ananyev <konstantin.ananyev@intel.com>
---
app/test/test_pmd_ring.c | 95 -------------------------
lib/librte_pmd_ring/Makefile | 1 +
lib/librte_pmd_ring/rte_eth_ring.c | 141 ++++++++++++++++++++++++++++++++++---
mk/rte.app.mk | 14 ++--
4 files changed, 142 insertions(+), 109 deletions(-)
diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
index 4d9c2ba..1fe38fa 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -42,7 +42,6 @@
/* two test rings, r1 is used by two ports, r2 just by one */
static struct rte_ring *r1[2], *r2;
-static struct rte_ring *nullring = NULL;
static struct rte_mempool *mp;
static uint8_t start_idx; /* will store the port id of the first of our new ports */
@@ -59,58 +58,6 @@ static uint8_t start_idx; /* will store the port id of the first of our new port
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 512
-
-static int
-test_ring_ethdev_create(void)
-{
- int retval;
- printf("Testing ring pmd create\n");
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create zero-sized RXTX ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, RTE_MAX_NUMA_NODES);
- if (retval >= 0) {
- printf("Failure, can create ring pmd on socket %d\n", RTE_MAX_NUMA_NODES);
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 1, &r2, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null rx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, NULL, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null tx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&nullring, 1, r1, 2, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create TX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, &nullring, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&r2, 1, &r2, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RXTX ring pmd\n");
- return -1;
- }
-
- return 0;
-}
-
static int
test_ethdev_configure(void)
{
@@ -305,26 +252,12 @@ test_stats_reset(void)
static int
test_pmd_ring_init(void)
{
- const char * name1 = "R3";
- const char * name2 = "R4";
- const char * params_null = NULL;
- const char * params = "PARAMS";
struct rte_eth_stats stats;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
printf("Testing ring pmd init\n");
- if (rte_pmd_ring_devinit(name1, params_null) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
- if (rte_pmd_ring_devinit(name2, params) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -371,24 +304,16 @@ test_pmd_ring_init(void)
rte_eth_dev_stop(RXTX_PORT2);
- /* Test init same name pmd ring */
- rte_pmd_ring_devinit(name1, params_null);
return 0;
}
static int
test_pmd_ring_pair_create(void)
{
- const char * name1 = "_RNG_P0";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_create(name1, SOCKET0) < 0) {
- printf("Create ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -447,28 +372,16 @@ test_pmd_ring_pair_create(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test create same name ring pair */
- if (rte_eth_ring_pair_create(name1, SOCKET0) == 0) {
- printf("Create same name ring pair error\n");
- return -1;
- }
return 0;
}
static int
test_pmd_ring_pair_attach(void)
{
- const char * name1 = "_RNG_P0";
- const char * name2 = "_RNG_P1";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_attach(name1, SOCKET0) < 0) {
- printf("Attach ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -529,11 +442,6 @@ test_pmd_ring_pair_attach(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test attach non-existing ring pair */
- if (rte_eth_ring_pair_attach(name2, SOCKET0) == 0) {
- printf("Attach non-existing ring pair error\n");
- return -1;
- }
return 0;
}
@@ -568,9 +476,6 @@ test_pmd_ring(void)
return -1;
}
- if (test_ring_ethdev_create() < 0)
- return -1;
-
if (test_ethdev_configure() < 0)
return -1;
diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
index 73b2d38..35d40cb 100644
--- a/lib/librte_pmd_ring/Makefile
+++ b/lib/librte_pmd_ring/Makefile
@@ -52,5 +52,6 @@ SYMLINK-y-include += rte_eth_ring.h
# this lib depends upon:
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index cee3fff..3a129b6 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -38,6 +38,17 @@
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_vdev.h>
+#include <rte_pmd.h>
+#include <rte_kvargs.h>
+
+#define ETH_RING_NUMA_NODE_ACTION_ARG "nodeaction"
+#define ETH_RING_ACTION_CREATE "CREATE"
+#define ETH_RING_ACTION_ATTACH "ATTACH"
+
+static const char *valid_arguments[] = {
+ ETH_RING_NUMA_NODE_ACTION_ARG,
+ NULL
+};
struct ring_queue {
struct rte_ring *rng;
@@ -373,28 +384,143 @@ eth_dev_ring_pair_create(const char *name, const unsigned numa_node,
int
rte_eth_ring_pair_create(const char *name, const unsigned numa_node)
{
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_create is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_CREATE);
}
int
rte_eth_ring_pair_attach(const char *name, const unsigned numa_node)
{
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_attach is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_ATTACH);
}
+struct node_action_pair {
+ char name[PATH_MAX];
+ unsigned node;
+ enum dev_action action;
+};
+
+struct node_action_list {
+ unsigned total;
+ unsigned count;
+ struct node_action_pair *list;
+};
+
+static int parse_kvlist (const char *key __rte_unused, const char *value, void *data)
+{
+ struct node_action_list *info = data;
+ int ret;
+ char *name;
+ char *action;
+ char *node;
+ char *end;
+
+ name = strdup(value);
+
+ ret = -EINVAL;
+
+ if (!name) {
+ RTE_LOG(WARNING, PMD, "command line paramter is empty for ring pmd!\n");
+ goto out;
+ }
+
+ node = strchr(name, ':');
+ if (!node) {
+ RTE_LOG(WARNING, PMD, "could not parse node value from %s", name);
+ goto out;
+ }
+
+ *node = '\0';
+ node++;
+
+ action = strchr(node, ':');
+ if (!action) {
+ RTE_LOG(WARNING, PMD, "could not action value from %s", node);
+ goto out;
+ }
+
+ *action = '\0';
+ action++;
+
+ /*
+ * Need to do some sanity checking here
+ */
+
+ if (strcmp(action, ETH_RING_ACTION_ATTACH) == 0)
+ info->list[info->count].action = DEV_ATTACH;
+ else if (strcmp(action, ETH_RING_ACTION_CREATE) == 0)
+ info->list[info->count].action = DEV_CREATE;
+ else
+ goto out;
+
+ errno = 0;
+ info->list[info->count].node = strtol(node, &end, 10);
+
+ if ((errno != 0) || (*end != '\0')) {
+ RTE_LOG(WARNING, PMD, "node value %s is unparseable as a number\n", node);
+ goto out;
+ }
+
+ rte_snprintf(info->list[info->count].name, sizeof(info->list[info->count].name), "%s", name);
+
+ info->count++;
+
+ ret = 0;
+out:
+ free(name);
+ return ret;
+}
+
int
rte_pmd_ring_devinit(const char *name, const char *params)
{
+ struct rte_kvargs *kvlist;
+ int ret = 0;
+ struct node_action_list *info = NULL;
+
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
+
if (params == NULL || params[0] == '\0')
eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
else {
- RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
- " rings-backed ethernet device\n");
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ kvlist = rte_kvargs_parse(params, valid_arguments);
+
+ if (!kvlist) {
+ RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
+ " rings-backed ethernet device\n");
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ return 0;
+ } else {
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
+ info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
+ (sizeof(struct node_action_pair) * ret), 0);
+ if (!info)
+ goto out;
+
+ info->total = ret;
+ info->list = (struct node_action_pair*)(info + 1);
+
+ ret = rte_kvargs_process(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG,
+ parse_kvlist, info);
+
+ if (ret < 0)
+ goto out_free;
+
+ for (info->count = 0; info->count < info->total; info->count++) {
+ eth_dev_ring_pair_create(name, info->list[info->count].node,
+ info->list[info->count].action);
+ }
+
+ }
}
- return 0;
+
+out_free:
+ rte_free(info);
+out:
+ return ret;
}
static struct rte_vdev_driver pmd_ring_drv = {
@@ -402,9 +528,4 @@ static struct rte_vdev_driver pmd_ring_drv = {
.init = rte_pmd_ring_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_ring_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_ring_drv);
-}
+PMD_REGISTER_DRIVER(pmd_ring_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index e6d09b8..4f167aa 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -133,10 +133,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
LDLIBS += -lethdev
endif
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-LDLIBS += -lrte_pmd_ring
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
LDLIBS += -lrte_malloc
endif
@@ -173,9 +169,19 @@ LDLIBS += -lrte_cmdline
endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lrte_pmd_pcap -lpcap
endif
+
endif
LDLIBS += $(EXECENV_LDLIBS)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-04-16 13:51 ` [dpdk-dev] [PATCH 01/15 v2] " Neil Horman
@ 2014-04-18 11:23 ` Thomas Monjalon
2014-04-18 13:18 ` Neil Horman
2014-04-29 23:42 ` Thomas Monjalon
1 sibling, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-18 11:23 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
Hi Neil,
2014-04-16 09:51, Neil Horman:
> The shared libraries built with the current makefile set produce static
> libraries rather than actual shared objects. This is due to several missing
> options that are required to correctly build shared objects using ld, as
> well as a mis-specified -share option (which should be -shared). Switching
> to the use of CC rather than LD and fixing the -shared option corrects
> these problems and builds the DSOs correctly.
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
[...]
> --- a/mk/rte.lib.mk
> +++ b/mk/rte.lib.mk
[...]
> +ifeq ($(LINK_USING_CC),1)
> +# Override the definition of LD here, since we're linking with CC
> +LD := $(CC)
> +endif
[...]
> -O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -share $(OBJS-y) -o $(LIB)
> +O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -shared $(OBJS-y) -o $(LIB)
I think that CPU_LDFLAGS should be prefixed with -Wl, in case of CC linking.
So blindly assigning CC to LD variable seems a bad idea.
Other makefiles have different O_TO_S commands depending of LINK_USING_CC.
> --- a/mk/rte.sharelib.mk
> +++ b/mk/rte.sharelib.mk
[...]
> -O_TO_S = $(LD) $(CPU_LDFLAGS) -share $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
> +O_TO_S = $(LD) $(CPU_LDFLAGS) -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
Why not using CC here whether LINK_USING_CC is enabled?
Feel free to send a v3 ;)
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-15 18:05 ` [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro Neil Horman
2014-04-16 11:52 ` Thomas Monjalon
@ 2014-04-18 11:42 ` Thomas Monjalon
2014-04-18 12:04 ` Neil Horman
1 sibling, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-18 11:42 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-15 14:05, Neil Horman:
> Rather than have each driver have to remember to add a constructor to it to
> make sure its gets registered properly, wrap that process up in a macro to
> make registration a one line affair. This also sets the stage for us to
> make registration of vdev pmds and physical pmds a uniform process
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> --- /dev/null
> +++ b/lib/librte_eal/common/include/rte_pmd.h
So you are creating a new header file for PMD API, right?
According to rte_ethdev.h,
"The Ethernet Device API is composed of two parts:"
"- The application-oriented Ethernet API"
"- The driver-oriented Ethernet API"
So we should implement this macro in rte_ethdev.h.
But maybe you prefer to split this file in two files. If so, please send a
separated patch for that.
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 07/15] eal: Make vdev init path generic for both virtual and physcial devices
2014-04-15 18:06 ` [dpdk-dev] [PATCH 07/15] eal: Make vdev init path generic for both virtual and physcial devices Neil Horman
@ 2014-04-18 12:02 ` Thomas Monjalon
0 siblings, 0 replies; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-18 12:02 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
I have some comments inline.
2014-04-15 14:06, Neil Horman:
> Currently, physical device pmds use a separate initalization path
> (rte_pmd_init_all) while virtual devices use a constructor registration and
> rte_eal_dev_init. Theres no reason to have them be separate. This patch
> removes the vdev specific nomenclature from the vdev init path and makes it
> more generic for use with all pmds. This is the first step in converting
> the physical device pmds to using the same constructor based registration
> path that the virtual devices use
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> - if (rte_eal_vdev_init() < 0)
> + if (rte_eal_dev_init() < 0)
> rte_panic("Cannot init virtual devices\n");
You should update the panic log here.
> +/** Global list of virtual device drivers. */
> +static struct rte_driver_list dev_driver_list =
> + TAILQ_HEAD_INITIALIZER(dev_driver_list);
Same comment about "virtual device".
> + /* No need to register drivers that are embeded in DPDK
> + * (pmd_pcap, pmd_ring, ...). The initialization function have
> + * the ((constructor)) attribute so they will register at
> + * startup. */
Should we keep this comment?
> +#ifndef _RTE_VDEV_H_
> +#define _RTE_VDEV_H_
Should be _RTE_DEV_H_
> +/**
> + * @file
> + *
> + * RTE Virtual Devices Interface
> + *
> + * This file manages the list of the virtual device drivers.
> + */
Not only virtual.
> +/** Double linked list of virtual device drivers. */
[...]
> + * Initialization function called for each virtual device probing.
[...]
> +/**
> + * A structure describing a virtual device driver.
> + */
[...]
> + * Register a virtual device driver.
[...]
> + * Unregister a virtual device driver.
You probably understood the idea ;)
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> - if (rte_eal_vdev_init() < 0)
> + if (rte_eal_dev_init() < 0)
> rte_panic("Cannot init virtual devices\n");
Still "virtual" typo
Except typos, it seems a good step.
I think we could abstract more things in order to have even simpler API and
simpler command line. But we'll see it in another step.
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-18 11:42 ` Thomas Monjalon
@ 2014-04-18 12:04 ` Neil Horman
2014-04-18 12:08 ` Thomas Monjalon
0 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-18 12:04 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Fri, Apr 18, 2014 at 04:42:01AM -0700, Thomas Monjalon wrote:
> 2014-04-15 14:05, Neil Horman:
> > Rather than have each driver have to remember to add a constructor to it to
> > make sure its gets registered properly, wrap that process up in a macro to
> > make registration a one line affair. This also sets the stage for us to
> > make registration of vdev pmds and physical pmds a uniform process
> >
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>
> > --- /dev/null
> > +++ b/lib/librte_eal/common/include/rte_pmd.h
>
> So you are creating a new header file for PMD API, right?
>
> According to rte_ethdev.h,
> "The Ethernet Device API is composed of two parts:"
> "- The application-oriented Ethernet API"
> "- The driver-oriented Ethernet API"
>
> So we should implement this macro in rte_ethdev.h.
> But maybe you prefer to split this file in two files. If so, please send a
> separated patch for that.
>
Actually I'm fine with moving the macro to another file, though if I do, I think
merging it into rte_dev.h is more appropriate, as thats where the driver
registration function lives.
Neil
> Thanks
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-18 12:04 ` Neil Horman
@ 2014-04-18 12:08 ` Thomas Monjalon
2014-04-18 13:20 ` Neil Horman
0 siblings, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-18 12:08 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-18 08:04, Neil Horman:
> On Fri, Apr 18, 2014 at 04:42:01AM -0700, Thomas Monjalon wrote:
> > 2014-04-15 14:05, Neil Horman:
> > > Rather than have each driver have to remember to add a constructor to it
> > > to
> > > make sure its gets registered properly, wrap that process up in a macro
> > > to
> > > make registration a one line affair. This also sets the stage for us to
> > > make registration of vdev pmds and physical pmds a uniform process
> > >
> > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > >
> > > --- /dev/null
> > > +++ b/lib/librte_eal/common/include/rte_pmd.h
> >
> > So you are creating a new header file for PMD API, right?
> >
> > According to rte_ethdev.h,
> > "The Ethernet Device API is composed of two parts:"
> > "- The application-oriented Ethernet API"
> > "- The driver-oriented Ethernet API"
> >
> > So we should implement this macro in rte_ethdev.h.
> > But maybe you prefer to split this file in two files. If so, please send a
> > separated patch for that.
>
> Actually I'm fine with moving the macro to another file, though if I do, I
> think merging it into rte_dev.h is more appropriate, as thats where the
> driver registration function lives.
I'm not sure to understand what you're saying.
My suggestion is to have 2 files in lib/librte_ether: 1 for application API
and 1 for PMD API.
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-04-18 11:23 ` Thomas Monjalon
@ 2014-04-18 13:18 ` Neil Horman
2014-04-18 13:29 ` Thomas Monjalon
0 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-18 13:18 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Fri, Apr 18, 2014 at 01:23:19PM +0200, Thomas Monjalon wrote:
> Hi Neil,
>
> 2014-04-16 09:51, Neil Horman:
> > The shared libraries built with the current makefile set produce static
> > libraries rather than actual shared objects. This is due to several missing
> > options that are required to correctly build shared objects using ld, as
> > well as a mis-specified -share option (which should be -shared). Switching
> > to the use of CC rather than LD and fixing the -shared option corrects
> > these problems and builds the DSOs correctly.
> >
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> [...]
> > --- a/mk/rte.lib.mk
> > +++ b/mk/rte.lib.mk
> [...]
> > +ifeq ($(LINK_USING_CC),1)
> > +# Override the definition of LD here, since we're linking with CC
> > +LD := $(CC)
> > +endif
> [...]
> > -O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -share $(OBJS-y) -o $(LIB)
> > +O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -shared $(OBJS-y) -o $(LIB)
>
> I think that CPU_LDFLAGS should be prefixed with -Wl, in case of CC linking.
> So blindly assigning CC to LD variable seems a bad idea.
> Other makefiles have different O_TO_S commands depending of LINK_USING_CC.
>
I'm not so sure about that. Or more specifically, I wonder if some more rework
isn't needed here. I say that because, while what you say makes sense in terms
of formatting the CPU_FLAGS variable for use with CC, the only current use of
CPU_LDFLAGS set -melf_i386, which IIRC is a gcc flag, not meant to be passed to
LD. I can change the makefile to completely rewrite the comand based on
LINK_USING_CC, but it seems to me that CPU_LDFLAGS should not be passed in the
use of the LD case.
thoughts?
Neil
> > --- a/mk/rte.sharelib.mk
> > +++ b/mk/rte.sharelib.mk
> [...]
> > -O_TO_S = $(LD) $(CPU_LDFLAGS) -share $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
> > +O_TO_S = $(LD) $(CPU_LDFLAGS) -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
>
> Why not using CC here whether LINK_USING_CC is enabled?
>
> Feel free to send a v3 ;)
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-18 12:08 ` Thomas Monjalon
@ 2014-04-18 13:20 ` Neil Horman
2014-04-18 13:32 ` Thomas Monjalon
0 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-04-18 13:20 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Fri, Apr 18, 2014 at 02:08:56PM +0200, Thomas Monjalon wrote:
> 2014-04-18 08:04, Neil Horman:
> > On Fri, Apr 18, 2014 at 04:42:01AM -0700, Thomas Monjalon wrote:
> > > 2014-04-15 14:05, Neil Horman:
> > > > Rather than have each driver have to remember to add a constructor to it
> > > > to
> > > > make sure its gets registered properly, wrap that process up in a macro
> > > > to
> > > > make registration a one line affair. This also sets the stage for us to
> > > > make registration of vdev pmds and physical pmds a uniform process
> > > >
> > > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > > >
> > > > --- /dev/null
> > > > +++ b/lib/librte_eal/common/include/rte_pmd.h
> > >
> > > So you are creating a new header file for PMD API, right?
> > >
> > > According to rte_ethdev.h,
> > > "The Ethernet Device API is composed of two parts:"
> > > "- The application-oriented Ethernet API"
> > > "- The driver-oriented Ethernet API"
> > >
> > > So we should implement this macro in rte_ethdev.h.
> > > But maybe you prefer to split this file in two files. If so, please send a
> > > separated patch for that.
> >
> > Actually I'm fine with moving the macro to another file, though if I do, I
> > think merging it into rte_dev.h is more appropriate, as thats where the
> > driver registration function lives.
>
> I'm not sure to understand what you're saying.
> My suggestion is to have 2 files in lib/librte_ether: 1 for application API
> and 1 for PMD API.
>
I'm suggesting not having 2 files at all, and merging rte_pmd.h into into
rte_dev.h, which is where all the rest of the device registration code lives
already. Does that make sense?
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-04-18 13:18 ` Neil Horman
@ 2014-04-18 13:29 ` Thomas Monjalon
2014-04-18 17:36 ` Neil Horman
2014-04-21 14:41 ` Neil Horman
0 siblings, 2 replies; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-18 13:29 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-18 09:18, Neil Horman:
> On Fri, Apr 18, 2014 at 01:23:19PM +0200, Thomas Monjalon wrote:
> > I think that CPU_LDFLAGS should be prefixed with -Wl, in case of CC
> > linking. So blindly assigning CC to LD variable seems a bad idea.
> > Other makefiles have different O_TO_S commands depending of LINK_USING_CC.
>
> I'm not so sure about that. Or more specifically, I wonder if some more
> rework isn't needed here. I say that because, while what you say makes
> sense in terms of formatting the CPU_FLAGS variable for use with CC, the
> only current use of CPU_LDFLAGS set -melf_i386, which IIRC is a gcc flag,
> not meant to be passed to LD. I can change the makefile to completely
> rewrite the comand based on LINK_USING_CC, but it seems to me that
> CPU_LDFLAGS should not be passed in the use of the LD case.
Right, -melf_i386 shouldn't be a LDFLAG.
Feel free to fix it.
By the way, It's cleaner to prepare -Wl prefixing and keep an empty LDFLAGS.
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-18 13:20 ` Neil Horman
@ 2014-04-18 13:32 ` Thomas Monjalon
2014-04-18 17:42 ` Neil Horman
0 siblings, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-18 13:32 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-18 09:20, Neil Horman:
> On Fri, Apr 18, 2014 at 02:08:56PM +0200, Thomas Monjalon wrote:
> > 2014-04-18 08:04, Neil Horman:
> > > On Fri, Apr 18, 2014 at 04:42:01AM -0700, Thomas Monjalon wrote:
> > > > 2014-04-15 14:05, Neil Horman:
> > > > > Rather than have each driver have to remember to add a constructor
> > > > > to it
> > > > > to
> > > > > make sure its gets registered properly, wrap that process up in a
> > > > > macro
> > > > > to
> > > > > make registration a one line affair. This also sets the stage for
> > > > > us to
> > > > > make registration of vdev pmds and physical pmds a uniform process
> > > > >
> > > > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > > > >
> > > > > --- /dev/null
> > > > > +++ b/lib/librte_eal/common/include/rte_pmd.h
> > > >
> > > > So you are creating a new header file for PMD API, right?
> > > >
> > > > According to rte_ethdev.h,
> > > > "The Ethernet Device API is composed of two parts:"
> > > > "- The application-oriented Ethernet API"
> > > > "- The driver-oriented Ethernet API"
> > > >
> > > > So we should implement this macro in rte_ethdev.h.
> > > > But maybe you prefer to split this file in two files. If so, please
> > > > send a
> > > > separated patch for that.
> > >
> > > Actually I'm fine with moving the macro to another file, though if I do,
> > > I
> > > think merging it into rte_dev.h is more appropriate, as thats where the
> > > driver registration function lives.
> >
> > I'm not sure to understand what you're saying.
> > My suggestion is to have 2 files in lib/librte_ether: 1 for application
> > API
> > and 1 for PMD API.
>
> I'm suggesting not having 2 files at all, and merging rte_pmd.h into into
> rte_dev.h, which is where all the rest of the device registration code lives
> already. Does that make sense?
Oh yes, I didn't understand because you speak about rte_dev.h which is
actually rte_ethdev.h.
I'm fine with keeping it. I just was wondering if it would be a cleaner API by
splitting it as it has 2 very different roles.
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-04-18 13:29 ` Thomas Monjalon
@ 2014-04-18 17:36 ` Neil Horman
2014-04-21 14:41 ` Neil Horman
1 sibling, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-18 17:36 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Fri, Apr 18, 2014 at 03:29:01PM +0200, Thomas Monjalon wrote:
> 2014-04-18 09:18, Neil Horman:
> > On Fri, Apr 18, 2014 at 01:23:19PM +0200, Thomas Monjalon wrote:
> > > I think that CPU_LDFLAGS should be prefixed with -Wl, in case of CC
> > > linking. So blindly assigning CC to LD variable seems a bad idea.
> > > Other makefiles have different O_TO_S commands depending of LINK_USING_CC.
> >
> > I'm not so sure about that. Or more specifically, I wonder if some more
> > rework isn't needed here. I say that because, while what you say makes
> > sense in terms of formatting the CPU_FLAGS variable for use with CC, the
> > only current use of CPU_LDFLAGS set -melf_i386, which IIRC is a gcc flag,
> > not meant to be passed to LD. I can change the makefile to completely
> > rewrite the comand based on LINK_USING_CC, but it seems to me that
> > CPU_LDFLAGS should not be passed in the use of the LD case.
>
> Right, -melf_i386 shouldn't be a LDFLAG.
> Feel free to fix it.
> By the way, It's cleaner to prepare -Wl prefixing and keep an empty LDFLAGS.
>
Right, We're heading into a long weekend here. On monday I'll clean this up by
separating the LD and CC commands based on LINK_USING_CC, and pass the proper
options to each.
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-18 13:32 ` Thomas Monjalon
@ 2014-04-18 17:42 ` Neil Horman
0 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-18 17:42 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Fri, Apr 18, 2014 at 03:32:15PM +0200, Thomas Monjalon wrote:
> 2014-04-18 09:20, Neil Horman:
> > On Fri, Apr 18, 2014 at 02:08:56PM +0200, Thomas Monjalon wrote:
> > > 2014-04-18 08:04, Neil Horman:
> > > > On Fri, Apr 18, 2014 at 04:42:01AM -0700, Thomas Monjalon wrote:
> > > > > 2014-04-15 14:05, Neil Horman:
> > > > > > Rather than have each driver have to remember to add a constructor
> > > > > > to it
> > > > > > to
> > > > > > make sure its gets registered properly, wrap that process up in a
> > > > > > macro
> > > > > > to
> > > > > > make registration a one line affair. This also sets the stage for
> > > > > > us to
> > > > > > make registration of vdev pmds and physical pmds a uniform process
> > > > > >
> > > > > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > > > > >
> > > > > > --- /dev/null
> > > > > > +++ b/lib/librte_eal/common/include/rte_pmd.h
> > > > >
> > > > > So you are creating a new header file for PMD API, right?
> > > > >
> > > > > According to rte_ethdev.h,
> > > > > "The Ethernet Device API is composed of two parts:"
> > > > > "- The application-oriented Ethernet API"
> > > > > "- The driver-oriented Ethernet API"
> > > > >
> > > > > So we should implement this macro in rte_ethdev.h.
> > > > > But maybe you prefer to split this file in two files. If so, please
> > > > > send a
> > > > > separated patch for that.
> > > >
> > > > Actually I'm fine with moving the macro to another file, though if I do,
> > > > I
> > > > think merging it into rte_dev.h is more appropriate, as thats where the
> > > > driver registration function lives.
> > >
> > > I'm not sure to understand what you're saying.
> > > My suggestion is to have 2 files in lib/librte_ether: 1 for application
> > > API
> > > and 1 for PMD API.
> >
> > I'm suggesting not having 2 files at all, and merging rte_pmd.h into into
> > rte_dev.h, which is where all the rest of the device registration code lives
> > already. Does that make sense?
>
> Oh yes, I didn't understand because you speak about rte_dev.h which is
> actually rte_ethdev.h.
>
No, its not. Oliviers patch set introduced rte_dev.h to add the driver
registration functions. I had rte_pmd.h separately since we were apparently
developing in parallel. Since you accepted his, I'm fine with merging the one
macro in rte_pmd.h into his rte_dev.h header, since the functionality all goes
together there.
> I'm fine with keeping it. I just was wondering if it would be a cleaner API by
> splitting it as it has 2 very different roles.
>
You've already got it split (rte_ethdev.h for ethernet interface registration,
and rte_dev.h for pmd driver registration). The only reason rte_pmd.h still
exists is because thats what I had when I did my initial development. The only
thing left to do is either merge the stuff in rte_dev.h into rte_pmd.h or merge
the stuff in rte_pmd.h into rte_dev.h. Since rte_pmd.h only has one macro, it
seems merging it into rte_dev.h is more pragmatic.
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-04-18 13:29 ` Thomas Monjalon
2014-04-18 17:36 ` Neil Horman
@ 2014-04-21 14:41 ` Neil Horman
1 sibling, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:41 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Fri, Apr 18, 2014 at 03:29:01PM +0200, Thomas Monjalon wrote:
> 2014-04-18 09:18, Neil Horman:
> > On Fri, Apr 18, 2014 at 01:23:19PM +0200, Thomas Monjalon wrote:
> > > I think that CPU_LDFLAGS should be prefixed with -Wl, in case of CC
> > > linking. So blindly assigning CC to LD variable seems a bad idea.
> > > Other makefiles have different O_TO_S commands depending of LINK_USING_CC.
> >
> > I'm not so sure about that. Or more specifically, I wonder if some more
> > rework isn't needed here. I say that because, while what you say makes
> > sense in terms of formatting the CPU_FLAGS variable for use with CC, the
> > only current use of CPU_LDFLAGS set -melf_i386, which IIRC is a gcc flag,
> > not meant to be passed to LD. I can change the makefile to completely
> > rewrite the comand based on LINK_USING_CC, but it seems to me that
> > CPU_LDFLAGS should not be passed in the use of the LD case.
>
> Right, -melf_i386 shouldn't be a LDFLAG.
> Feel free to fix it.
> By the way, It's cleaner to prepare -Wl prefixing and keep an empty LDFLAGS.
>
Actually, I looked into this a bit more, turns out -melf_i386 is an LDFLAG. Its
a bit silly to have it there because its passed automatically from the compiler
to the linker depending on the machine that gcc is building for, or ld does it
natively depending on the input file format. But perhaps some compiler or
linker version has a bug where that doesn't happen properly. Either way, it can
be prefixed with a -Wl, so I'm just going to leave it alone
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (14 preceding siblings ...)
2014-04-15 18:06 ` [dpdk-dev] [PATCH 15/15] pmd: Remove rte_pmd_init_all Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 01/14] makefiles: Fixed -share command line option error Neil Horman
` (17 more replies)
15 siblings, 18 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
Disconnect compile time linkage between eal library / applications and pmd's
I noticed that, while tinkering with dpdk, building for shared libraries still
resulted in all the test applications linking to all the built pmd's, despite
not actually needing them all. We are able to tell an application at run time
(via the -d/--blacklist/--whitelist/--vdev options) which pmd's we want to use,
and so have no need to link them at all. The only reason they get pulled in is
because rte_eal_non_pci_init_etherdev and rte_pmd_init_all contain static lists
to the individual pmd init functions. The result is that, even when building as
DSO's, we have to load all the pmd libraries, which is space inefficient and
defeating of some of the purpose of shared objects.
To correct this, I developed this patch series, which introduces a new macro,
PMD_REGISTER_DRIVER, which wraps up Oliviers work using constructors on the
virtual device pmds, then expands on it to include the physical device pmds,
allowing us to break linkages between dpdk applications and pmd's almost
entirely (save for the ring and xenvirt drivers, which have additional api's
outside of the standard dpdk code that we need to further fix). This also
allows us to completely remove the rte_pmd_init_all routine, hiding its function
internally to the rte_eal_init path.
I've tested this feature using the igb and pcap pmd's, both statically and
dynamically linked with the test and testpmd sample applications, and it seems
to work well.
Note, I encountered a few bugs along the way, which I fixed and noted in the
series.
Regards
Neil
Change Notes:
1) Reposted the entire series. Recent changes permeated accross several
patches, and since a few patches already had multiple versions, I've reposted
the entire series and bumped the version number to 5, whcih skips a few
versions, but ensures this series is seen as the most recent.
2) Merged the PMD_REGISTER_DRIVER macro into rte_dev.h, which is a better
location for it. Required removing include of rte_pmd.h across most of the
patches in the series.
3) Cleaned up various leftover "virtual" comments in the driver registration api
that no longer belong there after making it generic
4) Fixed the LINK_USING_CC check in rte.lib.mk so it works like other uses
5) Fixed CPU_LDFLAGS conversion to use -Wl in case we link with gcc.
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 01/14] makefiles: Fixed -share command line option error
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 02/14] pmd: Add PMD_REGISTER_DRIVER macro Neil Horman
` (16 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
The shared libraries built with the current makefile set produce static
libraries rather than actual shared objects. This is due to several missing
options that are required to correctly build shared objects using ld, as well as
a mis-specified -share option (which should be -shared). Switching to the use of
CC rather than LD and fixing the -shared option corrects these problems and
builds the DSOs correctly.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
Change notes:
v2) Added test for LINK_USING_CC to convert to link with gcc
---
mk/rte.lib.mk | 14 ++++++++++++--
mk/rte.sharelib.mk | 2 +-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index f75ca92..fc8fd01 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -59,6 +59,18 @@ build: _postbuild
exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
+ifeq ($(LINK_USING_CC),1)
+comma := ,
+CPU_LDFLAGS := $(addprefix -Wl$(comma),$(CPU_LDFLAGS))
+O_TO_S = $(CC) $(CPU_LDFLAGS) -Wl$(comma)-z$(comma)muldefs -shared $(OBJS-y) -o $(LIB)
+
+ifeq ($(RTE_BUILD_SHARED_LIB),y)
+O_TO_C = $(CC) -z muldefs -shared $(OBJS-y) -o $(LIB_ONE)
+endif
+else
+O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -shared $(OBJS-y) -o $(LIB)
+endif
+
O_TO_A = $(AR) crus $(LIB) $(OBJS-y)
O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight
O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")
@@ -68,7 +80,6 @@ O_TO_A_DO = @set -e; \
$(O_TO_A) && \
echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))
-O_TO_S = $(LD) $(CPU_LDFLAGS) -z muldefs -share $(OBJS-y) -o $(LIB)
O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
O_TO_S_DO = @set -e; \
@@ -84,7 +95,6 @@ O_TO_C_DO = @set -e; \
$(lib_dir) \
$(copy_obj)
else
-O_TO_C = $(LD) -z muldefs -share $(OBJS-y) -o $(LIB_ONE)
O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight
O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)"," LD_C $(@)")
O_TO_C_DO = @set -e; \
diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk
index 3967b51..429309f 100644
--- a/mk/rte.sharelib.mk
+++ b/mk/rte.sharelib.mk
@@ -45,7 +45,7 @@ sharelib: $(LIB_ONE) FORCE
OBJS = $(wildcard $(RTE_OUTPUT)/build/lib/*.o)
-O_TO_S = $(LD) $(CPU_LDFLAGS) -share $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
+O_TO_S = $(LD) $(CPU_LDFLAGS) -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
O_TO_S_CMD = "cmd_$@ = $(O_TO_S_STR)"
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 02/14] pmd: Add PMD_REGISTER_DRIVER macro
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 01/14] makefiles: Fixed -share command line option error Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 03/14] pcap: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
` (15 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
Rather than have each driver have to remember to add a constructor to it to make
sure its gets registered properly, wrap that process up in a macro to make
registration a one line affair. This also sets the stage for us to make
registration of vdev pmds and physical pmds a uniform process
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/include/rte_vdev.h | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 2f99bf4..d3e7e39 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -37,7 +37,7 @@ INC += rte_log.h rte_memcpy.h rte_memory.h rte_memzone.h rte_pci.h
INC += rte_pci_dev_ids.h rte_per_lcore.h rte_prefetch.h rte_random.h
INC += rte_rwlock.h rte_spinlock.h rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_cpuflags.h rte_version.h rte_tailq_elem.h
-INC += rte_eal_memconfig.h rte_malloc_heap.h
+INC += rte_eal_memconfig.h rte_malloc_heap.h
INC += rte_hexdump.h rte_devargs.h rte_vdev.h
ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 48f71b7..c7aa795 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -83,6 +83,24 @@ void rte_eal_vdev_driver_register(struct rte_vdev_driver *driver);
*/
void rte_eal_vdev_driver_unregister(struct rte_vdev_driver *driver);
+enum rte_pmd_driver_type {
+ PMD_VDEV = 1
+};
+
+extern void rte_eal_nonpci_dev_init_register(const char *name, int (*dev_initfn)(const char *, const char *));
+#define PMD_REGISTER_DRIVER(d, t)\
+void devinitfn_ ##d(void);\
+void __attribute__((constructor, used)) devinitfn_ ##d(void)\
+{\
+ enum rte_pmd_driver_type _t = (t);\
+ switch(_t)\
+ {\
+ case PMD_VDEV:\
+ rte_eal_vdev_driver_register(&d);\
+ break;\
+ };\
+}
+
#ifdef __cplusplus
}
#endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 03/14] pcap: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 01/14] makefiles: Fixed -share command line option error Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 02/14] pmd: Add PMD_REGISTER_DRIVER macro Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 04/14] ring: " Neil Horman
` (14 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the pcap driver to use the PMD_REGISTER_DRIVER macro and fix up the
Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the pcap library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_pmd_pcap/rte_eth_pcap.c | 7 +------
mk/rte.app.mk | 2 ++
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index 680dfdc..c987940 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -772,9 +772,4 @@ static struct rte_vdev_driver pmd_pcap_drv = {
.init = rte_pmd_pcap_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_pcap_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_pcap_drv);
-}
+PMD_REGISTER_DRIVER(pmd_pcap_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 072718a..83f0867 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -172,9 +172,11 @@ ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
LDLIBS += -lrte_cmdline
endif
+ifeq ($(RTE_BUILD_SHARED_LIB),n)
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lrte_pmd_pcap -lpcap
endif
+endif
LDLIBS += $(EXECENV_LDLIBS)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 04/14] ring: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (2 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 03/14] pcap: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 05/14] xenvirt: " Neil Horman
` (13 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the ring driver to use the PMD_REGISTER_DRIVER macro and fix up the
Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the ring library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Note that the ring driver was also written in such a way that it violated some
general layering principles, several functions were contained in the pmd which
were being called by example from the test application in the app/test
directory. Specifically it was calling eth_ring_pair_attach,
eth_ring_pair_create and rte_eth_ring_devinit, which should only be called
internally to the dpdk core library. To correct this I've removed those
functions, and instead allowed them to be called indirectly at initalization
time using the vdev command line argument key nodeaction=<name>:<node>:<action>
where action is one of ATTACH or CREATE. I've tested out the functionality of
the command line with the testpmd utility, with success, and have removed the
called functions from the test utility. This will affect how the test utility
is invoked (the -d and --vdev option will need to be specified on the command
line now), but honestly, given the way it was coded, I think the testing of the
ring pmd was not the best example of how to code with dpdk to begin with. I
have also left the two layer violating functions in place, so as not to break
existing applications, but added deprecation warnings to them so that apps can
migrate off them.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
Change notes
v2) fixed DEPDIR specifcation, should depend on RING not PCAP
v3) Cleaned up strcmp error checking, printfs, and other parsing issues as
pointed out by Konstantin Ananyev <konstantin.ananyev@intel.com>
---
app/test/test_pmd_ring.c | 95 -------------------------
lib/librte_pmd_ring/Makefile | 1 +
lib/librte_pmd_ring/rte_eth_ring.c | 140 ++++++++++++++++++++++++++++++++++---
mk/rte.app.mk | 10 +--
4 files changed, 137 insertions(+), 109 deletions(-)
diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
index 4d9c2ba..1fe38fa 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -42,7 +42,6 @@
/* two test rings, r1 is used by two ports, r2 just by one */
static struct rte_ring *r1[2], *r2;
-static struct rte_ring *nullring = NULL;
static struct rte_mempool *mp;
static uint8_t start_idx; /* will store the port id of the first of our new ports */
@@ -59,58 +58,6 @@ static uint8_t start_idx; /* will store the port id of the first of our new port
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 512
-
-static int
-test_ring_ethdev_create(void)
-{
- int retval;
- printf("Testing ring pmd create\n");
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create zero-sized RXTX ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 0, NULL, 0, RTE_MAX_NUMA_NODES);
- if (retval >= 0) {
- printf("Failure, can create ring pmd on socket %d\n", RTE_MAX_NUMA_NODES);
- return -1;
- }
-
- retval = rte_eth_from_rings(NULL, 1, &r2, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null rx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, NULL, 1, SOCKET0);
- if (retval >= 0) {
- printf("Failure, can create pmd with null tx rings\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&nullring, 1, r1, 2, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create TX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(r1, 1, &nullring, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RX-only ring pmd\n");
- return -1;
- }
-
- retval = rte_eth_from_rings(&r2, 1, &r2, 1, SOCKET0);
- if (retval < 0) {
- printf("Failure, failed to create RXTX ring pmd\n");
- return -1;
- }
-
- return 0;
-}
-
static int
test_ethdev_configure(void)
{
@@ -305,26 +252,12 @@ test_stats_reset(void)
static int
test_pmd_ring_init(void)
{
- const char * name1 = "R3";
- const char * name2 = "R4";
- const char * params_null = NULL;
- const char * params = "PARAMS";
struct rte_eth_stats stats;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
printf("Testing ring pmd init\n");
- if (rte_pmd_ring_devinit(name1, params_null) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
- if (rte_pmd_ring_devinit(name2, params) < 0) {
- printf("Testing ring pmd init fail\n");
- return -1;
- }
-
if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -371,24 +304,16 @@ test_pmd_ring_init(void)
rte_eth_dev_stop(RXTX_PORT2);
- /* Test init same name pmd ring */
- rte_pmd_ring_devinit(name1, params_null);
return 0;
}
static int
test_pmd_ring_pair_create(void)
{
- const char * name1 = "_RNG_P0";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_create(name1, SOCKET0) < 0) {
- printf("Create ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -447,28 +372,16 @@ test_pmd_ring_pair_create(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test create same name ring pair */
- if (rte_eth_ring_pair_create(name1, SOCKET0) == 0) {
- printf("Create same name ring pair error\n");
- return -1;
- }
return 0;
}
static int
test_pmd_ring_pair_attach(void)
{
- const char * name1 = "_RNG_P0";
- const char * name2 = "_RNG_P1";
struct rte_eth_stats stats, stats2;
struct rte_mbuf buf, *pbuf = &buf;
struct rte_eth_conf null_conf;
- if (rte_eth_ring_pair_attach(name1, SOCKET0) < 0) {
- printf("Attach ring pair failed\n");
- return -1;
- }
-
if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) {
printf(" TX/RX port exceed max eth ports\n");
return -1;
@@ -529,11 +442,6 @@ test_pmd_ring_pair_attach(void)
rte_eth_dev_stop(RXTX_PORT4);
rte_eth_dev_stop(RXTX_PORT5);
- /* Test attach non-existing ring pair */
- if (rte_eth_ring_pair_attach(name2, SOCKET0) == 0) {
- printf("Attach non-existing ring pair error\n");
- return -1;
- }
return 0;
}
@@ -568,9 +476,6 @@ test_pmd_ring(void)
return -1;
}
- if (test_ring_ethdev_create() < 0)
- return -1;
-
if (test_ethdev_configure() < 0)
return -1;
diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
index 73b2d38..35d40cb 100644
--- a/lib/librte_pmd_ring/Makefile
+++ b/lib/librte_pmd_ring/Makefile
@@ -52,5 +52,6 @@ SYMLINK-y-include += rte_eth_ring.h
# this lib depends upon:
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index cee3fff..6325a3a 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -38,6 +38,16 @@
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_vdev.h>
+#include <rte_kvargs.h>
+
+#define ETH_RING_NUMA_NODE_ACTION_ARG "nodeaction"
+#define ETH_RING_ACTION_CREATE "CREATE"
+#define ETH_RING_ACTION_ATTACH "ATTACH"
+
+static const char *valid_arguments[] = {
+ ETH_RING_NUMA_NODE_ACTION_ARG,
+ NULL
+};
struct ring_queue {
struct rte_ring *rng;
@@ -373,28 +383,143 @@ eth_dev_ring_pair_create(const char *name, const unsigned numa_node,
int
rte_eth_ring_pair_create(const char *name, const unsigned numa_node)
{
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_create is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_CREATE);
}
int
rte_eth_ring_pair_attach(const char *name, const unsigned numa_node)
{
+ RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_attach is deprecated\n");
return eth_dev_ring_pair_create(name, numa_node, DEV_ATTACH);
}
+struct node_action_pair {
+ char name[PATH_MAX];
+ unsigned node;
+ enum dev_action action;
+};
+
+struct node_action_list {
+ unsigned total;
+ unsigned count;
+ struct node_action_pair *list;
+};
+
+static int parse_kvlist (const char *key __rte_unused, const char *value, void *data)
+{
+ struct node_action_list *info = data;
+ int ret;
+ char *name;
+ char *action;
+ char *node;
+ char *end;
+
+ name = strdup(value);
+
+ ret = -EINVAL;
+
+ if (!name) {
+ RTE_LOG(WARNING, PMD, "command line paramter is empty for ring pmd!\n");
+ goto out;
+ }
+
+ node = strchr(name, ':');
+ if (!node) {
+ RTE_LOG(WARNING, PMD, "could not parse node value from %s", name);
+ goto out;
+ }
+
+ *node = '\0';
+ node++;
+
+ action = strchr(node, ':');
+ if (!action) {
+ RTE_LOG(WARNING, PMD, "could not action value from %s", node);
+ goto out;
+ }
+
+ *action = '\0';
+ action++;
+
+ /*
+ * Need to do some sanity checking here
+ */
+
+ if (strcmp(action, ETH_RING_ACTION_ATTACH) == 0)
+ info->list[info->count].action = DEV_ATTACH;
+ else if (strcmp(action, ETH_RING_ACTION_CREATE) == 0)
+ info->list[info->count].action = DEV_CREATE;
+ else
+ goto out;
+
+ errno = 0;
+ info->list[info->count].node = strtol(node, &end, 10);
+
+ if ((errno != 0) || (*end != '\0')) {
+ RTE_LOG(WARNING, PMD, "node value %s is unparseable as a number\n", node);
+ goto out;
+ }
+
+ rte_snprintf(info->list[info->count].name, sizeof(info->list[info->count].name), "%s", name);
+
+ info->count++;
+
+ ret = 0;
+out:
+ free(name);
+ return ret;
+}
+
int
rte_pmd_ring_devinit(const char *name, const char *params)
{
+ struct rte_kvargs *kvlist;
+ int ret = 0;
+ struct node_action_list *info = NULL;
+
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
+
if (params == NULL || params[0] == '\0')
eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
else {
- RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
- " rings-backed ethernet device\n");
- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ kvlist = rte_kvargs_parse(params, valid_arguments);
+
+ if (!kvlist) {
+ RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
+ " rings-backed ethernet device\n");
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ return 0;
+ } else {
+ eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
+ info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
+ (sizeof(struct node_action_pair) * ret), 0);
+ if (!info)
+ goto out;
+
+ info->total = ret;
+ info->list = (struct node_action_pair*)(info + 1);
+
+ ret = rte_kvargs_process(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG,
+ parse_kvlist, info);
+
+ if (ret < 0)
+ goto out_free;
+
+ for (info->count = 0; info->count < info->total; info->count++) {
+ eth_dev_ring_pair_create(name, info->list[info->count].node,
+ info->list[info->count].action);
+ }
+
+ }
}
- return 0;
+
+out_free:
+ rte_free(info);
+out:
+ return ret;
}
static struct rte_vdev_driver pmd_ring_drv = {
@@ -402,9 +527,4 @@ static struct rte_vdev_driver pmd_ring_drv = {
.init = rte_pmd_ring_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_ring_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_ring_drv);
-}
+PMD_REGISTER_DRIVER(pmd_ring_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 83f0867..16edbce 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -133,10 +133,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
LDLIBS += -lethdev
endif
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-LDLIBS += -lrte_pmd_ring
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
LDLIBS += -lrte_malloc
endif
@@ -173,9 +169,15 @@ LDLIBS += -lrte_cmdline
endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
+LDLIBS += -lrte_pmd_ring
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lrte_pmd_pcap -lpcap
endif
+
endif
LDLIBS += $(EXECENV_LDLIBS)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 05/14] xenvirt: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (3 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 04/14] ring: " Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 06/14] eal: Make vdev init path generic for both virtual and physcial devices Neil Horman
` (12 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the xenvirt driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the xenvirt library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
A few notes:
xenvirt was unbuildable as of commit 4c39baf297d10c217e7d3e7370f26a1fede58308..
That commit neglected to include the rte_vdev.h header, so several structs were
left undefined. This patch includes a fix for that as well.
Also, The linkage for xenvirt is broken in much the same way pmd_ring was, in
that the xenvirt pmd has a function that is called directly from applications
(the example being the testpmd application). The function is
rte_mempool_gntalloc_create, and should clearly be moved into the rte_mempool
library, with the supporting code in the function implementation moved to a new
xenvirt library separate from the pmd. This is a large undertaking that
detracts from the purpose of this series however, and so for now, I'm leaving
the linkage to the application in place, and will address this issue in a later
series
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 8 ++------
mk/rte.app.mk | 7 +++----
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
index 533aa76..ecafe7a 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_vdev.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@ -710,9 +711,4 @@ static struct rte_vdev_driver pmd_xenvirt_drv = {
.init = rte_pmd_xenvirt_devinit,
};
-__attribute__((constructor))
-static void
-rte_pmd_xenvirt_init(void)
-{
- rte_eal_vdev_driver_register(&pmd_xenvirt_drv);
-}
+PMD_REGISTER_DRIVER(pmd_xenvirt_drv, PMD_VDEV);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 16edbce..aabe75e 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -158,16 +158,15 @@ ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
LDLIBS += -lrte_eal
endif
+ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
+LDLIBS += -lrte_cmdline
+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
-
ifeq ($(RTE_BUILD_SHARED_LIB),n)
ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 06/14] eal: Make vdev init path generic for both virtual and physcial devices
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (4 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 05/14] xenvirt: " Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 07/14] igb: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
` (11 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
Currently, physical device pmds use a separate initalization path
(rte_pmd_init_all) while virtual devices use a constructor registration and
rte_eal_dev_init. Theres no reason to have them be separate. This patch
removes the vdev specific nomenclature from the vdev init path and makes it more
generic for use with all pmds. This is the first step in converting the
physical device pmds to using the same constructor based registration path that
the virtual devices use
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_eal/bsdapp/eal/Makefile | 2 +-
lib/librte_eal/bsdapp/eal/eal.c | 4 +-
lib/librte_eal/common/Makefile | 4 +-
lib/librte_eal/common/eal_common_dev.c | 109 +++++++++++++++++++++++++++
lib/librte_eal/common/eal_common_vdev.c | 97 ------------------------
lib/librte_eal/common/include/eal_private.h | 2 +-
lib/librte_eal/common/include/rte_dev.h | 111 ++++++++++++++++++++++++++++
lib/librte_eal/common/include/rte_vdev.h | 108 ---------------------------
lib/librte_eal/linuxapp/eal/Makefile | 2 +-
lib/librte_eal/linuxapp/eal/eal.c | 4 +-
lib/librte_pmd_pcap/rte_eth_pcap.c | 7 +-
lib/librte_pmd_ring/rte_eth_ring.c | 7 +-
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 7 +-
13 files changed, 241 insertions(+), 223 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_dev.c
delete mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_dev.h
delete mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 4c2a4f1..abf1ad2 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -69,7 +69,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_errno.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_cpuflags.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_whitelist.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_vdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
CFLAGS_eal.o := -D_GNU_SOURCE
#CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index e944aba..8de3fad 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -854,8 +854,8 @@ rte_eal_init(int argc, char **argv)
rte_eal_mcfg_complete();
- if (rte_eal_vdev_init() < 0)
- rte_panic("Cannot init virtual devices\n");
+ if (rte_eal_dev_init() < 0)
+ rte_panic("Cannot init pmd devices\n");
RTE_LCORE_FOREACH_SLAVE(i) {
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index d3e7e39..0016fc5 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -37,8 +37,8 @@ INC += rte_log.h rte_memcpy.h rte_memory.h rte_memzone.h rte_pci.h
INC += rte_pci_dev_ids.h rte_per_lcore.h rte_prefetch.h rte_random.h
INC += rte_rwlock.h rte_spinlock.h rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_cpuflags.h rte_version.h rte_tailq_elem.h
-INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_vdev.h
+INC += rte_eal_memconfig.h rte_malloc_heap.h
+INC += rte_hexdump.h rte_devargs.h rte_dev.h
ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)
INC += rte_warnings.h
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
new file mode 100644
index 0000000..8c42738
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -0,0 +1,109 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2014 6WIND S.A.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <sys/queue.h>
+
+#include <rte_dev.h>
+#include <rte_devargs.h>
+#include <rte_debug.h>
+#include <rte_devargs.h>
+
+#include "eal_private.h"
+
+/** Global list of device drivers. */
+static struct rte_driver_list dev_driver_list =
+ TAILQ_HEAD_INITIALIZER(dev_driver_list);
+
+/* register a driver */
+void
+rte_eal_driver_register(struct rte_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&dev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_eal_driver_unregister(struct rte_driver *driver)
+{
+ TAILQ_REMOVE(&dev_driver_list, driver, next);
+}
+
+int
+rte_eal_dev_init(void)
+{
+ struct rte_devargs *devargs;
+ struct rte_driver *driver;
+
+ /*
+ * Note that the dev_driver_list is populated here
+ * from calls made to rte_eal_driver_register from constructor functions
+ * embedded into PMD modules via the PMD_REGISTER_DRIVER macro
+ */
+
+ /* call the init function for each virtual device */
+ TAILQ_FOREACH(devargs, &devargs_list, next) {
+
+ if (devargs->type != RTE_DEVTYPE_VIRTUAL)
+ continue;
+
+ TAILQ_FOREACH(driver, &dev_driver_list, next) {
+ if (driver->type != PMD_VDEV)
+ continue;
+
+ /* search a driver prefix in virtual device name */
+ if (!strncmp(driver->name, devargs->virtual.drv_name,
+ strlen(driver->name))) {
+ driver->init(devargs->virtual.drv_name,
+ devargs->args);
+ break;
+ }
+ }
+
+ if (driver == NULL) {
+ rte_panic("no driver found for %s\n",
+ devargs->virtual.drv_name);
+ }
+ }
+
+ /* Once the vdevs are initalized, start calling all the pdev drivers */
+ TAILQ_FOREACH(driver, &dev_driver_list, next) {
+ if (driver->type != PMD_PDEV)
+ continue;
+ /* PDEV drivers don't get passed any parameters */
+ driver->init(NULL, NULL);
+ }
+ return 0;
+}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
deleted file mode 100644
index 62d0302..0000000
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2014 6WIND S.A.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <inttypes.h>
-#include <sys/queue.h>
-
-#include <rte_vdev.h>
-#include <rte_devargs.h>
-#include <rte_debug.h>
-#include <rte_devargs.h>
-
-#include "eal_private.h"
-
-/** Global list of virtual device drivers. */
-static struct rte_vdev_driver_list vdev_driver_list =
- TAILQ_HEAD_INITIALIZER(vdev_driver_list);
-
-/* register a driver */
-void
-rte_eal_vdev_driver_register(struct rte_vdev_driver *driver)
-{
- TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
-}
-
-/* unregister a driver */
-void
-rte_eal_vdev_driver_unregister(struct rte_vdev_driver *driver)
-{
- TAILQ_REMOVE(&vdev_driver_list, driver, next);
-}
-
-int
-rte_eal_vdev_init(void)
-{
- struct rte_devargs *devargs;
- struct rte_vdev_driver *driver;
-
- /* No need to register drivers that are embeded in DPDK
- * (pmd_pcap, pmd_ring, ...). The initialization function have
- * the ((constructor)) attribute so they will register at
- * startup. */
-
- /* call the init function for each virtual device */
- TAILQ_FOREACH(devargs, &devargs_list, next) {
-
- if (devargs->type != RTE_DEVTYPE_VIRTUAL)
- continue;
-
- TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- /* search a driver prefix in virtual device name */
- if (!strncmp(driver->name, devargs->virtual.drv_name,
- strlen(driver->name))) {
- driver->init(devargs->virtual.drv_name,
- devargs->args);
- break;
- }
- }
-
- if (driver == NULL) {
- rte_panic("no driver found for %s\n",
- devargs->virtual.drv_name);
- }
- }
- return 0;
-}
diff --git a/lib/librte_eal/common/include/eal_private.h b/lib/librte_eal/common/include/eal_private.h
index 22d8b08..b99ad23 100644
--- a/lib/librte_eal/common/include/eal_private.h
+++ b/lib/librte_eal/common/include/eal_private.h
@@ -201,6 +201,6 @@ int rte_eal_alarm_init(void);
*
* This function is private to the EAL.
*/
-int rte_eal_vdev_init(void);
+int rte_eal_dev_init(void);
#endif /* _EAL_PRIVATE_H_ */
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
new file mode 100644
index 0000000..5af36c8
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -0,0 +1,111 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 6WIND S.A.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of 6WIND S.A. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTE_DEV_H_
+#define _RTE_DEV_H_
+
+/**
+ * @file
+ *
+ * RTE PMD Driver Registration Interface
+ *
+ * This file manages the list of device drivers.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+
+/** Double linked list of device drivers. */
+TAILQ_HEAD(rte_driver_list, rte_driver);
+
+/**
+ * Initialization function called for each device driver once.
+ */
+typedef int (rte_dev_init_t)(const char *name, const char *args);
+
+/**
+ * Driver type enumeration
+ */
+enum pmd_type {
+ PMD_VDEV = 0,
+ PMD_PDEV = 1,
+};
+
+/**
+ * A structure describing a device driver.
+ */
+struct rte_driver {
+ TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+ enum pmd_type type; /**< PMD Driver type */
+ const char *name; /**< Driver name. */
+ rte_dev_init_t *init; /**< Device init. function. */
+};
+
+/**
+ * Register a device driver.
+ *
+ * @param driver
+ * A pointer to a rte_dev structure describing the driver
+ * to be registered.
+ */
+void rte_eal_driver_register(struct rte_driver *driver);
+
+/**
+ * Unregister a device driver.
+ *
+ * @param driver
+ * A pointer to a rte_dev structure describing the driver
+ * to be unregistered.
+ */
+void rte_eal_driver_unregister(struct rte_driver *driver);
+
+/**
+ * Initalize all the registered drivers in this process
+ */
+int rte_eal_dev_init(void);
+
+#define PMD_REGISTER_DRIVER(d)\
+void devinitfn_ ##d(void);\
+void __attribute__((constructor, used)) devinitfn_ ##d(void)\
+{\
+ rte_eal_driver_register(&d);\
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VDEV_H_ */
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
deleted file mode 100644
index c7aa795..0000000
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2014 6WIND S.A.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of 6WIND S.A. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RTE_VDEV_H_
-#define _RTE_VDEV_H_
-
-/**
- * @file
- *
- * RTE Virtual Devices Interface
- *
- * This file manages the list of the virtual device drivers.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/queue.h>
-
-/** Double linked list of virtual device drivers. */
-TAILQ_HEAD(rte_vdev_driver_list, rte_vdev_driver);
-
-/**
- * Initialization function called for each virtual device probing.
- */
-typedef int (rte_vdev_init_t)(const char *name, const char *args);
-
-/**
- * A structure describing a virtual device driver.
- */
-struct rte_vdev_driver {
- TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
- const char *name; /**< Driver name. */
- rte_vdev_init_t *init; /**< Device init. function. */
-};
-
-/**
- * Register a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev structure describing the driver
- * to be registered.
- */
-void rte_eal_vdev_driver_register(struct rte_vdev_driver *driver);
-
-/**
- * Unregister a virtual device driver.
- *
- * @param driver
- * A pointer to a rte_vdev structure describing the driver
- * to be unregistered.
- */
-void rte_eal_vdev_driver_unregister(struct rte_vdev_driver *driver);
-
-enum rte_pmd_driver_type {
- PMD_VDEV = 1
-};
-
-extern void rte_eal_nonpci_dev_init_register(const char *name, int (*dev_initfn)(const char *, const char *));
-#define PMD_REGISTER_DRIVER(d, t)\
-void devinitfn_ ##d(void);\
-void __attribute__((constructor, used)) devinitfn_ ##d(void)\
-{\
- enum rte_pmd_driver_type _t = (t);\
- switch(_t)\
- {\
- case PMD_VDEV:\
- rte_eal_vdev_driver_register(&d);\
- break;\
- };\
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RTE_VDEV_H_ */
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 00f7367..e800e60 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -77,7 +77,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_errno.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_cpuflags.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_hexdump.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_vdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
CFLAGS_eal.o := -D_GNU_SOURCE
CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 04b2b32..d95fd54 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -1058,8 +1058,8 @@ rte_eal_init(int argc, char **argv)
RTE_LOG(WARNING, EAL, "%s\n", dlerror());
}
- if (rte_eal_vdev_init() < 0)
- rte_panic("Cannot init virtual devices\n");
+ if (rte_eal_dev_init() < 0)
+ rte_panic("Cannot init pmd devices\n");
RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n",
rte_config.master_lcore, (int)thread_id);
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index c987940..dc4670c 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -40,7 +40,7 @@
#include <rte_string_fns.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
-#include <rte_vdev.h>
+#include <rte_dev.h>
#include <net/if.h>
@@ -767,9 +767,10 @@ rte_pmd_pcap_devinit(const char *name, const char *params)
}
-static struct rte_vdev_driver pmd_pcap_drv = {
+static struct rte_driver pmd_pcap_drv = {
.name = "eth_pcap",
+ .type = PMD_VDEV,
.init = rte_pmd_pcap_devinit,
};
-PMD_REGISTER_DRIVER(pmd_pcap_drv, PMD_VDEV);
+PMD_REGISTER_DRIVER(pmd_pcap_drv);
diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index 6325a3a..b761543 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -37,7 +37,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_vdev.h>
+#include <rte_dev.h>
#include <rte_kvargs.h>
#define ETH_RING_NUMA_NODE_ACTION_ARG "nodeaction"
@@ -522,9 +522,10 @@ out:
return ret;
}
-static struct rte_vdev_driver pmd_ring_drv = {
+static struct rte_driver pmd_ring_drv = {
.name = "eth_ring",
+ .type = PMD_VDEV,
.init = rte_pmd_ring_devinit,
};
-PMD_REGISTER_DRIVER(pmd_ring_drv, PMD_VDEV);
+PMD_REGISTER_DRIVER(pmd_ring_drv);
diff --git a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
index ecafe7a..5b976d3 100644
--- a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
+++ b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
@@ -53,7 +53,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_vdev.h>
+#include <rte_dev.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@ -706,9 +706,10 @@ rte_pmd_xenvirt_devinit(const char *name, const char *params)
return 0;
}
-static struct rte_vdev_driver pmd_xenvirt_drv = {
+static struct rte_driver pmd_xenvirt_drv = {
.name = "eth_xenvirt",
+ .type = PMD_VDEV,
.init = rte_pmd_xenvirt_devinit,
};
-PMD_REGISTER_DRIVER(pmd_xenvirt_drv, PMD_VDEV);
+PMD_REGISTER_DRIVER(pmd_xenvirt_drv);
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 07/14] igb: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (5 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 06/14] eal: Make vdev init path generic for both virtual and physcial devices Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 08/14] igbvf: " Neil Horman
` (10 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the igb pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the igb library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
examples/dpdk_qat/main.c | 4 ----
lib/librte_ether/rte_ethdev.h | 13 -------------
lib/librte_pmd_e1000/igb_ethdev.c | 12 ++++++++++--
3 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c
index cdf6832..64cb610 100644
--- a/examples/dpdk_qat/main.c
+++ b/examples/dpdk_qat/main.c
@@ -697,10 +697,6 @@ MAIN(int argc, char **argv)
return -1;
/* init driver */
-#ifdef RTE_LIBRTE_IGB_PMD
- if (rte_igb_pmd_init() < 0)
- rte_panic("Cannot init igb pmd\n");
-#endif
#ifdef RTE_LIBRTE_IXGBE_PMD
if (rte_ixgbe_pmd_init() < 0)
rte_panic("Cannot init ixgbe pmd\n");
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index dea7471..e50ed48 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1317,15 +1317,6 @@ extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
* The initialization function of the driver for
- * Intel(r) IGB Gigabit Ethernet Controller devices.
- * This function is invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_igb_pmd_init(void);
-
-/**
- * The initialization function of the driver for
* Intel(r) EM Gigabit Ethernet Controller devices.
* This function is invoked once at EAL start time.
* @return
@@ -1402,10 +1393,6 @@ int rte_pmd_init_all(void)
int ret = -ENODEV;
#ifdef RTE_LIBRTE_IGB_PMD
- if ((ret = rte_igb_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init igb PMD\n");
- return (ret);
- }
if ((ret = rte_igbvf_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init igbvf PMD\n");
return (ret);
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index 673b4de..5e578c5 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -51,6 +51,7 @@
#include <rte_eal.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
+#include <rte_dev.h>
#include "e1000_logs.h"
#include "e1000/e1000_api.h"
@@ -619,8 +620,8 @@ static struct eth_driver rte_igbvf_pmd = {
.dev_private_size = sizeof(struct e1000_adapter),
};
-int
-rte_igb_pmd_init(void)
+static int
+rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
rte_eth_driver_register(&rte_igb_pmd);
return 0;
@@ -2182,3 +2183,10 @@ eth_igb_rss_reta_query(struct rte_eth_dev *dev,
return 0;
}
+
+static struct rte_driver pmd_igb_drv = {
+ .type = PMD_PDEV,
+ .init = rte_igb_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(pmd_igb_drv);
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 08/14] igbvf: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (6 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 07/14] igb: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 09/14] e1000: " Neil Horman
` (9 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the igbvf pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the igbvf library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 16 ----------------
lib/librte_pmd_e1000/igb_ethdev.c | 10 ++++++++--
2 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index e50ed48..d13cc4f 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1325,15 +1325,6 @@ extern void rte_eth_driver_register(struct eth_driver *eth_drv);
extern int rte_em_pmd_init(void);
/**
- * The initialization function of the driver for 1Gbps Intel IGB_VF
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_igbvf_pmd_init(void);
-
-/**
* The initialization function of the driver for 10Gbps Intel IXGBE
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1392,13 +1383,6 @@ int rte_pmd_init_all(void)
{
int ret = -ENODEV;
-#ifdef RTE_LIBRTE_IGB_PMD
- if ((ret = rte_igbvf_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init igbvf PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_IGB_PMD */
-
#ifdef RTE_LIBRTE_EM_PMD
if ((ret = rte_em_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init em PMD\n");
diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c
index 5e578c5..6aaded0 100644
--- a/lib/librte_pmd_e1000/igb_ethdev.c
+++ b/lib/librte_pmd_e1000/igb_ethdev.c
@@ -643,8 +643,8 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
* Invoked one at EAL init time.
* Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
*/
-int
-rte_igbvf_pmd_init(void)
+static int
+rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
DEBUGFUNC("rte_igbvf_pmd_init");
@@ -2189,4 +2189,10 @@ static struct rte_driver pmd_igb_drv = {
.init = rte_igb_pmd_init,
};
+static struct rte_driver pmd_igbvf_drv = {
+ .type = PMD_PDEV,
+ .init = rte_igbvf_pmd_init,
+};
+
PMD_REGISTER_DRIVER(pmd_igb_drv);
+PMD_REGISTER_DRIVER(pmd_igbvf_drv);
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 09/14] e1000: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (7 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 08/14] igbvf: " Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 10/14] ixgbe: " Neil Horman
` (8 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the e1000 pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the e1000 library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 16 ----------------
lib/librte_pmd_e1000/em_ethdev.c | 12 ++++++++++--
mk/rte.app.mk | 8 ++++----
3 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index d13cc4f..9e32f56 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,15 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for
- * Intel(r) EM Gigabit Ethernet Controller devices.
- * This function is invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_em_pmd_init(void);
-
-/**
* The initialization function of the driver for 10Gbps Intel IXGBE
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1383,13 +1374,6 @@ int rte_pmd_init_all(void)
{
int ret = -ENODEV;
-#ifdef RTE_LIBRTE_EM_PMD
- if ((ret = rte_em_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init em PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_EM_PMD */
-
#ifdef RTE_LIBRTE_IXGBE_PMD
if ((ret = rte_ixgbe_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init ixgbe PMD\n");
diff --git a/lib/librte_pmd_e1000/em_ethdev.c b/lib/librte_pmd_e1000/em_ethdev.c
index d8c9a9b..000feef 100644
--- a/lib/librte_pmd_e1000/em_ethdev.c
+++ b/lib/librte_pmd_e1000/em_ethdev.c
@@ -51,6 +51,7 @@
#include <rte_eal.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
+#include <rte_dev.h>
#include "e1000_logs.h"
#include "e1000/e1000_api.h"
@@ -285,8 +286,8 @@ static struct eth_driver rte_em_pmd = {
.dev_private_size = sizeof(struct e1000_adapter),
};
-int
-rte_em_pmd_init(void)
+static int
+rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
rte_eth_driver_register(&rte_em_pmd);
return 0;
@@ -1433,3 +1434,10 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index)
e1000_rar_set(hw, addr, index);
}
+
+struct rte_driver em_pmd_drv = {
+ .type = PMD_PDEV,
+ .init = rte_em_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(em_pmd_drv);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index aabe75e..a94830e 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -73,10 +73,6 @@ LDLIBS += -lrte_ivshmem
endif
endif
-ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y)
-LDLIBS += -lrte_pmd_e1000
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
LDLIBS += -lrte_pmd_ixgbe
endif
@@ -169,6 +165,10 @@ endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y)
+LDLIBS += -lrte_pmd_e1000
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
LDLIBS += -lrte_pmd_ring
endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 10/14] ixgbe: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (8 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 09/14] e1000: " Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 11/14] ixgbevf: " Neil Horman
` (7 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the ixgbe pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the ixgbe library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
examples/dpdk_qat/main.c | 6 ------
examples/vmdq_dcb/main.c | 4 ----
lib/librte_ether/rte_ethdev.h | 13 -------------
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 12 ++++++++++--
4 files changed, 10 insertions(+), 25 deletions(-)
diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c
index 64cb610..741d3f3 100644
--- a/examples/dpdk_qat/main.c
+++ b/examples/dpdk_qat/main.c
@@ -696,12 +696,6 @@ MAIN(int argc, char **argv)
if (ret < 0)
return -1;
- /* init driver */
-#ifdef RTE_LIBRTE_IXGBE_PMD
- if (rte_ixgbe_pmd_init() < 0)
- rte_panic("Cannot init ixgbe pmd\n");
-#endif
-
if (rte_eal_pci_probe() < 0)
rte_panic("Cannot probe PCI\n");
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 844f334..1626ba5 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -455,10 +455,6 @@ MAIN(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid VMDQ argument\n");
- if (rte_ixgbe_pmd_init() != 0 ||
- rte_eal_pci_probe() != 0)
- rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
-
cores = rte_lcore_count();
if ((cores & (cores - 1)) != 0 || cores > 128) {
rte_exit(EXIT_FAILURE,"This program can only run on an even"
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9e32f56..9621be7 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,15 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for 10Gbps Intel IXGBE
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_ixgbe_pmd_init(void);
-
-/**
* The initialization function of the driver for 10Gbps Intel IXGBE_VF
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1375,10 +1366,6 @@ int rte_pmd_init_all(void)
int ret = -ENODEV;
#ifdef RTE_LIBRTE_IXGBE_PMD
- if ((ret = rte_ixgbe_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init ixgbe PMD\n");
- return (ret);
- }
if ((ret = rte_ixgbevf_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init ixgbevf PMD\n");
return (ret);
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index a5a7f9a..efe899a 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -58,6 +58,7 @@
#include <rte_ethdev.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
+#include <rte_dev.h>
#include "ixgbe_logs.h"
#include "ixgbe/ixgbe_api.h"
@@ -955,8 +956,8 @@ static struct eth_driver rte_ixgbevf_pmd = {
* Invoked once at EAL init time.
* Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
*/
-int
-rte_ixgbe_pmd_init(void)
+static int
+rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
@@ -3060,3 +3061,10 @@ ixgbe_mirror_rule_reset(struct rte_eth_dev *dev, uint8_t rule_id)
return 0;
}
+
+struct rte_driver rte_ixgbe_driver = {
+ .type = PMD_PDEV,
+ .init = rte_ixgbe_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_ixgbe_driver);
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 11/14] ixgbevf: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (9 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 10/14] ixgbe: " Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 12/14] virtio: " Neil Horman
` (6 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the ixgbevf pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the ixgbevf library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 16 ----------------
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 12 +++++++++---
mk/rte.app.mk | 8 ++++----
3 files changed, 13 insertions(+), 23 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9621be7..ba535dc 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,15 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for 10Gbps Intel IXGBE_VF
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_ixgbevf_pmd_init(void);
-
-/**
* The initialization function of the driver for Qumranet virtio-net
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1365,13 +1356,6 @@ int rte_pmd_init_all(void)
{
int ret = -ENODEV;
-#ifdef RTE_LIBRTE_IXGBE_PMD
- if ((ret = rte_ixgbevf_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init ixgbevf PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_IXGBE_PMD */
-
#ifdef RTE_LIBRTE_VIRTIO_PMD
if ((ret = rte_virtio_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init virtio PMD\n");
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index efe899a..10dde5f 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -970,8 +970,8 @@ rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unuse
* Invoked one at EAL init time.
* Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
*/
-int
-rte_ixgbevf_pmd_init(void)
+static int
+rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
{
DEBUGFUNC("rte_ixgbevf_pmd_init");
@@ -3062,9 +3062,15 @@ ixgbe_mirror_rule_reset(struct rte_eth_dev *dev, uint8_t rule_id)
return 0;
}
-struct rte_driver rte_ixgbe_driver = {
+static struct rte_driver rte_ixgbe_driver = {
.type = PMD_PDEV,
.init = rte_ixgbe_pmd_init,
};
+static struct rte_driver rte_ixgbevf_driver = {
+ .type = PMD_PDEV,
+ .init = rte_ixgbevf_pmd_init,
+};
+
PMD_REGISTER_DRIVER(rte_ixgbe_driver);
+PMD_REGISTER_DRIVER(rte_ixgbevf_driver);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index a94830e..d8f7907 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -73,10 +73,6 @@ LDLIBS += -lrte_ivshmem
endif
endif
-ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
-LDLIBS += -lrte_pmd_ixgbe
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
LDLIBS += -lrte_pmd_virtio_uio
endif
@@ -165,6 +161,10 @@ endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y)
LDLIBS += -lrte_pmd_e1000
endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 12/14] virtio: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (10 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 11/14] ixgbevf: " Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 13/14] vmxnet3: " Neil Horman
` (5 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the virtio pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the virtio library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 16 ----------------
lib/librte_pmd_virtio/virtio_ethdev.c | 12 ++++++++++--
mk/rte.app.mk | 8 ++++----
3 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ba535dc..7126f95 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,15 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for Qumranet virtio-net
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_virtio_pmd_init(void);
-
-/**
* The initialization function of the driver for VMware VMXNET3
* Ethernet devices.
* Invoked once at EAL start time.
@@ -1356,13 +1347,6 @@ int rte_pmd_init_all(void)
{
int ret = -ENODEV;
-#ifdef RTE_LIBRTE_VIRTIO_PMD
- if ((ret = rte_virtio_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init virtio PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_VIRTIO_PMD */
-
#ifdef RTE_LIBRTE_VMXNET3_PMD
if ((ret = rte_vmxnet3_pmd_init()) != 0) {
RTE_LOG(ERR, PMD, "Cannot init vmxnet3 PMD\n");
diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index f107161..611393e 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -50,6 +50,7 @@
#include <rte_memory.h>
#include <rte_eal.h>
+#include <rte_dev.h>
#include "virtio_ethdev.h"
#include "virtio_pci.h"
@@ -486,8 +487,8 @@ static struct eth_driver rte_virtio_pmd = {
* Register itself as the [Poll Mode] Driver of PCI virtio devices.
* Returns 0 on success.
*/
-int
-rte_virtio_pmd_init(void)
+static int
+rte_virtio_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
{
rte_eth_driver_register(&rte_virtio_pmd);
return (0);
@@ -643,3 +644,10 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_pktlen = VIRTIO_MAX_RX_PKTLEN;
dev_info->max_mac_addrs = VIRTIO_MAX_MAC_ADDRS;
}
+
+static struct rte_driver rte_virtio_driver = {
+ .type = PMD_PDEV,
+ .init = rte_virtio_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_virtio_driver);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index d8f7907..3f1386b 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -73,10 +73,6 @@ LDLIBS += -lrte_ivshmem
endif
endif
-ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
-LDLIBS += -lrte_pmd_virtio_uio
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
LDLIBS += -lrte_pmd_vmxnet3_uio
endif
@@ -161,6 +157,10 @@ endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
+LDLIBS += -lrte_pmd_virtio_uio
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
LDLIBS += -lrte_pmd_ixgbe
endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 13/14] vmxnet3: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (11 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 12/14] virtio: " Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 14/14] pmd: Remove rte_pmd_init_all Neil Horman
` (4 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
convert the vmxnet3 pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the vmxnet3 library
when building DSO's and must specify its use on the command line with the -d
option. Static linking will still initalize the driver automatically.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
lib/librte_ether/rte_ethdev.h | 19 +------------------
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 12 ++++++++++--
mk/rte.app.mk | 8 ++++----
3 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 7126f95..24288f8 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,16 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of the driver for VMware VMXNET3
- * Ethernet devices.
- * Invoked once at EAL start time.
- * @return
- * 0 on success
- */
-extern int rte_vmxnet3_pmd_init(void);
-
-
-/**
* The initialization function of *all* supported and enabled drivers.
* Right now, the following PMDs are supported:
* - igb
@@ -1345,14 +1335,7 @@ extern int rte_vmxnet3_pmd_init(void);
static inline
int rte_pmd_init_all(void)
{
- int ret = -ENODEV;
-
-#ifdef RTE_LIBRTE_VMXNET3_PMD
- if ((ret = rte_vmxnet3_pmd_init()) != 0) {
- RTE_LOG(ERR, PMD, "Cannot init vmxnet3 PMD\n");
- return (ret);
- }
-#endif /* RTE_LIBRTE_VMXNET3_PMD */
+ int ret = 0;
if (ret == -ENODEV)
RTE_LOG(ERR, PMD, "No PMD(s) are configured\n");
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
index 8259cfe..c41032f 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
@@ -60,6 +60,7 @@
#include <rte_atomic.h>
#include <rte_string_fns.h>
#include <rte_malloc.h>
+#include <rte_dev.h>
#include "vmxnet3/vmxnet3_defs.h"
@@ -278,8 +279,8 @@ static struct eth_driver rte_vmxnet3_pmd = {
* Invoked once at EAL init time.
* Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
*/
-int
-rte_vmxnet3_pmd_init(void)
+static int
+rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
{
PMD_INIT_FUNC_TRACE();
@@ -763,3 +764,10 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
+
+static struct rte_driver rte_vmxnet3_driver = {
+ .type = PMD_PDEV,
+ .init = rte_vmxnet3_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_vmxnet3_driver);
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 3f1386b..cfea6c6 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -73,10 +73,6 @@ LDLIBS += -lrte_ivshmem
endif
endif
-ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
-LDLIBS += -lrte_pmd_vmxnet3_uio
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
LDLIBS += -lrte_timer
endif
@@ -157,6 +153,10 @@ endif
ifeq ($(RTE_BUILD_SHARED_LIB),n)
+ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
+LDLIBS += -lrte_pmd_vmxnet3_uio
+endif
+
ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
LDLIBS += -lrte_pmd_virtio_uio
endif
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* [dpdk-dev] [PATCH 0/X v5 14/14] pmd: Remove rte_pmd_init_all
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (12 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 13/14] vmxnet3: " Neil Horman
@ 2014-04-21 14:59 ` Neil Horman
2014-04-21 17:05 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (3 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 14:59 UTC (permalink / raw)
To: dev
Now that we've converted all the pmds in dpdk to use the driver registration
macro, rte_pmd_init_all has become empty. As theres no reason to keep it around
anymore, just remove it and fix up all the eample callers.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
app/test-pmd/testpmd.c | 3 ---
app/test/test_kni.c | 5 ----
examples/exception_path/main.c | 5 ----
examples/ip_reassembly/main.c | 4 ----
examples/ipv4_frag/main.c | 4 ----
examples/ipv4_multicast/main.c | 4 ----
examples/kni/main.c | 5 ----
examples/l2fwd-ivshmem/host/host.c | 4 ----
examples/l2fwd/main.c | 4 ----
examples/l3fwd-power/main.c | 4 ----
examples/l3fwd-vf/main.c | 4 ----
examples/l3fwd/main.c | 4 ----
examples/link_status_interrupt/main.c | 4 ----
examples/load_balancer/init.c | 6 -----
.../client_server_mp/shared/init_drivers.h | 2 +-
examples/multi_process/l2fwd_fork/main.c | 4 ----
examples/multi_process/symmetric_mp/main.c | 2 --
examples/netmap_compat/bridge/bridge.c | 4 ----
examples/qos_meter/main.c | 4 ----
examples/qos_sched/init.c | 4 ----
examples/quota_watermark/qw/init.c | 5 ----
examples/vhost/main.c | 2 +-
examples/vhost_xen/main.c | 2 +-
examples/vmdq/main.c | 2 +-
lib/librte_ether/rte_ethdev.h | 27 ----------------------
25 files changed, 4 insertions(+), 114 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 04dca57..7f2dcde 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1755,9 +1755,6 @@ main(int argc, char** argv)
if (diag < 0)
rte_panic("Cannot init EAL\n");
- if (rte_pmd_init_all())
- rte_panic("Cannot init PMD\n");
-
if (rte_eal_pci_probe())
rte_panic("Cannot probe PCI\n");
diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index e0fe44e..d37758b 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -509,11 +509,6 @@ test_kni(void)
printf("fail to create mempool for kni\n");
return -1;
}
- ret = rte_pmd_init_all();
- if (ret < 0) {
- printf("fail to initialize PMD\n");
- return -1;
- }
ret = rte_eal_pci_probe();
if (ret < 0) {
printf("fail to probe PCI devices\n");
diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index 0bc149d..d73b413 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -566,11 +566,6 @@ main(int argc, char** argv)
return -1;
}
- /* Initialise PMD driver(s) */
- ret = rte_pmd_init_all();
- if (ret < 0)
- FATAL_ERROR("Could not probe PMD (%d)", ret);
-
/* Scan PCI bus for recognised devices */
ret = rte_eal_pci_probe();
if (ret < 0)
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 4880a5f..bafa8d9 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -1553,10 +1553,6 @@ MAIN(int argc, char **argv)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/ipv4_frag/main.c b/examples/ipv4_frag/main.c
index 93664c8..329f2ce 100644
--- a/examples/ipv4_frag/main.c
+++ b/examples/ipv4_frag/main.c
@@ -608,10 +608,6 @@ MAIN(int argc, char **argv)
if (pool_indirect == NULL)
rte_panic("Cannot init indirect mbuf pool\n");
- /* init driver */
- if (rte_pmd_init_all() < 0)
- rte_panic("Cannot init PMD\n");
-
if (rte_eal_pci_probe() < 0)
rte_panic("Cannot probe PCI\n");
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index 3bd37e4..da4e09d 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -753,10 +753,6 @@ MAIN(int argc, char **argv)
if (clone_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n");
- /* init driver */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 274990b..fe823b3 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -889,11 +889,6 @@ main(int argc, char** argv)
return -1;
}
- /* Initialise PMD driver(s) */
- ret = rte_pmd_init_all();
- if (ret < 0)
- rte_exit(EXIT_FAILURE, "Could not initialise PMD (%d)\n", ret);
-
/* Scan PCI bus for recognised devices */
ret = rte_eal_pci_probe();
if (ret < 0)
diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c
index 6aaa082..e0627a4 100644
--- a/examples/l2fwd-ivshmem/host/host.c
+++ b/examples/l2fwd-ivshmem/host/host.c
@@ -716,10 +716,6 @@ int main(int argc, char **argv)
if (l2fwd_ivshmem_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 2d94366..d04e27a 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -615,10 +615,6 @@ MAIN(int argc, char **argv)
if (l2fwd_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 219f802..598b7a2 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1547,10 +1547,6 @@ MAIN(int argc, char **argv)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c
index fb811fa..793cacc 100644
--- a/examples/l3fwd-vf/main.c
+++ b/examples/l3fwd-vf/main.c
@@ -1007,10 +1007,6 @@ MAIN(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- /* init driver */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 1ba4ca2..8ee1af9 100755
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1841,10 +1841,6 @@ MAIN(int argc, char **argv)
rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index de6c87f..8d17b01 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -663,10 +663,6 @@ MAIN(int argc, char **argv)
if (lsi_pktmbuf_pool == NULL)
rte_panic("Cannot init mbuf pool\n");
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_panic("Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_panic("Cannot probe PCI\n");
diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c
index 6a2f218..e997238 100644
--- a/examples/load_balancer/init.c
+++ b/examples/load_balancer/init.c
@@ -450,12 +450,6 @@ app_init_nics(void)
int ret;
uint32_t n_rx_queues, n_tx_queues;
- /* Init driver */
- printf("Initializing the PMD driver ...\n");
- if (rte_pmd_init_all() < 0) {
- rte_panic("Cannot init PMD\n");
- }
-
if (rte_eal_pci_probe() < 0) {
rte_panic("Cannot probe PCI\n");
}
diff --git a/examples/multi_process/client_server_mp/shared/init_drivers.h b/examples/multi_process/client_server_mp/shared/init_drivers.h
index afa03bd..5d9a90f 100644
--- a/examples/multi_process/client_server_mp/shared/init_drivers.h
+++ b/examples/multi_process/client_server_mp/shared/init_drivers.h
@@ -40,7 +40,7 @@
static inline int
init_drivers(void)
{
- if (rte_pmd_init_all() < 0 || rte_eal_pci_probe() < 0)
+ if (rte_eal_pci_probe() < 0)
return -1;
return 0;
diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c
index 3dd2b2a..a34f420 100644
--- a/examples/multi_process/l2fwd_fork/main.c
+++ b/examples/multi_process/l2fwd_fork/main.c
@@ -1050,10 +1050,6 @@ MAIN(int argc, char **argv)
for (i = 0; i < RTE_MAX_LCORE; i++)
lcore_resource[i].lcore_id = i;
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 12fa28d..028f98d 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -463,8 +463,6 @@ main(int argc, char **argv)
/* probe to determine the NIC devices available */
proc_type = rte_eal_process_type();
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init pmd\n");
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
if (rte_eth_dev_count() == 0)
diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c
index ecf5757..e0cef57 100644
--- a/examples/netmap_compat/bridge/bridge.c
+++ b/examples/netmap_compat/bridge/bridge.c
@@ -294,10 +294,6 @@ int main(int argc, char *argv[])
if (ports.num == 0)
rte_exit(EXIT_FAILURE, "no ports specified\n");
- err = rte_pmd_init_all();
- if (err < 0)
- rte_exit(EXIT_FAILURE, "rte_pmd_init_all(): error %d\n", err);
-
err = rte_eal_pci_probe();
if (err < 0)
rte_exit(EXIT_FAILURE, "rte_eal_pci_probe(): error %d\n", err);
diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c
index bc76703..e1698cc 100755
--- a/examples/qos_meter/main.c
+++ b/examples/qos_meter/main.c
@@ -386,10 +386,6 @@ MAIN(int argc, char **argv)
if (pool == NULL)
rte_exit(EXIT_FAILURE, "Buffer pool creation error\n");
- /* PMD init */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "PMD init error\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "PCI probe error\n");
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index 7c5c62e..e021815 100755
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -305,10 +305,6 @@ int app_init(void)
char ring_name[MAX_NAME_LEN];
char pool_name[MAX_NAME_LEN];
- /* init driver(s) */
- if (rte_pmd_init_all() < 0)
- rte_exit(EXIT_FAILURE, "Cannot init PMD\n");
-
if (rte_eal_pci_probe() < 0)
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c
index f42eb8b..44455b2 100644
--- a/examples/quota_watermark/qw/init.c
+++ b/examples/quota_watermark/qw/init.c
@@ -138,11 +138,6 @@ init_dpdk(void)
{
int ret;
- /* Initialize the PMD */
- ret = rte_pmd_init_all();
- if (ret < 0)
- rte_exit(EXIT_FAILURE, "Failed to initialize poll mode drivers (error %d)\n", ret);
-
/* Bind the drivers to usable devices */
ret = rte_eal_pci_probe();
if (ret < 0)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 816a71a..b86d57d 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1657,7 +1657,7 @@ MAIN(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid argument\n");
- if (rte_pmd_init_all() != 0 || rte_eal_pci_probe() != 0)
+ if (rte_eal_pci_probe() != 0)
rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index eafc0aa..2ec44ee 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -1464,7 +1464,7 @@ MAIN(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid argument\n");
- if (rte_pmd_init_all() != 0 || rte_eal_pci_probe() != 0)
+ if (rte_eal_pci_probe() != 0)
rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index fac24aa..0f52bdd 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -597,7 +597,7 @@ MAIN(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid VMDQ argument\n");
- if (rte_pmd_init_all() != 0 || rte_eal_pci_probe() != 0)
+ if (rte_eal_pci_probe() != 0)
rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 24288f8..d5ea46b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1316,33 +1316,6 @@ struct eth_driver {
extern void rte_eth_driver_register(struct eth_driver *eth_drv);
/**
- * The initialization function of *all* supported and enabled drivers.
- * Right now, the following PMDs are supported:
- * - igb
- * - igbvf
- * - em
- * - ixgbe
- * - ixgbevf
- * - virtio
- * - vmxnet3
- * This function is invoked once at EAL start time.
- * @return
- * 0 on success.
- * Error code of the device initialization failure,
- * -ENODEV if there are no drivers available
- * (e.g. if all driver config options are = n).
- */
-static inline
-int rte_pmd_init_all(void)
-{
- int ret = 0;
-
- if (ret == -ENODEV)
- RTE_LOG(ERR, PMD, "No PMD(s) are configured\n");
- return (ret);
-}
-
-/**
* Configure an Ethernet device.
* This function must be invoked first before any other function in the
* Ethernet API. This function can also be re-invoked when a device is in the
--
1.8.3.1
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (13 preceding siblings ...)
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 14/14] pmd: Remove rte_pmd_init_all Neil Horman
@ 2014-04-21 17:05 ` Neil Horman
2014-04-21 20:10 ` Stephen Hemminger
` (2 subsequent siblings)
17 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 17:05 UTC (permalink / raw)
To: dev
On Mon, Apr 21, 2014 at 10:59:25AM -0400, Neil Horman wrote:
> Disconnect compile time linkage between eal library / applications and pmd's
>
> I noticed that, while tinkering with dpdk, building for shared libraries still
> resulted in all the test applications linking to all the built pmd's, despite
> not actually needing them all. We are able to tell an application at run time
> (via the -d/--blacklist/--whitelist/--vdev options) which pmd's we want to use,
> and so have no need to link them at all. The only reason they get pulled in is
> because rte_eal_non_pci_init_etherdev and rte_pmd_init_all contain static lists
> to the individual pmd init functions. The result is that, even when building as
> DSO's, we have to load all the pmd libraries, which is space inefficient and
> defeating of some of the purpose of shared objects.
>
> To correct this, I developed this patch series, which introduces a new macro,
> PMD_REGISTER_DRIVER, which wraps up Oliviers work using constructors on the
> virtual device pmds, then expands on it to include the physical device pmds,
> allowing us to break linkages between dpdk applications and pmd's almost
> entirely (save for the ring and xenvirt drivers, which have additional api's
> outside of the standard dpdk code that we need to further fix). This also
> allows us to completely remove the rte_pmd_init_all routine, hiding its function
> internally to the rte_eal_init path.
>
> I've tested this feature using the igb and pcap pmd's, both statically and
> dynamically linked with the test and testpmd sample applications, and it seems
> to work well.
>
> Note, I encountered a few bugs along the way, which I fixed and noted in the
> series.
>
> Regards
> Neil
>
> Change Notes:
>
> 1) Reposted the entire series. Recent changes permeated accross several
> patches, and since a few patches already had multiple versions, I've reposted
> the entire series and bumped the version number to 5, whcih skips a few
> versions, but ensures this series is seen as the most recent.
>
> 2) Merged the PMD_REGISTER_DRIVER macro into rte_dev.h, which is a better
> location for it. Required removing include of rte_pmd.h across most of the
> patches in the series.
>
> 3) Cleaned up various leftover "virtual" comments in the driver registration api
> that no longer belong there after making it generic
>
> 4) Fixed the LINK_USING_CC check in rte.lib.mk so it works like other uses
>
> 5) Fixed CPU_LDFLAGS conversion to use -Wl in case we link with gcc.
>
>
>
Shoot, I fat fingered in a 0/X in all the patch prefixes. sorry about that.
Neil
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (14 preceding siblings ...)
2014-04-21 17:05 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
@ 2014-04-21 20:10 ` Stephen Hemminger
2014-04-21 20:36 ` Neil Horman
2014-05-16 15:28 ` Neil Horman
2014-05-20 12:45 ` Thomas Monjalon
17 siblings, 1 reply; 77+ messages in thread
From: Stephen Hemminger @ 2014-04-21 20:10 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
On Mon, 21 Apr 2014 10:59:25 -0400
Neil Horman <nhorman@tuxdriver.com> wrote:
> Disconnect compile time linkage between eal library / applications and pmd's
>
> I noticed that, while tinkering with dpdk, building for shared libraries still
> resulted in all the test applications linking to all the built pmd's, despite
> not actually needing them all. We are able to tell an application at run time
> (via the -d/--blacklist/--whitelist/--vdev options) which pmd's we want to use,
> and so have no need to link them at all. The only reason they get pulled in is
> because rte_eal_non_pci_init_etherdev and rte_pmd_init_all contain static lists
> to the individual pmd init functions. The result is that, even when building as
> DSO's, we have to load all the pmd libraries, which is space inefficient and
> defeating of some of the purpose of shared objects.
>
> To correct this, I developed this patch series, which introduces a new macro,
> PMD_REGISTER_DRIVER, which wraps up Oliviers work using constructors on the
> virtual device pmds, then expands on it to include the physical device pmds,
> allowing us to break linkages between dpdk applications and pmd's almost
> entirely (save for the ring and xenvirt drivers, which have additional api's
> outside of the standard dpdk code that we need to further fix). This also
> allows us to completely remove the rte_pmd_init_all routine, hiding its function
> internally to the rte_eal_init path.
>
> I've tested this feature using the igb and pcap pmd's, both statically and
> dynamically linked with the test and testpmd sample applications, and it seems
> to work well.
>
> Note, I encountered a few bugs along the way, which I fixed and noted in the
> series.
>
> Regards
> Neil
>
> Change Notes:
>
> 1) Reposted the entire series. Recent changes permeated accross several
> patches, and since a few patches already had multiple versions, I've reposted
> the entire series and bumped the version number to 5, whcih skips a few
> versions, but ensures this series is seen as the most recent.
>
> 2) Merged the PMD_REGISTER_DRIVER macro into rte_dev.h, which is a better
> location for it. Required removing include of rte_pmd.h across most of the
> patches in the series.
>
> 3) Cleaned up various leftover "virtual" comments in the driver registration api
> that no longer belong there after making it generic
>
> 4) Fixed the LINK_USING_CC check in rte.lib.mk so it works like other uses
>
> 5) Fixed CPU_LDFLAGS conversion to use -Wl in case we link with gcc.
I am ok with build device drivers as libraries, but there can be a
performance impact. For performance, we link with link-time optimization
and that is not possible as shared library. Haven't measured but at least
in the kernel, modules add a performance tax because they aren't in same
memory region and therefore cause a TLB miss. Might have same impact in
user mode.
You might be able to get some of this back by compiling with link-time-optimization
on a device at a time, and
also use the flags to tell compiler that only certain entry points are
shared and need tob e global.
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's
2014-04-21 20:10 ` Stephen Hemminger
@ 2014-04-21 20:36 ` Neil Horman
0 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-04-21 20:36 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Mon, Apr 21, 2014 at 01:10:00PM -0700, Stephen Hemminger wrote:
> On Mon, 21 Apr 2014 10:59:25 -0400
> Neil Horman <nhorman@tuxdriver.com> wrote:
>
> > Disconnect compile time linkage between eal library / applications and pmd's
> >
> > I noticed that, while tinkering with dpdk, building for shared libraries still
> > resulted in all the test applications linking to all the built pmd's, despite
> > not actually needing them all. We are able to tell an application at run time
> > (via the -d/--blacklist/--whitelist/--vdev options) which pmd's we want to use,
> > and so have no need to link them at all. The only reason they get pulled in is
> > because rte_eal_non_pci_init_etherdev and rte_pmd_init_all contain static lists
> > to the individual pmd init functions. The result is that, even when building as
> > DSO's, we have to load all the pmd libraries, which is space inefficient and
> > defeating of some of the purpose of shared objects.
> >
> > To correct this, I developed this patch series, which introduces a new macro,
> > PMD_REGISTER_DRIVER, which wraps up Oliviers work using constructors on the
> > virtual device pmds, then expands on it to include the physical device pmds,
> > allowing us to break linkages between dpdk applications and pmd's almost
> > entirely (save for the ring and xenvirt drivers, which have additional api's
> > outside of the standard dpdk code that we need to further fix). This also
> > allows us to completely remove the rte_pmd_init_all routine, hiding its function
> > internally to the rte_eal_init path.
> >
> > I've tested this feature using the igb and pcap pmd's, both statically and
> > dynamically linked with the test and testpmd sample applications, and it seems
> > to work well.
> >
> > Note, I encountered a few bugs along the way, which I fixed and noted in the
> > series.
> >
> > Regards
> > Neil
> >
> > Change Notes:
> >
> > 1) Reposted the entire series. Recent changes permeated accross several
> > patches, and since a few patches already had multiple versions, I've reposted
> > the entire series and bumped the version number to 5, whcih skips a few
> > versions, but ensures this series is seen as the most recent.
> >
> > 2) Merged the PMD_REGISTER_DRIVER macro into rte_dev.h, which is a better
> > location for it. Required removing include of rte_pmd.h across most of the
> > patches in the series.
> >
> > 3) Cleaned up various leftover "virtual" comments in the driver registration api
> > that no longer belong there after making it generic
> >
> > 4) Fixed the LINK_USING_CC check in rte.lib.mk so it works like other uses
> >
> > 5) Fixed CPU_LDFLAGS conversion to use -Wl in case we link with gcc.
>
> I am ok with build device drivers as libraries, but there can be a
> performance impact. For performance, we link with link-time optimization
> and that is not possible as shared library. Haven't measured but at least
> in the kernel, modules add a performance tax because they aren't in same
> memory region and therefore cause a TLB miss. Might have same impact in
> user mode.
>
Possibly, but that seems like a build time decision. Performance numbers are
definately good for guidance here, but one way or another if you're not ok with
the impact, you configure to build statically, and go on about your day. We're
not preventing that here, just making the DSO build case work a little more
sanely, so that the core libraries and applications don't have to link against
the DSO's directly.
> You might be able to get some of this back by compiling with link-time-optimization
> on a device at a time, and
> also use the flags to tell compiler that only certain entry points are
> shared and need tob e global.
>
That seems like a fine idea. In fact with this patch, a typical pmd would need
no global entry points, as the constructor registers the init routine (which can
be static), and the init routine registers the ethernet device driver. We could
probably (with this changeset) create a boilerplate linker script for the pmds
that marked all the symbols except constructors as local (xenvirt and ring are
notable exceptions to this rule, but those can likely be fixed up).
Regardless, I'd like to address that in a separate patch, as I think this series
is doing enough on its own. It a good idea for optimization though.
Neil
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-04-16 13:51 ` [dpdk-dev] [PATCH 01/15 v2] " Neil Horman
2014-04-18 11:23 ` Thomas Monjalon
@ 2014-04-29 23:42 ` Thomas Monjalon
2014-05-02 11:09 ` Neil Horman
1 sibling, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-04-29 23:42 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-16 09:51, Neil Horman:
> The shared libraries built with the current makefile set produce static
> libraries rather than actual shared objects. This is due to several missing
> options that are required to correctly build shared objects using ld, as
> well as a mis-specified -share option (which should be -shared). Switching
> to the use of CC rather than LD and fixing the -shared option corrects
> these problems and builds the DSOs correctly.
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Applied for version 1.6.0r2.
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-04-29 23:42 ` Thomas Monjalon
@ 2014-05-02 11:09 ` Neil Horman
2014-05-02 12:22 ` Thomas Monjalon
0 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-05-02 11:09 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Wed, Apr 30, 2014 at 01:42:12AM +0200, Thomas Monjalon wrote:
> 2014-04-16 09:51, Neil Horman:
> > The shared libraries built with the current makefile set produce static
> > libraries rather than actual shared objects. This is due to several missing
> > options that are required to correctly build shared objects using ld, as
> > well as a mis-specified -share option (which should be -shared). Switching
> > to the use of CC rather than LD and fixing the -shared option corrects
> > these problems and builds the DSOs correctly.
> >
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>
> Applied for version 1.6.0r2.
>
> Thanks
> --
> Thomas
>
So, I just went and looked at 1.6.0r2 and noted that you applied this patch, but
the rest of the series is still missing. This is what I was talking about
earlier when I said you weren't applying patch series atomically. It makes it
impossible to have any clue what the upstream development head is going to look
like. On top of that, since you're clearly integrating other changes ahead of
this, theres every likelyhood the rest of my v5 series won't apply.
the v5 series has sat out here for a few weeks now without comment. If there
aren't any objections to it, apply it. Whats the problem here? I'm not going
to package the DPDK until this series (or the functionality it offers) is in
place.
Neil
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-05-02 11:09 ` Neil Horman
@ 2014-05-02 12:22 ` Thomas Monjalon
2014-05-02 13:01 ` Neil Horman
0 siblings, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-05-02 12:22 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-05-02 07:09, Neil Horman:
> On Wed, Apr 30, 2014 at 01:42:12AM +0200, Thomas Monjalon wrote:
> > 2014-04-16 09:51, Neil Horman:
> > > The shared libraries built with the current makefile set produce static
> > > libraries rather than actual shared objects. This is due to several
> > > missing options that are required to correctly build shared objects
> > > using ld, as well as a mis-specified -share option (which should be
> > > -shared). Switching to the use of CC rather than LD and fixing the
> > > -shared option corrects these problems and builds the DSOs correctly.
> > >
> > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> >
> > Applied for version 1.6.0r2.
>
> So, I just went and looked at 1.6.0r2 and noted that you applied this patch,
> but the rest of the series is still missing. This is what I was talking
> about earlier when I said you weren't applying patch series atomically. It
> makes it impossible to have any clue what the upstream development head is
> going to look like. On top of that, since you're clearly integrating other
> changes ahead of this, theres every likelyhood the rest of my v5 series
> won't apply.
>
> the v5 series has sat out here for a few weeks now without comment. If there
> aren't any objections to it, apply it. Whats the problem here? I'm not
> going to package the DPDK until this series (or the functionality it
> offers) is in place.
This patch is clearly an important fix. So I took it for release 1.6.0r2.
The other patches of the serie are enhancements which will be in 1.7.0.
The goal is to change the integration model.
Now we'll stop integrating enhancements and big changes when first release
candidate is out. Then it will be clear that only fixes and mandatory changes
will be integrated in the last part of the release cycle.
I hope you agree we're improving the workflow.
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-05-02 12:22 ` Thomas Monjalon
@ 2014-05-02 13:01 ` Neil Horman
2014-05-02 13:18 ` Thomas Monjalon
0 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-05-02 13:01 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Fri, May 02, 2014 at 02:22:17PM +0200, Thomas Monjalon wrote:
> 2014-05-02 07:09, Neil Horman:
> > On Wed, Apr 30, 2014 at 01:42:12AM +0200, Thomas Monjalon wrote:
> > > 2014-04-16 09:51, Neil Horman:
> > > > The shared libraries built with the current makefile set produce static
> > > > libraries rather than actual shared objects. This is due to several
> > > > missing options that are required to correctly build shared objects
> > > > using ld, as well as a mis-specified -share option (which should be
> > > > -shared). Switching to the use of CC rather than LD and fixing the
> > > > -shared option corrects these problems and builds the DSOs correctly.
> > > >
> > > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > >
> > > Applied for version 1.6.0r2.
> >
> > So, I just went and looked at 1.6.0r2 and noted that you applied this patch,
> > but the rest of the series is still missing. This is what I was talking
> > about earlier when I said you weren't applying patch series atomically. It
> > makes it impossible to have any clue what the upstream development head is
> > going to look like. On top of that, since you're clearly integrating other
> > changes ahead of this, theres every likelyhood the rest of my v5 series
> > won't apply.
> >
> > the v5 series has sat out here for a few weeks now without comment. If there
> > aren't any objections to it, apply it. Whats the problem here? I'm not
> > going to package the DPDK until this series (or the functionality it
> > offers) is in place.
>
> This patch is clearly an important fix. So I took it for release 1.6.0r2.
> The other patches of the serie are enhancements which will be in 1.7.0.
>
> The goal is to change the integration model.
> Now we'll stop integrating enhancements and big changes when first release
> candidate is out. Then it will be clear that only fixes and mandatory changes
> will be integrated in the last part of the release cycle.
>
> I hope you agree we're improving the workflow.
Apologies to you Thomas, and the rest of the 6wind list. He just explained to
me that patch applications ni 1.6.0r2 aren't inherited by 1.7.0 so the entire
patch series will need to be reapplied to 1.7.0. The workflow is atypical to
me, but I should have seen that, given there is no master branch. Sorry for the
outburst.
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15 v2] makefiles: Fixed -share command line option error
2014-05-02 13:01 ` Neil Horman
@ 2014-05-02 13:18 ` Thomas Monjalon
0 siblings, 0 replies; 77+ messages in thread
From: Thomas Monjalon @ 2014-05-02 13:18 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-05-02 09:01, Neil Horman:
> On Fri, May 02, 2014 at 02:22:17PM +0200, Thomas Monjalon wrote:
> > 2014-05-02 07:09, Neil Horman:
> > > On Wed, Apr 30, 2014 at 01:42:12AM +0200, Thomas Monjalon wrote:
> > > > 2014-04-16 09:51, Neil Horman:
> > > > > The shared libraries built with the current makefile set produce
> > > > > static
> > > > > libraries rather than actual shared objects. This is due to several
> > > > > missing options that are required to correctly build shared objects
> > > > > using ld, as well as a mis-specified -share option (which should be
> > > > > -shared). Switching to the use of CC rather than LD and fixing the
> > > > > -shared option corrects these problems and builds the DSOs
> > > > > correctly.
> > > > >
> > > > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > > >
> > > > Applied for version 1.6.0r2.
> > >
> > > So, I just went and looked at 1.6.0r2 and noted that you applied this
> > > patch, but the rest of the series is still missing. This is what I was
> > > talking about earlier when I said you weren't applying patch series
> > > atomically. It makes it impossible to have any clue what the upstream
> > > development head is going to look like. On top of that, since you're
> > > clearly integrating other changes ahead of this, theres every
> > > likelyhood the rest of my v5 series won't apply.
> > >
> > > the v5 series has sat out here for a few weeks now without comment. If
> > > there aren't any objections to it, apply it. Whats the problem here?
> > > I'm not going to package the DPDK until this series (or the
> > > functionality it offers) is in place.
> >
> > This patch is clearly an important fix. So I took it for release 1.6.0r2.
> > The other patches of the serie are enhancements which will be in 1.7.0.
> >
> > The goal is to change the integration model.
> > Now we'll stop integrating enhancements and big changes when first release
> > candidate is out. Then it will be clear that only fixes and mandatory
> > changes will be integrated in the last part of the release cycle.
> >
> > I hope you agree we're improving the workflow.
>
> Apologies to you Thomas, and the rest of the 6wind list. He just explained
> to me that patch applications ni 1.6.0r2 aren't inherited by 1.7.0 so the
> entire patch series will need to be reapplied to 1.7.0.
Sorry, you misunderstood :)
I'm starting a master branch from 1.6.0r2.
So the rest of you serie will be applied on master branch where 1.7.0 is going
to live.
I won't split patch serie anymore.
Apologies for the confusion.
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (15 preceding siblings ...)
2014-04-21 20:10 ` Stephen Hemminger
@ 2014-05-16 15:28 ` Neil Horman
2014-05-16 15:39 ` Thomas Monjalon
2014-05-20 12:45 ` Thomas Monjalon
17 siblings, 1 reply; 77+ messages in thread
From: Neil Horman @ 2014-05-16 15:28 UTC (permalink / raw)
To: dev
On Mon, Apr 21, 2014 at 10:59:25AM -0400, Neil Horman wrote:
> Disconnect compile time linkage between eal library / applications and pmd's
>
> I noticed that, while tinkering with dpdk, building for shared libraries still
> resulted in all the test applications linking to all the built pmd's, despite
> not actually needing them all. We are able to tell an application at run time
> (via the -d/--blacklist/--whitelist/--vdev options) which pmd's we want to use,
> and so have no need to link them at all. The only reason they get pulled in is
> because rte_eal_non_pci_init_etherdev and rte_pmd_init_all contain static lists
> to the individual pmd init functions. The result is that, even when building as
> DSO's, we have to load all the pmd libraries, which is space inefficient and
> defeating of some of the purpose of shared objects.
>
> To correct this, I developed this patch series, which introduces a new macro,
> PMD_REGISTER_DRIVER, which wraps up Oliviers work using constructors on the
> virtual device pmds, then expands on it to include the physical device pmds,
> allowing us to break linkages between dpdk applications and pmd's almost
> entirely (save for the ring and xenvirt drivers, which have additional api's
> outside of the standard dpdk code that we need to further fix). This also
> allows us to completely remove the rte_pmd_init_all routine, hiding its function
> internally to the rte_eal_init path.
>
> I've tested this feature using the igb and pcap pmd's, both statically and
> dynamically linked with the test and testpmd sample applications, and it seems
> to work well.
>
> Note, I encountered a few bugs along the way, which I fixed and noted in the
> series.
>
> Regards
> Neil
>
> Change Notes:
>
> 1) Reposted the entire series. Recent changes permeated accross several
> patches, and since a few patches already had multiple versions, I've reposted
> the entire series and bumped the version number to 5, whcih skips a few
> versions, but ensures this series is seen as the most recent.
>
> 2) Merged the PMD_REGISTER_DRIVER macro into rte_dev.h, which is a better
> location for it. Required removing include of rte_pmd.h across most of the
> patches in the series.
>
> 3) Cleaned up various leftover "virtual" comments in the driver registration api
> that no longer belong there after making it generic
>
> 4) Fixed the LINK_USING_CC check in rte.lib.mk so it works like other uses
>
> 5) Fixed CPU_LDFLAGS conversion to use -Wl in case we link with gcc.
>
>
>
Ping, so whats the status on the rest of this series? You said you would
integrate it with 1.7.0, but you've applied several dozen patches ahead of it
(many of which were posted after it), and as a result, it no longer applies. I
assume you're planning on fixing all of this up?
Neil
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's
2014-05-16 15:28 ` Neil Horman
@ 2014-05-16 15:39 ` Thomas Monjalon
0 siblings, 0 replies; 77+ messages in thread
From: Thomas Monjalon @ 2014-05-16 15:39 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
Hi Neil,
2014-05-16 11:28, Neil Horman:
> Ping, so whats the status on the rest of this series? You said you would
> integrate it with 1.7.0, but you've applied several dozen patches ahead of
> it (many of which were posted after it), and as a result, it no longer
> applies. I assume you're planning on fixing all of this up?
I was pretty sure you'll ping me :)
This serie should be the next to be applied, probably on Monday.
I take this opportunity to "recruit" more reviewers.
Many patches are pending for review and there will be probably even more in
next days. So reviewers are welcome!
http://dpdk.org/dev#review
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
` (16 preceding siblings ...)
2014-05-16 15:28 ` Neil Horman
@ 2014-05-20 12:45 ` Thomas Monjalon
2014-05-20 14:13 ` Neil Horman
17 siblings, 1 reply; 77+ messages in thread
From: Thomas Monjalon @ 2014-05-20 12:45 UTC (permalink / raw)
To: Neil Horman; +Cc: dev
2014-04-21 10:59, Neil Horman:
> Disconnect compile time linkage between eal library / applications and pmd's
>
> I noticed that, while tinkering with dpdk, building for shared libraries
> still resulted in all the test applications linking to all the built pmd's,
> despite not actually needing them all. We are able to tell an application
> at run time (via the -d/--blacklist/--whitelist/--vdev options) which pmd's
> we want to use, and so have no need to link them at all. The only reason
> they get pulled in is because rte_eal_non_pci_init_etherdev and
> rte_pmd_init_all contain static lists to the individual pmd init functions.
> The result is that, even when building as DSO's, we have to load all the
> pmd libraries, which is space inefficient and defeating of some of the
> purpose of shared objects.
>
> To correct this, I developed this patch series, which introduces a new
> macro, PMD_REGISTER_DRIVER, which wraps up Oliviers work using constructors
> on the virtual device pmds, then expands on it to include the physical
> device pmds, allowing us to break linkages between dpdk applications and
> pmd's almost entirely (save for the ring and xenvirt drivers, which have
> additional api's outside of the standard dpdk code that we need to further
> fix). This also allows us to completely remove the rte_pmd_init_all
> routine, hiding its function internally to the rte_eal_init path.
>
> I've tested this feature using the igb and pcap pmd's, both statically and
> dynamically linked with the test and testpmd sample applications, and it
> seems to work well.
>
> Note, I encountered a few bugs along the way, which I fixed and noted in
> the series.
Thanks for this nice cleanup.
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Applied for version 1.7.0.
--
Thomas
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's
2014-05-20 12:45 ` Thomas Monjalon
@ 2014-05-20 14:13 ` Neil Horman
0 siblings, 0 replies; 77+ messages in thread
From: Neil Horman @ 2014-05-20 14:13 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Tue, May 20, 2014 at 02:45:09PM +0200, Thomas Monjalon wrote:
> 2014-04-21 10:59, Neil Horman:
> > Disconnect compile time linkage between eal library / applications and pmd's
> >
> > I noticed that, while tinkering with dpdk, building for shared libraries
> > still resulted in all the test applications linking to all the built pmd's,
> > despite not actually needing them all. We are able to tell an application
> > at run time (via the -d/--blacklist/--whitelist/--vdev options) which pmd's
> > we want to use, and so have no need to link them at all. The only reason
> > they get pulled in is because rte_eal_non_pci_init_etherdev and
> > rte_pmd_init_all contain static lists to the individual pmd init functions.
> > The result is that, even when building as DSO's, we have to load all the
> > pmd libraries, which is space inefficient and defeating of some of the
> > purpose of shared objects.
> >
> > To correct this, I developed this patch series, which introduces a new
> > macro, PMD_REGISTER_DRIVER, which wraps up Oliviers work using constructors
> > on the virtual device pmds, then expands on it to include the physical
> > device pmds, allowing us to break linkages between dpdk applications and
> > pmd's almost entirely (save for the ring and xenvirt drivers, which have
> > additional api's outside of the standard dpdk code that we need to further
> > fix). This also allows us to completely remove the rte_pmd_init_all
> > routine, hiding its function internally to the rte_eal_init path.
> >
> > I've tested this feature using the igb and pcap pmd's, both statically and
> > dynamically linked with the test and testpmd sample applications, and it
> > seems to work well.
> >
> > Note, I encountered a few bugs along the way, which I fixed and noted in
> > the series.
>
> Thanks for this nice cleanup.
>
> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
>
> Applied for version 1.7.0.
>
Thank you Thomas, I will pull this into the rpm I have awaiting revew for
Fedora asap.
Neil
> --
> Thomas
>
^ permalink raw reply [flat|nested] 77+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15 v3] ring: Convert to use of PMD_REGISTER_DRIVER and fix linking
2014-04-17 15:16 ` [dpdk-dev] [PATCH 05/15 v3] " Neil Horman
@ 2014-06-13 13:28 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 77+ messages in thread
From: De Lara Guarch, Pablo @ 2014-06-13 13:28 UTC (permalink / raw)
To: Neil Horman, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Neil Horman
> Sent: Thursday, April 17, 2014 4:17 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 05/15 v3] ring: Convert to use of
> PMD_REGISTER_DRIVER and fix linking
>
> convert the ring driver to use the PMD_REGISTER_DRIVER macro and fix up
> the
> Makefile so that its linkage is only done if we are building static libraries.
> This means that the test applications now have no reference to the ring
> library
> when building DSO's and must specify its use on the command line with the -
> d
> option. Static linking will still initalize the driver automatically.
>
> Note that the ring driver was also written in such a way that it violated some
> general layering principles, several functions were contained in the pmd
> which
> were being called by example from the test application in the app/test
> directory. Specifically it was calling eth_ring_pair_attach,
> eth_ring_pair_create and rte_eth_ring_devinit, which should only be called
> internally to the dpdk core library. To correct this I've removed those
> functions, and instead allowed them to be called indirectly at initalization
> time using the vdev command line argument key
> nodeaction=<name>:<node>:<action>
> where action is one of ATTACH or CREATE. I've tested out the functionality of
> the command line with the testpmd utility, with success, and have removed
> the
> called functions from the test utility. This will affect how the test utility
> is invoked (the -d and --vdev option will need to be specified on the
> command
> line now), but honestly, given the way it was coded, I think the testing of the
> ring pmd was not the best example of how to code with dpdk to begin with. I
> have also left the two layer violating functions in place, so as not to break
> existing applications, but added deprecation warnings to them so that apps
> can
> migrate off them.
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>
> ---
> Change notes
>
> v2) fixed DEPDIR specifcation, should depend on RING not PCAP
>
> v3) Cleaned up strcmp error checking, printfs, and other parsing issues as
> pointed out by Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---
> app/test/test_pmd_ring.c | 95 -------------------------
> lib/librte_pmd_ring/Makefile | 1 +
> lib/librte_pmd_ring/rte_eth_ring.c | 141
> ++++++++++++++++++++++++++++++++++---
> mk/rte.app.mk | 14 ++--
> 4 files changed, 142 insertions(+), 109 deletions(-)
>
> diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
> index 4d9c2ba..1fe38fa 100644
> --- a/app/test/test_pmd_ring.c
> +++ b/app/test/test_pmd_ring.c
> @@ -42,7 +42,6 @@
> /* two test rings, r1 is used by two ports, r2 just by one */
> static struct rte_ring *r1[2], *r2;
>
> -static struct rte_ring *nullring = NULL;
> static struct rte_mempool *mp;
> static uint8_t start_idx; /* will store the port id of the first of our new ports
> */
>
> @@ -59,58 +58,6 @@ static uint8_t start_idx; /* will store the port id of the
> first of our new port
> #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) +
> RTE_PKTMBUF_HEADROOM)
> #define NB_MBUF 512
>
> -
> -static int
> -test_ring_ethdev_create(void)
> -{
> - int retval;
> - printf("Testing ring pmd create\n");
> -
> - retval = rte_eth_from_rings(NULL, 0, NULL, 0, SOCKET0);
> - if (retval < 0) {
> - printf("Failure, failed to create zero-sized RXTX ring pmd\n");
> - return -1;
> - }
> -
> - retval = rte_eth_from_rings(NULL, 0, NULL, 0,
> RTE_MAX_NUMA_NODES);
> - if (retval >= 0) {
> - printf("Failure, can create ring pmd on socket %d\n",
> RTE_MAX_NUMA_NODES);
> - return -1;
> - }
> -
> - retval = rte_eth_from_rings(NULL, 1, &r2, 1, SOCKET0);
> - if (retval >= 0) {
> - printf("Failure, can create pmd with null rx rings\n");
> - return -1;
> - }
> -
> - retval = rte_eth_from_rings(r1, 1, NULL, 1, SOCKET0);
> - if (retval >= 0) {
> - printf("Failure, can create pmd with null tx rings\n");
> - return -1;
> - }
> -
> - retval = rte_eth_from_rings(&nullring, 1, r1, 2, SOCKET0);
> - if (retval < 0) {
> - printf("Failure, failed to create TX-only ring pmd\n");
> - return -1;
> - }
> -
> - retval = rte_eth_from_rings(r1, 1, &nullring, 1, SOCKET0);
> - if (retval < 0) {
> - printf("Failure, failed to create RX-only ring pmd\n");
> - return -1;
> - }
> -
> - retval = rte_eth_from_rings(&r2, 1, &r2, 1, SOCKET0);
> - if (retval < 0) {
> - printf("Failure, failed to create RXTX ring pmd\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
> static int
> test_ethdev_configure(void)
> {
> @@ -305,26 +252,12 @@ test_stats_reset(void)
> static int
> test_pmd_ring_init(void)
> {
> - const char * name1 = "R3";
> - const char * name2 = "R4";
> - const char * params_null = NULL;
> - const char * params = "PARAMS";
> struct rte_eth_stats stats;
> struct rte_mbuf buf, *pbuf = &buf;
> struct rte_eth_conf null_conf;
>
> printf("Testing ring pmd init\n");
>
> - if (rte_pmd_ring_devinit(name1, params_null) < 0) {
> - printf("Testing ring pmd init fail\n");
> - return -1;
> - }
> -
> - if (rte_pmd_ring_devinit(name2, params) < 0) {
> - printf("Testing ring pmd init fail\n");
> - return -1;
> - }
> -
> if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) {
> printf(" TX/RX port exceed max eth ports\n");
> return -1;
> @@ -371,24 +304,16 @@ test_pmd_ring_init(void)
>
> rte_eth_dev_stop(RXTX_PORT2);
>
> - /* Test init same name pmd ring */
> - rte_pmd_ring_devinit(name1, params_null);
> return 0;
> }
>
> static int
> test_pmd_ring_pair_create(void)
> {
> - const char * name1 = "_RNG_P0";
> struct rte_eth_stats stats, stats2;
> struct rte_mbuf buf, *pbuf = &buf;
> struct rte_eth_conf null_conf;
>
> - if (rte_eth_ring_pair_create(name1, SOCKET0) < 0) {
> - printf("Create ring pair failed\n");
> - return -1;
> - }
> -
> if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >=
> RTE_MAX_ETHPORTS)) {
> printf(" TX/RX port exceed max eth ports\n");
> return -1;
> @@ -447,28 +372,16 @@ test_pmd_ring_pair_create(void)
> rte_eth_dev_stop(RXTX_PORT4);
> rte_eth_dev_stop(RXTX_PORT5);
>
> - /* Test create same name ring pair */
> - if (rte_eth_ring_pair_create(name1, SOCKET0) == 0) {
> - printf("Create same name ring pair error\n");
> - return -1;
> - }
> return 0;
> }
>
> static int
> test_pmd_ring_pair_attach(void)
> {
> - const char * name1 = "_RNG_P0";
> - const char * name2 = "_RNG_P1";
> struct rte_eth_stats stats, stats2;
> struct rte_mbuf buf, *pbuf = &buf;
> struct rte_eth_conf null_conf;
>
> - if (rte_eth_ring_pair_attach(name1, SOCKET0) < 0) {
> - printf("Attach ring pair failed\n");
> - return -1;
> - }
> -
> if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >=
> RTE_MAX_ETHPORTS)) {
> printf(" TX/RX port exceed max eth ports\n");
> return -1;
> @@ -529,11 +442,6 @@ test_pmd_ring_pair_attach(void)
> rte_eth_dev_stop(RXTX_PORT4);
> rte_eth_dev_stop(RXTX_PORT5);
>
> - /* Test attach non-existing ring pair */
> - if (rte_eth_ring_pair_attach(name2, SOCKET0) == 0) {
> - printf("Attach non-existing ring pair error\n");
> - return -1;
> - }
> return 0;
> }
>
> @@ -568,9 +476,6 @@ test_pmd_ring(void)
> return -1;
> }
>
> - if (test_ring_ethdev_create() < 0)
> - return -1;
> -
> if (test_ethdev_configure() < 0)
> return -1;
>
> diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
> index 73b2d38..35d40cb 100644
> --- a/lib/librte_pmd_ring/Makefile
> +++ b/lib/librte_pmd_ring/Makefile
> @@ -52,5 +52,6 @@ SYMLINK-y-include += rte_eth_ring.h
> # this lib depends upon:
> DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
> DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf
> lib/librte_ether
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
>
> include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/lib/librte_pmd_ring/rte_eth_ring.c
> b/lib/librte_pmd_ring/rte_eth_ring.c
> index cee3fff..3a129b6 100644
> --- a/lib/librte_pmd_ring/rte_eth_ring.c
> +++ b/lib/librte_pmd_ring/rte_eth_ring.c
> @@ -38,6 +38,17 @@
> #include <rte_memcpy.h>
> #include <rte_string_fns.h>
> #include <rte_vdev.h>
> +#include <rte_pmd.h>
> +#include <rte_kvargs.h>
> +
> +#define ETH_RING_NUMA_NODE_ACTION_ARG "nodeaction"
> +#define ETH_RING_ACTION_CREATE "CREATE"
> +#define ETH_RING_ACTION_ATTACH "ATTACH"
> +
> +static const char *valid_arguments[] = {
> + ETH_RING_NUMA_NODE_ACTION_ARG,
> + NULL
> +};
>
> struct ring_queue {
> struct rte_ring *rng;
> @@ -373,28 +384,143 @@ eth_dev_ring_pair_create(const char *name,
> const unsigned numa_node,
> int
> rte_eth_ring_pair_create(const char *name, const unsigned numa_node)
> {
> + RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_create is
> deprecated\n");
> return eth_dev_ring_pair_create(name, numa_node, DEV_CREATE);
> }
>
> int
> rte_eth_ring_pair_attach(const char *name, const unsigned numa_node)
> {
> + RTE_LOG(WARNING, PMD, "rte_eth_ring_pair_attach is
> deprecated\n");
> return eth_dev_ring_pair_create(name, numa_node, DEV_ATTACH);
> }
>
> +struct node_action_pair {
> + char name[PATH_MAX];
> + unsigned node;
> + enum dev_action action;
> +};
> +
> +struct node_action_list {
> + unsigned total;
> + unsigned count;
> + struct node_action_pair *list;
> +};
> +
> +static int parse_kvlist (const char *key __rte_unused, const char *value,
> void *data)
> +{
> + struct node_action_list *info = data;
> + int ret;
> + char *name;
> + char *action;
> + char *node;
> + char *end;
> +
> + name = strdup(value);
> +
> + ret = -EINVAL;
> +
> + if (!name) {
> + RTE_LOG(WARNING, PMD, "command line paramter is empty
> for ring pmd!\n");
> + goto out;
> + }
> +
> + node = strchr(name, ':');
> + if (!node) {
> + RTE_LOG(WARNING, PMD, "could not parse node value from
> %s", name);
> + goto out;
> + }
> +
> + *node = '\0';
> + node++;
> +
> + action = strchr(node, ':');
> + if (!action) {
> + RTE_LOG(WARNING, PMD, "could not action value from %s",
> node);
> + goto out;
> + }
> +
> + *action = '\0';
> + action++;
> +
> + /*
> + * Need to do some sanity checking here
> + */
> +
> + if (strcmp(action, ETH_RING_ACTION_ATTACH) == 0)
> + info->list[info->count].action = DEV_ATTACH;
> + else if (strcmp(action, ETH_RING_ACTION_CREATE) == 0)
> + info->list[info->count].action = DEV_CREATE;
> + else
> + goto out;
> +
> + errno = 0;
> + info->list[info->count].node = strtol(node, &end, 10);
> +
> + if ((errno != 0) || (*end != '\0')) {
> + RTE_LOG(WARNING, PMD, "node value %s is unparseable as
> a number\n", node);
> + goto out;
> + }
> +
> + rte_snprintf(info->list[info->count].name, sizeof(info->list[info-
> >count].name), "%s", name);
> +
> + info->count++;
> +
> + ret = 0;
> +out:
> + free(name);
> + return ret;
> +}
> +
> int
> rte_pmd_ring_devinit(const char *name, const char *params)
> {
> + struct rte_kvargs *kvlist;
> + int ret = 0;
> + struct node_action_list *info = NULL;
> +
> RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
>
> +
> if (params == NULL || params[0] == '\0')
> eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
> else {
> - RTE_LOG(INFO, PMD, "Ignoring unsupported parameters
> when creating"
> - " rings-backed ethernet device\n");
> - eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
> + kvlist = rte_kvargs_parse(params, valid_arguments);
> +
> + if (!kvlist) {
> + RTE_LOG(INFO, PMD, "Ignoring unsupported
> parameters when creating"
> + " rings-backed ethernet device\n");
> + eth_dev_ring_create(name, rte_socket_id(),
> DEV_CREATE);
> + return 0;
> + } else {
> + eth_dev_ring_create(name, rte_socket_id(),
> DEV_CREATE);
> + ret = rte_kvargs_count(kvlist,
> ETH_RING_NUMA_NODE_ACTION_ARG);
> + info = rte_zmalloc("struct node_action_list",
> sizeof(struct node_action_list) +
> + (sizeof(struct node_action_pair) *
> ret), 0);
> + if (!info)
> + goto out;
> +
> + info->total = ret;
> + info->list = (struct node_action_pair*)(info + 1);
> +
> + ret = rte_kvargs_process(kvlist,
> ETH_RING_NUMA_NODE_ACTION_ARG,
> + parse_kvlist, info);
> +
> + if (ret < 0)
> + goto out_free;
> +
> + for (info->count = 0; info->count < info->total; info-
> >count++) {
> + eth_dev_ring_pair_create(name, info-
> >list[info->count].node,
> + info->list[info-
> >count].action);
> + }
> +
> + }
> }
> - return 0;
> +
> +out_free:
> + rte_free(info);
> +out:
> + return ret;
> }
>
> static struct rte_vdev_driver pmd_ring_drv = {
> @@ -402,9 +528,4 @@ static struct rte_vdev_driver pmd_ring_drv = {
> .init = rte_pmd_ring_devinit,
> };
>
> -__attribute__((constructor))
> -static void
> -rte_pmd_ring_init(void)
> -{
> - rte_eal_vdev_driver_register(&pmd_ring_drv);
> -}
> +PMD_REGISTER_DRIVER(pmd_ring_drv, PMD_VDEV);
> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
> index e6d09b8..4f167aa 100644
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -133,10 +133,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
> LDLIBS += -lethdev
> endif
>
> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
> -LDLIBS += -lrte_pmd_ring
> -endif
> -
> ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
> LDLIBS += -lrte_malloc
> endif
> @@ -173,9 +169,19 @@ LDLIBS += -lrte_cmdline
> endif
>
> ifeq ($(RTE_BUILD_SHARED_LIB),n)
> +
> +ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
> +LDLIBS += -lrte_pmd_ring
> +endif
> +
> +ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
> +LDLIBS += -lrte_pmd_ring
> +endif
> +
> ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
> LDLIBS += -lrte_pmd_pcap -lpcap
> endif
> +
> endif
>
> LDLIBS += $(EXECENV_LDLIBS)
> --
> 1.8.3.1
Hi Neil,
Sorry for opening this thread again, but I have encountered that the ring PMD unit test (ring_pmd_autotest in the test application) fails, due to this patch, as several functions calls were removed (such as rte_eth_ring_pair_create) . According to the explanation of this patch, you said that using -d/-vdev is required for the test app. Have you checked if unit test worked for you? In that case, could you tell me which parameters are needed, please?
Thanks,
Pablo
^ permalink raw reply [flat|nested] 77+ messages in thread
end of thread, other threads:[~2014-06-13 13:28 UTC | newest]
Thread overview: 77+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 18:05 [dpdk-dev] [PATCH 0/15] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 01/15] makefiles: Fixed -share command line option error Neil Horman
2014-04-16 9:22 ` Thomas Monjalon
2014-04-16 11:00 ` Neil Horman
2014-04-16 11:37 ` Thomas Monjalon
2014-04-16 13:51 ` [dpdk-dev] [PATCH 01/15 v2] " Neil Horman
2014-04-18 11:23 ` Thomas Monjalon
2014-04-18 13:18 ` Neil Horman
2014-04-18 13:29 ` Thomas Monjalon
2014-04-18 17:36 ` Neil Horman
2014-04-21 14:41 ` Neil Horman
2014-04-29 23:42 ` Thomas Monjalon
2014-05-02 11:09 ` Neil Horman
2014-05-02 12:22 ` Thomas Monjalon
2014-05-02 13:01 ` Neil Horman
2014-05-02 13:18 ` Thomas Monjalon
2014-04-15 18:05 ` [dpdk-dev] [PATCH 02/15] make: include whole archive on static link Neil Horman
2014-04-16 9:26 ` Thomas Monjalon
2014-04-16 11:02 ` Neil Horman
2014-04-16 11:40 ` Thomas Monjalon
2014-04-16 13:02 ` Neil Horman
2014-04-16 13:33 ` Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro Neil Horman
2014-04-16 11:52 ` Thomas Monjalon
2014-04-16 12:59 ` John W. Linville
2014-04-16 13:08 ` Neil Horman
2014-04-16 16:11 ` Olivier MATZ
2014-04-16 17:15 ` John W. Linville
2014-04-16 17:29 ` Neil Horman
2014-04-17 8:08 ` Olivier MATZ
2014-04-17 10:59 ` Neil Horman
2014-04-18 11:42 ` Thomas Monjalon
2014-04-18 12:04 ` Neil Horman
2014-04-18 12:08 ` Thomas Monjalon
2014-04-18 13:20 ` Neil Horman
2014-04-18 13:32 ` Thomas Monjalon
2014-04-18 17:42 ` Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 04/15] pcap: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
2014-04-15 18:05 ` [dpdk-dev] [PATCH 05/15] ring: " Neil Horman
2014-04-16 13:53 ` [dpdk-dev] [PATCH 05/15 v2] " Neil Horman
2014-04-17 9:50 ` [dpdk-dev] [PATCH 05/15] " Ananyev, Konstantin
2014-04-17 11:06 ` Neil Horman
2014-04-17 15:16 ` [dpdk-dev] [PATCH 05/15 v3] " Neil Horman
2014-06-13 13:28 ` De Lara Guarch, Pablo
2014-04-15 18:06 ` [dpdk-dev] [PATCH 06/15] xenvirt: " Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 07/15] eal: Make vdev init path generic for both virtual and physcial devices Neil Horman
2014-04-18 12:02 ` Thomas Monjalon
2014-04-15 18:06 ` [dpdk-dev] [PATCH 08/15] igb: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 09/15] igbvf: " Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 10/15] e1000: " Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 11/15] ixgbe: " Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 12/15] ixgbevf: " Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 13/15] virtio: " Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 14/15] vmxnet3: " Neil Horman
2014-04-15 18:06 ` [dpdk-dev] [PATCH 15/15] pmd: Remove rte_pmd_init_all Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 01/14] makefiles: Fixed -share command line option error Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 02/14] pmd: Add PMD_REGISTER_DRIVER macro Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 03/14] pcap: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 04/14] ring: " Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 05/14] xenvirt: " Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 06/14] eal: Make vdev init path generic for both virtual and physcial devices Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 07/14] igb: Convert to use of PMD_REGISTER_DRIVER and fix linking Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 08/14] igbvf: " Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 09/14] e1000: " Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 10/14] ixgbe: " Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 11/14] ixgbevf: " Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 12/14] virtio: " Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 13/14] vmxnet3: " Neil Horman
2014-04-21 14:59 ` [dpdk-dev] [PATCH 0/X v5 14/14] pmd: Remove rte_pmd_init_all Neil Horman
2014-04-21 17:05 ` [dpdk-dev] [PATCH v5 00/14] dpdk: Separate compile time linkage between eal lib and pmd's Neil Horman
2014-04-21 20:10 ` Stephen Hemminger
2014-04-21 20:36 ` Neil Horman
2014-05-16 15:28 ` Neil Horman
2014-05-16 15:39 ` Thomas Monjalon
2014-05-20 12:45 ` Thomas Monjalon
2014-05-20 14:13 ` Neil Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).