net/nfp: add the feature of RSS based on VXLAN inner layer

Message ID 1665383329-23583-1-git-send-email-chaoyong.he@corigine.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/nfp: add the feature of RSS based on VXLAN inner layer |

Checks

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

Commit Message

Chaoyong He Oct. 10, 2022, 6:28 a.m. UTC
  Add the logics to support the feature of RSS packets based on
the inner layer of VXLAN tunnel.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>

Depends-on: series-24819 ("preparation for the rte_flow offload of nfp PMD")

---
 drivers/net/nfp/flower/nfp_flower.c             |   2 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.c        |   1 +
 drivers/net/nfp/flower/nfp_flower_ctrl.c        |   2 +-
 drivers/net/nfp/flower/nfp_flower_representor.c |   2 +-
 drivers/net/nfp/nfp_common.c                    |  33 +++++++
 drivers/net/nfp/nfp_common.h                    |   4 +
 drivers/net/nfp/nfp_cpp_bridge.h                |   2 -
 drivers/net/nfp/nfp_ethdev.c                    | 111 ++++++++++++++++++++++++
 drivers/net/nfp/nfp_ethdev_vf.c                 |   1 +
 drivers/net/nfp/nfp_rxtx.c                      |   1 +
 10 files changed, 154 insertions(+), 5 deletions(-)
  

Comments

Ferruh Yigit Oct. 13, 2022, 12:03 p.m. UTC | #1
On 10/10/2022 7:28 AM, Chaoyong He wrote:
> Add the logics to support the feature of RSS packets based on
> the inner layer of VXLAN tunnel.
> 
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> 
> Depends-on: series-24819 ("preparation for the rte_flow offload of nfp PMD")
> 
> ---
>   drivers/net/nfp/flower/nfp_flower.c             |   2 +-
>   drivers/net/nfp/flower/nfp_flower_cmsg.c        |   1 +
>   drivers/net/nfp/flower/nfp_flower_ctrl.c        |   2 +-
>   drivers/net/nfp/flower/nfp_flower_representor.c |   2 +-
>   drivers/net/nfp/nfp_common.c                    |  33 +++++++
>   drivers/net/nfp/nfp_common.h                    |   4 +
>   drivers/net/nfp/nfp_cpp_bridge.h                |   2 -
>   drivers/net/nfp/nfp_ethdev.c                    | 111 ++++++++++++++++++++++++
>   drivers/net/nfp/nfp_ethdev_vf.c                 |   1 +
>   drivers/net/nfp/nfp_rxtx.c                      |   1 +
>   10 files changed, 154 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
> index 3e97f5c..da96d2f 100644
> --- a/drivers/net/nfp/flower/nfp_flower.c
> +++ b/drivers/net/nfp/flower/nfp_flower.c
> @@ -10,9 +10,9 @@
>   #include <ethdev_pci.h>
>   #include <ethdev_driver.h>
>   
> +#include "../nfp_ctrl.h"
>   #include "../nfp_common.h"
>   #include "../nfp_logs.h"
> -#include "../nfp_ctrl.h"
>   #include "../nfp_cpp_bridge.h"
>   #include "../nfp_rxtx.h"
>   #include "../nfpcore/nfp_mip.h"
> diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
> index 750a629..b719eb2 100644
> --- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
> +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
> @@ -5,6 +5,7 @@
>   
>   #include "../nfpcore/nfp_nsp.h"
>   #include "../nfp_logs.h"
> +#include "../nfp_ctrl.h"
>   #include "../nfp_common.h"
>   #include "nfp_flower.h"
>   #include "nfp_flower_cmsg.h"
> diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
> index df908ef..961ca34 100644
> --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
> +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
> @@ -6,9 +6,9 @@
>   #include <rte_common.h>
>   #include <ethdev_pci.h>
>   
> +#include "../nfp_ctrl.h"
>   #include "../nfp_common.h"
>   #include "../nfp_logs.h"
> -#include "../nfp_ctrl.h"
>   #include "../nfp_rxtx.h"
>   #include "nfp_flower.h"
>   #include "nfp_flower_ctrl.h"
> diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
> index 0e60f50..8db73e0 100644
> --- a/drivers/net/nfp/flower/nfp_flower_representor.c
> +++ b/drivers/net/nfp/flower/nfp_flower_representor.c
> @@ -6,9 +6,9 @@
>   #include <rte_common.h>
>   #include <ethdev_pci.h>
>   
> +#include "../nfp_ctrl.h"
>   #include "../nfp_common.h"
>   #include "../nfp_logs.h"
> -#include "../nfp_ctrl.h"
>   #include "../nfp_rxtx.h"
>   #include "../nfpcore/nfp_mip.h"
>   #include "../nfpcore/nfp_rtsym.h"
> diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
> index 07781a1..ec6a669 100644
> --- a/drivers/net/nfp/nfp_common.c
> +++ b/drivers/net/nfp/nfp_common.c
> @@ -37,6 +37,7 @@
>   #include "nfpcore/nfp_rtsym.h"
>   #include "nfpcore/nfp_nsp.h"
>   
> +#include "nfp_ctrl.h"
>   #include "nfp_common.h"
>   #include "nfp_ctrl.h"
>   #include "nfp_rxtx.h"

