Skip to contentSkip to conversation

app/testpmd: fix invalid rxq and txq nubmer setting

PATCH Superseded Wei Dai 5 participants 32 messages Jan 8, 2018 – Jan 17, 2018

lore
Share & tools
lore

Wei Dai

author
#0 lore raw

cover app/testpmd: fix invalid rxq and txq nubmer setting

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". The global variable rxq or txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

These 2 patches reserve the last correct rxq and txq, if an invalid input is detected, it is restored to the backup value to avoid crash.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c |  2 ++
 app/test-pmd/testpmd.c | 19 +++++++++++++++----
 app/test-pmd/testpmd.h |  3 +++
 3 files changed, 20 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.5
author
#1 lore raw

PATCH 1/2 app/testpmd: fix invalid rxq number setting

If an invalid RX queue is configured from testpmd command like "port config all rxq number", the global variable rxq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid rxq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c |  1 +
 app/test-pmd/testpmd.c | 10 ++++++++--
 app/test-pmd/testpmd.h |  2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c +1 -0
index f71d963..3f3986c 100644
@@ -1501,6 +1501,7 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		nb_rxq_bak = nb_rxq;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) {
app/test-pmd/testpmd.c +8 -2
index 47e145c..5939c88 100644
@@ -188,6 +188,8 @@ uint8_t dcb_test = 0;
 queueid_t nb_rxq = 1; /**< Number of RX queues per port. */
 queueid_t nb_txq = 1; /**< Number of TX queues per port. */
 
+queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX queues */
+
 /*
  * Configurable number of RX/TX ring descriptors.
  */
@@ -708,10 +710,14 @@ init_fwd_streams(void)
 		port = &ports[pid];
 		if (nb_rxq > port->dev_info.max_rx_queues) {
 			printf("Fail: nb_rxq(%d) is greater than "
-				"max_rx_queues(%d)\n", nb_rxq,
-				port->dev_info.max_rx_queues);
+				"max_rx_queues(%d), restore to backup "
+				"rxq number(%d)\n", nb_rxq,
+				port->dev_info.max_rx_queues,
+				nb_rxq_bak);
+			nb_rxq = nb_rxq_bak;
 			return -1;
 		}
+		nb_rxq_bak = nb_rxq;
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
 				"max_tx_queues(%d)\n", nb_txq,
app/test-pmd/testpmd.h +2 -0
index 4d7f27c..84246f7 100644
@@ -391,6 +391,8 @@ extern uint64_t rss_hf;
 extern queueid_t nb_rxq;
 extern queueid_t nb_txq;
 
+extern queueid_t nb_rxq_bak;
+
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
 
Signature · 1 line
2.7.5
#2 lore raw

Re: [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 51 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Dai
Sent: Monday, January 8, 2018 1:03 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

If an invalid RX queue is configured from testpmd command like "port config all rxq number", the global variable rxq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid rxq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c |  1 +
 app/test-pmd/testpmd.c | 10 ++++++++--
 app/test-pmd/testpmd.h |  2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c +1 -0
index f71d963..3f3986c 100644
@@ -1501,6 +1501,7 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		nb_rxq_bak = nb_rxq;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) {
app/test-pmd/testpmd.c +2 -0
index 47e145c..5939c88 100644
@@ -188,6 +188,8 @@ uint8_t dcb_test = 0;
 queueid_t nb_rxq = 1; /**< Number of RX queues per port. */
 queueid_t nb_txq = 1; /**< Number of TX queues per port. */
 
+queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX queues */
+
 /*
  * Configurable number of RX/TX ring descriptors.
  */

app/test-pmd/testpmd.c init_fwd_streams(void) · line 711

Quoted 2 lines
app/test-pmd/testpmd.c +0 -0
@@ -708,10 +710,14 @@ init_fwd_streams(void)
 		port = &ports[pid];
 		if (nb_rxq > port->dev_info.max_rx_queues) {

Why not to add that check in the function handler for " port config ... rxq ..." command itself? In that case you wouldn't need nb_rxq_bak at all.
Konstantin

Quoted 29 lines
app/test-pmd/testpmd.c +6 -2
 			printf("Fail: nb_rxq(%d) is greater than "
-				"max_rx_queues(%d)\n", nb_rxq,
-				port->dev_info.max_rx_queues);
+				"max_rx_queues(%d), restore to backup "
+				"rxq number(%d)\n", nb_rxq,
+				port->dev_info.max_rx_queues,
+				nb_rxq_bak);
+			nb_rxq = nb_rxq_bak;
 			return -1;
 		}
+		nb_rxq_bak = nb_rxq;
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
 				"max_tx_queues(%d)\n", nb_txq,
app/test-pmd/testpmd.h +2 -1
index 4d7f27c..84246f7 100644
@@ -391,6 +391,8 @@ extern uint64_t rss_hf;
 extern queueid_t nb_rxq;
 extern queueid_t nb_txq;
 
+extern queueid_t nb_rxq_bak;
+
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
 
--

2.7.5

author
#3 lore raw

Re: [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 57 lines

-----Original Message-----
From: Ananyev, Konstantin
Sent: Tuesday, January 9, 2018 4:06 AM
To: Dai, Wei <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 15 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Dai
Sent: Monday, January 8, 2018 1:03 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

If an invalid RX queue is configured from testpmd command like "port config all rxq number", the global variable rxq is updated by this invalid value. It may cause testpmd crash.
This patch restores its last correct value when an invalid rxq number configured is detected.

Quoted 7 lines
Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c |  1 +

app/test-pmd/testpmd.c | 10 ++++++++-- app/test-pmd/testpmd.h |

2

Quoted 23 lines

++

 3 files changed, 11 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

f71d963..3f3986c 100644

app/test-pmd/cmdline.c +1 -0
@@ -1501,6 +1501,7 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		nb_rxq_bak = nb_rxq;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) { diff --git

a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 47e145c..5939c88 100644

app/test-pmd/testpmd.c +0 -0
@@ -188,6 +188,8 @@ uint8_t dcb_test = 0;  queueid_t nb_rxq = 1; /**<

Number of RX queues per port. */ queueid_t nb_txq = 1; /**< Number of TX queues per port. */

Quoted 14 lines

app/test-pmd/testpmd.c init_fwd_streams(void) · line 711

Quoted 9 lines
app/test-pmd/testpmd.c +3 -0
+queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX
+queues */
+
 /*
  * Configurable number of RX/TX ring descriptors.
  */
@@ -708,10 +710,14 @@ init_fwd_streams(void)
 		port = &ports[pid];
 		if (nb_rxq > port->dev_info.max_rx_queues) {

Why not to add that check in the function handler for " port config ... rxq ..." command itself?
In that case you wouldn't need nb_rxq_bak at all.
Konstantin

Thanks for your feedback, Konstantin.
I see your point. If that check is added in the function handler of command line, same loop code will be repeated.

There are 2 ways to change nb_rxq:
1. with --rxq in the command line to start testpmd app to overwrite the default value 1
2. with "port config all rxq number" in the testpmd run time command line

How can your method correct an invalid input with --rxq in the command to start testpm app ?

By the way, my v1 patch has a bug in case of more than 1 port with different maximum number of Rx queues. For example, the max_rx_queues of port 0 is 8 and that of port 1 is 4.
The previous valid rxq=4, if "port config all rxq 5" is run,
The nb_rxq_bak is updated to 5, nb_rxq can't be restored to last correct value 4 for port 1.

I will fix bug in my v2 patch.

Quoted 29 lines
Quoted 29 lines
app/test-pmd/testpmd.c +6 -2
 			printf("Fail: nb_rxq(%d) is greater than "
-				"max_rx_queues(%d)\n", nb_rxq,
-				port->dev_info.max_rx_queues);
+				"max_rx_queues(%d), restore to backup "
+				"rxq number(%d)\n", nb_rxq,
+				port->dev_info.max_rx_queues,
+				nb_rxq_bak);
+			nb_rxq = nb_rxq_bak;
 			return -1;
 		}
