From: Gregory Etelson Date: Tue, 2 Nov 2021 12:24:21 +0000 (+0200) Subject: app/testpmd: fix tunnel offload validation X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=849e6ddc6a431a021d6ab2125f1ebbba545cf05a;hp=47f5dee19e5f9a2cf1883a7119675d7a25470aca;p=dpdk.git 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") Cc: stable@dpdk.org Signed-off-by: Gregory Etelson Reviewed-by: Viacheslav Ovsiienko Acked-by: Aman Singh --- diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index f87d9d5b82..1722d6c8f8 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1971,6 +1971,7 @@ port_flow_validate(portid_t port_id, { struct rte_flow_error error; struct port_flow_tunnel *pft = NULL; + int ret; /* Poisoning to make sure PMDs update it in case of error. */ memset(&error, 0x11, sizeof(error)); @@ -1984,10 +1985,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; }