[dpdk-dev,v2,1/3] net/i40e: add QinQ wrapper function
diff mbox

Message ID 1490287113-8895-2-git-send-email-bernard.iremonger@intel.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show

Checks

Context Check Description
ci/Intel-compilation fail apply patch file failure
ci/checkpatch warning coding style issues

Commit Message

Bernard Iremonger March 23, 2017, 4:38 p.m. UTC
Add i40e_dev_cloud_filter_qinq function, and call it
from i40e_dev_consistent_tunnel_filter_set function.
Replace filter 0x1 with QinQ filter.

Signed-off-by: Laura Stroe <laura.stroe@intel.com>
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 121 +++++++++++++++++++++++++++++++++++++++--
 drivers/net/i40e/i40e_ethdev.h |  26 +++++++++
 2 files changed, 143 insertions(+), 4 deletions(-)

Comments

Lu, Wenzhuo March 28, 2017, 8:11 a.m. UTC | #1
Hi Bernard,

> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger

> Sent: Friday, March 24, 2017 12:39 AM

> To: dev@dpdk.org; Xing, Beilei; Wu, Jingjing

> Cc: Zhang, Helin; Iremonger, Bernard; Stroe, Laura

> Subject: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper function

> 

> Add i40e_dev_cloud_filter_qinq function, and call it from

> i40e_dev_consistent_tunnel_filter_set function.

> Replace filter 0x1 with QinQ filter.

Better not use 0x1 here. Maybe it should be change to outer IP filter?
And seems better to add more explanation about what's QinQ filter here.

> +

> +/* Create a QinQ cloud filter

> + *

> + * The Fortville NIC has limited resources for tunnel filters,

> + * so we can only reuse existing filters.

> + *

> + * In step 1 we define which Field Vector fields can be used for

> + * filter types.

> + * As we do not have the inner tag defined as a field,

> + * we have to define it first, by reusing one of L1 entries.

> + *

> + * In step 2 we are replacing one of existing filter types with

> + * a new one for QinQ.

> + * As we reusing L1 and replacing L2, some of the default filter

> + * types will disappear,which depends on L1 and L2 entries we reuse.

> + *

> + * Step 1: Create L1 filter of outer vlan (12b) + inner vlan (12b)

> + *

> + * 1.	Create L1 filter of outer vlan (12b) which will be in use

> + *		later when we define the cloud filter.

> + *	a.	Valid_flags.replace_cloud = 0

> + *	b.	Old_filter = 10 (Stag_Inner_Vlan)

> + *	c.	New_filter = 0x10

> + *	d.	TR bit = 0xff (optional, not used here)

> + *	e.	Buffer – 2 entries:

> + *		i.	Byte0 = 8 (outer vlan FV index). Byte1 =0 (rsv) Byte 2-

> 3 = 0x0fff

> + *		ii.	Byte0 = 37 (inner vlan FV index). Byte1 =0 (rsv) Byte

> 2-3 = 0x0fff

> + *

> + * Step 2:

> + * 2.	Create cloud filter using two L1 filters entries: stag and

> + *		new filter(outer vlan+ inner vlan)

> + *	a.	Valid_flags.replace_cloud = 1

> + *	b.	Old_filter = 1 (instead of outer IP)

> + *	c.	New_filter = 0x10

> + *	d.	Buffer – 2 entries:

> + *		i.	Byte0 = 0x80 | 7 (valid | Stag). Byte13 = 0 (rsv)

> + *		ii.	Byte8 = 0x80 | 0x10 (valid | new l1 filter step1).

> Byte9-11 = 0 (rsv)

> + */

> +static int

> +i40e_dev_cloud_filter_qinq(struct i40e_pf *pf) {

Is it better to change the function name to i40e_dev_create_cloud_filter_qinq?

> diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h

> index 934c679..020c5a2 100644

> --- a/drivers/net/i40e/i40e_ethdev.h

> +++ b/drivers/net/i40e/i40e_ethdev.h

> 

>  /**

> + * filter type of tunneling packet

> + */

> +#define ETH_TUNNEL_FILTER_OMAC  0x01 /**< filter by outer MAC addr */

> +#define ETH_TUNNEL_FILTER_OIP   0x02 /**< filter by outer IP Addr */

> +#define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */

> +#define ETH_TUNNEL_FILTER_IMAC  0x08 /**< filter by inner MAC addr */

> +#define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */

> +#define ETH_TUNNEL_FILTER_IIP   0x20 /**< filter by inner IP addr */

Seems not necessary to redefine these macros.

> +#define ETH_TUNNEL_FILTER_OVLAN 0x40 /**< filter by outer VLAN ID */

> +

> +#define I40E_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \

> +					ETH_TUNNEL_FILTER_IVLAN)

> +#define I40E_TUNNEL_FILTER_IMAC_IVLAN_TENID

> (ETH_TUNNEL_FILTER_IMAC | \

> +					ETH_TUNNEL_FILTER_IVLAN | \

> +					ETH_TUNNEL_FILTER_TENID)

> +#define I40E_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \

> +					ETH_TUNNEL_FILTER_TENID)

> +#define I40E_TUNNEL_FILTER_OMAC_TENID_IMAC

> (ETH_TUNNEL_FILTER_OMAC | \

> +					ETH_TUNNEL_FILTER_TENID | \

> +					ETH_TUNNEL_FILTER_IMAC)

I don't think it's necessary the redefine these macros either. Maybe we only need to add I40E_TUNNEL_FILTER_CUSTOM_QINQ.

> +#define I40E_TUNNEL_FILTER_CUSTOM_QINQ (ETH_TUNNEL_FILTER_OMAC

> | \

> +					ETH_TUNNEL_FILTER_OVLAN |

> ETH_TUNNEL_FILTER_IVLAN)

> +

> +/**

>   * Tunneling Packet filter configuration.

>   */

