From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <hzhan75@shecgisg004.sh.intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 18BC893D2
 for <dev@dpdk.org>; Thu, 22 Oct 2015 09:28:17 +0200 (CEST)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga102.fm.intel.com with ESMTP; 22 Oct 2015 00:28:17 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.20,181,1444719600"; d="scan'208";a="816791251"
Received: from shvmail01.sh.intel.com ([10.239.29.42])
 by fmsmga001.fm.intel.com with ESMTP; 22 Oct 2015 00:28:17 -0700
Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com
 [10.239.29.89])
 by shvmail01.sh.intel.com with ESMTP id t9M7SFEb008126;
 Thu, 22 Oct 2015 15:28:15 +0800
Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1])
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id
 t9M7SBSl021259; Thu, 22 Oct 2015 15:28:13 +0800
Received: (from hzhan75@localhost)
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t9M7SBci021255;
 Thu, 22 Oct 2015 15:28:11 +0800
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Date: Thu, 22 Oct 2015 15:28:06 +0800
Message-Id: <1445498887-21218-2-git-send-email-helin.zhang@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1445498887-21218-1-git-send-email-helin.zhang@intel.com>
References: <1442760674-19482-1-git-send-email-helin.zhang@intel.com>
 <1445498887-21218-1-git-send-email-helin.zhang@intel.com>
Cc: yulong.pei@intel.com
Subject: [dpdk-dev] [PATCH v2 1/2] i40e: adjust the number of queues for RSS
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 22 Oct 2015 07:28:18 -0000

It adjusts the number of queues for RSS from power of 2 to any as
long as it does not exceeds the hardware allowed.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    | 8 ++++----
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2dd9fdc..4b70588 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5153,12 +5153,12 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 	 * If both VMDQ and RSS enabled, not all of PF queues are configured.
 	 * It's necessary to calulate the actual PF queues that are configured.
 	 */
-	if (pf->dev_data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG) {
+	if (pf->dev_data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG)
 		num = i40e_pf_calc_configured_queues_num(pf);
-		num = i40e_align_floor(num);
-	} else
-		num = i40e_align_floor(pf->dev_data->nb_rx_queues);
+	else
+		num = pf->dev_data->nb_rx_queues;
 
+	num = RTE_MIN(num, I40E_MAX_Q_PER_TC);
 	PMD_INIT_LOG(INFO, "Max of contiguous %u PF queues are configured",
 			num);
 
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index b694400..b15ff7b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1915,7 +1915,7 @@ i40evf_config_rss(struct i40e_vf *vf)
 		return 0;
 	}
 
-	num = i40e_align_floor(vf->dev_data->nb_rx_queues);
+	num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
 	/* Fill out the look up table */
 	for (i = 0, j = 0; i < nb_q; i++, j++) {
 		if (j >= num)
-- 
1.9.3