ethdev: get rid of device type
authorDavid Marchand <david.marchand@6wind.com>
Tue, 20 Sep 2016 12:41:26 +0000 (18:11 +0530)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 3 Oct 2016 14:33:39 +0000 (16:33 +0200)
Now that hotplug has been moved to eal, there is no reason to keep the
device type in this layer.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
16 files changed:
app/test/virtual_pmd.c
drivers/net/af_packet/rte_eth_af_packet.c
drivers/net/bonding/rte_eth_bond_api.c
drivers/net/cxgbe/cxgbe_main.c
drivers/net/mlx4/mlx4.c
drivers/net/mlx5/mlx5.c
drivers/net/mpipe/mpipe_tilegx.c
drivers/net/null/rte_eth_null.c
drivers/net/pcap/rte_eth_pcap.c
drivers/net/ring/rte_eth_ring.c
drivers/net/vhost/rte_eth_vhost.c
drivers/net/virtio/virtio_user_ethdev.c
drivers/net/xenvirt/rte_eth_xenvirt.c
examples/ip_pipeline/init.c
lib/librte_ether/rte_ethdev.c
lib/librte_ether/rte_ethdev.h

index b4bd2f2..8a1f0d0 100644 (file)
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
                goto err;
 
        /* reserve an ethdev entry */
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+       eth_dev = rte_eth_dev_allocate(name);
        if (eth_dev == NULL)
                goto err;
 
index efc5db6..93ae2d7 100644 (file)
@@ -666,7 +666,7 @@ rte_pmd_init_internals(const char *name,
        }
 
        /* reserve an ethdev entry */
-       *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       *eth_dev = rte_eth_dev_allocate(name);
        if (*eth_dev == NULL)
                goto error;
 
index 203ebe9..8514652 100644 (file)
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
        }
 
        /* reserve an ethdev entry */
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(name);
        if (eth_dev == NULL) {
                RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
                goto err;
index ceaf5ab..922155b 100644 (file)
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
                 */
 
                /* reserve an ethdev entry */
-               pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+               pi->eth_dev = rte_eth_dev_allocate(name);
                if (!pi->eth_dev)
                        goto out_free;
 
index 18da84a..6efea24 100644 (file)
@@ -5803,7 +5803,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 
                        snprintf(name, sizeof(name), "%s port %u",
                                 ibv_get_device_name(ibv_dev), port);
-                       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+                       eth_dev = rte_eth_dev_allocate(name);
                }
                if (eth_dev == NULL) {
                        ERROR("can not allocate rte ethdev");
index 4eaabcd..f1de40a 100644 (file)
@@ -617,7 +617,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 
                        snprintf(name, sizeof(name), "%s port %u",
                                 ibv_get_device_name(ibv_dev), port);
-                       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+                       eth_dev = rte_eth_dev_allocate(name);
                }
                if (eth_dev == NULL) {
                        ERROR("can not allocate rte ethdev");
index 6fe1c55..66b43ec 100644 (file)
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
                return -ENODEV;
        }
 
-       eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(ifname);
        if (!eth_dev) {
                RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
                rte_free(priv);
index 29e5954..42ec107 100644 (file)
@@ -517,7 +517,7 @@ eth_dev_null_create(const char *name,
                goto error;
 
        /* reserve an ethdev entry */
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(name);
        if (eth_dev == NULL)
                goto error;
 
index b7a3b03..418fc52 100644 (file)
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
                goto error;
 
        /* reserve an ethdev entry */
-       *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       *eth_dev = rte_eth_dev_allocate(name);
        if (*eth_dev == NULL)
                goto error;
 
index 5d2580a..b90684c 100644 (file)
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
        }
 
        /* reserve an ethdev entry */
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(name);
        if (eth_dev == NULL) {
                rte_errno = ENOSPC;
                goto error;
index 80c3f4c..d0bffbd 100644 (file)
@@ -714,7 +714,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
                goto error;
 
        /* reserve an ethdev entry */
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(name);
        if (eth_dev == NULL)
                goto error;
 
index 8077f2e..c682d8f 100644 (file)
@@ -277,7 +277,7 @@ virtio_user_eth_dev_alloc(const char *name)
        struct virtio_hw *hw;
        struct virtio_user_dev *dev;
 
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(name);
        if (!eth_dev) {
                PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
                return NULL;
index 8cb26ce..2ffa54c 100644 (file)
@@ -654,7 +654,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
                goto err;
 
        /* reserve an ethdev entry */
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(name);
        if (eth_dev == NULL)
                goto err;
 
index cd167f6..0dbc332 100644 (file)
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
        }
 }
 
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
-       uint32_t pmd_id = p->pmd_id;
-       struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
-       if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
-               return 1;
-
-       return 0;
-}
-
 void
 app_link_up_internal(struct app_params *app, struct app_link_params *cp)
 {
        uint32_t i;
        int status;
 
-       if (app_link_is_virtual(cp)) {
-               cp->state = 1;
-               return;
-       }
-
        /* For each link, add filters for IP of current link */
        if (cp->ip != 0) {
                for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
        uint32_t i;
        int status;
 
-       if (app_link_is_virtual(cp)) {
-               cp->state = 0;
-               return;
-       }
-
        /* PMD link down */
        status = rte_eth_dev_set_link_down(cp->pmd_id);
        if (status < 0)
index 4f54952..cc2f921 100644 (file)
@@ -190,7 +190,7 @@ rte_eth_dev_find_free_port(void)
 }
 
 struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
 {
        uint8_t port_id;
        struct rte_eth_dev *eth_dev;
@@ -215,7 +215,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
        snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
        eth_dev->data->port_id = port_id;
        eth_dev->attached = DEV_ATTACHED;
-       eth_dev->dev_type = type;
        eth_dev_last_created_port = port_id;
        nb_ports++;
        return eth_dev;
@@ -247,7 +246,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
        rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
                        sizeof(ethdev_name));
 
-       eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+       eth_dev = rte_eth_dev_allocate(ethdev_name);
        if (eth_dev == NULL)
                return -ENOMEM;
 
index 5f78a9b..2b5f371 100644 (file)
@@ -1605,17 +1605,6 @@ struct rte_eth_rxtx_callback {
        void *param;
 };
 
-/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
-       RTE_ETH_DEV_UNKNOWN,    /**< unknown device type */
-       RTE_ETH_DEV_PCI,
-               /**< Physical function and Virtual function of PCI devices */
-       RTE_ETH_DEV_VIRTUAL,    /**< non hardware device */
-       RTE_ETH_DEV_MAX         /**< max value of this enum */
-};
-
 /**
  * @internal
  * The generic data structure associated with each ethernet device.
@@ -1646,7 +1635,6 @@ struct rte_eth_dev {
         */
        struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
        uint8_t attached; /**< Flag indicating the port is attached */
-       enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
 } __rte_cache_aligned;
 
 struct rte_eth_dev_sriov {
@@ -1760,8 +1748,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
  * @return
  *   - Slot in the rte_dev_devices array for a new device;
  */
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
-               enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
 
 /**
  * @internal