[dpdk-dev] [PATCH v2 1/4] vhost: support async dequeue for split ring
Jiang, Cheng1
cheng1.jiang at intel.com
Mon Sep 27 08:33:54 CEST 2021
Hi Wenwu,
Comments are inline.
> -----Original Message-----
> From: Ma, WenwuX <wenwux.ma at intel.com>
> Sent: Saturday, September 18, 2021 3:27 AM
> To: dev at dpdk.org
> Cc: maxime.coquelin at redhat.com; Xia, Chenbo <chenbo.xia at intel.com>;
> Jiang, Cheng1 <cheng1.jiang at intel.com>; Hu, Jiayu <jiayu.hu at intel.com>;
> Pai G, Sunil <sunil.pai.g at intel.com>; Yang, YvonneX
> <yvonnex.yang at intel.com>; Wang, YuanX <yuanx.wang at intel.com>; Ma,
> WenwuX <wenwux.ma at intel.com>; Wang, Yinan <yinan.wang at intel.com>
> Subject: [PATCH v2 1/4] vhost: support async dequeue for split ring
>
> From: Yuan Wang <yuanx.wang at intel.com>
>
> This patch implements asynchronous dequeue data path for split ring.
> A new asynchronous dequeue function is introduced. With this function, the
> application can try to receive packets from the guest with offloading copies
> to the async channel, thus saving precious CPU cycles.
>
> Signed-off-by: Yuan Wang <yuanx.wang at intel.com>
> Signed-off-by: Jiayu Hu <jiayu.hu at intel.com>
> Signed-off-by: Wenwu Ma <wenwux.ma at intel.com>
> Tested-by: Yinan Wang <yinan.wang at intel.com>
> Tested-by: Yvonne Yang <yvonnex.yang at intel.com>
> ---
> doc/guides/prog_guide/vhost_lib.rst | 9 +
> lib/vhost/rte_vhost_async.h | 33 +-
> lib/vhost/version.map | 3 +
> lib/vhost/vhost.h | 3 +-
> lib/vhost/virtio_net.c | 530 ++++++++++++++++++++++++++++
> 5 files changed, 575 insertions(+), 3 deletions(-)
>
> diff --git a/doc/guides/prog_guide/vhost_lib.rst
> b/doc/guides/prog_guide/vhost_lib.rst
> index 171e0096f6..9ed544db7a 100644
> --- a/doc/guides/prog_guide/vhost_lib.rst
> +++ b/doc/guides/prog_guide/vhost_lib.rst
> @@ -303,6 +303,15 @@ The following is an overview of some key Vhost API
> functions:
> Clear inflight packets which are submitted to DMA engine in vhost async
> data
> path. Completed packets are returned to applications through ``pkts``.
>
> +* ``rte_vhost_async_try_dequeue_burst(vid, queue_id, mbuf_pool, pkts,
> +count, nr_inflight)``
> +
> + This function tries to receive packets from the guest with offloading
> + copies to the async channel. The packets that are transfer completed
> + are returned in ``pkts``. The other packets that their copies are
> + submitted to the async channel but not completed are called "in-flight
> packets".
> + This function will not return in-flight packets until their copies
> + are completed by the async channel.
> +
> Vhost-user Implementations
> --------------------------
>
> diff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h index
> ad71555a7f..973efa19b1 100644
> --- a/lib/vhost/rte_vhost_async.h
> +++ b/lib/vhost/rte_vhost_async.h
> @@ -84,11 +84,12 @@ struct rte_vhost_async_channel_ops { };
>
> /**
> - * inflight async packet information
> + * in-flight async packet information
> */
> struct async_inflight_info {
> struct rte_mbuf *mbuf;
> - uint16_t descs; /* num of descs inflight */
> + struct virtio_net_hdr nethdr;
> + uint16_t descs; /* num of descs in-flight */
> uint16_t nr_buffers; /* num of buffers inflight for packed ring */ };
>
> @@ -255,5 +256,33 @@ int rte_vhost_async_get_inflight(int vid, uint16_t
> queue_id); __rte_experimental uint16_t
> rte_vhost_clear_queue_thread_unsafe(int vid, uint16_t queue_id,
> struct rte_mbuf **pkts, uint16_t count);
Blank line is needed here.
> +/**
> + * This function tries to receive packets from the guest with
> +offloading
> + * copies to the async channel. The packets that are transfer completed
> + * are returned in "pkts". The other packets that their copies are
> +submitted to
> + * the async channel but not completed are called "in-flight packets".
> + * This function will not return in-flight packets until their copies
> +are
> + * completed by the async channel.
> + *
> + * @param vid
> + * id of vhost device to dequeue data
The Initials should be in uppercase. The following also needs to be changed.
> + * @param queue_id
> + * queue id to dequeue data
Should be 'ID of virtqueue ......'.
Thanks,
Cheng
> + * @param mbuf_pool
> + * mbuf_pool where host mbuf is allocated.
> + * @param pkts
> + * blank array to keep successfully dequeued packets
> + * @param count
> + * size of the packet array
> + * @param nr_inflight
> + * the amount of in-flight packets. If error occurred, its value is set to -1.
> + * @return
> + * num of successfully dequeued packets */ __rte_experimental
> +uint16_t rte_vhost_async_try_dequeue_burst(int vid, uint16_t queue_id,
> + struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t
> count,
> + int *nr_inflight);
>
> #endif /* _RTE_VHOST_ASYNC_H_ */
> diff --git a/lib/vhost/version.map b/lib/vhost/version.map index
> c92a9d4962..1e033ad8e2 100644
> --- a/lib/vhost/version.map
> +++ b/lib/vhost/version.map
> @@ -85,4 +85,7 @@ EXPERIMENTAL {
> rte_vhost_async_channel_register_thread_unsafe;
> rte_vhost_async_channel_unregister_thread_unsafe;
> rte_vhost_clear_queue_thread_unsafe;
> +
> + # added in 21.11
> + rte_vhost_async_try_dequeue_burst;
> };
More information about the dev
mailing list