From patchwork Sat Apr 15 01:48: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: 97452 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp509560qgf; Fri, 14 Apr 2017 18:49:11 -0700 (PDT) X-Received: by 10.107.142.201 with SMTP id q192mr361196iod.138.1492220951544; Fri, 14 Apr 2017 18:49:11 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w20si4404440iof.24.2017.04.14.18.49.10; Fri, 14 Apr 2017 18:49:11 -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 2459D62E66; Sat, 15 Apr 2017 01:49:10 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id EA47E62DB4; Sat, 15 Apr 2017 01:49:07 +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 AC6BA62CBB; Sat, 15 Apr 2017 01:49:06 +0000 (UTC) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) by lists.linaro.org (Postfix) with ESMTPS id 6732D62CB6 for ; Sat, 15 Apr 2017 01:49:04 +0000 (UTC) Received: by mail-lf0-f45.google.com with SMTP id 75so47324334lfs.2 for ; Fri, 14 Apr 2017 18:49:04 -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=xrQkjwJJcc92XGHqpn4qGlfcXfR5DoXGp6DQs09zGN0=; b=TSr00k3ZHEhadJRukJflin6EWVJrujJrlPNCH+eu9xz0MrG3Vn1Zp0sxdTAvWbyous 77tkI/1QcXPMPI6TUiOXKPqmr1qicfFacI83sfvCS7ZEfHU8bOtf0HH51A/B34c+MgOH dqkywnnfxD+/yWe4hamQ88cIjbB11LjHiOGxVrNxt/Z3roe42mTvgDCXVxOVsIl0YCHh NwMV5cyU2H36s/cdF7jRD+vXz1jUJT8m6PXjXkbDfuhgh1+re5q8lEChFsvJ9QJ2vMeT 3ztH91Mf9IHGPP/Ws+iVdkIswPwPZJncgF4x9DHIlMoS82sAAUXHxEfpETnDdDtN8+UR ReMQ== X-Gm-Message-State: AN3rC/5M1vW99tppLRv7H4G3+xZ2blHB4qvc3DKJ+wnSJnsNxKM+HhhF dvkhXqQlippcbyc2SnRNWfiU X-Received: by 10.46.33.168 with SMTP id h40mr88735lji.52.1492220942844; Fri, 14 Apr 2017 18:49:02 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([188.162.64.63]) by smtp.gmail.com with ESMTPSA id q71sm674844lfe.40.2017.04.14.18.49.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Apr 2017 18:49:02 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Sat, 15 Apr 2017 04:48:58 +0300 Message-Id: <20170415014858.22154-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [API-NEXT v3] 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/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 Reviewed-by: Balasubramanian Manoharan 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/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