aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2022-10-28 18:02:29 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2022-12-29 14:55:25 +0200
commite2eb952cc47843f453edd01bc3b153feeff5ef68 (patch)
tree641d04683f66e1681d5376947cb66c241b37e301 /platform/linux-generic
parent648c27bfcfdf4c19e4418aedf75e803eb914bcfd (diff)
linux-gen: crypto: inline event conversion functions
Inline odp_crypto_packet_from_event() and odp_crypto_packet_to_event() function implementations. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'platform/linux-generic')
-rw-r--r--platform/linux-generic/Makefile.am2
-rw-r--r--platform/linux-generic/arch/aarch64/odp_crypto_armv8.c14
-rw-r--r--platform/linux-generic/include-abi/odp/api/abi/crypto.h3
-rw-r--r--platform/linux-generic/include/odp/api/plat/crypto_inlines.h49
-rw-r--r--platform/linux-generic/odp_crypto_api.c11
-rw-r--r--platform/linux-generic/odp_crypto_ipsecmb.c14
-rw-r--r--platform/linux-generic/odp_crypto_null.c14
-rw-r--r--platform/linux-generic/odp_crypto_openssl.c14
8 files changed, 64 insertions, 57 deletions
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 7bc48edd6..7d312d0b7 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -34,6 +34,7 @@ odpapiplatinclude_HEADERS = \
include/odp/api/plat/buffer_inline_types.h \
include/odp/api/plat/byteorder_inlines.h \
include/odp/api/plat/cpu_inlines.h \
+ include/odp/api/plat/crypto_inlines.h \
include/odp/api/plat/debug_inlines.h \
include/odp/api/plat/event_inlines.h \
include/odp/api/plat/event_inline_types.h \
@@ -294,6 +295,7 @@ __LIB__libodp_linux_la_SOURCES += \
odp_buffer_api.c \
odp_byteorder_api.c \
odp_cpu_api.c \
+ odp_crypto_api.c \
odp_event_api.c \
odp_hash_api.c \
odp_ipsec_api.c \
diff --git a/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c b/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c
index 0a73d4868..58e566c22 100644
--- a/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c
+++ b/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c
@@ -889,20 +889,6 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl)
return (uint64_t)hdl;
}
-odp_packet_t odp_crypto_packet_from_event(odp_event_t ev)
-{
- /* This check not mandated by the API specification */
- _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET);
- _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO);
-
- return odp_packet_from_event(ev);
-}
-
-odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt)
-{
- return odp_packet_to_event(pkt);
-}
-
int odp_crypto_result(odp_crypto_packet_result_t *result,
odp_packet_t packet)
{
diff --git a/platform/linux-generic/include-abi/odp/api/abi/crypto.h b/platform/linux-generic/include-abi/odp/api/abi/crypto.h
index 24019db12..bef725c28 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/crypto.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/crypto.h
@@ -19,7 +19,8 @@
extern "C" {
#endif
-/* Placeholder for inlined API functions */
+/* Inlined API functions */
+#include <odp/api/plat/crypto_inlines.h>
#ifdef __cplusplus
}
diff --git a/platform/linux-generic/include/odp/api/plat/crypto_inlines.h b/platform/linux-generic/include/odp/api/plat/crypto_inlines.h
new file mode 100644
index 000000000..cfea67283
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/plat/crypto_inlines.h
@@ -0,0 +1,49 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_CRYPTO_INLINES_H_
+#define ODP_PLAT_CRYPTO_INLINES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/event.h>
+#include <odp/api/packet.h>
+
+#include <odp/api/plat/debug_inlines.h>
+
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
+#ifndef _ODP_NO_INLINE
+ /* Inline functions by default */
+ #define _ODP_INLINE static inline
+ #define odp_crypto_packet_from_event __odp_crypto_packet_from_event
+ #define odp_crypto_packet_to_event __odp_crypto_packet_to_event
+#else
+ #define _ODP_INLINE
+#endif
+
+_ODP_INLINE odp_packet_t odp_crypto_packet_from_event(odp_event_t ev)
+{
+ _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET);
+ _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO);
+
+ return odp_packet_from_event(ev);
+}
+
+_ODP_INLINE odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt)
+{
+ return odp_packet_to_event(pkt);
+}
+
+/** @endcond */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/odp_crypto_api.c b/platform/linux-generic/odp_crypto_api.c
new file mode 100644
index 000000000..646472e2e
--- /dev/null
+++ b/platform/linux-generic/odp_crypto_api.c
@@ -0,0 +1,11 @@
+/* Copyright (c) 2022, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <odp/api/crypto.h>
+
+/* Non-inlined versions of API functions */
+#define _ODP_NO_INLINE
+#include <odp/api/plat/crypto_inlines.h>
diff --git a/platform/linux-generic/odp_crypto_ipsecmb.c b/platform/linux-generic/odp_crypto_ipsecmb.c
index d291a7067..34b62fdee 100644
--- a/platform/linux-generic/odp_crypto_ipsecmb.c
+++ b/platform/linux-generic/odp_crypto_ipsecmb.c
@@ -790,20 +790,6 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl)
return (uint64_t)hdl;
}
-odp_packet_t odp_crypto_packet_from_event(odp_event_t ev)
-{
- /* This check not mandated by the API specification */
- _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET);
- _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO);
-
- return odp_packet_from_event(ev);
-}
-
-odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt)
-{
- return odp_packet_to_event(pkt);
-}
-
int odp_crypto_result(odp_crypto_packet_result_t *result,
odp_packet_t packet)
{
diff --git a/platform/linux-generic/odp_crypto_null.c b/platform/linux-generic/odp_crypto_null.c
index b9d319861..aeb27ab5b 100644
--- a/platform/linux-generic/odp_crypto_null.c
+++ b/platform/linux-generic/odp_crypto_null.c
@@ -449,20 +449,6 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl)
return (uint64_t)hdl;
}
-odp_packet_t odp_crypto_packet_from_event(odp_event_t ev)
-{
- /* This check not mandated by the API specification */
- _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET);
- _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO);
-
- return odp_packet_from_event(ev);
-}
-
-odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt)
-{
- return odp_packet_to_event(pkt);
-}
-
static
odp_crypto_packet_result_t *get_op_result_from_packet(odp_packet_t pkt)
{
diff --git a/platform/linux-generic/odp_crypto_openssl.c b/platform/linux-generic/odp_crypto_openssl.c
index 0f637850f..210cad38d 100644
--- a/platform/linux-generic/odp_crypto_openssl.c
+++ b/platform/linux-generic/odp_crypto_openssl.c
@@ -2778,20 +2778,6 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl)
return (uint64_t)hdl;
}
-odp_packet_t odp_crypto_packet_from_event(odp_event_t ev)
-{
- /* This check not mandated by the API specification */
- _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET);
- _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO);
-
- return odp_packet_from_event(ev);
-}
-
-odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt)
-{
- return odp_packet_to_event(pkt);
-}
-
static
odp_crypto_packet_result_t *get_op_result_from_packet(odp_packet_t pkt)
{