API Reference Manual
1.46.0
|
Stash for storing object handles.
Data Structures | |
union | odp_stash_stats_opt_t |
Stash statistics counters options. More... | |
struct | odp_stash_stats_t |
Stash statistics counters. More... | |
struct | odp_stash_capability_t |
Stash capabilities (per stash type) More... | |
struct | odp_stash_param_t |
Stash parameters. More... | |
Macros | |
#define | ODP_STASH_INVALID ((odp_stash_t)0) |
Invalid stash handle. | |
#define | ODP_STASH_NAME_LEN 32 |
Maximum stash name length, including the null character. | |
Typedefs | |
typedef _odp_abi_stash_t * | odp_stash_t |
Stash handle. | |
typedef enum odp_stash_type_t | odp_stash_type_t |
Stash types. | |
typedef enum odp_stash_op_mode_t | odp_stash_op_mode_t |
Stash operation mode. | |
typedef union odp_stash_stats_opt_t | odp_stash_stats_opt_t |
Stash statistics counters options. More... | |
typedef struct odp_stash_stats_t | odp_stash_stats_t |
Stash statistics counters. | |
typedef struct odp_stash_capability_t | odp_stash_capability_t |
Stash capabilities (per stash type) | |
typedef struct odp_stash_param_t | odp_stash_param_t |
Stash parameters. | |
Enumerations | |
enum | odp_stash_type_t { ODP_STASH_TYPE_DEFAULT = 0 , ODP_STASH_TYPE_FIFO } |
Stash types. More... | |
enum | odp_stash_op_mode_t { ODP_STASH_OP_MT = 0 , ODP_STASH_OP_ST , ODP_STASH_OP_LOCAL } |
Stash operation mode. More... | |
Functions | |
int | odp_stash_capability (odp_stash_capability_t *capa, odp_stash_type_t type) |
Query stash capabilities. More... | |
void | odp_stash_param_init (odp_stash_param_t *param) |
Initialize stash params. More... | |
odp_stash_t | odp_stash_create (const char *name, const odp_stash_param_t *param) |
Create a stash. More... | |
int | odp_stash_destroy (odp_stash_t stash) |
Destroy a stash. More... | |
odp_stash_t | odp_stash_lookup (const char *name) |
Find a stash by name. More... | |
uint64_t | odp_stash_to_u64 (odp_stash_t stash) |
Get printable value for a stash handle. More... | |
int32_t | odp_stash_put (odp_stash_t stash, const void *obj, int32_t num) |
Put object handles into a stash. More... | |
int32_t | odp_stash_put_batch (odp_stash_t stash, const void *obj, int32_t num) |
Put batch of object handles into a stash. More... | |
int32_t | odp_stash_put_u32 (odp_stash_t stash, const uint32_t val[], int32_t num) |
Put 32-bit integers into a stash. More... | |
int32_t | odp_stash_put_u32_batch (odp_stash_t stash, const uint32_t val[], int32_t num) |
Put batch of 32-bit integers into a stash. More... | |
int32_t | odp_stash_put_u64 (odp_stash_t stash, const uint64_t val[], int32_t num) |
Put 64-bit integers into a stash. More... | |
int32_t | odp_stash_put_u64_batch (odp_stash_t stash, const uint64_t val[], int32_t num) |
Put batch of 64-bit integers into a stash. More... | |
int32_t | odp_stash_put_ptr (odp_stash_t stash, const uintptr_t ptr[], int32_t num) |
Put pointers into a stash. More... | |
int32_t | odp_stash_put_ptr_batch (odp_stash_t stash, const uintptr_t ptr[], int32_t num) |
Put batch of pointers into a stash. More... | |
int32_t | odp_stash_get (odp_stash_t stash, void *obj, int32_t num) |
Get object handles from a stash. More... | |
int32_t | odp_stash_get_batch (odp_stash_t stash, void *obj, int32_t num) |
Get batch of object handles from a stash. More... | |
int32_t | odp_stash_get_u32 (odp_stash_t stash, uint32_t val[], int32_t num) |
Get 32-bit integers from a stash. More... | |
int32_t | odp_stash_get_u32_batch (odp_stash_t stash, uint32_t val[], int32_t num) |
Get batch of 32-bit integers from a stash. More... | |
int32_t | odp_stash_get_u64 (odp_stash_t stash, uint64_t val[], int32_t num) |
Get 64-bit integers from a stash. More... | |
int32_t | odp_stash_get_u64_batch (odp_stash_t stash, uint64_t val[], int32_t num) |
Get batch of 64-bit integers from a stash. More... | |
int32_t | odp_stash_get_ptr (odp_stash_t stash, uintptr_t ptr[], int32_t num) |
Get pointers from a stash. More... | |
int32_t | odp_stash_get_ptr_batch (odp_stash_t stash, uintptr_t ptr[], int32_t num) |
Get batch of pointers from a stash. More... | |
int | odp_stash_flush_cache (odp_stash_t stash) |
Flush object handles from the thread local cache. More... | |
void | odp_stash_print (odp_stash_t stash) |
Print debug information about the stash. More... | |
int | odp_stash_stats (odp_stash_t stash, odp_stash_stats_t *stats) |
Read statistics counters of a stash. More... | |
typedef union odp_stash_stats_opt_t odp_stash_stats_opt_t |
Stash statistics counters options.
Statistics counters listed in a bit field structure.
enum odp_stash_type_t |
Stash types.
Definition at line 43 of file api/spec/stash_types.h.
enum odp_stash_op_mode_t |
Stash operation mode.
Definition at line 72 of file api/spec/stash_types.h.
int odp_stash_capability | ( | odp_stash_capability_t * | capa, |
odp_stash_type_t | type | ||
) |
Query stash capabilities.
Outputs capabilities of the given stash type on success. The stash type is not supported if 'max_stashes' capability is zero. The default stash type (ODP_STASH_TYPE_DEFAULT) is always supported. The function returns failure if the given stash type is unknown to the implementation.
[out] | capa | Pointer to capability structure for output |
type | Stash type |
0 | on success |
<0 | on failure |
void odp_stash_param_init | ( | odp_stash_param_t * | param | ) |
Initialize stash params.
Initialize an odp_stash_param_t to its default values for all fields.
param | Parameter structure to be initialized |
odp_stash_t odp_stash_create | ( | const char * | name, |
const odp_stash_param_t * | param | ||
) |
Create a stash.
This routine is used to create a stash for object handles. Object handle values are opaque data to ODP implementation. Application may use a stash to store e.g. pointers, offsets or indexes to arbitrary objects which are allocated and freed frequently (e.g. per packet) during application processing. Object handle size is specified in stash parameters.
It is optional to give a name. Names do not have to be unique. However, odp_stash_lookup() returns only a single matching stash.
name | Name of the stash or NULL. Maximum string length is ODP_STASH_NAME_LEN, including the null character. |
param | Stash creation parameters |
ODP_STASH_INVALID | Stash could not be created |
int odp_stash_destroy | ( | odp_stash_t | stash | ) |
Destroy a stash.
Destroy a previously created stash. Stash must be empty before it is destroyed. Results are undefined if an attempt is made to destroy a stash that contains object handles.
stash | The stash to be destroyed |
0 | Success |
<0 | Failure |
odp_stash_t odp_stash_lookup | ( | const char * | name | ) |
Find a stash by name.
name | Name of the stash |
ODP_STASH_INVALID | Stash could not be found |
uint64_t odp_stash_to_u64 | ( | odp_stash_t | stash | ) |
Get printable value for a stash handle.
stash | Handle to be converted for debugging |
int32_t odp_stash_put | ( | odp_stash_t | stash, |
const void * | obj, | ||
int32_t | num | ||
) |
Put object handles into a stash.
Store object handles into the stash. Handle values are opaque data to ODP implementation and may be e.g. pointers or indexes to arbitrary objects. Application specifies object handle size and maximum number of handles to be stored in stash creation parameters.
A successful operation returns the actual number of object handles stored. If the return value is less than 'num', the remaining handles at the end of 'obj' array are not stored.
In case of ODP_STASH_TYPE_FIFO, object handles are stored into the stash in the order they are in the array.
stash | Stash handle |
obj | Points to an array of object handles to be stored. Object handle size is specified by 'obj_size' in stash creation parameters. The array must be 'obj_size' aligned in memory. |
num | Number of object handles to store |
<0 | on failure |
int32_t odp_stash_put_batch | ( | odp_stash_t | stash, |
const void * | obj, | ||
int32_t | num | ||
) |
Put batch of object handles into a stash.
Otherwise like odp_stash_put(), except that this function stores either all 'num' object handles or none. odp_stash_capability_t.max_put_batch defines the maximum supported batch size.
stash | Stash handle |
obj | Points to an array of object handles to be stored. Object handle size is specified by 'obj_size' in stash creation parameters. The array must be 'obj_size' aligned in memory. |
num | Number of object handles to store |
<0 | on failure |
int32_t odp_stash_put_u32 | ( | odp_stash_t | stash, |
const uint32_t | val[], | ||
int32_t | num | ||
) |
Put 32-bit integers into a stash.
Otherwise like odp_stash_put(), except that this function operates on 32-bit integers. The stash must have been created with 'obj_size' of 4.
stash | Stash handle |
val | Points to an array of 32-bit integers to be stored. The array must be 32-bit aligned in memory. |
num | Number of integers to store |
<0 | on failure |
int32_t odp_stash_put_u32_batch | ( | odp_stash_t | stash, |
const uint32_t | val[], | ||
int32_t | num | ||
) |
Put batch of 32-bit integers into a stash.
Otherwise like odp_stash_put_u32(), except that this function stores either all 'num' object handles or none. odp_stash_capability_t.max_put_batch defines the maximum supported batch size.
stash | Stash handle |
val | Points to an array of 32-bit integers to be stored. The array must be 32-bit aligned in memory. |
num | Number of integers to store |
<0 | on failure |
int32_t odp_stash_put_u64 | ( | odp_stash_t | stash, |
const uint64_t | val[], | ||
int32_t | num | ||
) |
Put 64-bit integers into a stash.
Otherwise like odp_stash_put(), except that this function operates on 64-bit integers. The stash must have been created with 'obj_size' of 8.
stash | Stash handle |
val | Points to an array of 64-bit integers to be stored. The array must be 64-bit aligned in memory. |
num | Number of integers to store |
<0 | on failure |
int32_t odp_stash_put_u64_batch | ( | odp_stash_t | stash, |
const uint64_t | val[], | ||
int32_t | num | ||
) |
Put batch of 64-bit integers into a stash.
Otherwise like odp_stash_put_u64(), except that this function stores either all 'num' object handles or none. odp_stash_capability_t.max_put_batch defines the maximum supported batch size.
stash | Stash handle |
val | Points to an array of 64-bit integers to be stored. The array must be 64-bit aligned in memory. |
num | Number of integers to store |
<0 | on failure |
int32_t odp_stash_put_ptr | ( | odp_stash_t | stash, |
const uintptr_t | ptr[], | ||
int32_t | num | ||
) |
Put pointers into a stash.
Otherwise like odp_stash_put(), except that this function operates on pointers. The stash must have been created with 'obj_size' matching to the size of uintptr_t.
stash | Stash handle |
ptr | Points to an array of pointers to be stored. The array must be pointer size aligned in memory. |
num | Number of pointers to store |
<0 | on failure |
int32_t odp_stash_put_ptr_batch | ( | odp_stash_t | stash, |
const uintptr_t | ptr[], | ||
int32_t | num | ||
) |
Put batch of pointers into a stash.
Otherwise like odp_stash_put_ptr(), except that this function stores either all 'num' object handles or none. odp_stash_capability_t.max_put_batch defines the maximum supported batch size.
stash | Stash handle |
ptr | Points to an array of pointers to be stored. The array must be pointer size aligned in memory. |
num | Number of pointers to store |
<0 | on failure |
int32_t odp_stash_get | ( | odp_stash_t | stash, |
void * | obj, | ||
int32_t | num | ||
) |
Get object handles from a stash.
Get previously stored object handles from the stash. Application specifies object handle size in stash creation parameters.
stash | Stash handle | |
[out] | obj | Points to an array of object handles for output. Object handle size is specified by 'obj_size' in stash creation parameters. The array must be 'obj_size' aligned in memory. |
num | Maximum number of object handles to get from the stash |
<0 | on failure |
int32_t odp_stash_get_batch | ( | odp_stash_t | stash, |
void * | obj, | ||
int32_t | num | ||
) |
Get batch of object handles from a stash.
Otherwise like odp_stash_get(), except that this function outputs either all 'num' object handles or none. odp_stash_capability_t.max_get_batch defines the maximum supported batch size.
stash | Stash handle | |
[out] | obj | Points to an array of object handles for output. Object handle size is specified by 'obj_size' in stash creation parameters. The array must be 'obj_size' aligned in memory. |
num | Number of object handles to get from the stash |
<0 | on failure |
int32_t odp_stash_get_u32 | ( | odp_stash_t | stash, |
uint32_t | val[], | ||
int32_t | num | ||
) |
Get 32-bit integers from a stash.
Otherwise like odp_stash_get(), except that this function operates on 32-bit integers. The stash must have been created with 'obj_size' of 4.
stash | Stash handle | |
[out] | val | Points to an array of 32-bit integers for output. The array must be 32-bit aligned in memory. |
num | Maximum number of integers to get from the stash |
<0 | on failure |
int32_t odp_stash_get_u32_batch | ( | odp_stash_t | stash, |
uint32_t | val[], | ||
int32_t | num | ||
) |
Get batch of 32-bit integers from a stash.
Otherwise like odp_stash_get_u32(), except that this function outputs either all 'num' object handles or none. odp_stash_capability_t.max_get_batch defines the maximum supported batch size.
stash | Stash handle | |
[out] | val | Points to an array of 32-bit integers for output. The array must be 32-bit aligned in memory. |
num | Number of integers to get from the stash |
<0 | on failure |
int32_t odp_stash_get_u64 | ( | odp_stash_t | stash, |
uint64_t | val[], | ||
int32_t | num | ||
) |
Get 64-bit integers from a stash.
Otherwise like odp_stash_get(), except that this function operates on 64-bit integers. The stash must have been created with 'obj_size' of 8.
stash | Stash handle | |
[out] | val | Points to an array of 64-bit integers for output. The array must be 64-bit aligned in memory. |
num | Maximum number of integers to get from the stash |
<0 | on failure |
int32_t odp_stash_get_u64_batch | ( | odp_stash_t | stash, |
uint64_t | val[], | ||
int32_t | num | ||
) |
Get batch of 64-bit integers from a stash.
Otherwise like odp_stash_get_u64(), except that this function outputs either all 'num' object handles or none. odp_stash_capability_t.max_get_batch defines the maximum supported batch size.
stash | Stash handle | |
[out] | val | Points to an array of 64-bit integers for output. The array must be 64-bit aligned in memory. |
num | Number of integers to get from the stash |
<0 | on failure |
int32_t odp_stash_get_ptr | ( | odp_stash_t | stash, |
uintptr_t | ptr[], | ||
int32_t | num | ||
) |
Get pointers from a stash.
Otherwise like odp_stash_get(), except that this function operates on pointers. The stash must have been created with 'obj_size' matching to the size of uintptr_t.
stash | Stash handle | |
[out] | ptr | Points to an array of pointers for output. The array must be pointer size aligned in memory. |
num | Maximum number of pointers to get from the stash |
<0 | on failure |
int32_t odp_stash_get_ptr_batch | ( | odp_stash_t | stash, |
uintptr_t | ptr[], | ||
int32_t | num | ||
) |
Get batch of pointers from a stash.
Otherwise like odp_stash_get_ptr(), except that this function outputs either all 'num' object handles or none. odp_stash_capability_t.max_get_batch defines the maximum supported batch size.
stash | Stash handle | |
[out] | ptr | Points to an array of pointers for output. The array must be pointer size aligned in memory. |
num | Number of pointers to get from the stash |
<0 | on failure |
int odp_stash_flush_cache | ( | odp_stash_t | stash | ) |
Flush object handles from the thread local cache.
Flushes all object handles from the thread local cache into the stash, so that those are available to odp_stash_get() calls from other threads. This call may be used to ensure that thread local cache is empty e.g. before the calling thread stops using the stash.
Flush and put operations share 'put_mode' setting in stash creation parameters. So, application must ensure that flush and put operations are not used concurrently, when ODP_STASH_OP_ST is selected.
stash | Stash handle |
0 | on success |
<0 | on failure |
void odp_stash_print | ( | odp_stash_t | stash | ) |
Print debug information about the stash.
Print implementation defined information about the stash to the ODP log. The information is intended to be used for debugging.
stash | Stash handle |
int odp_stash_stats | ( | odp_stash_t | stash, |
odp_stash_stats_t * | stats | ||
) |
Read statistics counters of a stash.
Read the statistics counters enabled using odp_stash_stats_opt_t during stash creation. Inactive counters are set to zero by the implementation.
stash | Stash handle | |
[out] | stats | Points to statistics counters structure for output |
0 | on success |
<0 | on failure |