DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Pai G, Sunil" <sunil.pai.g@intel.com>
To: "Wang, YuanX" <yuanx.wang@intel.com>,
	"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
	"Xia, Chenbo" <chenbo.xia@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Hu, Jiayu" <jiayu.hu@intel.com>,
	"Ding, Xuan" <xuan.ding@intel.com>,
	"Yang, YvonneX" <yvonnex.yang@intel.com>
Subject: RE: [RFC v2 1/2] vhost: support clear in-flight packets for async dequeue
Date: Mon, 28 Mar 2022 06:08:13 +0000	[thread overview]
Message-ID: <DM8PR11MB5605BBB7823EDC7D741F3333BD1D9@DM8PR11MB5605.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220311173414.93216-2-yuanx.wang@intel.com>

Hi Yuan,

Thanks for the patch, comment inline.

> +uint16_t
> +rte_vhost_clear_queue(int vid, uint16_t queue_id, struct rte_mbuf **pkts,
> +		uint16_t count, int16_t dma_id, uint16_t vchan_id) {
> +	struct virtio_net *dev = get_device(vid);
> +	struct vhost_virtqueue *vq;
> +	uint16_t n_pkts_cpl = 0;
> +
> +	if (!dev)
> +		return 0;
> +
> +	VHOST_LOG_DATA(DEBUG, "(%s) %s\n", dev->ifname, __func__);
> +	if (unlikely(queue_id >= dev->nr_vring)) {
> +		VHOST_LOG_DATA(ERR, "(%s) %s: invalid virtqueue idx %d.\n",
> +			dev->ifname, __func__, queue_id);
> +		return 0;
> +	}
> +
> +	vq = dev->virtqueue[queue_id];
> +

I think the following checks must be protected by spinlock.
Similar to : https://patches.dpdk.org/project/dpdk/patch/20220328020754.1155063-1-jiayu.hu@intel.com/ 

> +	if (unlikely(!vq->async)) {
> +		VHOST_LOG_DATA(ERR, "(%s) %s: async not registered for queue
> id %d.\n",
> +			dev->ifname, __func__, queue_id);
> +		return 0;
> +	}
> +
> +	if (unlikely(!dma_copy_track[dma_id].vchans ||
> +
> 	!dma_copy_track[dma_id].vchans[vchan_id].pkts_cmpl_flag_addr)) {
> +		VHOST_LOG_DATA(ERR, "(%s) %s: invalid channel %d:%u.\n", dev-
> >ifname, __func__,
> +				dma_id, vchan_id);
> +		return 0;
> +	}
> +
> +	if (!rte_spinlock_trylock(&vq->access_lock)) {
> +		VHOST_LOG_DATA(ERR,
> +			"(%d) %s: failed to clear async queue id %d, virtqueue
> busy.\n",
> +			dev->vid, __func__, queue_id);
> +		return 0;
> +	}
> +

<snipped>

Thanks and regards,
Sunil

  reply	other threads:[~2022-03-28  6:08 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 ` [RFC 2/2] example/vhost: support to " Yuan Wang
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 [this message]
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=DM8PR11MB5605BBB7823EDC7D741F3333BD1D9@DM8PR11MB5605.namprd11.prod.outlook.com \
    --to=sunil.pai.g@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=jiayu.hu@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=xuan.ding@intel.com \
    --cc=yuanx.wang@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).