ethdev: remove detachable device flag
authorGaetan Rivet <gaetan.rivet@6wind.com>
Tue, 24 Oct 2017 10:35:38 +0000 (12:35 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 26 Oct 2017 00:33:01 +0000 (02:33 +0200)
This flag is not necessary at the ether layer anymore.
Buses are able to advertise their hotplug support. The ether layer can
rely upon this capability instead of a special flag.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
30 files changed:
doc/guides/prog_guide/port_hotplug_framework.rst
doc/guides/rel_notes/deprecation.rst
doc/guides/rel_notes/release_17_11.rst
drivers/net/af_packet/rte_eth_af_packet.c
drivers/net/ark/ark_ethdev.c
drivers/net/avp/avp_ethdev.c
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/bonding/rte_eth_bond_pmd.c
drivers/net/e1000/em_ethdev.c
drivers/net/e1000/igb_ethdev.c
drivers/net/fm10k/fm10k_ethdev.c
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev_vf.c
drivers/net/ixgbe/ixgbe_ethdev.c
drivers/net/kni/rte_eth_kni.c
drivers/net/liquidio/lio_ethdev.c
drivers/net/mlx4/mlx4.c
drivers/net/mlx5/mlx5.c
drivers/net/nfp/nfp_net.c
drivers/net/null/rte_eth_null.c
drivers/net/pcap/rte_eth_pcap.c
drivers/net/ring/rte_eth_ring.c
drivers/net/sfc/sfc_ethdev.c
drivers/net/softnic/rte_eth_softnic.c
drivers/net/tap/rte_eth_tap.c
drivers/net/vhost/rte_eth_vhost.c
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_user_ethdev.c
drivers/net/vmxnet3/vmxnet3_ethdev.c
lib/librte_ether/rte_ethdev.h

index ee76577..fb0efc1 100644 (file)
@@ -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.
index e4ca250..a2faa2e 100644 (file)
@@ -48,14 +48,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
index 0622d10..dafa4ba 100644 (file)
@@ -284,6 +284,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
index 46b8250..c6b86a3 100644 (file)
@@ -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;
 
index dae1f3d..1760628 100644 (file)
@@ -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) {
index b97a90c..d729b26 100644 (file)
@@ -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");
index c2d54ef..8c9926b 100644 (file)
@@ -2800,7 +2800,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;
 
index 3fbc1b1..cbc7ddd 100644 (file)
@@ -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);
 
index 6ebfa6d..a599260 100644 (file)
@@ -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;
index 003bdf0..2fd679b 100644 (file)
@@ -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;
index 7baa927..7a42906 100644 (file)
@@ -3019,7 +3019,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));
index 48db2dd..fdc150d 100644 (file)
@@ -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;
index 9f14875..bc8bbca 100644 (file)
@@ -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;
index a873153..f74ff64 100644 (file)
@@ -1174,7 +1174,6 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
                return -ENOMEM;
 
        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;
@@ -1635,7 +1634,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;
index d290c79..d68ff7a 100644 (file)
@@ -397,8 +397,6 @@ eth_kni_create(struct rte_vdev_device *vdev,
        eth_dev->data = data;
        eth_dev->dev_ops = &eth_kni_ops;
 
-       data->dev_flags = RTE_ETH_DEV_DETACHABLE;
-
        internals->no_request_thread = args->no_request_thread;
 
        return eth_dev;
index 239f6af..924eb26 100644 (file)
@@ -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;
index 9be875b..5d35a50 100644 (file)
@@ -637,7 +637,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);
index 89fdc13..e3c9b89 100644 (file)
@@ -918,7 +918,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;
index 0917b9c..b2ad20e 100644 (file)
@@ -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);
 }
 
index 47c7b14..3433c9c 100644 (file)
@@ -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;
index 1b8a74e..3205df8 100644 (file)
@@ -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;
 }
index 61473ca..d82d207 100644 (file)
@@ -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;
 
index bd09191..cd82b0d 100644 (file)
@@ -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;
index 34dceae..abb617a 100644 (file)
@@ -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;
 }
index 61c6774..64dd3b0 100644 (file)
@@ -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;
index 3534649..f98c980 100644 (file)
@@ -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;
 
index bfbd737..d4354f9 100644 (file)
@@ -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;
index 20b7292..0cfa27b 100644 (file)
@@ -376,7 +376,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;
 }
 
index 58bc4f2..6f5cadf 100644 (file)
@@ -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;
index 67ecc6a..3d9a8aa 100644 (file)
@@ -1814,8 +1814,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 */