diff options
Diffstat (limited to 'platform/linux-generic/include')
16 files changed, 110 insertions, 38 deletions
diff --git a/platform/linux-generic/include/odp/api/plat/atomic_inlines.h b/platform/linux-generic/include/odp/api/plat/atomic_inlines.h index a9da70890..5ce4bfc28 100644 --- a/platform/linux-generic/include/odp/api/plat/atomic_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/atomic_inlines.h @@ -100,7 +100,7 @@ _ODP_INLINE uint32_t odp_atomic_fetch_add_u32(odp_atomic_u32_t *atom, _ODP_INLINE void odp_atomic_add_u32(odp_atomic_u32_t *atom, uint32_t val) { - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); + _odp_atomic_add_u32(atom, val); } _ODP_INLINE uint32_t odp_atomic_fetch_sub_u32(odp_atomic_u32_t *atom, @@ -111,7 +111,7 @@ _ODP_INLINE uint32_t odp_atomic_fetch_sub_u32(odp_atomic_u32_t *atom, _ODP_INLINE void odp_atomic_sub_u32(odp_atomic_u32_t *atom, uint32_t val) { - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); + _odp_atomic_sub_u32(atom, val); } _ODP_INLINE uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom) @@ -121,7 +121,7 @@ _ODP_INLINE uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom) _ODP_INLINE void odp_atomic_inc_u32(odp_atomic_u32_t *atom) { - (void)__atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); + _odp_atomic_inc_u32(atom); } _ODP_INLINE uint32_t odp_atomic_fetch_dec_u32(odp_atomic_u32_t *atom) @@ -131,7 +131,7 @@ _ODP_INLINE uint32_t odp_atomic_fetch_dec_u32(odp_atomic_u32_t *atom) _ODP_INLINE void odp_atomic_dec_u32(odp_atomic_u32_t *atom) { - (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); + _odp_atomic_dec_u32(atom); } _ODP_INLINE int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t *old_val, @@ -180,7 +180,7 @@ _ODP_INLINE void odp_atomic_min_u32(odp_atomic_u32_t *atom, uint32_t new_min) * CAS operation expression for the ATOMIC_OP macro */ #define ATOMIC_CAS_OP(ret_ptr, old_val, new_val) \ -({ \ +__extension__ ({ \ if (atom->v == (old_val)) { \ atom->v = (new_val); \ *(ret_ptr) = 1; \ @@ -197,7 +197,7 @@ _ODP_INLINE void odp_atomic_min_u32(odp_atomic_u32_t *atom, uint32_t new_min) * @return The old value of the variable. */ #define ATOMIC_OP(atom, expr) \ -({ \ +__extension__ ({ \ uint64_t _old_val; \ /* Loop while lock is already taken, stop when lock becomes clear */ \ while (__atomic_test_and_set(&(atom)->lock, __ATOMIC_ACQUIRE)) \ @@ -350,7 +350,7 @@ _ODP_INLINE uint64_t odp_atomic_fetch_add_u64(odp_atomic_u64_t *atom, _ODP_INLINE void odp_atomic_add_u64(odp_atomic_u64_t *atom, uint64_t val) { - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); + _odp_atomic_add_u64(atom, val); } _ODP_INLINE uint64_t odp_atomic_fetch_sub_u64(odp_atomic_u64_t *atom, @@ -361,7 +361,7 @@ _ODP_INLINE uint64_t odp_atomic_fetch_sub_u64(odp_atomic_u64_t *atom, _ODP_INLINE void odp_atomic_sub_u64(odp_atomic_u64_t *atom, uint64_t val) { - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); + _odp_atomic_sub_u64(atom, val); } _ODP_INLINE uint64_t odp_atomic_fetch_inc_u64(odp_atomic_u64_t *atom) @@ -371,7 +371,7 @@ _ODP_INLINE uint64_t odp_atomic_fetch_inc_u64(odp_atomic_u64_t *atom) _ODP_INLINE void odp_atomic_inc_u64(odp_atomic_u64_t *atom) { - (void)__atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); + _odp_atomic_inc_u64(atom); } _ODP_INLINE uint64_t odp_atomic_fetch_dec_u64(odp_atomic_u64_t *atom) @@ -381,7 +381,7 @@ _ODP_INLINE uint64_t odp_atomic_fetch_dec_u64(odp_atomic_u64_t *atom) _ODP_INLINE void odp_atomic_dec_u64(odp_atomic_u64_t *atom) { - (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); + _odp_atomic_dec_u64(atom); } _ODP_INLINE int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val, @@ -411,12 +411,12 @@ _ODP_INLINE void odp_atomic_store_rel_u64(odp_atomic_u64_t *atom, uint64_t val) _ODP_INLINE void odp_atomic_add_rel_u64(odp_atomic_u64_t *atom, uint64_t val) { - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELEASE); + _odp_atomic_add_rel_u64(atom, val); } _ODP_INLINE void odp_atomic_sub_rel_u64(odp_atomic_u64_t *atom, uint64_t val) { - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE); + _odp_atomic_sub_rel_u64(atom, val); } _ODP_INLINE int odp_atomic_cas_acq_u64(odp_atomic_u64_t *atom, @@ -485,12 +485,12 @@ _ODP_INLINE void odp_atomic_store_rel_u32(odp_atomic_u32_t *atom, uint32_t val) _ODP_INLINE void odp_atomic_add_rel_u32(odp_atomic_u32_t *atom, uint32_t val) { - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELEASE); + _odp_atomic_add_rel_u32(atom, val); } _ODP_INLINE void odp_atomic_sub_rel_u32(odp_atomic_u32_t *atom, uint32_t val) { - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE); + _odp_atomic_sub_rel_u32(atom, val); } _ODP_INLINE int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom, diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index 81280b1fa..d98e0e6be 100644 --- a/platform/linux-generic/include/odp_atomic_internal.h +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -138,7 +138,7 @@ static inline void _odp_atomic_flag_clear(_odp_atomic_flag_t *flag) #ifdef ODP_ATOMIC_U128 /** An unsigned 128-bit (16-byte) scalar type */ -typedef __int128 _uint128_t; +__extension__ typedef __int128 _uint128_t; /** Atomic 128-bit type */ typedef struct ODP_ALIGNED(16) { diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index e7bc78d6e..dec85f9d3 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -83,7 +83,7 @@ struct ODP_ALIGNED_CACHE odp_buffer_hdr_t { uint8_t flow_id; /* Data or next header */ - uint8_t data[0]; + uint8_t data[]; }; /* Buffer header size is critical for performance. Ensure that it does not accidentally diff --git a/platform/linux-generic/include/odp_config_internal.h b/platform/linux-generic/include/odp_config_internal.h index 40d2639f1..899b261bd 100644 --- a/platform/linux-generic/include/odp_config_internal.h +++ b/platform/linux-generic/include/odp_config_internal.h @@ -54,6 +54,11 @@ extern "C" { #define CONFIG_QUEUE_MAX_ORD_LOCKS 2 /* + * Maximum number of stashes + */ +#define CONFIG_MAX_STASHES 128 + +/* * Maximum number of packet IO resources */ #define ODP_CONFIG_PKTIO_ENTRIES 64 @@ -119,10 +124,10 @@ extern "C" { /* * Number of shared memory blocks reserved for implementation internal use. * - * Each pool requires three SHM blocks (buffers, ring, user area). 20 blocks are - * reserved for per ODP module global data. + * Each stash requires one SHM block, each pool requires three blocks (buffers, + * ring, user area), and 20 blocks are reserved for per ODP module global data. */ -#define CONFIG_INTERNAL_SHM_BLOCKS ((ODP_CONFIG_POOLS * 3) + 20) +#define CONFIG_INTERNAL_SHM_BLOCKS (CONFIG_MAX_STASHES + (ODP_CONFIG_POOLS * 3) + 20) /* * Maximum number of shared memory blocks. diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index 5027cfe4a..c5c1890c3 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -29,6 +29,10 @@ extern "C" { #endif +/* Avoid "ISO C99 requires at least one argument for the "..." in a variadic + * macro" errors when building with 'pedantic' option. */ +#pragma GCC system_header + /* Debug level configure option. Zero is the highest level. Value of N prints debug messages from * level 0 to N. */ #define CONFIG_DEBUG_LEVEL 0 diff --git a/platform/linux-generic/include/odp_event_vector_internal.h b/platform/linux-generic/include/odp_event_vector_internal.h index d3322eff5..2d51801df 100644 --- a/platform/linux-generic/include/odp_event_vector_internal.h +++ b/platform/linux-generic/include/odp_event_vector_internal.h @@ -17,6 +17,8 @@ #include <odp/api/packet.h> #include <odp_buffer_internal.h> +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" /** * Internal event vector header */ @@ -28,9 +30,10 @@ typedef struct { uint32_t size; /* Vector of packet handles */ - odp_packet_t packet[0]; + odp_packet_t packet[]; } odp_event_vector_hdr_t; +#pragma GCC diagnostic pop /** * Return the vector header diff --git a/platform/linux-generic/include/odp_ipsec_internal.h b/platform/linux-generic/include/odp_ipsec_internal.h index 66d85d119..cc224e4cc 100644 --- a/platform/linux-generic/include/odp_ipsec_internal.h +++ b/platform/linux-generic/include/odp_ipsec_internal.h @@ -84,6 +84,8 @@ int _odp_ipsec_status_send(odp_queue_t queue, #define IPSEC_MAX_SALT_LEN 4 /**< Maximum salt length in bytes */ +#define IPSEC_SEQ_HI_LEN 4 /**< ESN Higher bits length in bytes */ + /* The minimum supported AR window size */ #define IPSEC_AR_WIN_SIZE_MIN 32 @@ -175,6 +177,8 @@ struct ipsec_sa_s { unsigned copy_flabel : 1; unsigned aes_ctr_iv : 1; unsigned udp_encap : 1; + unsigned esn : 1; + unsigned insert_seq_hi : 1; /* Only for outbound */ unsigned use_counter_iv : 1; @@ -264,8 +268,14 @@ typedef struct odp_ipsec_sa_lookup_s { /** IPSEC AAD */ typedef struct ODP_PACKED { - odp_u32be_t spi; /**< Security Parameter Index */ - odp_u32be_t seq_no; /**< Sequence Number */ + /**< Security Parameter Index */ + odp_u32be_t spi; + + /**< Sequence Number */ + union { + odp_u32be_t seq_no; + odp_u64be_t seq_no64; + }; } ipsec_aad_t; /* Return IV length required for the cipher for IPsec use */ @@ -317,14 +327,14 @@ int _odp_ipsec_sa_lifetime_update(ipsec_sa_t *ipsec_sa, uint32_t len, * * @retval <0 if the packet falls out of window */ -int _odp_ipsec_sa_replay_precheck(ipsec_sa_t *ipsec_sa, uint32_t seq, +int _odp_ipsec_sa_replay_precheck(ipsec_sa_t *ipsec_sa, uint64_t seq, odp_ipsec_op_status_t *status); /* Run check on sequence number of the packet and update window if necessary. * * @retval <0 if the packet falls out of window */ -int _odp_ipsec_sa_replay_update(ipsec_sa_t *ipsec_sa, uint32_t seq, +int _odp_ipsec_sa_replay_update(ipsec_sa_t *ipsec_sa, uint64_t seq, odp_ipsec_op_status_t *status); /** diff --git a/platform/linux-generic/include/odp_llqueue.h b/platform/linux-generic/include/odp_llqueue.h index cc4b84ecd..e9cf9945e 100644 --- a/platform/linux-generic/include/odp_llqueue.h +++ b/platform/linux-generic/include/odp_llqueue.h @@ -49,7 +49,7 @@ static odp_bool_t llq_on_queue(struct llnode *node); typedef uint64_t dintptr_t; #endif #if __SIZEOF_PTRDIFF_T__ == 8 -typedef __int128 dintptr_t; +__extension__ typedef __int128 dintptr_t; #endif struct llnode { diff --git a/platform/linux-generic/include/odp_macros_internal.h b/platform/linux-generic/include/odp_macros_internal.h index 229772373..997e0fd5b 100644 --- a/platform/linux-generic/include/odp_macros_internal.h +++ b/platform/linux-generic/include/odp_macros_internal.h @@ -22,14 +22,14 @@ extern "C" { #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define MIN(a, b) \ - ({ \ + __extension__ ({ \ __typeof__(a) tmp_a = (a); \ __typeof__(b) tmp_b = (b); \ tmp_a < tmp_b ? tmp_a : tmp_b; \ }) #define MAX(a, b) \ - ({ \ + __extension__ ({ \ __typeof__(a) tmp_a = (a); \ __typeof__(b) tmp_b = (b); \ tmp_a > tmp_b ? tmp_a : tmp_b; \ @@ -39,7 +39,7 @@ extern "C" { ((type *)(void *)(((char *)pointer) - offsetof(type, member))) #define DIV_ROUND_UP(a, b) \ - ({ \ + __extension__ ({ \ __typeof__(a) tmp_a = (a); \ __typeof__(b) tmp_b = (b); \ ODP_STATIC_ASSERT(__builtin_constant_p(b), ""); \ diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 497ea4aee..62f8aea25 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -73,6 +73,8 @@ typedef struct { ODP_STATIC_ASSERT(PKT_MAX_SEGS < UINT16_MAX, "PACKET_MAX_SEGS_ERROR"); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" /** * Internal Packet header * @@ -148,9 +150,10 @@ typedef struct odp_packet_hdr_t { }; /* Packet data storage */ - uint8_t data[0]; + uint8_t data[]; } odp_packet_hdr_t; +#pragma GCC diagnostic pop /* Packet header size is critical for performance. Ensure that it does not accidentally * grow over 256 bytes when cache line size is 64 bytes (or less). With larger cache line sizes, diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h index dc9f0d207..001bdfc37 100644 --- a/platform/linux-generic/include/odp_pool_internal.h +++ b/platform/linux-generic/include/odp_pool_internal.h @@ -35,6 +35,8 @@ typedef struct ODP_ALIGNED_CACHE pool_cache_t { } pool_cache_t; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" /* Buffer header ring */ typedef struct ODP_ALIGNED_CACHE { /* Ring header */ @@ -44,9 +46,10 @@ typedef struct ODP_ALIGNED_CACHE { odp_buffer_hdr_t *buf_hdr[CONFIG_POOL_MAX_NUM + 1]; /* Index to pointer look-up table for external memory pool */ - odp_buffer_hdr_t *buf_hdr_by_index[0]; + odp_buffer_hdr_t *buf_hdr_by_index[]; } pool_ring_t; +#pragma GCC diagnostic pop /* Callback function for pool destroy */ typedef void (*pool_destroy_cb_fn)(void *pool); diff --git a/platform/linux-generic/include/odp_ring_common.h b/platform/linux-generic/include/odp_ring_common.h index 88e6bf880..a2d9e4be5 100644 --- a/platform/linux-generic/include/odp_ring_common.h +++ b/platform/linux-generic/include/odp_ring_common.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, Nokia +/* Copyright (c) 2019-2021, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -12,7 +12,8 @@ extern "C" { #endif #define _ODP_RING_TYPE_U32 1 -#define _ODP_RING_TYPE_PTR 2 +#define _ODP_RING_TYPE_U64 2 +#define _ODP_RING_TYPE_PTR 3 #ifdef __cplusplus } diff --git a/platform/linux-generic/include/odp_ring_internal.h b/platform/linux-generic/include/odp_ring_internal.h index 6ac6d0ee3..d11e81bf2 100644 --- a/platform/linux-generic/include/odp_ring_internal.h +++ b/platform/linux-generic/include/odp_ring_internal.h @@ -1,5 +1,5 @@ /* Copyright (c) 2016-2018, Linaro Limited - * Copyright (c) 2019, Nokia + * Copyright (c) 2019-2021, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -45,12 +45,17 @@ struct ring_common { typedef struct ODP_ALIGNED_CACHE { struct ring_common r; - uint32_t data[0]; + uint32_t data[]; } ring_u32_t; typedef struct ODP_ALIGNED_CACHE { struct ring_common r; - void *data[0]; + uint64_t data[]; +} ring_u64_t; + +typedef struct ODP_ALIGNED_CACHE { + struct ring_common r; + void *data[]; } ring_ptr_t; /* 32-bit CAS with memory order selection */ @@ -87,6 +92,16 @@ static inline int cas_mo_u32(odp_atomic_u32_t *atom, uint32_t *old_val, #define _RING_ENQ ring_u32_enq #define _RING_ENQ_MULTI ring_u32_enq_multi #define _RING_LEN ring_u32_len +#elif _ODP_RING_TYPE == _ODP_RING_TYPE_U64 + #define _ring_gen_t ring_u64_t + #define _ring_data_t uint64_t + + #define _RING_INIT ring_u64_init + #define _RING_DEQ ring_u64_deq + #define _RING_DEQ_MULTI ring_u64_deq_multi + #define _RING_ENQ ring_u64_enq + #define _RING_ENQ_MULTI ring_u64_enq_multi + #define _RING_LEN ring_u64_len #elif _ODP_RING_TYPE == _ODP_RING_TYPE_PTR #define _ring_gen_t ring_ptr_t #define _ring_data_t void * diff --git a/platform/linux-generic/include/odp_ring_u64_internal.h b/platform/linux-generic/include/odp_ring_u64_internal.h new file mode 100644 index 000000000..4b4c7b1b5 --- /dev/null +++ b/platform/linux-generic/include/odp_ring_u64_internal.h @@ -0,0 +1,25 @@ +/* Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_RING_U64_INTERNAL_H_ +#define ODP_RING_U64_INTERNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp_ring_common.h> + +#undef _ODP_RING_TYPE +#define _ODP_RING_TYPE _ODP_RING_TYPE_U64 + +#include <odp_ring_internal.h> + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h index 23fd54bf9..435fa8b70 100644 --- a/platform/linux-generic/include/odp_timer_internal.h +++ b/platform/linux-generic/include/odp_timer_internal.h @@ -20,6 +20,8 @@ #include <odp/api/timer.h> #include <odp_global_data.h> +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" /** * Internal Timeout header */ @@ -37,6 +39,7 @@ typedef struct { odp_timer_t timer; } odp_timeout_hdr_t; +#pragma GCC diagnostic pop /* A larger decrement value should be used after receiving events compared to * an 'empty' call. */ diff --git a/platform/linux-generic/include/protocols/ipsec.h b/platform/linux-generic/include/protocols/ipsec.h index 7838076d4..eabd2d1d9 100644 --- a/platform/linux-generic/include/protocols/ipsec.h +++ b/platform/linux-generic/include/protocols/ipsec.h @@ -34,7 +34,7 @@ extern "C" { typedef struct ODP_PACKED { odp_u32be_t spi; /**< Security Parameter Index */ odp_u32be_t seq_no; /**< Sequence Number */ - uint8_t iv[0]; /**< Initialization vector */ + uint8_t iv[]; /**< Initialization vector */ } _odp_esphdr_t; /** @internal Compile time assert */ @@ -47,7 +47,7 @@ ODP_STATIC_ASSERT(sizeof(_odp_esphdr_t) == _ODP_ESPHDR_LEN, typedef struct ODP_PACKED { uint8_t pad_len; /**< Padding length (0-255) */ uint8_t next_header; /**< Next header protocol */ - uint8_t icv[0]; /**< Integrity Check Value (optional) */ + uint8_t icv[]; /**< Integrity Check Value (optional) */ } _odp_esptrl_t; /** @internal Compile time assert */ @@ -63,7 +63,7 @@ typedef struct ODP_PACKED { odp_u16be_t pad; /**< Padding (must be 0) */ odp_u32be_t spi; /**< Security Parameter Index */ odp_u32be_t seq_no; /**< Sequence Number */ - uint8_t icv[0]; /**< Integrity Check Value */ + uint8_t icv[]; /**< Integrity Check Value */ } _odp_ahhdr_t; /** @internal Compile time assert */ |