Skip to contentSkip to conversation

app/testpmd: support unequal number of RXQ and TXQ

PATCH In review [email protected] 2 participants 5 messages Sep 28, 2021 – Oct 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: support unequal number of RXQ and TXQ

From: Jun Yang <[email protected]>

The existing forwarding mode configures the total number of queues as the minimum of rxq and txq, so eventually the number of txq are same as rxq.
However in some scenarios, specially for flow control the number of rxq and txq can be different.
This patch makes the txq and function of rxq for all such scenario instead of keeping 1:1 relationship between the two.

---
 app/test-pmd/config.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
app/test-pmd/config.c +2 -4
index f5765b34f7..7e17f233ba 100644
@@ -3000,8 +3000,6 @@ rss_fwd_config_setup(void)
 	int end;
 
 	nb_q = nb_rxq;
-	if (nb_q > nb_txq)
-		nb_q = nb_txq;
 	cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
 	cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
 	cur_fwd_config.nb_fwd_streams =
@@ -3038,7 +3036,7 @@ rss_fwd_config_setup(void)
 		fs->rx_port = fwd_ports_ids[rxp];
 		fs->rx_queue = rxq;
 		fs->tx_port = fwd_ports_ids[txp];
-		fs->tx_queue = rxq;
+		fs->tx_queue = (rxq % nb_txq);
 		fs->peer_addr = fs->tx_port;
 		fs->retry_enabled = retry_enabled;
 		rxp++;
@@ -3253,7 +3251,7 @@ fwd_config_setup(void)
 		return;
 	}
 
-	if ((nb_rxq > 1) && (nb_txq > 1)){
+	if ((nb_rxq > 1) && (nb_txq > 1)) {
 		if (dcb_config) {
 			for (i = 0; i < nb_fwd_ports; i++) {
 				pt_id = fwd_ports_ids[i];
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 app/testpmd: update raw flow to take hex input

From: Nipun Gupta <[email protected]>

This patch enables method to provide key and mask for raw rules to be provided as hexadecimal values. There is new parameter pattern_mask added to support this.

---
 app/test-pmd/cmdline_flow.c                 | 15 +++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 +++++++++++++
 2 files changed, 28 insertions(+)
app/test-pmd/cmdline_flow.c +15 -0
index 6cd99bf37f..a95b147d92 100644
@@ -158,6 +158,7 @@ enum index {
 	ITEM_RAW_OFFSET,
 	ITEM_RAW_LIMIT,
 	ITEM_RAW_PATTERN,
+	ITEM_RAW_PATTERN_HEX,
 	ITEM_ETH,
 	ITEM_ETH_DST,
 	ITEM_ETH_SRC,
@@ -1046,6 +1047,7 @@ static const enum index item_raw[] = {
 	ITEM_RAW_OFFSET,
 	ITEM_RAW_LIMIT,
 	ITEM_RAW_PATTERN,
+	ITEM_RAW_PATTERN_HEX,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2487,6 +2489,19 @@ static const struct token token_list[] = {
 			     ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw),
 					    ITEM_RAW_PATTERN_SIZE)),
 	},
+	[ITEM_RAW_PATTERN_HEX] = {
+		.name = "pattern_hex",
+		.help = "hex string to look for",
+		.next = NEXT(item_raw,
+			     NEXT_ENTRY(HEX),
+			     NEXT_ENTRY(ITEM_PARAM_IS,
+					ITEM_PARAM_SPEC,
+					ITEM_PARAM_MASK)),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_raw, pattern),
+			     ARGS_ENTRY(struct rte_flow_item_raw, length),
+			     ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw),
+					    ITEM_RAW_PATTERN_SIZE)),
+	},
 	[ITEM_ETH] = {
 		.name = "eth",
 		.help = "match Ethernet header",
doc/guides/testpmd_app_ug/testpmd_funcs.rst +13 -0
index 4f8751be1c..3a69d37037 100644
@@ -3637,6 +3637,7 @@ This section lists supported pattern items and their attributes, if any.
   - ``offset {integer}``: absolute or relative offset for pattern.
   - ``limit {unsigned}``: search area limit for start of pattern.
   - ``pattern {string}``: byte string to look for.
+  - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
 
 - ``eth``: match Ethernet header.
 
@@ -5036,6 +5037,18 @@ The meter policy action list: ``green -> green, yellow -> yellow, red -> red``.
    testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
    testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end
 
+Sample RAW rule
+~~~~~~~~~~~~~~~
+
+A RAW rule can be creted as following using ``pattern_hex`` key and mask.
+
+::
+
+    testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset
+             is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a
+             pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions
+             queue index 4 / end
+
 BPF Functions
 --------------
 
Signature · 1 line
2.17.1
#2 lore raw

Re: [dpdk-dev] [PATCH] app/testpmd: update raw flow to take hex input

Please ignore this patch for now.

Regards,
Nipun

Quoted 102 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, September 28, 2021 4:39 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Nipun Gupta <[email protected]>
Subject: [PATCH] app/testpmd: update raw flow to take hex input

From: Nipun Gupta <[email protected]>

This patch enables method to provide key and mask for raw rules to be provided as hexadecimal values. There is new parameter pattern_mask added to support this.

---
 app/test-pmd/cmdline_flow.c                 | 15 +++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 +++++++++++++
 2 files changed, 28 insertions(+)
app/test-pmd/cmdline_flow.c +15 -0
index 6cd99bf37f..a95b147d92 100644
@@ -158,6 +158,7 @@ enum index {
 	ITEM_RAW_OFFSET,
 	ITEM_RAW_LIMIT,
 	ITEM_RAW_PATTERN,
+	ITEM_RAW_PATTERN_HEX,
 	ITEM_ETH,
 	ITEM_ETH_DST,
 	ITEM_ETH_SRC,
@@ -1046,6 +1047,7 @@ static const enum index item_raw[] = {
 	ITEM_RAW_OFFSET,
 	ITEM_RAW_LIMIT,
 	ITEM_RAW_PATTERN,
+	ITEM_RAW_PATTERN_HEX,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2487,6 +2489,19 @@ static const struct token token_list[] = {
 			     ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw),
 					    ITEM_RAW_PATTERN_SIZE)),
 	},
