From: Ilias Apalodimas <ilias.apalodi...@linaro.org>

        * typedef struct { } ODP_ALIGN() test_t; is correct
        * typedef struct ODP_ALIGN() {} test_t; is correct and
        preferred from gcc standards
        * typedef struct {} test_t ODP_ALIGN() discards align
        Had segfauls on gcc-7 using that

Signed-off-by: Ilias Apalodimas <ilias.apalodi...@linaro.org>
---
/** Email created from pull request 398 (apalos:align)
 ** https://github.com/Linaro/odp/pull/398
 ** Patch: https://github.com/Linaro/odp/pull/398.patch
 ** Base sha: 77ff03881d844a9d6a4bc773086bd8aaecace541
 ** Merge commit sha: c603837c88f6623aeccb807bbb19cbd91c4c0583
 **/
 example/ipfragreass/odp_ipfragreass.c              |  4 ++--
 example/l3fwd/odp_l3fwd_db.h                       |  4 ++--
 example/switch/odp_switch.c                        |  4 ++--
 helper/cuckootable.c                               |  8 ++++----
 helper/iplookuptable.c                             |  4 ++--
 .../include/odp/api/plat/atomic_types.h            |  8 ++++----
 .../include/odp/api/plat/cpumask_types.h           |  4 ++--
 .../linux-generic/include/odp_atomic_internal.h    |  9 ++++----
 .../linux-generic/include/odp_buffer_internal.h    |  4 ++--
 .../linux-generic/include/odp_ipsec_internal.h     |  2 +-
 platform/linux-generic/include/odp_packet_dpdk.h   |  8 ++++----
 .../linux-generic/include/odp_packet_internal.h    |  2 +-
 .../include/odp_packet_io_ring_internal.h          | 10 ++++-----
 platform/linux-generic/include/odp_packet_netmap.h |  4 ++--
 platform/linux-generic/include/odp_packet_socket.h |  6 +++---
 platform/linux-generic/include/odp_pool_internal.h | 10 ++++-----
 .../linux-generic/include/odp_queue_internal.h     |  4 ++--
 .../include/odp_queue_scalable_internal.h          |  4 ++--
 platform/linux-generic/include/odp_ring_internal.h |  4 ++--
 .../linux-generic/include/odp_schedule_scalable.h  | 24 +++++++++++-----------
 .../include/odp_schedule_scalable_ordered.h        |  8 ++++----
 platform/linux-generic/odp_name_table.c            |  8 ++++----
 platform/linux-generic/odp_packet.c                |  2 +-
 platform/linux-generic/odp_pkt_queue.c             |  9 ++++----
 platform/linux-generic/odp_pool.c                  |  2 +-
 platform/linux-generic/odp_schedule.c              | 18 ++++++++--------
 platform/linux-generic/odp_schedule_iquery.c       | 14 ++++++-------
 platform/linux-generic/odp_schedule_sp.c           | 12 +++++------
 platform/linux-generic/odp_timer.c                 | 12 +++++------
 platform/linux-generic/pktio/socket_mmap.c         |  7 ++++---
 test/performance/odp_l2fwd.c                       |  4 ++--
 test/performance/odp_pktio_ordered.c               |  4 ++--
 test/performance/odp_sched_latency.c               |  4 ++--
 test/performance/odp_scheduling.c                  |  4 ++--
 test/validation/api/chksum/chksum.c                |  6 +++---
 35 files changed, 121 insertions(+), 120 deletions(-)

diff --git a/example/ipfragreass/odp_ipfragreass.c 
b/example/ipfragreass/odp_ipfragreass.c
index 6ad0db9fd..6668263b0 100644
--- a/example/ipfragreass/odp_ipfragreass.c
+++ b/example/ipfragreass/odp_ipfragreass.c
@@ -47,9 +47,9 @@ static odp_queue_t reassembled_pkts;
 static odp_atomic_u32_t packets_reassembled;
 
 /** Number of fragments processed per thread in reassembly (for printing) */
-static struct {
+static struct ODP_ALIGNED_CACHE {
        uint32_t frags;
-} ODP_ALIGNED_CACHE thread_stats[MAX_WORKERS];
+} thread_stats[MAX_WORKERS];
 
 /** Shared hash map structure for reassembly */
 static union fraglist *fraglists;
