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 D916AA04A9; Tue, 25 Jan 2022 07:54:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7C60642837; Tue, 25 Jan 2022 07:54:04 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id E82F94282D for ; Tue, 25 Jan 2022 07:54:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643093643; x=1674629643; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=iiC9zjPCRWSFSUr3n/L661D8aNJGk/y8rMEVaa6naFk=; b=SurbhJvXfTc6Me3731VZ5XA34asgpzqkvQyVsaAAYxTdIA4pgSvJMmnR QMNbUKRsZ579L0Mn7YLD5eXCaMtipF2snvzPwG1Gn87L+7C5CuBgBE10q r92W/m0tPr4qmjoYyZRfxjKppgt20gOBL4HyCR9CksI4pXsVn3ib7Wd12 Is29LcQDxpEi+xDqjsSvoO0yiqJpKUduNHFCSzx2GxCq5G54hzorgfu2t B6XoKuCp7trb24Ds0jOOz1KDeammV11SrpRWHX5jM1n1BOEnQFulXbRsZ zy/7rMqfsOK7fyNOmJwgRRbiiI9DpZRmnfwJlUfPWbuvl3yd2XSuK6QSd A==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="246181375" X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="246181375" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 22:53:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="695724385" Received: from dpdk-dipei.sh.intel.com ([10.67.111.91]) by orsmga005.jf.intel.com with ESMTP; 24 Jan 2022 22:53:46 -0800 From: Andy Pei To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com, changpeng.liu@intel.com Subject: [PATCH 15/15] vhost: make sure each queue callfd is configured Date: Tue, 25 Jan 2022 14:47:38 +0800 Message-Id: <1643093258-47258-16-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1643093258-47258-1-git-send-email-andy.pei@intel.com> References: <1643093258-47258-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 During the vhost data path building process, qemu will create a call fd at first, and create another call fd in the end. The final call fd will be used to relay notify. In the original code, after kick fd is set, dev_conf will set the first call fd. Even though the actual call fd will set, the data path will not work correctly. Signed-off-by: Andy Pei --- lib/vhost/vhost_user.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 5eb1dd6..0be879a 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -3137,12 +3137,27 @@ typedef int (*vhost_message_handler_t)(struct virtio_net **pdev, if (!vdpa_dev) goto out; + if (request != VHOST_USER_SET_VRING_CALL) + goto out; + if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) { if (vdpa_dev->ops->dev_conf(dev->vid)) VHOST_LOG_CONFIG(ERR, "Failed to configure vDPA device\n"); else dev->flags |= VIRTIO_DEV_VDPA_CONFIGURED; + } else { + /** + ** when VIRTIO_DEV_VDPA_CONFIGURED already configured + ** close the device and config the device again, + ** make sure the call fd of each queue is configed correctly. + **/ + if (vdpa_dev->ops->dev_close(dev->vid)) + VHOST_LOG_CONFIG(ERR, + "Failed to close vDPA device\n"); + if (vdpa_dev->ops->dev_conf(dev->vid)) + VHOST_LOG_CONFIG(ERR, + "Failed to re-config vDPA device\n"); } out: -- 1.8.3.1