aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_pool_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/include/odp_pool_internal.h')
-rw-r--r--platform/linux-generic/include/odp_pool_internal.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h
index 4c9f9a9ce..824aa9292 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -28,6 +28,8 @@ extern "C" {
#include <odp_ring_ptr_internal.h>
#include <odp/api/plat/strong_types.h>
+#define _ODP_POOL_MEM_SRC_DATA_SIZE 128
+
typedef struct ODP_ALIGNED_CACHE pool_cache_t {
/* Number of buffers in cache */
uint32_t cache_num;
@@ -52,8 +54,7 @@ typedef struct ODP_ALIGNED_CACHE {
} pool_ring_t;
#pragma GCC diagnostic pop
-/* Callback function for pool destroy */
-typedef void (*pool_destroy_cb_fn)(void *pool);
+struct _odp_pool_mem_src_ops_t;
typedef struct pool_t {
odp_ticketlock_t lock ODP_ALIGNED_CACHE;
@@ -91,14 +92,11 @@ typedef struct pool_t {
uint8_t *uarea_base_addr;
odp_pool_type_t type_2;
odp_pool_ext_param_t ext_param;
-
- /* Used by DPDK zero-copy pktio */
- uint32_t dpdk_elt_size;
uint32_t skipped_blocks;
- uint8_t pool_in_use;
uint8_t mem_from_huge_pages;
- pool_destroy_cb_fn ext_destroy;
- void *ext_desc;
+ const struct _odp_pool_mem_src_ops_t *mem_src_ops;
+ /* Private area for memory source operations */
+ uint8_t mem_src_data[_ODP_POOL_MEM_SRC_DATA_SIZE] ODP_ALIGNED_CACHE;
struct ODP_ALIGNED_CACHE {
odp_atomic_u64_t alloc_ops;
@@ -130,6 +128,25 @@ typedef struct pool_global_t {
} pool_global_t;
+/* Operations for when ODP packet pool is used as a memory source for e.g. zero-copy packet IO
+ * purposes */
+typedef struct _odp_pool_mem_src_ops_t {
+ /* Name of the ops provider */
+ const char *name;
+ /* Signal if ops provider is an active user for the pool as a memory source */
+ odp_bool_t (*is_active)(void);
+ /* Force disable for the ops provider (for now, if one active memory source user is found,
+ * others are disabled) */
+ void (*force_disable)(void);
+ /* Adjust pool block sizes as required by memory consumer */
+ void (*adjust_size)(uint8_t *data, uint32_t *block_size, uint32_t *block_offset,
+ uint32_t *flags);
+ /* Bind the pool as a memory source */
+ int (*bind)(uint8_t *data, pool_t *pool);
+ /* Unbind the pool as a memory source */
+ void (*unbind)(uint8_t *data);
+} _odp_pool_mem_src_ops_t;
+
extern pool_global_t *_odp_pool_glb;
static inline pool_t *pool_entry(uint32_t pool_idx)