aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRobbie King <robking@cisco.com>2014-09-09 09:49:50 -0400
committerMaxim Uvarov <maxim.uvarov@linaro.org>2014-09-10 13:32:51 +0400
commit96f72fd96ce8d18a5f2894a8b7b094e435d65401 (patch)
tree06b3776f2c967fb91666697e2010986b5f4036c4 /platform
parent88c6e096bc0084c901082e7a863169674fbea035 (diff)
Add user context to packet
Signed-off-by: Robbie King <robking@cisco.com> Tested-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org> Reviewed-and Tested-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> Reviewed-by: Bala Manoharan <bala.manoharan@linaro.org> Reviewed-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/include/api/odp_packet.h18
-rw-r--r--platform/linux-generic/include/odp_packet_internal.h2
-rw-r--r--platform/linux-generic/odp_packet.c10
3 files changed, 30 insertions, 0 deletions
diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h
index ef4be9e93..4a089d157 100644
--- a/platform/linux-generic/include/api/odp_packet.h
+++ b/platform/linux-generic/include/api/odp_packet.h
@@ -98,6 +98,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-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index 0ab3be299..49c59b28d 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -112,6 +112,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-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 20137d08d..64fd0f8b7 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -386,3 +386,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;
+}