API Reference Manual  1.45.1
api/spec/pool_types.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2021-2024 Nokia
3  */
4 
11 #ifndef ODP_API_SPEC_POOL_TYPES_H_
12 #define ODP_API_SPEC_POOL_TYPES_H_
13 #include <odp/visibility_begin.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include <odp/api/std_types.h>
20 #include <odp/api/dma_types.h>
21 #include <odp/api/ml_types.h>
22 
48 #define ODP_POOL_MAX_SUBPARAMS 7
49 
55 typedef union odp_pool_stats_opt_t {
57  struct {
59  uint64_t available : 1;
60 
62  uint64_t alloc_ops : 1;
63 
65  uint64_t alloc_fails : 1;
66 
68  uint64_t free_ops : 1;
69 
71  uint64_t total_ops : 1;
72 
74  uint64_t cache_available : 1;
75 
77  uint64_t cache_alloc_ops : 1;
78 
80  uint64_t cache_free_ops : 1;
81 
83  uint64_t thread_cache_available : 1;
84  } bit;
85 
90  uint64_t all;
91 
93 
101 typedef struct odp_pool_stats_t {
103  uint64_t available;
104 
107  uint64_t alloc_ops;
108 
110  uint64_t alloc_fails;
111 
113  uint64_t free_ops;
114 
117  uint64_t total_ops;
118 
120  uint64_t cache_available;
121 
124  uint64_t cache_alloc_ops;
125 
127  uint64_t cache_free_ops;
128 
130  struct {
133  uint16_t first;
134 
137  uint16_t last;
138 
146 
148 
156  uint64_t available;
157 
159  uint64_t alloc_ops;
160 
162  uint64_t alloc_fails;
163 
165  uint64_t free_ops;
166 
168  uint64_t total_ops;
169 
171  uint64_t cache_available;
172 
174  uint64_t cache_alloc_ops;
175 
177  uint64_t cache_free_ops;
178 
180 
184 typedef struct odp_pool_capability_t {
186  uint32_t max_pools;
187 
189  struct {
191  uint32_t max_pools;
192 
194  uint32_t max_align;
195 
200  uint32_t max_size;
201 
206  uint32_t max_num;
207 
209  uint32_t max_uarea_size;
210 
223 
225  uint32_t min_cache_size;
226 
228  uint32_t max_cache_size;
229 
232  } buf;
233 
235  struct {
237  uint32_t max_pools;
238 
247  uint32_t max_len;
248 
253  uint32_t max_num;
254 
259  uint32_t max_align;
260 
266  uint32_t min_headroom;
267 
273  uint32_t max_headroom;
274 
280  uint32_t min_tailroom;
281 
284 
289  uint32_t min_seg_len;
290 
298  uint32_t max_seg_len;
299 
301  uint32_t max_uarea_size;
302 
307 
313 
315  uint32_t min_cache_size;
316 
318  uint32_t max_cache_size;
319 
322  } pkt;
323 
325  struct {
327  uint32_t max_pools;
328 
333  uint32_t max_num;
334 
336  uint32_t max_uarea_size;
337 
342 
344  uint32_t min_cache_size;
345 
347  uint32_t max_cache_size;
348 
351  } tmo;
352 
354  struct {
356  uint32_t max_pools;
357 
362  uint32_t max_num;
363 
365  uint32_t max_size;
366 
368  uint32_t max_uarea_size;
369 
374 
376  uint32_t min_cache_size;
377 
379  uint32_t max_cache_size;
380 
384 
386 
390 typedef struct odp_pool_pkt_subparam_t {
392  uint32_t num;
393 
395  uint32_t len;
396 
398 
402 typedef enum odp_pool_type_t {
404  ODP_POOL_PACKET = ODP_EVENT_PACKET,
405 
407  ODP_POOL_BUFFER = ODP_EVENT_BUFFER,
408 
410  ODP_POOL_TIMEOUT = ODP_EVENT_TIMEOUT,
411 
419 
422 
425 
427 
431 typedef struct odp_pool_param_t {
434 
436  struct {
438  uint32_t num;
439 
445  uint32_t size;
446 
451  uint32_t align;
452 
457  uint32_t uarea_size;
458 
473  uint32_t cache_size;
474  } buf;
475 
477  struct {
486  uint32_t num;
487 
496  uint32_t max_num;
497 
505  uint32_t len;
506 
511  uint32_t max_len;
512 
524  uint32_t align;
525 
531  uint32_t seg_len;
532 
537  uint32_t uarea_size;
538 
544  uint32_t headroom;
545 
552  uint8_t num_subparam;
553 
569 
574  uint32_t cache_size;
575  } pkt;
576 
578  struct {
580  uint32_t num;
581 
586  uint32_t uarea_size;
587 
592  uint32_t cache_size;
593  } tmo;
594 
596  struct {
598  uint32_t num;
599 
601  uint32_t max_size;
602 
607  uint32_t uarea_size;
608 
613  uint32_t cache_size;
615 
617  struct {
632  void (*init_fn)(void *uarea, uint32_t size, void *args, uint32_t index);
633 
637  void *args;
639 
648 
650 
657 #define ODP_POOL_POPULATE_DONE 0x1
658 
670 
674  uint32_t max_pools;
675 
677  uint32_t min_cache_size;
678 
680  uint32_t max_cache_size;
681 
684 
686  struct {
688  uint32_t max_num_buf;
689 
691  uint32_t max_buf_size;
692 
700  uint32_t odp_header_size;
701 
710 
718  uint32_t min_mem_align;
719 
725  uint32_t min_buf_align;
726 
733  uint32_t min_head_align;
734 
741  struct {
748  uint16_t buf_size_aligned : 1;
749 
750  };
751 
756  uint32_t max_headroom;
757 
765 
768 
770  uint32_t max_uarea_size;
771 
777 
778  } pkt;
779 
781 
785 typedef struct odp_pool_ext_param_t {
788 
790  struct {
798  void (*init_fn)(void *uarea, uint32_t size, void *args, uint32_t index);
799 
802  void *args;
803 
805 
812  uint32_t cache_size;
813 
821 
823  struct {
829  uint32_t num_buf;
830 
838  uint32_t buf_size;
839 
847  uint32_t app_header_size;
848 
856  uint32_t uarea_size;
857 
866  uint32_t headroom;
867 
868  } pkt;
869 
871 
876 typedef struct odp_pool_info_t {
879 
881  const char *name;
882 
889 
891  union {
894 
897 
900 
903  };
904 
906  struct {
913  uint32_t max_num;
914 
915  } pkt;
916 
924  uintptr_t min_data_addr;
925 
933  uintptr_t max_data_addr;
934 
936 
941 #ifdef __cplusplus
942 }
943 #endif
944 
945 #include <odp/visibility_end.h>
946 #endif
ODP DMA.
ODP Machine Learning (ML) types.
Standard C language types and definitions for ODP.
union odp_pool_stats_opt_t odp_pool_stats_opt_t
Pool statistics counters options.
#define ODP_POOL_MAX_SUBPARAMS
Maximum number of packet pool subparameters.
#define ODP_POOL_MAX_THREAD_STATS
Maximum number of per thread statistics a single odp_pool_stats() call can read.
struct odp_pool_param_t odp_pool_param_t
Pool parameters.
struct odp_pool_ext_param_t odp_pool_ext_param_t
External memory pool parameters.
struct odp_pool_capability_t odp_pool_capability_t
Pool capabilities.
odp_pool_type_t
Pool types.
struct odp_pool_pkt_subparam_t odp_pool_pkt_subparam_t
Packet pool subparameters.
struct odp_pool_ext_capability_t odp_pool_ext_capability_t
External memory pool capabilities.
struct odp_pool_stats_t odp_pool_stats_t
Pool statistics counters.
struct odp_pool_info_t odp_pool_info_t
Pool information struct Used to get information about a pool.
struct odp_pool_stats_selected_t odp_pool_stats_selected_t
Pool statistics counters.
@ ODP_POOL_TIMEOUT
Timeout pool.
@ ODP_POOL_VECTOR
Vector event pool.
@ ODP_POOL_BUFFER
Buffer pool.
@ ODP_POOL_PACKET
Packet pool.
@ ODP_POOL_DMA_COMPL
DMA completion event pool.
@ ODP_POOL_ML_COMPL
ML completion event pool.
bool odp_bool_t
Boolean type.
DMA completion event pool parameters.
ML completion event pool parameters.
uint32_t max_align
Maximum buffer data alignment in bytes.
struct odp_pool_capability_t::@118 buf
Buffer pool capabilities
uint32_t max_headroom
Maximum packet level headroom length in bytes.
uint32_t min_headroom
Minimum packet level headroom length in bytes.
uint32_t max_num
Maximum number of buffers of any size.
struct odp_pool_capability_t::@120 tmo
Timeout pool capabilities
uint32_t min_cache_size
Minimum size of thread local cache.
uint32_t max_segs_per_pkt
Maximum number of segments per packet.
odp_bool_t uarea_persistence
Pool user area persistence.
uint32_t max_uarea_size
Maximum user area size in bytes.
uint32_t max_size
Maximum buffer data size in bytes.
uint8_t max_num_subparam
Maximum number of subparameters.
odp_pool_stats_opt_t stats
Supported statistics counters.
struct odp_pool_capability_t::@119 pkt
Packet pool capabilities
struct odp_pool_capability_t::@121 vector
Vector pool capabilities.
uint32_t max_cache_size
Maximum size of thread local cache.
uint32_t min_seg_len
Minimum packet segment data length in bytes.
uint32_t max_pools
Maximum number of pools of any type (odp_pool_type_t)
uint32_t min_tailroom
Minimum packet level tailroom length in bytes.
uint32_t max_seg_len
Maximum packet segment data length in bytes.
uint32_t max_len
Maximum packet data length in bytes.
External memory pool capabilities.
uint16_t buf_size_aligned
Packet buffers are size aligned.
uint32_t max_pools
Maximum number of pools.
uint32_t max_num_buf
Maximum number of packet buffers.
odp_bool_t uarea_persistence
Pool user area persistence.
uint32_t max_segs_per_pkt
Maximum number of segments per packet.
uint32_t max_headroom
Maximum headroom parameter value.
uint32_t odp_trailer_size
ODP trailer size in bytes.
uint32_t min_mem_align
Minimum packet pool memory area alignment in bytes.
uint32_t max_uarea_size
Maximum user area size in bytes.
uint32_t min_head_align
Minimum packet headroom alignment in bytes.
uint32_t min_cache_size
Minimum size of thread local cache.
odp_pool_type_t type
Requested pool type.
odp_pool_stats_opt_t stats
Supported statistics counters.
uint32_t max_headroom_size
Maximum headroom size in bytes.
uint32_t max_cache_size
Maximum size of thread local cache.
struct odp_pool_ext_capability_t::@127 pkt
Packet pool capabilities
uint32_t odp_header_size
ODP header size in bytes.
uint32_t max_buf_size
Maximum packet buffer size in bytes.
uint32_t min_buf_align
Minimum packet buffer pointer alignment in bytes.
External memory pool parameters.
struct odp_pool_ext_param_t::@130 uarea_init
Parameters for user area initialization.
odp_pool_type_t type
Pool type.
void(* init_fn)(void *uarea, uint32_t size, void *args, uint32_t index)
See uarea_init.init_fn of odp_pool_param_t for details (odp_pool_param_t::init_fn).
uint32_t uarea_size
User area size.
uint32_t app_header_size
Application header size.
uint32_t headroom
Minimum headroom size.
uint32_t cache_size
Maximum thread local cache size for the pool.
void * args
See uarea_init.args of odp_pool_param_t for details (odp_pool_param_t::args).
odp_pool_stats_opt_t stats
Pool statistics configuration.
struct odp_pool_ext_param_t::@131 pkt
Parameters for packet pools.
uint32_t buf_size
Packet buffer size.
uint32_t num_buf
Number of packet buffers.
Pool information struct Used to get information about a pool.
odp_dma_pool_param_t dma_pool_param
Copy of pool parameters when pool type is ODP_POOL_DMA_COMPL.
uint32_t max_num
Maximum number of packets of any length.
struct odp_pool_info_t::@134 pkt
Additional info for packet pools.
odp_pool_ext_param_t pool_ext_param
Copy of external memory pool parameters.
odp_ml_compl_pool_param_t ml_pool_param
Copy of pool parameters when pool type is ODP_POOL_ML_COMPL.
uintptr_t min_data_addr
Minimum data address.
const char * name
Pool name.
odp_pool_type_t type
Pool type.
odp_pool_param_t params
Copy of pool parameters.
odp_bool_t pool_ext
External memory pool.
uintptr_t max_data_addr
Maximum data address.
Pool parameters.
uint32_t uarea_size
Minimum user area size in bytes.
struct odp_pool_param_t::@125 vector
Parameters for vector pools.
void * args
Pointer to application defined arguments to be passed to every call of init_fn.
uint32_t num
Number of buffers in the pool.
struct odp_pool_param_t::@122 buf
Parameters for buffer pools.
uint32_t max_len
Maximum packet length that will be allocated from the pool.
uint32_t align
Minimum buffer alignment in bytes.
uint32_t headroom
Minimum headroom size in bytes.
odp_pool_pkt_subparam_t sub[ODP_POOL_MAX_SUBPARAMS]
Subparameter table.
uint32_t cache_size
Maximum number of buffers cached locally per thread.
uint8_t num_subparam
Number of subparameters.
struct odp_pool_param_t::@124 tmo
Parameters for timeout pools.
void(* init_fn)(void *uarea, uint32_t size, void *args, uint32_t index)
User area initialization function.
uint32_t size
Minimum buffer size in bytes.
uint32_t max_num
Maximum number of packets.
odp_pool_type_t type
Pool type.
struct odp_pool_param_t::@123 pkt
Parameters for packet pools.
uint32_t len
Minimum length of 'num' packets.
uint32_t max_size
Maximum number of handles (such as odp_packet_t) in a vector.
uint32_t seg_len
Minimum number of packet data bytes that can be stored in the first segment of a newly allocated pack...
struct odp_pool_param_t::@126 uarea_init
Parameters for user area initialization.
odp_pool_stats_opt_t stats
Configure statistics counters.
Packet pool subparameters.
uint32_t len
Packet length in bytes.
uint32_t num
Number of 'len' byte packets.
Pool statistics counters.
uint64_t cache_free_ops
See odp_pool_stats_t::cache_free_ops.
uint64_t cache_alloc_ops
See odp_pool_stats_t::cache_alloc_ops.
uint64_t cache_available
See odp_pool_stats_t::cache_available.
uint64_t free_ops
See odp_pool_stats_t::free_ops.
uint64_t available
See odp_pool_stats_t::available.
uint64_t total_ops
See odp_pool_stats_t::total_ops.
uint64_t alloc_ops
See odp_pool_stats_t::alloc_ops.
uint64_t alloc_fails
See odp_pool_stats_t::alloc_fails.
Pool statistics counters.
struct odp_pool_stats_t::@117 thread
Per thread counters.
uint64_t alloc_ops
The number of alloc operations from the pool.
uint64_t available
The number of available events in the pool.
uint16_t first
First thread identifier to read counters from.
uint64_t free_ops
The number of free operations to the pool.
uint64_t cache_free_ops
The number of free operations, which stored events to pool caches.
uint64_t alloc_fails
The number of failed alloc operations (pool empty)
uint64_t total_ops
The total number of alloc and free operations.
uint64_t cache_alloc_ops
The number of successful alloc operations from pool caches (returned at least one event).
uint64_t cache_available
The number of available events in the local caches of all threads.
uint16_t last
Last thread identifier to read counters from.
Pool statistics counters options.
uint64_t total_ops
See odp_pool_stats_t::total_ops.
uint64_t cache_free_ops
See odp_pool_stats_t::cache_free_ops.
uint64_t cache_available
See odp_pool_stats_t::cache_available.
uint64_t alloc_fails
See odp_pool_stats_t::alloc_fails.
uint64_t thread_cache_available
See odp_pool_stats_t::thread::cache_available.
uint64_t free_ops
See odp_pool_stats_t::free_ops.
uint64_t alloc_ops
See odp_pool_stats_t::alloc_ops.
uint64_t available
See odp_pool_stats_t::available.
uint64_t all
All bits of the bit field structure.
uint64_t cache_alloc_ops
See odp_pool_stats_t::cache_alloc_ops.
struct odp_pool_stats_opt_t::@116 bit
Option flags.