>  struct i40e_tunnel_filter_conf {

> --

> 2.10.1
Bernard Iremonger March 28, 2017, 11:09 a.m. UTC | #2
Hi Wenzhuo,

> -----Original Message-----

> From: Lu, Wenzhuo

> Sent: Tuesday, March 28, 2017 9:11 AM

> To: Iremonger, Bernard <bernard.iremonger@intel.com>; dev@dpdk.org;

> Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>

> Cc: Zhang, Helin <helin.zhang@intel.com>; Iremonger, Bernard

> <bernard.iremonger@intel.com>; Stroe, Laura <laura.stroe@intel.com>

> Subject: RE: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper function

> 

> Hi Bernard,

> 

> > -----Original Message-----

> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard

> Iremonger

> > Sent: Friday, March 24, 2017 12:39 AM

> > To: dev@dpdk.org; Xing, Beilei; Wu, Jingjing

> > Cc: Zhang, Helin; Iremonger, Bernard; Stroe, Laura

> > Subject: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper function

> >

> > Add i40e_dev_cloud_filter_qinq function, and call it from

> > i40e_dev_consistent_tunnel_filter_set function.

> > Replace filter 0x1 with QinQ filter.

> Better not use 0x1 here. Maybe it should be change to outer IP filter?

Ok, I will change to out IP filter.
> And seems better to add more explanation about what's QinQ filter here.

Ok, I will add some information.
> 

> > +

> > +/* Create a QinQ cloud filter

> > + *

> > + * The Fortville NIC has limited resources for tunnel filters,

> > + * so we can only reuse existing filters.

> > + *

> > + * In step 1 we define which Field Vector fields can be used for

> > + * filter types.

> > + * As we do not have the inner tag defined as a field,

> > + * we have to define it first, by reusing one of L1 entries.

> > + *

> > + * In step 2 we are replacing one of existing filter types with

> > + * a new one for QinQ.

> > + * As we reusing L1 and replacing L2, some of the default filter

> > + * types will disappear,which depends on L1 and L2 entries we reuse.

> > + *

> > + * Step 1: Create L1 filter of outer vlan (12b) + inner vlan (12b)

> > + *

> > + * 1.	Create L1 filter of outer vlan (12b) which will be in use

> > + *		later when we define the cloud filter.

> > + *	a.	Valid_flags.replace_cloud = 0

> > + *	b.	Old_filter = 10 (Stag_Inner_Vlan)

> > + *	c.	New_filter = 0x10

> > + *	d.	TR bit = 0xff (optional, not used here)

> > + *	e.	Buffer – 2 entries:

> > + *		i.	Byte0 = 8 (outer vlan FV index). Byte1 =0 (rsv) Byte 2-

> > 3 = 0x0fff

> > + *		ii.	Byte0 = 37 (inner vlan FV index). Byte1 =0 (rsv) Byte

> > 2-3 = 0x0fff

> > + *

> > + * Step 2:

> > + * 2.	Create cloud filter using two L1 filters entries: stag and

> > + *		new filter(outer vlan+ inner vlan)

> > + *	a.	Valid_flags.replace_cloud = 1

> > + *	b.	Old_filter = 1 (instead of outer IP)

> > + *	c.	New_filter = 0x10

> > + *	d.	Buffer – 2 entries:

> > + *		i.	Byte0 = 0x80 | 7 (valid | Stag). Byte13 = 0 (rsv)

> > + *		ii.	Byte8 = 0x80 | 0x10 (valid | new l1 filter step1).

> > Byte9-11 = 0 (rsv)

> > + */

> > +static int

> > +i40e_dev_cloud_filter_qinq(struct i40e_pf *pf) {

> Is it better to change the function name to

> i40e_dev_create_cloud_filter_qinq?

> 

> > diff --git a/drivers/net/i40e/i40e_ethdev.h

> > b/drivers/net/i40e/i40e_ethdev.h index 934c679..020c5a2 100644

> > --- a/drivers/net/i40e/i40e_ethdev.h

> > +++ b/drivers/net/i40e/i40e_ethdev.h

> >

> >  /**

> > + * filter type of tunneling packet

> > + */

> > +#define ETH_TUNNEL_FILTER_OMAC  0x01 /**< filter by outer MAC addr

> */

> > +#define ETH_TUNNEL_FILTER_OIP   0x02 /**< filter by outer IP Addr */

> > +#define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */

> > +#define ETH_TUNNEL_FILTER_IMAC  0x08 /**< filter by inner MAC addr

> */

> > +#define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */

> > +#define ETH_TUNNEL_FILTER_IIP   0x20 /**< filter by inner IP addr */

> Seems not necessary to redefine these macros.

> 

> > +#define ETH_TUNNEL_FILTER_OVLAN 0x40 /**< filter by outer VLAN ID

> */

> > +

> > +#define I40E_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC

> | \

> > +					ETH_TUNNEL_FILTER_IVLAN)

> > +#define I40E_TUNNEL_FILTER_IMAC_IVLAN_TENID

> > (ETH_TUNNEL_FILTER_IMAC | \

> > +					ETH_TUNNEL_FILTER_IVLAN | \

> > +					ETH_TUNNEL_FILTER_TENID)

> > +#define I40E_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC

> | \

> > +					ETH_TUNNEL_FILTER_TENID)

> > +#define I40E_TUNNEL_FILTER_OMAC_TENID_IMAC

> > (ETH_TUNNEL_FILTER_OMAC | \

> > +					ETH_TUNNEL_FILTER_TENID | \

> > +					ETH_TUNNEL_FILTER_IMAC)

> I don't think it's necessary the redefine these macros either. Maybe we only

> need to add I40E_TUNNEL_FILTER_CUSTOM_QINQ.


I will check this.

> 

> > +#define I40E_TUNNEL_FILTER_CUSTOM_QINQ