+	[ITEM_RAW_PATTERN_HEX] = {
+		.name = "pattern_hex",
+		.help = "hex string to look for",
+		.next = NEXT(item_raw,
+			     NEXT_ENTRY(HEX),
+			     NEXT_ENTRY(ITEM_PARAM_IS,
+					ITEM_PARAM_SPEC,
+					ITEM_PARAM_MASK)),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_raw, pattern),
+			     ARGS_ENTRY(struct rte_flow_item_raw, length),
+			     ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw),
+					    ITEM_RAW_PATTERN_SIZE)),
+	},
 	[ITEM_ETH] = {
 		.name = "eth",
 		.help = "match Ethernet header",
doc/guides/testpmd_app_ug/testpmd_funcs.rst +0 -0
index 4f8751be1c..3a69d37037 100644
@@ -3637,6 +3637,7 @@ This section lists supported pattern items and their

attributes, if any.
- ``offset {integer}``: absolute or relative offset for pattern.
- ``limit {unsigned}``: search area limit for start of pattern.
- ``pattern {string}``: byte string to look for.

doc/guides/testpmd_app_ug/testpmd_funcs.rst +1 -1
+  - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
 
 - ``eth``: match Ethernet header.
@@ -5036,6 +5037,18 @@ The meter policy action list: ``green -> green, yellow
-> yellow, red -> red``.
    testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
    testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions

meter mtr_id 1 / end

doc/guides/testpmd_app_ug/testpmd_funcs.rst +8 -0
+Sample RAW rule
+~~~~~~~~~~~~~~~
+
+A RAW rule can be creted as following using ``pattern_hex`` key and mask.
+
+::
+
+    testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0

search is 0 offset
+ is 0 limit is 0 pattern_hex spec
00000000000000000000000000000000000000000000000000000a0a0a0a
+ pattern_hex mask
0000000000000000000000000000000000000000000000000000ffffffff / end actions

doc/guides/testpmd_app_ug/testpmd_funcs.rst +2 -1
+             queue index 4 / end
+
 BPF Functions
 --------------
 
--

2.17.1

#3 lore raw
In reply to [email protected]
Quoted 10 lines · On 9/28/2021 12:08 PM, [email protected] wrote:

From: Jun Yang <[email protected]>

The existing forwarding mode configures the total number of queues as the minimum of rxq and txq, so eventually the number of txq are same as rxq.
However in some scenarios, specially for flow control the number of rxq and txq can be different.
This patch makes the txq and function of rxq for all such scenario instead of keeping 1:1 relationship between the two.

Hi Nipun,

I expect more code exists that assumes Rx queue number and Tx queue number is equal, did you able to test unequal queue numbers with below change?

And can you please describe your usecase more, is the device has uneven Rx/Tx queues?

Quoted 19 lines
---
 app/test-pmd/config.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
app/test-pmd/config.c +0 -2
index f5765b34f7..7e17f233ba 100644
@@ -3000,8 +3000,6 @@ rss_fwd_config_setup(void)
 	int end;
 
 	nb_q = nb_rxq;
-	if (nb_q > nb_txq)
-		nb_q = nb_txq;
 	cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
 	cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
 	cur_fwd_config.nb_fwd_streams =

app/test-pmd/config.c rss_fwd_config_setup(void) · line 3039

Quoted 5 lines
app/test-pmd/config.c +1 -1
@@ -3038,7 +3036,7 @@ rss_fwd_config_setup(void)
 		fs->rx_port = fwd_ports_ids[rxp];
 		fs->rx_queue = rxq;
 		fs->tx_port = fwd_ports_ids[txp];
-		fs->tx_queue = rxq;
+		fs->tx_queue = (rxq % nb_txq);

Is this assumes number of Rx queue is always more than number of Tx queue?

Quoted 13 lines
app/test-pmd/config.c +1 -1
 		fs->peer_addr = fs->tx_port;
 		fs->retry_enabled = retry_enabled;
 		rxp++;
@@ -3253,7 +3251,7 @@ fwd_config_setup(void)
 		return;
 	}
 
