diff mbox series

[API-NEXT,v14,16/16] linux-gen: ipsec: pass checksum flags to packet parsing code

Message ID 1513119632-28755-17-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v14,1/16] validation: ipsec: add ipv4 name parts | expand

Commit Message

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


Pass checksum and protocol parsing flags to packet parsing code.
Checksum checks are not yet implemented by odp_packet_parse, it will be
done later.

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

---
/** Email created from pull request 304 (lumag:ipsec-ipv6-2)
 ** https://github.com/Linaro/odp/pull/304
 ** Patch: https://github.com/Linaro/odp/pull/304.patch
 ** Base sha: d96a8207591fbcaac25b79286d7d72a537354c1f
 ** Merge commit sha: 832a79461bc8bd90e572c396fa081e162e1dacb6
 **/
 platform/linux-generic/odp_ipsec.c | 35 +++++++++--------------------------
 1 file changed, 9 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c
index 6568924a3..4f23eb17b 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -198,24 +198,6 @@  static const uint8_t ipsec_padding[255] = {
 	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 };
 
-static inline odp_pktio_parser_layer_t parse_layer(odp_ipsec_proto_layer_t l)
-{
-	switch (l) {
-	case ODP_IPSEC_LAYER_NONE:
-		return ODP_PKTIO_PARSER_LAYER_NONE;
-	case ODP_IPSEC_LAYER_L2:
-		return ODP_PKTIO_PARSER_LAYER_L2;
-	case ODP_IPSEC_LAYER_L3:
-		return ODP_PKTIO_PARSER_LAYER_L3;
-	case ODP_IPSEC_LAYER_L4:
-		return ODP_PKTIO_PARSER_LAYER_L4;
-	case ODP_IPSEC_LAYER_ALL:
-		return ODP_PKTIO_PARSER_LAYER_ALL;
-	}
-
-	return ODP_PKTIO_PARSER_LAYER_NONE;
-}
-
 typedef struct {
 	void *ip;
 	unsigned stats_length;
@@ -605,6 +587,7 @@  static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
 	odp_crypto_packet_op_param_t param;
 	int rc;
 	odp_crypto_packet_result_t crypto; /**< Crypto operation result */
+	odp_packet_parse_param_t parse_param;
 	odp_packet_hdr_t *pkt_hdr;
 
 	state.ip_offset = odp_packet_l3_offset(pkt);
@@ -770,15 +753,15 @@  static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
 		goto err;
 	}
 
-	pkt_hdr = odp_packet_hdr(pkt);
-
-	packet_parse_reset(pkt_hdr);
+	parse_param.proto = state.is_ipv4 ?
+				ODP_PROTO_IPV4 :
+				ODP_PROTO_IPV6;
+	parse_param.last_layer = (odp_proto_layer_t)ipsec_config.inbound.parse;
+	parse_param.chksums = ipsec_config.inbound.chksums;
 
-	packet_parse_l3_l4(pkt_hdr, parse_layer(ipsec_config.inbound.parse),
-			   state.ip_offset,
-			   state.is_ipv4 ?
-			   _ODP_ETHTYPE_IPV4 :
-			   _ODP_ETHTYPE_IPV6);
+	/* We do not care about return code here.
+	 * Parsing error should not result in IPsec error. */
+	odp_packet_parse(pkt, state.ip_offset, &parse_param);
 
 	*pkt_out = pkt;