vfio: set errno on unsupported OS

Currently, when code is running on FreeBSD or Windows, there is no way
to distinguish between a geniune error and a "VFIO is unsupported"
error. Fix the dummy implementations to also set the rte_errno flag.

Fixes: 279b581c897d ("vfio: expose functions")
Fixes: c564a2a20093 ("vfio: expose clear group function for internal usages")
Fixes: 964b2f3bfb07 ("vfio: export some internal functions")
Fixes: ea2dc1066870 ("vfio: add multi container support")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Anatoly Burakov 2021-10-28 14:15:19 +00:00 committed by David Marchand
parent da6e4cdca1
commit 4fd15c6af0
2 changed files with 15 additions and 0 deletions

View File

@ -1018,6 +1018,7 @@ int rte_vfio_setup_device(__rte_unused const char *sysfs_base,
__rte_unused int *vfio_dev_fd,
__rte_unused struct vfio_device_info *device_info)
{
rte_errno = ENOTSUP;
return -1;
}
@ -1025,11 +1026,13 @@ int rte_vfio_release_device(__rte_unused const char *sysfs_base,
__rte_unused const char *dev_addr,
__rte_unused int fd)
{
rte_errno = ENOTSUP;
return -1;
}
int rte_vfio_enable(__rte_unused const char *modname)
{
rte_errno = ENOTSUP;
return -1;
}
@ -1045,6 +1048,7 @@ int rte_vfio_noiommu_is_enabled(void)
int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
{
rte_errno = ENOTSUP;
return -1;
}
@ -1053,30 +1057,35 @@ rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
__rte_unused const char *dev_addr,
__rte_unused int *iommu_group_num)
{
rte_errno = ENOTSUP;
return -1;
}
int
rte_vfio_get_container_fd(void)
{
rte_errno = ENOTSUP;
return -1;
}
int
rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
{
rte_errno = ENOTSUP;
return -1;
}
int
rte_vfio_container_create(void)
{
rte_errno = ENOTSUP;
return -1;
}
int
rte_vfio_container_destroy(__rte_unused int container_fd)
{
rte_errno = ENOTSUP;
return -1;
}
@ -1084,6 +1093,7 @@ int
rte_vfio_container_group_bind(__rte_unused int container_fd,
__rte_unused int iommu_group_num)
{
rte_errno = ENOTSUP;
return -1;
}
@ -1091,6 +1101,7 @@ int
rte_vfio_container_group_unbind(__rte_unused int container_fd,
__rte_unused int iommu_group_num)
{
rte_errno = ENOTSUP;
return -1;
}
@ -1100,6 +1111,7 @@ rte_vfio_container_dma_map(__rte_unused int container_fd,
__rte_unused uint64_t iova,
__rte_unused uint64_t len)
{
rte_errno = ENOTSUP;
return -1;
}
@ -1109,5 +1121,6 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd,
__rte_unused uint64_t iova,
__rte_unused uint64_t len)
{
rte_errno = ENOTSUP;
return -1;
}

View File

@ -481,6 +481,7 @@ rte_vfio_container_dma_map(__rte_unused int container_fd,
__rte_unused uint64_t iova,
__rte_unused uint64_t len)
{
rte_errno = ENOTSUP;
return -1;
}
@ -490,6 +491,7 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd,
__rte_unused uint64_t iova,
__rte_unused uint64_t len)
{
rte_errno = ENOTSUP;
return -1;
}