DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Hu, Jiayu" <jiayu.hu@intel.com>
To: "Wang, YuanX" <yuanx.wang@intel.com>,
	"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
	"Xia, Chenbo" <chenbo.xia@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Ding, Xuan" <xuan.ding@intel.com>,
	"Pai G, Sunil" <sunil.pai.g@intel.com>
Subject: RE: [PATCH v5 2/2] example/vhost: support to clear in-flight packets for async dequeue
Date: Tue, 14 Jun 2022 23:56:39 +0000
Message-ID: <39e6cea169af4ccfafa97bd74d6af739@intel.com> (raw)
In-Reply-To: <20220609173404.1769210-3-yuanx.wang@intel.com>

Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>

Thanks,
Jiayu

> -----Original Message-----
> From: Wang, YuanX <yuanx.wang@intel.com>
> Sent: Friday, June 10, 2022 1:34 AM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>;
> dev@dpdk.org
> Cc: Hu, Jiayu <jiayu.hu@intel.com>; Ding, Xuan <xuan.ding@intel.com>; Pai
> G, Sunil <sunil.pai.g@intel.com>; Wang, YuanX <yuanx.wang@intel.com>
> Subject: [PATCH v5 2/2] example/vhost: support to clear in-flight packets for
> async dequeue
> 
> This patch allows vring_state_changed() to clear in-flight dequeue packets. It
> also clears the in-flight packets in a thread-safe way in destroy_device().
> 
> Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> ---
>  examples/vhost/main.c | 26 +++++++++++++++++++++-----
>  1 file changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c index
> e7fee5aa1b..a679ef738c 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -1543,6 +1543,25 @@ vhost_clear_queue_thread_unsafe(struct
> vhost_dev *vdev, uint16_t queue_id)
>  	}
>  }
> 
> +static void
> +vhost_clear_queue(struct vhost_dev *vdev, uint16_t queue_id) {
> +	uint16_t n_pkt = 0;
> +	int pkts_inflight;
> +
> +	int16_t dma_id = dma_bind[vid2socketid[vdev-
> >vid]].dmas[queue_id].dev_id;
> +	pkts_inflight = rte_vhost_async_get_inflight(vdev->vid, queue_id);
> +
> +	struct rte_mbuf *m_cpl[pkts_inflight];
> +
> +	while (pkts_inflight) {
> +		n_pkt = rte_vhost_clear_queue(vdev->vid, queue_id, m_cpl,
> +						pkts_inflight, dma_id, 0);
> +		free_pkts(m_cpl, n_pkt);
> +		pkts_inflight = rte_vhost_async_get_inflight(vdev->vid,
> queue_id);
> +	}
> +}
> +
>  /*
>   * Remove a device from the specific data core linked list and from the
>   * main linked list. Synchronization  occurs through the use of the @@ -
> 1600,13 +1619,13 @@ destroy_device(int vid)
>  		vdev->vid);
> 
>  	if (dma_bind[vid].dmas[VIRTIO_RXQ].async_enabled) {
> -		vhost_clear_queue_thread_unsafe(vdev, VIRTIO_RXQ);
> +		vhost_clear_queue(vdev, VIRTIO_RXQ);
>  		rte_vhost_async_channel_unregister(vid, VIRTIO_RXQ);
>  		dma_bind[vid].dmas[VIRTIO_RXQ].async_enabled = false;
>  	}
> 
>  	if (dma_bind[vid].dmas[VIRTIO_TXQ].async_enabled) {
> -		vhost_clear_queue_thread_unsafe(vdev, VIRTIO_TXQ);
> +		vhost_clear_queue(vdev, VIRTIO_TXQ);
>  		rte_vhost_async_channel_unregister(vid, VIRTIO_TXQ);
>  		dma_bind[vid].dmas[VIRTIO_TXQ].async_enabled = false;
>  	}
> @@ -1765,9 +1784,6 @@ vring_state_changed(int vid, uint16_t queue_id, int
> enable)
>  	if (!vdev)
>  		return -1;
> 
> -	if (queue_id != VIRTIO_RXQ)
> -		return 0;
> -
>  	if (dma_bind[vid2socketid[vid]].dmas[queue_id].async_enabled) {
>  		if (!enable)
>  			vhost_clear_queue_thread_unsafe(vdev, queue_id);
> --
> 2.25.1


  parent reply	other threads:[~2022-06-14 23:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 18:27 [PATCH 0/2] support to clear in-flight packets for async Yuan Wang
2022-04-13 18:27 ` [PATCH 1/2] vhost: support clear in-flight packets for async dequeue Yuan Wang
2022-04-13 18:27 ` [PATCH 2/2] example/vhost: support to " Yuan Wang
2022-05-13 16:35 ` [PATCH v2 0/2] support to clear in-flight packets for async Yuan Wang
2022-05-13 16:35   ` [PATCH v2 1/2] vhost: support clear in-flight packets for async dequeue Yuan Wang
2022-05-13 16:35   ` [PATCH v2 2/2] example/vhost: support to " Yuan Wang
2022-05-23 16:13 ` [PATCH v3 0/2] support to clear in-flight packets for async Yuan Wang
2022-05-23 16:13   ` [PATCH v3 1/2] vhost: support clear in-flight packets for async dequeue Yuan Wang
2022-05-23 16:13   ` [PATCH v3 2/2] example/vhost: support to " Yuan Wang
2022-06-06 17:45 ` [PATCH v4 0/2] support to clear in-flight packets for async Yuan Wang
2022-06-06 17:45   ` [PATCH v4 1/2] vhost: support clear in-flight packets for async dequeue Yuan Wang
2022-06-09  7:06     ` Hu, Jiayu
2022-06-09  7:51       ` Wang, YuanX
2022-06-06 17:45   ` [PATCH v4 2/2] example/vhost: support to " Yuan Wang
2022-06-09 17:34 ` [PATCH v5 0/2] support to clear in-flight packets for async Yuan Wang
2022-06-09 17:34   ` [PATCH v5 1/2] vhost: support clear in-flight packets for async dequeue Yuan Wang
2022-06-14 13:23     ` Maxime Coquelin
2022-06-14 23:56     ` Hu, Jiayu
2022-06-09 17:34   ` [PATCH v5 2/2] example/vhost: support to " Yuan Wang
2022-06-14 13:28     ` Maxime Coquelin
2022-06-14 23:56     ` Hu, Jiayu [this message]
2022-06-17 14:06   ` [PATCH v5 0/2] support to clear in-flight packets for async Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39e6cea169af4ccfafa97bd74d6af739@intel.com \
    --to=jiayu.hu@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=sunil.pai.g@intel.com \
    --cc=xuan.ding@intel.com \
    --cc=yuanx.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git