[dpdk-dev] [PATCH 1/2] vhost: support to clear in-flight packets for async dequeue
Xia, Chenbo
chenbo.xia at intel.com
Wed Sep 15 09:02:15 CEST 2021
Hi Yuan,
> -----Original Message-----
> From: Wang, YuanX <yuanx.wang at intel.com>
> Sent: Thursday, September 9, 2021 2:58 PM
> To: dev at dpdk.org
> Cc: maxime.coquelin at redhat.com; Xia, Chenbo <chenbo.xia at intel.com>; Pai G,
> Sunil <sunil.pai.g at intel.com>; Hu, Jiayu <jiayu.hu at intel.com>; Ding, Xuan
> <xuan.ding at intel.com>; Jiang, Cheng1 <cheng1.jiang at intel.com>; Ma, WenwuX
> <wenwux.ma at intel.com>; Yang, YvonneX <yvonnex.yang at intel.com>; Wang, YuanX
> <yuanx.wang at intel.com>
> Subject: [PATCH 1/2] vhost: support to clear in-flight packets for async
> dequeue
>
> rte_vhost_clear_queue_thread_unsafe() supports to clear
> in-flight packets for async enqueue only. But after
> supporting async dequeue, this API should support async dequeue too.
>
> Signed-off-by: Yuan Wang <yuanx.wang at intel.com>
> ---
> lib/vhost/virtio_net.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index e0159b53e3..7f6183a929 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -27,6 +27,11 @@
>
> #define VHOST_ASYNC_BATCH_THRESHOLD 32
>
> +static __rte_always_inline uint16_t
> +async_poll_dequeue_completed_split(struct virtio_net *dev,
> + struct vhost_virtqueue *vq, uint16_t queue_id,
> + struct rte_mbuf **pkts, uint16_t count, bool legacy_ol_flags);
> +
> static __rte_always_inline bool
> rxvq_is_mergeable(struct virtio_net *dev)
> {
> @@ -2119,11 +2124,6 @@ rte_vhost_clear_queue_thread_unsafe(int vid, uint16_t
> queue_id,
> return 0;
>
> VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__);
> - if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) {
> - VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n",
> - dev->vid, __func__, queue_id);
> - return 0;
> - }
>
> vq = dev->virtqueue[queue_id];
>
> @@ -2133,7 +2133,11 @@ rte_vhost_clear_queue_thread_unsafe(int vid, uint16_t
> queue_id,
> return 0;
> }
>
> - n_pkts_cpl = vhost_poll_enqueue_completed(dev, queue_id, pkts, count);
> + if ((queue_id % 2) == 0)
You can remove the internal '()'.
> + n_pkts_cpl = vhost_poll_enqueue_completed(dev, queue_id, pkts,
> count);
> + else
> + n_pkts_cpl = async_poll_dequeue_completed_split(dev, vq, queue_id,
> pkts, count,
You should check we are using split queue before entering this split queue function.
Thanks,
Chenbo
> + dev->flags & VIRTIO_DEV_LEGACY_OL_FLAGS);
>
> return n_pkts_cpl;
> }
> --
> 2.25.1
More information about the dev
mailing list