Remove RTE_ETH_DEV_DETACHABLE
Subsystems (3)
cover Remove RTE_ETH_DEV_DETACHABLE
This flag was deprecated in the previous release, and this is its removal.
We are going from an explicit support of device detach, to an implicit one, with specific checks in place for PMDs not supporting the feature.
Attempting to Cc all relevant maintainers:
Sorry for any undue ML traffic going your way if you are not interested in this series.
I'd like to highlight Alejandro Lucero for the NFP PMD, as the patch is somewhat more involved for this PMD and I don't have the hardware available to validate the change.
Gaetan Rivet (3):
ethdev: remove detachable device flag
doc: follow detachable flag disappearance
pci: propagate PMD removal error value for unplug
doc/guides/prog_guide/port_hotplug_framework.rst | 8 ++------ drivers/net/af_packet/rte_eth_af_packet.c | 1 - drivers/net/ark/ark_ethdev.c | 1 - drivers/net/avp/avp_ethdev.c | 2 -- drivers/net/bnxt/bnxt_ethdev.c | 1 - drivers/net/bonding/rte_eth_bond_pmd.c | 3 +-- drivers/net/e1000/em_ethdev.c | 1 - drivers/net/e1000/igb_ethdev.c | 2 -- drivers/net/fm10k/fm10k_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev_vf.c | 1 - drivers/net/ixgbe/ixgbe_ethdev.c | 2 -- drivers/net/kni/rte_eth_kni.c | 2 -- drivers/net/liquidio/lio_ethdev.c | 1 - drivers/net/mlx4/mlx4.c | 1 - drivers/net/mlx5/mlx5.c | 1 - drivers/net/nfp/nfp_net.c | 19 ++++++++++++++++--- drivers/net/null/rte_eth_null.c | 2 -- drivers/net/pcap/rte_eth_pcap.c | 1 - drivers/net/ring/rte_eth_ring.c | 1 - drivers/net/sfc/sfc_ethdev.c | 2 -- drivers/net/softnic/rte_eth_softnic.c | 1 - drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/vhost/rte_eth_vhost.c | 3 +-- drivers/net/virtio/virtio_ethdev.c | 1 - drivers/net/virtio/virtio_user_ethdev.c | 1 - drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 - lib/librte_eal/common/eal_common_pci.c | 14 ++++++++++---- lib/librte_ether/rte_ethdev.c | 19 ------------------- lib/librte_ether/rte_ethdev.h | 2 -- 30 files changed, 31 insertions(+), 67 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/3 ethdev: remove detachable device flag
This flag is not necessary at the ether layer anymore. Buses are able to advertize their hotplug support. The ether layer can rely upon this capability instead of a special flag.
--- drivers/net/af_packet/rte_eth_af_packet.c | 1 - drivers/net/ark/ark_ethdev.c | 1 - drivers/net/avp/avp_ethdev.c | 2 -- drivers/net/bnxt/bnxt_ethdev.c | 1 - drivers/net/bonding/rte_eth_bond_pmd.c | 3 +-- drivers/net/e1000/em_ethdev.c | 1 - drivers/net/e1000/igb_ethdev.c | 2 -- drivers/net/fm10k/fm10k_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev_vf.c | 1 - drivers/net/ixgbe/ixgbe_ethdev.c | 2 -- drivers/net/kni/rte_eth_kni.c | 2 -- drivers/net/liquidio/lio_ethdev.c | 1 - drivers/net/mlx4/mlx4.c | 1 - drivers/net/mlx5/mlx5.c | 1 - drivers/net/nfp/nfp_net.c | 19 ++++++++++++++++--- drivers/net/null/rte_eth_null.c | 2 -- drivers/net/pcap/rte_eth_pcap.c | 1 - drivers/net/ring/rte_eth_ring.c | 1 - drivers/net/sfc/sfc_ethdev.c | 2 -- drivers/net/softnic/rte_eth_softnic.c | 1 - drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/vhost/rte_eth_vhost.c | 3 +-- drivers/net/virtio/virtio_ethdev.c | 1 - drivers/net/virtio/virtio_user_ethdev.c | 1 - drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 - lib/librte_ether/rte_ethdev.c | 19 ------------------- lib/librte_ether/rte_ethdev.h | 2 -- 28 files changed, 19 insertions(+), 57 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +0 -1
@@ -814,7 +814,6 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, (*eth_dev)->data = data; (*eth_dev)->dev_ops = &ops; - (*eth_dev)->data->dev_flags =RTE_ETH_DEV_DETACHABLE ;return 0 ;
drivers/net/ark/ark_ethdev.c +0 -1
@@ -342,7 +342,6 @@ eth_ark_dev_init(struct rte_eth_dev *dev)/* We are a single function multi-port device. */ ret =ark_config_device (dev); dev->dev_ops = &ark_eth_dev_ops; - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; dev->data->mac_addrs =rte_zmalloc ("ark" ,ETHER_ADDR_LEN ,0 );if (!dev->data->mac_addrs) {
drivers/net/avp/avp_ethdev.c +0 -2
@@ -1004,8 +1004,6 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev)rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; -/* Check current migration status */ if (avp_dev_migration_pending (eth_dev)) {PMD_DRV_LOG (ERR ,"VM live migration operation in progress\n" );
drivers/net/bnxt/bnxt_ethdev.c +0 -1
@@ -2780,7 +2780,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)RTE_LOG (INFO ,PMD ,"%s\n" , bnxt_version);rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; bp = eth_dev->data->dev_private;
drivers/net/bonding/rte_eth_bond_pmd.c +1 -2
@@ -2761,8 +2761,7 @@ 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->data->dev_flags =RTE_ETH_DEV_INTR_LSC ;rte_spinlock_init (&internals->lock);
drivers/net/e1000/em_ethdev.c +0 -1
@@ -341,7 +341,6 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) }rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->hw_addr = (void *)pci_dev->mem_resource[0 ].addr; hw->device_id = pci_dev->id.device_id;
drivers/net/e1000/igb_ethdev.c +0 -2
@@ -818,7 +818,6 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) }rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->hw_addr= (void *)pci_dev->mem_resource[0 ].addr;
@@ -1053,7 +1052,6 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev);rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id;
drivers/net/fm10k/fm10k_ethdev.c +0 -1
@@ -2909,7 +2909,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) }rte_eth_copy_pci_info (dev, pdev); - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; macvlan =FM10K_DEV_PRIVATE_TO_MACVLAN (dev->data->dev_private);memset (macvlan,0 ,sizeof (*macvlan));
drivers/net/i40e/i40e_ethdev.c +0 -1
@@ -1100,7 +1100,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) intr_handle = &pci_dev->intr_handle;rte_eth_copy_pci_info (dev, pci_dev); - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; pf->adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); pf->adapter->eth_dev = dev;
drivers/net/i40e/i40e_ethdev_vf.c +0 -1
@@ -1461,7 +1461,6 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)i40e_set_default_ptype_table (eth_dev);i40e_set_default_pctype_table (eth_dev);rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->vendor_id = pci_dev->id.vendor_id; hw->device_id = pci_dev->id.device_id;
drivers/net/ixgbe/ixgbe_ethdev.c +0 -2
@@ -1168,7 +1168,6 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) }rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ;/* Vendor and Device ID need to be set before init of shared code */ hw->device_id = pci_dev->id.device_id;
@@ -1627,7 +1626,6 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) }rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id;
drivers/net/kni/rte_eth_kni.c +0 -2
@@ -397,8 +397,6 @@ eth_kni_create(struct rte_vdev_device *vdev, eth_dev->data = data; eth_dev->dev_ops = ð_kni_ops; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ; - internals->no_request_thread = args->no_request_thread;return eth_dev;
drivers/net/liquidio/lio_ethdev.c +0 -1
@@ -2079,7 +2079,6 @@ lio_eth_dev_init(struct rte_eth_dev *eth_dev)return 0 ;rte_eth_copy_pci_info (eth_dev, pdev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ;if (pdev->mem_resource[0 ].addr) { lio_dev->hw_addr = pdev->mem_resource[0 ].addr;
drivers/net/mlx4/mlx4.c +0 -1
@@ -642,7 +642,6 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) eth_dev->intr_handle = &priv->intr_handle; priv->dev = eth_dev; eth_dev->dev_ops = &mlx4_dev_ops; - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ;/* Bring Ethernet device up. */ DEBUG ("forcing Ethernet interface up" );mlx4_dev_set_link_up (priv->dev);
drivers/net/mlx5/mlx5.c +0 -1
@@ -917,7 +917,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) eth_dev->data->mac_addrs = priv->mac; eth_dev->device = &pci_dev->device;rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; eth_dev->device->driver = &mlx5_driver.driver; priv->dev = eth_dev; eth_dev->dev_ops = &mlx5_dev_ops;
drivers/net/nfp/nfp_net.c +16 -3
@@ -2668,9 +2668,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)return 0 ;rte_eth_copy_pci_info (eth_dev, pci_dev); -/* hotplug is not possible with multiport PF */ -if (!hw->pf_multiport_enabled) - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id;
@@ -3016,6 +3013,22 @@ static int eth_nfp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev) { +struct rte_eth_dev *eth_dev; +struct nfp_net_hw *hw, *hwport0; +int port =0 ; + + eth_dev =rte_eth_dev_allocated (pci_dev->device.name); +if ((pci_dev->id.device_id ==PCI_DEVICE_ID_NFP4000_PF_NIC ) || + (pci_dev->id.device_id ==PCI_DEVICE_ID_NFP6000_PF_NIC )) { + port =get_pf_port_number (eth_dev->data->name); + hwport0 =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); + hw = &hwport0[port]; + }else { + hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); + } +/* hotplug is not possible with multiport PF */ +if (!hw->pf_multiport_enabled) +return -ENOTSUP ;return rte_eth_dev_pci_generic_remove (pci_dev,NULL ); }
drivers/net/null/rte_eth_null.c +0 -2
@@ -542,8 +542,6 @@ eth_dev_null_create(struct rte_vdev_device *dev, eth_dev->data = data; eth_dev->dev_ops = &ops; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ; -/* finally assign rx and tx ops */ if (packet_copy) { eth_dev->rx_pkt_burst = eth_null_copy_rx;
drivers/net/pcap/rte_eth_pcap.c +0 -1
@@ -840,7 +840,6 @@ pmd_init_internals(struct rte_vdev_device *vdev,*/ (*eth_dev)->data = data; (*eth_dev)->dev_ops = &ops; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ;return 0 ; }
drivers/net/ring/rte_eth_ring.c +0 -1
@@ -358,7 +358,6 @@ do_eth_dev_ring_create(const char *name, eth_dev->data = data; eth_dev->dev_ops = &ops; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ; data->kdrv =RTE_KDRV_NONE ; data->numa_node = numa_node;
drivers/net/sfc/sfc_ethdev.c +0 -2
@@ -1791,8 +1791,6 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)/* Copy PCI device info to the dev->data */ rte_eth_copy_pci_info (dev, pci_dev); - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; - rc =sfc_kvargs_parse (sa);if (rc !=0 ) goto fail_kvargs_parse;
drivers/net/softnic/rte_eth_softnic.c +0 -1
@@ -557,7 +557,6 @@ pmd_ethdev_register(struct rte_vdev_device *vdev, soft_dev->data->promiscuous =1 ; soft_dev->data->kdrv =RTE_KDRV_NONE ; soft_dev->data->numa_node = numa_node; - soft_dev->data->dev_flags =RTE_ETH_DEV_DETACHABLE ;return 0 ; }
drivers/net/tap/rte_eth_tap.c +1 -1
@@ -1268,7 +1268,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,/* Setup some default values */ rte_memcpy (data, dev->data,sizeof (*data)); data->dev_private = pmd; - data->dev_flags =RTE_ETH_DEV_DETACHABLE |RTE_ETH_DEV_INTR_LSC ; + data->dev_flags =RTE_ETH_DEV_INTR_LSC ; data->numa_node = numa_node; data->dev_link = pmd_link;
drivers/net/vhost/rte_eth_vhost.c +1 -2
@@ -1086,8 +1086,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name, internal->max_queues = queues; data->dev_link = pmd_link; data->mac_addrs = eth_addr; - data->dev_flags = -RTE_ETH_DEV_DETACHABLE |RTE_ETH_DEV_INTR_LSC ; + data->dev_flags =RTE_ETH_DEV_INTR_LSC ; eth_dev->dev_ops = &ops;
drivers/net/virtio/virtio_ethdev.c +0 -1
@@ -1384,7 +1384,6 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)rte_eth_copy_pci_info (eth_dev, pci_dev); } - eth_dev->data->dev_flags =RTE_ETH_DEV_DETACHABLE ;/* If host does not support both status and MSI-X then disable LSC */ if (vtpci_with_feature (hw,VIRTIO_NET_F_STATUS ) && hw->use_msix) eth_dev->data->dev_flags |=RTE_ETH_DEV_INTR_LSC ;
drivers/net/virtio/virtio_user_ethdev.c +0 -1
@@ -372,7 +372,6 @@ virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev) hw->use_simple_rx =0 ; hw->use_simple_tx =0 ; hw->virtio_user_dev = dev; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ;return eth_dev; }
drivers/net/vmxnet3/vmxnet3_ethdev.c +0 -1
@@ -309,7 +309,6 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)return 0 ;rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ;/* Vendor and Device ID need to be set before init of shared code */ hw->device_id = pci_dev->id.device_id;
lib/librte_ether/rte_ethdev.c +0 -19
@@ -356,21 +356,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)return -ENODEV ; } -static int -rte_eth_dev_is_detachable (uint16_t port_id) -{ -uint32_t dev_flags; - -RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -EINVAL ); - - dev_flags = rte_eth_devices[port_id].data->dev_flags; -if ((dev_flags &RTE_ETH_DEV_DETACHABLE ) && - (!(dev_flags &RTE_ETH_DEV_BONDED_SLAVE ))) -return 0 ; -else -return 1 ; -} -/* attach the new device, then store port_id of the device */ int rte_eth_dev_attach (const char *devargs,uint16_t *port_id)
@@ -428,10 +413,6 @@ rte_eth_dev_detach(uint16_t port_id, char *name) goto err; } -/* FIXME: move this to eal, once device flags are relocated there */ -if (rte_eth_dev_is_detachable (port_id)) - goto err; -snprintf (name,sizeof (rte_eth_devices[port_id].data->name),"%s" , rte_eth_devices[port_id].data->name);
lib/librte_ether/rte_ethdev.h +0 -2
@@ -1798,8 +1798,6 @@ struct rte_eth_dev_data {/**< VLAN filter configuration. */ }; -/** Device supports hotplug detach */ -#define RTE_ETH_DEV_DETACHABLE 0x0001/** Device supports link state interrupt */ #define RTE_ETH_DEV_INTR_LSC 0x0002/** Device is a bonded slave */
Signature · 1 line
2.1.4
Re: [PATCH v1 1/3] ethdev: remove detachable device flag
Quoted 5 lines · Gaetan Rivet
This flag is not necessary at the ether layer anymore. Buses are able to advertize their hotplug support. The ether layer can rely upon this capability instead of a special flag.
Signed-off-by Gaetan Rivet <[email protected]>
Quoted 30 lines
--- drivers/net/af_packet/rte_eth_af_packet.c | 1 - drivers/net/ark/ark_ethdev.c | 1 - drivers/net/avp/avp_ethdev.c | 2 -- drivers/net/bnxt/bnxt_ethdev.c | 1 - drivers/net/bonding/rte_eth_bond_pmd.c | 3 +-- drivers/net/e1000/em_ethdev.c | 1 - drivers/net/e1000/igb_ethdev.c | 2 -- drivers/net/fm10k/fm10k_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev_vf.c | 1 - drivers/net/ixgbe/ixgbe_ethdev.c | 2 -- drivers/net/kni/rte_eth_kni.c | 2 -- drivers/net/liquidio/lio_ethdev.c | 1 - drivers/net/mlx4/mlx4.c | 1 - drivers/net/mlx5/mlx5.c | 1 - drivers/net/nfp/nfp_net.c | 19 ++++++++++++++++--- drivers/net/null/rte_eth_null.c | 2 -- drivers/net/pcap/rte_eth_pcap.c | 1 - drivers/net/ring/rte_eth_ring.c | 1 - drivers/net/sfc/sfc_ethdev.c | 2 -- drivers/net/softnic/rte_eth_softnic.c | 1 - drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/vhost/rte_eth_vhost.c | 3 +-- drivers/net/virtio/virtio_ethdev.c | 1 - drivers/net/virtio/virtio_user_ethdev.c | 1 - drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 - lib/librte_ether/rte_ethdev.c | 19 ------------------- lib/librte_ether/rte_ethdev.h | 2 -- 28 files changed, 19 insertions(+), 57 deletions(-)
<...>
Quoted 13 lines
drivers/net/sfc/sfc_ethdev.c +0
-2@@ -1791,8 +1791,6 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)/* Copy PCI device info to the dev->data */ rte_eth_copy_pci_info (dev, pci_dev); - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; - rc =sfc_kvargs_parse (sa);if (rc !=0 ) goto fail_kvargs_parse;
<...>
Re: [PATCH v1 1/3] ethdev: remove detachable device flag
In reply to Gaetan Rivet24/10/2017 10:59, Gaetan Rivet:
Quoted 5 lines
This flag is not necessary at the ether layer anymore. Buses are able to advertize their hotplug support. The ether layer can rely upon this capability instead of a special flag.
Signed-off-by Gaetan Rivet <[email protected]>
Please update the release notes in API section
and remove the deprecation notice.
Thanks
Re: [PATCH v1 1/3] ethdev: remove detachable device flag
Quoted 11 lines · Thomas Monjalon
24/10/2017 10:59, Gaetan Rivet:
Quoted 5 lines
This flag is not necessary at the ether layer anymore. Buses are able to advertize their hotplug support. The ether layer can rely upon this capability instead of a special flag.
Signed-off-by Gaetan Rivet <[email protected]>Please update the release notes in API section
and remove the deprecation notice.
Thanks
Sure.
I missed a BONDED_SLAVE issue as well, and can divide the 1/3 patch in two (first the ether changes, second the flag removal).
Will send a v2 shortly.
Signature · 2 lines
Gaëtan Rivet 6WIND
PATCH 2/3 doc: follow detachable flag disappearance
In reply to Gaetan RivetUpdate documentation to new API.
--- doc/guides/prog_guide/port_hotplug_framework.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
doc/guides/prog_guide/port_hotplug_framework.rst +2 -6
@@ -101,10 +101,6 @@ Limitations * The framework can only be enabled with Linux. BSD is not supported. -* To detach a port, the port should be backed by a device that igb_uio - or VFIO manages. - * Not all PMDs support detaching feature. - To know whether a PMD can support detaching, search for the - "RTE_ETH_DEV_DETACHABLE" flag in rte_eth_dev::data::dev_flags. If the flag is - defined in the PMD, detaching is supported. + The underlying bus must support hot-unplug. If not supported, + the function ``rte_eth_dev_detach()`` will return negative ENOTSUP.
Signature · 1 line
2.1.4
Re: [PATCH v1 2/3] doc: follow detachable flag disappearance
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Tuesday, October 24, 2017 9:59 AM
To: [email protected]
Cc: Gaetan Rivet <[email protected]>
Subject: [dpdk-dev] [PATCH v1 2/3] doc: follow detachable flag disappearance
Quoted 3 lines
Update documentation to new API.
Signed-off-by Gaetan Rivet <[email protected]>
Re: [PATCH v1 2/3] doc: follow detachable flag disappearance
In reply to Gaetan RivetQuoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Tuesday, October 24, 2017 9:59 AM
To: [email protected]
Cc: Gaetan Rivet <[email protected]>
Subject: [dpdk-dev] [PATCH v1 2/3] doc: follow detachable flag disappearance
Quoted 3 lines
Update documentation to new API.
Signed-off-by Gaetan Rivet <[email protected]>
PATCH 3/3 pci: propagate PMD removal error value for unplug
In reply to Gaetan RivetIf a PCI device detach removal fails, returns the actual removal operator error value.
Use this value within pci->unplug, as it may help applications solve an issue with the feature or more accurately warn their users.
--- lib/librte_eal/common/eal_common_pci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
lib/librte_eal/common/eal_common_pci.c +10 -4
@@ -263,6 +263,7 @@ rte_pci_detach_dev(struct rte_pci_device *dev) {struct rte_pci_addr *loc;struct rte_pci_driver *dr; +int ret =0 ;if (dev ==NULL )return -EINVAL ;
@@ -277,8 +278,11 @@ rte_pci_detach_dev(struct rte_pci_device *dev)RTE_LOG (DEBUG ,EAL ," remove driver: %x:%x %s\n" , dev->id.vendor_id, dev->id.device_id, dr->driver.name); -if (dr->remove && (dr->remove (dev) <0 )) -return -1 ;/* negative value is an error */ +if (dr->remove) { + ret = dr->remove (dev); +if (ret <0 ) +return ret; + }/* clear driver structure */ dev->driver =NULL ;
@@ -551,8 +555,10 @@ pci_unplug(struct rte_device *dev) pdev =RTE_DEV_TO_PCI (dev); ret =rte_pci_detach_dev (pdev); -rte_pci_remove_device (pdev); -free (pdev); +if (ret ==0 ) { +rte_pci_remove_device (pdev); +free (pdev); + }return ret; }
Signature · 1 line
2.1.4
v2 cover Remove RTE_ETH_DEV_DETACHABLE
In reply to Gaetan RivetThis flag was deprecated in the previous release, and this is its removal.
We are going from an explicit support of device detach, to an implicit one, with specific checks in place for PMDs not supporting the feature.
Attempting to Cc all relevant maintainers:
Sorry for any undue ML traffic going your way if you are not interested in this series.
I'd like to highlight Alejandro Lucero for the NFP PMD, as the patch is somewhat more involved for this PMD and I don't have the hardware available to validate the change.
v2:
+ Split ether patch:
First remove the use of the flag, then remove the flag
+ Restore RTE_ETH_DEV_BONDED_SLAVE check, previously hastily removed along the DETACHABLE one.
+ Added release note, removed deprecation notice
Gaetan Rivet (6):
ethdev: do not rely on detachable flag in detach
ethdev: remove detachable device flag
pci: propagate PMD removal error value for unplug
doc: follow detachable flag disappearance
doc: update detachable flag deprecation notice
doc: note ether API change for detachable flag
doc/guides/prog_guide/port_hotplug_framework.rst | 8 ++------ doc/guides/rel_notes/deprecation.rst | 8 -------- doc/guides/rel_notes/release_17_11.rst | 6 ++++++ drivers/net/af_packet/rte_eth_af_packet.c | 1 - drivers/net/ark/ark_ethdev.c | 1 - drivers/net/avp/avp_ethdev.c | 2 -- drivers/net/bnxt/bnxt_ethdev.c | 1 - drivers/net/bonding/rte_eth_bond_pmd.c | 3 +-- drivers/net/e1000/em_ethdev.c | 1 - drivers/net/e1000/igb_ethdev.c | 2 -- drivers/net/fm10k/fm10k_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev_vf.c | 1 - drivers/net/ixgbe/ixgbe_ethdev.c | 2 -- drivers/net/kni/rte_eth_kni.c | 2 -- drivers/net/liquidio/lio_ethdev.c | 1 - drivers/net/mlx4/mlx4.c | 1 - drivers/net/mlx5/mlx5.c | 1 - drivers/net/nfp/nfp_net.c | 19 ++++++++++++++--- drivers/net/null/rte_eth_null.c | 2 -- drivers/net/pcap/rte_eth_pcap.c | 1 - drivers/net/ring/rte_eth_ring.c | 1 - drivers/net/sfc/sfc_ethdev.c | 2 -- drivers/net/softnic/rte_eth_softnic.c | 1 - drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/vhost/rte_eth_vhost.c | 3 +-- drivers/net/virtio/virtio_ethdev.c | 1 - drivers/net/virtio/virtio_user_ethdev.c | 1 - drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 - lib/librte_eal/common/eal_common_pci.c | 14 +++++++++---- lib/librte_ether/rte_ethdev.c | 26 ++++++++---------------- lib/librte_ether/rte_ethdev.h | 2 -- 32 files changed, 46 insertions(+), 73 deletions(-)
Signature · 1 line
2.1.4
PATCH v2 1/6 ethdev: do not rely on detachable flag in detach
This flag is deprecated and should not be used to check for the device ability to be detached.
The rte_dev library call will fail with the relevant error code if detaching this port is not possible.
--- lib/librte_ether/rte_ethdev.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
lib/librte_ether/rte_ethdev.c +9 -17
@@ -356,21 +356,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)return -ENODEV ; } -static int -rte_eth_dev_is_detachable (uint16_t port_id) -{ -uint32_t dev_flags; - -RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -EINVAL ); - - dev_flags = rte_eth_devices[port_id].data->dev_flags; -if ((dev_flags &RTE_ETH_DEV_DETACHABLE ) && - (!(dev_flags &RTE_ETH_DEV_BONDED_SLAVE ))) -return 0 ; -else -return 1 ; -} -/* attach the new device, then store port_id of the device */ int rte_eth_dev_attach (const char *devargs,uint16_t *port_id)
@@ -421,16 +406,23 @@ rte_eth_dev_attach(const char *devargs, uint16_t *port_id)int rte_eth_dev_detach (uint16_t port_id,char *name) { +uint32_t dev_flags;int ret =-1 ; +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -EINVAL ); +if (name ==NULL ) { ret = -EINVAL ; goto err; } -/* FIXME: move this to eal, once device flags are relocated there */ -if (rte_eth_dev_is_detachable (port_id)) + dev_flags = rte_eth_devices[port_id].data->dev_flags; +if (dev_flags &RTE_ETH_DEV_BONDED_SLAVE ) { +RTE_LOG (ERR ,EAL ,"Port %" PRIu16" is bonded, cannot detach\n" , + port_id); + ret = -ENOTSUP ; goto err; + }snprintf (name,sizeof (rte_eth_devices[port_id].data->name),"%s" , rte_eth_devices[port_id].data->name);
Signature · 1 line
2.1.4
PATCH v2 2/6 ethdev: remove detachable device flag
In reply to Gaetan RivetThis flag is not necessary at the ether layer anymore. Buses are able to advertize their hotplug support. The ether layer can rely upon this capability instead of a special flag.
--- drivers/net/af_packet/rte_eth_af_packet.c | 1 - drivers/net/ark/ark_ethdev.c | 1 - drivers/net/avp/avp_ethdev.c | 2 -- drivers/net/bnxt/bnxt_ethdev.c | 1 - drivers/net/bonding/rte_eth_bond_pmd.c | 3 +-- drivers/net/e1000/em_ethdev.c | 1 - drivers/net/e1000/igb_ethdev.c | 2 -- drivers/net/fm10k/fm10k_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev.c | 1 - drivers/net/i40e/i40e_ethdev_vf.c | 1 - drivers/net/ixgbe/ixgbe_ethdev.c | 2 -- drivers/net/kni/rte_eth_kni.c | 2 -- drivers/net/liquidio/lio_ethdev.c | 1 - drivers/net/mlx4/mlx4.c | 1 - drivers/net/mlx5/mlx5.c | 1 - drivers/net/nfp/nfp_net.c | 19 ++++++++++++++++--- drivers/net/null/rte_eth_null.c | 2 -- drivers/net/pcap/rte_eth_pcap.c | 1 - drivers/net/ring/rte_eth_ring.c | 1 - drivers/net/sfc/sfc_ethdev.c | 2 -- drivers/net/softnic/rte_eth_softnic.c | 1 - drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/vhost/rte_eth_vhost.c | 3 +-- drivers/net/virtio/virtio_ethdev.c | 1 - drivers/net/virtio/virtio_user_ethdev.c | 1 - drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 - lib/librte_ether/rte_ethdev.h | 2 -- 27 files changed, 19 insertions(+), 38 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +0 -1
@@ -814,7 +814,6 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, (*eth_dev)->data = data; (*eth_dev)->dev_ops = &ops; - (*eth_dev)->data->dev_flags =RTE_ETH_DEV_DETACHABLE ;return 0 ;
drivers/net/ark/ark_ethdev.c +0 -1
@@ -342,7 +342,6 @@ eth_ark_dev_init(struct rte_eth_dev *dev)/* We are a single function multi-port device. */ ret =ark_config_device (dev); dev->dev_ops = &ark_eth_dev_ops; - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; dev->data->mac_addrs =rte_zmalloc ("ark" ,ETHER_ADDR_LEN ,0 );if (!dev->data->mac_addrs) {
drivers/net/avp/avp_ethdev.c +0 -2
@@ -1004,8 +1004,6 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev)rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; -/* Check current migration status */ if (avp_dev_migration_pending (eth_dev)) {PMD_DRV_LOG (ERR ,"VM live migration operation in progress\n" );
drivers/net/bnxt/bnxt_ethdev.c +0 -1
@@ -2780,7 +2780,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)RTE_LOG (INFO ,PMD ,"%s\n" , bnxt_version);rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; bp = eth_dev->data->dev_private;
drivers/net/bonding/rte_eth_bond_pmd.c +1 -2
@@ -2761,8 +2761,7 @@ 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->data->dev_flags =RTE_ETH_DEV_INTR_LSC ;rte_spinlock_init (&internals->lock);
drivers/net/e1000/em_ethdev.c +0 -1
@@ -341,7 +341,6 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) }rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->hw_addr = (void *)pci_dev->mem_resource[0 ].addr; hw->device_id = pci_dev->id.device_id;
drivers/net/e1000/igb_ethdev.c +0 -2
@@ -818,7 +818,6 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) }rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->hw_addr= (void *)pci_dev->mem_resource[0 ].addr;
@@ -1053,7 +1052,6 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev);rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id;
drivers/net/fm10k/fm10k_ethdev.c +0 -1
@@ -2909,7 +2909,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) }rte_eth_copy_pci_info (dev, pdev); - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; macvlan =FM10K_DEV_PRIVATE_TO_MACVLAN (dev->data->dev_private);memset (macvlan,0 ,sizeof (*macvlan));
drivers/net/i40e/i40e_ethdev.c +0 -1
@@ -1100,7 +1100,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) intr_handle = &pci_dev->intr_handle;rte_eth_copy_pci_info (dev, pci_dev); - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; pf->adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); pf->adapter->eth_dev = dev;
drivers/net/i40e/i40e_ethdev_vf.c +0 -1
@@ -1461,7 +1461,6 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)i40e_set_default_ptype_table (eth_dev);i40e_set_default_pctype_table (eth_dev);rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->vendor_id = pci_dev->id.vendor_id; hw->device_id = pci_dev->id.device_id;
drivers/net/ixgbe/ixgbe_ethdev.c +0 -2
@@ -1168,7 +1168,6 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) }rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ;/* Vendor and Device ID need to be set before init of shared code */ hw->device_id = pci_dev->id.device_id;
@@ -1627,7 +1626,6 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) }rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id;
drivers/net/kni/rte_eth_kni.c +0 -2
@@ -397,8 +397,6 @@ eth_kni_create(struct rte_vdev_device *vdev, eth_dev->data = data; eth_dev->dev_ops = ð_kni_ops; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ; - internals->no_request_thread = args->no_request_thread;return eth_dev;
drivers/net/liquidio/lio_ethdev.c +0 -1
@@ -2079,7 +2079,6 @@ lio_eth_dev_init(struct rte_eth_dev *eth_dev)return 0 ;rte_eth_copy_pci_info (eth_dev, pdev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ;if (pdev->mem_resource[0 ].addr) { lio_dev->hw_addr = pdev->mem_resource[0 ].addr;
drivers/net/mlx4/mlx4.c +0 -1
@@ -642,7 +642,6 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) eth_dev->intr_handle = &priv->intr_handle; priv->dev = eth_dev; eth_dev->dev_ops = &mlx4_dev_ops; - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ;/* Bring Ethernet device up. */ DEBUG ("forcing Ethernet interface up" );mlx4_dev_set_link_up (priv->dev);
drivers/net/mlx5/mlx5.c +0 -1
@@ -917,7 +917,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) eth_dev->data->mac_addrs = priv->mac; eth_dev->device = &pci_dev->device;rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; eth_dev->device->driver = &mlx5_driver.driver; priv->dev = eth_dev; eth_dev->dev_ops = &mlx5_dev_ops;
drivers/net/nfp/nfp_net.c +16 -3
@@ -2668,9 +2668,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)return 0 ;rte_eth_copy_pci_info (eth_dev, pci_dev); -/* hotplug is not possible with multiport PF */ -if (!hw->pf_multiport_enabled) - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id;
@@ -3016,6 +3013,22 @@ static int eth_nfp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev) { +struct rte_eth_dev *eth_dev; +struct nfp_net_hw *hw, *hwport0; +int port =0 ; + + eth_dev =rte_eth_dev_allocated (pci_dev->device.name); +if ((pci_dev->id.device_id ==PCI_DEVICE_ID_NFP4000_PF_NIC ) || + (pci_dev->id.device_id ==PCI_DEVICE_ID_NFP6000_PF_NIC )) { + port =get_pf_port_number (eth_dev->data->name); + hwport0 =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); + hw = &hwport0[port]; + }else { + hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); + } +/* hotplug is not possible with multiport PF */ +if (!hw->pf_multiport_enabled) +return -ENOTSUP ;return rte_eth_dev_pci_generic_remove (pci_dev,NULL ); }
drivers/net/null/rte_eth_null.c +0 -2
@@ -542,8 +542,6 @@ eth_dev_null_create(struct rte_vdev_device *dev, eth_dev->data = data; eth_dev->dev_ops = &ops; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ; -/* finally assign rx and tx ops */ if (packet_copy) { eth_dev->rx_pkt_burst = eth_null_copy_rx;
drivers/net/pcap/rte_eth_pcap.c +0 -1
@@ -840,7 +840,6 @@ pmd_init_internals(struct rte_vdev_device *vdev,*/ (*eth_dev)->data = data; (*eth_dev)->dev_ops = &ops; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ;return 0 ; }
drivers/net/ring/rte_eth_ring.c +0 -1
@@ -358,7 +358,6 @@ do_eth_dev_ring_create(const char *name, eth_dev->data = data; eth_dev->dev_ops = &ops; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ; data->kdrv =RTE_KDRV_NONE ; data->numa_node = numa_node;
drivers/net/sfc/sfc_ethdev.c +0 -2
@@ -1791,8 +1791,6 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)/* Copy PCI device info to the dev->data */ rte_eth_copy_pci_info (dev, pci_dev); - dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ; - rc =sfc_kvargs_parse (sa);if (rc !=0 ) goto fail_kvargs_parse;
drivers/net/softnic/rte_eth_softnic.c +0 -1
@@ -557,7 +557,6 @@ pmd_ethdev_register(struct rte_vdev_device *vdev, soft_dev->data->promiscuous =1 ; soft_dev->data->kdrv =RTE_KDRV_NONE ; soft_dev->data->numa_node = numa_node; - soft_dev->data->dev_flags =RTE_ETH_DEV_DETACHABLE ;return 0 ; }
drivers/net/tap/rte_eth_tap.c +1 -1
@@ -1268,7 +1268,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,/* Setup some default values */ rte_memcpy (data, dev->data,sizeof (*data)); data->dev_private = pmd; - data->dev_flags =RTE_ETH_DEV_DETACHABLE |RTE_ETH_DEV_INTR_LSC ; + data->dev_flags =RTE_ETH_DEV_INTR_LSC ; data->numa_node = numa_node; data->dev_link = pmd_link;
drivers/net/vhost/rte_eth_vhost.c +1 -2
@@ -1086,8 +1086,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name, internal->max_queues = queues; data->dev_link = pmd_link; data->mac_addrs = eth_addr; - data->dev_flags = -RTE_ETH_DEV_DETACHABLE |RTE_ETH_DEV_INTR_LSC ; + data->dev_flags =RTE_ETH_DEV_INTR_LSC ; eth_dev->dev_ops = &ops;
drivers/net/virtio/virtio_ethdev.c +0 -1
@@ -1384,7 +1384,6 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)rte_eth_copy_pci_info (eth_dev, pci_dev); } - eth_dev->data->dev_flags =RTE_ETH_DEV_DETACHABLE ;/* If host does not support both status and MSI-X then disable LSC */ if (vtpci_with_feature (hw,VIRTIO_NET_F_STATUS ) && hw->use_msix) eth_dev->data->dev_flags |=RTE_ETH_DEV_INTR_LSC ;
drivers/net/virtio/virtio_user_ethdev.c +0 -1
@@ -372,7 +372,6 @@ virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev) hw->use_simple_rx =0 ; hw->use_simple_tx =0 ; hw->virtio_user_dev = dev; - data->dev_flags =RTE_ETH_DEV_DETACHABLE ;return eth_dev; }
drivers/net/vmxnet3/vmxnet3_ethdev.c +0 -1
@@ -309,7 +309,6 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)return 0 ;rte_eth_copy_pci_info (eth_dev, pci_dev); - eth_dev->data->dev_flags |=RTE_ETH_DEV_DETACHABLE ;/* Vendor and Device ID need to be set before init of shared code */ hw->device_id = pci_dev->id.device_id;
lib/librte_ether/rte_ethdev.h +0 -2
@@ -1798,8 +1798,6 @@ struct rte_eth_dev_data {/**< VLAN filter configuration. */ }; -/** Device supports hotplug detach */ -#define RTE_ETH_DEV_DETACHABLE 0x0001/** Device supports link state interrupt */ #define RTE_ETH_DEV_INTR_LSC 0x0002/** Device is a bonded slave */
Signature · 1 line
2.1.4
PATCH v2 3/6 pci: propagate PMD removal error value for unplug
In reply to Gaetan RivetIf a PCI device detach removal fails, returns the actual removal operator error value.
Use this value within pci->unplug, as it may help applications solve an issue with the feature or more accurately warn their users.
--- lib/librte_eal/common/eal_common_pci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
lib/librte_eal/common/eal_common_pci.c +10 -4
@@ -263,6 +263,7 @@ rte_pci_detach_dev(struct rte_pci_device *dev) {struct rte_pci_addr *loc;struct rte_pci_driver *dr; +int ret =0 ;if (dev ==NULL )return -EINVAL ;
@@ -277,8 +278,11 @@ rte_pci_detach_dev(struct rte_pci_device *dev)RTE_LOG (DEBUG ,EAL ," remove driver: %x:%x %s\n" , dev->id.vendor_id, dev->id.device_id, dr->driver.name); -if (dr->remove && (dr->remove (dev) <0 )) -return -1 ;/* negative value is an error */ +if (dr->remove) { + ret = dr->remove (dev); +if (ret <0 ) +return ret; + }/* clear driver structure */ dev->driver =NULL ;
@@ -551,8 +555,10 @@ pci_unplug(struct rte_device *dev) pdev =RTE_DEV_TO_PCI (dev); ret =rte_pci_detach_dev (pdev); -rte_pci_remove_device (pdev); -free (pdev); +if (ret ==0 ) { +rte_pci_remove_device (pdev); +free (pdev); + }return ret; }
Signature · 1 line
2.1.4
PATCH v2 4/6 doc: follow detachable flag disappearance
In reply to Gaetan RivetUpdate documentation to new API.
--- doc/guides/prog_guide/port_hotplug_framework.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
doc/guides/prog_guide/port_hotplug_framework.rst +2 -6
@@ -101,10 +101,6 @@ Limitations * The framework can only be enabled with Linux. BSD is not supported. -* To detach a port, the port should be backed by a device that igb_uio - or VFIO manages. - * Not all PMDs support detaching feature. - To know whether a PMD can support detaching, search for the - "RTE_ETH_DEV_DETACHABLE" flag in rte_eth_dev::data::dev_flags. If the flag is - defined in the PMD, detaching is supported. + The underlying bus must support hot-unplug. If not supported, + the function ``rte_eth_dev_detach()`` will return negative ENOTSUP.
Signature · 1 line
2.1.4
Re: [PATCH v2 4/6] doc: follow detachable flag disappearance
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Tuesday, October 24, 2017 11:36 AM
To: [email protected]
Cc: Gaetan Rivet <[email protected]>
Subject: [dpdk-dev] [PATCH v2 4/6] doc: follow detachable flag disappearance
Quoted 3 lines
Update documentation to new API.
Signed-off-by Gaetan Rivet <[email protected]>
PATCH v2 5/6 doc: update detachable flag deprecation notice
In reply to Gaetan RivetRemove the deprecation notice as the flag has been removed.
--- doc/guides/rel_notes/deprecation.rst | 8 -------- 1 file changed, 8 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -8
@@ -56,14 +56,6 @@ Deprecation Notices Target release for removal of the legacy API will be defined once most PMDs have switched to rte_flow. -* ethdev: The device flag advertizing hotplug capability - ``RTE_ETH_DEV_DETACHABLE`` is not needed anymore and will be removed in - v17.11. - This capability is verified upon calling the relevant hotplug functions in EAL - by checking that the ``unplug`` ops is set in the bus. This verification is - done by the EAL and not by the ``ethdev`` layer anymore. Users relying on this - flag being present only have to remove their checks to follow the change. - * ethdev: new parameters - ``rte_security_capabilities`` and ``rte_security_ops`` will be added to ``rte_eth_dev_info`` and ``rte_eth_dev`` respectively to support security operations like
Signature · 1 line
2.1.4
Re: [PATCH v2 5/6] doc: update detachable flag deprecation notice
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Tuesday, October 24, 2017 11:36 AM
To: [email protected]
Cc: Gaetan Rivet <[email protected]>
Subject: [dpdk-dev] [PATCH v2 5/6] doc: update detachable flag deprecation notice
Quoted 3 lines
Remove the deprecation notice as the flag has been removed.
Signed-off-by Gaetan Rivet <[email protected]>
PATCH v2 6/6 doc: note ether API change for detachable flag
In reply to Gaetan RivetAdd the ether library evolution to the release notes
--- doc/guides/rel_notes/release_17_11.rst | 6 ++++++ 1 file changed, 6 insertions(+)
doc/guides/rel_notes/release_17_11.rst +6 -0
@@ -246,6 +246,12 @@ API Changes The size of internal device name is increased to 64 characters to allow for storing longer bus specific name. +* **Ethdev flag RTE_ETH_DEV_DETACHABLE was removed** + + This flag is not necessary anymore, with the new hotplug implementation. + It is now removed from the ether library. Its semantic is expressed at the bus + and PMD level. + * **Service cores API updated for usability** The service cores API has been changed, removing pointers from the API
Signature · 1 line
2.1.4
Re: [PATCH v2 6/6] doc: note ether API change for detachable flag
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Tuesday, October 24, 2017 11:36 AM
To: [email protected]
Cc: Gaetan Rivet <[email protected]>
Subject: [dpdk-dev] [PATCH v2 6/6] doc: note ether API change for detachable flag
Quoted 3 lines
Add the ether library evolution to the release notes
Signed-off-by Gaetan Rivet <[email protected]>
Re: [PATCH v2 6/6] doc: note ether API change for detachable flag
In reply to Gaetan RivetQuoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Tuesday, October 24, 2017 11:36 AM
To: [email protected]
Cc: Gaetan Rivet <[email protected]>
Subject: [dpdk-dev] [PATCH v2 6/6] doc: note ether API change for detachable flag
Quoted 3 lines
Add the ether library evolution to the release notes
Signed-off-by Gaetan Rivet <[email protected]>
24/10/2017 12:35, Gaetan Rivet:
Quoted 7 lines
Gaetan Rivet (6):
ethdev: do not rely on detachable flag in detach
ethdev: remove detachable device flag
pci: propagate PMD removal error value for unplug
doc: follow detachable flag disappearance
doc: update detachable flag deprecation notice
doc: note ether API change for detachable flag
All the doc patches can be squashed in the patch 2.
Please Ferruh, make it part of RC2 in next-net when the nfp part is confirmed.
Thanks
Quoted 10 lines · Thomas Monjalon
24/10/2017 12:35, Gaetan Rivet:
Quoted 7 lines
Gaetan Rivet (6):
ethdev: do not rely on detachable flag in detach
ethdev: remove detachable device flag
pci: propagate PMD removal error value for unplug
doc: follow detachable flag disappearance
doc: update detachable flag deprecation notice
doc: note ether API change for detachable flagAcked-by Thomas Monjalon <[email protected]>
Series applied to dpdk-next-net/master, thanks.
(doc patches squashed into patch 2/6)
Hi guys,
i have been on PTO since the 19th of October.
I will test this patch asap, but I'm aware this has already been accepted.
Quoted 16 lines · Ferruh Yigit
Quoted 10 lines · Thomas Monjalon
24/10/2017 12:35, Gaetan Rivet:
Quoted 7 lines
Gaetan Rivet (6):
ethdev: do not rely on detachable flag in detach
ethdev: remove detachable device flag
pci: propagate PMD removal error value for unplug
doc: follow detachable flag disappearance
doc: update detachable flag deprecation notice
doc: note ether API change for detachable flagAcked-by Thomas Monjalon <[email protected]>Series applied to dpdk-next-net/master, thanks.
(doc patches squashed into patch 2/6)
I'm afraid the patch introduced a problem for the NFP PMD.
I have submitted a patch fixing it: "net/nfp: avoid unplug if multiport"
Thanks
Quoted 27 lines · Alejandro Lucero
Hi guys,
i have been on PTO since the 19th of October.
I will test this patch asap, but I'm aware this has already been accepted.
Quoted 16 lines · Ferruh Yigit
Quoted 10 lines · Thomas Monjalon
24/10/2017 12:35, Gaetan Rivet:
Quoted 7 lines
Gaetan Rivet (6):
ethdev: do not rely on detachable flag in detach
ethdev: remove detachable device flag
pci: propagate PMD removal error value for unplug
doc: follow detachable flag disappearance
doc: update detachable flag deprecation notice
doc: note ether API change for detachable flagAcked-by Thomas Monjalon <[email protected]>Series applied to dpdk-next-net/master, thanks.
(doc patches squashed into patch 2/6)
Quoted 3 lines · Alejandro Lucero
I'm afraid the patch introduced a problem for the NFP PMD.
I have submitted a patch fixing it: "net/nfp: avoid unplug if multiport"
Hi Alejandro,
Sorry for this short notice, and thank you for the fix.
Quoted 34 lines
Thanks
On Mon, Oct 30, 2017 at 9:45 AM, Alejandro Lucero <[email protected] <mailto:[email protected]>> wrote:
Hi guys,
i have been on PTO since the 19th of October.
I will test this patch asap, but I'm aware this has already been accepted.
On Wed, Oct 25, 2017 at 6:37 PM, Ferruh Yigit <[email protected] <mailto:[email protected]>> wrote:
On 10/24/2017 5:35 AM, Thomas Monjalon wrote:
> 24/10/2017 12:35, Gaetan Rivet:
>> Gaetan Rivet (6):
>> ethdev: do not rely on detachable flag in detach >> ethdev: remove detachable device flag >> pci: propagate PMD removal error value for unplug >> doc: follow detachable flag disappearance >> doc: update detachable flag deprecation notice >> doc: note ether API change for detachable flag> Acked-by: Thomas Monjalon <[email protected] <mailto:[email protected]>>
Series applied to dpdk-next-net/master, thanks.
(doc patches squashed into patch 2/6)
Quoted 1 line · Gaetan Rivet
This flag was deprecated in the previous release, and this is its removal.
This change was in wait list, but it would be much more better if not received just before rc2, but in early stages in the release, at worst before rc1.
Although patch looks good to me, getting ethdev layer update in rc2 is creating some stress.
Quoted 2 lines
We are going from an explicit support of device detach, to an implicit one, with specific checks in place for PMDs not supporting the feature.
Removing this flag implies all ethdev devices are detachable, right. That is why you need to update error value handling in pci hotplug code, and return error in nfp remove path, since there is no way to say not detachable.
Quoted 23 lines
Attempting to Cc all relevant maintainers:
Cc Ajit Khaparde <[email protected]>Cc Alejandro Lucero <[email protected]>Cc Beilei Xing <[email protected]>Cc Bruce Richardson <[email protected]>Cc Cristian Dumitrescu <[email protected]>Cc Declan Doherty <[email protected]>Cc Ferruh Yigit <[email protected]>Cc Jing Chen <[email protected]>Cc John Miller <[email protected]>Cc John W. Linville <[email protected]>Cc Konstantin Ananyev <[email protected]>Cc Matt Peters <[email protected]>Cc Nelio Laranjeiro <[email protected]>Cc Pascal Mazon <[email protected]>Cc Shrikrishna Khare <[email protected]>Cc Srisivasubramanian Srinivasan <[email protected]>Cc Tetsuya Mukawa <[email protected]>Cc Wenzhuo Lu <[email protected]>Cc Yongseok Koh <[email protected]>
Quoted 6 lines
Sorry for any undue ML traffic going your way if you are not interested in this series.
I'd like to highlight Alejandro Lucero for the NFP PMD, as the patch is somewhat more involved for this PMD and I don't have the hardware available to validate the change.
Let's give one more day to Alejandro to comment on NFP update.
And others to comment on overall, if there is no objection include this into rc2.
Quoted 18 lines
v2:
+ Split ether patch:
First remove the use of the flag, then remove the flag+ Restore
RTE_ETH_DEV_BONDED_SLAVEcheck, previously hastily removed along the DETACHABLE one.+ Added release note, removed deprecation notice
Gaetan Rivet (6):
ethdev: do not rely on detachable flag in detach
ethdev: remove detachable device flag
pci: propagate PMD removal error value for unplug
doc: follow detachable flag disappearance
doc: update detachable flag deprecation notice
doc: note ether API change for detachable flag
<...>
Quoted 42 lines · Ferruh Yigit
Quoted 1 line · Gaetan Rivet
This flag was deprecated in the previous release, and this is its removal.
This change was in wait list, but it would be much more better if not received just before rc2, but in early stages in the release, at worst before rc1.
Although patch looks good to me, getting ethdev layer update in rc2 is creating some stress.
Quoted 2 lines
We are going from an explicit support of device detach, to an implicit one, with specific checks in place for PMDs not supporting the feature.
Removing this flag implies all ethdev devices are detachable, right. That is why you need to update error value handling in pci hotplug code, and return error in nfp remove path, since there is no way to say not detachable.
Quoted 26 lines
Attempting to Cc all relevant maintainers:
Cc Ajit Khaparde <[email protected]>Cc Alejandro Lucero <[email protected]>Cc Beilei Xing <[email protected]>Cc Bruce Richardson <[email protected]>Cc Cristian Dumitrescu <[email protected]>Cc Declan Doherty <[email protected]>Cc Ferruh Yigit <[email protected]>Cc Jing Chen <[email protected]>Cc John Miller <[email protected]>Cc John W. Linville <[email protected]>Cc Konstantin Ananyev <[email protected]>Cc Matt Peters <[email protected]>Cc Nelio Laranjeiro <[email protected]>Cc Pascal Mazon <[email protected]>Cc Shrikrishna Khare <[email protected]>Cc Srisivasubramanian Srinivasan <[email protected]>Cc Tetsuya Mukawa <[email protected]>Cc Wenzhuo Lu <[email protected]>Cc Yongseok Koh <[email protected]>Sorry for any undue ML traffic going your way if you are not interested in this series.
Quoted 7 lines
Quoted 3 lines
I'd like to highlight Alejandro Lucero for the NFP PMD, as the patch is somewhat more involved for this PMD and I don't have the hardware available to validate the change.
Let's give one more day to Alejandro to comment on NFP update.
And others to comment on overall, if there is no objection include this into rc2.
btw, not directly related to this patch, but related to the hotplug, testpmd crashes after detaching a port and start forwarding, anyone have bandwidth to look at this?
Quoted 22 lines
Quoted 19 lines
v2:
+ Split ether patch:
First remove the use of the flag, then remove the flag+ Restore
RTE_ETH_DEV_BONDED_SLAVEcheck, previously hastily removed along the DETACHABLE one.+ Added release note, removed deprecation notice
Gaetan Rivet (6):
ethdev: do not rely on detachable flag in detach
ethdev: remove detachable device flag
pci: propagate PMD removal error value for unplug
doc: follow detachable flag disappearance
doc: update detachable flag deprecation notice
doc: note ether API change for detachable flag<...>