* [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure
@ 2016-07-08 19:09 Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra Jan Viktorin
` (16 more replies)
0 siblings, 17 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
Hello,
based on the discussions with Shreyansh, I propose a patchset with
the important EAL changes. It is incomplete and I suppose to extend
and change certain things in the foreseeable future.
Important notes:
* pmd_type is removed
* introduced rte_vdev_driver inheriting rte_driver
* PMD_REGISTER_DRIVER is replaced by RTE_EAL_VDRV_REGISTER
* rte_driver/device integrated into rte_pci_driver/device
* all drivers and devices are in 2 lists - general and bus-specific
Shreyansh, I hope I do not duplicate your work. I tried to avoid touching
pmd_type but it quite complicated... There is also an initial generalization
of rte_pci_resource. More such generalizations are to be done.
The init/uninit functions cannot be generalized easily, I think. Both PCI
and VDEV have different requirements.
No idea about hotplug...
The patchset is based on (all rebased on top of 34d279):
[PATCH v5 00/17] Prepare for rte_device / rte_driver
Thanks anybody for some quick review and notes.
Regards
Jan
--
Jan Viktorin (15):
eal: extract vdev infra
eal: no need to test for PMD_VDEV anymore
eal: do not call init for PMD_PDEV drivers
drivers: convert PMD_VDEV drivers to use rte_vdev_driver
eal: move init/uninit to rte_vdev_driver
eal: remove PMD_REGISTER_DRIVER
eal: get rid of pmd_type
eal: define macro container_of
eal: rte_pci.h includes rte_dev.h
eal: rename and move rte_pci_resource
eal/pci: inherit rte_driver by rte_pci_driver
eal: call rte_eal_driver_register
eal: introduce rte_device
eal/pci: inherit rte_device by rte_pci_device
eal/pci: insert rte_device on scan
app/test/test_pci.c | 10 ++-
app/test/virtual_pmd.c | 6 +-
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 13 ++--
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 13 ++--
drivers/crypto/kasumi/rte_kasumi_pmd.c | 13 ++--
drivers/crypto/null/null_crypto_pmd.c | 13 ++--
drivers/crypto/qat/rte_qat_cryptodev.c | 4 +-
drivers/crypto/snow3g/rte_snow3g_pmd.c | 13 ++--
drivers/net/af_packet/rte_eth_af_packet.c | 11 ++--
drivers/net/bnx2x/bnx2x_ethdev.c | 8 ++-
drivers/net/bonding/rte_eth_bond_pmd.c | 11 ++--
drivers/net/cxgbe/cxgbe_ethdev.c | 4 +-
drivers/net/cxgbe/sge.c | 6 +-
drivers/net/e1000/em_ethdev.c | 4 +-
drivers/net/e1000/igb_ethdev.c | 8 ++-
drivers/net/ena/ena_ethdev.c | 4 +-
drivers/net/enic/enic_ethdev.c | 4 +-
drivers/net/fm10k/fm10k_ethdev.c | 10 +--
drivers/net/i40e/i40e_ethdev.c | 4 +-
drivers/net/i40e/i40e_ethdev_vf.c | 4 +-
drivers/net/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++-
drivers/net/mlx4/mlx4.c | 4 +-
drivers/net/mlx5/mlx5.c | 4 +-
drivers/net/mpipe/mpipe_tilegx.c | 20 +++---
drivers/net/nfp/nfp_net.c | 4 +-
drivers/net/null/rte_eth_null.c | 11 ++--
drivers/net/pcap/rte_eth_pcap.c | 11 ++--
drivers/net/qede/qede_ethdev.c | 4 ++
drivers/net/ring/rte_eth_ring.c | 11 ++--
drivers/net/szedata2/rte_eth_szedata2.c | 8 ++-
drivers/net/vhost/rte_eth_vhost.c | 11 ++--
drivers/net/virtio/virtio_ethdev.c | 6 +-
drivers/net/virtio/virtio_pci.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 7 +-
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 11 ++--
lib/librte_cryptodev/rte_cryptodev.c | 6 +-
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 67 +++----------------
lib/librte_eal/common/eal_common_pci.c | 20 +++---
lib/librte_eal/common/eal_common_vdev.c | 100 +++++++++++++++++++++++++++++
lib/librte_eal/common/include/rte_common.h | 16 +++++
lib/librte_eal/common/include/rte_dev.h | 54 +++++++++-------
lib/librte_eal/common/include/rte_pci.h | 20 ++----
lib/librte_eal/common/include/rte_vdev.h | 96 +++++++++++++++++++++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
lib/librte_eal/linuxapp/eal/eal_ivshmem.c | 2 +-
lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +-
lib/librte_ether/rte_ethdev.c | 16 +++--
51 files changed, 468 insertions(+), 229 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-11 13:29 ` Shreyansh jain
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 02/15] eal: no need to test for PMD_VDEV anymore Jan Viktorin
` (15 subsequent siblings)
16 siblings, 1 reply; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
Move all PMD_VDEV-specific code into a separate module and header
file to not polute the generic code anymore. There is now a list
of virtual devices available.
The rte_vdev_driver integrates the original rte_driver inside
(C inheritance). The rte_driver will be however change in the
future to serve as a common base for all other types of drivers.
The existing PMDs (PMD_VDEV) are to be modified later (there is
no change for them at the moment).
There is however a inconsistency. The functions rte_eal_vdev_init
and rte_eal_vdev_uninit are still placed in the rte_dev.h (instead
of the rte_vdev.h).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 54 +---------------
lib/librte_eal/common/eal_common_vdev.c | 104 +++++++++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 1 +
lib/librte_eal/common/include/rte_vdev.h | 83 ++++++++++++++++++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
7 files changed, 192 insertions(+), 54 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create 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 698fa0a..b7e94a4 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -69,6 +69,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index f5ea0ee..dac7ce7 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_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_dev.h
+INC += rte_hexdump.h rte_devargs.h rte_dev.h rte_vdev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 14c6cf1..f9b3d1d 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -64,32 +64,6 @@ rte_eal_driver_unregister(struct rte_driver *driver)
}
int
-rte_eal_vdev_init(const char *name, const char *args)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->init(name, args);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
-int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
@@ -98,7 +72,7 @@ rte_eal_dev_init(void)
/*
* 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
+ * embedded into PMD modules via the RTE_EAL_VDRV_REGISTER macro
*/
/* call the init function for each virtual device */
@@ -125,32 +99,6 @@ rte_eal_dev_init(void)
return 0;
}
-int
-rte_eal_vdev_uninit(const char *name)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->uninit(name);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
int rte_eal_dev_attach(const char *name, const char *devargs)
{
struct rte_pci_addr addr;
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
new file mode 100644
index 0000000..ea83c41
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -0,0 +1,104 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. 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 RehiveTech 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 <sys/queue.h>
+#include <rte_vdev.h>
+
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_eal_vdrv_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+int
+rte_eal_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
+ return driver->driver.init(name, args);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
+
+int
+rte_eal_vdev_uninit(const char *name)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
+ return driver->driver.uninit(name);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index b1c0520..2aeb752 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -210,6 +210,7 @@ static void devinitfn_ ##d(void)\
rte_eal_driver_register(&d);\
}
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
new file mode 100644
index 0000000..523bd92
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -0,0 +1,83 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. 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 RehiveTech 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
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_eal_vdrv_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_eal_vdrv_unregister(struct rte_vdev_driver *driver);
+
+#define RTE_EAL_VDRV_REGISTER(d)\
+RTE_INIT(vdrvinitfn_ ##d);\
+static void vdrvinitfn_ ##d(void)\
+{\
+ rte_eal_vdrv_register(&d);\
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 30b30f3..9553e97 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -85,6 +85,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 02/15] eal: no need to test for PMD_VDEV anymore
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 03/15] eal: do not call init for PMD_PDEV drivers Jan Viktorin
` (14 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
All devices in the rte_eal_vdev_init/uninit are always virtual devices.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/common/eal_common_vdev.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index ea83c41..5a74da8 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -60,9 +60,6 @@ rte_eal_vdev_init(const char *name, const char *args)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
@@ -86,9 +83,6 @@ rte_eal_vdev_uninit(const char *name)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 03/15] eal: do not call init for PMD_PDEV drivers
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 02/15] eal: no need to test for PMD_VDEV anymore Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 04/15] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Jan Viktorin
` (13 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
There is no way how to call an init on a PMD_PDEV driver as those
drivers are all PCI drivers and they do not register any rte_driver
with EAL. We can drop the loop over PMD_PDEV drivers entirely.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/common/eal_common_dev.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index f9b3d1d..f4c880c 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -67,7 +67,6 @@ int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
- struct rte_driver *driver;
/*
* Note that the dev_driver_list is populated here
@@ -89,13 +88,6 @@ rte_eal_dev_init(void)
}
}
- /* 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;
}
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 04/15] drivers: convert PMD_VDEV drivers to use rte_vdev_driver
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (2 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 03/15] eal: do not call init for PMD_PDEV drivers Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 05/15] eal: move init/uninit to rte_vdev_driver Jan Viktorin
` (12 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
All PMD_VDEV drivers can now use rte_vdev_driver instead of the
rte_driver (which is embedded in the rte_vdev_driver).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 16 +++++++++-------
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 16 +++++++++-------
drivers/crypto/kasumi/rte_kasumi_pmd.c | 16 +++++++++-------
drivers/crypto/null/null_crypto_pmd.c | 16 +++++++++-------
drivers/crypto/snow3g/rte_snow3g_pmd.c | 16 +++++++++-------
drivers/net/af_packet/rte_eth_af_packet.c | 16 +++++++++-------
drivers/net/bonding/rte_eth_bond_pmd.c | 16 +++++++++-------
drivers/net/mpipe/mpipe_tilegx.c | 26 +++++++++++++++-----------
drivers/net/null/rte_eth_null.c | 16 +++++++++-------
drivers/net/pcap/rte_eth_pcap.c | 16 +++++++++-------
drivers/net/ring/rte_eth_ring.c | 16 +++++++++-------
drivers/net/vhost/rte_eth_vhost.c | 16 +++++++++-------
drivers/net/xenvirt/rte_eth_xenvirt.c | 16 +++++++++-------
13 files changed, 123 insertions(+), 95 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 2987ef6..e6720e8 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -37,7 +37,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -514,11 +514,13 @@ aesni_gcm_uninit(const char *name)
return 0;
}
-static struct rte_driver aesni_gcm_pmd_drv = {
- .name = CRYPTODEV_NAME_AESNI_GCM_PMD,
- .type = PMD_VDEV,
- .init = aesni_gcm_init,
- .uninit = aesni_gcm_uninit
+static struct rte_vdev_driver aesni_gcm_pmd_drv = {
+ .driver = {
+ .name = CRYPTODEV_NAME_AESNI_GCM_PMD,
+ .type = PMD_VDEV,
+ .init = aesni_gcm_init,
+ .uninit = aesni_gcm_uninit
+ },
};
-PMD_REGISTER_DRIVER(aesni_gcm_pmd_drv);
+RTE_EAL_VDRV_REGISTER(aesni_gcm_pmd_drv);
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 6554fc4..6c6420b 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -714,11 +714,13 @@ cryptodev_aesni_mb_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
- .name = CRYPTODEV_NAME_AESNI_MB_PMD,
- .type = PMD_VDEV,
- .init = cryptodev_aesni_mb_init,
- .uninit = cryptodev_aesni_mb_uninit
+static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
+ .driver = {
+ .name = CRYPTODEV_NAME_AESNI_MB_PMD,
+ .type = PMD_VDEV,
+ .init = cryptodev_aesni_mb_init,
+ .uninit = cryptodev_aesni_mb_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_aesni_mb_pmd_drv);
+RTE_EAL_VDRV_REGISTER(cryptodev_aesni_mb_pmd_drv);
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 0bf415d..91181c4 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
#include <rte_kvargs.h>
@@ -648,11 +648,13 @@ cryptodev_kasumi_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_kasumi_pmd_drv = {
- .name = CRYPTODEV_NAME_KASUMI_PMD,
- .type = PMD_VDEV,
- .init = cryptodev_kasumi_init,
- .uninit = cryptodev_kasumi_uninit
+static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
+ .driver = {
+ .name = CRYPTODEV_NAME_KASUMI_PMD,
+ .type = PMD_VDEV,
+ .init = cryptodev_kasumi_init,
+ .uninit = cryptodev_kasumi_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_kasumi_pmd_drv);
+RTE_EAL_VDRV_REGISTER(cryptodev_kasumi_pmd_drv);
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index bdaf13c..a015ee5 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,7 @@
#include <rte_common.h>
#include <rte_config.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include "null_crypto_pmd_private.h"
@@ -268,11 +268,13 @@ cryptodev_null_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_null_pmd_drv = {
- .name = CRYPTODEV_NAME_NULL_PMD,
- .type = PMD_VDEV,
- .init = cryptodev_null_init,
- .uninit = cryptodev_null_uninit
+static struct rte_vdev_driver cryptodev_null_pmd_drv = {
+ .driver = {
+ .name = CRYPTODEV_NAME_NULL_PMD,
+ .type = PMD_VDEV,
+ .init = cryptodev_null_init,
+ .uninit = cryptodev_null_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_null_pmd_drv);
+RTE_EAL_VDRV_REGISTER(cryptodev_null_pmd_drv);
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 6d59de7..060e819 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
#include <rte_kvargs.h>
@@ -639,11 +639,13 @@ cryptodev_snow3g_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_snow3g_pmd_drv = {
- .name = CRYPTODEV_NAME_SNOW3G_PMD,
- .type = PMD_VDEV,
- .init = cryptodev_snow3g_init,
- .uninit = cryptodev_snow3g_uninit
+static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
+ .driver = {
+ .name = CRYPTODEV_NAME_SNOW3G_PMD,
+ .type = PMD_VDEV,
+ .init = cryptodev_snow3g_init,
+ .uninit = cryptodev_snow3g_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_snow3g_pmd_drv);
+RTE_EAL_VDRV_REGISTER(cryptodev_snow3g_pmd_drv);
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 36ac102..a42e1b4 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -40,7 +40,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
@@ -871,11 +871,13 @@ rte_pmd_af_packet_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_af_packet_drv = {
- .name = "eth_af_packet",
- .type = PMD_VDEV,
- .init = rte_pmd_af_packet_devinit,
- .uninit = rte_pmd_af_packet_devuninit,
+static struct rte_vdev_driver pmd_af_packet_drv = {
+ .driver = {
+ .name = "eth_af_packet",
+ .type = PMD_VDEV,
+ .init = rte_pmd_af_packet_devinit,
+ .uninit = rte_pmd_af_packet_devuninit,
+ },
};
-PMD_REGISTER_DRIVER(pmd_af_packet_drv);
+RTE_EAL_VDRV_REGISTER(pmd_af_packet_drv);
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 129f04b..01e94b8 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -42,7 +42,7 @@
#include <rte_ip_frag.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_alarm.h>
#include <rte_cycles.h>
@@ -2504,11 +2504,13 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
return 0;
}
-static struct rte_driver bond_drv = {
- .name = "eth_bond",
- .type = PMD_VDEV,
- .init = bond_init,
- .uninit = bond_uninit,
+static struct rte_vdev_driver bond_drv = {
+ .driver = {
+ .name = "eth_bond",
+ .type = PMD_VDEV,
+ .init = bond_init,
+ .uninit = bond_uninit,
+ },
};
-PMD_REGISTER_DRIVER(bond_drv);
+RTE_EAL_VDRV_REGISTER(bond_drv);
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 9de556e..fd8c7a4 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <rte_eal.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_eal_memconfig.h>
#include <rte_ethdev.h>
#include <rte_malloc.h>
@@ -1623,20 +1623,24 @@ rte_pmd_mpipe_devinit(const char *ifname,
return 0;
}
-static struct rte_driver pmd_mpipe_xgbe_drv = {
- .name = "xgbe",
- .type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
+ .driver = {
+ .name = "xgbe",
+ .type = PMD_VDEV,
+ .init = rte_pmd_mpipe_devinit,
+ },
};
-static struct rte_driver pmd_mpipe_gbe_drv = {
- .name = "gbe",
- .type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
+ .driver = {
+ .name = "gbe",
+ .type = PMD_VDEV,
+ .init = rte_pmd_mpipe_devinit,
+ },
};
-PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv);
-PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv);
+RTE_EAL_VDRV_REGISTER(pmd_mpipe_xgbe_drv);
+RTE_EAL_VDRV_REGISTER(pmd_mpipe_gbe_drv);
static void __attribute__((constructor, used))
mpipe_init_contexts(void)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index e6c74a6..56370c9 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -35,7 +35,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_spinlock.h>
@@ -682,11 +682,13 @@ rte_pmd_null_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_null_drv = {
- .name = "eth_null",
- .type = PMD_VDEV,
- .init = rte_pmd_null_devinit,
- .uninit = rte_pmd_null_devuninit,
+static struct rte_vdev_driver pmd_null_drv = {
+ .driver = {
+ .name = "eth_null",
+ .type = PMD_VDEV,
+ .init = rte_pmd_null_devinit,
+ .uninit = rte_pmd_null_devuninit,
+ },
};
-PMD_REGISTER_DRIVER(pmd_null_drv);
+RTE_EAL_VDRV_REGISTER(pmd_null_drv);
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 2d00d04..d59d9bb 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -40,7 +40,7 @@
#include <rte_string_fns.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <net/if.h>
@@ -1083,11 +1083,13 @@ rte_pmd_pcap_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_pcap_drv = {
- .name = "eth_pcap",
- .type = PMD_VDEV,
- .init = rte_pmd_pcap_devinit,
- .uninit = rte_pmd_pcap_devuninit,
+static struct rte_vdev_driver pmd_pcap_drv = {
+ .driver = {
+ .name = "eth_pcap",
+ .type = PMD_VDEV,
+ .init = rte_pmd_pcap_devinit,
+ .uninit = rte_pmd_pcap_devuninit,
+ },
};
-PMD_REGISTER_DRIVER(pmd_pcap_drv);
+RTE_EAL_VDRV_REGISTER(pmd_pcap_drv);
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index b78d1cf..ff15cfd 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -38,7 +38,7 @@
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
@@ -623,11 +623,13 @@ rte_pmd_ring_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_ring_drv = {
- .name = "eth_ring",
- .type = PMD_VDEV,
- .init = rte_pmd_ring_devinit,
- .uninit = rte_pmd_ring_devuninit,
+static struct rte_vdev_driver pmd_ring_drv = {
+ .driver = {
+ .name = "eth_ring",
+ .type = PMD_VDEV,
+ .init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit,
+ },
};
-PMD_REGISTER_DRIVER(pmd_ring_drv);
+RTE_EAL_VDRV_REGISTER(pmd_ring_drv);
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 4e99360..f10944b 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -41,7 +41,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_virtio_net.h>
#include <rte_spinlock.h>
@@ -917,11 +917,13 @@ rte_pmd_vhost_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_vhost_drv = {
- .name = "eth_vhost",
- .type = PMD_VDEV,
- .init = rte_pmd_vhost_devinit,
- .uninit = rte_pmd_vhost_devuninit,
+static struct rte_vdev_driver pmd_vhost_drv = {
+ .driver = {
+ .name = "eth_vhost",
+ .type = PMD_VDEV,
+ .init = rte_pmd_vhost_devinit,
+ .uninit = rte_pmd_vhost_devuninit,
+ },
};
-PMD_REGISTER_DRIVER(pmd_vhost_drv);
+RTE_EAL_VDRV_REGISTER(pmd_vhost_drv);
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 72861d8..1e1a876 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -53,7 +53,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@ -756,11 +756,13 @@ rte_pmd_xenvirt_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_xenvirt_drv = {
- .name = "eth_xenvirt",
- .type = PMD_VDEV,
- .init = rte_pmd_xenvirt_devinit,
- .uninit = rte_pmd_xenvirt_devuninit,
+static struct rte_vdev_driver pmd_xenvirt_drv = {
+ .driver = {
+ .name = "eth_xenvirt",
+ .type = PMD_VDEV,
+ .init = rte_pmd_xenvirt_devinit,
+ .uninit = rte_pmd_xenvirt_devuninit,
+ },
};
-PMD_REGISTER_DRIVER(pmd_xenvirt_drv);
+RTE_EAL_VDRV_REGISTER(pmd_xenvirt_drv);
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 05/15] eal: move init/uninit to rte_vdev_driver
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (3 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 04/15] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 06/15] eal: remove PMD_REGISTER_DRIVER Jan Viktorin
` (11 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
These functions are virtual-device specific and they are never called
for any PCI driver (after introducing RTE_EAL_PCI_REGISTER, there is
no way to do it). All affected drivers are updated.
The prototypes are renamed to rte_vdev_init_t and rte_vdev_uninit_t.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 4 ++--
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 ++--
drivers/crypto/kasumi/rte_kasumi_pmd.c | 4 ++--
drivers/crypto/null/null_crypto_pmd.c | 4 ++--
drivers/crypto/snow3g/rte_snow3g_pmd.c | 4 ++--
drivers/net/af_packet/rte_eth_af_packet.c | 4 ++--
drivers/net/bonding/rte_eth_bond_pmd.c | 4 ++--
drivers/net/mpipe/mpipe_tilegx.c | 4 ++--
drivers/net/null/rte_eth_null.c | 4 ++--
drivers/net/pcap/rte_eth_pcap.c | 4 ++--
drivers/net/ring/rte_eth_ring.c | 4 ++--
drivers/net/vhost/rte_eth_vhost.c | 4 ++--
drivers/net/xenvirt/rte_eth_xenvirt.c | 4 ++--
lib/librte_eal/common/eal_common_vdev.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 12 ------------
lib/librte_eal/common/include/rte_vdev.h | 15 ++++++++++++++-
16 files changed, 42 insertions(+), 41 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index e6720e8..6e45293 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -518,9 +518,9 @@ static struct rte_vdev_driver aesni_gcm_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_AESNI_GCM_PMD,
.type = PMD_VDEV,
- .init = aesni_gcm_init,
- .uninit = aesni_gcm_uninit
},
+ .init = aesni_gcm_init,
+ .uninit = aesni_gcm_uninit,
};
RTE_EAL_VDRV_REGISTER(aesni_gcm_pmd_drv);
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 6c6420b..e7cdcfd 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -718,9 +718,9 @@ static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_AESNI_MB_PMD,
.type = PMD_VDEV,
- .init = cryptodev_aesni_mb_init,
- .uninit = cryptodev_aesni_mb_uninit
},
+ .init = cryptodev_aesni_mb_init,
+ .uninit = cryptodev_aesni_mb_uninit,
};
RTE_EAL_VDRV_REGISTER(cryptodev_aesni_mb_pmd_drv);
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 91181c4..792184a 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -652,9 +652,9 @@ static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_KASUMI_PMD,
.type = PMD_VDEV,
- .init = cryptodev_kasumi_init,
- .uninit = cryptodev_kasumi_uninit
},
+ .init = cryptodev_kasumi_init,
+ .uninit = cryptodev_kasumi_uninit,
};
RTE_EAL_VDRV_REGISTER(cryptodev_kasumi_pmd_drv);
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index a015ee5..5250e3f 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -272,9 +272,9 @@ static struct rte_vdev_driver cryptodev_null_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_NULL_PMD,
.type = PMD_VDEV,
- .init = cryptodev_null_init,
- .uninit = cryptodev_null_uninit
},
+ .init = cryptodev_null_init,
+ .uninit = cryptodev_null_uninit,
};
RTE_EAL_VDRV_REGISTER(cryptodev_null_pmd_drv);
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 060e819..6dc9a2e 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -643,9 +643,9 @@ static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_SNOW3G_PMD,
.type = PMD_VDEV,
- .init = cryptodev_snow3g_init,
- .uninit = cryptodev_snow3g_uninit
},
+ .init = cryptodev_snow3g_init,
+ .uninit = cryptodev_snow3g_uninit,
};
RTE_EAL_VDRV_REGISTER(cryptodev_snow3g_pmd_drv);
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index a42e1b4..66aaf99 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -875,9 +875,9 @@ static struct rte_vdev_driver pmd_af_packet_drv = {
.driver = {
.name = "eth_af_packet",
.type = PMD_VDEV,
- .init = rte_pmd_af_packet_devinit,
- .uninit = rte_pmd_af_packet_devuninit,
},
+ .init = rte_pmd_af_packet_devinit,
+ .uninit = rte_pmd_af_packet_devuninit,
};
RTE_EAL_VDRV_REGISTER(pmd_af_packet_drv);
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 01e94b8..801a481 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2508,9 +2508,9 @@ static struct rte_vdev_driver bond_drv = {
.driver = {
.name = "eth_bond",
.type = PMD_VDEV,
- .init = bond_init,
- .uninit = bond_uninit,
},
+ .init = bond_init,
+ .uninit = bond_uninit,
};
RTE_EAL_VDRV_REGISTER(bond_drv);
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index fd8c7a4..fe7c0c6 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1627,16 +1627,16 @@ static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
.driver = {
.name = "xgbe",
.type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
},
+ .init = rte_pmd_mpipe_devinit,
};
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
.driver = {
.name = "gbe",
.type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
},
+ .init = rte_pmd_mpipe_devinit,
};
RTE_EAL_VDRV_REGISTER(pmd_mpipe_xgbe_drv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 56370c9..85c4526 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -686,9 +686,9 @@ static struct rte_vdev_driver pmd_null_drv = {
.driver = {
.name = "eth_null",
.type = PMD_VDEV,
- .init = rte_pmd_null_devinit,
- .uninit = rte_pmd_null_devuninit,
},
+ .init = rte_pmd_null_devinit,
+ .uninit = rte_pmd_null_devuninit,
};
RTE_EAL_VDRV_REGISTER(pmd_null_drv);
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index d59d9bb..934b77f 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1087,9 +1087,9 @@ static struct rte_vdev_driver pmd_pcap_drv = {
.driver = {
.name = "eth_pcap",
.type = PMD_VDEV,
- .init = rte_pmd_pcap_devinit,
- .uninit = rte_pmd_pcap_devuninit,
},
+ .init = rte_pmd_pcap_devinit,
+ .uninit = rte_pmd_pcap_devuninit,
};
RTE_EAL_VDRV_REGISTER(pmd_pcap_drv);
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index ff15cfd..95245be 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -627,9 +627,9 @@ static struct rte_vdev_driver pmd_ring_drv = {
.driver = {
.name = "eth_ring",
.type = PMD_VDEV,
- .init = rte_pmd_ring_devinit,
- .uninit = rte_pmd_ring_devuninit,
},
+ .init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit,
};
RTE_EAL_VDRV_REGISTER(pmd_ring_drv);
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index f10944b..1c8b33d 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -921,9 +921,9 @@ static struct rte_vdev_driver pmd_vhost_drv = {
.driver = {
.name = "eth_vhost",
.type = PMD_VDEV,
- .init = rte_pmd_vhost_devinit,
- .uninit = rte_pmd_vhost_devuninit,
},
+ .init = rte_pmd_vhost_devinit,
+ .uninit = rte_pmd_vhost_devuninit,
};
RTE_EAL_VDRV_REGISTER(pmd_vhost_drv);
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 1e1a876..b97246b 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -760,9 +760,9 @@ static struct rte_vdev_driver pmd_xenvirt_drv = {
.driver = {
.name = "eth_xenvirt",
.type = PMD_VDEV,
- .init = rte_pmd_xenvirt_devinit,
- .uninit = rte_pmd_xenvirt_devuninit,
},
+ .init = rte_pmd_xenvirt_devinit,
+ .uninit = rte_pmd_xenvirt_devuninit,
};
RTE_EAL_VDRV_REGISTER(pmd_xenvirt_drv);
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 5a74da8..7e7ddd1 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -67,7 +67,7 @@ rte_eal_vdev_init(const char *name, const char *args)
* So use strncmp to compare.
*/
if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
- return driver->driver.init(name, args);
+ return driver->init(name, args);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
@@ -90,7 +90,7 @@ rte_eal_vdev_uninit(const char *name)
* So use strncmp to compare.
*/
if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
- return driver->driver.uninit(name);
+ return driver->uninit(name);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 2aeb752..63fc454 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,16 +105,6 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
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);
-
-/**
- * Uninitilization function called for each device driver once.
- */
-typedef int (rte_dev_uninit_t)(const char *name);
-
-/**
* Driver type enumeration
*/
enum pmd_type {
@@ -129,8 +119,6 @@ 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. */
- rte_dev_uninit_t *uninit; /**< Device uninit. function. */
};
/**
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 523bd92..709aa2e 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -43,12 +43,25 @@ extern "C" {
/** Double linked list of virtual device drivers. */
TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * Initialization function called for each device driver once.
+ */
+typedef int (rte_vdev_init_t)(const char *name, const char *args);
+
+/**
+ * Uninitilization function called for each device driver once.
+ */
+typedef int (rte_vdev_uninit_t)(const char *name);
+
/**
* A virtual device driver abstraction.
*/
struct rte_vdev_driver {
TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
- struct rte_driver driver; /**< Inherited general driver. */
+ struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_init_t *init; /**< Virtual device init. function. */
+ rte_vdev_uninit_t *uninit; /**< Virtual device uninit. function. */
};
/**
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 06/15] eal: remove PMD_REGISTER_DRIVER
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (4 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 05/15] eal: move init/uninit to rte_vdev_driver Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 07/15] eal: get rid of pmd_type Jan Viktorin
` (10 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
All devices register themselfs by calling a kind of RTE_EAL_*_REGISTER.
The PMD_REGISTER_DRIVER is not used anymore.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/common/include/rte_dev.h | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 63fc454..2fa85f7 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -191,16 +191,4 @@ int rte_eal_dev_attach(const char *name, const char *devargs);
*/
int rte_eal_dev_detach(const char *name);
-#define PMD_REGISTER_DRIVER(d)\
-RTE_INIT(devinitfn_ ##d);\
-static void devinitfn_ ##d(void)\
-{\
- rte_eal_driver_register(&d);\
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
#endif /* _RTE_VDEV_H_ */
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 07/15] eal: get rid of pmd_type
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (5 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 06/15] eal: remove PMD_REGISTER_DRIVER Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 08/15] eal: define macro container_of Jan Viktorin
` (9 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
There is no need to determine a PMD type any more. The PMD_VDEV devices
has its own list of drivers. And all PMD_PDEV are PCI devices using
a different way of registering themselfs.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 1 -
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 1 -
drivers/crypto/kasumi/rte_kasumi_pmd.c | 1 -
drivers/crypto/null/null_crypto_pmd.c | 1 -
drivers/crypto/snow3g/rte_snow3g_pmd.c | 1 -
drivers/net/af_packet/rte_eth_af_packet.c | 1 -
drivers/net/bonding/rte_eth_bond_pmd.c | 1 -
drivers/net/mpipe/mpipe_tilegx.c | 2 --
drivers/net/null/rte_eth_null.c | 1 -
drivers/net/pcap/rte_eth_pcap.c | 1 -
drivers/net/ring/rte_eth_ring.c | 1 -
drivers/net/vhost/rte_eth_vhost.c | 1 -
drivers/net/xenvirt/rte_eth_xenvirt.c | 1 -
lib/librte_eal/common/include/rte_dev.h | 9 ---------
14 files changed, 23 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 6e45293..dfa1001 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -517,7 +517,6 @@ aesni_gcm_uninit(const char *name)
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_AESNI_GCM_PMD,
- .type = PMD_VDEV,
},
.init = aesni_gcm_init,
.uninit = aesni_gcm_uninit,
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index e7cdcfd..3265f83 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -717,7 +717,6 @@ cryptodev_aesni_mb_uninit(const char *name)
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_AESNI_MB_PMD,
- .type = PMD_VDEV,
},
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit,
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 792184a..c39b0a1 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -651,7 +651,6 @@ cryptodev_kasumi_uninit(const char *name)
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_KASUMI_PMD,
- .type = PMD_VDEV,
},
.init = cryptodev_kasumi_init,
.uninit = cryptodev_kasumi_uninit,
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 5250e3f..5ad8b86 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -271,7 +271,6 @@ cryptodev_null_uninit(const char *name)
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_NULL_PMD,
- .type = PMD_VDEV,
},
.init = cryptodev_null_init,
.uninit = cryptodev_null_uninit,
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 6dc9a2e..9fc5c64 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -642,7 +642,6 @@ cryptodev_snow3g_uninit(const char *name)
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
.driver = {
.name = CRYPTODEV_NAME_SNOW3G_PMD,
- .type = PMD_VDEV,
},
.init = cryptodev_snow3g_init,
.uninit = cryptodev_snow3g_uninit,
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 66aaf99..9d0c6d3 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -874,7 +874,6 @@ rte_pmd_af_packet_devuninit(const char *name)
static struct rte_vdev_driver pmd_af_packet_drv = {
.driver = {
.name = "eth_af_packet",
- .type = PMD_VDEV,
},
.init = rte_pmd_af_packet_devinit,
.uninit = rte_pmd_af_packet_devuninit,
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 801a481..a3846e6 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2507,7 +2507,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
static struct rte_vdev_driver bond_drv = {
.driver = {
.name = "eth_bond",
- .type = PMD_VDEV,
},
.init = bond_init,
.uninit = bond_uninit,
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index fe7c0c6..9d5cc6d 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1626,7 +1626,6 @@ rte_pmd_mpipe_devinit(const char *ifname,
static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
.driver = {
.name = "xgbe",
- .type = PMD_VDEV,
},
.init = rte_pmd_mpipe_devinit,
};
@@ -1634,7 +1633,6 @@ static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
.driver = {
.name = "gbe",
- .type = PMD_VDEV,
},
.init = rte_pmd_mpipe_devinit,
};
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 85c4526..39eb5d0 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -685,7 +685,6 @@ rte_pmd_null_devuninit(const char *name)
static struct rte_vdev_driver pmd_null_drv = {
.driver = {
.name = "eth_null",
- .type = PMD_VDEV,
},
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit,
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 934b77f..be5a21a 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1086,7 +1086,6 @@ rte_pmd_pcap_devuninit(const char *name)
static struct rte_vdev_driver pmd_pcap_drv = {
.driver = {
.name = "eth_pcap",
- .type = PMD_VDEV,
},
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit,
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 95245be..cdb2efd 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -626,7 +626,6 @@ rte_pmd_ring_devuninit(const char *name)
static struct rte_vdev_driver pmd_ring_drv = {
.driver = {
.name = "eth_ring",
- .type = PMD_VDEV,
},
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit,
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 1c8b33d..9a1c4ac 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -920,7 +920,6 @@ rte_pmd_vhost_devuninit(const char *name)
static struct rte_vdev_driver pmd_vhost_drv = {
.driver = {
.name = "eth_vhost",
- .type = PMD_VDEV,
},
.init = rte_pmd_vhost_devinit,
.uninit = rte_pmd_vhost_devuninit,
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index b97246b..38d7a68 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -759,7 +759,6 @@ rte_pmd_xenvirt_devuninit(const char *name)
static struct rte_vdev_driver pmd_xenvirt_drv = {
.driver = {
.name = "eth_xenvirt",
- .type = PMD_VDEV,
},
.init = rte_pmd_xenvirt_devinit,
.uninit = rte_pmd_xenvirt_devuninit,
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 2fa85f7..225257e 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,19 +105,10 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * 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. */
};
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 08/15] eal: define macro container_of
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (6 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 07/15] eal: get rid of pmd_type Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 09/15] eal: rte_pci.h includes rte_dev.h Jan Viktorin
` (8 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 332f2a4..a9b6792 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -322,6 +322,22 @@ rte_bsf32(uint32_t v)
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#endif
+/**
+ * Return pointer to the wrapping struct instance.
+ * Example:
+ *
+ * struct wrapper {
+ * ...
+ * struct child c;
+ * ...
+ * };
+ *
+ * struct child *x = obtain(...);
+ * struct wrapper *w = container_of(x, struct wrapper, c);
+ */
+#define container_of(p, type, member) \
+ ((type *) (((char *) (p)) - offsetof(type, member)))
+
#define _RTE_STR(x) #x
/** Take a macro value and get a string version of it */
#define RTE_STR(x) _RTE_STR(x)
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 09/15] eal: rte_pci.h includes rte_dev.h
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (7 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 08/15] eal: define macro container_of Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 10/15] eal: rename and move rte_pci_resource Jan Viktorin
` (7 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
Further refactoring and generalization of PCI infrastructure will
require access to the rte_dev.h contents.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/common/include/rte_pci.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index eed6b56..ec77cbc 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -84,6 +84,7 @@ extern "C" {
#include <rte_debug.h>
#include <rte_interrupts.h>
+#include <rte_dev.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 10/15] eal: rename and move rte_pci_resource
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (8 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 09/15] eal: rte_pci.h includes rte_dev.h Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 11/15] eal/pci: inherit rte_driver by rte_pci_driver Jan Viktorin
` (6 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
There is no need to have a custom memory resource representation for
each infrastructure (PCI, ...) as it would always have the same members.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
drivers/net/szedata2/rte_eth_szedata2.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 9 +++++++++
lib/librte_eal/common/include/rte_pci.h | 11 +----------
lib/librte_eal/linuxapp/eal/eal_ivshmem.c | 2 +-
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 6815dbb..d925bc6 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1416,7 +1416,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
int ret;
uint32_t szedata2_index;
struct rte_pci_addr *pci_addr = &dev->pci_dev->addr;
- struct rte_pci_resource *pci_rsc =
+ struct rte_mem_resource *pci_rsc =
&dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER];
char rsc_filename[PATH_MAX];
void *pci_resource_ptr = NULL;
@@ -1473,7 +1473,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, dev->pci_dev);
- /* mmap pci resource0 file to rte_pci_resource structure */
+ /* mmap pci resource0 file to rte_mem_resource structure */
if (dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].phys_addr ==
0) {
RTE_LOG(ERR, PMD, "Missing resource%u file\n",
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 225257e..2a0d326 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -100,6 +100,15 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
} \
} while (0)
+/**
+ * A generic memory resource representation.
+ */
+struct rte_mem_resource {
+ uint64_t phys_addr; /**< Physical address, 0 if not resource. */
+ uint64_t len; /**< Length of the resource. */
+ void *addr; /**< Virtual address, NULL when not mapped. */
+};
+
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index ec77cbc..950ea89 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -111,15 +111,6 @@ const char *pci_get_sysfs_path(void);
/** Default sysfs path for PCI device search. */
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
-/**
- * A structure describing a PCI resource.
- */
-struct rte_pci_resource {
- uint64_t phys_addr; /**< Physical address, 0 if no resource. */
- uint64_t len; /**< Length of the resource. */
- void *addr; /**< Virtual address, NULL when not mapped. */
-};
-
/** Maximum number of PCI resources. */
#define PCI_MAX_RESOURCE 6
@@ -163,7 +154,7 @@ struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
- struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
+ struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
diff --git a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c
index 67b3caf..20f9413 100644
--- a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c
+++ b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c
@@ -834,7 +834,7 @@ rte_eal_ivshmem_obj_init(void)
int rte_eal_ivshmem_init(void)
{
struct rte_pci_device * dev;
- struct rte_pci_resource * res;
+ struct rte_mem_resource * res;
int fd, ret;
char path[PATH_MAX];
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 11/15] eal/pci: inherit rte_driver by rte_pci_driver
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (9 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 10/15] eal: rename and move rte_pci_resource Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 12/15] eal: call rte_eal_driver_register Jan Viktorin
` (5 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
app/test/test_pci.c | 10 +++++++---
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 4 +++-
drivers/net/bnx2x/bnx2x_ethdev.c | 8 ++++++--
drivers/net/cxgbe/cxgbe_ethdev.c | 4 +++-
drivers/net/cxgbe/sge.c | 6 +++---
drivers/net/e1000/em_ethdev.c | 4 +++-
drivers/net/e1000/igb_ethdev.c | 8 ++++++--
drivers/net/ena/ena_ethdev.c | 4 +++-
drivers/net/enic/enic_ethdev.c | 4 +++-
drivers/net/fm10k/fm10k_ethdev.c | 4 +++-
drivers/net/i40e/i40e_ethdev.c | 4 +++-
drivers/net/i40e/i40e_ethdev_vf.c | 4 +++-
drivers/net/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++--
drivers/net/mlx4/mlx4.c | 4 +++-
drivers/net/mlx5/mlx5.c | 4 +++-
drivers/net/nfp/nfp_net.c | 4 +++-
drivers/net/qede/qede_ethdev.c | 4 ++++
drivers/net/szedata2/rte_eth_szedata2.c | 4 +++-
drivers/net/virtio/virtio_ethdev.c | 6 ++++--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 7 +++++--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
lib/librte_cryptodev/rte_cryptodev.c | 4 ++--
lib/librte_eal/common/eal_common_pci.c | 4 ++--
lib/librte_eal/common/include/rte_pci.h | 4 +++-
lib/librte_ether/rte_ethdev.c | 4 ++--
27 files changed, 89 insertions(+), 38 deletions(-)
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index 354a0ad..9be08f9 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -78,14 +78,18 @@ struct rte_pci_id my_driver_id2[] = {
};
struct rte_pci_driver my_driver = {
- .name = "test_driver",
+ .driver = {
+ .name = "test_driver",
+ },
.devinit = my_driver_init,
.id_table = my_driver_id,
.drv_flags = 0,
};
struct rte_pci_driver my_driver2 = {
- .name = "test_driver2",
+ .driver = {
+ .name = "test_driver2",
+ },
.devinit = my_driver_init,
.id_table = my_driver_id2,
.drv_flags = 0,
@@ -95,7 +99,7 @@ static int
my_driver_init(__attribute__((unused)) struct rte_pci_driver *dr,
struct rte_pci_device *dev)
{
- printf("My driver init called in %s\n", dr->name);
+ printf("My driver init called in %s\n", dr->driver.name);
printf("%x:%x:%x.%d", dev->addr.domain, dev->addr.bus,
dev->addr.devid, dev->addr.function);
printf(" - vendor:%x device:%x\n", dev->id.vendor_id, dev->id.device_id);
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 8a1f0d0..56eeb99 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -586,7 +586,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
pci_dev->numa_node = socket_id;
- pci_drv->name = virtual_ethdev_driver_name;
+ pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
if (isr_support)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 970970a..fab8bd8 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -114,7 +114,9 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
static struct rte_cryptodev_driver rte_qat_pmd = {
.pci_drv = {
- .name = "rte_qat_pmd",
+ .driver = {
+ .name = "rte_qat_pmd",
+ },
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_cryptodev_pci_probe,
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 5ab3c75..062a93f 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -503,7 +503,9 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_bnx2x_pmd = {
.pci_drv = {
- .name = "rte_bnx2x_pmd",
+ .driver = {
+ .name = "rte_bnx2x_pmd",
+ },
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.devinit = rte_eth_dev_pci_probe,
@@ -520,7 +522,9 @@ RTE_EAL_PCI_REGISTER(rte_bnx2x_pmd);
*/
static struct eth_driver rte_bnx2xvf_pmd = {
.pci_drv = {
- .name = "rte_bnx2xvf_pmd",
+ .driver = {
+ .name = "rte_bnx2xvf_pmd",
+ },
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 1389371..33934c3 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -866,7 +866,9 @@ out_free_adapter:
static struct eth_driver rte_cxgbe_pmd = {
.pci_drv = {
- .name = "rte_cxgbe_pmd",
+ .driver = {
+ .name = "rte_cxgbe_pmd",
+ },
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index ab5a842..c03c760 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1645,7 +1645,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
iq->size = cxgbe_roundup(iq->size, 16);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, fwevtq ? "fwq_ring" : "rx_ring",
+ eth_dev->driver->pci_drv.driver.name, fwevtq ? "fwq_ring" : "rx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1697,7 +1697,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
fl->size = cxgbe_roundup(fl->size, 8);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
fwevtq ? "fwq_ring" : "fl_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1893,7 +1893,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, "tx_ring",
+ eth_dev->driver->pci_drv.driver.name, "tx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index c67e67f..2de3075 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -364,7 +364,9 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_em_pmd = {
.pci_drv = {
- .name = "rte_em_pmd",
+ .driver = {
+ .name = "rte_em_pmd",
+ },
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a523944..c414c03 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -979,7 +979,9 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_igb_pmd = {
.pci_drv = {
- .name = "rte_igb_pmd",
+ .driver = {
+ .name = "rte_igb_pmd",
+ },
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -998,7 +1000,9 @@ RTE_EAL_PCI_REGISTER(rte_igb_pmd);
*/
static struct eth_driver rte_igbvf_pmd = {
.pci_drv = {
- .name = "rte_igbvf_pmd",
+ .driver = {
+ .name = "rte_igbvf_pmd",
+ },
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index dc32435..35fffc0 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1428,7 +1428,9 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
static struct eth_driver rte_ena_pmd = {
.pci_drv = {
- .name = "rte_ena_pmd",
+ .driver = {
+ .name = "rte_ena_pmd",
+ },
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index d5e395d..0eb7948 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -657,7 +657,9 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_enic_pmd = {
.pci_drv = {
- .name = "rte_enic_pmd",
+ .driver = {
+ .name = "rte_enic_pmd",
+ },
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8ec8f5e..4ffa66c 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3060,7 +3060,9 @@ static const struct rte_pci_id pci_id_fm10k_map[] = {
static struct eth_driver rte_pmd_fm10k = {
.pci_drv = {
- .name = "rte_pmd_fm10k",
+ .driver = {
+ .name = "rte_pmd_fm10k",
+ },
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f2712ab..0eb82f8 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -641,7 +641,9 @@ static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
static struct eth_driver rte_i40e_pmd = {
.pci_drv = {
- .name = "rte_i40e_pmd",
+ .driver = {
+ .name = "rte_i40e_pmd",
+ },
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 3411831..f67f9fa 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1552,7 +1552,9 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
*/
static struct eth_driver rte_i40evf_pmd = {
.pci_drv = {
- .name = "rte_i40evf_pmd",
+ .driver = {
+ .name = "rte_i40evf_pmd",
+ },
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 8aa41e5..0a79dd1 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -249,7 +249,7 @@ i40e_fdir_setup(struct i40e_pf *pf)
/* reserve memory for the fdir programming packet */
snprintf(z_name, sizeof(z_name), "%s_%s_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
I40E_FDIR_MZ_NAME,
eth_dev->data->port_id);
mz = i40e_memzone_reserve(z_name, I40E_FDIR_PKT_LEN, SOCKET_ID_ANY);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index dd521e8..82a81fa 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1489,7 +1489,9 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_ixgbe_pmd = {
.pci_drv = {
- .name = "rte_ixgbe_pmd",
+ .driver = {
+ .name = "rte_ixgbe_pmd",
+ },
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1508,7 +1510,9 @@ RTE_EAL_PCI_REGISTER(rte_ixgbe_pmd);
*/
static struct eth_driver rte_ixgbevf_pmd = {
.pci_drv = {
- .name = "rte_ixgbevf_pmd",
+ .driver = {
+ .name = "rte_ixgbevf_pmd",
+ },
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index ba42c33..310d98c 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5829,7 +5829,9 @@ static const struct rte_pci_id mlx4_pci_id_map[] = {
static struct eth_driver mlx4_driver = {
.pci_drv = {
- .name = MLX4_DRIVER_NAME,
+ .driver = {
+ .name = MLX4_DRIVER_NAME,
+ },
.id_table = mlx4_pci_id_map,
.devinit = mlx4_pci_devinit,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index f6399fc..3f6509a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -638,7 +638,9 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
static struct eth_driver mlx5_driver = {
.pci_drv = {
- .name = MLX5_DRIVER_NAME,
+ .driver = {
+ .name = MLX5_DRIVER_NAME,
+ },
.id_table = mlx5_pci_id_map,
.devinit = mlx5_pci_devinit,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 951c8b4..69c2678 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2464,7 +2464,9 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
static struct eth_driver rte_nfp_net_pmd = {
.pci_drv = {
- .name = "rte_nfp_net_pmd",
+ .driver = {
+ .name = "rte_nfp_net_pmd",
+ },
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 4fcb54c..6d06f53 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1052,7 +1052,9 @@ static struct rte_pci_id pci_id_qede_map[] = {
static struct eth_driver rte_qedevf_pmd = {
.pci_drv = {
+ .driver {
.name = "rte_qedevf_pmd",
+ },
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
@@ -1066,7 +1068,9 @@ static struct eth_driver rte_qedevf_pmd = {
static struct eth_driver rte_qede_pmd = {
.pci_drv = {
+ .driver = {
.name = "rte_qede_pmd",
+ },
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index d925bc6..c0d6963 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1572,7 +1572,9 @@ static const struct rte_pci_id rte_szedata2_pci_id_table[] = {
static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
- .name = RTE_SZEDATA2_PCI_DRIVER_NAME,
+ .driver = {
+ .name = RTE_SZEDATA2_PCI_DRIVER_NAME,
+ },
.id_table = rte_szedata2_pci_id_table,
.devinit = rte_eth_dev_pci_probe,
.devuninit = rte_eth_dev_pci_remove,
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 9f5faf1..9c06c46 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1252,7 +1252,9 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_virtio_pmd = {
.pci_drv = {
- .name = "rte_virtio_pmd",
+ .driver = {
+ .name = "rte_virtio_pmd",
+ },
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
@@ -1473,7 +1475,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct virtio_hw *hw = dev->data->dev_private;
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = VIRTIO_MIN_RX_BUFSIZE;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 79c5f6d..a7438d1 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -138,7 +138,8 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%d_%s",
- dev->driver->pci_drv.name, dev->data->port_id, post_string);
+ dev->driver->pci_drv.driver.name,
+ dev->data->port_id, post_string);
mz = rte_memzone_lookup(z_name);
if (mz)
@@ -329,7 +330,9 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_vmxnet3_pmd = {
.pci_drv = {
- .name = "rte_vmxnet3_pmd",
+ .driver = {
+ .name = "rte_vmxnet3_pmd",
+ },
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index ccafc0c..536f0ac 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -772,7 +772,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 3b587e4..afb13d7 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -370,7 +370,7 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
- " failed", pci_drv->name,
+ " failed", pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
@@ -781,7 +781,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
dev_info->pci_dev = dev->pci_dev;
if (dev->driver)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
}
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index d05dda4..3bcb059 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -193,7 +193,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
}
RTE_LOG(INFO, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
/* map resources for devices that use igb_uio */
@@ -253,7 +253,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
loc->function, dev->numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->devuninit && (dr->devuninit(dev) < 0))
return -1; /* negative value is an error */
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 950ea89..139d76f 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -202,13 +202,15 @@ typedef int (pci_devuninit_t)(struct rte_pci_device *);
*/
struct rte_pci_driver {
TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */
- const char *name; /**< Driver name. */
+ struct rte_driver driver; /**< Inherit the core driver. */
pci_devinit_t *devinit; /**< Device init. function. */
pci_devuninit_t *devuninit; /**< Device uninit function. */
const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
uint32_t drv_flags; /**< Flags contolling handling of device. */
};
+#define to_pci_driver(drv) container_of((drv), struct rte_pci_driver, driver)
+
/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
#define RTE_PCI_DRV_NEED_MAPPING 0x0001
/** Device needs to be unbound even if no module is provided */
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 48c7254..f2e0716 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2562,7 +2562,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -3216,7 +3216,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->kdrv = pci_dev->kdrv;
eth_dev->data->numa_node = pci_dev->numa_node;
- eth_dev->data->drv_name = pci_dev->driver->name;
+ eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
int
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 12/15] eal: call rte_eal_driver_register
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (10 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 11/15] eal/pci: inherit rte_driver by rte_pci_driver Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 13/15] eal: introduce rte_device Jan Viktorin
` (4 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
To register both vdev and pci drivers into the list of all rte_driver,
we have to call rte_eal_driver_register explicitly.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/common/eal_common_pci.c | 2 ++
lib/librte_eal/common/eal_common_vdev.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 3bcb059..144479e 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -468,11 +468,13 @@ void
rte_eal_pci_register(struct rte_pci_driver *driver)
{
TAILQ_INSERT_TAIL(&pci_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_pci_unregister(struct rte_pci_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&pci_driver_list, driver, next);
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 7e7ddd1..389db3e 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -42,12 +42,14 @@ void
rte_eal_vdrv_register(struct rte_vdev_driver *driver)
{
TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&vdev_driver_list, driver, next);
}
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 13/15] eal: introduce rte_device
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (11 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 12/15] eal: call rte_eal_driver_register Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 14/15] eal/pci: inherit rte_device by rte_pci_device Jan Viktorin
` (3 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/common/eal_common_dev.c | 13 +++++++++++++
lib/librte_eal/common/include/rte_dev.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index f4c880c..2c2a1bd 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -48,6 +48,9 @@
/** Global list of device drivers. */
static struct rte_driver_list dev_driver_list =
TAILQ_HEAD_INITIALIZER(dev_driver_list);
+/** Global list of device drivers. */
+static struct rte_device_list dev_device_list =
+ TAILQ_HEAD_INITIALIZER(dev_device_list);
/* register a driver */
void
@@ -63,6 +66,16 @@ rte_eal_driver_unregister(struct rte_driver *driver)
TAILQ_REMOVE(&dev_driver_list, driver, next);
}
+void rte_eal_device_insert(struct rte_device *dev)
+{
+ TAILQ_INSERT_TAIL(&dev_device_list, dev, next);
+}
+
+void rte_eal_device_remove(struct rte_device *dev)
+{
+ TAILQ_REMOVE(&dev_device_list, dev, next);
+}
+
int
rte_eal_dev_init(void)
{
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 2a0d326..d767012 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -112,6 +112,37 @@ struct rte_mem_resource {
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
+/** Double linked list of devices. */
+TAILQ_HEAD(rte_device_list, rte_device);
+
+/* Forward declaration */
+struct rte_driver;
+
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+ TAILQ_ENTRY(rte_device) next; /**< Next device */
+ struct rte_driver *driver; /**< Associated driver */
+ int numa_node; /**< NUMA node connection */
+ struct rte_devargs *devargs; /**< Device user arguments */
+};
+
+/**
+ * Insert a device detected by a bus scanning.
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the detected device.
+ */
+void rte_eal_device_insert(struct rte_device *dev);
+
+/**
+ * Remove a device (e.g. when being unplugged).
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the device to be removed.
+ */
+void rte_eal_device_remove(struct rte_device *dev);
/**
* A structure describing a device driver.
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 14/15] eal/pci: inherit rte_device by rte_pci_device
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (12 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 13/15] eal: introduce rte_device Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 15/15] eal/pci: insert rte_device on scan Jan Viktorin
` (2 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
app/test/virtual_pmd.c | 4 ++--
drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
drivers/net/virtio/virtio_pci.c | 2 +-
lib/librte_cryptodev/rte_cryptodev.c | 2 +-
lib/librte_eal/common/eal_common_pci.c | 14 +++++++-------
lib/librte_eal/common/include/rte_pci.h | 4 +---
lib/librte_eal/linuxapp/eal/eal_pci.c | 4 ++--
lib/librte_ether/rte_ethdev.c | 14 +++++++++-----
8 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 56eeb99..4831113 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -585,7 +585,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
if (eth_dev == NULL)
goto err;
- pci_dev->numa_node = socket_id;
+ pci_dev->device.numa_node = socket_id;
pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
@@ -626,7 +626,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
eth_dev->dev_ops = &dev_private->dev_ops;
eth_dev->pci_dev = pci_dev;
- eth_dev->pci_dev->driver = ð_drv->pci_drv;
+ eth_dev->pci_dev->device.driver = ð_drv->pci_drv.driver;
eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success;
eth_dev->tx_pkt_burst = virtual_ethdev_tx_burst_success;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 4ffa66c..4230a75 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -675,7 +675,7 @@ fm10k_dev_tx_init(struct rte_eth_dev *dev)
/* Enable use of FTAG bit in TX descriptor, PFVTCTL
* register is read-only for VF.
*/
- if (fm10k_check_ftag(dev->pci_dev->devargs)) {
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs)) {
if (hw->mac.type == fm10k_mac_pf) {
FM10K_WRITE_REG(hw, FM10K_PFVTCTL(i),
FM10K_PFVTCTL_FTAG_DESC_ENABLE);
@@ -2734,7 +2734,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
int use_sse = 1;
uint16_t tx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
tx_ftag_en = 1;
for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -2767,7 +2767,7 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)
uint16_t i, rx_using_sse;
uint16_t rx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
rx_ftag_en = 1;
/* In order to allow Vector Rx there are a few configuration
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 9c9a3dd..6fbfa39 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -719,7 +719,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
- dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) {
+ dev->device.devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) {
PMD_INIT_LOG(INFO,
"skip kernel managed virtio device.");
return 1;
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index afb13d7..d2a2a60 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -401,7 +401,7 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (cryptodev == NULL)
return -ENODEV;
- cryptodrv = (const struct rte_cryptodev_driver *)pci_dev->driver;
+ cryptodrv = (const struct rte_cryptodev_driver *)to_pci_driver(pci_dev->device.driver);
if (cryptodrv == NULL)
return -ENODEV;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 144479e..66ceba6 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -183,11 +183,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
RTE_LOG(INFO, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid, loc->function,
- dev->numa_node);
+ dev->device.numa_node);
/* no initialization when blacklisted, return without error */
- if (dev->devargs != NULL &&
- dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {
+ if (dev->device.devargs != NULL &&
+ dev->device.devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {
RTE_LOG(DEBUG, EAL, " Device is blacklisted, not initializing\n");
return 1;
}
@@ -208,7 +208,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
}
/* reference driver structure */
- dev->driver = dr;
+ dev->device.driver = &dr->driver;
/* call the driver devinit() function */
return dr->devinit(dr, dev);
@@ -250,7 +250,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid,
- loc->function, dev->numa_node);
+ loc->function, dev->device.numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->driver.name);
@@ -259,7 +259,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
return -1; /* negative value is an error */
/* clear driver structure */
- dev->driver = NULL;
+ dev->device.driver = NULL;
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
/* unmap resources for devices that use igb_uio */
@@ -415,7 +415,7 @@ rte_eal_pci_probe(void)
/* set devargs in PCI structure */
devargs = pci_devargs_lookup(dev);
if (devargs != NULL)
- dev->devargs = devargs;
+ dev->device.devargs = devargs;
/* probe all or only whitelisted devices */
if (probe_all)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 139d76f..2f78ec4 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -152,14 +152,12 @@ enum rte_kernel_driver {
*/
struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
+ struct rte_device device; /**< Inherited device. */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */
- struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
- int numa_node; /**< NUMA node connection */
- struct rte_devargs *devargs; /**< Device user arguments */
enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
};
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 0a368c5..6f1a28a 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -350,13 +350,13 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
dirname);
if (access(filename, R_OK) != 0) {
/* if no NUMA support, set default to 0 */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
} else {
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
free(dev);
return -1;
}
- dev->numa_node = tmp;
+ dev->device.numa_node = tmp;
}
/* parse resources */
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f2e0716..be12687 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -303,7 +303,7 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (eth_dev == NULL)
return -ENODEV;
- eth_drv = (const struct eth_driver *)pci_dev->driver;
+ eth_drv = (const struct eth_driver *)to_pci_driver(pci_dev->device.driver);
/* Invoke PMD device uninit function */
if (*eth_drv->eth_dev_uninit) {
@@ -3202,21 +3202,25 @@ rte_eth_dev_get_dcb_info(uint8_t port_id,
void
rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
{
+ struct rte_pci_driver *pci_drv;
+
if ((eth_dev == NULL) || (pci_dev == NULL)) {
RTE_PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
eth_dev, pci_dev);
return;
}
+ pci_drv = to_pci_driver(pci_dev->device.driver);
+
eth_dev->data->dev_flags = 0;
- if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
+ if (pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)
eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
- if (pci_dev->driver->drv_flags & RTE_PCI_DRV_DETACHABLE)
+ if (pci_drv->drv_flags & RTE_PCI_DRV_DETACHABLE)
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = pci_dev->kdrv;
- eth_dev->data->numa_node = pci_dev->numa_node;
- eth_dev->data->drv_name = pci_dev->driver->driver.name;
+ eth_dev->data->numa_node = pci_dev->device.numa_node;
+ eth_dev->data->drv_name = pci_dev->device.driver->name;
}
int
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v1 15/15] eal/pci: insert rte_device on scan
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (13 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 14/15] eal/pci: inherit rte_device by rte_pci_device Jan Viktorin
@ 2016-07-08 19:09 ` Jan Viktorin
2016-07-11 13:13 ` [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Shreyansh jain
2016-07-15 13:19 ` Thomas Monjalon
16 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-08 19:09 UTC (permalink / raw)
To: dev; +Cc: Jan Viktorin, Shreyansh Jain, thomas.monjalon, David Marchand
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 6f1a28a..ab08a16 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -390,6 +390,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
/* device is valid, add in list (sorted) */
if (TAILQ_EMPTY(&pci_device_list)) {
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
} else {
struct rte_pci_device *dev2;
@@ -402,6 +403,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
if (ret < 0) {
TAILQ_INSERT_BEFORE(dev2, dev, next);
+ rte_eal_device_insert(&dev->device);
} else { /* already registered */
dev2->kdrv = dev->kdrv;
dev2->max_vfs = dev->max_vfs;
@@ -411,6 +413,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
return 0;
}
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
}
--
2.9.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (14 preceding siblings ...)
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 15/15] eal/pci: insert rte_device on scan Jan Viktorin
@ 2016-07-11 13:13 ` Shreyansh jain
2016-07-15 13:19 ` Thomas Monjalon
16 siblings, 0 replies; 21+ messages in thread
From: Shreyansh jain @ 2016-07-11 13:13 UTC (permalink / raw)
To: Jan Viktorin, dev; +Cc: thomas.monjalon, David Marchand
Hi Jan,
On Saturday 09 July 2016 12:39 AM, Jan Viktorin wrote:
> Hello,
>
> based on the discussions with Shreyansh, I propose a patchset with
> the important EAL changes. It is incomplete and I suppose to extend
> and change certain things in the foreseeable future.
>
> Important notes:
>
> * pmd_type is removed
> * introduced rte_vdev_driver inheriting rte_driver
> * PMD_REGISTER_DRIVER is replaced by RTE_EAL_VDRV_REGISTER
> * rte_driver/device integrated into rte_pci_driver/device
> * all drivers and devices are in 2 lists - general and bus-specific
>
> Shreyansh, I hope I do not duplicate your work. I tried to avoid touching
> pmd_type but it quite complicated... There is also an initial generalization
> of rte_pci_resource. More such generalizations are to be done.
My mistake - I didn't even notice this email somehow. In fact, I noticed right when I was about to send the v6 - while searching for my old conversation.
I will look through these patches and remove any conflicting change (as much as possible) - I don't think it there would much conflicts except the VDEV area.
And, cursory look shows not much duplication - don't worry.
>
> The init/uninit functions cannot be generalized easily, I think. Both PCI
> and VDEV have different requirements.
>
> No idea about hotplug...
>
>
> The patchset is based on (all rebased on top of 34d279):
>
> [PATCH v5 00/17] Prepare for rte_device / rte_driver
>
>
> Thanks anybody for some quick review and notes.
Added to my list of todo. I will review and reply soon.
>
> Regards
> Jan
-
Shreyansh
[...]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra Jan Viktorin
@ 2016-07-11 13:29 ` Shreyansh jain
2016-07-11 14:08 ` Jan Viktorin
0 siblings, 1 reply; 21+ messages in thread
From: Shreyansh jain @ 2016-07-11 13:29 UTC (permalink / raw)
To: Jan Viktorin, dev; +Cc: thomas.monjalon, David Marchand
Hi Jan,
Some comments.
On Saturday 09 July 2016 12:39 AM, Jan Viktorin wrote:
> Move all PMD_VDEV-specific code into a separate module and header
> file to not polute the generic code anymore. There is now a list
> of virtual devices available.
>
> The rte_vdev_driver integrates the original rte_driver inside
> (C inheritance). The rte_driver will be however change in the
> future to serve as a common base for all other types of drivers.
>
> The existing PMDs (PMD_VDEV) are to be modified later (there is
> no change for them at the moment).
>
> There is however a inconsistency. The functions rte_eal_vdev_init
> and rte_eal_vdev_uninit are still placed in the rte_dev.h (instead
> of the rte_vdev.h).
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> ---
> lib/librte_eal/bsdapp/eal/Makefile | 1 +
> lib/librte_eal/common/Makefile | 2 +-
> lib/librte_eal/common/eal_common_dev.c | 54 +---------------
> lib/librte_eal/common/eal_common_vdev.c | 104 +++++++++++++++++++++++++++++++
> lib/librte_eal/common/include/rte_dev.h | 1 +
> lib/librte_eal/common/include/rte_vdev.h | 83 ++++++++++++++++++++++++
> lib/librte_eal/linuxapp/eal/Makefile | 1 +
> 7 files changed, 192 insertions(+), 54 deletions(-)
> create mode 100644 lib/librte_eal/common/eal_common_vdev.c
> create 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 698fa0a..b7e94a4 100644
> --- a/lib/librte_eal/bsdapp/eal/Makefile
> +++ b/lib/librte_eal/bsdapp/eal/Makefile
[...]
> diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
> new file mode 100644
> index 0000000..ea83c41
> --- /dev/null
> +++ b/lib/librte_eal/common/eal_common_vdev.c
> @@ -0,0 +1,104 @@
> +/*-
> + * BSD LICENSE
> + *
> + * Copyright(c) 2016 RehiveTech. 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 RehiveTech 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 <sys/queue.h>
> +#include <rte_vdev.h>
> +
> +struct vdev_driver_list vdev_driver_list =
> + TAILQ_HEAD_INITIALIZER(vdev_driver_list);
> +
> +/* register a driver */
> +void
> +rte_eal_vdrv_register(struct rte_vdev_driver *driver)
> +{
> + TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
> +}
> +
> +/* unregister a driver */
> +void
> +rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
> +{
> + TAILQ_REMOVE(&vdev_driver_list, driver, next);
> +}
> +
> +int
> +rte_eal_vdev_init(const char *name, const char *args)
> +{
> + struct rte_vdev_driver *driver;
> +
> + if (name == NULL)
> + return -EINVAL;
> +
> + TAILQ_FOREACH(driver, &vdev_driver_list, next) {
> + if (driver->driver.type != PMD_VDEV)
> + continue;
Now that two separate lists for vdev and pdev exist, we don't need this check anymore.
In fact, PMD_VDEV might not even exist.
> +
> + /*
> + * search a driver prefix in virtual device name.
> + * For example, if the driver is pcap PMD, driver->name
> + * will be "eth_pcap", but "name" will be "eth_pcapN".
> + * So use strncmp to compare.
> + */
> + if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
> + return driver->driver.init(name, args);
> + }
> +
> + RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
> + return -EINVAL;
> +}
> +
> +int
> +rte_eal_vdev_uninit(const char *name)
> +{
> + struct rte_vdev_driver *driver;
> +
> + if (name == NULL)
> + return -EINVAL;
> +
> + TAILQ_FOREACH(driver, &vdev_driver_list, next) {
> + if (driver->driver.type != PMD_VDEV)
> + continue;
Same as above, redundant check.
> +
> + /*
> + * search a driver prefix in virtual device name.
> + * For example, if the driver is pcap PMD, driver->name
> + * will be "eth_pcap", but "name" will be "eth_pcapN".
> + * So use strncmp to compare.
> + */
> + if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
> + return driver->driver.uninit(name);
> + }
> +
> + RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
> + return -EINVAL;
> +}
> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
> index b1c0520..2aeb752 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -210,6 +210,7 @@ static void devinitfn_ ##d(void)\
> rte_eal_driver_register(&d);\
> }
>
> +
Probably a stray newline.
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
> new file mode 100644
> index 0000000..523bd92
> --- /dev/null
> +++ b/lib/librte_eal/common/include/rte_vdev.h
> @@ -0,0 +1,83 @@
> +/*-
> + * BSD LICENSE
> + *
> + * Copyright(c) 2016 RehiveTech. 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 RehiveTech 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
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <sys/queue.h>
> +#include <rte_dev.h>
> +
> +/** Double linked list of virtual device drivers. */
> +TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
> +
> +/**
> + * A virtual device driver abstraction.
> + */
> +struct rte_vdev_driver {
> + TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
> + struct rte_driver driver; /**< Inherited general driver. */
> +};
> +
> +/**
> + * Register a virtual device driver.
> + *
> + * @param driver
> + * A pointer to a rte_vdev_driver structure describing the driver
> + * to be registered.
> + */
> +void rte_eal_vdrv_register(struct rte_vdev_driver *driver);
> +
> +/**
> + * Unregister a virtual device driver.
> + *
> + * @param driver
> + * A pointer to a rte_vdev_driver structure describing the driver
> + * to be unregistered.
> + */
> +void rte_eal_vdrv_unregister(struct rte_vdev_driver *driver);
> +
> +#define RTE_EAL_VDRV_REGISTER(d)\
In the recent commits, I noticed that macros have taken the (name, driver) format.
PMD_REGISTER_DRIVER() (now redundant), DRIVER_REGISTER_PCI_TABLE() ... etc
It might be better to stick to the same format.
> +RTE_INIT(vdrvinitfn_ ##d);\
> +static void vdrvinitfn_ ##d(void)\
> +{\
> + rte_eal_vdrv_register(&d);\
> +}
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
> index 30b30f3..9553e97 100644
> --- a/lib/librte_eal/linuxapp/eal/Makefile
> +++ b/lib/librte_eal/linuxapp/eal/Makefile
> @@ -85,6 +85,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
> SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
> SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
> SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
> +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
> SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
> SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
> SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra
2016-07-11 13:29 ` Shreyansh jain
@ 2016-07-11 14:08 ` Jan Viktorin
0 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-11 14:08 UTC (permalink / raw)
To: Shreyansh jain; +Cc: dev, thomas.monjalon, David Marchand
On Mon, 11 Jul 2016 18:59:48 +0530
Shreyansh jain <shreyansh.jain@nxp.com> wrote:
> Hi Jan,
>
> Some comments.
>
> On Saturday 09 July 2016 12:39 AM, Jan Viktorin wrote:
> > Move all PMD_VDEV-specific code into a separate module and header
> > file to not polute the generic code anymore. There is now a list
> > of virtual devices available.
> >
> > The rte_vdev_driver integrates the original rte_driver inside
> > (C inheritance). The rte_driver will be however change in the
> > future to serve as a common base for all other types of drivers.
> >
> > The existing PMDs (PMD_VDEV) are to be modified later (there is
> > no change for them at the moment).
> >
> > There is however a inconsistency. The functions rte_eal_vdev_init
> > and rte_eal_vdev_uninit are still placed in the rte_dev.h (instead
> > of the rte_vdev.h).
> >
> > Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> > ---
[...]
> > +
> > +/* unregister a driver */
> > +void
> > +rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
> > +{
> > + TAILQ_REMOVE(&vdev_driver_list, driver, next);
> > +}
> > +
> > +int
> > +rte_eal_vdev_init(const char *name, const char *args)
> > +{
> > + struct rte_vdev_driver *driver;
> > +
> > + if (name == NULL)
> > + return -EINVAL;
> > +
> > + TAILQ_FOREACH(driver, &vdev_driver_list, next) {
> > + if (driver->driver.type != PMD_VDEV)
> > + continue;
>
> Now that two separate lists for vdev and pdev exist, we don't need this check anymore.
> In fact, PMD_VDEV might not even exist.
Solved already in the next 2 patches.
>
> > +
> > + /*
> > + * search a driver prefix in virtual device name.
> > + * For example, if the driver is pcap PMD, driver->name
> > + * will be "eth_pcap", but "name" will be "eth_pcapN".
> > + * So use strncmp to compare.
> > + */
> > + if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
> > + return driver->driver.init(name, args);
> > + }
> > +
> > + RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
> > + return -EINVAL;
> > +}
> > +
> > +int
> > +rte_eal_vdev_uninit(const char *name)
> > +{
> > + struct rte_vdev_driver *driver;
> > +
> > + if (name == NULL)
> > + return -EINVAL;
> > +
> > + TAILQ_FOREACH(driver, &vdev_driver_list, next) {
> > + if (driver->driver.type != PMD_VDEV)
> > + continue;
>
> Same as above, redundant check.
Solved already in the next 2 patches.
>
> > +
> > + /*
> > + * search a driver prefix in virtual device name.
> > + * For example, if the driver is pcap PMD, driver->name
> > + * will be "eth_pcap", but "name" will be "eth_pcapN".
> > + * So use strncmp to compare.
> > + */
> > + if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
> > + return driver->driver.uninit(name);
> > + }
> > +
> > + RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
> > + return -EINVAL;
> > +}
> > diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
> > index b1c0520..2aeb752 100644
> > --- a/lib/librte_eal/common/include/rte_dev.h
> > +++ b/lib/librte_eal/common/include/rte_dev.h
> > @@ -210,6 +210,7 @@ static void devinitfn_ ##d(void)\
> > rte_eal_driver_register(&d);\
> > }
> >
> > +
>
> Probably a stray newline.
Will fix.
>
> > #ifdef __cplusplus
> > }
> > #endif
> > diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
> > new file mode 100644
> > index 0000000..523bd92
> > --- /dev/null
> > +++ b/lib/librte_eal/common/include/rte_vdev.h
> > @@ -0,0 +1,83 @@
[...]
> > +/**
> > + * Unregister a virtual device driver.
> > + *
> > + * @param driver
> > + * A pointer to a rte_vdev_driver structure describing the driver
> > + * to be unregistered.
> > + */
> > +void rte_eal_vdrv_unregister(struct rte_vdev_driver *driver);
> > +
> > +#define RTE_EAL_VDRV_REGISTER(d)\
>
> In the recent commits, I noticed that macros have taken the (name, driver) format.
> PMD_REGISTER_DRIVER() (now redundant), DRIVER_REGISTER_PCI_TABLE() ... etc
> It might be better to stick to the same format.
Yes, I will change this when rebasing.
Thanks
Jan
>
> > +RTE_INIT(vdrvinitfn_ ##d);\
> > +static void vdrvinitfn_ ##d(void)\
> > +{\
> > + rte_eal_vdrv_register(&d);\
> > +}
> > +
> > +#ifdef __cplusplus
> > +}
> > +#endif
> > +
> > +#endif
> > diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
> > index 30b30f3..9553e97 100644
> > --- a/lib/librte_eal/linuxapp/eal/Makefile
> > +++ b/lib/librte_eal/linuxapp/eal/Makefile
> > @@ -85,6 +85,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
> > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
> > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
> > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
> > +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
> > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
> > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
> > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
> >
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
` (15 preceding siblings ...)
2016-07-11 13:13 ` [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Shreyansh jain
@ 2016-07-15 13:19 ` Thomas Monjalon
2016-07-15 15:33 ` Jan Viktorin
16 siblings, 1 reply; 21+ messages in thread
From: Thomas Monjalon @ 2016-07-15 13:19 UTC (permalink / raw)
To: Jan Viktorin, Shreyansh Jain, David Marchand; +Cc: dev
2016-07-08 21:09, Jan Viktorin:
> Hello,
>
> based on the discussions with Shreyansh, I propose a patchset with
> the important EAL changes. It is incomplete and I suppose to extend
> and change certain things in the foreseeable future.
>
> Important notes:
>
> * pmd_type is removed
> * introduced rte_vdev_driver inheriting rte_driver
> * PMD_REGISTER_DRIVER is replaced by RTE_EAL_VDRV_REGISTER
> * rte_driver/device integrated into rte_pci_driver/device
> * all drivers and devices are in 2 lists - general and bus-specific
>
> Shreyansh, I hope I do not duplicate your work. I tried to avoid touching
> pmd_type but it quite complicated... There is also an initial generalization
> of rte_pci_resource. More such generalizations are to be done.
>
> The init/uninit functions cannot be generalized easily, I think. Both PCI
> and VDEV have different requirements.
>
> No idea about hotplug...
Please could you give a clear overview of how you split the work in
your respective series?
I take the opportunity to put my notes about some initial targets of
this refactoring:
module/drivers
attached to 1 bus: pci_driver or vdev_driver
rte_device = device resources / embedded in pci/vdev_driver
attached to n device interfaces (ethdev, crypto)
1 device resource -> n device interfaces
hotplug resource -> lookup drivers list
per-bus lists or 1 list?
devinit/devuninit generalized and moved to rte_driver
-> rename to probe/remove
crypto.dev_type could be dropped
drv_flags should be moved to rte_driver
intr_init can be moved earlier in init, before affinity set
devices
unique_device_name -> standard naming?
difference with port_id ? -> device id for ethdev
should be unique_resource_name -> 1 EAL resource may match several devices
ethdev manage an interface, eal manage a hardware resource, device object in between?
need for bus object?
no need of driver object, module object?
devargs, intr_handle, numa_node should be moved to rte_device
hotplug notification to do
notify free-able ressource?
remove blacklist at EAL level and let application handle it
devargs still in hotplug function, must be moved in separate API
devargs
new API
new command line parameters
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure
2016-07-15 13:19 ` Thomas Monjalon
@ 2016-07-15 15:33 ` Jan Viktorin
0 siblings, 0 replies; 21+ messages in thread
From: Jan Viktorin @ 2016-07-15 15:33 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: Shreyansh Jain, David Marchand, dev
On Fri, 15 Jul 2016 15:19:14 +0200
Thomas Monjalon <thomas.monjalon@6wind.com> wrote:
> 2016-07-08 21:09, Jan Viktorin:
> > Hello,
> >
> > based on the discussions with Shreyansh, I propose a patchset with
> > the important EAL changes. It is incomplete and I suppose to extend
> > and change certain things in the foreseeable future.
> >
> > Important notes:
> >
> > * pmd_type is removed
> > * introduced rte_vdev_driver inheriting rte_driver
> > * PMD_REGISTER_DRIVER is replaced by RTE_EAL_VDRV_REGISTER
> > * rte_driver/device integrated into rte_pci_driver/device
> > * all drivers and devices are in 2 lists - general and bus-specific
> >
> > Shreyansh, I hope I do not duplicate your work. I tried to avoid touching
> > pmd_type but it quite complicated... There is also an initial generalization
> > of rte_pci_resource. More such generalizations are to be done.
> >
> > The init/uninit functions cannot be generalized easily, I think. Both PCI
> > and VDEV have different requirements.
> >
> > No idea about hotplug...
>
> Please could you give a clear overview of how you split the work in
> your respective series?
Yes, it's a bit messy... My quick summary follows.
>
> I take the opportunity to put my notes about some initial targets of
> this refactoring:
>
> module/drivers
> attached to 1 bus: pci_driver or vdev_driver
pci_driver is done by Shreyansh/David
vdev_driver is done by myself
> rte_device = device resources / embedded in pci/vdev_driver
Extraction of rte_device is done by myself
> attached to n device interfaces (ethdev, crypto)
> 1 device resource -> n device interfaces
I am not sure, what those two points means exactly.
> hotplug resource -> lookup drivers list
> per-bus lists or 1 list?
Not sure. At least partially done by Shreyansh/David.
> devinit/devuninit generalized and moved to rte_driver
> -> rename to probe/remove
Some renames done by Shreyansh/David.
There will be no move. The vdev_driver has different kind of init/uninit
then PCI. So I cannot see a simple way how to generalize this.
I'll do the final init->probe, uninit->remove renames.
> crypto.dev_type could be dropped
I am not sure about this.
> drv_flags should be moved to rte_driver
I'll do.
> intr_init can be moved earlier in init, before affinity set
> devices
Done by Shreyansh/David.
> unique_device_name -> standard naming?
Done for PCI: rte_eal_pci_device_name by Shreyansh/David.
> difference with port_id ? -> device id for ethdev
Not sure.
> should be unique_resource_name -> 1 EAL resource may match several devices
Not sure.
> ethdev manage an interface, eal manage a hardware resource, device object in between?
Not sure about the question.
> need for bus object?
I don't think so at this stage.
> no need of driver object, module object?
The current rte_driver will not exist. Same for any kind of module.
> devargs, intr_handle, numa_node should be moved to rte_device
Yes, done by myself.
> hotplug notification to do
> notify free-able ressource?
> remove blacklist at EAL level and let application handle it
> devargs still in hotplug function, must be moved in separate API
> devargs
> new API
> new command line parameters
>
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2016-07-15 15:34 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra Jan Viktorin
2016-07-11 13:29 ` Shreyansh jain
2016-07-11 14:08 ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 02/15] eal: no need to test for PMD_VDEV anymore Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 03/15] eal: do not call init for PMD_PDEV drivers Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 04/15] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 05/15] eal: move init/uninit to rte_vdev_driver Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 06/15] eal: remove PMD_REGISTER_DRIVER Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 07/15] eal: get rid of pmd_type Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 08/15] eal: define macro container_of Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 09/15] eal: rte_pci.h includes rte_dev.h Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 10/15] eal: rename and move rte_pci_resource Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 11/15] eal/pci: inherit rte_driver by rte_pci_driver Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 12/15] eal: call rte_eal_driver_register Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 13/15] eal: introduce rte_device Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 14/15] eal/pci: inherit rte_device by rte_pci_device Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 15/15] eal/pci: insert rte_device on scan Jan Viktorin
2016-07-11 13:13 ` [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Shreyansh jain
2016-07-15 13:19 ` Thomas Monjalon
2016-07-15 15:33 ` Jan Viktorin
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).