MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pci_rte_vfio_setup_device

Function pci_rte_vfio_setup_device

dpdk/drivers/bus/pci/linux/pci_vfio.c:439–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437}
438
439static int
440pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
441{
442 if (pci_vfio_setup_interrupts(dev, vfio_dev_fd) != 0) {
443 RTE_LOG(ERR, EAL, "Error setting up interrupts!\n");
444 return -1;
445 }
446
447 if (pci_vfio_enable_bus_memory(dev, vfio_dev_fd)) {
448 RTE_LOG(ERR, EAL, "Cannot enable bus memory!\n");
449 return -1;
450 }
451
452 if (rte_pci_set_bus_master(dev, true)) {
453 RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
454 return -1;
455 }
456
457 /*
458 * Reset the device. If the device is not capable of resetting,
459 * then it updates errno as EINVAL.
460 */
461 if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
462 RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
463 errno, strerror(errno));
464 return -1;
465 }
466
467 return 0;
468}
469
470static int
471pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,

Callers 1

Calls 4

rte_pci_set_bus_masterFunction · 0.85
ioctlFunction · 0.50

Tested by

no test coverage detected