API Reference Manual  1.47.0
api/spec/pool_types.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2021-2025 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 #include <odp/api/std_types.h>
16 #include <odp/api/dma_types.h>
17 #include <odp/api/ml_types.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
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  struct {
388  uint32_t max_pools;
389 
394  uint32_t max_num;
395 
397  uint32_t max_size;
398 
400  uint32_t max_uarea_size;
401 
406 
408  uint32_t min_cache_size;
409 
411  uint32_t max_cache_size;
412 
416 
418 
422 typedef struct odp_pool_pkt_subparam_t {
424  uint32_t num;
425 
427  uint32_t len;
428 
430 
434 typedef enum odp_pool_type_t {
436  ODP_POOL_PACKET = ODP_EVENT_PACKET,
437 
439  ODP_POOL_BUFFER = ODP_EVENT_BUFFER,
440 
442  ODP_POOL_TIMEOUT = ODP_EVENT_TIMEOUT,
443 
451 
454 
457 
460 
462 
466 typedef struct odp_pool_param_t {
469 
471  struct {
473  uint32_t num;
474 
480  uint32_t size;
481 
486  uint32_t align;
487 
492  uint32_t uarea_size;
493 
508  uint32_t cache_size;
509  } buf;
510 
512  struct {
521  uint32_t num;
522 
531  uint32_t max_num;
532 
540  uint32_t len;
541 
546  uint32_t max_len;
547 
559  uint32_t align;
560 
566  uint32_t seg_len;
567 
572  uint32_t uarea_size;
573 
579  uint32_t headroom;
580 
587  uint8_t num_subparam;
588 
604 
609  uint32_t cache_size;
610  } pkt;
611 
613  struct {
615  uint32_t num;
616 
621  uint32_t uarea_size;
622 
627  uint32_t cache_size;
628  } tmo;
629 
631  struct {
633  uint32_t num;
634 
636  uint32_t max_size;
637 
642  uint32_t uarea_size;
643 
648  uint32_t cache_size;
650 
652  struct {
654  uint32_t num;
655 
657  uint32_t max_size;
658 
663  uint32_t uarea_size;
664 
669  uint32_t cache_size;
671 
673  struct {
688  void (*init_fn)(void *uarea, uint32_t size, void *args, uint32_t index);
689 
693  void *args;
695 
704 
706 
713 #define ODP_POOL_POPULATE_DONE 0x1
714 
726 
730  uint32_t max_pools;
731 
733  uint32_t min_cache_size;
734 
736  uint32_t max_cache_size;
737 
740 
742  struct {
744  uint32_t max_num_buf;
745 
747  uint32_t max_buf_size;
748 
756  uint32_t odp_header_size;
757 
766 
774  uint32_t min_mem_align;
775 
781  uint32_t min_buf_align;
782 
789  uint32_t min_head_align;
790 
797  struct {
804  uint16_t buf_size_aligned : 1;
805 
806  };
807 
812  uint32_t max_headroom;
813 
821 
824 
826  uint32_t max_uarea_size;
827 
833 
834  } pkt;
835 
837 
841 typedef struct odp_pool_ext_param_t {
844 
846  struct {
854  void (*init_fn)(void *uarea, uint32_t size, void *args, uint32_t index);
855 
858  void *args;
859 
861 
868  uint32_t cache_size;
869 
877 
879  struct {
885  uint32_t num_buf;
886 
894  uint32_t buf_size;
895 
903  uint32_t app_header_size;
904 
912  uint32_t uarea_size;
913 
922  uint32_t headroom;
923 
924  } pkt;
925 
927 
932 typedef struct odp_pool_info_t {
935 
937  const char *name;
938 
945 
947  union {
950 
953 
956 
959  };
960 
962  struct {
969  uint32_t max_num;
970 
971  } pkt;
972 
980  uintptr_t min_data_addr;
981 
989  uintptr_t max_data_addr;
990 
992 
997 #ifdef __cplusplus
998 }
999 #endif
1000 
1001 #include <odp/visibility_end.h>
1002 #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.
@ ODP_POOL_EVENT_VECTOR
Event vector 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.
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.
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.
struct odp_pool_capability_t::@131 pkt
Packet pool capabilities
odp_pool_stats_opt_t stats
Supported statistics counters.
struct odp_pool_capability_t::@134 event_vector
Event vector pool capabilities.
struct odp_pool_capability_t::@133 vector
Vector pool capabilities.
struct odp_pool_capability_t::@132 tmo
Timeout 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.
struct odp_pool_capability_t::@130 buf
Buffer pool capabilities
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.
struct odp_pool_ext_capability_t::@141 pkt
Packet pool capabilities
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.
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::@145 pkt
Parameters for packet pools.
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::@144 uarea_init
Parameters for user area initialization.
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.
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.
struct odp_pool_info_t::@148 pkt
Additional info for packet pools.
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.
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.
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.
struct odp_pool_param_t::@135 buf
Parameters for buffer pools.
struct odp_pool_param_t::@136 pkt
Parameters for packet pools.
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.
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::@138 vector
Parameters for vector pools.
uint32_t len
Minimum length of 'num' packets.
struct odp_pool_param_t::@140 uarea_init
Parameters for user area initialization.
uint32_t max_size
Maximum number of handles (such as odp_packet_t) in a vector.
struct odp_pool_param_t::@139 event_vector
Parameters for event vector pools.
uint32_t seg_len
Minimum number of packet data bytes that can be stored in the first segment of a newly allocated pack...
odp_pool_stats_opt_t stats
Configure statistics counters.
struct odp_pool_param_t::@137 tmo
Parameters for timeout pools.
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.
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.
struct odp_pool_stats_t::@129 thread
Per thread counters.
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.
struct odp_pool_stats_opt_t::@128 bit
Option flags.
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.