DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net: remove dead driver names
@ 2016-11-10 13:51 David Marchand
  2016-11-10 13:51 ` [dpdk-dev] [PATCH 2/2] net: align ethdev and eal " David Marchand
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: David Marchand @ 2016-11-10 13:51 UTC (permalink / raw)
  To: thomas.monjalon
  Cc: dev, linville, declan.doherty, zlu, lsun, alejandro.lucero,
	mtetsuyah, nicolas.pernas.maradei, ferruh.yigit, harish.patil,
	rasesh.mody, sony.chacko, bruce.richardson, huawei.xie,
	yuanhan.liu, jianfeng.tan

Since b1fb53a39d88 ("ethdev: remove some PCI specific handling"),
rte_eth_dev_info_get() relies on dev->data->drv_name to report the driver
name to caller.

Having the pmds set driver_info->driver_name in the pmds is useless,
since ethdev overwrites it right after.
The only thing the pmd must do is:
- for pci drivers, call rte_eth_copy_pci_info() which then sets
  data->drv_name
- for vdev drivers, manually set data->drv_name

At this stage, virtio-user does not properly report a driver name (fixed in
next commit).

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 5 +----
 drivers/net/nfp/nfp_net.c                 | 1 -
 drivers/net/null/rte_eth_null.c           | 4 +---
 drivers/net/pcap/rte_eth_pcap.c           | 4 +---
 drivers/net/qede/qede_ethdev.c            | 1 -
 drivers/net/ring/rte_eth_ring.c           | 4 +---
 drivers/net/vhost/rte_eth_vhost.c         | 3 ---
 drivers/net/virtio/virtio_ethdev.c        | 4 ----
 drivers/net/xenvirt/rte_eth_xenvirt.c     | 5 +----
 9 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index ff45068..a66a657 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -115,8 +115,6 @@ static const char *valid_arguments[] = {
 	NULL
 };
 
-static const char *drivername = "AF_PACKET PMD";
-
 static struct rte_eth_link pmd_link = {
 	.link_speed = ETH_SPEED_NUM_10G,
 	.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -280,7 +278,6 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	dev_info->driver_name = drivername;
 	dev_info->if_index = internals->if_index;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
@@ -693,7 +690,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 = drivername;
+	(*eth_dev)->data->drv_name = "AF_PACKET PMD";
 	(*eth_dev)->data->kdrv = RTE_KDRV_NONE;
 	(*eth_dev)->data->numa_node = numa_node;
 
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index c6b1587..0c342ab 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1006,7 +1006,6 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	dev_info->driver_name = dev->driver->pci_drv.driver.name;
 	dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
 	dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
 	dev_info->min_rx_bufsize = ETHER_MIN_MTU;
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 836d982..09d77fd 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -88,7 +88,6 @@ struct pmd_internals {
 
 
 static struct ether_addr eth_addr = { .addr_bytes = {0} };
-static const char *drivername = "Null PMD";
 static struct rte_eth_link pmd_link = {
 	.link_speed = ETH_SPEED_NUM_10G,
 	.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -295,7 +294,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 		return;
 
 	internals = dev->data->dev_private;
-	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)-1;
 	dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
@@ -555,7 +553,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 = drivername;
+	data->drv_name = "Null PMD";
 	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 0162f44..8b4fba7 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -119,7 +119,6 @@ static struct ether_addr eth_addr = {
 	.addr_bytes = { 0, 0, 0, 0x1, 0x2, 0x3 }
 };
 
-static const char *drivername = "Pcap PMD";
 static struct rte_eth_link pmd_link = {
 		.link_speed = ETH_SPEED_NUM_10G,
 		.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -552,7 +551,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	dev_info->driver_name = drivername;
 	dev_info->if_index = internals->if_index;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t) -1;
@@ -842,7 +840,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 = drivername;
+	data->drv_name = "Pcap PMD";
 	data->numa_node = numa_node;
 
 	return 0;
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 59129f2..a56ba90 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -662,7 +662,6 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
 		dev_info->max_vfs = 0;
 	else
 		dev_info->max_vfs = (uint16_t)NUM_OF_VFS(&qdev->edev);
-	dev_info->driver_name = qdev->drv_ver;
 	dev_info->reta_size = ECORE_RSS_IND_TABLE_SIZE;
 	dev_info->flow_type_rss_offloads = (uint64_t)QEDE_RSS_OFFLOAD_ALL;
 
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index c1767c4..56afaf2 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -75,7 +75,6 @@ struct pmd_internals {
 };
 
 
-static const char *drivername = "Rings PMD";
 static struct rte_eth_link pmd_link = {
 		.link_speed = ETH_SPEED_NUM_10G,
 		.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -173,7 +172,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 		struct rte_eth_dev_info *dev_info)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
-	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)-1;
 	dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
@@ -343,7 +341,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 = drivername;
+	data->drv_name = "Rings PMD";
 	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 766d4ef..96bf391 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -53,8 +53,6 @@
 #define ETH_VHOST_CLIENT_ARG		"client"
 #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
 
-static const char *drivername = "VHOST PMD";
-
 static const char *valid_arguments[] = {
 	ETH_VHOST_IFACE_ARG,
 	ETH_VHOST_QUEUES_ARG,
@@ -861,7 +859,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 		return;
 	}
 
-	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)-1;
 	dev_info->max_rx_queues = internal->max_queues;
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 079fd6c..741688e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1624,10 +1624,6 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	uint64_t tso_mask;
 	struct virtio_hw *hw = dev->data->dev_private;
 
-	if (dev->pci_dev)
-		dev_info->driver_name = dev->driver->pci_drv.driver.name;
-	else
-		dev_info->driver_name = "virtio_user PMD";
 	dev_info->max_rx_queues =
 		RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
 	dev_info->max_tx_queues =
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index c08a056..f74d72c 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -70,8 +70,6 @@
 /* virtio_idx is increased after new device is created.*/
 static int virtio_idx = 0;
 
-static const char *drivername = "xen virtio PMD";
-
 static struct rte_eth_link pmd_link = {
 		.link_speed = ETH_SPEED_NUM_10G,
 		.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -331,7 +329,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 	struct pmd_internals *internals = dev->data->dev_private;
 
 	RTE_SET_USED(internals);
-	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)2048;
 	dev_info->max_rx_queues = (uint16_t)1;
@@ -675,7 +672,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 = drivername;
+	eth_dev->data->drv_name = "xen virtio PMD";
 	eth_dev->driver = NULL;
 	eth_dev->data->numa_node = numa_node;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 2/2] net: align ethdev and eal driver names
  2016-11-10 13:51 [dpdk-dev] [PATCH 1/2] net: remove dead driver names David Marchand
@ 2016-11-10 13:51 ` David Marchand
  2016-11-10 18:46   ` Ferruh Yigit
  2016-11-21 16:31 ` [dpdk-dev] [PATCH 1/2] net: remove dead " Jan Blunck
  2016-11-21 18:06 ` [dpdk-dev] [PATCH v2 " David Marchand
  2 siblings, 1 reply; 7+ messages in thread
From: David Marchand @ 2016-11-10 13:51 UTC (permalink / raw)
  To: thomas.monjalon
  Cc: dev, linville, declan.doherty, zlu, lsun, alejandro.lucero,
	mtetsuyah, nicolas.pernas.maradei, ferruh.yigit, harish.patil,
	rasesh.mody, sony.chacko, bruce.richardson, huawei.xie,
	yuanhan.liu, jianfeng.tan

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 <david.marchand@6wind.com>
---
 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 <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_tcp.h>
+#include <rte_vdev.h>
 
 #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 <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
+#include <rte_vdev.h>
 
 #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;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] net: align ethdev and eal driver names
  2016-11-10 13:51 ` [dpdk-dev] [PATCH 2/2] net: align ethdev and eal " David Marchand
