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 9C6CCA0093; Tue, 23 Aug 2022 07:25:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04329427EC; Tue, 23 Aug 2022 07:25:00 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 7BE664282D for ; Tue, 23 Aug 2022 07:24:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661232298; x=1692768298; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=5AXOpeePn1UowgYWzlVi6v5rkeYV+FgRpf/ICfZ+F4U=; b=JHuxwm6vznsDGceqjU6BJNZcfxaIfOry9Ez/Lvm+JaV54Cl2RgFgh9Up wB8+VJZtOuxDW1yoTjZ0it+ghhGbt3R1xn8DJrquOLtOj4Ut2ECDAoqnZ SWpIzJEKo4l1VuuTqcG3ecJw+mattWAt3rcq/MMhEpvgzrzSI8O4ZF1Jq rGVzBXZwudKLWMgmspSOLtlolsG38eRO3/DUugJFOee2m/WBB2wYeOYyy vetRmDufAwg5RszDx2F7FDl0+cSFeaekUzJj23fddtBNYJ27hnyK8AbgS maOLiWux74lYAEiFY6Zq2azr/Avj+H2RACCKBry5fGpNhbDFl7GzI6wjF g==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="355325322" X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="355325322" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2022 22:24:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="669864781" Received: from dpdk-dipei.sh.intel.com ([10.67.110.251]) by fmsmga008.fm.intel.com with ESMTP; 22 Aug 2022 22:24:56 -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 6/8] vdpa/ifc: set vring state callback update data path Date: Tue, 23 Aug 2022 12:35:03 +0800 Message-Id: <1661229305-240952-7-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1661229305-240952-1-git-send-email-andy.pei@intel.com> References: <1661229305-240952-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, in the case that first queue is ready and device is configured, when more queues need to be configured, we just close and restart data path. This also fix the situation that using set_vring_state callback to disable one queue will cause all vfio interrupts being disabled. Signed-off-by: Andy Pei --- drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index a62bcec..94c8ef1 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1286,8 +1286,6 @@ struct rte_vdpa_dev_info { struct internal_list *list; struct ifcvf_internal *internal; struct ifcvf_hw *hw; - struct ifcvf_pci_common_cfg *cfg; - int ret = 0; vdev = rte_vhost_get_vdpa_device(vid); list = find_internal_resource_by_vdev(vdev); @@ -1303,27 +1301,20 @@ struct rte_vdpa_dev_info { } hw = &internal->hw; - if (!internal->configured) - goto exit; - cfg = hw->common_cfg; - IFCVF_WRITE_REG16(vring, &cfg->queue_select); - IFCVF_WRITE_REG16(!!state, &cfg->queue_enable); + hw->vring[vring].enable = !!state; - if (!state && hw->vring[vring].enable) { - ret = vdpa_disable_vfio_intr(internal); - if (ret) - return ret; - } + if (!internal->configured) + goto exit; - if (state && !hw->vring[vring].enable) { - ret = vdpa_enable_vfio_intr(internal, false); - if (ret) - return ret; - } + /* close data path */ + rte_atomic32_set(&internal->dev_attached, 0); + update_datapath(internal); + /* restart data path */ + rte_atomic32_set(&internal->dev_attached, 1); + update_datapath(internal); exit: - hw->vring[vring].enable = !!state; return 0; } -- 1.8.3.1