[dpdk-dev,v2,1/2] ethdev: add GENEVE flow pattern item

Message ID 1512124996-13388-2-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko Dec. 1, 2017, 10:43 a.m. UTC
  From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>

Add new pattern item RTE_FLOW_ITEM_TYPE_GENEVE in flow API.
Add default mask for the item.

Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
 lib/librte_ether/rte_flow.c        |  1 +
 lib/librte_ether/rte_flow.h        | 30 ++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+)
  

Comments

Adrien Mazarguil Dec. 4, 2017, 2:03 p.m. UTC | #1
On Fri, Dec 01, 2017 at 10:43:15AM +0000, Andrew Rybchenko wrote:
> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> 
> Add new pattern item RTE_FLOW_ITEM_TYPE_GENEVE in flow API.
> Add default mask for the item.
> 
> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

Just one remaining nit, please see below. While you could address it through
a subsequent patch, you might as well send v3 directly to make things easier
for Ferruh.

Otherwise it's all good, thanks.

> ---
>  doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
>  lib/librte_ether/rte_flow.c        |  1 +
>  lib/librte_ether/rte_flow.h        | 30 ++++++++++++++++++++++++++++++
>  3 files changed, 43 insertions(+)
> 
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index d158be5..5b8f9c5 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -980,6 +980,18 @@ Matches an ESP header.
>  - ``hdr``: ESP header definition (``rte_esp.h``).
>  - Default ``mask`` matches SPI only.
>  
> +Item: ``GENEVE``
> +^^^^^^^^^^^^^^^

Missing "^" under title, this may trigger a warning during documentation
generation.
  
Ferruh Yigit Dec. 7, 2017, 11:52 p.m. UTC | #2
On 12/4/2017 6:03 AM, Adrien Mazarguil wrote:
> On Fri, Dec 01, 2017 at 10:43:15AM +0000, Andrew Rybchenko wrote:
>> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>>
>> Add new pattern item RTE_FLOW_ITEM_TYPE_GENEVE in flow API.
>> Add default mask for the item.
>>
>> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> 
> Just one remaining nit, please see below. While you could address it through
> a subsequent patch, you might as well send v3 directly to make things easier
> for Ferruh.
> 
> Otherwise it's all good, thanks.

May I take this as (for series):
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

> 
>> ---
>>  doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
>>  lib/librte_ether/rte_flow.c        |  1 +
>>  lib/librte_ether/rte_flow.h        | 30 ++++++++++++++++++++++++++++++
>>  3 files changed, 43 insertions(+)
>>
>> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
>> index d158be5..5b8f9c5 100644
>> --- a/doc/guides/prog_guide/rte_flow.rst
>> +++ b/doc/guides/prog_guide/rte_flow.rst
>> @@ -980,6 +980,18 @@ Matches an ESP header.
>>  - ``hdr``: ESP header definition (``rte_esp.h``).
>>  - Default ``mask`` matches SPI only.
>>  
>> +Item: ``GENEVE``
>> +^^^^^^^^^^^^^^^
> 
> Missing "^" under title, this may trigger a warning during documentation
> generation.

I can add that one missing '^' while applying, no patch required.
  
Adrien Mazarguil Dec. 8, 2017, 10:52 a.m. UTC | #3
On Thu, Dec 07, 2017 at 03:52:44PM -0800, Ferruh Yigit wrote:
> On 12/4/2017 6:03 AM, Adrien Mazarguil wrote:
> > On Fri, Dec 01, 2017 at 10:43:15AM +0000, Andrew Rybchenko wrote:
> >> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> >>
> >> Add new pattern item RTE_FLOW_ITEM_TYPE_GENEVE in flow API.
> >> Add default mask for the item.
> >>
> >> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> >> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > 
> > Just one remaining nit, please see below. While you could address it through
> > a subsequent patch, you might as well send v3 directly to make things easier
> > for Ferruh.
> > 
> > Otherwise it's all good, thanks.
> 
> May I take this as (for series):
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Sure, thanks.

