From patchwork Tue Aug 23 04:35:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pei, Andy" X-Patchwork-Id: 115345 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1C265A0093; Tue, 23 Aug 2022 07:25:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1186B427F5; Tue, 23 Aug 2022 07:24:57 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 4084442829 for ; Tue, 23 Aug 2022 07:24:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661232295; x=1692768295; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Sc/sPWJi9OSN3YevCIG004RgnfnYrh6TbhSvcoAVYVI=; b=SetI3LK+6kfIckSmBTag4vg33/f1z+M7HA7kQ0pbLklyI/R6UjnID2MF jjkbAwC4RDfvksaWAjoSJf0DCDH14MlCbl8nSYE447h8e87oRM6gKACkv EBlyNU+SoOwyr8UvwebqMUWAgtZXoCzXMNLiBMsERa+/DCK6aKhAA68ll Clztl6rUPBvN3OrCKNAptnoxGB0Cx1wYyQwpUic+FcTPPrPv+5xN6RWeL WWPa2niCrIWVqrwrOKLNzXVtVYJlgWuBjCr5A4rM0zFqqxDnP5Iq7kUEF lIgTsb27N543ZVtQ3rYJ5ITwZqndOA5ULa9nNwyiRzqftdFWfbCnQug19 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="355325316" X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="355325316" 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:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="669864760" Received: from dpdk-dipei.sh.intel.com ([10.67.110.251]) by fmsmga008.fm.intel.com with ESMTP; 22 Aug 2022 22:24:53 -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 5/8] vdpa/ifc: only configure enabled queue Date: Tue, 23 Aug 2022 12:35:02 +0800 Message-Id: <1661229305-240952-6-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 when configure the hardware queue, we only configure queues which have been enabled by vhost. Signed-off-by: Andy Pei --- drivers/vdpa/ifc/base/ifcvf.c | 5 ++++- drivers/vdpa/ifc/ifcvf_vdpa.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c index 1b50df6..ca5f677 100644 --- a/drivers/vdpa/ifc/base/ifcvf.c +++ b/drivers/vdpa/ifc/base/ifcvf.c @@ -230,6 +230,8 @@ ifcvf_enable_multiqueue(hw, hw->nr_vring); 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); @@ -264,7 +266,8 @@ notify_off = IFCVF_READ_REG16(&cfg->queue_notify_off); hw->notify_addr[i] = (void *)((u8 *)hw->notify_base + notify_off * hw->notify_off_multiplier); - IFCVF_WRITE_REG16(1, &cfg->queue_enable); + if (hw->vring[i].enable) + IFCVF_WRITE_REG16(1, &cfg->queue_enable); } return 0; diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 34aea6c..a62bcec 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -290,6 +290,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) { @@ -505,6 +507,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;