Skip to contentSkip to conversation

app/testpmd: add valid check to verify multi mempool feature

PATCH Superseded Hanumanth Pothula 5 participants 27 messages Nov 17, 2022 – Nov 22, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: add valid check to verify multi mempool feature

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

Bugzilla ID: 1128

---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +7 -1
index 78ea19fcbb..79c0951b62 100644
@@ -2648,16 +2648,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_eth_dev_info dev_info;
 	struct rte_mempool *mpx;
 	unsigned int i, mp_n;
 	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;
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 app/testpmd: add valid check to verify multi mempool feature

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

Bugzilla ID: 1128

v2:
- Rebased on tip of next-net/main

---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +7 -1
index 4e25f77c6a..fd634bd5e6 100644
@@ -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;
Signature · 1 line
2.25.1
Tested-by on v2 1/1
#2 lore raw
Quoted 2 lines · Hanumanth Pothula

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

Spell check: whether

Quoted 3 lines

Bugzilla ID: 1128

Quoted 21 lines

v2:
- Rebased on tip of next-net/main

---
  app/test-pmd/testpmd.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +3 -0
index 4e25f77c6a..fd634bd5e6 100644
@@ -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)

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2673

Quoted 10 lines
app/test-pmd/testpmd.c +4 -1
+		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)"

Quoted 3 lines
app/test-pmd/testpmd.c +0 -0
  	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) != 0))) {
  		/* Single pool/segment configuration */
  		rx_conf->rx_seg = NULL;
#3 lore raw
Quoted 51 lines

-----Original Message-----
From: Singh, Aman Deep <[email protected]>
Sent: Thursday, November 17, 2022 8:30 PM
To: Hanumanth Reddy Pothula <[email protected]>; Yuying Zhang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: [EXT] Re: [PATCH v2 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

----------------------------------------------------------------------

Quoted 2 lines · Hanumanth Pothula

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

Spell check: whether

Quoted 3 lines

Bugzilla ID: 1128

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 11 lines

v2:
- Rebased on tip of next-net/main

---
  app/test-pmd/testpmd.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

4e25f77c6a..fd634bd5e6 100644

app/test-pmd/testpmd.c +0 -0
@@ -2655,16 +2655,22 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

Quoted 8 lines
app/test-pmd/testpmd.c +1 -0
  	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;
 
Quoted 15 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2673

Quoted 12 lines
app/test-pmd/testpmd.c +6 -1
+	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.

Quoted 4 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t · line 2674

Quoted 1 line
app/test-pmd/testpmd.c +0 -0
  	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) !=

0))) {

Quoted 2 lines
app/test-pmd/testpmd.c +0 -0
  		/* Single pool/segment configuration */
  		rx_conf->rx_seg = NULL;
#4 lore raw

PATCH v3 1/1 app/testpmd: add valid check to verify multi mempool feature

In reply to Hanumanth Pothula

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

Bugzilla ID: 1128

v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +7 -1
index 4e25f77c6a..6c3d0948ec 100644
@@ -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;
Signature · 1 line
2.25.1
#5 lore raw
Quoted 33 lines · Hanumanth Pothula

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

Bugzilla ID: 1128

v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +5 -0
index 4e25f77c6a..6c3d0948ec 100644
@@ -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

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2676

Quoted 10 lines
app/test-pmd/testpmd.c +2 -1
 	 * 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;

Hi Yingya, Yu,

Can you please verify this patch?

Thanks,
ferruh

#6 lore raw

There is a new issue after applying the patch.
Failed to configure buffer_split for a single queue and port can't up.
The test steps and logs are as follows:
./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 5-9 -n 4 -a 31:00.0 --force-max-simd-bitwidth=64 -- -i --mbuf-size=2048,2048 --txq=4 --rxq=4 testpmd> port stop all
testpmd> port 0 rxq 2 rx_offload buffer_split on
testpmd> show port 0 rx_offload configuration
Rx Offloading Configuration of port 0 :
Port : RSS_HASH
Queue[ 0] : RSS_HASH
Queue[ 1] : RSS_HASH
Queue[ 2] : RSS_HASH BUFFER_SPLIT
Queue[ 3] : RSS_HASH
testpmd> set rxhdrs eth
testpmd> port start all
Configuring Port 0 (socket 0)
No Rx segmentation offload configured
Fail to configure port 0 rx queues

BRs,
Yingya

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, November 18, 2022 7:37 AM
To: Hanumanth Pothula <[email protected]>; Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>; Han, YingyaX <[email protected]>; Jiang, YuX <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 1/1] app/testpmd: add valid check to verify multi mempool feature

Quoted 33 lines · Hanumanth Pothula

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

Bugzilla ID: 1128

v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

4e25f77c6a..6c3d0948ec 100644

app/test-pmd/testpmd.c +5 -0
@@ -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

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2676

Quoted 10 lines
app/test-pmd/testpmd.c +2 -1
 	 * 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;

Hi Yingya, Yu,

Can you please verify this patch?

Thanks,
ferruh

#7 lore raw

Hi Yingya,
Uploaded new patch-set, can you please help in verifying the same,
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

Regards,
Hanumanth

Quoted 104 lines

-----Original Message-----
From: Han, YingyaX <[email protected]>
Sent: Friday, November 18, 2022 12:22 PM
To: Ferruh Yigit <[email protected]>; Hanumanth Reddy Pothula <[email protected]>; Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>; Jiang, YuX <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: [EXT] RE: [PATCH v3 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

----------------------------------------------------------------------
There is a new issue after applying the patch.
Failed to configure buffer_split for a single queue and port can't up. The test steps and logs are as follows:
./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 5-9 -n 4 -a 31:00.0 -- force-max-simd-bitwidth=64 -- -i --mbuf-size=2048,2048 --txq=4 --rxq=4 testpmd> port stop all
testpmd> port 0 rxq 2 rx_offload buffer_split on show port 0 rx_offload testpmd> configuration
Rx Offloading Configuration of port 0 :
Port : RSS_HASH
Queue[ 0] : RSS_HASH
Queue[ 1] : RSS_HASH
Queue[ 2] : RSS_HASH BUFFER_SPLIT
Queue[ 3] : RSS_HASH
testpmd> set rxhdrs eth
testpmd> port start all
Configuring Port 0 (socket 0)
No Rx segmentation offload configured
Fail to configure port 0 rx queues

BRs,
Yingya

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, November 18, 2022 7:37 AM
To: Hanumanth Pothula <[email protected]>; Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>; Han, YingyaX <[email protected]>; Jiang, YuX <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 1/1] app/testpmd: add valid check to verify multi mempool feature

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 20 lines · Hanumanth Pothula

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

Bugzilla ID: 1128

v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

4e25f77c6a..6c3d0948ec 100644

app/test-pmd/testpmd.c +0 -0
@@ -2655,16 +2655,22 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

Quoted 11 lines
app/test-pmd/testpmd.c +4 -0
 	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;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +3 -1
+
 	/* 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))) {

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2676

Quoted 2 lines
app/test-pmd/testpmd.c +0 -0
 		/* Single pool/segment configuration */
 		rx_conf->rx_seg = NULL;

Hi Yingya, Yu,

Can you please verify this patch?

Thanks,
ferruh

#8 lore raw

PATCH v3 1/1 app/testpmd: add valid check to verify multi mempool feature

In reply to Hanumanth Pothula

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

Bugzilla ID: 1128

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(-)
app/test-pmd/testpmd.c +8 -2
index 4e25f77c6a..9fc14e6d6b 100644
@@ -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;
Signature · 1 line
2.25.1
#9 lore raw

PATCH v4 1/1 app/testpmd: add valid check to verify multi mempool feature

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

Bugzilla ID: 1128

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(-)
app/test-pmd/testpmd.c +8 -2
index 4e25f77c6a..c1b4dbd716 100644
@@ -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;
Signature · 1 line
2.25.1
#10 lore raw
Quoted 3 lines · Hanumanth Pothula

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

My preference would be revert the testpmd patch [1] that adds this new feature after -rc2, and add it back next release with new testpmd argument and below mentioned changes in setup function.

@Andrew, @Thomas, @Jerin, what do you think?

[1]
4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

Quoted 2 lines

Bugzilla ID: 1128

Can you please add fixes line?

Quoted 1 line

Please put the changelog after '---', which than git will take it as note.

Quoted 27 lines

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(-)
app/test-pmd/testpmd.c +4 -0
index 4e25f77c6a..c1b4dbd716 100644
@@ -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;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2673

Quoted 10 lines
app/test-pmd/testpmd.c +3 -2
+
 	/* 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 ||

Using dev_info.max_rx_mempools for check means if device supports multiple mempool, multiple mempool will be configured independent from user configuration. But user may prefer singe mempool or buffer split.

Right now only PMD support multiple mempool is 'cnxk', so this doesn't impact others but I think this is not correct.

Instead of re-using testpmd "mbuf-size" parameter (it is already used for two other features, and this is the reason of the defect) it would be better to have an explicit parameter for multiple mempool feature.

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2677

Quoted 4 lines
app/test-pmd/testpmd.c +1 -0
+	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) == 0))) {
 		/* Single pool/segment configuration */
 		rx_conf->rx_seg = NULL;
 		rx_conf->rx_nseg = 0;

Logic seems correct, although I have not tested.

Current functions tries to detect the requested feature and setup queues accordingly, features are:
- single mempool
- packet split (to multiple mempool)
- multiple mempool (various size)

And the logic in the function is:
``
if ( (! multiple mempool) && (! packet split))
setup for single mempool
exit

if (packet split)
setup packet split
else
setup multiple mempool
``

What do you think to
a) simplify logic by making single mempool as fallback and last option, instead of detecting non existence of other configs
b) have explicit check for multiple mempool

Like:

``
if (packet split)
setup packet split
exit
else if (multiple mempool)
setup multiple mempool
exit

setup for single mempool
``

I think this both solves the defect and simplifies the code.

#11 lore raw
Quoted 29 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Saturday, November 19, 2022 2:26 AM
To: Hanumanth Reddy Pothula <[email protected]>; [email protected]; [email protected]; Nithin Kumar Dabilpuram <[email protected]>
Cc: [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Subject: [EXT] Re: [PATCH v4 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

----------------------------------------------------------------------

Quoted 3 lines · Hanumanth Pothula

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

My preference would be revert the testpmd patch [1] that adds this new feature after -rc2, and add it back next release with new testpmd argument and below mentioned changes in setup function.

@Andrew, @Thomas, @Jerin, what do you think?

Quoted 8 lines

[1]
4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

Quoted 2 lines

Bugzilla ID: 1128

Can you please add fixes line?

Ack

Quoted 4 lines
Quoted 1 line

Please put the changelog after '---', which than git will take it as note.

Ack

Quoted 38 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 16 lines

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(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

4e25f77c6a..c1b4dbd716 100644

app/test-pmd/testpmd.c +0 -0
@@ -2655,17 +2655,23 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +3 -0
 	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)

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +3 -2
+		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))) {

Quoted 6 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2673

Quoted 1 line
app/test-pmd/testpmd.c +1 -0
+	if ((dev_info.max_rx_mempools == 0) && (rx_pkt_nb_segs <= 1 ||

Using dev_info.max_rx_mempools for check means if device supports multiple mempool, multiple mempool will be configured independent from user configuration. But user may prefer singe mempool or buffer split.

Please find my suggested logic.

Quoted 50 lines

Right now only PMD support multiple mempool is 'cnxk', so this doesn't impact others but I think this is not correct.

Instead of re-using testpmd "mbuf-size" parameter (it is already used for two other features, and this is the reason of the defect) it would be better to have an explicit parameter for multiple mempool feature.

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t · line 2674

Quoted 1 line
app/test-pmd/testpmd.c +1 -0
+	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) ==

0))) {

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2677

Quoted 3 lines
app/test-pmd/testpmd.c +0 -0
 		/* Single pool/segment configuration */
 		rx_conf->rx_seg = NULL;
 		rx_conf->rx_nseg = 0;

Logic seems correct, although I have not tested.

Current functions tries to detect the requested feature and setup queues accordingly, features are:
- single mempool
- packet split (to multiple mempool)
- multiple mempool (various size)

And the logic in the function is:
``
if ( (! multiple mempool) && (! packet split))
setup for single mempool
exit

if (packet split)
setup packet split
else
setup multiple mempool
``

What do you think to
a) simplify logic by making single mempool as fallback and last option, instead of detecting non existence of other configs
b) have explicit check for multiple mempool