diff --git a/example/l3fwd/odp_l3fwd_db.h b/example/l3fwd/odp_l3fwd_db.h
index 8df2999df..015f38325 100644
--- a/example/l3fwd/odp_l3fwd_db.h
+++ b/example/l3fwd/odp_l3fwd_db.h
@@ -39,7 +39,7 @@ typedef struct ip_addr_range_s {
 /**
  * TCP/UDP flow
  */
-typedef struct ipv4_tuple5_s {
+typedef struct ODP_ALIGNED_CACHE ipv4_tuple5_s {
        union {
                struct {
                        int32_t src_ip;
@@ -55,7 +55,7 @@ typedef struct ipv4_tuple5_s {
                        int64_t lo64;
                };
        };
-} ipv4_tuple5_t ODP_ALIGNED_CACHE;
+} ipv4_tuple5_t;
 
 /**
  * Forwarding data base entry
diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c
index 3e52970be..954c667ca 100644
--- a/example/switch/odp_switch.c
+++ b/example/switch/odp_switch.c
@@ -66,7 +66,7 @@ static int exit_threads;   /**< Break workers loop if set to 
1 */
 /**
  * Statistics
  */
-typedef union {
+typedef union ODP_ALIGNED_CACHE {
        struct {
                /** Number of received packets */
                uint64_t rx_packets;
@@ -79,7 +79,7 @@ typedef union {
        } s;
 
        uint8_t padding[ODP_CACHE_LINE_SIZE];
-} stats_t ODP_ALIGNED_CACHE;
+} stats_t;
 
 /**
  * Packet buffer
diff --git a/helper/cuckootable.c b/helper/cuckootable.c
index 4707191d7..29298d42d 100644
--- a/helper/cuckootable.c
+++ b/helper/cuckootable.c
@@ -93,12 +93,12 @@ struct cuckoo_table_key_value {
  *  into a bucket, and each bucket has at most HASH_BUCKET_ENTRIES
  *  elements.
  */
-struct cuckoo_table_bucket {
+struct ODP_ALIGNED_CACHE cuckoo_table_bucket {
        struct cuckoo_table_signatures signatures[HASH_BUCKET_ENTRIES];
        /* Includes dummy key index that always contains index 0 */
        odp_buffer_t key_buf[HASH_BUCKET_ENTRIES + 1];
        uint8_t flag[HASH_BUCKET_ENTRIES];
-} ODP_ALIGNED_CACHE;
+};
 
 /* More efficient access to a map of single ullong */
 #define ULLONG_FOR_EACH_1(IDX, MAP)    \
@@ -106,7 +106,7 @@ struct cuckoo_table_bucket {
                 MAP = (MAP & (MAP - 1)))
 
 /** A hash table structure. */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /**< for check */
        uint32_t magicword;
        /**< Name of the hash. */
@@ -126,7 +126,7 @@ typedef struct {
        /** Table with buckets storing all the hash values and key indexes
          to the key table*/
        struct cuckoo_table_bucket *buckets;
-} odph_cuckoo_table_impl ODP_ALIGNED_CACHE;
+} odph_cuckoo_table_impl;
 
 /**
  * Aligns input parameter to the next power of 2
diff --git a/helper/iplookuptable.c b/helper/iplookuptable.c
index 7ca68de27..7b1faa292 100644
--- a/helper/iplookuptable.c
+++ b/helper/iplookuptable.c
@@ -96,7 +96,7 @@ typedef enum {
 } cache_type_t;
 
 /** A IP lookup table structure. */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /**< for check */
        uint32_t magicword;
        /** Name of the hash. */
@@ -118,7 +118,7 @@ typedef struct {
        odp_queue_t free_slots[2];
        /** The number of pool used by each queue. */
        uint32_t cache_count[2];
-} odph_iplookup_table_impl ODP_ALIGNED_CACHE;
+} odph_iplookup_table_impl;
 
 /***********************************************************
  *****************   Cache management   ********************
diff --git a/platform/linux-generic/include/odp/api/plat/atomic_types.h 
b/platform/linux-generic/include/odp/api/plat/atomic_types.h
index a674ac997..803678a12 100644
--- a/platform/linux-generic/include/odp/api/plat/atomic_types.h
+++ b/platform/linux-generic/include/odp/api/plat/atomic_types.h
@@ -24,22 +24,22 @@ extern "C" {
  * @internal
  * Atomic 64-bit unsigned integer
  */
-struct odp_atomic_u64_s {
+struct ODP_ALIGNED(sizeof(uint64_t)) odp_atomic_u64_s {
        uint64_t v; /**< Actual storage for the atomic variable */
 #if __GCC_ATOMIC_LLONG_LOCK_FREE < 2
        /* Some architectures do not support lock-free operations on 64-bit
         * data types. We use a spin lock to ensure atomicity. */
        char lock; /**< Spin lock (if needed) used to ensure atomic access */
 #endif
-} ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignement! */
+};
 
 /**
  * @internal
  * Atomic 32-bit unsigned integer
  */
-struct odp_atomic_u32_s {
+struct ODP_ALIGNED(sizeof(uint32_t)) odp_atomic_u32_s {
        uint32_t v; /**< Actual storage for the atomic variable */
-} ODP_ALIGNED(sizeof(uint32_t)); /* Enforce alignement! */
+};
 
 #if __GCC_ATOMIC_LLONG_LOCK_FREE < 2
 
diff --git a/platform/linux-generic/include/odp/api/plat/cpumask_types.h 
b/platform/linux-generic/include/odp/api/plat/cpumask_types.h
index c2727a46c..3e3532688 100644
--- a/platform/linux-generic/include/odp/api/plat/cpumask_types.h
+++ b/platform/linux-generic/include/odp/api/plat/cpumask_types.h
@@ -34,14 +34,14 @@ extern "C" {
  *
  * Don't access directly, use access functions.
  */
-typedef struct odp_cpumask_t {
+typedef struct ODP_ALIGNED(8) odp_cpumask_t {
        /** @private CPU mask storage
          *
          * This is private to the implementation.
          * Don't access directly, use access functions.
          */
        uint8_t _u8[ODP_CPUMASK_SIZE / 8];
-} odp_cpumask_t ODP_ALIGNED(8);
+} odp_cpumask_t;
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp_atomic_internal.h 
b/platform/linux-generic/include/odp_atomic_internal.h
index dca2175ce..24fd2dde3 100644
--- a/platform/linux-generic/include/odp_atomic_internal.h
+++ b/platform/linux-generic/include/odp_atomic_internal.h
@@ -29,10 +29,9 @@ extern "C" {
 /**
  * Pointer atomic type
  */
-typedef struct {
+typedef struct ODP_ALIGNED(sizeof(void *)) {
        void *v; /**< Actual storage for the atomic variable */
-} _odp_atomic_ptr_t
-ODP_ALIGNED(sizeof(void *)); /* Enforce alignement! */
+} _odp_atomic_ptr_t;
 
 /**
  * Atomic flag (boolean) type
@@ -609,9 +608,9 @@ static inline void 
_odp_atomic_flag_clear(_odp_atomic_flag_t *flag)
 typedef __int128 _uint128_t;
 
 /** Atomic 128-bit type */
-typedef struct {
+typedef struct ODP_ALIGNED(16) {
        _uint128_t v; /**< Actual storage for the atomic variable */
-} _odp_atomic_u128_t ODP_ALIGNED(16);
+} _odp_atomic_u128_t;
 
 /**
  * 16-byte atomic exchange operation
diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index c56c5b01b..b52669387 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -42,7 +42,7 @@ typedef struct seg_entry_t {
 } seg_entry_t;
 
 /* Common buffer header */
-struct odp_buffer_hdr_t {
+struct ODP_ALIGNED_CACHE odp_buffer_hdr_t {
 
        /* Buffer index in the pool */
        uint32_t  index;
@@ -110,7 +110,7 @@ struct odp_buffer_hdr_t {
 
        /* Data or next header */
        uint8_t data[0];
-} ODP_ALIGNED_CACHE;
+};
 
 ODP_STATIC_ASSERT(CONFIG_PACKET_SEGS_PER_HDR < 256,
                  "CONFIG_PACKET_SEGS_PER_HDR_TOO_LARGE");
diff --git a/platform/linux-generic/include/odp_ipsec_internal.h 
b/platform/linux-generic/include/odp_ipsec_internal.h
index 70a583c5b..dbdcbb917 100644
--- a/platform/linux-generic/include/odp_ipsec_internal.h
+++ b/platform/linux-generic/include/odp_ipsec_internal.h
@@ -92,7 +92,7 @@ int _odp_ipsec_status_send(odp_queue_t queue,
 #define ODP_CONFIG_IPSEC_SAS   8
 
 struct ipsec_sa_s {
-       odp_atomic_u32_t state ODP_ALIGNED_CACHE;
+       odp_atomic_u32_t ODP_ALIGNED_CACHE state;
 
        uint32_t        ipsec_sa_idx;
        odp_ipsec_sa_t  ipsec_sa_hdl;
diff --git a/platform/linux-generic/include/odp_packet_dpdk.h 
b/platform/linux-generic/include/odp_packet_dpdk.h
index 05f00ad34..242926555 100644
--- a/platform/linux-generic/include/odp_packet_dpdk.h
+++ b/platform/linux-generic/include/odp_packet_dpdk.h
@@ -41,13 +41,13 @@ struct pkt_cache_t {
        unsigned count;                   /**< packets in cache */
 };
 
-typedef union {
+typedef union ODP_ALIGNED_CACHE {
        struct pkt_cache_t s;
        uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct pkt_cache_t))];
-} pkt_cache_t ODP_ALIGNED_CACHE;
+} pkt_cache_t;
 
 /** Packet IO using DPDK interface */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        odp_pool_t pool;                  /**< pool to alloc packets from */
        struct rte_mempool *pkt_pool;     /**< DPDK packet pool */
        uint32_t data_room;               /**< maximum packet length */
@@ -64,6 +64,6 @@ typedef struct {
        odp_ticketlock_t tx_lock[PKTIO_MAX_QUEUES];  /**< TX queue locks */
        /** cache for storing extra RX packets */
        pkt_cache_t rx_cache[PKTIO_MAX_QUEUES];
-} pkt_dpdk_t ODP_ALIGNED_CACHE;
+} pkt_dpdk_t;
 
 #endif
diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 62888f8a5..ac7109381 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -155,7 +155,7 @@ typedef struct {
        /* Type of extra data */
        uint8_t extra_type;
        /* Extra space for packet descriptors. E.g. DPDK mbuf  */
-       uint8_t extra[PKT_EXTRA_LEN] ODP_ALIGNED_CACHE;
+       uint8_t ODP_ALIGNED_CACHE extra[PKT_EXTRA_LEN];
 #endif
 
        /* Context for IPsec */
diff --git a/platform/linux-generic/include/odp_packet_io_ring_internal.h 
b/platform/linux-generic/include/odp_packet_io_ring_internal.h
index d044f9319..5a60a4ee3 100644
--- a/platform/linux-generic/include/odp_packet_io_ring_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_ring_internal.h
@@ -132,26 +132,26 @@ typedef struct _ring {
        int flags;
 
        /** @private Producer */
-       struct _prod {
+       struct ODP_ALIGNED_CACHE _prod {
                uint32_t watermark;      /* Maximum items */
                uint32_t sp_enqueue;     /* True, if single producer. */
                uint32_t size;           /* Size of ring. */
                uint32_t mask;           /* Mask (size-1) of ring. */
                volatile uint32_t head;  /* Producer head. */
                volatile uint32_t tail;  /* Producer tail. */
-       } prod ODP_ALIGNED_CACHE;
+       } prod;
 
        /** @private Consumer */
-       struct _cons {
+       struct ODP_ALIGNED_CACHE _cons {
                uint32_t sc_dequeue;     /* True, if single consumer. */
                uint32_t size;           /* Size of the ring. */
                uint32_t mask;           /* Mask (size-1) of ring. */
                volatile uint32_t head;  /* Consumer head. */
                volatile uint32_t tail;  /* Consumer tail. */
-       } cons ODP_ALIGNED_CACHE;
+       } cons;
 
        /** @private Memory space of ring starts here. */
-       void *ring[0] ODP_ALIGNED_CACHE;
+       void ODP_ALIGNED_CACHE *ring[0];
 } _ring_t;
 
 /* The default enqueue is "single-producer".*/
diff --git a/platform/linux-generic/include/odp_packet_netmap.h 
b/platform/linux-generic/include/odp_packet_netmap.h
index 876c7e465..616541b5e 100644
--- a/platform/linux-generic/include/odp_packet_netmap.h
+++ b/platform/linux-generic/include/odp_packet_netmap.h
@@ -30,10 +30,10 @@ struct netmap_ring_t {
        odp_ticketlock_t lock;  /**< Queue lock */
 };
 
-typedef union {
+typedef union ODP_ALIGNED_CACHE {
        struct netmap_ring_t s;
        uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct netmap_ring_t))];
-} netmap_ring_t ODP_ALIGNED_CACHE;
+} netmap_ring_t;
 
 /** Netmap ring slot */
 typedef struct  {
diff --git a/platform/linux-generic/include/odp_packet_socket.h 
b/platform/linux-generic/include/odp_packet_socket.h
index 0e61f6f0c..52d2776b7 100644
--- a/platform/linux-generic/include/odp_packet_socket.h
+++ b/platform/linux-generic/include/odp_packet_socket.h
@@ -67,11 +67,11 @@ ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= 
ODP_CACHE_LINE_SIZE,
 /** Packet socket using mmap rings for both Rx and Tx */
 typedef struct {
        /** Packet mmap ring for Rx */
-       struct ring rx_ring ODP_ALIGNED_CACHE;
+       struct ring ODP_ALIGNED_CACHE rx_ring;
        /** Packet mmap ring for Tx */
-       struct ring tx_ring ODP_ALIGNED_CACHE;
+       struct ring ODP_ALIGNED_CACHE tx_ring;
 
-       int sockfd ODP_ALIGNED_CACHE;
+       int ODP_ALIGNED_CACHE sockfd;
        odp_pool_t pool;
        size_t frame_offset; /**< frame start offset from start of pkt buf */
        uint8_t *mmap_base;
diff --git a/platform/linux-generic/include/odp_pool_internal.h 
b/platform/linux-generic/include/odp_pool_internal.h
index 61ec5ccc5..8284bcd7d 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -26,27 +26,27 @@ extern "C" {
 #include <odp_ring_internal.h>
 #include <odp/api/plat/strong_types.h>
 
-typedef struct pool_cache_t {
+typedef struct ODP_ALIGNED_CACHE pool_cache_t {
        uint32_t num;
        uint32_t buf_index[CONFIG_POOL_CACHE_SIZE];
 
-} pool_cache_t ODP_ALIGNED_CACHE;
+} pool_cache_t;
 
 /* Buffer header ring */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Ring header */
        ring_t   hdr;
 
        /* Ring data: buffer handles */
        uint32_t buf[CONFIG_POOL_MAX_NUM];
 
-} pool_ring_t ODP_ALIGNED_CACHE;
+} pool_ring_t;
 
 /* Callback function for pool destroy */
 typedef void (*pool_destroy_cb_fn)(void *pool);
 
 typedef struct pool_t {
-       odp_ticketlock_t lock ODP_ALIGNED_CACHE;
+       odp_ticketlock_t ODP_ALIGNED_CACHE lock;
 
        char             name[ODP_POOL_NAME_LEN];
        odp_pool_param_t params;
diff --git a/platform/linux-generic/include/odp_queue_internal.h 
b/platform/linux-generic/include/odp_queue_internal.h
index dd846d592..f08fbe2ac 100644
--- a/platform/linux-generic/include/odp_queue_internal.h
+++ b/platform/linux-generic/include/odp_queue_internal.h
@@ -36,13 +36,13 @@ extern "C" {
 #define QUEUE_STATUS_SCHED        4
 
 struct queue_entry_s {
-       odp_ticketlock_t  lock ODP_ALIGNED_CACHE;
+       odp_ticketlock_t  ODP_ALIGNED_CACHE lock;
 
        odp_buffer_hdr_t *head;
        odp_buffer_hdr_t *tail;
        int               status;
 
-       queue_enq_fn_t       enqueue ODP_ALIGNED_CACHE;
+       queue_enq_fn_t       ODP_ALIGNED_CACHE enqueue;
        queue_deq_fn_t       dequeue;
        queue_enq_multi_fn_t enqueue_multi;
        queue_deq_multi_fn_t dequeue_multi;
diff --git a/platform/linux-generic/include/odp_queue_scalable_internal.h 
b/platform/linux-generic/include/odp_queue_scalable_internal.h
index ddc65f604..b015ce32b 100644
--- a/platform/linux-generic/include/odp_queue_scalable_internal.h
+++ b/platform/linux-generic/include/odp_queue_scalable_internal.h
@@ -33,10 +33,10 @@ extern "C" {
 struct queue_entry_s {
        sched_elem_t     sched_elem;
 
-       odp_ticketlock_t lock ODP_ALIGNED_CACHE;
+       odp_ticketlock_t ODP_ALIGNED_CACHE lock;
        int              status;
 
-       queue_enq_fn_t       enqueue ODP_ALIGNED_CACHE;
+       queue_enq_fn_t       ODP_ALIGNED_CACHE enqueue;
        queue_deq_fn_t       dequeue;
        queue_enq_multi_fn_t enqueue_multi;
        queue_deq_multi_fn_t dequeue_multi;
diff --git a/platform/linux-generic/include/odp_ring_internal.h 
b/platform/linux-generic/include/odp_ring_internal.h
index 44b83c603..c2eedb8e2 100644
--- a/platform/linux-generic/include/odp_ring_internal.h
+++ b/platform/linux-generic/include/odp_ring_internal.h
@@ -25,7 +25,7 @@ extern "C" {
  * must be a power of two. Also ring size must be larger than the maximum
  * number of data items that will be stored on it (there's no check against
  * overwriting). */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Writer head and tail */
        odp_atomic_u32_t w_head;
        odp_atomic_u32_t w_tail;
@@ -36,7 +36,7 @@ typedef struct {
        odp_atomic_u32_t r_tail;
 
        uint32_t data[0];
-} ring_t ODP_ALIGNED_CACHE;
+} ring_t;
 
 /* Initialize ring */
 static inline void ring_init(ring_t *ring)
diff --git a/platform/linux-generic/include/odp_schedule_scalable.h 
b/platform/linux-generic/include/odp_schedule_scalable.h
index ac357b015..92d60276b 100644
--- a/platform/linux-generic/include/odp_schedule_scalable.h
+++ b/platform/linux-generic/include/odp_schedule_scalable.h
@@ -29,7 +29,7 @@
 #define ODP_SCHED_PRIO_PKTIN 8
 #define ODP_SCHED_PRIO_NUM  9
 
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        union {
                struct {
                        struct llqueue llq;
@@ -37,16 +37,16 @@ typedef struct {
                };
                char line[ODP_CACHE_LINE_SIZE];
        };
-} sched_queue_t ODP_ALIGNED_CACHE;
+} sched_queue_t;
 
 #define TICKET_INVALID (uint16_t)(~0U)
 
-typedef struct {
+typedef struct ODP_ALIGNED(sizeof(uint64_t)) {
        int32_t numevts;
        uint16_t wrr_budget;
        uint8_t cur_ticket;
        uint8_t nxt_ticket;
-} qschedstate_t ODP_ALIGNED(sizeof(uint64_t));
+} qschedstate_t;
 
 typedef uint32_t ringidx_t;
 
@@ -58,7 +58,7 @@ typedef uint32_t ringidx_t;
 
 #define ODP_NO_SCHED_QUEUE (ODP_SCHED_SYNC_ORDERED + 1)
 
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        struct llnode node;
        sched_queue_t *schedq;
 #ifdef CONFIG_QSCHST_LOCK
@@ -89,7 +89,7 @@ typedef struct {
 #define cons_type qschst_type
 #endif
        odp_schedule_group_t sched_grp;
-} sched_elem_t ODP_ALIGNED_CACHE;
+} sched_elem_t;
 
 /* Number of scheduling groups */
 #define MAX_SCHED_GROUP (sizeof(sched_group_mask_t) * CHAR_BIT)
@@ -98,7 +98,7 @@ typedef bitset_t sched_group_mask_t;
 
 typedef struct {
        /* Threads currently associated with the sched group */
-       bitset_t thr_actual[ODP_SCHED_PRIO_NUM] ODP_ALIGNED_CACHE;
+       bitset_t ODP_ALIGNED_CACHE thr_actual[ODP_SCHED_PRIO_NUM];
        bitset_t thr_wanted;
        /* Used to spread queues over schedq's */
        uint32_t xcount[ODP_SCHED_PRIO_NUM];
@@ -106,13 +106,13 @@ typedef struct {
        uint32_t xfactor;
        char name[ODP_SCHED_GROUP_NAME_LEN];
        /* ODP_SCHED_PRIO_NUM * xfactor. Must be last. */
-       sched_queue_t schedq[1] ODP_ALIGNED_CACHE;
+       sched_queue_t ODP_ALIGNED_CACHE schedq[1];
 } sched_group_t;
 
 /* Number of reorder contexts per thread */
 #define TS_RVEC_SIZE 16
 
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Atomic queue currently being processed or NULL */
        sched_elem_t *atomq;
        /* Schedq the currently processed queue was popped from */
@@ -135,10 +135,10 @@ typedef struct {
        sched_group_mask_t sg_wanted[ODP_SCHED_PRIO_NUM];
        bitset_t priv_rvec_free;
        /* Bitset of free entries in rvec[] */
-       bitset_t rvec_free ODP_ALIGNED_CACHE;
+       bitset_t ODP_ALIGNED_CACHE rvec_free;
        /* Reordering contexts to allocate from */
-       reorder_context_t rvec[TS_RVEC_SIZE] ODP_ALIGNED_CACHE;
-} sched_scalable_thread_state_t ODP_ALIGNED_CACHE;
+       reorder_context_t ODP_ALIGNED_CACHE rvec[TS_RVEC_SIZE];
+} sched_scalable_thread_state_t;
 
 void sched_update_enq(sched_elem_t *q, uint32_t actual);
 void sched_update_enq_sp(sched_elem_t *q, uint32_t actual);
diff --git a/platform/linux-generic/include/odp_schedule_scalable_ordered.h 
b/platform/linux-generic/include/odp_schedule_scalable_ordered.h
index c493dead4..14e411e23 100644
--- a/platform/linux-generic/include/odp_schedule_scalable_ordered.h
+++ b/platform/linux-generic/include/odp_schedule_scalable_ordered.h
@@ -57,12 +57,12 @@
  * We need a point of synchronisation where this knowledge and potential state
  * change can be transferred between threads.
  */
-typedef struct hc {
+typedef struct ODP_ALIGNED(sizeof(uint64_t)) hc {
        /* First missing context */
        uint32_t head;
        /* Change indicator */
        uint32_t chgi;
-} hc_t ODP_ALIGNED(sizeof(uint64_t));
+} hc_t;
 
 /* Number of reorder contects in the reorder window.
  * Should be at least one per CPU.
@@ -90,7 +90,7 @@ typedef struct reorder_window {
  */
 #define RC_EVT_SIZE 18
 
-struct reorder_context {
+struct ODP_ALIGNED_CACHE reorder_context {
        /* Reorder window to which this context belongs */
        reorder_window_t *rwin;
        /* Pointer to TS->rvec_free */
@@ -109,7 +109,7 @@ struct reorder_context {
        /* Events stored in this context */
        odp_buffer_hdr_t *events[RC_EVT_SIZE];
        queue_entry_t *destq[RC_EVT_SIZE];
-} ODP_ALIGNED_CACHE;
+};
 
 reorder_window_t *rwin_alloc(_odp_ishm_pool_t *pool,
                             unsigned lock_count);
diff --git a/platform/linux-generic/odp_name_table.c 
b/platform/linux-generic/odp_name_table.c
index 3ff46b347..e9a84ef32 100644
--- a/platform/linux-generic/odp_name_table.c
+++ b/platform/linux-generic/odp_name_table.c
@@ -56,7 +56,7 @@ typedef struct name_tbl_entry_s name_tbl_entry_t;
  /* It is important for most platforms that the following struct fit within
  * one cacheline.
  */
-struct name_tbl_entry_s {
+struct ODP_ALIGNED_CACHE name_tbl_entry_s {
        name_tbl_entry_t *next_entry;
        uint64_t          user_data;
        _odp_int_name_t   name_tbl_id;
@@ -64,9 +64,9 @@ struct name_tbl_entry_s {
        uint8_t           name_kind;
        uint8_t           name_len;
        char              name[_ODP_INT_NAME_LEN + 1];
-} ODP_ALIGNED_CACHE;
+};
 
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        uint32_t          num_allocd;
        uint32_t          num_used;
        uint32_t          num_added_to_free_list;
@@ -74,7 +74,7 @@ typedef struct {
        uint32_t          base_id;
        name_tbl_entry_t *free_list_head;
        name_tbl_entry_t  entries[0];
-} ODP_ALIGNED_CACHE name_tbl_t;
+} name_tbl_t;
 
 typedef struct {
        name_tbl_t *tbls[NUM_NAME_TBLS];
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index a812fec15..2f18f6916 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -26,7 +26,7 @@
 #include <odp/visibility_begin.h>
 
 /* Fill in packet header field offsets for inline functions */
-const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = {
+const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE _odp_packet_inline = {
        .data           = offsetof(odp_packet_hdr_t, buf_hdr.seg[0].data),
        .seg_len        = offsetof(odp_packet_hdr_t, buf_hdr.seg[0].len),
        .frame_len      = offsetof(odp_packet_hdr_t, frame_len),
diff --git a/platform/linux-generic/odp_pkt_queue.c 
b/platform/linux-generic/odp_pkt_queue.c
index 4f6a1eb61..172191931 100644
--- a/platform/linux-generic/odp_pkt_queue.c
+++ b/platform/linux-generic/odp_pkt_queue.c
@@ -22,15 +22,16 @@
 
 #define NUM_PKTS     7
 
-typedef struct /* Must be exactly 64 bytes long AND cacheline aligned! */ {
+/* Must be exactly 64 bytes long AND cacheline aligned! */
+typedef struct ODP_ALIGNED_CACHE {
        uint32_t next_queue_blk_idx;
        uint32_t tail_queue_blk_idx;
        odp_packet_t pkts[NUM_PKTS];
-} ODP_ALIGNED_CACHE queue_blk_t;
+} queue_blk_t;
 
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        queue_blk_t blks[0];
-} ODP_ALIGNED_CACHE queue_blks_t;
+} queue_blks_t;
 
 /* The queue_num_tbl is used to map from a queue_num to a queue_num_desc.
  * The reason is based on the assumption that usually only a small fraction
diff --git a/platform/linux-generic/odp_pool.c 
b/platform/linux-generic/odp_pool.c
index e20693de1..5ecf15358 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -60,7 +60,7 @@ static __thread pool_local_t local;
 #include <odp/visibility_begin.h>
 
 /* Fill in pool header field offsets for inline functions */
-const _odp_pool_inline_offset_t _odp_pool_inline ODP_ALIGNED_CACHE = {
+const _odp_pool_inline_offset_t ODP_ALIGNED_CACHE _odp_pool_inline = {
        .pool_hdl          = offsetof(pool_t, pool_hdl),
        .uarea_size        = offsetof(pool_t, params.pkt.uarea_size)
 };
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 1a9a2a8f1..118f9eb17 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -177,24 +177,24 @@ typedef struct {
 } sched_local_t;
 
 /* Priority queue */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Ring header */
        ring_t ring;
 
        /* Ring data: queue indexes */
        uint32_t queue_index[PRIO_QUEUE_RING_SIZE];
 
-} prio_queue_t ODP_ALIGNED_CACHE;
+} prio_queue_t;
 
 /* Packet IO queue */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Ring header */
        ring_t ring;
 
        /* Ring data: pktio poll command indexes */
        uint32_t cmd_index[PKTIO_RING_SIZE];
 
-} pktio_queue_t ODP_ALIGNED_CACHE;
+} pktio_queue_t;
 
 /* Packet IO poll command */
 typedef struct {
@@ -205,17 +205,17 @@ typedef struct {
 } pktio_cmd_t;
 
 /* Order context of a queue */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Current ordered context id */
-       odp_atomic_u64_t  ctx ODP_ALIGNED_CACHE;
+       odp_atomic_u64_t ODP_ALIGNED_CACHE ctx;
 
        /* Next unallocated context id */
-       odp_atomic_u64_t  next_ctx;
+       odp_atomic_u64_t next_ctx;
 
        /* Array of ordered locks */
-       odp_atomic_u64_t  lock[CONFIG_QUEUE_MAX_ORD_LOCKS];
+       odp_atomic_u64_t lock[CONFIG_QUEUE_MAX_ORD_LOCKS];
 
-} order_context_t ODP_ALIGNED_CACHE;
+} order_context_t;
 
 typedef struct {
        pri_mask_t     pri_mask[NUM_PRIO];
diff --git a/platform/linux-generic/odp_schedule_iquery.c 
b/platform/linux-generic/odp_schedule_iquery.c
index 3d794b140..33767c1f8 100644
--- a/platform/linux-generic/odp_schedule_iquery.c
+++ b/platform/linux-generic/odp_schedule_iquery.c
@@ -93,13 +93,13 @@ typedef struct {
 #define MAX_DEQ CONFIG_BURST_SIZE
 
 /* Instantiate a RING data structure as pktio command queue */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Ring header */
        ring_t ring;
 
        /* Ring data: pktio poll command indexes */
        uint32_t cmd_index[PKTIO_RING_SIZE];
-} pktio_cmd_queue_t ODP_ALIGNED_CACHE;
+} pktio_cmd_queue_t;
 
 /* Packet IO poll command */
 typedef struct {
@@ -122,17 +122,17 @@ typedef struct {
 typedef struct sched_thread_local sched_thread_local_t;
 
 /* Order context of a queue */
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Current ordered context id */
-       odp_atomic_u64_t  ctx ODP_ALIGNED_CACHE;
+       odp_atomic_u64_t ODP_ALIGNED_CACHE ctx;
 
        /* Next unallocated context id */
-       odp_atomic_u64_t  next_ctx;
+       odp_atomic_u64_t next_ctx;
 
        /* Array of ordered locks */
-       odp_atomic_u64_t  lock[CONFIG_QUEUE_MAX_ORD_LOCKS];
+       odp_atomic_u64_t lock[CONFIG_QUEUE_MAX_ORD_LOCKS];
 
-} order_context_t ODP_ALIGNED_CACHE;
+} order_context_t;
 
 typedef struct {
        odp_shm_t selfie;
diff --git a/platform/linux-generic/odp_schedule_sp.c 
b/platform/linux-generic/odp_schedule_sp.c
index 7f0404b1c..017eaee34 100644
--- a/platform/linux-generic/odp_schedule_sp.c
+++ b/platform/linux-generic/odp_schedule_sp.c
@@ -61,20 +61,20 @@ struct sched_cmd_s {
        int                pktin_idx[NUM_PKTIN];
 };
 
-typedef struct sched_cmd_t {
+typedef struct ODP_ALIGNED_CACHE sched_cmd_t {
        struct sched_cmd_s s;
        uint8_t            pad[ROUNDUP_CACHE_LINE(sizeof(struct sched_cmd_s)) -
                               sizeof(struct sched_cmd_s)];
-} sched_cmd_t ODP_ALIGNED_CACHE;
+} sched_cmd_t;
 
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        /* Ring header */
        ring_t ring;
 
        /* Ring data: queue indexes */
        uint32_t ring_idx[RING_SIZE];
 
-} prio_queue_t ODP_ALIGNED_CACHE;
+} prio_queue_t;
 
 typedef struct thr_group_t {
        /* A generation counter for fast comparison if groups have changed */
@@ -88,7 +88,7 @@ typedef struct thr_group_t {
 
 } thr_group_t;
 
-typedef struct sched_group_t {
+typedef struct ODP_ALIGNED_CACHE sched_group_t {
        struct {
                odp_ticketlock_t  lock;
 
@@ -104,7 +104,7 @@ typedef struct sched_group_t {
 
        } s;
 
-} sched_group_t ODP_ALIGNED_CACHE;
+} sched_group_t;
 
 typedef struct {
        sched_cmd_t   queue_cmd[NUM_QUEUE];
diff --git a/platform/linux-generic/odp_timer.c 
b/platform/linux-generic/odp_timer.c
index 72f9505dd..bdb25c60e 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -98,7 +98,11 @@ static odp_timeout_hdr_t *timeout_hdr(odp_timeout_t tmo)
  * odp_timer abstract datatype
  *****************************************************************************/
 
-typedef struct tick_buf_s {
+typedef struct
+#ifdef ODP_ATOMIC_U128
+ODP_ALIGNED(16) /* 16-byte atomic operations need properly aligned addresses */
+#endif
+tick_buf_s {
 #if __GCC_ATOMIC_LLONG_LOCK_FREE < 2
        /* No atomics support for 64-bit variables, will use separate lock */
        /* Use the same layout as odp_atomic_u64_t but without lock variable */
@@ -112,11 +116,7 @@ typedef struct tick_buf_s {
 #ifdef TB_NEEDS_PAD
        uint32_t pad;/* Need to be able to access padding for successful CAS */
 #endif
-} tick_buf_t
-#ifdef ODP_ATOMIC_U128
-ODP_ALIGNED(16) /* 16-byte atomic operations need properly aligned addresses */
-#endif
-;
+} tick_buf_t;
 
 #if __GCC_ATOMIC_LLONG_LOCK_FREE >= 2
 /* Only assert this when we perform atomic operations on tick_buf_t */
diff --git a/platform/linux-generic/pktio/socket_mmap.c 
b/platform/linux-generic/pktio/socket_mmap.c
index c63a25398..19b03694e 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -61,9 +61,10 @@ static int set_pkt_sock_fanout_mmap(pkt_sock_mmap_t *const 
pkt_sock,
 
 union frame_map {
        struct {
-               struct tpacket2_hdr tp_h ODP_ALIGNED(TPACKET_ALIGNMENT);
-               struct sockaddr_ll s_ll
-               ODP_ALIGNED(TPACKET_ALIGN(sizeof(struct tpacket2_hdr)));
+               struct tpacket2_hdr ODP_ALIGNED(TPACKET_ALIGNMENT) tp_h;
+               struct sockaddr_ll
+                       ODP_ALIGNED(TPACKET_ALIGN(sizeof(struct tpacket2_hdr)))
+                       s_ll;
        } *v2;
 
        void *raw;
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 2353e2414..09a12b050 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -123,7 +123,7 @@ static void sig_handler(int signo ODP_UNUSED)
 /**
  * Statistics
  */
-typedef union {
+typedef union ODP_ALIGNED_CACHE {
        struct {
                /** Number of forwarded packets */
                uint64_t packets;
@@ -134,7 +134,7 @@ typedef union {
        } s;
 
        uint8_t padding[ODP_CACHE_LINE_SIZE];
-} stats_t ODP_ALIGNED_CACHE;
+} stats_t;
 
 /**
  * Thread specific data
diff --git a/test/performance/odp_pktio_ordered.c 
b/test/performance/odp_pktio_ordered.c
index 2248eb2fd..db9bfe764 100644
--- a/test/performance/odp_pktio_ordered.c
+++ b/test/performance/odp_pktio_ordered.c
@@ -179,7 +179,7 @@ ODP_STATIC_ASSERT(sizeof(flow_t) <= PKT_UAREA_SIZE,
 /**
  * Statistics
  */
-typedef union {
+typedef union ODP_ALIGNED_CACHE {
        struct {
                /** Number of forwarded packets */
                uint64_t packets;
@@ -192,7 +192,7 @@ typedef union {
        } s;
 
        uint8_t padding[ODP_CACHE_LINE_SIZE];
-} stats_t ODP_ALIGNED_CACHE;
+} stats_t;
 
 /**
  * IPv4 5-tuple
diff --git a/test/performance/odp_sched_latency.c 
b/test/performance/odp_sched_latency.c
index fc2860518..ae7a5914d 100644
--- a/test/performance/odp_sched_latency.c
+++ b/test/performance/odp_sched_latency.c
@@ -97,11 +97,11 @@ typedef struct {
 } test_stat_t;
 
 /** Performance test statistics (per core) */
-typedef union {
+typedef union ODP_ALIGNED_CACHE {
        test_stat_t prio[NUM_PRIOS]; /**< Test statistics per priority */
 
        uint8_t pad[CACHE_ALIGN_ROUNDUP(NUM_PRIOS * sizeof(test_stat_t))];
-} core_stat_t ODP_ALIGNED_CACHE;
+} core_stat_t;
 
 /** Test global variables */
 typedef struct {
diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index 03078a5b3..8d2574b73 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -55,12 +55,12 @@ typedef struct {
        int fairness;   /**< Check fairness */
 } test_args_t;
 
-typedef struct {
+typedef struct ODP_ALIGNED_CACHE {
        uint64_t num_ev;
 
        /* Round up the struct size to cache line size */
        uint8_t pad[ODP_CACHE_LINE_SIZE - sizeof(uint64_t)];
-} queue_context_t ODP_ALIGNED_CACHE;
+} queue_context_t;
 
 /** Test global variables */
 typedef struct {
diff --git a/test/validation/api/chksum/chksum.c 
b/test/validation/api/chksum/chksum.c
index de98b74a0..f8687955e 100644
--- a/test/validation/api/chksum/chksum.c
+++ b/test/validation/api/chksum/chksum.c
@@ -14,7 +14,7 @@
 #define NUM_UDP      4
 #define MAX_UDP_LEN  128
 
-static uint8_t ip_hdr_test_vect[NUM_IP_HDR][IP_HDR_LEN] ODP_ALIGNED(4) = {
+static uint8_t ODP_ALIGNED(4) ip_hdr_test_vect[NUM_IP_HDR][IP_HDR_LEN] = {
        {       0x45, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11,
                0xAB, 0x33, 0xC0, 0xA8, 0x2C, 0xA2, 0xC0, 0xA8, 0x21, 0x99
        },
@@ -38,7 +38,7 @@ struct udp_test_vect_s {
        uint8_t data[MAX_UDP_LEN];
 };
 
-static struct udp_test_vect_s udp_test_vect[NUM_UDP] ODP_ALIGNED(4) = {
+static struct udp_test_vect_s ODP_ALIGNED(4) udp_test_vect[NUM_UDP] = {
        {.len = 38,
        .data = { 0x00, 0x11, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                  0x00, 0x00, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x1A, 0xFF, 0x3C,
@@ -86,7 +86,7 @@ static struct udp_test_vect_s udp_test_vect[NUM_UDP] 
ODP_ALIGNED(4) = {
 /* Long UDP packet with pseudo header. Checksum field is set to zero.
  * The array contains padding, so that a possible overrun is more likely
  * detected (overrun bytes are not all zeros). */
-static uint8_t udp_test_vect_long[] ODP_ALIGNED(4) = {
+static uint8_t ODP_ALIGNED(4) udp_test_vect_long[] = {
        0x00, 0x11, 0x05, 0xED, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x3F, 0x00, 0x3F, 0x05, 0xED, 0x00, 0x00,
        0x0B, 0x2C, 0x9C, 0x06, 0x07, 0xF3, 0x51, 0x05, 0xF7, 0xA7,

Reply via email to