[v4,0/2] app/testpmd implement VXLAN/NVGRE Encap/Decap
mbox series

Message ID cover.1529420040.git.nelio.laranjeiro@6wind.com
Headers show
Series
  • app/testpmd implement VXLAN/NVGRE Encap/Decap
Related show

Message

Nélio Laranjeiro June 21, 2018, 7:13 a.m. UTC
This series adds an easy and maintainable configuration version support for
those two actions for 18.08 by using global variables in testpmd to store the
necessary information for the tunnel encapsulation.  Those variables are used
in conjunction of RTE_FLOW_ACTION_{VXLAN,NVGRE}_ENCAP action to create easily
the action for flows.

A common way to use it:

 set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
 flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end

 set vxlan ipv6 4 4 4 ::1 ::2222 11:11:11:11:11:11 22:22:22:22:22:22
 flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end

 set nvgre ipv4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
 flow create 0 ingress pattern end actions nvgre_encap / queue index 0 / end

 set nvgre ipv6 4 ::1 ::2222 11:11:11:11:11:11 22:22:22:22:22:22
 flow create 0 ingress pattern end actions nvgre_encap / queue index 0 / end

This also replace the proposal done by Mohammad Abdul Awal [1] which handles
in a more complex way for the same work.

Note this API has already a modification planned for 18.11 [2] thus those
series should have a limited life for a single release.

[1] https://dpdk.org/ml/archives/dev/2018-May/101403.html
[2] https://dpdk.org/ml/archives/dev/2018-June/103485.html

Changes in v4:

- fix big endian issue on vni and tni.
- add samples to the documentation.
- set the VXLAN UDP source port to 0 by default to let the driver generate it
  from the inner hash as described in the RFC 7348.
- use default rte flow mask for each item.

Changes in v3:

- support VLAN in the outer encapsulation.
- fix the documentation with missing arguments.

Changes in v2:

- add default IPv6 values for NVGRE encapsulation.
- replace VXLAN to NVGRE in comments concerning NVGRE layer.

Nelio Laranjeiro (2):
  app/testpmd: add VXLAN encap/decap support
  app/testpmd: add NVGRE encap/decap support

 app/test-pmd/cmdline.c                      | 252 ++++++++++++++++++
 app/test-pmd/cmdline_flow.c                 | 268 ++++++++++++++++++++
 app/test-pmd/testpmd.c                      |  32 +++
 app/test-pmd/testpmd.h                      |  32 +++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  72 ++++++
 5 files changed, 656 insertions(+)

Comments

Mohammad Abdul Awal June 22, 2018, 7:42 a.m. UTC | #1
Hi Nelio,


On 21/06/2018 08:13, Nelio Laranjeiro wrote:
> This series adds an easy and maintainable configuration version support for
> those two actions for 18.08 by using global variables in testpmd to store the
> necessary information for the tunnel encapsulation.  Those variables are used
> in conjunction of RTE_FLOW_ACTION_{VXLAN,NVGRE}_ENCAP action to create easily
> the action for flows.
>
> A common way to use it:
>
>   set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>   flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end

This way we can define only one tunnel for all the flows. This is not a 
convenient for testing a scenario (e.g. mutiport or switch) with 
multiple tunnels. Isn't it?

Regards,
Awal.
Nélio Laranjeiro June 22, 2018, 8:31 a.m. UTC | #2
On Fri, Jun 22, 2018 at 08:42:10AM +0100, Mohammad Abdul Awal wrote:
> Hi Nelio,
> 
> 
> On 21/06/2018 08:13, Nelio Laranjeiro wrote:
> > This series adds an easy and maintainable configuration version support for
> > those two actions for 18.08 by using global variables in testpmd to store the
> > necessary information for the tunnel encapsulation.  Those variables are used
> > in conjunction of RTE_FLOW_ACTION_{VXLAN,NVGRE}_ENCAP action to create easily
> > the action for flows.
> > 
> > A common way to use it:
> > 
> >   set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> >   flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
> 
> This way we can define only one tunnel for all the flows. This is not a
> convenient for testing a scenario (e.g. mutiport or switch) with multiple
> tunnels. Isn't it?

Hi Awal.

The "set vxlan" command will just configure the outer VXLAN tunnel to be
used, when the "flow" command is invoked, it will use the VXLAN tunnel
information and create a valid VXLAN_ENCAP action.  For instance:

 testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
 testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
 testpmd> set vxlan ipv6 4 34 42 ::1 ::2222 80:12:13:14:15:16 22:22:22:22:22:22
 testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end

