@@ -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;
@@ -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
@@ -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
@@ -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
@@ -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 ********************
@@ -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
@@ -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;
/**
* @}
@@ -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
@@ -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");
@@ -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;
@@ -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
@@ -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 */
@@ -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".*/
@@ -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 {
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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)
@@ -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);
@@ -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);
@@ -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];
@@ -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),
@@ -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
@@ -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)
};
@@ -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];
@@ -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;
@@ -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];
@@ -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 */
@@ -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;
@@ -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
@@ -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
@@ -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 {
@@ -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 {
@@ -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,