pci: create device list and fallback on its members
Now that rte_device is available, drivers can start using its members (numa, name) as well as link themselves into another rte_device list. As of now no one is using this list, but can be used for moving over all devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup). Signed-off-by: Jan Viktorin <viktorin@rehivetech.com> [Shreyansh: Reword commit log for extra rte_device list] Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com> Acked-by: David Marchand <david.marchand@6wind.com>
This commit is contained in:
parent
a000b58662
commit
13a1317d3b
@ -585,7 +585,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
|
||||
if (eth_dev == NULL)
|
||||
goto err;
|
||||
|
||||
pci_dev->numa_node = socket_id;
|
||||
pci_dev->device.numa_node = socket_id;
|
||||
pci_drv->driver.name = virtual_ethdev_driver_name;
|
||||
pci_drv->id_table = id_table;
|
||||
|
||||
@ -626,7 +626,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
|
||||
eth_dev->dev_ops = &dev_private->dev_ops;
|
||||
|
||||
eth_dev->pci_dev = pci_dev;
|
||||
eth_dev->pci_dev->driver = ð_drv->pci_drv;
|
||||
eth_dev->pci_dev->device.driver = ð_drv->pci_drv.driver;
|
||||
|
||||
eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success;
|
||||
eth_dev->tx_pkt_burst = virtual_ethdev_tx_burst_success;
|
||||
|
@ -675,7 +675,7 @@ fm10k_dev_tx_init(struct rte_eth_dev *dev)
|
||||
/* Enable use of FTAG bit in TX descriptor, PFVTCTL
|
||||
* register is read-only for VF.
|
||||
*/
|
||||
if (fm10k_check_ftag(dev->pci_dev->devargs)) {
|
||||
if (fm10k_check_ftag(dev->pci_dev->device.devargs)) {
|
||||
if (hw->mac.type == fm10k_mac_pf) {
|
||||
FM10K_WRITE_REG(hw, FM10K_PFVTCTL(i),
|
||||
FM10K_PFVTCTL_FTAG_DESC_ENABLE);
|
||||
@ -2731,7 +2731,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
|
||||
int use_sse = 1;
|
||||
uint16_t tx_ftag_en = 0;
|
||||
|
||||
if (fm10k_check_ftag(dev->pci_dev->devargs))
|
||||
if (fm10k_check_ftag(dev->pci_dev->device.devargs))
|
||||
tx_ftag_en = 1;
|
||||
|
||||
for (i = 0; i < dev->data->nb_tx_queues; i++) {
|
||||
@ -2762,7 +2762,7 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)
|
||||
uint16_t i, rx_using_sse;
|
||||
uint16_t rx_ftag_en = 0;
|
||||
|
||||
if (fm10k_check_ftag(dev->pci_dev->devargs))
|
||||
if (fm10k_check_ftag(dev->pci_dev->device.devargs))
|
||||
rx_ftag_en = 1;
|
||||
|
||||
/* In order to allow Vector Rx there are a few configuration
|
||||
|
@ -905,8 +905,10 @@ config_floating_veb(struct rte_eth_dev *dev)
|
||||
memset(pf->floating_veb_list, 0, sizeof(pf->floating_veb_list));
|
||||
|
||||
if (hw->aq.fw_maj_ver >= FLOATING_VEB_SUPPORTED_FW_MAJ) {
|
||||
pf->floating_veb = is_floating_veb_supported(pci_dev->devargs);
|
||||
config_vf_floating_veb(pci_dev->devargs, pf->floating_veb,
|
||||
pf->floating_veb =
|
||||
is_floating_veb_supported(pci_dev->device.devargs);
|
||||
config_vf_floating_veb(pci_dev->device.devargs,
|
||||
pf->floating_veb,
|
||||
pf->floating_veb_list);
|
||||
} else {
|
||||
pf->floating_veb = false;
|
||||
|
@ -511,7 +511,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
|
||||
priv->mtu = ETHER_MTU;
|
||||
priv->mps = mps; /* Enable MPW by default if supported. */
|
||||
priv->cqe_comp = 1; /* Enable compression by default. */
|
||||
err = mlx5_args(priv, pci_dev->devargs);
|
||||
err = mlx5_args(priv, pci_dev->device.devargs);
|
||||
if (err) {
|
||||
ERROR("failed to process device arguments: %s",
|
||||
strerror(err));
|
||||
|
@ -745,8 +745,9 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
|
||||
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
|
||||
if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
|
||||
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
|
||||
(!dev->devargs ||
|
||||
dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
|
||||
(!dev->device.devargs ||
|
||||
dev->device.devargs->type !=
|
||||
RTE_DEVTYPE_WHITELISTED_PCI)) {
|
||||
PMD_INIT_LOG(INFO,
|
||||
"skip kernel managed virtio device.");
|
||||
return 1;
|
||||
|
@ -287,7 +287,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
|
||||
dev->max_vfs = 0;
|
||||
|
||||
/* FreeBSD has no NUMA support (yet) */
|
||||
dev->numa_node = 0;
|
||||
dev->device.numa_node = 0;
|
||||
|
||||
/* FreeBSD has only one pass through driver */
|
||||
dev->kdrv = RTE_KDRV_NIC_UIO;
|
||||
|
@ -185,11 +185,12 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
|
||||
|
||||
RTE_LOG(INFO, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
|
||||
loc->domain, loc->bus, loc->devid, loc->function,
|
||||
dev->numa_node);
|
||||
dev->device.numa_node);
|
||||
|
||||
/* no initialization when blacklisted, return without error */
|
||||
if (dev->devargs != NULL &&
|
||||
dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {
|
||||
if (dev->device.devargs != NULL &&
|
||||
dev->device.devargs->type ==
|
||||
RTE_DEVTYPE_BLACKLISTED_PCI) {
|
||||
RTE_LOG(INFO, EAL, " Device is blacklisted, not initializing\n");
|
||||
return 1;
|
||||
}
|
||||
@ -252,7 +253,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
|
||||
|
||||
RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
|
||||
loc->domain, loc->bus, loc->devid,
|
||||
loc->function, dev->numa_node);
|
||||
loc->function, dev->device.numa_node);
|
||||
|
||||
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
|
||||
dev->id.device_id, dr->driver.name);
|
||||
@ -418,7 +419,7 @@ rte_eal_pci_probe(void)
|
||||
/* set devargs in PCI structure */
|
||||
devargs = pci_devargs_lookup(dev);
|
||||
if (devargs != NULL)
|
||||
dev->devargs = devargs;
|
||||
dev->device.devargs = devargs;
|
||||
|
||||
/* probe all or only whitelisted devices */
|
||||
if (probe_all)
|
||||
|
@ -149,6 +149,7 @@ enum rte_kernel_driver {
|
||||
*/
|
||||
struct rte_pci_device {
|
||||
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
|
||||
struct rte_device device; /**< Inherit core device */
|
||||
struct rte_pci_addr addr; /**< PCI location. */
|
||||
struct rte_pci_id id; /**< PCI ID. */
|
||||
struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
|
||||
@ -156,8 +157,6 @@ struct rte_pci_device {
|
||||
struct rte_intr_handle intr_handle; /**< Interrupt handle */
|
||||
struct rte_pci_driver *driver; /**< Associated driver */
|
||||
uint16_t max_vfs; /**< sriov enable if not zero */
|
||||
int numa_node; /**< NUMA node connection */
|
||||
struct rte_devargs *devargs; /**< Device user arguments */
|
||||
enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
|
||||
};
|
||||
|
||||
|
@ -350,13 +350,13 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
dirname);
|
||||
if (access(filename, R_OK) != 0) {
|
||||
/* if no NUMA support, set default to 0 */
|
||||
dev->numa_node = 0;
|
||||
dev->device.numa_node = 0;
|
||||
} else {
|
||||
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
|
||||
free(dev);
|
||||
return -1;
|
||||
}
|
||||
dev->numa_node = tmp;
|
||||
dev->device.numa_node = tmp;
|
||||
}
|
||||
|
||||
/* parse resources */
|
||||
@ -390,6 +390,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
|
||||
/* device is valid, add in list (sorted) */
|
||||
if (TAILQ_EMPTY(&pci_device_list)) {
|
||||
rte_eal_device_insert(&dev->device);
|
||||
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
|
||||
} else {
|
||||
struct rte_pci_device *dev2;
|
||||
@ -402,6 +403,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
|
||||
if (ret < 0) {
|
||||
TAILQ_INSERT_BEFORE(dev2, dev, next);
|
||||
rte_eal_device_insert(&dev->device);
|
||||
} else { /* already registered */
|
||||
dev2->kdrv = dev->kdrv;
|
||||
dev2->max_vfs = dev->max_vfs;
|
||||
@ -411,6 +413,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
rte_eal_device_insert(&dev->device);
|
||||
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
|
||||
}
|
||||
|
||||
|
@ -3209,7 +3209,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
|
||||
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
eth_dev->data->kdrv = pci_dev->kdrv;
|
||||
eth_dev->data->numa_node = pci_dev->numa_node;
|
||||
eth_dev->data->numa_node = pci_dev->device.numa_node;
|
||||
eth_dev->data->drv_name = pci_dev->driver->driver.name;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user