EM-ODP  3.7.0
Event Machine on ODP
event_machine_pool.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2023, 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  *
34  * Event Machine event pool functions.
35  *
36  */
37 
38 #include "em_include.h"
39 
40 /* per core (thread) state for em_atomic_group_get_next() */
41 static ENV_LOCAL unsigned int _pool_tbl_iter_idx;
42 
43 void em_pool_cfg_init(em_pool_cfg_t *const pool_cfg)
44 {
45  odp_pool_param_t odp_pool_defaults;
46  uint32_t buf_cache_sz;
47  uint32_t pkt_cache_sz;
48  uint32_t vec_cache_sz;
49  uint32_t cache_sz;
50 
51  if (unlikely(!pool_cfg)) {
54  "pool_cfg pointer NULL!");
55  return;
56  }
57 
58  odp_pool_param_init(&odp_pool_defaults);
59  memset(pool_cfg, 0, sizeof(*pool_cfg));
60 
61  pool_cfg->event_type = EM_EVENT_TYPE_UNDEF;
62 
63  buf_cache_sz = odp_pool_defaults.buf.cache_size;
64  pkt_cache_sz = odp_pool_defaults.pkt.cache_size;
65  vec_cache_sz = odp_pool_defaults.vector.cache_size;
66  cache_sz = MIN(buf_cache_sz, pkt_cache_sz);
67  cache_sz = MIN(cache_sz, vec_cache_sz);
68 
69  for (int i = 0; i < EM_MAX_SUBPOOLS; i++)
70  pool_cfg->subpool[i].cache_size = cache_sz;
71 
73 }
74 
75 em_pool_t
76 em_pool_create(const char *name, em_pool_t pool, const em_pool_cfg_t *pool_cfg)
77 {
78  em_pool_t pool_created;
79  const char *err_str = "";
80 
81  /* Verify config */
82  int err = invalid_pool_cfg(pool_cfg, &err_str);
83 
84  if (unlikely(err)) {
86  "Pool create: invalid pool-config(%d): %s",
87  err, err_str);
88  return EM_POOL_UNDEF;
89  }
90 
91  err = check_pool_uarea_persistence(pool_cfg, &err_str);
92 
93  if (unlikely(err)) {
95  "Pool create: user area persistence unsupported(%d): %s",
96  err, err_str);
97  return EM_POOL_UNDEF;
98  }
99 
100  pool_created = pool_create(name, pool, pool_cfg);
101 
102  if (unlikely(pool_created == EM_POOL_UNDEF ||
103  (pool != EM_POOL_UNDEF && pool != pool_created))) {
105  "Pool create failed,\n"
106  "requested:%" PRI_POOL " created:%" PRI_POOL "",
107  pool, pool_created);
108  return EM_POOL_UNDEF;
109  }
110 
111  return pool_created;
112 }
113 
115 em_pool_delete(em_pool_t pool)
116 {
117  em_status_t stat;
118 
119  stat = pool_delete(pool);
121  "Pool delete failed");
122 
123  return EM_OK;
124 }
125 
126 em_pool_t
127 em_pool_find(const char *name)
128 {
129  if (name && *name)
130  return pool_find(name);
131 
132  return EM_POOL_UNDEF;
133 }
134 
135 size_t
136 em_pool_get_name(em_pool_t pool, char *name /*out*/, size_t maxlen)
137 {
138  const mpool_elem_t *mpool_elem = pool_elem_get(pool);
139  size_t len = 0;
140 
141  if (unlikely(name == NULL || maxlen == 0)) {
143  "Invalid args: name=0x%" PRIx64 ", maxlen=%zu",
144  name, maxlen);
145  return 0;
146  }
147 
148  if (unlikely(mpool_elem == NULL || !pool_allocated(mpool_elem))) {
150  "Invalid Pool:%" PRI_POOL "", pool);
151  name[0] = '\0';
152  return 0;
153  }
154 
155  len = strnlen(mpool_elem->name, sizeof(mpool_elem->name) - 1);
156  if (maxlen - 1 < len)
157  len = maxlen - 1;
158 
159  memcpy(name, mpool_elem->name, len);
160  name[len] = '\0';
161 
162  return len;
163 }
164 
165 em_pool_t
166 em_pool_get_first(unsigned int *num)
167 {
168  const mpool_elem_t *const mpool_elem_tbl = em_shm->mpool_tbl.pool;
169  const mpool_elem_t *mpool_elem = &mpool_elem_tbl[0];
170  const unsigned int pool_cnt = pool_count();
171 
172  _pool_tbl_iter_idx = 0; /* reset iteration */
173 
174  if (num)
175  *num = pool_cnt;
176 
177  if (pool_cnt == 0) {
178  _pool_tbl_iter_idx = EM_CONFIG_POOLS; /* UNDEF = _get_next() */
179  return EM_POOL_UNDEF;
180  }
181 
182  /* find first */
183  while (!pool_allocated(mpool_elem)) {
184  _pool_tbl_iter_idx++;
185  if (_pool_tbl_iter_idx >= EM_CONFIG_POOLS)
186  return EM_POOL_UNDEF;
187  mpool_elem = &mpool_elem_tbl[_pool_tbl_iter_idx];
188  }
189 
190  return pool_idx2hdl(_pool_tbl_iter_idx);
191 }
192 
193 em_pool_t
195 {
196  if (_pool_tbl_iter_idx >= EM_CONFIG_POOLS - 1)
197  return EM_POOL_UNDEF;
198 
199  _pool_tbl_iter_idx++;
200 
201  const mpool_elem_t *const mpool_elem_tbl = em_shm->mpool_tbl.pool;
202  const mpool_elem_t *mpool_elem = &mpool_elem_tbl[_pool_tbl_iter_idx];
203 
204  /* find next */
205  while (!pool_allocated(mpool_elem)) {
206  _pool_tbl_iter_idx++;
207  if (_pool_tbl_iter_idx >= EM_CONFIG_POOLS)
208  return EM_POOL_UNDEF;
209  mpool_elem = &mpool_elem_tbl[_pool_tbl_iter_idx];
210  }
211 
212  return pool_idx2hdl(_pool_tbl_iter_idx);
213 }
214 
216 em_pool_info(em_pool_t pool, em_pool_info_t *pool_info /*out*/)
217 {
218  const mpool_elem_t *pool_elem = pool_elem_get(pool);
219 
220  if (EM_CHECK_LEVEL > 0)
221  RETURN_ERROR_IF(!pool_elem || !pool_info,
223  "Inv. args: pool:%" PRI_POOL " pool_info:%p",
224  pool, pool_info);
225 
226  if (EM_CHECK_LEVEL >= 2)
227  RETURN_ERROR_IF(!pool_allocated(pool_elem),
229  "EM-pool:%" PRI_POOL " not created", pool);
230 
231  memset(pool_info, 0, sizeof(*pool_info));
232  /* copy pool info into the user provided 'pool_info' */
233  strncpy(pool_info->name, pool_elem->name, sizeof(pool_info->name));
234  pool_info->name[sizeof(pool_info->name) - 1] = '\0';
235  pool_info->em_pool = pool_elem->em_pool;
236  pool_info->event_type = pool_elem->event_type;
237  pool_info->align_offset = pool_elem->align_offset;
238  pool_info->user_area_size = pool_elem->user_area.size;
239  pool_info->num_subpools = pool_elem->num_subpools;
240 
241  for (int i = 0; i < pool_elem->num_subpools; i++) {
242  pool_info->subpool[i].size = pool_elem->size[i]; /*sorted sz*/
243  pool_info->subpool[i].num = pool_elem->pool_cfg.subpool[i].num;
244  pool_info->subpool[i].cache_size = pool_elem->pool_cfg.subpool[i].cache_size;
245  }
246 
247  /*
248  * EM pool usage statistics only collected if the pool was created with
249  * 'available' or 'cache_available' statistics enabled either through
250  * EM config file: 'pool.statistics' or in 'em_pool_cfg_t::stats_opt'
251  * given to function em_pool_create(..., pool_cfg).
252  */
253  if (!pool_elem->stats_opt.bit.available &&
254  !pool_elem->stats_opt.bit.cache_available)
255  return EM_OK; /* no statistics, return */
256 
257  /* EM pool usage statistics _enabled_ - collect it: */
258  for (int i = 0; i < pool_elem->num_subpools; i++) {
259  const uint64_t num = pool_elem->pool_cfg.subpool[i].num;
260  uint64_t used = 0;
261  uint64_t free = 0;
262  odp_pool_stats_t odp_stats;
263 
264  /* avoid LTO-error: 'odp_stats.thread.first/last' may be used uninitialized */
265  odp_stats.thread.first = 0;
266  odp_stats.thread.last = 0;
267 
268  int ret = odp_pool_stats(pool_elem->odp_pool[i], &odp_stats);
269 
271  "EM-pool:%" PRI_POOL " subpool:%d stats failed:%d",
272  pool, i, ret);
273  /* ODP inactive counters are zero, it is safe to add both: */
274  free = odp_stats.available + odp_stats.cache_available;
275  if (free > num)
276  free = num;
277  used = num - free;
278 
279  pool_info->subpool[i].used = used;
280  pool_info->subpool[i].free = free;
281  }
282 
283  return EM_OK;
284 }
285 
286 void
287 em_pool_info_print(em_pool_t pool)
288 {
289  pool_info_print_hdr(1);
290  pool_info_print(pool);
291 }
292 
293 int em_pool_get_num_subpools(em_pool_t pool)
294 {
295  const mpool_elem_t *pool_elem = pool_elem_get(pool);
296 
297  if (EM_CHECK_LEVEL > 0 && unlikely(!pool_elem)) {
299  "Inv. args: pool:%" PRI_POOL, pool);
300  return -1;
301  }
302 
303  if (EM_CHECK_LEVEL >= 2 && unlikely(!pool_allocated(pool_elem))) {
305  "EM-pool:%" PRI_POOL " not created", pool);
306  return -1;
307  }
308 
309  return pool_elem->num_subpools;
310 }
311 
312 void
314 {
315  em_pool_t pool;
316  unsigned int num;
317 
318  pool = em_pool_get_first(&num);
319 
320  pool_info_print_hdr(num);
321  while (pool != EM_POOL_UNDEF) {
322  pool_info_print(pool);
323  pool = em_pool_get_next();
324  }
325 }
326 
327 em_status_t em_pool_stats(em_pool_t pool, em_pool_stats_t *pool_stats/*out*/)
328 {
329  int i;
330  int ret;
331  odp_pool_stats_t *odp_stats;
332  const mpool_elem_t *pool_elem = pool_elem_get(pool);
333 
334  if (EM_CHECK_LEVEL > 0)
335  RETURN_ERROR_IF(!pool_elem || !pool_stats,
337  "Inv. args: pool:%" PRI_POOL " pool_stats:%p",
338  pool, pool_stats);
339 
340  if (EM_CHECK_LEVEL >= 2)
341  RETURN_ERROR_IF(!pool_allocated(pool_elem),
343  "EM-pool: %" PRI_POOL "not created", pool);
344 
345  i = 0;
346  for (; i < pool_elem->num_subpools; i++) {
347  odp_stats = (odp_pool_stats_t *)&pool_stats->subpool_stats[i];
348 
349  /* avoid LTO-error: 'odp_stats.thread.first/last' may be used uninitialized */
350  odp_stats->thread.first = 0;
351  odp_stats->thread.last = 0;
352 
353  ret = odp_pool_stats(pool_elem->odp_pool[i], odp_stats);
354 
356  "EM-pool:%" PRI_POOL " subpool:%d stats failed:%d",
357  pool, i, ret);
358  }
359 
360  pool_stats->num_subpools = i;
361 
362  return EM_OK;
363 }
364 
366 {
367  int ret;
368  const mpool_elem_t *pool_elem = pool_elem_get(pool);
369 
370  if (EM_CHECK_LEVEL > 0)
371  RETURN_ERROR_IF(pool_elem == NULL,
373  "EM-pool:%" PRI_POOL " invalid", pool);
374 
375  if (EM_CHECK_LEVEL >= 2)
376  RETURN_ERROR_IF(!pool_allocated(pool_elem),
378  "EM-pool:%" PRI_POOL " not created", pool);
379 
380  for (int i = 0; i < pool_elem->num_subpools; i++) {
381  ret = odp_pool_stats_reset(pool_elem->odp_pool[i]);
383  "EM-pool:%" PRI_POOL " subpool:%d stats reset failed:%d",
384  pool);
385  }
386 
387  return EM_OK;
388 }
389 
390 void em_pool_stats_print(em_pool_t pool)
391 {
392  pool_stats_print(pool);
393 }
394 
395 #define SUBPOOL_STATS_INV_ARG_FMT \
396 "Inv. args: pool:%" PRI_POOL " subpools:%p num_subpools:%d subpool_stats:%p"
397 
398 int
399 em_pool_subpool_stats(em_pool_t pool, const int subpools[], int num_subpools,
400  em_pool_subpool_stats_t subpool_stats[]/*out*/)
401 {
402  int ret;
403  int num_stats = 0;
404  odp_pool_stats_t *odp_stats;
405  const mpool_elem_t *pool_elem = pool_elem_get(pool);
406 
407  if (EM_CHECK_LEVEL > 0 &&
408  unlikely(!pool_elem || !subpools || !subpool_stats ||
409  num_subpools <= 0 || num_subpools > pool_elem->num_subpools)) {
411  SUBPOOL_STATS_INV_ARG_FMT, pool, subpools,
412  num_subpools, subpool_stats);
413  return 0;
414  }
415 
416  if (EM_CHECK_LEVEL >= 2 && unlikely(!pool_allocated(pool_elem))) {
418  "EM-pool: %" PRI_POOL "not allocated", pool);
419  return 0;
420  }
421 
422  for (int i = 0; i < num_subpools; i++) {
423  if (EM_CHECK_LEVEL > 0 &&
424  unlikely(subpools[i] > pool_elem->num_subpools - 1)) {
426  "arg 'subpools[%d]: %d' out of range", i, subpools[i]);
427  return num_stats;
428  }
429 
430  odp_stats = (odp_pool_stats_t *)&subpool_stats[i];
431 
432  /* avoid LTO-error: 'odp_stats.thread.first/last' may be used uninitialized */
433  odp_stats->thread.first = 0;
434  odp_stats->thread.last = 0;
435 
436  ret = odp_pool_stats(pool_elem->odp_pool[subpools[i]], odp_stats);
437  if (unlikely(ret < 0)) {
439  "EM-pool:%" PRI_POOL " subpool:%d stats failed:%d",
440  pool, subpools[i], ret);
441  return num_stats;
442  }
443  num_stats++;
444  }
445 
446  return num_stats;
447 }
448 
450 em_pool_subpool_stats_reset(em_pool_t pool, const int subpools[], int num_subpools)
451 {
452  int ret;
453  const mpool_elem_t *pool_elem = pool_elem_get(pool);
454 
455  if (EM_CHECK_LEVEL > 0)
456  RETURN_ERROR_IF(!pool_elem || !subpools || num_subpools <= 0 ||
457  num_subpools > pool_elem->num_subpools,
459  "Inv. args: pool:%" PRI_POOL " subpools:%p num:%d",
460  pool, subpools, num_subpools);
461 
462  if (EM_CHECK_LEVEL >= 2)
463  RETURN_ERROR_IF(!pool_allocated(pool_elem),
465  "EM-pool:%" PRI_POOL " not created", pool);
466 
467  for (int i = 0; i < num_subpools; i++) {
468  RETURN_ERROR_IF(subpools[i] > pool_elem->num_subpools - 1,
470  "arg 'subpools[%d]: %d' out of range", i, subpools[i]);
471 
472  ret = odp_pool_stats_reset(pool_elem->odp_pool[subpools[i]]);
474  "EM-pool:%" PRI_POOL " subpool:%d stats reset failed:%d",
475  pool, subpools[i], ret);
476  }
477 
478  return EM_OK;
479 }
480 
481 void em_pool_subpool_stats_print(em_pool_t pool, const int subpools[], int num_subpools)
482 {
483  subpools_stats_print(pool, subpools, num_subpools);
484 }
485 
486 static inline void assign_odp_stats_opt(odp_pool_stats_opt_t *opt_odp/*out*/,
487  const em_pool_stats_opt_t *opt_em)
488 {
489  opt_odp->all = 0;
490  opt_odp->bit.available = opt_em->available;
491  opt_odp->bit.alloc_ops = opt_em->alloc_ops;
492  opt_odp->bit.alloc_fails = opt_em->alloc_fails;
493  opt_odp->bit.free_ops = opt_em->free_ops;
494  opt_odp->bit.total_ops = opt_em->total_ops;
495  opt_odp->bit.cache_available = opt_em->cache_available;
496  opt_odp->bit.cache_alloc_ops = opt_em->cache_alloc_ops;
497  opt_odp->bit.cache_free_ops = opt_em->cache_free_ops;
498 }
499 
501 em_pool_stats_selected(em_pool_t pool, em_pool_stats_selected_t *pool_stats/*out*/,
502  const em_pool_stats_opt_t *opt)
503 {
504  int i;
505  int ret;
506  odp_pool_stats_opt_t opt_odp;
507  odp_pool_stats_selected_t *odp_stats;
508  const mpool_elem_t *pool_elem = pool_elem_get(pool);
509 
510  if (EM_CHECK_LEVEL > 0)
511  RETURN_ERROR_IF(!pool_elem || !pool_stats || !opt,
513  "Inv. args: pool:%" PRI_POOL " pool_stats:%p opt: %p",
514  pool, pool_stats, opt);
515 
516  if (EM_CHECK_LEVEL >= 2)
517  RETURN_ERROR_IF(!pool_allocated(pool_elem),
519  "EM-pool: %" PRI_POOL "not created", pool);
520 
521  assign_odp_stats_opt(&opt_odp, opt);
522 
523  for (i = 0; i < pool_elem->num_subpools; i++) {
524  odp_pool_t odp_pool = pool_elem->odp_pool[i];
525 
526  if (EM_CHECK_LEVEL >= 3)
527  RETURN_ERROR_IF(odp_pool == ODP_POOL_INVALID,
529  "EM-pool:%" PRI_POOL " invalid subpool:%d",
530  pool, i);
531 
532  odp_stats = (odp_pool_stats_selected_t *)&pool_stats->subpool_stats[i];
533 
534  ret = odp_pool_stats_selected(odp_pool, odp_stats, &opt_odp);
535 
537  "EM-pool:%" PRI_POOL " subpool:%d stats selected failed:%d",
538  pool, i, ret);
539  }
540 
541  pool_stats->num_subpools = i;
542 
543  return EM_OK;
544 }
545 
546 void em_pool_stats_selected_print(em_pool_t pool, const em_pool_stats_opt_t *opt)
547 {
548  pool_stats_selected_print(pool, opt);
549 }
550 
551 #define SUBPOOL_STATS_SELECTED_INV_ARG_FMT \
552 "Inv. args: pool:%" PRI_POOL " subpools:%p num_subpools:%d subpool_stats:%p opt: %p"
553 
554 int em_pool_subpool_stats_selected(em_pool_t pool, const int subpools[], int num_subpools,
555  em_pool_subpool_stats_selected_t subpool_stats[]/*out*/,
556  const em_pool_stats_opt_t *opt)
557 {
558  int ret;
559  int num_stats = 0;
560  odp_pool_stats_opt_t opt_odp;
561  odp_pool_stats_selected_t *odp_stats;
562  const mpool_elem_t *pool_elem = pool_elem_get(pool);
563 
564  if (EM_CHECK_LEVEL > 0 &&
565  unlikely(!pool_elem || !subpools || !subpool_stats || !opt ||
566  num_subpools <= 0 || num_subpools > pool_elem->num_subpools)) {
568  SUBPOOL_STATS_SELECTED_INV_ARG_FMT, pool, subpools,
569  num_subpools, subpool_stats, opt);
570  return 0;
571  }
572 
573  if (EM_CHECK_LEVEL >= 2 && unlikely(!pool_allocated(pool_elem))) {
575  "EM-pool: %" PRI_POOL "not allocated", pool);
576  return 0;
577  }
578 
579  assign_odp_stats_opt(&opt_odp, opt);
580 
581  for (int i = 0; i < num_subpools; i++) {
582  odp_pool_t odp_pool = pool_elem->odp_pool[subpools[i]];
583 
584  if (EM_CHECK_LEVEL > 0 &&
585  unlikely(subpools[i] > pool_elem->num_subpools - 1)) {
587  "arg 'subpools[%d]: %d' out of range", i, subpools[i]);
588  return num_stats;
589  }
590 
591  if (EM_CHECK_LEVEL >= 3 && unlikely(odp_pool == ODP_POOL_INVALID)) {
593  "EM-pool:%" PRI_POOL " invalid subpool:%d", pool, i);
594  return num_stats;
595  }
596 
597  odp_stats = (odp_pool_stats_selected_t *)&subpool_stats[i];
598 
599  ret = odp_pool_stats_selected(odp_pool, odp_stats, &opt_odp);
600  if (unlikely(ret < 0)) {
602  "EM-pool:%" PRI_POOL " subpool:%d stats failed:%d",
603  pool, subpools[i], ret);
604  return num_stats;
605  }
606  num_stats++;
607  }
608 
609  return num_stats;
610 }
611 
612 void em_pool_subpool_stats_selected_print(em_pool_t pool, const int subpools[],
613  int num_subpools,
614  const em_pool_stats_opt_t *opt)
615 {
616  subpools_stats_selected_print(pool, subpools, num_subpools, opt);
617 }
618 
619 uint64_t em_pool_to_u64(em_pool_t pool)
620 {
621  return (uint64_t)pool;
622 }
mpool_elem_t::size
uint16_t size
Definition: em_pool_types.h:55
mpool_elem_t::em_pool
em_pool_t em_pool
Definition: em_pool_types.h:71
em_pool_get_num_subpools
int em_pool_get_num_subpools(em_pool_t pool)
Return the number of subpools in an EM pool.
Definition: event_machine_pool.c:293
em_pool_stats_opt_t::available
uint64_t available
Definition: event_machine_pool.h:102
em_pool_subpool_stats
int em_pool_subpool_stats(em_pool_t pool, const int subpools[], int num_subpools, em_pool_subpool_stats_t subpool_stats[])
Retrieve statistics about subpool(s) of an EM pool.
Definition: event_machine_pool.c:399
EM_OK
#define EM_OK
Definition: event_machine_types.h:329
mpool_elem_t::user_area
struct mpool_elem_t::@54 user_area
em_pool_info_t::align_offset
uint32_t align_offset
Definition: event_machine_pool.h:333
em_pool_info_t::size
uint32_t size
Definition: event_machine_pool.h:340
em_pool_get_next
em_pool_t em_pool_get_next(void)
Definition: event_machine_pool.c:194
em_pool_stats_opt_t::alloc_ops
uint64_t alloc_ops
Definition: event_machine_pool.h:105
EM_ERR_NOT_CREATED
@ EM_ERR_NOT_CREATED
Definition: event_machine_hw_types.h:274
EM_ESCOPE_POOL_STATS_SELECTED
#define EM_ESCOPE_POOL_STATS_SELECTED
Definition: event_machine_hw_types.h:544
em_pool_subpool_stats_reset
em_status_t em_pool_subpool_stats_reset(em_pool_t pool, const int subpools[], int num_subpools)
Definition: event_machine_pool.c:450
em_pool_subpool_stats_print
void em_pool_subpool_stats_print(em_pool_t pool, const int subpools[], int num_subpools)
Helper function to print statistics for subpool(s) of an EM pool.
Definition: event_machine_pool.c:481
EM_ESCOPE_POOL_CREATE
#define EM_ESCOPE_POOL_CREATE
Definition: event_machine_hw_types.h:489
em_pool_find
em_pool_t em_pool_find(const char *name)
Definition: event_machine_pool.c:127
em_pool_stats_opt_t::cache_alloc_ops
uint64_t cache_alloc_ops
Definition: event_machine_pool.h:120
mpool_elem_t::odp_pool
odp_pool_t odp_pool[EM_MAX_SUBPOOLS]
Definition: em_pool_types.h:69
em_pool_info_t::em_pool
em_pool_t em_pool
Definition: event_machine_pool.h:329
em_pool_stats_print
void em_pool_stats_print(em_pool_t pool)
Helper function to print statistics for an EM pool.
Definition: event_machine_pool.c:390
PRI_POOL
#define PRI_POOL
Definition: event_machine_hw_types.h:62
em_pool_info_print_all
void em_pool_info_print_all(void)
Definition: event_machine_pool.c:313
em_pool_info_t::num
uint32_t num
Definition: event_machine_pool.h:342
em_pool_info_t::used
uint32_t used
Definition: event_machine_pool.h:352
em_pool_info_t::num_subpools
int num_subpools
Definition: event_machine_pool.h:337
em_pool_stats_opt_t::free_ops
uint64_t free_ops
Definition: event_machine_pool.h:111
EM_ERR_LIB_FAILED
@ EM_ERR_LIB_FAILED
Definition: event_machine_hw_types.h:291
EM_ERR_NOT_SUPPORTED
@ EM_ERR_NOT_SUPPORTED
Definition: event_machine_hw_types.h:284
em_pool_info_t::user_area_size
size_t user_area_size
Definition: event_machine_pool.h:335
em_pool_create
em_pool_t em_pool_create(const char *name, em_pool_t pool, const em_pool_cfg_t *pool_cfg)
Definition: event_machine_pool.c:76
EM_ESCOPE_POOL_SUBPOOL_STATS_SELECTED
#define EM_ESCOPE_POOL_SUBPOOL_STATS_SELECTED
Definition: event_machine_hw_types.h:549
EM_ESCOPE_POOL_STATS
#define EM_ESCOPE_POOL_STATS
Definition: event_machine_hw_types.h:524
em_pool_stats_opt_t::cache_free_ops
uint64_t cache_free_ops
Definition: event_machine_pool.h:123
em_pool_stats_selected_t
Definition: event_machine_pool.h:441
em_pool_subpool_stats_selected_print
void em_pool_subpool_stats_selected_print(em_pool_t pool, const int subpools[], int num_subpools, const em_pool_stats_opt_t *opt)
Helper function to print selected statistics for subpool(s) of an EM pool.
Definition: event_machine_pool.c:612
EM_ESCOPE_POOL_DELETE
#define EM_ESCOPE_POOL_DELETE
Definition: event_machine_hw_types.h:494
em_pool_delete
em_status_t em_pool_delete(em_pool_t pool)
Definition: event_machine_pool.c:115
EM_ESCOPE_POOL_CFG_INIT
#define EM_ESCOPE_POOL_CFG_INIT
Definition: event_machine_hw_types.h:484
em_pool_get_name
size_t em_pool_get_name(em_pool_t pool, char *name, size_t maxlen)
Definition: event_machine_pool.c:136
EM_ESCOPE_POOL_NUM_SUBPOOLS
#define EM_ESCOPE_POOL_NUM_SUBPOOLS
Definition: event_machine_hw_types.h:554
em_pool_cfg_t
Definition: event_machine_pool.h:141
em_pool_info_t::cache_size
uint32_t cache_size
Definition: event_machine_pool.h:344
mpool_elem_t
Definition: em_pool_types.h:47
EM_ESCOPE_POOL_GET_NAME
#define EM_ESCOPE_POOL_GET_NAME
Definition: event_machine_hw_types.h:504
em_pool_subpool_stats_t
Definition: event_machine_pool.h:364
RETURN_ERROR_IF
#define RETURN_ERROR_IF(cond, error, escope, fmt,...)
Definition: em_error.h:50
EM_ERR_BAD_ID
@ EM_ERR_BAD_ID
Definition: event_machine_hw_types.h:265
em_pool_stats_opt_t::total_ops
uint64_t total_ops
Definition: event_machine_pool.h:114
INTERNAL_ERROR
#define INTERNAL_ERROR(error, escope, fmt,...)
Definition: em_error.h:43
em_pool_cfg_init
void em_pool_cfg_init(em_pool_cfg_t *const pool_cfg)
Definition: event_machine_pool.c:43
mpool_elem_t::event_type
em_event_type_t event_type
Definition: em_pool_types.h:49
mpool_elem_t::stats_opt
odp_pool_stats_opt_t stats_opt
Definition: em_pool_types.h:75
mpool_elem_t::pool_cfg
em_pool_cfg_t pool_cfg
Definition: em_pool_types.h:77
mpool_elem_t::align_offset
uint32_t align_offset
Definition: em_pool_types.h:51
em_pool_cfg_t::num
uint32_t num
Definition: event_machine_pool.h:281
em_pool_stats_opt_t::cache_available
uint64_t cache_available
Definition: event_machine_pool.h:117
mpool_elem_t::num_subpools
int num_subpools
Definition: em_pool_types.h:65
em_pool_cfg_t::__internal_check
uint32_t __internal_check
Definition: event_machine_pool.h:319
em_pool_cfg_t::cache_size
uint32_t cache_size
Definition: event_machine_pool.h:294
em_pool_info_t::event_type
em_event_type_t event_type
Definition: event_machine_pool.h:331
em_pool_info
em_status_t em_pool_info(em_pool_t pool, em_pool_info_t *pool_info)
Definition: event_machine_pool.c:216
em_pool_stats_opt_t::alloc_fails
uint64_t alloc_fails
Definition: event_machine_pool.h:108
em_status_t
uint32_t em_status_t
Definition: event_machine_types.h:321
EM_CHECK_LEVEL
#define EM_CHECK_LEVEL
Definition: event_machine_config.h:253
EM_ESCOPE_POOL_SUBPOOL_STATS_RESET
#define EM_ESCOPE_POOL_SUBPOOL_STATS_RESET
Definition: event_machine_hw_types.h:539
em_pool_stats_t
Definition: event_machine_pool.h:399
em_shm
em_shm_t * em_shm
Definition: event_machine_init.c:41
em_pool_info_print
void em_pool_info_print(em_pool_t pool)
Definition: event_machine_pool.c:287
EM_ESCOPE_POOL_INFO
#define EM_ESCOPE_POOL_INFO
Definition: event_machine_hw_types.h:519
em_include.h
em_pool_stats_opt_t
Definition: event_machine_pool.h:98
EM_ESCOPE_POOL_STATS_RESET
#define EM_ESCOPE_POOL_STATS_RESET
Definition: event_machine_hw_types.h:529
EM_EVENT_TYPE_UNDEF
@ EM_EVENT_TYPE_UNDEF
Definition: event_machine_hw_types.h:69
em_pool_subpool_stats_selected
int em_pool_subpool_stats_selected(em_pool_t pool, const int subpools[], int num_subpools, em_pool_subpool_stats_selected_t subpool_stats[], const em_pool_stats_opt_t *opt)
Retrieve selected statistics about subpool(s) of an EM pool.
Definition: event_machine_pool.c:554
EM_POOL_UNDEF
#define EM_POOL_UNDEF
Definition: event_machine_hw_types.h:60
EM_CHECK_INIT_CALLED
#define EM_CHECK_INIT_CALLED
Definition: em_include.h:69
em_pool_get_first
em_pool_t em_pool_get_first(unsigned int *num)
Definition: event_machine_pool.c:166
em_pool_cfg_t::subpool
struct em_pool_cfg_t::@11 subpool[EM_MAX_SUBPOOLS]
EM_ERR_BAD_ARG
@ EM_ERR_BAD_ARG
Definition: event_machine_hw_types.h:261
EM_CONFIG_POOLS
#define EM_CONFIG_POOLS
Definition: event_machine_config.h:119
em_pool_to_u64
uint64_t em_pool_to_u64(em_pool_t pool)
Definition: event_machine_pool.c:619
ENV_LOCAL
#define ENV_LOCAL
Definition: environment.h:57
em_pool_stats_selected
em_status_t em_pool_stats_selected(em_pool_t pool, em_pool_stats_selected_t *pool_stats, const em_pool_stats_opt_t *opt)
Retrieve selected statistics about an EM pool.
Definition: event_machine_pool.c:501
em_pool_cfg_t::event_type
em_event_type_t event_type
Definition: event_machine_pool.h:156
EM_MAX_SUBPOOLS
#define EM_MAX_SUBPOOLS
The number of subpools in each EM pool. The subpool is a pool with buffers of only one size.
Definition: event_machine_hw_types.h:254
EM_ESCOPE_POOL_SUBPOOL_STATS
#define EM_ESCOPE_POOL_SUBPOOL_STATS
Definition: event_machine_hw_types.h:534
em_pool_info_t::free
uint32_t free
Definition: event_machine_pool.h:360
em_pool_info_t
Definition: event_machine_pool.h:325
em_pool_subpool_stats_selected_t
Definition: event_machine_pool.h:409
em_pool_stats
em_status_t em_pool_stats(em_pool_t pool, em_pool_stats_t *pool_stats)
Retrieve statistics about an EM pool.
Definition: event_machine_pool.c:327
em_pool_stats_selected_print
void em_pool_stats_selected_print(em_pool_t pool, const em_pool_stats_opt_t *opt)
Helper function to print selected statistics for an EM pool.
Definition: event_machine_pool.c:546
em_pool_stats_reset
em_status_t em_pool_stats_reset(em_pool_t pool)
Definition: event_machine_pool.c:365