Skip to contentSkip to conversation

app/testpmd: fix flow flush with invalid port

PATCH Superseded Junyu Jiang 3 participants 6 messages Oct 14, 2020 – Oct 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix flow flush with invalid port

There is no error info displayed when running flow flush command with invalid port. This patch fixed the issue.

Fixes 2a449871a12d ("app/testpmd: align behaviour of multi-port detach")
---
 app/test-pmd/config.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
app/test-pmd/config.c +5 -4
index fe31a9d52..cc4527386 100644
@@ -1775,16 +1775,17 @@ port_flow_flush(portid_t port_id)
 	struct rte_port *port = &ports[port_id];
 	int ret = 0;
 
+	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+		port_id == (portid_t)RTE_PORT_ALL)
+		return -EINVAL;
+
 	if (port->flow_list == NULL)
 		return ret;
 
 	/* Poisoning to make sure PMDs update it in case of error. */
 	memset(&error, 0x44, sizeof(error));
 	if (rte_flow_flush(port_id, &error)) {
-		ret = port_flow_complain(&error);
-		if (port_id_is_invalid(port_id, DISABLED_WARN) ||
-		    port_id == (portid_t)RTE_PORT_ALL)
-			return ret;
+		port_flow_complain(&error);
 	}
 
 	while (port->flow_list) {
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 24 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Junyu Jiang
Sent: Wednesday, October 14, 2020 4:30 PM
To: [email protected]
Cc: Beilei Xing <[email protected]>; Wenzhuo Lu <[email protected]>; Junyu Jiang <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] app/testpmd: fix flow flush with invalid port

There is no error info displayed when running flow flush command with invalid port. This patch fixed the issue.

Fixes 2a449871a12d ("app/testpmd: align behaviour of multi-port detach")
---
 app/test-pmd/config.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
app/test-pmd/config.c index renamed from app/test-pmd/config.c +0 -0

fe31a9d52..cc4527386 100644

app/test-pmd/config.c port_flow_flush(portid_t port_id) · line 1781

Quoted 7 lines
app/test-pmd/config.c +4 -0
@@ -1775,16 +1775,17 @@ port_flow_flush(portid_t port_id)
 	struct rte_port *port = &ports[port_id];
 	int ret = 0;
 
+	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+		port_id == (portid_t)RTE_PORT_ALL)
+		return -EINVAL;
+

Also better to move the port initialize after this check to make the code clean?

Quoted 16 lines
app/test-pmd/config.c +1 -5
 	if (port->flow_list == NULL)
 		return ret;
 
 	/* Poisoning to make sure PMDs update it in case of error. */
 	memset(&error, 0x44, sizeof(error));
 	if (rte_flow_flush(port_id, &error)) {
-		ret = port_flow_complain(&error);
-		if (port_id_is_invalid(port_id, DISABLED_WARN) ||
-		    port_id == (portid_t)RTE_PORT_ALL)
-			return ret;
+		port_flow_complain(&error);
 	}
 
 	while (port->flow_list) {
--

2.17.1

#2 lore raw
Quoted 29 lines · Suanming Mou

Hi,

Quoted 27 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Junyu Jiang
Sent: Wednesday, October 14, 2020 4:30 PM
To: [email protected]
Cc: Beilei Xing <[email protected]>; Wenzhuo Lu <[email protected]>; Junyu Jiang <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] app/testpmd: fix flow flush with invalid port

There is no error info displayed when running flow flush command with invalid port. This patch fixed the issue.

Fixes 2a449871a12d ("app/testpmd: align behaviour of multi-port detach")
---
  app/test-pmd/config.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
app/test-pmd/config.c index renamed from app/test-pmd/config.c +0 -0

fe31a9d52..cc4527386 100644

app/test-pmd/config.c +0 -0
@@ -1775,16 +1775,17 @@ port_flow_flush(portid_t port_id)
  	struct rte_port *port = &ports[port_id];
  	int ret = 0;
 
Quoted 7 lines

app/test-pmd/config.c port_flow_flush(portid_t port_id) · line 1781

Quoted 4 lines
app/test-pmd/config.c +4 -0
+	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+		port_id == (portid_t)RTE_PORT_ALL)
+		return -EINVAL;
+

Also better to move the port initialize after this check to make the code clean?

+1

#3 lore raw

Hi,

Quoted 48 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 6:14 AM
To: Suanming Mou <[email protected]>; Jiang, JunyuX <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix flow flush with invalid port

Quoted 32 lines · Suanming Mou

Hi,

Quoted 30 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Junyu Jiang
Sent: Wednesday, October 14, 2020 4:30 PM
To: [email protected]
Cc: Beilei Xing <[email protected]>; Wenzhuo Lu <[email protected]>; Junyu Jiang <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] app/testpmd: fix flow flush with invalid port

There is no error info displayed when running flow flush command with invalid port. This patch fixed the issue.

Fixes 2a449871a12d ("app/testpmd: align behaviour of multi-port

detach")
Cc: [email protected]

---
  app/test-pmd/config.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
app/test-pmd/config.c index renamed from app/test-pmd/config.c +0 -0

fe31a9d52..cc4527386 100644

app/test-pmd/config.c +0 -0
@@ -1775,16 +1775,17 @@ port_flow_flush(portid_t port_id)
  	struct rte_port *port = &ports[port_id];
  	int ret = 0;
 
Quoted 6 lines

app/test-pmd/config.c port_flow_flush(portid_t port_id) · line 1781

Quoted 4 lines
app/test-pmd/config.c +4 -0
+	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+		port_id == (portid_t)RTE_PORT_ALL)
+		return -EINVAL;
+

Also better to move the port initialize after this check to make the code

Quoted 4 lines

clean?

Quoted 1 line

+1

I will fix in V2.
Thanks.

#4 lore raw

PATCH v2 1/1 app/testpmd: fix flow flush with invalid port

In reply to Junyu Jiang

There is no error info displayed when running flow flush command with invalid port. This patch fixed the issue.

Fixes 2a449871a12d ("app/testpmd: align behaviour of multi-port detach")
---
 app/test-pmd/config.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
app/test-pmd/config.c +8 -5
index fe31a9d52..541952ab8 100644
@@ -1772,19 +1772,22 @@ int
 port_flow_flush(portid_t port_id)
 {
 	struct rte_flow_error error;
-	struct rte_port *port = &ports[port_id];
+	struct rte_port *port;
 	int ret = 0;
 
+	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+		port_id == (portid_t)RTE_PORT_ALL)
+		return -EINVAL;
+
+	port = &ports[port_id];
+
 	if (port->flow_list == NULL)
 		return ret;
 
 	/* Poisoning to make sure PMDs update it in case of error. */
 	memset(&error, 0x44, sizeof(error));
 	if (rte_flow_flush(port_id, &error)) {
-		ret = port_flow_complain(&error);
-		if (port_id_is_invalid(port_id, DISABLED_WARN) ||
-		    port_id == (portid_t)RTE_PORT_ALL)
-			return ret;
+		port_flow_complain(&error);
 	}
 
 	while (port->flow_list) {
Signature · 1 line
2.17.1