DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiao Wang <xiao.w.wang@intel.com>
To: dev@dpdk.org
Cc: zhihong.wang@intel.com, jianfeng.tan@intel.com,
	tiwei.bie@intel.com, maxime.coquelin@redhat.com,
	yliu@fridaylinux.org, cunming.liang@intel.com,
	dan.daly@intel.com, remy.horton@intel.com,
	mohammad.abdul.awal@intel.com, Xiao Wang <xiao.w.wang@intel.com>
Subject: [dpdk-dev] [PATCH RFC 3/4] vhost: get all callfd before setting datapath
Date: Fri, 29 Dec 2017 10:05:01 -0800	[thread overview]
Message-ID: <1514570702-154906-4-git-send-email-xiao.w.wang@intel.com> (raw)
In-Reply-To: <1514570702-154906-1-git-send-email-xiao.w.wang@intel.com>

vDPA device driver will need callfd to setup device VFIO interrupt.
Looking at QEMU vhost message sequence, the real callfd comes after
the other vring messages and just before SET_VRING_ENABLE.

This patch is to make sure we configure device only when all the
guest information is in hand.

Note: virtio-user's vhost message sequence is slightly different from
QEMU, it has no SET_VRING_ENABLE in the ending. So this patch is not
applicable to virtio-user. We could align virtio-user's message
sequence to QEMU in future to address this issue.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 lib/librte_vhost/vhost_user.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 51e6443..65d52bd 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -1404,7 +1404,9 @@
 		send_vhost_reply(fd, &msg);
 	}
 
-	if (!(dev->flags & VIRTIO_DEV_RUNNING) && virtio_is_ready(dev)) {
+	if (msg.request.master == VHOST_USER_SET_VRING_ENABLE &&
+			!(dev->flags & VIRTIO_DEV_RUNNING) &&
+			virtio_is_ready(dev)) {
 		dev->flags |= VIRTIO_DEV_READY;
 
 		if (!(dev->flags & VIRTIO_DEV_RUNNING)) {
-- 
1.8.3.1

  parent reply	other threads:[~2017-12-29  9:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29 18:04 [dpdk-dev] [PATCH RFC 0/4] examples/vdpa: add virtio-net PCI device driver Xiao Wang
2017-12-29 18:04 ` [dpdk-dev] [PATCH RFC 1/4] bus/pci: expose PCI API to app Xiao Wang
2017-12-29 18:05 ` [dpdk-dev] [PATCH RFC 2/4] vhost: expose vhost lib " Xiao Wang
2017-12-29 18:05 ` Xiao Wang [this message]
2017-12-29 18:05 ` [dpdk-dev] [PATCH RFC 4/4] examples/vdpa: add virtio-net PCI device driver Xiao 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=1514570702-154906-4-git-send-email-xiao.w.wang@intel.com \
    --to=xiao.w.wang@intel.com \
    --cc=cunming.liang@intel.com \
    --cc=dan.daly@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mohammad.abdul.awal@intel.com \
    --cc=remy.horton@intel.com \
    --cc=tiwei.bie@intel.com \
    --cc=yliu@fridaylinux.org \
    --cc=zhihong.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
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).