diff mbox series

[v4,5/8] abi: packet: added initial definitions

Message ID 1485850046-28457-6-git-send-email-petri.savolainen@linaro.org
State Accepted
Commit 10cd6d5e4294d3a35a366e564fbc57abde732e85
Headers show
Series First ABI files | expand

Commit Message

Petri Savolainen Jan. 31, 2017, 8:07 a.m. UTC
Initially, use the same default ABI file for all architectures.
Default values match those defined in odp-linux implementation
to minimize changes in this phase.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
 include/odp/arch/arm32-linux/odp/api/abi/packet.h  |  7 ++++
 include/odp/arch/arm64-linux/odp/api/abi/packet.h  |  7 ++++
 include/odp/arch/default/api/abi/packet.h          | 47 ++++++++++++++++++++++
 include/odp/arch/mips64-linux/odp/api/abi/packet.h |  7 ++++
 .../odp/arch/power64-linux/odp/api/abi/packet.h    |  7 ++++
 include/odp/arch/x86_32-linux/odp/api/abi/packet.h |  7 ++++
 include/odp/arch/x86_64-linux/odp/api/abi/packet.h |  7 ++++
 platform/Makefile.inc                              |  6 ++-
 .../include/odp/api/plat/packet_types.h            | 26 ++++--------
 platform/linux-generic/odp_packet.c                | 10 +++++
 10 files changed, 111 insertions(+), 20 deletions(-)
 create mode 100644 include/odp/arch/arm32-linux/odp/api/abi/packet.h
 create mode 100644 include/odp/arch/arm64-linux/odp/api/abi/packet.h
 create mode 100644 include/odp/arch/default/api/abi/packet.h
 create mode 100644 include/odp/arch/mips64-linux/odp/api/abi/packet.h
 create mode 100644 include/odp/arch/power64-linux/odp/api/abi/packet.h
 create mode 100644 include/odp/arch/x86_32-linux/odp/api/abi/packet.h
 create mode 100644 include/odp/arch/x86_64-linux/odp/api/abi/packet.h

-- 
2.8.1
diff mbox series

Patch

diff --git a/include/odp/arch/arm32-linux/odp/api/abi/packet.h b/include/odp/arch/arm32-linux/odp/api/abi/packet.h
new file mode 100644
index 0000000..f44cb53
--- /dev/null
+++ b/include/odp/arch/arm32-linux/odp/api/abi/packet.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/packet.h>
diff --git a/include/odp/arch/arm64-linux/odp/api/abi/packet.h b/include/odp/arch/arm64-linux/odp/api/abi/packet.h
new file mode 100644
index 0000000..f44cb53
--- /dev/null
+++ b/include/odp/arch/arm64-linux/odp/api/abi/packet.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/packet.h>
diff --git a/include/odp/arch/default/api/abi/packet.h b/include/odp/arch/default/api/abi/packet.h
new file mode 100644
index 0000000..60a41b8
--- /dev/null
+++ b/include/odp/arch/default/api/abi/packet.h
@@ -0,0 +1,47 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef ODP_ABI_PACKET_H_
+#define ODP_ABI_PACKET_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/** @internal Dummy type for strong typing */
+typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_packet_t;
+
+/** @ingroup odp_packet
+ *  @{
+ */
+
+typedef _odp_abi_packet_t *odp_packet_t;
+typedef uint8_t            odp_packet_seg_t;
+
+#define ODP_PACKET_INVALID        ((odp_packet_t)0xffffffff)
+#define ODP_PACKET_SEG_INVALID    ((odp_packet_seg_t)-1)
+#define ODP_PACKET_OFFSET_INVALID (0x0fffffff)
+
+typedef enum {
+	ODP_PACKET_GREEN = 0,
+	ODP_PACKET_YELLOW = 1,
+	ODP_PACKET_RED = 2,
+	ODP_PACKET_ALL_COLORS = 3,
+} odp_packet_color_t;
+
+#define ODP_NUM_PACKET_COLORS 3
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/odp/arch/mips64-linux/odp/api/abi/packet.h b/include/odp/arch/mips64-linux/odp/api/abi/packet.h
new file mode 100644
index 0000000..f44cb53
--- /dev/null
+++ b/include/odp/arch/mips64-linux/odp/api/abi/packet.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/packet.h>
diff --git a/include/odp/arch/power64-linux/odp/api/abi/packet.h b/include/odp/arch/power64-linux/odp/api/abi/packet.h
new file mode 100644
index 0000000..f44cb53
--- /dev/null
+++ b/include/odp/arch/power64-linux/odp/api/abi/packet.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/packet.h>
diff --git a/include/odp/arch/x86_32-linux/odp/api/abi/packet.h b/include/odp/arch/x86_32-linux/odp/api/abi/packet.h
new file mode 100644
index 0000000..f44cb53
--- /dev/null
+++ b/include/odp/arch/x86_32-linux/odp/api/abi/packet.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/packet.h>
diff --git a/include/odp/arch/x86_64-linux/odp/api/abi/packet.h b/include/odp/arch/x86_64-linux/odp/api/abi/packet.h
new file mode 100644
index 0000000..f44cb53
--- /dev/null
+++ b/include/odp/arch/x86_64-linux/odp/api/abi/packet.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/packet.h>
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 29ed347..03d9376 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -65,14 +65,16 @@  odpapiabidefaultinclude_HEADERS = \
 	$(top_srcdir)/include/odp/arch/default/api/abi/buffer.h \
 	$(top_srcdir)/include/odp/arch/default/api/abi/classification.h \
 	$(top_srcdir)/include/odp/arch/default/api/abi/crypto.h \
