Skip to contentSkip to conversation

app/testpmd: fix tunnel offload validation

PATCH Applied Gregory Etelson 4 participants 6 messages Nov 2, 2021 – Nov 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix tunnel offload validation

Tunnel offload API allows application to restore packet to its original form if chain of flows missed after DECAP action. The main idea of the tunnel offload API was to query port PMD to provide flow elements - actions or items.
Flow elements supplied by PMD are merged with original flow rule elements provided by testpmd operator to create a new flow rule, optimal for PMD, to implement the tunnel offload API.
That flow rule transformation is hidden form testpmd operator and uses internal testpmd resources.

Current testpmd did not release tunnel offload resources if flow rule validation failed.

The patch always releases tunnel offload resources after flow rule validation returns.

Fixes 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")
---
 app/test-pmd/config.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
app/test-pmd/config.c +4 -2
index a18871d461..4870aaeba6 100644
@@ -2011,6 +2011,7 @@ port_flow_validate(portid_t port_id,
 	struct rte_flow_error error;
 	struct port_flow_tunnel *pft = NULL;
 	struct rte_port *port;
+	int ret;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
 	    port_id == (portid_t)RTE_PORT_ALL)
@@ -2037,10 +2038,11 @@ port_flow_validate(portid_t port_id,
 		if (pft->actions)
 			actions = pft->actions;
 	}
-	if (rte_flow_validate(port_id, attr, pattern, actions, &error))
-		return port_flow_complain(&error);
+	ret = rte_flow_validate(port_id, attr, pattern, actions, &error);
 	if (tunnel_ops->enabled)
 		port_flow_tunnel_offload_cmd_release(port_id, tunnel_ops, pft);
+	if (ret)
+		return port_flow_complain(&error);
 	printf("Flow rule validated\n");
 	return 0;
 }
Signature · 1 line
2.33.1
#1 lore raw

Hello Ferruh,

Can you estimate when this patch will be merged into 21.11 ?

Thank you.

Regards,
Gregory

Quoted 86 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, November 2, 2021 14:24
To: [email protected]; Gregory Etelson <[email protected]>
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Xiaoyun Li <[email protected]>
Subject: [PATCH] app/testpmd: fix tunnel offload validation

Tunnel offload API allows application to restore packet to
its original form if chain of flows missed after DECAP action.
The main idea of the tunnel offload API was to query port PMD
to provide flow elements - actions or items. Flow elements supplied by PMD are merged with original flow rule
elements provided by testpmd operator to create a new flow rule,
optimal for PMD, to implement the tunnel offload API.
That flow rule transformation is hidden form testpmd operator and uses
internal testpmd resources.

Current testpmd did not release tunnel offload resources if flow rule
validation failed.

The patch always releases tunnel offload resources after flow rule
validation returns.

