EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
em_pool_types.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015, Nokia Solutions and Networks
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/**
32 * @file
33 * EM internal POOL types & definitions
34 *
35 */
36
37#ifndef EM_POOL_TYPES_H_
38#define EM_POOL_TYPES_H_
39
40#include <stdint.h>
41
42#include <odp_api.h>
43
44#include <event_machine.h>
46
47#include "misc/objpool.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/**
54 * EM event/memory pool
55 */
56typedef struct {
57 /** Event type of events allocated from the pool */
59 /** Event alignment offset, see em-odp.conf */
60 uint32_t align_offset;
61 /** Event user area size */
62 struct {
63 /** Requested user area size (bytes) */
64 uint16_t size;
65 /*
66 * Note: Use uint16_t instead of size_t to match bitfield sizes
67 * of event_hdr_t::user_area.size.
68 * Size is max EM_EVENT_USER_AREA_MAX_SIZE bytes which
69 * will fit into uint16_t.
70 */
71 } user_area;
72
73 /** Number of subpools within one EM pool, max=EM_MAX_SUBPOOLS */
75 /** ODP (sub)pool buffer (event) payload sizes */
76 uint32_t size[EM_MAX_SUBPOOLS];
77 /** ODP buffer handles for the subpools */
78 odp_pool_t odp_pool[EM_MAX_SUBPOOLS];
79 /** EM pool handle */
80 em_pool_t em_pool;
81 /** for linking free pool-entries together */
83 /** Pool statistic options chosen during create */
84 odp_pool_stats_opt_t stats_opt;
85 /** Pool Configuration given during create */
87 /* Pool name */
88 char name[EM_POOL_NAME_LEN];
90
91/**
92 * @def POOL_ODP2EM_TBL_LEN
93 * Length of the mpool_tbl_t::pool_odp2em[] array
94 */
95#define POOL_ODP2EM_TBL_LEN 256
96
97/*
98 * Verify at compile time that the mpool_tbl_t::pool_odp2em[] mapping table
99 * is large enough.
100 * Verified also at runtime that: POOL_ODP2EM_TBL_LEN > odp_pool_max_index()
101 */
103 "MPOOL_TBL_T__POOL_ODP2EM__LEN_ERR");
104
105/**
106 * Table entry in the mapping table from odp-pool to em-pool and subpool.
107 * See the mpool_tbl_t::pool_subpool_odp2em[] array.
108 */
109typedef union {
110 struct {
111 uint32_t pool; /* em_pool_t typecast to uint32_t, always fits */
112 uint32_t subpool;
113 };
114 uint64_t both;
116
117COMPILE_TIME_ASSERT(sizeof(pool_subpool_t) == sizeof(uint64_t), "POOL_SUBPOOL_T__SIZE_ERR");
118
119/**
120 * Undef value for a pool_subpool_t
121 * pool_subpool_undef = {.pool = EM_POOL_UNDEF, .subpool = 0};
122 */
124
125/**
126 * EM pool element table
127 */
128typedef struct {
129 /** event/memory pool elem table */
131
132 /**
133 * Mapping from odp_pool_index(odp_pool) to em-pool handle and subpool.
134 * Verified at runtime that: POOL_ODP2EM_TBL_LEN > odp_pool_max_index()
135 */
137
138 /** ODP pool capabilities common for all pools */
139 odp_pool_capability_t odp_pool_capability ENV_CACHE_LINE_ALIGNED;
141
142/**
143 * Pool of free mempools
144 */
145typedef struct {
146 objpool_t objpool;
148
149#ifdef __cplusplus
150}
151#endif
152
153#endif /* EM_POOL_TYPES_H_ */
const pool_subpool_t pool_subpool_undef
Undef value for a pool_subpool_t pool_subpool_undef = {.pool = EM_POOL_UNDEF, .subpool = 0};.
Definition em_pool.c:100
#define POOL_ODP2EM_TBL_LEN
#define EM_CONFIG_POOLS
#define EM_MAX_SUBPOOLS
The maximum number of subpools in each EM pool. The subpool is a pool with buffers of only one size.
#define EM_POOL_NAME_LEN
uint32_t em_event_type_t
em_pool_cfg_t pool_cfg
odp_pool_stats_opt_t stats_opt
uint32_t align_offset
objpool_elem_t objpool_elem
em_pool_t em_pool
uint16_t size
em_event_type_t event_type
odp_pool_capability_t odp_pool_capability ENV_CACHE_LINE_ALIGNED