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 at 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(ð_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 {