-	if ((nb_rxq > 1) && (nb_txq > 1)){
+	if ((nb_rxq > 1) && (nb_txq > 1)) {
 		if (dcb_config) {
 			for (i = 0; i < nb_fwd_ports; i++) {
 				pt_id = fwd_ports_ids[i];
#4 lore raw
Quoted 22 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, September 30, 2021 7:16 PM
To: Nipun Gupta <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hemant Agrawal <[email protected]>; Jun Yang <[email protected]>
Subject: Re: [PATCH] app/testpmd: support unequal number of RXQ and TXQ

Quoted 10 lines · On 9/28/2021 12:08 PM, [email protected] wrote:

From: Jun Yang <[email protected]>

The existing forwarding mode configures the total number of queues as the minimum of rxq and txq, so eventually the number of txq are same as rxq.
However in some scenarios, specially for flow control the number of rxq and txq can be different.
This patch makes the txq and function of rxq for all such scenario instead of keeping 1:1 relationship between the two.

Quoted 5 lines

Hi Nipun,

I expect more code exists that assumes Rx queue number and Tx queue number is
equal, did you able to test unequal queue numbers with below change?

Hi Ferruh,

Yes, this works with flow, but I will double check on latest code without using flow too. Also, we will check for any other code which shall need change w.r.t. this functionality.

Quoted 3 lines

And can you please describe your usecase more, is the device has uneven Rx/Tx queues?

Yes, you are correct. In our case, Rx queues which we can use can be much higher than Tx queues, when rte flow is being used.

Quoted 13 lines
Quoted 13 lines
---
 app/test-pmd/config.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
app/test-pmd/config.c +0 -0
index f5765b34f7..7e17f233ba 100644
@@ -3000,8 +3000,6 @@ rss_fwd_config_setup(void)
 	int end;
 
Quoted 14 lines

app/test-pmd/config.c rss_fwd_config_setup(void) · line 3039

Quoted 12 lines
app/test-pmd/config.c +1 -3
 	nb_q = nb_rxq;
-	if (nb_q > nb_txq)
-		nb_q = nb_txq;
 	cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores;
 	cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
 	cur_fwd_config.nb_fwd_streams =
@@ -3038,7 +3036,7 @@ rss_fwd_config_setup(void)
 		fs->rx_port = fwd_ports_ids[rxp];
 		fs->rx_queue = rxq;
 		fs->tx_port = fwd_ports_ids[txp];
-		fs->tx_queue = rxq;
+		fs->tx_queue = (rxq % nb_txq);

Is this assumes number of Rx queue is always more than number of Tx queue?

Yes, but on re-thought as per your comment, we shall need to revisit this logic. I will have a relook on this part too.

Thanks,
Nipun

Quoted 14 lines
Quoted 14 lines
app/test-pmd/config.c +1 -1
 		fs->peer_addr = fs->tx_port;
 		fs->retry_enabled = retry_enabled;
 		rxp++;
@@ -3253,7 +3251,7 @@ fwd_config_setup(void)
 		return;
 	}
 
-	if ((nb_rxq > 1) && (nb_txq > 1)){
+	if ((nb_rxq > 1) && (nb_txq > 1)) {
 		if (dcb_config) {
 			for (i = 0; i < nb_fwd_ports; i++) {
 				pt_id = fwd_ports_ids[i];