Like:

``
if (packet split)
setup packet split
exit
else if (multiple mempool)
setup multiple mempool
exit

Quoted 4 lines

setup for single mempool
``

I think this both solves the defect and simplifies the code.

Yes Ferruh your suggested logic simplifies the code.

In the lines of your proposed logic, below if conditions might work fine for all features(buffer-split/multi-mempool) supported by PMD and user preference,

if (rx_pkt_nb_segs > 1 ||

            rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
	/*multi-segment (buffer split)*/
} else if (mbuf_data_size_n > 1 && dev_info.max_rx_mempools > 1) {
	/*multi-mempool*/
} else {
	/* single pool and segment */
} 

Or adding new Rx offload parameter for multi_mempool feature, I think it might not be required, using dev_info.max_rx_mempools works fine.

if (rx_pkt_nb_segs > 1 ||

            rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
	/*multi-segment (buffer split)*/
} else if (mbuf_data_size_n > 1 && rx_conf->offloads & RTE_ETH_RX_OFFLOAD_MULTI_MEMPOOL ) {
	/*multi-mempool*/
} else {
	/* single pool and segment */
}

Please let me know your inputs on above logic.

#12 lore raw
Quoted 148 lines · Hanumanth Reddy Pothula
Quoted 29 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Saturday, November 19, 2022 2:26 AM
To: Hanumanth Reddy Pothula <[email protected]>; [email protected]; [email protected]; Nithin Kumar Dabilpuram <[email protected]>
Cc: [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Subject: [EXT] Re: [PATCH v4 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

----------------------------------------------------------------------

Quoted 3 lines · Hanumanth Pothula

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

My preference would be revert the testpmd patch [1] that adds this new feature after -rc2, and add it back next release with new testpmd argument and below mentioned changes in setup function.

@Andrew, @Thomas, @Jerin, what do you think?

Quoted 8 lines

[1]
4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

Quoted 2 lines

Bugzilla ID: 1128

Can you please add fixes line?

Ack

Quoted 4 lines
Quoted 1 line

Please put the changelog after '---', which than git will take it as note.

Ack

Quoted 38 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 16 lines

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(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

4e25f77c6a..c1b4dbd716 100644

app/test-pmd/testpmd.c +0 -0
@@ -2655,17 +2655,23 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +3 -0
 	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)

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +3 -2
+		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))) {

Quoted 6 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2673

Quoted 1 line
app/test-pmd/testpmd.c +1 -0
+	if ((dev_info.max_rx_mempools == 0) && (rx_pkt_nb_segs <= 1 ||

Using dev_info.max_rx_mempools for check means if device supports multiple mempool, multiple mempool will be configured independent from user configuration. But user may prefer singe mempool or buffer split.

Please find my suggested logic.

Quoted 50 lines

Right now only PMD support multiple mempool is 'cnxk', so this doesn't impact others but I think this is not correct.

Instead of re-using testpmd "mbuf-size" parameter (it is already used for two other features, and this is the reason of the defect) it would be better to have an explicit parameter for multiple mempool feature.

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t · line 2674

Quoted 1 line
app/test-pmd/testpmd.c +1 -0
+	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) ==

0))) {

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2677

Quoted 3 lines
app/test-pmd/testpmd.c +0 -0
 		/* Single pool/segment configuration */
 		rx_conf->rx_seg = NULL;
 		rx_conf->rx_nseg = 0;

Logic seems correct, although I have not tested.

Current functions tries to detect the requested feature and setup queues accordingly, features are:
- single mempool
- packet split (to multiple mempool)
- multiple mempool (various size)

And the logic in the function is:
``
if ( (! multiple mempool) && (! packet split))
setup for single mempool
exit

if (packet split)
setup packet split
else
setup multiple mempool
``

What do you think to
a) simplify logic by making single mempool as fallback and last option, instead of detecting non existence of other configs
b) have explicit check for multiple mempool

Like:

``
if (packet split)
setup packet split
exit
else if (multiple mempool)
setup multiple mempool
exit

Quoted 4 lines

setup for single mempool
``

I think this both solves the defect and simplifies the code.

Yes Ferruh your suggested logic simplifies the code.

In the lines of your proposed logic, below if conditions might work fine for all features(buffer-split/multi-mempool) supported by PMD and user preference,

Quoted 9 lines

if (rx_pkt_nb_segs > 1 ||

            rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
	/*multi-segment (buffer split)*/
} else if (mbuf_data_size_n > 1 && dev_info.max_rx_mempools > 1) {
	/*multi-mempool*/
} else {
	/* single pool and segment */
} 

mbuf_data_size_n > 1 may mean user is requesting multiple segment, or buffer split, so I am not sure about using this value to decide on multiple mempool feature, it can create side effect as Bug 1128 does.

Quoted 2 lines

Or adding new Rx offload parameter for multi_mempool feature, I think it might not be required, using dev_info.max_rx_mempools works fine.

In ethdev level, we don't need an offload flag, since separated config options clarify the intention there.
What is needed is a way to understand users intention, for application (testpmd) and configure device accordingly.
That is why I think 'dev_info.max_rx_mempools' is not working fine, because that is a way for device to say multiple mempool is supported, it is not to get user intention.
In your logic when device supports multiple mempool, use it independent from what user request.

I suggest having a testpmd argument explicitly to say multiple mempool feature is requested, this will help to distinguish buffer split, multiple mempool, single mempool features.

Thanks.

Quoted 11 lines

if (rx_pkt_nb_segs > 1 ||

            rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
	/*multi-segment (buffer split)*/
} else if (mbuf_data_size_n > 1 && rx_conf->offloads & RTE_ETH_RX_OFFLOAD_MULTI_MEMPOOL ) {
	/*multi-mempool*/
} else {
	/* single pool and segment */
}

Please let me know your inputs on above logic.

#13 lore raw
Quoted 199 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, November 21, 2022 3:38 PM
To: Hanumanth Reddy Pothula <[email protected]>; [email protected]; [email protected]; Nithin Kumar Dabilpuram <[email protected]>
Cc: [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Subject: Re: [EXT] Re: [PATCH v4 1/1] app/testpmd: add valid check to verify multi mempool feature

Quoted 10 lines · Hanumanth Reddy Pothula
Quoted 10 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Saturday, November 19, 2022 2:26 AM
To: Hanumanth Reddy Pothula <[email protected]>; [email protected]; [email protected]; Nithin Kumar Dabilpuram <[email protected]>
Cc: [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Aman Singh <[email protected]>;

Yuying

Quoted 9 lines
Quoted 9 lines

Zhang <[email protected]>
Subject: [EXT] Re: [PATCH v4 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

---------------------------------------------------------------------

Quoted 1 line · Hanumanth Pothula

Validate ethdev parameter 'max_rx_mempools' to know whether

device

Quoted 36 lines
Quoted 10 lines
Quoted 2 lines

supports multi-mempool feature or not.

My preference would be revert the testpmd patch [1] that adds this new feature after -rc2, and add it back next release with new testpmd argument and below mentioned changes in setup function.

@Andrew, @Thomas, @Jerin, what do you think?

Quoted 9 lines

[1]
4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

Quoted 2 lines

Bugzilla ID: 1128

Can you please add fixes line?

Ack

Quoted 4 lines
Quoted 1 line

Please put the changelog after '---', which than git will take it as note.

Ack

Quoted 11 lines
Quoted 11 lines

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(-)
Quoted 5 lines
Quoted 5 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id,

Quoted 5 lines
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

4e25f77c6a..c1b4dbd716 100644

app/test-pmd/testpmd.c +0 -0
@@ -2655,17 +2655,23 @@ rx_queue_setup(uint16_t port_id,

uint16_t

Quoted 22 lines
Quoted 22 lines

rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +3 -0
 	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)

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +3 -2
+		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))) {

Quoted 5 lines
Quoted 5 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2673

Quoted 1 line
app/test-pmd/testpmd.c +1 -0
+	if ((dev_info.max_rx_mempools == 0) && (rx_pkt_nb_segs <= 1 ||

Using dev_info.max_rx_mempools for check means if device supports multiple mempool, multiple mempool will be configured independent from user configuration. But user may prefer singe mempool or buffer

split.

Quoted 9 lines
Quoted 1 line

Please find my suggested logic.

Quoted 6 lines

Right now only PMD support multiple mempool is 'cnxk', so this doesn't impact others but I think this is not correct.

Instead of re-using testpmd "mbuf-size" parameter (it is already used for two other features, and this is the reason of the defect) it would be better to have an explicit parameter for multiple mempool

feature.

Quoted 55 lines
Quoted 44 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, · line 2674

Quoted 3 lines
app/test-pmd/testpmd.c +1 -0
+	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) ==

0))) {

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2677

Quoted 3 lines
app/test-pmd/testpmd.c +0 -0
 		/* Single pool/segment configuration */
 		rx_conf->rx_seg = NULL;
 		rx_conf->rx_nseg = 0;

Logic seems correct, although I have not tested.

Current functions tries to detect the requested feature and setup queues accordingly, features are:
- single mempool
- packet split (to multiple mempool)
- multiple mempool (various size)

And the logic in the function is:
``
if ( (! multiple mempool) && (! packet split))
setup for single mempool
exit

if (packet split)
setup packet split
else
setup multiple mempool
``

What do you think to
a) simplify logic by making single mempool as fallback and last option, instead of detecting non existence of other configs
b) have explicit check for multiple mempool

Like:

``
if (packet split)
setup packet split
exit
else if (multiple mempool)
setup multiple mempool
exit

Quoted 4 lines

setup for single mempool
``

I think this both solves the defect and simplifies the code.

Yes Ferruh your suggested logic simplifies the code.

In the lines of your proposed logic, below if conditions might work fine for all features(buffer-split/multi-mempool) supported by PMD and user preference,

Quoted 9 lines

if (rx_pkt_nb_segs > 1 ||

            rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
	/*multi-segment (buffer split)*/
} else if (mbuf_data_size_n > 1 && dev_info.max_rx_mempools > 1) {
	/*multi-mempool*/
} else {
	/* single pool and segment */
}

mbuf_data_size_n > 1 may mean user is requesting multiple segment, or buffer split, so I am not sure about using this value to decide on multiple mempool feature, it can create side effect as Bug 1128 does.

Quoted 1 line

Or adding new Rx offload parameter for multi_mempool feature, I think it

might not be required, using dev_info.max_rx_mempools works fine.

Quoted 1 line

In ethdev level, we don't need an offload flag, since separated config options clarify the intention there.
What is needed is a way to understand users intention, for application (testpmd) and configure device accordingly.
That is why I think 'dev_info.max_rx_mempools' is not working fine, because that is a way for device to say multiple mempool is supported, it is not to get user intention.
In your logic when device supports multiple mempool, use it independent from what user request.

Quoted 5 lines

I suggest having a testpmd argument explicitly to say multiple mempool feature is requested, this will help to distinguish buffer split, multiple mempool, single mempool features.

Thanks.

Sure, will upload new patch-set with testpmd argument, which tells multiple mempool feature is enabled/disabled.

Quoted 13 lines
Quoted 5 lines