Fixes 1b9f274623b8 ("app/testpmd: add

commands for tunnel offload")

Signed-off-by: Gregory Etelson
<[email protected]>

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

pmd/config.c
index a18871d461..4870aaeba6 100644

app/test-pmd/config.c +1 -0
@@ -2011,6 +2011,7 @@
 port_flow_validate(portid_t port_id,
 	struct rte_flow_error error;
 	struct port_flow_tunnel *pft = NULL;
 	struct rte_port *port;
+	int ret;
 
 	if (port_id_is_invalid(port_id,

ENABLED_WARN) ||

app/test-pmd/config.c +1 -2
 	    port_id == (portid_t)RTE_PORT_ALL)
@@ -2037,10 +2038,11 @@
 port_flow_validate(portid_t port_id,
 		if (pft->actions)
 			actions = pft->actions;
 	}
-	if (rte_flow_validate(port_id, attr,
 pattern, actions, &error))
-		return
 port_flow_complain(&error);
+	ret = rte_flow_validate(port_id, attr,
 pattern, actions, &error);
 	if (tunnel_ops->enabled)
	port_flow_tunnel_offload_cmd_release(

port_id, tunnel_ops, pft);

app/test-pmd/config.c +2 -0
+	if (ret)
+		return

port_flow_complain(&error);

app/test-pmd/config.c +0 -1
 	printf("Flow rule validated\n");
 	return 0;
 }
--

2.33.1

#2 lore raw
Quoted 4 lines · Gregory Etelson

Hello Ferruh,

Can you estimate when this patch will be merged into 21.11 ?

Hi Gregory,

It is not merged because it is missing review.

Ori, Slava, can you please help with the review?

Quoted 92 lines

Thank you.

Regards,
Gregory

Quoted 86 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, November 2, 2021 14:24
To: [email protected]; Gregory Etelson <[email protected]>
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Xiaoyun Li <[email protected]>
Subject: [PATCH] app/testpmd: fix tunnel offload validation

Tunnel offload API allows application to restore packet to
its original form if chain of flows missed after DECAP action.
The main idea of the tunnel offload API was to query port PMD
to provide flow elements - actions or items. Flow elements supplied by PMD are merged with original flow rule
elements provided by testpmd operator to create a new flow rule,
optimal for PMD, to implement the tunnel offload API.
That flow rule transformation is hidden form testpmd operator and uses
internal testpmd resources.

Current testpmd did not release tunnel offload resources if flow rule
validation failed.

The patch always releases tunnel offload resources after flow rule
validation returns.

Fixes 1b9f274623b8 ("app/testpmd: add

commands for tunnel offload")

Signed-off-by: Gregory Etelson
<[email protected]>

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

pmd/config.c
index a18871d461..4870aaeba6 100644

app/test-pmd/config.c +1 -0
@@ -2011,6 +2011,7 @@
 port_flow_validate(portid_t port_id,
  	struct rte_flow_error error;
  	struct port_flow_tunnel *pft = NULL;
  	struct rte_port *port;
+	int ret;
 
  	if (port_id_is_invalid(port_id,

ENABLED_WARN) ||
port_id == (portid_t)RTE_PORT_ALL)

app/test-pmd/config.c +1 -2
@@ -2037,10 +2038,11 @@
 port_flow_validate(portid_t port_id,
  		if (pft->actions)
  			actions = pft->actions;
  	}
-	if (rte_flow_validate(port_id, attr,
 pattern, actions, &error))
-		return
 port_flow_complain(&error);
+	ret = rte_flow_validate(port_id, attr,
 pattern, actions, &error);
  	if (tunnel_ops->enabled)
	port_flow_tunnel_offload_cmd_release(

port_id, tunnel_ops, pft);

app/test-pmd/config.c +2 -0
+	if (ret)
+		return

port_flow_complain(&error);
printf("Flow rule validated\n"); return 0;
}
--
2.33.1

#3 lore raw
Quoted 107 lines · Ferruh Yigit
Quoted 4 lines · Gregory Etelson

Hello Ferruh,

Can you estimate when this patch will be merged into 21.11 ?

Hi Gregory,

It is not merged because it is missing review.

Ori, Slava, can you please help with the review?

Quoted 81 lines

Thank you.

Regards,
Gregory

Quoted 76 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, November 2, 2021 14:24
To: [email protected]; Gregory Etelson <[email protected]>
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Xiaoyun Li <[email protected]>
Subject: [PATCH] app/testpmd: fix tunnel offload validation

Tunnel offload API allows application to restore packet to
its original form if chain of flows missed after DECAP action.
The main idea of the tunnel offload API was to query port PMD
to provide flow elements - actions or items. Flow elements supplied by PMD are merged with original flow rule
elements provided by testpmd operator to create a new flow rule,
optimal for PMD, to implement the tunnel offload API.
That flow rule transformation is hidden form testpmd operator and uses
internal testpmd resources.

Current testpmd did not release tunnel offload resources if flow rule
validation failed.

The patch always releases tunnel offload resources after flow rule
validation returns.

Fixes 1b9f274623b8 ("app/testpmd: add

commands for tunnel offload")

Signed-off-by: Gregory Etelson <[email protected]>
---
  app/test-pmd/config.c | 6 ++++--

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

pmd/config.c
index a18871d461..4870aaeba6 100644

app/test-pmd/config.c +1 -0
@@ -2011,6 +2011,7 @@
 port_flow_validate(portid_t port_id,
       struct rte_flow_error error;
       struct port_flow_tunnel *pft = NULL;
       struct rte_port *port;
+    int ret;
 
       if (port_id_is_invalid(port_id,

ENABLED_WARN) ||
          port_id == (portid_t)RTE_PORT_ALL)

app/test-pmd/config.c +1 -2
@@ -2037,10 +2038,11 @@
 port_flow_validate(portid_t port_id,
           if (pft->actions)
               actions = pft->actions;
       }
-    if (rte_flow_validate(port_id, attr,
 pattern, actions, &error))
-        return
 port_flow_complain(&error);
+    ret = rte_flow_validate(port_id, attr,
 pattern, actions, &error);
       if (tunnel_ops->enabled)
Quoted 11 lines
Quoted 10 lines

    port_flow_tunnel_offload_cmd_release( port_id, tunnel_ops, pft);
+    if (ret)
+        return port_flow_complain(&error); printf("Flow rule validated\n"); return 0;
  }

Signature · 1 line
2.33.1
Reviewed-by
#4 lore raw
In reply to Ferruh Yigit
Quoted 13 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, November 17, 2021 12:10
To: Gregory Etelson <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>
Subject: Re: [PATCH] app/testpmd: fix tunnel offload validation

Quoted 2 lines · Gregory Etelson

Hello Ferruh,

Quoted 47 lines
Quoted 2 lines

Can you estimate when this patch will be merged into 21.11 ?

Hi Gregory,

It is not merged because it is missing review.

Ori, Slava, can you please help with the review?

Quoted 37 lines

Thank you.

Regards,
Gregory

Quoted 32 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, November 2, 2021 14:24
To: [email protected]; Gregory Etelson <[email protected]>
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Xiaoyun Li <[email protected]>
Subject: [PATCH] app/testpmd: fix tunnel offload validation

Tunnel offload API allows application to restore packet to its original form if chain of flows missed after DECAP action. The main idea of the tunnel offload API was to query port PMD to provide flow elements - actions or items.
Flow elements supplied by PMD are merged with original flow rule elements provided by testpmd operator to create a new flow rule, optimal for PMD, to implement the tunnel offload API. That flow rule transformation is hidden form testpmd operator and uses internal testpmd resources.

Current testpmd did not release tunnel offload resources if flow rule validation failed.

The patch always releases tunnel offload resources after flow rule validation returns.

Fixes 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")

Signed-off-by: Gregory Etelson
<[email protected]>

Applied
#5 lore raw
Quoted 54 lines · Slava Ovsiienko
Quoted 54 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, November 17, 2021 12:10
To: Gregory Etelson <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>
Subject: Re: [PATCH] app/testpmd: fix tunnel offload validation

Quoted 4 lines · Gregory Etelson

Hello Ferruh,

Can you estimate when this patch will be merged into 21.11 ?

Hi Gregory,

It is not merged because it is missing review.

Ori, Slava, can you please help with the review?

Quoted 31 lines

Thank you.

Regards,
Gregory

Quoted 26 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Tuesday, November 2, 2021 14:24
To: [email protected]; Gregory Etelson <[email protected]>
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Xiaoyun Li <[email protected]>
Subject: [PATCH] app/testpmd: fix tunnel offload validation

Tunnel offload API allows application to restore packet to its original form if chain of flows missed after DECAP action. The main idea of the tunnel offload API was to query port PMD to provide flow elements - actions or items.
Flow elements supplied by PMD are merged with original flow rule elements provided by testpmd operator to create a new flow rule, optimal for PMD, to implement the tunnel offload API. That flow rule transformation is hidden form testpmd operator and uses internal testpmd resources.

Current testpmd did not release tunnel offload resources if flow rule validation failed.

The patch always releases tunnel offload resources after flow rule validation returns.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Fixes 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")

Signed-off-by: Gregory Etelson
<[email protected]>

Applied to dpdk-next-net/main, thanks.