diff mbox series

[24/29] linux-gen, include: switch packet headers to api+abi

Message ID 20171023111057.6328-25-dmitry.ereminsolenikov@linaro.org
State Superseded
Headers show
Series restructure headers for ABI-compat/platform-optimized modes | expand

Commit Message

Dmitry Eremin-Solenikov Oct. 23, 2017, 11:10 a.m. UTC
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
 include/Makefile.am                                |  6 ++
 .../include => include}/odp/api/classification.h   |  2 +-
 .../include => include}/odp/api/crypto.h           |  2 +-
 .../include => include}/odp/api/packet.h           | 11 +---
 .../include => include}/odp/api/packet_flags.h     |  9 +--
 .../include => include}/odp/api/packet_io.h        |  6 +-
 .../include => include}/odp/api/packet_io_stats.h  |  4 +-
 platform/linux-generic/Makefile.am                 | 12 ++--
 .../linux-generic/include-abi/odp/api/abi/packet.h | 68 ++++++++++++++++++++++
 .../include-abi/odp/api/abi/packet_flags.h         | 27 +++++++++
 .../include/odp/api/plat/packet_flag_inlines.h     | 19 +-----
 .../plat/{packet_types.h => packet_inline_types.h} | 53 +----------------
 .../include/odp/api/plat/packet_inlines.h          | 27 +++------
 .../linux-generic/include/odp_packet_internal.h    |  3 +-
 platform/linux-generic/odp_packet.c                |  2 +-
 platform/linux-generic/pktio/dpdk.c                |  2 +-
 platform/linux-generic/pktio/netmap.c              |  2 +-
 17 files changed, 136 insertions(+), 119 deletions(-)
 rename {platform/linux-generic/include => include}/odp/api/classification.h (93%)
 rename {platform/linux-generic/include => include}/odp/api/crypto.h (92%)
 rename {platform/linux-generic/include => include}/odp/api/packet.h (67%)
 rename {platform/linux-generic/include => include}/odp/api/packet_flags.h (59%)
 rename {platform/linux-generic/include => include}/odp/api/packet_io.h (83%)
 rename {platform/linux-generic/include => include}/odp/api/packet_io_stats.h (79%)
 create mode 100644 platform/linux-generic/include-abi/odp/api/abi/packet.h
 create mode 100644 platform/linux-generic/include-abi/odp/api/abi/packet_flags.h
 rename platform/linux-generic/include/odp/api/plat/{packet_types.h => packet_inline_types.h} (76%)

-- 
2.14.2
diff mbox series

Patch

diff --git a/include/Makefile.am b/include/Makefile.am
index addf4bc92261..4ef4d89185d0 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -10,8 +10,10 @@  odpapiinclude_HEADERS = \
 	odp/api/buffer.h \
 	odp/api/byteorder.h \
 	odp/api/chksum.h \
+	odp/api/classification.h \
 	odp/api/compiler.h \
 	odp/api/cpumask.h \
+	odp/api/crypto.h \
 	odp/api/deprecated.h \
 	odp/api/errno.h \
 	odp/api/event.h \
@@ -20,6 +22,10 @@  odpapiinclude_HEADERS = \
 	odp/api/hints.h \
 	odp/api/init.h \
 	odp/api/ipsec.h \
+	odp/api/packet.h \
+	odp/api/packet_flags.h \
+	odp/api/packet_io.h \
+	odp/api/packet_io_stats.h \
 	odp/api/pool.h \
 	odp/api/queue.h \
 	odp/api/random.h \