if (rx_pkt_nb_segs > 1 ||

            rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
	/*multi-segment (buffer split)*/
} else if (mbuf_data_size_n > 1 && rx_conf->offloads &

RTE_ETH_RX_OFFLOAD_MULTI_MEMPOOL ) {

Quoted 7 lines
	/*multi-mempool*/
} else {
	/* single pool and segment */
}

Please let me know your inputs on above logic.

#14 lore raw

PATCH v5 1/1 app/testpmd: add valid check to verify multi mempool feature

In reply to Hanumanth Pothula

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

Also, add new testpmd command line argument, multi-mempool, to control multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

---
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/parameters.c |  3 ++
 app/test-pmd/testpmd.c    | 58 +++++++++++++++++++++++++--------------
 app/test-pmd/testpmd.h    |  1 +
 3 files changed, 41 insertions(+), 21 deletions(-)
app/test-pmd/parameters.c +3 -0
index aed4cdcb84..26d6450db4 100644
@@ -700,6 +700,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rx-mq-mode",                 1, 0, 0 },
 		{ "record-core-cycles",         0, 0, 0 },
 		{ "record-burst-stats",         0, 0, 0 },
+		{ "multi-mempool",              0, 0, 0 },
 		{ PARAM_NUM_PROCS,              1, 0, 0 },
 		{ PARAM_PROC_ID,                1, 0, 0 },
 		{ 0, 0, 0, 0 },
@@ -1449,6 +1450,8 @@ launch_args_parse(int argc, char** argv)
 				record_core_cycles = 1;
 			if (!strcmp(lgopts[opt_idx].name, "record-burst-stats"))
 				record_burst_stats = 1;
+			if (!strcmp(lgopts[opt_idx].name, "multi-mempool"))
+				multi_mempool = 1;
 			if (!strcmp(lgopts[opt_idx].name, PARAM_NUM_PROCS))
 				num_procs = atoi(optarg);
 			if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
app/test-pmd/testpmd.c +37 -21

92 lines not on this page · raw message

app/test-pmd/testpmd.h +1 -0
index aaf69c349a..9472a2cb19 100644
@@ -464,6 +464,7 @@ enum dcb_mode_enable
 extern uint8_t xstats_hide_zero; /**< Hide zero values for xstats display */
 
 /* globals used for configuration */
+extern uint8_t multi_mempool; /**< Enables multi-mempool feature. */
 extern uint8_t record_core_cycles; /**< Enables measurement of CPU cycles */
 extern uint8_t record_burst_stats; /**< Enables display of RX and TX bursts */
 extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
Signature · 1 line
2.25.1
#15 lore raw
Quoted 34 lines · Hanumanth Pothula

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

Also, add new testpmd command line argument, multi-mempool, to control multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

---
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/parameters.c |  3 ++
 app/test-pmd/testpmd.c    | 58 +++++++++++++++++++++++++--------------
 app/test-pmd/testpmd.h    |  1 +
 3 files changed, 41 insertions(+), 21 deletions(-)
app/test-pmd/parameters.c +0 -0
index aed4cdcb84..26d6450db4 100644

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 703

Quoted 4 lines
app/test-pmd/parameters.c +1 -0
@@ -700,6 +700,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rx-mq-mode",                 1, 0, 0 },
 		{ "record-core-cycles",         0, 0, 0 },
 		{ "record-burst-stats",         0, 0, 0 },
+		{ "multi-mempool",              0, 0, 0 },

Can you please group with relatet paramters, instead of appending end, after 'rxpkts' related parameters group (so after 'txpkts') can be good location since it is used for buffer split.

need to document new argument on 'doc/guides/testpmd_app_ug/run_app.rst'

Also need to add help string in 'usage()' function, again grouped in related paramters.

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1454

Quoted 9 lines
app/test-pmd/parameters.c +2 -0
 		{ PARAM_NUM_PROCS,              1, 0, 0 },
 		{ PARAM_PROC_ID,                1, 0, 0 },
 		{ 0, 0, 0, 0 },
@@ -1449,6 +1450,8 @@ launch_args_parse(int argc, char** argv)
 				record_core_cycles = 1;
 			if (!strcmp(lgopts[opt_idx].name, "record-burst-stats"))
 				record_burst_stats = 1;
+			if (!strcmp(lgopts[opt_idx].name, "multi-mempool"))
+				multi_mempool = 1;

Can you group with related paramters, same as above mentioned location?

Quoted 8 lines
app/test-pmd/parameters.c +0 -0
 			if (!strcmp(lgopts[opt_idx].name, PARAM_NUM_PROCS))
 				num_procs = atoi(optarg);
 			if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
app/test-pmd/testpmd.c +0 -0
index 4e25f77c6a..9dfc4c9d0e 100644

app/test-pmd/testpmd.c uint8_t record_burst_stats; · line 503

Quoted 7 lines
app/test-pmd/testpmd.c +4 -0
@@ -497,6 +497,11 @@ uint8_t record_burst_stats;
  */
 uint32_t rxq_share;
 
+/*
+ * Multi-mempool support, disabled by default.
+ */
+uint8_t multi_mempool;

Can you put this after 'rx_pkt_nb_segs' related group.

Quoted 13 lines
app/test-pmd/testpmd.c +2 -0
+
 unsigned int num_sockets = 0;
 unsigned int socket_ids[RTE_MAX_NUMA_NODES];
 
@@ -2655,28 +2660,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;
 

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2677

Quoted 10 lines
app/test-pmd/testpmd.c +5 -0
+	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
 	 */

Is above comment block still valid?

Quoted 21 lines
app/test-pmd/testpmd.c +2 -13
-	if (!(mbuf_data_size_n > 1) && !(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;
-		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
-					     nb_rx_desc, socket_id,
-					     rx_conf, mp);
-		goto exit;
-	}
-
-	if (rx_pkt_nb_segs > 1 ||
-	    rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
+	if ((rx_pkt_nb_segs > 1) &&
+	    (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
 		/* multi-segment configuration */
 		for (i = 0; i < rx_pkt_nb_segs; i++) {
 			struct rte_eth_rxseg_split *rx_seg = &rx_useg[i].split;
@@ -2701,7 +2701,14 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		}
 		rx_conf->rx_nseg = rx_pkt_nb_segs;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2711

Quoted 10 lines
app/test-pmd/testpmd.c +8 -1
 		rx_conf->rx_seg = rx_useg;
-	} else {
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+				    socket_id, rx_conf, NULL);
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+	} else if ((multi_mempool == 1) && (dev_info.max_rx_mempools != 0) &&
+		  (mbuf_data_size_n > 1)) {

What do you think to move 'rte_eth_dev_info_get()' within this if block, and reduce 'dev_info' scope, like

else if (multi_mempool == 1)

	if (mbuf_data_size_n <= 1))
		log(describe problem)
		return
	struct rte_eth_dev_info dev_info;
	ret = rte_eth_dev_info_get(port_id, &dev_info);
	if (dev_info.max_rx_mempools == 0)
		log("device doesn't support requested config"
		return
	<multi-pool configuration>

else

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2714

Quoted 3 lines
app/test-pmd/testpmd.c +0 -0
 		/* multi-pool configuration */
 		for (i = 0; i < mbuf_data_size_n; i++) {
 			mpx = mbuf_pool_find(socket_id, i);

Where the mempools are created? Is that code also needs to be updated to use/check 'multi_mempool' variable/config?

Quoted 36 lines
app/test-pmd/testpmd.c +16 -7
@@ -2709,14 +2716,23 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		}
 		rx_conf->rx_mempools = rx_mempool;
 		rx_conf->rx_nmempool = mbuf_data_size_n;
-	}
-	ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
 				    socket_id, rx_conf, NULL);
-	rx_conf->rx_seg = NULL;
-	rx_conf->rx_nseg = 0;
-	rx_conf->rx_mempools = NULL;
-	rx_conf->rx_nmempool = 0;
-exit:
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+	} else {
+		/* Single pool/segment configuration */
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+				    socket_id, rx_conf, mp);
+	}
+
+
 	ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start ?
 						RTE_ETH_QUEUE_STATE_STOPPED :
 						RTE_ETH_QUEUE_STATE_STARTED;
app/test-pmd/testpmd.h +0 -0
index aaf69c349a..9472a2cb19 100644

app/test-pmd/testpmd.h enum dcb_mode_enable · line 467

Quoted 4 lines
app/test-pmd/testpmd.h +1 -0
@@ -464,6 +464,7 @@ enum dcb_mode_enable
 extern uint8_t xstats_hide_zero; /**< Hide zero values for xstats display */
 
 /* globals used for configuration */
+extern uint8_t multi_mempool; /**< Enables multi-mempool feature. */

Again please group this same location as done in .c file

Quoted 3 lines
app/test-pmd/testpmd.h +0 -0
 extern uint8_t record_core_cycles; /**< Enables measurement of CPU cycles */
 extern uint8_t record_burst_stats; /**< Enables display of RX and TX bursts */
 extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
