diff mbox series

[API-NEXT,v2,4/5] api: ipsec: introduce all_status bitfield covering all error and flags

Message ID 1494288006-2185-4-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v2,1/5] api: ipsec: move soft limits expiration to flags, rather than errors | expand

Commit Message

Github ODP bot May 9, 2017, midnight UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


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 <dmitry.ereminsolenikov@linaro.org>

---
/** 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 mbox series

Patch

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;