[v2,1/4] lib: add optional fields in GRE header

Message ID 20220211014530.77711-2-xiazhang@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Add support for GRE optional fields matching |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Sean Zhang Feb. 11, 2022, 1:45 a.m. UTC
  There are optional fields in GRE header(checksum/key/sequence), this
patch adds definition of structures of the optional fields.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
 lib/net/rte_gre.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
  

Comments

Ferruh Yigit Feb. 11, 2022, 9:38 a.m. UTC | #1
On 2/11/2022 1:45 AM, Sean Zhang wrote:
> There are optional fields in GRE header(checksum/key/sequence), this
> patch adds definition of structures of the optional fields.
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> ---
>   lib/net/rte_gre.h | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
> 
> diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h
> index 5897756..6c6aef6 100644
> --- a/lib/net/rte_gre.h
> +++ b/lib/net/rte_gre.h
> @@ -48,6 +48,28 @@ struct rte_gre_hdr {
>   	uint16_t proto;  /**< Protocol Type */
>   } __rte_packed;
>   
> +/**
> + * Optional field checksum in GRE header
> + */
> +struct rte_gre_hdr_opt_checksum_rsvd {
> +	rte_be16_t checksum;
> +	rte_be16_t reserved1;

Can you please explain why this reserved field is added,
I guess it i not part of the GRE spec, but added for mlx driver?

Since these struts will be public, we can't update them later easily,
so we should be careful on them.

> +} __rte_packed;
> +
> +/**
> + * Optional field key in GRE header
> + */
> +struct rte_gre_hdr_opt_key {
> +	rte_be32_t key;
> +} __rte_packed;
> +
> +/**
> + * Optional field sequence in GRE header
> + */
> +struct rte_gre_hdr_opt_sequence {
> +	rte_be32_t sequence;
> +} __rte_packed;
> +
>   #ifdef __cplusplus
>   }
>   #endif
  
Ori Kam Feb. 11, 2022, 10:12 a.m. UTC | #2
Hi Sean,

> -----Original Message-----
> From: Sean Zhang <xiazhang@nvidia.com>
> Subject: [v2 1/4] lib: add optional fields in GRE header
> 
> There are optional fields in GRE header(checksum/key/sequence), this
> patch adds definition of structures of the optional fields.
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> ---
>  lib/net/rte_gre.h | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h
> index 5897756..6c6aef6 100644
> --- a/lib/net/rte_gre.h
> +++ b/lib/net/rte_gre.h
> @@ -48,6 +48,28 @@ struct rte_gre_hdr {
>  	uint16_t proto;  /**< Protocol Type */
>  } __rte_packed;
> 
> +/**
> + * Optional field checksum in GRE header
> + */
> +struct rte_gre_hdr_opt_checksum_rsvd {
> +	rte_be16_t checksum;
> +	rte_be16_t reserved1;
> +} __rte_packed;
> +
> +/**
> + * Optional field key in GRE header
> + */
> +struct rte_gre_hdr_opt_key {
> +	rte_be32_t key;
> +} __rte_packed;
> +
> +/**
> + * Optional field sequence in GRE header
> + */
> +struct rte_gre_hdr_opt_sequence {
> +	rte_be32_t sequence;
> +} __rte_packed;
> +
>  #ifdef __cplusplus
>  }
>  #endif
> --
> 1.8.3.1

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  
Sean Zhang Feb. 11, 2022, 10:23 a.m. UTC | #3
Hi Ferruh,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Friday, February 11, 2022 5:38 PM
> To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Olivier Matz
> <olivier.matz@6wind.com>
> Cc: dev@dpdk.org; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>;
> Ori Kam <orika@nvidia.com>
> Subject: Re: [v2 1/4] lib: add optional fields in GRE header
> 
> External email: Use caution opening links or attachments
> 
> 
> On 2/11/2022 1:45 AM, Sean Zhang wrote:
> > There are optional fields in GRE header(checksum/key/sequence), this
> > patch adds definition of structures of the optional fields.
> >
> > Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> > ---
> >   lib/net/rte_gre.h | 22 ++++++++++++++++++++++
> >   1 file changed, 22 insertions(+)
> >
> > diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h index
> > 5897756..6c6aef6 100644
> > --- a/lib/net/rte_gre.h
> > +++ b/lib/net/rte_gre.h
> > @@ -48,6 +48,28 @@ struct rte_gre_hdr {
> >       uint16_t proto;  /**< Protocol Type */
> >   } __rte_packed;
> >
> > +/**
> > + * Optional field checksum in GRE header  */ struct
> > +rte_gre_hdr_opt_checksum_rsvd {
> > +     rte_be16_t checksum;
> > +     rte_be16_t reserved1;
> 
> Can you please explain why this reserved field is added, I guess it i not part of
> the GRE spec, but added for mlx driver?
> 

Yes, the reserverd1 field is part of GRE spec, and the field go together with checksum field, so I add the reserverd1 field here.

You can refer to section 2.6 of https://datatracker.ietf.org/doc/rfc2784/ 

> Since these struts will be public, we can't update them later easily, so we
> should be careful on them.
> 
> > +} __rte_packed;
> > +
> > +/**
> > + * Optional field key in GRE header
> > + */
> > +struct rte_gre_hdr_opt_key {
> > +     rte_be32_t key;
> > +} __rte_packed;
> > +
> > +/**
> > + * Optional field sequence in GRE header  */ struct
> > +rte_gre_hdr_opt_sequence {
> > +     rte_be32_t sequence;
> > +} __rte_packed;
> > +
> >   #ifdef __cplusplus
> >   }
> >   #endif
  