#16 lore raw
Quoted 50 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, November 21, 2022 6:53 PM
To: Hanumanth Reddy Pothula <[email protected]>; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: [EXT] Re: [PATCH v5 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

----------------------------------------------------------------------

Quoted 4 lines · Hanumanth Pothula

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

Also, add new testpmd command line argument, multi-mempool, to

control

Quoted 20 lines

multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx

queue")

---
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

Quoted 3 lines
---
 app/test-pmd/parameters.c |  3 ++
 app/test-pmd/testpmd.c    | 58 +++++++++++++++++++++++++------------

--

Quoted 3 lines
 app/test-pmd/testpmd.h    |  1 +
 3 files changed, 41 insertions(+), 21 deletions(-)
Quoted 14 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 703

Quoted 9 lines
app/test-pmd/parameters.c +1 -0
index aed4cdcb84..26d6450db4 100644
@@ -700,6 +700,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rx-mq-mode",                 1, 0, 0 },
 		{ "record-core-cycles",         0, 0, 0 },
 		{ "record-burst-stats",         0, 0, 0 },
+		{ "multi-mempool",              0, 0, 0 },

Can you please group with relatet paramters, instead of appending end, after 'rxpkts' related parameters group (so after 'txpkts') can be good location since it is used for buffer split.

Ack

Quoted 3 lines

need to document new argument on
'doc/guides/testpmd_app_ug/run_app.rst'

Ack

Quoted 2 lines

Also need to add help string in 'usage()' function, again grouped in related paramters.

Sure, will add help string

Quoted 8 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1451

Quoted 7 lines
app/test-pmd/parameters.c +0 -0
 		{ PARAM_NUM_PROCS,              1, 0, 0 },
 		{ PARAM_PROC_ID,                1, 0, 0 },
 		{ 0, 0, 0, 0 },
@@ -1449,6 +1450,8 @@ launch_args_parse(int argc, char** argv)
 				record_core_cycles = 1;
 			if (!strcmp(lgopts[opt_idx].name, "record-burst-

stats"))

Quoted 7 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1453

Quoted 2 lines
app/test-pmd/parameters.c +1 -0
 				record_burst_stats = 1;
+			if (!strcmp(lgopts[opt_idx].name, "multi-

mempool"))

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1454

Quoted 1 line
app/test-pmd/parameters.c +1 -0
+				multi_mempool = 1;

Can you group with related paramters, same as above mentioned location?

Ack

Quoted 13 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1455

Quoted 1 line
app/test-pmd/parameters.c +0 -0
 			if (!strcmp(lgopts[opt_idx].name,

PARAM_NUM_PROCS))

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1457

Quoted 2 lines
app/test-pmd/parameters.c +0 -0
 				num_procs = atoi(optarg);
 			if (!strcmp(lgopts[opt_idx].name,

PARAM_PROC_ID)) diff --git

Quoted 8 lines

a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4e25f77c6a..9dfc4c9d0e 100644

app/test-pmd/testpmd.c +0 -0
@@ -497,6 +497,11 @@ uint8_t record_burst_stats;
  */
 uint32_t rxq_share;
 
Quoted 7 lines

app/test-pmd/testpmd.c uint8_t record_burst_stats; · line 503

Quoted 4 lines
app/test-pmd/testpmd.c +4 -0
+/*
+ * Multi-mempool support, disabled by default.
+ */
+uint8_t multi_mempool;

Can you put this after 'rx_pkt_nb_segs' related group.

Ack

Quoted 14 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 5 lines
app/test-pmd/testpmd.c +1 -0
+
 unsigned int num_sockets = 0;
 unsigned int socket_ids[RTE_MAX_NUMA_NODES];
 
@@ -2655,28 +2660,23 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

Quoted 8 lines
app/test-pmd/testpmd.c +1 -0
 	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;
 
Quoted 12 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2677

Quoted 10 lines
app/test-pmd/testpmd.c +5 -0
+	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
 	 */

Is above comment block still valid?

Will remove

Quoted 35 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t · line 2668

Quoted 3 lines
app/test-pmd/testpmd.c +0 -2
-	if (!(mbuf_data_size_n > 1) && !(rx_pkt_nb_segs > 1 ||
-	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) !=

0))) {

Quoted 6 lines
app/test-pmd/testpmd.c +0 -6
-		/* Single pool/segment configuration */
-		rx_conf->rx_seg = NULL;
-		rx_conf->rx_nseg = 0;
-		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
-					     nb_rx_desc, socket_id,
-					     rx_conf, mp);

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +2 -5
-		goto exit;
-	}
-
-	if (rx_pkt_nb_segs > 1 ||
-	    rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
+	if ((rx_pkt_nb_segs > 1) &&
+	    (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
 		/* multi-segment configuration */
 		for (i = 0; i < rx_pkt_nb_segs; i++) {
 			struct rte_eth_rxseg_split *rx_seg =

&rx_useg[i].split; @@ -2701,7

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 8 lines

+2701,14 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

app/test-pmd/testpmd.c +3 -1
 		}
 		rx_conf->rx_nseg = rx_pkt_nb_segs;
 		rx_conf->rx_seg = rx_useg;
-	} else {
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 4 lines
app/test-pmd/testpmd.c +4 -0
+				    socket_id, rx_conf, NULL);
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+	} else if ((multi_mempool == 1) && (dev_info.max_rx_mempools !=

0) &&

Quoted 4 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2711

Quoted 1 line
app/test-pmd/testpmd.c +1 -0
+		  (mbuf_data_size_n > 1)) {

What do you think to move 'rte_eth_dev_info_get()' within this if block, and reduce 'dev_info' scope, like

Ack

Quoted 11 lines

else if (multi_mempool == 1)

	if (mbuf_data_size_n <= 1))
		log(describe problem)
		return
	struct rte_eth_dev_info dev_info;
	ret = rte_eth_dev_info_get(port_id, &dev_info);
	if (dev_info.max_rx_mempools == 0)
		log("device doesn't support requested config"
		return
	<multi-pool configuration>
Quoted 8 lines

else

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2714

Quoted 3 lines
app/test-pmd/testpmd.c +0 -0
 		/* multi-pool configuration */
 		for (i = 0; i < mbuf_data_size_n; i++) {
 			mpx = mbuf_pool_find(socket_id, i);

Where the mempools are created? Is that code also needs to be updated to use/check 'multi_mempool' variable/config?

I think it's not required, as user might create multiple pools for other scenarios as well, for example as part of buzilla id: 1128, user creating two pools but not for multi-mempool feature. ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 5,6 -n 8 --force-max-simd-bitwidth=64 -- -i --portmask=0x3 --rxq=1 --txq=1 --txd=1024 --rxd=1024 --nb-cores=1 --mbuf-size=2048,2048

Quoted 45 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 2 lines
app/test-pmd/testpmd.c +0 -0
@@ -2709,14 +2716,23 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 8 lines
app/test-pmd/testpmd.c +3 -2
 		}
 		rx_conf->rx_mempools = rx_mempool;
 		rx_conf->rx_nmempool = mbuf_data_size_n;
-	}
-	ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

Quoted 5 lines
app/test-pmd/testpmd.c +0 -4
 				    socket_id, rx_conf, NULL);
-	rx_conf->rx_seg = NULL;
-	rx_conf->rx_nseg = 0;
-	rx_conf->rx_mempools = NULL;
-	rx_conf->rx_nmempool = 0;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +9 -1
-exit:
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+	} else {
+		/* Single pool/segment configuration */
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 5 lines
app/test-pmd/testpmd.c +4 -0
+				    socket_id, rx_conf, mp);
+	}
+
+
 	ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start

?

Quoted 1 line

RTE_ETH_QUEUE_STATE_STOPPED :

Quoted 1 line
	RTE_ETH_QUEUE_STATE_STARTED;
Quoted 7 lines
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

aaf69c349a..9472a2cb19 100644

app/test-pmd/testpmd.h +0 -0
@@ -464,6 +464,7 @@ enum dcb_mode_enable  extern uint8_t

xstats_hide_zero; /**< Hide zero values for xstats display */

Quoted 5 lines
Quoted 2 lines

/* globals used for configuration */
+extern uint8_t multi_mempool; /**< Enables multi-mempool feature.

*/

Again please group this same location as done in .c file

Ack.

Quoted 5 lines
Quoted 4 lines

extern uint8_t record_core_cycles; /**< Enables measurement of CPU
cycles */ extern uint8_t record_burst_stats; /**< Enables display of RX and TX bursts */ extern uint16_t verbose_level; /**< Drives messages

being displayed, if any. */

#17 lore raw
Quoted 191 lines · Hanumanth Reddy Pothula
Quoted 50 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, November 21, 2022 6:53 PM
To: Hanumanth Reddy Pothula <[email protected]>; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: [EXT] Re: [PATCH v5 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

----------------------------------------------------------------------

Quoted 4 lines · Hanumanth Pothula

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

Also, add new testpmd command line argument, multi-mempool, to

control

Quoted 20 lines

multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx

queue")

---
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

Quoted 3 lines
---
 app/test-pmd/parameters.c |  3 ++
 app/test-pmd/testpmd.c    | 58 +++++++++++++++++++++++++------------

--

Quoted 3 lines
 app/test-pmd/testpmd.h    |  1 +
 3 files changed, 41 insertions(+), 21 deletions(-)
Quoted 14 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 703

Quoted 9 lines
app/test-pmd/parameters.c +1 -0
index aed4cdcb84..26d6450db4 100644
@@ -700,6 +700,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rx-mq-mode",                 1, 0, 0 },
 		{ "record-core-cycles",         0, 0, 0 },
 		{ "record-burst-stats",         0, 0, 0 },
+		{ "multi-mempool",              0, 0, 0 },

Can you please group with relatet paramters, instead of appending end, after 'rxpkts' related parameters group (so after 'txpkts') can be good location since it is used for buffer split.

Ack

Quoted 3 lines

need to document new argument on
'doc/guides/testpmd_app_ug/run_app.rst'

Ack

Quoted 2 lines

Also need to add help string in 'usage()' function, again grouped in related paramters.

Sure, will add help string

Quoted 8 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1451

Quoted 7 lines
app/test-pmd/parameters.c +0 -0
 		{ PARAM_NUM_PROCS,              1, 0, 0 },
 		{ PARAM_PROC_ID,                1, 0, 0 },
 		{ 0, 0, 0, 0 },
@@ -1449,6 +1450,8 @@ launch_args_parse(int argc, char** argv)
 				record_core_cycles = 1;
 			if (!strcmp(lgopts[opt_idx].name, "record-burst-

stats"))

Quoted 7 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1453

Quoted 2 lines
app/test-pmd/parameters.c +1 -0
 				record_burst_stats = 1;
+			if (!strcmp(lgopts[opt_idx].name, "multi-

mempool"))

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1454

Quoted 1 line
app/test-pmd/parameters.c +1 -0
+				multi_mempool = 1;

Can you group with related paramters, same as above mentioned location?

Ack

Quoted 13 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1455

Quoted 1 line
app/test-pmd/parameters.c +0 -0
 			if (!strcmp(lgopts[opt_idx].name,

PARAM_NUM_PROCS))

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1457

Quoted 2 lines
app/test-pmd/parameters.c +0 -0
 				num_procs = atoi(optarg);
 			if (!strcmp(lgopts[opt_idx].name,

PARAM_PROC_ID)) diff --git

Quoted 8 lines

a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4e25f77c6a..9dfc4c9d0e 100644

app/test-pmd/testpmd.c +0 -0
@@ -497,6 +497,11 @@ uint8_t record_burst_stats;
  */
 uint32_t rxq_share;
 
Quoted 7 lines

app/test-pmd/testpmd.c uint8_t record_burst_stats; · line 503

Quoted 4 lines
app/test-pmd/testpmd.c +4 -0
+/*
+ * Multi-mempool support, disabled by default.
+ */
+uint8_t multi_mempool;

Can you put this after 'rx_pkt_nb_segs' related group.

Ack

Quoted 14 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 5 lines
app/test-pmd/testpmd.c +1 -0
+
 unsigned int num_sockets = 0;
 unsigned int socket_ids[RTE_MAX_NUMA_NODES];
 
@@ -2655,28 +2660,23 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

Quoted 8 lines
app/test-pmd/testpmd.c +1 -0
 	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;
 
Quoted 12 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2677

Quoted 10 lines
app/test-pmd/testpmd.c +5 -0
+	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
 	 */

Is above comment block still valid?

Will remove

Quoted 35 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t · line 2668

Quoted 3 lines
app/test-pmd/testpmd.c +0 -2
-	if (!(mbuf_data_size_n > 1) && !(rx_pkt_nb_segs > 1 ||
-	    ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) !=

0))) {

Quoted 6 lines
app/test-pmd/testpmd.c +0 -6
-		/* Single pool/segment configuration */
-		rx_conf->rx_seg = NULL;
-		rx_conf->rx_nseg = 0;
-		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
-					     nb_rx_desc, socket_id,
-					     rx_conf, mp);

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +2 -5
-		goto exit;
-	}
-
-	if (rx_pkt_nb_segs > 1 ||
-	    rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
+	if ((rx_pkt_nb_segs > 1) &&
+	    (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
 		/* multi-segment configuration */
 		for (i = 0; i < rx_pkt_nb_segs; i++) {
 			struct rte_eth_rxseg_split *rx_seg =

&rx_useg[i].split; @@ -2701,7

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 8 lines

+2701,14 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

app/test-pmd/testpmd.c +3 -1
 		}
 		rx_conf->rx_nseg = rx_pkt_nb_segs;
 		rx_conf->rx_seg = rx_useg;
-	} else {
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 4 lines
app/test-pmd/testpmd.c +4 -0
+				    socket_id, rx_conf, NULL);
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+	} else if ((multi_mempool == 1) && (dev_info.max_rx_mempools !=

0) &&

Quoted 4 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2711

Quoted 1 line
app/test-pmd/testpmd.c +1 -0
+		  (mbuf_data_size_n > 1)) {

What do you think to move 'rte_eth_dev_info_get()' within this if block, and reduce 'dev_info' scope, like

Ack

Quoted 13 lines

else if (multi_mempool == 1)

	if (mbuf_data_size_n <= 1))
		log(describe problem)
		return
	struct rte_eth_dev_info dev_info;
	ret = rte_eth_dev_info_get(port_id, &dev_info);
	if (dev_info.max_rx_mempools == 0)
		log("device doesn't support requested config"
		return
	<multi-pool configuration>

else

Quoted 8 lines
Quoted 6 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2714

Quoted 3 lines
app/test-pmd/testpmd.c +0 -0
 		/* multi-pool configuration */
 		for (i = 0; i < mbuf_data_size_n; i++) {
 			mpx = mbuf_pool_find(socket_id, i);

Where the mempools are created? Is that code also needs to be updated to use/check 'multi_mempool' variable/config?

I think it's not required, as user might create multiple pools for other scenarios as well, for example as part of buzilla id: 1128, user creating two pools but not for multi-mempool feature. ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 5,6 -n 8 --force-max-simd-bitwidth=64 -- -i --portmask=0x3 --rxq=1 --txq=1 --txd=1024 --rxd=1024 --nb-cores=1 --mbuf-size=2048,2048

If they are not created explicit for multiple pool, agree to not change that code, thanks.

Quoted 57 lines
Quoted 45 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 2 lines
app/test-pmd/testpmd.c +0 -0
@@ -2709,14 +2716,23 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 8 lines
app/test-pmd/testpmd.c +3 -2
 		}
 		rx_conf->rx_mempools = rx_mempool;
 		rx_conf->rx_nmempool = mbuf_data_size_n;
-	}
-	ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

Quoted 5 lines
app/test-pmd/testpmd.c +0 -4
 				    socket_id, rx_conf, NULL);
-	rx_conf->rx_seg = NULL;
-	rx_conf->rx_nseg = 0;
-	rx_conf->rx_mempools = NULL;
-	rx_conf->rx_nmempool = 0;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +9 -1
-exit:
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+	} else {
+		/* Single pool/segment configuration */
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 5 lines
app/test-pmd/testpmd.c +4 -0
+				    socket_id, rx_conf, mp);
+	}
+
+
 	ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start