Are above header inclusion changes related to this patch?
  
Chaoyong He Oct. 14, 2022, 1:15 a.m. UTC | #2
> On 10/10/2022 7:28 AM, Chaoyong He wrote:
> > Add the logics to support the feature of RSS packets based on the
> > inner layer of VXLAN tunnel.
> >
> > Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> > Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> >
> > Depends-on: series-24819 ("preparation for the rte_flow offload of nfp
> > PMD")
> >
> > ---
> >   drivers/net/nfp/flower/nfp_flower.c             |   2 +-
> >   drivers/net/nfp/flower/nfp_flower_cmsg.c        |   1 +
> >   drivers/net/nfp/flower/nfp_flower_ctrl.c        |   2 +-
> >   drivers/net/nfp/flower/nfp_flower_representor.c |   2 +-
> >   drivers/net/nfp/nfp_common.c                    |  33 +++++++
> >   drivers/net/nfp/nfp_common.h                    |   4 +
> >   drivers/net/nfp/nfp_cpp_bridge.h                |   2 -
> >   drivers/net/nfp/nfp_ethdev.c                    | 111
> ++++++++++++++++++++++++
> >   drivers/net/nfp/nfp_ethdev_vf.c                 |   1 +
> >   drivers/net/nfp/nfp_rxtx.c                      |   1 +
> >   10 files changed, 154 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/nfp/flower/nfp_flower.c
> > b/drivers/net/nfp/flower/nfp_flower.c
> > index 3e97f5c..da96d2f 100644
> > --- a/drivers/net/nfp/flower/nfp_flower.c
> > +++ b/drivers/net/nfp/flower/nfp_flower.c
> > @@ -10,9 +10,9 @@
> >   #include <ethdev_pci.h>
> >   #include <ethdev_driver.h>
> >
> > +#include "../nfp_ctrl.h"
> >   #include "../nfp_common.h"
> >   #include "../nfp_logs.h"
> > -#include "../nfp_ctrl.h"
> >   #include "../nfp_cpp_bridge.h"
> >   #include "../nfp_rxtx.h"
> >   #include "../nfpcore/nfp_mip.h"
> > diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c
> > b/drivers/net/nfp/flower/nfp_flower_cmsg.c
> > index 750a629..b719eb2 100644
> > --- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
> > +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
> > @@ -5,6 +5,7 @@
> >
> >   #include "../nfpcore/nfp_nsp.h"
> >   #include "../nfp_logs.h"
> > +#include "../nfp_ctrl.h"
> >   #include "../nfp_common.h"
> >   #include "nfp_flower.h"
> >   #include "nfp_flower_cmsg.h"
> > diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c
> > b/drivers/net/nfp/flower/nfp_flower_ctrl.c
> > index df908ef..961ca34 100644
> > --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
> > +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
> > @@ -6,9 +6,9 @@
> >   #include <rte_common.h>
> >   #include <ethdev_pci.h>
> >
> > +#include "../nfp_ctrl.h"
> >   #include "../nfp_common.h"
> >   #include "../nfp_logs.h"
> > -#include "../nfp_ctrl.h"
> >   #include "../nfp_rxtx.h"
> >   #include "nfp_flower.h"
> >   #include "nfp_flower_ctrl.h"
> > diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c
> > b/drivers/net/nfp/flower/nfp_flower_representor.c
> > index 0e60f50..8db73e0 100644
> > --- a/drivers/net/nfp/flower/nfp_flower_representor.c
> > +++ b/drivers/net/nfp/flower/nfp_flower_representor.c
> > @@ -6,9 +6,9 @@
> >   #include <rte_common.h>
> >   #include <ethdev_pci.h>
> >
> > +#include "../nfp_ctrl.h"
> >   #include "../nfp_common.h"
> >   #include "../nfp_logs.h"
> > -#include "../nfp_ctrl.h"
> >   #include "../nfp_rxtx.h"
> >   #include "../nfpcore/nfp_mip.h"
> >   #include "../nfpcore/nfp_rtsym.h"
> > diff --git a/drivers/net/nfp/nfp_common.c
> > b/drivers/net/nfp/nfp_common.c index 07781a1..ec6a669 100644
> > --- a/drivers/net/nfp/nfp_common.c
> > +++ b/drivers/net/nfp/nfp_common.c
> > @@ -37,6 +37,7 @@
> >   #include "nfpcore/nfp_rtsym.h"
> >   #include "nfpcore/nfp_nsp.h"
> >
> > +#include "nfp_ctrl.h"
> >   #include "nfp_common.h"
> >   #include "nfp_ctrl.h"
> >   #include "nfp_rxtx.h"
> 
> Are above header inclusion changes related to this patch?

Yes, it does relate.
In this patch, we use a macro in `nfp_common.h`, and this macro is defined in `nfp_ctrl.h`,
so import the dependency relations of this two header files.
If we don't modify the related files which use these two header files, the compile process will fail.
  
Ferruh Yigit Oct. 14, 2022, 8:42 a.m. UTC | #3
On 10/14/2022 2:15 AM, Chaoyong He wrote:
>> On 10/10/2022 7:28 AM, Chaoyong He wrote:
>>> Add the logics to support the feature of RSS packets based on the
>>> inner layer of VXLAN tunnel.
>>>
>>> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
>>> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
>>>
>>> Depends-on: series-24819 ("preparation for the rte_flow offload of nfp
>>> PMD")
>>>
>>> ---
>>>    drivers/net/nfp/flower/nfp_flower.c             |   2 +-
>>>    drivers/net/nfp/flower/nfp_flower_cmsg.c        |   1 +
>>>    drivers/net/nfp/flower/nfp_flower_ctrl.c        |   2 +-
>>>    drivers/net/nfp/flower/nfp_flower_representor.c |   2 +-
>>>    drivers/net/nfp/nfp_common.c                    |  33 +++++++
>>>    drivers/net/nfp/nfp_common.h                    |   4 +
>>>    drivers/net/nfp/nfp_cpp_bridge.h                |   2 -
>>>    drivers/net/nfp/nfp_ethdev.c                    | 111
>> ++++++++++++++++++++++++
>>>    drivers/net/nfp/nfp_ethdev_vf.c                 |   1 +
>>>    drivers/net/nfp/nfp_rxtx.c                      |   1 +
>>>    10 files changed, 154 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/net/nfp/flower/nfp_flower.c
>>> b/drivers/net/nfp/flower/nfp_flower.c
>>> index 3e97f5c..da96d2f 100644
>>> --- a/drivers/net/nfp/flower/nfp_flower.c
>>> +++ b/drivers/net/nfp/flower/nfp_flower.c
>>> @@ -10,9 +10,9 @@
>>>    #include <ethdev_pci.h>
>>>    #include <ethdev_driver.h>
>>>
>>> +#include "../nfp_ctrl.h"
>>>    #include "../nfp_common.h"
>>>    #include "../nfp_logs.h"
>>> -#include "../nfp_ctrl.h"
>>>    #include "../nfp_cpp_bridge.h"
>>>    #include "../nfp_rxtx.h"
>>>    #include "../nfpcore/nfp_mip.h"
>>> diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c
>>> b/drivers/net/nfp/flower/nfp_flower_cmsg.c
>>> index 750a629..b719eb2 100644
>>> --- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
>>> +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
>>> @@ -5,6 +5,7 @@
>>>
>>>    #include "../nfpcore/nfp_nsp.h"
>>>    #include "../nfp_logs.h"
>>> +#include "../nfp_ctrl.h"
>>>    #include "../nfp_common.h"
>>>    #include "nfp_flower.h"
>>>    #include "nfp_flower_cmsg.h"
>>> diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c
>>> b/drivers/net/nfp/flower/nfp_flower_ctrl.c
>>> index df908ef..961ca34 100644
>>> --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
>>> +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
>>> @@ -6,9 +6,9 @@
>>>    #include <rte_common.h>
>>>    #include <ethdev_pci.h>
>>>
>>> +#include "../nfp_ctrl.h"
>>>    #include "../nfp_common.h"
>>>    #include "../nfp_logs.h"
>>> -#include "../nfp_ctrl.h"
>>>    #include "../nfp_rxtx.h"
>>>    #include "nfp_flower.h"
>>>    #include "nfp_flower_ctrl.h"
>>> diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c
>>> b/drivers/net/nfp/flower/nfp_flower_representor.c
>>> index 0e60f50..8db73e0 100644
>>> --- a/drivers/net/nfp/flower/nfp_flower_representor.c
>>> +++ b/drivers/net/nfp/flower/nfp_flower_representor.c
>>> @@ -6,9 +6,9 @@
>>>    #include <rte_common.h>
>>>    #include <ethdev_pci.h>
>>>
>>> +#include "../nfp_ctrl.h"
>>>    #include "../nfp_common.h"
>>>    #include "../nfp_logs.h"
>>> -#include "../nfp_ctrl.h"
>>>    #include "../nfp_rxtx.h"
>>>    #include "../nfpcore/nfp_mip.h"
>>>    #include "../nfpcore/nfp_rtsym.h"
>>> diff --git a/drivers/net/nfp/nfp_common.c
>>> b/drivers/net/nfp/nfp_common.c index 07781a1..ec6a669 100644
>>> --- a/drivers/net/nfp/nfp_common.c
>>> +++ b/drivers/net/nfp/nfp_common.c
>>> @@ -37,6 +37,7 @@
>>>    #include "nfpcore/nfp_rtsym.h"
>>>    #include "nfpcore/nfp_nsp.h"
>>>
>>> +#include "nfp_ctrl.h"
>>>    #include "nfp_common.h"
>>>    #include "nfp_ctrl.h"
>>>    #include "nfp_rxtx.h"
>>
>> Are above header inclusion changes related to this patch?
> 
> Yes, it does relate.
> In this patch, we use a macro in `nfp_common.h`, and this macro is defined in `nfp_ctrl.h`,
> so import the dependency relations of this two header files.
> If we don't modify the related files which use these two header files, the compile process will fail.
> 

OK, it is for 'NFP_NET_N_VXLAN_PORTS' which is defined in `nfp_ctrl.h`, 
and used in `nfp_common.h` in this patch.

And you are including `nfp_ctrl.h` in all c files that uses 
`nfp_common.h`, instead
why don't you include `nfp_ctrl.h` in `nfp_common.h`?
Because you are creating this dependency anyway, whoever includes 
`nfp_common.h` will need `nfp_ctrl.h`.

Or other option can be moving 'NFP_NET_N_VXLAN_PORTS' define (and its 
dependencies) to `nfp_common.h`, if it is logically makes sense.
  
Chaoyong He Oct. 14, 2022, 9:30 a.m. UTC | #4
> On 10/14/2022 2:15 AM, Chaoyong He wrote:
> >> On 10/10/2022 7:28 AM, Chaoyong He wrote:
> >>> Add the logics to support the feature of RSS packets based on the
> >>> inner layer of VXLAN tunnel.
> >>>
> >>> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> >>> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> >>>
> >>> Depends-on: series-24819 ("preparation for the rte_flow offload of
> >>> nfp
> >>> PMD")
> >>>
> >>> ---
> >>>    drivers/net/nfp/flower/nfp_flower.c             |   2 +-
> >>>    drivers/net/nfp/flower/nfp_flower_cmsg.c        |   1 +
> >>>    drivers/net/nfp/flower/nfp_flower_ctrl.c        |   2 +-
> >>>    drivers/net/nfp/flower/nfp_flower_representor.c |   2 +-
> >>>    drivers/net/nfp/nfp_common.c                    |  33 +++++++
> >>>    drivers/net/nfp/nfp_common.h                    |   4 +
> >>>    drivers/net/nfp/nfp_cpp_bridge.h                |   2 -
> >>>    drivers/net/nfp/nfp_ethdev.c                    | 111
> >> ++++++++++++++++++++++++
> >>>    drivers/net/nfp/nfp_ethdev_vf.c                 |   1 +
> >>>    drivers/net/nfp/nfp_rxtx.c                      |   1 +
> >>>    10 files changed, 154 insertions(+), 5 deletions(-)
> >>>
> >>> diff --git a/drivers/net/nfp/flower/nfp_flower.c
> >>> b/drivers/net/nfp/flower/nfp_flower.c
> >>> index 3e97f5c..da96d2f 100644
> >>> --- a/drivers/net/nfp/flower/nfp_flower.c
> >>> +++ b/drivers/net/nfp/flower/nfp_flower.c
> >>> @@ -10,9 +10,9 @@
> >>>    #include <ethdev_pci.h>
> >>>    #include <ethdev_driver.h>
> >>>
> >>> +#include "../nfp_ctrl.h"
> >>>    #include "../nfp_common.h"
> >>>    #include "../nfp_logs.h"
> >>> -#include "../nfp_ctrl.h"
> >>>    #include "../nfp_cpp_bridge.h"
> >>>    #include "../nfp_rxtx.h"
> >>>    #include "../nfpcore/nfp_mip.h"
> >>> diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c
> >>> b/drivers/net/nfp/flower/nfp_flower_cmsg.c
> >>> index 750a629..b719eb2 100644
> >>> --- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
> >>> +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
> >>> @@ -5,6 +5,7 @@
> >>>
> >>>    #include "../nfpcore/nfp_nsp.h"
> >>>    #include "../nfp_logs.h"
> >>> +#include "../nfp_ctrl.h"
> >>>    #include "../nfp_common.h"
> >>>    #include "nfp_flower.h"
> >>>    #include "nfp_flower_cmsg.h"
> >>> diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c
> >>> b/drivers/net/nfp/flower/nfp_flower_ctrl.c
> >>> index df908ef..961ca34 100644
> >>> --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
> >>> +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
> >>> @@ -6,9 +6,9 @@
> >>>    #include <rte_common.h>
> >>>    #include <ethdev_pci.h>
> >>>
> >>> +#include "../nfp_ctrl.h"
> >>>    #include "../nfp_common.h"
> >>>    #include "../nfp_logs.h"
> >>> -#include "../nfp_ctrl.h"
> >>>    #include "../nfp_rxtx.h"
> >>>    #include "nfp_flower.h"
> >>>    #include "nfp_flower_ctrl.h"
> >>> diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c
> >>> b/drivers/net/nfp/flower/nfp_flower_representor.c
> >>> index 0e60f50..8db73e0 100644
> >>> --- a/drivers/net/nfp/flower/nfp_flower_representor.c
> >>> +++ b/drivers/net/nfp/flower/nfp_flower_representor.c
> >>> @@ -6,9 +6,9 @@
> >>>    #include <rte_common.h>
> >>>    #include <ethdev_pci.h>
> >>>
> >>> +#include "../nfp_ctrl.h"
> >>>    #include "../nfp_common.h"
> >>>    #include "../nfp_logs.h"
> >>> -#include "../nfp_ctrl.h"
> >>>    #include "../nfp_rxtx.h"
> >>>    #include "../nfpcore/nfp_mip.h"
> >>>    #include "../nfpcore/nfp_rtsym.h"
> >>> diff --git a/drivers/net/nfp/nfp_common.c
> >>> b/drivers/net/nfp/nfp_common.c index 07781a1..ec6a669 100644
> >>> --- a/drivers/net/nfp/nfp_common.c
> >>> +++ b/drivers/net/nfp/nfp_common.c
> >>> @@ -37,6 +37,7 @@
> >>>    #include "nfpcore/nfp_rtsym.h"
> >>>    #include "nfpcore/nfp_nsp.h"
> >>>
> >>> +#include "nfp_ctrl.h"
> >>>    #include "nfp_common.h"
> >>>    #include "nfp_ctrl.h"
> >>>    #include "nfp_rxtx.h"
> >>
> >> Are above header inclusion changes related to this patch?
> >
> > Yes, it does relate.
> > In this patch, we use a macro in `nfp_common.h`, and this macro is
> > defined in `nfp_ctrl.h`, so import the dependency relations of this two
> header files.
> > If we don't modify the related files which use these two header files, the
> compile process will fail.
> >
> 
> OK, it is for 'NFP_NET_N_VXLAN_PORTS' which is defined in `nfp_ctrl.h`, and
> used in `nfp_common.h` in this patch.
> 
> And you are including `nfp_ctrl.h` in all c files that uses `nfp_common.h`,
> instead why don't you include `nfp_ctrl.h` in `nfp_common.h`?
> Because you are creating this dependency anyway, whoever includes
> `nfp_common.h` will need `nfp_ctrl.h`.
> 
> Or other option can be moving 'NFP_NET_N_VXLAN_PORTS' define (and its
> dependencies) to `nfp_common.h`, if it is logically makes sense.

Yes, you are right.
I will send out a v2 patch and include `nfp_ctrl.h` in `nfp_common.h`.
Thanks!
  

Patch

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 3e97f5c..da96d2f 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -10,9 +10,9 @@ 
 #include <ethdev_pci.h>
 #include <ethdev_driver.h>
 
+#include "../nfp_ctrl.h"
 #include "../nfp_common.h"
 #include "../nfp_logs.h"
-#include "../nfp_ctrl.h"
 #include "../nfp_cpp_bridge.h"
 #include "../nfp_rxtx.h"
 #include "../nfpcore/nfp_mip.h"
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 750a629..b719eb2 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -5,6 +5,7 @@ 
 
 #include "../nfpcore/nfp_nsp.h"
 #include "../nfp_logs.h"
+#include "../nfp_ctrl.h"
 #include "../nfp_common.h"
 #include "nfp_flower.h"
 #include "nfp_flower_cmsg.h"
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index df908ef..961ca34 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -6,9 +6,9 @@ 
 #include <rte_common.h>
 #include <ethdev_pci.h>
 
+#include "../nfp_ctrl.h"
 #include "../nfp_common.h"
 #include "../nfp_logs.h"
-#include "../nfp_ctrl.h"
 #include "../nfp_rxtx.h"
 #include "nfp_flower.h"
 #include "nfp_flower_ctrl.h"
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 0e60f50..8db73e0 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -6,9 +6,9 @@ 
 #include <rte_common.h>
 #include <ethdev_pci.h>
 
+#include "../nfp_ctrl.h"
 #include "../nfp_common.h"
 #include "../nfp_logs.h"
-#include "../nfp_ctrl.h"
 #include "../nfp_rxtx.h"
 #include "../nfpcore/nfp_mip.h"
 #include "../nfpcore/nfp_rtsym.h"
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 07781a1..ec6a669 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -37,6 +37,7 @@ 
 #include "nfpcore/nfp_rtsym.h"
 #include "nfpcore/nfp_nsp.h"
 
+#include "nfp_ctrl.h"
 #include "nfp_common.h"
 #include "nfp_ctrl.h"
 #include "nfp_rxtx.h"
@@ -1370,6 +1371,38 @@ 
 	}
 }
 
+int
+nfp_net_set_vxlan_port(struct nfp_net_hw *hw,
+		size_t idx,
+		uint16_t port)
+{
+	int ret;
+	uint32_t i;
+
+	if (idx > NFP_NET_N_VXLAN_PORTS) {
+		PMD_DRV_LOG(ERR, "The idx value is out of range.");
+		return -ERANGE;
+	}
+
+	hw->vxlan_ports[idx] = port;
+
+	for (i = 0; i < NFP_NET_N_VXLAN_PORTS; i += 2) {
+		nn_cfg_writel(hw, NFP_NET_CFG_VXLAN_PORT + i * sizeof(port),
+			(hw->vxlan_ports[i + 1] << 16) | hw->vxlan_ports[i]);
+	}
+
+	rte_spinlock_lock(&hw->reconfig_lock);
+
+	nn_cfg_writel(hw, NFP_NET_CFG_UPDATE, NFP_NET_CFG_UPDATE_VXLAN);
+	rte_wmb();
+
+	ret = __nfp_net_reconfig(hw, NFP_NET_CFG_UPDATE_VXLAN);
+
+	rte_spinlock_unlock(&hw->reconfig_lock);
+
+	return ret;
+}
+
 RTE_LOG_REGISTER_SUFFIX(nfp_logtype_init, init, NOTICE);
 RTE_LOG_REGISTER_SUFFIX(nfp_logtype_driver, driver, NOTICE);
 RTE_LOG_REGISTER_SUFFIX(nfp_logtype_cpp, cpp, NOTICE);
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 27ea9c2..cc9ac01 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -209,6 +209,9 @@  struct nfp_net_hw {
 	int stride_rx;
 	int stride_tx;
 
+	uint16_t vxlan_ports[NFP_NET_N_VXLAN_PORTS];
+	uint8_t vxlan_usecnt[NFP_NET_N_VXLAN_PORTS];
+
 	uint8_t *qcp_cfg;
 	rte_spinlock_t reconfig_lock;
 
@@ -438,6 +441,7 @@  int nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
 void nfp_net_close_rx_queue(struct rte_eth_dev *dev);
 void nfp_net_stop_tx_queue(struct rte_eth_dev *dev);
 void nfp_net_close_tx_queue(struct rte_eth_dev *dev);
+int nfp_net_set_vxlan_port(struct nfp_net_hw *hw, size_t idx, uint16_t port);
 
 #define NFP_NET_DEV_PRIVATE_TO_HW(adapter)\
 	(&((struct nfp_net_adapter *)adapter)->hw)
diff --git a/drivers/net/nfp/nfp_cpp_bridge.h b/drivers/net/nfp/nfp_cpp_bridge.h
index 7fee3a9..2abc77c 100644
--- a/drivers/net/nfp/nfp_cpp_bridge.h
+++ b/drivers/net/nfp/nfp_cpp_bridge.h
@@ -16,8 +16,6 @@ 
 #ifndef _NFP_CPP_BRIDGE_H_
 #define _NFP_CPP_BRIDGE_H_
 
-#include "nfp_common.h"
-
 #define NFP_CPP_MEMIO_BOUNDARY	(1 << 20)
 #define NFP_BRIDGE_OP_READ	20
 #define NFP_BRIDGE_OP_WRITE	30
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e131021..0e3d82a 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -32,6 +32,7 @@ 
 #include "nfpcore/nfp_rtsym.h"
 #include "nfpcore/nfp_nsp.h"
 
+#include "nfp_ctrl.h"
 #include "nfp_common.h"
 #include "nfp_ctrl.h"
 #include "nfp_rxtx.h"
@@ -138,6 +139,10 @@ 
 
 	update |= NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING;
 
+	/* Enable vxlan */
+	new_ctrl |= NFP_NET_CFG_CTRL_VXLAN;
+	update |= NFP_NET_CFG_UPDATE_VXLAN;
+
 	if (hw->cap & NFP_NET_CFG_CTRL_RINGCFG)
 		new_ctrl |= NFP_NET_CFG_CTRL_RINGCFG;
 
@@ -319,6 +324,110 @@ 
 	return 0;
 }
 
+static int
+nfp_net_find_vxlan_idx(struct nfp_net_hw *hw,
+		uint16_t port,
+		uint32_t *idx)
+{
+	uint32_t i;
+	int free_idx = -1;
+
+	for (i = 0; i < NFP_NET_N_VXLAN_PORTS; i++) {
+		if (hw->vxlan_ports[i] == port) {
+			free_idx = i;
+			break;
+		}
+
+		if (hw->vxlan_usecnt[i] == 0) {
+			free_idx = i;
+			break;
+		}
+	}
+
+	if (free_idx == -1)
+		return -EINVAL;
+
+	*idx = free_idx;
+
+	return 0;
+}
+
+static int
+nfp_udp_tunnel_port_add(struct rte_eth_dev *dev,
+		struct rte_eth_udp_tunnel *tunnel_udp)
+{
+	int ret;
+	uint32_t idx;
+	uint16_t vxlan_port;
+	struct nfp_net_hw *hw;
+	enum rte_eth_tunnel_type tnl_type;
+
+	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	vxlan_port = tunnel_udp->udp_port;
+	tnl_type   = tunnel_udp->prot_type;
+
+	if (tnl_type != RTE_ETH_TUNNEL_TYPE_VXLAN) {
+		PMD_DRV_LOG(ERR, "Not VXLAN tunnel");
+		return -ENOTSUP;
+	}
+
+	ret = nfp_net_find_vxlan_idx(hw, vxlan_port, &idx);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed find valid vxlan idx");
+		return -EINVAL;
+	}
+
+	if (hw->vxlan_usecnt[idx] == 0) {
+		ret = nfp_net_set_vxlan_port(hw, idx, vxlan_port);
+		if (ret != 0) {
+			PMD_DRV_LOG(ERR, "Failed set vxlan port");
+			return -EINVAL;
+		}
+	}
+
+	hw->vxlan_usecnt[idx]++;
+
+	return 0;
+}
+
+static int
+nfp_udp_tunnel_port_del(struct rte_eth_dev *dev,
+		struct rte_eth_udp_tunnel *tunnel_udp)
+{
+	int ret;
+	uint32_t idx;
+	uint16_t vxlan_port;
+	struct nfp_net_hw *hw;
+	enum rte_eth_tunnel_type tnl_type;
+
+	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	vxlan_port = tunnel_udp->udp_port;
+	tnl_type   = tunnel_udp->prot_type;
+
+	if (tnl_type != RTE_ETH_TUNNEL_TYPE_VXLAN) {
+		PMD_DRV_LOG(ERR, "Not VXLAN tunnel");
+		return -ENOTSUP;
+	}
+
+	ret = nfp_net_find_vxlan_idx(hw, vxlan_port, &idx);
+	if (ret != 0 || hw->vxlan_usecnt[idx] == 0) {
+		PMD_DRV_LOG(ERR, "Failed find valid vxlan idx");
+		return -EINVAL;
+	}
+
+	hw->vxlan_usecnt[idx]--;
+
+	if (hw->vxlan_usecnt[idx] == 0) {
+		ret = nfp_net_set_vxlan_port(hw, idx, 0);
+		if (ret != 0) {
+			PMD_DRV_LOG(ERR, "Failed set vxlan port");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
 /* Initialise and register driver with DPDK Application */
 static const struct eth_dev_ops nfp_net_eth_dev_ops = {
 	.dev_configure		= nfp_net_configure,
@@ -347,6 +456,8 @@ 
 	.tx_queue_release	= nfp_net_tx_queue_release,
 	.rx_queue_intr_enable   = nfp_rx_queue_intr_enable,
 	.rx_queue_intr_disable  = nfp_rx_queue_intr_disable,
+	.udp_tunnel_port_add    = nfp_udp_tunnel_port_add,
+	.udp_tunnel_port_del    = nfp_udp_tunnel_port_del,
 };
 
 static inline int
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 6c6caef..fa0d289 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -18,6 +18,7 @@ 
 #include "nfpcore/nfp_mip.h"
 #include "nfpcore/nfp_rtsym.h"
 
+#include "nfp_ctrl.h"
 #include "nfp_common.h"
 #include "nfp_ctrl.h"
 #include "nfp_rxtx.h"
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index b8c874d..b764845 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -16,6 +16,7 @@ 
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 
+#include "nfp_ctrl.h"
 #include "nfp_common.h"
 #include "nfp_ctrl.h"
 #include "nfp_rxtx.h"