[dpdk-dev] [PATCH v1] vhost: fix async callback return type define
Xia, Chenbo
chenbo.xia at intel.com
Mon Jul 27 14:52:45 CEST 2020
> -----Original Message-----
> From: Fu, Patrick <patrick.fu at intel.com>
> Sent: Thursday, July 23, 2020 1:39 PM
> To: dev at dpdk.org; maxime.coquelin at redhat.com; Xia, Chenbo
> <chenbo.xia at intel.com>
> Cc: Fu, Patrick <patrick.fu at intel.com>
> Subject: [PATCH v1] vhost: fix async callback return type define
>
> From: Patrick Fu <patrick.fu at intel.com>
>
> The async copy device callbacks are used by async APIs to transfer data and
> check completion status. Async APIs return the number of packets successfully
> processed to the caller applications and no error (negative) value is allowed for
> API return value. Thus, negative return values from async device callbacks don't
> have meaningful usage, while adding overhead in checking the return value
> validity. This patch change the callback return values from "int" to "uint32_t" to
> get aligned with async API definition.
>
> Fixes: 78639d54563a ("vhost: introduce async enqueue registration API")
>
> Signed-off-by: Patrick Fu <patrick.fu at intel.com>
> ---
> lib/librte_vhost/rte_vhost_async.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/lib/librte_vhost/rte_vhost_async.h
> b/lib/librte_vhost/rte_vhost_async.h
> index c8ad8dbc7..66d258abe 100644
> --- a/lib/librte_vhost/rte_vhost_async.h
> +++ b/lib/librte_vhost/rte_vhost_async.h
> @@ -59,9 +59,9 @@ struct rte_vhost_async_channel_ops {
> * @param count
> * number of elements in the "descs" array
> * @return
> - * -1 on failure, number of descs processed on success
> + * number of descs processed on success
> */
> - int (*transfer_data)(int vid, uint16_t queue_id,
> + uint32_t (*transfer_data)(int vid, uint16_t queue_id,
> struct rte_vhost_async_desc *descs,
> struct rte_vhost_async_status *opaque_data,
> uint16_t count);
> @@ -70,15 +70,15 @@ struct rte_vhost_async_channel_ops {
> * @param vid
> * id of vhost device to check copy completion
> * @param queue_id
> - * queue id to check copyp completion
> + * queue id to check copy completion
> * @param opaque_data
> * buffer to receive the opaque data pair from DMA engine
> * @param max_packets
> * max number of packets could be completed
> * @return
> - * -1 on failure, number of iov segments completed on success
> + * number of iov segments completed on success
> */
> - int (*check_completed_copies)(int vid, uint16_t queue_id,
> + uint32_t (*check_completed_copies)(int vid, uint16_t queue_id,
> struct rte_vhost_async_status *opaque_data,
> uint16_t max_packets);
> };
> --
> 2.18.4
Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>
More information about the dev
mailing list