aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@linaro.org>2014-06-25 17:35:00 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2014-06-26 21:43:15 +0400
commit17317a758132ac9996eeed2c90c1b2477da99d57 (patch)
tree9b9ba1198af53207ef2ce1a1a7e6eecca5017619 /platform/linux-generic/include
parent0e683f99047f78f78202b2bc54326c4a500e86ab (diff)
Buffer header C99 compliance and cleanup
Fixed C99 compliance bug in buffer header (removed the empty array). Cleaned and harmonized buffer pool implementation for different buffer types. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Diffstat (limited to 'platform/linux-generic/include')
-rw-r--r--platform/linux-generic/include/odp_buffer_internal.h14
-rw-r--r--platform/linux-generic/include/odp_buffer_pool_internal.h4
-rw-r--r--platform/linux-generic/include/odp_packet_internal.h5
-rw-r--r--platform/linux-generic/include/odp_timer_internal.h4
4 files changed, 17 insertions, 10 deletions
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index a1a6b4eba..11024f84a 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -79,6 +79,7 @@ typedef struct odp_buffer_chunk_t {
} odp_buffer_chunk_t;
+/* Common buffer header */
typedef struct odp_buffer_hdr_t {
struct odp_buffer_hdr_t *next; /* next buf in a list */
odp_buffer_bits_t handle; /* handle */
@@ -92,13 +93,20 @@ typedef struct odp_buffer_hdr_t {
int type; /* type of next header */
odp_buffer_pool_t pool; /* buffer pool */
- uint8_t payload[]; /* next header or data */
} odp_buffer_hdr_t;
-ODP_ASSERT(sizeof(odp_buffer_hdr_t) == ODP_OFFSETOF(odp_buffer_hdr_t, payload),
- ODP_BUFFER_HDR_T__SIZE_ERROR);
+/* Ensure next header starts from 8 byte align */
+ODP_ASSERT((sizeof(odp_buffer_hdr_t) % 8) == 0, ODP_BUFFER_HDR_T__SIZE_ERROR);
+/* Raw buffer header */
+typedef struct {
+ odp_buffer_hdr_t buf_hdr; /* common buffer header */
+ uint8_t buf_data[]; /* start of buffer data area */
+} odp_raw_buffer_hdr_t;
+
+
+/* Chunk header */
typedef struct odp_buffer_chunk_hdr_t {
odp_buffer_hdr_t buf_hdr;
odp_buffer_chunk_t chunk;
diff --git a/platform/linux-generic/include/odp_buffer_pool_internal.h b/platform/linux-generic/include/odp_buffer_pool_internal.h
index 381482f17..1c0a9fcbe 100644
--- a/platform/linux-generic/include/odp_buffer_pool_internal.h
+++ b/platform/linux-generic/include/odp_buffer_pool_internal.h
@@ -58,8 +58,8 @@ struct pool_entry_s {
uint64_t num_bufs;
void *pool_base_addr;
uint64_t pool_size;
- size_t payload_size;
- size_t payload_align;
+ size_t user_size;
+ size_t user_align;
int buf_type;
size_t hdr_size;
};
diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index eb978a3e9..45ed41254 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -115,11 +115,10 @@ typedef struct {
odp_pktio_t input;
uint32_t pad;
- uint8_t payload[];
-
+ uint8_t buf_data[]; /* start of buffer data area */
} odp_packet_hdr_t;
-ODP_ASSERT(sizeof(odp_packet_hdr_t) == ODP_OFFSETOF(odp_packet_hdr_t, payload),
+ODP_ASSERT(sizeof(odp_packet_hdr_t) == ODP_OFFSETOF(odp_packet_hdr_t, buf_data),
ODP_PACKET_HDR_T__SIZE_ERR);
ODP_ASSERT(sizeof(odp_packet_hdr_t) % sizeof(uint64_t) == 0,
ODP_PACKET_HDR_T__SIZE_ERR2);
diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h
index f99a10e3f..76f1545ee 100644
--- a/platform/linux-generic/include/odp_timer_internal.h
+++ b/platform/linux-generic/include/odp_timer_internal.h
@@ -48,13 +48,13 @@ typedef struct odp_timeout_hdr_t {
timeout_t meta;
- uint8_t payload[];
+ uint8_t buf_data[];
} odp_timeout_hdr_t;
ODP_ASSERT(sizeof(odp_timeout_hdr_t) ==
- ODP_OFFSETOF(odp_timeout_hdr_t, payload),
+ ODP_OFFSETOF(odp_timeout_hdr_t, buf_data),
ODP_TIMEOUT_HDR_T__SIZE_ERR);
ODP_ASSERT(sizeof(odp_timeout_hdr_t) % sizeof(uint64_t) == 0,