diff mbox series

[API-NEXT,v3,1/2] api: packet add L2 packet type to complement L3 and L4 types

Message ID 1518620408-18352-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v3,1/2] api: packet add L2 packet type to complement L3 and L4 types | expand

Commit Message

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


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

---
/** Email created from pull request 476 (lumag:l2-type)
 ** https://github.com/Linaro/odp/pull/476
 ** Patch: https://github.com/Linaro/odp/pull/476.patch
 ** Base sha: 4b1101adedf0941f6db34047cc06fde11fb06a34
 ** Merge commit sha: d4636c5108ebc788ba06616a49ad536163961f5f
 **/
 include/odp/api/abi-default/packet.h |  5 +++++
 include/odp/api/spec/packet.h        | 24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
diff mbox series

Patch

diff --git a/include/odp/api/abi-default/packet.h b/include/odp/api/abi-default/packet.h
index b83288d4c..f9efdc7c0 100644
--- a/include/odp/api/abi-default/packet.h
+++ b/include/odp/api/abi-default/packet.h
@@ -30,6 +30,11 @@  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_l2_type_t;
+
+#define ODP_PROTO_L2_TYPE_NONE   0
+#define ODP_PROTO_L2_TYPE_ETH    1
+
 typedef uint8_t odp_proto_l3_type_t;
 
 #define ODP_PROTO_L3_TYPE_NONE   0
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 4be515c7b..079a1ae1b 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -71,6 +71,19 @@  extern "C" {
   * Packet is red
   */
 
+/**
+ * @typedef odp_proto_l2_type_t
+ * Layer 2 protocol type
+ */
+
+/**
+ * @def ODP_PROTO_L2_TYPE_NONE
+ * Layer 2 protocol type not defined
+ *
+ * @def ODP_PROTO_L2_TYPE_ETH
+ * Layer 2 protocol is Ethernet
+ */
+
 /**
  * @typedef odp_proto_l3_type_t
  * Layer 3 protocol type
@@ -1615,6 +1628,17 @@  uint32_t odp_packet_l4_offset(odp_packet_t pkt);
  */
 int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
 
+/**
+ * Layer 2 protocol type
+ *
+ * Returns layer 2 protocol type. Initial type value is ODP_PROTO_L2_TYPE_NONE.
+ *
+ * @param      pkt      Packet handle
+ *
+ * @return Layer 2 protocol type
+ */
+odp_proto_l2_type_t odp_packet_l2_type(odp_packet_t pkt);
+
 /**
  * Layer 3 protocol type
  *