From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 86C18A00C2; Thu, 13 Oct 2022 10:48:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1CE2C42E00; Thu, 13 Oct 2022 10:48:17 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id BA51A42E02 for ; Thu, 13 Oct 2022 10:48:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665650895; x=1697186895; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=vs8cEPzeyHZY5bInJ0IrevkdQ1NPCBS+BQo02AyJ6hA=; b=CTiCovWI+bvzoajLf3Iu9KDV6ieHhSxyk2W23hD6/XRRgtUGYsJE4mP0 Yk03E3XGIKOMPEMomoTZVl2DcFCNEx5Ax/GEdwAJfRNT3CwL3eQl/zyCR Htfd8hxEqUhtFZe1jkUZezumkRucGx6cLscXkYUG5era8yoDr7VobGrB3 +kN2CTFcIOMhML/5BlT6BBdugYxDUc+cPW2Qt1NKK9kWEHQGa77aD2Bs3 gjOd69Q3DNNEGtOzLvY2x7YSekA+dC3xS9DewdoJPVJD0dauvsMFtbHue eyPhloEILjJ3vYwcUvWy0slq+jRJTsUx2Gef/e6Y+F9aHjfEUrHYXciAh g==; X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="288292730" X-IronPort-AV: E=Sophos;i="5.95,180,1661842800"; d="scan'208";a="288292730" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2022 01:48:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="658100494" X-IronPort-AV: E=Sophos;i="5.95,180,1661842800"; d="scan'208";a="658100494" Received: from dpdk-dipei.sh.intel.com ([10.67.110.251]) by orsmga008.jf.intel.com with ESMTP; 13 Oct 2022 01:48:12 -0700 From: Andy Pei To: dev@dpdk.org Cc: chenbo.xia@intel.com, rosen.xu@intel.com, wei.huang@intel.com, gang.cao@intel.com, maxime.coquelin@redhat.com Subject: [PATCH v4 8/8] vhost: improve vDPA blk device configure condition Date: Thu, 13 Oct 2022 16:44:34 +0800 Message-Id: <1665650674-291949-9-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1665650674-291949-1-git-send-email-andy.pei@intel.com> References: <1661229305-240952-2-git-send-email-andy.pei@intel.com> <1665650674-291949-1-git-send-email-andy.pei@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org To support multi-queue, configure device after call fd of all queues are set. Signed-off-by: Andy Pei Signed-off-by: Huang Wei --- lib/vhost/vhost_user.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 0509025..3ede83f 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2965,6 +2965,7 @@ static int is_vring_iotlb(struct virtio_net *dev, uint32_t vdpa_type = -1; uint32_t request; uint32_t i; + uint16_t blk_call_fd; dev = get_device(vid); if (dev == NULL) @@ -3191,9 +3192,15 @@ static int is_vring_iotlb(struct virtio_net *dev, if (!vdpa_dev) goto out; - if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK - && request != VHOST_USER_SET_VRING_CALL) - goto out; + if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK) { + if (request == VHOST_USER_SET_VRING_CALL) { + blk_call_fd = ctx.msg.payload.u64 & VHOST_USER_VRING_IDX_MASK; + if (blk_call_fd != dev->nr_vring - 1) + goto out; + } else { + goto out; + } + } if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) { if (vdpa_dev->ops->dev_conf(dev->vid)) -- 1.8.3.1