From patchwork Sun Nov 12 16:00:04 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: 118664 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp865814qgn; Sun, 12 Nov 2017 08:00:45 -0800 (PST) X-Google-Smtp-Source: AGs4zMbw+8dO9n9pTCe+Hm3fYy0IN0Muow98uSMosY20f2dKRfCALYb+E6pBeNpgA4qtSZCkYxjg X-Received: by 10.55.183.134 with SMTP id h128mr9614344qkf.96.1510502444791; Sun, 12 Nov 2017 08:00:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510502444; cv=none; d=google.com; s=arc-20160816; b=NAoQQmCpTRnH8ch6VZQJm1CN/hTk0/+rarn/Y6gu1G57HUAnRn6q9ELP1hcXzpkRCu FqngyoIiwelLfmjlfQfRPLXWGKUylOmY+Y6phIjkqi63JSi7ThFudQ3aGrz21aKL8dzP ks2viTnz8hnF/uo8hHSl5TzN+3gExCNVHgEPOSvVUJO6/5RCJn8Qr/3eKVFbmcqEy45s ajf7lK7Sff8yArhe1KUe2LHizFO4Pv1CNjfa5eVJ51oWsoUJ2T3HGhcum8a6HnW8Yziu Z3kbFqKD8NJ94dN2zw849JhOQmBJBFk2dEHB3lf+ghzINEZFpIN8V93Cyh8Pjuk9qpCg oxHQ== 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=tAMhSxghjoFDfS9yAhQVaf78bV8Bhjz9p538aaamwc0=; b=Zuu6jI8cZnamKvwQkwBjUr0bcE8BNAM9RloaCpPnCqNALhRC3Om2vMlkF5mVlA9I8e RqFwQ/QSrg/X3WBdUffLTHjDqE/+fgW1N4tlBrEB/3gDnkJIwhsxyhIlVKwTYMvvDHn8 7pdllcEuOappTEOiDnwUpfFg7xpqdxxmZuenHOSC7rYq1Y2mfPHF20d68AyaNp1pMO20 oSwz8bQhdWwyrGVgG1uZkCqV5lPbfwRitVq9fy1U6ATFQ7C7JB7DWv8HsmkLWaPnq+bs gmsRNIYyfD1wRnhBaRzoYWdr44tSXh2KGXHN26o7N+sT5eNCW0mZhICQi+ScLIRqkmnu FpNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 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 (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id o68si14304842qko.430.2017.11.12.08.00.44; Sun, 12 Nov 2017 08:00:44 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 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 6C9E160BF7; Sun, 12 Nov 2017 16:00:44 +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,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 B4B3D60A51; Sun, 12 Nov 2017 16:00:14 +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 7C497609FD; Sun, 12 Nov 2017 16:00:11 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id D73DF607A0 for ; Sun, 12 Nov 2017 16:00:09 +0000 (UTC) Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:168]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 2CC7F134EC04 for ; Sun, 12 Nov 2017 19:00:08 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id VqvYlv4ZZU-08LqNNg8; Sun, 12 Nov 2017 19:00:08 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lXMUguEPPe-07vCkbaf; Sun, 12 Nov 2017 19:00:07 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Sun, 12 Nov 2017 19:00:04 +0300 Message-Id: <1510502406-25607-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510502406-25607-1-git-send-email-odpbot@yandex.ru> References: <1510502406-25607-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 294 Subject: [lng-odp] [PATCH API-NEXT v1 1/3] linux-gen: crypto: drop extra memcpy on result return 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 There is no need to fill local struct and then copy it to packet. Just fill packet data directly, saving one memcpy call. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 294 (lumag:crypto-err-flag) ** https://github.com/Linaro/odp/pull/294 ** Patch: https://github.com/Linaro/odp/pull/294.patch ** Base sha: a908a4dead95321e84d6a8a23de060051dcd8969 ** Merge commit sha: 5a1039aa1f26df3ca3cbb44a047116fe285b5dbc **/ platform/linux-generic/odp_crypto.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index f34863bf2..79be510d4 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -1158,7 +1158,6 @@ int odp_crypto_int(odp_packet_t pkt_in, odp_crypto_alg_err_t rc_cipher = ODP_CRYPTO_ALG_ERR_NONE; odp_crypto_alg_err_t rc_auth = ODP_CRYPTO_ALG_ERR_NONE; odp_crypto_generic_session_t *session; - odp_crypto_packet_result_t local_result; odp_bool_t allocated = false; odp_packet_t out_pkt = *pkt_out; odp_crypto_packet_result_t *op_result; @@ -1204,18 +1203,16 @@ int odp_crypto_int(odp_packet_t pkt_in, } /* Fill in result */ - local_result.cipher_status.alg_err = rc_cipher; - local_result.cipher_status.hw_err = ODP_CRYPTO_HW_ERR_NONE; - local_result.auth_status.alg_err = rc_auth; - local_result.auth_status.hw_err = ODP_CRYPTO_HW_ERR_NONE; - local_result.ok = - (rc_cipher == ODP_CRYPTO_ALG_ERR_NONE) && - (rc_auth == ODP_CRYPTO_ALG_ERR_NONE); - _odp_buffer_event_subtype_set(packet_to_buffer(out_pkt), ODP_EVENT_PACKET_CRYPTO); op_result = get_op_result_from_packet(out_pkt); - *op_result = local_result; + op_result->cipher_status.alg_err = rc_cipher; + op_result->cipher_status.hw_err = ODP_CRYPTO_HW_ERR_NONE; + op_result->auth_status.alg_err = rc_auth; + op_result->auth_status.hw_err = ODP_CRYPTO_HW_ERR_NONE; + op_result->ok = + (rc_cipher == ODP_CRYPTO_ALG_ERR_NONE) && + (rc_auth == ODP_CRYPTO_ALG_ERR_NONE); /* Synchronous, simply return results */ *pkt_out = out_pkt;