[PATCH API-NEXT v3] api: ipsec: factor out IP protocol version parameter#20
Closed
lumag wants to merge 1 commit intoOpenDataPlane:api-nextfrom
Closed
[PATCH API-NEXT v3] api: ipsec: factor out IP protocol version parameter#20lumag wants to merge 1 commit intoOpenDataPlane:api-nextfrom
lumag wants to merge 1 commit intoOpenDataPlane:api-nextfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## api-next #20 +/- ##
===========================================
Coverage ? 79.09%
===========================================
Files ? 189
Lines ? 33982
Branches ? 0
===========================================
Hits ? 26879
Misses ? 7103
Partials ? 0Continue to review full report at Codecov.
|
Contributor
From: Dmitry Eremin-Solenikov On 03.05.2017 17:00, Github ODP bot wrote: > From: Dmitry Eremin-Solenikov > > Both tunnel and lookup parameters refer IP protocol version. Factor that > out as an IPsec enum used in both places. > > Signed-off-by: Dmitry Eremin-Solenikov > --- > /** Email created from pull request 20 (lumag:ipsec-ipv) > ** https://github.com/Linaro/odp/pull/20 > ** Patch: https://github.com/Linaro/odp/pull/20.patch > ** Base sha: 0b1dbf37b4030c6da4c6f13645c63fd4ac8ff923 > ** Merge commit sha: 3525f2823e4a228a1fd0f9d8b661de0fc248457a > **/ > include/odp/api/spec/ipsec.h | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) Maxim, this should have received [PATCH API-NEXT] subject prefix. -- With best wishes Dmitry |
Contributor
From: Dmitry Eremin-Solenikov On 03.05.2017 19:00, Github ODP bot wrote: > From: Dmitry Eremin-Solenikov > > Both tunnel and lookup parameters refer IP protocol version. Factor that > out as an IPsec enum used in both places. Subject prefixes are still not correct. -- With best wishes Dmitry |
Contributor
From: Maxim Uvarov On 05/03/17 17:06, Dmitry Eremin-Solenikov wrote: > On 03.05.2017 17:00, Github ODP bot wrote: >> From: Dmitry Eremin-Solenikov >> >> Both tunnel and lookup parameters refer IP protocol version. Factor that >> out as an IPsec enum used in both places. >> >> Signed-off-by: Dmitry Eremin-Solenikov >> --- >> /** Email created from pull request 20 (lumag:ipsec-ipv) >> ** https://github.com/Linaro/odp/pull/20 >> ** Patch: https://github.com/Linaro/odp/pull/20.patch >> ** Base sha: 0b1dbf37b4030c6da4c6f13645c63fd4ac8ff923 >> ** Merge commit sha: 3525f2823e4a228a1fd0f9d8b661de0fc248457a >> **/ >> include/odp/api/spec/ipsec.h | 21 +++++++++------------ >> 1 file changed, 9 insertions(+), 12 deletions(-) > > Maxim, this should have received [PATCH API-NEXT] subject prefix. > has to be fixed after update. If you want to resend email you can change title in github page. Maxim. |
Contributor
From: "Savolainen, Petri (Nokia - FI/Espoo)"
> -----Original Message-----
> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of
> Github ODP bot
> Sent: Wednesday, May 03, 2017 7:00 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH] api: ipsec: factor out IP protocol version
> parameter
>
> From: Dmitry Eremin-Solenikov
>
> Both tunnel and lookup parameters refer IP protocol version. Factor that
> out as an IPsec enum used in both places.
>
> Signed-off-by: Dmitry Eremin-Solenikov
> ---
> /** Email created from pull request 20 (lumag:ipsec-ipv)
> ** https://github.com/Linaro/odp/pull/20
> ** Patch: https://github.com/Linaro/odp/pull/20.patch
> ** Base sha: 467285f59991e0f28d22a50c99e56f07a4380b8d
> ** Merge commit sha: cd17da2593db2313648bb4b462e751dae1b19659
> **/
> include/odp/api/spec/ipsec.h | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
> index e83494d..7b3b1fe 100644
> --- a/include/odp/api/spec/ipsec.h
> +++ b/include/odp/api/spec/ipsec.h
> @@ -339,16 +339,16 @@ typedef enum odp_ipsec_protocol_t {
> } odp_ipsec_protocol_t;
>
> /**
> - * IPSEC tunnel type
> + * IPSEC header type
> */
> -typedef enum odp_ipsec_tunnel_type_t {
> - /** Outer header is IPv4 */
> - ODP_IPSEC_TUNNEL_IPV4 = 0,
> +typedef enum odp_ipsec_header_type_t {
> + /** Header is IPv4 */
> + ODP_IPSEC_IPV4 = 0,
>
> - /** Outer header is IPv6 */
> - ODP_IPSEC_TUNNEL_IPV6
> + /** Header is IPv6 */
> + ODP_IPSEC_IPV6
>
> -} odp_ipsec_tunnel_type_t;
> +} odp_ipsec_header_type_t;
Keep the current tunnel type. That way it's possible to extend it later with new tunnel types if needed.
>
> /**
> * IPSEC crypto parameters
> @@ -378,7 +378,7 @@ typedef struct odp_ipsec_crypto_param_t {
> */
> typedef struct odp_ipsec_tunnel_param_t {
> /** Tunnel type: IPv4 or IPv6 */
> - odp_ipsec_tunnel_type_t type;
> + odp_ipsec_header_type_t type;
>
> /** Variant mappings for tunnel parameters */
> union {
> @@ -613,11 +613,8 @@ typedef struct odp_ipsec_sa_param_t {
> * only in ODP_IPSEC_LOOKUP_DSTADDR_SPI lookup mode. */
> struct {
> /** Select IP version
> - *
> - * 4: IPv4
> - * 6: IPv6
> */
> - uint8_t ip_version;
> + odp_ipsec_header_type_t ip_version;
Name the type as IP header version enum. E.g.
odp_ipsec_ip_version_t
The down side of this is that enum is int vs. uint8_t is one byte.
-Petri
>
> /** IP destination address (NETWORK ENDIAN) */
> void *dst_addr;
|
Contributor
From: Dmitry Eremin-Solenikov
On 05.05.2017 13:12, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>
>
>> -----Original Message-----
>> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of
>> Github ODP bot
>> Sent: Wednesday, May 03, 2017 7:00 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [PATCH] api: ipsec: factor out IP protocol version
>> parameter
>>
>> From: Dmitry Eremin-Solenikov
>>
>> Both tunnel and lookup parameters refer IP protocol version. Factor that
>> out as an IPsec enum used in both places.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov
>> ---
>> /** Email created from pull request 20 (lumag:ipsec-ipv)
>> ** https://github.com/Linaro/odp/pull/20
>> ** Patch: https://github.com/Linaro/odp/pull/20.patch
>> ** Base sha: 467285f59991e0f28d22a50c99e56f07a4380b8d
>> ** Merge commit sha: cd17da2593db2313648bb4b462e751dae1b19659
>> **/
>> include/odp/api/spec/ipsec.h | 21 +++++++++------------
>> 1 file changed, 9 insertions(+), 12 deletions(-)
>>
>> diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
>> index e83494d..7b3b1fe 100644
>> --- a/include/odp/api/spec/ipsec.h
>> +++ b/include/odp/api/spec/ipsec.h
>> @@ -339,16 +339,16 @@ typedef enum odp_ipsec_protocol_t {
>> } odp_ipsec_protocol_t;
>>
>> /**
>> - * IPSEC tunnel type
>> + * IPSEC header type
>> */
>> -typedef enum odp_ipsec_tunnel_type_t {
>> - /** Outer header is IPv4 */
>> - ODP_IPSEC_TUNNEL_IPV4 = 0,
>> +typedef enum odp_ipsec_header_type_t {
>> + /** Header is IPv4 */
>> + ODP_IPSEC_IPV4 = 0,
>>
>> - /** Outer header is IPv6 */
>> - ODP_IPSEC_TUNNEL_IPV6
>> + /** Header is IPv6 */
>> + ODP_IPSEC_IPV6
>>
>> -} odp_ipsec_tunnel_type_t;
>> +} odp_ipsec_header_type_t;
>
> Keep the current tunnel type. That way it's possible to extend it later with new tunnel types if needed.
Ack.
>> /**
>> * IPSEC crypto parameters
>> @@ -378,7 +378,7 @@ typedef struct odp_ipsec_crypto_param_t {
>> */
>> typedef struct odp_ipsec_tunnel_param_t {
>> /** Tunnel type: IPv4 or IPv6 */
>> - odp_ipsec_tunnel_type_t type;
>> + odp_ipsec_header_type_t type;
>>
>> /** Variant mappings for tunnel parameters */
>> union {
>> @@ -613,11 +613,8 @@ typedef struct odp_ipsec_sa_param_t {
>> * only in ODP_IPSEC_LOOKUP_DSTADDR_SPI lookup mode. */
>> struct {
>> /** Select IP version
>> - *
>> - * 4: IPv4
>> - * 6: IPv6
>> */
>> - uint8_t ip_version;
>> + odp_ipsec_header_type_t ip_version;
>
> Name the type as IP header version enum. E.g.
>
> odp_ipsec_ip_version_t
>
> The down side of this is that enum is int vs. uint8_t is one byte.
Well, memory is cheap. One can use any kind of storage internally (even
1-bit flag). However inside parameters I would vote for clarity rather
than storage. Moreover for embedded implementations one can set
-fshort-enums.
--
With best wishes
Dmitry
|
| /** Header is IPv4 */ | ||
| ODP_IPSEC_IPV4 = 0, | ||
|
|
||
| /** Header is IPv6 */ |
Contributor
There was a problem hiding this comment.
Wouldn't it make sense to define these enum values as 4 and 6 respectively?
Author
There was a problem hiding this comment.
@Bill-Fischofer-Linaro why would we like to have exact values for those enum names?
Instead of using 'magic' numbers for ip version in SA params, define new enum to distinguish between IPv4 and IPv6. Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Bill-Fischofer-Linaro
approved these changes
May 23, 2017
Contributor
Bill-Fischofer-Linaro
left a comment
There was a problem hiding this comment.
Reviewed-by: Bill Fischofer bill.fischofer@linaro.org
Contributor
|
Merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both tunnel and lookup parameters refer IP protocol version. Factor that
out as an IPsec enum used in both places.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org