From patchwork Tue May 9 00: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: 98854 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1571791qge; Mon, 8 May 2017 17:02:13 -0700 (PDT) X-Received: by 10.200.35.240 with SMTP id r45mr17155065qtr.233.1494288133317; Mon, 08 May 2017 17:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494288133; cv=none; d=google.com; s=arc-20160816; b=ux1cn89U/Eir9+9+KAPaU7lRXPyj6e5G9cjncQ79QWLDQW9V0FRO0wPVDUgj5algd1 V+cgbZhFGib2h+Kbfv239YR04ocYg5Oo95XwGHdoG7T4cxmOVVJw/2dBP+m3ilNVZU0q bsu+XJop18YY5mzIzd02Dsb/WBIRTNXO73Bgc7iUnfqwpXOKlK04Rm3teZYxQyuJREY9 49WTI4YSf7MUqGDKCGhn4RgssM+7N7L1HHMkloEvjhXO1Mg6vERzkyjR+W3VZZhHT2yB 32OcldurOJ63pQ0CU6rXWk8vXrTlQ6iEwNGYmpsbgAYkjxB3zyX8etl+r1QBnW2nEvZh f4yA== 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=n3GRgT0gt59D1J1zZGKGxa9iFUfAPZR9b0RN6M5rngM=; b=gI3I5aUxOP3T3dj3wlM6wWLa7qhpiayzCd2JzPkw2HanLselQlBq1+M2kVw1XO6k5T NgYIVy/zTvhzTZ1c8AlwDudTzJ/DrdIH5Ec7JIGUehDijxxjgisy3NjMLN4xJvTFbZ2Y fixrzUfI2LcmHdGJXEMfxxpOlSSppXGsTs8NWoKVTXiPA/cva2bV61gexv8GHJ/JGbqD c0WPybPpVeyh70c5L7AbYi6YbUImzgNpJuETWL03MKpzeK9on+FdegwuqNLQ2Lgzl+K4 Z/43mRWIci8UM9RmNtbfq98syDpSVMzVAISTuikCEWgoRh8i+lsVsv7PrefZs2YLw416 LK6A== 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 g190si13726922qkf.118.2017.05.08.17.02.12; Mon, 08 May 2017 17:02:13 -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 38BFA60ACC; Tue, 9 May 2017 00:02:12 +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 31E1C60AED; Tue, 9 May 2017 00:00:55 +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 6FDF66069C; Tue, 9 May 2017 00:00:47 +0000 (UTC) Received: from forward1h.cmail.yandex.net (forward1h.cmail.yandex.net [87.250.230.16]) by lists.linaro.org (Postfix) with ESMTPS id C70506069C for ; Tue, 9 May 2017 00:00:44 +0000 (UTC) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [77.88.29.84]) by forward1h.cmail.yandex.net (Yandex) with ESMTP id 2FFA82071B for ; Tue, 9 May 2017 03:00:43 +0300 (MSK) Received: from smtp1p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1p.mail.yandex.net (Yandex) with ESMTP id 0B95F1780AE2 for ; Tue, 9 May 2017 03:00:42 +0300 (MSK) Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id jXeh2d2q7z-0gh0ZeCW; Tue, 09 May 2017 03:00:42 +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, 9 May 2017 03:00:04 +0300 Message-Id: <1494288006-2185-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494288006-2185-1-git-send-email-odpbot@yandex.ru> References: <1494288006-2185-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 22 Subject: [lng-odp] [PATCH API-NEXT v2 4/5] 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 22 (lumag:ipsec-limits) ** https://github.com/Linaro/odp/pull/22 ** Patch: https://github.com/Linaro/odp/pull/22.patch ** Base sha: 3ea9c1dac34e0fb4785b0d643056c731daa55e85 ** Merge commit sha: 85b927011c941f816b853da7284c0c3a939c5efb **/ 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 26b3389..3a33845 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -839,71 +839,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;