> (ETH_TUNNEL_FILTER_OMAC

> > | \

> > +					ETH_TUNNEL_FILTER_OVLAN |

> > ETH_TUNNEL_FILTER_IVLAN)

> > +

> > +/**

> >   * Tunneling Packet filter configuration.

> >   */

> >  struct i40e_tunnel_filter_conf {

> > --

> > 2.10.1


Thanks for the review.

Regards,

Bernard.
Bernard Iremonger March 28, 2017, 1:23 p.m. UTC | #3
Hi Wenzhuo,

<snip>

-----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard

> > Iremonger

> > > Sent: Friday, March 24, 2017 12:39 AM

> > > To: dev@dpdk.org; Xing, Beilei; Wu, Jingjing

> > > Cc: Zhang, Helin; Iremonger, Bernard; Stroe, Laura

> > > Subject: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper

> > > function

> > >

> > > Add i40e_dev_cloud_filter_qinq function, and call it from

> > > i40e_dev_consistent_tunnel_filter_set function.

> > > Replace filter 0x1 with QinQ filter.

> > Better not use 0x1 here. Maybe it should be change to outer IP filter?

> Ok, I will change to out IP filter.

> > And seems better to add more explanation about what's QinQ filter here.

> Ok, I will add some information.

> >

> > > +

> > > +/* Create a QinQ cloud filter

> > > + *

> > > + * The Fortville NIC has limited resources for tunnel filters,

> > > + * so we can only reuse existing filters.

> > > + *

> > > + * In step 1 we define which Field Vector fields can be used for

> > > + * filter types.

> > > + * As we do not have the inner tag defined as a field,

> > > + * we have to define it first, by reusing one of L1 entries.

> > > + *

> > > + * In step 2 we are replacing one of existing filter types with

> > > + * a new one for QinQ.

> > > + * As we reusing L1 and replacing L2, some of the default filter

> > > + * types will disappear,which depends on L1 and L2 entries we reuse.

> > > + *

> > > + * Step 1: Create L1 filter of outer vlan (12b) + inner vlan (12b)

> > > + *

> > > + * 1.	Create L1 filter of outer vlan (12b) which will be in use

> > > + *		later when we define the cloud filter.

> > > + *	a.	Valid_flags.replace_cloud = 0

> > > + *	b.	Old_filter = 10 (Stag_Inner_Vlan)

> > > + *	c.	New_filter = 0x10

> > > + *	d.	TR bit = 0xff (optional, not used here)

> > > + *	e.	Buffer – 2 entries:

> > > + *		i.	Byte0 = 8 (outer vlan FV index). Byte1 =0 (rsv) Byte 2-

> > > 3 = 0x0fff

> > > + *		ii.	Byte0 = 37 (inner vlan FV index). Byte1 =0 (rsv) Byte

> > > 2-3 = 0x0fff

> > > + *

> > > + * Step 2:

> > > + * 2.	Create cloud filter using two L1 filters entries: stag and

> > > + *		new filter(outer vlan+ inner vlan)

> > > + *	a.	Valid_flags.replace_cloud = 1

> > > + *	b.	Old_filter = 1 (instead of outer IP)

> > > + *	c.	New_filter = 0x10

> > > + *	d.	Buffer – 2 entries:

> > > + *		i.	Byte0 = 0x80 | 7 (valid | Stag). Byte13 = 0 (rsv)

> > > + *		ii.	Byte8 = 0x80 | 0x10 (valid | new l1 filter step1).

> > > Byte9-11 = 0 (rsv)

> > > + */

> > > +static int

> > > +i40e_dev_cloud_filter_qinq(struct i40e_pf *pf) {

> > Is it better to change the function name to

> > i40e_dev_create_cloud_filter_qinq?


Ok, how about i40e_cloud_filter_qinq_create()?
It is more in line with the existing code.

> >

> > > diff --git a/drivers/net/i40e/i40e_ethdev.h

> > > b/drivers/net/i40e/i40e_ethdev.h index 934c679..020c5a2 100644

> > > --- a/drivers/net/i40e/i40e_ethdev.h

> > > +++ b/drivers/net/i40e/i40e_ethdev.h

> > >

> > >  /**

> > > + * filter type of tunneling packet

> > > + */

> > > +#define ETH_TUNNEL_FILTER_OMAC  0x01 /**< filter by outer MAC

> addr

> > */

> > > +#define ETH_TUNNEL_FILTER_OIP   0x02 /**< filter by outer IP Addr */

> > > +#define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */

> > > +#define ETH_TUNNEL_FILTER_IMAC  0x08 /**< filter by inner MAC addr

> > */

> > > +#define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID

> */

> > > +#define ETH_TUNNEL_FILTER_IIP   0x20 /**< filter by inner IP addr */

> > Seems not necessary to redefine these macros.

> >

> > > +#define ETH_TUNNEL_FILTER_OVLAN 0x40 /**< filter by outer VLAN ID

> > */

> > > +

> > > +#define I40E_TUNNEL_FILTER_IMAC_IVLAN

> (ETH_TUNNEL_FILTER_IMAC

> > | \

> > > +					ETH_TUNNEL_FILTER_IVLAN)

> > > +#define I40E_TUNNEL_FILTER_IMAC_IVLAN_TENID

> > > (ETH_TUNNEL_FILTER_IMAC | \

> > > +					ETH_TUNNEL_FILTER_IVLAN | \

> > > +					ETH_TUNNEL_FILTER_TENID)

> > > +#define I40E_TUNNEL_FILTER_IMAC_TENID

> (ETH_TUNNEL_FILTER_IMAC

> > | \

> > > +					ETH_TUNNEL_FILTER_TENID)

> > > +#define I40E_TUNNEL_FILTER_OMAC_TENID_IMAC

> > > (ETH_TUNNEL_FILTER_OMAC | \

> > > +					ETH_TUNNEL_FILTER_TENID | \

> > > +					ETH_TUNNEL_FILTER_IMAC)

> > I don't think it's necessary the redefine these macros either. Maybe

> > we only need to add I40E_TUNNEL_FILTER_CUSTOM_QINQ.

> 

> I will check this.


These are now used in the i40e_ethdev code replacing RTE_* macros.
 
> >

> > > +#define I40E_TUNNEL_FILTER_CUSTOM_QINQ

> > (ETH_TUNNEL_FILTER_OMAC

> > > | \

> > > +					ETH_TUNNEL_FILTER_OVLAN |

> > > ETH_TUNNEL_FILTER_IVLAN)

> > > +

> > > +/**

> > >   * Tunneling Packet filter configuration.

> > >   */

> > >  struct i40e_tunnel_filter_conf {

> > > --

> > > 2.10.1

> 

> Thanks for the review.

> 

> Regards,

> 

> Bernard.
Lu, Wenzhuo March 29, 2017, 12:52 a.m. UTC | #4
Hi Bernard,

> -----Original Message-----

> From: Iremonger, Bernard

> Sent: Tuesday, March 28, 2017 9:23 PM

> To: Iremonger, Bernard; Lu, Wenzhuo; dev@dpdk.org; Xing, Beilei; Wu,

> Jingjing

> Cc: Zhang, Helin; Stroe, Laura

> Subject: RE: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper function

> 

> Hi Wenzhuo,

> 

> <snip>

> 

> -----Original Message-----

> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard

> > > Iremonger

> > > > Sent: Friday, March 24, 2017 12:39 AM

> > > > To: dev@dpdk.org; Xing, Beilei; Wu, Jingjing

> > > > Cc: Zhang, Helin; Iremonger, Bernard; Stroe, Laura

> > > > Subject: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper

> > > > function

> > > >

> > > > Add i40e_dev_cloud_filter_qinq function, and call it from

> > > > i40e_dev_consistent_tunnel_filter_set function.

> > > > Replace filter 0x1 with QinQ filter.

> > > Better not use 0x1 here. Maybe it should be change to outer IP filter?

> > Ok, I will change to out IP filter.

> > > And seems better to add more explanation about what's QinQ filter here.

> > Ok, I will add some information.

> > >

> > > > +

> > > > +/* Create a QinQ cloud filter

> > > > + *

> > > > + * The Fortville NIC has limited resources for tunnel filters,

> > > > + * so we can only reuse existing filters.

> > > > + *

> > > > + * In step 1 we define which Field Vector fields can be used for

> > > > + * filter types.

> > > > + * As we do not have the inner tag defined as a field,

> > > > + * we have to define it first, by reusing one of L1 entries.

> > > > + *

> > > > + * In step 2 we are replacing one of existing filter types with

> > > > + * a new one for QinQ.

> > > > + * As we reusing L1 and replacing L2, some of the default filter

> > > > + * types will disappear,which depends on L1 and L2 entries we reuse.

> > > > + *

> > > > + * Step 1: Create L1 filter of outer vlan (12b) + inner vlan

> > > > +(12b)

> > > > + *

> > > > + * 1.	Create L1 filter of outer vlan (12b) which will be in use

> > > > + *		later when we define the cloud filter.

> > > > + *	a.	Valid_flags.replace_cloud = 0

> > > > + *	b.	Old_filter = 10 (Stag_Inner_Vlan)

> > > > + *	c.	New_filter = 0x10

> > > > + *	d.	TR bit = 0xff (optional, not used here)

> > > > + *	e.	Buffer – 2 entries:

> > > > + *		i.	Byte0 = 8 (outer vlan FV index). Byte1 =0 (rsv)

> Byte 2-

> > > > 3 = 0x0fff

> > > > + *		ii.	Byte0 = 37 (inner vlan FV index). Byte1 =0 (rsv)

> Byte

> > > > 2-3 = 0x0fff

> > > > + *

> > > > + * Step 2:

> > > > + * 2.	Create cloud filter using two L1 filters entries: stag and

> > > > + *		new filter(outer vlan+ inner vlan)

> > > > + *	a.	Valid_flags.replace_cloud = 1

> > > > + *	b.	Old_filter = 1 (instead of outer IP)

> > > > + *	c.	New_filter = 0x10

> > > > + *	d.	Buffer – 2 entries:

> > > > + *		i.	Byte0 = 0x80 | 7 (valid | Stag). Byte13 = 0 (rsv)

> > > > + *		ii.	Byte8 = 0x80 | 0x10 (valid | new l1 filter

> step1).

> > > > Byte9-11 = 0 (rsv)

> > > > + */

> > > > +static int

> > > > +i40e_dev_cloud_filter_qinq(struct i40e_pf *pf) {

> > > Is it better to change the function name to

> > > i40e_dev_create_cloud_filter_qinq?

> 

> Ok, how about i40e_cloud_filter_qinq_create()?

> It is more in line with the existing code.

It's fine to me:)

> 

> > >

> > > > diff --git a/drivers/net/i40e/i40e_ethdev.h

> > > > b/drivers/net/i40e/i40e_ethdev.h index 934c679..020c5a2 100644

> > > > --- a/drivers/net/i40e/i40e_ethdev.h

> > > > +++ b/drivers/net/i40e/i40e_ethdev.h

> > > >

> > > >  /**

> > > > + * filter type of tunneling packet  */ #define

> > > > +ETH_TUNNEL_FILTER_OMAC  0x01 /**< filter by outer MAC

> > addr

> > > */

> > > > +#define ETH_TUNNEL_FILTER_OIP   0x02 /**< filter by outer IP Addr */

> > > > +#define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */

> > > > +#define ETH_TUNNEL_FILTER_IMAC  0x08 /**< filter by inner MAC

> > > > +addr

> > > */

> > > > +#define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID

> > */

> > > > +#define ETH_TUNNEL_FILTER_IIP   0x20 /**< filter by inner IP addr */

> > > Seems not necessary to redefine these macros.

> > >

> > > > +#define ETH_TUNNEL_FILTER_OVLAN 0x40 /**< filter by outer VLAN ID

> > > */

> > > > +

> > > > +#define I40E_TUNNEL_FILTER_IMAC_IVLAN

> > (ETH_TUNNEL_FILTER_IMAC

> > > | \

> > > > +					ETH_TUNNEL_FILTER_IVLAN)

> > > > +#define I40E_TUNNEL_FILTER_IMAC_IVLAN_TENID

> > > > (ETH_TUNNEL_FILTER_IMAC | \

> > > > +					ETH_TUNNEL_FILTER_IVLAN | \

> > > > +					ETH_TUNNEL_FILTER_TENID)

> > > > +#define I40E_TUNNEL_FILTER_IMAC_TENID

> > (ETH_TUNNEL_FILTER_IMAC

> > > | \

> > > > +					ETH_TUNNEL_FILTER_TENID)

> > > > +#define I40E_TUNNEL_FILTER_OMAC_TENID_IMAC

> > > > (ETH_TUNNEL_FILTER_OMAC | \

> > > > +					ETH_TUNNEL_FILTER_TENID | \

> > > > +					ETH_TUNNEL_FILTER_IMAC)

> > > I don't think it's necessary the redefine these macros either. Maybe

> > > we only need to add I40E_TUNNEL_FILTER_CUSTOM_QINQ.

> >

> > I will check this.

> 

> These are now used in the i40e_ethdev code replacing RTE_* macros.

I think these macros are not NIC specific. Better define them in RTE. But if it's not the good time to add them to RTE, maybe the concern of ABI change. We need only define ETH_TUNNEL_FILTER_OVLAN and I40E_TUNNEL_FILTER_OMAC_TENID_IMAC here.

> 

> > >

> > > > +#define I40E_TUNNEL_FILTER_CUSTOM_QINQ

> > > (ETH_TUNNEL_FILTER_OMAC

> > > > | \

> > > > +					ETH_TUNNEL_FILTER_OVLAN |

> > > > ETH_TUNNEL_FILTER_IVLAN)

> > > > +

> > > > +/**

> > > >   * Tunneling Packet filter configuration.

> > > >   */

> > > >  struct i40e_tunnel_filter_conf {

> > > > --

> > > > 2.10.1

> >

> > Thanks for the review.

> >

> > Regards,

> >

> > Bernard.
Bernard Iremonger March 29, 2017, 9:11 a.m. UTC | #5
Hi Wenzhuo,

> -----Original Message-----

> From: Lu, Wenzhuo

> Sent: Wednesday, March 29, 2017 1:53 AM

> To: Iremonger, Bernard <bernard.iremonger@intel.com>; dev@dpdk.org;

> Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>

> Cc: Zhang, Helin <helin.zhang@intel.com>; Stroe, Laura

> <laura.stroe@intel.com>

> Subject: RE: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper function

> 

> Hi Bernard,

> 

> > -----Original Message-----

> > From: Iremonger, Bernard

> > Sent: Tuesday, March 28, 2017 9:23 PM

> > To: Iremonger, Bernard; Lu, Wenzhuo; dev@dpdk.org; Xing, Beilei; Wu,

> > Jingjing

> > Cc: Zhang, Helin; Stroe, Laura

> > Subject: RE: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper

> > function

> >

> > Hi Wenzhuo,

> >

> > <snip>

> >

> > -----Original Message-----

> > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard

> > > > Iremonger

> > > > > Sent: Friday, March 24, 2017 12:39 AM

> > > > > To: dev@dpdk.org; Xing, Beilei; Wu, Jingjing

> > > > > Cc: Zhang, Helin; Iremonger, Bernard; Stroe, Laura

> > > > > Subject: [dpdk-dev] [PATCH v2 1/3] net/i40e: add QinQ wrapper

> > > > > function

> > > > >

> > > > > Add i40e_dev_cloud_filter_qinq function, and call it from

> > > > > i40e_dev_consistent_tunnel_filter_set function.

> > > > > Replace filter 0x1 with QinQ filter.

> > > > Better not use 0x1 here. Maybe it should be change to outer IP filter?

> > > Ok, I will change to out IP filter.

> > > > And seems better to add more explanation about what's QinQ filter

> here.

> > > Ok, I will add some information.

> > > >

> > > > > +

> > > > > +/* Create a QinQ cloud filter

> > > > > + *

> > > > > + * The Fortville NIC has limited resources for tunnel filters,

> > > > > + * so we can only reuse existing filters.

> > > > > + *

> > > > > + * In step 1 we define which Field Vector fields can be used

> > > > > +for

> > > > > + * filter types.

> > > > > + * As we do not have the inner tag defined as a field,

> > > > > + * we have to define it first, by reusing one of L1 entries.

> > > > > + *

> > > > > + * In step 2 we are replacing one of existing filter types with

> > > > > + * a new one for QinQ.

> > > > > + * As we reusing L1 and replacing L2, some of the default

> > > > > +filter

> > > > > + * types will disappear,which depends on L1 and L2 entries we reuse.

> > > > > + *

> > > > > + * Step 1: Create L1 filter of outer vlan (12b) + inner vlan

> > > > > +(12b)

> > > > > + *

> > > > > + * 1.	Create L1 filter of outer vlan (12b) which will be in use

> > > > > + *		later when we define the cloud filter.

> > > > > + *	a.	Valid_flags.replace_cloud = 0

> > > > > + *	b.	Old_filter = 10 (Stag_Inner_Vlan)

> > > > > + *	c.	New_filter = 0x10

> > > > > + *	d.	TR bit = 0xff (optional, not used here)

> > > > > + *	e.	Buffer – 2 entries:

> > > > > + *		i.	Byte0 = 8 (outer vlan FV index). Byte1 =0 (rsv)

> > Byte 2-

> > > > > 3 = 0x0fff

> > > > > + *		ii.	Byte0 = 37 (inner vlan FV index). Byte1 =0

> (rsv)

> > Byte

> > > > > 2-3 = 0x0fff

> > > > > + *

> > > > > + * Step 2:

> > > > > + * 2.	Create cloud filter using two L1 filters entries: stag and

> > > > > + *		new filter(outer vlan+ inner vlan)

> > > > > + *	a.	Valid_flags.replace_cloud = 1

> > > > > + *	b.	Old_filter = 1 (instead of outer IP)

> > > > > + *	c.	New_filter = 0x10

> > > > > + *	d.	Buffer – 2 entries:

> > > > > + *		i.	Byte0 = 0x80 | 7 (valid | Stag). Byte13 = 0 (rsv)

> > > > > + *		ii.	Byte8 = 0x80 | 0x10 (valid | new l1 filter

> > step1).

> > > > > Byte9-11 = 0 (rsv)

> > > > > + */

> > > > > +static int

> > > > > +i40e_dev_cloud_filter_qinq(struct i40e_pf *pf) {

> > > > Is it better to change the function name to

> > > > i40e_dev_create_cloud_filter_qinq?

> >

> > Ok, how about i40e_cloud_filter_qinq_create()?

> > It is more in line with the existing code.

> It's fine to me:)

> 

> >

> > > >

> > > > > diff --git a/drivers/net/i40e/i40e_ethdev.h

> > > > > b/drivers/net/i40e/i40e_ethdev.h index 934c679..020c5a2 100644

> > > > > --- a/drivers/net/i40e/i40e_ethdev.h

> > > > > +++ b/drivers/net/i40e/i40e_ethdev.h

> > > > >

> > > > >  /**

> > > > > + * filter type of tunneling packet  */ #define

> > > > > +ETH_TUNNEL_FILTER_OMAC  0x01 /**< filter by outer MAC

> > > addr

> > > > */

> > > > > +#define ETH_TUNNEL_FILTER_OIP   0x02 /**< filter by outer IP Addr

> */

> > > > > +#define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID

> > > > > +*/ #define ETH_TUNNEL_FILTER_IMAC  0x08 /**< filter by inner

> > > > > +MAC addr

> > > > */

> > > > > +#define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN

> > > > > +ID

> > > */

> > > > > +#define ETH_TUNNEL_FILTER_IIP   0x20 /**< filter by inner IP addr

> */

> > > > Seems not necessary to redefine these macros.

> > > >

> > > > > +#define ETH_TUNNEL_FILTER_OVLAN 0x40 /**< filter by outer

> VLAN

> > > > > +ID

> > > > */

> > > > > +

> > > > > +#define I40E_TUNNEL_FILTER_IMAC_IVLAN

> > > (ETH_TUNNEL_FILTER_IMAC

> > > > | \

> > > > > +					ETH_TUNNEL_FILTER_IVLAN)

> > > > > +#define I40E_TUNNEL_FILTER_IMAC_IVLAN_TENID

> > > > > (ETH_TUNNEL_FILTER_IMAC | \

> > > > > +					ETH_TUNNEL_FILTER_IVLAN

> | \

> > > > > +					ETH_TUNNEL_FILTER_TENID)

> > > > > +#define I40E_TUNNEL_FILTER_IMAC_TENID

> > > (ETH_TUNNEL_FILTER_IMAC

> > > > | \

> > > > > +					ETH_TUNNEL_FILTER_TENID)

> > > > > +#define I40E_TUNNEL_FILTER_OMAC_TENID_IMAC

> > > > > (ETH_TUNNEL_FILTER_OMAC | \

> > > > > +					ETH_TUNNEL_FILTER_TENID

> | \

> > > > > +					ETH_TUNNEL_FILTER_IMAC)

> > > > I don't think it's necessary the redefine these macros either.

> > > > Maybe we only need to add I40E_TUNNEL_FILTER_CUSTOM_QINQ.

> > >

> > > I will check this.

> >

> > These are now used in the i40e_ethdev code replacing RTE_* macros.

> I think these macros are not NIC specific. Better define them in RTE. But if it's

> not the good time to add them to RTE, maybe the concern of ABI change. We

> need only define ETH_TUNNEL_FILTER_OVLAN and

> I40E_TUNNEL_FILTER_OMAC_TENID_IMAC here.


If I just define the above filters, then the following switch statement has mixed RTE and I40E macros, it seems cleaner to me to use all  I40E macros. I can change back to mixed macros if you think it is better.

static int
i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag)
{
	switch (filter_type) {
	case I40E_TUNNEL_FILTER_IMAC_IVLAN:
		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN;
		break;
	case I40E_TUNNEL_FILTER_IMAC_IVLAN_TENID:
		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID;
		break;
	case I40E_TUNNEL_FILTER_CUSTOM_QINQ:
		*flag = I40E_AQC_ADD_CLOUD_FILTER_CUSTOM_QINQ;
		break;
	case I40E_TUNNEL_FILTER_IMAC_TENID:
		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID;
		break;
	case I40E_TUNNEL_FILTER_OMAC_TENID_IMAC:
		*flag = I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC;
		break;
	case ETH_TUNNEL_FILTER_IMAC:
		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC;
		break;
	case ETH_TUNNEL_FILTER_OIP:
		*flag = I40E_AQC_ADD_CLOUD_FILTER_OIP;
		break;
	case ETH_TUNNEL_FILTER_IIP:
		*flag = I40E_AQC_ADD_CLOUD_FILTER_IIP;
		break;
	default:
		PMD_DRV_LOG(ERR, "invalid tunnel filter type");
		return -EINVAL;
	}

	return 0;
> 

> >

> > > >

> > > > > +#define I40E_TUNNEL_FILTER_CUSTOM_QINQ

> > > > (ETH_TUNNEL_FILTER_OMAC

> > > > > | \

> > > > > +					ETH_TUNNEL_FILTER_OVLAN

> |

> > > > > ETH_TUNNEL_FILTER_IVLAN)

> > > > > +

> > > > > +/**

> > > > >   * Tunneling Packet filter configuration.

> > > > >   */

> > > > >  struct i40e_tunnel_filter_conf {

> > > > > --

> > > > > 2.10.1

> > >

> > > Thanks for the review.

> > >

> > > Regards,

> > >

> > > Bernard.


Regards,

Bernard.

Patch
diff mbox

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1eb1625..e5ddad4 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -414,6 +414,7 @@  static int i40e_tunnel_filter_convert(
 	struct i40e_tunnel_filter *tunnel_filter);
 static int i40e_sw_tunnel_filter_insert(struct i40e_pf *pf,
 				struct i40e_tunnel_filter *tunnel_filter);
+static int i40e_dev_cloud_filter_qinq(struct i40e_pf *pf);
 
 static void i40e_ethertype_filter_restore(struct i40e_pf *pf);
 static void i40e_tunnel_filter_restore(struct i40e_pf *pf);
@@ -6686,16 +6687,19 @@  static int
 i40e_dev_get_filter_type(uint16_t filter_type, uint16_t *flag)
 {
 	switch (filter_type) {
-	case RTE_TUNNEL_FILTER_IMAC_IVLAN:
+	case I40E_TUNNEL_FILTER_IMAC_IVLAN:
 		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN;
 		break;
-	case RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID:
+	case I40E_TUNNEL_FILTER_IMAC_IVLAN_TENID:
 		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID;
 		break;
-	case RTE_TUNNEL_FILTER_IMAC_TENID:
+	case I40E_TUNNEL_FILTER_CUSTOM_QINQ:
+		*flag = I40E_AQC_ADD_CLOUD_FILTER_CUSTOM_QINQ;
+		break;
+	case I40E_TUNNEL_FILTER_IMAC_TENID:
 		*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID;
 		break;
-	case RTE_TUNNEL_FILTER_OMAC_TENID_IMAC:
+	case I40E_TUNNEL_FILTER_OMAC_TENID_IMAC:
 		*flag = I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC;
 		break;
 	case ETH_TUNNEL_FILTER_IMAC:
@@ -7029,6 +7033,25 @@  i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 		big_buffer = 1;
 		tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoGRE;
 		break;
+	case I40E_TUNNEL_TYPE_QINQ:
+		if (tunnel_filter->filter_type == I40E_TUNNEL_FILTER_CUSTOM_QINQ) {
+			PMD_DRV_LOG(INFO, "Replace a tunnel filter.");
+			ret = i40e_dev_cloud_filter_qinq(pf);
+			if (ret < 0) {
+				PMD_DRV_LOG(ERR, "Failed to replace a tunnel filter.");
+				return ret;
+			}
+			/*	Add in the General fields the values of
+			 *	the Outer and Inner VLAN
+			 *	Big Buffer should be set, see changes in
+			 *	i40e_aq_add_cloud_filters
+			 */
+			pfilter->general_fields[0] = tunnel_filter->inner_vlan;
+			pfilter->general_fields[1] = tunnel_filter->outer_vlan;
+			big_buffer = 1;
+		}
+		break;
+
 	default:
 		/* Other tunnel types is not supported. */
 		PMD_DRV_LOG(ERR, "tunnel type is not supported.");
@@ -7042,6 +7065,9 @@  i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 	else if (tunnel_filter->tunnel_type == I40E_TUNNEL_TYPE_MPLSoGRE)
 		pfilter->element.flags =
 			I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoGRE;
+	else if (tunnel_filter->tunnel_type == I40E_TUNNEL_TYPE_QINQ)
+		pfilter->element.flags |=
+			I40E_AQC_ADD_CLOUD_FILTER_CUSTOM_QINQ;
 	else {
 		val = i40e_dev_get_filter_type(tunnel_filter->filter_type,
 						&pfilter->element.flags);
@@ -11702,3 +11728,90 @@  rte_pmd_i40e_get_ppp_list(uint8_t port, uint8_t *buff, uint32_t size)
 
 	return status;
 }
+
+/* Create a QinQ cloud filter
+ *
+ * The Fortville NIC has limited resources for tunnel filters,
+ * so we can only reuse existing filters.
+ *
+ * In step 1 we define which Field Vector fields can be used for
+ * filter types.
+ * As we do not have the inner tag defined as a field,
+ * we have to define it first, by reusing one of L1 entries.
+ *
+ * In step 2 we are replacing one of existing filter types with
+ * a new one for QinQ.
+ * As we reusing L1 and replacing L2, some of the default filter
+ * types will disappear,which depends on L1 and L2 entries we reuse.
+ *
+ * Step 1: Create L1 filter of outer vlan (12b) + inner vlan (12b)
+ *
+ * 1.	Create L1 filter of outer vlan (12b) which will be in use
+ *		later when we define the cloud filter.
+ *	a.	Valid_flags.replace_cloud = 0
+ *	b.	Old_filter = 10 (Stag_Inner_Vlan)
+ *	c.	New_filter = 0x10
+ *	d.	TR bit = 0xff (optional, not used here)
+ *	e.	Buffer – 2 entries:
+ *		i.	Byte0 = 8 (outer vlan FV index). Byte1 =0 (rsv) Byte 2-3 = 0x0fff
+ *		ii.	Byte0 = 37 (inner vlan FV index). Byte1 =0 (rsv) Byte 2-3 = 0x0fff
+ *
+ * Step 2:
+ * 2.	Create cloud filter using two L1 filters entries: stag and
+ *		new filter(outer vlan+ inner vlan)
+ *	a.	Valid_flags.replace_cloud = 1
+ *	b.	Old_filter = 1 (instead of outer IP)
+ *	c.	New_filter = 0x10
+ *	d.	Buffer – 2 entries:
+ *		i.	Byte0 = 0x80 | 7 (valid | Stag). Byte13 = 0 (rsv)
+ *		ii.	Byte8 = 0x80 | 0x10 (valid | new l1 filter step1). Byte9-11 = 0 (rsv)
+ */
+static int
+i40e_dev_cloud_filter_qinq(struct i40e_pf *pf)
+{
+	int ret = -ENOTSUP;
+	struct i40e_aqc_replace_cloud_filters_cmd  filter_replace;
+	struct i40e_aqc_replace_cloud_filters_cmd_buf  filter_replace_buf;
+	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+
+	/* Init */
+	memset(&filter_replace, 0, sizeof(struct i40e_aqc_replace_cloud_filters_cmd));
+	memset(&filter_replace_buf, 0, sizeof(struct i40e_aqc_replace_cloud_filters_cmd_buf));
+
+	/* create L1 filter */
+	filter_replace.old_filter_type = I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_IVLAN;
+	filter_replace.new_filter_type = I40E_AQC_ADD_CLOUD_FILTER_CUSTOM_QINQ;
+	filter_replace.tr_bit = 0xff;  /* tr_bit is not used */
+
+	/* Prepare the buffer, 2 entries */
+	filter_replace_buf.data[0] = I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_VLAN;
+	filter_replace_buf.data[0] |= I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED;
+	/* Field Vector 12b mask */
+	filter_replace_buf.data[2] = 0xff;
+	filter_replace_buf.data[3] = 0x0f;
+	filter_replace_buf.data[4] = I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_INNER_VLAN;
+	filter_replace_buf.data[4] |= I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED;
+	/* Field Vector 12b mask */
+	filter_replace_buf.data[6] = 0xff;
+	filter_replace_buf.data[7] = 0x0f;
+	ret = i40e_aq_replace_cloud_filters(hw, &filter_replace, &filter_replace_buf);
+	if (ret != I40E_SUCCESS)
+		return ret;
+
+	/* Apply the second L2 cloud filter */
+	memset(&filter_replace, 0, sizeof(struct i40e_aqc_replace_cloud_filters_cmd));
+	memset(&filter_replace_buf, 0, sizeof(struct i40e_aqc_replace_cloud_filters_cmd_buf));
+
+	/* create L2 filter, input for L2 filter will be L1 filter  */
+	filter_replace.valid_flags = I40E_AQC_REPLACE_CLOUD_FILTER;
+	filter_replace.old_filter_type = I40E_AQC_ADD_CLOUD_FILTER_OIP;
+	filter_replace.new_filter_type = I40E_AQC_ADD_CLOUD_FILTER_CUSTOM_QINQ;
+
+	/* Prepare the buffer, 2 entries */
+	filter_replace_buf.data[0] = I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG;
+	filter_replace_buf.data[0] |= I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED;
+	filter_replace_buf.data[4] = I40E_AQC_ADD_CLOUD_FILTER_CUSTOM_QINQ;
+	filter_replace_buf.data[4] |= I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED;
+	ret = i40e_aq_replace_cloud_filters(hw, &filter_replace, &filter_replace_buf);
+	return ret;
+}
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 934c679..020c5a2 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -504,6 +504,7 @@  struct i40e_ethertype_rule {
 #define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_TEID_WORD1 45
 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoUDP 8
 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoGRE 9
+#define I40E_AQC_ADD_CLOUD_FILTER_CUSTOM_QINQ 0x10
 #define I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoUDP 0x11
 #define I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoGRE 0x12
 #define I40E_AQC_ADD_L1_FILTER_TEID_MPLS 0x11
@@ -552,10 +553,35 @@  enum i40e_tunnel_type {
 	I40E_L2_TUNNEL_TYPE_E_TAG,
 	I40E_TUNNEL_TYPE_MPLSoUDP,
 	I40E_TUNNEL_TYPE_MPLSoGRE,
+	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_MAX,
 };
 
 /**
+ * filter type of tunneling packet
+ */
+#define ETH_TUNNEL_FILTER_OMAC  0x01 /**< filter by outer MAC addr */
+#define ETH_TUNNEL_FILTER_OIP   0x02 /**< filter by outer IP Addr */
+#define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
+#define ETH_TUNNEL_FILTER_IMAC  0x08 /**< filter by inner MAC addr */
+#define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
+#define ETH_TUNNEL_FILTER_IIP   0x20 /**< filter by inner IP addr */
+#define ETH_TUNNEL_FILTER_OVLAN 0x40 /**< filter by outer VLAN ID */
+
+#define I40E_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \
+					ETH_TUNNEL_FILTER_IVLAN)
+#define I40E_TUNNEL_FILTER_IMAC_IVLAN_TENID (ETH_TUNNEL_FILTER_IMAC | \
+					ETH_TUNNEL_FILTER_IVLAN | \
+					ETH_TUNNEL_FILTER_TENID)
+#define I40E_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \
+					ETH_TUNNEL_FILTER_TENID)
+#define I40E_TUNNEL_FILTER_OMAC_TENID_IMAC (ETH_TUNNEL_FILTER_OMAC | \
+					ETH_TUNNEL_FILTER_TENID | \
+					ETH_TUNNEL_FILTER_IMAC)
+#define I40E_TUNNEL_FILTER_CUSTOM_QINQ (ETH_TUNNEL_FILTER_OMAC | \
+					ETH_TUNNEL_FILTER_OVLAN | ETH_TUNNEL_FILTER_IVLAN)
+
+/**
  * Tunneling Packet filter configuration.
  */
 struct i40e_tunnel_filter_conf {