?

Quoted 1 line

RTE_ETH_QUEUE_STATE_STOPPED :

Quoted 1 line
	RTE_ETH_QUEUE_STATE_STARTED;
Quoted 7 lines
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

aaf69c349a..9472a2cb19 100644

app/test-pmd/testpmd.h +0 -0
@@ -464,6 +464,7 @@ enum dcb_mode_enable  extern uint8_t

xstats_hide_zero; /**< Hide zero values for xstats display */

Quoted 5 lines
Quoted 2 lines

/* globals used for configuration */
+extern uint8_t multi_mempool; /**< Enables multi-mempool feature.

*/

Again please group this same location as done in .c file

Ack.

Quoted 5 lines
Quoted 4 lines

extern uint8_t record_core_cycles; /**< Enables measurement of CPU
cycles */ extern uint8_t record_burst_stats; /**< Enables display of RX and TX bursts */ extern uint16_t verbose_level; /**< Drives messages

being displayed, if any. */

#18 lore raw

PATCH v6 1/1 app/testpmd: add valid check to verify multi mempool feature

In reply to Hanumanth Pothula

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

Also, add new testpmd command line argument, multi-mempool, to control multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

---
v6:
- Updated run_app.rst file with multi-mempool argument.
- defined and populated multi_mempool at related arguments.
- invoking rte_eth_dev_info_get() withing multi-mempool condition
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/parameters.c             |  4 ++
 app/test-pmd/testpmd.c                | 66 +++++++++++++++++----------
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  4 ++
 4 files changed, 50 insertions(+), 25 deletions(-)
app/test-pmd/parameters.c +4 -0
index aed4cdcb84..d0f7b2f11d 100644
@@ -155,6 +155,7 @@ usage(char* progname)
 	printf("  --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\n");
 	printf("  --txpkts=X[,Y]*: set TX segment sizes"
 		" or total packet length.\n");
+	printf(" --multi-mempool: enable multi-mempool support\n");
 	printf("  --txonly-multi-flow: generate multiple flows in txonly mode\n");
 	printf("  --tx-ip=src,dst: IP addresses in Tx-only mode\n");
 	printf("  --tx-udp=src[,dst]: UDP ports in Tx-only mode\n");
@@ -669,6 +670,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rxpkts",			1, 0, 0 },
 		{ "rxhdrs",			1, 0, 0 },
 		{ "txpkts",			1, 0, 0 },
+		{ "multi-mempool",              0, 0, 0 },
 		{ "txonly-multi-flow",		0, 0, 0 },
 		{ "rxq-share",			2, 0, 0 },
 		{ "eth-link-speed",		1, 0, 0 },
@@ -1295,6 +1297,8 @@ launch_args_parse(int argc, char** argv)
 				else
 					rte_exit(EXIT_FAILURE, "bad txpkts\n");
 			}
+			if (!strcmp(lgopts[opt_idx].name, "multi-mempool"))
+				multi_mempool = 1;
 			if (!strcmp(lgopts[opt_idx].name, "txonly-multi-flow"))
 				txonly_multi_flow = 1;
 			if (!strcmp(lgopts[opt_idx].name, "rxq-share")) {
app/test-pmd/testpmd.c +41 -25

99 lines not on this page · raw message

app/test-pmd/testpmd.h +1 -0
index aaf69c349a..e4f9b142c9 100644
@@ -589,6 +589,7 @@ extern uint32_t max_rx_pkt_len;
 extern uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];
 extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+extern uint8_t multi_mempool; /**< Enables multi-mempool feature. */
 extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 
doc/guides/testpmd_app_ug/run_app.rst +4 -0
index 610e442924..329570e721 100644
@@ -365,6 +365,10 @@ The command line options are:
     Set TX segment sizes or total packet length. Valid for ``tx-only``
     and ``flowgen`` forwarding modes.
 
+* ``--multi-mempool``
+
+    Enable multi-mempool, multiple mbuf pools per Rx queue, support.
+
 *   ``--txonly-multi-flow``
 
     Generate multiple flows in txonly mode.
Signature · 1 line
2.25.1
#19 lore raw
Quoted 3 lines · Hanumanth Pothula

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

Validation 'max_rx_mempools' is not main purpose of this patch, I would move below paragraph up.

Quoted 36 lines

Also, add new testpmd command line argument, multi-mempool, to control multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

---
v6:
- Updated run_app.rst file with multi-mempool argument.
- defined and populated multi_mempool at related arguments.
- invoking rte_eth_dev_info_get() withing multi-mempool condition
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/parameters.c             |  4 ++
 app/test-pmd/testpmd.c                | 66 +++++++++++++++++----------
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  4 ++
 4 files changed, 50 insertions(+), 25 deletions(-)
app/test-pmd/parameters.c +0 -0
index aed4cdcb84..d0f7b2f11d 100644

app/test-pmd/parameters.c usage(char* progname) · line 158

Quoted 4 lines
app/test-pmd/parameters.c +1 -0
@@ -155,6 +155,7 @@ usage(char* progname)
 	printf("  --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\n");
 	printf("  --txpkts=X[,Y]*: set TX segment sizes"
 		" or total packet length.\n");
+	printf(" --multi-mempool: enable multi-mempool support\n");

Indentation is wrong, one space is missing.

Can you also update the '--mbuf-size=' definition, it has:
" ... extra memory pools will be created for allocating mbufs to receive packets with buffer splitting features.",
Now it is for both "buffer splitting and multi Rx mempool features." Even it can be possible to reference to new argument.

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 673

Quoted 8 lines
app/test-pmd/parameters.c +1 -0
 	printf("  --txonly-multi-flow: generate multiple flows in txonly mode\n");
 	printf("  --tx-ip=src,dst: IP addresses in Tx-only mode\n");
 	printf("  --tx-udp=src[,dst]: UDP ports in Tx-only mode\n");
@@ -669,6 +670,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rxpkts",			1, 0, 0 },
 		{ "rxhdrs",			1, 0, 0 },
 		{ "txpkts",			1, 0, 0 },
+		{ "multi-mempool",              0, 0, 0 },

Thinking twice, I am not sure about the 'multi-mempool' name, because 'mbuf-size' already cause to create multiple mempool, 'multi-mempool' can be confusing.
As ethdev variable name is 'max_rx_mempools', what do you think to use 'multi-rx-mempools' here as argument?

Quoted 25 lines
app/test-pmd/parameters.c +2 -0
 		{ "txonly-multi-flow",		0, 0, 0 },
 		{ "rxq-share",			2, 0, 0 },
 		{ "eth-link-speed",		1, 0, 0 },
@@ -1295,6 +1297,8 @@ launch_args_parse(int argc, char** argv)
 				else
 					rte_exit(EXIT_FAILURE, "bad txpkts\n");
 			}
+			if (!strcmp(lgopts[opt_idx].name, "multi-mempool"))
+				multi_mempool = 1;
 			if (!strcmp(lgopts[opt_idx].name, "txonly-multi-flow"))
 				txonly_multi_flow = 1;
 			if (!strcmp(lgopts[opt_idx].name, "rxq-share")) {
app/test-pmd/testpmd.c +1 -0
index 4e25f77c6a..0bf2e4bd0d 100644
@@ -245,6 +245,7 @@ uint32_t max_rx_pkt_len;
  */
 uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+uint8_t multi_mempool; /**< Enables multi-mempool feature */
 uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];

app/test-pmd/testpmd.c uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT] = { · line 263

Quoted 5 lines
app/test-pmd/testpmd.c +2 -0
@@ -258,6 +259,8 @@ uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT] = {
 };
 uint8_t  tx_pkt_nb_segs = 1; /**< Number of segments in TXONLY packets */
 
+
+

Unintendend change.

Quoted 76 lines
app/test-pmd/testpmd.c +28 -25
 enum tx_pkt_split tx_pkt_split = TX_PKT_SPLIT_OFF;
 /**< Split policy for packets to TX. */
 
@@ -2659,24 +2662,9 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	uint32_t prev_hdrs = 0;
 	int ret;
 
-	/* Verify Rx queue configuration is single pool and segment or
-	 * multiple pool/segment.
-	 * @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))) {
-		/* Single pool/segment configuration */
-		rx_conf->rx_seg = NULL;
-		rx_conf->rx_nseg = 0;
-		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
-					     nb_rx_desc, socket_id,
-					     rx_conf, mp);
-		goto exit;
-	}
 
-	if (rx_pkt_nb_segs > 1 ||
-	    rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
+	if ((rx_pkt_nb_segs > 1) &&
+	    (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
 		/* multi-segment configuration */
 		for (i = 0; i < rx_pkt_nb_segs; i++) {
 			struct rte_eth_rxseg_split *rx_seg = &rx_useg[i].split;
@@ -2701,22 +2689,50 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		}
 		rx_conf->rx_nseg = rx_pkt_nb_segs;
 		rx_conf->rx_seg = rx_useg;
-	} else {
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+				    socket_id, rx_conf, NULL);
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+	} else if (multi_mempool == 1) {
 		/* multi-pool configuration */
+		struct rte_eth_dev_info dev_info;
+
+		if (mbuf_data_size_n <= 1) {
+			RTE_LOG(ERR, EAL, "invalid number of mempools %u",
+				mbuf_data_size_n);
+			return -EINVAL;
+		}
+		ret = rte_eth_dev_info_get(port_id, &dev_info);
+		if (ret != 0)
+			return ret;
+		if (dev_info.max_rx_mempools == 0) {
+			RTE_LOG(ERR, EAL, "device doesn't support requested multi-mempool configuration");
+			return -ENOTSUP;
+		}
 		for (i = 0; i < mbuf_data_size_n; i++) {
 			mpx = mbuf_pool_find(socket_id, i);
 			rx_mempool[i] = mpx ? mpx : mp;
 		}
 		rx_conf->rx_mempools = rx_mempool;
 		rx_conf->rx_nmempool = mbuf_data_size_n;
-	}
-	ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
 				    socket_id, rx_conf, NULL);
-	rx_conf->rx_seg = NULL;
-	rx_conf->rx_nseg = 0;
-	rx_conf->rx_mempools = NULL;
-	rx_conf->rx_nmempool = 0;
-exit:
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2735

