From patchwork Tue May 16 16: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: 99879 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp2099651qge; Tue, 16 May 2017 09:05:18 -0700 (PDT) X-Received: by 10.55.154.143 with SMTP id c137mr10432007qke.177.1494950718708; Tue, 16 May 2017 09:05:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494950718; cv=none; d=google.com; s=arc-20160816; b=oJGZzBpWm/Rc1BNREZ834oriVAtT9SfPidQnVPwwC7S411pyRwwcQQpo1/gHnTMNvQ ZWHbv1o/9pznytjHUh+Pjk+g6kY/0odE2vNp554h/PP5v/9NR0FrkpGY4OT9zcky85x0 GiinaBkrH6Pex/vDbY6LgObq1GAjzgQCgjn/q9BnwP33r2PeVApDY30fCBR3k5dCJziN p5Q/Kv+gfPkGghA05oQoGaeA9qpW2H8gVr9LW9miYK4Z1z7VMochfTxAK024cZi+miOf Ct2YrlqD/ynKUJZz7tMAOpCH5BUSw/QmPavv2xHx5Fkngxzs41/4EEtnHfVfA1mi514m 5gpQ== 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=g84YEp28uNkjyHwvo0S5WAGZbJvS3cJQLqtuRHBJO2g=; b=Ld/Vra7OaN/bqCscEOZ+kX2ElfsZQDa3rSOkK5wtT/DXJMJ5g9S9x4OqEIjpcXOE7y vxUr0bfc4E6cz1z6Z4KK1TVGN+lRnWKqQWlOnJNaaU7iT+rKqNKC46eLhvDbIk7q4L8M zwVCB/sHgpAn4nxG4J4Oq+HlC/qCLVuEVGBoyiWaq8f4ugmWzuf7tKW5LAWkcAVjoNVi 6Oxg07AFWD4gZoUB1TKiyRinGfXiqrw7GBrzdGNyW5kdfzMqzOKemlZECTwxy50Da3nc eoXT+x2hQmRCzM9XD1p3/8z700Zl4NTZ5Stex1S2FlI8fR6G0r129AagQS0SCtkcIPs2 7oNQ== 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 c6si14077853qtb.60.2017.05.16.09.05.17; Tue, 16 May 2017 09:05:18 -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 427C060B33; Tue, 16 May 2017 16:05:17 +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 2619360B2A; Tue, 16 May 2017 16:02:02 +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 A13AD608E2; Tue, 16 May 2017 16:01:33 +0000 (UTC) Received: from forward1j.cmail.yandex.net (forward1j.cmail.yandex.net [5.255.227.19]) by lists.linaro.org (Postfix) with ESMTPS id 89D2C60B1A for ; Tue, 16 May 2017 16:00:39 +0000 (UTC) Received: from smtp2h.mail.yandex.net (smtp2h.mail.yandex.net [84.201.187.145]) by forward1j.cmail.yandex.net (Yandex) with ESMTP id 13B1D206AC for ; Tue, 16 May 2017 19:00:38 +0300 (MSK) Received: from smtp2h.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2h.mail.yandex.net (Yandex) with ESMTP id CAADA7810CE for ; Tue, 16 May 2017 19:00:37 +0300 (MSK) Received: by smtp2h.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id uvbp18VO5L-0ajCIuHZ; Tue, 16 May 2017 19:00:36 +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: Tue, 16 May 2017 19:00:14 +0300 Message-Id: <1494950422-11135-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494950422-11135-1-git-send-email-odpbot@yandex.ru> References: <1494950422-11135-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 28 Subject: [lng-odp] [PATCH API-NEXT v5 3/11] api: ipsec: introduce all_status bitfield covering all error and flags 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 An expectation would be that an application would check if there is any exceptional status set by checking the all_status field and then further descending on the reason on the particular exception. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 28 (lumag:ipsec) ** https://github.com/Linaro/odp/pull/28 ** Patch: https://github.com/Linaro/odp/pull/28.patch ** Base sha: f4c213cccc49b4b28557506ad19fba49b872d24f ** Merge commit sha: e6ef5a70e5261ee32e5edb33fc7710d103010d95 **/ include/odp/api/spec/ipsec.h | 135 +++++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 63 deletions(-) diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index b1c81b1..103fc39 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -851,71 +851,80 @@ typedef struct odp_ipsec_op_opt_t { #define ODP_IPSEC_OK 0 /** IPSEC operation status */ -typedef struct odp_ipsec_op_status_t { - /** Variant mappings for op status */ - union { - /** Error flags */ - struct { - /** Protocol error. Not a valid ESP or AH packet. */ - uint32_t proto : 1; - - /** SA lookup failed */ - uint32_t sa_lookup : 1; - - /** Authentication failed */ - uint32_t auth : 1; - - /** Anti-replay check failed */ - uint32_t antireplay : 1; - - /** Other algorithm error */ - uint32_t alg : 1; - - /** Packet does not fit into the given MTU size */ - uint32_t mtu : 1; - - /** Soft lifetime expired: seconds */ - uint32_t soft_exp_sec : 1; - - /** Soft lifetime expired: bytes */ - uint32_t soft_exp_bytes : 1; - - /** Soft lifetime expired: packets */ - uint32_t soft_exp_packets : 1; - - /** Hard lifetime expired: seconds */ - uint32_t hard_exp_sec : 1; - - /** Hard lifetime expired: bytes */ - uint32_t hard_exp_bytes : 1; - - /** Hard lifetime expired: packets */ - uint32_t hard_exp_packets : 1; - - } error; - - /** All error bits - * - * This field can be used to set, clear or compare multiple - * flags. For example, 'status.all_error != ODP_IPSEC_OK' - * checks if there are - * any errors. - */ - uint32_t all_error; +typedef union odp_ipsec_op_status_t { + struct { + /** Variant mappings for op status */ + union { + /** Error flags */ + struct { + /** + * Protocol error. Not a valid ESP or AH + * packet. + */ + uint32_t proto : 1; + + /** SA lookup failed */ + uint32_t sa_lookup : 1; + + /** Authentication failed */ + uint32_t auth : 1; + + /** Anti-replay check failed */ + uint32_t antireplay : 1; + + /** Other algorithm error */ + uint32_t alg : 1; + + /** + * Packet does not fit into the given MTU size + */ + uint32_t mtu : 1; + + /** Soft lifetime expired: seconds */ + uint32_t soft_exp_sec : 1; + + /** Soft lifetime expired: bytes */ + uint32_t soft_exp_bytes : 1; + + /** Soft lifetime expired: packets */ + uint32_t soft_exp_packets : 1; + + /** Hard lifetime expired: seconds */ + uint32_t hard_exp_sec : 1; + + /** Hard lifetime expired: bytes */ + uint32_t hard_exp_bytes : 1; + + /** Hard lifetime expired: packets */ + uint32_t hard_exp_packets : 1; + + } error; + + /** All error bits + * + * This field can be used to set, clear or compare + * multiple flags. For example, 'status.all_error != + * ODP_IPSEC_OK' checks if there are any errors. + */ + uint32_t all_error; + }; + + /** Variant mappings for status flags */ + union { + /** Status flags */ + struct { + /** Packet was processed in inline mode */ + uint32_t inline_mode : 1; + + } flag; + + /** All flag bits */ + uint32_t all_flag; + }; }; - /** Variant mappings for status flags */ - union { - /** Status flags */ - struct { - /** Packet was processed in inline mode */ - uint32_t inline_mode : 1; - - } flag; - - /** All flag bits */ - uint32_t all_flag; - }; + /** All status bits */ + uint64_t all_status; } odp_ipsec_op_status_t;