[v2,1/1] app/testpmd: add valid check to verify multi mempool feature

Message ID 20221117125542.3091224-1-hpothula@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series [v2,1/1] app/testpmd: add valid check to verify multi mempool feature |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Hanumanth Pothula Nov. 17, 2022, 12:55 p.m. UTC
  Validate ethdev parameter 'max_rx_mempools' to know wheater device
supports multi-mempool feature or not.

Bugzilla ID: 1128

Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
v2:
 - Rebased on tip of next-net/main
---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Singh, Aman Deep Nov. 17, 2022, 3 p.m. UTC | #1
On 11/17/2022 6:25 PM, Hanumanth Pothula wrote:
> Validate ethdev parameter 'max_rx_mempools' to know wheater device
> supports multi-mempool feature or not.

Spell check: whether

> Bugzilla ID: 1128
>
> Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>

Tested-by: Aman Singh <aman.deep.singh@intel.com>

> v2:
>   - Rebased on tip of next-net/main
> ---
>   app/test-pmd/testpmd.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 4e25f77c6a..fd634bd5e6 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2655,16 +2655,22 @@ 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 ||
> +	if (!(dev_info.max_rx_mempools != 0) && !(rx_pkt_nb_segs > 1 ||

Can we make the check simpler "(dev_info.max_rx_mempools == 0)"

>   	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) != 0))) {
>   		/* Single pool/segment configuration */
>   		rx_conf->rx_seg = NULL;
  
Hanumanth Pothula Nov. 17, 2022, 3:58 p.m. UTC | #2
> -----Original Message-----
> From: Singh, Aman Deep <aman.deep.singh@intel.com>
> Sent: Thursday, November 17, 2022 8:30 PM
> To: Hanumanth Reddy Pothula <hpothula@marvell.com>; Yuying Zhang
> <yuying.zhang@intel.com>
> Cc: dev@dpdk.org; andrew.rybchenko@oktetlabs.ru;
> thomas@monjalon.net; -yux.jiang@intel.com; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>
> Subject: [EXT] Re: [PATCH v2 1/1] app/testpmd: add valid check to verify
> multi mempool feature
> 
> External Email
> 
> ----------------------------------------------------------------------
> 
> 
> On 11/17/2022 6:25 PM, Hanumanth Pothula wrote:
> > Validate ethdev parameter 'max_rx_mempools' to know wheater device
> > supports multi-mempool feature or not.
> 
> Spell check: whether
> 
> > Bugzilla ID: 1128
> >
> > Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
> 
> Tested-by: Aman Singh <aman.deep.singh@intel.com>
> 
> > v2:
> >   - Rebased on tip of next-net/main
> > ---
> >   app/test-pmd/testpmd.c | 8 +++++++-
> >   1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 4e25f77c6a..fd634bd5e6 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -2655,16 +2655,22 @@ 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 ||
> > +	if (!(dev_info.max_rx_mempools != 0) && !(rx_pkt_nb_segs > 1 ||
> 
> Can we make the check simpler "(dev_info.max_rx_mempools == 0)"
> 
Sure, will simplify the condition.

> >   	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) !=
> 0))) {
> >   		/* Single pool/segment configuration */
> >   		rx_conf->rx_seg = NULL;
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4e25f77c6a..fd634bd5e6 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2655,16 +2655,22 @@  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 ||
+	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;