From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 1B3CA7CBA for ; Fri, 29 Dec 2017 10:29:12 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Dec 2017 01:29:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,475,1508828400"; d="scan'208";a="15934416" Received: from dpdk-xiao-1.sh.intel.com ([10.67.110.153]) by orsmga003.jf.intel.com with ESMTP; 29 Dec 2017 01:29:10 -0800 From: Xiao Wang 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 Date: Fri, 29 Dec 2017 10:05:01 -0800 Message-Id: <1514570702-154906-4-git-send-email-xiao.w.wang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1514570702-154906-1-git-send-email-xiao.w.wang@intel.com> References: <1514570702-154906-1-git-send-email-xiao.w.wang@intel.com> Subject: [dpdk-dev] [PATCH RFC 3/4] vhost: get all callfd before setting datapath X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Dec 2017 09:29:13 -0000 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 --- 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