aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-06-12 17:32:28 +0300
committerMatias Elo <matias.elo@nokia.com>2023-06-16 12:29:21 +0300
commit6990f9a52f511a693a771cea050de7e7eb590e4d (patch)
tree3dc8dae55e74954d3994482a50248565e66ebf70 /platform
parent6b7ba3932ace5550004471c5c9acee6a42cdbd92 (diff)
linux-gen: dma: inline completion event alloc/free functions
Inline implementations of odp_dma_compl_alloc() and odp_dma_compl_free() functions. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/include/odp/api/plat/dma_inlines.h42
-rw-r--r--platform/linux-generic/odp_dma.c36
2 files changed, 42 insertions, 36 deletions
diff --git a/platform/linux-generic/include/odp/api/plat/dma_inlines.h b/platform/linux-generic/include/odp/api/plat/dma_inlines.h
index 6c41015b9..84b5fef5b 100644
--- a/platform/linux-generic/include/odp/api/plat/dma_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/dma_inlines.h
@@ -11,6 +11,7 @@
#include <odp/api/dma_types.h>
#include <odp/api/event_types.h>
#include <odp/api/hints.h>
+#include <odp/api/pool_types.h>
#include <odp/api/queue_types.h>
#include <odp/api/plat/debug_inlines.h>
@@ -30,6 +31,8 @@
#define odp_dma_compl_result __odp_dma_compl_result
#define odp_dma_transfer_param_init __odp_dma_transfer_param_init
#define odp_dma_compl_param_init __odp_dma_compl_param_init
+ #define odp_dma_compl_alloc __odp_dma_compl_alloc
+ #define odp_dma_compl_free __odp_dma_compl_free
#else
#define _ODP_INLINE
#endif
@@ -88,6 +91,45 @@ _ODP_INLINE void odp_dma_compl_param_init(odp_dma_compl_param_t *compl_param)
compl_param->transfer_id = ODP_DMA_TRANSFER_ID_INVALID;
}
+_ODP_INLINE odp_dma_compl_t odp_dma_compl_alloc(odp_pool_t pool)
+{
+ odp_buffer_t buf;
+ odp_event_t ev;
+ odp_dma_result_t *result;
+ int8_t *ev_type;
+
+ buf = odp_buffer_alloc(pool);
+ if (odp_unlikely(buf == ODP_BUFFER_INVALID))
+ return ODP_DMA_COMPL_INVALID;
+
+ result = (odp_dma_result_t *)odp_buffer_addr(buf);
+ memset(result, 0, sizeof(odp_dma_result_t));
+
+ ev = odp_buffer_to_event(buf);
+ ev_type = _odp_event_hdr_ptr(ev, int8_t, event_type);
+ *ev_type = ODP_EVENT_DMA_COMPL;
+
+ return (odp_dma_compl_t)(uintptr_t)buf;
+}
+
+_ODP_INLINE void odp_dma_compl_free(odp_dma_compl_t dma_compl)
+{
+ int8_t *ev_type;
+ odp_event_t ev;
+ odp_buffer_t buf = (odp_buffer_t)(uintptr_t)dma_compl;
+
+ if (odp_unlikely(dma_compl == ODP_DMA_COMPL_INVALID)) {
+ _ODP_ERR("Bad DMA compl handle\n");
+ return;
+ }
+
+ ev = odp_buffer_to_event(buf);
+ ev_type = _odp_event_hdr_ptr(ev, int8_t, event_type);
+ *ev_type = ODP_EVENT_BUFFER;
+
+ odp_buffer_free(buf);
+}
+
/** @endcond */
#endif
diff --git a/platform/linux-generic/odp_dma.c b/platform/linux-generic/odp_dma.c
index b7e513db9..eef7e5c02 100644
--- a/platform/linux-generic/odp_dma.c
+++ b/platform/linux-generic/odp_dma.c
@@ -749,42 +749,6 @@ odp_pool_t odp_dma_pool_create(const char *name, const odp_dma_pool_param_t *dma
return pool;
}
-odp_dma_compl_t odp_dma_compl_alloc(odp_pool_t pool)
-{
- odp_buffer_t buf;
- odp_event_t ev;
- odp_dma_result_t *result;
-
- buf = odp_buffer_alloc(pool);
-
- if (odp_unlikely(buf == ODP_BUFFER_INVALID))
- return ODP_DMA_COMPL_INVALID;
-
- result = odp_buffer_addr(buf);
- memset(result, 0, sizeof(odp_dma_result_t));
-
- ev = odp_buffer_to_event(buf);
- _odp_event_type_set(ev, ODP_EVENT_DMA_COMPL);
-
- return (odp_dma_compl_t)(uintptr_t)buf;
-}
-
-void odp_dma_compl_free(odp_dma_compl_t dma_compl)
-{
- odp_event_t ev;
- odp_buffer_t buf = (odp_buffer_t)(uintptr_t)dma_compl;
-
- if (odp_unlikely(dma_compl == ODP_DMA_COMPL_INVALID)) {
- _ODP_ERR("Bad DMA compl handle\n");
- return;
- }
-
- ev = odp_buffer_to_event(buf);
- _odp_event_type_set(ev, ODP_EVENT_BUFFER);
-
- odp_buffer_free(buf);
-}
-
uint64_t odp_dma_to_u64(odp_dma_t dma)
{
return (uint64_t)(uintptr_t)dma;