From patchwork Sat Jul 1 10:00:01 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: 106803 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3319296qge; Sat, 1 Jul 2017 03:01:50 -0700 (PDT) X-Received: by 10.55.118.66 with SMTP id r63mr29782852qkc.234.1498903310030; Sat, 01 Jul 2017 03:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498903310; cv=none; d=google.com; s=arc-20160816; b=hhEKoM1iRYcbzgOOPjKjXYjeL5qyM0F4UMKIJTR6796/FIHGaL4eQaARynpgBticJx PJGmJwz4VD3IYIEFESjJbg7D6S7gF4Y5gu0pcqRaadrhWHmiyBfT86ck9Mwital1K6J0 4zDs2YzSjkVGXqFCZ9SkiJHiI7eUcviw5tkLG9PS8N9LCBcKeFM+i448rF66wEwX5EfY dtcFPx2w28xOVByHUZ+12E4R9mady3y/WROJMOqe7wPnTZ6URFNFMxD5EFN7jRe3iI2W rCnGqfL+djWJ9+A3nMzPBFu9yWX/5XNI6g2sCM4/nWmoOxEjN68tbIqC4d0BkKzp1OcD Ie3g== 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=QSGY7t9YIKR8raRp0AqJ9jutT0HzuitoQWPJfCQm4ls=; b=iWWlUn9VMseQLB39ZqTryBHDohfCVm/m1rcaiABvL1FTiKpX7G/w20LweC6rvWtu8D m6hyFB9+Q0ffAwx9qyNyeENtxEHLaLaYN7kF7CHrriVFXJwWEptKjo1wPHMwZnLCs48f C7FPZfjRdZIDm/9QAFQON9ROXqPWVIueZJuX42vSed6/mVLYUL/i+s6xaNrCUPgCo5p7 TUQyqLzUVHHKVBOm4DMCY422gy9SKA04f860PVC5K4PTlCq3YeL74Xpdoe8nsltqOZWU 9MquwJyPo4zMm0SEJN5cUEZyhE6vqbMitMn1y3rBCL8cKGRFa5LGjxi0CFGZ1Fz0K5pF ozfg== 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 z188si6689509qke.98.2017.07.01.03.01.49; Sat, 01 Jul 2017 03:01:50 -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 A8C2862DFD; Sat, 1 Jul 2017 10:01:49 +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 4AF6260981; Sat, 1 Jul 2017 10:00:25 +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 DF4EE608FC; Sat, 1 Jul 2017 10:00:19 +0000 (UTC) Received: from forward5j.cmail.yandex.net (forward5j.cmail.yandex.net [5.255.227.23]) by lists.linaro.org (Postfix) with ESMTPS id E191260656 for ; Sat, 1 Jul 2017 10:00:15 +0000 (UTC) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b6:7]) by forward5j.cmail.yandex.net (Yandex) with ESMTP id 9F28920BB5 for ; Sat, 1 Jul 2017 13:00:14 +0300 (MSK) Received: from smtp2p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2p.mail.yandex.net (Yandex) with ESMTP id 707F61A80057 for ; Sat, 1 Jul 2017 13:00:13 +0300 (MSK) Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id qX4dfs6pfd-0DfqXRkX; Sat, 01 Jul 2017 13:00:13 +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: Sat, 1 Jul 2017 13:00:01 +0300 Message-Id: <1498903208-7527-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1498903208-7527-1-git-send-email-odpbot@yandex.ru> References: <1498903208-7527-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 64 Subject: [lng-odp] [PATCH API-NEXT v5 3/10] api: crypto: drop async mode support 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 Current Crypto API provides a way to set the 'preferred' mode of operation, without actually telling if the operation will proceed in sync or async mode. In preparation of reworking crypto API declare that all operations always end up processed in sync mode (posted == FALSE). Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 64 (lumag:crypto-packet) ** https://github.com/Linaro/odp/pull/64 ** Patch: https://github.com/Linaro/odp/pull/64.patch ** Base sha: 7a5813042d58598e1c66243d8cfed548302edfc4 ** Merge commit sha: 503ae4dbca9c82be6657b05369d23a484ef0cba8 **/ include/odp/api/spec/crypto.h | 10 ++-- .../linux-generic/include/odp_crypto_internal.h | 8 --- .../linux-generic/include/odp_packet_internal.h | 4 -- platform/linux-generic/odp_crypto.c | 61 +++++----------------- platform/linux-generic/odp_packet.c | 1 - 5 files changed, 16 insertions(+), 68 deletions(-) diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 470cba05..01b15d6b 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -640,14 +640,12 @@ void odp_crypto_compl_free(odp_crypto_compl_t completion_event); * Crypto per packet operation * * Performs the cryptographic operations specified during session creation - * on the packet. If the operation is performed synchronously, "posted" - * will return FALSE and the result of the operation is immediately available. - * If "posted" returns TRUE the result will be delivered via the completion - * queue specified when the session was created. + * on the packet. The operation is performed synchronously, the result of the + * operation is immediately available. * * @param param Operation parameters - * @param posted Pointer to return posted, TRUE for async operation - * @param result Results of operation (when posted returns FALSE) + * @param posted Always returns FALSE + * @param result Results of operation * * @retval 0 on success * @retval <0 on failure diff --git a/platform/linux-generic/include/odp_crypto_internal.h b/platform/linux-generic/include/odp_crypto_internal.h index c3b70b23..52b94d07 100644 --- a/platform/linux-generic/include/odp_crypto_internal.h +++ b/platform/linux-generic/include/odp_crypto_internal.h @@ -56,14 +56,6 @@ struct odp_crypto_generic_session { }; /** - * Per packet operation result - */ -typedef struct odp_crypto_generic_op_result { - uint32_t magic; - odp_crypto_op_result_t result; -} odp_crypto_generic_op_result_t; - -/** * Per session creation operation result */ typedef struct odp_crypto_generic_session_result { diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index cdd139bb..9f28fc05 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -128,9 +128,6 @@ typedef struct { /* Classifier destination queue */ odp_queue_t dst_queue; - /* Result for crypto */ - odp_crypto_generic_op_result_t op_result; - /* Packet data storage */ uint8_t data[0]; } odp_packet_hdr_t; @@ -171,7 +168,6 @@ static inline void copy_packet_cls_metadata(odp_packet_hdr_t *src_hdr, dst_hdr->dst_queue = src_hdr->dst_queue; dst_hdr->flow_hash = src_hdr->flow_hash; dst_hdr->timestamp = src_hdr->timestamp; - dst_hdr->op_result = src_hdr->op_result; } static inline void pull_tail(odp_packet_hdr_t *pkt_hdr, uint32_t len) diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 0e2adad1..b23b5b6b 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -88,14 +88,6 @@ struct odp_crypto_global_s { static odp_crypto_global_t *global; static -odp_crypto_generic_op_result_t *get_op_result_from_event(odp_event_t ev) -{ - odp_packet_hdr_t *hdr = odp_packet_hdr(odp_packet_from_event(ev)); - - return &hdr->op_result; -} - -static odp_crypto_generic_session_t *alloc_session(void) { odp_crypto_generic_session_t *session = NULL; @@ -903,37 +895,14 @@ odp_crypto_operation(odp_crypto_op_param_t *param, (rc_cipher == ODP_CRYPTO_ALG_ERR_NONE) && (rc_auth == ODP_CRYPTO_ALG_ERR_NONE); - /* If specified during creation post event to completion queue */ - if (ODP_QUEUE_INVALID != session->p.compl_queue) { - odp_event_t completion_event; - odp_crypto_generic_op_result_t *op_result; - odp_buffer_t buf; - - /* Linux generic will always use packet for completion event */ - completion_event = odp_packet_to_event(param->out_pkt); - buf = odp_buffer_from_event(completion_event); - _odp_buffer_event_type_set(buf, ODP_EVENT_CRYPTO_COMPL); - _odp_buffer_event_subtype_set(buf, ODP_EVENT_NO_SUBTYPE); - /* Asynchronous, build result (no HW so no errors) and send it*/ - op_result = get_op_result_from_event(completion_event); - op_result->magic = OP_RESULT_MAGIC; - op_result->result = local_result; - if (odp_queue_enq(session->p.compl_queue, completion_event)) { - odp_event_free(completion_event); - goto err; - } + /* Synchronous, simply return results */ + if (!result) + goto err; + *result = local_result; - /* Indicate to caller operation was async */ - *posted = 1; - } else { - /* Synchronous, simply return results */ - if (!result) - goto err; - *result = local_result; + /* Indicate to caller operation was sync */ + *posted = 0; - /* Indicate to caller operation was sync */ - *posted = 0; - } return 0; err: @@ -1093,25 +1062,19 @@ void odp_crypto_compl_result(odp_crypto_compl_t completion_event, odp_crypto_op_result_t *result) { - odp_event_t ev = odp_crypto_compl_to_event(completion_event); - odp_crypto_generic_op_result_t *op_result; + (void)completion_event; + (void)result; - op_result = get_op_result_from_event(ev); - - if (OP_RESULT_MAGIC != op_result->magic) - ODP_ABORT(); - - memcpy(result, &op_result->result, sizeof(*result)); + /* We won't get such events anyway, so there can be no result */ + ODP_ASSERT(0); } void odp_crypto_compl_free(odp_crypto_compl_t completion_event) { - odp_buffer_t buf = - odp_buffer_from_event((odp_event_t)completion_event); + odp_event_t ev = odp_crypto_compl_to_event(completion_event); - _odp_buffer_event_type_set(buf, ODP_EVENT_PACKET); - _odp_buffer_event_subtype_set(buf, ODP_EVENT_PACKET_BASIC); + odp_buffer_free(odp_buffer_from_event(ev)); } void odp_crypto_session_param_init(odp_crypto_session_param_t *param) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 3789feca..22358438 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -166,7 +166,6 @@ static inline void packet_seg_copy_md(odp_packet_hdr_t *dst, dst->dst_queue = src->dst_queue; dst->flow_hash = src->flow_hash; dst->timestamp = src->timestamp; - dst->op_result = src->op_result; /* buffer header side packet metadata */ dst->buf_hdr.buf_u64 = src->buf_hdr.buf_u64;