* [dpdk-dev] [PATCH v2 01/42] eal: add name field to generic device
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 02/42] eal: parse "driver" device argument before probing drivers Gaetan Rivet
` (41 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
This adds a name field to the generic struct rte_device. The EAL is
checking for the name being populated when registering a device but
doesn't enforce global unique names as this is left to the bus
implementations.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 +++
lib/librte_eal/common/eal_common_dev.c | 3 +++
lib/librte_eal/common/eal_common_vdev.c | 2 ++
lib/librte_eal/common/include/rte_dev.h | 1 +
lib/librte_eal/common/include/rte_pci.h | 1 +
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 +++
6 files changed, 13 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 1e9031c..6e289da 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -282,6 +282,9 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
/* FreeBSD has no NUMA support (yet) */
dev->device.numa_node = 0;
+ rte_eal_pci_device_name(&dev->addr, dev->name, sizeof(dev->name));
+ dev->device.name = dev->name;
+
/* FreeBSD has only one pass through driver */
dev->kdrv = RTE_KDRV_NIC_UIO;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 01e37c4..badf918 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -70,6 +70,9 @@ rte_eal_driver_unregister(struct rte_driver *driver)
void rte_eal_device_insert(struct rte_device *dev)
{
+ RTE_VERIFY(dev->name);
+ RTE_VERIFY(dev->name[0] != '\0');
+
TAILQ_INSERT_TAIL(&dev_device_list, dev, next);
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 22fe2ca..c922297 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -180,6 +180,7 @@ rte_eal_vdev_init(const char *name, const char *args)
dev->device.devargs = devargs;
dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->virt.drv_name;
ret = vdev_probe_all_drivers(dev);
if (ret) {
@@ -271,6 +272,7 @@ vdev_scan(void)
dev->device.devargs = devargs;
dev->device.numa_node = SOCKET_ID_ANY;
+ dev->device.name = devargs->virt.drv_name;
rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 4251099..67c2b0c 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -122,6 +122,7 @@ struct rte_driver;
*/
struct rte_device {
TAILQ_ENTRY(rte_device) next; /**< Next device */
+ const char *name; /**< Device name */
const struct rte_driver *driver;/**< Associated driver */
int numa_node; /**< NUMA node connection */
struct rte_devargs *devargs; /**< Device user arguments */
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index de0641a..7ec9980 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -172,6 +172,7 @@ struct rte_pci_device {
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
+ char name[PCI_PRI_STR_SIZE+1]; /**< PCI location (ASCII) */
};
/**
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 7897e15..ab5f8c6 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -324,6 +324,9 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
dev->device.numa_node = tmp;
}
+ rte_eal_pci_device_name(addr, dev->name, sizeof(dev->name));
+ dev->device.name = dev->name;
+
/* parse resources */
snprintf(filename, sizeof(filename), "%s/resource", dirname);
if (pci_parse_sysfs_resource(filename, dev) < 0) {
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 02/42] eal: parse "driver" device argument before probing drivers
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 01/42] eal: add name field to generic device Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-05-10 2:34 ` Ferruh Yigit
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 03/42] net/nfp: use library function for DMA zone reserve Gaetan Rivet
` (40 subsequent siblings)
42 siblings, 1 reply; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
In some cases the virtual device name should be totally different than
the driver being used for the device. Therefore lets parse the devargs for
the "driver" argument before probing drivers in vdev_probe_all_drivers().
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
lib/librte_eal/common/eal_common_vdev.c | 51 +++++++++++++++++++++++++++++----
1 file changed, 46 insertions(+), 5 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index c922297..9158a1c 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -72,12 +72,51 @@ rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
TAILQ_REMOVE(&vdev_driver_list, driver, next);
}
+/*
+ * Parse "driver" devargs without adding a dependency on rte_kvargs.h
+ */
+static char *parse_driver_arg(const char *args)
+{
+ const char *c;
+ char *str;
+
+ if (!args || args[0] == '\0')
+ return NULL;
+
+ c = args;
+
+ do {
+ if (strncmp(c, "driver=", 7) == 0) {
+ c += 7;
+ break;
+ }
+
+ c = strchr(c, ',');
+ if (c)
+ c++;
+ } while (c);
+
+ if (c)
+ str = strdup(c);
+ else
+ str = NULL;
+
+ return str;
+}
+
static int
vdev_probe_all_drivers(struct rte_vdev_device *dev)
{
- const char *name = rte_vdev_device_name(dev);
+ const char *name;
+ char *drv_name;
struct rte_vdev_driver *driver;
- int ret;
+ int ret = 1;
+
+ drv_name = parse_driver_arg(rte_vdev_device_args(dev));
+ name = drv_name ? drv_name : rte_vdev_device_name(dev);
+
+ RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
+ rte_vdev_device_name(dev));
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
/*
@@ -92,7 +131,7 @@ vdev_probe_all_drivers(struct rte_vdev_device *dev)
ret = driver->probe(dev);
if (ret)
dev->device.driver = NULL;
- return ret;
+ goto out;
}
}
@@ -105,11 +144,13 @@ vdev_probe_all_drivers(struct rte_vdev_device *dev)
ret = driver->probe(dev);
if (ret)
dev->device.driver = NULL;
- return ret;
+ break;
}
}
- return 1;
+out:
+ free(drv_name);
+ return ret;
}
static struct rte_vdev_device *
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH v2 02/42] eal: parse "driver" device argument before probing drivers
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 02/42] eal: parse "driver" device argument before probing drivers Gaetan Rivet
@ 2017-05-10 2:34 ` Ferruh Yigit
2017-05-10 11:01 ` Ferruh Yigit
0 siblings, 1 reply; 104+ messages in thread
From: Ferruh Yigit @ 2017-05-10 2:34 UTC (permalink / raw)
To: Gaetan Rivet, Jan Blunck; +Cc: dev
On 4/11/2017 4:44 PM, Gaetan Rivet wrote:
> From: Jan Blunck <jblunck@infradead.org>
>
> In some cases the virtual device name should be totally different than
> the driver being used for the device. Therefore lets parse the devargs for
> the "driver" argument before probing drivers in vdev_probe_all_drivers().
Hi Gaetan, Jan,
I have caught this while checking something else.
This patch adds an alternative way for virtual devices to get probed
when device name is not proper.
This probing can be done by having "driver=<driver_name>" in device
argument (not in name).
Do we really need this alternative method, as far as I can see only user
of this is a unit test for bonding?
This method is a little hidden/undocumented and a hack solution, I think
it is better and easier to fix virtual device names in unit test and
remove this, what do you think?
Thanks,
ferruh
>
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
<...>
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH v2 02/42] eal: parse "driver" device argument before probing drivers
2017-05-10 2:34 ` Ferruh Yigit
@ 2017-05-10 11:01 ` Ferruh Yigit
0 siblings, 0 replies; 104+ messages in thread
From: Ferruh Yigit @ 2017-05-10 11:01 UTC (permalink / raw)
To: Gaetan Rivet, Jan Blunck; +Cc: dev
On 5/10/2017 3:34 AM, Ferruh Yigit wrote:
> On 4/11/2017 4:44 PM, Gaetan Rivet wrote:
>> From: Jan Blunck <jblunck@infradead.org>
>>
>> In some cases the virtual device name should be totally different than
>> the driver being used for the device. Therefore lets parse the devargs for
>> the "driver" argument before probing drivers in vdev_probe_all_drivers().
>
> Hi Gaetan, Jan,
>
> I have caught this while checking something else.
>
> This patch adds an alternative way for virtual devices to get probed
> when device name is not proper.
>
> This probing can be done by having "driver=<driver_name>" in device
> argument (not in name).
>
> Do we really need this alternative method, as far as I can see only user
> of this is a unit test for bonding?
>
> This method is a little hidden/undocumented and a hack solution, I think
> it is better and easier to fix virtual device names in unit test and
> remove this, what do you think?
I am suggesting: http://dpdk.org/dev/patchwork/patch/24196/
>
> Thanks,
> ferruh
>
>>
>> Signed-off-by: Jan Blunck <jblunck@infradead.org>
> <...>
>
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 03/42] net/nfp: use library function for DMA zone reserve
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 01/42] eal: add name field to generic device Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 02/42] eal: parse "driver" device argument before probing drivers Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 04/42] ether: add allocation helper for virtual drivers Gaetan Rivet
` (39 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
This driver can use the library function rte_eth_dma_zone_reserve()
instead of duplicating the code.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/nfp/nfp_net.c | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 1a7a992..d06b10a 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -204,26 +204,6 @@ nn_cfg_writeq(struct nfp_net_hw *hw, int off, uint64_t val)
nn_writeq(rte_cpu_to_le_64(val), hw->ctrl_bar + off);
}
-/* Creating memzone for hardware rings. */
-static const struct rte_memzone *
-ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
- uint16_t queue_id, uint32_t ring_size, int socket_id)
-{
- char z_name[RTE_MEMZONE_NAMESIZE];
- const struct rte_memzone *mz;
-
- snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.driver.name,
- ring_name, dev->data->port_id, queue_id);
-
- mz = rte_memzone_lookup(z_name);
- if (mz)
- return mz;
-
- return rte_memzone_reserve_aligned(z_name, ring_size, socket_id, 0,
- NFP_MEMZONE_ALIGN);
-}
-
/*
* Atomically reads link status information from global structure rte_eth_dev.
*
@@ -1455,9 +1435,10 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev,
* handle the maximum ring size is allocated in order to allow for
* resizing in later calls to the queue setup function.
*/
- tz = ring_dma_zone_reserve(dev, "rx_ring", queue_idx,
+ tz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx,
sizeof(struct nfp_net_rx_desc) *
- NFP_NET_MAX_RX_DESC, socket_id);
+ NFP_NET_MAX_RX_DESC, NFP_MEMZONE_ALIGN,
+ socket_id);
if (tz == NULL) {
RTE_LOG(ERR, PMD, "Error allocatig rx dma\n");
@@ -1597,9 +1578,10 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
* handle the maximum ring size is allocated in order to allow for
* resizing in later calls to the queue setup function.
*/
- tz = ring_dma_zone_reserve(dev, "tx_ring", queue_idx,
+ tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx,
sizeof(struct nfp_net_tx_desc) *
- NFP_NET_MAX_TX_DESC, socket_id);
+ NFP_NET_MAX_TX_DESC, NFP_MEMZONE_ALIGN,
+ socket_id);
if (tz == NULL) {
RTE_LOG(ERR, PMD, "Error allocating tx dma\n");
nfp_net_tx_queue_release(txq);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 04/42] ether: add allocation helper for virtual drivers
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (2 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 03/42] net/nfp: use library function for DMA zone reserve Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 05/42] net/tap: use ethdev allocation helper for virtual devices Gaetan Rivet
` (38 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
This helper should be used by ethdev drivers supporting virtual devices
to help allocating a new ethdev and properly filling the default fields.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
lib/librte_ether/Makefile | 1 +
lib/librte_ether/rte_ethdev_vdev.h | 85 ++++++++++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+)
create mode 100644 lib/librte_ether/rte_ethdev_vdev.h
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index 066114b..d0017b8 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -50,6 +50,7 @@ SRCS-y += rte_flow.c
# Export include files
#
SYMLINK-y-include += rte_ethdev.h
+SYMLINK-y-include += rte_ethdev_vdev.h
SYMLINK-y-include += rte_eth_ctrl.h
SYMLINK-y-include += rte_dev_info.h
SYMLINK-y-include += rte_flow.h
diff --git a/lib/librte_ether/rte_ethdev_vdev.h b/lib/librte_ether/rte_ethdev_vdev.h
new file mode 100644
index 0000000..0b47535
--- /dev/null
+++ b/lib/librte_ether/rte_ethdev_vdev.h
@@ -0,0 +1,85 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Brocade Communications Systems, Inc.
+ * Author: Jan Blunck <jblunck@infradead.org>
+ *
+ * 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 the copyright holder 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_ETHDEV_VDEV_H_
+#define _RTE_ETHDEV_VDEV_H_
+
+#include <rte_malloc.h>
+#include <rte_vdev.h>
+#include <rte_ethdev.h>
+
+/**
+ * @internal
+ * Allocates a new ethdev slot for an ethernet device and returns the pointer
+ * to that slot for the driver to use.
+ *
+ * @param dev
+ * Pointer to virtual device
+ *
+ * @param private_data_size
+ * Size of private data structure
+ *
+ * @return
+ * A pointer to a rte_eth_dev or NULL if allocation failed.
+ */
+static inline struct rte_eth_dev *
+rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)
+{
+ struct rte_eth_dev *eth_dev;
+ const char *name = rte_vdev_device_name(dev);
+
+ eth_dev = rte_eth_dev_allocate(name);
+ if (!eth_dev)
+ return NULL;
+
+ if (private_data_size) {
+ eth_dev->data->dev_private = rte_zmalloc_socket(name,
+ private_data_size, RTE_CACHE_LINE_SIZE,
+ dev->device.numa_node);
+ if (!eth_dev->data->dev_private) {
+ rte_eth_dev_release_port(eth_dev);
+ return NULL;
+ }
+ }
+
+ eth_dev->device = &dev->device;
+ eth_dev->driver = NULL;
+ eth_dev->intr_handle = NULL;
+
+ eth_dev->data->kdrv = RTE_KDRV_NONE;
+ eth_dev->data->numa_node = dev->device.numa_node;
+ eth_dev->data->drv_name = dev->device.driver->name;
+ return eth_dev;
+}
+
+#endif /* _RTE_ETHDEV_VDEV_H_ */
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 05/42] net/tap: use ethdev allocation helper for virtual devices
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (3 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 04/42] ether: add allocation helper for virtual drivers Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 06/42] net/vhost: " Gaetan Rivet
` (37 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/tap/rte_eth_tap.c | 38 +++++++++++++-------------------------
1 file changed, 13 insertions(+), 25 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 698e14b..206a0d6 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -36,6 +36,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_vdev.h>
#include <rte_kvargs.h>
@@ -1131,12 +1132,13 @@ tap_kernel_support(struct pmd_internals *pmd)
}
static int
-eth_dev_tap_create(const char *name, char *tap_name, char *remote_iface)
+eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,
+ char *remote_iface)
{
int numa_node = rte_socket_id();
- struct rte_eth_dev *dev = NULL;
- struct pmd_internals *pmd = NULL;
- struct rte_eth_dev_data *data = NULL;
+ struct rte_eth_dev *dev;
+ struct pmd_internals *pmd;
+ struct rte_eth_dev_data *data;
int i;
RTE_LOG(DEBUG, PMD, " TAP device on numa %u\n", rte_socket_id());
@@ -1147,22 +1149,14 @@ eth_dev_tap_create(const char *name, char *tap_name, char *remote_iface)
goto error_exit;
}
- pmd = rte_zmalloc_socket(tap_name, sizeof(*pmd), 0, numa_node);
- if (!pmd) {
- RTE_LOG(ERR, PMD, "TAP Unable to allocate internal struct\n");
- goto error_exit;
- }
-
- /* name in allocation and data->name must be consistent */
- snprintf(data->name, sizeof(data->name), "%s", name);
- dev = rte_eth_dev_allocate(name);
+ dev = rte_eth_vdev_allocate(vdev, sizeof(*pmd));
if (!dev) {
RTE_LOG(ERR, PMD, "TAP Unable to allocate device struct\n");
goto error_exit;
}
+ pmd = dev->data->dev_private;
snprintf(pmd->name, sizeof(pmd->name), "%s", tap_name);
-
pmd->nb_queues = RTE_PMD_TAP_MAX_QUEUES;
pmd->ioctl_sock = socket(AF_INET, SOCK_DGRAM, 0);
@@ -1174,13 +1168,11 @@ eth_dev_tap_create(const char *name, char *tap_name, char *remote_iface)
}
/* Setup some default values */
+ rte_memcpy(data, dev->data, sizeof(*data));
data->dev_private = pmd;
- data->port_id = dev->data->port_id;
- data->mtu = dev->data->mtu;
data->dev_flags = RTE_ETH_DEV_DETACHABLE | RTE_ETH_DEV_INTR_LSC;
- data->kdrv = RTE_KDRV_NONE;
- data->drv_name = pmd_tap_drv.driver.name;
data->numa_node = numa_node;
+ data->drv_name = pmd_tap_drv.driver.name;
data->dev_link = pmd_link;
data->mac_addrs = &pmd->eth_addr;
@@ -1189,7 +1181,6 @@ eth_dev_tap_create(const char *name, char *tap_name, char *remote_iface)
dev->data = data;
dev->dev_ops = &ops;
- dev->driver = NULL;
dev->rx_pkt_burst = pmd_rx_burst;
dev->tx_pkt_burst = pmd_tx_burst;
@@ -1236,13 +1227,10 @@ eth_dev_tap_create(const char *name, char *tap_name, char *remote_iface)
return 0;
error_exit:
- RTE_LOG(DEBUG, PMD, "TAP Unable to initialize %s\n", name);
+ RTE_LOG(DEBUG, PMD, "TAP Unable to initialize %s\n",
+ rte_vdev_device_name(vdev));
rte_free(data);
- rte_free(pmd);
-
- rte_eth_dev_release_port(dev);
-
return -EINVAL;
}
@@ -1343,7 +1331,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
RTE_LOG(NOTICE, PMD, "Initializing pmd_tap for %s as %s\n",
name, tap_name);
- ret = eth_dev_tap_create(name, tap_name, remote_iface);
+ ret = eth_dev_tap_create(dev, tap_name, remote_iface);
leave:
if (ret == -1) {
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 06/42] net/vhost: use ethdev allocation helper for virtual devices
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (4 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 05/42] net/tap: use ethdev allocation helper for virtual devices Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 07/42] net/virtio: " Gaetan Rivet
` (36 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/vhost/rte_eth_vhost.c | 54 +++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 28 deletions(-)
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index cdd8c31..9663e55 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -36,6 +36,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_vdev.h>
@@ -983,9 +984,10 @@ static const struct eth_dev_ops ops = {
static struct rte_vdev_driver pmd_vhost_drv;
static int
-eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
- const unsigned numa_node, uint64_t flags)
+eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name,
+ int16_t queues, const unsigned int numa_node, uint64_t flags)
{
+ const char *name = rte_vdev_device_name(dev);
struct rte_eth_dev_data *data = NULL;
struct pmd_internal *internal = NULL;
struct rte_eth_dev *eth_dev = NULL;
@@ -996,23 +998,19 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
RTE_LOG(INFO, PMD, "Creating VHOST-USER backend on numa socket %u\n",
numa_node);
- /* now do all data allocation - for eth_dev structure, dummy pci driver
- * and internal (private) data
+ /* now do all data allocation - for eth_dev structure and internal
+ * (private) data
*/
data = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);
if (data == NULL)
goto error;
- internal = rte_zmalloc_socket(name, sizeof(*internal), 0, numa_node);
- if (internal == NULL)
- goto error;
-
list = rte_zmalloc_socket(name, sizeof(*list), 0, numa_node);
if (list == NULL)
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name);
+ eth_dev = rte_eth_vdev_allocate(dev, sizeof(*internal));
if (eth_dev == NULL)
goto error;
@@ -1029,10 +1027,10 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
/* now put it all together
* - store queue data in internal,
- * - store numa_node info in ethdev data
* - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
+ internal = eth_dev->data->dev_private;
internal->dev_name = strdup(name);
if (internal->dev_name == NULL)
goto error;
@@ -1048,26 +1046,21 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
rte_spinlock_init(&vring_state->lock);
vring_states[eth_dev->data->port_id] = vring_state;
- data->dev_private = internal;
- data->port_id = eth_dev->data->port_id;
- memmove(data->name, eth_dev->data->name, sizeof(data->name));
+ /* We'll replace the 'data' originally allocated by eth_dev. So the
+ * vhost PMD resources won't be shared between multi processes.
+ */
+ rte_memcpy(data, eth_dev->data, sizeof(*data));
+ eth_dev->data = data;
+
data->nb_rx_queues = queues;
data->nb_tx_queues = queues;
internal->max_queues = queues;
data->dev_link = pmd_link;
data->mac_addrs = eth_addr;
-
- /* We'll replace the 'data' originally allocated by eth_dev. So the
- * vhost PMD resources won't be shared between multi processes.
- */
- eth_dev->data = data;
- eth_dev->dev_ops = &ops;
- eth_dev->driver = NULL;
data->dev_flags =
RTE_ETH_DEV_DETACHABLE | RTE_ETH_DEV_INTR_LSC;
- data->kdrv = RTE_KDRV_NONE;
- data->drv_name = pmd_vhost_drv.driver.name;
- data->numa_node = numa_node;
+
+ eth_dev->dev_ops = &ops;
/* finally assign rx and tx ops */
eth_dev->rx_pkt_burst = eth_vhost_rx;
@@ -1090,8 +1083,10 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
return data->port_id;
error:
- if (internal)
+ if (internal) {
+ free(internal->iface_name);
free(internal->dev_name);
+ }
rte_free(vring_state);
rte_free(eth_addr);
if (eth_dev)
@@ -1134,7 +1129,6 @@ open_int(const char *key __rte_unused, const char *value, void *extra_args)
static int
rte_pmd_vhost_probe(struct rte_vdev_device *dev)
{
- const char *name;
struct rte_kvargs *kvlist = NULL;
int ret = 0;
char *iface_name;
@@ -1143,8 +1137,8 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
int client_mode = 0;
int dequeue_zero_copy = 0;
- name = rte_vdev_device_name(dev);
- RTE_LOG(INFO, PMD, "Initializing pmd_vhost for %s\n", name);
+ RTE_LOG(INFO, PMD, "Initializing pmd_vhost for %s\n",
+ rte_vdev_device_name(dev));
kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_arguments);
if (kvlist == NULL)
@@ -1189,7 +1183,11 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
flags |= RTE_VHOST_USER_DEQUEUE_ZERO_COPY;
}
- eth_dev_vhost_create(name, iface_name, queues, rte_socket_id(), flags);
+ if (dev->device.numa_node == SOCKET_ID_ANY)
+ dev->device.numa_node = rte_socket_id();
+
+ eth_dev_vhost_create(dev, iface_name, queues, dev->device.numa_node,
+ flags);
out_free:
rte_kvargs_free(kvlist);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 07/42] net/virtio: use ethdev allocation helper for virtual devices
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (5 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 06/42] net/vhost: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 08/42] net/af_packet: " Gaetan Rivet
` (35 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/virtio/virtio_user_ethdev.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 46276ee..361841a 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -40,6 +40,7 @@
#include <rte_malloc.h>
#include <rte_kvargs.h>
+#include <rte_ethdev_vdev.h>
#include <rte_vdev.h>
#include <rte_alarm.h>
@@ -336,27 +337,21 @@ get_integer_arg(const char *key __rte_unused,
static struct rte_vdev_driver virtio_user_driver;
static struct rte_eth_dev *
-virtio_user_eth_dev_alloc(const char *name)
+virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev)
{
struct rte_eth_dev *eth_dev;
struct rte_eth_dev_data *data;
struct virtio_hw *hw;
struct virtio_user_dev *dev;
- eth_dev = rte_eth_dev_allocate(name);
+ eth_dev = rte_eth_vdev_allocate(vdev, sizeof(*hw));
if (!eth_dev) {
PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
return NULL;
}
data = eth_dev->data;
-
- hw = rte_zmalloc(NULL, sizeof(*hw), 0);
- if (!hw) {
- PMD_INIT_LOG(ERR, "malloc virtio_hw failed");
- rte_eth_dev_release_port(eth_dev);
- return NULL;
- }
+ hw = eth_dev->data->dev_private;
dev = rte_zmalloc(NULL, sizeof(*dev), 0);
if (!dev) {
@@ -377,12 +372,7 @@ virtio_user_eth_dev_alloc(const char *name)
hw->modern = 0;
hw->use_simple_rxtx = 0;
hw->virtio_user_dev = dev;
- data->dev_private = hw;
- data->drv_name = virtio_user_driver.driver.name;
- data->numa_node = SOCKET_ID_ANY;
- data->kdrv = RTE_KDRV_NONE;
data->dev_flags = RTE_ETH_DEV_DETACHABLE;
- eth_dev->driver = NULL;
return eth_dev;
}
@@ -500,7 +490,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
goto end;
}
- eth_dev = virtio_user_eth_dev_alloc(rte_vdev_device_name(dev));
+ eth_dev = virtio_user_eth_dev_alloc(dev);
if (!eth_dev) {
PMD_INIT_LOG(ERR, "virtio_user fails to alloc device");
goto end;
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 08/42] net/af_packet: use ethdev allocation helper for virtual devices
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (6 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 07/42] net/virtio: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 09/42] app/test: don't short-circuit null device creation Gaetan Rivet
` (34 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/af_packet/rte_eth_af_packet.c | 42 ++++++++++++++-----------------
1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 77536e8..6f6ba0c 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -38,6 +38,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
#include <rte_vdev.h>
@@ -539,18 +540,19 @@ open_packet_iface(const char *key __rte_unused,
static struct rte_vdev_driver pmd_af_packet_drv;
static int
-rte_pmd_init_internals(const char *name,
+rte_pmd_init_internals(struct rte_vdev_device *dev,
const int sockfd,
const unsigned nb_queues,
unsigned int blocksize,
unsigned int blockcnt,
unsigned int framesize,
unsigned int framecnt,
- const unsigned numa_node,
struct pmd_internals **internals,
struct rte_eth_dev **eth_dev,
struct rte_kvargs *kvlist)
{
+ const char *name = rte_vdev_device_name(dev);
+ const unsigned int numa_node = dev->device.numa_node;
struct rte_eth_dev_data *data = NULL;
struct rte_kvargs_pair *pair = NULL;
struct ifreq ifr;
@@ -768,7 +770,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name);
+ *eth_dev = rte_eth_vdev_allocate(dev, 0);
if (*eth_dev == NULL)
goto error;
@@ -782,22 +784,16 @@ rte_pmd_init_internals(const char *name,
(*internals)->nb_queues = nb_queues;
+ rte_memcpy(data, (*eth_dev)->data, sizeof(*data));
data->dev_private = *internals;
- data->port_id = (*eth_dev)->data->port_id;
data->nb_rx_queues = (uint16_t)nb_queues;
data->nb_tx_queues = (uint16_t)nb_queues;
data->dev_link = pmd_link;
data->mac_addrs = &(*internals)->eth_addr;
- strncpy(data->name,
- (*eth_dev)->data->name, strlen((*eth_dev)->data->name));
(*eth_dev)->data = data;
(*eth_dev)->dev_ops = &ops;
- (*eth_dev)->driver = NULL;
(*eth_dev)->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
- (*eth_dev)->data->drv_name = pmd_af_packet_drv.driver.name;
- (*eth_dev)->data->kdrv = RTE_KDRV_NONE;
- (*eth_dev)->data->numa_node = numa_node;
return 0;
@@ -822,11 +818,11 @@ rte_pmd_init_internals(const char *name,
}
static int
-rte_eth_from_packet(const char *name,
+rte_eth_from_packet(struct rte_vdev_device *dev,
int const *sockfd,
- const unsigned numa_node,
struct rte_kvargs *kvlist)
{
+ const char *name = rte_vdev_device_name(dev);
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
struct rte_kvargs_pair *pair = NULL;
@@ -909,11 +905,11 @@ rte_eth_from_packet(const char *name,
RTE_LOG(INFO, PMD, "%s:\tframe size %d\n", name, framesize);
RTE_LOG(INFO, PMD, "%s:\tframe count %d\n", name, framecount);
- if (rte_pmd_init_internals(name, *sockfd, qpairs,
- blocksize, blockcount,
- framesize, framecount,
- numa_node, &internals, ð_dev,
- kvlist) < 0)
+ if (rte_pmd_init_internals(dev, *sockfd, qpairs,
+ blocksize, blockcount,
+ framesize, framecount,
+ &internals, ð_dev,
+ kvlist) < 0)
return -1;
eth_dev->rx_pkt_burst = eth_af_packet_rx;
@@ -925,15 +921,12 @@ rte_eth_from_packet(const char *name,
static int
rte_pmd_af_packet_probe(struct rte_vdev_device *dev)
{
- const char *name = rte_vdev_device_name(dev);
- unsigned numa_node;
int ret = 0;
struct rte_kvargs *kvlist;
int sockfd = -1;
- RTE_LOG(INFO, PMD, "Initializing pmd_af_packet for %s\n", name);
-
- numa_node = rte_socket_id();
+ RTE_LOG(INFO, PMD, "Initializing pmd_af_packet for %s\n",
+ rte_vdev_device_name(dev));
kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_arguments);
if (kvlist == NULL) {
@@ -953,7 +946,10 @@ rte_pmd_af_packet_probe(struct rte_vdev_device *dev)
goto exit;
}
- ret = rte_eth_from_packet(name, &sockfd, numa_node, kvlist);
+ if (dev->device.numa_node == SOCKET_ID_ANY)
+ dev->device.numa_node = rte_socket_id();
+
+ ret = rte_eth_from_packet(dev, &sockfd, kvlist);
close(sockfd); /* no longer needed */
exit:
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 09/42] app/test: don't short-circuit null device creation
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (7 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 08/42] net/af_packet: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 10/42] net/null: internalize eth_dev_null_create() Gaetan Rivet
` (33 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
A virtual device should get initialized through the rte_eal_vdev_init()
function to properly initialize the driver.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/null/rte_eth_null.c | 1 +
| 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index a7b57bc..4a0d07d 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -50,6 +50,7 @@ static unsigned default_packet_copy;
static const char *valid_arguments[] = {
ETH_NULL_PACKET_SIZE_ARG,
ETH_NULL_PACKET_COPY_ARG,
+ "driver",
NULL
};
--git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index 9034f62..3a2cac3 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -551,7 +551,8 @@ test_setup(void)
port_id = rte_eth_dev_count();
snprintf(name, sizeof(name), SLAVE_DEV_NAME_FMT, port_id);
- retval = eth_dev_null_create(name, 0, 64, 0);
+ retval = rte_eal_vdev_init(name,
+ "driver=net_null,size=64,copy=0");
TEST_ASSERT_SUCCESS(retval, "Failed to create null device '%s'\n",
name);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 10/42] net/null: internalize eth_dev_null_create()
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (8 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 09/42] app/test: don't short-circuit null device creation Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 11/42] net/null: use ethdev allocation helper for virtual devices Gaetan Rivet
` (32 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
There is no need to export this API. Remaining users should use the
rte_eal_vdev_init() function instead.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/null/Makefile | 7 +-----
drivers/net/null/rte_eth_null.c | 4 +---
drivers/net/null/rte_eth_null.h | 40 -------------------------------
drivers/net/null/rte_pmd_null_version.map | 7 ------
| 1 -
5 files changed, 2 insertions(+), 57 deletions(-)
delete mode 100644 drivers/net/null/rte_eth_null.h
diff --git a/drivers/net/null/Makefile b/drivers/net/null/Makefile
index 40a839f..77810bc 100644
--- a/drivers/net/null/Makefile
+++ b/drivers/net/null/Makefile
@@ -41,16 +41,11 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pmd_null_version.map
-LIBABIVER := 1
+LIBABIVER := 2
#
# all source are stored in SRCS-y
#
SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += rte_eth_null.c
-#
-# Export include files
-#
-SYMLINK-y-include += rte_eth_null.h
-
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 4a0d07d..863fcc7 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -39,8 +39,6 @@
#include <rte_kvargs.h>
#include <rte_spinlock.h>
-#include "rte_eth_null.h"
-
#define ETH_NULL_PACKET_SIZE_ARG "size"
#define ETH_NULL_PACKET_COPY_ARG "copy"
@@ -478,7 +476,7 @@ static const struct eth_dev_ops ops = {
static struct rte_vdev_driver pmd_null_drv;
-int
+static int
eth_dev_null_create(const char *name,
const unsigned numa_node,
unsigned packet_size,
diff --git a/drivers/net/null/rte_eth_null.h b/drivers/net/null/rte_eth_null.h
deleted file mode 100644
index abada8c..0000000
--- a/drivers/net/null/rte_eth_null.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2015 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RTE_ETH_NULL_H_
-#define RTE_ETH_NULL_H_
-
-int eth_dev_null_create(const char *name, const unsigned numa_node,
- unsigned packet_size, unsigned packet_copy);
-
-#endif /* RTE_ETH_NULL_H_ */
diff --git a/drivers/net/null/rte_pmd_null_version.map b/drivers/net/null/rte_pmd_null_version.map
index 84b1d0f..ef35398 100644
--- a/drivers/net/null/rte_pmd_null_version.map
+++ b/drivers/net/null/rte_pmd_null_version.map
@@ -2,10 +2,3 @@ DPDK_2.0 {
local: *;
};
-
-DPDK_2.2 {
- global:
-
- eth_dev_null_create;
-
-} DPDK_2.0;
--git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index 3a2cac3..f356c95 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -52,7 +52,6 @@
#include <rte_string_fns.h>
#include <rte_errno.h>
#include <rte_eth_bond.h>
-#include <rte_eth_null.h>
#include "test.h"
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 11/42] net/null: use ethdev allocation helper for virtual devices
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (9 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 10/42] net/null: internalize eth_dev_null_create() Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 12/42] net/bonding: make bonding API call through EAL on create/free Gaetan Rivet
` (31 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/null/rte_eth_null.c | 50 ++++++++++++++---------------------------
1 file changed, 17 insertions(+), 33 deletions(-)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 863fcc7..abf3ec7 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -33,6 +33,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_vdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_vdev.h>
@@ -477,8 +478,7 @@ static const struct eth_dev_ops ops = {
static struct rte_vdev_driver pmd_null_drv;
static int
-eth_dev_null_create(const char *name,
- const unsigned numa_node,
+eth_dev_null_create(struct rte_vdev_device *dev,
unsigned packet_size,
unsigned packet_copy)
{
@@ -495,27 +495,25 @@ eth_dev_null_create(const char *name,
0xBE, 0xAC, 0x01, 0xFA
};
- if (name == NULL)
- return -EINVAL;
+ if (dev->device.numa_node == SOCKET_ID_ANY)
+ dev->device.numa_node = rte_socket_id();
RTE_LOG(INFO, PMD, "Creating null ethdev on numa socket %u\n",
- numa_node);
+ dev->device.numa_node);
/* now do all data allocation - for eth_dev structure, dummy pci driver
* and internal (private) data
*/
- data = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);
- if (data == NULL)
- goto error;
-
- internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
- if (internals == NULL)
- goto error;
+ data = rte_zmalloc_socket(rte_vdev_device_name(dev), sizeof(*data), 0,
+ dev->device.numa_node);
+ if (!data)
+ return -ENOMEM;
- /* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name);
- if (eth_dev == NULL)
- goto error;
+ eth_dev = rte_eth_vdev_allocate(dev, sizeof(*internals));
+ if (!eth_dev) {
+ rte_free(data);
+ return -ENOMEM;
+ }
/* now put it all together
* - store queue data in internals,
@@ -526,6 +524,7 @@ eth_dev_null_create(const char *name,
/* NOTE: we'll replace the data element, of originally allocated eth_dev
* so the nulls are local per-process */
+ internals = eth_dev->data->dev_private;
internals->packet_size = packet_size;
internals->packet_copy = packet_copy;
internals->port_id = eth_dev->data->port_id;
@@ -535,22 +534,16 @@ eth_dev_null_create(const char *name,
rte_memcpy(internals->rss_key, default_rss_key, 40);
- data->dev_private = internals;
- data->port_id = eth_dev->data->port_id;
+ rte_memcpy(data, eth_dev->data, sizeof(*data));
data->nb_rx_queues = (uint16_t)nb_rx_queues;
data->nb_tx_queues = (uint16_t)nb_tx_queues;
data->dev_link = pmd_link;
data->mac_addrs = ð_addr;
- strncpy(data->name, eth_dev->data->name, strlen(eth_dev->data->name));
eth_dev->data = data;
eth_dev->dev_ops = &ops;
- eth_dev->driver = NULL;
data->dev_flags = RTE_ETH_DEV_DETACHABLE;
- data->kdrv = RTE_KDRV_NONE;
- data->drv_name = pmd_null_drv.driver.name;
- data->numa_node = numa_node;
/* finally assign rx and tx ops */
if (packet_copy) {
@@ -562,12 +555,6 @@ eth_dev_null_create(const char *name,
}
return 0;
-
-error:
- rte_free(data);
- rte_free(internals);
-
- return -1;
}
static inline int
@@ -608,7 +595,6 @@ static int
rte_pmd_null_probe(struct rte_vdev_device *dev)
{
const char *name, *params;
- unsigned numa_node;
unsigned packet_size = default_packet_size;
unsigned packet_copy = default_packet_copy;
struct rte_kvargs *kvlist = NULL;
@@ -621,8 +607,6 @@ rte_pmd_null_probe(struct rte_vdev_device *dev)
params = rte_vdev_device_args(dev);
RTE_LOG(INFO, PMD, "Initializing pmd_null for %s\n", name);
- numa_node = rte_socket_id();
-
if (params != NULL) {
kvlist = rte_kvargs_parse(params, valid_arguments);
if (kvlist == NULL)
@@ -651,7 +635,7 @@ rte_pmd_null_probe(struct rte_vdev_device *dev)
"packet copy is %s\n", packet_size,
packet_copy ? "enabled" : "disabled");
- ret = eth_dev_null_create(name, numa_node, packet_size, packet_copy);
+ ret = eth_dev_null_create(dev, packet_size, packet_copy);
free_kvlist:
if (kvlist)
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 12/42] net/bonding: make bonding API call through EAL on create/free
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (10 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 11/42] net/null: use ethdev allocation helper for virtual devices Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 13/42] net/bonding: use ethdev allocation helper for virtual devices Gaetan Rivet
` (30 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
To properly embed the generic rte_device into the rte_eth_dev this reworks
the bonding API to call through rte_eal_vdev_init().
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/bonding/rte_eth_bond_api.c | 171 +++++--------------------------
drivers/net/bonding/rte_eth_bond_args.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 174 ++++++++++++++++++++++++++++++--
3 files changed, 194 insertions(+), 153 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index f552d96..80c7091 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -38,13 +38,12 @@
#include <rte_ethdev.h>
#include <rte_tcp.h>
#include <rte_vdev.h>
+#include <rte_kvargs.h>
#include "rte_eth_bond.h"
#include "rte_eth_bond_private.h"
#include "rte_eth_bond_8023ad_private.h"
-#define DEFAULT_POLLING_INTERVAL_10_MS (10)
-
int
check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev)
{
@@ -163,163 +162,45 @@ number_of_sockets(void)
int
rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
{
- struct bond_dev_private *internals = NULL;
- struct rte_eth_dev *eth_dev = NULL;
- uint32_t vlan_filter_bmp_size;
-
- /* now do all data allocation - for eth_dev structure, dummy pci driver
- * and internal (private) data
- */
+ struct bond_dev_private *internals;
+ char devargs[52];
+ uint8_t port_id;
+ int ret;
if (name == NULL) {
RTE_BOND_LOG(ERR, "Invalid name specified");
- goto err;
- }
-
- if (socket_id >= number_of_sockets()) {
- RTE_BOND_LOG(ERR,
- "Invalid socket id specified to create bonded device on.");
- goto err;
+ return -EINVAL;
}
- internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
- if (internals == NULL) {
- RTE_BOND_LOG(ERR, "Unable to malloc internals on socket");
- goto err;
- }
+ ret = snprintf(devargs, sizeof(devargs),
+ "driver=net_bonding,mode=%d,socket_id=%d", mode, socket_id);
+ if (ret < 0 || ret >= (int)sizeof(devargs))
+ return -ENOMEM;
- /* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name);
- if (eth_dev == NULL) {
- RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
- goto err;
- }
+ ret = rte_eal_vdev_init(name, devargs);
+ if (ret)
+ return -ENOMEM;
- eth_dev->data->dev_private = internals;
- eth_dev->data->nb_rx_queues = (uint16_t)1;
- eth_dev->data->nb_tx_queues = (uint16_t)1;
-
- eth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,
- socket_id);
- if (eth_dev->data->mac_addrs == NULL) {
- RTE_BOND_LOG(ERR, "Unable to malloc mac_addrs");
- goto err;
- }
-
- eth_dev->dev_ops = &default_dev_ops;
- eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |
- RTE_ETH_DEV_DETACHABLE;
- eth_dev->driver = NULL;
- eth_dev->data->kdrv = RTE_KDRV_NONE;
- eth_dev->data->drv_name = pmd_bond_drv.driver.name;
- eth_dev->data->numa_node = socket_id;
-
- rte_spinlock_init(&internals->lock);
-
- internals->port_id = eth_dev->data->port_id;
- internals->mode = BONDING_MODE_INVALID;
- internals->current_primary_port = RTE_MAX_ETHPORTS + 1;
- internals->balance_xmit_policy = BALANCE_XMIT_POLICY_LAYER2;
- internals->xmit_hash = xmit_l2_hash;
- internals->user_defined_mac = 0;
- internals->link_props_set = 0;
-
- internals->link_status_polling_enabled = 0;
-
- internals->link_status_polling_interval_ms = DEFAULT_POLLING_INTERVAL_10_MS;
- internals->link_down_delay_ms = 0;
- internals->link_up_delay_ms = 0;
-
- internals->slave_count = 0;
- internals->active_slave_count = 0;
- internals->rx_offload_capa = 0;
- internals->tx_offload_capa = 0;
- internals->candidate_max_rx_pktlen = 0;
- internals->max_rx_pktlen = 0;
-
- /* Initially allow to choose any offload type */
- internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK;
-
- memset(internals->active_slaves, 0, sizeof(internals->active_slaves));
- memset(internals->slaves, 0, sizeof(internals->slaves));
-
- /* Set mode 4 default configuration */
- bond_mode_8023ad_setup(eth_dev, NULL);
- if (bond_ethdev_mode_set(eth_dev, mode)) {
- RTE_BOND_LOG(ERR, "Failed to set bonded device %d mode too %d",
- eth_dev->data->port_id, mode);
- goto err;
- }
+ ret = rte_eth_dev_get_port_by_name(name, &port_id);
+ RTE_ASSERT(!ret);
- vlan_filter_bmp_size =
- rte_bitmap_get_memory_footprint(ETHER_MAX_VLAN_ID + 1);
- internals->vlan_filter_bmpmem = rte_malloc(name, vlan_filter_bmp_size,
- RTE_CACHE_LINE_SIZE);
- if (internals->vlan_filter_bmpmem == NULL) {
- RTE_BOND_LOG(ERR,
- "Failed to allocate vlan bitmap for bonded device %u\n",
- eth_dev->data->port_id);
- goto err;
- }
-
- internals->vlan_filter_bmp = rte_bitmap_init(ETHER_MAX_VLAN_ID + 1,
- internals->vlan_filter_bmpmem, vlan_filter_bmp_size);
- if (internals->vlan_filter_bmp == NULL) {
- RTE_BOND_LOG(ERR,
- "Failed to init vlan bitmap for bonded device %u\n",
- eth_dev->data->port_id);
- rte_free(internals->vlan_filter_bmpmem);
- goto err;
- }
-
- return eth_dev->data->port_id;
+ /*
+ * To make bond_ethdev_configure() happy we need to free the
+ * internals->kvlist here.
+ *
+ * Also see comment in bond_ethdev_configure().
+ */
+ internals = rte_eth_devices[port_id].data->dev_private;
+ rte_kvargs_free(internals->kvlist);
+ internals->kvlist = NULL;
-err:
- rte_free(internals);
- if (eth_dev != NULL) {
- rte_free(eth_dev->data->mac_addrs);
- rte_eth_dev_release_port(eth_dev);
- }
- return -1;
+ return port_id;
}
int
rte_eth_bond_free(const char *name)
{
- struct rte_eth_dev *eth_dev = NULL;
- struct bond_dev_private *internals;
-
- /* now free all data allocation - for eth_dev structure,
- * dummy pci driver and internal (private) data
- */
-
- /* find an ethdev entry */
- eth_dev = rte_eth_dev_allocated(name);
- if (eth_dev == NULL)
- return -ENODEV;
-
- internals = eth_dev->data->dev_private;
- if (internals->slave_count != 0)
- return -EBUSY;
-
- if (eth_dev->data->dev_started == 1) {
- bond_ethdev_stop(eth_dev);
- bond_ethdev_close(eth_dev);
- }
-
- eth_dev->dev_ops = NULL;
- eth_dev->rx_pkt_burst = NULL;
- eth_dev->tx_pkt_burst = NULL;
-
- internals = eth_dev->data->dev_private;
- rte_bitmap_free(internals->vlan_filter_bmp);
- rte_free(internals->vlan_filter_bmpmem);
- rte_free(eth_dev->data->dev_private);
- rte_free(eth_dev->data->mac_addrs);
-
- rte_eth_dev_release_port(eth_dev);
-
- return 0;
+ return rte_eal_vdev_uninit(name);
}
static int
diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 3dca273..e3bdad9 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -47,7 +47,7 @@ const char *pmd_bond_init_valid_arguments[] = {
PMD_BOND_XMIT_POLICY_KVARG,
PMD_BOND_SOCKET_ID_KVARG,
PMD_BOND_MAC_ADDR_KVARG,
-
+ "driver",
NULL
};
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 340d793..2b1db0b 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -51,6 +51,7 @@
#include "rte_eth_bond_8023ad_private.h"
#define REORDER_PERIOD_MS 10
+#define DEFAULT_POLLING_INTERVAL_10_MS (10)
#define HASH_L4_PORTS(h) ((h)->src_port ^ (h)->dst_port)
@@ -2240,6 +2241,132 @@ const struct eth_dev_ops default_dev_ops = {
};
static int
+bond_alloc(struct rte_vdev_device *dev, uint8_t mode)
+{
+ const char *name = rte_vdev_device_name(dev);
+ uint8_t socket_id = dev->device.numa_node;
+ struct bond_dev_private *internals = NULL;
+ struct rte_eth_dev *eth_dev = NULL;
+ uint32_t vlan_filter_bmp_size;
+
+ /* now do all data allocation - for eth_dev structure, dummy pci driver
+ * and internal (private) data
+ */
+
+ if (name == NULL) {
+ RTE_BOND_LOG(ERR, "Invalid name specified");
+ goto err;
+ }
+
+ if (socket_id >= number_of_sockets()) {
+ RTE_BOND_LOG(ERR,
+ "Invalid socket id specified to create bonded device on.");
+ goto err;
+ }
+
+ internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
+ if (internals == NULL) {
+ RTE_BOND_LOG(ERR, "Unable to malloc internals on socket");
+ goto err;
+ }
+
+ /* reserve an ethdev entry */
+ eth_dev = rte_eth_dev_allocate(name);
+ if (eth_dev == NULL) {
+ RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
+ goto err;
+ }
+
+ eth_dev->data->dev_private = internals;
+ eth_dev->data->nb_rx_queues = (uint16_t)1;
+ eth_dev->data->nb_tx_queues = (uint16_t)1;
+
+ eth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,
+ socket_id);
+ if (eth_dev->data->mac_addrs == NULL) {
+ RTE_BOND_LOG(ERR, "Unable to malloc mac_addrs");
+ goto err;
+ }
+
+ eth_dev->dev_ops = &default_dev_ops;
+ eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |
+ RTE_ETH_DEV_DETACHABLE;
+ eth_dev->driver = NULL;
+ eth_dev->data->kdrv = RTE_KDRV_NONE;
+ eth_dev->data->drv_name = pmd_bond_drv.driver.name;
+ eth_dev->data->numa_node = socket_id;
+
+ rte_spinlock_init(&internals->lock);
+
+ internals->port_id = eth_dev->data->port_id;
+ internals->mode = BONDING_MODE_INVALID;
+ internals->current_primary_port = RTE_MAX_ETHPORTS + 1;
+ internals->balance_xmit_policy = BALANCE_XMIT_POLICY_LAYER2;
+ internals->xmit_hash = xmit_l2_hash;
+ internals->user_defined_mac = 0;
+ internals->link_props_set = 0;
+
+ internals->link_status_polling_enabled = 0;
+
+ internals->link_status_polling_interval_ms =
+ DEFAULT_POLLING_INTERVAL_10_MS;
+ internals->link_down_delay_ms = 0;
+ internals->link_up_delay_ms = 0;
+
+ internals->slave_count = 0;
+ internals->active_slave_count = 0;
+ internals->rx_offload_capa = 0;
+ internals->tx_offload_capa = 0;
+ internals->candidate_max_rx_pktlen = 0;
+ internals->max_rx_pktlen = 0;
+
+ /* Initially allow to choose any offload type */
+ internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK;
+
+ memset(internals->active_slaves, 0, sizeof(internals->active_slaves));
+ memset(internals->slaves, 0, sizeof(internals->slaves));
+
+ /* Set mode 4 default configuration */
+ bond_mode_8023ad_setup(eth_dev, NULL);
+ if (bond_ethdev_mode_set(eth_dev, mode)) {
+ RTE_BOND_LOG(ERR, "Failed to set bonded device %d mode too %d",
+ eth_dev->data->port_id, mode);
+ goto err;
+ }
+
+ vlan_filter_bmp_size =
+ rte_bitmap_get_memory_footprint(ETHER_MAX_VLAN_ID + 1);
+ internals->vlan_filter_bmpmem = rte_malloc(name, vlan_filter_bmp_size,
+ RTE_CACHE_LINE_SIZE);
+ if (internals->vlan_filter_bmpmem == NULL) {
+ RTE_BOND_LOG(ERR,
+ "Failed to allocate vlan bitmap for bonded device %u\n",
+ eth_dev->data->port_id);
+ goto err;
+ }
+
+ internals->vlan_filter_bmp = rte_bitmap_init(ETHER_MAX_VLAN_ID + 1,
+ internals->vlan_filter_bmpmem, vlan_filter_bmp_size);
+ if (internals->vlan_filter_bmp == NULL) {
+ RTE_BOND_LOG(ERR,
+ "Failed to init vlan bitmap for bonded device %u\n",
+ eth_dev->data->port_id);
+ rte_free(internals->vlan_filter_bmpmem);
+ goto err;
+ }
+
+ return eth_dev->data->port_id;
+
+err:
+ rte_free(internals);
+ if (eth_dev != NULL) {
+ rte_free(eth_dev->data->mac_addrs);
+ rte_eth_dev_release_port(eth_dev);
+ }
+ return -1;
+}
+
+static int
bond_probe(struct rte_vdev_device *dev)
{
const char *name;
@@ -2248,6 +2375,9 @@ bond_probe(struct rte_vdev_device *dev)
uint8_t bonding_mode, socket_id;
int arg_count, port_id;
+ if (!dev)
+ return -EINVAL;
+
name = rte_vdev_device_name(dev);
RTE_LOG(INFO, EAL, "Initializing pmd_bond for %s\n", name);
@@ -2289,8 +2419,10 @@ bond_probe(struct rte_vdev_device *dev)
socket_id = rte_socket_id();
}
+ dev->device.numa_node = socket_id;
+
/* Create link bonding eth device */
- port_id = rte_eth_bond_create(name, bonding_mode, socket_id);
+ port_id = bond_alloc(dev, bonding_mode);
if (port_id < 0) {
RTE_LOG(ERR, EAL, "Failed to create socket %s in mode %u on "
"socket %u.\n", name, bonding_mode, socket_id);
@@ -2312,8 +2444,9 @@ bond_probe(struct rte_vdev_device *dev)
static int
bond_remove(struct rte_vdev_device *dev)
{
+ struct rte_eth_dev *eth_dev;
+ struct bond_dev_private *internals;
const char *name;
- int ret;
if (!dev)
return -EINVAL;
@@ -2321,12 +2454,39 @@ bond_remove(struct rte_vdev_device *dev)
name = rte_vdev_device_name(dev);
RTE_LOG(INFO, EAL, "Uninitializing pmd_bond for %s\n", name);
- /* free link bonding eth device */
- ret = rte_eth_bond_free(name);
- if (ret < 0)
- RTE_LOG(ERR, EAL, "Failed to free %s\n", name);
+ /* now free all data allocation - for eth_dev structure,
+ * dummy pci driver and internal (private) data
+ */
- return ret;
+ /* find an ethdev entry */
+ eth_dev = rte_eth_dev_allocated(name);
+ if (eth_dev == NULL)
+ return -ENODEV;
+
+ RTE_ASSERT(eth_dev->device == &dev->device);
+
+ internals = eth_dev->data->dev_private;
+ if (internals->slave_count != 0)
+ return -EBUSY;
+
+ if (eth_dev->data->dev_started == 1) {
+ bond_ethdev_stop(eth_dev);
+ bond_ethdev_close(eth_dev);
+ }
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
+
+ internals = eth_dev->data->dev_private;
+ rte_bitmap_free(internals->vlan_filter_bmp);
+ rte_free(internals->vlan_filter_bmpmem);
+ rte_free(eth_dev->data->dev_private);
+ rte_free(eth_dev->data->mac_addrs);
+
+ rte_eth_dev_release_port(eth_dev);
+
+ return 0;
}
/* this part will resolve the slave portids after all the other pdev and vdev
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 13/42] net/bonding: use ethdev allocation helper for virtual devices
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (11 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 12/42] net/bonding: make bonding API call through EAL on create/free Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 14/42] net/kni: " Gaetan Rivet
` (29 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 2b1db0b..2ddcd07 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -36,6 +36,7 @@
#include <rte_mbuf.h>
#include <rte_malloc.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_vdev.h>
#include <rte_tcp.h>
#include <rte_udp.h>
#include <rte_ip.h>
@@ -2253,31 +2254,20 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode)
* and internal (private) data
*/
- if (name == NULL) {
- RTE_BOND_LOG(ERR, "Invalid name specified");
- goto err;
- }
-
if (socket_id >= number_of_sockets()) {
RTE_BOND_LOG(ERR,
"Invalid socket id specified to create bonded device on.");
goto err;
}
- internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
- if (internals == NULL) {
- RTE_BOND_LOG(ERR, "Unable to malloc internals on socket");
- goto err;
- }
-
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name);
+ eth_dev = rte_eth_vdev_allocate(dev, sizeof(*internals));
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
}
- eth_dev->data->dev_private = internals;
+ internals = eth_dev->data->dev_private;
eth_dev->data->nb_rx_queues = (uint16_t)1;
eth_dev->data->nb_tx_queues = (uint16_t)1;
@@ -2291,10 +2281,6 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode)
eth_dev->dev_ops = &default_dev_ops;
eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |
RTE_ETH_DEV_DETACHABLE;
- eth_dev->driver = NULL;
- eth_dev->data->kdrv = RTE_KDRV_NONE;
- eth_dev->data->drv_name = pmd_bond_drv.driver.name;
- eth_dev->data->numa_node = socket_id;
rte_spinlock_init(&internals->lock);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 14/42] net/kni: use ethdev allocation helper for virtual devices
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (12 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 13/42] net/bonding: use ethdev allocation helper for virtual devices Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 15/42] net/pcap: " Gaetan Rivet
` (28 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
drivers/net/kni/rte_eth_kni.c | 39 +++++++++++++++------------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index e3ce572..8f90034 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -36,6 +36,7 @@
#include <unistd.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_vdev.h>
#include <rte_kni.h>
#include <rte_kvargs.h>
#include <rte_malloc.h>
@@ -358,32 +359,32 @@ static const struct eth_dev_ops eth_kni_ops = {
static struct rte_vdev_driver eth_kni_drv;
static struct rte_eth_dev *
-eth_kni_create(const char *name, struct eth_kni_args *args,
+eth_kni_create(struct rte_vdev_device *vdev,
+ struct eth_kni_args *args,
unsigned int numa_node)
{
- struct pmd_internals *internals = NULL;
+ struct pmd_internals *internals;
struct rte_eth_dev_data *data;
struct rte_eth_dev *eth_dev;
+ const char *name;
RTE_LOG(INFO, PMD, "Creating kni ethdev on numa socket %u\n",
numa_node);
+ name = rte_vdev_device_name(vdev);
data = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);
if (data == NULL)
- goto error;
-
- internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
- if (internals == NULL)
- goto error;
+ return NULL;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name);
- if (eth_dev == NULL)
- goto error;
+ eth_dev = rte_eth_vdev_allocate(vdev, sizeof(*internals));
+ if (eth_dev == NULL) {
+ rte_free(data);
+ return NULL;
+ }
- data->dev_private = internals;
- data->port_id = eth_dev->data->port_id;
- memmove(data->name, eth_dev->data->name, sizeof(data->name));
+ internals = eth_dev->data->dev_private;
+ rte_memcpy(data, eth_dev->data, sizeof(*data));
data->nb_rx_queues = 1;
data->nb_tx_queues = 1;
data->dev_link = pmd_link;
@@ -393,22 +394,12 @@ eth_kni_create(const char *name, struct eth_kni_args *args,
eth_dev->data = data;
eth_dev->dev_ops = ð_kni_ops;
- eth_dev->device->driver = NULL;
data->dev_flags = RTE_ETH_DEV_DETACHABLE;
- data->kdrv = RTE_KDRV_NONE;
- data->drv_name = eth_kni_drv.driver.name;
- data->numa_node = numa_node;
internals->no_request_thread = args->no_request_thread;
return eth_dev;
-
-error:
- rte_free(data);
- rte_free(internals);
-
- return NULL;
}
static int
@@ -462,7 +453,7 @@ eth_kni_probe(struct rte_vdev_device *vdev)
if (ret < 0)
return ret;
- eth_dev = eth_kni_create(name, &args, rte_socket_id());
+ eth_dev = eth_kni_create(vdev, &args, rte_socket_id());
if (eth_dev == NULL)
goto kni_uninit;
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 15/42] net/pcap: use ethdev allocation helper for virtual devices
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (13 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 14/42] net/kni: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 16/42] ethdev: add PCI driver helpers Gaetan Rivet
` (27 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
drivers/net/pcap/rte_eth_pcap.c | 62 ++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 35 deletions(-)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 05cbd47..defb3b4 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -40,6 +40,7 @@
#include <rte_cycles.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_vdev.h>
#include <rte_kvargs.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
@@ -790,14 +791,17 @@ open_tx_iface(const char *key, const char *value, void *extra_args)
static struct rte_vdev_driver pmd_pcap_drv;
static int
-pmd_init_internals(const char *name, const unsigned int nb_rx_queues,
+pmd_init_internals(struct rte_vdev_device *vdev,
+ const unsigned int nb_rx_queues,
const unsigned int nb_tx_queues,
struct pmd_internals **internals,
struct rte_eth_dev **eth_dev)
{
struct rte_eth_dev_data *data = NULL;
- unsigned int numa_node = rte_socket_id();
+ unsigned int numa_node = vdev->device.numa_node;
+ const char *name;
+ name = rte_vdev_device_name(vdev);
RTE_LOG(INFO, PMD, "Creating pcap-backed ethdev on numa socket %u\n",
numa_node);
@@ -806,17 +810,14 @@ pmd_init_internals(const char *name, const unsigned int nb_rx_queues,
*/
data = rte_zmalloc_socket(name, sizeof(*data), 0, numa_node);
if (data == NULL)
- goto error;
-
- *internals = rte_zmalloc_socket(name, sizeof(**internals), 0,
- numa_node);
- if (*internals == NULL)
- goto error;
+ return -1;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name);
- if (*eth_dev == NULL)
- goto error;
+ *eth_dev = rte_eth_vdev_allocate(vdev, sizeof(**internals));
+ if (*eth_dev == NULL) {
+ rte_free(data);
+ return -1;
+ }
/* now put it all together
* - store queue data in internals,
@@ -824,9 +825,8 @@ pmd_init_internals(const char *name, const unsigned int nb_rx_queues,
* - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
- data->dev_private = *internals;
- data->port_id = (*eth_dev)->data->port_id;
- snprintf(data->name, sizeof(data->name), "%s", (*eth_dev)->data->name);
+ *internals = (*eth_dev)->data->dev_private;
+ rte_memcpy(data, (*eth_dev)->data, sizeof(*data));
data->nb_rx_queues = (uint16_t)nb_rx_queues;
data->nb_tx_queues = (uint16_t)nb_tx_queues;
data->dev_link = pmd_link;
@@ -838,26 +838,17 @@ pmd_init_internals(const char *name, const unsigned int nb_rx_queues,
*/
(*eth_dev)->data = data;
(*eth_dev)->dev_ops = &ops;
- (*eth_dev)->driver = NULL;
data->dev_flags = RTE_ETH_DEV_DETACHABLE;
- data->kdrv = RTE_KDRV_NONE;
- data->drv_name = pmd_pcap_drv.driver.name;
- data->numa_node = numa_node;
return 0;
-
-error:
- rte_free(data);
- rte_free(*internals);
-
- return -1;
}
static int
-eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues,
- const unsigned int nb_rx_queues, struct pmd_devargs *tx_queues,
- const unsigned int nb_tx_queues, struct rte_kvargs *kvlist,
- struct pmd_internals **internals, struct rte_eth_dev **eth_dev)
+eth_from_pcaps_common(struct rte_vdev_device *vdev,
+ struct pmd_devargs *rx_queues, const unsigned int nb_rx_queues,
+ struct pmd_devargs *tx_queues, const unsigned int nb_tx_queues,
+ struct rte_kvargs *kvlist, struct pmd_internals **internals,
+ struct rte_eth_dev **eth_dev)
{
struct rte_kvargs_pair *pair = NULL;
unsigned int k_idx;
@@ -869,7 +860,7 @@ eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues,
if (tx_queues == NULL && nb_tx_queues > 0)
return -1;
- if (pmd_init_internals(name, nb_rx_queues, nb_tx_queues, internals,
+ if (pmd_init_internals(vdev, nb_rx_queues, nb_tx_queues, internals,
eth_dev) < 0)
return -1;
@@ -907,16 +898,17 @@ eth_from_pcaps_common(const char *name, struct pmd_devargs *rx_queues,
}
static int
-eth_from_pcaps(const char *name, struct pmd_devargs *rx_queues,
- const unsigned int nb_rx_queues, struct pmd_devargs *tx_queues,
- const unsigned int nb_tx_queues, struct rte_kvargs *kvlist,
- int single_iface, unsigned int using_dumpers)
+eth_from_pcaps(struct rte_vdev_device *vdev,
+ struct pmd_devargs *rx_queues, const unsigned int nb_rx_queues,
+ struct pmd_devargs *tx_queues, const unsigned int nb_tx_queues,
+ struct rte_kvargs *kvlist, int single_iface,
+ unsigned int using_dumpers)
{
struct pmd_internals *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
int ret;
- ret = eth_from_pcaps_common(name, rx_queues, nb_rx_queues,
+ ret = eth_from_pcaps_common(vdev, rx_queues, nb_rx_queues,
tx_queues, nb_tx_queues, kvlist, &internals, ð_dev);
if (ret < 0)
@@ -1027,7 +1019,7 @@ pmd_pcap_probe(struct rte_vdev_device *dev)
goto free_kvlist;
create_eth:
- ret = eth_from_pcaps(name, &pcaps, pcaps.num_of_queue, &dumpers,
+ ret = eth_from_pcaps(dev, &pcaps, pcaps.num_of_queue, &dumpers,
dumpers.num_of_queue, kvlist, single_iface, is_tx_pcap);
free_kvlist:
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 16/42] ethdev: add PCI driver helpers
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (14 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 15/42] net/pcap: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 17/42] net/virtio: Don't use eth_driver Gaetan Rivet
` (26 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
This adds the following helper intended to be used by rte_pci_driver
implementations working with ethdev:
- rte_eth_dev_pci_allocate
- rte_eth_dev_pci_release
- rte_eth_dev_pci_generic_probe
- rte_eth_dev_pci_generic_remove
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
lib/librte_ether/Makefile | 1 +
lib/librte_ether/rte_ethdev_pci.h | 151 ++++++++++++++++++++++++++++++++++++++
2 files changed, 152 insertions(+)
create mode 100644 lib/librte_ether/rte_ethdev_pci.h
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index d0017b8..93fdde1 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -50,6 +50,7 @@ SRCS-y += rte_flow.c
# Export include files
#
SYMLINK-y-include += rte_ethdev.h
+SYMLINK-y-include += rte_ethdev_pci.h
SYMLINK-y-include += rte_ethdev_vdev.h
SYMLINK-y-include += rte_eth_ctrl.h
SYMLINK-y-include += rte_dev_info.h
diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h
new file mode 100644
index 0000000..4b728db
--- /dev/null
+++ b/lib/librte_ether/rte_ethdev_pci.h
@@ -0,0 +1,151 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Brocade Communications Systems, Inc.
+ * Author: Jan Blunck <jblunck@infradead.org>
+ *
+ * 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 the copyright holder 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_ETHDEV_PCI_H_
+#define _RTE_ETHDEV_PCI_H_
+
+#include <rte_malloc.h>
+#include <rte_pci.h>
+#include <rte_ethdev.h>
+
+/**
+ * @internal
+ * Allocates a new ethdev slot for an ethernet device and returns the pointer
+ * to that slot for the driver to use.
+ *
+ * @param dev
+ * Pointer to the PCI device
+ *
+ * @param private_data_size
+ * Size of private data structure
+ *
+ * @return
+ * A pointer to a rte_eth_dev or NULL if allocation failed.
+ */
+static inline struct rte_eth_dev *
+rte_eth_dev_pci_allocate(struct rte_pci_device *dev, size_t private_data_size)
+{
+ struct rte_eth_dev *eth_dev;
+ const char *name;
+
+ if (!dev)
+ return NULL;
+
+ name = dev->device.name;
+
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ eth_dev = rte_eth_dev_allocate(name);
+ if (!eth_dev)
+ return NULL;
+
+ if (private_data_size) {
+ eth_dev->data->dev_private = rte_zmalloc_socket(name,
+ private_data_size, RTE_CACHE_LINE_SIZE,
+ dev->device.numa_node);
+ if (!eth_dev->data->dev_private) {
+ rte_eth_dev_release_port(eth_dev);
+ return NULL;
+ }
+ }
+ } else {
+ eth_dev = rte_eth_dev_attach_secondary(name);
+ if (!eth_dev)
+ return NULL;
+ }
+
+ eth_dev->device = &dev->device;
+ eth_dev->driver = NULL;
+ eth_dev->intr_handle = &dev->intr_handle;
+ rte_eth_copy_pci_info(eth_dev, dev);
+ return eth_dev;
+}
+
+static inline void
+rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
+{
+ /* free ether device */
+ rte_eth_dev_release_port(eth_dev);
+
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+ rte_free(eth_dev->data->dev_private);
+
+ eth_dev->data->dev_private = NULL;
+
+ eth_dev->device = NULL;
+ eth_dev->driver = NULL;
+ eth_dev->intr_handle = NULL;
+}
+
+typedef int (*eth_dev_pci_callback_t)(struct rte_eth_dev *eth_dev);
+
+static inline int
+rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
+ size_t private_data_size, eth_dev_pci_callback_t dev_init)
+{
+ struct rte_eth_dev *eth_dev;
+ int ret;
+
+ eth_dev = rte_eth_dev_pci_allocate(pci_dev, private_data_size);
+ if (!eth_dev)
+ return -ENOMEM;
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
+ ret = dev_init(eth_dev);
+ if (ret)
+ rte_eth_dev_pci_release(eth_dev);
+
+ return ret;
+}
+
+static inline int
+rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev,
+ eth_dev_pci_callback_t dev_uninit)
+{
+ struct rte_eth_dev *eth_dev;
+ int ret;
+
+ eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+ if (!eth_dev)
+ return -ENODEV;
+
+ if (dev_uninit) {
+ ret = dev_uninit(eth_dev);
+ if (ret)
+ return ret;
+ }
+
+ rte_eth_dev_pci_release(eth_dev);
+ return 0;
+}
+
+#endif /* _RTE_ETHDEV_PCI_H_ */
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 17/42] net/virtio: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (15 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 16/42] ethdev: add PCI driver helpers Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 18/42] net/bnx2x: " Gaetan Rivet
` (25 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/virtio/virtio_ethdev.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 78cb3e8..f0a0219 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -38,6 +38,7 @@
#include <unistd.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_memzone.h>
@@ -1612,19 +1613,26 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
return 0;
}
-static struct eth_driver rte_virtio_pmd = {
- .pci_drv = {
- .driver = {
- .name = "net_virtio",
- },
- .id_table = pci_id_virtio_map,
- .drv_flags = 0,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
+static int eth_virtio_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct virtio_hw),
+ eth_virtio_dev_init);
+}
+
+static int eth_virtio_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_virtio_dev_uninit);
+}
+
+static struct rte_pci_driver rte_virtio_pmd = {
+ .driver = {
+ .name = "net_virtio",
},
- .eth_dev_init = eth_virtio_dev_init,
- .eth_dev_uninit = eth_virtio_dev_uninit,
- .dev_private_size = sizeof(struct virtio_hw),
+ .id_table = pci_id_virtio_map,
+ .drv_flags = 0,
+ .probe = eth_virtio_pci_probe,
+ .remove = eth_virtio_pci_remove,
};
RTE_INIT(rte_virtio_pmd_init);
@@ -1636,7 +1644,7 @@ rte_virtio_pmd_init(void)
return;
}
- rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
+ rte_eal_pci_register(&rte_virtio_pmd);
}
/*
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 18/42] net/bnx2x: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (16 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 17/42] net/virtio: Don't use eth_driver Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 19/42] net/bnxt: " Gaetan Rivet
` (24 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/bnx2x/bnx2x_ethdev.c | 64 +++++++++++++++++++++++++++-------------
drivers/net/bnx2x/bnx2x_rxtx.c | 2 +-
2 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 0e8b4d9..314e5ea 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -12,6 +12,7 @@
#include "bnx2x_rxtx.h"
#include <rte_dev.h>
+#include <rte_ethdev_pci.h>
/*
* The set of PCI devices this driver supports
@@ -627,34 +628,57 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
return bnx2x_common_dev_init(eth_dev, 1);
}
-static struct eth_driver rte_bnx2x_pmd = {
- .pci_drv = {
- .id_table = pci_id_bnx2x_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_bnx2x_dev_init,
- .dev_private_size = sizeof(struct bnx2x_softc),
+static struct rte_pci_driver rte_bnx2x_pmd;
+static struct rte_pci_driver rte_bnx2xvf_pmd;
+
+static int eth_bnx2x_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
+{
+ struct rte_eth_dev *eth_dev;
+ int ret;
+
+ eth_dev = rte_eth_dev_pci_allocate(pci_dev, sizeof(struct bnx2x_softc));
+ if (!eth_dev)
+ return -ENOMEM;
+
+ if (pci_drv == &rte_bnx2x_pmd)
+ ret = eth_bnx2x_dev_init(eth_dev);
+ else if (pci_drv == &rte_bnx2xvf_pmd)
+ ret = eth_bnx2xvf_dev_init(eth_dev);
+ else
+ ret = -EINVAL;
+
+ if (ret)
+ rte_eth_dev_pci_release(eth_dev);
+
+ return ret;
+}
+
+static int eth_bnx2x_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
+}
+
+static struct rte_pci_driver rte_bnx2x_pmd = {
+ .id_table = pci_id_bnx2x_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_bnx2x_pci_probe,
+ .remove = eth_bnx2x_pci_remove,
};
/*
* virtual function driver struct
*/
-static struct eth_driver rte_bnx2xvf_pmd = {
- .pci_drv = {
- .id_table = pci_id_bnx2xvf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_bnx2xvf_dev_init,
- .dev_private_size = sizeof(struct bnx2x_softc),
+static struct rte_pci_driver rte_bnx2xvf_pmd = {
+ .id_table = pci_id_bnx2xvf_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = eth_bnx2x_pci_probe,
+ .remove = eth_bnx2x_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_bnx2x, pci_id_bnx2x_map);
RTE_PMD_REGISTER_KMOD_DEP(net_bnx2x, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_bnx2xvf, "* igb_uio | vfio");
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index adf0309..5dd4aee 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -19,7 +19,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.driver.name, ring_name,
+ dev->device->driver->name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 19/42] net/bnxt: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (17 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 18/42] net/bnx2x: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 20/42] net/cxgbe: " Gaetan Rivet
` (23 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/bnxt/bnxt_ethdev.c | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 6167443..5dc3ff0 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -36,6 +36,7 @@
#include <rte_dev.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_malloc.h>
#include <rte_cycles.h>
@@ -1075,6 +1076,8 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
return rc;
}
+static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);
+
static int
bnxt_dev_init(struct rte_eth_dev *eth_dev)
{
@@ -1167,7 +1170,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
return 0;
error_free:
- eth_dev->driver->eth_dev_uninit(eth_dev);
+ bnxt_dev_uninit(eth_dev);
error:
return rc;
}
@@ -1196,19 +1199,26 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
return rc;
}
-static struct eth_driver bnxt_rte_pmd = {
- .pci_drv = {
- .id_table = bnxt_pci_id_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING |
- RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove
- },
- .eth_dev_init = bnxt_dev_init,
- .eth_dev_uninit = bnxt_dev_uninit,
- .dev_private_size = sizeof(struct bnxt),
+static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct bnxt),
+ bnxt_dev_init);
+}
+
+static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, bnxt_dev_uninit);
+}
+
+static struct rte_pci_driver bnxt_rte_pmd = {
+ .id_table = bnxt_pci_id_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING |
+ RTE_PCI_DRV_INTR_LSC,
+ .probe = bnxt_pci_probe,
+ .remove = bnxt_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 20/42] net/cxgbe: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (18 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 19/42] net/bnxt: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 21/42] net/em: " Gaetan Rivet
` (22 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/cxgbe/cxgbe_ethdev.c | 29 +++++++++++++++++++----------
drivers/net/cxgbe/sge.c | 6 +++---
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 4d543a7..34fed84 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -57,6 +57,7 @@
#include <rte_alarm.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
#include <rte_random.h>
@@ -1039,17 +1040,25 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)
return err;
}
-static struct eth_driver rte_cxgbe_pmd = {
- .pci_drv = {
- .id_table = cxgb4_pci_tbl,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_cxgbe_dev_init,
- .dev_private_size = sizeof(struct port_info),
+static int eth_cxgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct port_info), eth_cxgbe_dev_init);
+}
+
+static int eth_cxgbe_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
+}
+
+static struct rte_pci_driver rte_cxgbe_pmd = {
+ .id_table = cxgb4_pci_tbl,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_cxgbe_pci_probe,
+ .remove = eth_cxgbe_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_cxgbe, rte_cxgbe_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_cxgbe, rte_cxgbe_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_cxgbe, cxgb4_pci_tbl);
RTE_PMD_REGISTER_KMOD_DEP(net_cxgbe, "* igb_uio | uio_pci_generic | vfio");
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 37b6090..2f9e12c 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1641,7 +1641,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.driver.name,
+ eth_dev->data->drv_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);
@@ -1694,7 +1694,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.driver.name,
+ eth_dev->data->drv_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);
@@ -1890,7 +1890,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.driver.name, "tx_ring",
+ eth_dev->data->drv_name, "tx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 21/42] net/em: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (19 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 20/42] net/cxgbe: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 22/42] net/igb: " Gaetan Rivet
` (21 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/e1000/em_ethdev.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index ecefa56..599b9e0 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -45,6 +45,7 @@
#include <rte_pci.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_eal.h>
@@ -417,16 +418,23 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
return 0;
}
-static struct eth_driver rte_em_pmd = {
- .pci_drv = {
- .id_table = pci_id_em_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_em_dev_init,
- .eth_dev_uninit = eth_em_dev_uninit,
- .dev_private_size = sizeof(struct e1000_adapter),
+static int eth_em_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct e1000_adapter), eth_em_dev_init);
+}
+
+static int eth_em_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_em_dev_uninit);
+}
+
+static struct rte_pci_driver rte_em_pmd = {
+ .id_table = pci_id_em_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_em_pci_probe,
+ .remove = eth_em_pci_remove,
};
static int
@@ -1857,6 +1865,6 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
}
-RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map);
RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 22/42] net/igb: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (20 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 21/42] net/em: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 23/42] net/ena: " Gaetan Rivet
` (20 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/e1000/igb_ethdev.c | 60 ++++++++++++++++++++++++++----------------
1 file changed, 38 insertions(+), 22 deletions(-)
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index cc2c244..2bda4b3 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -45,6 +45,7 @@
#include <rte_pci.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_eal.h>
@@ -1088,31 +1089,46 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
return 0;
}
-static struct eth_driver rte_igb_pmd = {
- .pci_drv = {
- .id_table = pci_id_igb_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_igb_dev_init,
- .eth_dev_uninit = eth_igb_dev_uninit,
- .dev_private_size = sizeof(struct e1000_adapter),
+static int eth_igb_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct e1000_adapter), eth_igb_dev_init);
+}
+
+static int eth_igb_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_igb_dev_uninit);
+}
+
+static struct rte_pci_driver rte_igb_pmd = {
+ .id_table = pci_id_igb_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_igb_pci_probe,
+ .remove = eth_igb_pci_remove,
};
+
+static int eth_igbvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct e1000_adapter), eth_igbvf_dev_init);
+}
+
+static int eth_igbvf_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_igbvf_dev_uninit);
+}
+
/*
* virtual function driver struct
*/
-static struct eth_driver rte_igbvf_pmd = {
- .pci_drv = {
- .id_table = pci_id_igbvf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_igbvf_dev_init,
- .eth_dev_uninit = eth_igbvf_dev_uninit,
- .dev_private_size = sizeof(struct e1000_adapter),
+static struct rte_pci_driver rte_igbvf_pmd = {
+ .id_table = pci_id_igbvf_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = eth_igbvf_pci_probe,
+ .remove = eth_igbvf_pci_remove,
};
static void
@@ -5309,9 +5325,9 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-RTE_PMD_REGISTER_PCI(net_e1000_igb, rte_igb_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_e1000_igb, rte_igb_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb, pci_id_igb_map);
RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb_vf, pci_id_igbvf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb_vf, "* igb_uio | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 23/42] net/ena: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (21 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 22/42] net/igb: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 24/42] net/enic: " Gaetan Rivet
` (19 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/ena/ena_ethdev.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 5dd44d7..f5f748f 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -33,6 +33,7 @@
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_tcp.h>
#include <rte_atomic.h>
#include <rte_dev.h>
@@ -1776,17 +1777,25 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
return sent_idx;
}
-static struct eth_driver rte_ena_pmd = {
- .pci_drv = {
- .id_table = pci_id_ena_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_ena_dev_init,
- .dev_private_size = sizeof(struct ena_adapter),
+static int eth_ena_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct ena_adapter), eth_ena_dev_init);
+}
+
+static int eth_ena_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
+}
+
+static struct rte_pci_driver rte_ena_pmd = {
+ .id_table = pci_id_ena_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = eth_ena_pci_probe,
+ .remove = eth_ena_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_ena, rte_ena_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_ena, rte_ena_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_ena, pci_id_ena_map);
RTE_PMD_REGISTER_KMOD_DEP(net_ena, "* igb_uio | uio_pci_generic | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 24/42] net/enic: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (22 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 23/42] net/ena: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 25/42] net/fm10k: " Gaetan Rivet
` (18 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/enic/enic_ethdev.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 2c2e29e..7579696 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -38,6 +38,7 @@
#include <rte_dev.h>
#include <rte_pci.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_string_fns.h>
#include "vnic_intr.h"
@@ -629,17 +630,25 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
return enic_probe(enic);
}
-static struct eth_driver rte_enic_pmd = {
- .pci_drv = {
- .id_table = pci_id_enic_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_enicpmd_dev_init,
- .dev_private_size = sizeof(struct enic),
+static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct enic),
+ eth_enicpmd_dev_init);
+}
+
+static int eth_enic_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
+}
+
+static struct rte_pci_driver rte_enic_pmd = {
+ .id_table = pci_id_enic_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_enic_pci_probe,
+ .remove = eth_enic_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_enic, rte_enic_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_enic, rte_enic_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_enic, pci_id_enic_map);
RTE_PMD_REGISTER_KMOD_DEP(net_enic, "* igb_uio | uio_pci_generic | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 25/42] net/fm10k: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (23 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 24/42] net/enic: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 26/42] net/i40e: " Gaetan Rivet
` (17 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/fm10k/fm10k_ethdev.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index de0352e..94b4d40 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -32,6 +32,7 @@
*/
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_malloc.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
@@ -3112,6 +3113,18 @@ eth_fm10k_dev_uninit(struct rte_eth_dev *dev)
return 0;
}
+static int eth_fm10k_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct fm10k_adapter), eth_fm10k_dev_init);
+}
+
+static int eth_fm10k_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_fm10k_dev_uninit);
+}
+
/*
* The set of PCI devices this driver supports. This driver will enable both PF
* and SRIOV-VF devices.
@@ -3123,18 +3136,13 @@ static const struct rte_pci_id pci_id_fm10k_map[] = {
{ .vendor_id = 0, /* sentinel */ },
};
-static struct eth_driver rte_pmd_fm10k = {
- .pci_drv = {
- .id_table = pci_id_fm10k_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_fm10k_dev_init,
- .eth_dev_uninit = eth_fm10k_dev_uninit,
- .dev_private_size = sizeof(struct fm10k_adapter),
+static struct rte_pci_driver rte_pmd_fm10k = {
+ .id_table = pci_id_fm10k_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_fm10k_pci_probe,
+ .remove = eth_fm10k_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_fm10k, rte_pmd_fm10k.pci_drv);
+RTE_PMD_REGISTER_PCI(net_fm10k, rte_pmd_fm10k);
RTE_PMD_REGISTER_PCI_TABLE(net_fm10k, pci_id_fm10k_map);
RTE_PMD_REGISTER_KMOD_DEP(net_fm10k, "* igb_uio | uio_pci_generic | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 26/42] net/i40e: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (24 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 25/42] net/fm10k: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 27/42] net/i40evf: " Gaetan Rivet
` (16 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/i40e/i40e_ethdev.c | 36 ++++++++++++++++++++++--------------
drivers/net/i40e/i40e_fdir.c | 2 +-
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 6927fde..ac5e181 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -45,6 +45,7 @@
#include <rte_pci.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_memzone.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
@@ -642,16 +643,23 @@ static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
#define I40E_NB_TXQ_PRIO_XSTATS (sizeof(rte_i40e_txq_prio_strings) / \
sizeof(rte_i40e_txq_prio_strings[0]))
-static struct eth_driver rte_i40e_pmd = {
- .pci_drv = {
- .id_table = pci_id_i40e_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_i40e_dev_init,
- .eth_dev_uninit = eth_i40e_dev_uninit,
- .dev_private_size = sizeof(struct i40e_adapter),
+static int eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct i40e_adapter), eth_i40e_dev_init);
+}
+
+static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_i40e_dev_uninit);
+}
+
+static struct rte_pci_driver rte_i40e_pmd = {
+ .id_table = pci_id_i40e_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_i40e_pci_probe,
+ .remove = eth_i40e_pci_remove,
};
static inline int
@@ -682,7 +690,7 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
return 0;
}
-RTE_PMD_REGISTER_PCI(net_i40e, rte_i40e_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_i40e, rte_i40e_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_i40e, pci_id_i40e_map);
RTE_PMD_REGISTER_KMOD_DEP(net_i40e, "* igb_uio | uio_pci_generic | vfio");
@@ -10689,10 +10697,10 @@ i40e_filter_restore(struct i40e_pf *pf)
}
static bool
-is_device_supported(struct rte_eth_dev *dev, struct eth_driver *drv)
+is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv)
{
- if (strcmp(dev->driver->pci_drv.driver.name,
- drv->pci_drv.driver.name))
+ if (strcmp(dev->data->drv_name,
+ drv->driver.name))
return false;
return true;
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 32d3b19..28cc554 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -257,7 +257,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.driver.name,
+ eth_dev->data->drv_name,
I40E_FDIR_MZ_NAME,
eth_dev->data->port_id);
mz = i40e_memzone_reserve(z_name, I40E_FDIR_PKT_LEN, SOCKET_ID_ANY);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 27/42] net/i40evf: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (25 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 26/42] net/i40e: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 28/42] net/ixgbe: " Gaetan Rivet
` (15 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/i40e/i40e_ethdev_vf.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 7e48fea..cd9e51f 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -55,6 +55,7 @@
#include <rte_alarm.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
#include <rte_dev.h>
@@ -1543,22 +1544,30 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
return 0;
}
+
+static int eth_i40evf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct i40e_adapter), i40evf_dev_init);
+}
+
+static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, i40evf_dev_uninit);
+}
+
/*
* virtual function driver struct
*/
-static struct eth_driver rte_i40evf_pmd = {
- .pci_drv = {
- .id_table = pci_id_i40evf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = i40evf_dev_init,
- .eth_dev_uninit = i40evf_dev_uninit,
- .dev_private_size = sizeof(struct i40e_adapter),
+static struct rte_pci_driver rte_i40evf_pmd = {
+ .id_table = pci_id_i40evf_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = eth_i40evf_pci_probe,
+ .remove = eth_i40evf_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_i40e_vf, rte_i40evf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_i40e_vf, rte_i40evf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_i40e_vf, pci_id_i40evf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_i40e_vf, "* igb_uio | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 28/42] net/ixgbe: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (26 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 27/42] net/i40evf: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 29/42] net/mlx: Don't reference eth_driver Gaetan Rivet
` (14 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 66 ++++++++++++++++++++++++----------------
1 file changed, 40 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 1462324..ef781ca 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -56,6 +56,7 @@
#include <rte_alarm.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
#include <rte_random.h>
@@ -247,7 +248,7 @@ static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,
struct ether_addr *mac_addr);
static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config);
static bool is_device_supported(struct rte_eth_dev *dev,
- struct eth_driver *drv);
+ struct rte_pci_driver *drv);
/* For Virtual Function support */
static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev);
@@ -1768,31 +1769,45 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
return 0;
}
-static struct eth_driver rte_ixgbe_pmd = {
- .pci_drv = {
- .id_table = pci_id_ixgbe_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_ixgbe_dev_init,
- .eth_dev_uninit = eth_ixgbe_dev_uninit,
- .dev_private_size = sizeof(struct ixgbe_adapter),
+static int eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct ixgbe_adapter), eth_ixgbe_dev_init);
+}
+
+static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_ixgbe_dev_uninit);
+}
+
+static struct rte_pci_driver rte_ixgbe_pmd = {
+ .id_table = pci_id_ixgbe_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_ixgbe_pci_probe,
+ .remove = eth_ixgbe_pci_remove,
};
+static int eth_ixgbevf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct ixgbe_adapter), eth_ixgbevf_dev_init);
+}
+
+static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_ixgbevf_dev_uninit);
+}
+
/*
* virtual function driver struct
*/
-static struct eth_driver rte_ixgbevf_pmd = {
- .pci_drv = {
- .id_table = pci_id_ixgbevf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_ixgbevf_dev_init,
- .eth_dev_uninit = eth_ixgbevf_dev_uninit,
- .dev_private_size = sizeof(struct ixgbe_adapter),
+static struct rte_pci_driver rte_ixgbevf_pmd = {
+ .id_table = pci_id_ixgbevf_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = eth_ixgbevf_pci_probe,
+ .remove = eth_ixgbevf_pci_remove,
};
static int
@@ -4383,10 +4398,9 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)
}
static bool
-is_device_supported(struct rte_eth_dev *dev, struct eth_driver *drv)
+is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv)
{
- if (strcmp(dev->driver->pci_drv.driver.name,
- drv->pci_drv.driver.name))
+ if (strcmp(dev->data->drv_name, drv->driver.name))
return false;
return true;
@@ -8774,9 +8788,9 @@ rte_pmd_ixgbe_set_tc_bw_alloc(uint8_t port,
return 0;
}
-RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe, pci_id_ixgbe_map);
RTE_PMD_REGISTER_KMOD_DEP(net_ixgbe, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_PCI(net_ixgbe_vf, rte_ixgbevf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_ixgbe_vf, rte_ixgbevf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe_vf, pci_id_ixgbevf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_ixgbe_vf, "* igb_uio | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 29/42] net/mlx: Don't reference eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (27 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 28/42] net/ixgbe: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 30/42] net/nfp: Don't use eth_driver Gaetan Rivet
` (13 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
The eth_driver concept is unused in the mlx drivers so don't reference it.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/mlx4/mlx4.c | 24 +++++++++++-------------
drivers/net/mlx5/mlx5.c | 24 +++++++++++-------------
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index aff9155..a1363c8 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -60,6 +60,7 @@
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_dev.h>
#include <rte_mbuf.h>
#include <rte_errno.h>
@@ -5477,7 +5478,7 @@ mlx4_args(struct rte_devargs *devargs, struct mlx4_conf *conf)
return ret;
}
-static struct eth_driver mlx4_driver;
+static struct rte_pci_driver mlx4_driver;
/**
* DPDK callback to register a PCI device.
@@ -5509,7 +5510,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
int i;
(void)pci_drv;
- assert(pci_drv == &mlx4_driver.pci_drv);
+ assert(pci_drv == &mlx4_driver);
/* Get mlx4_dev[] index. */
idx = mlx4_dev_idx(&pci_dev->addr);
if (idx == -1) {
@@ -5808,7 +5809,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
rte_eth_copy_pci_info(eth_dev, pci_dev);
- eth_dev->driver = &mlx4_driver;
+ eth_dev->device->driver = &mlx4_driver.driver;
priv->dev = eth_dev;
eth_dev->dev_ops = &mlx4_dev_ops;
@@ -5872,16 +5873,13 @@ static const struct rte_pci_id mlx4_pci_id_map[] = {
}
};
-static struct eth_driver mlx4_driver = {
- .pci_drv = {
- .driver = {
- .name = MLX4_DRIVER_NAME
- },
- .id_table = mlx4_pci_id_map,
- .probe = mlx4_pci_probe,
- .drv_flags = RTE_PCI_DRV_INTR_LSC,
+static struct rte_pci_driver mlx4_driver = {
+ .driver = {
+ .name = MLX4_DRIVER_NAME
},
- .dev_private_size = sizeof(struct priv)
+ .id_table = mlx4_pci_id_map,
+ .probe = mlx4_pci_probe,
+ .drv_flags = RTE_PCI_DRV_INTR_LSC,
};
/**
@@ -5900,7 +5898,7 @@ rte_mlx4_pmd_init(void)
*/
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
- rte_eal_pci_register(&mlx4_driver.pci_drv);
+ rte_eal_pci_register(&mlx4_driver);
}
RTE_PMD_EXPORT_NAME(net_mlx4, __COUNTER__);
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b7eb9b5..6de4e4c 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -56,6 +56,7 @@
#endif
#include <rte_malloc.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_pci.h>
#include <rte_common.h>
#include <rte_kvargs.h>
@@ -365,7 +366,7 @@ mlx5_args(struct priv *priv, struct rte_devargs *devargs)
return 0;
}
-static struct eth_driver mlx5_driver;
+static struct rte_pci_driver mlx5_driver;
/**
* DPDK callback to register a PCI device.
@@ -396,7 +397,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
int i;
(void)pci_drv;
- assert(pci_drv == &mlx5_driver.pci_drv);
+ assert(pci_drv == &mlx5_driver);
/* Get mlx5_dev[] index. */
idx = mlx5_dev_idx(&pci_dev->addr);
if (idx == -1) {
@@ -731,7 +732,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
eth_dev->device = &pci_dev->device;
rte_eth_copy_pci_info(eth_dev, pci_dev);
- eth_dev->driver = &mlx5_driver;
+ eth_dev->device->driver = &mlx5_driver.driver;
priv->dev = eth_dev;
eth_dev->dev_ops = &mlx5_dev_ops;
@@ -813,16 +814,13 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
}
};
-static struct eth_driver mlx5_driver = {
- .pci_drv = {
- .driver = {
- .name = MLX5_DRIVER_NAME
- },
- .id_table = mlx5_pci_id_map,
- .probe = mlx5_pci_probe,
- .drv_flags = RTE_PCI_DRV_INTR_LSC,
+static struct rte_pci_driver mlx5_driver = {
+ .driver = {
+ .name = MLX5_DRIVER_NAME
},
- .dev_private_size = sizeof(struct priv)
+ .id_table = mlx5_pci_id_map,
+ .probe = mlx5_pci_probe,
+ .drv_flags = RTE_PCI_DRV_INTR_LSC,
};
/**
@@ -840,7 +838,7 @@ rte_mlx5_pmd_init(void)
*/
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
- rte_eal_pci_register(&mlx5_driver.pci_drv);
+ rte_eal_pci_register(&mlx5_driver);
}
RTE_PMD_EXPORT_NAME(net_mlx5, __COUNTER__);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 30/42] net/nfp: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (28 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 29/42] net/mlx: Don't reference eth_driver Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 31/42] net/qede: " Gaetan Rivet
` (12 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/nfp/nfp_net.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index d06b10a..eda87a5 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -46,6 +46,7 @@
#include <rte_log.h>
#include <rte_debug.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_dev.h>
#include <rte_ether.h>
#include <rte_malloc.h>
@@ -2580,18 +2581,26 @@ static const struct rte_pci_id pci_id_nfp_net_map[] = {
},
};
-static struct eth_driver rte_nfp_net_pmd = {
- .pci_drv = {
- .id_table = pci_id_nfp_net_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = nfp_net_init,
- .dev_private_size = sizeof(struct nfp_net_adapter),
+static int eth_nfp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct nfp_net_adapter), nfp_net_init);
+}
+
+static int eth_nfp_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
+}
+
+static struct rte_pci_driver rte_nfp_net_pmd = {
+ .id_table = pci_id_nfp_net_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_nfp_pci_probe,
+ .remove = eth_nfp_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_nfp, rte_nfp_net_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_nfp, rte_nfp_net_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_nfp, pci_id_nfp_net_map);
RTE_PMD_REGISTER_KMOD_DEP(net_nfp, "* igb_uio | uio_pci_generic | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 31/42] net/qede: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (29 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 30/42] net/nfp: Don't use eth_driver Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 32/42] net/sfc: " Gaetan Rivet
` (11 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/qede/qede_ethdev.c | 60 +++++++++++++++++++++++++-----------------
drivers/net/qede/qede_ethdev.h | 1 +
2 files changed, 37 insertions(+), 24 deletions(-)
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 5f469e5..fbad2a6 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2382,35 +2382,47 @@ static const struct rte_pci_id pci_id_qede_map[] = {
{.vendor_id = 0,}
};
-static struct eth_driver rte_qedevf_pmd = {
- .pci_drv = {
- .id_table = pci_id_qedevf_map,
- .drv_flags =
- RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = qedevf_eth_dev_init,
- .eth_dev_uninit = qedevf_eth_dev_uninit,
- .dev_private_size = sizeof(struct qede_dev),
+static int qedevf_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct qede_dev), qedevf_eth_dev_init);
+}
+
+static int qedevf_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, qedevf_eth_dev_uninit);
+}
+
+static struct rte_pci_driver rte_qedevf_pmd = {
+ .id_table = pci_id_qedevf_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = qedevf_eth_dev_pci_probe,
+ .remove = qedevf_eth_dev_pci_remove,
};
-static struct eth_driver rte_qede_pmd = {
- .pci_drv = {
- .id_table = pci_id_qede_map,
- .drv_flags =
- RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = qede_eth_dev_init,
- .eth_dev_uninit = qede_eth_dev_uninit,
- .dev_private_size = sizeof(struct qede_dev),
+static int qede_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct qede_dev), qede_eth_dev_init);
+}
+
+static int qede_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, qede_eth_dev_uninit);
+}
+
+static struct rte_pci_driver rte_qede_pmd = {
+ .id_table = pci_id_qede_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = qede_eth_dev_pci_probe,
+ .remove = qede_eth_dev_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_qede, rte_qede_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_qede, rte_qede_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_qede, pci_id_qede_map);
RTE_PMD_REGISTER_KMOD_DEP(net_qede, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_PCI(net_qede_vf, rte_qedevf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_qede_vf, rte_qedevf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_qede_vf, pci_id_qedevf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_qede_vf, "* igb_uio | vfio");
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index 56703da..f5549c2 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -14,6 +14,7 @@
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_dev.h>
#include <rte_ip.h>
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 32/42] net/sfc: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (30 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 31/42] net/qede: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 33/42] net/szedata2: " Gaetan Rivet
` (10 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/sfc/sfc_ethdev.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 4f7b640..7620080 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -31,6 +31,7 @@
#include <rte_dev.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_pci.h>
#include <rte_errno.h>
@@ -1596,21 +1597,28 @@ static const struct rte_pci_id pci_id_sfc_efx_map[] = {
{ .vendor_id = 0 /* sentinel */ }
};
-static struct eth_driver sfc_efx_pmd = {
- .pci_drv = {
- .id_table = pci_id_sfc_efx_map,
- .drv_flags =
- RTE_PCI_DRV_INTR_LSC |
- RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = sfc_eth_dev_init,
- .eth_dev_uninit = sfc_eth_dev_uninit,
- .dev_private_size = sizeof(struct sfc_adapter),
+static int sfc_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct sfc_adapter), sfc_eth_dev_init);
+}
+
+static int sfc_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, sfc_eth_dev_uninit);
+}
+
+static struct rte_pci_driver sfc_efx_pmd = {
+ .id_table = pci_id_sfc_efx_map,
+ .drv_flags =
+ RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_NEED_MAPPING,
+ .probe = sfc_eth_dev_pci_probe,
+ .remove = sfc_eth_dev_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_sfc_efx, sfc_efx_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_sfc_efx, sfc_efx_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_sfc_efx, pci_id_sfc_efx_map);
RTE_PMD_REGISTER_KMOD_DEP(net_sfc_efx, "* igb_uio | uio_pci_generic | vfio");
RTE_PMD_REGISTER_PARAM_STRING(net_sfc_efx,
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 33/42] net/szedata2: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (31 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 32/42] net/sfc: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 34/42] net/thunderx: " Gaetan Rivet
` (9 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/szedata2/rte_eth_szedata2.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index fe7a6b3..54212b7 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -45,6 +45,7 @@
#include <rte_mbuf.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_kvargs.h>
@@ -1587,18 +1588,26 @@ static const struct rte_pci_id rte_szedata2_pci_id_table[] = {
}
};
-static struct eth_driver szedata2_eth_driver = {
- .pci_drv = {
- .id_table = rte_szedata2_pci_id_table,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = rte_szedata2_eth_dev_init,
- .eth_dev_uninit = rte_szedata2_eth_dev_uninit,
- .dev_private_size = sizeof(struct pmd_internals),
+static int szedata2_eth_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct pmd_internals), rte_szedata2_eth_dev_init);
+}
+
+static int szedata2_eth_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev,
+ rte_szedata2_eth_dev_uninit);
+}
+
+static struct rte_pci_driver szedata2_eth_driver = {
+ .id_table = rte_szedata2_pci_id_table,
+ .probe = szedata2_eth_pci_probe,
+ .remove = szedata2_eth_pci_remove,
};
-RTE_PMD_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver.pci_drv);
+RTE_PMD_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver);
RTE_PMD_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
RTE_PMD_REGISTER_KMOD_DEP(RTE_SZEDATA2_DRIVER_NAME,
"* combo6core & combov3 & szedata2 & szedata2_cv3");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 34/42] net/thunderx: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (32 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 33/42] net/szedata2: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 35/42] net/vmxnet3: " Gaetan Rivet
` (8 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/thunderx/nicvf_ethdev.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 6c3670a..b0b9c3b 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -53,6 +53,7 @@
#include <rte_eal.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_interrupts.h>
#include <rte_log.h>
#include <rte_memory.h>
@@ -2131,17 +2132,25 @@ static const struct rte_pci_id pci_id_nicvf_map[] = {
},
};
-static struct eth_driver rte_nicvf_pmd = {
- .pci_drv = {
- .id_table = pci_id_nicvf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = nicvf_eth_dev_init,
- .dev_private_size = sizeof(struct nicvf),
+static int nicvf_eth_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct nicvf),
+ nicvf_eth_dev_init);
+}
+
+static int nicvf_eth_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
+}
+
+static struct rte_pci_driver rte_nicvf_pmd = {
+ .id_table = pci_id_nicvf_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = nicvf_eth_pci_probe,
+ .remove = nicvf_eth_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_thunderx, rte_nicvf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_thunderx, rte_nicvf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_thunderx, pci_id_nicvf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_thunderx, "* igb_uio | uio_pci_generic | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 35/42] net/vmxnet3: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (33 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 34/42] net/thunderx: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 36/42] net/avp: " Gaetan Rivet
` (7 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index ae3efaa..0e8eb75 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -56,6 +56,7 @@
#include <rte_alarm.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_atomic.h>
#include <rte_string_fns.h>
#include <rte_malloc.h>
@@ -377,16 +378,23 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
return 0;
}
-static struct eth_driver rte_vmxnet3_pmd = {
- .pci_drv = {
- .id_table = pci_id_vmxnet3_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_vmxnet3_dev_init,
- .eth_dev_uninit = eth_vmxnet3_dev_uninit,
- .dev_private_size = sizeof(struct vmxnet3_hw),
+static int eth_vmxnet3_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_probe(pci_dev,
+ sizeof(struct vmxnet3_hw), eth_vmxnet3_dev_init);
+}
+
+static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_vmxnet3_dev_uninit);
+}
+
+static struct rte_pci_driver rte_vmxnet3_pmd = {
+ .id_table = pci_id_vmxnet3_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = eth_vmxnet3_pci_probe,
+ .remove = eth_vmxnet3_pci_remove,
};
static int
@@ -1116,6 +1124,6 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-RTE_PMD_REGISTER_PCI(net_vmxnet3, rte_vmxnet3_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_vmxnet3, rte_vmxnet3_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_vmxnet3, pci_id_vmxnet3_map);
RTE_PMD_REGISTER_KMOD_DEP(net_vmxnet3, "* igb_uio | uio_pci_generic | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 36/42] net/avp: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (34 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 35/42] net/vmxnet3: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 18:48 ` Legacy, Allain
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 37/42] net/liquidio: " Gaetan Rivet
` (6 subsequent siblings)
42 siblings, 1 reply; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
drivers/net/avp/avp_ethdev.c | 43 ++++++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 11 deletions(-)
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 7f2ab47..9ca2786 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -37,6 +37,7 @@
#include <unistd.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_memzone.h>
@@ -1076,17 +1077,37 @@ eth_avp_dev_uninit(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+eth_avp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ struct rte_eth_dev *eth_dev;
+ int ret;
-static struct eth_driver rte_avp_pmd = {
- {
- .id_table = pci_id_avp_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = eth_avp_dev_init,
- .eth_dev_uninit = eth_avp_dev_uninit,
- .dev_private_size = sizeof(struct avp_adapter),
+ eth_dev = rte_eth_dev_pci_allocate(pci_dev,
+ sizeof(struct avp_adapter));
+ if (eth_dev == NULL)
+ return -ENOMEM;
+
+ ret = eth_avp_dev_init(eth_dev);
+ if (ret)
+ rte_eth_dev_pci_release(eth_dev);
+
+ return ret;
+}
+
+static int
+eth_avp_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev,
+ eth_avp_dev_uninit);
+}
+
+static struct rte_pci_driver rte_avp_pmd = {
+ .id_table = pci_id_avp_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = eth_avp_pci_probe,
+ .remove = eth_avp_pci_remove,
};
static int
@@ -2287,5 +2308,5 @@ avp_dev_stats_reset(struct rte_eth_dev *eth_dev)
}
}
-RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_avp, pci_id_avp_map);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH v2 36/42] net/avp: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 36/42] net/avp: " Gaetan Rivet
@ 2017-04-11 18:48 ` Legacy, Allain
0 siblings, 0 replies; 104+ messages in thread
From: Legacy, Allain @ 2017-04-11 18:48 UTC (permalink / raw)
To: Gaetan Rivet, dev; +Cc: Jan Blunck
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Gaetan Rivet
> Sent: Tuesday, April 11, 2017 11:45 AM
> To: dev@dpdk.org
> Cc: Jan Blunck
> Subject: [dpdk-dev] [PATCH v2 36/42] net/avp: Don't use eth_driver
>
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---
Acked-by: Allain Legacy <allain.legacy@windriver.com>
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 37/42] net/liquidio: Don't use eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (35 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 36/42] net/avp: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 38/42] ethdev: remove unused ethdev PCI probe/remove Gaetan Rivet
` (5 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
drivers/net/liquidio/lio_ethdev.c | 44 +++++++++++++++++++++++++++++----------
1 file changed, 33 insertions(+), 11 deletions(-)
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index df91659..4edb0d1 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -32,6 +32,7 @@
*/
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_cycles.h>
#include <rte_malloc.h>
#include <rte_alarm.h>
@@ -2011,24 +2012,45 @@ lio_eth_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
+static int
+lio_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ struct rte_eth_dev *eth_dev;
+ int ret;
+
+ eth_dev = rte_eth_dev_pci_allocate(pci_dev,
+ sizeof(struct lio_device));
+ if (eth_dev == NULL)
+ return -ENOMEM;
+
+ ret = lio_eth_dev_init(eth_dev);
+ if (ret)
+ rte_eth_dev_pci_release(eth_dev);
+
+ return ret;
+}
+
+static int
+lio_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev,
+ lio_eth_dev_uninit);
+}
+
/* Set of PCI devices this driver supports */
static const struct rte_pci_id pci_id_liovf_map[] = {
{ RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_VF_VID) },
{ .vendor_id = 0, /* sentinel */ }
};
-static struct eth_driver rte_liovf_pmd = {
- .pci_drv = {
- .id_table = pci_id_liovf_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- },
- .eth_dev_init = lio_eth_dev_init,
- .eth_dev_uninit = lio_eth_dev_uninit,
- .dev_private_size = sizeof(struct lio_device),
+static struct rte_pci_driver rte_liovf_pmd = {
+ .id_table = pci_id_liovf_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = lio_eth_dev_pci_probe,
+ .remove = lio_eth_dev_pci_remove,
};
-RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_liovf, pci_id_liovf_map);
RTE_PMD_REGISTER_KMOD_DEP(net_liovf, "* igb_uio | vfio");
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 38/42] ethdev: remove unused ethdev PCI probe/remove
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (36 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 37/42] net/liquidio: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-12 11:24 ` Neil Horman
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 39/42] ethdev: remove unused ethdev driver Gaetan Rivet
` (4 subsequent siblings)
42 siblings, 1 reply; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
This removes the now unused rte_eth_dev_pci_probe() and
rte_eth_dev_pci_remove() functions.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
lib/librte_ether/rte_ethdev.c | 97 ----------------------------------
lib/librte_ether/rte_ethdev.h | 15 ------
lib/librte_ether/rte_ethdev_pci.h | 10 ++++
lib/librte_ether/rte_ether_version.map | 10 +---
4 files changed, 11 insertions(+), 121 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6ed2321..5bb016d 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -285,103 +285,6 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
}
int
-rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
-{
- struct eth_driver *eth_drv;
- struct rte_eth_dev *eth_dev;
- char ethdev_name[RTE_ETH_NAME_MAX_LEN];
-
- int diag;
-
- eth_drv = (struct eth_driver *)pci_drv;
-
- rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
- sizeof(ethdev_name));
-
- if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- eth_dev = rte_eth_dev_allocate(ethdev_name);
- if (eth_dev == NULL)
- return -ENOMEM;
-
- eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
- eth_drv->dev_private_size,
- RTE_CACHE_LINE_SIZE);
- if (eth_dev->data->dev_private == NULL)
- rte_panic("Cannot allocate memzone for private port data\n");
- } else {
- eth_dev = rte_eth_dev_attach_secondary(ethdev_name);
- if (eth_dev == NULL) {
- /*
- * if we failed to attach a device, it means the
- * device is skipped in primary process, due to
- * some errors. If so, we return a positive value,
- * to let EAL skip it for the secondary process
- * as well.
- */
- return 1;
- }
- }
- eth_dev->device = &pci_dev->device;
- eth_dev->intr_handle = &pci_dev->intr_handle;
- eth_dev->driver = eth_drv;
-
- /* Invoke PMD device initialization function */
- diag = (*eth_drv->eth_dev_init)(eth_dev);
- if (diag == 0)
- return 0;
-
- RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%x device_id=0x%x) failed\n",
- pci_drv->driver.name,
- (unsigned) pci_dev->id.vendor_id,
- (unsigned) pci_dev->id.device_id);
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- rte_free(eth_dev->data->dev_private);
- rte_eth_dev_release_port(eth_dev);
- return diag;
-}
-
-int
-rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
-{
- const struct eth_driver *eth_drv;
- struct rte_eth_dev *eth_dev;
- char ethdev_name[RTE_ETH_NAME_MAX_LEN];
- int ret;
-
- if (pci_dev == NULL)
- return -EINVAL;
-
- rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
- sizeof(ethdev_name));
-
- eth_dev = rte_eth_dev_allocated(ethdev_name);
- if (eth_dev == NULL)
- return -ENODEV;
-
- eth_drv = (const struct eth_driver *)pci_dev->driver;
-
- /* Invoke PMD device uninit function */
- if (*eth_drv->eth_dev_uninit) {
- ret = (*eth_drv->eth_dev_uninit)(eth_dev);
- if (ret)
- return ret;
- }
-
- /* free ether device */
- rte_eth_dev_release_port(eth_dev);
-
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- rte_free(eth_dev->data->dev_private);
-
- eth_dev->device = NULL;
- eth_dev->driver = NULL;
- eth_dev->data = NULL;
-
- return 0;
-}
-
-int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
if (port_id >= RTE_MAX_ETHPORTS ||
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8cd1a11..abef70f 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4608,21 +4608,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
-/**
- * @internal
- * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
- * interface.
- */
-int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev);
-
-/**
- * @internal
- * Wrapper for use by pci drivers as a .remove function to detach a ethdev
- * interface.
- */
-int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
-
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h
index 4b728db..fe62589 100644
--- a/lib/librte_ether/rte_ethdev_pci.h
+++ b/lib/librte_ether/rte_ethdev_pci.h
@@ -108,6 +108,11 @@ rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
typedef int (*eth_dev_pci_callback_t)(struct rte_eth_dev *eth_dev);
+/**
+ * @internal
+ * Wrapper for use by pci drivers in a .probe function to attach to a ethdev
+ * interface.
+ */
static inline int
rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
size_t private_data_size, eth_dev_pci_callback_t dev_init)
@@ -127,6 +132,11 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
return ret;
}
+/**
+ * @internal
+ * Wrapper for use by pci drivers in a .remove function to detach a ethdev
+ * interface.
+ */
static inline int
rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev,
eth_dev_pci_callback_t dev_uninit)
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index f2bed58..b95312f 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -134,14 +134,6 @@ DPDK_16.07 {
} DPDK_16.04;
-DPDK_16.11 {
- global:
-
- rte_eth_dev_pci_probe;
- rte_eth_dev_pci_remove;
-
-} DPDK_16.07;
-
DPDK_17.02 {
global:
@@ -153,7 +145,7 @@ DPDK_17.02 {
rte_flow_query;
rte_flow_validate;
-} DPDK_16.11;
+} DPDK_16.07;
DPDK_17.05 {
global:
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH v2 38/42] ethdev: remove unused ethdev PCI probe/remove
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 38/42] ethdev: remove unused ethdev PCI probe/remove Gaetan Rivet
@ 2017-04-12 11:24 ` Neil Horman
2017-04-12 11:28 ` Neil Horman
0 siblings, 1 reply; 104+ messages in thread
From: Neil Horman @ 2017-04-12 11:24 UTC (permalink / raw)
To: Gaetan Rivet; +Cc: dev, Jan Blunck
On Tue, Apr 11, 2017 at 05:44:45PM +0200, Gaetan Rivet wrote:
> From: Jan Blunck <jblunck@infradead.org>
>
> This removes the now unused rte_eth_dev_pci_probe() and
> rte_eth_dev_pci_remove() functions.
>
> Signed-off-by: Jan Blunck <jblunck@infradead.org>
> ---
> lib/librte_ether/rte_ethdev.c | 97 ----------------------------------
> lib/librte_ether/rte_ethdev.h | 15 ------
> lib/librte_ether/rte_ethdev_pci.h | 10 ++++
> lib/librte_ether/rte_ether_version.map | 10 +---
> 4 files changed, 11 insertions(+), 121 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 6ed2321..5bb016d 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -285,103 +285,6 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
> }
>
> int
> -rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
> - struct rte_pci_device *pci_dev)
> -{
> - struct eth_driver *eth_drv;
> - struct rte_eth_dev *eth_dev;
> - char ethdev_name[RTE_ETH_NAME_MAX_LEN];
> -
> - int diag;
> -
> - eth_drv = (struct eth_driver *)pci_drv;
> -
> - rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
> - sizeof(ethdev_name));
> -
> - if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> - eth_dev = rte_eth_dev_allocate(ethdev_name);
> - if (eth_dev == NULL)
> - return -ENOMEM;
> -
> - eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
> - eth_drv->dev_private_size,
> - RTE_CACHE_LINE_SIZE);
> - if (eth_dev->data->dev_private == NULL)
> - rte_panic("Cannot allocate memzone for private port data\n");
> - } else {
> - eth_dev = rte_eth_dev_attach_secondary(ethdev_name);
> - if (eth_dev == NULL) {
> - /*
> - * if we failed to attach a device, it means the
> - * device is skipped in primary process, due to
> - * some errors. If so, we return a positive value,
> - * to let EAL skip it for the secondary process
> - * as well.
> - */
> - return 1;
> - }
> - }
> - eth_dev->device = &pci_dev->device;
> - eth_dev->intr_handle = &pci_dev->intr_handle;
> - eth_dev->driver = eth_drv;
> -
> - /* Invoke PMD device initialization function */
> - diag = (*eth_drv->eth_dev_init)(eth_dev);
> - if (diag == 0)
> - return 0;
> -
> - RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%x device_id=0x%x) failed\n",
> - pci_drv->driver.name,
> - (unsigned) pci_dev->id.vendor_id,
> - (unsigned) pci_dev->id.device_id);
> - if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> - rte_free(eth_dev->data->dev_private);
> - rte_eth_dev_release_port(eth_dev);
> - return diag;
> -}
> -
> -int
> -rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
> -{
> - const struct eth_driver *eth_drv;
> - struct rte_eth_dev *eth_dev;
> - char ethdev_name[RTE_ETH_NAME_MAX_LEN];
> - int ret;
> -
> - if (pci_dev == NULL)
> - return -EINVAL;
> -
> - rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
> - sizeof(ethdev_name));
> -
> - eth_dev = rte_eth_dev_allocated(ethdev_name);
> - if (eth_dev == NULL)
> - return -ENODEV;
> -
> - eth_drv = (const struct eth_driver *)pci_dev->driver;
> -
> - /* Invoke PMD device uninit function */
> - if (*eth_drv->eth_dev_uninit) {
> - ret = (*eth_drv->eth_dev_uninit)(eth_dev);
> - if (ret)
> - return ret;
> - }
> -
> - /* free ether device */
> - rte_eth_dev_release_port(eth_dev);
> -
> - if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> - rte_free(eth_dev->data->dev_private);
> -
> - eth_dev->device = NULL;
> - eth_dev->driver = NULL;
> - eth_dev->data = NULL;
> -
> - return 0;
> -}
> -
> -int
> rte_eth_dev_is_valid_port(uint8_t port_id)
> {
> if (port_id >= RTE_MAX_ETHPORTS ||
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 8cd1a11..abef70f 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -4608,21 +4608,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
> int
> rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
>
> -/**
> - * @internal
> - * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
> - * interface.
> - */
> -int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
> - struct rte_pci_device *pci_dev);
> -
> -/**
> - * @internal
> - * Wrapper for use by pci drivers as a .remove function to detach a ethdev
> - * interface.
> - */
> -int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
> -
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h
> index 4b728db..fe62589 100644
> --- a/lib/librte_ether/rte_ethdev_pci.h
> +++ b/lib/librte_ether/rte_ethdev_pci.h
> @@ -108,6 +108,11 @@ rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
>
> typedef int (*eth_dev_pci_callback_t)(struct rte_eth_dev *eth_dev);
>
> +/**
> + * @internal
> + * Wrapper for use by pci drivers in a .probe function to attach to a ethdev
> + * interface.
> + */
> static inline int
> rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
> size_t private_data_size, eth_dev_pci_callback_t dev_init)
> @@ -127,6 +132,11 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
> return ret;
> }
>
> +/**
> + * @internal
> + * Wrapper for use by pci drivers in a .remove function to detach a ethdev
> + * interface.
> + */
> static inline int
> rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev,
> eth_dev_pci_callback_t dev_uninit)
> diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
> index f2bed58..b95312f 100644
> --- a/lib/librte_ether/rte_ether_version.map
> +++ b/lib/librte_ether/rte_ether_version.map
> @@ -134,14 +134,6 @@ DPDK_16.07 {
>
> } DPDK_16.04;
>
> -DPDK_16.11 {
> - global:
> -
> - rte_eth_dev_pci_probe;
> - rte_eth_dev_pci_remove;
> -
> -} DPDK_16.07;
> -
> DPDK_17.02 {
> global:
>
> @@ -153,7 +145,7 @@ DPDK_17.02 {
> rte_flow_query;
> rte_flow_validate;
>
> -} DPDK_16.11;
> +} DPDK_16.07;
>
> DPDK_17.05 {
> global:
> --
> 2.1.4
>
>
given that this was an exported function, there may be other application out
there using this method. You need to go through the deprecation process before
this can be integrated.
Neil
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH v2 38/42] ethdev: remove unused ethdev PCI probe/remove
2017-04-12 11:24 ` Neil Horman
@ 2017-04-12 11:28 ` Neil Horman
0 siblings, 0 replies; 104+ messages in thread
From: Neil Horman @ 2017-04-12 11:28 UTC (permalink / raw)
To: Gaetan Rivet; +Cc: dev, Jan Blunck
On Wed, Apr 12, 2017 at 07:24:26AM -0400, Neil Horman wrote:
> On Tue, Apr 11, 2017 at 05:44:45PM +0200, Gaetan Rivet wrote:
> > From: Jan Blunck <jblunck@infradead.org>
> >
> > This removes the now unused rte_eth_dev_pci_probe() and
> > rte_eth_dev_pci_remove() functions.
> >
> > Signed-off-by: Jan Blunck <jblunck@infradead.org>
> > ---
> > lib/librte_ether/rte_ethdev.c | 97 ----------------------------------
> > lib/librte_ether/rte_ethdev.h | 15 ------
> > lib/librte_ether/rte_ethdev_pci.h | 10 ++++
> > lib/librte_ether/rte_ether_version.map | 10 +---
> > 4 files changed, 11 insertions(+), 121 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> > index 6ed2321..5bb016d 100644
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -285,103 +285,6 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
> > }
> >
> > int
> > -rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
> > - struct rte_pci_device *pci_dev)
> > -{
> > - struct eth_driver *eth_drv;
> > - struct rte_eth_dev *eth_dev;
> > - char ethdev_name[RTE_ETH_NAME_MAX_LEN];
> > -
> > - int diag;
> > -
> > - eth_drv = (struct eth_driver *)pci_drv;
> > -
> > - rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
> > - sizeof(ethdev_name));
> > -
> > - if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> > - eth_dev = rte_eth_dev_allocate(ethdev_name);
> > - if (eth_dev == NULL)
> > - return -ENOMEM;
> > -
> > - eth_dev->data->dev_private = rte_zmalloc("ethdev private structure",
> > - eth_drv->dev_private_size,
> > - RTE_CACHE_LINE_SIZE);
> > - if (eth_dev->data->dev_private == NULL)
> > - rte_panic("Cannot allocate memzone for private port data\n");
> > - } else {
> > - eth_dev = rte_eth_dev_attach_secondary(ethdev_name);
> > - if (eth_dev == NULL) {
> > - /*
> > - * if we failed to attach a device, it means the
> > - * device is skipped in primary process, due to
> > - * some errors. If so, we return a positive value,
> > - * to let EAL skip it for the secondary process
> > - * as well.
> > - */
> > - return 1;
> > - }
> > - }
> > - eth_dev->device = &pci_dev->device;
> > - eth_dev->intr_handle = &pci_dev->intr_handle;
> > - eth_dev->driver = eth_drv;
> > -
> > - /* Invoke PMD device initialization function */
> > - diag = (*eth_drv->eth_dev_init)(eth_dev);
> > - if (diag == 0)
> > - return 0;
> > -
> > - RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%x device_id=0x%x) failed\n",
> > - pci_drv->driver.name,
> > - (unsigned) pci_dev->id.vendor_id,
> > - (unsigned) pci_dev->id.device_id);
> > - if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> > - rte_free(eth_dev->data->dev_private);
> > - rte_eth_dev_release_port(eth_dev);
> > - return diag;
> > -}
> > -
> > -int
> > -rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
> > -{
> > - const struct eth_driver *eth_drv;
> > - struct rte_eth_dev *eth_dev;
> > - char ethdev_name[RTE_ETH_NAME_MAX_LEN];
> > - int ret;
> > -
> > - if (pci_dev == NULL)
> > - return -EINVAL;
> > -
> > - rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
> > - sizeof(ethdev_name));
> > -
> > - eth_dev = rte_eth_dev_allocated(ethdev_name);
> > - if (eth_dev == NULL)
> > - return -ENODEV;
> > -
> > - eth_drv = (const struct eth_driver *)pci_dev->driver;
> > -
> > - /* Invoke PMD device uninit function */
> > - if (*eth_drv->eth_dev_uninit) {
> > - ret = (*eth_drv->eth_dev_uninit)(eth_dev);
> > - if (ret)
> > - return ret;
> > - }
> > -
> > - /* free ether device */
> > - rte_eth_dev_release_port(eth_dev);
> > -
> > - if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> > - rte_free(eth_dev->data->dev_private);
> > -
> > - eth_dev->device = NULL;
> > - eth_dev->driver = NULL;
> > - eth_dev->data = NULL;
> > -
> > - return 0;
> > -}
> > -
> > -int
> > rte_eth_dev_is_valid_port(uint8_t port_id)
> > {
> > if (port_id >= RTE_MAX_ETHPORTS ||
> > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> > index 8cd1a11..abef70f 100644
> > --- a/lib/librte_ether/rte_ethdev.h
> > +++ b/lib/librte_ether/rte_ethdev.h
> > @@ -4608,21 +4608,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
> > int
> > rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
> >
> > -/**
> > - * @internal
> > - * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
> > - * interface.
> > - */
> > -int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
> > - struct rte_pci_device *pci_dev);
> > -
> > -/**
> > - * @internal
> > - * Wrapper for use by pci drivers as a .remove function to detach a ethdev
> > - * interface.
> > - */
> > -int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
> > -
> > #ifdef __cplusplus
> > }
> > #endif
> > diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h
> > index 4b728db..fe62589 100644
> > --- a/lib/librte_ether/rte_ethdev_pci.h
> > +++ b/lib/librte_ether/rte_ethdev_pci.h
> > @@ -108,6 +108,11 @@ rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
> >
> > typedef int (*eth_dev_pci_callback_t)(struct rte_eth_dev *eth_dev);
> >
> > +/**
> > + * @internal
> > + * Wrapper for use by pci drivers in a .probe function to attach to a ethdev
> > + * interface.
> > + */
> > static inline int
> > rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
> > size_t private_data_size, eth_dev_pci_callback_t dev_init)
> > @@ -127,6 +132,11 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
> > return ret;
> > }
> >
> > +/**
> > + * @internal
> > + * Wrapper for use by pci drivers in a .remove function to detach a ethdev
> > + * interface.
> > + */
> > static inline int
> > rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev,
> > eth_dev_pci_callback_t dev_uninit)
> > diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
> > index f2bed58..b95312f 100644
> > --- a/lib/librte_ether/rte_ether_version.map
> > +++ b/lib/librte_ether/rte_ether_version.map
> > @@ -134,14 +134,6 @@ DPDK_16.07 {
> >
> > } DPDK_16.04;
> >
> > -DPDK_16.11 {
> > - global:
> > -
> > - rte_eth_dev_pci_probe;
> > - rte_eth_dev_pci_remove;
> > -
> > -} DPDK_16.07;
> > -
> > DPDK_17.02 {
> > global:
> >
> > @@ -153,7 +145,7 @@ DPDK_17.02 {
> > rte_flow_query;
> > rte_flow_validate;
> >
> > -} DPDK_16.11;
> > +} DPDK_16.07;
> >
> > DPDK_17.05 {
> > global:
> > --
> > 2.1.4
> >
> >
>
> given that this was an exported function, there may be other application out
> there using this method. You need to go through the deprecation process before
> this can be integrated.
>
> Neil
>
>
Scratch that, was looking at an old version of the deprecation file, this has
already been announced.
Neil
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 39/42] ethdev: remove unused ethdev driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (37 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 38/42] ethdev: remove unused ethdev PCI probe/remove Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 40/42] test: " Gaetan Rivet
` (3 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
This removes the now unused struct eth_driver.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/cxgbe/cxgbe_main.c | 1 -
drivers/net/ring/rte_eth_ring.c | 1 -
lib/librte_ether/rte_ethdev.h | 73 --------------------------------------
lib/librte_ether/rte_ethdev_pci.h | 2 --
lib/librte_ether/rte_ethdev_vdev.h | 1 -
5 files changed, 78 deletions(-)
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 541fc40..f895b18 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1165,7 +1165,6 @@ int cxgbe_probe(struct adapter *adapter)
allocate_mac:
pi->eth_dev->device = &adapter->pdev->device;
pi->eth_dev->data->dev_private = pi;
- pi->eth_dev->driver = adapter->eth_dev->driver;
pi->eth_dev->dev_ops = adapter->eth_dev->dev_ops;
pi->eth_dev->tx_pkt_burst = adapter->eth_dev->tx_pkt_burst;
pi->eth_dev->rx_pkt_burst = adapter->eth_dev->rx_pkt_burst;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 4bae895..36867e6 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -338,7 +338,6 @@ do_eth_dev_ring_create(const char *name,
data->mac_addrs = &internals->address;
eth_dev->data = data;
- eth_dev->driver = NULL;
eth_dev->dev_ops = &ops;
data->dev_flags = RTE_ETH_DEV_DETACHABLE;
data->kdrv = RTE_KDRV_NONE;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index abef70f..9fb8432 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1651,7 +1651,6 @@ struct rte_eth_dev {
eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */
struct rte_eth_dev_data *data; /**< Pointer to device data */
- const struct eth_driver *driver;/**< Driver for this device */
const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
struct rte_device *device; /**< Backing device */
struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
@@ -1854,78 +1853,6 @@ int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
*/
int rte_eth_dev_detach(uint8_t port_id, char *devname);
-struct eth_driver;
-/**
- * @internal
- * Initialization function of an Ethernet driver invoked for each matching
- * Ethernet PCI device detected during the PCI probing phase.
- *
- * @param eth_dev
- * The *eth_dev* pointer is the address of the *rte_eth_dev* structure
- * associated with the matching device and which have been [automatically]
- * allocated in the *rte_eth_devices* array.
- * The *eth_dev* structure is supplied to the driver initialization function
- * with the following fields already initialized:
- *
- * - *pci_dev*: Holds the pointers to the *rte_pci_device* structure which
- * contains the generic PCI information of the matching device.
- *
- * - *driver*: Holds the pointer to the *eth_driver* structure.
- *
- * - *dev_private*: Holds a pointer to the device private data structure.
- *
- * - *mtu*: Contains the default Ethernet maximum frame length (1500).
- *
- * - *port_id*: Contains the port index of the device (actually the index
- * of the *eth_dev* structure in the *rte_eth_devices* array).
- *
- * @return
- * - 0: Success, the device is properly initialized by the driver.
- * In particular, the driver MUST have set up the *dev_ops* pointer
- * of the *eth_dev* structure.
- * - <0: Error code of the device initialization failure.
- */
-typedef int (*eth_dev_init_t)(struct rte_eth_dev *eth_dev);
-
-/**
- * @internal
- * Finalization function of an Ethernet driver invoked for each matching
- * Ethernet PCI device detected during the PCI closing phase.
- *
- * @param eth_dev
- * The *eth_dev* pointer is the address of the *rte_eth_dev* structure
- * associated with the matching device and which have been [automatically]
- * allocated in the *rte_eth_devices* array.
- * @return
- * - 0: Success, the device is properly finalized by the driver.
- * In particular, the driver MUST free the *dev_ops* pointer
- * of the *eth_dev* structure.
- * - <0: Error code of the device initialization failure.
- */
-typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev);
-
-/**
- * @internal
- * The structure associated with a PMD Ethernet driver.
- *
- * Each Ethernet driver acts as a PCI driver and is represented by a generic
- * *eth_driver* structure that holds:
- *
- * - An *rte_pci_driver* structure (which must be the first field).
- *
- * - The *eth_dev_init* function invoked for each matching PCI device.
- *
- * - The *eth_dev_uninit* function invoked for each matching PCI device.
- *
- * - The size of the private data to allocate for each matching device.
- */
-struct eth_driver {
- struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */
- eth_dev_init_t eth_dev_init; /**< Device init function. */
- eth_dev_uninit_t eth_dev_uninit; /**< Device uninit function. */
- unsigned int dev_private_size; /**< Size of device private data. */
-};
-
/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h
index fe62589..f85d26f 100644
--- a/lib/librte_ether/rte_ethdev_pci.h
+++ b/lib/librte_ether/rte_ethdev_pci.h
@@ -84,7 +84,6 @@ rte_eth_dev_pci_allocate(struct rte_pci_device *dev, size_t private_data_size)
}
eth_dev->device = &dev->device;
- eth_dev->driver = NULL;
eth_dev->intr_handle = &dev->intr_handle;
rte_eth_copy_pci_info(eth_dev, dev);
return eth_dev;
@@ -102,7 +101,6 @@ rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
eth_dev->data->dev_private = NULL;
eth_dev->device = NULL;
- eth_dev->driver = NULL;
eth_dev->intr_handle = NULL;
}
diff --git a/lib/librte_ether/rte_ethdev_vdev.h b/lib/librte_ether/rte_ethdev_vdev.h
index 0b47535..fa2cb61 100644
--- a/lib/librte_ether/rte_ethdev_vdev.h
+++ b/lib/librte_ether/rte_ethdev_vdev.h
@@ -73,7 +73,6 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)
}
eth_dev->device = &dev->device;
- eth_dev->driver = NULL;
eth_dev->intr_handle = NULL;
eth_dev->data->kdrv = RTE_KDRV_NONE;
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 40/42] test: remove unused ethdev driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (38 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 39/42] ethdev: remove unused ethdev driver Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 41/42] ethdev: remove PCI specific helper from generic ethdev header Gaetan Rivet
` (2 subsequent siblings)
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
test/test/virtual_pmd.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c
index b209355..186d9b7 100644
--- a/test/test/virtual_pmd.c
+++ b/test/test/virtual_pmd.c
@@ -532,7 +532,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
{
struct rte_pci_device *pci_dev = NULL;
struct rte_eth_dev *eth_dev = NULL;
- struct eth_driver *eth_drv = NULL;
struct rte_pci_driver *pci_drv = NULL;
struct rte_pci_id *id_table = NULL;
struct virtual_ethdev_private *dev_private = NULL;
@@ -550,10 +549,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
if (pci_dev == NULL)
goto err;
- eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, socket_id);
- if (eth_drv == NULL)
- goto err;
-
pci_drv = rte_zmalloc_socket(name, sizeof(*pci_drv), 0, socket_id);
if (pci_drv == NULL)
goto err;
@@ -594,8 +589,8 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
pci_drv->drv_flags &= ~RTE_PCI_DRV_INTR_LSC;
- eth_drv->pci_drv = (struct rte_pci_driver)(*pci_drv);
- eth_dev->driver = eth_drv;
+ eth_dev->device = &pci_dev->device;
+ eth_dev->device->driver = &pci_drv->driver;
eth_dev->data->nb_rx_queues = (uint16_t)1;
eth_dev->data->nb_tx_queues = (uint16_t)1;
@@ -622,7 +617,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
dev_private->dev_ops = virtual_ethdev_default_dev_ops;
eth_dev->dev_ops = &dev_private->dev_ops;
- pci_dev->device.driver = ð_drv->pci_drv.driver;
+ pci_dev->device.driver = &pci_drv->driver;
eth_dev->device = &pci_dev->device;
eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success;
@@ -633,7 +628,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
err:
rte_free(pci_dev);
rte_free(pci_drv);
- rte_free(eth_drv);
rte_free(id_table);
rte_free(dev_private);
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 41/42] ethdev: remove PCI specific helper from generic ethdev header
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (39 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 40/42] test: " Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 42/42] ethdev: don't include PCI header Gaetan Rivet
2017-04-12 16:25 ` [dpdk-dev] [PATCH v2 00/42] Remove struct eth_driver Stephen Hemminger
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
This moves the rte_eth_copy_pci_info() into the PCI specific ethdev
header. As a side effect this also removes it from the list of symbols
exported by the rte_ethdev library.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
drivers/net/cxgbe/cxgbe_main.c | 1 +
lib/librte_ether/rte_ethdev.c | 20 --------------------
lib/librte_ether/rte_ethdev.h | 14 --------------
lib/librte_ether/rte_ethdev_pci.h | 32 ++++++++++++++++++++++++++++++++
lib/librte_ether/rte_ether_version.map | 1 -
5 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index f895b18..1f230cd 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -57,6 +57,7 @@
#include <rte_alarm.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_pci.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
#include <rte_random.h>
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 5bb016d..474188c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3117,26 +3117,6 @@ rte_eth_dev_get_dcb_info(uint8_t port_id,
return (*dev->dev_ops->get_dcb_info)(dev, dcb_info);
}
-void
-rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
-{
- 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;
- }
-
- eth_dev->intr_handle = &pci_dev->intr_handle;
-
- eth_dev->data->dev_flags = 0;
- if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
- eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
-
- eth_dev->data->kdrv = pci_dev->kdrv;
- eth_dev->data->numa_node = pci_dev->device.numa_node;
- eth_dev->data->drv_name = pci_dev->driver->driver.name;
-}
-
int
rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
struct rte_eth_l2_tunnel_conf *l2_tunnel)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9fb8432..bd538b0 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4422,20 +4422,6 @@ int rte_eth_timesync_read_time(uint8_t port_id, struct timespec *time);
int rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *time);
/**
- * Copy pci device info to the Ethernet device data.
- *
- * @param eth_dev
- * The *eth_dev* pointer is the address of the *rte_eth_dev* structure.
- * @param pci_dev
- * The *pci_dev* pointer is the address of the *rte_pci_device* structure.
- *
- * @return
- * - 0 on success, negative on error
- */
-void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
- struct rte_pci_device *pci_dev);
-
-/**
* Create memzone for HW rings.
* malloc can't be used as the physical address is needed.
* If the memzone is already created, then this function returns a ptr
diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h
index f85d26f..2953579 100644
--- a/lib/librte_ether/rte_ethdev_pci.h
+++ b/lib/librte_ether/rte_ethdev_pci.h
@@ -39,6 +39,38 @@
#include <rte_ethdev.h>
/**
+ * Copy pci device info to the Ethernet device data.
+ *
+ * @param eth_dev
+ * The *eth_dev* pointer is the address of the *rte_eth_dev* structure.
+ * @param pci_dev
+ * The *pci_dev* pointer is the address of the *rte_pci_device* structure.
+ *
+ * @return
+ * - 0 on success, negative on error
+ */
+static inline void
+rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
+ struct rte_pci_device *pci_dev)
+{
+ 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;
+ }
+
+ eth_dev->intr_handle = &pci_dev->intr_handle;
+
+ eth_dev->data->dev_flags = 0;
+ if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
+
+ eth_dev->data->kdrv = pci_dev->kdrv;
+ eth_dev->data->numa_node = pci_dev->device.numa_node;
+ eth_dev->data->drv_name = pci_dev->driver->driver.name;
+}
+
+/**
* @internal
* Allocates a new ethdev slot for an ethernet device and returns the pointer
* to that slot for the driver to use.
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index b95312f..e6018ae 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -7,7 +7,6 @@ DPDK_2.2 {
rte_eth_allmulticast_disable;
rte_eth_allmulticast_enable;
rte_eth_allmulticast_get;
- rte_eth_copy_pci_info;
rte_eth_dev_allocate;
rte_eth_dev_allocated;
rte_eth_dev_attach;
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2 42/42] ethdev: don't include PCI header
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (40 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 41/42] ethdev: remove PCI specific helper from generic ethdev header Gaetan Rivet
@ 2017-04-11 15:44 ` Gaetan Rivet
2017-04-12 16:25 ` [dpdk-dev] [PATCH v2 00/42] Remove struct eth_driver Stephen Hemminger
42 siblings, 0 replies; 104+ messages in thread
From: Gaetan Rivet @ 2017-04-11 15:44 UTC (permalink / raw)
To: dev; +Cc: Jan Blunck
From: Jan Blunck <jblunck@infradead.org>
Since the PCI functionality has been moved to the PCI specific ethdev
header we don't need to include rte_pci.h from here anymore.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
lib/librte_ether/rte_ethdev.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index bd538b0..68a91e2 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -179,7 +179,6 @@ extern "C" {
#include <rte_log.h>
#include <rte_interrupts.h>
-#include <rte_pci.h>
#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_errno.h>
@@ -901,6 +900,8 @@ struct rte_eth_conf {
#define DEV_TX_OFFLOAD_GENEVE_TNL_TSO 0x00001000 /**< Used for tunneling packet. */
#define DEV_TX_OFFLOAD_MACSEC_INSERT 0x00002000
+struct rte_pci_device;
+
/**
* Ethernet device information
*/
--
2.1.4
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/42] Remove struct eth_driver
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 00/42] " Gaetan Rivet
` (41 preceding siblings ...)
2017-04-11 15:44 ` [dpdk-dev] [PATCH v2 42/42] ethdev: don't include PCI header Gaetan Rivet
@ 2017-04-12 16:25 ` Stephen Hemminger
2017-04-14 13:09 ` Thomas Monjalon
42 siblings, 1 reply; 104+ messages in thread
From: Stephen Hemminger @ 2017-04-12 16:25 UTC (permalink / raw)
To: Gaetan Rivet; +Cc: dev, Jan Blunck
On Tue, 11 Apr 2017 17:44:07 +0200
Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
> I rebased the following work of Jan:
>
> This series is removing the PCI specific struct eth_driver from rte_ether. The
> PCI drivers are changed to use the newly introduced header-only helpers
> instead. Although the virtual drivers did not make use of the ethdev's driver
> field they are converted to use the VDEV specific allocation helpers. The
> motivation for this change is to properly embed a reference to the generic
> rte_device in the ethdev.
>
> The series is based on:
>
> * http://dpdk.org/dev/patchwork/patch/20416/
> * http://dpdk.org/dev/patchwork/patch/20417/
> * The "Rework vdev probing to use rte_bus infrastructure" series
> * http://dpdk.org/dev/patchwork/patch/21058/
>
> Changes in v2:
> * Removed the patch "net/vmxnet3: use library function for DMA zone reserve"
> It is essentially duplicating the following commit:
> 04df93d1edac ("net/vmxnet3: fix queue size changes")
> * Fixed header includes for mlx4 and mlx5 PMD
> * Followed the changes of the series for new PMDs (AVP, liquidio)
> * Made KNI use the new API
> * Made PCAP use the new API
> * Fixed undefined behavior on vdev driver arg parsing
> * Fixed virtual_pmd for unit test
>
> Gaetan Rivet (5):
> net/kni: use ethdev allocation helper for virtual devices
> net/pcap: use ethdev allocation helper for virtual devices
> net/avp: Don't use eth_driver
> net/liquidio: Don't use eth_driver
> test: remove unused ethdev driver
>
> Jan Blunck (37):
> eal: add name field to generic device
> eal: parse "driver" device argument before probing drivers
> net/nfp: use library function for DMA zone reserve
> ether: add allocation helper for virtual drivers
> net/tap: use ethdev allocation helper for virtual devices
> net/vhost: use ethdev allocation helper for virtual devices
> net/virtio: use ethdev allocation helper for virtual devices
> net/af_packet: use ethdev allocation helper for virtual devices
> app/test: don't short-circuit null device creation
> net/null: internalize eth_dev_null_create()
> net/null: use ethdev allocation helper for virtual devices
> net/bonding: make bonding API call through EAL on create/free
> net/bonding: use ethdev allocation helper for virtual devices
> ethdev: add PCI driver helpers
> net/virtio: Don't use eth_driver
> net/bnx2x: Don't use eth_driver
> net/bnxt: Don't use eth_driver
> net/cxgbe: Don't use eth_driver
> net/em: Don't use eth_driver
> net/igb: Don't use eth_driver
> net/ena: Don't use eth_driver
> net/enic: Don't use eth_driver
> net/fm10k: Don't use eth_driver
> net/i40e: Don't use eth_driver
> net/i40evf: Don't use eth_driver
> net/ixgbe: Don't use eth_driver
> net/mlx: Don't reference eth_driver
> net/nfp: Don't use eth_driver
> net/qede: Don't use eth_driver
> net/sfc: Don't use eth_driver
> net/szedata2: Don't use eth_driver
> net/thunderx: Don't use eth_driver
> net/vmxnet3: Don't use eth_driver
> ethdev: remove unused ethdev PCI probe/remove
> ethdev: remove unused ethdev driver
> ethdev: remove PCI specific helper from generic ethdev header
> ethdev: don't include PCI header
>
> drivers/net/af_packet/rte_eth_af_packet.c | 42 +++----
> drivers/net/avp/avp_ethdev.c | 43 +++++--
> drivers/net/bnx2x/bnx2x_ethdev.c | 64 ++++++----
> drivers/net/bnx2x/bnx2x_rxtx.c | 2 +-
> drivers/net/bnxt/bnxt_ethdev.c | 36 ++++--
> drivers/net/bonding/rte_eth_bond_api.c | 171 ++++----------------------
> drivers/net/bonding/rte_eth_bond_args.c | 2 +-
> drivers/net/bonding/rte_eth_bond_pmd.c | 160 +++++++++++++++++++++++--
> drivers/net/cxgbe/cxgbe_ethdev.c | 29 +++--
> drivers/net/cxgbe/cxgbe_main.c | 2 +-
> drivers/net/cxgbe/sge.c | 6 +-
> drivers/net/e1000/em_ethdev.c | 30 +++--
> drivers/net/e1000/igb_ethdev.c | 60 ++++++----
> drivers/net/ena/ena_ethdev.c | 29 +++--
> drivers/net/enic/enic_ethdev.c | 29 +++--
> drivers/net/fm10k/fm10k_ethdev.c | 30 +++--
> drivers/net/i40e/i40e_ethdev.c | 36 +++---
> drivers/net/i40e/i40e_ethdev_vf.c | 31 +++--
> drivers/net/i40e/i40e_fdir.c | 2 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 66 +++++++----
> drivers/net/kni/rte_eth_kni.c | 39 +++---
> drivers/net/liquidio/lio_ethdev.c | 44 +++++--
> drivers/net/mlx4/mlx4.c | 24 ++--
> drivers/net/mlx5/mlx5.c | 24 ++--
> drivers/net/nfp/nfp_net.c | 59 ++++-----
> drivers/net/null/Makefile | 7 +-
> drivers/net/null/rte_eth_null.c | 55 +++------
> drivers/net/null/rte_eth_null.h | 40 -------
> drivers/net/null/rte_pmd_null_version.map | 7 --
> drivers/net/pcap/rte_eth_pcap.c | 62 +++++-----
> drivers/net/qede/qede_ethdev.c | 60 ++++++----
> drivers/net/qede/qede_ethdev.h | 1 +
> drivers/net/ring/rte_eth_ring.c | 1 -
> drivers/net/sfc/sfc_ethdev.c | 34 ++++--
> drivers/net/szedata2/rte_eth_szedata2.c | 29 +++--
> drivers/net/tap/rte_eth_tap.c | 38 ++----
> drivers/net/thunderx/nicvf_ethdev.c | 29 +++--
> drivers/net/vhost/rte_eth_vhost.c | 54 ++++-----
> drivers/net/virtio/virtio_ethdev.c | 34 ++++--
> drivers/net/virtio/virtio_user_ethdev.c | 20 +---
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 30 +++--
> lib/librte_eal/bsdapp/eal/eal_pci.c | 3 +
> lib/librte_eal/common/eal_common_dev.c | 3 +
> lib/librte_eal/common/eal_common_vdev.c | 53 ++++++++-
> lib/librte_eal/common/include/rte_dev.h | 1 +
> lib/librte_eal/common/include/rte_pci.h | 1 +
> lib/librte_eal/linuxapp/eal/eal_pci.c | 3 +
> lib/librte_ether/Makefile | 2 +
> lib/librte_ether/rte_ethdev.c | 117 ------------------
> lib/librte_ether/rte_ethdev.h | 105 +---------------
> lib/librte_ether/rte_ethdev_pci.h | 191 ++++++++++++++++++++++++++++++
> lib/librte_ether/rte_ethdev_vdev.h | 84 +++++++++++++
> lib/librte_ether/rte_ether_version.map | 11 +-
> test/test/test_link_bonding_rssconf.c | 4 +-
> test/test/virtual_pmd.c | 12 +-
> 55 files changed, 1185 insertions(+), 966 deletions(-)
> delete mode 100644 drivers/net/null/rte_eth_null.h
> create mode 100644 lib/librte_ether/rte_ethdev_pci.h
> create mode 100644 lib/librte_ether/rte_ethdev_vdev.h
>
Looks good.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/42] Remove struct eth_driver
2017-04-12 16:25 ` [dpdk-dev] [PATCH v2 00/42] Remove struct eth_driver Stephen Hemminger
@ 2017-04-14 13:09 ` Thomas Monjalon
2017-04-18 18:27 ` [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver Ferruh Yigit
0 siblings, 1 reply; 104+ messages in thread
From: Thomas Monjalon @ 2017-04-14 13:09 UTC (permalink / raw)
To: Gaetan Rivet, Jan Blunck, pablo.de.lara.guarch, jerin.jacob
Cc: dev, Stephen Hemminger, bruce.richardson
2017-04-12 09:25, Stephen Hemminger:
> On Tue, 11 Apr 2017 17:44:07 +0200
> Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
>
> > I rebased the following work of Jan:
> >
> > This series is removing the PCI specific struct eth_driver from rte_ether. The
> > PCI drivers are changed to use the newly introduced header-only helpers
> > instead. Although the virtual drivers did not make use of the ethdev's driver
> > field they are converted to use the VDEV specific allocation helpers. The
> > motivation for this change is to properly embed a reference to the generic
> > rte_device in the ethdev.
> >
> > The series is based on:
> >
> > * http://dpdk.org/dev/patchwork/patch/20416/
> > * http://dpdk.org/dev/patchwork/patch/20417/
> > * The "Rework vdev probing to use rte_bus infrastructure" series
> > * http://dpdk.org/dev/patchwork/patch/21058/
> >
> > Changes in v2:
> > * Removed the patch "net/vmxnet3: use library function for DMA zone reserve"
> > It is essentially duplicating the following commit:
> > 04df93d1edac ("net/vmxnet3: fix queue size changes")
> > * Fixed header includes for mlx4 and mlx5 PMD
> > * Followed the changes of the series for new PMDs (AVP, liquidio)
> > * Made KNI use the new API
> > * Made PCAP use the new API
> > * Fixed undefined behavior on vdev driver arg parsing
> > * Fixed virtual_pmd for unit test
>
> Looks good.
>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Applied, thanks
Now we need to remove
struct rte_pci_driver pci_drv;
from cryptodev and eventdev.
Sooner is better :)
Thanks
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver
2017-04-14 13:09 ` Thomas Monjalon
@ 2017-04-18 18:27 ` Ferruh Yigit
2017-04-18 18:27 ` [dpdk-dev] [PATCH 1/2] net/ark: remove eth_dev Ferruh Yigit
` (3 more replies)
0 siblings, 4 replies; 104+ messages in thread
From: Ferruh Yigit @ 2017-04-18 18:27 UTC (permalink / raw)
To: dev
Cc: Ferruh Yigit, Shepard Siegel, Ed Czeck, John Miller,
Hemant Agrawal, Shreyansh Jain, Jianfeng Tan, Jan Blunck,
Stephen Hemminger, Gaetan Rivet
There are two PMDs in next-net and not merged into main tree:
- ARK
- DPAA2
These drivers also needs to get these updates.
And to prevent breaking build these changes can be squashed into PMD
in next-net before integration. This means these changes needs to be
merged promptly.
ARK PMD updates are done, can you please review and please feel free to
re-make the patch if required.
CC: Shepard Siegel <shepard.siegel@atomicrules.com>
CC: Ed Czeck <ed.czeck@atomicrules.com>
CC: John Miller <john.miller@atomicrules.com>
Since DPAA2 has its own device type and not using ethdev driver, it
looks like no update required, can you please double check?
CC: Hemant Agrawal <hemant.agrawal@nxp.com>
CC: Shreyansh Jain <shreyansh.jain@nxp.c
Also xenvirt giving a build error related ethdev driver usage, build
error fixed, again please feel free to send new version of the patch
if required. This can be preferred to get into main tree.
CC: Jianfeng Tan <jianfeng.tan@intel.com>
CC: Jan Blunck <jblunck@infradead.org>
CC: Stephen Hemminger <stephen@networkplumber.org>
CC: Gaetan Rivet <gaetan.rivet@6wind.com>
Ferruh Yigit (2):
net/ark: remove eth_dev
net/xenvirt: remove ethdev driver
drivers/net/ark/ark_ethdev.c | 44 +++++++++++++++++++++++++----------
drivers/net/xenvirt/rte_eth_xenvirt.c | 1 -
2 files changed, 32 insertions(+), 13 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH 1/2] net/ark: remove eth_dev
2017-04-18 18:27 ` [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver Ferruh Yigit
@ 2017-04-18 18:27 ` Ferruh Yigit
2017-04-18 19:24 ` Ed Czeck
2017-04-18 18:27 ` [dpdk-dev] [PATCH 2/2] net/xenvirt: remove ethdev driver Ferruh Yigit
` (2 subsequent siblings)
3 siblings, 1 reply; 104+ messages in thread
From: Ferruh Yigit @ 2017-04-18 18:27 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit, Shepard Siegel, Ed Czeck, John Miller
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
CC: Shepard Siegel <shepard.siegel@atomicrules.com>
CC: Ed Czeck <ed.czeck@atomicrules.com>
CC: John Miller <john.miller@atomicrules.com>
---
drivers/net/ark/ark_ethdev.c | 44 ++++++++++++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 651dd26..1f6cd0d 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -40,6 +40,7 @@
#include "ark_global.h"
#include "ark_logs.h"
#include "ark_ethdev.h"
+#include <rte_ethdev_pci.h>
#include "ark_ethdev_tx.h"
#include "ark_ethdev_rx.h"
#include "ark_mpu.h"
@@ -118,16 +119,36 @@ static const struct rte_pci_id pci_id_ark_map[] = {
{.vendor_id = 0, /* sentinel */ },
};
-static struct eth_driver rte_ark_pmd = {
- .pci_drv = {
- .probe = rte_eth_dev_pci_probe,
- .remove = rte_eth_dev_pci_remove,
- .id_table = pci_id_ark_map,
- .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC
- },
- .eth_dev_init = eth_ark_dev_init,
- .eth_dev_uninit = eth_ark_dev_uninit,
- .dev_private_size = sizeof(struct ark_adapter),
+static int
+eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+ struct rte_pci_device *pci_dev)
+{
+ struct rte_eth_dev *eth_dev;
+ int ret;
+
+ eth_dev = rte_eth_dev_pci_allocate(pci_dev, sizeof(struct ark_adapter));
+
+ if (eth_dev == NULL)
+ return -ENOMEM;
+
+ ret = eth_ark_dev_init(eth_dev);
+ if (ret)
+ rte_eth_dev_pci_release(eth_dev);
+
+ return ret;
+}
+
+static int
+eth_ark_pci_remove(struct rte_pci_device *pci_dev)
+{
+ return rte_eth_dev_pci_generic_remove(pci_dev, eth_ark_dev_uninit);
+}
+
+static struct rte_pci_driver rte_ark_pmd = {
+ .id_table = pci_id_ark_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = eth_ark_pci_probe,
+ .remove = eth_ark_pci_remove,
};
static const struct eth_dev_ops ark_eth_dev_ops = {
@@ -375,7 +396,6 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
eth_dev->device = &pci_dev->device;
eth_dev->data->dev_private = ark;
- eth_dev->driver = ark->eth_dev->driver;
eth_dev->dev_ops = ark->eth_dev->dev_ops;
eth_dev->tx_pkt_burst = ark->eth_dev->tx_pkt_burst;
eth_dev->rx_pkt_burst = ark->eth_dev->rx_pkt_burst;
@@ -963,7 +983,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params)
return 0;
}
-RTE_PMD_REGISTER_PCI(net_ark, rte_ark_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI(net_ark, rte_ark_pmd);
RTE_PMD_REGISTER_KMOD_DEP(net_ark, "* igb_uio | uio_pci_generic ");
RTE_PMD_REGISTER_PCI_TABLE(net_ark, pci_id_ark_map);
RTE_PMD_REGISTER_PARAM_STRING(net_ark,
--
2.9.3
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/xenvirt: remove ethdev driver
2017-04-18 18:27 ` [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver Ferruh Yigit
2017-04-18 18:27 ` [dpdk-dev] [PATCH 1/2] net/ark: remove eth_dev Ferruh Yigit
@ 2017-04-18 18:27 ` Ferruh Yigit
2017-04-19 9:52 ` [dpdk-dev] [PATCH v2] net/xenvirt: fix build error Ferruh Yigit
2017-04-18 18:38 ` [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver Ferruh Yigit
2017-04-19 11:37 ` Shreyansh Jain
3 siblings, 1 reply; 104+ messages in thread
From: Ferruh Yigit @ 2017-04-18 18:27 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit, Jianfeng Tan
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
CC: Jianfeng Tan <jianfeng.tan@intel.com>
---
drivers/net/xenvirt/rte_eth_xenvirt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 6ec8c08..7bd29fa 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -673,7 +673,6 @@ eth_dev_xenvirt_create(const char *name, const char *params,
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = RTE_KDRV_NONE;
eth_dev->data->drv_name = pmd_xenvirt_drv.driver.name;
- eth_dev->driver = NULL;
eth_dev->data->numa_node = numa_node;
eth_dev->rx_pkt_burst = eth_xenvirt_rx;
--
2.9.3
^ permalink raw reply [flat|nested] 104+ messages in thread
* [dpdk-dev] [PATCH v2] net/xenvirt: fix build error
2017-04-18 18:27 ` [dpdk-dev] [PATCH 2/2] net/xenvirt: remove ethdev driver Ferruh Yigit
@ 2017-04-19 9:52 ` Ferruh Yigit
2017-04-19 12:12 ` Thomas Monjalon
0 siblings, 1 reply; 104+ messages in thread
From: Ferruh Yigit @ 2017-04-19 9:52 UTC (permalink / raw)
To: Jianfeng Tan; +Cc: dev, Ferruh Yigit, Thomas Monjalon
build error:
.../drivers/net/xenvirt/rte_eth_xenvirt.c:676:9:
error: ‘struct rte_eth_dev’ has no member named ‘driver’
eth_dev->driver = NULL;
^~
ethdev driver removed, removing assignment to it to fix the build error
Fixes: 9dca21fb80b6 ("ethdev: remove ethdev driver")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
CC: Jianfeng Tan <jianfeng.tan@intel.com>
---
drivers/net/xenvirt/rte_eth_xenvirt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 6ec8c08..7bd29fa 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -673,7 +673,6 @@ eth_dev_xenvirt_create(const char *name, const char *params,
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = RTE_KDRV_NONE;
eth_dev->data->drv_name = pmd_xenvirt_drv.driver.name;
- eth_dev->driver = NULL;
eth_dev->data->numa_node = numa_node;
eth_dev->rx_pkt_burst = eth_xenvirt_rx;
--
2.9.3
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver
2017-04-18 18:27 ` [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver Ferruh Yigit
2017-04-18 18:27 ` [dpdk-dev] [PATCH 1/2] net/ark: remove eth_dev Ferruh Yigit
2017-04-18 18:27 ` [dpdk-dev] [PATCH 2/2] net/xenvirt: remove ethdev driver Ferruh Yigit
@ 2017-04-18 18:38 ` Ferruh Yigit
2017-04-19 11:37 ` Shreyansh Jain
3 siblings, 0 replies; 104+ messages in thread
From: Ferruh Yigit @ 2017-04-18 18:38 UTC (permalink / raw)
To: dev
Cc: Shepard Siegel, Ed Czeck, John Miller, Hemant Agrawal,
Shreyansh Jain, Jianfeng Tan, Jan Blunck, Stephen Hemminger,
Gaetan Rivet
On 4/18/2017 7:27 PM, Ferruh Yigit wrote:
> There are two PMDs in next-net and not merged into main tree:
> - ARK
> - DPAA2
>
> These drivers also needs to get these updates.
latest next-net rebased on main tree to help development of these.
! next-net is broken now !
>
> And to prevent breaking build these changes can be squashed into PMD
> in next-net before integration. This means these changes needs to be
> merged promptly.
>
> ARK PMD updates are done, can you please review and please feel free to
> re-make the patch if required.
> CC: Shepard Siegel <shepard.siegel@atomicrules.com>
> CC: Ed Czeck <ed.czeck@atomicrules.com>
> CC: John Miller <john.miller@atomicrules.com>
>
> Since DPAA2 has its own device type and not using ethdev driver, it
> looks like no update required, can you please double check?
> CC: Hemant Agrawal <hemant.agrawal@nxp.com>
> CC: Shreyansh Jain <shreyansh.jain@nxp.c
>
> Also xenvirt giving a build error related ethdev driver usage, build
> error fixed, again please feel free to send new version of the patch
> if required. This can be preferred to get into main tree.
> CC: Jianfeng Tan <jianfeng.tan@intel.com>
>
>
> CC: Jan Blunck <jblunck@infradead.org>
> CC: Stephen Hemminger <stephen@networkplumber.org>
> CC: Gaetan Rivet <gaetan.rivet@6wind.com>
>
>
> Ferruh Yigit (2):
> net/ark: remove eth_dev
> net/xenvirt: remove ethdev driver
>
> drivers/net/ark/ark_ethdev.c | 44 +++++++++++++++++++++++++----------
> drivers/net/xenvirt/rte_eth_xenvirt.c | 1 -
> 2 files changed, 32 insertions(+), 13 deletions(-)
>
^ permalink raw reply [flat|nested] 104+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver
2017-04-18 18:27 ` [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver Ferruh Yigit
` (2 preceding siblings ...)
2017-04-18 18:38 ` [dpdk-dev] [PATCH 0/2] next-net: remove ethdev driver Ferruh Yigit
@ 2017-04-19 11:37 ` Shreyansh Jain
3 siblings, 0 replies; 104+ messages in thread
From: Shreyansh Jain @ 2017-04-19 11:37 UTC (permalink / raw)
To: Ferruh Yigit
Cc: dev, Shepard Siegel, Ed Czeck, John Miller, Hemant Agrawal,
Shreyansh Jain, Jianfeng Tan, Jan Blunck, Stephen Hemminger,
Gaetan Rivet
On Tuesday 18 April 2017 11:57 PM, Ferruh Yigit wrote:
> There are two PMDs in next-net and not merged into main tree:
> - ARK
> - DPAA2
>
> These drivers also needs to get these updates.
>
> And to prevent breaking build these changes can be squashed into PMD
> in next-net before integration. This means these changes needs to be
> merged promptly.
>
> ARK PMD updates are done, can you please review and please feel free to
> re-make the patch if required.
> CC: Shepard Siegel <shepard.siegel@atomicrules.com>
> CC: Ed Czeck <ed.czeck@atomicrules.com>
> CC: John Miller <john.miller@atomicrules.com>
>
> Since DPAA2 has its own device type and not using ethdev driver, it
> looks like no update required, can you please double check?
> CC: Hemant Agrawal <hemant.agrawal@nxp.com>
> CC: Shreyansh Jain <shreyansh.jain@nxp.c
Based on this patch series, eth_driver was removed a couple of versions
back [1]. DPAA2 PMD is not using eth_driver now.
[1] http://dpdk.org/ml/archives/dev/2017-March/060478.html - v9
>
> Also xenvirt giving a build error related ethdev driver usage, build
> error fixed, again please feel free to send new version of the patch
> if required. This can be preferred to get into main tree.
> CC: Jianfeng Tan <jianfeng.tan@intel.com>
>
>
> CC: Jan Blunck <jblunck@infradead.org>
> CC: Stephen Hemminger <stephen@networkplumber.org>
> CC: Gaetan Rivet <gaetan.rivet@6wind.com>
>
>
> Ferruh Yigit (2):
> net/ark: remove eth_dev
> net/xenvirt: remove ethdev driver
>
> drivers/net/ark/ark_ethdev.c | 44 +++++++++++++++++++++++++----------
> drivers/net/xenvirt/rte_eth_xenvirt.c | 1 -
> 2 files changed, 32 insertions(+), 13 deletions(-)
>
^ permalink raw reply [flat|nested] 104+ messages in thread