From patchwork Wed Apr 19 13:41:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 97640 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp329779qgf; Wed, 19 Apr 2017 06:41:44 -0700 (PDT) X-Received: by 10.36.46.69 with SMTP id i66mr3091041ita.59.1492609304596; Wed, 19 Apr 2017 06:41:44 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m70si15010214itg.58.2017.04.19.06.41.43; Wed, 19 Apr 2017 06:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id ACCDF62F99; Wed, 19 Apr 2017 13:41:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8903862D43; Wed, 19 Apr 2017 13:41:41 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9AF6262D54; Wed, 19 Apr 2017 13:41:39 +0000 (UTC) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) by lists.linaro.org (Postfix) with ESMTPS id 57AEC62D33 for ; Wed, 19 Apr 2017 13:41:37 +0000 (UTC) Received: by mail-lf0-f52.google.com with SMTP id 88so12659726lfr.0 for ; Wed, 19 Apr 2017 06:41:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=kdWyj0mV/cmyxTKcqunwbYJnmXUoQmZ80k17h0ImuAY=; b=QbwJWwfRXhZSW8R+fVp/P6JVedp45/FzhkWkBP2r9/ObuL6WHoFUNeI5bY1QXHv/ap 5YS/4TfHTE2tsveQ39eb+U8K1Dwi5KffGMR3rhEGJFMLJFyokZ6olxo1appD30eILO/F bQSpgoJRwQP17hI7DwcERawrVXvrkgpEml/+SCNGaiNgILA4XHnRgW/7g+oXjlcsS8Bb R/xJ8IcBxeLZPKBJB4gMYeFcvtS5nwLe6V2A24BLSOlT5/PR8zlL4VcsRfy4Dnp8LES7 /jAERieWEouz2PEHx9CcYtevoV3Kk3qgwHw247pZoqgYbQch0h9DB/9Nk4AS7CrMrlSS sXGA== X-Gm-Message-State: AN3rC/7nP1iCxnEKcWcaGDH6cpRAW/L9uevZpm/A+goJHx/O3Ip8ky06 3nHPhcGaQEQ4EgapxHMO7id9 X-Received: by 10.25.79.4 with SMTP id d4mr1099816lfb.122.1492609295786; Wed, 19 Apr 2017 06:41:35 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([188.162.65.18]) by smtp.gmail.com with ESMTPSA id m16sm435560lfj.57.2017.04.19.06.41.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 06:41:35 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Wed, 19 Apr 2017 16:41:27 +0300 Message-Id: <20170419134127.24269-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [API-NEXT v5] api: ipsec: factor out definitions for feature support levels X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" 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 --- include/odp/api/spec/ipsec.h | 39 +++++----------- include/odp/api/spec/support.h | 57 ++++++++++++++++++++++++ include/odp_api.h | 1 + platform/Makefile.inc | 1 + platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp/api/support.h | 34 ++++++++++++++ 6 files changed, 106 insertions(+), 27 deletions(-) create mode 100644 include/odp/api/spec/support.h create mode 100644 platform/linux-generic/include/odp/api/support.h -- 2.11.0 Reviewed-by: Petri Savolainen diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index a0ceb11a..ecbf38c6 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -19,6 +19,7 @@ extern "C" { #endif #include +#include #include #include @@ -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_support_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_support_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_support_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_support_t pipeline_cls; /** Soft expiry limit in seconds support * diff --git a/include/odp/api/spec/support.h b/include/odp/api/spec/support.h new file mode 100644 index 00000000..cc43b6f0 --- /dev/null +++ b/include/odp/api/spec/support.h @@ -0,0 +1,57 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP support API + */ + +#ifndef ODP_API_SUPPORT_H_ +#define ODP_API_SUPPORT_H_ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup odp_support ODP support + * Common API + * @{ + */ + +/** + * ODP support support + * + * Support levels are specified in the relative order, where ODP_SUPPORT_NO is + * the lowest level. E.g. if the examined support level is greater than + * ODP_SUPPORT_NO, the feature is supported in some form. + */ +typedef enum odp_support_t { + /** + * Feature is not supported + */ + ODP_SUPPORT_NO = 0, + /** + * Feature is supported + */ + ODP_SUPPORT_YES, + /** + * Feature is supported and preferred + */ + ODP_SUPPORT_PREFERRED +} odp_support_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/include/odp_api.h b/include/odp_api.h index 73e5309a..e3ffcb1e 100644 --- a/include/odp_api.h +++ b/include/odp_api.h @@ -57,6 +57,7 @@ extern "C" { #include #include #include +#include #include #ifdef __cplusplus diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 874cf887..b4cc2433 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -31,6 +31,7 @@ odpapispecinclude_HEADERS = \ $(top_srcdir)/include/odp/api/spec/debug.h \ $(top_srcdir)/include/odp/api/spec/errno.h \ $(top_srcdir)/include/odp/api/spec/event.h \ + $(top_srcdir)/include/odp/api/spec/support.h \ $(top_srcdir)/include/odp/api/spec/hash.h \ $(top_srcdir)/include/odp/api/spec/hints.h \ $(top_srcdir)/include/odp/api/spec/init.h \ diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 0d5299cb..3257d261 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -37,6 +37,7 @@ odpapiinclude_HEADERS = \ $(srcdir)/include/odp/api/debug.h \ $(srcdir)/include/odp/api/errno.h \ $(srcdir)/include/odp/api/event.h \ + $(srcdir)/include/odp/api/support.h \ $(srcdir)/include/odp/api/hash.h \ $(srcdir)/include/odp/api/hints.h \ $(srcdir)/include/odp/api/init.h \ diff --git a/platform/linux-generic/include/odp/api/support.h b/platform/linux-generic/include/odp/api/support.h new file mode 100644 index 00000000..dd6abab2 --- /dev/null +++ b/platform/linux-generic/include/odp/api/support.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP support API - platform specific header + */ + +#ifndef ODP_PLAT_SUPPORT_H_ +#define ODP_PLAT_SUPPORT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup odp_support + * @{ + */ + +/** + * @} + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif