aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2022-10-28 14:07:45 +0300
committerMatias Elo <matias.elo@nokia.com>2022-11-29 16:37:29 +0200
commit4a3bb9ca46667a67fd2255a7b2efd2b9a840229f (patch)
tree50d22a12e93f2d072958b4b12f5ecf14cd7b744d /platform/linux-generic
parent0a8460c27a0592933cccefa3c16fe73dc2e3e50a (diff)
linux-gen: ipsec: inline odp_ipsec_result() implementation
Inline odp_ipsec_result() function implementation. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Diffstat (limited to 'platform/linux-generic')
-rw-r--r--platform/linux-generic/include/odp/api/plat/ipsec_inlines.h19
-rw-r--r--platform/linux-generic/include/odp/api/plat/packet_inline_types.h1
-rw-r--r--platform/linux-generic/odp_ipsec.c16
-rw-r--r--platform/linux-generic/odp_packet.c4
4 files changed, 22 insertions, 18 deletions
diff --git a/platform/linux-generic/include/odp/api/plat/ipsec_inlines.h b/platform/linux-generic/include/odp/api/plat/ipsec_inlines.h
index a40a05dbf..efedfe626 100644
--- a/platform/linux-generic/include/odp/api/plat/ipsec_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/ipsec_inlines.h
@@ -8,9 +8,11 @@
#define ODP_PLAT_IPSEC_INLINES_H_
#include <odp/api/event.h>
+#include <odp/api/ipsec_types.h>
#include <odp/api/packet.h>
#include <odp/api/plat/debug_inlines.h>
+#include <odp/api/plat/packet_inline_types.h>
/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
@@ -19,10 +21,13 @@
#define _ODP_INLINE static inline
#define odp_ipsec_packet_from_event __odp_ipsec_packet_from_event
#define odp_ipsec_packet_to_event __odp_ipsec_packet_to_event
+ #define odp_ipsec_result __odp_ipsec_result
#else
#define _ODP_INLINE
#endif
+extern const _odp_packet_inline_offset_t _odp_packet_inline;
+
_ODP_INLINE odp_packet_t odp_ipsec_packet_from_event(odp_event_t ev)
{
_ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET);
@@ -36,6 +41,20 @@ _ODP_INLINE odp_event_t odp_ipsec_packet_to_event(odp_packet_t pkt)
return odp_packet_to_event(pkt);
}
+_ODP_INLINE int odp_ipsec_result(odp_ipsec_packet_result_t *result, odp_packet_t pkt)
+{
+ odp_ipsec_packet_result_t *res;
+
+ _ODP_ASSERT(result != NULL);
+ _ODP_ASSERT(odp_packet_subtype(pkt) == ODP_EVENT_PACKET_IPSEC);
+
+ res = _odp_pkt_get_ptr(pkt, odp_ipsec_packet_result_t, ipsec_ctx);
+
+ *result = *res;
+
+ return 0;
+}
+
/** @endcond */
#endif
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h
index 2ae0829c3..c1dcc0ecb 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h
@@ -52,6 +52,7 @@ typedef struct _odp_packet_inline_offset_t {
uint16_t flags;
uint16_t subtype;
uint16_t cls_mark;
+ uint16_t ipsec_ctx;
} _odp_packet_inline_offset_t;
diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c
index e459203fb..28d46c794 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -2604,22 +2604,6 @@ int odp_ipsec_test_sa_update(odp_ipsec_sa_t sa,
return 0;
}
-int odp_ipsec_result(odp_ipsec_packet_result_t *result, odp_packet_t packet)
-{
- odp_ipsec_packet_result_t *res;
-
- _ODP_ASSERT(result != NULL);
-
- res = ipsec_pkt_result(packet);
-
- /* FIXME: maybe postprocess here, setting alg error in case of crypto
- * error instead of processing packet fully in ipsec_in/out_single */
-
- *result = *res;
-
- return 0;
-}
-
int odp_ipsec_stats(odp_ipsec_sa_t sa, odp_ipsec_stats_t *stats)
{
ipsec_sa_t *ipsec_sa;
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 2ebf602e8..212e48de0 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -67,8 +67,8 @@ const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = {
.input_flags = offsetof(odp_packet_hdr_t, p.input_flags),
.flags = offsetof(odp_packet_hdr_t, p.flags),
.subtype = offsetof(odp_packet_hdr_t, subtype),
- .cls_mark = offsetof(odp_packet_hdr_t, cls_mark)
-
+ .cls_mark = offsetof(odp_packet_hdr_t, cls_mark),
+ .ipsec_ctx = offsetof(odp_packet_hdr_t, ipsec_ctx),
};
#include <odp/visibility_end.h>