diff mbox

[API-NEXT,v3] api: ipsec: factor out definitions for feature support levels

Message ID 20170415014858.22154-1-dmitry.ereminsolenikov@linaro.org
State New
Headers show

Commit Message

Dmitry Eremin-Solenikov April 15, 2017, 1:48 a.m. UTC
Instead of having magic 0-1-2 numbers, let's have the special enum for
feature support levels (unsupported/supported/preferred).

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
 include/odp/api/spec/feature.h                   | 53 ++++++++++++++++++++++++
 include/odp/api/spec/ipsec.h                     | 39 ++++++-----------
 include/odp_api.h                                |  1 +
 platform/linux-generic/include/odp/api/feature.h | 34 +++++++++++++++
 4 files changed, 100 insertions(+), 27 deletions(-)
 create mode 100644 include/odp/api/spec/feature.h
 create mode 100644 platform/linux-generic/include/odp/api/feature.h

-- 
2.11.0

Comments

Balasubramanian Manoharan April 15, 2017, 4:19 a.m. UTC | #1
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>



On 15 April 2017 at 07:18, Dmitry Eremin-Solenikov
<dmitry.ereminsolenikov@linaro.org> wrote:
> Instead of having magic 0-1-2 numbers, let's have the special enum for

> feature support levels (unsupported/supported/preferred).

>

> Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

> ---

>  include/odp/api/spec/feature.h                   | 53 ++++++++++++++++++++++++

>  include/odp/api/spec/ipsec.h                     | 39 ++++++-----------

>  include/odp_api.h                                |  1 +

>  platform/linux-generic/include/odp/api/feature.h | 34 +++++++++++++++

>  4 files changed, 100 insertions(+), 27 deletions(-)

>  create mode 100644 include/odp/api/spec/feature.h

>  create mode 100644 platform/linux-generic/include/odp/api/feature.h

>

> diff --git a/include/odp/api/spec/feature.h b/include/odp/api/spec/feature.h

> new file mode 100644

> index 00000000..7ee2ae04

> --- /dev/null

> +++ b/include/odp/api/spec/feature.h

> @@ -0,0 +1,53 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +/**

> + * @file

> + *

> + * ODP feature API

> + */

> +

> +#ifndef ODP_API_FEATURE_H_

> +#define ODP_API_FEATURE_H_

> +#include <odp/visibility_begin.h>

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +/** @defgroup odp_feature ODP feature

> + *  Common API

> + *  @{

> + */

> +

> +/**

> + * ODP feature support

> + */

> +typedef enum odp_feature_t {

> +       /**

> +        * Feature is not supported

> +        */

> +       ODP_FEATURE_UNSUPPORTED,

> +       /**

> +        * Feature is supported

> +        */

> +       ODP_FEATURE_SUPPORTED,

> +       /**

> +        * Feature is supported and preferred

> +        */

> +       ODP_FEATURE_PREFERRED

> +} odp_feature_t;

> +

> +/**

> + * @}

> + */

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#include <odp/visibility_end.h>

> +#endif

> diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h

> index a0ceb11a..e15eb590 100644

> --- a/include/odp/api/spec/ipsec.h

> +++ b/include/odp/api/spec/ipsec.h