-	$(top_srcdir)/include/odp/arch/default/api/abi/event.h
+	$(top_srcdir)/include/odp/arch/default/api/abi/event.h \
+	$(top_srcdir)/include/odp/arch/default/api/abi/packet.h
 
 odpapiabiarchincludedir= $(includedir)/odp/arch/@ARCH_ABI@/odp/api/abi
 odpapiabiarchinclude_HEADERS = \
 	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/buffer.h \
 	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/classification.h \
 	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/crypto.h \
-	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/event.h
+	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/event.h \
+	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/packet.h
 
 EXTRA_DIST = \
 	     arch/arm/odp/api/cpu_arch.h \
diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h
index 864494d..34e5dd8 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_types.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_types.h
@@ -18,11 +18,15 @@ 
 extern "C" {
 #endif
 
+#include <odp/api/plat/static_inline.h>
+#if ODP_ABI_COMPAT == 1
+#include <odp/api/abi/packet.h>
+#else
+
 #include <odp/api/std_types.h>
 #include <odp/api/plat/strong_types.h>
 
-/** @addtogroup odp_packet ODP PACKET
- *  Operations on a packet.
+/** @ingroup odp_packet
  *  @{
  */
 
@@ -32,13 +36,10 @@  typedef ODP_HANDLE_T(odp_packet_t);
 
 #define ODP_PACKET_OFFSET_INVALID (0x0fffffff)
 
-/* A packet segment handle stores a small index. Strong type handles are
- * pointers, which would be wasteful in this case. */
 typedef uint8_t odp_packet_seg_t;
 
 #define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1)
 
-/** odp_packet_color_t assigns names to the various pkt "colors" */
 typedef enum {
 	ODP_PACKET_GREEN = 0,
 	ODP_PACKET_YELLOW = 1,
@@ -46,25 +47,14 @@  typedef enum {
 	ODP_PACKET_ALL_COLORS = 3,
 } odp_packet_color_t;
 
-/** Sets the maximum number of pkt "colors" */
 #define ODP_NUM_PACKET_COLORS 3
 
-/** Get printable format of odp_packet_t */
-static inline uint64_t odp_packet_to_u64(odp_packet_t hdl)
-{
-	return _odp_pri(hdl);
-}
-
-/** Get printable format of odp_packet_seg_t */
-static inline uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl)
-{
-	return _odp_pri(hdl);
-}
-
 /**
  * @}
  */
 
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 34d720c..8833822 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -2211,3 +2211,13 @@  int packet_parse_layer(odp_packet_hdr_t *pkt_hdr, layer_t layer)
 	return packet_parse_common(&pkt_hdr->p, base, pkt_hdr->frame_len,
 				   seg_len, layer);
 }
+
+uint64_t odp_packet_to_u64(odp_packet_t hdl)
+{
+	return _odp_pri(hdl);
+}
+
+uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl)
+{
+	return _odp_pri(hdl);
+}