DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuan Wang <yuanx.wang@intel.com>
To: maxime.coquelin@redhat.com, chenbo.xia@intel.com
Cc: dev@dpdk.org, jiayu.hu@intel.com, xuan.ding@intel.com,
	wenwux.ma@intel.com, yvonnex.yang@intel.com,
	yuanx.wang@intel.com
Subject: [RFC 2/2] example/vhost: support to clear in-flight packets for async dequeue
Date: Mon, 17 Jan 2022 13:28:47 +0000	[thread overview]
Message-ID: <20220117132847.884998-3-yuanx.wang@intel.com> (raw)
In-Reply-To: <20220117132847.884998-1-yuanx.wang@intel.com>

This patch allows vhost_clear_queue_thread_unsafe() to clear
in-flight dequeue packets.

Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
---
 examples/vhost/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 04a85262bc..050f983fd6 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1495,6 +1495,7 @@ vhost_clear_queue_thread_unsafe(struct vhost_dev *vdev, uint16_t queue_id)
 	uint16_t n_pkt = 0;
 	uint16_t dma_id = dma_bind[vid2socketid[vdev->vid]].dmas[queue_id].dev_id;
 	struct rte_mbuf *m_enq_cpl[vdev->pkts_enq_inflight];
+	struct rte_mbuf *m_deq_cpl[vdev->pkts_deq_inflight];
 
 	if (queue_id % 2 == 0) {
 		while (vdev->pkts_enq_inflight) {
@@ -1503,6 +1504,13 @@ vhost_clear_queue_thread_unsafe(struct vhost_dev *vdev, uint16_t queue_id)
 			free_pkts(m_enq_cpl, n_pkt);
 			__atomic_sub_fetch(&vdev->pkts_enq_inflight, n_pkt, __ATOMIC_SEQ_CST);
 		}
+	} else {
+		while (vdev->pkts_deq_inflight) {
+			n_pkt = rte_vhost_clear_queue_thread_unsafe(vdev->vid,
+				queue_id, m_deq_cpl, vdev->pkts_deq_inflight, dma_id, 0);
+			free_pkts(m_deq_cpl, n_pkt);
+			__atomic_sub_fetch(&vdev->pkts_deq_inflight, n_pkt, __ATOMIC_SEQ_CST);
+		}
 	}
 }
 
-- 
2.25.1


  parent reply	other threads:[~2022-01-17  5:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 13:28 [RFC 0/2] support to clear in-flight packets for async Yuan Wang
2022-01-17 13:28 ` [RFC 1/2] vhost: support clear in-flight packets for async dequeue Yuan Wang
2022-01-17 13:28 ` Yuan Wang [this message]
2022-03-11 17:34 ` [RFC v2 0/2] support to clear in-flight packets for async Yuan Wang
2022-03-11 17:34   ` [RFC v2 1/2] vhost: support clear in-flight packets for async dequeue Yuan Wang
2022-03-28  6:08     ` Pai G, Sunil
2022-03-29  9:51       ` Wang, YuanX
2022-03-11 17:34   ` [RFC v2 2/2] example/vhost: support to " Yuan Wang

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=20220117132847.884998-3-yuanx.wang@intel.com \
    --to=yuanx.wang@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=jiayu.hu@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=wenwux.ma@intel.com \
    --cc=xuan.ding@intel.com \
    --cc=yvonnex.yang@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).