Quoted 10 lines
app/test-pmd/testpmd.c +10 -0
+	} else {
+		/* Single pool/segment configuration */
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+				    socket_id, rx_conf, mp);
+	}
+

Technically execution can reach to this point without taking any of the braches above, in that case there should be an error here instead of silently continue.

I think either there should be a check here, not sure how to do, or single mempool can be the default setup out of the 'else' block. What do you think?

Quoted 30 lines
app/test-pmd/testpmd.c +0 -0
 	ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start ?
 						RTE_ETH_QUEUE_STATE_STOPPED :
 						RTE_ETH_QUEUE_STATE_STARTED;
app/test-pmd/testpmd.h +1 -0
index aaf69c349a..e4f9b142c9 100644
@@ -589,6 +589,7 @@ extern uint32_t max_rx_pkt_len;
 extern uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];
 extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+extern uint8_t multi_mempool; /**< Enables multi-mempool feature. */
 extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 
doc/guides/testpmd_app_ug/run_app.rst +4 -0
index 610e442924..329570e721 100644
@@ -365,6 +365,10 @@ The command line options are:
     Set TX segment sizes or total packet length. Valid for ``tx-only``
     and ``flowgen`` forwarding modes.
 
+* ``--multi-mempool``
+
+    Enable multi-mempool, multiple mbuf pools per Rx queue, support.
+
 *   ``--txonly-multi-flow``
 
     Generate multiple flows in txonly mode.
