drivers: copy fake PCI device info to ethdev data

Initialise dev_flags, driver, kdrv, drv_name and numa_node fields
in eth_dev data.

for the following vdevs:
null
ring
pcap
af_packet
xenvirt
mpipe
bonding

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Bernard Iremonger 2015-11-03 13:01:57 +00:00 committed by Thomas Monjalon
parent eeefe73f0a
commit 8fb9e2bbf9
8 changed files with 55 additions and 16 deletions

View File

@ -5,7 +5,7 @@
*
* Originally based upon librte_pmd_pcap code:
*
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
* Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* Copyright(c) 2014 6WIND S.A.
* All rights reserved.
*
@ -656,8 +656,8 @@ rte_pmd_init_internals(const char *name,
/*
* now put it all together
* - store queue data in internals,
* - store numa_node info in pci_driver
* - point eth_dev_data to internals and pci_driver
* - store numa_node in eth_dev
* - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
@ -675,6 +675,11 @@ rte_pmd_init_internals(const char *name,
(*eth_dev)->data = data;
(*eth_dev)->dev_ops = &ops;
(*eth_dev)->pci_dev = pci_dev;
(*eth_dev)->driver = NULL;
(*eth_dev)->data->dev_flags = 0;
(*eth_dev)->data->drv_name = drivername;
(*eth_dev)->data->kdrv = RTE_KDRV_NONE;
(*eth_dev)->data->numa_node = numa_node;
return 0;

View File

@ -44,6 +44,8 @@
#define DEFAULT_POLLING_INTERVAL_10_MS (10)
const char pmd_bond_driver_name[] = "rte_bond_pmd";
int
valid_bonded_ethdev(const struct rte_eth_dev *eth_dev)
{
@ -163,8 +165,6 @@ number_of_sockets(void)
return ++sockets;
}
const char pmd_bond_driver_name[] = "rte_bond_pmd";
static struct rte_pci_id pci_id_table = {
.device_id = PCI_ANY_ID,
.subsystem_device_id = PCI_ANY_ID,
@ -252,6 +252,13 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
eth_dev->dev_ops = &default_dev_ops;
eth_dev->pci_dev = pci_dev;
eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |
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->numa_node = socket_id;
rte_spinlock_init(&internals->lock);
internals->port_id = eth_dev->data->port_id;

View File

@ -80,6 +80,7 @@ struct mpipe_context {
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 {
@ -1595,6 +1596,12 @@ rte_pmd_mpipe_devinit(const char *ifname,
eth_dev->pci_dev = &priv->pci_dev;
eth_dev->data->mac_addrs = &priv->mac_addr;
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->numa_node = instance;
eth_dev->dev_ops = &mpipe_dev_ops;
eth_dev->rx_pkt_burst = &mpipe_recv_pkts;
eth_dev->tx_pkt_burst = &mpipe_xmit_pkts;

View File

@ -540,8 +540,8 @@ eth_dev_null_create(const char *name,
/* now put it all together
* - store queue data in internals,
* - store numa_node info in pci_driver
* - point eth_dev_data to internals and pci_driver
* - store numa_node info in ethdev data
* - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
/* NOTE: we'll replace the data element, of originally allocated eth_dev
@ -575,6 +575,12 @@ eth_dev_null_create(const char *name,
eth_dev->driver = &rte_null_pmd;
TAILQ_INIT(&eth_dev->link_intr_cbs);
eth_dev->driver = NULL;
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = RTE_KDRV_NONE;
eth_dev->data->drv_name = drivername;
eth_dev->data->numa_node = numa_node;
/* finally assign rx and tx ops */
if (packet_copy) {
eth_dev->rx_pkt_burst = eth_null_copy_rx;

View File

@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
* Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* Copyright(c) 2014 6WIND S.A.
* All rights reserved.
*
@ -845,8 +845,8 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
/* now put it all together
* - store queue data in internals,
* - store numa_node info in pci_driver
* - point eth_dev_data to internals and pci_driver
* - store numa_node info in eth_dev
* - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
/* NOTE: we'll replace the data element, of originally allocated eth_dev
@ -876,6 +876,11 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
(*eth_dev)->dev_ops = &ops;
(*eth_dev)->pci_dev = pci_dev;
(*eth_dev)->driver = &rte_pcap_pmd;
(*eth_dev)->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
(*eth_dev)->driver = NULL;
(*eth_dev)->data->kdrv = RTE_KDRV_NONE;
(*eth_dev)->data->drv_name = drivername;
(*eth_dev)->data->numa_node = numa_node;
return 0;

View File

@ -336,11 +336,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
goto error;
}
/* now put it all together
* - store queue data in internals,
* - store numa_node info in pci_driver
* - point eth_dev_data to internals and pci_driver
* - store numa_node info in eth_dev_data
* - point eth_dev_data to internals
* - and point eth_dev structure to new eth_dev_data structure
*/
/* NOTE: we'll replace the data element, of originally allocated eth_dev
@ -374,7 +373,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
eth_dev->data = data;
eth_dev->driver = &rte_ring_pmd;
eth_dev->dev_ops = &ops;
eth_dev->pci_dev = pci_dev;
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = RTE_KDRV_NONE;
eth_dev->data->drv_name = drivername;
eth_dev->data->numa_node = numa_node;
TAILQ_INIT(&(eth_dev->link_intr_cbs));
/* finally assign rx and tx ops */

View File

@ -67,7 +67,7 @@
/* virtio_idx is increased after new device is created.*/
static int virtio_idx = 0;
static const char *drivername = "xen dummy virtio PMD";
static const char *drivername = "xen virtio PMD";
static struct rte_eth_link pmd_link = {
.link_speed = 10000,
@ -688,8 +688,13 @@ eth_dev_xenvirt_create(const char *name, const char *params,
eth_dev->data = data;
eth_dev->dev_ops = &ops;
eth_dev->data->dev_flags = RTE_PCI_DRV_DETACHABLE;
eth_dev->pci_dev = pci_dev;
eth_dev->data->kdrv = RTE_KDRV_NONE;
eth_dev->data->drv_name = drivername;
eth_dev->driver = NULL;
eth_dev->data->numa_node = numa_node;
eth_dev->rx_pkt_burst = eth_xenvirt_rx;
eth_dev->tx_pkt_burst = eth_xenvirt_tx;

View File

@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
* Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -149,6 +149,7 @@ enum rte_kernel_driver {
RTE_KDRV_VFIO,
RTE_KDRV_UIO_GENERIC,
RTE_KDRV_NIC_UIO,
RTE_KDRV_NONE,
};
/**