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 4D167A034C; Sun, 27 Mar 2022 17:37:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B465D428B7; Sun, 27 Mar 2022 17:36:16 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id C8654428AF for ; Sun, 27 Mar 2022 17:36: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=1648395374; x=1679931374; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=S3MLMAqbl75k872rPBUBNw3QcbfpkBVyzIwi/QB+q8M=; b=WNKnvhV7Zz5cMzhoy93ypzuRBkg5L3mWFHiJuzqdAfmZl6dKZyJlGne8 QGjmW6HrdvRWylTHj1+XacxWP5F86n2kxtCxPe03lemCiqmK9MpP1fjmh 1Wl4heho7QcbIE6h0qa59lfC/lZxUx0hg8VU5u65BCBjBZWX/Ybz7qyMJ oayhxcZ2Bt4R8qziZcgM3dvrxaPHhl80KG56swQ6y+aKRGXQ4ELr3xd9j eiKFhCyXoxK9ag2LDTWFreAmF+Jz1Cv9zhhU881hD6g3odWmn3PPz1Vqx rT/yenzuDF/ARvAmzNG96lqAmmz2Wn//fVztTf5qynBNO9SYkfCK7Z+RB A==; X-IronPort-AV: E=McAfee;i="6200,9189,10299"; a="259045680" X-IronPort-AV: E=Sophos;i="5.90,215,1643702400"; d="scan'208";a="259045680" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2022 08:36:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,215,1643702400"; d="scan'208";a="562421622" Received: from dpdk-dipei.sh.intel.com ([10.67.110.238]) by orsmga008.jf.intel.com with ESMTP; 27 Mar 2022 08:36:12 -0700 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 v4 16/16] vhost: make sure each queue callfd is configured Date: Sun, 27 Mar 2022 22:51:39 +0800 Message-Id: <1648392699-60113-17-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1648392699-60113-1-git-send-email-andy.pei@intel.com> References: <1643093258-47258-2-git-send-email-andy.pei@intel.com> <1648392699-60113-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 b11fafd..8c5904f 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -3197,12 +3197,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, "(%s) failed to configure vDPA device\n", dev->ifname); else dev->flags |= VIRTIO_DEV_VDPA_CONFIGURED; + } else { + /** + ** VIRTIO_DEV_VDPA_CONFIGURED already configured + ** close the device and open the device again, + ** make sure the call fd of each queue is configed to haedware. + **/ + 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