diff options
Diffstat (limited to 'platform/linux-generic')
24 files changed, 135 insertions, 91 deletions
diff --git a/platform/linux-generic/include/odp/api/plat/static_inline.h b/platform/linux-generic/include/odp/api/plat/static_inline.h new file mode 100644 index 000000000..633e2f273 --- /dev/null +++ b/platform/linux-generic/include/odp/api/plat/static_inline.h @@ -0,0 +1,43 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * Macro for static inline functions + */ + +#ifndef ODP_PLAT_STATIC_INLINE_H_ +#define ODP_PLAT_STATIC_INLINE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @internal + * @def ODP_ABI_COMPAT + * Control ABI compatibility + */ + +/** + * @internal + * @def _ODP_INLINE + * Define a function as inlined or not inlined (for ABI compatibility) + */ +#if 1 +#define ODP_ABI_COMPAT 1 +#define _ODP_INLINE +#else +#define ODP_ABI_COMPAT 0 +#define _ODP_INLINE static inline +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index f3696a994..43c29a761 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 @@ -709,9 +708,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 712799d71..01e0cae17 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -156,7 +156,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 df1b29ff8..158b1d5f1 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -37,13 +37,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 58d64aa5b..605d87502 100644 --- a/platform/linux-generic/include/odp_queue_scalable_internal.h +++ b/platform/linux-generic/include/odp_queue_scalable_internal.h @@ -34,10 +34,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 bd9e77c0a..77765fb89 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 7e3e156f9..e5ba8982a 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -61,7 +61,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 ac764b3af..b83486778 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; |