diff --git a/platform/linux-generic/include/odp/api/classification.h b/include/odp/api/classification.h
similarity index 93%
rename from platform/linux-generic/include/odp/api/classification.h
rename to include/odp/api/classification.h
index 01be7063d102..ecdf92031d0a 100644
--- a/platform/linux-generic/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -20,7 +20,7 @@  extern "C" {
 #include <odp/api/std_types.h>
 #include <odp/api/abi/pool.h>
 #include <odp/api/abi/classification.h>
-#include <odp/api/plat/packet_types.h>
+#include <odp/api/abi/packet.h>
 #include <odp/api/abi/packet_io.h>
 #include <odp/api/abi/queue.h>
 
diff --git a/platform/linux-generic/include/odp/api/crypto.h b/include/odp/api/crypto.h
similarity index 92%
rename from platform/linux-generic/include/odp/api/crypto.h
rename to include/odp/api/crypto.h
index ead28eab0bfc..3f4104677201 100644
--- a/platform/linux-generic/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -18,7 +18,7 @@  extern "C" {
 #endif
 
 #include <odp/api/std_types.h>
-#include <odp/api/plat/packet_types.h>
+#include <odp/api/abi/packet.h>
 #include <odp/api/abi/crypto.h>
 #include <odp/api/abi/buffer.h>
 #include <odp/api/abi/pool.h>
diff --git a/platform/linux-generic/include/odp/api/packet.h b/include/odp/api/packet.h
similarity index 67%
rename from platform/linux-generic/include/odp/api/packet.h
rename to include/odp/api/packet.h
index 5d744df544d6..88c4f0278c84 100644
--- a/platform/linux-generic/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -10,8 +10,8 @@ 
  * ODP packet descriptor
  */
 
-#ifndef ODP_PLAT_PACKET_H_
-#define ODP_PLAT_PACKET_H_
+#ifndef ODP_API_PACKET_H_
+#define ODP_API_PACKET_H_
 
 #ifdef __cplusplus
 extern "C" {
@@ -20,15 +20,10 @@  extern "C" {
 #include <odp/api/std_types.h>
 #include <odp/api/abi/event.h>
 #include <odp/api/abi/packet_io.h>
-#include <odp/api/plat/packet_types.h>
+#include <odp/api/abi/packet.h>
 #include <odp/api/abi/buffer.h>
 #include <odp/api/abi/pool.h>
 
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 0
-#include <odp/api/plat/packet_inlines.h>
-#endif
-
 #include <odp/api/spec/packet.h>
 
 #ifdef __cplusplus
diff --git a/platform/linux-generic/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
similarity index 59%
rename from platform/linux-generic/include/odp/api/packet_flags.h
rename to include/odp/api/packet_flags.h
index 1e55af823736..2b3006b5192c 100644
--- a/platform/linux-generic/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -10,17 +10,14 @@ 
  * ODP packet flags
  */
 
-#ifndef ODP_PLAT_PACKET_FLAGS_H_
-#define ODP_PLAT_PACKET_FLAGS_H_
+#ifndef ODP_API_PACKET_FLAGS_H_
+#define ODP_API_PACKET_FLAGS_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 0
-#include <odp/api/plat/packet_flag_inlines.h>
-#endif
+#include <odp/api/abi/packet_flags.h>
 
 #include <odp/api/spec/packet_flags.h>
 
diff --git a/platform/linux-generic/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
similarity index 83%
rename from platform/linux-generic/include/odp/api/packet_io.h
rename to include/odp/api/packet_io.h
index 9107685a36dc..a854d7b987b0 100644
--- a/platform/linux-generic/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -10,8 +10,8 @@ 
  * ODP Packet IO
  */
 
-#ifndef ODP_PLAT_PACKET_IO_H_
-#define ODP_PLAT_PACKET_IO_H_
+#ifndef ODP_API_PACKET_IO_H_
+#define ODP_API_PACKET_IO_H_
 
 #ifdef __cplusplus
 extern "C" {
@@ -20,7 +20,7 @@  extern "C" {
 #include <odp/api/std_types.h>
 #include <odp/api/abi/pool.h>
 #include <odp/api/abi/classification.h>
-#include <odp/api/plat/packet_types.h>
+#include <odp/api/abi/packet.h>
 #include <odp/api/abi/packet_io.h>
 #include <odp/api/abi/queue.h>
 
diff --git a/platform/linux-generic/include/odp/api/packet_io_stats.h b/include/odp/api/packet_io_stats.h
similarity index 79%
rename from platform/linux-generic/include/odp/api/packet_io_stats.h
rename to include/odp/api/packet_io_stats.h
index a9cd9535e610..b2b32075ea22 100644
--- a/platform/linux-generic/include/odp/api/packet_io_stats.h
+++ b/include/odp/api/packet_io_stats.h
@@ -10,8 +10,8 @@ 
  * ODP packet IO stats
  */
 
-#ifndef ODP_PLAT_PACKET_IO_STATS_H_
-#define ODP_PLAT_PACKET_IO_STATS_H_
+#ifndef ODP_API_PACKET_IO_STATS_H_
+#define ODP_API_PACKET_IO_STATS_H_
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 14b449ea42c1..f2454ac51fff 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -20,14 +20,8 @@  odpinclude_HEADERS = \
 odpapiincludedir= $(includedir)/odp/api
 odpapiinclude_HEADERS = \
 		  include/odp/api/align.h \
-		  include/odp/api/classification.h \
 		  include/odp/api/cpu.h \
-		  include/odp/api/crypto.h \
-		  include/odp/api/debug.h \
-		  include/odp/api/packet_flags.h \
-		  include/odp/api/packet.h \
-		  include/odp/api/packet_io.h \
-		  include/odp/api/packet_io_stats.h
+		  include/odp/api/debug.h
 
 odpapiplatincludedir= $(includedir)/odp/api/plat
 odpapiplatinclude_HEADERS = \
@@ -35,9 +29,9 @@  odpapiplatinclude_HEADERS = \
 		  include/odp/api/plat/byteorder_inlines.h \
 		  include/odp/api/plat/packet_flag_inlines.h \
 		  include/odp/api/plat/packet_flag_inlines_api.h \
+		  include/odp/api/plat/packet_inline_types.h \
 		  include/odp/api/plat/packet_inlines.h \
 		  include/odp/api/plat/packet_inlines_api.h \
-		  include/odp/api/plat/packet_types.h \
 		  include/odp/api/plat/std_clib_inlines.h \
 		  include/odp/api/plat/strong_types.h \
 		  include/odp/api/plat/sync_inlines.h \
@@ -60,6 +54,8 @@  odpapiabiarchinclude_HEADERS = \
 		  include-abi/odp/api/abi/event.h \
 		  include-abi/odp/api/abi/init.h \
 		  include-abi/odp/api/abi/ipsec.h \
+		  include-abi/odp/api/abi/packet.h \
+		  include-abi/odp/api/abi/packet_flags.h \
 		  include-abi/odp/api/abi/packet_io.h \
 		  include-abi/odp/api/abi/pool.h \
 		  include-abi/odp/api/abi/queue.h \
diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet.h b/platform/linux-generic/include-abi/odp/api/abi/packet.h
new file mode 100644
index 000000000000..31d446f8dd9f
--- /dev/null
+++ b/platform/linux-generic/include-abi/odp/api/abi/packet.h
@@ -0,0 +1,68 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP packet descriptor
+ */
+
+#ifndef ODP_API_ABI_PACKET_H_
+#define ODP_API_ABI_PACKET_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/std_types.h>
+#include <odp/api/plat/strong_types.h>
+
+/** @ingroup odp_packet
+ *  @{
+ */
+
+typedef ODP_HANDLE_T(odp_packet_t);
+
+#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0)
+
+#define ODP_PACKET_OFFSET_INVALID 0xffff
+
+typedef uint8_t odp_packet_seg_t;
+
+static inline uint8_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
+{
+	return (uint8_t)seg;
+}
+
+static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint8_t ndx)
+{
+	return (odp_packet_seg_t)ndx;
+}
+
+#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1)
+
+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
+
+#include <odp/api/plat/static_inline.h>
+#include <odp/api/plat/packet_inlines.h>
+#include <odp/api/plat/packet_inlines_api.h>
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet_flags.h b/platform/linux-generic/include-abi/odp/api/abi/packet_flags.h
new file mode 100644
index 000000000000..9a8474a33eda
--- /dev/null
+++ b/platform/linux-generic/include-abi/odp/api/abi/packet_flags.h
@@ -0,0 +1,27 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP packet descriptor
+ */
+
+#ifndef ODP_API_ABI_PACKET_FLAGS_H_
+#define ODP_API_ABI_PACKET_FLAGS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/plat/packet_flag_inlines.h>
+#include <odp/api/plat/packet_flag_inlines_api.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h
index 42003e3179ea..3212248f336c 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h
@@ -13,7 +13,8 @@ 
 #ifndef _ODP_PLAT_PACKET_FLAG_INLINES_H_
 #define _ODP_PLAT_PACKET_FLAG_INLINES_H_
 
-#include <odp/api/plat/packet_types.h>
+#include <odp/api/abi/packet.h>
+#include <odp/api/plat/packet_inlines.h>
 #include <odp/api/hints.h>
 
 /** @internal Inline function offsets */
@@ -70,20 +71,4 @@  static inline int _odp_packet_has_ts(odp_packet_t pkt)
 	return flags.timestamp;
 }
 
-/* Include inlined versions of API functions */
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 0
-
-/** @ingroup odp_packet
- *  @{
- */
-
-#include <odp/api/plat/packet_flag_inlines_api.h>
-
-/**
- * @}
- */
-
-#endif
-
 #endif
diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h
similarity index 76%
rename from platform/linux-generic/include/odp/api/plat/packet_types.h
rename to platform/linux-generic/include/odp/api/plat/packet_inline_types.h
index 68c66312b2f3..0bfd0241331a 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_types.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h
@@ -11,61 +11,14 @@ 
  * ODP packet descriptor
  */
 
-#ifndef ODP_PACKET_TYPES_H_
-#define ODP_PACKET_TYPES_H_
+#ifndef ODP_PACKET_INLINE_TYPES_H_
+#define ODP_PACKET_INLINE_TYPES_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include <stddef.h>
-
-#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>
-
-/** @ingroup odp_packet
- *  @{
- */
-
-typedef ODP_HANDLE_T(odp_packet_t);
-
-#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0)
-
-#define ODP_PACKET_OFFSET_INVALID 0xffff
-
-typedef uint8_t odp_packet_seg_t;
-
-static inline uint8_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
-{
-	return (uint8_t)seg;
-}
-
-static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint8_t ndx)
-{
-	return (odp_packet_seg_t)ndx;
-}
-
-#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1)
-
-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
-
-/**
- * @}
- */
-
-#endif
+#include <stdint.h>
 
 /** @internal Packet field accessor */
 #define _odp_pkt_get(pkt, cast, field) \
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index bfd65cbf1068..48475ba823e8 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -13,16 +13,21 @@ 
 #ifndef _ODP_PLAT_PACKET_INLINES_H_
 #define _ODP_PLAT_PACKET_INLINES_H_
 
-#include <odp/api/plat/strong_types.h>
-#include <odp/api/plat/packet_types.h>
+#include <odp/api/abi/packet.h>
 #include <odp/api/pool.h>
-#include <odp/api/packet_io.h>
+#include <odp/api/abi/packet_io.h>
 #include <odp/api/hints.h>
+#include <odp/api/time.h>
+#include <odp/api/abi/buffer.h>
+
+#include <odp/api/plat/packet_inline_types.h>
 
 /** @internal Inline function offsets */
 extern const _odp_packet_inline_offset_t _odp_packet_inline;
 
+#include <odp/api/plat/static_inline.h>
 #if ODP_ABI_COMPAT == 1
+#include <odp/api/plat/strong_types.h>
 /** @internal Inline function @param seg @return */
 static inline uint32_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
 {
@@ -164,20 +169,4 @@  static inline odp_buffer_t packet_to_buffer(odp_packet_t pkt)
 	return (odp_buffer_t)pkt;
 }
 
-/* Include inlined versions of API functions */
-#include <odp/api/plat/static_inline.h>
-#if ODP_ABI_COMPAT == 0
-
-/** @ingroup odp_packet
- *  @{
- */
-
-#include <odp/api/plat/packet_inlines_api.h>
-
-/**
- * @}
- */
-
-#endif
-
 #endif
diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index fed562aa3409..db4864ff0b5e 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -23,11 +23,12 @@  extern "C" {
 #include <odp_pool_internal.h>
 #include <odp_buffer_inlines.h>
 #include <odp/api/packet.h>
+#include <odp/api/plat/packet_inline_types.h>
 #include <odp/api/packet_io.h>
 #include <odp/api/crypto.h>
 #include <odp_crypto_internal.h>
 #include <odp_ipsec_internal.h>
-#include <odp/api/plat/packet_types.h>
+#include <odp/api/abi/packet.h>
 #include <odp_queue_if.h>
 
 /** Minimum segment length expected by packet_parse_common() */
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 603ac7181dea..ada02faec018 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -6,8 +6,8 @@ 
 
 #include "config.h"
 
-#include <odp/api/plat/packet_inlines.h>
 #include <odp/api/packet.h>
+#include <odp/api/plat/packet_inlines.h>
 #include <odp_packet_internal.h>
 #include <odp_debug_internal.h>
 #include <odp/api/hints.h>
diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index 1a930a487abf..28b4d25d282f 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -17,8 +17,8 @@ 
 
 #include <odp/api/cpumask.h>
 
-#include <odp/api/plat/packet_inlines.h>
 #include <odp/api/packet.h>
+#include <odp/api/plat/packet_inlines.h>
 
 #include <odp_packet_io_internal.h>
 #include <odp_classification_internal.h>
diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index 812416b2fc94..1473d0b8030a 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -10,8 +10,8 @@ 
 
 #include <odp_posix_extensions.h>
 
-#include <odp/api/plat/packet_inlines.h>
 #include <odp/api/packet.h>
+#include <odp/api/plat/packet_inlines.h>
 
 #include <odp_packet_io_internal.h>
 #include <odp_packet_netmap.h>