From patchwork Wed Jul 12 14:00:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 107521 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp858105qge; Wed, 12 Jul 2017 07:06:57 -0700 (PDT) X-Received: by 10.237.51.167 with SMTP id v36mr6441155qtd.72.1499868417781; Wed, 12 Jul 2017 07:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499868417; cv=none; d=google.com; s=arc-20160816; b=0gKsgVGeX/d+GV63Yu66hGxeI0t+4Gw/UremTUUeXLn4LX6locDMjDuW4eYBm8S/4o 0CPJDWpDuwQbydKEEkxJwpJvY1nhjwzsSJuZmqIL861zu7hetM9+5cTGmL8Pd8DzAQqr +UL4xXdyDM4fDvnLtujym8WZ3C8mUWYpefMZqG+0FTxh0Hs/1MylAS8Uwny3FttYHxus Rfgt6gdp5Xv4+mrOFuE1ivdxk40S1yDt90ZWhbqpVacAtqK4L1ZCPBMw08AVMQF22AV5 xugtunq36Xu7aQfclms+dEHTZv3cDH11iQozbHMVc3rnT06wuiJ/cpQzzAxjCtel0Wdi 0G+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=f4tu5w6eJHCXLXcNOeQBGhKEaADKuLgr3hLC4aBd5uA=; b=xWjI2Y+k1AGj7qjfge7kepksxBeS7e05jb7cVHg9VdzC3tKAnaFZPXrSUc3f5yDcEv jILcc+JzefV/ruehaLCvL4etz1mZeIfisTQT44lASn+srg4zZDwoMPjG29euglWyO8WE wXwl+me3JEvuR5rsP8B0u70VfHrbvz+2Uq4Dhw0CYCeGOYfE0FBqDHehluC7bfNwWUx9 r/lqlptzi4f8RUCXCTs0o8ABI+wv1oO2UavSxRXpVgHSdSI4o+t6f5UbtvVAi4Yn6BGH 2qvs5S2M8bbIE+hcodw/5bgr4/WgxcrzvuQVS2XrX5aPvKNfZHItAkCK4cHNg4Y1xp+F 84DA== ARC-Authentication-Results: i=1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id t38si2414507qta.166.2017.07.12.07.06.57; Wed, 12 Jul 2017 07:06:57 -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=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 781466091E; Wed, 12 Jul 2017 14:06:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8AB0F644E2; Wed, 12 Jul 2017 14:02:57 +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 86F7660C4E; Wed, 12 Jul 2017 14:02:50 +0000 (UTC) Received: from forward3h.cmail.yandex.net (forward3h.cmail.yandex.net [87.250.230.18]) by lists.linaro.org (Postfix) with ESMTPS id 085AF606B5 for ; Wed, 12 Jul 2017 14:01:06 +0000 (UTC) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [95.108.252.166]) by forward3h.cmail.yandex.net (Yandex) with ESMTP id 917A2214FD for ; Wed, 12 Jul 2017 17:01:04 +0300 (MSK) Received: from smtp4p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp4p.mail.yandex.net (Yandex) with ESMTP id DB0D665012F1 for ; Wed, 12 Jul 2017 17:00:35 +0300 (MSK) Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id blQPLGFwg5-0YJuPCwD; Wed, 12 Jul 2017 17:00:34 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 12 Jul 2017 17:00:14 +0300 Message-Id: <1499868014-26323-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499868014-26323-1-git-send-email-odpbot@yandex.ru> References: <1499868014-26323-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 74 Subject: [lng-odp] [PATCH API-NEXT v2 4/4] api: crypto: revert deprecation of crypto completion API 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" From: Dmitry Eremin-Solenikov It was decided that it would be benefitable to live with both API types at this point, as odp_crypto_compl_t was available for some time. So undeprecate odp_crypto_compl_t and related functionality. Validation tests also provide necessary tests for pref_mode and for completion event. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 74 (lumag:crypto-packet) ** https://github.com/Linaro/odp/pull/74 ** Patch: https://github.com/Linaro/odp/pull/74.patch ** Base sha: ee5be324411a7520528a367967c28fc529d3bc2e ** Merge commit sha: 5411462e6545fa2d6a286a40c2057db97714ee74 **/ include/odp/api/spec/crypto.h | 38 +++++++------------- include/odp/arch/default/api/abi/crypto.h | 4 +-- include/odp/arch/default/api/abi/event.h | 4 +-- .../include/odp/api/plat/crypto_types.h | 3 +- .../include/odp/api/plat/event_types.h | 3 +- platform/linux-generic/odp_crypto.c | 4 --- platform/linux-generic/odp_event.c | 2 -- test/common_plat/performance/odp_crypto.c | 1 + test/common_plat/validation/api/crypto/crypto.c | 2 ++ .../validation/api/crypto/odp_crypto_test_inp.c | 41 +++++++++++++++++++++- .../validation/api/crypto/odp_crypto_test_inp.h | 2 ++ 11 files changed, 61 insertions(+), 43 deletions(-) diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 3e47f3ef..6736214b 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -271,11 +271,8 @@ typedef struct odp_crypto_session_param_t { */ odp_bool_t auth_cipher_text; - /** Preferred sync vs. async - * - * @deprecated no-op now, odp_crypto_operation() will always process - * data in non-posted mode */ - odp_crypto_op_mode_t ODP_DEPRECATE(pref_mode); + /** Preferred sync vs. async for odp_crypto_operation() */ + odp_crypto_op_mode_t pref_mode; /** Operation mode when using packet interface: sync or async */ odp_crypto_op_mode_t op_mode; @@ -340,11 +337,8 @@ typedef struct odp_crypto_op_param_t { /** Session handle from creation */ odp_crypto_session_t session; - /** User context - * - * @deprecated No need to pass context around sync calls - * */ - void *ODP_DEPRECATE(ctx); + /** User context */ + void *ctx; /** Input packet * @@ -504,11 +498,8 @@ typedef struct odp_crypto_op_result { /** Request completed successfully */ odp_bool_t ok; - /** User context from request - * - * @deprecated No need to pass context around sync calls - * */ - void *ODP_DEPRECATE(ctx); + /** User context from request */ + void *ctx; /** Output packet */ odp_packet_t pkt; @@ -692,8 +683,7 @@ int odp_crypto_session_destroy(odp_crypto_session_t session); * * @return crypto completion handle */ -ODP_DEPRECATE(odp_crypto_compl_t) ODP_DEPRECATE(odp_crypto_compl_from_event)( - odp_event_t ev); +odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev); /** * Convert crypto completion handle to event handle @@ -702,16 +692,14 @@ ODP_DEPRECATE(odp_crypto_compl_t) ODP_DEPRECATE(odp_crypto_compl_from_event)( * * @return Event handle */ -odp_event_t ODP_DEPRECATE(odp_crypto_compl_to_event)( - ODP_DEPRECATE(odp_crypto_compl_t) completion_event); +odp_event_t odp_crypto_compl_to_event(odp_crypto_compl_t completion_event); /** * Release crypto completion event * * @param completion_event Completion event we are done accessing */ -void ODP_DEPRECATE(odp_crypto_compl_free)( - ODP_DEPRECATE(odp_crypto_compl_t) completion_event); +void odp_crypto_compl_free(odp_crypto_compl_t completion_event); /** * Crypto per packet operation @@ -739,9 +727,8 @@ int odp_crypto_operation(odp_crypto_op_param_t *param, * @param completion_event Event containing operation results * @param result Pointer to result structure */ -void ODP_DEPRECATE(odp_crypto_compl_result)( - ODP_DEPRECATE(odp_crypto_compl_t) completion_event, - odp_crypto_op_result_t *result); +void odp_crypto_compl_result(odp_crypto_compl_t completion_event, + odp_crypto_op_result_t *result); /** * Get printable value for an odp_crypto_session_t @@ -767,8 +754,7 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl); * to enable applications to generate a printable value that represents * an odp_crypto_compl_t handle. */ -uint64_t ODP_DEPRECATE(odp_crypto_compl_to_u64)( - ODP_DEPRECATE(odp_crypto_compl_t) hdl); +uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl); /** * Initialize crypto session parameters diff --git a/include/odp/arch/default/api/abi/crypto.h b/include/odp/arch/default/api/abi/crypto.h index 2d02eee6..f0793a19 100644 --- a/include/odp/arch/default/api/abi/crypto.h +++ b/include/odp/arch/default/api/abi/crypto.h @@ -11,8 +11,6 @@ extern "C" { #endif -#include - #include /** @internal Dummy type for strong typing */ @@ -25,7 +23,7 @@ typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_crypto_compl_t; #define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL) typedef uint64_t odp_crypto_session_t; -typedef _odp_abi_crypto_compl_t *ODP_DEPRECATE(odp_crypto_compl_t); +typedef _odp_abi_crypto_compl_t *odp_crypto_compl_t; /** * @} diff --git a/include/odp/arch/default/api/abi/event.h b/include/odp/arch/default/api/abi/event.h index 871d2cf9..f86d8e27 100644 --- a/include/odp/arch/default/api/abi/event.h +++ b/include/odp/arch/default/api/abi/event.h @@ -11,8 +11,6 @@ extern "C" { #endif -#include - #include /** @internal Dummy type for strong typing */ @@ -30,7 +28,7 @@ typedef enum odp_event_type_t { ODP_EVENT_BUFFER = 1, ODP_EVENT_PACKET = 2, ODP_EVENT_TIMEOUT = 3, - ODP_DEPRECATE(ODP_EVENT_CRYPTO_COMPL) = 4, + ODP_EVENT_CRYPTO_COMPL = 4, ODP_EVENT_IPSEC_STATUS = 5 } odp_event_type_t; diff --git a/platform/linux-generic/include/odp/api/plat/crypto_types.h b/platform/linux-generic/include/odp/api/plat/crypto_types.h index 23e1cc42..2cc747eb 100644 --- a/platform/linux-generic/include/odp/api/plat/crypto_types.h +++ b/platform/linux-generic/include/odp/api/plat/crypto_types.h @@ -22,7 +22,6 @@ extern "C" { #if ODP_ABI_COMPAT == 1 #include #else -#include /** @ingroup odp_crypto * @{ @@ -31,7 +30,7 @@ extern "C" { #define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL) typedef uint64_t odp_crypto_session_t; -typedef ODP_HANDLE_T(ODP_DEPRECATE(odp_crypto_compl_t)); +typedef ODP_HANDLE_T(odp_crypto_compl_t); /** * @} diff --git a/platform/linux-generic/include/odp/api/plat/event_types.h b/platform/linux-generic/include/odp/api/plat/event_types.h index 58ce0a8b..4d0efff1 100644 --- a/platform/linux-generic/include/odp/api/plat/event_types.h +++ b/platform/linux-generic/include/odp/api/plat/event_types.h @@ -23,7 +23,6 @@ extern "C" { #include #else -#include #include #include @@ -39,7 +38,7 @@ typedef enum odp_event_type_t { ODP_EVENT_BUFFER = 1, ODP_EVENT_PACKET = 2, ODP_EVENT_TIMEOUT = 3, - ODP_DEPRECATE(ODP_EVENT_CRYPTO_COMPL) = 4, + ODP_EVENT_CRYPTO_COMPL = 4, ODP_EVENT_IPSEC_STATUS = 5 } odp_event_type_t; diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 80ff6f59..ca51bdf0 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -881,9 +881,7 @@ odp_crypto_operation(odp_crypto_op_param_t *param, ODP_EVENT_PACKET_BASIC); /* Fill in result */ -#if ODP_DEPRECATED_API local_result.ctx = param->ctx; -#endif local_result.pkt = out_pkt; local_result.cipher_status = packet_result.cipher_status; local_result.auth_status = packet_result.auth_status; @@ -1030,7 +1028,6 @@ int32_t odp_random_test_data(uint8_t *buf, uint32_t len, uint64_t *seed) return len; } -#if ODP_DEPRECATED_API odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ @@ -1067,7 +1064,6 @@ uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl) { return _odp_pri(hdl); } -#endif void odp_crypto_session_param_init(odp_crypto_session_param_t *param) { diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index 56cc90b0..23b410d8 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -46,11 +46,9 @@ void odp_event_free(odp_event_t event) case ODP_EVENT_TIMEOUT: odp_timeout_free(odp_timeout_from_event(event)); break; -#if ODP_DEPRECATED_API case ODP_EVENT_CRYPTO_COMPL: odp_crypto_compl_free(odp_crypto_compl_from_event(event)); break; -#endif default: ODP_ABORT("Invalid event type: %d\n", odp_event_type(event)); } diff --git a/test/common_plat/performance/odp_crypto.c b/test/common_plat/performance/odp_crypto.c index 27d4fd30..7a25ffdc 100644 --- a/test/common_plat/performance/odp_crypto.c +++ b/test/common_plat/performance/odp_crypto.c @@ -427,6 +427,7 @@ create_session_from_config(odp_crypto_session_t *session, odp_crypto_session_param_init(¶ms); memcpy(¶ms, &config->session, sizeof(odp_crypto_session_param_t)); params.op = ODP_CRYPTO_OP_ENCODE; + params.pref_mode = ODP_CRYPTO_SYNC; /* Lookup the packet pool */ pkt_pool = odp_pool_lookup("packet_pool"); diff --git a/test/common_plat/validation/api/crypto/crypto.c b/test/common_plat/validation/api/crypto/crypto.c index 8a6c20ec..04ca527d 100644 --- a/test/common_plat/validation/api/crypto/crypto.c +++ b/test/common_plat/validation/api/crypto/crypto.c @@ -15,6 +15,8 @@ odp_suiteinfo_t crypto_suites[] = { {ODP_CRYPTO_SYNC_INP, crypto_suite_sync_init, crypto_suite_term, crypto_suite}, + {ODP_CRYPTO_ASYNC_INP, crypto_suite_async_init, + crypto_suite_term, crypto_suite}, {ODP_CRYPTO_PACKET_SYNC_INP, crypto_suite_packet_sync_init, crypto_suite_term, crypto_suite}, {ODP_CRYPTO_PACKET_ASYNC_INP, crypto_suite_packet_async_init, diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c index ac59744f..953fef02 100644 --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c @@ -16,6 +16,7 @@ struct suite_context_s { odp_bool_t packet; odp_crypto_op_mode_t op_mode; + odp_crypto_op_mode_t pref_mode; odp_pool_t pool; odp_queue_t queue; }; @@ -81,6 +82,7 @@ static int alg_op(odp_packet_t pkt, op_params.session = session; op_params.pkt = pkt; op_params.out_pkt = pkt; + op_params.ctx = (void *)0xdeadbeef; if (cipher_range) { op_params.cipher_range = *cipher_range; @@ -109,8 +111,30 @@ static int alg_op(odp_packet_t pkt, return rc; } - CU_ASSERT(posted == 0); + if (posted) { + odp_event_t event; + odp_crypto_compl_t compl_event; + + /* Poll completion queue for results */ + do { + event = odp_queue_deq(suite_context.queue); + } while (event == ODP_EVENT_INVALID); + + CU_ASSERT(ODP_EVENT_CRYPTO_COMPL == odp_event_type(event)); + CU_ASSERT(ODP_EVENT_NO_SUBTYPE == odp_event_subtype(event)); + CU_ASSERT(ODP_EVENT_CRYPTO_COMPL == + odp_event_types(event, &subtype)); + CU_ASSERT(ODP_EVENT_NO_SUBTYPE == subtype); + + compl_event = odp_crypto_compl_from_event(event); + CU_ASSERT(odp_crypto_compl_to_u64(compl_event) == + odp_crypto_compl_to_u64(odp_crypto_compl_from_event(event))); + odp_crypto_compl_result(compl_event, &result); + odp_crypto_compl_free(compl_event); + } + CU_ASSERT(result.pkt == pkt); + CU_ASSERT(result.ctx == (void *)0xdeadbeef); CU_ASSERT(ODP_EVENT_PACKET == odp_event_type(odp_packet_to_event(result.pkt))); CU_ASSERT(ODP_EVENT_PACKET_BASIC == @@ -403,6 +427,7 @@ static void alg_test(odp_crypto_op_t op, ses_params.op = op; ses_params.auth_cipher_text = false; ses_params.op_mode = suite_context.op_mode; + ses_params.pref_mode = suite_context.pref_mode; ses_params.cipher_alg = cipher_alg; ses_params.auth_alg = auth_alg; ses_params.compl_queue = suite_context.queue; @@ -1678,6 +1703,20 @@ int crypto_suite_sync_init(void) return -1; suite_context.queue = ODP_QUEUE_INVALID; + suite_context.pref_mode = ODP_CRYPTO_SYNC; + return 0; +} + +int crypto_suite_async_init(void) +{ + suite_context.pool = odp_pool_lookup("packet_pool"); + if (suite_context.pool == ODP_POOL_INVALID) + return -1; + suite_context.queue = odp_queue_lookup("crypto-out"); + if (suite_context.queue == ODP_QUEUE_INVALID) + return -1; + + suite_context.pref_mode = ODP_CRYPTO_ASYNC; return 0; } diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.h b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.h index 2bc77a94..c50b8493 100644 --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.h +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.h @@ -10,6 +10,7 @@ /* Suite names */ #define ODP_CRYPTO_SYNC_INP "odp_crypto_sync_inp" +#define ODP_CRYPTO_ASYNC_INP "odp_crypto_async_inp" #define ODP_CRYPTO_PACKET_SYNC_INP "odp_crypto_packet_sync_inp" #define ODP_CRYPTO_PACKET_ASYNC_INP "odp_crypto_packet_async_inp" @@ -17,6 +18,7 @@ extern odp_testinfo_t crypto_suite[]; int crypto_suite_sync_init(void); +int crypto_suite_async_init(void); int crypto_suite_packet_sync_init(void); int crypto_suite_packet_async_init(void); int crypto_suite_term(void);