From patchwork Mon Apr 17 21:02:58 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: 97514 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1506888qgf; Mon, 17 Apr 2017 14:03:05 -0700 (PDT) X-Received: by 10.237.60.61 with SMTP id t58mr10485761qte.168.1492462985932; Mon, 17 Apr 2017 14:03:05 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a4si11159919qth.327.2017.04.17.14.03.05; Mon, 17 Apr 2017 14:03:05 -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 7586360CE0; Mon, 17 Apr 2017 21:03:05 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5DFE563576; Mon, 17 Apr 2017 21:03:03 +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 1626663551; Mon, 17 Apr 2017 21:03:02 +0000 (UTC) Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) by lists.linaro.org (Postfix) with ESMTPS id C6D8B60CCE for ; Mon, 17 Apr 2017 21:02:59 +0000 (UTC) Received: by mail-lf0-f41.google.com with SMTP id t144so71245217lff.1 for ; Mon, 17 Apr 2017 14:02:59 -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=kKVPFv5OImqzkMedkLUy7Vk1/rJfID9lY2J7WqpWpmA=; b=KueL243QKbu3rmyJOzjtffHfdbQOiW/hBJu7nhNnSaPF6imW2Ia7Tjr7sdeC1bZdtX QZeqKz7BUJMOqM0W5m2xqlHAObkyESfWQEUSR7Wf9JNqi2wWaWBB9pNeSd45NSNHc61g QsqIwk9O5nTgs8dPnp8geGaO/EYbmoh+aV7/KRpSDooUwSBuxclxeGOm4vJStMlC9PfI 55ZGnxHC8S1KuTqMXzVmfGmcD5QwATAEZWEQTsKVW9pALVYghbQ1ZL+UUFZfh0+RZec0 w/PAqVPM0yFQXkj7uoRV8ReRIzTGlxdQxs0J4y3BGdXzsQxIzESgTcT9QfEGRu9dLt/9 o/8g== X-Gm-Message-State: AN3rC/65Han0inJXJ/16Lm98qaA0caQqkU2ksAdYVJhVOU2tgWQKMRFi Ip+XowZXe08z6WBIJRDg/qTy X-Received: by 10.46.83.12 with SMTP id h12mr3239176ljb.84.1492462978260; Mon, 17 Apr 2017 14:02:58 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([94.25.228.248]) by smtp.gmail.com with ESMTPSA id 33sm2158508lfs.16.2017.04.17.14.02.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Apr 2017 14:02:57 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Tue, 18 Apr 2017 00:02:58 +0300 Message-Id: <20170417210258.6920-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [API-NEXT v4] 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/feature.h | 53 ++++++++++++++++++++++++ include/odp/api/spec/ipsec.h | 39 ++++++----------- include/odp_api.h | 1 + platform/Makefile.inc | 1 + platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp/api/feature.h | 34 +++++++++++++++ 6 files changed, 102 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 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 + +#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 +#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 +#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_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 #include #include +#include #include #ifdef __cplusplus diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 874cf887..5a63b24b 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/feature.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..95f6369c 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/feature.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/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 + +#ifdef __cplusplus +} +#endif + +#endif