diff mbox series

[API-NEXT,v8,1/2] api: packet: separate checksum check flags

Message ID 1513033216-731-2-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v8,1/2] api: packet: separate checksum check flags | expand

Commit Message

Github ODP bot Dec. 11, 2017, 11 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Separate union controlling different checksum checks. It will be used by
IPsec API.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 630d8422564ebf4991b468cb38a29e9483fc2ec2
 ** Merge commit sha: 0fe38b26ae32c0f63255268251af6908304afa45
 **/
 include/odp/api/spec/packet.h       | 46 +++++++++++++++++++++----------------
 test/validation/api/packet/packet.c | 10 ++++----
 2 files changed, 31 insertions(+), 25 deletions(-)
diff mbox series

Patch

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index b897c9d3c..02c770f21 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1178,6 +1178,31 @@  int odp_packet_move_data(odp_packet_t pkt, uint32_t dst_offset,
  *
  */
 
+/**
+ * Flags to control packet data checksum checking
+ */
+typedef union odp_proto_chksums_t {
+	/** Individual checksum bits. */
+	struct {
+		/** IPv4 header checksum */
+		uint32_t ipv4   : 1;
+
+		/** UDP checksum */
+		uint32_t udp    : 1;
+
+		/** TCP checksum */
+		uint32_t tcp    : 1;
+
+		/** SCTP checksum */
+		uint32_t sctp   : 1;
+
+	} chksum;
+
+	/** All checksum bits. This can be used to set/clear all flags. */
+	uint32_t all_chksum;
+
+} odp_proto_chksums_t;
+
 /**
  * Packet parse parameters
  */
@@ -1194,26 +1219,7 @@  typedef struct odp_packet_parse_param_t {
 	 *  layer. Checksum checking status can be queried for each packet with
 	 *  odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status().
 	 */
-	union {
-		/** Individual check bits. */
-		struct {
-			/** Check IPv4 header checksum */
-			uint32_t ipv4_chksum   : 1;
-
-			/** Check UDP checksum */
-			uint32_t udp_chksum    : 1;
-
-			/** Check TCP checksum */
-			uint32_t tcp_chksum    : 1;
-
-			/** Check SCTP checksum */
-			uint32_t sctp_chksum   : 1;
-
-		} check;
-
-		/** All check bits. This can be used to set/clear all flags. */
-		uint32_t all_check;
-	};
+	odp_proto_chksums_t check;
 
 } odp_packet_parse_param_t;
 
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c
index ce4d66c0b..bc0cf54c9 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -2451,7 +2451,7 @@  void packet_test_parse(void)
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.layer = ODP_PROTO_LAYER_ALL;
-	parse.all_check = 0;
+	parse.check.all_chksum = 0;
 
 	CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
 	CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1],
@@ -2482,7 +2482,7 @@  void packet_test_parse(void)
 
 	parse.proto = ODP_PROTO_IPV4;
 	parse.layer = ODP_PROTO_LAYER_L4;
-	parse.all_check = 0;
+	parse.check.all_chksum = 0;
 
 	CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
 	CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1],
@@ -2512,7 +2512,7 @@  void packet_test_parse(void)
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.layer = ODP_PROTO_LAYER_L4;
-	parse.all_check = 0;
+	parse.check.all_chksum = 0;
 
 	CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
 	CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1],
@@ -2542,7 +2542,7 @@  void packet_test_parse(void)
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.layer = ODP_PROTO_LAYER_L4;
-	parse.all_check = 0;
+	parse.check.all_chksum = 0;
 
 	CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
 	CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1],
@@ -2573,7 +2573,7 @@  void packet_test_parse(void)
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.layer = ODP_PROTO_LAYER_ALL;
-	parse.all_check = 0;
+	parse.check.all_chksum = 0;
 
 	CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
 	CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1],