[API-NEXT,v3,6/11] linux-gen: packet: support L4 type No Next Header

Message ID 1519761609-20848-7-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series
  • [API-NEXT,v3,1/11] linux-gen: packet: add odp_packet_l2_type() implementation
Related show

Commit Message

Github ODP bot Feb. 27, 2018, 8 p.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


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

---
/** Email created from pull request 502 (lumag:ipsec-imp-upd)
 ** https://github.com/Linaro/odp/pull/502
 ** Patch: https://github.com/Linaro/odp/pull/502.patch
 ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae
 ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544
 **/
 platform/linux-generic/include/odp/api/plat/packet_inline_types.h | 1 +
 platform/linux-generic/include/protocols/ip.h                     | 1 +
 platform/linux-generic/odp_packet.c                               | 6 ++++++
 3 files changed, 8 insertions(+)

Patch

diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h
index 2e8efecb6..4b88d3517 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h
@@ -90,6 +90,7 @@  typedef union {
 		uint64_t tcp:1;       /* TCP */
 		uint64_t sctp:1;      /* SCTP */
 		uint64_t icmp:1;      /* ICMP */
+		uint64_t no_next_hdr:1; /* No Next Header */
 
 		uint64_t color:2;     /* Packet color for traffic mgmt */
 		uint64_t nodrop:1;    /* Drop eligibility status */
diff --git a/platform/linux-generic/include/protocols/ip.h b/platform/linux-generic/include/protocols/ip.h
index f02980693..19aef3dcc 100644
--- a/platform/linux-generic/include/protocols/ip.h
+++ b/platform/linux-generic/include/protocols/ip.h
@@ -167,6 +167,7 @@  typedef struct ODP_PACKED {
 #define _ODP_IPPROTO_AH      0x33 /**< Authentication Header (51) */
 #define _ODP_IPPROTO_ESP     0x32 /**< Encapsulating Security Payload (50) */
 #define _ODP_IPPROTO_ICMPV6  0x3A /**< Internet Control Message Protocol (58) */
+#define _ODP_IPPROTO_NO_NEXT 0x3B /**< No Next Header (59) */
 #define _ODP_IPPROTO_DEST    0x3C /**< IPv6 Destination header (60) */
 #define _ODP_IPPROTO_SCTP    0x84 /**< Stream Control Transmission protocol
 				       (132) */
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 2459a3aa8..b30cc63ad 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -2224,6 +2224,10 @@  int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr,
 		prs->input_flags.sctp = 1;
 		break;
 
+	case _ODP_IPPROTO_NO_NEXT:
+		prs->input_flags.no_next_hdr = 1;
+		break;
+
 	default:
 		prs->input_flags.l4 = 0;
 		break;
@@ -2529,6 +2533,8 @@  odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt)
 	else if (pkt_hdr->p.input_flags.icmp &&
 		 pkt_hdr->p.input_flags.ipv6)
 		return ODP_PROTO_L4_TYPE_ICMPV6;
+	else if (pkt_hdr->p.input_flags.no_next_hdr)
+		return ODP_PROTO_L4_TYPE_NO_NEXT;
 
 	return ODP_PROTO_L4_TYPE_NONE;
 }