will create two VLXAN_ENCAP flow one with IPv4 tunnel the second one
with an IPv6.  Whereas:

 testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
 testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.2.3.4 / end
 	actions vxlan_encap / queue index 0 / end
 testpmd> flow create 0 ingress pattern eth / ipv4 src is 20.2.3.4 / end
 	actions vxlan_encap / queue index 0 / end

will encapsulate the packets having as IPv4 source IP 10.2.3.4 and
20.2.3.4 with the same VXLAN tunnel headers.

Regards,
Mohammad Abdul Awal June 22, 2018, 8:51 a.m. UTC | #3
On 22/06/2018 09:31, Nélio Laranjeiro wrote:
> On Fri, Jun 22, 2018 at 08:42:10AM +0100, Mohammad Abdul Awal wrote:
>> Hi Nelio,
>>
>>
>> On 21/06/2018 08:13, Nelio Laranjeiro wrote:
>>> This series adds an easy and maintainable configuration version support for
>>> those two actions for 18.08 by using global variables in testpmd to store the
>>> necessary information for the tunnel encapsulation.  Those variables are used
>>> in conjunction of RTE_FLOW_ACTION_{VXLAN,NVGRE}_ENCAP action to create easily
>>> the action for flows.
>>>
>>> A common way to use it:
>>>
>>>    set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>>>    flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
>> This way we can define only one tunnel for all the flows. This is not a
>> convenient for testing a scenario (e.g. mutiport or switch) with multiple
>> tunnels. Isn't it?
> Hi Awal.
>
> The "set vxlan" command will just configure the outer VXLAN tunnel to be
> used, when the "flow" command is invoked, it will use the VXLAN tunnel
> information and create a valid VXLAN_ENCAP action.  For instance:
>
>   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>   testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
>   testpmd> set vxlan ipv6 4 34 42 ::1 ::2222 80:12:13:14:15:16 22:22:22:22:22:22
>   testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
>
> will create two VLXAN_ENCAP flow one with IPv4 tunnel the second one
> with an IPv6.  Whereas:
>
>   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>   testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.2.3.4 / end
>   	actions vxlan_encap / queue index 0 / end
>   testpmd> flow create 0 ingress pattern eth / ipv4 src is 20.2.3.4 / end
>   	actions vxlan_encap / queue index 0 / end
>
> will encapsulate the packets having as IPv4 source IP 10.2.3.4 and
> 20.2.3.4 with the same VXLAN tunnel headers.

I understand that the same IPv4 tunnel will be used for both flows in 
your example above.  I have the following questions.

1) How can we create two or more IPv4 (or IPv6) tunnel?
1) How can we make the flows to use different IPv4 tunnels?
As an example,

  testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
  testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 33:33:33:33:33:33 44:44:44:44:44:44
  testpmd> flow create 0 ingress pattern end actions vxlan_encap <first tunnel?> / queue index 0 / end
  testpmd> flow create 0 ingress pattern end actions vxlan_encap <second tunnel?> / queue index 0 / end
  

Is it possible?

Regards,
Awal.

>
> Regards,
>
Nélio Laranjeiro June 22, 2018, 9:08 a.m. UTC | #4
On Fri, Jun 22, 2018 at 09:51:15AM +0100, Mohammad Abdul Awal wrote:
> 
> 
> On 22/06/2018 09:31, Nélio Laranjeiro wrote:
> > On Fri, Jun 22, 2018 at 08:42:10AM +0100, Mohammad Abdul Awal wrote:
> > > Hi Nelio,
> > > 
> > > 
> > > On 21/06/2018 08:13, Nelio Laranjeiro wrote:
> > > > This series adds an easy and maintainable configuration version support for
> > > > those two actions for 18.08 by using global variables in testpmd to store the
> > > > necessary information for the tunnel encapsulation.  Those variables are used
> > > > in conjunction of RTE_FLOW_ACTION_{VXLAN,NVGRE}_ENCAP action to create easily
> > > > the action for flows.
> > > > 
> > > > A common way to use it:
> > > > 
> > > >    set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> > > >    flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
> > > This way we can define only one tunnel for all the flows. This is not a
> > > convenient for testing a scenario (e.g. mutiport or switch) with multiple
> > > tunnels. Isn't it?
> > Hi Awal.
> > 
> > The "set vxlan" command will just configure the outer VXLAN tunnel to be
> > used, when the "flow" command is invoked, it will use the VXLAN tunnel
> > information and create a valid VXLAN_ENCAP action.  For instance:
> > 
> >   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> >   testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
> >   testpmd> set vxlan ipv6 4 34 42 ::1 ::2222 80:12:13:14:15:16 22:22:22:22:22:22
> >   testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
> > 
> > will create two VLXAN_ENCAP flow one with IPv4 tunnel the second one
> > with an IPv6.  Whereas:
> > 
> >   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> >   testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.2.3.4 / end
> >   	actions vxlan_encap / queue index 0 / end
> >   testpmd> flow create 0 ingress pattern eth / ipv4 src is 20.2.3.4 / end
> >   	actions vxlan_encap / queue index 0 / end
> > 
> > will encapsulate the packets having as IPv4 source IP 10.2.3.4 and
> > 20.2.3.4 with the same VXLAN tunnel headers.
> 
> I understand that the same IPv4 tunnel will be used for both flows in your
> example above.  I have the following questions.
> 
> 1) How can we create two or more IPv4 (or IPv6) tunnel?
> 1) How can we make the flows to use different IPv4 tunnels?
> As an example,
> 
>  testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>  testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 33:33:33:33:33:33 44:44:44:44:44:44
>  testpmd> flow create 0 ingress pattern end actions vxlan_encap <first tunnel?> / queue index 0 / end
>  testpmd> flow create 0 ingress pattern end actions vxlan_encap <second tunnel?> / queue index 0 / end
> 

