diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2014-08-21 02:03:02 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2014-08-22 12:42:02 +0400 |
commit | 7fd717d8ffdff7f09e4824a28bedaa9829f80cff (patch) | |
tree | 25383be1bb49718dab43478d84631ab0e4437242 /include | |
parent | 3ee9b44a2824457992bcafe7705b61d8e3be2b0c (diff) |
Move includes back into linux-generic
To much linux-generic specific details.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-and-Tested-by: Mike Holmes <mike.holmes@linaro.org>
Reviewed-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
Diffstat (limited to 'include')
30 files changed, 0 insertions, 4022 deletions
diff --git a/include/odp.h b/include/odp.h deleted file mode 100644 index 0ee3faf7..00000000 --- a/include/odp.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * The OpenDataPlane API - * - */ - -#ifndef ODP_H_ -#define ODP_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <odp_config.h> - -#include <odp_version.h> -#include <odp_std_types.h> -#include <odp_compiler.h> - -#include <odp_align.h> -#include <odp_hints.h> -#include <odp_debug.h> -#include <odp_byteorder.h> -#include <odp_coremask.h> -#include <odp_barrier.h> -#include <odp_spinlock.h> -#include <odp_atomic.h> - -#include <odp_init.h> -#include <odp_system_info.h> -#include <odp_thread.h> -#include <odp_shared_memory.h> -#include <odp_buffer.h> -#include <odp_buffer_pool.h> -#include <odp_queue.h> -#include <odp_ticketlock.h> -#include <odp_time.h> -#include <odp_timer.h> -#include <odp_schedule.h> -#include <odp_sync.h> -#include <odp_packet.h> -#include <odp_packet_flags.h> -#include <odp_packet_io.h> - -#ifdef __cplusplus -} -#endif -#endif diff --git a/include/odp_align.h b/include/odp_align.h deleted file mode 100644 index 5ee61be3..00000000 --- a/include/odp_align.h +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP alignments - */ - -#ifndef ODP_ALIGN_H_ -#define ODP_ALIGN_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __GNUC__ - -/* Checkpatch complains, but cannot use __aligned(size) for this purpose. */ - -/** - * Defines type/struct/variable alignment in bytes - */ -#define ODP_ALIGNED(x) __attribute__((__aligned__(x))) - -/** - * Defines type/struct to be packed - */ -#define ODP_PACKED __attribute__((__packed__)) - -/** - * Returns offset of member in type - */ -#define ODP_OFFSETOF(type, member) __builtin_offsetof(type, member) - -/** - * Returns sizeof member - */ -#define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member) - -#if defined __x86_64__ || defined __i386__ - -/** Cache line size */ -#define ODP_CACHE_LINE_SIZE 64 - -#elif defined __arm__ || defined __aarch64__ - -/** Cache line size */ -#define ODP_CACHE_LINE_SIZE 64 - -#elif defined __OCTEON__ - -/** Cache line size */ -#define ODP_CACHE_LINE_SIZE 128 - -#elif defined __powerpc__ - -/** Cache line size */ -#define ODP_CACHE_LINE_SIZE 64 - -#else -#error GCC target not found -#endif - -#else -#error Non-gcc compatible compiler -#endif - -/** Page size */ -#define ODP_PAGE_SIZE 4096 - - -/* - * Round up - */ - -/** - * @internal - * Round up 'x' to alignment 'align' - */ -#define ODP_ALIGN_ROUNDUP(x, align)\ - ((align) * (((x) + align - 1) / (align))) - -/** - * @internal - * Round up pointer 'x' to alignment 'align' - */ -#define ODP_ALIGN_ROUNDUP_PTR(x, align)\ - ((void *)ODP_ALIGN_ROUNDUP((uintptr_t)(x), (uintptr_t)(align))) - -/** - * @internal - * Round up 'x' to cache line size alignment - */ -#define ODP_CACHE_LINE_SIZE_ROUNDUP(x)\ - ODP_ALIGN_ROUNDUP(x, ODP_CACHE_LINE_SIZE) - -/** - * @internal - * Round up pointer 'x' to cache line size alignment - */ -#define ODP_CACHE_LINE_SIZE_ROUNDUP_PTR(x)\ - ((void *)ODP_CACHE_LINE_SIZE_ROUNDUP((uintptr_t)(x))) - -/** - * @internal - * Round up 'x' to page size alignment - */ -#define ODP_PAGE_SIZE_ROUNDUP(x)\ - ODP_ALIGN_ROUNDUP(x, ODP_PAGE_SIZE) - - -/* - * Round down - */ - -/** - * @internal - * Round down 'x' to 'align' alignment, which is a power of two - */ -#define ODP_ALIGN_ROUNDDOWN_POWER_2(x, align)\ - ((x) & (~((align) - 1))) - -/** - * @internal - * Round down pointer 'x' to 'align' alignment, which is a power of two - */ -#define ODP_ALIGN_ROUNDDOWN_PTR_POWER_2(x, align)\ -((void *)ODP_ALIGN_ROUNDDOWN_POWER_2((uintptr_t)(x), (uintptr_t)(align))) - -/** - * @internal - * Round down 'x' to cache line size alignment - */ -#define ODP_CACHE_LINE_SIZE_ROUNDDOWN(x)\ - ODP_ALIGN_ROUNDDOWN_POWER_2(x, ODP_CACHE_LINE_SIZE) - -/** - * @internal - * Round down pointer 'x' to cache line size alignment - */ -#define ODP_CACHE_LINE_SIZE_ROUNDDOWN_PTR(x)\ - ((void *)ODP_CACHE_LINE_SIZE_ROUNDDOWN((uintptr_t)(x))) - - -/** Defines type/struct/variable to be cache line size aligned */ -#define ODP_ALIGNED_CACHE ODP_ALIGNED(ODP_CACHE_LINE_SIZE) - -/** Defines type/struct/variable to be page size aligned */ -#define ODP_ALIGNED_PAGE ODP_ALIGNED(ODP_PAGE_SIZE) - - - -/* - * Check align - */ - -/** - * @internal - * Check if pointer 'x' is aligned to 'align', which is a power of two - */ -#define ODP_ALIGNED_CHECK_POWER_2(x, align)\ - ((((uintptr_t)(x)) & (((uintptr_t)(align))-1)) == 0) - -/** - * @internal - * Check if value is a power of two - */ -#define ODP_VAL_IS_POWER_2(x) ((((x)-1) & (x)) == 0) - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_atomic.h b/include/odp_atomic.h deleted file mode 100644 index 0cc4cf4c..00000000 --- a/include/odp_atomic.h +++ /dev/null @@ -1,470 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP atomic operations - */ - -#ifndef ODP_ATOMIC_H_ -#define ODP_ATOMIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> - - -/** - * Atomic integer - */ -typedef volatile int32_t odp_atomic_int_t; - -/** - * Atomic unsigned integer 64 bits - */ -typedef volatile uint64_t odp_atomic_u64_t; - -/** - * Atomic unsigned integer 32 bits - */ -typedef volatile uint32_t odp_atomic_u32_t; - - -/** - * Initialize atomic integer - * - * @param ptr An integer atomic variable - * - * @note The operation is not synchronized with other threads - */ -static inline void odp_atomic_init_int(odp_atomic_int_t *ptr) -{ - *ptr = 0; -} - -/** - * Load value of atomic integer - * - * @param ptr An atomic variable - * - * @return atomic integer value - * - * @note The operation is not synchronized with other threads - */ -static inline int odp_atomic_load_int(odp_atomic_int_t *ptr) -{ - return *ptr; -} - -/** - * Store value to atomic integer - * - * @param ptr An atomic variable - * @param new_value Store new_value to a variable - * - * @note The operation is not synchronized with other threads - */ -static inline void odp_atomic_store_int(odp_atomic_int_t *ptr, int new_value) -{ - *ptr = new_value; -} - -/** - * Fetch and add atomic integer - * - * @param ptr An atomic variable - * @param value A value to be added to the variable - * - * @return Value of the variable before the operation - */ -static inline int odp_atomic_fetch_add_int(odp_atomic_int_t *ptr, int value) -{ - return __sync_fetch_and_add(ptr, value); -} - -/** - * Fetch and subtract atomic integer - * - * @param ptr An atomic integer variable - * @param value A value to be subtracted from the variable - * - * @return Value of the variable before the operation - */ -static inline int odp_atomic_fetch_sub_int(odp_atomic_int_t *ptr, int value) -{ - return __sync_fetch_and_sub(ptr, value); -} - -/** - * Fetch and increment atomic integer by 1 - * - * @param ptr An atomic variable - * - * @return Value of the variable before the operation - */ -static inline int odp_atomic_fetch_inc_int(odp_atomic_int_t *ptr) -{ - return odp_atomic_fetch_add_int(ptr, 1); -} - -/** - * Increment atomic integer by 1 - * - * @param ptr An atomic variable - * - */ -static inline void odp_atomic_inc_int(odp_atomic_int_t *ptr) -{ - odp_atomic_fetch_add_int(ptr, 1); -} - -/** - * Fetch and decrement atomic integer by 1 - * - * @param ptr An atomic int variable - * - * @return Value of the variable before the operation - */ -static inline int odp_atomic_fetch_dec_int(odp_atomic_int_t *ptr) -{ - return odp_atomic_fetch_sub_int(ptr, 1); -} - -/** - * Decrement atomic integer by 1 - * - * @param ptr An atomic variable - * - */ -static inline void odp_atomic_dec_int(odp_atomic_int_t *ptr) -{ - odp_atomic_fetch_sub_int(ptr, 1); -} - -/** - * Initialize atomic uint32 - * - * @param ptr An atomic variable - * - * @note The operation is not synchronized with other threads - */ -static inline void odp_atomic_init_u32(odp_atomic_u32_t *ptr) -{ - *ptr = 0; -} - -/** - * Load value of atomic uint32 - * - * @param ptr An atomic variable - * - * @return atomic uint32 value - * - * @note The operation is not synchronized with other threads - */ -static inline uint32_t odp_atomic_load_u32(odp_atomic_u32_t *ptr) -{ - return *ptr; -} - -/** - * Store value to atomic uint32 - * - * @param ptr An atomic variable - * @param new_value Store new_value to a variable - * - * @note The operation is not synchronized with other threads - */ -static inline void odp_atomic_store_u32(odp_atomic_u32_t *ptr, - uint32_t new_value) -{ - *ptr = new_value; -} - -/** - * Fetch and add atomic uint32 - * - * @param ptr An atomic variable - * @param value A value to be added to the variable - * - * @return Value of the variable before the operation - */ -static inline uint32_t odp_atomic_fetch_add_u32(odp_atomic_u32_t *ptr, - uint32_t value) -{ - return __sync_fetch_and_add(ptr, value); -} - -/** - * Fetch and subtract uint32 - * - * @param ptr An atomic variable - * @param value A value to be sub to the variable - * - * @return Value of the variable before the operation - */ -static inline uint32_t odp_atomic_fetch_sub_u32(odp_atomic_u32_t *ptr, - uint32_t value) -{ - return __sync_fetch_and_sub(ptr, value); -} - -/** - * Fetch and increment atomic uint32 by 1 - * - * @param ptr An atomic variable - * - * @return Value of the variable before the operation - */ -#if defined __OCTEON__ - -static inline uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *ptr) -{ - uint32_t ret; - - __asm__ __volatile__ ("syncws"); - __asm__ __volatile__ ("lai %0,(%2)" : "=r" (ret), "+m" (ptr) : - "r" (ptr)); - - return ret; -} - -#else - -static inline uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *ptr) -{ - return odp_atomic_fetch_add_u32(ptr, 1); -} - -#endif - -/** - * Increment atomic uint32 by 1 - * - * @param ptr An atomic variable - * - */ -static inline void odp_atomic_inc_u32(odp_atomic_u32_t *ptr) -{ - odp_atomic_fetch_add_u32(ptr, 1); -} - -/** - * Fetch and decrement uint32 by 1 - * - * @param ptr An atomic variable - * - * @return Value of the variable before the operation - */ -static inline uint32_t odp_atomic_fetch_dec_u32(odp_atomic_u32_t *ptr) -{ - return odp_atomic_fetch_sub_u32(ptr, 1); -} - -/** - * Decrement atomic uint32 by 1 - * - * @param ptr An atomic variable - * - */ -static inline void odp_atomic_dec_u32(odp_atomic_u32_t *ptr) -{ - odp_atomic_fetch_sub_u32(ptr, 1); -} - -/** - * Atomic compare and set for 32bit - * - * @param dst destination location into which the value will be written. - * @param exp expected value. - * @param src new value. - * @return Non-zero on success; 0 on failure. - */ -static inline int -odp_atomic_cmpset_u32(odp_atomic_u32_t *dst, uint32_t exp, uint32_t src) -{ - return __sync_bool_compare_and_swap(dst, exp, src); -} - -/** - * Initialize atomic uint64 - * - * @param ptr An atomic variable - * - * @note The operation is not synchronized with other threads - */ -static inline void odp_atomic_init_u64(odp_atomic_u64_t *ptr) -{ - *ptr = 0; -} - -/** - * Load value of atomic uint64 - * - * @param ptr An atomic variable - * - * @return atomic uint64 value - * - * @note The operation is not synchronized with other threads - */ -static inline uint64_t odp_atomic_load_u64(odp_atomic_u64_t *ptr) -{ - return *ptr; -} - -/** - * Store value to atomic uint64 - * - * @param ptr An atomic variable - * @param new_value Store new_value to a variable - * - * @note The operation is not synchronized with other threads - */ -static inline void odp_atomic_store_u64(odp_atomic_u64_t *ptr, - uint64_t new_value) -{ - *ptr = new_value; -} - -/** - * Add atomic uint64 - * - * @param ptr An atomic variable - * @param value A value to be added to the variable - * - */ -static inline void odp_atomic_add_u64(odp_atomic_u64_t *ptr, uint64_t value) -{ - __sync_fetch_and_add(ptr, value); -} - -/** - * Fetch and add atomic uint64 - * - * @param ptr An atomic variable - * @param value A value to be added to the variable - * - * @return Value of the variable before the operation - */ - -#if defined __powerpc__ && !defined __powerpc64__ -static inline uint64_t odp_atomic_fetch_add_u64(odp_atomic_u64_t *ptr, - uint64_t value) -{ - return __sync_fetch_and_add((odp_atomic_u32_t *)ptr, - (uint32_t)value); -} -#else -static inline uint64_t odp_atomic_fetch_add_u64(odp_atomic_u64_t *ptr, - uint64_t value) -{ - return __sync_fetch_and_add(ptr, value); -} -#endif -/** - * Subtract atomic uint64 - * - * @param ptr An atomic variable - * @param value A value to be subtracted from the variable - * - */ -static inline void odp_atomic_sub_u64(odp_atomic_u64_t *ptr, uint64_t value) -{ - __sync_fetch_and_sub(ptr, value); -} - -/** - * Fetch and subtract atomic uint64 - * - * @param ptr An atomic variable - * @param value A value to be subtracted from the variable - * - * @return Value of the variable before the operation - */ -#if defined __powerpc__ && !defined __powerpc64__ -static inline uint64_t odp_atomic_fetch_sub_u64(odp_atomic_u64_t *ptr, - uint64_t value) -{ - return __sync_fetch_and_sub((odp_atomic_u32_t *)ptr, - (uint32_t)value); -} -#else -static inline uint64_t odp_atomic_fetch_sub_u64(odp_atomic_u64_t *ptr, - uint64_t value) -{ - return __sync_fetch_and_sub(ptr, value); -} -#endif -/** - * Fetch and increment atomic uint64 by 1 - * - * @param ptr An atomic variable - * - * @return Value of the variable before the operation - */ -static inline uint64_t odp_atomic_fetch_inc_u64(odp_atomic_u64_t *ptr) -{ - return odp_atomic_fetch_add_u64(ptr, 1); -} - -/** - * Increment atomic uint64 by 1 - * - * @param ptr An atomic variable - * - */ -static inline void odp_atomic_inc_u64(odp_atomic_u64_t *ptr) -{ - odp_atomic_fetch_add_u64(ptr, 1); -} - -/** - * Fetch and decrement atomic uint64 by 1 - * - * @param ptr An atomic variable - * - * @return Value of the variable before the operation - */ -static inline uint64_t odp_atomic_fetch_dec_u64(odp_atomic_u64_t *ptr) -{ - return odp_atomic_fetch_sub_u64(ptr, 1); -} - -/** - * Decrement atomic uint64 by 1 - * - * @param ptr An atomic variable - * - */ -static inline void odp_atomic_dec_u64(odp_atomic_u64_t *ptr) -{ - odp_atomic_fetch_sub_u64(ptr, 1); -} - -/** - * Atomic compare and set for 64bit - * - * @param dst destination location into which the value will be written. - * @param exp expected value. - * @param src new value. - * @return Non-zero on success; 0 on failure. - */ -static inline int -odp_atomic_cmpset_u64(odp_atomic_u64_t *dst, uint64_t exp, uint64_t src) -{ - return __sync_bool_compare_and_swap(dst, exp, src); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_barrier.h b/include/odp_barrier.h deleted file mode 100644 index a7b32155..00000000 --- a/include/odp_barrier.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP execution barriers - */ - -#ifndef ODP_BARRIER_H_ -#define ODP_BARRIER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> -#include <odp_atomic.h> - - -/** - * ODP execution barrier - */ -typedef struct odp_barrier_t { - int count; /**< @private Thread count */ - odp_atomic_int_t bar; /**< @private Barrier counter */ -} odp_barrier_t; - - -/** - * Init barrier with thread count - * - * @param barrier Barrier - * @param count Thread count - */ -void odp_barrier_init_count(odp_barrier_t *barrier, int count); - - -/** - * Synchronise thread execution on barrier - * - * @param barrier Barrier - */ -void odp_barrier_sync(odp_barrier_t *barrier); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_buffer.h b/include/odp_buffer.h deleted file mode 100644 index d8577fd9..00000000 --- a/include/odp_buffer.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP buffer descriptor - */ - -#ifndef ODP_BUFFER_H_ -#define ODP_BUFFER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> - - - -/** - * ODP buffer - */ -typedef uint32_t odp_buffer_t; - -#define ODP_BUFFER_INVALID (0xffffffff) /**< Invalid buffer */ - - -/** - * Buffer start address - * - * @param buf Buffer handle - * - * @return Buffer start address - */ -void *odp_buffer_addr(odp_buffer_t buf); - -/** - * Buffer maximum data size - * - * @param buf Buffer handle - * - * @return Buffer maximum data size - */ -size_t odp_buffer_size(odp_buffer_t buf); - -/** - * Buffer type - * - * @param buf Buffer handle - * - * @return Buffer type - */ -int odp_buffer_type(odp_buffer_t buf); - -#define ODP_BUFFER_TYPE_INVALID (-1) /**< Buffer type invalid */ -#define ODP_BUFFER_TYPE_ANY 0 /**< Buffer that can hold any other - buffer type */ -#define ODP_BUFFER_TYPE_RAW 1 /**< Raw buffer, no additional metadata */ -#define ODP_BUFFER_TYPE_PACKET 2 /**< Packet buffer */ -#define ODP_BUFFER_TYPE_TIMEOUT 3 /**< Timeout buffer */ - - -/** - * Tests if buffer is valid - * - * @param buf Buffer handle - * - * @return 1 if valid, otherwise 0 - */ -int odp_buffer_is_valid(odp_buffer_t buf); - -/** - * Print buffer metadata to STDOUT - * - * @param buf Buffer handle - * - */ -void odp_buffer_print(odp_buffer_t buf); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_buffer_pool.h b/include/odp_buffer_pool.h deleted file mode 100644 index 26d9f14a..00000000 --- a/include/odp_buffer_pool.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP buffer pool - */ - -#ifndef ODP_BUFFER_POOL_H_ -#define ODP_BUFFER_POOL_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -#include <odp_std_types.h> -#include <odp_buffer.h> - -/** Maximum queue name lenght in chars */ -#define ODP_BUFFER_POOL_NAME_LEN 32 - -/** Invalid buffer pool */ -#define ODP_BUFFER_POOL_INVALID (0xffffffff) - -/** ODP buffer pool */ -typedef uint32_t odp_buffer_pool_t; - - -/** - * Create a buffer pool - * - * @param name Name of the pool (max ODP_BUFFER_POOL_NAME_LEN - 1 chars) - * @param base_addr Pool base address - * @param size Pool size in bytes - * @param buf_size Buffer size in bytes - * @param buf_align Minimum buffer alignment - * @param buf_type Buffer type - * - * @return Buffer pool handle - */ -odp_buffer_pool_t odp_buffer_pool_create(const char *name, - void *base_addr, uint64_t size, - size_t buf_size, size_t buf_align, - int buf_type); - - -/** - * Find a buffer pool by name - * - * @param name Name of the pool - * - * @return Buffer pool handle, or ODP_BUFFER_POOL_INVALID if not found. - */ -odp_buffer_pool_t odp_buffer_pool_lookup(const char *name); - - -/** - * Print buffer pool info - * - * @param pool Pool handle - * - */ -void odp_buffer_pool_print(odp_buffer_pool_t pool); - - -/** - * Buffer alloc - * - * The validity of a buffer can be cheked at any time with odp_buffer_is_valid() - * @param pool Pool handle - * - * @return Buffer handle or ODP_BUFFER_INVALID - */ -odp_buffer_t odp_buffer_alloc(odp_buffer_pool_t pool); - - -/** - * Buffer free - * - * @param buf Buffer handle - * - */ -void odp_buffer_free(odp_buffer_t buf); - - -/** - * Buffer pool of the buffer - * - * @param buf Buffer handle - * - * @return Buffer pool the buffer was allocated from - */ -odp_buffer_pool_t odp_buffer_pool(odp_buffer_t buf); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_byteorder.h b/include/odp_byteorder.h deleted file mode 100644 index e0f7a17f..00000000 --- a/include/odp_byteorder.h +++ /dev/null @@ -1,268 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP byteorder - */ - -#ifndef ODP_BYTEORDER_H_ -#define ODP_BYTEORDER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <endian.h> -#include <odp_std_types.h> -#include <odp_compiler.h> - -#ifndef __BYTE_ORDER -#error __BYTE_ORDER not defined! -#endif - -#ifndef __BIG_ENDIAN -#error __BIG_ENDIAN not defined! -#endif - -#ifndef __LITTLE_ENDIAN -#error __LITTLE_ENDIAN not defined! -#endif - -/** Big endian byte order */ -#define ODP_BIG_ENDIAN __BIG_ENDIAN - -/** Little endian byte order */ -#define ODP_LITTLE_ENDIAN __LITTLE_ENDIAN - -/** Selected byte order */ -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define ODP_BYTE_ORDER ODP_LITTLE_ENDIAN -#elif __BYTE_ORDER == __BIG_ENDIAN -#define ODP_BYTE_ORDER ODP_BIG_ENDIAN -#endif - - -/* for use with type checkers such as sparse */ -#ifdef __CHECKER__ -/** @internal bitwise attribute */ -#define __odp_bitwise __attribute__((bitwise)) -/** @internal force attribute */ -#define __odp_force __attribute__((force)) -#else -/** @internal bitwise attribute */ -#define __odp_bitwise -/** @internal force attribute */ -#define __odp_force -#endif - - -typedef uint16_t __odp_bitwise uint16le_t; /**< unsigned 16bit little endian */ -typedef uint16_t __odp_bitwise uint16be_t; /**< unsigned 16bit big endian */ - -typedef uint32_t __odp_bitwise uint32le_t; /**< unsigned 32bit little endian */ -typedef uint32_t __odp_bitwise uint32be_t; /**< unsigned 32bit big endian */ - -typedef uint64_t __odp_bitwise uint64le_t; /**< unsigned 64bit little endian */ -typedef uint64_t __odp_bitwise uint64be_t; /**< unsigned 64bit big endian */ - -typedef uint16_t __odp_bitwise uint16sum_t; /**< unsigned 16bit bitwise */ -typedef uint32_t __odp_bitwise uint32sum_t; /**< unsigned 32bit bitwise */ -/* - * Big Endian -> CPU byte order: - */ - -/** - * Convert 16bit big endian to cpu native uint16_t - * @param be16 big endian 16bit - * @return cpu native uint16_t - */ -static inline uint16_t odp_be_to_cpu_16(uint16be_t be16) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return __odp_builtin_bswap16((__odp_force uint16_t)be16); -#else - return (__odp_force uint16_t)be16; -#endif -} - -/** - * Convert 32bit big endian to cpu native uint32_t - * @param be32 big endian 32bit - * @return cpu native uint32_t - */ -static inline uint32_t odp_be_to_cpu_32(uint32be_t be32) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return __builtin_bswap32((__odp_force uint32_t)be32); -#else - return (__odp_force uint32_t)be32; -#endif -} - -/** - * Convert 64bit big endian to cpu native uint64_t - * @param be64 big endian 64bit - * @return cpu native uint64_t - */ -static inline uint64_t odp_be_to_cpu_64(uint64be_t be64) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return __builtin_bswap64((__odp_force uint64_t)be64); -#else - return (__odp_force uint64_t)be64; -#endif -} - - -/* - * CPU byte order -> Big Endian: - */ - -/** - * Convert cpu native uint16_t to 16bit big endian - * @param cpu16 uint16_t in cpu native format - * @return big endian 16bit - */ -static inline uint16be_t odp_cpu_to_be_16(uint16_t cpu16) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint16be_t)__odp_builtin_bswap16(cpu16); -#else - return (__odp_force uint16be_t)cpu16; -#endif -} - -/** - * Convert cpu native uint32_t to 32bit big endian - * @param cpu32 uint32_t in cpu native format - * @return big endian 32bit - */ -static inline uint32be_t odp_cpu_to_be_32(uint32_t cpu32) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint32be_t)__builtin_bswap32(cpu32); -#else - return (__odp_force uint32be_t)cpu32; -#endif -} - -/** - * Convert cpu native uint64_t to 64bit big endian - * @param cpu64 uint64_t in cpu native format - * @return big endian 64bit - */ -static inline uint64be_t odp_cpu_to_be_64(uint64_t cpu64) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint64be_t)__builtin_bswap64(cpu64); -#else - return (__odp_force uint64be_t)cpu64; -#endif -} - - -/* - * Little Endian -> CPU byte order: - */ - -/** - * Convert 16bit little endian to cpu native uint16_t - * @param le16 little endian 16bit - * @return cpu native uint16_t - */ -static inline uint16_t odp_le_to_cpu_16(uint16le_t le16) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint16_t)le16; -#else - return __odp_builtin_bswap16((__odp_force uint16_t)le16); -#endif -} - -/** - * Convert 32bit little endian to cpu native uint32_t - * @param le32 little endian 32bit - * @return cpu native uint32_t - */ -static inline uint32_t odp_le_to_cpu_32(uint32le_t le32) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint32_t)le32; -#else - return __builtin_bswap32((__odp_force uint32_t)le32); -#endif -} - -/** - * Convert 64bit little endian to cpu native uint64_t - * @param le64 little endian 64bit - * @return cpu native uint64_t - */ -static inline uint64_t odp_le_to_cpu_64(uint64le_t le64) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint64_t)le64; -#else - return __builtin_bswap64((__odp_force uint64_t)le64); -#endif -} - - -/* - * CPU byte order -> Little Endian: - */ - -/** - * Convert cpu native uint16_t to 16bit little endian - * @param cpu16 uint16_t in cpu native format - * @return little endian 16bit - */ -static inline uint16le_t odp_cpu_to_le_16(uint16_t cpu16) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint16le_t)cpu16; -#else - return (__odp_force uint16le_t)__odp_builtin_bswap16(cpu16); -#endif -} - -/** - * Convert cpu native uint32_t to 32bit little endian - * @param cpu32 uint32_t in cpu native format - * @return little endian 32bit - */ -static inline uint32le_t odp_cpu_to_le_32(uint32_t cpu32) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint32le_t)cpu32; -#else - return (__odp_force uint32le_t)__builtin_bswap32(cpu32); -#endif -} - -/** - * Convert cpu native uint64_t to 64bit little endian - * @param cpu64 uint64_t in cpu native format - * @return little endian 64bit - */ -static inline uint64le_t odp_cpu_to_le_64(uint64_t cpu64) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint64le_t)cpu64; -#else - return (__odp_force uint64le_t)__builtin_bswap64(cpu64); -#endif -} - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_compiler.h b/include/odp_compiler.h deleted file mode 100644 index a4e6e78b..00000000 --- a/include/odp_compiler.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * Compiler related - */ - -#ifndef ODP_COMPILER_H_ -#define ODP_COMPILER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @internal GNU compiler version */ -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - -/** - * @internal - * Compiler __builtin_bswap16() is not available on all platforms - * until GCC 4.8.0 - work around this by offering __odp_builtin_bswap16() - * Don't use this function directly, instead see odp_byteorder.h - */ -#if GCC_VERSION < 40800 -#define __odp_builtin_bswap16(u16) ((((u16)&0x00ff) << 8)|(((u16)&0xff00) >> 8)) -#else -#define __odp_builtin_bswap16(u16) __builtin_bswap16(u16) -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_config.h b/include/odp_config.h deleted file mode 100644 index 7a15ff9f..00000000 --- a/include/odp_config.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP configuration - */ - -#ifndef ODP_CONFIG_H_ -#define ODP_CONFIG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Maximum number of threads - */ -#define ODP_CONFIG_MAX_THREADS 128 - -/** - * Maximum number of buffer pools - */ -#define ODP_CONFIG_BUFFER_POOLS 16 - -/** - * Maximum number of queues - */ -#define ODP_CONFIG_QUEUES 1024 - -/** - * Number of scheduling priorities - */ -#define ODP_CONFIG_SCHED_PRIOS 8 - -/** - * Maximum number of packet IO resources - */ -#define ODP_CONFIG_PKTIO_ENTRIES 64 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_coremask.h b/include/odp_coremask.h deleted file mode 100644 index 141cb6aa..00000000 --- a/include/odp_coremask.h +++ /dev/null @@ -1,177 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP core masks and enumeration - */ - -#ifndef ODP_COREMASK_H_ -#define ODP_COREMASK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -#include <odp_std_types.h> - -/** @internal */ -#define ODP_COREMASK_SIZE_U64 1 - -/** - * Core mask - * - * Don't access directly, use access functions. - */ -typedef struct odp_coremask_t { - uint64_t _u64[ODP_COREMASK_SIZE_U64]; /**< @private Mask*/ - -} odp_coremask_t; - - - -/** - * Add core mask bits from a string - * - * @param str Hexadecimal digits in a string. Core #0 is located - * at the least significant bit (0x1). - * @param mask Core mask to modify - * - * @note Supports currently only core indexes upto 63 - */ -void odp_coremask_from_str(const char *str, odp_coremask_t *mask); - -/** - * Write core mask as a string of hexadecimal digits - * - * @param str String for output - * @param len Size of string length (incl. ending zero) - * @param mask Core mask - * - * @note Supports currently only core indexes upto 63 - */ -void odp_coremask_to_str(char *str, int len, const odp_coremask_t *mask); - - -/** - * Add core mask bits from a u64 array - * - * In the array core #0 is located at the least significant bit - * of the first word (u64[0] = 0x1). - * - * Examples - * core 0: u64[0] = 0x1 - * core 1: u64[0] = 0x2 - * ... - * core 63: u64[0] = 0x8000 0000 0000 0000 - * core 64: u64[0] = 0x0, u64[1] = 0x1 - * core 65: u64[0] = 0x0, u64[1] = 0x2 - * - * @param u64 An array of u64 bit words - * @param num Number of u64 words in the array - * @param mask Core mask to modify - * - * @note Supports currently only core indexes upto 63 - */ -void odp_coremask_from_u64(const uint64_t *u64, int num, odp_coremask_t *mask); - -/** - * Clear entire mask - * @param mask Core mask to flush with zero value - */ -static inline void odp_coremask_zero(odp_coremask_t *mask) -{ - mask->_u64[0] = 0; -} - -/** - * Add core to mask - * @param core Core number - * @param mask add core number in core mask - */ -void odp_coremask_set(int core, odp_coremask_t *mask); - -/** - * Remove core from mask - * @param core Core number - * @param mask clear core number from core mask - */ -void odp_coremask_clr(int core, odp_coremask_t *mask); - -/** - * Test if core is a member of mask - * @param core Core number - * @param mask Core mask to check if core num set or not - * @return non-zero if set otherwise 0 - */ -int odp_coremask_isset(int core, const odp_coremask_t *mask); - -/** - * Count number of cores in mask - * @param mask Core mask - * @return coremask count - */ -int odp_coremask_count(const odp_coremask_t *mask); - - - -/** - * Logical AND over two source masks. - * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 - */ -static inline void odp_coremask_and(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] & src2->_u64[0]; -} - -/** - * Logical OR over two source masks. - * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 - */ -static inline void odp_coremask_or(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] | src2->_u64[0]; -} - -/** - * Logical XOR over two source masks. - * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 - */ -static inline void odp_coremask_xor(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] ^ src2->_u64[0]; -} - -/** - * Test if two masks contain the same cores - */ -static inline int odp_coremask_equal(odp_coremask_t *mask1, - odp_coremask_t *mask2) -{ - return (mask1->_u64[0] == mask2->_u64[0]); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_crypto.h b/include/odp_crypto.h deleted file mode 100644 index 9220fb5e..00000000 --- a/include/odp_crypto.h +++ /dev/null @@ -1,356 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP crypto - */ - -#ifndef ODP_CRYPTO_H_ -#define ODP_CRYPTO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <odp_std_types.h> -#include <odp_buffer.h> -#include <odp_buffer_pool.h> -#include <odp_queue.h> -#include <odp_packet.h> - -/** Invalid session handle */ -#define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL) - -/** - * Crypto API opaque session handle - */ -typedef uint64_t odp_crypto_session_t; - -/** - * Crypto API operation mode - */ -enum odp_crypto_op_mode { - ODP_CRYPTO_SYNC, /**< Synchronous, return results immediately */ - ODP_CRYPTO_ASYNC, /**< Aynchronous, return results via posted event */ -}; - -/** - * Crypto API operation type - */ -enum odp_crypto_op { - ODP_CRYPTO_OP_ENCODE, /**< Encrypt and/or compute authentication ICV */ - ODP_CRYPTO_OP_DECODE /**< Decrypt and/or verify authentication ICV */ -}; - -/** - * Crypto API cipher algorithm - */ -enum odp_cipher_alg { - ODP_CIPHER_ALG_NULL, /**< No cipher algorithm specified */ - ODP_CIPHER_ALG_DES, /**< DES */ - ODP_CIPHER_ALG_3DES_CBC, /**< Triple DES with cipher block chaining */ -}; - -/** - * Crypto API authentication algorithm - */ -enum odp_auth_alg { - ODP_AUTH_ALG_NULL, /**< No authentication algorithm specified */ - ODP_AUTH_ALG_MD5_96, /**< HMAC-MD5 with 96 bit key */ -}; - -/** - * Crypto API key structure - */ -typedef struct odp_crypto_key { - uint8_t *data; /**< Key data */ - uint32_t length; /**< Key length in bytes */ -} odp_crypto_key_t; - -/** - * Crypto API IV structure - */ -typedef struct odp_crypto_iv { - uint8_t *data; /**< IV data */ - uint32_t length; /**< IV length in bytes */ -} odp_crypto_iv_t; - -/** - * Crypto API data range specifier - */ -typedef struct odp_crypto_data_range { - uint32_t offset; /**< Offset from beginning of buffer (chain) */ - uint32_t length; /**< Length of data to operate on */ -} odp_crypto_data_range_t; - -/** - * Crypto API session creation paramters - * - * @todo Add "odp_session_proc_info_t" - */ -typedef struct odp_crypto_session_params { - enum odp_crypto_op op; /**< Encode versus decode */ - bool auth_cipher_text; /**< Authenticate/cipher ordering */ - enum odp_crypto_op_mode pref_mode; /**< Preferred sync vs async */ - enum odp_cipher_alg cipher_alg; /**< Cipher algorithm */ - odp_crypto_key_t cipher_key; /**< Cipher key */ - odp_crypto_iv_t iv; /**< Cipher Initialization Vector (IV) */ - enum odp_auth_alg auth_alg; /**< Authentication algorithm */ - odp_crypto_key_t auth_key; /**< Authentication key */ - odp_queue_t compl_queue; /**< Async mode completion event queue */ - odp_buffer_pool_t output_pool; /**< Output buffer pool */ -} odp_crypto_session_params_t; - -/** - * @var odp_crypto_session_params_t::auth_cipher_text - * - * Controls ordering of authentication and cipher operations, - * and is relative to the operation (encode vs decode). - * When encoding, @c TRUE indicates the authentication operation - * should be peformed @b after the cipher operation else before. - * When decoding, @c TRUE indicates the reverse order of operation. - * - * @var odp_crypto_session_params_t::compl_queue - * - * When the API operates asynchronously, the completion queue is - * used to return the completion status of the operation to the - * application. - * - * @var odp_crypto_session_params_t::output_pool - * - * When the output packet is not specified during the call to - * odp_crypto_operation, the output packet buffer will be allocated - * from this pool. - */ - -/** - * Crypto API per packet operation parameters - * - * @todo Clarify who zero's ICV and how this relates to "hash_result_offset" - */ -typedef struct odp_crypto_op_params { - odp_crypto_session_t session; /**< Session handle from creation */ - odp_packet_t pkt; /**< Input packet buffer */ - odp_packet_t out_pkt; /**< Output packet buffer */ - uint8_t *override_iv_ptr; /**< Override session IV pointer */ - uint32_t hash_result_offset; /**< Offset from start of packet buffer for hash result */ - odp_crypto_data_range_t cipher_range; /**< Data range to apply cipher */ - odp_crypto_data_range_t auth_range; /**< Data range to authenticate */ -} odp_crypto_op_params_t; - -/** - * @var odp_crypto_op_params_t::pkt - * Specifies the input packet buffer for the crypto operation. When the - * @c out_pkt variable is set to @c ODP_PACKET_INVALID (indicating a new - * buffer should be allocated for the resulting packet), the \#define TBD - * indicates whether the implementation will free the input packet buffer - * or if it becomes the responsibility of the caller. - * - * @var odp_crypto_op_params_t::out_pkt - * - * The API supports both "in place" (the original packet "pkt" is - * modified) and "copy" (the packet is replicated to a new buffer - * which contains the modified data). - * - * The "in place" mode of operation is indicated by setting @c out_pkt - * equal to @c pkt. For the copy mode of operation, setting @c out_pkt - * to a valid packet buffer value indicates the caller wishes to specify - * the destination buffer. Setting @c out_pkt to @c ODP_PACKET_INVALID - * indicates the caller wishes the destination packet buffer be allocated - * from the output pool specified during session creation. - * - * @sa odp_crypto_session_params_t::output_pool. - */ - -/** - * Crypto API session creation return code - */ -enum odp_crypto_ses_create_err { - ODP_CRYPTO_SES_CREATE_ERR_NONE, /**< Session created */ - ODP_CRYPTO_SES_CREATE_ERR_ENOMEM, /**< Creation failed, no resources */ - ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER, /**< Creation failed, bad cipher params */ - ODP_CRYPTO_SES_CREATE_ERR_INV_AUTH, /**< Creation failed, bad auth params */ -}; - -/** - * Crypto API algorithm return code - */ -enum crypto_alg_err { - ODP_CRYPTO_ALG_ERR_NONE, /**< Algorithm successful */ - ODP_CRYPTO_ALG_ERR_DATA_SIZE, /**< Invalid data block size */ - ODP_CRYPTO_ALG_ERR_KEY_SIZE, /**< Key size invalid for algorithm */ - ODP_CRYPTO_ALG_ERR_ICV_CHECK, /**< Computed ICV value mismatch */ -}; - -/** - * Crypto API hardware centric return code - */ -enum crypto_hw_err { - ODP_CRYPTO_HW_ERR_NONE, /**< Operation completed successfully */ - ODP_CRYPTO_HW_ERR_DMA, /**< Error detected during DMA of data */ - ODP_CRYPTO_HW_ERR_BP_DEPLETED, /**< Operation failed due to buffer pool depletion */ -}; - -/** - * Cryto API per packet operation completion status - */ -typedef struct odp_crypto_compl_status { - enum crypto_alg_err alg_err; /**< Algorithm specific return code */ - enum crypto_hw_err hw_err; /**< Hardware specific return code */ -} odp_crypto_compl_status_t; - - -/** - * Crypto session creation (synchronous) - * - * @param params Session parameters - * @param session Created session else ODP_CRYPTO_SESSION_INVALID - * @param status Failure code if unsuccessful - * - * @return 0 if successful else -1 - */ -int -odp_crypto_session_create(odp_crypto_session_params_t *params, - odp_crypto_session_t *session, - enum odp_crypto_ses_create_err *status); - -/** - * Crypto session creation (asynchronous) - * - * Initiate crypto session creation. Results are delivered using - * the completion event via the completion queue. - * - * @param params Session parameters - * @param completion_event Event by which the session creation results are - * delivered. - * @param completion_queue Queue by which the completion event will be - * delivered. - * - * @return 0 if successful else -1 - * - */ -int -odp_crypto_session_create_async(odp_crypto_session_params_t *params, - odp_buffer_t completion_event, - odp_queue_t completion_queue); - - -/** - * Crypto session creation completion status - * - * Accessor function for obtaining creation status from the completion event. - * - * @param completion_event Event containing operation results - * @param status Pointer to store creation return code - */ -void -odp_crypto_get_ses_create_compl_status(odp_buffer_t completion_event, - enum odp_crypto_ses_create_err *status); - -/** - * Crypto session creation completion return value - * - * Accessor function for obtaining handle for newly created session. - * - * @param completion_event Event containing operation results - * @param session Pointer to store session handle - */ -void -odp_crypto_get_ses_create_compl_session(odp_buffer_t completion_event, - odp_crypto_session_t *session); - -/** - * Crypto per packet operation - * - * Performs the cryptographic operations specified during session creation - * on the packet. If the operation is performed synchronously, "posted" - * will return FALSE and the result of the operation is immediately available - * in the completion event. If "posted" returns TRUE the result will be - * delivered via the completion queue specified when the session was created. - * - * @todo Resolve if completion_event is necessary, can/should the output - * packet buffer always be used instead. - * - * @param params Operation parameters - * @param posted Pointer to return posted, TRUE for async operation - * @param completion_event Event by which the operation results are delivered. - * - * @return 0 if successful else -1 - */ -int -odp_crypto_operation(odp_crypto_op_params_t *params, - bool *posted, - odp_buffer_t completion_event); - -/** - * Crypto per packet operation set user context in completion event - * - * @param completion_event Event containing operation results - * @param ctx User data - */ -void -odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event, - void *ctx); - -/** - * Crypto per packet operation completion status - * - * Accessor function for obtaining operation status from the completion event. - * - * @param completion_event Event containing operation results - * @param auth Pointer to store authentication results - * @param cipher Pointer to store cipher results - */ -void -odp_crypto_get_operation_compl_status(odp_buffer_t completion_event, - odp_crypto_compl_status_t *auth, - odp_crypto_compl_status_t *cipher); - -/** - * Crypto per packet operation query completed operation packet - * - * Accessor function for obtaining current packet buffer, can be - * different from input packet buffer on some systems - * - * @param completion_event Event containing operation results - * - * @return Packet structure where data now resides - */ -odp_packet_t -odp_crypto_get_operation_compl_packet(odp_buffer_t completion_event); - -/** - * Crypto per packet operation query user context in completion event - * - * @param completion_event Event containing operation results - * - * @return User data - */ -void * -odp_crypto_get_operation_compl_ctx(odp_buffer_t completion_event); - -/** - * Generate random byte string - * - * @param buf Pointer to store result - * @param len Pointer to input length value as well as return value - * @param use_entropy Use entropy - * - * @todo Define the implication of the use_entropy parameter - * - * @return 0 if succesful - */ -int -odp_hw_random_get(uint8_t *buf, size_t *len, bool use_entropy); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_debug.h b/include/odp_debug.h deleted file mode 100644 index e8f60036..00000000 --- a/include/odp_debug.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -/** - * @file - * - * ODP debug - */ - -#ifndef ODP_DEBUG_H_ -#define ODP_DEBUG_H_ - -#include <stdio.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __GNUC__ - -/** - * Indicate deprecated variables, functions or types - */ -#define ODP_DEPRECATED __attribute__((__deprecated__)) - -/** - * Intentionally unused variables ot functions - */ -#define ODP_UNUSED __attribute__((__unused__)) - -#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) - -/** - * _Static_assert was only added in GCC 4.6. Provide a weak replacement - * for previous versions. - */ -#define _Static_assert(e, s) extern int (*static_assert_checker (void)) \ - [sizeof (struct { unsigned int error_if_negative: (e) ? 1 : -1; })] - -#endif - -#else - -#define ODP_DEPRECATED -#define ODP_UNUSED - -#endif - -/** - * Runtime assertion-macro - aborts if 'cond' is false. - */ -#ifndef ODP_NO_DEBUG -#define ODP_ASSERT(cond, msg) \ - do { if (!(cond)) {ODP_ERR("%s\n", msg); abort(); } } while (0) -#else -#define ODP_ASSERT(cond, msg) -#endif - -/** - * Compile time assertion-macro - fail compilation if cond is false. - * @note This macro has zero runtime overhead - */ -#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) - -/** - * Debug printing macro, which prints output when DEBUG flag is set. - */ -#define ODP_DBG(fmt, ...) \ - do { if (ODP_DEBUG_PRINT == 1) \ - printf(fmt, ##__VA_ARGS__); \ - } while (0) - -/** - * Print output to stderr (file, line and function). - */ -#define ODP_ERR(fmt, ...) \ - fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_hints.h b/include/odp_hints.h deleted file mode 100644 index e1cd1d02..00000000 --- a/include/odp_hints.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP compiler hints - */ - -#ifndef ODP_HINTS_H_ -#define ODP_HINTS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __GNUC__ - - -/** - * Hot code section - */ -#define ODP_HOT_CODE __attribute__((__hot__)) - -/** - * Cold code section - */ -#define ODP_COLD_CODE __attribute__((__cold__)) - -/** - * Branch likely taken - */ -#define odp_likely(x) __builtin_expect((x), 1) - -/** - * Branch unlikely taken - */ -#define odp_unlikely(x) __builtin_expect((x), 0) - - -/* - * __builtin_prefetch (const void *addr, rw, locality) - * - * rw 0..1 (0: read, 1: write) - * locality 0..3 (0: dont leave to cache, 3: leave on all cache levels) - */ - -/** - * Cache prefetch address - */ -#define odp_prefetch(x) __builtin_prefetch((x), 0, 3) - -/** - * Cache prefetch address for storing - */ -#define odp_prefetch_store(x) __builtin_prefetch((x), 1, 3) - - - -#else - -#define ODP_HOT_CODE -#define ODP_COLD_CODE -#define odp_likely(x) -#define odp_unlikely(x) -#define odp_prefetch(x) -#define odp_prefetch_store(x) - -#endif - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_init.h b/include/odp_init.h deleted file mode 100644 index 490324a3..00000000 --- a/include/odp_init.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP initialisation - */ - -#ifndef ODP_INIT_H_ -#define ODP_INIT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -#include <odp_std_types.h> - - - - -/** - * Perform global ODP initalisation. - * - * This function must be called once before calling - * any other ODP API functions. - * - * @return 0 if successful - */ -int odp_init_global(void); - - -/** - * Perform thread local ODP initalisation. - * - * All threads must call this function before calling - * any other ODP API functions. - * @param thr_id Thread id - * @return 0 if successful - */ -int odp_init_local(int thr_id); - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_packet.h b/include/odp_packet.h deleted file mode 100644 index ef4be9e9..00000000 --- a/include/odp_packet.h +++ /dev/null @@ -1,436 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP packet descriptor - */ - -#ifndef ODP_PACKET_H_ -#define ODP_PACKET_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <odp_buffer.h> - - -/** - * ODP packet descriptor - */ -typedef odp_buffer_t odp_packet_t; - -/** Invalid packet */ -#define ODP_PACKET_INVALID ODP_BUFFER_INVALID - -/** Invalid offset */ -#define ODP_PACKET_OFFSET_INVALID ((uint32_t)-1) - - -/** - * ODP packet segment handle - */ -typedef int odp_packet_seg_t; - -/** Invalid packet segment */ -#define ODP_PACKET_SEG_INVALID -1 - -/** - * ODP packet segment info - */ -typedef struct odp_packet_seg_info_t { - void *addr; /**< Segment start address */ - size_t size; /**< Segment maximum data size */ - void *data; /**< Segment data address */ - size_t data_len; /**< Segment data length */ -} odp_packet_seg_info_t; - - -/** - * Initialize the packet - * - * Needs to be called if the user allocates a packet buffer, i.e. the packet - * has not been received from I/O through ODP. - * - * @param pkt Packet handle - */ -void odp_packet_init(odp_packet_t pkt); - -/** - * Convert from packet handle to buffer handle - * - * @param buf Buffer handle - * - * @return Packet handle - */ -odp_packet_t odp_packet_from_buffer(odp_buffer_t buf); - -/** - * Convert from buffer handle to packet handle - * - * @param pkt Packet handle - * - * @return Buffer handle - */ -odp_buffer_t odp_buffer_from_packet(odp_packet_t pkt); - -/** - * Set the packet length - * - * @param pkt Packet handle - * @param len Length of packet in bytes - */ -void odp_packet_set_len(odp_packet_t pkt, size_t len); - -/** - * Get the packet length - * - * @param pkt Packet handle - * - * @return Packet length in bytes - */ -size_t odp_packet_get_len(odp_packet_t pkt); - -/** - * Get address to the start of the packet buffer - * - * The address of the packet buffer is not necessarily the same as the start - * address of the received frame, e.g. an eth frame may be offset by 2 or 6 - * bytes to ensure 32 or 64-bit alignment of the IP header. - * Use odp_packet_l2(pkt) to get the start address of a received valid frame - * or odp_packet_start(pkt) to get the start address even if no valid L2 header - * could be found. - * - * @param pkt Packet handle - * - * @return Pointer to the start of the packet buffer - * - * @see odp_packet_l2(), odp_packet_start() - */ -uint8_t *odp_packet_buf_addr(odp_packet_t pkt); - -/** - * Get pointer to the start of the received frame - * - * The address of the packet buffer is not necessarily the same as the start - * address of the received frame, e.g. an eth frame may be offset by 2 or 6 - * bytes to ensure 32 or 64-bit alignment of the IP header. - * Use odp_packet_l2(pkt) to get the start address of a received valid eth frame - * - * odp_packet_start() will always return a pointer to the start of the frame, - * even if the frame is unrecognized and no valid L2 header could be found. - * - * @param pkt Packet handle - * - * @return Pointer to the start of the received frame - * - * @see odp_packet_l2(), odp_packet_buf_addr() - */ -uint8_t *odp_packet_start(odp_packet_t pkt); - -/** - * Get pointer to the start of the L2 frame - * - * The L2 frame header address is not necessarily the same as the address of the - * packet buffer, see odp_packet_buf_addr() - * - * @param pkt Packet handle - * - * @return Pointer to L2 header or NULL if not found - * - * @see odp_packet_buf_addr(), odp_packet_start() - */ -uint8_t *odp_packet_l2(odp_packet_t pkt); - -/** - * Return the byte offset from the packet buffer to the L2 frame - * - * @param pkt Packet handle - * - * @return L2 byte offset or ODP_PACKET_OFFSET_INVALID if not found - */ -size_t odp_packet_l2_offset(odp_packet_t pkt); - -/** - * Set the byte offset to the L2 frame - * - * @param pkt Packet handle - * @param offset L2 byte offset - */ -void odp_packet_set_l2_offset(odp_packet_t pkt, size_t offset); - - -/** - * Get pointer to the start of the L3 packet - * - * @param pkt Packet handle - * - * @return Pointer to L3 packet or NULL if not found - * - */ -uint8_t *odp_packet_l3(odp_packet_t pkt); - -/** - * Return the byte offset from the packet buffer to the L3 packet - * - * @param pkt Packet handle - * - * @return L3 byte offset or ODP_PACKET_OFFSET_INVALID if not found - */ -size_t odp_packet_l3_offset(odp_packet_t pkt); - -/** - * Set the byte offset to the L3 packet - * - * @param pkt Packet handle - * @param offset L3 byte offset - */ -void odp_packet_set_l3_offset(odp_packet_t pkt, size_t offset); - - -/** - * Get pointer to the start of the L4 packet - * - * @param pkt Packet handle - * - * @return Pointer to L4 packet or NULL if not found - * - */ -uint8_t *odp_packet_l4(odp_packet_t pkt); - -/** - * Return the byte offset from the packet buffer to the L4 packet - * - * @param pkt Packet handle - * - * @return L4 byte offset or ODP_PACKET_OFFSET_INVALID if not found - */ -size_t odp_packet_l4_offset(odp_packet_t pkt); - -/** - * Set the byte offset to the L4 packet - * - * @param pkt Packet handle - * @param offset L4 byte offset - */ -void odp_packet_set_l4_offset(odp_packet_t pkt, size_t offset); - -/** - * Print (debug) information about the packet - * - * @param pkt Packet handle - */ -void odp_packet_print(odp_packet_t pkt); - -/** - * Copy contents and metadata from pkt_src to pkt_dst - * Useful when creating copies of packets - * - * @param pkt_dst Destination packet - * @param pkt_src Source packet - * - * @return 0 if successful - */ -int odp_packet_copy(odp_packet_t pkt_dst, odp_packet_t pkt_src); - -/** - * Tests if packet is segmented (a scatter/gather list) - * - * @param pkt Packet handle - * - * @return Non-zero if packet is segmented, otherwise 0 - */ -int odp_packet_is_segmented(odp_packet_t pkt); - -/** - * Segment count - * - * Returns number of segments in the packet. A packet has always at least one - * segment (the packet buffer itself). - * - * @param pkt Packet handle - * - * @return Segment count - */ -int odp_packet_seg_count(odp_packet_t pkt); - -/** - * Get segment by index - * - * @param pkt Packet handle - * @param index Segment index (0 ... seg_count-1) - * - * @return Segment handle, or ODP_PACKET_SEG_INVALID on an error - */ -odp_packet_seg_t odp_packet_seg(odp_packet_t pkt, int index); - -/** - * Get next segment - * - * @param pkt Packet handle - * @param seg Current segment handle - * - * @return Handle to next segment, or ODP_PACKET_SEG_INVALID on an error - */ -odp_packet_seg_t odp_packet_seg_next(odp_packet_t pkt, odp_packet_seg_t seg); - -/** - * Segment info - * - * Copies segment parameters into the info structure. - * - * @param pkt Packet handle - * @param seg Segment handle - * @param info Pointer to segment info structure - * - * @return 0 if successful, otherwise non-zero - */ -int odp_packet_seg_info(odp_packet_t pkt, odp_packet_seg_t seg, - odp_packet_seg_info_t *info); - -/** - * Segment start address - * - * @param pkt Packet handle - * @param seg Segment handle - * - * @return Segment start address, or NULL on an error - */ -void *odp_packet_seg_addr(odp_packet_t pkt, odp_packet_seg_t seg); - -/** - * Segment maximum data size - * - * @param pkt Packet handle - * @param seg Segment handle - * - * @return Segment maximum data size - */ -size_t odp_packet_seg_size(odp_packet_t pkt, odp_packet_seg_t seg); - -/** - * Segment data address - * - * @param pkt Packet handle - * @param seg Segment handle - * - * @return Segment data address - */ -void *odp_packet_seg_data(odp_packet_t pkt, odp_packet_seg_t seg); - -/** - * Segment data length - * - * @param pkt Packet handle - * @param seg Segment handle - * - * @return Segment data length - */ -size_t odp_packet_seg_data_len(odp_packet_t pkt, odp_packet_seg_t seg); - -/** - * Segment headroom - * - * seg_headroom = seg_data - seg_addr - * - * @param pkt Packet handle - * @param seg Segment handle - * - * @return Number of octets from seg_addr to seg_data - */ -size_t odp_packet_seg_headroom(odp_packet_t pkt, odp_packet_seg_t seg); - -/** - * Segment tailroom - * - * seg_tailroom = seg_size - seg_headroom - seg_data_len - * - * @param pkt Packet handle - * @param seg Segment handle - * - * @return Number of octets from end-of-data to end-of-segment - */ -size_t odp_packet_seg_tailroom(odp_packet_t pkt, odp_packet_seg_t seg); - -/** - * Push out segment head - * - * Push out segment data address (away from data) and increase data length. - * Does not modify packet in case of an error. - * - * seg_data -= len - * seg_data_len += len - * - * @param pkt Packet handle - * @param seg Segment handle - * @param len Number of octets to push head (0 ... seg_headroom) - * - * @return New segment data address, or NULL on an error - */ -void *odp_packet_seg_push_head(odp_packet_t pkt, odp_packet_seg_t seg, - size_t len); - -/** - * Pull in segment head - * - * Pull in segment data address (towards data) and decrease data length. - * Does not modify packet in case of an error. - * - * seg_data += len - * seg_data_len -= len - * - * @param pkt Packet handle - * @param seg Segment handle - * @param len Number of octets to pull head (0 ... seg_data_len) - * - * @return New segment data address, or NULL on an error - */ -void *odp_packet_seg_pull_head(odp_packet_t pkt, odp_packet_seg_t seg, - size_t len); - -/** - * Push out segment tail - * - * Increase segment data length. - * Does not modify packet in case of an error. - * - * seg_data_len += len - * - * @param pkt Packet handle - * @param seg Segment handle - * @param len Number of octets to push tail (0 ... seg_tailroom) - * - * @return New segment data length, or -1 on an error - */ -int odp_packet_seg_push_tail(odp_packet_t pkt, odp_packet_seg_t seg, - size_t len); - -/** - * Pull in segment tail - * - * Decrease segment data length. - * Does not modify packet in case of an error. - * - * seg_data_len -= len - * - * @param pkt Packet handle - * @param seg Segment handle - * @param len Number of octets to pull tail (0 ... seg_data_len) - * - * @return New segment data length, or -1 on an error - */ -int odp_packet_seg_pull_tail(odp_packet_t pkt, odp_packet_seg_t seg, - size_t len); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_packet_flags.h b/include/odp_packet_flags.h deleted file mode 100644 index eb9315bc..00000000 --- a/include/odp_packet_flags.h +++ /dev/null @@ -1,189 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP packet flags - */ - -#ifndef ODP_PACKET_FLAGS_H_ -#define ODP_PACKET_FLAGS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <odp_std_types.h> -#include <odp_packet.h> - -/** - * Check for packet errors - * - * Checks all error flags at once. - * - * @param pkt Packet handle - * @return 1 if packet has errors, 0 otherwise - */ -int odp_packet_error(odp_packet_t pkt); - -/** - * Check if error was 'frame length' error - * - * @param pkt Packet handle - * @return 1 if frame length error detected, 0 otherwise - */ -int odp_packet_errflag_frame_len(odp_packet_t pkt); - -/** - * Check for L2 header, e.g. ethernet - * - * @param pkt Packet handle - * @return 1 if packet contains a valid & known L2 header, 0 otherwise - */ -int odp_packet_inflag_l2(odp_packet_t pkt); - -/** - * Check for L3 header, e.g. IPv4, IPv6 - * - * @param pkt Packet handle - * @return 1 if packet contains a valid & known L3 header, 0 otherwise - */ -int odp_packet_inflag_l3(odp_packet_t pkt); - -/** - * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP) - * - * @param pkt Packet handle - * @return 1 if packet contains a valid & known L4 header, 0 otherwise - */ -int odp_packet_inflag_l4(odp_packet_t pkt); - -/** - * Check for Ethernet header - * - * @param pkt Packet handle - * @return 1 if packet contains a valid eth header, 0 otherwise - */ -int odp_packet_inflag_eth(odp_packet_t pkt); - -/** - * Check for jumbo frame - * - * @param pkt Packet handle - * @return 1 if packet contains jumbo frame, 0 otherwise - */ -int odp_packet_inflag_jumbo(odp_packet_t pkt); - -/** - * Check for VLAN - * - * @param pkt Packet handle - * @return 1 if packet contains a VLAN header, 0 otherwise - */ -int odp_packet_inflag_vlan(odp_packet_t pkt); - -/** - * Check for VLAN QinQ (stacked VLAN) - * - * @param pkt Packet handle - * @return 1 if packet contains a VLAN QinQ header, 0 otherwise - */ -int odp_packet_inflag_vlan_qinq(odp_packet_t pkt); - -/** - * Check for ARP - * - * @param pkt Packet handle - * @return 1 if packet contains an ARP header, 0 otherwise - */ -int odp_packet_inflag_arp(odp_packet_t pkt); - -/** - * Check for IPv4 - * - * @param pkt Packet handle - * @return 1 if packet contains an IPv4 header, 0 otherwise - */ -int odp_packet_inflag_ipv4(odp_packet_t pkt); - -/** - * Check for IPv6 - * - * @param pkt Packet handle - * @return 1 if packet contains an IPv6 header, 0 otherwise - */ -int odp_packet_inflag_ipv6(odp_packet_t pkt); - -/** - * Check for IP fragment - * - * @param pkt Packet handle - * @return 1 if packet is an IP fragment, 0 otherwise - */ -int odp_packet_inflag_ipfrag(odp_packet_t pkt); - -/** - * Check for IP options - * - * @param pkt Packet handle - * @return 1 if packet contains IP options, 0 otherwise - */ -int odp_packet_inflag_ipopt(odp_packet_t pkt); - -/** - * Check for IPSec - * - * @param pkt Packet handle - * @return 1 if packet requires IPSec processing, 0 otherwise - */ -int odp_packet_inflag_ipsec(odp_packet_t pkt); - -/** - * Check for UDP - * - * @param pkt Packet handle - * @return 1 if packet contains a UDP header, 0 otherwise - */ -int odp_packet_inflag_udp(odp_packet_t pkt); - -/** - * Check for TCP - * - * @param pkt Packet handle - * @return 1 if packet contains a TCP header, 0 otherwise - */ -int odp_packet_inflag_tcp(odp_packet_t pkt); - -/** - * Check for SCTP - * - * @param pkt Packet handle - * @return 1 if packet contains an SCTP header, 0 otherwise - */ -int odp_packet_inflag_sctp(odp_packet_t pkt); - -/** - * Check for ICMP - * - * @param pkt Packet handle - * @return 1 if packet contains an ICMP header, 0 otherwise - */ -int odp_packet_inflag_icmp(odp_packet_t pkt); - -/** - * Request L4 checksum calculation - * - * @param pkt Packet handle - */ -void odp_packet_outflag_l4_chksum(odp_packet_t pkt); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_packet_io.h b/include/odp_packet_io.h deleted file mode 100644 index cfefac09..00000000 --- a/include/odp_packet_io.h +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP Packet IO - */ - -#ifndef ODP_PACKET_IO_H_ -#define ODP_PACKET_IO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <odp_std_types.h> -#include <odp_buffer_pool.h> -#include <odp_packet.h> -#include <odp_queue.h> - -#include <odp_pktio_types.h> - -/** ODP packet IO handle */ -typedef uint32_t odp_pktio_t; - -/** Invalid packet IO handle */ -#define ODP_PKTIO_INVALID 0 - -/** - * Open an ODP packet IO instance - * - * @param dev Packet IO device - * @param pool Pool to use for packet IO - * @param params Set of parameters to pass to the arch dependent implementation - * - * @return ODP packet IO handle or ODP_PKTIO_INVALID on error - */ -odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool, - odp_pktio_params_t *params); - -/** - * Close an ODP packet IO instance - * - * @param id ODP packet IO handle - * - * @return 0 on success or -1 on error - */ -int odp_pktio_close(odp_pktio_t id); - -/** - * Receive packets - * - * @param id ODP packet IO handle - * @param pkt_table[] Storage for received packets (filled by function) - * @param len Length of pkt_table[], i.e. max number of pkts to receive - * - * @return Number of packets received or -1 on error - */ -int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len); - -/** - * Send packets - * - * @param id ODP packet IO handle - * @param pkt_table[] Array of packets to send - * @param len length of pkt_table[] - * - * @return Number of packets sent or -1 on error - */ -int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len); - -/** - * Set the default input queue to be associated with a pktio handle - * - * @param id ODP packet IO handle - * @param queue default input queue set - * @return 0 on success or -1 on error - */ -int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue); - -/** - * Get default input queue associated with a pktio handle - * - * @param id ODP packet IO handle - * - * @return Default input queue set or ODP_QUEUE_INVALID on error - */ -odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id); - -/** - * Remove default input queue (if set) - * - * @param id ODP packet IO handle - * - * @return 0 on success or -1 on error - */ -int odp_pktio_inq_remdef(odp_pktio_t id); - -/** - * Query default output queue - * - * @param id ODP packet IO handle - * - * @return Default out queue or ODP_QUEUE_INVALID on error - */ -odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id); - -/** - * Store packet input handle into packet - * - * @param pkt ODP packet buffer handle - * @param id ODP packet IO handle - * - * @return - */ -void odp_pktio_set_input(odp_packet_t pkt, odp_pktio_t id); - -/** - * Get stored packet input handle from packet - * - * @param pkt ODP packet buffer handle - * - * @return Packet IO handle - */ -odp_pktio_t odp_pktio_get_input(odp_packet_t pkt); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_queue.h b/include/odp_queue.h deleted file mode 100644 index 5e083f1a..00000000 --- a/include/odp_queue.h +++ /dev/null @@ -1,220 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP queue - */ - -#ifndef ODP_QUEUE_H_ -#define ODP_QUEUE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> -#include <odp_buffer.h> - - -/** - * ODP queue - */ -typedef uint32_t odp_queue_t; - -/** Invalid queue */ -#define ODP_QUEUE_INVALID 0 - -/** Maximum queue name lenght in chars */ -#define ODP_QUEUE_NAME_LEN 32 - - -/** - * ODP queue type - */ -typedef int odp_queue_type_t; - -#define ODP_QUEUE_TYPE_SCHED 0 /**< Scheduled queue */ -#define ODP_QUEUE_TYPE_POLL 1 /**< Not scheduled queue */ -#define ODP_QUEUE_TYPE_PKTIN 2 /**< Packet input queue */ -#define ODP_QUEUE_TYPE_PKTOUT 3 /**< Packet output queue */ - -/** - * ODP schedule priority - */ -typedef int odp_schedule_prio_t; - -/** Highest scheduling priority */ -#define ODP_SCHED_PRIO_HIGHEST 0 - -/** Normal scheduling priority */ -#define ODP_SCHED_PRIO_NORMAL (ODP_CONFIG_SCHED_PRIOS / 2) - -/** Lowest scheduling priority */ -#define ODP_SCHED_PRIO_LOWEST (ODP_CONFIG_SCHED_PRIOS - 1) - -/** Default scheduling priority */ -#define ODP_SCHED_PRIO_DEFAULT ODP_SCHED_PRIO_NORMAL - - -/** - * ODP schedule synchronisation - */ -typedef int odp_schedule_sync_t; - -#define ODP_SCHED_SYNC_NONE 0 /**< Queue not synchronised */ -#define ODP_SCHED_SYNC_ATOMIC 1 /**< Atomic queue */ -#define ODP_SCHED_SYNC_ORDERED 2 /**< Ordered queue */ - -/** Default queue synchronisation */ -#define ODP_SCHED_SYNC_DEFAULT ODP_SCHED_SYNC_ATOMIC - -/** - * ODP schedule core group - */ -typedef int odp_schedule_group_t; - -/** Group of all cores */ -#define ODP_SCHED_GROUP_ALL 0 - -/** Default core group */ -#define ODP_SCHED_GROUP_DEFAULT ODP_SCHED_GROUP_ALL - - -/** - * ODP Queue parameters - */ -typedef struct odp_queue_param_t { - /** Scheduler parameters */ - struct { - odp_schedule_prio_t prio; - odp_schedule_sync_t sync; - odp_schedule_group_t group; - } sched; - /** Queue context */ - void *context; -} odp_queue_param_t; - - -/** - * Queue create - * - * @param name Queue name - * @param type Queue type - * @param param Queue parameters. Uses defaults if NULL. - * - * @return Queue handle or ODP_QUEUE_INVALID - */ -odp_queue_t odp_queue_create(const char *name, odp_queue_type_t type, - odp_queue_param_t *param); - -/** - * Find a queue by name - * - * @param name Queue name - * - * @return Queue handle or ODP_QUEUE_INVALID - */ -odp_queue_t odp_queue_lookup(const char *name); - -/** - * Set queue context - * - * Its the responsability of the interface user to make sure - * queue context allocation is done in an area reachable for - * all EOs accessing the context - * - * @param queue Queue handle - * @param context Address to the queue context - * - * @return 0 if successful - */ -int odp_queue_set_context(odp_queue_t queue, void *context); - -/** - * Get queue context - * - * @param queue Queue handle - * - * @return If successful, a pointer to the queue context, - * NULL for failure. - */ -void *odp_queue_get_context(odp_queue_t queue); - -/** - * Queue enqueue - * - * @param queue Queue handle - * @param buf Buffer handle - * - * @return 0 if succesful - */ -int odp_queue_enq(odp_queue_t queue, odp_buffer_t buf); - -/** - * Enqueue multiple buffers to a queue - * - * @param queue Queue handle - * @param buf Buffer handles - * @param num Number of buffer handles - * - * @return 0 if succesful - */ -int odp_queue_enq_multi(odp_queue_t queue, odp_buffer_t buf[], int num); - -/** - * Queue dequeue - * - * Dequeues next buffer from head of the queue. Cannot be used for - * ODP_QUEUE_TYPE_SCHED type queues (use odp_schedule() instead). - * - * @param queue Queue handle - * - * @return Buffer handle, or ODP_BUFFER_INVALID - */ -odp_buffer_t odp_queue_deq(odp_queue_t queue); - -/** - * Dequeue multiple buffers from a queue - * - * Dequeues multiple buffers from head of the queue. Cannot be used for - * ODP_QUEUE_TYPE_SCHED type queues (use odp_schedule() instead). - * - * @param queue Queue handle - * @param buf Buffer handles for output - * @param num Maximum number of buffer handles - - * @return Number of buffers written (0 ... num) - */ -int odp_queue_deq_multi(odp_queue_t queue, odp_buffer_t buf[], int num); - -/** - * Queue type - * - * @param queue Queue handle - * - * @return Queue type - */ -odp_queue_type_t odp_queue_type(odp_queue_t queue); - -/** - * Queue schedule type - * - * @param queue Queue handle - * - * @return Queue schedule synchronisation type - */ -odp_schedule_sync_t odp_queue_sched_type(odp_queue_t queue); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_rwlock.h b/include/odp_rwlock.h deleted file mode 100644 index 252ebb2b..00000000 --- a/include/odp_rwlock.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_RWLOCK_H_ -#define ODP_RWLOCK_H_ - -/** - * @file - * - * ODP RW Locks - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * The odp_rwlock_t type. - * write lock count is -1, - * read lock count > 0 - */ -typedef struct { - volatile int32_t cnt; /**< -1 Write lock, - > 0 for Read lock. */ -} odp_rwlock_t; - - -/** - * Initialize the rwlock to an unlocked state. - * - * @param rwlock pointer to the RW Lock. - */ -void odp_rwlock_init(odp_rwlock_t *rwlock); - -/** - * Aquire a read lock. - * - * @param rwlock pointer to a RW Lock. - */ -void odp_rwlock_read_lock(odp_rwlock_t *rwlock); - -/** - * Release a read lock. - * - * @param rwlock pointer to the RW Lock. - */ -void odp_rwlock_read_unlock(odp_rwlock_t *rwlock); - -/** - * Aquire a write lock. - * - * @param rwlock pointer to a RW Lock. - */ -void odp_rwlock_write_lock(odp_rwlock_t *rwlock); - -/** - * Release a write lock. - * - * @param rwlock pointer to a RW Lock. - */ -void odp_rwlock_write_unlock(odp_rwlock_t *rwlock); - -#ifdef __cplusplus -} -#endif - -#endif /* ODP_RWLOCK_H_ */ diff --git a/include/odp_schedule.h b/include/odp_schedule.h deleted file mode 100644 index 80870213..00000000 --- a/include/odp_schedule.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP schedule - */ - -#ifndef ODP_SCHEDULE_H_ -#define ODP_SCHEDULE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> -#include <odp_buffer.h> -#include <odp_queue.h> - - -#define ODP_SCHED_WAIT 0 /**< Wait infinitely */ -#define ODP_SCHED_NO_WAIT 1 /**< Do not wait */ - - -/** - * Schedule wait time - * - * Converts nanoseconds to wait values for other schedule functions. - * - * @param ns Nanoseconds - * - * @return Value for the wait parameter in schedule functions - */ -uint64_t odp_schedule_wait_time(uint64_t ns); - -/** - * Schedule - * - * Schedules all queues created with ODP_QUEUE_TYPE_SCHED type. Returns - * next highest priority buffer which is available for the calling thread. - * Outputs the source queue of the buffer. If there's no buffer available, waits - * for a buffer according to the wait parameter setting. Returns - * ODP_BUFFER_INVALID if reaches end of the wait period. - * - * @param from Output parameter for the source queue (where the buffer was - * dequeued from). Ignored if NULL. - * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to - * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. - * Use odp_schedule_wait_time() to convert time to other wait - * values. - * - * @return Next highest priority buffer, or ODP_BUFFER_INVALID - */ -odp_buffer_t odp_schedule(odp_queue_t *from, uint64_t wait); - -/** - * Schedule one buffer - * - * Like odp_schedule(), but is quaranteed to schedule only one buffer at a time. - * Each call will perform global scheduling and will reserve one buffer per - * thread in maximum. When called after other schedule functions, returns - * locally stored buffers (if any) first, and then continues in the global - * scheduling mode. - * - * This function optimises priority scheduling (over throughput). - * - * User can exit the schedule loop without first calling odp_schedule_pause(). - * - * @param from Output parameter for the source queue (where the buffer was - * dequeued from). Ignored if NULL. - * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to - * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. - * Use odp_schedule_wait_time() to convert time to other wait - * values. - * - * @return Next highest priority buffer, or ODP_BUFFER_INVALID - */ -odp_buffer_t odp_schedule_one(odp_queue_t *from, uint64_t wait); - - -/** - * Schedule multiple buffers - * - * Like odp_schedule(), but returns multiple buffers from a queue. - * - * @param from Output parameter for the source queue (where the buffer was - * dequeued from). Ignored if NULL. - * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to - * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. - * Use odp_schedule_wait_time() to convert time to other wait - * values. - * @param out_buf Buffer array for output - * @param num Maximum number of buffers to output - * - * @return Number of buffers outputed (0 ... num) - */ -int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_buffer_t out_buf[], - unsigned int num); - -/** - * Pause scheduling - * - * Pause global scheduling for this thread. After this call, all schedule calls - * will return only locally reserved buffers (if any). User can exit the - * schedule loop only after the schedule function indicates that there's no more - * buffers (no more locally reserved buffers). - * - * Must be used with odp_schedule() and odp_schedule_multi() before exiting (or - * stalling) the schedule loop. - */ -void odp_schedule_pause(void); - -/** - * Resume scheduling - * - * Resume global scheduling for this thread. After this call, all schedule calls - * will schedule normally (perform global scheduling). - */ -void odp_schedule_resume(void); - -/** - * Release currently hold atomic context - */ -void odp_schedule_release_atomic(void); - -/** - * Number of scheduling priorities - * - * @return Number of scheduling priorities - */ -int odp_schedule_num_prio(void); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_shared_memory.h b/include/odp_shared_memory.h deleted file mode 100644 index 8ac88474..00000000 --- a/include/odp_shared_memory.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP shared memory - */ - -#ifndef ODP_SHARED_MEMORY_H_ -#define ODP_SHARED_MEMORY_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> - -/** Maximum shared memory block name lenght in chars */ -#define ODP_SHM_NAME_LEN 32 - - -/** - * Reserve a block of shared memory - * - * @param name Name of the block (maximum ODP_SHM_NAME_LEN - 1 chars) - * @param size Block size in bytes - * @param align Block alignment in bytes - * - * @return Pointer to the reserved block, or NULL - */ -void *odp_shm_reserve(const char *name, uint64_t size, uint64_t align); - -/** - * Lookup for a block of shared memory - * - * @param name Name of the block - * - * @return Pointer to the block, or NULL - */ -void *odp_shm_lookup(const char *name); - - -/** - * Print all shared memory blocks - */ -void odp_shm_print_all(void); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_spinlock.h b/include/odp_spinlock.h deleted file mode 100644 index 52b7a712..00000000 --- a/include/odp_spinlock.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP spinlock - */ - -#ifndef ODP_SPINLOCK_H_ -#define ODP_SPINLOCK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> - - -/** - * ODP spinlock - */ -typedef struct odp_spinlock_t { - volatile int lock; /**< @private Lock */ -} odp_spinlock_t; - - -/** - * Init spinlock - * - * @param spinlock Spinlock - */ -void odp_spinlock_init(odp_spinlock_t *spinlock); - - -/** - * Lock spinlock - * - * @param spinlock Spinlock - */ -void odp_spinlock_lock(odp_spinlock_t *spinlock); - - -/** - * Try to lock spinlock - * - * @param spinlock Spinlock - * - * @return 1 if the lock was taken, otherwise 0. - */ -int odp_spinlock_trylock(odp_spinlock_t *spinlock); - - -/** - * Unlock spinlock - * - * @param spinlock Spinlock - */ -void odp_spinlock_unlock(odp_spinlock_t *spinlock); - - -/** - * Test if spinlock is locked - * - * @param spinlock Spinlock - * - * @return 1 if the lock is locked, otherwise 0. - */ -int odp_spinlock_is_locked(odp_spinlock_t *spinlock); - - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_std_types.h b/include/odp_std_types.h deleted file mode 100644 index b12a2f3a..00000000 --- a/include/odp_std_types.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * Standard C language types and definitions for ODP. - * - */ - -#ifndef ODP_STD_TYPES_H_ -#define ODP_STD_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -#include <stddef.h> -#include <stdbool.h> -#include <stdint.h> -#include <inttypes.h> -#include <limits.h> - - - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_sync.h b/include/odp_sync.h deleted file mode 100644 index 9cf4d462..00000000 --- a/include/odp_sync.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP synchronisation - */ - -#ifndef ODP_SYNC_H_ -#define ODP_SYNC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Synchronise stores - * - * Ensures that all CPU store operations that precede the odp_sync_stores() - * call are globally visible before any store operation that follows it. - */ -static inline void odp_sync_stores(void) -{ -#if defined __x86_64__ || defined __i386__ - - __asm__ __volatile__ ("sfence\n" : : : "memory"); - -#elif defined __arm__ || defined __aarch64__ - - __asm__ __volatile__ ("dmb st" : : : "memory"); - -#elif defined __OCTEON__ - - __asm__ __volatile__ ("syncws\n" : : : "memory"); - -#else - __sync_synchronize(); -#endif -} - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_system_info.h b/include/odp_system_info.h deleted file mode 100644 index 7a02df77..00000000 --- a/include/odp_system_info.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP system information - */ - -#ifndef ODP_SYSTEM_INFO_H_ -#define ODP_SYSTEM_INFO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> - - -/** - * CPU frequency in Hz - * - * @return CPU frequency in Hz - */ -uint64_t odp_sys_cpu_hz(void); - -/** - * Huge page size in bytes - * - * @return Huge page size in bytes - */ -uint64_t odp_sys_huge_page_size(void); - -/** - * Page size in bytes - * - * @return Page size in bytes - */ -uint64_t odp_sys_page_size(void); - -/** - * CPU model name - * - * @return Pointer to CPU model name string - */ -const char *odp_sys_cpu_model_str(void); - -/** - * Cache line size in bytes - * - * @return CPU cache line size in bytes - */ -int odp_sys_cache_line_size(void); - -/** - * Core count - * - * @return Core count - */ -int odp_sys_core_count(void); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_thread.h b/include/odp_thread.h deleted file mode 100644 index e8e8c8ab..00000000 --- a/include/odp_thread.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP Linux helper API - */ - -#ifndef ODP_THREAD_H_ -#define ODP_THREAD_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -#include <odp_std_types.h> - - - -/** - * Create thread id - * - * @param core Core dedicated for the thread - * @return New thread id - */ -int odp_thread_create(int core); - -/** - * Get thread id - * - * @return Thread id of the current thread - */ -int odp_thread_id(void); - - -/** - * Get thread id - * - * @return Core id where the thread is running currently - */ -int odp_thread_core(void); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_ticketlock.h b/include/odp_ticketlock.h deleted file mode 100644 index 6277a18e..00000000 --- a/include/odp_ticketlock.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP ticketlock - */ - -#ifndef ODP_TICKETLOCK_H_ -#define ODP_TICKETLOCK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> -#include <odp_atomic.h> - - -/** - * ODP ticketlock - */ -typedef struct odp_ticketlock_t { - odp_atomic_u32_t next_ticket; /**< @private Next ticket */ - volatile uint32_t cur_ticket; /**< @private Current ticket */ -} odp_ticketlock_t; - - -/** - * Init ticketlock - * - * @param ticketlock Ticketlock - */ -void odp_ticketlock_init(odp_ticketlock_t *ticketlock); - - -/** - * Lock ticketlock - * - * @param ticketlock Ticketlock - */ -void odp_ticketlock_lock(odp_ticketlock_t *ticketlock); - - -/** - * Try to lock ticketlock - * - * @param ticketlock Ticketlock - * - * @return 1 if the lock was taken, otherwise 0. - */ -int odp_ticketlock_trylock(odp_ticketlock_t *ticketlock); - - -/** - * Unlock ticketlock - * - * @param ticketlock Ticketlock - */ -void odp_ticketlock_unlock(odp_ticketlock_t *ticketlock); - - -/** - * Test if ticketlock is locked - * - * @param ticketlock Ticketlock - * - * @return 1 if the lock is locked, otherwise 0. - */ -int odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_time.h b/include/odp_time.h deleted file mode 100644 index 188d1fed..00000000 --- a/include/odp_time.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP time - */ - -#ifndef ODP_TIME_H_ -#define ODP_TIME_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <odp_std_types.h> - - -/** - * Current time in CPU cycles - * - * @return Current time in CPU cycles - */ -uint64_t odp_time_get_cycles(void); - - -/** - * Time difference - * - * @param t1 First time stamp - * @param t2 Second time stamp - * - * @return Difference of time stamps in CPU cycles - */ -uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2); - - -/** - * Convert CPU cycles to nanoseconds - * - * @param cycles Time in CPU cycles - * - * @return Time in nanoseconds - */ -uint64_t odp_time_cycles_to_ns(uint64_t cycles); - - -/** - * Convert nanoseconds to CPU cycles - * - * @param ns Time in nanoseconds - * - * @return Time in CPU cycles - */ -uint64_t odp_time_ns_to_cycles(uint64_t ns); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_timer.h b/include/odp_timer.h deleted file mode 100644 index 01db839d..00000000 --- a/include/odp_timer.h +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP timer - */ - -#ifndef ODP_TIMER_H_ -#define ODP_TIMER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <odp_std_types.h> -#include <odp_buffer.h> -#include <odp_buffer_pool.h> -#include <odp_queue.h> - - -/** - * ODP timer handle - */ -typedef uint32_t odp_timer_t; - -/** Invalid timer */ -#define ODP_TIMER_INVALID 0 - - -/** - * ODP timeout handle - */ -typedef odp_buffer_t odp_timer_tmo_t; - -/** Invalid timeout */ -#define ODP_TIMER_TMO_INVALID 0 - - -/** - * Timeout notification - */ -typedef odp_buffer_t odp_timeout_t; - - -/** - * Create a timer - * - * Creates a new timer with requested properties. - * - * @param name Name - * @param pool Buffer pool for allocating timeout notifications - * @param resolution Timeout resolution in nanoseconds - * @param min_tmo Minimum timeout duration in nanoseconds - * @param max_tmo Maximum timeout duration in nanoseconds - * - * @return Timer handle if successful, otherwise ODP_TIMER_INVALID - */ -odp_timer_t odp_timer_create(const char *name, odp_buffer_pool_t pool, - uint64_t resolution, uint64_t min_tmo, - uint64_t max_tmo); - -/** - * Convert timer ticks to nanoseconds - * - * @param timer Timer - * @param ticks Timer ticks - * - * @return Nanoseconds - */ -uint64_t odp_timer_tick_to_ns(odp_timer_t timer, uint64_t ticks); - -/** - * Convert nanoseconds to timer ticks - * - * @param timer Timer - * @param ns Nanoseconds - * - * @return Timer ticks - */ -uint64_t odp_timer_ns_to_tick(odp_timer_t timer, uint64_t ns); - -/** - * Timer resolution in nanoseconds - * - * @param timer Timer - * - * @return Resolution in nanoseconds - */ -uint64_t odp_timer_resolution(odp_timer_t timer); - -/** - * Maximum timeout in timer ticks - * - * @param timer Timer - * - * @return Maximum timeout in timer ticks - */ -uint64_t odp_timer_maximum_tmo(odp_timer_t timer); - -/** - * Current timer tick - * - * @param timer Timer - * - * @return Current time in timer ticks - */ -uint64_t odp_timer_current_tick(odp_timer_t timer); - -/** - * Request timeout with an absolute timer tick - * - * When tick reaches tmo_tick, the timer enqueues the timeout notification into - * the destination queue. - * - * @param timer Timer - * @param tmo_tick Absolute timer tick value which triggers the timeout - * @param queue Destination queue for the timeout notification - * @param buf User defined timeout notification buffer. When - * ODP_BUFFER_INVALID, default timeout notification is used. - * - * @return Timeout handle if successful, otherwise ODP_TIMER_TMO_INVALID - */ -odp_timer_tmo_t odp_timer_absolute_tmo(odp_timer_t timer, uint64_t tmo_tick, - odp_queue_t queue, odp_buffer_t buf); - -/** - * Cancel a timeout - * - * @param timer Timer - * @param tmo Timeout to cancel - * - * @return 0 if successful - */ -int odp_timer_cancel_tmo(odp_timer_t timer, odp_timer_tmo_t tmo); - -/** - * Convert buffer handle to timeout handle - * - * @param buf Buffer handle - * - * @return Timeout buffer handle - */ -odp_timeout_t odp_timeout_from_buffer(odp_buffer_t buf); - -/** - * Return absolute timeout tick - * - * @param tmo Timeout buffer handle - * - * @return Absolute timeout tick - */ -uint64_t odp_timeout_tick(odp_timeout_t tmo); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/odp_version.h b/include/odp_version.h deleted file mode 100644 index c823e2d6..00000000 --- a/include/odp_version.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP version - */ - -#ifndef ODP_VERSION_H_ -#define ODP_VERSION_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * ODP API main version - * - * Introduction of major new features or changes. APIs with different major - * versions are likely not backward compatible. - */ -#define ODP_VERSION_API_MAIN 0 - -/** - * ODP API sub version - * - * Introduction of additional features or minor changes. APIs with common - * major version and different sub versions may be backward compatible (if only - * additions). - */ -#define ODP_VERSION_API_SUB 0 - -/** - * ODP API bug correction version - * - * Bug corrections to the API files. APIs with the same major and sub - * versions, but different bug correction versions are backward compatible. - */ -#define ODP_VERSION_API_BUG 1 - - -/** @internal Version string expand */ -#define ODP_VERSION_STR_EXPAND(x) #x - -/** @internal Version to string */ -#define ODP_VERSION_TO_STR(x) ODP_VERSION_STR_EXPAND(x) - -/** @internal API version string */ -#define ODP_VERSION_API_STR \ -ODP_VERSION_TO_STR(ODP_VERSION_API_MAIN) "."\ -ODP_VERSION_TO_STR(ODP_VERSION_API_SUB) "."\ -ODP_VERSION_TO_STR(ODP_VERSION_API_BUG) - - -/** - * Returns ODP API version string - */ -static inline const char *odp_version_api_str(void) -{ - return ODP_VERSION_API_STR; -} - - - - -#ifdef __cplusplus -} -#endif - -#endif |