Ferruh Yigit Feb. 11, 2022, 10:37 a.m. UTC | #4
On 2/11/2022 10:23 AM, Sean Zhang (Networking SW) wrote:
> Hi Ferruh,
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Friday, February 11, 2022 5:38 PM
>> To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; NBU-Contact-
>> Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Olivier Matz
>> <olivier.matz@6wind.com>
>> Cc: dev@dpdk.org; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>;
>> Ori Kam <orika@nvidia.com>
>> Subject: Re: [v2 1/4] lib: add optional fields in GRE header
>>
>> External email: Use caution opening links or attachments
>>
>>
>> On 2/11/2022 1:45 AM, Sean Zhang wrote:
>>> There are optional fields in GRE header(checksum/key/sequence), this
>>> patch adds definition of structures of the optional fields.
>>>
>>> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
>>> ---
>>>    lib/net/rte_gre.h | 22 ++++++++++++++++++++++
>>>    1 file changed, 22 insertions(+)
>>>
>>> diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h index
>>> 5897756..6c6aef6 100644
>>> --- a/lib/net/rte_gre.h
>>> +++ b/lib/net/rte_gre.h
>>> @@ -48,6 +48,28 @@ struct rte_gre_hdr {
>>>        uint16_t proto;  /**< Protocol Type */
>>>    } __rte_packed;
>>>
>>> +/**
>>> + * Optional field checksum in GRE header  */ struct
>>> +rte_gre_hdr_opt_checksum_rsvd {
>>> +     rte_be16_t checksum;
>>> +     rte_be16_t reserved1;
>>
>> Can you please explain why this reserved field is added, I guess it i not part of
>> the GRE spec, but added for mlx driver?
>>
> 
> Yes, the reserverd1 field is part of GRE spec, and the field go together with checksum field, so I add the reserverd1 field here.
> 
> You can refer to section 2.6 of https://datatracker.ietf.org/doc/rfc2784/
> 

ack, thanks.

>> Since these struts will be public, we can't update them later easily, so we
>> should be careful on them.
>>
>>> +} __rte_packed;
>>> +
>>> +/**
>>> + * Optional field key in GRE header
>>> + */
>>> +struct rte_gre_hdr_opt_key {
>>> +     rte_be32_t key;
>>> +} __rte_packed;
>>> +
>>> +/**
>>> + * Optional field sequence in GRE header  */ struct
>>> +rte_gre_hdr_opt_sequence {
>>> +     rte_be32_t sequence;
>>> +} __rte_packed;
>>> +
>>>    #ifdef __cplusplus
>>>    }
>>>    #endif
>
  

Patch

diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h
index 5897756..6c6aef6 100644
--- a/lib/net/rte_gre.h
+++ b/lib/net/rte_gre.h
@@ -48,6 +48,28 @@  struct rte_gre_hdr {
 	uint16_t proto;  /**< Protocol Type */
 } __rte_packed;
 
+/**
+ * Optional field checksum in GRE header
+ */
+struct rte_gre_hdr_opt_checksum_rsvd {
+	rte_be16_t checksum;
+	rte_be16_t reserved1;
+} __rte_packed;
+
+/**
+ * Optional field key in GRE header
+ */
+struct rte_gre_hdr_opt_key {
+	rte_be32_t key;
+} __rte_packed;
+
+/**
+ * Optional field sequence in GRE header
+ */
+struct rte_gre_hdr_opt_sequence {
+	rte_be32_t sequence;
+} __rte_packed;
+
 #ifdef __cplusplus
 }
 #endif