Doing this, the flows will use the same tunnel, you must do:

 testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
 testpmd> flow create 0 ingress pattern end actions vxlan_encap <first tunnel?> / queue index 0 / end
 testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 33:33:33:33:33:33 44:44:44:44:44:44
 testpmd> flow create 0 ingress pattern end actions vxlan_encap <second tunnel?> / queue index 0 / end

to have what you want.

> Is it possible?

Regards,
Mohammad Abdul Awal June 22, 2018, 10:19 a.m. UTC | #5
On 22/06/2018 10:08, Nélio Laranjeiro wrote:
> On Fri, Jun 22, 2018 at 09:51:15AM +0100, Mohammad Abdul Awal wrote:
>>
>> On 22/06/2018 09:31, Nélio Laranjeiro wrote:
>>> On Fri, Jun 22, 2018 at 08:42:10AM +0100, Mohammad Abdul Awal wrote:
>>>> Hi Nelio,
>>>>
>>>>
>>>> On 21/06/2018 08:13, Nelio Laranjeiro wrote:
>>>>> This series adds an easy and maintainable configuration version support for
>>>>> those two actions for 18.08 by using global variables in testpmd to store the
>>>>> necessary information for the tunnel encapsulation.  Those variables are used
>>>>> in conjunction of RTE_FLOW_ACTION_{VXLAN,NVGRE}_ENCAP action to create easily
>>>>> the action for flows.
>>>>>
>>>>> A common way to use it:
>>>>>
>>>>>     set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>>>>>     flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
>>>> This way we can define only one tunnel for all the flows. This is not a
>>>> convenient for testing a scenario (e.g. mutiport or switch) with multiple
>>>> tunnels. Isn't it?
>>> Hi Awal.
>>>
>>> The "set vxlan" command will just configure the outer VXLAN tunnel to be
>>> used, when the "flow" command is invoked, it will use the VXLAN tunnel
>>> information and create a valid VXLAN_ENCAP action.  For instance:
>>>
>>>    testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>>>    testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
>>>    testpmd> set vxlan ipv6 4 34 42 ::1 ::2222 80:12:13:14:15:16 22:22:22:22:22:22
>>>    testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
>>>
>>> will create two VLXAN_ENCAP flow one with IPv4 tunnel the second one
>>> with an IPv6.  Whereas:
>>>
>>>    testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>>>    testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.2.3.4 / end
>>>    	actions vxlan_encap / queue index 0 / end
>>>    testpmd> flow create 0 ingress pattern eth / ipv4 src is 20.2.3.4 / end
>>>    	actions vxlan_encap / queue index 0 / end
>>>
>>> will encapsulate the packets having as IPv4 source IP 10.2.3.4 and
>>> 20.2.3.4 with the same VXLAN tunnel headers.
>> I understand that the same IPv4 tunnel will be used for both flows in your
>> example above.  I have the following questions.
>>
>> 1) How can we create two or more IPv4 (or IPv6) tunnel?
>> 1) How can we make the flows to use different IPv4 tunnels?
>> As an example,
>>
>>   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>>   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 33:33:33:33:33:33 44:44:44:44:44:44
>>   testpmd> flow create 0 ingress pattern end actions vxlan_encap <first tunnel?> / queue index 0 / end
>>   testpmd> flow create 0 ingress pattern end actions vxlan_encap <second tunnel?> / queue index 0 / end
>>
> Doing this, the flows will use the same tunnel, you must do:
>
>   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
>   testpmd> flow create 0 ingress pattern end actions vxlan_encap <first tunnel?> / queue index 0 / end
>   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 33:33:33:33:33:33 44:44:44:44:44:44
>   testpmd> flow create 0 ingress pattern end actions vxlan_encap <second tunnel?> / queue index 0 / end
>
> to have what you want.
OK, thanks for the clarification. So, since there will be only one 
global instance of the tunnel,  for any subsequent "set vxlan" 
operations, the tunnel created from the last last operation will be 
used. May be it should be cleared in the description/documentation?

