diff mbox

[4/4] dpdk: add generic crypto

Message ID 1410995157-6905-5-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 9f5a5512e5853abf1d13208eeeae442ddc232aa5
Headers show

Commit Message

Maxim Uvarov Sept. 17, 2014, 11:05 p.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 platform/linux-dpdk/Makefile.am                   |  2 ++
 platform/linux-dpdk/include/api/odp_packet.h      | 18 ++++++++++++++++++
 platform/linux-dpdk/include/odp_packet_internal.h |  2 ++
 platform/linux-dpdk/odp_packet.c                  | 10 ++++++++++
 4 files changed, 32 insertions(+)
diff mbox

Patch

diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am
index a59435f..1240404 100644
--- a/platform/linux-dpdk/Makefile.am
+++ b/platform/linux-dpdk/Makefile.am
@@ -32,6 +32,7 @@  include_HEADERS = \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_compiler.h \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_config.h \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_coremask.h \
+		  $(top_srcdir)/platform/linux-generic/include/api/odp_crypto.h \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_debug.h \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_hints.h \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_init.h \
@@ -67,6 +68,7 @@  __LIB__libodp_la_SOURCES = \
 			   odp_buffer.c \
 			   odp_buffer_pool.c \
 			   ../linux-generic/odp_coremask.c \
+			   ../linux-generic/odp_crypto.c \
 			   odp_init.c \
 			   odp_linux.c \
 			   odp_packet.c \
diff --git a/platform/linux-dpdk/include/api/odp_packet.h b/platform/linux-dpdk/include/api/odp_packet.h
index 5545bdc..64a92e8 100644
--- a/platform/linux-dpdk/include/api/odp_packet.h
+++ b/platform/linux-dpdk/include/api/odp_packet.h
@@ -80,6 +80,24 @@  void odp_packet_set_len(odp_packet_t pkt, size_t len);
 size_t odp_packet_get_len(odp_packet_t pkt);
 
 /**
+ * Set packet user context
+ *
+ * @param buf      Packet handle
+ * @param ctx      User context
+ *
+ */
+void odp_packet_set_ctx(odp_packet_t buf, const void *ctx);
+
+/**
+ * Get packet user context
+ *
+ * @param buf      Packet handle
+ *
+ * @return User context
+ */
+void *odp_packet_get_ctx(odp_packet_t buf);
+
+/**
  * Get address to the start of the packet buffer
  *
  * The address of the packet buffer is not necessarily the same as the start
diff --git a/platform/linux-dpdk/include/odp_packet_internal.h b/platform/linux-dpdk/include/odp_packet_internal.h
index 9357f90..ccaba5a 100644
--- a/platform/linux-dpdk/include/odp_packet_internal.h
+++ b/platform/linux-dpdk/include/odp_packet_internal.h
@@ -115,6 +115,8 @@  typedef struct {
 
 	uint32_t frame_len;
 
+	uint64_t user_ctx;        /* user context */
+
 	odp_pktio_t input;
 
 	uint32_t pad;
diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c
index edfd06d..458b0db 100644
--- a/platform/linux-dpdk/odp_packet.c
+++ b/platform/linux-dpdk/odp_packet.c
@@ -372,3 +372,13 @@  int odp_packet_copy(odp_packet_t pkt_dst, odp_packet_t pkt_src)
 
 	return 0;
 }
+
+void odp_packet_set_ctx(odp_packet_t pkt, const void *ctx)
+{
+	odp_packet_hdr(pkt)->user_ctx = (intptr_t)ctx;
+}
+
+void *odp_packet_get_ctx(odp_packet_t pkt)
+{
+	return (void *)(intptr_t)odp_packet_hdr(pkt)->user_ctx;
+}