remove pci driver from vdevs
Subsystems (3)
cover remove pci driver from vdevs
There is a dummy pci driver in the vdev PMD's at present.
This patch set removes the pci driver from the vdev PMD's.
Changes have been made to librte_ether to handle vdevs and pdevs in the same way.
The following vdev PMD's have had the pci driver removed:
null
ring
bonding
pcapaf_packet
xenvirt
mpipe
All the pdev PMD's have been modified to copy the pci device info into ethdev data.
Bernard Iremonger (17):
librte_eal: add RTE_KDRV_NONE for vdevs
librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
librte_ether: add function rte_eth_copy_dev_info()
null: remove pci device driver
ring: remove pci device driver
bonding: remove pci device driver
pcap: remove pci device driver
ixgbe: copy pci device info to eth_dev data
e1000: copy pci device info to eth_dev data
i40e: copy pci device info to eth_dev data
fm10k: copy pci device info to eth_dev data
bnx2x: copy pci device info to eth_dev data
cxgbe: copy pci device info to eth_dev data
enic: copy pci device info to eth_dev data
mlx4: copy pci device info to eth_dev data
virtio: copy pci device info to eth_dev data
vmxnet3: copy pci device info to eth_dev data
David Hunt (3):
af_packet: remove pci device driver
xenvirt: remove pci device driver
mpipe: remove pci device driver
drivers/net/af_packet/rte_eth_af_packet.c | 20 +++++------ drivers/net/bnx2x/bnx2x_ethdev.c | 4 +++ drivers/net/bonding/rte_eth_bond_alb.c | 2 +- drivers/net/bonding/rte_eth_bond_api.c | 58 +++++++++--------------------- drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++----- drivers/net/bonding/rte_eth_bond_private.h | 2 +- drivers/net/cxgbe/cxgbe_ethdev.c | 5 +++ drivers/net/e1000/em_ethdev.c | 3 ++ drivers/net/e1000/igb_ethdev.c | 5 +++ drivers/net/enic/enic_ethdev.c | 2 ++ drivers/net/fm10k/fm10k_ethdev.c | 2 ++ drivers/net/i40e/i40e_ethdev.c | 3 ++ drivers/net/i40e/i40e_ethdev_vf.c | 2 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++ drivers/net/mlx4/mlx4.c | 4 +++ drivers/net/mpipe/mpipe_tilegx.c | 10 ++++-- drivers/net/null/rte_eth_null.c | 32 +++++------------ drivers/net/pcap/rte_eth_pcap.c | 31 +++++----------- drivers/net/ring/rte_eth_ring.c | 37 +++++-------------- drivers/net/virtio/virtio_ethdev.c | 3 ++ drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 ++ drivers/net/xenvirt/rte_eth_xenvirt.c | 14 +++----- lib/librte_eal/common/include/rte_pci.h | 3 +- lib/librte_ether/rte_ethdev.c | 54 ++++++++++++++++------------ lib/librte_ether/rte_ethdev.h | 29 +++++++++++++++ lib/librte_ether/rte_ether_version.map | 7 ++++ 26 files changed, 180 insertions(+), 174 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/20 librte_eal: add RTE_KDRV_NONE for vdevs
--- lib/librte_eal/common/include/rte_pci.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_eal/common/include/rte_pci.h +2 -1
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -149,6 +149,7 @@ enum rte_kernel_driver {RTE_KDRV_VFIO ,RTE_KDRV_UIO_GENERIC ,RTE_KDRV_NIC_UIO , + RTE_KDRV_NONE, };/**
Signature · 1 line
1.9.1
PATCH 2/20 librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
In reply to Bernard Iremongeradd dev_flags to rte_eth_dev_data, add macros for dev_flags. add kdrv to rte_eth_dev_data.
add numa_node to rte_eth_dev_data.
add drv_name to rte_eth_dev_data.
use dev_type to distinguish between vdev's and pdev's. remove pci_dev branches.
--- lib/librte_ether/rte_ethdev.c | 53 ++++++++++++++++++++++++------------------- lib/librte_ether/rte_ethdev.h | 15 ++++++++++++ 2 files changed, 45 insertions(+), 23 deletions(-)
lib/librte_ether/rte_ethdev.c +30 -23
@@ -424,7 +424,7 @@ rte_eth_dev_socket_id(uint8_t port_id) {if (!rte_eth_dev_is_valid_port (port_id))return -1 ; -return rte_eth_devices[port_id].pci_dev->numa_node; +return rte_eth_devices[port_id].data->numa_node; }uint8_t
@@ -503,27 +503,25 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)static int rte_eth_dev_is_detachable (uint8_t port_id) { -uint32_t drv_flags; +uint32_t dev_flags;if (!rte_eth_dev_is_valid_port (port_id)) {PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id);return -EINVAL ; } -if (rte_eth_devices[port_id].dev_type ==RTE_ETH_DEV_PCI ) { -switch (rte_eth_devices[port_id].pci_dev->kdrv) { -case RTE_KDRV_IGB_UIO : -case RTE_KDRV_UIO_GENERIC : -case RTE_KDRV_NIC_UIO : -break ; -case RTE_KDRV_VFIO : -default : -return -ENOTSUP ; - } +switch (rte_eth_devices[port_id].data->kdrv) { +case RTE_KDRV_IGB_UIO : +case RTE_KDRV_UIO_GENERIC : +case RTE_KDRV_NIC_UIO : +case RTE_KDRV_NONE : +break ; +case RTE_KDRV_VFIO : +default : +return -ENOTSUP ; } - - drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags; -return !(drv_flags &RTE_PCI_DRV_DETACHABLE ); + dev_flags = rte_eth_devices[port_id].data->dev_flags; +return !(dev_flags &RTE_ETH_DEV_DETACHABLE ); }/* attach the new physical device, then store port_id of the device */
@@ -1143,14 +1141,11 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,* If link state interrupt is enabled, check that the * device supports it. */ -if (dev_conf->intr_conf.lsc ==1 ) { -const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv; - -if (!(pci_drv->drv_flags &RTE_PCI_DRV_INTR_LSC )) { +if ((dev_conf->intr_conf.lsc ==1 ) && + (!(dev->data->dev_flags &RTE_ETH_DEV_INTR_LSC ))) {PMD_DEBUG_TRACE ("driver %s does not support lsc\n" , - pci_drv->name); + dev->data->drv_name);return -EINVAL ; - } }/*
@@ -1795,8 +1790,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)FUNC_PTR_OR_RET (*dev->dev_ops->dev_infos_get); (*dev->dev_ops->dev_infos_get)(dev, dev_info); dev_info->pci_dev = dev->pci_dev; -if (dev->driver) - dev_info->driver_name = dev->driver->pci_drv.name; + dev_info->driver_name = dev->data->drv_name; }void
@@ -3570,3 +3564,16 @@ rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)FUNC_PTR_OR_ERR_RET (*dev->dev_ops->set_eeprom, -ENOTSUP );return (*dev->dev_ops->set_eeprom)(dev, info); } + +void +rte_eth_copy_dev_info (struct rte_eth_dev *eth_dev,struct rte_pci_device *pci_dev) +{ +if ((eth_dev ==NULL ) || (pci_dev ==NULL )) +PMD_DEBUG_TRACE ("NULL pointer eth_dev=%p pci_dev=%p\n" , + eth_dev, pci_dev); + + eth_dev->data->dev_flags = pci_dev->driver->drv_flags; + eth_dev->data->kdrv = pci_dev->kdrv; + eth_dev->data->numa_node = pci_dev->numa_node; + eth_dev->data->drv_name = pci_dev->driver->name; +}
lib/librte_ether/rte_ethdev.h +15 -0
@@ -1635,8 +1635,23 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ lro : 1; /**< RX LRO is ON(1) / OFF(0) */ +uint32_t dev_flags;/**< Flags controlling handling of device. */ +enum rte_kernel_driver kdrv;/**< Kernel driver passthrough */ +int numa_node; +const char *drv_name; }; +/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */ +#define RTE_ETH_DEV_DRV_NEED_MAPPING RTE_PCI_DRV_NEED_MAPPING +/** Device needs to be unbound even if no module is provided */ +#define RTE_ETH_DEV_DRV_FORCE_UNBIND RTE_PCI_DRV_FORCE_UNBIND +/** Device supports link state interrupt */ +#define RTE_ETH_DEV_INTR_LSC RTE_PCI_DRV_INTR_LSC +/** Device supports detaching capability */ +#define RTE_ETH_DEV_DETACHABLE RTE_PCI_DRV_DETACHABLE +/** Device is a bonded device */ +#define RTE_ETH_DEV_BONDED 0x0020 +/** * @internal * The pool of *rte_eth_dev* structures. The size of the pool
Signature · 1 line
1.9.1
Re: [PATCH 02/20] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
Quoted 116 lines · Bernard Iremonger
add
dev_flagstorte_eth_dev_data, add macros fordev_flags. add kdrv torte_eth_dev_data.
addnuma_nodetorte_eth_dev_data.
adddrv_nametorte_eth_dev_data.
usedev_typeto distinguish between vdev's and pdev's. removepci_devbranches.Signed-off-by Bernard Iremonger <[email protected]>--- lib/librte_ether/rte_ethdev.c | 53 ++++++++++++++++++++++++------------------- lib/librte_ether/rte_ethdev.h | 15 ++++++++++++ 2 files changed, 45 insertions(+), 23 deletions(-)lib/librte_ether/rte_ethdev.c +30
-23@@ -424,7 +424,7 @@ rte_eth_dev_socket_id(uint8_t port_id) {if (!rte_eth_dev_is_valid_port (port_id))return -1 ; -return rte_eth_devices[port_id].pci_dev->numa_node; +return rte_eth_devices[port_id].data->numa_node; }uint8_t @@ -503,27 +503,25 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)static int rte_eth_dev_is_detachable (uint8_t port_id) { -uint32_t drv_flags; +uint32_t dev_flags;if (!rte_eth_dev_is_valid_port (port_id)) {PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id);return -EINVAL ; } -if (rte_eth_devices[port_id].dev_type ==RTE_ETH_DEV_PCI ) { -switch (rte_eth_devices[port_id].pci_dev->kdrv) { -case RTE_KDRV_IGB_UIO : -case RTE_KDRV_UIO_GENERIC : -case RTE_KDRV_NIC_UIO : -break ; -case RTE_KDRV_VFIO : -default : -return -ENOTSUP ; - } +switch (rte_eth_devices[port_id].data->kdrv) { +case RTE_KDRV_IGB_UIO : +case RTE_KDRV_UIO_GENERIC : +case RTE_KDRV_NIC_UIO : +case RTE_KDRV_NONE : +break ; +case RTE_KDRV_VFIO : +default : +return -ENOTSUP ; } - - drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags; -return !(drv_flags &RTE_PCI_DRV_DETACHABLE ); + dev_flags = rte_eth_devices[port_id].data->dev_flags; +return !(dev_flags &RTE_ETH_DEV_DETACHABLE ); }/* attach the new physical device, then store port_id of the device */ @@ -1143,14 +1141,11 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,* If link state interrupt is enabled, check that the * device supports it. */ -if (dev_conf->intr_conf.lsc ==1 ) { -const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv; - -if (!(pci_drv->drv_flags &RTE_PCI_DRV_INTR_LSC )) { +if ((dev_conf->intr_conf.lsc ==1 ) && + (!(dev->data->dev_flags &RTE_ETH_DEV_INTR_LSC ))) {PMD_DEBUG_TRACE ("driver %s does not support lsc\n" , - pci_drv->name); + dev->data->drv_name);return -EINVAL ; - } }/* @@ -1795,8 +1790,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)FUNC_PTR_OR_RET (*dev->dev_ops->dev_infos_get); (*dev->dev_ops->dev_infos_get)(dev, dev_info); dev_info->pci_dev = dev->pci_dev; -if (dev->driver) - dev_info->driver_name = dev->driver->pci_drv.name; + dev_info->driver_name = dev->data->drv_name; }void @@ -3570,3 +3564,16 @@ rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)FUNC_PTR_OR_ERR_RET (*dev->dev_ops->set_eeprom, -ENOTSUP );return (*dev->dev_ops->set_eeprom)(dev, info); } + +void +rte_eth_copy_dev_info (struct rte_eth_dev *eth_dev,struct rte_pci_device *pci_dev) +{ +if ((eth_dev ==NULL ) || (pci_dev ==NULL )) +PMD_DEBUG_TRACE ("NULL pointer eth_dev=%p pci_dev=%p\n" , + eth_dev, pci_dev); + + eth_dev->data->dev_flags = pci_dev->driver->drv_flags; + eth_dev->data->kdrv = pci_dev->kdrv; + eth_dev->data->numa_node = pci_dev->numa_node; + eth_dev->data->drv_name = pci_dev->driver->name; +}lib/librte_ether/rte_ethdev.h +0
-0
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1639
Quoted 5 lines
lib/librte_ether/rte_ethdev.h +2
-0@@ -1635,8 +1635,23 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ lro : 1; /**< RX LRO is ON(1) / OFF(0) */ +uint32_t dev_flags;/**< Flags controlling handling of device. */ +enum rte_kernel_driver kdrv;/**< Kernel driver passthrough */
Why add this here? The ennumerated driver types are all variants on PCI bus types. Not sure why the ethernet interface needs to know this info
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1640
Quoted 1 line
lib/librte_ether/rte_ethdev.h +1
-0+int numa_node;
Ditto, this seems like information that is only relevant if the device is on a physical bus (i.e. virual devices are likely to not have a numa node)
Quoted 21 lines
lib/librte_ether/rte_ethdev.h +12
-0+const char *drv_name; }; +/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */ +#define RTE_ETH_DEV_DRV_NEED_MAPPING RTE_PCI_DRV_NEED_MAPPING +/** Device needs to be unbound even if no module is provided */ +#define RTE_ETH_DEV_DRV_FORCE_UNBIND RTE_PCI_DRV_FORCE_UNBIND +/** Device supports link state interrupt */ +#define RTE_ETH_DEV_INTR_LSC RTE_PCI_DRV_INTR_LSC +/** Device supports detaching capability */ +#define RTE_ETH_DEV_DETACHABLE RTE_PCI_DRV_DETACHABLE +/** Device is a bonded device */ +#define RTE_ETH_DEV_BONDED 0x0020 +/** * @internal * The pool of *rte_eth_dev* structures. The size of the pool Signature · 1 line
1.9.1
Re: [PATCH 02/20] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
Quoted 14 lines · Neil Horman
Quoted 13 lines · Bernard Iremonger
add
dev_flagstorte_eth_dev_data, add macros fordev_flags. add kdrv torte_eth_dev_data.
addnuma_nodetorte_eth_dev_data.
adddrv_nametorte_eth_dev_data.
usedev_typeto distinguish between vdev's and pdev's. removepci_devbranches.Signed-off-by Bernard Iremonger <[email protected]>--- lib/librte_ether/rte_ethdev.c | 53 ++++++++++++++++++++++++------------------- lib/librte_ether/rte_ethdev.h | 15 ++++++++++++ 2 files changed, 45 insertions(+), 23 deletions(-)
<snip>
Quoted 10 lines
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1639
Quoted 7 lines
+++
b/lib/librte_ether/rte_ethdev.hlib/librte_ether/rte_ethdev.h +2
-0@@ -1635,8 +1635,23 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ lro : 1; /**< RX LRO is ON(1) / OFF(0) */ +uint32_t dev_flags;/**< Flags controlling handling of device. */ +enum rte_kernel_driver kdrv;/**< Kernel driver passthrough */ Why add this here? The ennumerated driver types are all variants on PCI bus types. Not sure why the ethernet interface needs to know this info
Quoted 4 lines
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1640
Quoted 1 line
lib/librte_ether/rte_ethdev.h +1
-0+int numa_node;Ditto, this seems like information that is only relevant if the device is on a physical bus (i.e. virual devices are likely to not have a numa node)
Actually, I disagree. For some virtual devices they will have a numa node. For ring or other virtual PMDs the numa node will be the node on which the ring / mempool etc. memory is allocated on, and can be of relevance.
/Bruce
Re: [PATCH 02/20] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
Quoted 30 lines · Bruce Richardson
Quoted 14 lines · Neil Horman
Quoted 13 lines · Bernard Iremonger
add
dev_flagstorte_eth_dev_data, add macros fordev_flags. add kdrv torte_eth_dev_data.
addnuma_nodetorte_eth_dev_data.
adddrv_nametorte_eth_dev_data.
usedev_typeto distinguish between vdev's and pdev's. removepci_devbranches.Signed-off-by Bernard Iremonger <[email protected]>--- lib/librte_ether/rte_ethdev.c | 53 ++++++++++++++++++++++++------------------- lib/librte_ether/rte_ethdev.h | 15 ++++++++++++ 2 files changed, 45 insertions(+), 23 deletions(-)<snip>
Quoted 10 lines
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1639
Quoted 7 lines
+++
b/lib/librte_ether/rte_ethdev.hlib/librte_ether/rte_ethdev.h +2
-0@@ -1635,8 +1635,23 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ lro : 1; /**< RX LRO is ON(1) / OFF(0) */ +uint32_t dev_flags;/**< Flags controlling handling of device. */ +enum rte_kernel_driver kdrv;/**< Kernel driver passthrough */ Why add this here? The ennumerated driver types are all variants on PCI bus types. Not sure why the ethernet interface needs to know this info
Quoted 4 lines
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1640
Quoted 1 line
lib/librte_ether/rte_ethdev.h +1
-0+int numa_node;Ditto, this seems like information that is only relevant if the device is on a physical bus (i.e. virual devices are likely to not have a numa node)
Quoted 6 lines
Actually, I disagree. For some virtual devices they will have a numa node. For ring or other virtual PMDs the numa node will be the node on which the ring / mempool etc. memory is allocated on, and can be of relevance.
/Bruce
I think its fairly clear that some devices (including virtual ones) have some relevant relation to a numa_node (There are even some that have no numa_node, for which a -1 value makes some sense). That said, there are just as many that don't have a relevant numa_node.
1) There are some drivers for which numa_node make no sense (regardless of value):
* af_packet - The numa node is at best determined at run time by the interface
the socket is bound to
* pcap - same as af_packet
* bonding - multiple interfaces mean multiple numa_nodes, any value set here is
just as likely to be wrong as right
* mpipe - no real large memory area to associate with a numa node
* virtio - uses iopl for communication, and cannot know its numa_node
* vmxnet3 - same concept as virtio
* xenvirt - same as vmxnet3
I think its better that you store numa locality information in a pmd's private bus data, and export it to applications via a device method. that provides the flexibility to tell the application that there is no numa locality for a device (by not implementing the method), without having to expose an unset data field to the application.
Neil
Re: [PATCH 02/20] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
Quoted 61 lines · Neil Horman
Quoted 30 lines · Bruce Richardson
Quoted 14 lines · Neil Horman
Quoted 13 lines · Bernard Iremonger
add
dev_flagstorte_eth_dev_data, add macros fordev_flags. add kdrv torte_eth_dev_data.
addnuma_nodetorte_eth_dev_data.
adddrv_nametorte_eth_dev_data.
usedev_typeto distinguish between vdev's and pdev's. removepci_devbranches.Signed-off-by Bernard Iremonger <[email protected]>--- lib/librte_ether/rte_ethdev.c | 53 ++++++++++++++++++++++++------------------- lib/librte_ether/rte_ethdev.h | 15 ++++++++++++ 2 files changed, 45 insertions(+), 23 deletions(-)<snip>
Quoted 10 lines
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1639
Quoted 7 lines
+++
b/lib/librte_ether/rte_ethdev.hlib/librte_ether/rte_ethdev.h +2
-0@@ -1635,8 +1635,23 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ lro : 1; /**< RX LRO is ON(1) / OFF(0) */ +uint32_t dev_flags;/**< Flags controlling handling of device. */ +enum rte_kernel_driver kdrv;/**< Kernel driver passthrough */ Why add this here? The ennumerated driver types are all variants on PCI bus types. Not sure why the ethernet interface needs to know this info
Quoted 4 lines
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1640
Quoted 1 line
lib/librte_ether/rte_ethdev.h +1
-0+int numa_node;Ditto, this seems like information that is only relevant if the device is on a physical bus (i.e. virual devices are likely to not have a numa node)
Quoted 6 lines
Actually, I disagree. For some virtual devices they will have a numa node. For ring or other virtual PMDs the numa node will be the node on which the ring / mempool etc. memory is allocated on, and can be of relevance.
/Bruce
I think its fairly clear that some devices (including virtual ones) have some relevant relation to a
numa_node(There are even some that have nonuma_node, for which a -1 value makes some sense). That said, there are just as many that don't have a relevantnuma_node.1) There are some drivers for which
numa_nodemake no sense (regardless of value):
*af_packet- The numa node is at best determined at run time by the interface
the socket is bound to* pcap - same as
af_packet* bonding - multiple interfaces mean multiple
numa_nodes, any value set here is
just as likely to be wrong as right* mpipe - no real large memory area to associate with a numa node
* virtio - uses iopl for communication, and cannot know its
numa_node* vmxnet3 - same concept as virtio
* xenvirt - same as vmxnet3
Quoted 8 lines
I think its better that you store numa locality information in a pmd's private bus data, and export it to applications via a device method. that provides the flexibility to tell the application that there is no numa locality for a device (by not implementing the method), without having to expose an unset data field to the application.
Neil
Sure, that could work.
However, is it really worthwhile asking drivers to implement a new ethdev API function, rather than just having them set the numa node field correctly in the init function?
/Bruce
Re: [PATCH 02/20] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
Hi Neil
<snip>
Quoted 61 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review struct rte_eth_dev_data { · line 1635
Quoted 3 lines
+++
b/lib/librte_ether/rte_ethdev.h(quoted diff) +0
-0@@ -1635,8 +1635,23 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) /OFF(0). */
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review struct rte_eth_dev_data { · line 1636
Quoted 1 line
(quoted diff) +0
-0dev_started : 1, /**< Device state: STARTED(1) /STOPPED(0). */
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Review struct rte_eth_dev_data { · line 1638
Quoted 2 lines
(quoted diff) +1
-0lro : 1; /**< RX LRO is ON(1) / OFF(0) */ + uint32_t dev_flags; /**< Flags controlling handling of device.*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review struct rte_eth_dev_data { · line 1639
Quoted 1 line
(quoted diff) +1
-0+ enum rte_kernel_driver kdrv; /**< Kernel driverpassthrough */
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Why add this here? The ennumerated driver types are all variants on PCI bus types. Not sure why the ethernet interface needs to know this info
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1640
Quoted 1 line
lib/librte_ether/rte_ethdev.h +1
-0+int numa_node;Ditto, this seems like information that is only relevant if the device is on a physical bus (i.e. virual devices are likely to not have a numa node)
Actually, I disagree. For some virtual devices they will have a numa node. For ring or other virtual PMDs the numa node will be the node on which the ring / mempool etc. memory is allocated on, and can be of
relevance.
Quoted 28 lines
Quoted 3 lines
/Bruce
I think its fairly clear that some devices (including virtual ones) have some relevant relation to a
numa_node(There are even some that have nonuma_node, for which a -1 value makes some sense). That said, there are just as many that don't have a relevantnuma_node.1) There are some drivers for which
numa_nodemake no sense (regardless of
value):
*af_packet- The numa node is at best determined at run time by the
interface the socket is bound to* pcap - same as
af_packet* bonding - multiple interfaces mean multiple
numa_nodes, any value
set here is just as likely to be wrong as right* mpipe - no real large memory area to associate with a numa node
* virtio - uses iopl for communication, and cannot know its
numa_node* vmxnet3 - same concept as virtio
* xenvirt - same as vmxnet3
Quoted 8 lines
I think its better that you store numa locality information in a pmd's private bus data, and export it to applications via a device method. that provides the flexibility to tell the application that there is no numa locality for a device (by not implementing the method), without having to expose an unset data field to the application.
Neil
Quoted 6 lines
Sure, that could work.
However, is it really worthwhile asking drivers to implement a new ethdev API function, rather than just having them set the numa node field correctly in the init function?/Bruce
The four fields below have been added to struct rte_eth_dev_data
uint32_t dev_flags; /**< Flags controlling handling of device. */ enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ int numa_node; const char *drv_name;
The data for these fields is available in the struct rte_pci_device.
In order to remove the pci_device from the vdev PMD's this data needs to be available in the eth_dev.
A new function rte_eth_copy_dev_info() has been added to the eth_dev for use by the pdevs to copy this data from the pci_device to the ethdev. In the vdevs the pci_device has been removed and the new fields are set up directly in the rte_driver.init function.
The numa_node is already initialised in the following vdev PMD's:
af_packet - initialized from socket_id
bonding - initialized from socket_id
mpipe - initialized from instance
null - initialized from socket_id
pcap - initialized from socket_id
ring - initialized form socket_id
xenvirt - initialized from socket_id
Regards,
Bernard.
Re: [PATCH 02/20] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
In reply to Bernard IremongerQuoted 6 lines
lib/librte_ether/rte_ethdev.c +1
-0+}lib/librte_ether/rte_ethdev.h +0
-0
lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1643
Quoted 9 lines
lib/librte_ether/rte_ethdev.h +4
-0@@ -1635,8 +1635,23 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ lro : 1; /**< RX LRO is ON(1) / OFF(0) */ +uint32_t dev_flags;/**< Flags controlling handling of device. */ +enum rte_kernel_driver kdrv;/**< Kernel driver passthrough */ +int numa_node; +const char *drv_name; };
Unrelated to my other questions on this code: Is rte_eth_dev_data ever allocation by any applications? If so, this will have to go through the ABI process. I don't think it is, but I wanted to ask to be sure
Neil
Quoted 18 lines
lib/librte_ether/rte_ethdev.h +11
-0+/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */ +#define RTE_ETH_DEV_DRV_NEED_MAPPING RTE_PCI_DRV_NEED_MAPPING +/** Device needs to be unbound even if no module is provided */ +#define RTE_ETH_DEV_DRV_FORCE_UNBIND RTE_PCI_DRV_FORCE_UNBIND +/** Device supports link state interrupt */ +#define RTE_ETH_DEV_INTR_LSC RTE_PCI_DRV_INTR_LSC +/** Device supports detaching capability */ +#define RTE_ETH_DEV_DETACHABLE RTE_PCI_DRV_DETACHABLE +/** Device is a bonded device */ +#define RTE_ETH_DEV_BONDED 0x0020 +/** * @internal * The pool of *rte_eth_dev* structures. The size of the pool Signature · 1 line
1.9.1
Re: [PATCH 02/20] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
Quoted 19 lines · Neil Horman
Quoted 6 lines
lib/librte_ether/rte_ethdev.c +1
-0+}lib/librte_ether/rte_ethdev.h +0
-0lib/librte_ether/rte_ethdev.h struct rte_eth_dev_data { · line 1643
Quoted 9 lines
lib/librte_ether/rte_ethdev.h +4
-0@@ -1635,8 +1635,23 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ lro : 1; /**< RX LRO is ON(1) / OFF(0) */ +uint32_t dev_flags;/**< Flags controlling handling of device. */ +enum rte_kernel_driver kdrv;/**< Kernel driver passthrough */ +int numa_node; +const char *drv_name; };Unrelated to my other questions on this code: Is
rte_eth_dev_dataever allocation by any applications? If so, this will have to go through the ABI process. I don't think it is, but I wanted to ask to be sure
Quoted 2 lines
Neil
No - applications do not allocate this structure directly, it's internal only, so we should be safe here from an ABI perspective.
/Bruce
PATCH 3/20 librte_ether: add function rte_eth_copy_dev_info()
In reply to Bernard Iremonger--- lib/librte_ether/rte_ethdev.c | 1 + lib/librte_ether/rte_ethdev.h | 14 ++++++++++++++ lib/librte_ether/rte_ether_version.map | 7 +++++++ 3 files changed, 22 insertions(+)
lib/librte_ether/rte_ethdev.c +1 -0
@@ -3576,4 +3576,5 @@ rte_eth_copy_dev_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de eth_dev->data->kdrv = pci_dev->kdrv; eth_dev->data->numa_node = pci_dev->numa_node; eth_dev->data->drv_name = pci_dev->driver->name; + }
lib/librte_ether/rte_ethdev.h +14 -0
@@ -3993,6 +3993,20 @@ extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,extern int rte_eth_timesync_read_tx_timestamp (uint8_t port_id,struct timespec *timestamp); +/** +* 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 +*/ +extern void rte_eth_copy_dev_info (struct rte_eth_dev *eth_dev,struct rte_pci_device *pci_dev); + + #ifdef __cplusplus }#endif
lib/librte_ether/rte_ether_version.map +7 -0
@@ -127,3 +127,10 @@ DPDK_2.1 { rte_eth_timesync_read_tx_timestamp; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_eth_copy_dev_info; + +} DPDK_2.1;
Signature · 1 line
1.9.1
PATCH 4/20 null: remove pci device driver
In reply to Bernard Iremongerremove rte_null_pmd and pci_dev.
initialise dev_flags, driver, drv_name, kdrv and numa_node fields in eth_dev data
--- drivers/net/null/rte_eth_null.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-)
drivers/net/null/rte_eth_null.c +9 -23
@@ -1,8 +1,8 @@/*- * BSD LICENSE * -* Copyright (C) IGEL Co.,Ltd. -* All rights reserved. +* Copyright (C) IGEL Co.,Ltd. All rights reserved. +* Copyright(c) 2015 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions
@@ -340,13 +340,6 @@ eth_stats_reset(struct rte_eth_dev *dev) } } -static struct eth_driver rte_null_pmd = { - .pci_drv = { - .name ="rte_null_pmd" , - .drv_flags =RTE_PCI_DRV_DETACHABLE , - }, -}; -static void eth_queue_release (void *q) {
@@ -386,7 +379,6 @@ eth_dev_null_create(const char *name,const unsigned nb_rx_queues =1 ;const unsigned nb_tx_queues =1 ;struct rte_eth_dev_data *data =NULL ; -struct rte_pci_device *pci_dev =NULL ;struct pmd_internals *internals =NULL ;struct rte_eth_dev *eth_dev =NULL ;
@@ -403,10 +395,6 @@ eth_dev_null_create(const char *name,if (data ==NULL ) goto error; - pci_dev =rte_zmalloc_socket (name,sizeof (*pci_dev),0 , numa_node); -if (pci_dev ==NULL ) - goto error; - internals =rte_zmalloc_socket (name,sizeof (*internals),0 , numa_node);if (internals ==NULL ) goto error;
@@ -418,8 +406,7 @@ eth_dev_null_create(const char *name,/* now put it all together * - store queue data in internals, -* - store numa_node info in pci_driver -* - point eth_dev_data to internals and pci_driver +* - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */ /* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -431,8 +418,6 @@ eth_dev_null_create(const char *name, internals->packet_copy = packet_copy; internals->numa_node = numa_node; - pci_dev->numa_node = numa_node; - data->dev_private = internals; data->port_id = eth_dev->data->port_id; data->nb_rx_queues = (uint16_t )nb_rx_queues;
@@ -443,8 +428,11 @@ eth_dev_null_create(const char *name, eth_dev->data = data; eth_dev->dev_ops = &ops; - eth_dev->pci_dev = pci_dev; - eth_dev->driver = &rte_null_pmd; + eth_dev->driver =NULL ; + eth_dev->data->dev_flags =RTE_ETH_DEV_DETACHABLE ; + eth_dev->data->kdrv =RTE_KDRV_NONE ; + eth_dev->data->drv_name =NULL ; + eth_dev->data->numa_node = numa_node;/* finally assign rx and tx ops */ if (packet_copy) {
@@ -459,7 +447,6 @@ eth_dev_null_create(const char *name, error:rte_free (data); -rte_free (pci_dev);rte_free (internals);return -1 ;
@@ -562,14 +549,13 @@ rte_pmd_null_devuninit(const char *name)RTE_LOG (INFO ,PMD ,"Closing null ethdev on numa socket %u\n" ,rte_socket_id ()); -/* reserve an ethdev entry */ +/* find the ethdev entry */ eth_dev =rte_eth_dev_allocated (name);if (eth_dev ==NULL )return -1 ;rte_free (eth_dev->data->dev_private);rte_free (eth_dev->data); -rte_free (eth_dev->pci_dev);rte_eth_dev_release_port (eth_dev);
Signature · 1 line
1.9.1
PATCH 5/20 ring: remove pci device driver
In reply to Bernard Iremongerremove rte_ring_pmd and pci_dev.
initialise dev_flags, driver, drv_name, kdrv and numa_node fields in eth_dev data.
--- drivers/net/ring/rte_eth_ring.c | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-)
drivers/net/ring/rte_eth_ring.c +8 -29
@@ -44,8 +44,6 @@#define ETH_RING_ACTION_CREATE "CREATE"#define ETH_RING_ACTION_ATTACH "ATTACH" -static const char *ring_ethdev_driver_name ="Ring PMD" ; -static const char *valid_arguments[] = {ETH_RING_NUMA_NODE_ACTION_ARG ,NULL
@@ -252,15 +250,6 @@ static const struct eth_dev_ops ops = { .mac_addr_add = eth_mac_addr_add, }; -static struct eth_driver rte_ring_pmd = { - .pci_drv = { - .name ="rte_ring_pmd" , - .drv_flags =RTE_PCI_DRV_DETACHABLE , - }, -}; - -static struct rte_pci_id id_table; - int rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], const unsigned nb_rx_queues,
@@ -269,7 +258,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], const unsigned numa_node) {struct rte_eth_dev_data *data =NULL ; -struct rte_pci_device *pci_dev =NULL ;struct pmd_internals *internals =NULL ;struct rte_eth_dev *eth_dev =NULL ;
@@ -291,10 +279,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],if (data ==NULL ) goto error; - pci_dev =rte_zmalloc_socket (name,sizeof (*pci_dev),0 , numa_node); -if (pci_dev ==NULL ) - goto error; - internals =rte_zmalloc_socket (name,sizeof (*internals),0 , numa_node);if (internals ==NULL ) goto error;
@@ -304,11 +288,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],if (eth_dev ==NULL ) goto error; -/* now put it all together * - store queue data in internals, -* - store numa_node info in pci_driver -* - point eth_dev_data to internals and pci_driver +* - store numa_node info in eth_dev_data +* - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */ /* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -323,12 +306,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], internals->tx_ring_queues[i].rng = tx_queues[i]; } - rte_ring_pmd.pci_drv.name = ring_ethdev_driver_name; - rte_ring_pmd.pci_drv.id_table = &id_table; - - pci_dev->numa_node = numa_node; - pci_dev->driver = &rte_ring_pmd.pci_drv; - data->dev_private = internals; data->port_id = eth_dev->data->port_id;memmove (data->name, eth_dev->data->name,sizeof (data->name));
@@ -338,9 +315,13 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], data->mac_addrs = &internals->address; eth_dev->data = data; - eth_dev->driver = &rte_ring_pmd; + eth_dev->driver =NULL ; eth_dev->dev_ops = &ops; - eth_dev->pci_dev = pci_dev; + eth_dev->data->dev_flags =RTE_ETH_DEV_DETACHABLE ; + eth_dev->data->kdrv =RTE_KDRV_NONE ; + eth_dev->data->drv_name =NULL ; + eth_dev->data->numa_node = numa_node; +TAILQ_INIT (&(eth_dev->link_intr_cbs));/* finally assign rx and tx ops */
@@ -351,7 +332,6 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], error:rte_free (data); -rte_free (pci_dev);rte_free (internals);return -1 ;
@@ -561,7 +541,6 @@ rte_pmd_ring_devuninit(const char *name)eth_dev_stop (eth_dev);rte_free (eth_dev->data->dev_private);rte_free (eth_dev->data); -rte_free (eth_dev->pci_dev);rte_eth_dev_release_port (eth_dev);return 0 ;
Signature · 1 line
1.9.1
PATCH 6/20 bonding: remove pci device driver
In reply to Bernard Iremongerremove pci_dev, pci_drv, rte_bond_pmd and pci_id_table.
initialise dev_flags, kdrv, driver, drv_name and numa_node fields in eth_dev data. handle numa_node for vdevs
handle RTE_ETH_DEV_INTR_LSC for vdevs
rename valid_bonded_device to check_for_bonded_device
--- drivers/net/bonding/rte_eth_bond_alb.c | 2 +- drivers/net/bonding/rte_eth_bond_api.c | 58 +++++++++--------------------- drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++----- drivers/net/bonding/rte_eth_bond_private.h | 2 +- 4 files changed, 26 insertions(+), 52 deletions(-)
drivers/net/bonding/rte_eth_bond_alb.c +1 -1
@@ -65,7 +65,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev)uint16_t data_size;char mem_name[RTE_ETH_NAME_MAX_LEN ]; -int socket_id = bond_dev->pci_dev->numa_node; +int socket_id = bond_dev->data->numa_node;/* Fill hash table with initial values */ memset (hash_table,0 ,sizeof (struct client_data ) *ALB_HASH_TABLE_SIZE );
drivers/net/bonding/rte_eth_bond_api.c +16 -42
127 lines not on this page · raw message
drivers/net/bonding/rte_eth_bond_pmd.c +8 -8
@@ -1307,7 +1307,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,rte_eth_dev_stop (slave_eth_dev->data->port_id);/* Enable interrupts on slave device if supported */ -if (slave_eth_dev->driver->pci_drv.drv_flags &RTE_PCI_DRV_INTR_LSC ) +if (slave_eth_dev->data->dev_flags &RTE_ETH_DEV_INTR_LSC ) slave_eth_dev->data->dev_conf.intr_conf.lsc =1 ;/* Configure device */
@@ -1362,9 +1362,9 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, }/* If lsc interrupt is set, check initial slave's link status */ -if (slave_eth_dev->driver->pci_drv.drv_flags &RTE_PCI_DRV_INTR_LSC ) +if (slave_eth_dev->data->dev_flags &RTE_ETH_DEV_INTR_LSC )bond_ethdev_lsc_event_callback (slave_eth_dev->data->port_id, -RTE_ETH_EVENT_INTR_LSC , &bonded_eth_dev->data->port_id); +RTE_ETH_EVENT_INTR_LSC , &bonded_eth_dev->data->port_id);return 0 ; }
@@ -1447,7 +1447,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)int i;/* slave eth dev will be started by bonded device */ -if (valid_bonded_ethdev (eth_dev)) { +if (check_for_bonded_ethdev (eth_dev)) {RTE_BOND_LOG (ERR ,"User tried to explicitly start a slave eth_dev (%d)" , eth_dev->data->port_id);return -1 ;
@@ -1592,7 +1592,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_tx_queues = (uint16_t )512 ; dev_info->min_rx_bufsize =0 ; - dev_info->pci_dev = dev->pci_dev; + dev_info->pci_dev =NULL ; dev_info->rx_offload_capa = internals->rx_offload_capa; dev_info->tx_offload_capa = internals->tx_offload_capa;
@@ -1605,7 +1605,7 @@ bond_ethdev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, {struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)rte_zmalloc_socket (NULL ,sizeof (struct bond_rx_queue ), -0 , dev->pci_dev->numa_node); +0 , dev->data->numa_node);if (bd_rx_q ==NULL )return -1 ;
@@ -1629,7 +1629,7 @@ bond_ethdev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, {struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)rte_zmalloc_socket (NULL ,sizeof (struct bond_tx_queue ), -0 , dev->pci_dev->numa_node); +0 , dev->data->numa_node);if (bd_tx_q ==NULL )return -1 ;
@@ -1873,7 +1873,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type, bonded_eth_dev = &rte_eth_devices[*(uint8_t *)param]; slave_eth_dev = &rte_eth_devices[port_id]; -if (valid_bonded_ethdev (bonded_eth_dev)) +if (check_for_bonded_ethdev (bonded_eth_dev))return ; internals = bonded_eth_dev->data->dev_private;
drivers/net/bonding/rte_eth_bond_private.h +1 -1
@@ -162,7 +162,7 @@ struct bond_dev_private {extern struct eth_dev_ops default_dev_ops;int -valid_bonded_ethdev (const struct rte_eth_dev *eth_dev); +check_for_bonded_ethdev (const struct rte_eth_dev *eth_dev);/* Search given slave array to find possition of given id. * Return slave pos or slaves_count if not found. */
Signature · 1 line
1.9.1
PATCH 7/20 pcap: remove pci device driver
In reply to Bernard Iremongerremove rte_pcap_pmd and pci_dev.
initialise dev_flags, driver, drv_name, kdrv and numa_node fields in eth_dev data
--- drivers/net/pcap/rte_eth_pcap.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-)
drivers/net/pcap/rte_eth_pcap.c +9 -22
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * Copyright(c) 2014 6WIND S.A. * All rights reserved. *
@@ -617,13 +617,6 @@ static const struct eth_dev_ops ops = { .stats_reset = eth_stats_reset, }; -static struct eth_driver rte_pcap_pmd = { - .pci_drv = { - .name ="rte_pcap_pmd" , - .drv_flags =RTE_PCI_DRV_DETACHABLE , - }, -}; -/* * Function handler that opens the pcap file for reading a stores a * reference of it for use it later on.
@@ -806,7 +799,6 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues, struct rte_kvargs *kvlist) {struct rte_eth_dev_data *data =NULL ; -struct rte_pci_device *pci_dev =NULL ;unsigned k_idx;struct rte_kvargs_pair *pair =NULL ;
@@ -819,17 +811,13 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,RTE_LOG (INFO ,PMD ,"Creating pcap-backed ethdev on numa socket %u\n" , numa_node); -/* now do all data allocation - for eth_dev structure, dummy pci driver +/* 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; - pci_dev =rte_zmalloc_socket (name,sizeof (*pci_dev),0 , numa_node); -if (pci_dev ==NULL ) - goto error; - *internals =rte_zmalloc_socket (name,sizeof (**internals),0 , numa_node);if (*internals ==NULL ) goto error;
@@ -845,8 +833,8 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,/* now put it all together * - store queue data in internals, -* - store numa_node info in pci_driver -* - point eth_dev_data to internals and pci_driver +* - store numa_node info in eth_dev +* - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */ /* NOTE: we'll replace the data element, of originally allocated eth_dev
@@ -860,8 +848,6 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,else (*internals)->if_index =if_nametoindex (pair->value); - pci_dev->numa_node = numa_node; - data->dev_private = *internals; data->port_id = (*eth_dev)->data->port_id;snprintf (data->name,sizeof (data->name),"%s" , (*eth_dev)->data->name);
@@ -874,14 +860,16 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues, (*eth_dev)->data = data; (*eth_dev)->dev_ops = &ops; - (*eth_dev)->pci_dev = pci_dev; - (*eth_dev)->driver = &rte_pcap_pmd; + (*eth_dev)->data->dev_flags =RTE_ETH_DEV_DETACHABLE ; + (*eth_dev)->driver =NULL ; + (*eth_dev)->data->kdrv =RTE_KDRV_NONE ; + (*eth_dev)->data->drv_name =NULL ; + (*eth_dev)->data->numa_node = numa_node;return 0 ; error:rte_free (data); -rte_free (pci_dev);rte_free (*internals);return -1 ;
@@ -1096,7 +1084,6 @@ rte_pmd_pcap_devuninit(const char *name)rte_free (eth_dev->data->dev_private);rte_free (eth_dev->data); -rte_free (eth_dev->pci_dev);rte_eth_dev_release_port (eth_dev);
Signature · 1 line
1.9.1
PATCH 8/20 af_packet: remove pci device driver
In reply to Bernard IremongerFrom: David Hunt <[email protected]>
initialise dev_flags, driver, kdrv, drv_name and numa_node fileds in eth_dev data.
--- drivers/net/af_packet/rte_eth_af_packet.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +8 -12
@@ -5,7 +5,7 @@* * Originally based upon librte_pmd_pcap code: * -* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * Copyright(c) 2014 6WIND S.A. * All rights reserved. *
@@ -431,7 +431,6 @@ rte_pmd_init_internals(const char *name, struct rte_kvargs *kvlist) {struct rte_eth_dev_data *data =NULL ; -struct rte_pci_device *pci_dev =NULL ;struct rte_kvargs_pair *pair =NULL ;struct ifreq ifr;size_t ifnamelen;
@@ -469,10 +468,6 @@ rte_pmd_init_internals(const char *name,if (data ==NULL ) goto error; - pci_dev =rte_zmalloc_socket (name,sizeof (*pci_dev),0 , numa_node); -if (pci_dev ==NULL ) - goto error; - *internals =rte_zmalloc_socket (name,sizeof (**internals),0 , numa_node);if (*internals ==NULL )
@@ -655,8 +650,8 @@ rte_pmd_init_internals(const char *name,/* * now put it all together * - store queue data in internals, -* - store numa_node info in pci_driver -* - point eth_dev_data to internals and pci_driver +* - store numa_node info in eth_dev +* - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */
@@ -669,17 +664,18 @@ rte_pmd_init_internals(const char *name, data->dev_link = pmd_link; data->mac_addrs = &(*internals)->eth_addr; - pci_dev->numa_node = numa_node; - (*eth_dev)->data = data; (*eth_dev)->dev_ops = &ops; - (*eth_dev)->pci_dev = pci_dev; + (*eth_dev)->data->dev_flags =0 ; + (*eth_dev)->driver =NULL ; + (*eth_dev)->data->drv_name =NULL ; + (*eth_dev)->data->kdrv =RTE_KDRV_NONE ; + (*eth_dev)->data->numa_node = numa_node;return 0 ; error:rte_free (data); -rte_free (pci_dev);if (*internals) {for (q =0 ; q < nb_queues; q++) {
Signature · 1 line
1.9.1
PATCH 9/20 xenvirt: remove pci device driver
In reply to Bernard IremongerFrom: David Hunt <[email protected]>
Initialise dev_flags, driver, kdrv, drv_name and numa_node in eth_dev data.
--- drivers/net/xenvirt/rte_eth_xenvirt.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/xenvirt/rte_eth_xenvirt.c +5 -9
@@ -617,7 +617,6 @@ eth_dev_xenvirt_create(const char *name, const char *params, enum dev_action action) {struct rte_eth_dev_data *data =NULL ; -struct rte_pci_device *pci_dev =NULL ;struct pmd_internals *internals =NULL ;struct rte_eth_dev *eth_dev =NULL ;struct xenvirt_dict dict;
@@ -639,10 +638,6 @@ eth_dev_xenvirt_create(const char *name, const char *params,if (data ==NULL ) goto err; - pci_dev =rte_zmalloc_socket (name,sizeof (*pci_dev),0 , numa_node); -if (pci_dev ==NULL ) - goto err; - internals =rte_zmalloc_socket (name,sizeof (*internals),0 , numa_node);if (internals ==NULL ) goto err;
@@ -652,8 +647,6 @@ eth_dev_xenvirt_create(const char *name, const char *params,if (eth_dev ==NULL ) goto err; - pci_dev->numa_node = numa_node; - data->dev_private = internals; data->port_id = eth_dev->data->port_id; data->nb_rx_queues = (uint16_t )1 ;
@@ -668,7 +661,11 @@ eth_dev_xenvirt_create(const char *name, const char *params, eth_dev->data = data; eth_dev->dev_ops = &ops; - eth_dev->pci_dev = pci_dev; + eth_dev->data->dev_flags =0 ; + eth_dev->data->kdrv =RTE_KDRV_NONE ; + eth_dev->data->drv_name =NULL ; + eth_dev->driver =NULL ; + eth_dev->data->numa_node = numa_node; eth_dev->rx_pkt_burst = eth_xenvirt_rx; eth_dev->tx_pkt_burst = eth_xenvirt_tx;
@@ -680,7 +677,6 @@ eth_dev_xenvirt_create(const char *name, const char *params, err:rte_free (data); -rte_free (pci_dev);rte_free (internals);return -1 ;
Signature · 1 line
1.9.1
PATCH 10/20 mpipe: remove pci device driver
In reply to Bernard IremongerFrom: David Hunt <[email protected]>
initialise dev_flags, kdrv, driver, drv_name and numa_node in eth_dev data.
--- drivers/net/mpipe/mpipe_tilegx.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +7 -3
@@ -2,6 +2,7 @@* BSD LICENSE * * Copyright(c) 2015 EZchip Semiconductor Ltd. All rights reserved. +* Copyright(c) 2015 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions
@@ -122,7 +123,6 @@ struct mpipe_dev_priv {int channel;/* Device channel. */ int port_id;/* DPDK port index. */ struct rte_eth_dev *eth_dev;/* DPDK device. */ -struct rte_pci_device pci_dev;/* PCI device data. */ struct rte_mbuf **tx_comps;/* TX completion array. */ struct rte_mempool *rx_mpool;/* mpool used by the rx queues. */ unsigned rx_offset;/* Receive head room. */
@@ -1567,7 +1567,6 @@ rte_pmd_mpipe_devinit(const char *ifname, priv->context = context; priv->instance = instance; priv->is_xaui = (strncmp (ifname,"xgbe" ,4 ) ==0 ); - priv->pci_dev.numa_node = instance; priv->channel =-1 ; mac = priv->mac_addr.addr_bytes;
@@ -1591,9 +1590,14 @@ rte_pmd_mpipe_devinit(const char *ifname, priv->eth_dev = eth_dev; priv->port_id = eth_dev->data->port_id; eth_dev->data->dev_private = priv; - eth_dev->pci_dev = &priv->pci_dev; eth_dev->data->mac_addrs = &priv->mac_addr; + eth_dev->data->dev_flags =0 ; + eth_dev->data->kdrv =RTE_KDRV_NONE ; + eth_dev->driver =NULL ; + eth_dev->data->drv_name =NULL ; + eth_dev->data->numa_node = instance; + eth_dev->dev_ops = &mpipe_dev_ops; eth_dev->rx_pkt_burst = &mpipe_recv_pkts; eth_dev->tx_pkt_burst = &mpipe_xmit_pkts;
Signature · 1 line
1.9.1
PATCH 11/20 ixgbe: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +4 -0
@@ -887,6 +887,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) } pci_dev = eth_dev->pci_dev; +rte_eth_copy_dev_info (eth_dev, pci_dev); +/* Vendor and Device ID need to be set before init of shared code */ hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id;
@@ -1155,6 +1157,8 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) pci_dev = eth_dev->pci_dev; +rte_eth_copy_dev_info (eth_dev, pci_dev); + hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id; hw->hw_addr = (void *)pci_dev->mem_resource[0 ].addr;
Signature · 1 line
1.9.1
PATCH 12/20 e1000: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/e1000/em_ethdev.c | 3 +++ drivers/net/e1000/igb_ethdev.c | 5 +++++ 2 files changed, 8 insertions(+)
drivers/net/e1000/em_ethdev.c +3 -0
@@ -232,6 +232,9 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)E1000_DEV_PRIVATE_TO_VFTA (eth_dev->data->dev_private); pci_dev = eth_dev->pci_dev; + +rte_eth_copy_dev_info (eth_dev, pci_dev); + eth_dev->dev_ops = ð_em_ops; eth_dev->rx_pkt_burst = (eth_rx_burst_t)ð_em_recv_pkts; eth_dev->tx_pkt_burst = (eth_tx_burst_t)ð_em_xmit_pkts;
drivers/net/e1000/igb_ethdev.c +5 -0
@@ -531,6 +531,9 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)uint32_t ctrl_ext; pci_dev = eth_dev->pci_dev; + +rte_eth_copy_dev_info (eth_dev, pci_dev); + eth_dev->dev_ops = ð_igb_ops; eth_dev->rx_pkt_burst = ð_igb_recv_pkts; eth_dev->tx_pkt_burst = ð_igb_xmit_pkts;
@@ -739,6 +742,8 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) pci_dev = eth_dev->pci_dev; +rte_eth_copy_dev_info (eth_dev, pci_dev); + hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id; hw->hw_addr = (void *)pci_dev->mem_resource[0 ].addr;
Signature · 1 line
1.9.1
PATCH 13/20 i40e: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/i40e/i40e_ethdev.c | 3 +++ drivers/net/i40e/i40e_ethdev_vf.c | 2 ++ 2 files changed, 5 insertions(+)
drivers/net/i40e/i40e_ethdev.c +3 -0
@@ -408,6 +408,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)return 0 ; } pci_dev = dev->pci_dev; + +rte_eth_copy_dev_info (dev, pci_dev); + pf->adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); pf->adapter->eth_dev = dev; pf->dev_data = dev->data;
drivers/net/i40e/i40e_ethdev_vf.c +2 -0
@@ -1187,6 +1187,8 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)return 0 ; } +rte_eth_copy_dev_info (eth_dev, eth_dev->pci_dev); + hw->vendor_id = eth_dev->pci_dev->id.vendor_id; hw->device_id = eth_dev->pci_dev->id.device_id; hw->subsystem_vendor_id = eth_dev->pci_dev->id.subsystem_vendor_id;
Signature · 1 line
1.9.1
PATCH 14/20 fm10k: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/fm10k/fm10k_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/fm10k/fm10k_ethdev.c +2 -0
@@ -2075,6 +2075,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; +rte_eth_copy_dev_info (dev, dev->pci_dev); + macvlan =FM10K_DEV_PRIVATE_TO_MACVLAN (dev->data->dev_private);memset (macvlan,0 ,sizeof (*macvlan));/* Vendor and Device ID need to be set before init of shared code */
Signature · 1 line
1.9.1
PATCH 15/20 bnx2x: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/bnx2x/bnx2x_ethdev.c +4 -0
@@ -1,5 +1,6 @@/* * Copyright (c) 2013-2015 Brocade Communications Systems, Inc. +* Copyright(c) 2015 Intel Corporation. * * All rights reserved. */
@@ -419,6 +420,9 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) eth_dev->dev_ops = is_vf ? &bnx2xvf_eth_dev_ops : &bnx2x_eth_dev_ops; pci_dev = eth_dev->pci_dev; + +rte_eth_copy_dev_info (eth_dev, pci_dev); + sc = eth_dev->data->dev_private; sc->pcie_bus = pci_dev->addr.bus; sc->pcie_device = pci_dev->addr.devid;
Signature · 1 line
1.9.1
Re: [PATCH 15/20] bnx2x: copy pci device info to eth_dev data
Quoted 6 lines · On Mon, 28 Sep 2015 14:03:33 +0100 Bernard Iremonger…
/*
* Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
+ * Copyright(c) 2015 Intel Corporation.
*
* All rights reserved.
*/
I agree with others, you can't claim copyright until you have made substantive changes. At one point a lawyer told me that had to be 10% of the code.
Re: [PATCH 15/20] bnx2x: copy pci device info to eth_dev data
Hi Stephen,
<snip>
Quoted 10 lines
Quoted 6 lines · On Mon, 28 Sep 2015 14:03:33 +0100 Bernard Iremonger…
/*
* Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
+ * Copyright(c) 2015 Intel Corporation.
*
* All rights reserved.
*/
Quoted 3 lines
I agree with others, you can't claim copyright until you have made substantive changes. At one point a lawyer told me that had to be 10% of the code.
I thought it was necessary to add the copyright line because I had modified the code. I will remove it in the next revision of the patch set.
Regards,
Bernard.
PATCH 16/20 cxgbe: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/cxgbe/cxgbe_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +5 -0
@@ -2,6 +2,8 @@* BSD LICENSE * * Copyright(c) 2014-2015 Chelsio Communications. +* Copyright(c) 2015 Intel Corporation. +* * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -744,6 +746,9 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)return 0 ; pci_dev = eth_dev->pci_dev; + +rte_eth_copy_dev_info (eth_dev, pci_dev); +snprintf (name,sizeof (name),"cxgbeadapter%d" , eth_dev->data->port_id); adapter =rte_zmalloc (name,sizeof (*adapter),0 );if (!adapter)
Signature · 1 line
1.9.1
Re: [PATCH 16/20] cxgbe: copy pci device info to eth_dev data
Hi Bernard,
Quoted 31 lines · Bernard Iremonger
Signed-off-by Bernard Iremonger <[email protected]>--- drivers/net/cxgbe/cxgbe_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/net/cxgbe/cxgbe_ethdev.c +5
-0@@ -2,6 +2,8 @@* BSD LICENSE * * Copyright(c) 2014-2015 Chelsio Communications. +* Copyright(c) 2015 Intel Corporation. +* * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -744,6 +746,9 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)return 0 ; pci_dev = eth_dev->pci_dev; + +rte_eth_copy_dev_info (eth_dev, pci_dev); +snprintf (name,sizeof (name),"cxgbeadapter%d" , eth_dev->data->port_id); adapter =rte_zmalloc (name,sizeof (*adapter),0 );if (!adapter)Signature · 1 line
1.9.1
Out of curiosity, do you really need to add Intel copyright on top of source file for a 3 line change in source file? I see that you have done the same for cisco, mellanox, broadcom and other vendors as well.
I don't claim to understand Copyright very well. However, I have seen in other open community projects like kernel.org where people many times do significant change in someone else's code and yet, don't normally add their own copyright to source files.
Care to explain what is the intention here with addition of Intel Copyright statement?
Thanks,
Rahul
Re: [PATCH 16/20] cxgbe: copy pci device info to eth_dev data
Hi Rahul,
<snip>
Quoted 12 lines
Out of curiosity, do you really need to add Intel copyright on top of source file for a 3 line change in source file? I see that you have done the same for cisco, mellanox, broadcom and other vendors as well.
I don't claim to understand Copyright very well. However, I have seen in other
open community projects like kernel.org where people many times do significant
change in someone else's code and yet, don't normally add their own copyright
to source files.
Quoted 5 lines
Care to explain what is the intention here with addition of Intel Copyright statement?
Thanks,
Rahul
I thought it was necessary to add the Intel Copyright, because I had modified the code. I will remove it in the next revision of the patchset.
Regards,
Bernard.
PATCH 17/20 enic: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/enic/enic_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/enic/enic_ethdev.c +2 -0
@@ -3,6 +3,7 @@* Copyright 2007 Nuova Systems, Inc. All rights reserved. * * Copyright (c) 2014, Cisco Systems, Inc. +* Copyright(c) 2015 Intel Corporation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -599,6 +600,7 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev) eth_dev->tx_pkt_burst = &enicpmd_xmit_pkts; pdev = eth_dev->pci_dev; +rte_eth_copy_dev_info (eth_dev, pdev); enic->pdev = pdev; addr = &pdev->addr;
Signature · 1 line
1.9.1
PATCH 18/20 mlx4: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/mlx4/mlx4.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/mlx4/mlx4.c +4 -0
@@ -3,6 +3,7 @@* * Copyright 2012-2015 6WIND S.A. * Copyright 2012 Mellanox. +* Copyright(c) 2015 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions
@@ -4980,6 +4981,9 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) eth_dev->data->dev_private = priv; eth_dev->pci_dev = pci_dev; + +rte_eth_copy_dev_info (eth_dev, pci_dev); + eth_dev->driver = &mlx4_driver; eth_dev->data->rx_mbuf_alloc_failed =0 ; eth_dev->data->mtu =ETHER_MTU ;
Signature · 1 line
1.9.1
PATCH 19/20 virtio: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/virtio/virtio_ethdev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/virtio/virtio_ethdev.c +3 -0
@@ -1185,6 +1185,9 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) } pci_dev = eth_dev->pci_dev; + +rte_eth_copy_dev_info (eth_dev, pci_dev); +if (virtio_resource_init (pci_dev) <0 )return -1 ;
Signature · 1 line
1.9.1
PATCH 20/20 vmxnet3: copy pci device info to eth_dev data
In reply to Bernard Iremonger--- drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/vmxnet3/vmxnet3_ethdev.c +2 -0
@@ -235,6 +235,8 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; +rte_eth_copy_dev_info (eth_dev, pci_dev); +/* Vendor and Device ID need to be set before init of shared code */ hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id;
Signature · 1 line
1.9.1