>> Is it possible?
> Regards,
>
Nélio Laranjeiro June 26, 2018, 3:15 p.m. UTC | #6
On Fri, Jun 22, 2018 at 11:19:14AM +0100, Mohammad Abdul Awal wrote:
> On 22/06/2018 10:08, Nélio Laranjeiro wrote:
> > On Fri, Jun 22, 2018 at 09:51:15AM +0100, Mohammad Abdul Awal wrote:
> > > 
> > > On 22/06/2018 09:31, Nélio Laranjeiro wrote:
> > > > On Fri, Jun 22, 2018 at 08:42:10AM +0100, Mohammad Abdul Awal wrote:
> > > > > Hi Nelio,
> > > > > 
> > > > > 
> > > > > On 21/06/2018 08:13, Nelio Laranjeiro wrote:
> > > > > > This series adds an easy and maintainable configuration version support for
> > > > > > those two actions for 18.08 by using global variables in testpmd to store the
> > > > > > necessary information for the tunnel encapsulation.  Those variables are used
> > > > > > in conjunction of RTE_FLOW_ACTION_{VXLAN,NVGRE}_ENCAP action to create easily
> > > > > > the action for flows.
> > > > > > 
> > > > > > A common way to use it:
> > > > > > 
> > > > > >     set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> > > > > >     flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
> > > > > This way we can define only one tunnel for all the flows. This is not a
> > > > > convenient for testing a scenario (e.g. mutiport or switch) with multiple
> > > > > tunnels. Isn't it?
> > > > Hi Awal.
> > > > 
> > > > The "set vxlan" command will just configure the outer VXLAN tunnel to be
> > > > used, when the "flow" command is invoked, it will use the VXLAN tunnel
> > > > information and create a valid VXLAN_ENCAP action.  For instance:
> > > > 
> > > >    testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> > > >    testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
> > > >    testpmd> set vxlan ipv6 4 34 42 ::1 ::2222 80:12:13:14:15:16 22:22:22:22:22:22
> > > >    testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end
> > > > 
> > > > will create two VLXAN_ENCAP flow one with IPv4 tunnel the second one
> > > > with an IPv6.  Whereas:
> > > > 
> > > >    testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> > > >    testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.2.3.4 / end
> > > >    	actions vxlan_encap / queue index 0 / end
> > > >    testpmd> flow create 0 ingress pattern eth / ipv4 src is 20.2.3.4 / end
> > > >    	actions vxlan_encap / queue index 0 / end
> > > > 
> > > > will encapsulate the packets having as IPv4 source IP 10.2.3.4 and
> > > > 20.2.3.4 with the same VXLAN tunnel headers.
> > > I understand that the same IPv4 tunnel will be used for both flows in your
> > > example above.  I have the following questions.
> > > 
> > > 1) How can we create two or more IPv4 (or IPv6) tunnel?
> > > 1) How can we make the flows to use different IPv4 tunnels?
> > > As an example,
> > > 
> > >   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> > >   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 33:33:33:33:33:33 44:44:44:44:44:44
> > >   testpmd> flow create 0 ingress pattern end actions vxlan_encap <first tunnel?> / queue index 0 / end
> > >   testpmd> flow create 0 ingress pattern end actions vxlan_encap <second tunnel?> / queue index 0 / end
> > > 
> > Doing this, the flows will use the same tunnel, you must do:
> > 
> >   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22
> >   testpmd> flow create 0 ingress pattern end actions vxlan_encap <first tunnel?> / queue index 0 / end
> >   testpmd> set vxlan ipv4 4 4 4 127.0.0.1 128.0.0.1 33:33:33:33:33:33 44:44:44:44:44:44
> >   testpmd> flow create 0 ingress pattern end actions vxlan_encap <second tunnel?> / queue index 0 / end
> > 
> > to have what you want.
> OK, thanks for the clarification. So, since there will be only one global
> instance of the tunnel,  for any subsequent "set vxlan" operations, the
> tunnel created from the last last operation will be used. May be it should
> be cleared in the description/documentation?

Will add it in the v5.

> > > Is it possible?
> > Regards,
> > 
> 

Thanks,