> >> ---
> >>  doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
> >>  lib/librte_ether/rte_flow.c        |  1 +
> >>  lib/librte_ether/rte_flow.h        | 30 ++++++++++++++++++++++++++++++
> >>  3 files changed, 43 insertions(+)
> >>
> >> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> >> index d158be5..5b8f9c5 100644
> >> --- a/doc/guides/prog_guide/rte_flow.rst
> >> +++ b/doc/guides/prog_guide/rte_flow.rst
> >> @@ -980,6 +980,18 @@ Matches an ESP header.
> >>  - ``hdr``: ESP header definition (``rte_esp.h``).
> >>  - Default ``mask`` matches SPI only.
> >>  
> >> +Item: ``GENEVE``
> >> +^^^^^^^^^^^^^^^
> > 
> > Missing "^" under title, this may trigger a warning during documentation
> > generation.
> 
> I can add that one missing '^' while applying, no patch required.
  
Ferruh Yigit Dec. 8, 2017, 7:06 p.m. UTC | #4
On 12/7/2017 3:52 PM, Ferruh Yigit wrote:
> On 12/4/2017 6:03 AM, Adrien Mazarguil wrote:
>> On Fri, Dec 01, 2017 at 10:43:15AM +0000, Andrew Rybchenko wrote:
>>> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>>>
>>> Add new pattern item RTE_FLOW_ITEM_TYPE_GENEVE in flow API.
>>> Add default mask for the item.
>>>
>>> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>
>> Just one remaining nit, please see below. While you could address it through
>> a subsequent patch, you might as well send v3 directly to make things easier
>> for Ferruh.
>>
>> Otherwise it's all good, thanks.
> 
> May I take this as (for series):
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Series applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index d158be5..5b8f9c5 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -980,6 +980,18 @@  Matches an ESP header.
 - ``hdr``: ESP header definition (``rte_esp.h``).
 - Default ``mask`` matches SPI only.
 
+Item: ``GENEVE``
+^^^^^^^^^^^^^^^
+
+Matches a GENEVE header.
+
+- ``ver_opt_len_o_c_rsvd0``: version (2b), length of the options fields (6b),
+  OAM packet (1b), critical options present (1b), reserved 0 (6b).
+- ``protocol``: protocol type.
+- ``vni``: virtual network identifier.
+- ``rsvd1``: reserved, normally 0x00.
+- Default ``mask`` matches VNI only.
+
 Actions
 ~~~~~~~
 
diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c
index 6659063..913d1a5 100644
--- a/lib/librte_ether/rte_flow.c
+++ b/lib/librte_ether/rte_flow.c
@@ -81,6 +81,7 @@  static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),
 	MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
 	MK_FLOW_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)),
+	MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index 47c88ea..e0402cf 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -344,6 +344,13 @@  enum rte_flow_item_type {
 	 * See struct rte_flow_item_esp.
 	 */
 	RTE_FLOW_ITEM_TYPE_ESP,
+
+	/**
+	 * Matches a GENEVE header.
+	 *
+	 * See struct rte_flow_item_geneve.
+	 */
+	RTE_FLOW_ITEM_TYPE_GENEVE,
 };
 
 /**
@@ -813,6 +820,29 @@  static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_GENEVE.
+ *
+ * Matches a GENEVE header.
+ */
+struct rte_flow_item_geneve {
+	/**
+	 * Version (2b), length of the options fields (6b), OAM packet (1b),
+	 * critical options present (1b), reserved 0 (6b).
+	 */
+	rte_be16_t ver_opt_len_o_c_rsvd0;
+	rte_be16_t protocol; /**< Protocol type. */
+	uint8_t vni[3]; /**< Virtual Network Identifier. */
+	uint8_t rsvd1; /**< Reserved, normally 0x00. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
+	.vni = "\xff\xff\xff",
+};
+#endif
+
+/**
  * Matching pattern item definition.
  *
  * A pattern is formed by stacking items starting from the lowest protocol