aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@linaro.org>2018-01-31 15:03:20 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-02-26 14:01:50 +0300
commitb5cb45b96f5b04f8d950e8a050424779e55bbcdc (patch)
tree031ae2bb22109d7ab6fb3845a8903f83736dff4b
parentd058f94572b2f699f005f2358d35f1ef87e97516 (diff)
api: packet: add protocol type enumeration
Add enumerations for L3 and L4 protocol types, and functions to request those. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--include/odp/api/abi-default/packet.h28
-rw-r--r--include/odp/api/spec/packet.h95
-rw-r--r--platform/linux-generic/include-abi/odp/api/abi/packet.h28
3 files changed, 151 insertions, 0 deletions
diff --git a/include/odp/api/abi-default/packet.h b/include/odp/api/abi-default/packet.h
index 10eed530d..d3a1753f8 100644
--- a/include/odp/api/abi-default/packet.h
+++ b/include/odp/api/abi-default/packet.h
@@ -30,6 +30,34 @@ typedef _odp_abi_packet_seg_t *odp_packet_seg_t;
#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)0xffffffff)
#define ODP_PACKET_OFFSET_INVALID 0xffff
+typedef uint8_t odp_proto_l3_type_t;
+
+#define ODP_PROTO_L3_TYPE_NONE 0
+#define ODP_PROTO_L3_TYPE_ARP 1
+#define ODP_PROTO_L3_TYPE_RARP 2
+#define ODP_PROTO_L3_TYPE_MPLS 3
+#define ODP_PROTO_L3_TYPE_IPV4 4
+#define ODP_PROTO_L3_TYPE_IPV6 6
+
+typedef uint8_t odp_proto_l4_type_t;
+
+/* Numbers from IANA Assigned Internet Protocol Numbers list */
+#define ODP_PROTO_L4_TYPE_NONE 0
+#define ODP_PROTO_L4_TYPE_ICMPV4 1
+#define ODP_PROTO_L4_TYPE_IGMP 2
+#define ODP_PROTO_L4_TYPE_IPV4 4
+#define ODP_PROTO_L4_TYPE_TCP 6
+#define ODP_PROTO_L4_TYPE_UDP 17
+#define ODP_PROTO_L4_TYPE_IPV6 41
+#define ODP_PROTO_L4_TYPE_GRE 47
+#define ODP_PROTO_L4_TYPE_ESP 50
+#define ODP_PROTO_L4_TYPE_AH 51
+#define ODP_PROTO_L4_TYPE_ICMPV6 58
+#define ODP_PROTO_L4_TYPE_NO_NEXT 59
+#define ODP_PROTO_L4_TYPE_IPCOMP 108
+#define ODP_PROTO_L4_TYPE_SCTP 132
+#define ODP_PROTO_L4_TYPE_ROHC 142
+
typedef enum {
ODP_PACKET_GREEN = 0,
ODP_PACKET_YELLOW = 1,
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 3222ff5c2..4be515c7b 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -72,6 +72,79 @@ extern "C" {
*/
/**
+ * @typedef odp_proto_l3_type_t
+ * Layer 3 protocol type
+ */
+
+/**
+ * @def ODP_PROTO_L3_TYPE_NONE
+ * Layer 3 protocol type not defined
+ *
+ * @def ODP_PROTO_L3_TYPE_ARP
+ * Layer 3 protocol is ARP
+ *
+ * @def ODP_PROTO_L3_TYPE_RARP
+ * Layer 3 protocol is RARP
+ *
+ * @def ODP_PROTO_L3_TYPE_MPLS
+ * Layer 3 protocol is MPLS
+ *
+ * @def ODP_PROTO_L3_TYPE_IPV4
+ * Layer 3 protocol type is IPv4
+ *
+ * @def ODP_PROTO_L3_TYPE_IPV6
+ * Layer 3 protocol type is IPv6
+ */
+
+/**
+ * @def ODP_PROTO_L4_TYPE_NONE
+ * Layer 4 protocol type not defined
+ *
+ * @def ODP_PROTO_L4_TYPE_ICMPV4
+ * Layer 4 protocol type is ICMPv4
+ *
+ * @def ODP_PROTO_L4_TYPE_IGMP
+ * Layer 4 protocol type is IGMP
+ *
+ * @def ODP_PROTO_L4_TYPE_IPV4
+ * Layer 4 protocol type is IPv4
+ *
+ * @def ODP_PROTO_L4_TYPE_TCP
+ * Layer 4 protocol type is TCP
+ *
+ * @def ODP_PROTO_L4_TYPE_UDP
+ * Layer 4 protocol type is UDP
+ *
+ * @def ODP_PROTO_L4_TYPE_IPV6
+ * Layer 4 protocol type is IPv6
+ *
+ * @def ODP_PROTO_L4_TYPE_GRE
+ * Layer 4 protocol type is GRE
+ *
+ * @def ODP_PROTO_L4_TYPE_ESP
+ * Layer 4 protocol type is IPSEC ESP
+ *
+ * @def ODP_PROTO_L4_TYPE_AH
+ * Layer 4 protocol type is IPSEC AH
+ *
+ * @def ODP_PROTO_L4_TYPE_ICMPV6
+ * Layer 4 protocol type is ICMPv6
+ *
+ * @def ODP_PROTO_L4_TYPE_NO_NEXT
+ * Layer 4 protocol type is "No Next Header".
+ * Protocol / next header number is 59.
+ *
+ * @def ODP_PROTO_L4_TYPE_IPCOMP
+ * Layer 4 protocol type is IP Payload Compression Protocol
+ *
+ * @def ODP_PROTO_L4_TYPE_SCTP
+ * Layer 4 protocol type is SCTP
+ *
+ * @def ODP_PROTO_L4_TYPE_ROHC
+ * Layer 4 protocol type is ROHC
+ */
+
+/**
* Protocol
*/
typedef enum odp_proto_t {
@@ -1543,6 +1616,28 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
/**
+ * Layer 3 protocol type
+ *
+ * Returns layer 3 protocol type. Initial type value is ODP_PROTO_L3_TYPE_NONE.
+ *
+ * @param pkt Packet handle
+ *
+ * @return Layer 3 protocol type
+ */
+odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt);
+
+/**
+ * Layer 4 protocol type
+ *
+ * Returns layer 4 protocol type. Initial type value is ODP_PROTO_L4_TYPE_NONE.
+ *
+ * @param pkt Packet handle
+ *
+ * @return Layer 4 protocol type
+ */
+odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt);
+
+/**
* Layer 3 checksum check status
*
* Returns the result of the latest layer 3 checksum check done for the packet.
diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet.h b/platform/linux-generic/include-abi/odp/api/abi/packet.h
index 66948aa18..5d4673fc9 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/packet.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/packet.h
@@ -47,6 +47,34 @@ static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint8_t ndx)
#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1)
+typedef uint8_t odp_proto_l3_type_t;
+
+#define ODP_PROTO_L3_TYPE_NONE 0
+#define ODP_PROTO_L3_TYPE_ARP 1
+#define ODP_PROTO_L3_TYPE_RARP 2
+#define ODP_PROTO_L3_TYPE_MPLS 3
+#define ODP_PROTO_L3_TYPE_IPV4 4
+#define ODP_PROTO_L3_TYPE_IPV6 6
+
+typedef uint8_t odp_proto_l4_type_t;
+
+/* Numbers from IANA Assigned Internet Protocol Numbers list */
+#define ODP_PROTO_L4_TYPE_NONE 0
+#define ODP_PROTO_L4_TYPE_ICMPV4 1
+#define ODP_PROTO_L4_TYPE_IGMP 2
+#define ODP_PROTO_L4_TYPE_IPV4 4
+#define ODP_PROTO_L4_TYPE_TCP 6
+#define ODP_PROTO_L4_TYPE_UDP 17
+#define ODP_PROTO_L4_TYPE_IPV6 41
+#define ODP_PROTO_L4_TYPE_GRE 47
+#define ODP_PROTO_L4_TYPE_ESP 50
+#define ODP_PROTO_L4_TYPE_AH 51
+#define ODP_PROTO_L4_TYPE_ICMPV6 58
+#define ODP_PROTO_L4_TYPE_NO_NEXT 59
+#define ODP_PROTO_L4_TYPE_IPCOMP 108
+#define ODP_PROTO_L4_TYPE_SCTP 132
+#define ODP_PROTO_L4_TYPE_ROHC 142
+
typedef enum {
ODP_PACKET_GREEN = 0,
ODP_PACKET_YELLOW = 1,