#20 lore raw
Quoted 70 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, November 21, 2022 11:02 PM
To: Hanumanth Reddy Pothula <[email protected]>; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: [EXT] Re: [PATCH v6 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

----------------------------------------------------------------------

Quoted 3 lines · Hanumanth Pothula

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

Validation 'max_rx_mempools' is not main purpose of this patch, I would move below paragraph up.

Quoted 1 line

Also, add new testpmd command line argument, multi-mempool, to

control

Quoted 36 lines

multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx

queue")

---
v6:
- Updated run_app.rst file with multi-mempool argument.
- defined and populated multi_mempool at related arguments.
- invoking rte_eth_dev_info_get() withing multi-mempool condition
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/parameters.c             |  4 ++
 app/test-pmd/testpmd.c                | 66 +++++++++++++++++----------
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  4 ++
 4 files changed, 50 insertions(+), 25 deletions(-)
app/test-pmd/parameters.c +0 -0
index aed4cdcb84..d0f7b2f11d 100644

app/test-pmd/parameters.c usage(char* progname) · line 158

Quoted 4 lines
app/test-pmd/parameters.c +1 -0
@@ -155,6 +155,7 @@ usage(char* progname)
 	printf("  --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\n");
 	printf("  --txpkts=X[,Y]*: set TX segment sizes"
 		" or total packet length.\n");
+	printf(" --multi-mempool: enable multi-mempool support\n");

Indentation is wrong, one space is missing.

Quoted 5 lines

Can you also update the '--mbuf-size=' definition, it has:
" ... extra memory pools will be created for allocating mbufs to receive packets with buffer splitting features.", Now it is for both "buffer splitting and multi Rx mempool features."
Even it can be possible to reference to new argument.

Sure, will update.

Quoted 16 lines

app/test-pmd/parameters.c usage(char* progname) · line 159

Quoted 2 lines
app/test-pmd/parameters.c +0 -0
 	printf("  --txonly-multi-flow: generate multiple flows in txonly

mode\n");

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 673

Quoted 7 lines
app/test-pmd/parameters.c +1 -1
 	printf("  --tx-ip=src,dst: IP addresses in Tx-only mode\n");
 	printf("  --tx-udp=src[,dst]: UDP ports in Tx-only mode\n"); @@
-669,6 +670,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rxpkts",			1, 0, 0 },
 		{ "rxhdrs",			1, 0, 0 },
 		{ "txpkts",			1, 0, 0 },
+		{ "multi-mempool",              0, 0, 0 },

Thinking twice, I am not sure about the 'multi-mempool' name, because 'mbuf-size' already cause to create multiple mempool, 'multi-mempool' can be confusing.
As ethdev variable name is 'max_rx_mempools', what do you think to use 'multi-rx-mempools' here as argument?

Yes, 'multi-rx-mempools' looks clean.

Quoted 31 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1298

Quoted 7 lines
app/test-pmd/parameters.c +0 -0
 		{ "txonly-multi-flow",		0, 0, 0 },
 		{ "rxq-share",			2, 0, 0 },
 		{ "eth-link-speed",		1, 0, 0 },
@@ -1295,6 +1297,8 @@ launch_args_parse(int argc, char** argv)
 				else
 					rte_exit(EXIT_FAILURE, "bad

txpkts\n");

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1300

Quoted 2 lines
app/test-pmd/parameters.c +1 -0
 			}
+			if (!strcmp(lgopts[opt_idx].name, "multi-

mempool"))

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1302

Quoted 2 lines
app/test-pmd/parameters.c +1 -0
+				multi_mempool = 1;
 			if (!strcmp(lgopts[opt_idx].name, "txonly-multi-

flow"))

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1304

Quoted 2 lines
app/test-pmd/parameters.c +0 -0
 				txonly_multi_flow = 1;
 			if (!strcmp(lgopts[opt_idx].name, "rxq-share")) { diff

--git

app/test-pmd/testpmd.c uint16_t

Quoted 13 lines

a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4e25f77c6a..0bf2e4bd0d 100644

app/test-pmd/testpmd.c +1 -0
@@ -245,6 +245,7 @@ uint32_t max_rx_pkt_len;
  */
 uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+uint8_t multi_mempool; /**< Enables multi-mempool feature */
 uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];
@@ -258,6 +259,8 @@ uint16_t

tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT]

Quoted 7 lines

app/test-pmd/testpmd.c

Quoted 5 lines

= { }; uint8_t tx_pkt_nb_segs = 1; /**< Number of segments in TXONLY packets */

app/test-pmd/testpmd.c +2 -0
+
+

Unintendend change.

Ack

Quoted 101 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 5 lines

enum tx_pkt_split tx_pkt_split = TX_PKT_SPLIT_OFF; /**< Split policy
for packets to TX. */

app/test-pmd/testpmd.c +0 -0
@@ -2659,24 +2662,9 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +0 -7
 	uint32_t prev_hdrs = 0;
 	int ret;
 
-	/* Verify Rx queue configuration is single pool and segment or
-	 * multiple pool/segment.
-	 * @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))) {

Quoted 6 lines
app/test-pmd/testpmd.c +0 -6
-		/* Single pool/segment configuration */
-		rx_conf->rx_seg = NULL;
-		rx_conf->rx_nseg = 0;
-		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
-					     nb_rx_desc, socket_id,
-					     rx_conf, mp);

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +2 -4
-		goto exit;
-	}
 
-	if (rx_pkt_nb_segs > 1 ||
-	    rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
+	if ((rx_pkt_nb_segs > 1) &&
+	    (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
 		/* multi-segment configuration */
 		for (i = 0; i < rx_pkt_nb_segs; i++) {
 			struct rte_eth_rxseg_split *rx_seg =

&rx_useg[i].split; @@

Quoted 1 line

-2701,22 +2689,50 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 7 lines
app/test-pmd/testpmd.c +3 -1
 		}
 		rx_conf->rx_nseg = rx_pkt_nb_segs;
 		rx_conf->rx_seg = rx_useg;
-	} else {
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 9 lines
app/test-pmd/testpmd.c +8 -0
+				    socket_id, rx_conf, NULL);
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+	} else if (multi_mempool == 1) {
 		/* multi-pool configuration */
+		struct rte_eth_dev_info dev_info;
+
+		if (mbuf_data_size_n <= 1) {
+			RTE_LOG(ERR, EAL, "invalid number of mempools

%u",

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 8 lines
app/test-pmd/testpmd.c +8 -0
+				mbuf_data_size_n);
+			return -EINVAL;
+		}
+		ret = rte_eth_dev_info_get(port_id, &dev_info);
+		if (ret != 0)
+			return ret;
+		if (dev_info.max_rx_mempools == 0) {
+			RTE_LOG(ERR, EAL, "device doesn't support

requested multi-mempool configuration");

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 13 lines
app/test-pmd/testpmd.c +5 -2
+			return -ENOTSUP;
+		}
 		for (i = 0; i < mbuf_data_size_n; i++) {
 			mpx = mbuf_pool_find(socket_id, i);
 			rx_mempool[i] = mpx ? mpx : mp;
 		}
 		rx_conf->rx_mempools = rx_mempool;
 		rx_conf->rx_nmempool = mbuf_data_size_n;
-	}
-	ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

Quoted 5 lines
app/test-pmd/testpmd.c +0 -4
 				    socket_id, rx_conf, NULL);
-	rx_conf->rx_seg = NULL;
-	rx_conf->rx_nseg = 0;
-	rx_conf->rx_mempools = NULL;
-	rx_conf->rx_nmempool = 0;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +9 -1
-exit:
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+	} else {
+		/* Single pool/segment configuration */
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2735

Quoted 3 lines
app/test-pmd/testpmd.c +3 -0
+				    socket_id, rx_conf, mp);
+	}
+

Technically execution can reach to this point without taking any of the braches above, in that case there should be an error here instead of silently continue.

Quoted 4 lines

I think either there should be a check here, not sure how to do, or single mempool can be the default setup out of the 'else' block. What do you think?

Yes, default case(final else) is going to be single pool/segment. I think there is no need of error return.

This function(rx_queue_setup()) returns return of rte_eth_rx_queue_setup().

Quoted 36 lines
Quoted 1 line

ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start

?

Quoted 1 line

RTE_ETH_QUEUE_STATE_STOPPED :

Quoted 1 line
	RTE_ETH_QUEUE_STATE_STARTED;

app/test-pmd/testpmd.h extern uint32_t max_rx_pkt_len; extern

Quoted 5 lines
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

aaf69c349a..e4f9b142c9 100644

app/test-pmd/testpmd.h +0 -0
@@ -589,6 +589,7 @@ extern uint32_t max_rx_pkt_len;  extern

uint32_t

app/test-pmd/testpmd.h extern uint32_t max_rx_pkt_len;

Quoted 4 lines
app/test-pmd/testpmd.h +1 -0
 rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];
 extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+extern uint8_t multi_mempool; /**< Enables multi-mempool feature.

*/

Quoted 19 lines
app/test-pmd/testpmd.h +0 -0
 extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 
doc/guides/testpmd_app_ug/run_app.rst +4 -0
index 610e442924..329570e721 100644
@@ -365,6 +365,10 @@ The command line options are:
     Set TX segment sizes or total packet length. Valid for ``tx-only``
     and ``flowgen`` forwarding modes.
 
+* ``--multi-mempool``
+
+    Enable multi-mempool, multiple mbuf pools per Rx queue, support.
+
 *   ``--txonly-multi-flow``
 
     Generate multiple flows in txonly mode.
#21 lore raw
Quoted 236 lines · Hanumanth Reddy Pothula
Quoted 70 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, November 21, 2022 11:02 PM
To: Hanumanth Reddy Pothula <[email protected]>; Aman Singh <[email protected]>; Yuying Zhang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: [EXT] Re: [PATCH v6 1/1] app/testpmd: add valid check to verify multi mempool feature

External Email

----------------------------------------------------------------------

Quoted 3 lines · Hanumanth Pothula

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

Validation 'max_rx_mempools' is not main purpose of this patch, I would move below paragraph up.

Quoted 1 line

Also, add new testpmd command line argument, multi-mempool, to

control

Quoted 36 lines

multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx

queue")

---
v6:
- Updated run_app.rst file with multi-mempool argument.
- defined and populated multi_mempool at related arguments.
- invoking rte_eth_dev_info_get() withing multi-mempool condition
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/parameters.c             |  4 ++
 app/test-pmd/testpmd.c                | 66 +++++++++++++++++----------
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  4 ++
 4 files changed, 50 insertions(+), 25 deletions(-)
app/test-pmd/parameters.c +0 -0
index aed4cdcb84..d0f7b2f11d 100644

app/test-pmd/parameters.c usage(char* progname) · line 158

Quoted 4 lines
app/test-pmd/parameters.c +1 -0
@@ -155,6 +155,7 @@ usage(char* progname)
 	printf("  --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\n");
 	printf("  --txpkts=X[,Y]*: set TX segment sizes"
 		" or total packet length.\n");
+	printf(" --multi-mempool: enable multi-mempool support\n");

Indentation is wrong, one space is missing.

Quoted 5 lines

Can you also update the '--mbuf-size=' definition, it has:
" ... extra memory pools will be created for allocating mbufs to receive packets with buffer splitting features.", Now it is for both "buffer splitting and multi Rx mempool features."
Even it can be possible to reference to new argument.

Sure, will update.

Quoted 16 lines

app/test-pmd/parameters.c usage(char* progname) · line 159

Quoted 2 lines
app/test-pmd/parameters.c +0 -0
 	printf("  --txonly-multi-flow: generate multiple flows in txonly

mode\n");

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 673

Quoted 7 lines
app/test-pmd/parameters.c +1 -1
 	printf("  --tx-ip=src,dst: IP addresses in Tx-only mode\n");
 	printf("  --tx-udp=src[,dst]: UDP ports in Tx-only mode\n"); @@
-669,6 +670,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rxpkts",			1, 0, 0 },
 		{ "rxhdrs",			1, 0, 0 },
 		{ "txpkts",			1, 0, 0 },
+		{ "multi-mempool",              0, 0, 0 },

Thinking twice, I am not sure about the 'multi-mempool' name, because 'mbuf-size' already cause to create multiple mempool, 'multi-mempool' can be confusing.
As ethdev variable name is 'max_rx_mempools', what do you think to use 'multi-rx-mempools' here as argument?

Yes, 'multi-rx-mempools' looks clean.

Quoted 31 lines

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1298

Quoted 7 lines
app/test-pmd/parameters.c +0 -0
 		{ "txonly-multi-flow",		0, 0, 0 },
 		{ "rxq-share",			2, 0, 0 },
 		{ "eth-link-speed",		1, 0, 0 },
@@ -1295,6 +1297,8 @@ launch_args_parse(int argc, char** argv)
 				else
 					rte_exit(EXIT_FAILURE, "bad

txpkts\n");

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1300

Quoted 2 lines
app/test-pmd/parameters.c +1 -0
 			}
+			if (!strcmp(lgopts[opt_idx].name, "multi-

mempool"))

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1302

Quoted 2 lines
app/test-pmd/parameters.c +1 -0
+				multi_mempool = 1;
 			if (!strcmp(lgopts[opt_idx].name, "txonly-multi-

flow"))

app/test-pmd/parameters.c launch_args_parse(int argc, char** argv) · line 1304

Quoted 2 lines
app/test-pmd/parameters.c +0 -0
 				txonly_multi_flow = 1;
 			if (!strcmp(lgopts[opt_idx].name, "rxq-share")) { diff

--git

app/test-pmd/testpmd.c uint16_t

Quoted 13 lines

a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4e25f77c6a..0bf2e4bd0d 100644

app/test-pmd/testpmd.c +1 -0
@@ -245,6 +245,7 @@ uint32_t max_rx_pkt_len;
  */
 uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+uint8_t multi_mempool; /**< Enables multi-mempool feature */
 uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];
@@ -258,6 +259,8 @@ uint16_t

tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT]

Quoted 7 lines

app/test-pmd/testpmd.c

Quoted 5 lines

= { }; uint8_t tx_pkt_nb_segs = 1; /**< Number of segments in TXONLY packets */

app/test-pmd/testpmd.c +2 -0
+
+

Unintendend change.

Ack

Quoted 101 lines

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t

Quoted 5 lines

enum tx_pkt_split tx_pkt_split = TX_PKT_SPLIT_OFF; /**< Split policy
for packets to TX. */

app/test-pmd/testpmd.c +0 -0
@@ -2659,24 +2662,9 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +0 -7
 	uint32_t prev_hdrs = 0;
 	int ret;
 
-	/* Verify Rx queue configuration is single pool and segment or
-	 * multiple pool/segment.
-	 * @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))) {

Quoted 6 lines
app/test-pmd/testpmd.c +0 -6
-		/* Single pool/segment configuration */
-		rx_conf->rx_seg = NULL;
-		rx_conf->rx_nseg = 0;
-		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
-					     nb_rx_desc, socket_id,
-					     rx_conf, mp);

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +2 -4
-		goto exit;
-	}
 
-	if (rx_pkt_nb_segs > 1 ||
-	    rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
+	if ((rx_pkt_nb_segs > 1) &&
+	    (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
 		/* multi-segment configuration */
 		for (i = 0; i < rx_pkt_nb_segs; i++) {
 			struct rte_eth_rxseg_split *rx_seg =

&rx_useg[i].split; @@

Quoted 1 line

-2701,22 +2689,50 @@ rx_queue_setup(uint16_t port_id, uint16_t

rx_queue_id,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 7 lines
app/test-pmd/testpmd.c +3 -1
 		}
 		rx_conf->rx_nseg = rx_pkt_nb_segs;
 		rx_conf->rx_seg = rx_useg;
-	} else {
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 9 lines
app/test-pmd/testpmd.c +8 -0
+				    socket_id, rx_conf, NULL);
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+	} else if (multi_mempool == 1) {
 		/* multi-pool configuration */
+		struct rte_eth_dev_info dev_info;
+
+		if (mbuf_data_size_n <= 1) {
+			RTE_LOG(ERR, EAL, "invalid number of mempools

%u",

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 8 lines
app/test-pmd/testpmd.c +8 -0
+				mbuf_data_size_n);
+			return -EINVAL;
+		}
+		ret = rte_eth_dev_info_get(port_id, &dev_info);
+		if (ret != 0)
+			return ret;
+		if (dev_info.max_rx_mempools == 0) {
+			RTE_LOG(ERR, EAL, "device doesn't support

requested multi-mempool configuration");

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 13 lines
app/test-pmd/testpmd.c +5 -2
+			return -ENOTSUP;
+		}
 		for (i = 0; i < mbuf_data_size_n; i++) {
 			mpx = mbuf_pool_find(socket_id, i);
 			rx_mempool[i] = mpx ? mpx : mp;
 		}
 		rx_conf->rx_mempools = rx_mempool;
 		rx_conf->rx_nmempool = mbuf_data_size_n;
-	}
-	ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

Quoted 5 lines
app/test-pmd/testpmd.c +0 -4
 				    socket_id, rx_conf, NULL);
-	rx_conf->rx_seg = NULL;
-	rx_conf->rx_nseg = 0;
-	rx_conf->rx_mempools = NULL;
-	rx_conf->rx_nmempool = 0;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,

Quoted 10 lines
app/test-pmd/testpmd.c +9 -1
-exit:
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+	} else {
+		/* Single pool/segment configuration */
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,

nb_rx_desc,

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2735

Quoted 3 lines
app/test-pmd/testpmd.c +3 -0
+				    socket_id, rx_conf, mp);
+	}
+

Technically execution can reach to this point without taking any of the braches above, in that case there should be an error here instead of silently continue.

Quoted 8 lines
Quoted 4 lines

I think either there should be a check here, not sure how to do, or single mempool can be the default setup out of the 'else' block. What do you think?

Yes, default case(final else) is going to be single pool/segment. I think there is no need of error return.

This function(rx_queue_setup()) returns return of rte_eth_rx_queue_setup().

ack

Quoted 37 lines
Quoted 36 lines
Quoted 1 line

ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start

?

Quoted 1 line

RTE_ETH_QUEUE_STATE_STOPPED :

Quoted 1 line
	RTE_ETH_QUEUE_STATE_STARTED;

app/test-pmd/testpmd.h extern uint32_t max_rx_pkt_len; extern

Quoted 5 lines
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

aaf69c349a..e4f9b142c9 100644

app/test-pmd/testpmd.h +0 -0
@@ -589,6 +589,7 @@ extern uint32_t max_rx_pkt_len;  extern

uint32_t

app/test-pmd/testpmd.h extern uint32_t max_rx_pkt_len;

Quoted 4 lines
app/test-pmd/testpmd.h +1 -0
 rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];
 extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+extern uint8_t multi_mempool; /**< Enables multi-mempool feature.

*/

Quoted 19 lines
app/test-pmd/testpmd.h +0 -0
 extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 
doc/guides/testpmd_app_ug/run_app.rst +4 -0
index 610e442924..329570e721 100644
@@ -365,6 +365,10 @@ The command line options are:
     Set TX segment sizes or total packet length. Valid for ``tx-only``
     and ``flowgen`` forwarding modes.
 
+* ``--multi-mempool``
+
+    Enable multi-mempool, multiple mbuf pools per Rx queue, support.
+
 *   ``--txonly-multi-flow``
 
     Generate multiple flows in txonly mode.
#22 lore raw

PATCH v7 1/1 app/testpmd: add valid check to verify multi mempool feature

In reply to Hanumanth Pothula

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

Also, add new testpmd command line argument, multi-mempool, to control multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

---
v7:
- Update testpmd argument name from multi-mempool to multi-rx-mempool.
- Upated defination of testpmd argument, mbuf-size.
- Resolved indentations.
v6:
- Updated run_app.rst file with multi-mempool argument.
- defined and populated multi_mempool at related arguments.
- invoking rte_eth_dev_info_get() withing multi-mempool condition
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/parameters.c             |  7 ++-
 app/test-pmd/testpmd.c                | 64 ++++++++++++++++-----------
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  4 ++
 4 files changed, 50 insertions(+), 26 deletions(-)
app/test-pmd/parameters.c +6 -1
index aed4cdcb84..af9ec39cf9 100644
@@ -88,7 +88,8 @@ usage(char* progname)
 	       "in NUMA mode.\n");
 	printf("  --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to "
 	       "N bytes. If multiple numbers are specified the extra pools "
-	       "will be created to receive with packet split features\n");
+	       "will be created to receive packets based on the features "
+	       "supported, like buufer-split, multi-mempool.\n");
 	printf("  --total-num-mbufs=N: set the number of mbufs to be allocated "
 	       "in mbuf pools.\n");
 	printf("  --max-pkt-len=N: set the maximum size of packet to N bytes.\n");
@@ -155,6 +156,7 @@ usage(char* progname)
 	printf("  --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\n");
 	printf("  --txpkts=X[,Y]*: set TX segment sizes"
 		" or total packet length.\n");
+	printf("  --multi-rx-mempool: enable multi-mempool support\n");
 	printf("  --txonly-multi-flow: generate multiple flows in txonly mode\n");
 	printf("  --tx-ip=src,dst: IP addresses in Tx-only mode\n");
 	printf("  --tx-udp=src[,dst]: UDP ports in Tx-only mode\n");
@@ -669,6 +671,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rxpkts",			1, 0, 0 },
 		{ "rxhdrs",			1, 0, 0 },
 		{ "txpkts",			1, 0, 0 },
+		{ "multi-rx-mempool",           0, 0, 0 },
 		{ "txonly-multi-flow",		0, 0, 0 },
 		{ "rxq-share",			2, 0, 0 },
 		{ "eth-link-speed",		1, 0, 0 },
@@ -1295,6 +1298,8 @@ launch_args_parse(int argc, char** argv)
 				else
 					rte_exit(EXIT_FAILURE, "bad txpkts\n");
 			}