+		nb_rxq_bak = nb_rxq;
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
 				"max_tx_queues(%d)\n", nb_txq,
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

4d7f27c..84246f7 100644

app/test-pmd/testpmd.h +2 -1
@@ -391,6 +391,8 @@ extern uint64_t rss_hf;  extern queueid_t nb_rxq;
 extern queueid_t nb_txq;
 
+extern queueid_t nb_rxq_bak;
+
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
 
--

2.7.5

#4 lore raw

Re: [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 86 lines

-----Original Message-----
From: Dai, Wei
Sent: Wednesday, January 10, 2018 1:34 AM
To: Ananyev, Konstantin <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 57 lines

-----Original Message-----
From: Ananyev, Konstantin
Sent: Tuesday, January 9, 2018 4:06 AM
To: Dai, Wei <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 15 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Dai
Sent: Monday, January 8, 2018 1:03 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

If an invalid RX queue is configured from testpmd command like "port config all rxq number", the global variable rxq is updated by this invalid value. It may cause testpmd crash.
This patch restores its last correct value when an invalid rxq number configured is detected.

Quoted 7 lines
Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c |  1 +

app/test-pmd/testpmd.c | 10 ++++++++-- app/test-pmd/testpmd.h |

2

Quoted 23 lines

++

 3 files changed, 11 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

f71d963..3f3986c 100644

app/test-pmd/cmdline.c +1 -0
@@ -1501,6 +1501,7 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		nb_rxq_bak = nb_rxq;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) { diff --git

a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 47e145c..5939c88 100644

app/test-pmd/testpmd.c +0 -0
@@ -188,6 +188,8 @@ uint8_t dcb_test = 0;  queueid_t nb_rxq = 1; /**<

Number of RX queues per port. */ queueid_t nb_txq = 1; /**< Number of TX queues per port. */

Quoted 14 lines

app/test-pmd/testpmd.c init_fwd_streams(void) · line 711

Quoted 9 lines
app/test-pmd/testpmd.c +3 -0
+queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX
+queues */
+
 /*
  * Configurable number of RX/TX ring descriptors.
  */
@@ -708,10 +710,14 @@ init_fwd_streams(void)
 		port = &ports[pid];
 		if (nb_rxq > port->dev_info.max_rx_queues) {

Why not to add that check in the function handler for " port config ... rxq ..." command itself?
In that case you wouldn't need nb_rxq_bak at all.
Konstantin

Thanks for your feedback, Konstantin.
I see your point. If that check is added in the function handler of command line, same loop code will be repeated.

Quoted 5 lines

There are 2 ways to change nb_rxq:
1. with --rxq in the command line to start testpmd app to overwrite the default value 1
2. with "port config all rxq number" in the testpmd run time command line

How can your method correct an invalid input with --rxq in the command to start testpm app ?

Have a separate function: test_queue_num(port, qnum) and call it from both places? Konstantin

Quoted 38 lines

By the way, my v1 patch has a bug in case of more than 1 port with different maximum number of Rx queues. For example, the max_rx_queues of port 0 is 8 and that of port 1 is 4.
The previous valid rxq=4, if "port config all rxq 5" is run,
The nb_rxq_bak is updated to 5, nb_rxq can't be restored to last correct value 4 for port 1.

I will fix bug in my v2 patch.

Quoted 29 lines
Quoted 29 lines
app/test-pmd/testpmd.c +6 -2
 			printf("Fail: nb_rxq(%d) is greater than "
-				"max_rx_queues(%d)\n", nb_rxq,
-				port->dev_info.max_rx_queues);
+				"max_rx_queues(%d), restore to backup "
+				"rxq number(%d)\n", nb_rxq,
+				port->dev_info.max_rx_queues,
+				nb_rxq_bak);
+			nb_rxq = nb_rxq_bak;
 			return -1;
 		}
+		nb_rxq_bak = nb_rxq;
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
 				"max_tx_queues(%d)\n", nb_txq,
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

4d7f27c..84246f7 100644

app/test-pmd/testpmd.h +2 -1
@@ -391,6 +391,8 @@ extern uint64_t rss_hf;  extern queueid_t nb_rxq;
 extern queueid_t nb_txq;
 
+extern queueid_t nb_rxq_bak;
+
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
 
--

2.7.5

author
#5 lore raw

