net: align ethdev and eal driver names
authorDavid Marchand <david.marchand@6wind.com>
Mon, 21 Nov 2016 18:06:14 +0000 (19:06 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:36:47 +0000 (19:36 +0100)
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
drivers/net/bonding/rte_eth_bond_api.c
drivers/net/bonding/rte_eth_bond_pmd.c
drivers/net/bonding/rte_eth_bond_private.h
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

index 4c317c4..f670165 100644 (file)
@@ -436,6 +436,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,
@@ -689,7 +691,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;
 
index 19347d8..f552d96 100644 (file)
@@ -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
@@ -212,7 +211,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);
index c1796f2..02e3448 100644 (file)
@@ -2562,12 +2562,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,
index d95d440..5a411e2 100644 (file)
@@ -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 {
index 792ab56..7bbd168 100644 (file)
@@ -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;
@@ -1605,7 +1604,7 @@ rte_pmd_mpipe_probe(const char *ifname,
 
        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;
@@ -1622,12 +1621,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);
index 725dff3..57203e2 100644 (file)
@@ -477,6 +477,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,
@@ -550,7 +552,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 */
index 69c6960..0912245 100644 (file)
@@ -787,6 +787,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,
@@ -839,7 +841,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;
index efc2b75..6f9cc1a 100644 (file)
@@ -256,6 +256,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,
@@ -340,7 +342,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;
 
        /* finally assign rx and tx ops */
index 98a4735..848a3da 100644 (file)
@@ -982,6 +982,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)
@@ -1066,7 +1068,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 */
index c877968..e544acc 100644 (file)
@@ -274,6 +274,8 @@ get_integer_arg(const char *key __rte_unused,
        return 0;
 }
 
+static struct rte_vdev_driver virtio_user_driver;
+
 static struct rte_eth_dev *
 virtio_user_eth_dev_alloc(const char *name)
 {
@@ -312,6 +314,7 @@ virtio_user_eth_dev_alloc(const char *name)
        hw->use_simple_rxtx = 0;
        hw->virtio_user_dev = dev;
        data->dev_private = hw;
+       data->drv_name = virtio_user_driver.driver.name;
        data->numa_node = SOCKET_ID_ANY;
        data->kdrv = RTE_KDRV_NONE;
        data->dev_flags = RTE_ETH_DEV_DETACHABLE;
index 1cc2ce1..19bc09a 100644 (file)
@@ -616,6 +616,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,
@@ -671,7 +672,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
 
        eth_dev->data->dev_flags = RTE_ETH_DEV_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;