summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Burakov <anatoly.burakov@intel.com>2019-11-04 17:41:33 +0000
committerDavid Marchand <david.marchand@redhat.com>2019-11-07 17:46:43 +0100
commit9362945d7e79ca292215a8875055998928d36e74 (patch)
tree6e16547c32c7eff13d8f8395c030513f7d9b5987
parent14d7ea259aebaacfa9326e54e881ab0e550f6a6e (diff)
downloaddpdk-9362945d7e79ca292215a8875055998928d36e74.zip
dpdk-9362945d7e79ca292215a8875055998928d36e74.tar.gz
dpdk-9362945d7e79ca292215a8875055998928d36e74.tar.xz
vfio: fix DMA mapping with default container
When requesting DMA mapping to default container, we are meant to supply the RTE_VFIO_DEFAULT_CONTAINER_FD value, however this is not handled correctly by get_vfio_cfg_by_container_fd(), because it only looks at actual fd values and does not check for this special case. Fix it to return default container if the fd requested is the special RTE_VFIO_DEFAULT_CONTAINER_FD value. Fixes: 4106d89a18f8 ("vfio: allow DMA map to the default container") Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> Reviewed-by: David Marchand <david.marchand@redhat.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
-rw-r--r--lib/librte_eal/linux/eal/eal_vfio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c
index d9541b1..d788738 100644
--- a/lib/librte_eal/linux/eal/eal_vfio.c
+++ b/lib/librte_eal/linux/eal/eal_vfio.c
@@ -412,6 +412,9 @@ get_vfio_cfg_by_container_fd(int container_fd)
{
int i;
+ if (container_fd == RTE_VFIO_DEFAULT_CONTAINER_FD)
+ return default_vfio_cfg;
+
for (i = 0; i < VFIO_MAX_CONTAINERS; i++) {
if (vfio_cfgs[i].vfio_container_fd == container_fd)
return &vfio_cfgs[i];