[dpdk-dev,01/2] vfio: expose clear group function for internal usages
Checks
Commit Message
other vfio based module e.g. fslmc will also need to use
the clear_group call.
So, exposing it and renaming it to *rte_vfio_clear_group*
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
lib/librte_eal/linuxapp/eal/eal_vfio.c | 18 +++++++++---------
lib/librte_eal/linuxapp/eal/eal_vfio.h | 2 +-
lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 2 +-
lib/librte_eal/rte_eal_version.map | 7 +++++++
4 files changed, 18 insertions(+), 11 deletions(-)
Comments
On 07-Dec-17 10:28 AM, Hemant Agrawal wrote:
> other vfio based module e.g. fslmc will also need to use
> the clear_group call.
> So, exposing it and renaming it to *rte_vfio_clear_group*
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
07/12/2017 11:28, Hemant Agrawal:
> other vfio based module e.g. fslmc will also need to use
> the clear_group call.
> So, exposing it and renaming it to *rte_vfio_clear_group*
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h
> +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h
> @@ -179,7 +179,7 @@ vfio_get_group_fd(int iommu_group_no);
>
> /* remove group fd from internal VFIO group fd array */
> int
> -clear_group(int vfio_group_fd);
> +rte_vfio_clear_group(int vfio_group_fd);
The function should be moved to lib/librte_eal/common/include/rte_vfio.h
and an empty implementation must be added for BSD.
Related note: in drivers/bus/fslmc/fslmc_vfio.h there is
#include "eal_vfio.h"
Can it be removed?
On 1/12/2018 10:06 PM, Thomas Monjalon wrote:
> 07/12/2017 11:28, Hemant Agrawal:
>> other vfio based module e.g. fslmc will also need to use
>> the clear_group call.
>> So, exposing it and renaming it to *rte_vfio_clear_group*
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>> --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h
>> +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h
>> @@ -179,7 +179,7 @@ vfio_get_group_fd(int iommu_group_no);
>>
>> /* remove group fd from internal VFIO group fd array */
>> int
>> -clear_group(int vfio_group_fd);
>> +rte_vfio_clear_group(int vfio_group_fd);
>
> The function should be moved to lib/librte_eal/common/include/rte_vfio.h
> and an empty implementation must be added for BSD.
>
I am sending v2 for that.
> Related note: in drivers/bus/fslmc/fslmc_vfio.h there is
> #include "eal_vfio.h"
> Can it be removed?
>
Yes but it will be different change.
Currently fslmc_vfio.h is is using few "vfio_get_xxx" functions. I will
plan that cleanup in different patch.
@@ -226,7 +226,7 @@ vfio_group_device_count(int vfio_group_fd)
}
int
-clear_group(int vfio_group_fd)
+rte_vfio_clear_group(int vfio_group_fd)
{
int i;
int socket_fd, ret;
@@ -329,12 +329,12 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
RTE_LOG(ERR, EAL, " %s cannot get group status, "
"error %i (%s)\n", dev_addr, errno, strerror(errno));
close(vfio_group_fd);
- clear_group(vfio_group_fd);
+ rte_vfio_clear_group(vfio_group_fd);
return -1;
} else if (!(group_status.flags & VFIO_GROUP_FLAGS_VIABLE)) {
RTE_LOG(ERR, EAL, " %s VFIO group is not viable!\n", dev_addr);
close(vfio_group_fd);
- clear_group(vfio_group_fd);
+ rte_vfio_clear_group(vfio_group_fd);
return -1;
}
@@ -348,7 +348,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
RTE_LOG(ERR, EAL, " %s cannot add VFIO group to container, "
"error %i (%s)\n", dev_addr, errno, strerror(errno));
close(vfio_group_fd);
- clear_group(vfio_group_fd);
+ rte_vfio_clear_group(vfio_group_fd);
return -1;
}
@@ -370,7 +370,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
" %s failed to select IOMMU type\n",
dev_addr);
close(vfio_group_fd);
- clear_group(vfio_group_fd);
+ rte_vfio_clear_group(vfio_group_fd);
return -1;
}
ret = t->dma_map_func(vfio_cfg.vfio_container_fd);
@@ -379,7 +379,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
" %s DMA remapping failed, error %i (%s)\n",
dev_addr, errno, strerror(errno));
close(vfio_group_fd);
- clear_group(vfio_group_fd);
+ rte_vfio_clear_group(vfio_group_fd);
return -1;
}
}
@@ -395,7 +395,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
RTE_LOG(WARNING, EAL, "Getting a vfio_dev_fd for %s failed\n",
dev_addr);
close(vfio_group_fd);
- clear_group(vfio_group_fd);
+ rte_vfio_clear_group(vfio_group_fd);
return -1;
}
@@ -407,7 +407,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
strerror(errno));
close(*vfio_dev_fd);
close(vfio_group_fd);
- clear_group(vfio_group_fd);
+ rte_vfio_clear_group(vfio_group_fd);
return -1;
}
vfio_group_device_get(vfio_group_fd);
@@ -467,7 +467,7 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr,
return -1;
}
- if (clear_group(vfio_group_fd) < 0) {
+ if (rte_vfio_clear_group(vfio_group_fd) < 0) {
RTE_LOG(INFO, EAL, "Error when clearing group for %s\n",
dev_addr);
return -1;
@@ -179,7 +179,7 @@ vfio_get_group_fd(int iommu_group_no);
/* remove group fd from internal VFIO group fd array */
int
-clear_group(int vfio_group_fd);
+rte_vfio_clear_group(int vfio_group_fd);
int vfio_mp_sync_setup(void);
@@ -333,7 +333,7 @@ vfio_mp_sync_thread(void __rte_unused * arg)
continue;
}
- ret = clear_group(vfio_data);
+ ret = rte_vfio_clear_group(vfio_data);
if (ret < 0)
vfio_mp_sync_send_request(conn_sock, SOCKET_NO_FD);
@@ -236,3 +236,10 @@ EXPERIMENTAL {
rte_service_start_with_defaults;
} DPDK_17.11;
+
+DPDK_18.02 {
+ global:
+
+ rte_vfio_clear_group;
+
+} DPDK_17.11;
\ No newline at end of file