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 3D32AA0032; Fri, 16 Sep 2022 08:17:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 112394282E; Fri, 16 Sep 2022 08:17:09 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id D664F427F7 for ; Fri, 16 Sep 2022 08:17:04 +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=Cr+274HMhI8uCWY9FQjFva1ZlzsPTCgLAwj6QRFecMg=; b=V2/mgg3MJkfun4x1WBok68sQUR1Gd2mEpzxpuP6A93S5F6FGkuNpomjv 8zIImq5uiYKk2K+0u0AYxqn3Snz6EECyxSORMGP/1+CPdsd4tT/8zaHbY sSEfdmIpWnMxPUQ4bZhZWB5iG74xKGuaRZ8oZWVmbY7n5MYQJ5IzyQMS3 NzphYrjb0kWrJAricnC65STqTGEwAuSS7z4uphZA+DE8jPrQPCbgmTvFl L2AYt47iwOlEExUUMcan7snKAB+wIn51u5TehUTVre/uw89nUnDp7s/vq 1hnzXeU2q9DsjpkFGkRQNjPW/U48fuwOo7bJGGzNnuO9knTtpW/tB+mU8 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10471"; a="278650950" X-IronPort-AV: E=Sophos;i="5.93,320,1654585200"; d="scan'208";a="278650950" 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:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,320,1654585200"; d="scan'208";a="568724596" Received: from dpdk-dipei.sh.intel.com ([10.67.110.251]) by orsmga003.jf.intel.com with ESMTP; 15 Sep 2022 23:16:36 -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 4/8] vdpa/ifc: write queue count to MQ register Date: Fri, 16 Sep 2022 14:16:26 +0800 Message-Id: <1663308990-621-5-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 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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c index 34c8226..7efb408 100644 --- a/drivers/vdpa/ifc/base/ifcvf.c +++ b/drivers/vdpa/ifc/base/ifcvf.c @@ -198,6 +198,35 @@ 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; + + 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; + } + + if (hw->device_type == IFCVF_NET) + nr_queue_pair = (nr_queue_pair + 1) / 2; + + 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 +244,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