patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] app/testpmd: fix tunnel offload validation
@ 2021-11-02 12:24 Gregory Etelson
  0 siblings, 0 replies; only message in thread
From: Gregory Etelson @ 2021-11-02 12:24 UTC (permalink / raw)
  To: dev, getelson; +Cc: matan, rasland, stable, Xiaoyun Li

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.

Cc: stable@dpdk.org

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

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/config.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a18871d461..4870aaeba6 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
 }
-- 
2.33.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-02 12:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 12:24 [dpdk-stable] [PATCH] app/testpmd: fix tunnel offload validation Gregory Etelson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).