Remove struct eth_driver
Subsystems (3)
cover Remove struct eth_driver
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/
* my "Rework vdev probing to use rte_bus infrastructure" series
* http://dpdk.org/dev/patchwork/patch/21058/
If requested I can push a tree with all dependent patches.
Jan Blunck (38):
eal: add name field to generic device
eal: parse "driver" device argument before probing drivers net/nfp: use library function for DMA zone reserve net/vmxnet3: 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/bnx2x/bnx2x_ethdev.c | 64 ++++++---- 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/mlx4/mlx4.c | 17 ++- drivers/net/mlx5/mlx5.c | 19 ++- 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/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 | 37 ++---- 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 +++-- drivers/net/vmxnet3/vmxnet3_rxtx.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 | 50 +++++++- 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 | 4 - test/test/test_link_bonding_rssconf.c | 4 +- 50 files changed, 1065 insertions(+), 891 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
Signature · 1 line
2.7.4
PATCH 1/38 eal: add name field to generic device
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.
--- 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(+)
lib/librte_eal/bsdapp/eal/eal_pci.c +3 -0
@@ -280,6 +280,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 ;
lib/librte_eal/common/eal_common_dev.c +3 -0
@@ -68,6 +68,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); }
lib/librte_eal/common/eal_common_vdev.c +2 -0
@@ -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);
lib/librte_eal/common/include/rte_dev.h +1 -0
@@ -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 */
lib/librte_eal/common/include/rte_pci.h +1 -0
@@ -158,6 +158,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) */ };/**
lib/librte_eal/linuxapp/eal/eal_pci.c +3 -0
@@ -316,6 +316,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 ) {
Signature · 1 line
2.7.4
PATCH 2/38 eal: parse "driver" device argument before probing drivers
In reply to Jan BlunckIn 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().
--- lib/librte_eal/common/eal_common_vdev.c | 48 +++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-)
lib/librte_eal/common/eal_common_vdev.c +43 -5
@@ -72,12 +72,48 @@ 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) +{ +char *str, *c; + +if (!args || args[0 ] =='\0' ) +return NULL ; + + c = str =strdup (args); + +do { +if (strncmp (c,"driver=" ,7 ) ==0 ) { + c +=7 ; +break ; + } + + c =strchr (c,',' ); +if (c) + c++; + }while (c); + +if (!c) +free (str); + +return c; +} +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 +128,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 +141,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 *
Signature · 1 line
2.7.4
PATCH 3/38 net/nfp: use library function for DMA zone reserve
In reply to Jan BlunckThis driver can use the library function rte_eth_dma_zone_reserve() instead of duplicating the code.
--- drivers/net/nfp/nfp_net.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-)
drivers/net/nfp/nfp_net.c +6 -24
@@ -205,26 +205,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. *
@@ -1461,9 +1441,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" );
@@ -1603,9 +1584,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);
Signature · 1 line
2.7.4
Re: [PATCH 03/38] net/nfp: use library function for DMA zone reserve
Hello Jan,
Quoted 56 lines · Jan Blunck
This driver can use the library function
rte_eth_dma_zone_reserve()instead of duplicating the code.Signed-off-by Jan Blunck <[email protected]>--- drivers/net/nfp/nfp_net.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-)drivers/net/nfp/nfp_net.c +3
-22@@ -205,26 +205,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. * @@ -1461,9 +1441,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" );@@ -1603,9 +1584,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.
drivers/net/nfp/nfp_net.c nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, · line 1593
Quoted 10 lines
drivers/net/nfp/nfp_net.c +3
-2*/ - 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);
This change is not part of the eth_driver removal process. Isn't it?
I would suggest this should be a separate series all together. This is valid for Patch 0004 as well.
Re: [PATCH 03/38] net/nfp: use library function for DMA zone reserve
Quoted 28 lines · Shreyansh Jain
Quoted 21 lines · Jan Blunck
drivers/net/nfp/nfp_net.c +0
-4-/* 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)drivers/net/nfp/nfp_net.c +0
-13-{ -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,
drivers/net/nfp/nfp_net.c nn_cfg_writeq(struct nfp_net_hw *hw, int off, uint64_t val) · line 227
Quoted 3 lines
drivers/net/nfp/nfp_net.c +0
-3- NFP_MEMZONE_ALIGN); -} -This change is not part of the
eth_driverremoval process. Isn't it?
Quoted 2 lines
I would suggest this should be a separate series all together. This is valid for Patch 0004 as well.
It is removing a dependency on eth_driver (see dev->driver->pci_drv.driver.name). Therefore even if I separate it this series would depend on it.
Thanks for reviewing,
Jan
PATCH 4/38 net/vmxnet3: use library function for DMA zone reserve
In reply to Jan BlunckThis driver can use the library function rte_eth_dma_zone_reserve() instead of duplicating the code.
--- drivers/net/vmxnet3/vmxnet3_rxtx.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +4 -26
@@ -872,30 +872,6 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)return nb_rx; } -/* -* Create memzone for device rings. malloc can't be used as the physical address is -* needed. If the memzone is already created, then this function returns a ptr -* to the old one. -*/ -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 ,VMXNET3_RING_BA_ALIGN ); -} - int vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
@@ -963,7 +939,8 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, size +=sizeof (struct Vmxnet3_TxCompDesc ) * comp_ring->size; size +=sizeof (struct Vmxnet3_TxDataDesc ) * data_ring->size; - mz =ring_dma_zone_reserve (dev,"txdesc" , queue_idx, size, socket_id); + mz =rte_eth_dma_zone_reserve (dev,"txdesc" , queue_idx, size, +VMXNET3_RING_BA_ALIGN , socket_id);if (mz ==NULL ) {PMD_INIT_LOG (ERR ,"ERROR: Creating queue descriptors zone" );return -ENOMEM ;
@@ -1065,7 +1042,8 @@ vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, size =sizeof (struct Vmxnet3_RxDesc ) * (ring0->size + ring1->size); size +=sizeof (struct Vmxnet3_RxCompDesc ) * comp_ring->size; - mz =ring_dma_zone_reserve (dev,"rxdesc" , queue_idx, size, socket_id); + mz =rte_eth_dma_zone_reserve (dev,"rxdesc" , queue_idx, size, +VMXNET3_RING_BA_ALIGN , socket_id);if (mz ==NULL ) {PMD_INIT_LOG (ERR ,"ERROR: Creating queue descriptors zone" );return -ENOMEM ;
Signature · 1 line
2.7.4
PATCH 5/38 ether: add allocation helper for virtual drivers
In reply to Jan BlunckThis helper should be used by ethdev drivers supporting virtual devices to help allocating a new ethdev and properly filling the default fields.
--- 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
lib/librte_ether/Makefile +1 -0
@@ -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
lib/librte_ether/rte_ethdev_vdev.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 6/38 net/tap: use ethdev allocation helper for virtual devices
In reply to Jan Blunck--- drivers/net/tap/rte_eth_tap.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-)
drivers/net/tap/rte_eth_tap.c +11 -26
@@ -33,6 +33,7 @@#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>
@@ -641,12 +642,12 @@ static const struct eth_dev_ops ops = { };static int -eth_dev_tap_create (const char *name,char *tap_name) +eth_dev_tap_create (struct rte_vdev_device *vdev,char *tap_name) {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 ());
@@ -657,30 +658,19 @@ eth_dev_tap_create(const char *name, char *tap_name) 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; - } - - dev =rte_eth_dev_allocate (tap_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 ;/* Setup some default values */ - data->dev_private = pmd; - data->port_id = dev->data->port_id; +rte_memcpy (data, dev->data,sizeof (*data)); data->dev_flags =RTE_ETH_DEV_DETACHABLE ; - data->kdrv =RTE_KDRV_NONE ; - data->drv_name = pmd_tap_drv.driver.name; - data->numa_node = numa_node; - data->dev_link = pmd_link; data->mac_addrs = &pmd->eth_addr; data->nb_rx_queues = pmd->nb_queues;
@@ -688,10 +678,8 @@ eth_dev_tap_create(const char *name, char *tap_name) dev->data = data; dev->dev_ops = &ops; - dev->driver =NULL ; dev->rx_pkt_burst = pmd_rx_burst; dev->tx_pkt_burst = pmd_tx_burst; -snprintf (dev->data->name,sizeof (dev->data->name),"%s" , name);/* Presetup the fds to -1 as being not valid */ for (i =0 ; i <RTE_PMD_TAP_MAX_QUEUES ; i++) {
@@ -702,13 +690,10 @@ eth_dev_tap_create(const char *name, char *tap_name)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 ; }
@@ -785,7 +770,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); + ret =eth_dev_tap_create (dev, tap_name); leave:if (ret ==-1 ) {
Signature · 1 line
2.7.4
PATCH 7/38 net/vhost: use ethdev allocation helper for virtual devices
In reply to Jan Blunck--- drivers/net/vhost/rte_eth_vhost.c | 54 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 28 deletions(-)
drivers/net/vhost/rte_eth_vhost.c +26 -28
@@ -39,6 +39,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>
@@ -1012,9 +1013,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 ;
@@ -1025,23 +1027,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;
@@ -1058,10 +1056,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;
@@ -1077,26 +1075,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;
@@ -1114,8 +1107,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)
@@ -1158,7 +1153,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;
@@ -1167,8 +1161,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 )
@@ -1213,7 +1207,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);
Signature · 1 line
2.7.4
PATCH 8/38 net/virtio: use ethdev allocation helper for virtual devices
In reply to Jan Blunck--- drivers/net/virtio/virtio_user_ethdev.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/net/virtio/virtio_user_ethdev.c +5 -15
@@ -37,6 +37,7 @@#include <rte_malloc.h> #include <rte_kvargs.h> +#include <rte_ethdev_vdev.h> #include <rte_vdev.h> #include "virtio_ethdev.h"
@@ -277,27 +278,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) {
@@ -313,12 +308,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; }
@@ -412,7 +402,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;
Signature · 1 line
2.7.4
PATCH 9/38 net/af_packet: use ethdev allocation helper for virtual devices
In reply to Jan Blunck--- drivers/net/af_packet/rte_eth_af_packet.c | 42 ++++++++++++++----------------- 1 file changed, 19 insertions(+), 23 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +19 -23
@@ -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:
Signature · 1 line
2.7.4
PATCH 10/38 app/test: don't short-circuit null device creation
In reply to Jan BlunckA virtual device should get initialized through the rte_eal_vdev_init() function to properly initialize the driver.
--- drivers/net/null/rte_eth_null.c | 1 + test/test/test_link_bonding_rssconf.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/null/rte_eth_null.c +1 -0
@@ -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 };
test/test/test_link_bonding_rssconf.c +2 -1
@@ -552,7 +552,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);
Signature · 1 line
2.7.4
PATCH 11/38 net/null: internalize eth_dev_null_create()
In reply to Jan BlunckThere is no need to export this API. Remaining users should use the rte_eal_vdev_init() function instead.
--- 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 ------ test/test/test_link_bonding_rssconf.c | 1 - 5 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 drivers/net/null/rte_eth_null.h
drivers/net/null/Makefile +1 -6
@@ -41,18 +41,13 @@ 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 - # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mbuf
drivers/net/null/rte_eth_null.c +1 -3
@@ -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"
@@ -480,7 +478,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,
drivers/net/null/rte_eth_null.h deleted +0 -40
@@ -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_ */
drivers/net/null/rte_pmd_null_version.map +0 -7
@@ -2,10 +2,3 @@ DPDK_2.0 { local: *; }; - -DPDK_2.2 { - global: - - eth_dev_null_create; - -} DPDK_2.0;
test/test/test_link_bonding_rssconf.c +0 -1
@@ -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"
Signature · 1 line
2.7.4
PATCH 12/38 net/null: use ethdev allocation helper for virtual devices
In reply to Jan Blunck--- drivers/net/null/rte_eth_null.c | 50 ++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 33 deletions(-)
drivers/net/null/rte_eth_null.c +17 -33
@@ -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>
@@ -479,8 +480,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) {
@@ -497,27 +497,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,
@@ -528,6 +526,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;
@@ -537,22 +536,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) {
@@ -564,12 +557,6 @@ eth_dev_null_create(const char *name, }return 0 ; - -error: -rte_free (data); -rte_free (internals); - -return -1 ; } static inline int
@@ -610,7 +597,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 ;
@@ -623,8 +609,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 )
@@ -653,7 +637,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)
Signature · 1 line
2.7.4
PATCH 13/38 net/bonding: make bonding API call through EAL on create/free
In reply to Jan BlunckTo properly embed the generic rte_device into the rte_eth_dev this reworks the bonding API to call through rte_eal_vdev_init().
--- 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(-)
drivers/net/bonding/rte_eth_bond_api.c +26 -145
@@ -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
drivers/net/bonding/rte_eth_bond_args.c +1 -1
@@ -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 };
drivers/net/bonding/rte_eth_bond_pmd.c +167 -7
213 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 14/38 net/bonding: use ethdev allocation helper for virtual devices
In reply to Jan Blunck--- drivers/net/bonding/rte_eth_bond_pmd.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +3 -17
@@ -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>
@@ -2243,31 +2244,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 ;
@@ -2281,10 +2271,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);
Signature · 1 line
2.7.4
PATCH 15/38 ethdev: add PCI driver helpers
In reply to Jan BlunckThis 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
--- 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
lib/librte_ether/Makefile +1 -0
@@ -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
lib/librte_ether/rte_ethdev_pci.h new file +151 -0
151 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 16/38 net/virtio: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/virtio/virtio_ethdev.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/net/virtio/virtio_ethdev.c +21 -13
@@ -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>
@@ -1572,19 +1573,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);
@@ -1596,7 +1604,7 @@ rte_virtio_pmd_init(void)return ; } -rte_eal_pci_register (&rte_virtio_pmd.pci_drv); +rte_eal_pci_register (&rte_virtio_pmd); }/*
Signature · 1 line
2.7.4
PATCH 17/38 net/bnx2x: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/bnx2x/bnx2x_ethdev.c | 64 +++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 20 deletions(-)
drivers/net/bnx2x/bnx2x_ethdev.c +44 -20
@@ -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
@@ -626,34 +627,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" );
Signature · 1 line
2.7.4
Re: [PATCH 17/38] net/bnx2x: Don't use eth_driver
Quoted 98 lines
Signed-off-by Jan Blunck <[email protected]>---
drivers/net/bnx2x/bnx2x_ethdev.c| 64
+++++++++++++++++++++++++++-------------1 file changed, 44 insertions(+), 20 deletions(-)drivers/net/bnx2x/bnx2x_ethdev.c +43
-19@@ -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 @@ -626,34 +627,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");drivers/net/bnx2x/bnx2x_ethdev.c +1
-1-RTE_PMD_REGISTER_PCI (net_bnx2xvf, rte_bnx2xvf_pmd.pci_drv); +RTE_PMD_REGISTER_PCI (net_bnx2xvf, rte_bnx2xvf_pmd);
Quoted 6 lines
RTE_PMD_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map);RTE_PMD_REGISTER_KMOD_DEP(net_bnx2xvf, "* igb_uio | vfio");Signature · 1 line
2.7.4
PATCH 18/38 net/bnxt: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/bnxt/bnxt_ethdev.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +23 -13
@@ -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" );
Signature · 1 line
2.7.4
PATCH 19/38 net/cxgbe: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/cxgbe/cxgbe_ethdev.c | 29 +++++++++++++++++++---------- drivers/net/cxgbe/sge.c | 6 +++--- 2 files changed, 22 insertions(+), 13 deletions(-)
drivers/net/cxgbe/cxgbe_ethdev.c +19 -10
@@ -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" );
drivers/net/cxgbe/sge.c +3 -3
@@ -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);
Signature · 1 line
2.7.4
PATCH 20/38 net/em: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/e1000/em_ethdev.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/e1000/em_ethdev.c +19 -11
@@ -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>
@@ -416,16 +417,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
@@ -1847,6 +1855,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" );
Signature · 1 line
2.7.4
PATCH 21/38 net/igb: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/e1000/igb_ethdev.c | 60 ++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 22 deletions(-)
drivers/net/e1000/igb_ethdev.c +38 -22
@@ -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>
@@ -1087,31 +1088,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" );
Signature · 1 line
2.7.4
PATCH 22/38 net/ena: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/ena/ena_ethdev.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/ena/ena_ethdev.c +19 -10
@@ -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" );
Signature · 1 line
2.7.4
PATCH 23/38 net/enic: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/enic/enic_ethdev.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/enic/enic_ethdev.c +19 -10
@@ -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"
@@ -634,17 +635,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" );
Signature · 1 line
2.7.4
PATCH 24/38 net/fm10k: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/fm10k/fm10k_ethdev.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/fm10k/fm10k_ethdev.c +19 -11
@@ -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>
@@ -3067,6 +3068,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.
@@ -3078,18 +3091,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" );
Signature · 1 line
2.7.4
PATCH 25/38 net/i40e: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/i40e/i40e_ethdev.c | 36 ++++++++++++++++++++++-------------- drivers/net/i40e/i40e_fdir.c | 2 +- 2 files changed, 23 insertions(+), 15 deletions(-)
drivers/net/i40e/i40e_ethdev.c +22 -14
@@ -44,6 +44,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>
@@ -627,16 +628,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
@@ -667,7 +675,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" );
@@ -10282,10 +10290,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;
drivers/net/i40e/i40e_fdir.c +1 -1
@@ -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 );
Signature · 1 line
2.7.4
PATCH 26/38 net/i40evf: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/i40e/i40e_ethdev_vf.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +20 -11
@@ -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>
@@ -1542,22 +1543,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" );
Signature · 1 line
2.7.4
PATCH 27/38 net/ixgbe: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/ixgbe/ixgbe_ethdev.c | 66 ++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +40 -26
@@ -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>
@@ -254,7 +255,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);
@@ -1767,31 +1768,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
@@ -4382,10 +4397,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;
@@ -8682,9 +8696,9 @@ ixgbe_clear_all_l2_tn_filter(struct rte_eth_dev *dev)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" );
Signature · 1 line
2.7.4
PATCH 28/38 net/mlx: Don't reference eth_driver
In reply to Jan BlunckThe eth_driver concept is unused in the mlx drivers so don't reference it.
--- drivers/net/mlx4/mlx4.c | 17 +++++++---------- drivers/net/mlx5/mlx5.c | 19 ++++++++----------- 2 files changed, 15 insertions(+), 21 deletions(-)
drivers/net/mlx4/mlx4.c +7 -10
@@ -5510,7 +5510,7 @@ priv_dev_interrupt_handler_install(struct priv *priv, struct rte_eth_dev *dev) } } -static struct eth_driver mlx4_driver; +static struct rte_pci_driver mlx4_driver;/** * DPDK callback to register a PCI device.
@@ -5889,16 +5889,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 , };/**
drivers/net/mlx5/mlx5.c +8 -11
@@ -343,7 +343,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.
@@ -373,7 +373,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 ) {
@@ -761,16 +761,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 , };/**
Signature · 1 line
2.7.4
PATCH 29/38 net/nfp: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/nfp/nfp_net.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/nfp/nfp_net.c +19 -10
@@ -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>
@@ -2579,18 +2580,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" );
Signature · 1 line
2.7.4
PATCH 30/38 net/qede: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/qede/qede_ethdev.c | 60 +++++++++++++++++++++++++----------------- drivers/net/qede/qede_ethdev.h | 1 + 2 files changed, 37 insertions(+), 24 deletions(-)
drivers/net/qede/qede_ethdev.c +36 -24
@@ -2337,35 +2337,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" );
drivers/net/qede/qede_ethdev.h +1 -0
@@ -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>
Signature · 1 line
2.7.4
Re: [PATCH 30/38] net/qede: Don't use eth_driver
Quoted 107 lines
Signed-off-by Jan Blunck <[email protected]>---
drivers/net/qede/qede_ethdev.c| 60
+++++++++++++++++++++++++-----------------drivers/net/qede/qede_ethdev.h| 1 +2 files changed, 37 insertions(+), 24 deletions(-)drivers/net/qede/qede_ethdev.c +35
-23@@ -2337,35 +2337,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");drivers/net/qede/qede_ethdev.c +1
-1-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");drivers/net/qede/qede_ethdev.h +1
-0@@ -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> Signature · 1 line
2.7.4
PATCH 31/38 net/sfc: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/sfc/sfc_ethdev.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/net/sfc/sfc_ethdev.c +21 -13
@@ -29,6 +29,7 @@#include <rte_dev.h> #include <rte_ethdev.h> +#include <rte_ethdev_pci.h> #include <rte_pci.h> #include "efx.h"
@@ -1340,21 +1341,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,
Signature · 1 line
2.7.4
PATCH 32/38 net/szedata2: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/szedata2/rte_eth_szedata2.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/szedata2/rte_eth_szedata2.c +19 -10
@@ -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" );
Signature · 1 line
2.7.4
PATCH 33/38 net/thunderx: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/thunderx/nicvf_ethdev.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/thunderx/nicvf_ethdev.c +19 -10
@@ -54,6 +54,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>
@@ -2111,17 +2112,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" );
Signature · 1 line
2.7.4
PATCH 34/38 net/vmxnet3: Don't use eth_driver
In reply to Jan Blunck--- drivers/net/vmxnet3/vmxnet3_ethdev.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/vmxnet3/vmxnet3_ethdev.c +19 -11
@@ -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>
@@ -338,16 +339,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
@@ -970,6 +978,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" );
Signature · 1 line
2.7.4
PATCH 35/38 ethdev: remove unused ethdev PCI probe/remove
In reply to Jan BlunckThis removes the now unused rte_eth_dev_pci_probe() and rte_eth_dev_pci_remove() functions.
--- 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 | 3 -- 4 files changed, 10 insertions(+), 115 deletions(-)
lib/librte_ether/rte_ethdev.c +0 -97
@@ -277,103 +277,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 ||
lib/librte_ether/rte_ethdev.h +0 -15
@@ -4419,21 +4419,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
lib/librte_ether/rte_ethdev_pci.h +10 -0
@@ -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)
lib/librte_ether/rte_ether_version.map +0 -3
@@ -137,9 +137,6 @@ DPDK_16.07 { DPDK_16.11 { global: - rte_eth_dev_pci_probe; - rte_eth_dev_pci_remove; - } DPDK_16.07; DPDK_17.02 {
Signature · 1 line
2.7.4
PATCH 36/38 ethdev: remove unused ethdev driver
In reply to Jan BlunckThis removes the now unused struct eth_driver.
--- 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(-)
drivers/net/cxgbe/cxgbe_main.c +0 -1
@@ -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;
drivers/net/ring/rte_eth_ring.c +0 -1
@@ -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 ;
lib/librte_ether/rte_ethdev.h +0 -73
85 lines not on this page · raw message
lib/librte_ether/rte_ethdev_pci.h +0 -2
@@ -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 ; }
lib/librte_ether/rte_ethdev_vdev.h +0 -1
@@ -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 ;
Signature · 1 line
2.7.4
PATCH 37/38 ethdev: remove PCI specific helper from generic ethdev header
In reply to Jan BlunckThis 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.
--- 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(-)
drivers/net/cxgbe/cxgbe_main.c +1 -0
@@ -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>
lib/librte_ether/rte_ethdev.c +0 -20
@@ -3103,26 +3103,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)
lib/librte_ether/rte_ethdev.h +0 -14
@@ -4233,20 +4233,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
lib/librte_ether/rte_ethdev_pci.h +32 -0
@@ -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.
lib/librte_ether/rte_ether_version.map +0 -1
@@ -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;
Signature · 1 line
2.7.4
PATCH 38/38 ethdev: don't include PCI header
In reply to Jan BlunckSince the PCI functionality has been moved to the PCI specific ethdev header we don't need to include rte_pci.h from here anymore.
--- lib/librte_ether/rte_ethdev.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_ether/rte_ethdev.h +2 -1
@@ -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 */
Signature · 1 line
2.7.4
Quoted 102 lines · On Mon, 6 Mar 2017 10:59:52 +0100 Jan Blunck <[email protected]> wrote:
This series is removing the PCI specific struct
eth_driverfromrte_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 genericrte_devicein the ethdev.The series is based on:
* http://dpdk.org/dev/patchwork/patch/20416/
* http://dpdk.org/dev/patchwork/patch/20417/
* my "Rework vdev probing to userte_businfrastructure" series
* http://dpdk.org/dev/patchwork/patch/21058/If requested I can push a tree with all dependent patches.
Jan Blunck (38):
eal: add name field to generic device
eal: parse "driver" device argument before probing drivers net/nfp: use library function for DMA zone reserve net/vmxnet3: 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 devicesnet/af_packet: use ethdev allocation helper for virtual devices app/test: don't short-circuit null device creation net/null: internalizeeth_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 useeth_driver
net/bnx2x: Don't useeth_driver
net/bnxt: Don't useeth_driver
net/cxgbe: Don't useeth_driver
net/em: Don't useeth_driver
net/igb: Don't useeth_driver
net/ena: Don't useeth_driver
net/enic: Don't useeth_driver
net/fm10k: Don't useeth_driver
net/i40e: Don't useeth_driver
net/i40evf: Don't useeth_driver
net/ixgbe: Don't useeth_driver
net/mlx: Don't referenceeth_driver
net/nfp: Don't useeth_driver
net/qede: Don't useeth_driver
net/sfc: Don't useeth_driver
net/szedata2: Don't useeth_driver
net/thunderx: Don't useeth_driver
net/vmxnet3: Don't useeth_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 headerdrivers/net/af_packet/rte_eth_af_packet.c | 42 +++---- drivers/net/bnx2x/bnx2x_ethdev.c | 64 ++++++---- 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/mlx4/mlx4.c | 17 ++- drivers/net/mlx5/mlx5.c | 19 ++- 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/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 | 37 ++---- 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 +++-- drivers/net/vmxnet3/vmxnet3_rxtx.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 | 50 +++++++- 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 +---------------
Quoted 9 lines
lib/librte_ether/rte_ethdev_pci.h | 191 ++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev_vdev.h | 84 +++++++++++++ lib/librte_ether/rte_ether_version.map | 4 - test/test/test_link_bonding_rssconf.c | 4 +- 50 files changed, 1065 insertions(+), 891 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
Could you put a tree with the patches up on github?
Quoted 17 lines · Stephen Hemminger
Quoted 14 lines · On Mon, 6 Mar 2017 10:59:52 +0100 Jan Blunck <[email protected]> wrote:
This series is removing the PCI specific struct
eth_driverfromrte_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 genericrte_devicein the ethdev.The series is based on:
* http://dpdk.org/dev/patchwork/patch/20416/
* http://dpdk.org/dev/patchwork/patch/20417/
* my "Rework vdev probing to userte_businfrastructure" series
* http://dpdk.org/dev/patchwork/patch/21058/
Quoted 4 lines
Quoted 2 lines
If requested I can push a tree with all dependent patches.
Could you put a tree with the patches up on github?
v2 cover Remove struct eth_driver
In reply to Jan BlunckI 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
Signature · 1 line
2.1.4
PATCH v2 1/42 eal: add name field to generic device
From: Jan Blunck <[email protected]>
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.
--- 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(+)
lib/librte_eal/bsdapp/eal/eal_pci.c +3 -0
@@ -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 ;
lib/librte_eal/common/eal_common_dev.c +3 -0
@@ -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); }
lib/librte_eal/common/eal_common_vdev.c +2 -0
@@ -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);
lib/librte_eal/common/include/rte_dev.h +1 -0
@@ -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 */
lib/librte_eal/common/include/rte_pci.h +1 -0
@@ -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) */ };/**
lib/librte_eal/linuxapp/eal/eal_pci.c +3 -0
@@ -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 ) {
Signature · 1 line
2.1.4
PATCH v2 2/42 eal: parse "driver" device argument before probing drivers
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
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().
--- lib/librte_eal/common/eal_common_vdev.c | 51 +++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-)
lib/librte_eal/common/eal_common_vdev.c +46 -5
@@ -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 *
Signature · 1 line
2.1.4
Re: [PATCH v2 02/42] eal: parse "driver" device argument before probing drivers
Quoted 5 lines · Gaetan Rivet
From: Jan Blunck <[email protected]>
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
Quoted 2 lines
Signed-off-by Jan Blunck <[email protected]>
<...>
Re: [PATCH v2 02/42] eal: parse "driver" device argument before probing drivers
Quoted 17 lines · Ferruh Yigit
Quoted 5 lines · Gaetan Rivet
From: Jan Blunck <[email protected]>
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).
Quoted 6 lines
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/
Quoted 8 lines
Thanks,
ferruhQuoted 2 lines
Signed-off-by Jan Blunck <[email protected]><...>
PATCH v2 3/42 net/nfp: use library function for DMA zone reserve
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
This driver can use the library function rte_eth_dma_zone_reserve() instead of duplicating the code.
--- drivers/net/nfp/nfp_net.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-)
drivers/net/nfp/nfp_net.c +6 -24
@@ -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);
Signature · 1 line
2.1.4
PATCH v2 4/42 ether: add allocation helper for virtual drivers
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
This helper should be used by ethdev drivers supporting virtual devices to help allocating a new ethdev and properly filling the default fields.
--- 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
lib/librte_ether/Makefile +1 -0
@@ -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
lib/librte_ether/rte_ethdev_vdev.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v2 5/42 net/tap: use ethdev allocation helper for virtual devices
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/tap/rte_eth_tap.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-)
drivers/net/tap/rte_eth_tap.c +13 -25
@@ -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 ) {
Signature · 1 line
2.1.4
PATCH v2 6/42 net/vhost: use ethdev allocation helper for virtual devices
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/vhost/rte_eth_vhost.c | 54 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 28 deletions(-)
drivers/net/vhost/rte_eth_vhost.c +26 -28
@@ -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);
Signature · 1 line
2.1.4
PATCH v2 7/42 net/virtio: use ethdev allocation helper for virtual devices
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/virtio/virtio_user_ethdev.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/net/virtio/virtio_user_ethdev.c +5 -15
@@ -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;
Signature · 1 line
2.1.4
PATCH v2 8/42 net/af_packet: use ethdev allocation helper for virtual devices
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/af_packet/rte_eth_af_packet.c | 42 ++++++++++++++----------------- 1 file changed, 19 insertions(+), 23 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +19 -23
@@ -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:
Signature · 1 line
2.1.4
PATCH v2 9/42 app/test: don't short-circuit null device creation
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
A virtual device should get initialized through the rte_eal_vdev_init() function to properly initialize the driver.
--- drivers/net/null/rte_eth_null.c | 1 + test/test/test_link_bonding_rssconf.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/null/rte_eth_null.c +1 -0
@@ -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 };
test/test/test_link_bonding_rssconf.c +2 -1
@@ -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);
Signature · 1 line
2.1.4
PATCH v2 10/42 net/null: internalize eth_dev_null_create()
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
There is no need to export this API. Remaining users should use the rte_eal_vdev_init() function instead.
--- 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 ------ test/test/test_link_bonding_rssconf.c | 1 - 5 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 drivers/net/null/rte_eth_null.h
drivers/net/null/Makefile +1 -6
@@ -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
drivers/net/null/rte_eth_null.c +1 -3
@@ -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,
drivers/net/null/rte_eth_null.h deleted +0 -40
@@ -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_ */
drivers/net/null/rte_pmd_null_version.map +0 -7
@@ -2,10 +2,3 @@ DPDK_2.0 { local: *; }; - -DPDK_2.2 { - global: - - eth_dev_null_create; - -} DPDK_2.0;
test/test/test_link_bonding_rssconf.c +0 -1
@@ -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"
Signature · 1 line
2.1.4
PATCH v2 11/42 net/null: use ethdev allocation helper for virtual devices
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/null/rte_eth_null.c | 50 ++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 33 deletions(-)
drivers/net/null/rte_eth_null.c +17 -33
@@ -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)
Signature · 1 line
2.1.4
PATCH v2 12/42 net/bonding: make bonding API call through EAL on create/free
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
To properly embed the generic rte_device into the rte_eth_dev this reworks the bonding API to call through rte_eal_vdev_init().
--- 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(-)
drivers/net/bonding/rte_eth_bond_api.c +26 -145
@@ -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
drivers/net/bonding/rte_eth_bond_args.c +1 -1
@@ -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 };
drivers/net/bonding/rte_eth_bond_pmd.c +167 -7
213 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v2 13/42 net/bonding: use ethdev allocation helper for virtual devices
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/bonding/rte_eth_bond_pmd.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +3 -17
@@ -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);
Signature · 1 line
2.1.4
PATCH v2 14/42 net/kni: use ethdev allocation helper for virtual devices
In reply to Gaetan Rivet--- drivers/net/kni/rte_eth_kni.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-)
drivers/net/kni/rte_eth_kni.c +15 -24
@@ -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;
Signature · 1 line
2.1.4
PATCH v2 15/42 net/pcap: use ethdev allocation helper for virtual devices
In reply to Gaetan Rivet--- drivers/net/pcap/rte_eth_pcap.c | 62 ++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 35 deletions(-)
drivers/net/pcap/rte_eth_pcap.c +27 -35
@@ -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:
Signature · 1 line
2.1.4
PATCH v2 16/42 ethdev: add PCI driver helpers
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
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
--- 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
lib/librte_ether/Makefile +1 -0
@@ -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
lib/librte_ether/rte_ethdev_pci.h new file +151 -0
151 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v2 17/42 net/virtio: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/virtio/virtio_ethdev.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/net/virtio/virtio_ethdev.c +21 -13
@@ -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); }/*
Signature · 1 line
2.1.4
PATCH v2 18/42 net/bnx2x: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/bnx2x/bnx2x_ethdev.c | 64 +++++++++++++++++++++++++++------------- drivers/net/bnx2x/bnx2x_rxtx.c | 2 +- 2 files changed, 45 insertions(+), 21 deletions(-)
drivers/net/bnx2x/bnx2x_ethdev.c +44 -20
@@ -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" );
drivers/net/bnx2x/bnx2x_rxtx.c +1 -1
@@ -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);
Signature · 1 line
2.1.4
PATCH v2 19/42 net/bnxt: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/bnxt/bnxt_ethdev.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +23 -13
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 20/42 net/cxgbe: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/cxgbe/cxgbe_ethdev.c | 29 +++++++++++++++++++---------- drivers/net/cxgbe/sge.c | 6 +++--- 2 files changed, 22 insertions(+), 13 deletions(-)
drivers/net/cxgbe/cxgbe_ethdev.c +19 -10
@@ -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" );
drivers/net/cxgbe/sge.c +3 -3
@@ -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);
Signature · 1 line
2.1.4
PATCH v2 21/42 net/em: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/e1000/em_ethdev.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/e1000/em_ethdev.c +19 -11
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 22/42 net/igb: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/e1000/igb_ethdev.c | 60 ++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 22 deletions(-)
drivers/net/e1000/igb_ethdev.c +38 -22
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 23/42 net/ena: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/ena/ena_ethdev.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/ena/ena_ethdev.c +19 -10
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 24/42 net/enic: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/enic/enic_ethdev.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/enic/enic_ethdev.c +19 -10
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 25/42 net/fm10k: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/fm10k/fm10k_ethdev.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/fm10k/fm10k_ethdev.c +19 -11
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 26/42 net/i40e: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/i40e/i40e_ethdev.c | 36 ++++++++++++++++++++++-------------- drivers/net/i40e/i40e_fdir.c | 2 +- 2 files changed, 23 insertions(+), 15 deletions(-)
drivers/net/i40e/i40e_ethdev.c +22 -14
@@ -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;
drivers/net/i40e/i40e_fdir.c +1 -1
@@ -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 );
Signature · 1 line
2.1.4
PATCH v2 27/42 net/i40evf: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/i40e/i40e_ethdev_vf.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +20 -11
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 28/42 net/ixgbe: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/ixgbe/ixgbe_ethdev.c | 66 ++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 26 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +40 -26
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 29/42 net/mlx: Don't reference eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
The eth_driver concept is unused in the mlx drivers so don't reference it.
--- drivers/net/mlx4/mlx4.c | 24 +++++++++++------------- drivers/net/mlx5/mlx5.c | 24 +++++++++++------------- 2 files changed, 22 insertions(+), 26 deletions(-)
drivers/net/mlx4/mlx4.c +11 -13
@@ -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__);
drivers/net/mlx5/mlx5.c +11 -13
@@ -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__);
Signature · 1 line
2.1.4
PATCH v2 30/42 net/nfp: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/nfp/nfp_net.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/nfp/nfp_net.c +19 -10
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 31/42 net/qede: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/qede/qede_ethdev.c | 60 +++++++++++++++++++++++++----------------- drivers/net/qede/qede_ethdev.h | 1 + 2 files changed, 37 insertions(+), 24 deletions(-)
drivers/net/qede/qede_ethdev.c +36 -24
@@ -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" );
drivers/net/qede/qede_ethdev.h +1 -0
@@ -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>
Signature · 1 line
2.1.4
PATCH v2 32/42 net/sfc: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/sfc/sfc_ethdev.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/net/sfc/sfc_ethdev.c +21 -13
@@ -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,
Signature · 1 line
2.1.4
PATCH v2 33/42 net/szedata2: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/szedata2/rte_eth_szedata2.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/szedata2/rte_eth_szedata2.c +19 -10
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 34/42 net/thunderx: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/thunderx/nicvf_ethdev.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/net/thunderx/nicvf_ethdev.c +19 -10
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 35/42 net/vmxnet3: Don't use eth_driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
--- drivers/net/vmxnet3/vmxnet3_ethdev.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/vmxnet3/vmxnet3_ethdev.c +19 -11
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 36/42 net/avp: Don't use eth_driver
In reply to Gaetan Rivet--- drivers/net/avp/avp_ethdev.c | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-)
drivers/net/avp/avp_ethdev.c +32 -11
@@ -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);
Signature · 1 line
2.1.4
Re: [PATCH v2 36/42] net/avp: Don't use eth_driver
Quoted 9 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Tuesday, April 11, 2017 11:45 AM
To: [email protected]
Cc: Jan Blunck
Subject: [dpdk-dev] [PATCH v2 36/42] net/avp: Don't useeth_driverSigned-off-by Gaetan Rivet <[email protected]>---
PATCH v2 37/42 net/liquidio: Don't use eth_driver
In reply to Gaetan Rivet--- drivers/net/liquidio/lio_ethdev.c | 44 +++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-)
drivers/net/liquidio/lio_ethdev.c +33 -11
@@ -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" );
Signature · 1 line
2.1.4
PATCH v2 38/42 ethdev: remove unused ethdev PCI probe/remove
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
This removes the now unused rte_eth_dev_pci_probe() and rte_eth_dev_pci_remove() functions.
--- 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(-)
lib/librte_ether/rte_ethdev.c +0 -97
@@ -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 ||
lib/librte_ether/rte_ethdev.h +0 -15
@@ -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
lib/librte_ether/rte_ethdev_pci.h +10 -0
@@ -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)
lib/librte_ether/rte_ether_version.map +1 -9
@@ -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:
Signature · 1 line
2.1.4
Re: [PATCH v2 38/42] ethdev: remove unused ethdev PCI probe/remove
Quoted 207 lines · Gaetan Rivet
From: Jan Blunck <[email protected]>
This removes the now unused
rte_eth_dev_pci_probe()andrte_eth_dev_pci_remove()functions.Signed-off-by Jan Blunck <[email protected]>--- 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(-)lib/librte_ether/rte_ethdev.c +0
-97@@ -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 ||lib/librte_ether/rte_ethdev.h +0
-15@@ -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 lib/librte_ether/rte_ethdev_pci.h +10
-0@@ -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)lib/librte_ether/rte_ether_version.map +1
-9@@ -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:Signature · 1 line
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
Re: [PATCH v2 38/42] ethdev: remove unused ethdev PCI probe/remove
Quoted 213 lines · Neil Horman
Quoted 207 lines · Gaetan Rivet
From: Jan Blunck <[email protected]>
This removes the now unused
rte_eth_dev_pci_probe()andrte_eth_dev_pci_remove()functions.Signed-off-by Jan Blunck <[email protected]>--- 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(-)lib/librte_ether/rte_ethdev.c +0
-97@@ -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 ||lib/librte_ether/rte_ethdev.h +0
-15@@ -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 lib/librte_ether/rte_ethdev_pci.h +10
-0@@ -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)lib/librte_ether/rte_ether_version.map +1
-9@@ -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:Signature · 1 line
2.1.4given 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.
Quoted 3 lines
Neil
Scratch that, was looking at an old version of the deprecation file, this has already been announced.
Neil
PATCH v2 39/42 ethdev: remove unused ethdev driver
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
This removes the now unused struct eth_driver.
--- 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(-)
drivers/net/cxgbe/cxgbe_main.c +0 -1
@@ -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;
drivers/net/ring/rte_eth_ring.c +0 -1
@@ -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 ;
lib/librte_ether/rte_ethdev.h +0 -73
85 lines not on this page · raw message
lib/librte_ether/rte_ethdev_pci.h +0 -2
@@ -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 ; }
lib/librte_ether/rte_ethdev_vdev.h +0 -1
@@ -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 ;
Signature · 1 line
2.1.4
PATCH v2 40/42 test: remove unused ethdev driver
In reply to Gaetan Rivet--- test/test/virtual_pmd.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
test/test/virtual_pmd.c +3 -9
@@ -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);
Signature · 1 line
2.1.4
PATCH v2 41/42 ethdev: remove PCI specific helper from generic ethdev header
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
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.
--- 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(-)
drivers/net/cxgbe/cxgbe_main.c +1 -0
@@ -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>
lib/librte_ether/rte_ethdev.c +0 -20
@@ -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)
lib/librte_ether/rte_ethdev.h +0 -14
@@ -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
lib/librte_ether/rte_ethdev_pci.h +32 -0
@@ -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.
lib/librte_ether/rte_ether_version.map +0 -1
@@ -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;
Signature · 1 line
2.1.4
PATCH v2 42/42 ethdev: don't include PCI header
In reply to Gaetan RivetFrom: Jan Blunck <[email protected]>
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.
--- lib/librte_ether/rte_ethdev.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_ether/rte_ethdev.h +2 -1
@@ -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 */
Signature · 1 line
2.1.4
Quoted 124 lines · On Tue, 11 Apr 2017 17:44:07 +0200 Gaetan Rivet <[email protected]> wrote:
I rebased the following work of Jan:
This series is removing the PCI specific struct
eth_driverfromrte_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 genericrte_devicein 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 userte_businfrastructure" 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
* Fixedvirtual_pmdfor unit testGaetan Rivet (5):
net/kni: use ethdev allocation helper for virtual devices net/pcap: use ethdev allocation helper for virtual devices net/avp: Don't useeth_driver
net/liquidio: Don't useeth_driver
test: remove unused ethdev driverJan 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 devicesnet/af_packet: use ethdev allocation helper for virtual devices app/test: don't short-circuit null device creation net/null: internalizeeth_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 useeth_driver
net/bnx2x: Don't useeth_driver
net/bnxt: Don't useeth_driver
net/cxgbe: Don't useeth_driver
net/em: Don't useeth_driver
net/igb: Don't useeth_driver
net/ena: Don't useeth_driver
net/enic: Don't useeth_driver
net/fm10k: Don't useeth_driver
net/i40e: Don't useeth_driver
net/i40evf: Don't useeth_driver
net/ixgbe: Don't useeth_driver
net/mlx: Don't referenceeth_driver
net/nfp: Don't useeth_driver
net/qede: Don't useeth_driver
net/sfc: Don't useeth_driver
net/szedata2: Don't useeth_driver
net/thunderx: Don't useeth_driver
net/vmxnet3: Don't useeth_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 headerdrivers/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 ++++++++++++++++++++++++++++++
Quoted 9 lines
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.
Thomas Monjalon
Applied2017-04-12 09:25, Stephen Hemminger:
Quoted 30 lines
Quoted 16 lines · On Tue, 11 Apr 2017 17:44:07 +0200 Gaetan Rivet <[email protected]> wrote:
I rebased the following work of Jan:
This series is removing the PCI specific struct
eth_driverfromrte_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 genericrte_devicein 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 userte_businfrastructure" series
* http://dpdk.org/dev/patchwork/patch/21058/Quoted 10 lines
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
* Fixedvirtual_pmdfor unit test
Quoted 3 lines
Looks good.
Applied, thanks
Now we need to remove
struct rte_pci_driver pci_drv;
from cryptodev and eventdev.
Sooner is better :)
Thanks
cover next-net: remove ethdev driver
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 <[email protected]>
CC: Ed Czeck <[email protected]>
CC: John Miller <[email protected]>
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 <[email protected]>
CC: Shreyansh Jain <[email protected]
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 <[email protected]>
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(-)
Signature · 1 line
2.9.3
PATCH 1/2 net/ark: remove eth_dev
---
--- drivers/net/ark/ark_ethdev.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-)
drivers/net/ark/ark_ethdev.c +32 -12
@@ -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,
Signature · 1 line
2.9.3
Re: [PATCH 1/2] net/ark: remove eth_dev
Thanks Ferruh, It all looks good and our tests pass
Re: [PATCH 1/2] net/ark: remove eth_dev
Quoted 3 lines · Ed Czeck
Thanks Ferruh, It all looks good and our tests pass
Acked-by Ed Czeck <[email protected]
Squashed into relevant commit in next-net, thanks.
PATCH 2/2 net/xenvirt: remove ethdev driver
In reply to Ferruh Yigit---
--- drivers/net/xenvirt/rte_eth_xenvirt.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/xenvirt/rte_eth_xenvirt.c +0 -1
@@ -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;
Signature · 1 line
2.9.3
PATCH v2 1/1 net/xenvirt: fix build error
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
---
--- drivers/net/xenvirt/rte_eth_xenvirt.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/xenvirt/rte_eth_xenvirt.c +0 -1
@@ -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;
Signature · 1 line
2.9.3
Thomas Monjalon
AppliedRe: [PATCH v2] net/xenvirt: fix build error
19/04/2017 11:52, Ferruh Yigit:
Quoted 11 lines
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 <[email protected]>
Applied, thanks
Re: [PATCH 0/2] next-net: remove ethdev driver
In reply to Ferruh YigitQuoted 5 lines · Ferruh Yigit
There are two PMDs in next-net and not merged into main tree:
- ARK
- DPAA2These drivers also needs to get these updates.
latest next-net rebased on main tree to help development of these.
! next-net is broken now !
Quoted 35 lines
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 <[email protected]>
CC: Ed Czeck <[email protected]>
CC: John Miller <[email protected]>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 <[email protected]>
CC: Shreyansh Jain <[email protected]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 <[email protected]>CC Jan Blunck <[email protected]>CC Stephen Hemminger <[email protected]>CC Gaetan Rivet <[email protected]>Ferruh Yigit (2):
net/ark: removeeth_dev
net/xenvirt: remove ethdev driverdrivers/net/ark/ark_ethdev.c | 44 +++++++++++++++++++++++++---------- drivers/net/xenvirt/rte_eth_xenvirt.c | 1 - 2 files changed, 32 insertions(+), 13 deletions(-)
Re: [PATCH 0/2] next-net: remove ethdev driver
In reply to Ferruh YigitQuoted 16 lines · Ferruh Yigit
There are two PMDs in next-net and not merged into main tree:
- ARK
- DPAA2These 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 <[email protected]>
CC: Ed Czeck <[email protected]>
CC: John Miller <[email protected]>
Quoted 4 lines
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 <[email protected]>
CC: Shreyansh Jain <[email protected]
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
Quoted 20 lines
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 <[email protected]>CC Jan Blunck <[email protected]>CC Stephen Hemminger <[email protected]>CC Gaetan Rivet <[email protected]>Ferruh Yigit (2):
net/ark: removeeth_dev
net/xenvirt: remove ethdev driverdrivers/net/ark/ark_ethdev.c | 44 +++++++++++++++++++++++++---------- drivers/net/xenvirt/rte_eth_xenvirt.c | 1 - 2 files changed, 32 insertions(+), 13 deletions(-)