vhost: fix async callback return type define
PATCH 1/1 vhost: fix async callback return type define
From: Patrick Fu <[email protected]>
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.
--- lib/librte_vhost/rte_vhost_async.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/librte_vhost/rte_vhost_async.h +5 -5
@@ -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); };
Signature · 1 line
2.18.4
Quoted 63 lines
-----Original Message-----
From: Fu, Patrick <[email protected]>
Sent: Thursday, July 23, 2020 1:39 PM
To: [email protected]; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>
Subject: [PATCH v1] vhost: fix async callback return type defineFrom: Patrick Fu <[email protected]>
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 <[email protected]>--- lib/librte_vhost/rte_vhost_async.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)lib/librte_vhost/rte_vhost_async.h +5
-6@@ -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); }; --
Quoted 1 line
2.18.4
Quoted 23 lines · On 7/23/20 7:39 AM, [email protected] wrote:
From: Patrick Fu <[email protected]>
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 <[email protected]>--- lib/librte_vhost/rte_vhost_async.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)lib/librte_vhost/rte_vhost_async.h +0
-0
lib/librte_vhost/rte_vhost_async.h struct rte_vhost_async_channel_ops { · line 62
Quoted 5 lines
lib/librte_vhost/rte_vhost_async.h +1
-1@@ -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
let's remove on success as in case of failure it will still be the number of descriptors process, i.e. 0.
Quoted 9 lines
lib/librte_vhost/rte_vhost_async.h +1
-1*/ -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
lib/librte_vhost/rte_vhost_async.h struct rte_vhost_async_channel_ops { · line 79
Quoted 10 lines
lib/librte_vhost/rte_vhost_async.h +2
-2* @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
Ditto
lib/librte_vhost/rte_vhost_async.h struct rte_vhost_async_channel_ops { · line 84
Quoted 7 lines
lib/librte_vhost/rte_vhost_async.h +1
-1*/ -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); };
Other than that:
I can fixup the comments while applying if you agree with it.
Thanks,
Maxime
Hi Maxime,
Quoted 26 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, July 28, 2020 5:10 PM
To: Fu, Patrick <[email protected]>; [email protected]; Xia, Chenbo <[email protected]>
Subject: Re: [PATCH v1] vhost: fix async callback return type definelib/librte_vhost/rte_vhost_async.h struct rte_vhost_async_channel_ops { · line 79
Quoted 5 lines · On 7/23/20 7:39 AM, [email protected] wrote:
From: Patrick Fu <[email protected]>
lib/librte_vhost/rte_vhost_async.h +1
-1* @return -* -1 on failure, number of iov segments completed on success +* number of iov segments completed on success Ditto
lib/librte_vhost/rte_vhost_async.h struct rte_vhost_async_channel_ops { · line 84
Quoted 7 lines
lib/librte_vhost/rte_vhost_async.h +1
-1*/ -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); };Other than that:
Quoted 4 lines
Reviewed-by Maxime Coquelin <[email protected]>I can fixup the comments while applying if you agree with it.
Yes, I think removing "on success" is correct there.
Thanks,
Patrick
Maxime Coquelin
AppliedQuoted 11 lines · On 7/23/20 7:39 AM, [email protected] wrote:
From: Patrick Fu <[email protected]>
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.
Quoted 6 lines
Fixes 78639d54563a ("vhost: introduce async enqueue registration API")Signed-off-by Patrick Fu <[email protected]>--- lib/librte_vhost/rte_vhost_async.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Applied to dpdk-next-virtio/master with agreed fixup.
Thanks,
Maxime