@ 2016-11-10 18:46   ` Ferruh Yigit
  0 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2016-11-10 18:46 UTC (permalink / raw)
  To: David Marchand, thomas.monjalon
  Cc: dev, linville, declan.doherty, zlu, lsun, alejandro.lucero,
	mtetsuyah, nicolas.pernas.maradei, harish.patil, rasesh.mody,
	sony.chacko, bruce.richardson, huawei.xie, yuanhan.liu,
	jianfeng.tan

On 11/10/2016 1:51 PM, David Marchand wrote:
> 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 <david.marchand@6wind.com>
> ---

Since you did all the work, instead of second patch what do you think
doing something like [1] (basically adding eth_dev->rte_driver link) and
when done for all vdevs, remove eth_dev->data->drv_name completely?


[1]
diff --git a/drivers/net/null/rte_eth_null.c
b/drivers/net/null/rte_eth_null.c
index e4fd68f..d657133 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -553,9 +553,9 @@ eth_dev_null_create(const char *name,
        TAILQ_INIT(&eth_dev->link_intr_cbs);

        eth_dev->driver = NULL;
+       eth_dev->rte_driver = &pmd_null_drv.driver;
        data->dev_flags = RTE_ETH_DEV_DETACHABLE;
        data->kdrv = RTE_KDRV_NONE;
-       data->drv_name = pmd_null_drv.driver.name;
        data->numa_node = numa_node;

        /* finally assign rx and tx ops */
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fde8112..0527c4a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -259,6 +259,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
        }
        eth_dev->pci_dev = pci_dev;
        eth_dev->driver = eth_drv;
+       eth_dev->rte_driver = pci_drv->driver.name;
        eth_dev->data->rx_mbuf_alloc_failed = 0;

        /* init user callbacks */
@@ -1557,7 +1558,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct
rte_eth_dev_info *dev_info)
        RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
        (*dev->dev_ops->dev_infos_get)(dev, dev_info);
        dev_info->pci_dev = dev->pci_dev;
-       dev_info->driver_name = dev->data->drv_name;
+       dev_info->driver_name = dev->rte_driver->name;
        dev_info->nb_rx_queues = dev->data->nb_rx_queues;
        dev_info->nb_tx_queues = dev->data->nb_tx_queues;
 }
@@ -3214,7 +3215,6 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
struct rte_pci_device *pci_de

        eth_dev->data->kdrv = pci_dev->kdrv;
        eth_dev->data->numa_node = pci_dev->device.numa_node;
-       eth_dev->data->drv_name = pci_dev->driver->driver.name;
 }

 int
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9678179..63e7931 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1642,6 +1642,7 @@ 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 */
+       struct rte_driver *rte_driver;
 } __rte_cache_aligned;

 struct rte_eth_dev_sriov {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] net: remove dead driver names
  2016-11-10 13:51 [dpdk-dev] [PATCH 1/2] net: remove dead driver names David Marchand
  2016-11-10 13:51 ` [dpdk-dev] [PATCH 2/2] net: align ethdev and eal " David Marchand
