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 E37C7A0548; Thu, 8 Sep 2022 07:53:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB2164282D; Thu, 8 Sep 2022 07:53:28 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 15E7D42802 for ; Thu, 8 Sep 2022 07:53:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662616407; x=1694152407; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=C1qcvZr+v+7XM9BeQOmJS3S3cvFJdhMF6r7Tecu9Mq4=; b=EtapcCDORBmE2W1ioMpJUevuLEfufCkCyG+Kmt0/Nff0rpGe9u4MGE2K AAVxqVZyoSyKcslp2HVLAldHf5J4djTkqoNV6mdmDGpCrx7aernbywn5D SrziyLS9MXxUwu0D90K0GWmCnyHBUF/lrYZH0WvcXbE416ToqDOGnL0vJ rAlWFVmbSD3WhF2QKlKnzm2sGZX/fL+mL+C4UxCZQzX+6XkDoGqiw00De UkIigxwRqdueRqSJptfnoyONv3OqigBJT9la+0UE5UUmkm9hsmx3LyVG7 QGpejTKjbY/xBeeyuXSlpiIFiEtZH/91mlJHGFUIfHsJbwdStAOZzrcej Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10463"; a="277464167" X-IronPort-AV: E=Sophos;i="5.93,299,1654585200"; d="scan'208";a="277464167" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 22:53:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,299,1654585200"; d="scan'208";a="676531818" Received: from dpdk-dipei.sh.intel.com ([10.67.110.251]) by fmsmga008.fm.intel.com with ESMTP; 07 Sep 2022 22:53:25 -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, Huang Wei Subject: [PATCH v2 4/8] vdpa/ifc: write queue count to MQ register Date: Thu, 8 Sep 2022 13:54:14 +0800 Message-Id: <1662616458-164613-5-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1662616458-164613-1-git-send-email-andy.pei@intel.com> References: <1661229305-240952-2-git-send-email-andy.pei@intel.com> <1662616458-164613-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 Write queue count to IFCVF_MQ_OFFSET register to enable multi queue feature. Signed-off-by: Andy Pei Signed-off-by: Huang Wei --- drivers/vdpa/ifc/base/ifcvf.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c index 34c8226..0444d74 100644 --- a/drivers/vdpa/ifc/base/ifcvf.c +++ b/drivers/vdpa/ifc/base/ifcvf.c @@ -198,6 +198,38 @@ IFCVF_WRITE_REG32(val >> 32, hi); } +STATIC void +ifcvf_enable_multiqueue(struct ifcvf_hw *hw) +{ + u8 *mq_cfg; + int qid; + int nr_queue_pair = 0; + + if (hw->device_type == IFCVF_NET) { + for (qid = 0; qid < hw->nr_vring; qid++) { + if (!hw->vring[qid].enable) + continue; + nr_queue_pair++; + } + + if (nr_queue_pair == 0) { + WARNINGOUT("no enabled vring\n"); + return; + } + + nr_queue_pair = (nr_queue_pair + 1) / 2; + } else if (hw->device_type == IFCVF_BLK) { + nr_queue_pair = hw->nr_vring; + } + + mq_cfg = hw->mq_cfg; + if (mq_cfg) { + *(u32 *)mq_cfg = nr_queue_pair; + RTE_LOG(INFO, PMD, "%d queue pairs are enabled\n", + nr_queue_pair); + } +} + STATIC int ifcvf_hw_enable(struct ifcvf_hw *hw) { @@ -215,6 +247,7 @@ return -1; } + ifcvf_enable_multiqueue(hw); for (i = 0; i < hw->nr_vring; i++) { IFCVF_WRITE_REG16(i, &cfg->queue_select); io_write64_twopart(hw->vring[i].desc, &cfg->queue_desc_lo, -- 1.8.3.1