From patchwork Thu Nov 10 13:51:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 16992 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id AFEF96A95; Thu, 10 Nov 2016 14:51:51 +0100 (CET) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 0FCC82C74 for ; Thu, 10 Nov 2016 14:51:38 +0100 (CET) Received: by mail-wm0-f48.google.com with SMTP id f82so32810149wmf.1 for ; Thu, 10 Nov 2016 05:51:38 -0800 (PST) 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=MwuyXVNg9EbiEzR996laq6lBmvB6NWGM+qa303tZlgs=; b=hanO+2+lVrYg3WFeZHjt3UwITy1auZKTcrYoewgvnRQgMDjio88o3gt3iEVGgBOTr3 oo09ggy5C1vKncqpllu0tY0/ZbqeQHKFExgaggMtvxztyOB0VIOp0Wzlnp3lP0DYpHef 0IYuesHEMBZZxEGeLrW0qtiqOfGbCN6I3gb3C2y9ax7NMjBDb462MmfVqLXOkmYdLHh9 yfHReuNnvOBN9I6NJjL+S6LggvaizXmfLLiUFwWDYvg9TxTsCNGHctVh8AY3QZC0ApG1 PkG1QzlZJ2S2WbMpRJcvnHMD3gvu6cBcYY69Y4q/De+eA58FWGWwUweHfSUrkYW6QW77 xgBw== 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=MwuyXVNg9EbiEzR996laq6lBmvB6NWGM+qa303tZlgs=; b=Jxgn7+voabb/W1tuUHjG3IF573W5/3ArCgzxrocfiJGaMbTOdFwUbxpadxDd5HZwze z1FAYlNmRrtqO8O0r5w8WKLA3dKJqhn1HLIZw4ogBkuX1KcOebDGBh5H7i9dAaZboBC7 Cq5wuy4UCuEzcRPTVi+e2Pc5pEmQDofoOSvDGZ3k8TdMFjQKriGKT+3IYsTVEi8mLCob +c0Iowa/pehYGOZILMrGZAeN2yRyPW6vx2rpljvv7HxiNpXYL1QSc2AM3w9nFW7rqjqg LeHjKTLin2vXV+E6vfWdT6bRpldfkLahSGz0NlMu0gvo1dgeVoD4PHHOCIaWvTWq/3a1 UUDg== X-Gm-Message-State: ABUngvcBjC6Y6SKP9UdKxpoPJKqW7EIXuv4fe9U4A+JGMNpiuQScDXYCUsRbI9uJQnpF77PA X-Received: by 10.194.122.65 with SMTP id lq1mr4482575wjb.12.1478785897697; Thu, 10 Nov 2016 05:51:37 -0800 (PST) Received: from gloops.dev.6wind.com (89.156.119.78.rev.sfr.net. [78.119.156.89]) by smtp.gmail.com with ESMTPSA id i132sm13067312wmf.14.2016.11.10.05.51.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 05:51:37 -0800 (PST) From: David Marchand To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, linville@tuxdriver.com, declan.doherty@intel.com, zlu@ezchip.com, lsun@ezchip.com, alejandro.lucero@netronome.com, mtetsuyah@gmail.com, nicolas.pernas.maradei@emutex.com, ferruh.yigit@intel.com, harish.patil@qlogic.com, rasesh.mody@qlogic.com, sony.chacko@qlogic.com, bruce.richardson@intel.com, huawei.xie@intel.com, yuanhan.liu@linux.intel.com, jianfeng.tan@intel.com Date: Thu, 10 Nov 2016 14:51:24 +0100 Message-Id: <1478785884-29273-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478785884-29273-1-git-send-email-david.marchand@6wind.com> References: <1478785884-29273-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH 2/2] net: align ethdev and eal driver names 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some virtual pmds report a different name than the vdev driver name registered in eal. While it does not hurt, let's try to be consistent. Signed-off-by: David Marchand --- drivers/net/af_packet/rte_eth_af_packet.c | 4 +++- drivers/net/bonding/rte_eth_bond_api.c | 7 +++---- drivers/net/bonding/rte_eth_bond_pmd.c | 4 ++-- drivers/net/bonding/rte_eth_bond_private.h | 2 +- drivers/net/mpipe/mpipe_tilegx.c | 21 ++++++++++++++++----- drivers/net/null/rte_eth_null.c | 4 +++- drivers/net/pcap/rte_eth_pcap.c | 4 +++- drivers/net/ring/rte_eth_ring.c | 4 +++- drivers/net/vhost/rte_eth_vhost.c | 4 +++- drivers/net/virtio/virtio_ethdev.c | 6 +++++- drivers/net/virtio/virtio_ethdev.h | 2 ++ drivers/net/virtio/virtio_user_ethdev.c | 2 +- drivers/net/xenvirt/rte_eth_xenvirt.c | 3 ++- 13 files changed, 47 insertions(+), 20 deletions(-) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index a66a657..8cae165 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -437,6 +437,8 @@ open_packet_iface(const char *key __rte_unused, return 0; } +static struct rte_vdev_driver pmd_af_packet_drv; + static int rte_pmd_init_internals(const char *name, const int sockfd, @@ -690,7 +692,7 @@ rte_pmd_init_internals(const char *name, (*eth_dev)->dev_ops = &ops; (*eth_dev)->driver = NULL; (*eth_dev)->data->dev_flags = RTE_ETH_DEV_DETACHABLE; - (*eth_dev)->data->drv_name = "AF_PACKET PMD"; + (*eth_dev)->data->drv_name = pmd_af_packet_drv.driver.name; (*eth_dev)->data->kdrv = RTE_KDRV_NONE; (*eth_dev)->data->numa_node = numa_node; diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 2a3893a..a4e86ae 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "rte_eth_bond.h" #include "rte_eth_bond_private.h" @@ -44,8 +45,6 @@ #define DEFAULT_POLLING_INTERVAL_10_MS (10) -const char pmd_bond_driver_name[] = "rte_bond_pmd"; - int check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev) { @@ -54,7 +53,7 @@ check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev) return -1; /* return 0 if driver name matches */ - return eth_dev->data->drv_name != pmd_bond_driver_name; + return eth_dev->data->drv_name != pmd_bond_drv.driver.name; } int @@ -221,7 +220,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) RTE_ETH_DEV_DETACHABLE; eth_dev->driver = NULL; eth_dev->data->kdrv = RTE_KDRV_NONE; - eth_dev->data->drv_name = pmd_bond_driver_name; + eth_dev->data->drv_name = pmd_bond_drv.driver.name; eth_dev->data->numa_node = socket_id; rte_spinlock_init(&internals->lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index a80b6fa..9bfd9f6 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2566,12 +2566,12 @@ bond_ethdev_configure(struct rte_eth_dev *dev) return 0; } -static struct rte_vdev_driver bond_drv = { +struct rte_vdev_driver pmd_bond_drv = { .probe = bond_probe, .remove = bond_remove, }; -RTE_PMD_REGISTER_VDEV(net_bonding, bond_drv); +RTE_PMD_REGISTER_VDEV(net_bonding, pmd_bond_drv); RTE_PMD_REGISTER_ALIAS(net_bonding, eth_bond); RTE_PMD_REGISTER_PARAM_STRING(net_bonding, diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index d95d440..5a411e2 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -63,7 +63,7 @@ extern const char *pmd_bond_init_valid_arguments[]; -extern const char pmd_bond_driver_name[]; +extern struct rte_vdev_driver pmd_bond_drv; /** Port Queue Mapping Structure */ struct bond_rx_queue { diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index fbbbb00..f0ba91e 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -87,7 +87,6 @@ struct mpipe_local { static __thread struct mpipe_local mpipe_local; static struct mpipe_context mpipe_contexts[GXIO_MPIPE_INSTANCE_MAX]; static int mpipe_instances; -static const char *drivername = "MPIPE PMD"; /* Per queue statistics. */ struct mpipe_queue_stats { @@ -1549,7 +1548,7 @@ mpipe_link_mac(const char *ifname, uint8_t *mac) } static int -rte_pmd_mpipe_probe(const char *ifname, +rte_pmd_mpipe_probe_common(struct rte_vdev_driver *drv, const char *ifname, const char *params __rte_unused) { gxio_mpipe_context_t *context; @@ -1606,7 +1605,7 @@ rte_pmd_mpipe_probe(const char *ifname, eth_dev->data->dev_flags = 0; eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->driver = NULL; - eth_dev->data->drv_name = drivername; + eth_dev->data->drv_name = drv->driver.name; eth_dev->data->numa_node = instance; eth_dev->dev_ops = &mpipe_dev_ops; @@ -1623,12 +1622,24 @@ rte_pmd_mpipe_probe(const char *ifname, return 0; } +static int +rte_pmd_mpipe_xgbe_probe(const char *ifname, const char *params __rte_unused) +{ + return rte_pmd_mpipe_probe_common(&pmd_mpipe_xgbe_drv, ifname, params); +} + +static int +rte_pmd_mpipe_gbe_probe(const char *ifname, const char *params __rte_unused) +{ + return rte_pmd_mpipe_probe_common(&pmd_mpipe_gbe_drv, ifname, params); +} + static struct rte_vdev_driver pmd_mpipe_xgbe_drv = { - .probe = rte_pmd_mpipe_probe, + .probe = rte_pmd_mpipe_xgbe_probe, }; static struct rte_vdev_driver pmd_mpipe_gbe_drv = { - .probe = rte_pmd_mpipe_probe, + .probe = rte_pmd_mpipe_gbe_probe, }; RTE_PMD_REGISTER_VDEV(net_mpipe_xgbe, pmd_mpipe_xgbe_drv); diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 09d77fd..e4fd68f 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -478,6 +478,8 @@ static const struct eth_dev_ops ops = { .rss_hash_conf_get = eth_rss_hash_conf_get }; +static struct rte_vdev_driver pmd_null_drv; + int eth_dev_null_create(const char *name, const unsigned numa_node, @@ -553,7 +555,7 @@ eth_dev_null_create(const char *name, eth_dev->driver = NULL; data->dev_flags = RTE_ETH_DEV_DETACHABLE; data->kdrv = RTE_KDRV_NONE; - data->drv_name = "Null PMD"; + data->drv_name = pmd_null_drv.driver.name; data->numa_node = numa_node; /* finally assign rx and tx ops */ diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 8b4fba7..58c326a 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -788,6 +788,8 @@ open_tx_iface(const char *key, const char *value, void *extra_args) return 0; } +static struct rte_vdev_driver pmd_pcap_drv; + static int pmd_init_internals(const char *name, const unsigned int nb_rx_queues, const unsigned int nb_tx_queues, @@ -840,7 +842,7 @@ pmd_init_internals(const char *name, const unsigned int nb_rx_queues, (*eth_dev)->driver = NULL; data->dev_flags = RTE_ETH_DEV_DETACHABLE; data->kdrv = RTE_KDRV_NONE; - data->drv_name = "Pcap PMD"; + data->drv_name = pmd_pcap_drv.driver.name; data->numa_node = numa_node; return 0; diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 56afaf2..31034cf 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -257,6 +257,8 @@ static const struct eth_dev_ops ops = { .mac_addr_add = eth_mac_addr_add, }; +static struct rte_vdev_driver pmd_ring_drv; + static int do_eth_dev_ring_create(const char *name, struct rte_ring * const rx_queues[], const unsigned nb_rx_queues, @@ -341,7 +343,7 @@ do_eth_dev_ring_create(const char *name, eth_dev->dev_ops = &ops; data->dev_flags = RTE_ETH_DEV_DETACHABLE; data->kdrv = RTE_KDRV_NONE; - data->drv_name = "Rings PMD"; + data->drv_name = pmd_ring_drv.driver.name; data->numa_node = numa_node; TAILQ_INIT(&(eth_dev->link_intr_cbs)); diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 96bf391..059a74f 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -984,6 +984,8 @@ static const struct eth_dev_ops ops = { .xstats_get_names = vhost_dev_xstats_get_names, }; +static struct rte_vdev_driver pmd_vhost_drv; + static int eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues, const unsigned numa_node, uint64_t flags) @@ -1071,7 +1073,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues, data->dev_flags = RTE_ETH_DEV_DETACHABLE | RTE_ETH_DEV_INTR_LSC; data->kdrv = RTE_KDRV_NONE; - data->drv_name = internal->dev_name; + data->drv_name = pmd_vhost_drv.driver.name; data->numa_node = numa_node; /* finally assign rx and tx ops */ diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 741688e..dbc4ddb 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -52,6 +52,7 @@ #include #include #include +#include #include "virtio_ethdev.h" #include "virtio_pci.h" @@ -1210,7 +1211,10 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) else eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; - rte_eth_copy_pci_info(eth_dev, pci_dev); + if (pci_dev) + rte_eth_copy_pci_info(eth_dev, pci_dev); + else + eth_dev->data->drv_name = virtio_user_driver.driver.name; rx_func_get(eth_dev); diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h index 27d9a19..94b4f43 100644 --- a/drivers/net/virtio/virtio_ethdev.h +++ b/drivers/net/virtio/virtio_ethdev.h @@ -104,4 +104,6 @@ uint16_t virtio_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, int eth_virtio_dev_init(struct rte_eth_dev *eth_dev); +extern struct rte_vdev_driver virtio_user_driver; + #endif /* _VIRTIO_ETHDEV_H_ */ diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 406beea..d3b595b 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -473,7 +473,7 @@ virtio_user_pmd_remove(const char *name) return 0; } -static struct rte_vdev_driver virtio_user_driver = { +struct rte_vdev_driver virtio_user_driver = { .probe = virtio_user_pmd_probe, .remove = virtio_user_pmd_remove, }; diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c index f74d72c..8321a0b 100644 --- a/drivers/net/xenvirt/rte_eth_xenvirt.c +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c @@ -617,6 +617,7 @@ enum dev_action { DEV_ATTACH }; +static struct rte_vdev_driver pmd_xenvirt_drv; static int eth_dev_xenvirt_create(const char *name, const char *params, @@ -672,7 +673,7 @@ eth_dev_xenvirt_create(const char *name, const char *params, eth_dev->data->dev_flags = RTE_PCI_DRV_DETACHABLE; eth_dev->data->kdrv = RTE_KDRV_NONE; - eth_dev->data->drv_name = "xen virtio PMD"; + eth_dev->data->drv_name = pmd_xenvirt_drv.driver.name; eth_dev->driver = NULL; eth_dev->data->numa_node = numa_node;