intrte_vfio_setup_device(constchar*sysfs_base,constchar*dev_addr,int*vfio_dev_fd,structvfio_device_info*device_info)
Setup vfio_cfg for the device identified by its address. It discovers the configured I/O MMU groups or
sets a new one for the device. If a new groups is assigned, the DMA mapping is performed.
This function is only relevant to linux and will return an error on BSD.
Parameterssysfs_base sysfs path prefix.
dev_addr device location.
vfio_dev_fd VFIO fd.
device_info Device information.
Returns
0 on success. <0 on failure. >1 if the device cannot be managed this way.
intrte_vfio_release_device(constchar*sysfs_base,constchar*dev_addr,intfd)
Release a device mapped to a VFIO-managed I/O MMU group.
This function is only relevant to linux and will return an error on BSD.
Parameterssysfs_base sysfs path prefix.
dev_addr device location.
fd VFIO fd.
Returns
0 on success. <0 on failure.
intrte_vfio_enable(constchar*modname)
Enable a VFIO-related kmod.
This function is only relevant to linux and will return an error on BSD.
Parametersmodname kernel module name.
Returns
0 on success. <0 on failure.
intrte_vfio_is_enabled(constchar*modname)
Check whether a VFIO-related kmod is enabled.
This function is only relevant to Linux.
Parametersmodname kernel module name.
Returns
1 if true. 0 otherwise.
intrte_vfio_noiommu_is_enabled(void)
Whether VFIO NOIOMMU mode is enabled.
This function is only relevant to Linux.
Returns
1 if true. 0 if false. <0 for errors.
intrte_vfio_clear_group(intvfio_group_fd)
Remove group fd from internal VFIO group fd array/
This function is only relevant to linux and will return an error on BSD.
Parametersvfio_group_fd VFIO Group FD.
Returns
0 on success. <0 on failure.
intrte_vfio_get_group_num(constchar*sysfs_base,constchar*dev_addr,int*iommu_group_num)
Parse IOMMU group number for a device
This function is only relevant to linux and will return an error on BSD.
Parameterssysfs_base sysfs path prefix.
dev_addr device location.
iommu_group_num iommu group number
Returns
>0 on success 0 for non-existent group or VFIO <0 for errors
__rte_experimentalintrte_vfio_get_device_info(constchar*sysfs_base,constchar*dev_addr,int*vfio_dev_fd,structvfio_device_info*device_info)
Get device information
This function is only relevant to Linux and will return an error on BSD.
Parameterssysfs_base sysfs path prefix.
dev_addr device location.
vfio_dev_fd VFIO fd.
device_info Device information.
Returns
0 on success. <0 on failure.
intrte_vfio_get_container_fd(void)
Open a new VFIO container fd
This function is only relevant to linux and will return an error on BSD.
Returns
0 container fd < 0 for errors
intrte_vfio_get_group_fd(intiommu_group_num)
Open VFIO group fd or get an existing one
This function is only relevant to linux and will return an error on BSD.
Parametersiommu_group_num iommu group number
Returns
0 group fd < 0 for errors
intrte_vfio_container_create(void)
Create a new container for device binding.
Note
Any newly allocated DPDK memory will not be mapped into these containers by default, user needs to
manage DMA mappings for any container created by this API.
When creating containers using this API, the container will only be available in the process that has
created it. Sharing containers and devices between multiple processes is not supported.
Returns
the container fd if successful <0 if failed
intrte_vfio_container_destroy(intcontainer_fd)
Destroy the container, unbind all vfio groups within it.
Parameterscontainer_fd the container fd to destroy
Returns
0 if successful <0 if failed
intrte_vfio_container_group_bind(intcontainer_fd,intiommu_group_num)
Bind a IOMMU group to a container.
Parameterscontainer_fd the container's fd
iommu_group_num the iommu group number to bind to container
Returns
group fd if successful <0 if failed
intrte_vfio_container_group_unbind(intcontainer_fd,intiommu_group_num)
Unbind a IOMMU group from a container.
Parameterscontainer_fd the container fd of container
iommu_group_num the iommu group number to delete from container
Returns
0 if successful <0 if failed
intrte_vfio_container_dma_map(intcontainer_fd,uint64_tvaddr,uint64_tiova,uint64_tlen)
Perform DMA mapping for devices in a container.
Parameterscontainer_fd the specified container fd. Use RTE_VFIO_DEFAULT_CONTAINER_FD to use the default
container.
vaddr Starting virtual address of memory to be mapped.
iova Starting IOVA address of memory to be mapped.
len Length of memory segment being mapped.
Returns
0 if successful <0 if failed
intrte_vfio_container_dma_unmap(intcontainer_fd,uint64_tvaddr,uint64_tiova,uint64_tlen)
Perform DMA unmapping for devices in a container.
Parameterscontainer_fd the specified container fd. Use RTE_VFIO_DEFAULT_CONTAINER_FD to use the default
container.
vaddr Starting virtual address of memory to be unmapped.
iova Starting IOVA address of memory to be unmapped.
len Length of memory segment being unmapped.
Returns
0 if successful <0 if failed