> @@ -19,6 +19,7 @@ extern "C" {

>  #endif

>

>  #include <odp/api/crypto.h>

> +#include <odp/api/feature.h>

>  #include <odp/api/packet_io.h>

>  #include <odp/api/classification.h>

>

> @@ -230,38 +231,22 @@ typedef struct odp_ipsec_capability_t {

>         /** Maximum number of IPSEC SAs */

>         uint32_t max_num_sa;

>

> -       /** Synchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_SYNC) support

> -        *

> -        *  0: Synchronous mode is not supported

> -        *  1: Synchronous mode is supported

> -        *  2: Synchronous mode is supported and preferred

> -        */

> -       uint8_t op_mode_sync;

> +       /** Synchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_SYNC) support */

> +       odp_feature_t op_mode_sync;

>

> -       /** Asynchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_ASYNC) support

> -        *

> -        *  0: Asynchronous mode is not supported

> -        *  1: Asynchronous mode is supported

> -        *  2: Asynchronous mode is supported and preferred

> +       /**

> +        * Asynchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_ASYNC) support

>          */

> -       uint8_t op_mode_async;

> +       odp_feature_t op_mode_async;

>

> -       /** Inline IPSEC operation mode (ODP_IPSEC_OP_MODE_INLINE) support

> -        *

> -        *  0: Inline IPSEC operation is not supported

> -        *  1: Inline IPSEC operation is supported

> -        *  2: Inline IPSEC operation is supported and preferred

> -        */

> -       uint8_t op_mode_inline;

> +       /** Inline IPSEC operation mode (ODP_IPSEC_OP_MODE_INLINE) support */

> +       odp_feature_t op_mode_inline;

>

> -       /** Support of pipelined classification (ODP_IPSEC_PIPELINE_CLS) of

> -        *  resulting inbound packets.

> -        *

> -        *  0: Classification of resulting packets is not supported

> -        *  1: Classification of resulting packets is supported

> -        *  2: Classification of resulting packets is supported and preferred

> +       /**

> +        * Support of pipelined classification (ODP_IPSEC_PIPELINE_CLS) of

> +        *  resulting inbound packets

>          */

> -       uint8_t pipeline_cls;

> +       odp_feature_t pipeline_cls;

>

>         /** Soft expiry limit in seconds support

>          *

> diff --git a/include/odp_api.h b/include/odp_api.h

> index 73e5309a..b736fb88 100644

> --- a/include/odp_api.h

> +++ b/include/odp_api.h

> @@ -57,6 +57,7 @@ extern "C" {

>  #include <odp/api/spinlock_recursive.h>

>  #include <odp/api/rwlock_recursive.h>

>  #include <odp/api/std_clib.h>

> +#include <odp/api/feature.h>

>  #include <odp/api/ipsec.h>

>

>  #ifdef __cplusplus

> diff --git a/platform/linux-generic/include/odp/api/feature.h b/platform/linux-generic/include/odp/api/feature.h

> new file mode 100644

> index 00000000..d0aa8179

> --- /dev/null

> +++ b/platform/linux-generic/include/odp/api/feature.h

> @@ -0,0 +1,34 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier:     BSD-3-Clause

> + */

> +

> +/**

> + * @file

> + *

> + * ODP feature API - platform specific header

> + */

> +

> +#ifndef ODP_PLAT_FEATURE_H_

> +#define ODP_PLAT_FEATURE_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +/** @ingroup odp_feature

> + *  @{

> + */

> +

> +/**

> + * @}

> + */

> +

> +#include <odp/api/spec/feature.h>

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif

> --

> 2.11.0

>
Maxim Uvarov April 17, 2017, 12:57 p.m. UTC | #2
Petri, ok?

Maxim.

On 04/15/17 07:19, Bala Manoharan wrote:
> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

> 

> 

> On 15 April 2017 at 07:18, Dmitry Eremin-Solenikov

> <dmitry.ereminsolenikov@linaro.org> wrote:

>> Instead of having magic 0-1-2 numbers, let's have the special enum for

>> feature support levels (unsupported/supported/preferred).

>>

>> Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

>> ---

>>  include/odp/api/spec/feature.h                   | 53 ++++++++++++++++++++++++

>>  include/odp/api/spec/ipsec.h                     | 39 ++++++-----------

>>  include/odp_api.h                                |  1 +

>>  platform/linux-generic/include/odp/api/feature.h | 34 +++++++++++++++

>>  4 files changed, 100 insertions(+), 27 deletions(-)

>>  create mode 100644 include/odp/api/spec/feature.h

>>  create mode 100644 platform/linux-generic/include/odp/api/feature.h

>>

>> diff --git a/include/odp/api/spec/feature.h b/include/odp/api/spec/feature.h

>> new file mode 100644

>> index 00000000..7ee2ae04

>> --- /dev/null

>> +++ b/include/odp/api/spec/feature.h

>> @@ -0,0 +1,53 @@

>> +/* Copyright (c) 2017, Linaro Limited

>> + * All rights reserved.

>> + *

>> + * SPDX-License-Identifier:     BSD-3-Clause

>> + */

>> +

>> +/**

>> + * @file

>> + *

>> + * ODP feature API

>> + */

>> +

>> +#ifndef ODP_API_FEATURE_H_

>> +#define ODP_API_FEATURE_H_

>> +#include <odp/visibility_begin.h>

>> +

>> +#ifdef __cplusplus

>> +extern "C" {

>> +#endif

>> +

>> +/** @defgroup odp_feature ODP feature

>> + *  Common API

>> + *  @{

>> + */

>> +

>> +/**

>> + * ODP feature support

>> + */

>> +typedef enum odp_feature_t {

>> +       /**

>> +        * Feature is not supported

>> +        */

>> +       ODP_FEATURE_UNSUPPORTED,

>> +       /**

>> +        * Feature is supported

>> +        */

>> +       ODP_FEATURE_SUPPORTED,

>> +       /**

>> +        * Feature is supported and preferred

>> +        */

>> +       ODP_FEATURE_PREFERRED

>> +} odp_feature_t;

>> +

>> +/**

>> + * @}

>> + */

>> +

>> +#ifdef __cplusplus

>> +}

>> +#endif

>> +

>> +#include <odp/visibility_end.h>

>> +#endif

>> diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h

>> index a0ceb11a..e15eb590 100644

>> --- a/include/odp/api/spec/ipsec.h

>> +++ b/include/odp/api/spec/ipsec.h

>> @@ -19,6 +19,7 @@ extern "C" {

>>  #endif

>>

>>  #include <odp/api/crypto.h>

>> +#include <odp/api/feature.h>

>>  #include <odp/api/packet_io.h>

>>  #include <odp/api/classification.h>

>>

>> @@ -230,38 +231,22 @@ typedef struct odp_ipsec_capability_t {

>>         /** Maximum number of IPSEC SAs */

>>         uint32_t max_num_sa;

>>

>> -       /** Synchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_SYNC) support

>> -        *

>> -        *  0: Synchronous mode is not supported

>> -        *  1: Synchronous mode is supported

>> -        *  2: Synchronous mode is supported and preferred

>> -        */

>> -       uint8_t op_mode_sync;

>> +       /** Synchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_SYNC) support */

>> +       odp_feature_t op_mode_sync;

>>

>> -       /** Asynchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_ASYNC) support

>> -        *

>> -        *  0: Asynchronous mode is not supported

>> -        *  1: Asynchronous mode is supported

>> -        *  2: Asynchronous mode is supported and preferred

>> +       /**

>> +        * Asynchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_ASYNC) support

>>          */

>> -       uint8_t op_mode_async;

>> +       odp_feature_t op_mode_async;

>>

>> -       /** Inline IPSEC operation mode (ODP_IPSEC_OP_MODE_INLINE) support

>> -        *

>> -        *  0: Inline IPSEC operation is not supported

>> -        *  1: Inline IPSEC operation is supported

>> -        *  2: Inline IPSEC operation is supported and preferred

>> -        */

>> -       uint8_t op_mode_inline;

>> +       /** Inline IPSEC operation mode (ODP_IPSEC_OP_MODE_INLINE) support */

>> +       odp_feature_t op_mode_inline;

>>

>> -       /** Support of pipelined classification (ODP_IPSEC_PIPELINE_CLS) of

>> -        *  resulting inbound packets.

>> -        *

>> -        *  0: Classification of resulting packets is not supported

>> -        *  1: Classification of resulting packets is supported

>> -        *  2: Classification of resulting packets is supported and preferred

>> +       /**

>> +        * Support of pipelined classification (ODP_IPSEC_PIPELINE_CLS) of

>> +        *  resulting inbound packets

>>          */

>> -       uint8_t pipeline_cls;

>> +       odp_feature_t pipeline_cls;

>>

>>         /** Soft expiry limit in seconds support

>>          *

>> diff --git a/include/odp_api.h b/include/odp_api.h

>> index 73e5309a..b736fb88 100644

>> --- a/include/odp_api.h

>> +++ b/include/odp_api.h

>> @@ -57,6 +57,7 @@ extern "C" {

>>  #include <odp/api/spinlock_recursive.h>

>>  #include <odp/api/rwlock_recursive.h>

>>  #include <odp/api/std_clib.h>

>> +#include <odp/api/feature.h>

>>  #include <odp/api/ipsec.h>

>>

>>  #ifdef __cplusplus

>> diff --git a/platform/linux-generic/include/odp/api/feature.h b/platform/linux-generic/include/odp/api/feature.h

>> new file mode 100644

>> index 00000000..d0aa8179

>> --- /dev/null

>> +++ b/platform/linux-generic/include/odp/api/feature.h

>> @@ -0,0 +1,34 @@

>> +/* Copyright (c) 2017, Linaro Limited

>> + * All rights reserved.

>> + *

>> + * SPDX-License-Identifier:     BSD-3-Clause

>> + */

>> +

>> +/**

>> + * @file

>> + *

>> + * ODP feature API - platform specific header

>> + */

>> +

>> +#ifndef ODP_PLAT_FEATURE_H_

>> +#define ODP_PLAT_FEATURE_H_

>> +

>> +#ifdef __cplusplus

>> +extern "C" {

>> +#endif

>> +

>> +/** @ingroup odp_feature

>> + *  @{

>> + */

>> +

>> +/**

>> + * @}

>> + */

>> +

>> +#include <odp/api/spec/feature.h>

>> +

>> +#ifdef __cplusplus

>> +}

>> +#endif

>> +

>> +#endif

>> --

>> 2.11.0

>>
Maxim Uvarov April 17, 2017, 3:13 p.m. UTC | #3
make distcheck fails:


In file included from
../../../platform/linux-generic/include/protocols/ip.h:20:0,

                 from
../../../platform/linux-generic/include/odp_classification_datamodel.h:28,

                 from
../../../platform/linux-generic/include/odp_packet_io_internal.h:23,

                 from
../../../platform/linux-generic/odp_classification.c:15:

../../../include/odp_api.h:60:29: fatal error: odp/api/feature.h: No
such file or directory

 #include <odp/api/feature.h>



On 04/15/17 07:19, Bala Manoharan wrote:
> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

> 

> 

> On 15 April 2017 at 07:18, Dmitry Eremin-Solenikov

> <dmitry.ereminsolenikov@linaro.org> wrote:

>> Instead of having magic 0-1-2 numbers, let's have the special enum for

>> feature support levels (unsupported/supported/preferred).

>>

>> Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

>> ---

>>  include/odp/api/spec/feature.h                   | 53 ++++++++++++++++++++++++

>>  include/odp/api/spec/ipsec.h                     | 39 ++++++-----------

>>  include/odp_api.h                                |  1 +

>>  platform/linux-generic/include/odp/api/feature.h | 34 +++++++++++++++

>>  4 files changed, 100 insertions(+), 27 deletions(-)

>>  create mode 100644 include/odp/api/spec/feature.h

>>  create mode 100644 platform/linux-generic/include/odp/api/feature.h

>>

>> diff --git a/include/odp/api/spec/feature.h b/include/odp/api/spec/feature.h

>> new file mode 100644

>> index 00000000..7ee2ae04

>> --- /dev/null

>> +++ b/include/odp/api/spec/feature.h

>> @@ -0,0 +1,53 @@

>> +/* Copyright (c) 2017, Linaro Limited

>> + * All rights reserved.

>> + *

>> + * SPDX-License-Identifier:     BSD-3-Clause

>> + */

>> +

>> +/**

>> + * @file

>> + *

>> + * ODP feature API

>> + */

>> +

>> +#ifndef ODP_API_FEATURE_H_

>> +#define ODP_API_FEATURE_H_

>> +#include <odp/visibility_begin.h>

>> +

>> +#ifdef __cplusplus

>> +extern "C" {

>> +#endif

>> +

>> +/** @defgroup odp_feature ODP feature

>> + *  Common API

>> + *  @{

>> + */

>> +

>> +/**

>> + * ODP feature support

>> + */

>> +typedef enum odp_feature_t {

>> +       /**

>> +        * Feature is not supported

>> +        */

>> +       ODP_FEATURE_UNSUPPORTED,

>> +       /**

>> +        * Feature is supported

>> +        */

>> +       ODP_FEATURE_SUPPORTED,

>> +       /**

>> +        * Feature is supported and preferred

>> +        */

>> +       ODP_FEATURE_PREFERRED

>> +} odp_feature_t;

>> +

>> +/**

>> + * @}

>> + */

>> +

>> +#ifdef __cplusplus

>> +}

>> +#endif

>> +

>> +#include <odp/visibility_end.h>

>> +#endif

>> diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h

>> index a0ceb11a..e15eb590 100644

>> --- a/include/odp/api/spec/ipsec.h

>> +++ b/include/odp/api/spec/ipsec.h

>> @@ -19,6 +19,7 @@ extern "C" {

>>  #endif

>>

>>  #include <odp/api/crypto.h>

>> +#include <odp/api/feature.h>

>>  #include <odp/api/packet_io.h>

>>  #include <odp/api/classification.h>

>>

>> @@ -230,38 +231,22 @@ typedef struct odp_ipsec_capability_t {

>>         /** Maximum number of IPSEC SAs */

>>         uint32_t max_num_sa;

>>

>> -       /** Synchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_SYNC) support

>> -        *

>> -        *  0: Synchronous mode is not supported

>> -        *  1: Synchronous mode is supported

>> -        *  2: Synchronous mode is supported and preferred

>> -        */

>> -       uint8_t op_mode_sync;

>> +       /** Synchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_SYNC) support */

>> +       odp_feature_t op_mode_sync;

>>

>> -       /** Asynchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_ASYNC) support

>> -        *

>> -        *  0: Asynchronous mode is not supported

>> -        *  1: Asynchronous mode is supported

>> -        *  2: Asynchronous mode is supported and preferred

>> +       /**

>> +        * Asynchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_ASYNC) support

>>          */

>> -       uint8_t op_mode_async;

>> +       odp_feature_t op_mode_async;

>>

>> -       /** Inline IPSEC operation mode (ODP_IPSEC_OP_MODE_INLINE) support

>> -        *

>> -        *  0: Inline IPSEC operation is not supported

>> -        *  1: Inline IPSEC operation is supported

>> -        *  2: Inline IPSEC operation is supported and preferred

>> -        */

>> -       uint8_t op_mode_inline;

>> +       /** Inline IPSEC operation mode (ODP_IPSEC_OP_MODE_INLINE) support */

>> +       odp_feature_t op_mode_inline;

>>

>> -       /** Support of pipelined classification (ODP_IPSEC_PIPELINE_CLS) of

>> -        *  resulting inbound packets.

>> -        *

>> -        *  0: Classification of resulting packets is not supported

>> -        *  1: Classification of resulting packets is supported

>> -        *  2: Classification of resulting packets is supported and preferred

>> +       /**

>> +        * Support of pipelined classification (ODP_IPSEC_PIPELINE_CLS) of

>> +        *  resulting inbound packets

>>          */

>> -       uint8_t pipeline_cls;

>> +       odp_feature_t pipeline_cls;

>>

>>         /** Soft expiry limit in seconds support

>>          *

>> diff --git a/include/odp_api.h b/include/odp_api.h

>> index 73e5309a..b736fb88 100644

>> --- a/include/odp_api.h

>> +++ b/include/odp_api.h

>> @@ -57,6 +57,7 @@ extern "C" {

>>  #include <odp/api/spinlock_recursive.h>

>>  #include <odp/api/rwlock_recursive.h>

>>  #include <odp/api/std_clib.h>

>> +#include <odp/api/feature.h>

>>  #include <odp/api/ipsec.h>

>>

>>  #ifdef __cplusplus

>> diff --git a/platform/linux-generic/include/odp/api/feature.h b/platform/linux-generic/include/odp/api/feature.h

>> new file mode 100644

>> index 00000000..d0aa8179

>> --- /dev/null

>> +++ b/platform/linux-generic/include/odp/api/feature.h

>> @@ -0,0 +1,34 @@

>> +/* Copyright (c) 2017, Linaro Limited

>> + * All rights reserved.

>> + *

>> + * SPDX-License-Identifier:     BSD-3-Clause

>> + */

>> +

>> +/**

>> + * @file

>> + *

>> + * ODP feature API - platform specific header

>> + */

>> +

>> +#ifndef ODP_PLAT_FEATURE_H_

>> +#define ODP_PLAT_FEATURE_H_

>> +

>> +#ifdef __cplusplus

>> +extern "C" {

>> +#endif

>> +

>> +/** @ingroup odp_feature

>> + *  @{

>> + */

>> +

>> +/**

>> + * @}

>> + */

>> +

>> +#include <odp/api/spec/feature.h>

>> +

>> +#ifdef __cplusplus

>> +}

>> +#endif

>> +

>> +#endif

>> --

>> 2.11.0

>>
Dmitry Eremin-Solenikov April 17, 2017, 8:57 p.m. UTC | #4
On 17.04.2017 18:13, Maxim Uvarov wrote:
> make distcheck fails:

> 

> 

> In file included from

> ../../../platform/linux-generic/include/protocols/ip.h:20:0,

> 

>                  from

> ../../../platform/linux-generic/include/odp_classification_datamodel.h:28,

> 

>                  from

> ../../../platform/linux-generic/include/odp_packet_io_internal.h:23,

> 

>                  from

> ../../../platform/linux-generic/odp_classification.c:15:

> 

> ../../../include/odp_api.h:60:29: fatal error: odp/api/feature.h: No

> such file or directory

> 

>  #include <odp/api/feature.h>


Ack. Forgot to update Makefile.am.

BTW: Is make distcheck a part of Travis CI build script?

-- 
With best wishes
Dmitry
diff mbox

Patch

diff --git a/include/odp/api/spec/feature.h b/include/odp/api/spec/feature.h
new file mode 100644
index 00000000..7ee2ae04
--- /dev/null
+++ b/include/odp/api/spec/feature.h
@@ -0,0 +1,53 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP feature API
+ */
+
+#ifndef ODP_API_FEATURE_H_
+#define ODP_API_FEATURE_H_
+#include <odp/visibility_begin.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup odp_feature ODP feature
+ *  Common API
+ *  @{
+ */
+
+/**
+ * ODP feature support
+ */
+typedef enum odp_feature_t {
+	/**
+	 * Feature is not supported
+	 */
+	ODP_FEATURE_UNSUPPORTED,
+	/**
+	 * Feature is supported
+	 */
+	ODP_FEATURE_SUPPORTED,
+	/**
+	 * Feature is supported and preferred
+	 */
+	ODP_FEATURE_PREFERRED
+} odp_feature_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <odp/visibility_end.h>
+#endif
diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index a0ceb11a..e15eb590 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -19,6 +19,7 @@  extern "C" {
 #endif
 
 #include <odp/api/crypto.h>
+#include <odp/api/feature.h>
 #include <odp/api/packet_io.h>
 #include <odp/api/classification.h>
 
@@ -230,38 +231,22 @@  typedef struct odp_ipsec_capability_t {
 	/** Maximum number of IPSEC SAs */
 	uint32_t max_num_sa;
 
-	/** Synchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_SYNC) support
-	 *
-	 *  0: Synchronous mode is not supported
-	 *  1: Synchronous mode is supported
-	 *  2: Synchronous mode is supported and preferred
-	 */
-	uint8_t op_mode_sync;
+	/** Synchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_SYNC) support */
+	odp_feature_t op_mode_sync;
 
-	/** Asynchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_ASYNC) support
-	 *
-	 *  0: Asynchronous mode is not supported
-	 *  1: Asynchronous mode is supported
-	 *  2: Asynchronous mode is supported and preferred
+	/**
+	 * Asynchronous IPSEC operation mode (ODP_IPSEC_OP_MODE_ASYNC) support
 	 */
-	uint8_t op_mode_async;
+	odp_feature_t op_mode_async;
 
-	/** Inline IPSEC operation mode (ODP_IPSEC_OP_MODE_INLINE) support
-	 *
-	 *  0: Inline IPSEC operation is not supported
-	 *  1: Inline IPSEC operation is supported
-	 *  2: Inline IPSEC operation is supported and preferred
-	 */
-	uint8_t op_mode_inline;
+	/** Inline IPSEC operation mode (ODP_IPSEC_OP_MODE_INLINE) support */
+	odp_feature_t op_mode_inline;
 
-	/** Support of pipelined classification (ODP_IPSEC_PIPELINE_CLS) of
-	 *  resulting inbound packets.
-	 *
-	 *  0: Classification of resulting packets is not supported
-	 *  1: Classification of resulting packets is supported
-	 *  2: Classification of resulting packets is supported and preferred
+	/**
+	 * Support of pipelined classification (ODP_IPSEC_PIPELINE_CLS) of
+	 *  resulting inbound packets
 	 */
-	uint8_t pipeline_cls;
+	odp_feature_t pipeline_cls;
 
 	/** Soft expiry limit in seconds support
 	 *
diff --git a/include/odp_api.h b/include/odp_api.h
index 73e5309a..b736fb88 100644
--- a/include/odp_api.h
+++ b/include/odp_api.h
@@ -57,6 +57,7 @@  extern "C" {
 #include <odp/api/spinlock_recursive.h>
 #include <odp/api/rwlock_recursive.h>
 #include <odp/api/std_clib.h>
+#include <odp/api/feature.h>
 #include <odp/api/ipsec.h>
 
 #ifdef __cplusplus
diff --git a/platform/linux-generic/include/odp/api/feature.h b/platform/linux-generic/include/odp/api/feature.h
new file mode 100644
index 00000000..d0aa8179
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/feature.h
@@ -0,0 +1,34 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP feature API - platform specific header
+ */
+
+#ifndef ODP_PLAT_FEATURE_H_
+#define ODP_PLAT_FEATURE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odp_feature
+ *  @{
+ */
+
+/**
+ * @}
+ */
+
+#include <odp/api/spec/feature.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif