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 1097BA0032; Fri, 16 Sep 2022 08:17:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B69942905; Fri, 16 Sep 2022 08:17:10 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 44F97427FF for ; Fri, 16 Sep 2022 08:17:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663309025; x=1694845025; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=84JcuC9nEOG9R2MUbPR9mej/TtQ8fCOuxSx6zuiqGqw=; b=S9AmPhBe0DThWGoYhAHVZjRJfbMLKn0VRWL0Ewk2suGAzSV4xHM2oCU5 Yd1KloWIuKVs4GpbXpohex0JcVxunefMljMwmlM01ZT/fzyBIjLrlZLjR irIepFt3a9da+5yHvPl45SdA4nmuD0jJOE6KfY7P2SirNv8cl7NjOdY3h 2tO+BmNgeBHzi0TnqzVxE9sAbD6UK498kBtee4l19yISCwaeiwmYUO0PE /XN5JjpQQ6h587mUlM9Jpk2yEcF7PFNqGAPoXVQjzHT3h3kt+d0X+PEY9 ZX9LThKvD6xLBYcbUmt2SyB4HwEl6q0OQUMKq/KvmvvNIyfzB45CprcSR g==; X-IronPort-AV: E=McAfee;i="6500,9779,10471"; a="278650960" X-IronPort-AV: E=Sophos;i="5.93,320,1654585200"; d="scan'208";a="278650960" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 23:16:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,320,1654585200"; d="scan'208";a="568724639" Received: from dpdk-dipei.sh.intel.com ([10.67.110.251]) by orsmga003.jf.intel.com with ESMTP; 15 Sep 2022 23:16:38 -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 v3 5/8] vdpa/ifc: only configure enabled queue Date: Fri, 16 Sep 2022 14:16:27 +0800 Message-Id: <1663308990-621-6-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663308990-621-1-git-send-email-andy.pei@intel.com> References: <1661229305-240952-2-git-send-email-andy.pei@intel.com> <1663308990-621-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 when configure the hardware queue, we only configure queues which have been enabled by vhost. Signed-off-by: Andy Pei Signed-off-by: Huang Wei --- drivers/vdpa/ifc/base/ifcvf.c | 3 +++ drivers/vdpa/ifc/ifcvf_vdpa.c | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c index 7efb408..619b034 100644 --- a/drivers/vdpa/ifc/base/ifcvf.c +++ b/drivers/vdpa/ifc/base/ifcvf.c @@ -246,6 +246,9 @@ ifcvf_enable_multiqueue(hw); for (i = 0; i < hw->nr_vring; i++) { + if (!hw->vring[i].enable) + continue; + IFCVF_WRITE_REG16(i, &cfg->queue_select); io_write64_twopart(hw->vring[i].desc, &cfg->queue_desc_lo, &cfg->queue_desc_hi); diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 376239a..b00afdb 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -284,6 +284,8 @@ struct rte_vdpa_dev_info { rte_vhost_get_negotiated_features(vid, &hw->req_features); for (i = 0; i < nr_vring; i++) { + if (!hw->vring[i].enable) + continue; rte_vhost_get_vhost_vring(vid, i, &vq); gpa = hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.desc); if (gpa == 0) { @@ -499,6 +501,8 @@ struct rte_vdpa_dev_info { vring.kickfd = -1; for (qid = 0; qid < q_num; qid++) { + if (!hw->vring[qid].enable) + continue; ev.events = EPOLLIN | EPOLLPRI; rte_vhost_get_vhost_vring(internal->vid, qid, &vring); ev.data.u64 = qid | (uint64_t)vring.kickfd << 32; @@ -1058,6 +1062,8 @@ struct rte_vdpa_dev_info { struct rte_vdpa_device *vdev; struct internal_list *list; struct ifcvf_internal *internal; + struct ifcvf_hw *hw; + uint16_t i; vdev = rte_vhost_get_vdpa_device(vid); list = find_internal_resource_by_vdev(vdev); @@ -1071,11 +1077,17 @@ struct rte_vdpa_dev_info { rte_atomic32_set(&internal->dev_attached, 1); update_datapath(internal); - if (rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, true) != 0) - DRV_LOG(NOTICE, "vDPA (%s): software relay is used.", + hw = &internal->hw; + for (i = 0; i < hw->nr_vring; i++) { + if (!hw->vring[i].enable) + continue; + if (rte_vhost_host_notifier_ctrl(vid, i, true) != 0) + DRV_LOG(NOTICE, "vDPA (%s): software relay is used.", vdev->device->name); + } internal->configured = 1; + DRV_LOG(INFO, "vDPA device %s is configured", vdev->device->name); return 0; } -- 1.8.3.1