Re: [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 110 lines

-----Original Message-----
From: Ananyev, Konstantin
Sent: Wednesday, January 10, 2018 9:55 AM
To: Dai, Wei <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 45 lines

-----Original Message-----
From: Dai, Wei
Sent: Wednesday, January 10, 2018 1:34 AM
To: Ananyev, Konstantin <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 35 lines

-----Original Message-----
From: Ananyev, Konstantin
Sent: Tuesday, January 9, 2018 4:06 AM
To: Dai, Wei <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

Quoted 23 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Dai
Sent: Monday, January 8, 2018 1:03 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: fix invalid rxq number setting

If an invalid RX queue is configured from testpmd command like "port config all rxq number", the global variable rxq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid rxq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration

settings")
Cc: [email protected]

---
 app/test-pmd/cmdline.c |  1 +

app/test-pmd/testpmd.c | 10 ++++++++-- app/test-pmd/testpmd.h

|

Quoted 9 lines
Quoted 9 lines

2

app/test-pmd/cmdline.c cmd_config_rx_tx_parsed(void

Quoted 8 lines

++

 3 files changed, 11 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

f71d963..3f3986c 100644

app/test-pmd/cmdline.c +0 -0
@@ -1501,6 +1501,7 @@ cmd_config_rx_tx_parsed(void

*parsed_result,

Quoted 1 line
Quoted 1 line

app/test-pmd/cmdline.c cmd_config_rx_tx_parsed(void · line 1501

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			printf("Warning: Either rx or tx queues should be non

zero\n");

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
app/test-pmd/cmdline.c +1 -0
 			return;
 		}
+		nb_rxq_bak = nb_rxq;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) { diff --git

a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 47e145c..5939c88 100644

app/test-pmd/testpmd.c +0 -0
@@ -188,6 +188,8 @@ uint8_t dcb_test = 0;  queueid_t nb_rxq = 1;
 /**< Number of RX queues per port. */  queueid_t nb_txq = 1; /**<

Number of TX queues per port. */

Quoted 11 lines
Quoted 11 lines

app/test-pmd/testpmd.c init_fwd_streams(void) · line 711

Quoted 9 lines
app/test-pmd/testpmd.c +3 -0
+queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of
+RX queues */
+
 /*
  * Configurable number of RX/TX ring descriptors.
  */
@@ -708,10 +710,14 @@ init_fwd_streams(void)
 		port = &ports[pid];
 		if (nb_rxq > port->dev_info.max_rx_queues) {

Why not to add that check in the function handler for " port config ...

rxq ..."

Quoted 13 lines
Quoted 3 lines

command itself?
In that case you wouldn't need nb_rxq_bak at all.
Konstantin

Thanks for your feedback, Konstantin.
I see your point. If that check is added in the function handler of command line, same loop code will be repeated.

There are 2 ways to change nb_rxq:
1. with --rxq in the command line to start testpmd app to overwrite the default value 1 2. with "port config all rxq number" in the testpmd run time command line

Quoted 7 lines
Quoted 1 line

How can your method correct an invalid input with --rxq in the command

to start testpm app ?

Have a separate function: test_queue_num(port, qnum) and call it from both places?
Konstantin

This nb_rxq is a common setting for all ports.
I can follow your guide in my v3 patch.
Thanks

Quoted 40 lines
Quoted 2 lines

By the way, my v1 patch has a bug in case of more than 1 port with

different maximum number of Rx queues.

Quoted 3 lines

For example, the max_rx_queues of port 0 is 8 and that of port 1 is 4. The previous valid rxq=4, if "port config all rxq 5" is run, The nb_rxq_bak is updated to 5, nb_rxq can't be restored to last correct value

4 for port 1.

Quoted 33 lines

I will fix bug in my v2 patch.

Quoted 29 lines
Quoted 29 lines
app/test-pmd/testpmd.c +6 -2
 			printf("Fail: nb_rxq(%d) is greater than "
-				"max_rx_queues(%d)\n", nb_rxq,
-				port->dev_info.max_rx_queues);
+				"max_rx_queues(%d), restore to backup "
+				"rxq number(%d)\n", nb_rxq,
+				port->dev_info.max_rx_queues,
+				nb_rxq_bak);
+			nb_rxq = nb_rxq_bak;
 			return -1;
 		}
+		nb_rxq_bak = nb_rxq;
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
 				"max_tx_queues(%d)\n", nb_txq, diff --git

a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 4d7f27c..84246f7 100644

app/test-pmd/testpmd.h +2 -1
@@ -391,6 +391,8 @@ extern uint64_t rss_hf;  extern queueid_t
 nb_rxq; extern queueid_t nb_txq;
 
+extern queueid_t nb_rxq_bak;
+
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
 
--

2.7.5

author
#6 lore raw

PATCH 2/2 app/testpmd: fix invalid txq number setting

In reply to Wei Dai

If an invalid TX queue is configured from testpmd command like "port config all txq number", the global variable txq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid txq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c | 1 +
 app/test-pmd/testpmd.c | 9 +++++++--
 app/test-pmd/testpmd.h | 1 +
 3 files changed, 9 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c +1 -0
index 3f3986c..b3ca850 100644
@@ -1509,6 +1509,7 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		nb_txq_bak = nb_txq;
 		nb_txq = res->value;
 	}
 	else if (!strcmp(res->name, "rxd")) {
app/test-pmd/testpmd.c +7 -2
index 5939c88..894e49f 100644
@@ -189,6 +189,7 @@ queueid_t nb_rxq = 1; /**< Number of RX queues per port. */
 queueid_t nb_txq = 1; /**< Number of TX queues per port. */
 
 queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX queues */
+queueid_t nb_txq_bak = 1; /**< Backup of last correct number of TX queues */
 
 /*
  * Configurable number of RX/TX ring descriptors.
@@ -720,10 +721,14 @@ init_fwd_streams(void)
 		nb_rxq_bak = nb_rxq;
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
-				"max_tx_queues(%d)\n", nb_txq,
-				port->dev_info.max_tx_queues);
+				"max_tx_queues(%d), restore to backup "
+				"txq number(%d)\n", nb_txq,
+				port->dev_info.max_tx_queues,
+				nb_txq_bak);
+			nb_txq = nb_txq_bak;
 			return -1;
 		}
+		nb_txq_bak = nb_txq;
 		if (numa_support) {
 			if (port_numa[pid] != NUMA_NO_CONFIG)
 				port->socket_id = port_numa[pid];
app/test-pmd/testpmd.h +1 -0
index 84246f7..7480c1a 100644
@@ -392,6 +392,7 @@ extern queueid_t nb_rxq;
 extern queueid_t nb_txq;
 
 extern queueid_t nb_rxq_bak;
+extern queueid_t nb_txq_bak;
 
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
Signature · 1 line
2.7.5
author
#7 lore raw

v2 cover app/testpmd: fix invalid rxq and txq nubmer setting

In reply to Wei Dai

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". The global variable rxq or txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

These 2 patches reserve the last correct rxq and txq, if an invalid input is detected, it is restored to the backup value to avoid crash.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---
v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c |  4 ++++
 app/test-pmd/testpmd.c | 23 +++++++++++++++++++----
 app/test-pmd/testpmd.h |  3 +++
 3 files changed, 26 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.5
author
#8 lore raw

PATCH v2 1/2 app/testpmd: fix invalid rxq number setting

If an invalid RX queue is configured from testpmd command like "port config all rxq number", the global variable rxq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid rxq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c |  2 ++
 app/test-pmd/testpmd.c | 13 +++++++++++--
 app/test-pmd/testpmd.h |  2 ++
 3 files changed, 15 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c +2 -0
index 5b2e2ef..a5a1d57 100644
@@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		/* bakcup last correct nb_rxq */
+		nb_rxq_bak = nb_rxq;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) {
app/test-pmd/testpmd.c +11 -2
index 9414d0e..efafc24 100644
@@ -189,6 +189,8 @@ uint8_t dcb_test = 0;
 queueid_t nb_rxq = 1; /**< Number of RX queues per port. */
 queueid_t nb_txq = 1; /**< Number of TX queues per port. */
 
+queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX queues */
+
 /*
  * Configurable number of RX/TX ring descriptors.
  */
@@ -709,8 +711,12 @@ init_fwd_streams(void)
 		port = &ports[pid];
 		if (nb_rxq > port->dev_info.max_rx_queues) {
 			printf("Fail: nb_rxq(%d) is greater than "
-				"max_rx_queues(%d)\n", nb_rxq,
-				port->dev_info.max_rx_queues);
+				"max_rx_queues(%d), restored to backup "
+				"rxq number(%d)\n", nb_rxq,
+				port->dev_info.max_rx_queues,
+				nb_rxq_bak);
+			/* restored to last corrcect nb_rxq */
+			nb_rxq = nb_rxq_bak;
 			return -1;
 		}
 		if (nb_txq > port->dev_info.max_tx_queues) {
@@ -738,6 +744,9 @@ init_fwd_streams(void)
 		}
 	}
 
+	/* backup the correct nb_rxq */
+	nb_rxq_bak = nb_rxq;
+
 	q = RTE_MAX(nb_rxq, nb_txq);
 	if (q == 0) {
 		printf("Fail: Cannot allocate fwd streams as number of queues is 0\n");
app/test-pmd/testpmd.h +2 -0
index 2a266fd..6f7932d 100644
@@ -392,6 +392,8 @@ extern uint64_t rss_hf;
 extern queueid_t nb_rxq;
 extern queueid_t nb_txq;
 
+extern queueid_t nb_rxq_bak;
+
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
 
Signature · 1 line
2.7.5
author
#9 lore raw

PATCH v2 2/2 app/testpmd: fix invalid txq number setting

In reply to Wei Dai

If an invalid TX queue is configured from testpmd command like "port config all txq number", the global variable txq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid txq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c |  2 ++
 app/test-pmd/testpmd.c | 12 +++++++++---
 app/test-pmd/testpmd.h |  1 +
 3 files changed, 12 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index a5a1d57..26dd81a 100644
@@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		/* bakcup last correct nb_txq */
+		nb_txq_bak = nb_txq;
 		nb_txq = res->value;
 	}
 	else if (!strcmp(res->name, "rxd")) {
app/test-pmd/testpmd.c +9 -3
index efafc24..8b49d96 100644
@@ -190,6 +190,7 @@ queueid_t nb_rxq = 1; /**< Number of RX queues per port. */
 queueid_t nb_txq = 1; /**< Number of TX queues per port. */
 
 queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX queues */
+queueid_t nb_txq_bak = 1; /**< Backup of last correct number of TX queues */
 
 /*
  * Configurable number of RX/TX ring descriptors.
@@ -721,8 +722,12 @@ init_fwd_streams(void)
 		}
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
-				"max_tx_queues(%d)\n", nb_txq,
-				port->dev_info.max_tx_queues);
+				"max_tx_queues(%d), restored to backup "
+				"txq number(%d)\n", nb_txq,
+				port->dev_info.max_tx_queues,
+				nb_txq_bak);
+			/* restored to last correct nb_txq */
+			nb_txq = nb_txq_bak;
 			return -1;
 		}
 		if (numa_support) {
@@ -744,8 +749,9 @@ init_fwd_streams(void)
 		}
 	}
 
