From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 3FD84A0544;
	Fri, 18 Nov 2022 15:14:04 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 20B704021F;
	Fri, 18 Nov 2022 15:14:04 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173])
 by mails.dpdk.org (Postfix) with ESMTP id 1CB6E4003F
 for <dev@dpdk.org>; Fri, 18 Nov 2022 15:14:03 +0100 (CET)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 2AI1x3uN004813; Fri, 18 Nov 2022 06:14:02 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=XFu5DVGclCXHPQv/ufWFvmZp6e0+YcUSozUe8kzH0Cw=;
 b=PWE9MtWL0UxIrzrL5e0dETVvW4MB/tyJTlh+1wK60YtGWqX4WOAzmg8lpeGLJOQ8lsIJ
 sg6EO/Qq/6wl7d3Fmgkd5RlrC/yZl26rcmYSBoaSC9BUM8Wbc5v0CDr6MtNpjDfh5BPK
 H1gGog0QnsL5d1avmyibv8qBn8AiYITxBtYhJcZFYA1e7PfLIpbJpSLRf8oReEOtPFsO
 fcmax+KksV9XmHbbsbe8zGCyJ2ez0kuXYVJ0feq4dgP3WNKFjg+QlUj5XJSxQSqnmHVr
 sW/SGeQtT6F+AmE/6PsoKug3MtSWHXkLSq/MdREoYu9lAMUWMm4kOqVihytV/z+kuRvS Nw== 
Received: from dc5-exch02.marvell.com ([199.233.59.182])
 by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kx0uta2jj-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Fri, 18 Nov 2022 06:14:02 -0800
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;
 Fri, 18 Nov 2022 06:14:00 -0800
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend
 Transport; Fri, 18 Nov 2022 06:14:00 -0800
Received: from localhost.localdomain (unknown [10.28.36.155])
 by maili.marvell.com (Postfix) with ESMTP id 6BB1D3F7054;
 Fri, 18 Nov 2022 06:13:57 -0800 (PST)
From: Hanumanth Pothula <hpothula@marvell.com>
To: Aman Singh <aman.deep.singh@intel.com>, Yuying Zhang
 <yuying.zhang@intel.com>
CC: <dev@dpdk.org>, <andrew.rybchenko@oktetlabs.ru>, <thomas@monjalon.net>,
 <yux.jiang@intel.com>, <jerinj@marvell.com>, <ndabilpuram@marvell.com>,
 <hpothula@marvell.com>
Subject: [PATCH v4 1/1] app/testpmd: add valid check to verify multi mempool
 feature
Date: Fri, 18 Nov 2022 19:43:34 +0530
Message-ID: <20221118141334.3825072-1-hpothula@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20221118111358.3563760-1-hpothula@marvell.com>
References: <20221118111358.3563760-1-hpothula@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-GUID: hEWmoeocJVb_QlN7TeQ7M-mhfB76PtnO
X-Proofpoint-ORIG-GUID: hEWmoeocJVb_QlN7TeQ7M-mhfB76PtnO
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1
 definitions=2022-11-18_02,2022-11-18_01,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Validate ethdev parameter 'max_rx_mempools' to know whether
device supports multi-mempool feature or not.

Bugzilla ID: 1128

Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
v4:
 - updated if condition.
v3:
 - Simplified conditional check.
 - Corrected spell, whether.
v2:
 - Rebased on tip of next-net/main.
---
 app/test-pmd/testpmd.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4e25f77c6a..c1b4dbd716 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2655,17 +2655,23 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	union rte_eth_rxseg rx_useg[MAX_SEGS_BUFFER_SPLIT] = {};
 	struct rte_mempool *rx_mempool[MAX_MEMPOOL] = {};
 	struct rte_mempool *mpx;
+	struct rte_eth_dev_info dev_info;
 	unsigned int i, mp_n;
 	uint32_t prev_hdrs = 0;
 	int ret;
 
+	ret = rte_eth_dev_info_get(port_id, &dev_info);
+	if (ret != 0)
+		return ret;
+
 	/* Verify Rx queue configuration is single pool and segment or
 	 * multiple pool/segment.
+	 * @see rte_eth_dev_info::max_rx_mempools
 	 * @see rte_eth_rxconf::rx_mempools
 	 * @see rte_eth_rxconf::rx_seg
 	 */
-	if (!(mbuf_data_size_n > 1) && !(rx_pkt_nb_segs > 1 ||
-	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) != 0))) {
+	if ((dev_info.max_rx_mempools == 0) && (rx_pkt_nb_segs <= 1 ||
+	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) == 0))) {
 		/* Single pool/segment configuration */
 		rx_conf->rx_seg = NULL;
 		rx_conf->rx_nseg = 0;
-- 
2.25.1