diff options
author | Matias Elo <matias.elo@nokia.com> | 2022-11-07 10:30:47 +0200 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-11-17 14:09:15 +0200 |
commit | d7fa6837d4d114c87dae6e7ad2704c80c06d7ffa (patch) | |
tree | f4464ac6409ba3ecea52ca64526138230b5acc33 /platform/linux-dpdk/include/odp | |
parent | 9c648009d1e2061762cd03e8720162e1a9a59a52 (diff) |
linux-dpdk: buffer: inline odp_buffer_is_valid() implementation
Inline implementation of odp_buffer_is_valid() function.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'platform/linux-dpdk/include/odp')
-rw-r--r-- | platform/linux-dpdk/include/odp/api/plat/buffer_inlines.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/linux-dpdk/include/odp/api/plat/buffer_inlines.h b/platform/linux-dpdk/include/odp/api/plat/buffer_inlines.h index 3984a5570..3aa399399 100644 --- a/platform/linux-dpdk/include/odp/api/plat/buffer_inlines.h +++ b/platform/linux-dpdk/include/odp/api/plat/buffer_inlines.h @@ -43,6 +43,7 @@ extern const _odp_buffer_inline_offset_t _odp_buffer_inline_offset; #define odp_buffer_user_area __odp_buffer_user_area #define odp_buffer_free __odp_buffer_free #define odp_buffer_free_multi __odp_buffer_free_multi + #define odp_buffer_is_valid __odp_buffer_is_valid #else #define _ODP_INLINE #endif @@ -114,6 +115,17 @@ _ODP_INLINE void odp_buffer_free_multi(const odp_buffer_t buf[], int num) rte_mempool_put_bulk(mp_pending, (void **)mbuf_tbl, num_pending); } +_ODP_INLINE int odp_buffer_is_valid(odp_buffer_t buf) +{ + if (odp_event_is_valid(odp_buffer_to_event(buf)) == 0) + return 0; + + if (odp_event_type(odp_buffer_to_event(buf)) != ODP_EVENT_BUFFER) + return 0; + + return 1; +} + /** @endcond */ #endif |