From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 61B4E58C3 for ; Wed, 20 Apr 2016 13:44:40 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id n3so77131770wmn.0 for ; Wed, 20 Apr 2016 04:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KshFNrlwHqbCSZuHz52ElbOyMy6QFRcUyu5893kLD8M=; b=fTUVb1sqvWSXmNC+3ReSQYokVku2vf8BALDYiDlCz73ptpGhrmreslatllibIjuWgB eEZkDLu0Z3ut5LZl52V2p47dve9EeV7MERzVNIOxGuWu1RDkeeE07pCdUHxB68j13G3s NeIVsM0pJYaUA6rZRKjPr0bl867iP6GFFymmOeEi6bCY/4ojjdhvsPBGCguePmVyITNk saxTaCHzicexBv1ke5FsjUHDew2yvJ4iLgiXo5tQDbCMOwrkv1v7Roq3N3d9viviMq58 TvurhQCL2vyil3PqIPsOqUNCzxy5Si4F8E9o2tMyaB8wSFcJWRaHKANsTrKqqboVvDj6 QcUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KshFNrlwHqbCSZuHz52ElbOyMy6QFRcUyu5893kLD8M=; b=N84lWOKCNX4HLqUoSYq5aZp+k4/tt3Vxbx0L1fW8ke3AOR4Dx2Kc7HXEkWceM/CBwe ab2zCQpOIkwLDOBD98rlo9ePhabHAWaOC4MbE557wfrLbQBZmtjeGijV4HHmFNOvi9e7 4mq710WABthWYZdIERMuNwR2Hk5VYaWLE2xktDItJR+NQmq2WQXQ/pTyBB1hsdSoHnRo o84260Fu0xM13LJedTWVWeCdLWNB8yVEywI+EltrqURDMjkKOrer+p74Xgikn/XUeBId My1XckaHUllTZuTo8+6hB6QvS0HDix9FJ4ncLXooHifXmBhiLhSInDevwuDJpDWavaGg xr0g== X-Gm-Message-State: AOPr4FXDQUA+uIVrW6r0IgM6E6dfpCCXugh2pLoNKJ3M6m7kO9eKwfGCxdR/HO9/TFtOah8B X-Received: by 10.194.192.106 with SMTP id hf10mr8120017wjc.134.1461152680219; Wed, 20 Apr 2016 04:44:40 -0700 (PDT) Received: from gloops.dev.6wind.com (144.77.126.78.rev.sfr.net. [78.126.77.144]) by smtp.gmail.com with ESMTPSA id m6sm5195708wje.21.2016.04.20.04.44.39 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Apr 2016 04:44:39 -0700 (PDT) From: David Marchand To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, viktorin@rehivetech.com Date: Wed, 20 Apr 2016 13:44:17 +0200 Message-Id: <1461152657-19969-18-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461152657-19969-1-git-send-email-david.marchand@6wind.com> References: <1454076516-21591-1-git-send-email-david.marchand@6wind.com> <1461152657-19969-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH v2 17/17] ethdev: get rid of device type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 11:44:40 -0000 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 --- app/test/virtual_pmd.c | 2 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/cxgbe/cxgbe_main.c | 2 +- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mpipe/mpipe_tilegx.c | 2 +- drivers/net/null/rte_eth_null.c | 2 +- drivers/net/pcap/rte_eth_pcap.c | 2 +- drivers/net/ring/rte_eth_ring.c | 2 +- drivers/net/vhost/rte_eth_vhost.c | 2 +- drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +- examples/ip_pipeline/init.c | 22 ---------------------- lib/librte_ether/rte_ethdev.c | 5 ++--- lib/librte_ether/rte_ethdev.h | 15 +-------------- 15 files changed, 15 insertions(+), 51 deletions(-) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index b4bd2f2..8a1f0d0 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -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; diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index f17bd7e..36ac102 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -648,7 +648,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; diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index e9247b5..c72807c 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -193,7 +193,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; diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index ceaf5ab..922155b 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -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; diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 8e4b0cc..0c76e72 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5667,7 +5667,7 @@ mlx4_pci_devinit(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"); diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 1989a37..f6399fc 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -519,7 +519,7 @@ mlx5_pci_devinit(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"); diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index adcbc19..4e29931 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -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); diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 5e8e203..e6c74a6 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -514,7 +514,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; diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index c98e234..2d00d04 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -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; diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index b1783c3..b78d1cf 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -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; diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 310cbef..4e99360 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -717,7 +717,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; diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c index b9638d9..663fb14 100644 --- a/drivers/net/xenvirt/rte_eth_xenvirt.c +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c @@ -663,7 +663,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; diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 83422e8..476d372 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -604,29 +604,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++) { @@ -734,11 +717,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) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1794025..55b32da 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -185,7 +185,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; @@ -210,7 +210,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; @@ -242,7 +241,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; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 016ce33..d120522 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1600,17 +1600,6 @@ struct rte_eth_rxtx_callback { }; /** - * 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. * @@ -1640,7 +1629,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 */ }; struct rte_eth_dev_sriov { @@ -1753,8 +1741,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 -- 1.9.1