-	/* backup the correct nb_rxq */
+	/* backup the correct nb_rxq and nb_txq */
 	nb_rxq_bak = nb_rxq;
+	nb_txq_bak = nb_txq;
 
 	q = RTE_MAX(nb_rxq, nb_txq);
 	if (q == 0) {
app/test-pmd/testpmd.h +1 -0
index 6f7932d..bca93c1 100644
@@ -393,6 +393,7 @@ extern queueid_t nb_rxq;
 extern queueid_t nb_txq;
 
 extern queueid_t nb_rxq_bak;
+extern queueid_t nb_txq_bak;
 
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
Signature · 1 line
2.7.5
#10 lore raw

Re: [PATCH v2 2/2] app/testpmd: fix invalid txq number setting

I think the name bak is a little bit confused, what do you think just use nd_txq_backup/nd_rxq_backup? And I think it's no need to break the patch into two patch, them fix the same thing and the code amount are not large.

Quoted 90 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Dai
Sent: Wednesday, January 10, 2018 12:14 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix invalid txq number setting

If an invalid TX queue is configured from testpmd command like "port config all txq number", the global variable txq is updated by this invalid value. It may cause testpmd crash.
This patch restores its last correct value when an invalid txq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c |  2 ++
 app/test-pmd/testpmd.c | 12 +++++++++---  app/test-pmd/testpmd.h |  1 +
 3 files changed, 12 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

a5a1d57..26dd81a 100644

app/test-pmd/cmdline.c +2 -0
@@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non
 zero\n");
 			return;
 		}
+		/* bakcup last correct nb_txq */
+		nb_txq_bak = nb_txq;
 		nb_txq = res->value;
 	}
app/test-pmd/cmdline.c +0 -0
 	else if (!strcmp(res->name, "rxd")) {
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

efafc24..8b49d96 100644

app/test-pmd/testpmd.c +0 -0
@@ -190,6 +190,7 @@ queueid_t nb_rxq = 1; /**< Number of RX queues per

port. */ queueid_t nb_txq = 1; /**< Number of TX queues per port. */

queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX queues */

app/test-pmd/testpmd.c +10 -3
+queueid_t nb_txq_bak = 1; /**< Backup of last correct number of TX
+queues */
 
 /*
  * Configurable number of RX/TX ring descriptors.
@@ -721,8 +722,12 @@ init_fwd_streams(void)
 		}
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
-				"max_tx_queues(%d)\n", nb_txq,
-				port->dev_info.max_tx_queues);
+				"max_tx_queues(%d), restored to backup "
+				"txq number(%d)\n", nb_txq,
+				port->dev_info.max_tx_queues,
+				nb_txq_bak);
+			/* restored to last correct nb_txq */
+			nb_txq = nb_txq_bak;
 			return -1;
 		}
 		if (numa_support) {
@@ -744,8 +749,9 @@ init_fwd_streams(void)
 		}
 	}
 
-	/* backup the correct nb_rxq */
+	/* backup the correct nb_rxq and nb_txq */
 	nb_rxq_bak = nb_rxq;
+	nb_txq_bak = nb_txq;
 
 	q = RTE_MAX(nb_rxq, nb_txq);
 	if (q == 0) {
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

6f7932d..bca93c1 100644

app/test-pmd/testpmd.h +1 -1
@@ -393,6 +393,7 @@ extern queueid_t nb_rxq;  extern queueid_t nb_txq;
 
 extern queueid_t nb_rxq_bak;
+extern queueid_t nb_txq_bak;
 
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
--

2.7.5

author
#11 lore raw

Re: [PATCH v2 2/2] app/testpmd: fix invalid txq number setting

Quoted 10 lines

-----Original Message-----
From: Yang, Qiming
Sent: Wednesday, January 10, 2018 2:38 PM
To: Dai, Wei <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix invalid txq number setting

Quoted 4 lines

I think the name bak is a little bit confused, what do you think just use nd_txq_backup/nd_rxq_backup?
And I think it's no need to break the patch into two patch, them fix the same thing and the code amount are not large.

I will follow Konstantin's guide to give v3 patch set.
By the way, I think 2 patches are much clearer and keep each very simple for others to review and for maintainer's convenience.

Quoted 96 lines
Quoted 17 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Dai
Sent: Wednesday, January 10, 2018 12:14 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Peng, Yuan <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix invalid txq number setting

If an invalid TX queue is configured from testpmd command like "port config all txq number", the global variable txq is updated by this invalid value. It may cause testpmd crash.
This patch restores its last correct value when an invalid txq number configured is detected.

Quoted 7 lines
Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c |  2 ++

app/test-pmd/testpmd.c | 12 +++++++++--- app/test-pmd/testpmd.h |

1

app/test-pmd/testpmd.c queueid_t nb_rxq = 1; /**< Number of RX queues

Quoted 21 lines
(quoted diff) +1 -0
+
 3 files changed, 12 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

a5a1d57..26dd81a 100644

app/test-pmd/cmdline.c +2 -0
@@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		/* bakcup last correct nb_txq */
+		nb_txq_bak = nb_txq;
 		nb_txq = res->value;
 	}
 	else if (!strcmp(res->name, "rxd")) { diff --git

a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index efafc24..8b49d96 100644

app/test-pmd/testpmd.c +0 -0
@@ -190,6 +190,7 @@ queueid_t nb_rxq = 1; /**< Number of RX queues

per

app/test-pmd/testpmd.h extern queueid_t nb_rxq; extern queueid_t

Quoted 40 lines

port. */ queueid_t nb_txq = 1; /**< Number of TX queues per port. */

queueid_t nb_rxq_bak = 1; /**< Backup of last correct number of RX
queues */

app/test-pmd/testpmd.c +10 -3
+queueid_t nb_txq_bak = 1; /**< Backup of last correct number of TX
+queues */
 
 /*
  * Configurable number of RX/TX ring descriptors.
@@ -721,8 +722,12 @@ init_fwd_streams(void)
 		}
 		if (nb_txq > port->dev_info.max_tx_queues) {
 			printf("Fail: nb_txq(%d) is greater than "
-				"max_tx_queues(%d)\n", nb_txq,
-				port->dev_info.max_tx_queues);
+				"max_tx_queues(%d), restored to backup "
+				"txq number(%d)\n", nb_txq,
+				port->dev_info.max_tx_queues,
+				nb_txq_bak);
+			/* restored to last correct nb_txq */
+			nb_txq = nb_txq_bak;
 			return -1;
 		}
 		if (numa_support) {
@@ -744,8 +749,9 @@ init_fwd_streams(void)
 		}
 	}
 
-	/* backup the correct nb_rxq */
+	/* backup the correct nb_rxq and nb_txq */
 	nb_rxq_bak = nb_rxq;
