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 49149A034C; Mon, 28 Mar 2022 10:03:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D314F428CF; Mon, 28 Mar 2022 10:02:15 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 9F480428CE for ; Mon, 28 Mar 2022 10:02:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648454533; x=1679990533; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0LUUAg0BjZY4nCoILL6MvUAVDXEP8UNje30DYtnOsfA=; b=RVr8KGnlye7RTaaWLnVWT2mRPWZOmVCOBmtZ8HrZ7pPRodZ8CjjqAmaO MJ/fxl6PuCH/xoIOCOy3VHUHYhvWbGeZPUl+zw5XhBdTusZd+yjmoM2GS reu76nHT4n9KmL+zDn2gPIUw/7FGxwzvMw+nPAYw13n3gJaqeKoMbsyA3 yzkNZAB9EQ+eJ45wRMUdzAcc6LBbA30HTXjHzMz2lhq1g2X94ejPJk1+M UL6VWtUdKfxktPJGJkK6NWZGnxG+K8McQGX+IQs4jDNgVI8xG58gx9m+S 9yYAuviMTAGOL+SzTV+wbsmf8N46nYD5Vl9L8rlBP5wDLtLAqEXDhULzH A==; X-IronPort-AV: E=McAfee;i="6200,9189,10299"; a="256515805" X-IronPort-AV: E=Sophos;i="5.90,216,1643702400"; d="scan'208";a="256515805" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 01:02:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,216,1643702400"; d="scan'208";a="563421956" Received: from dpdk-dipei.sh.intel.com ([10.67.110.238]) by orsmga008.jf.intel.com with ESMTP; 28 Mar 2022 01:02:11 -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 v5 16/16] vhost: make sure each queue callfd is configured Date: Mon, 28 Mar 2022 15:17:42 +0800 Message-Id: <1648451862-123318-17-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1648451862-123318-1-git-send-email-andy.pei@intel.com> References: <1643093258-47258-2-git-send-email-andy.pei@intel.com> <1648451862-123318-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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 55e8bd0..43154c0 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -3197,12 +3197,26 @@ 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 { + /* when VIRTIO_DEV_VDPA_CONFIGURED already configured + * close the device and config the device again, + * make sure the call fd of each queue is configured 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