From patchwork Fri Dec 12 22:40:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 42201 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F086926C77 for ; Fri, 12 Dec 2014 22:41:04 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf1774015wiv.5 for ; Fri, 12 Dec 2014 14:41:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=yKFB2l8+rGUR3Cx9Wv0Fy/M38yhDMAArW83mip5k71I=; b=fEX6dHpTcaXAboGK3NILn2PcmVx8U6UDjoEMAILQidC7C/N37UHvj3HApnICh674B8 aI4RQigWh17RnCg1+4amroSp7ELBAToShYldXPQiLaIHXxqj/hEGsjqirtBwE8McdG4w Ukga3GFDnGubDe497O9+w2TyCdc/b7/tqEtFRHYCBZbDkSxVLjgIli+V2Oi7h1r6pFWZ p3E19CbzqcxqVpkMZV1W+3+HemIStn/p6FAjSg0ydB+gnZbmE8+9395aqInM970YosYi FI1MTtAMgK8Ae8hiqhAitoEnRVGEZ6hzCFeigBlHx0rVxBAy1pLR6pfMItwB3F64hgXR MecQ== X-Gm-Message-State: ALoCoQmfVx1qaoemGcZu5slpYtdj4paREknKAnPOVNtm3GCPOaYjBYuWT5by4hfrA2kMX73kldx8 X-Received: by 10.180.24.35 with SMTP id r3mr1078183wif.0.1418424064284; Fri, 12 Dec 2014 14:41:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.226 with SMTP id kt2ls498112lac.52.gmail; Fri, 12 Dec 2014 14:41:04 -0800 (PST) X-Received: by 10.112.132.2 with SMTP id oq2mr17879758lbb.11.1418424064032; Fri, 12 Dec 2014 14:41:04 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id j9si2796081lam.35.2014.12.12.14.41.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Dec 2014 14:41:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so7430513lbj.9 for ; Fri, 12 Dec 2014 14:41:03 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr17923706lal.29.1418424063919; Fri, 12 Dec 2014 14:41:03 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp116679lbb; Fri, 12 Dec 2014 14:41:03 -0800 (PST) X-Received: by 10.224.4.133 with SMTP id 5mr35487215qar.37.1418424062421; Fri, 12 Dec 2014 14:41:02 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id z2si3064254qad.91.2014.12.12.14.41.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 12 Dec 2014 14:41:02 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XzYtP-0001f4-Ur; Fri, 12 Dec 2014 22:40:59 +0000 Received: from mail-lb0-f175.google.com ([209.85.217.175]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XzYt9-0001at-Ie for lng-odp@lists.linaro.org; Fri, 12 Dec 2014 22:40:43 +0000 Received: by mail-lb0-f175.google.com with SMTP id u10so6540873lbd.6 for ; Fri, 12 Dec 2014 14:40:38 -0800 (PST) X-Received: by 10.112.141.233 with SMTP id rr9mr17932420lbb.1.1418424037923; Fri, 12 Dec 2014 14:40:37 -0800 (PST) Received: from localhost.localdomain ([80.77.38.170]) by mx.google.com with ESMTPSA id kt7sm745502lac.4.2014.12.12.14.40.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Dec 2014 14:40:37 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org, robking@cisco.com Date: Sat, 13 Dec 2014 00:40:25 +0200 Message-Id: <1418424026-4526-3-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418424026-4526-1-git-send-email-taras.kondratiuk@linaro.org> References: <1418424026-4526-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: crypto patch Subject: [lng-odp] [PATCH 2/3] linux-generic: crypto: implement completion event context X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Taras Kondratiuk --- .../linux-generic/include/odp_crypto_internal.h | 1 + platform/linux-generic/odp_crypto.c | 28 +++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/include/odp_crypto_internal.h b/platform/linux-generic/include/odp_crypto_internal.h index 04db333..6ecfe80 100644 --- a/platform/linux-generic/include/odp_crypto_internal.h +++ b/platform/linux-generic/include/odp_crypto_internal.h @@ -69,6 +69,7 @@ typedef struct odp_crypto_generic_op_result { uint32_t magic; odp_crypto_compl_status_t cipher; odp_crypto_compl_status_t auth; + void* op_context; } odp_crypto_generic_op_result_t; /** diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index a2d4ab8..e605d59 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -446,17 +446,33 @@ odp_crypto_get_operation_compl_status(odp_buffer_t completion_event, void -odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event ODP_UNUSED, - void *ctx ODP_UNUSED) +odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event, + void *ctx) { - ODP_UNIMPLEMENTED(); + odp_crypto_generic_op_result_t *result; + + result = get_op_result_from_buffer(completion_event); + /* + * Completion event magic can't be checked here, because it is filled + * later in odp_crypto_operation() function. + */ + ODP_ASSERT(odp_buffer_type(completion_event == ODP_BUFFER_TYPE_PACKET), + "Completion is not a packet"); + + result->op_context = ctx; } void -*odp_crypto_get_operation_compl_ctx(odp_buffer_t completion_event ODP_UNUSED) +*odp_crypto_get_operation_compl_ctx(odp_buffer_t completion_event) { - ODP_UNIMPLEMENTED(); - return NULL; + odp_crypto_generic_op_result_t *result; + + result = get_op_result_from_buffer(completion_event); + ODP_ASSERT(OP_RESULT_MAGIC == result->magic, "Bad completion magic"); + ODP_ASSERT(odp_buffer_type(completion_event == ODP_BUFFER_TYPE_PACKET), + "Completion is not a packet"); + + return result->op_context; } odp_packet_t