+	nb_txq_bak = nb_txq;
 
 	q = RTE_MAX(nb_rxq, nb_txq);
 	if (q == 0) {
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

6f7932d..bca93c1 100644

app/test-pmd/testpmd.h +0 -0
@@ -393,6 +393,7 @@ extern queueid_t nb_rxq;  extern queueid_t

nb_txq;

Quoted 8 lines
app/test-pmd/testpmd.h +1 -1
 extern queueid_t nb_rxq_bak;
+extern queueid_t nb_txq_bak;
 
 extern uint16_t nb_rxd;
 extern uint16_t nb_txd;
--

2.7.5

author
#12 lore raw

v3 cover app/testpmd: fix invalid rxq and txq nubmer setting

In reply to Wei Dai

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". The global variable rxq or txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

These 2 patches reserve the last correct rxq and txq, if an invalid input is detected, it is restored to the backup value to avoid crash.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---
v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 ++
 app/test-pmd/parameters.c | 13 ++++---
 app/test-pmd/testpmd.c    | 94 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 110 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.5
author
#13 lore raw

PATCH v3 1/2 app/testpmd: fix invalid rxq number setting

If an invalid RX queue is configured from testpmd command like "port config all rxq number", the global variable rxq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid rxq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  7 ++++---
 app/test-pmd/testpmd.c    | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  3 +++
 4 files changed, 56 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index 5b2e2ef..f0623b1 100644
@@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_rxq(res->value) != 0)
+			return;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) {
app/test-pmd/parameters.c +4 -3
index 304b98d..eac1826 100644
@@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv)
 	int n, opt;
 	char **argvopt;
 	int opt_idx;