@ 2016-11-21 16:31 ` Jan Blunck
  2016-11-21 18:06 ` [dpdk-dev] [PATCH v2 " David Marchand
  2 siblings, 0 replies; 7+ messages in thread
From: Jan Blunck @ 2016-11-21 16:31 UTC (permalink / raw)
  To: David Marchand
  Cc: Thomas Monjalon, dev, linville, Declan Doherty, zlu, lsun,
	alejandro.lucero, mtetsuyah, nicolas.pernas.maradei,
	Ferruh Yigit, harish.patil, rasesh.mody, sony.chacko,
	Bruce Richardson, huawei.xie, Yuanhan Liu, jianfeng.tan

On Thu, Nov 10, 2016 at 2:51 PM, David Marchand
<david.marchand@6wind.com> wrote:
> Since b1fb53a39d88 ("ethdev: remove some PCI specific handling"),

Please fix this checkpatch finding.

> rte_eth_dev_info_get() relies on dev->data->drv_name to report the driver
> name to caller.
>
> Having the pmds set driver_info->driver_name in the pmds is useless,
> since ethdev overwrites it right after.
> The only thing the pmd must do is:
> - for pci drivers, call rte_eth_copy_pci_info() which then sets
>   data->drv_name
> - for vdev drivers, manually set data->drv_name
>
> At this stage, virtio-user does not properly report a driver name (fixed in
> next commit).
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
>  drivers/net/af_packet/rte_eth_af_packet.c | 5 +----
>  drivers/net/nfp/nfp_net.c                 | 1 -
>  drivers/net/null/rte_eth_null.c           | 4 +---
>  drivers/net/pcap/rte_eth_pcap.c           | 4 +---
>  drivers/net/qede/qede_ethdev.c            | 1 -

There is another stale variable drivername in qede_ethdev.c. Might be
the right time to remove it.

Thanks,
Jan

>  drivers/net/ring/rte_eth_ring.c           | 4 +---
>  drivers/net/vhost/rte_eth_vhost.c         | 3 ---
>  drivers/net/virtio/virtio_ethdev.c        | 4 ----
>  drivers/net/xenvirt/rte_eth_xenvirt.c     | 5 +----
>  9 files changed, 5 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
> index ff45068..a66a657 100644
> --- a/drivers/net/af_packet/rte_eth_af_packet.c
> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
> @@ -115,8 +115,6 @@ static const char *valid_arguments[] = {
>         NULL
>  };
>
> -static const char *drivername = "AF_PACKET PMD";
> -
>  static struct rte_eth_link pmd_link = {
>         .link_speed = ETH_SPEED_NUM_10G,
>         .link_duplex = ETH_LINK_FULL_DUPLEX,
> @@ -280,7 +278,6 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>  {
>         struct pmd_internals *internals = dev->data->dev_private;
>
> -       dev_info->driver_name = drivername;
>         dev_info->if_index = internals->if_index;
>         dev_info->max_mac_addrs = 1;
>         dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
> @@ -693,7 +690,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 = drivername;
> +       (*eth_dev)->data->drv_name = "AF_PACKET PMD";
>         (*eth_dev)->data->kdrv = RTE_KDRV_NONE;
>         (*eth_dev)->data->numa_node = numa_node;
>
> diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
> index c6b1587..0c342ab 100644
> --- a/drivers/net/nfp/nfp_net.c
> +++ b/drivers/net/nfp/nfp_net.c
> @@ -1006,7 +1006,6 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>
>         hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>
> -       dev_info->driver_name = dev->driver->pci_drv.driver.name;
>         dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
>         dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
>         dev_info->min_rx_bufsize = ETHER_MIN_MTU;
> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> index 836d982..09d77fd 100644
> --- a/drivers/net/null/rte_eth_null.c
> +++ b/drivers/net/null/rte_eth_null.c
> @@ -88,7 +88,6 @@ struct pmd_internals {
>
>
>  static struct ether_addr eth_addr = { .addr_bytes = {0} };
> -static const char *drivername = "Null PMD";
>  static struct rte_eth_link pmd_link = {
>         .link_speed = ETH_SPEED_NUM_10G,
>         .link_duplex = ETH_LINK_FULL_DUPLEX,
> @@ -295,7 +294,6 @@ eth_dev_info(struct rte_eth_dev *dev,
>                 return;
>
>         internals = dev->data->dev_private;
> -       dev_info->driver_name = drivername;
>         dev_info->max_mac_addrs = 1;
>         dev_info->max_rx_pktlen = (uint32_t)-1;
>         dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
> @@ -555,7 +553,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 = drivername;
> +       data->drv_name = "Null PMD";
>         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 0162f44..8b4fba7 100644
> --- a/drivers/net/pcap/rte_eth_pcap.c
> +++ b/drivers/net/pcap/rte_eth_pcap.c
> @@ -119,7 +119,6 @@ static struct ether_addr eth_addr = {
>         .addr_bytes = { 0, 0, 0, 0x1, 0x2, 0x3 }
>  };
>
> -static const char *drivername = "Pcap PMD";
>  static struct rte_eth_link pmd_link = {
>                 .link_speed = ETH_SPEED_NUM_10G,
>                 .link_duplex = ETH_LINK_FULL_DUPLEX,
> @@ -552,7 +551,6 @@ eth_dev_info(struct rte_eth_dev *dev,
>  {
>         struct pmd_internals *internals = dev->data->dev_private;
>
> -       dev_info->driver_name = drivername;
>         dev_info->if_index = internals->if_index;
>         dev_info->max_mac_addrs = 1;
>         dev_info->max_rx_pktlen = (uint32_t) -1;
> @@ -842,7 +840,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 = drivername;
> +       data->drv_name = "Pcap PMD";
>         data->numa_node = numa_node;
>
>         return 0;
> diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
> index 59129f2..a56ba90 100644
> --- a/drivers/net/qede/qede_ethdev.c
> +++ b/drivers/net/qede/qede_ethdev.c
> @@ -662,7 +662,6 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
>                 dev_info->max_vfs = 0;
>         else
>                 dev_info->max_vfs = (uint16_t)NUM_OF_VFS(&qdev->edev);
> -       dev_info->driver_name = qdev->drv_ver;
>         dev_info->reta_size = ECORE_RSS_IND_TABLE_SIZE;
>         dev_info->flow_type_rss_offloads = (uint64_t)QEDE_RSS_OFFLOAD_ALL;
>
> diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
> index c1767c4..56afaf2 100644
> --- a/drivers/net/ring/rte_eth_ring.c
> +++ b/drivers/net/ring/rte_eth_ring.c
> @@ -75,7 +75,6 @@ struct pmd_internals {
>  };
>
>
> -static const char *drivername = "Rings PMD";
>  static struct rte_eth_link pmd_link = {
>                 .link_speed = ETH_SPEED_NUM_10G,
>                 .link_duplex = ETH_LINK_FULL_DUPLEX,
> @@ -173,7 +172,6 @@ eth_dev_info(struct rte_eth_dev *dev,
>                 struct rte_eth_dev_info *dev_info)
>  {
>         struct pmd_internals *internals = dev->data->dev_private;
> -       dev_info->driver_name = drivername;
>         dev_info->max_mac_addrs = 1;
>         dev_info->max_rx_pktlen = (uint32_t)-1;
>         dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
> @@ -343,7 +341,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 = drivername;
> +       data->drv_name = "Rings PMD";
>         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 766d4ef..96bf391 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -53,8 +53,6 @@
>  #define ETH_VHOST_CLIENT_ARG           "client"
>  #define ETH_VHOST_DEQUEUE_ZERO_COPY    "dequeue-zero-copy"
>
> -static const char *drivername = "VHOST PMD";
> -
>  static const char *valid_arguments[] = {
>         ETH_VHOST_IFACE_ARG,
>         ETH_VHOST_QUEUES_ARG,
> @@ -861,7 +859,6 @@ eth_dev_info(struct rte_eth_dev *dev,
>                 return;
>         }
>
> -       dev_info->driver_name = drivername;
>         dev_info->max_mac_addrs = 1;
>         dev_info->max_rx_pktlen = (uint32_t)-1;
>         dev_info->max_rx_queues = internal->max_queues;
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 079fd6c..741688e 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1624,10 +1624,6 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>         uint64_t tso_mask;
>         struct virtio_hw *hw = dev->data->dev_private;
>
> -       if (dev->pci_dev)
> -               dev_info->driver_name = dev->driver->pci_drv.driver.name;
> -       else
> -               dev_info->driver_name = "virtio_user PMD";
>         dev_info->max_rx_queues =
>                 RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
>         dev_info->max_tx_queues =
> diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
> index c08a056..f74d72c 100644
> --- a/drivers/net/xenvirt/rte_eth_xenvirt.c
> +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
> @@ -70,8 +70,6 @@
>  /* virtio_idx is increased after new device is created.*/
>  static int virtio_idx = 0;
>
> -static const char *drivername = "xen virtio PMD";
> -
>  static struct rte_eth_link pmd_link = {
>                 .link_speed = ETH_SPEED_NUM_10G,
>                 .link_duplex = ETH_LINK_FULL_DUPLEX,
> @@ -331,7 +329,6 @@ eth_dev_info(struct rte_eth_dev *dev,
>         struct pmd_internals *internals = dev->data->dev_private;
>
>         RTE_SET_USED(internals);
> -       dev_info->driver_name = drivername;
>         dev_info->max_mac_addrs = 1;
>         dev_info->max_rx_pktlen = (uint32_t)2048;
>         dev_info->max_rx_queues = (uint16_t)1;
> @@ -675,7 +672,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 = drivername;
> +       eth_dev->data->drv_name = "xen virtio PMD";
>         eth_dev->driver = NULL;
>         eth_dev->data->numa_node = numa_node;
>
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v2 1/2] net: remove dead driver names
  2016-11-10 13:51 [dpdk-dev] [PATCH 1/2] net: remove dead driver names David Marchand
  2016-11-10 13:51 ` [dpdk-dev] [PATCH 2/2] net: align ethdev and eal " David Marchand
  2016-11-21 16:31 ` [dpdk-dev] [PATCH 1/2] net: remove dead " Jan Blunck
@ 2016-11-21 18:06 ` David Marchand
  2016-11-21 18:06   ` [dpdk-dev] [PATCH v2 2/2] net: align ethdev and eal " David Marchand
  2016-11-24 11:42   ` [dpdk-dev] [PATCH v2 1/2] net: remove dead " Ferruh Yigit
  2 siblings, 2 replies; 7+ messages in thread
From: David Marchand @ 2016-11-21 18:06 UTC (permalink / raw)
  To: thomas.monjalon
  Cc: dev, ferruh.yigit, jblunck, linville, declan.doherty, zlu, lsun,
	alejandro.lucero, mtetsuyah, nicolas.pernas.maradei,
	harish.patil, rasesh.mody, sony.chacko, bruce.richardson,
	huawei.xie, yuanhan.liu, jianfeng.tan

Since commit b1fb53a39d88 ("ethdev: remove some PCI specific handling"),
rte_eth_dev_info_get() relies on dev->data->drv_name to report the driver
name to caller.

Having the pmds set driver_info->driver_name in the pmds is useless,
since ethdev overwrites it right after.
The only thing the pmd must do is:
- for pci drivers, call rte_eth_copy_pci_info() which then sets
  data->drv_name
- for vdev drivers, manually set data->drv_name

At this stage, virtio-user does not properly report a driver name (fixed in
next commit).

Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Jan Blunck <jblunck@infradead.org>
---

Changes since v1:
- fixed commit log (checkpatch warning)
- removed stale variable in qede driver (caught by Jan B.)
---
 drivers/net/af_packet/rte_eth_af_packet.c | 5 +----
 drivers/net/nfp/nfp_net.c                 | 1 -
 drivers/net/null/rte_eth_null.c           | 4 +---
 drivers/net/pcap/rte_eth_pcap.c           | 4 +---
 drivers/net/qede/qede_ethdev.c            | 2 --
 drivers/net/ring/rte_eth_ring.c           | 4 +---
 drivers/net/vhost/rte_eth_vhost.c         | 3 ---
 drivers/net/virtio/virtio_ethdev.c        | 4 ----
 drivers/net/xenvirt/rte_eth_xenvirt.c     | 5 +----
 9 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index ff45068..a66a657 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -115,8 +115,6 @@ static const char *valid_arguments[] = {
 	NULL
 };
 
-static const char *drivername = "AF_PACKET PMD";
-
 static struct rte_eth_link pmd_link = {
 	.link_speed = ETH_SPEED_NUM_10G,
 	.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -280,7 +278,6 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	dev_info->driver_name = drivername;
 	dev_info->if_index = internals->if_index;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
@@ -693,7 +690,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 = drivername;
+	(*eth_dev)->data->drv_name = "AF_PACKET PMD";
 	(*eth_dev)->data->kdrv = RTE_KDRV_NONE;
 	(*eth_dev)->data->numa_node = numa_node;
 
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index c6b1587..0c342ab 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1006,7 +1006,6 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	dev_info->driver_name = dev->driver->pci_drv.driver.name;
 	dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
 	dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
 	dev_info->min_rx_bufsize = ETHER_MIN_MTU;
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 836d982..09d77fd 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -88,7 +88,6 @@ struct pmd_internals {
 
 
 static struct ether_addr eth_addr = { .addr_bytes = {0} };
-static const char *drivername = "Null PMD";
 static struct rte_eth_link pmd_link = {
 	.link_speed = ETH_SPEED_NUM_10G,
 	.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -295,7 +294,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 		return;
 
 	internals = dev->data->dev_private;
-	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)-1;
 	dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
@@ -555,7 +553,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 = drivername;
+	data->drv_name = "Null PMD";
 	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 0162f44..8b4fba7 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -119,7 +119,6 @@ static struct ether_addr eth_addr = {
 	.addr_bytes = { 0, 0, 0, 0x1, 0x2, 0x3 }
 };
 
-static const char *drivername = "Pcap PMD";
 static struct rte_eth_link pmd_link = {
 		.link_speed = ETH_SPEED_NUM_10G,
 		.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -552,7 +551,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	dev_info->driver_name = drivername;
 	dev_info->if_index = internals->if_index;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t) -1;
@@ -842,7 +840,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 = drivername;
+	data->drv_name = "Pcap PMD";
 	data->numa_node = numa_node;
 
 	return 0;
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index d106dd0..2c600c1 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -12,7 +12,6 @@
 
 /* Globals */
 static const struct qed_eth_ops *qed_ops;
-static const char *drivername = "qede pmd";
 static int64_t timer_period = 1;
 
 struct rte_qede_xstats_name_off {
@@ -663,7 +662,6 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
 		dev_info->max_vfs = 0;
 	else
 		dev_info->max_vfs = (uint16_t)NUM_OF_VFS(&qdev->edev);
-	dev_info->driver_name = qdev->drv_ver;
 	dev_info->reta_size = ECORE_RSS_IND_TABLE_SIZE;
 	dev_info->flow_type_rss_offloads = (uint64_t)QEDE_RSS_OFFLOAD_ALL;
 
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index c1767c4..56afaf2 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -75,7 +75,6 @@ struct pmd_internals {
 };
 
 
-static const char *drivername = "Rings PMD";
 static struct rte_eth_link pmd_link = {
 		.link_speed = ETH_SPEED_NUM_10G,
 		.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -173,7 +172,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 		struct rte_eth_dev_info *dev_info)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
-	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)-1;
 	dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
@@ -343,7 +341,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 = drivername;
+	data->drv_name = "Rings PMD";
 	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 766d4ef..96bf391 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -53,8 +53,6 @@
 #define ETH_VHOST_CLIENT_ARG		"client"
 #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
 
-static const char *drivername = "VHOST PMD";
-
 static const char *valid_arguments[] = {
 	ETH_VHOST_IFACE_ARG,
 	ETH_VHOST_QUEUES_ARG,
@@ -861,7 +859,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 		return;
 	}
 
-	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)-1;
 	dev_info->max_rx_queues = internal->max_queues;
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 079fd6c..741688e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1624,10 +1624,6 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	uint64_t tso_mask;
 	struct virtio_hw *hw = dev->data->dev_private;
 
-	if (dev->pci_dev)
-		dev_info->driver_name = dev->driver->pci_drv.driver.name;
-	else
-		dev_info->driver_name = "virtio_user PMD";
 	dev_info->max_rx_queues =
 		RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
 	dev_info->max_tx_queues =
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index c08a056..f74d72c 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -70,8 +70,6 @@
 /* virtio_idx is increased after new device is created.*/
 static int virtio_idx = 0;
 
-static const char *drivername = "xen virtio PMD";
-
 static struct rte_eth_link pmd_link = {
 		.link_speed = ETH_SPEED_NUM_10G,
 		.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -331,7 +329,6 @@ eth_dev_info(struct rte_eth_dev *dev,
 	struct pmd_internals *internals = dev->data->dev_private;
 
 	RTE_SET_USED(internals);
-	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)2048;
 	dev_info->max_rx_queues = (uint16_t)1;
@@ -675,7 +672,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 = drivername;
+	eth_dev->data->drv_name = "xen virtio PMD";
 	eth_dev->driver = NULL;
 	eth_dev->data->numa_node = numa_node;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v2 2/2] net: align ethdev and eal driver names
  2016-11-21 18:06 ` [dpdk-dev] [PATCH v2 " David Marchand
@ 2016-11-21 18:06   ` David Marchand
  2016-11-24 11:42   ` [dpdk-dev] [PATCH v2 1/2] net: remove dead " Ferruh Yigit
  1 sibling, 0 replies; 7+ messages in thread
From: David Marchand @ 2016-11-21 18:06 UTC (permalink / raw)
  To: thomas.monjalon
  Cc: dev, ferruh.yigit, jblunck, linville, declan.doherty, zlu, lsun,
	alejandro.lucero, mtetsuyah, nicolas.pernas.maradei,
	harish.patil, rasesh.mody, sony.chacko, bruce.richardson,
	huawei.xie, yuanhan.liu, jianfeng.tan

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 <david.marchand@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 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 <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_tcp.h>
+#include <rte_vdev.h>
 
 #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 <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_dev.h>
+#include <rte_vdev.h>
 
 #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;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] net: remove dead driver names
  2016-11-21 18:06 ` [dpdk-dev] [PATCH v2 " David Marchand
  2016-11-21 18:06   ` [dpdk-dev] [PATCH v2 2/2] net: align ethdev and eal " David Marchand
@ 2016-11-24 11:42   ` Ferruh Yigit
  1 sibling, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2016-11-24 11:42 UTC (permalink / raw)
  To: David Marchand, thomas.monjalon
  Cc: dev, jblunck, linville, declan.doherty, zlu, lsun,
	alejandro.lucero, mtetsuyah, nicolas.pernas.maradei,
	harish.patil, rasesh.mody, sony.chacko, bruce.richardson,
	huawei.xie, yuanhan.liu, jianfeng.tan

On 11/21/2016 6:06 PM, David Marchand wrote:
> Since commit b1fb53a39d88 ("ethdev: remove some PCI specific handling"),
> rte_eth_dev_info_get() relies on dev->data->drv_name to report the driver
> name to caller.
> 
> Having the pmds set driver_info->driver_name in the pmds is useless,
> since ethdev overwrites it right after.
> The only thing the pmd must do is:
> - for pci drivers, call rte_eth_copy_pci_info() which then sets
>   data->drv_name
> - for vdev drivers, manually set data->drv_name
> 
> At this stage, virtio-user does not properly report a driver name (fixed in
> next commit).
> 
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Reviewed-by: Jan Blunck <jblunck@infradead.org>

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-11-24 11:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-10 13:51 [dpdk-dev] [PATCH 1/2] net: remove dead driver names David Marchand
2016-11-10 13:51 ` [dpdk-dev] [PATCH 2/2] net: align ethdev and eal " David Marchand
2016-11-10 18:46   ` Ferruh Yigit
2016-11-21 16:31 ` [dpdk-dev] [PATCH 1/2] net: remove dead " Jan Blunck
2016-11-21 18:06 ` [dpdk-dev] [PATCH v2 " David Marchand
2016-11-21 18:06   ` [dpdk-dev] [PATCH v2 2/2] net: align ethdev and eal " David Marchand
2016-11-24 11:42   ` [dpdk-dev] [PATCH v2 1/2] net: remove dead " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).