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 C6EFEA0581; Wed, 19 Oct 2022 11:32:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7FFC42B8D; Wed, 19 Oct 2022 11:32:05 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id C78A942829 for ; Wed, 19 Oct 2022 11:32:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666171921; x=1697707921; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ZMIlW8JXsohCcENN7Y1SM460927jttCpnKUWXdptV7U=; b=PZDxTX3IcBfZCRza9u2mDhtXBQ/NHVZkO1y3THARzMwDgl7nBJkhzwsq 5/ky7s0TvAWWE7UeMZN+I2rU2w87J6nRwN5Jem3s5BWLx1hjYMFt2MPFi kFaClh8uWcqKgPcw7i8pynodTsuPcP7iwY+hCmbeL1nwYFKjrb5f76vik q2VFoYT3O4Ib7GC1BodEtNLu8aU7wcgOrJLoyPUJoeAZPhljVQCecajnU bdMt5Npg0LR6TAucC9Aj2JT5Eg78CGjerxQmBu8CnueBhtKq9fs0lB+M2 Kful4JOTHd5II9GSqrxgkLm1DYU5KAgzo0nJdoRcadj0M4/z4OoZjl/ot Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="303976956" X-IronPort-AV: E=Sophos;i="5.95,195,1661842800"; d="scan'208";a="303976956" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 02:32:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="771691060" X-IronPort-AV: E=Sophos;i="5.95,195,1661842800"; d="scan'208";a="771691060" Received: from dpdk-dipei.sh.intel.com ([10.67.110.251]) by fmsmga001.fm.intel.com with ESMTP; 19 Oct 2022 02:31:59 -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 v9 12/12] vhost: improve vDPA blk device configure condition Date: Wed, 19 Oct 2022 16:41:24 +0800 Message-Id: <1666168884-104665-13-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666168884-104665-1-git-send-email-andy.pei@intel.com> References: <1661229305-240952-2-git-send-email-andy.pei@intel.com> <1666168884-104665-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 Reviewed-by: Chenbo Xia Reviewed-by: Maxime Coquelin --- 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 e0ff79d..9902ae9 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2972,6 +2972,7 @@ static int is_vring_iotlb(struct virtio_net *dev, bool handled; uint32_t request; uint32_t i; + uint16_t blk_call_fd; dev = get_device(vid); if (dev == NULL) @@ -3181,9 +3182,15 @@ static int is_vring_iotlb(struct virtio_net *dev, if (!vdpa_dev) goto out; - if (vdpa_dev->type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK - && request != VHOST_USER_SET_VRING_CALL) - goto out; + if (vdpa_dev->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