+	portid_t pid;
 	enum { TX, RX };
 
 	static struct option lgopts[] = {
@@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv)
 				rss_hf = ETH_RSS_UDP;
 			if (!strcmp(lgopts[opt_idx].name, "rxq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
 					nb_rxq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_nb_rxq(&pid));
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
app/test-pmd/testpmd.c +47 -0

53 lines not on this page · raw message

app/test-pmd/testpmd.h +3 -0
index 2a266fd..1e38f43 100644
@@ -700,6 +700,9 @@ enum print_warning {
 int port_id_is_invalid(portid_t port_id, enum print_warning warning);
 int new_socket_id(unsigned int socket_id);
 
+queueid_t get_allowed_nb_rxq(portid_t *pid);
+int check_nb_rxq(queueid_t rxq);
+
 /*
  * Work-around of a compilation error with ICC on invocations of the
  * rte_be_to_cpu_16() function.
Signature · 1 line
2.7.5
author
#14 lore raw

PATCH v3 2/2 app/testpmd: fix invalid txq number setting

In reply to Wei Dai

If an invalid TX queue is configured from testpmd command like "port config all txq number", the global variable txq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid txq number configured is detected.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  6 +++---
 app/test-pmd/testpmd.c    | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  2 ++
 4 files changed, 54 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index f0623b1..6619cb8 100644
@@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_txq(res->value) != 0)
+			return;
 		nb_txq = res->value;
 	}
 	else if (!strcmp(res->name, "rxd")) {
app/test-pmd/parameters.c +3 -3
index eac1826..6b5925d 100644
@@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
 					nb_txq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_nb_txq(&pid));
 			}
 			if (!nb_rxq && !nb_txq) {
 				rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
app/test-pmd/testpmd.c +47 -0

53 lines not on this page · raw message

app/test-pmd/testpmd.h +2 -0
index 1e38f43..b848364 100644
@@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id);
 
 queueid_t get_allowed_nb_rxq(portid_t *pid);
 int check_nb_rxq(queueid_t rxq);
+queueid_t get_allowed_nb_txq(portid_t *pid);
+int check_nb_txq(queueid_t txq);
 
 /*
  * Work-around of a compilation error with ICC on invocations of the
Signature · 1 line
2.7.5
Acked-by on the v3 series
#15 lore raw
In reply to Wei Dai
Quoted 20 lines

-----Original Message-----
From: Dai, Wei
Sent: Wednesday, January 10, 2018 8:41 AM
To: Ananyev, Konstantin <[email protected]>; Yang, Qiming <[email protected]>; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [PATCH v3 0/2] app/testpmd: fix invalid rxq and txq nubmer setting

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". The global variable rxq or txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

These 2 patches reserve the last correct rxq and txq, if an invalid input is detected, it is restored to the backup value to avoid crash.

Quoted 6 lines
Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---

The code looks good to me, just seems some misspellings in the comments (mimumal).

Quoted 18 lines

v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 ++
 app/test-pmd/parameters.c | 13 ++++---
 app/test-pmd/testpmd.c    | 94 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 110 insertions(+), 6 deletions(-)

--
2.7.5

author
#16 lore raw
Quoted 37 lines

-----Original Message-----
From: Ananyev, Konstantin
Sent: Wednesday, January 10, 2018 5:59 PM
To: Dai, Wei <[email protected]>; Yang, Qiming <[email protected]>; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH v3 0/2] app/testpmd: fix invalid rxq and txq nubmer setting

Quoted 5 lines

-----Original Message-----
From: Dai, Wei
Sent: Wednesday, January 10, 2018 8:41 AM
To: Ananyev, Konstantin <[email protected]>; Yang, Qiming <[email protected]>; Peng, Yuan <[email protected]>; Lu,

Wenzhuo

Quoted 18 lines

<[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [PATCH v3 0/2] app/testpmd: fix invalid rxq and txq nubmer setting

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". The global variable rxq or txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

These 2 patches reserve the last correct rxq and txq, if an invalid input is detected, it is restored to the backup value to avoid crash.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
Quoted 7 lines
Quoted 3 lines

---

The code looks good to me, just seems some misspellings in the comments (mimumal).

Thanks, Konstantin.
I'll correct these misspellings in my v4 patch set.

Quoted 20 lines
Quoted 7 lines

v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Quoted 7 lines

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 ++
 app/test-pmd/parameters.c | 13 ++++---
 app/test-pmd/testpmd.c    | 94

+++++++++++++++++++++++++++++++++++++++++++++++

Quoted 5 lines
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 110 insertions(+), 6 deletions(-)

--
2.7.5

author
#17 lore raw

v4 cover app/testpmd: fix invalid rxq and txq nubmer settings

In reply to Wei Dai

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input.
This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---
v4: update git log message and rename 2 new added functions

v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 +++
 app/test-pmd/parameters.c | 13 +++----
 app/test-pmd/testpmd.c    | 92 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 108 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.5
author
#18 lore raw

PATCH v4 1/2 app/testpmd: fix invalid rxq number setting

If an invalid number of RX queues is configured from testpmd run-time command like "port config all rxq number" or from --rxq in the command to start testpmd, the global variable nb_rxq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid rxq setting and keeps its last correct value.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  7 ++++---
 app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  3 +++
 4 files changed, 55 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index 5b2e2ef..f0623b1 100644
@@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_rxq(res->value) != 0)
+			return;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) {
app/test-pmd/parameters.c +4 -3
index 304b98d..c46e734 100644
@@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv)
 	int n, opt;
 	char **argvopt;
 	int opt_idx;
+	portid_t pid;
 	enum { TX, RX };
 
 	static struct option lgopts[] = {
@@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv)
 				rss_hf = ETH_RSS_UDP;
 			if (!strcmp(lgopts[opt_idx].name, "rxq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
 					nb_rxq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_max_nb_rxq(&pid));
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
app/test-pmd/testpmd.c +46 -0

52 lines not on this page · raw message

app/test-pmd/testpmd.h +3 -0
index 2a266fd..e815509 100644
@@ -700,6 +700,9 @@ enum print_warning {
 int port_id_is_invalid(portid_t port_id, enum print_warning warning);
 int new_socket_id(unsigned int socket_id);
 
+queueid_t get_allowed_max_nb_rxq(portid_t *pid);
+int check_nb_rxq(queueid_t rxq);
+
 /*
  * Work-around of a compilation error with ICC on invocations of the
  * rte_be_to_cpu_16() function.
Signature · 1 line
2.7.5
author
#19 lore raw

PATCH v4 2/2 app/testpmd: fix invalid txq number setting

In reply to Wei Dai

If an invalid number of TX queues is configured from testpmd run-time command like "port config all txq number" or from --txq in the command to start testpmd, the global variable nb_txq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid txq setting and keeps its last correct value.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  6 +++---
 app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  2 ++
 4 files changed, 53 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index f0623b1..6619cb8 100644
@@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_txq(res->value) != 0)
+			return;
 		nb_txq = res->value;
 	}
 	else if (!strcmp(res->name, "rxd")) {
app/test-pmd/parameters.c +3 -3
index c46e734..ca2af65 100644
@@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
 					nb_txq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_max_nb_txq(&pid));
 			}
 			if (!nb_rxq && !nb_txq) {
 				rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
app/test-pmd/testpmd.c +46 -0

52 lines not on this page · raw message

app/test-pmd/testpmd.h +2 -0
index e815509..fe40892 100644
@@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id);
 
 queueid_t get_allowed_max_nb_rxq(portid_t *pid);
 int check_nb_rxq(queueid_t rxq);
+queueid_t get_allowed_max_nb_txq(portid_t *pid);
+int check_nb_txq(queueid_t txq);
 
 /*
  * Work-around of a compilation error with ICC on invocations of the
Signature · 1 line
2.7.5
#20 lore raw

Re: [PATCH v4 0/2] app/testpmd: fix invalid rxq and txq nubmer settings

In reply to Wei Dai

Hi Wei,

There is a build error applied your patches to the latest DPDK version. /root/dpdk/app/test-pmd/testpmd.c: In function 'check_nb_rxq':
/root/dpdk/app/test-pmd/testpmd.c:579:3: error: 'pid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
printf("Fail: input rxq (%u) can't be greater "
^
/root/dpdk/app/test-pmd/testpmd.c: In function 'check_nb_txq':
/root/dpdk/app/test-pmd/testpmd.c:625:3: error: 'pid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
printf("Fail: input txq (%u) can't be greater "
^
My gcc verison is gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)

Could you help to check it?

Thanks.
Yuan.

-----Original Message-----
From: Dai, Wei
Sent: Thursday, January 11, 2018 12:58 PM
To: Ananyev, Konstantin <[email protected]>; Yang, Qiming <[email protected]>; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [PATCH v4 0/2] app/testpmd: fix invalid rxq and txq nubmer settings

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number".
or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input.
This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---
v4: update git log message and rename 2 new added functions

v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 +++
 app/test-pmd/parameters.c | 13 +++----
 app/test-pmd/testpmd.c    | 92 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 108 insertions(+), 6 deletions(-)

--
2.7.5

author
#21 lore raw

Re: [PATCH v4 0/2] app/testpmd: fix invalid rxq and txq nubmer settings

Hi, Yuan
I can build dpdk with my patches successfully in my Fedora 24 with gcc 6.3.1 20161221 (Red Hat 6.3.1-1) Anyway, I will make v5 patch to address the problem you report and correct typos reported by Konstantin.

Thanks

Quoted 79 lines

-----Original Message-----
From: Peng, Yuan
Sent: Friday, January 12, 2018 1:40 PM
To: Dai, Wei <[email protected]>; Ananyev, Konstantin <[email protected]>; Yang, Qiming <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH v4 0/2] app/testpmd: fix invalid rxq and txq nubmer settings

Hi Wei,

There is a build error applied your patches to the latest DPDK version. /root/dpdk/app/test-pmd/testpmd.c: In function 'check_nb_rxq':
/root/dpdk/app/test-pmd/testpmd.c:579:3: error: 'pid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
printf("Fail: input rxq (%u) can't be greater "
^
/root/dpdk/app/test-pmd/testpmd.c: In function 'check_nb_txq':
/root/dpdk/app/test-pmd/testpmd.c:625:3: error: 'pid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
printf("Fail: input txq (%u) can't be greater "
^
My gcc verison is gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)

Could you help to check it?

Thanks.
Yuan.

-----Original Message-----
From: Dai, Wei
Sent: Thursday, January 11, 2018 12:58 PM
To: Ananyev, Konstantin <[email protected]>; Yang, Qiming <[email protected]>; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Dai, Wei <[email protected]>
Subject: [PATCH v4 0/2] app/testpmd: fix invalid rxq and txq nubmer settings

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input.
This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---
v4: update git log message and rename 2 new added functions

v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 +++
 app/test-pmd/parameters.c | 13 +++----
 app/test-pmd/testpmd.c    | 92
+++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 108 insertions(+), 6 deletions(-)

--
2.7.5

author
#22 lore raw

v5 cover app/testpmd: fix invalid rxq and txq nubmer settings

In reply to Wei Dai

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input.
This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---
v5: fix building failure with -Werror=maybe-uninitialized by gcc 5.3.1
fix typo error

v4: update git log message and rename 2 new added functions

v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 +++
 app/test-pmd/parameters.c | 13 +++----
 app/test-pmd/testpmd.c    | 92 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 108 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.5
author
#23 lore raw

PATCH v5 1/2 app/testpmd: fix invalid rxq number setting

If an invalid number of RX queues is configured from testpmd run-time command like "port config all rxq number" or from --rxq in the command to start testpmd, the global variable nb_rxq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid rxq setting and keeps its last correct value.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  7 ++++---
 app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  3 +++
 4 files changed, 55 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index 5b2e2ef..f0623b1 100644
@@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_rxq(res->value) != 0)
+			return;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) {
app/test-pmd/parameters.c +4 -3
index 304b98d..c46e734 100644
@@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv)
 	int n, opt;
 	char **argvopt;
 	int opt_idx;
+	portid_t pid;
 	enum { TX, RX };
 
 	static struct option lgopts[] = {
@@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv)
 				rss_hf = ETH_RSS_UDP;
 			if (!strcmp(lgopts[opt_idx].name, "rxq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
 					nb_rxq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_max_nb_rxq(&pid));
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
app/test-pmd/testpmd.c +46 -0

52 lines not on this page · raw message

app/test-pmd/testpmd.h +3 -0
index 2a266fd..e815509 100644
@@ -700,6 +700,9 @@ enum print_warning {
 int port_id_is_invalid(portid_t port_id, enum print_warning warning);
 int new_socket_id(unsigned int socket_id);
 
+queueid_t get_allowed_max_nb_rxq(portid_t *pid);
+int check_nb_rxq(queueid_t rxq);
+
 /*
  * Work-around of a compilation error with ICC on invocations of the
  * rte_be_to_cpu_16() function.
Signature · 1 line
2.7.5
Tested-by Acked-by Konstantin Ananyev on v5 1/2
#24 lore raw

Re: [PATCH v5 1/2] app/testpmd: fix invalid rxq number setting

- Tested Branch: master
- Tested commit 6c7001480ac6356ff0a4995f3ed495ed9c866061
- OS: 4.5.5-300.fc24.x86_64
- GCC: gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)
- CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
- NIC: Intel Corporation Device Fortville [8086:1572]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 1 cases, 1 passed, 0 failed

- Case:
./usertools/dpdk-devbind.py -b igb_uio 05:00:0 echo 1 >/sys/bus/pci/devices/0000:05:00.0/max_vfs
./usertools/dpdk-devbind.py -b vfio-pci 05:02.0
pf:
./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 4 -w 05:00.0,queue-num-per-vf=4 --file-prefix=test1 --socket-mem 1024,1024 - -I
vf:
./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 4 -w 05:02.0 --file-prefix=test2 --socket-mem 1024,1024 - -i --rxq=4 --txq=4
EAL: Detected 88 lcore(s)
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: PCI device 0000:05:02.0 on NUMA socket 0
EAL: probe driver: 8086:154c net_i40e_vf
EAL: using IOMMU type 1 (Type 1)
Interactive-mode selected
USER1: create a new mbuf pool <mbuf_pool_socket_0>: n=171456, size=2176, socket=0
USER1: create a new mbuf pool <mbuf_pool_socket_1>: n=171456, size=2176, socket=1 Configuring Port 0 (socket 0) Port 0: 7E:AC:58:44:3C:94 Checking link statuses... Done
testpmd> port stop all
Stopping ports...
Checking link statuses...
Done
testpmd> port config all txq 5
Fail: input txq (5) can't be greater than max_tx_queues (4) of port 0 testpmd> port config all rxq 5
Fail: input rxq (5) can't be greater than max_rx_queues (4) of port 0 testpmd> port start all Port 0: 5A:19:E4:5C:A3:C7 Checking link statuses... Done
testpmd> show port info all
Current number of RX queues: 4
Max possible RX queues: 4
Current number of TX queues: 4
Max possible TX queues: 4

there is no core dump, and the actual queue number doesn't change. The case passed.

-----Original Message-----
From: Dai, Wei
Sent: Friday, January 12, 2018 4:10 PM
To: Peng, Yuan <[email protected]>; Ananyev, Konstantin <[email protected]>; Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>; [email protected]
Subject: [PATCH v5 1/2] app/testpmd: fix invalid rxq number setting

If an invalid number of RX queues is configured from testpmd run-time command like "port config all rxq number" or from --rxq in the command to start testpmd, the global variable nb_rxq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid rxq setting and keeps its last correct value.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  7 ++++---
 app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  3 +++
 4 files changed, 55 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
@@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_rxq(res->value) != 0)
+			return;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) {
app/test-pmd/parameters.c +4 -3
@@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv)
 	int n, opt;
 	char **argvopt;
 	int opt_idx;
+	portid_t pid;
 	enum { TX, RX };
 
 	static struct option lgopts[] = {
@@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv)
 				rss_hf = ETH_RSS_UDP;
 			if (!strcmp(lgopts[opt_idx].name, "rxq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
 					nb_rxq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_max_nb_rxq(&pid));
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
app/test-pmd/testpmd.c +46 -0

52 lines not on this page · raw message

app/test-pmd/testpmd.h +3 -1
@@ -700,6 +700,9 @@ enum print_warning {  int port_id_is_invalid(portid_t port_id, enum print_warning warning);  int new_socket_id(unsigned int socket_id);
 
+queueid_t get_allowed_max_nb_rxq(portid_t *pid); int 
+check_nb_rxq(queueid_t rxq);
+
 /*
  * Work-around of a compilation error with ICC on invocations of the
  * rte_be_to_cpu_16() function.
--

2.7.5

author
#25 lore raw

PATCH v5 2/2 app/testpmd: fix invalid txq number setting

In reply to Wei Dai

If an invalid number of TX queues is configured from testpmd run-time command like "port config all txq number" or from --txq in the command to start testpmd, the global variable nb_txq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid txq setting and keeps its last correct value.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  6 +++---
 app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  2 ++
 4 files changed, 53 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index f0623b1..6619cb8 100644
@@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_txq(res->value) != 0)
+			return;
 		nb_txq = res->value;
 	}
 	else if (!strcmp(res->name, "rxd")) {
app/test-pmd/parameters.c +3 -3
index c46e734..ca2af65 100644
@@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
 					nb_txq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_max_nb_txq(&pid));
 			}
 			if (!nb_rxq && !nb_txq) {
 				rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
app/test-pmd/testpmd.c +46 -0

52 lines not on this page · raw message

app/test-pmd/testpmd.h +2 -0
index e815509..fe40892 100644
@@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id);
 
 queueid_t get_allowed_max_nb_rxq(portid_t *pid);
 int check_nb_rxq(queueid_t rxq);
+queueid_t get_allowed_max_nb_txq(portid_t *pid);
+int check_nb_txq(queueid_t txq);
 
 /*
  * Work-around of a compilation error with ICC on invocations of the
Signature · 1 line
2.7.5
Tested-by Acked-by Konstantin Ananyev on v5 2/2
#26 lore raw

Re: [PATCH v5 2/2] app/testpmd: fix invalid txq number setting

- Tested Branch: master
- Tested commit 6c7001480ac6356ff0a4995f3ed495ed9c866061
- OS: 4.5.5-300.fc24.x86_64
- GCC: gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)
- CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
- NIC: Intel Corporation Device Fortville [8086:1572]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 1 cases, 1 passed, 0 failed

- Case:
./usertools/dpdk-devbind.py -b igb_uio 05:00:0 echo 1 >/sys/bus/pci/devices/0000:05:00.0/max_vfs
./usertools/dpdk-devbind.py -b vfio-pci 05:02.0
pf:
./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 4 -w 05:00.0,queue-num-per-vf=4 --file-prefix=test1 --socket-mem 1024,1024 - -I
vf:
./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 4 -w 05:02.0 --file-prefix=test2 --socket-mem 1024,1024 - -i --rxq=4 --txq=4
EAL: Detected 88 lcore(s)
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: PCI device 0000:05:02.0 on NUMA socket 0
EAL: probe driver: 8086:154c net_i40e_vf
EAL: using IOMMU type 1 (Type 1)
Interactive-mode selected
USER1: create a new mbuf pool <mbuf_pool_socket_0>: n=171456, size=2176, socket=0
USER1: create a new mbuf pool <mbuf_pool_socket_1>: n=171456, size=2176, socket=1 Configuring Port 0 (socket 0) Port 0: 7E:AC:58:44:3C:94 Checking link statuses... Done
testpmd> port stop all
Stopping ports...
Checking link statuses...
Done
testpmd> port config all txq 5
Fail: input txq (5) can't be greater than max_tx_queues (4) of port 0 testpmd> port config all rxq 5
Fail: input rxq (5) can't be greater than max_rx_queues (4) of port 0 testpmd> port start all Port 0: 5A:19:E4:5C:A3:C7 Checking link statuses... Done
testpmd> show port info all
Current number of RX queues: 4
Max possible RX queues: 4
Current number of TX queues: 4
Max possible TX queues: 4

there is no core dump, and the actual queue number doesn't change. The case passed.

-----Original Message-----
From: Dai, Wei
Sent: Friday, January 12, 2018 4:10 PM
To: Peng, Yuan <[email protected]>; Ananyev, Konstantin <[email protected]>; Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>; [email protected]
Subject: [PATCH v5 2/2] app/testpmd: fix invalid txq number setting

If an invalid number of TX queues is configured from testpmd run-time command like "port config all txq number" or from --txq in the command to start testpmd, the global variable nb_txq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid txq setting and keeps its last correct value.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  6 +++---
 app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  2 ++
 4 files changed, 53 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
@@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_txq(res->value) != 0)
+			return;
 		nb_txq = res->value;
 	}
 	else if (!strcmp(res->name, "rxd")) {
app/test-pmd/parameters.c +3 -3
@@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
 					nb_txq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_max_nb_txq(&pid));
 			}
 			if (!nb_rxq && !nb_txq) {
 				rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
app/test-pmd/testpmd.c +46 -0

52 lines not on this page · raw message

app/test-pmd/testpmd.h +2 -1
@@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id);
 
 queueid_t get_allowed_max_nb_rxq(portid_t *pid);  int check_nb_rxq(queueid_t rxq);
+queueid_t get_allowed_max_nb_txq(portid_t *pid); int 
+check_nb_txq(queueid_t txq);
 
 /*
  * Work-around of a compilation error with ICC on invocations of the
--

2.7.5

Tested-by on the v5 series
#27 lore raw

Re: [PATCH v5 0/2] app/testpmd: fix invalid rxq and txq nubmer settings

In reply to Wei Dai

- Tested Branch: master
- Tested commit 6c7001480ac6356ff0a4995f3ed495ed9c866061
- OS: 4.5.5-300.fc24.x86_64
- GCC: gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)
- CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
- NIC: Intel Corporation Device Fortville [8086:1572]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 1 cases, 1 passed, 0 failed

- Case:
./usertools/dpdk-devbind.py -b igb_uio 05:00:0
echo 1 >/sys/bus/pci/devices/0000:05:00.0/max_vfs
./usertools/dpdk-devbind.py -b vfio-pci 05:02.0
pf:
./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 4 -w 05:00.0,queue-num-per-vf=4 --file-prefix=test1 --socket-mem 1024,1024 - -I vf:
./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 4 -w 05:02.0 --file-prefix=test2 --socket-mem 1024,1024 - -i --rxq=4 --txq=4
EAL: Detected 88 lcore(s)
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: PCI device 0000:05:02.0 on NUMA socket 0
EAL: probe driver: 8086:154c net_i40e_vf
EAL: using IOMMU type 1 (Type 1)
Interactive-mode selected
USER1: create a new mbuf pool <mbuf_pool_socket_0>: n=171456, size=2176, socket=0
USER1: create a new mbuf pool <mbuf_pool_socket_1>: n=171456, size=2176, socket=1
Configuring Port 0 (socket 0)
Port 0: 7E:AC:58:44:3C:94
Checking link statuses...
Done
testpmd> port stop all
Stopping ports...
Checking link statuses...
Done
testpmd> port config all txq 5
Fail: input txq (5) can't be greater than max_tx_queues (4) of port 0
testpmd> port config all rxq 5
Fail: input rxq (5) can't be greater than max_rx_queues (4) of port 0
testpmd> port start all
Port 0: 5A:19:E4:5C:A3:C7
Checking link statuses...
Done
testpmd> show port info all
Current number of RX queues: 4
Max possible RX queues: 4
Current number of TX queues: 4
Max possible TX queues: 4

there is no core dump, and the actual queue number doesn't change. The case passed.

-----Original Message-----
From: Dai, Wei
Sent: Friday, January 12, 2018 4:10 PM
To: Peng, Yuan <[email protected]>; Ananyev, Konstantin <[email protected]>; Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Dai, Wei <[email protected]>; [email protected]
Subject: [PATCH v5 0/2] app/testpmd: fix invalid rxq and txq nubmer settings

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number".
or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input.
This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.

With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---
v5: fix building failure with -Werror=maybe-uninitialized by gcc 5.3.1
fix typo error

v4: update git log message and rename 2 new added functions

v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 +++
 app/test-pmd/parameters.c | 13 +++----
 app/test-pmd/testpmd.c    | 92 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 108 insertions(+), 6 deletions(-)

--
2.7.5

author
#28 lore raw

v6 cover app/testpmd: fix invalid rxq and txq nubmer settings

In reply to Wei Dai

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number" or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.
With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

---
v6: same as v5. only correct patchwork mail format error
for maintainer's convenience.

v5: fix building failure with -Werror=maybe-uninitialized by gcc 5.3.1
fix typo error

v4: update git log message and rename 2 new added functions

v3: follow the guide from Konstantin to use functions to check
input rxq and txq instead of usage of new added global variables.

v2: fix a bug in v1

Wei Dai (2):
app/testpmd: fix invalid rxq number setting
app/testpmd: fix invalid txq number setting

 app/test-pmd/cmdline.c    |  4 +++
 app/test-pmd/parameters.c | 13 +++----
 app/test-pmd/testpmd.c    | 92 +++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  5 +++
 4 files changed, 108 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.5
author
#29 lore raw

PATCH v6 1/2 app/testpmd: fix invalid rxq number setting

If an invalid number of RX queues is configured from testpmd run-time command like "port config all rxq number" or from --rxq in the command to start testpmd, the global variable nb_rxq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid rxq setting and keeps its last correct value.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  7 ++++---
 app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  3 +++
 4 files changed, 55 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index 5b2e2ef..f0623b1 100644
@@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_rxq(res->value) != 0)
+			return;
 		nb_rxq = res->value;
 	}
 	else if (!strcmp(res->name, "txq")) {
app/test-pmd/parameters.c +4 -3
index 304b98d..c46e734 100644
@@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv)
 	int n, opt;
 	char **argvopt;
 	int opt_idx;
+	portid_t pid;
 	enum { TX, RX };
 
 	static struct option lgopts[] = {
@@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv)
 				rss_hf = ETH_RSS_UDP;
 			if (!strcmp(lgopts[opt_idx].name, "rxq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
 					nb_rxq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_max_nb_rxq(&pid));
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
app/test-pmd/testpmd.c +46 -0

52 lines not on this page · raw message

app/test-pmd/testpmd.h +3 -0
index 2a266fd..e815509 100644
@@ -700,6 +700,9 @@ enum print_warning {
 int port_id_is_invalid(portid_t port_id, enum print_warning warning);
 int new_socket_id(unsigned int socket_id);
 
+queueid_t get_allowed_max_nb_rxq(portid_t *pid);
+int check_nb_rxq(queueid_t rxq);
+
 /*
  * Work-around of a compilation error with ICC on invocations of the
  * rte_be_to_cpu_16() function.
Signature · 1 line
2.7.5
author
#30 lore raw

PATCH v6 2/2 app/testpmd: fix invalid txq number setting

In reply to Wei Dai

If an invalid number of TX queues is configured from testpmd run-time command like "port config all txq number" or from --txq in the command to start testpmd, the global variable nb_txq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid txq setting and keeps its last correct value.

Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")
---
 app/test-pmd/cmdline.c    |  2 ++
 app/test-pmd/parameters.c |  6 +++---
 app/test-pmd/testpmd.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  2 ++
 4 files changed, 53 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +2 -0
index f0623b1..6619cb8 100644
@@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 			printf("Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
+		if (check_nb_txq(res->value) != 0)
+			return;
 		nb_txq = res->value;
 	}
 	else if (!strcmp(res->name, "rxd")) {
app/test-pmd/parameters.c +3 -3
index c46e734..ca2af65 100644
@@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "txq")) {
 				n = atoi(optarg);
-				if (n >= 0 && n <= (int) MAX_QUEUE_ID)
+				if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
 					nb_txq = (queueid_t) n;
 				else
 					rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
-						  " >= 0 && <= %d\n", n,
-						  (int) MAX_QUEUE_ID);
+						  " >= 0 && <= %u\n", n,
+						  get_allowed_max_nb_txq(&pid));
 			}
 			if (!nb_rxq && !nb_txq) {
 				rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
app/test-pmd/testpmd.c +46 -0

52 lines not on this page · raw message

app/test-pmd/testpmd.h +2 -0
index e815509..fe40892 100644
@@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id);
 
 queueid_t get_allowed_max_nb_rxq(portid_t *pid);
 int check_nb_rxq(queueid_t rxq);
+queueid_t get_allowed_max_nb_txq(portid_t *pid);
+int check_nb_txq(queueid_t txq);
 
 /*
  * Work-around of a compilation error with ICC on invocations of the
Signature · 1 line
2.7.5
#31 lore raw

Re: [PATCH v6 0/2] app/testpmd: fix invalid rxq and txq nubmer settings

In reply to Wei Dai

12/01/2018 12:31, Wei Dai:

Quoted 11 lines

If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number" or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence.
With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq.

Quoted 6 lines
Fixes ce8d561418d4 ("app/testpmd: add port configuration settings")

Applied, thanks