+			if (!strcmp(lgopts[opt_idx].name, "multi-rx-mempool"))
+				multi_rx_mempool = 1;
 			if (!strcmp(lgopts[opt_idx].name, "txonly-multi-flow"))
 				txonly_multi_flow = 1;
 			if (!strcmp(lgopts[opt_idx].name, "rxq-share")) {
app/test-pmd/testpmd.c +39 -25

91 lines not on this page · raw message

app/test-pmd/testpmd.h +1 -0
index aaf69c349a..0596d38cd2 100644
@@ -589,6 +589,7 @@ extern uint32_t max_rx_pkt_len;
 extern uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];
 extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+extern uint8_t multi_rx_mempool; /**< Enables multi-mempool feature. */
 extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 
doc/guides/testpmd_app_ug/run_app.rst +4 -0
index 610e442924..af84b2260a 100644
@@ -365,6 +365,10 @@ The command line options are:
     Set TX segment sizes or total packet length. Valid for ``tx-only``
     and ``flowgen`` forwarding modes.
 
+* ``--multi-rx-mempool``
+
+    Enable multi-mempool, multiple mbuf pools per Rx queue, support.
+
 *   ``--txonly-multi-flow``
 
     Generate multiple flows in txonly mode.
Signature · 1 line
2.25.1
Reviewed-by on v7 1/1
#23 lore raw
Quoted 5 lines · Hanumanth Pothula

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

Also, add new testpmd command line argument, multi-mempool, to control multi-mempool feature. By default its disabled.

s/multi-mempool/multi-rx-mempool/

Also moving argument paragraph up.

Quoted 5 lines

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue")

With noted issues fixed,
Applied to dpdk-next-net/main, thanks.

Lets wait test report before requesting this to be merged to main repo.

@Yu, @Yuying,

Can you please verify this at the latest head of the next-net tree?

Thanks,
ferruh

Quoted 33 lines

---
v7:
- Update testpmd argument name from multi-mempool to multi-rx-mempool.
- Upated defination of testpmd argument, mbuf-size.
- Resolved indentations.
v6:
- Updated run_app.rst file with multi-mempool argument.
- defined and populated multi_mempool at related arguments.
- invoking rte_eth_dev_info_get() withing multi-mempool condition
v5:
- Added testpmd argument to enable multi-mempool feature.
- Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment.
v4:
- updated if condition.
v3:
- Simplified conditional check.
- Corrected spell, whether.
v2:
- Rebased on tip of next-net/main.

---
 app/test-pmd/parameters.c             |  7 ++-
 app/test-pmd/testpmd.c                | 64 ++++++++++++++++-----------
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  4 ++
 4 files changed, 50 insertions(+), 26 deletions(-)
app/test-pmd/parameters.c +0 -0
index aed4cdcb84..af9ec39cf9 100644

app/test-pmd/parameters.c usage(char* progname) · line 92

Quoted 6 lines
app/test-pmd/parameters.c +2 -1
@@ -88,7 +88,8 @@ usage(char* progname)
 	       "in NUMA mode.\n");
 	printf("  --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to "
 	       "N bytes. If multiple numbers are specified the extra pools "
-	       "will be created to receive with packet split features\n");
+	       "will be created to receive packets based on the features "
+	       "supported, like buufer-split, multi-mempool.\n");

s/buufer/buffer/

Quoted 33 lines
app/test-pmd/parameters.c +4 -0
 	printf("  --total-num-mbufs=N: set the number of mbufs to be allocated "
 	       "in mbuf pools.\n");
 	printf("  --max-pkt-len=N: set the maximum size of packet to N bytes.\n");
@@ -155,6 +156,7 @@ usage(char* progname)
 	printf("  --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\n");
 	printf("  --txpkts=X[,Y]*: set TX segment sizes"
 		" or total packet length.\n");
+	printf("  --multi-rx-mempool: enable multi-mempool support\n");
 	printf("  --txonly-multi-flow: generate multiple flows in txonly mode\n");
 	printf("  --tx-ip=src,dst: IP addresses in Tx-only mode\n");
 	printf("  --tx-udp=src[,dst]: UDP ports in Tx-only mode\n");
@@ -669,6 +671,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rxpkts",			1, 0, 0 },
 		{ "rxhdrs",			1, 0, 0 },
 		{ "txpkts",			1, 0, 0 },
+		{ "multi-rx-mempool",           0, 0, 0 },
 		{ "txonly-multi-flow",		0, 0, 0 },
 		{ "rxq-share",			2, 0, 0 },
 		{ "eth-link-speed",		1, 0, 0 },
@@ -1295,6 +1298,8 @@ launch_args_parse(int argc, char** argv)
 				else
 					rte_exit(EXIT_FAILURE, "bad txpkts\n");
 			}
+			if (!strcmp(lgopts[opt_idx].name, "multi-rx-mempool"))
+				multi_rx_mempool = 1;
 			if (!strcmp(lgopts[opt_idx].name, "txonly-multi-flow"))
 				txonly_multi_flow = 1;
 			if (!strcmp(lgopts[opt_idx].name, "rxq-share")) {
app/test-pmd/testpmd.c +0 -0
index 4e25f77c6a..716937925e 100644

app/test-pmd/testpmd.c uint32_t max_rx_pkt_len; · line 251

Quoted 7 lines
app/test-pmd/testpmd.c +1 -0
@@ -245,6 +245,7 @@ uint32_t max_rx_pkt_len;
  */
 uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+uint8_t multi_rx_mempool; /**< Enables multi-mempool feature */
 uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];

Better to move new variable out of packet split related variables, and below them.

Quoted 34 lines
app/test-pmd/testpmd.c +4 -18
@@ -2659,24 +2660,9 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	uint32_t prev_hdrs = 0;
 	int ret;
 
-	/* Verify Rx queue configuration is single pool and segment or
-	 * multiple pool/segment.
-	 * @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))) {
-		/* Single pool/segment configuration */
-		rx_conf->rx_seg = NULL;
-		rx_conf->rx_nseg = 0;
-		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
-					     nb_rx_desc, socket_id,
-					     rx_conf, mp);
-		goto exit;
-	}
 
-	if (rx_pkt_nb_segs > 1 ||
-	    rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {
+	if ((rx_pkt_nb_segs > 1) &&
+	    (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) {
 		/* multi-segment configuration */
 		for (i = 0; i < rx_pkt_nb_segs; i++) {
 			struct rte_eth_rxseg_split *rx_seg = &rx_useg[i].split;
@@ -2701,22 +2687,50 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		}
 		rx_conf->rx_nseg = rx_pkt_nb_segs;
 		rx_conf->rx_seg = rx_useg;
-	} else {
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;

app/test-pmd/testpmd.c rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, · line 2701

Quoted 10 lines
app/test-pmd/testpmd.c +9 -0
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+				    socket_id, rx_conf, NULL);
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+	} else if (multi_rx_mempool == 1) {
 		/* multi-pool configuration */
+		struct rte_eth_dev_info dev_info;
+
+		if (mbuf_data_size_n <= 1) {
+			RTE_LOG(ERR, EAL, "invalid number of mempools %u",

This for EAL logs, not for testpmd, converting them to "fprintf(stderr, .." as done in rest of the file.

Quoted 69 lines
app/test-pmd/testpmd.c +25 -7
+				mbuf_data_size_n);
+			return -EINVAL;
+		}
+		ret = rte_eth_dev_info_get(port_id, &dev_info);
+		if (ret != 0)
+			return ret;
+		if (dev_info.max_rx_mempools == 0) {
+			RTE_LOG(ERR, EAL, "device doesn't support requested multi-mempool configuration");
+			return -ENOTSUP;
+		}
 		for (i = 0; i < mbuf_data_size_n; i++) {
 			mpx = mbuf_pool_find(socket_id, i);
 			rx_mempool[i] = mpx ? mpx : mp;
 		}
 		rx_conf->rx_mempools = rx_mempool;
 		rx_conf->rx_nmempool = mbuf_data_size_n;
-	}
-	ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
 				    socket_id, rx_conf, NULL);
-	rx_conf->rx_seg = NULL;
-	rx_conf->rx_nseg = 0;
-	rx_conf->rx_mempools = NULL;
-	rx_conf->rx_nmempool = 0;
-exit:
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+	} else {
+		/* Single pool/segment configuration */
+		rx_conf->rx_seg = NULL;
+		rx_conf->rx_nseg = 0;
+		rx_conf->rx_mempools = NULL;
+		rx_conf->rx_nmempool = 0;
+		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc,
+				    socket_id, rx_conf, mp);
+	}
+
 	ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start ?
 						RTE_ETH_QUEUE_STATE_STOPPED :
 						RTE_ETH_QUEUE_STATE_STARTED;
app/test-pmd/testpmd.h +1 -0
index aaf69c349a..0596d38cd2 100644
@@ -589,6 +589,7 @@ extern uint32_t max_rx_pkt_len;
 extern uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];
 extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+extern uint8_t multi_rx_mempool; /**< Enables multi-mempool feature. */
 extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 
doc/guides/testpmd_app_ug/run_app.rst +4 -0
index 610e442924..af84b2260a 100644
@@ -365,6 +365,10 @@ The command line options are:
     Set TX segment sizes or total packet length. Valid for ``tx-only``
     and ``flowgen`` forwarding modes.
 
+* ``--multi-rx-mempool``
+
+    Enable multi-mempool, multiple mbuf pools per Rx queue, support.
+
 *   ``--txonly-multi-flow``
 
     Generate multiple flows in txonly mode.
Tested-by on v7 1/1
#24 lore raw
In reply to Hanumanth Pothula
Quoted 15 lines

-----Original Message-----
From: Hanumanth Pothula <[email protected]>
Sent: Tuesday, November 22, 2022 2:08 AM
To: Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jiang, YuX <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH v7 1/1] app/testpmd: add valid check to verify multi mempool feature

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

Quoted 8 lines

Also, add new testpmd command line argument, multi-mempool, to control multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx

queue")

Tested-by
#25 lore raw
Quoted 32 lines

-----Original Message-----
From: Han, YingyaX <[email protected]>
Sent: Tuesday, November 22, 2022 2:43 PM
To: Hanumanth Pothula <[email protected]>; Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jiang, YuX <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v7 1/1] app/testpmd: add valid check to verify multi mempool feature

Quoted 6 lines

-----Original Message-----
From: Hanumanth Pothula <[email protected]>
Sent: Tuesday, November 22, 2022 2:08 AM
To: Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; [email protected];

[email protected];

Quoted 9 lines

Jiang, YuX <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH v7 1/1] app/testpmd: add valid check to verify multi mempool feature

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

Also, add new testpmd command line argument, multi-mempool, to

control

Quoted 2 lines

multi-mempool feature. By default its disabled.

Quoted 9 lines
Quoted 5 lines

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx

queue")

#26 lore raw
Quoted 36 lines · Yaqi
Quoted 36 lines

-----Original Message-----
From: Han, YingyaX <[email protected]>
Sent: Tuesday, November 22, 2022 2:43 PM
To: Hanumanth Pothula <[email protected]>; Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jiang, YuX <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v7 1/1] app/testpmd: add valid check to verify multi mempool feature

Quoted 6 lines

-----Original Message-----
From: Hanumanth Pothula <[email protected]>
Sent: Tuesday, November 22, 2022 2:08 AM
To: Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; [email protected];

[email protected];

Quoted 9 lines

Jiang, YuX <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH v7 1/1] app/testpmd: add valid check to verify multi mempool feature

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

Also, add new testpmd command line argument, multi-mempool, to

control

Quoted 6 lines

multi-mempool feature. By default its disabled.

Bugzilla ID: 1128

Fixes 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx

queue")

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Thanks Yingya, Yaqi, I have updated commit log with these tags.