diff mbox series

[API-NEXT,v3,3/10] api: ipsec: introduce all_status bitfield covering all error and flags

Message ID 1494540010-25779-4-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v3,1/10] api: ipsec: add soft limit expiration event | expand

Commit Message

Github ODP bot May 11, 2017, 10 p.m. 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 28 (lumag:ipsec)
 ** https://github.com/Linaro/odp/pull/28
 ** Patch: https://github.com/Linaro/odp/pull/28.patch
 ** Base sha: 900dd9e2d3d2ae751ab2bc4e11dbd48ea7ed7030
 ** Merge commit sha: 1589f97414ab144b3cb1e65667d311783fdba670
 **/
 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 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;