app/testpmd: fix tunnel offload validation

Message ID 20211102122421.4190-1-getelson@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: fix tunnel offload validation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Etelson, Gregory Nov. 2, 2021, 12:24 p.m. UTC
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(-)
  

Comments

Etelson, Gregory Nov. 17, 2021, 8:57 a.m. UTC | #1
Hello Ferruh,

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

Thank you.

Regards,
Gregory

> -----Original Message-----
> From: Gregory Etelson <getelson@nvidia.com>
> Sent: Tuesday, November 2, 2021 14:24
> To: dev@dpdk.org; Gregory Etelson
> <getelson@nvidia.com>
> Cc: Matan Azrad <matan@nvidia.com>; Raslan
> Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org; Xiaoyun Li
> <xiaoyun.li@intel.com>
> 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.
> 
> 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
  
Ferruh Yigit Nov. 17, 2021, 10:09 a.m. UTC | #2
On 11/17/2021 8:57 AM, Gregory Etelson wrote:
> 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?


> Thank you.
> 
> Regards,
> Gregory
> 
>> -----Original Message-----
>> From: Gregory Etelson <getelson@nvidia.com>
>> Sent: Tuesday, November 2, 2021 14:24
>> To: dev@dpdk.org; Gregory Etelson
>> <getelson@nvidia.com>
>> Cc: Matan Azrad <matan@nvidia.com>; Raslan
>> Darawsheh <rasland@nvidia.com>;
>> stable@dpdk.org; Xiaoyun Li
>> <xiaoyun.li@intel.com>
>> 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.
>>
>> 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
>
  
Singh, Aman Deep Nov. 17, 2021, 10:18 a.m. UTC | #3
On 11/17/2021 3:39 PM, Ferruh Yigit wrote:
> On 11/17/2021 8:57 AM, Gregory Etelson wrote:
>> 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?
>
>
>> Thank you.
>>
>> Regards,
>> Gregory
>>
>>> -----Original Message-----
>>> From: Gregory Etelson <getelson@nvidia.com>
>>> Sent: Tuesday, November 2, 2021 14:24
>>> To: dev@dpdk.org; Gregory Etelson
>>> <getelson@nvidia.com>
>>> Cc: Matan Azrad <matan@nvidia.com>; Raslan
>>> Darawsheh <rasland@nvidia.com>;
>>> stable@dpdk.org; Xiaoyun Li
>>> <xiaoyun.li@intel.com>
>>> 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.
>>>
>>> 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
>>
>
> Acked-by: Aman Deep Singh <aman.deep.singh@intel.com>
  
Slava Ovsiienko Nov. 17, 2021, 10:27 a.m. UTC | #4
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Wednesday, November 17, 2021 12:10
> To: Gregory Etelson <getelson@nvidia.com>; dev@dpdk.org; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>
> Subject: Re: [PATCH] app/testpmd: fix tunnel offload validation
> 
> On 11/17/2021 8:57 AM, Gregory Etelson wrote:
> > 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?
> 
> 
> > Thank you.
> >
> > Regards,
> > Gregory
> >
> >> -----Original Message-----
> >> From: Gregory Etelson <getelson@nvidia.com>
> >> Sent: Tuesday, November 2, 2021 14:24
> >> To: dev@dpdk.org; Gregory Etelson
> >> <getelson@nvidia.com>
> >> Cc: Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
> >> <rasland@nvidia.com>; stable@dpdk.org; Xiaoyun Li
> >> <xiaoyun.li@intel.com>
> >> 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.
> >>
> >> Cc: stable@dpdk.org
> >>
> >> Fixes: 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")
> >>
> >> Signed-off-by: Gregory Etelson
> >> <getelson@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  
Ferruh Yigit Nov. 17, 2021, 12:26 p.m. UTC | #5
On 11/17/2021 10:27 AM, Slava Ovsiienko wrote:
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Wednesday, November 17, 2021 12:10
>> To: Gregory Etelson <getelson@nvidia.com>; dev@dpdk.org; Ori Kam
>> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>
>> Cc: Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
>> <rasland@nvidia.com>; NBU-Contact-Thomas Monjalon
>> <thomas@monjalon.net>
>> Subject: Re: [PATCH] app/testpmd: fix tunnel offload validation
>>
>> On 11/17/2021 8:57 AM, Gregory Etelson wrote:
>>> 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?
>>
>>
>>> Thank you.
>>>
>>> Regards,
>>> Gregory
>>>
>>>> -----Original Message-----
>>>> From: Gregory Etelson <getelson@nvidia.com>
>>>> Sent: Tuesday, November 2, 2021 14:24
>>>> To: dev@dpdk.org; Gregory Etelson
>>>> <getelson@nvidia.com>
>>>> Cc: Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
>>>> <rasland@nvidia.com>; stable@dpdk.org; Xiaoyun Li
>>>> <xiaoyun.li@intel.com>
>>>> 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.
>>>>
>>>> Cc: stable@dpdk.org
>>>>
>>>> Fixes: 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")
>>>>
>>>> Signed-off-by: Gregory Etelson
>>>> <getelson@nvidia.com>
> Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 
> 

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

Patch

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;
 }