@@ -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, uint64_t ctx);
+
+/**
+ * Get packet user context
+ *
+ * @param buf Packet handle
+ *
+ * @return User context
+ */
+uint64_t 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
@@ -112,6 +112,8 @@ typedef struct {
uint32_t frame_len;
+ uint64_t user_ctx; /* user context */
+
odp_pktio_t input;
uint32_t pad;
@@ -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, uint64_t ctx)
+{
+ odp_packet_hdr(pkt)->user_ctx = ctx;
+}
+
+uint64_t odp_packet_get_ctx(odp_packet_t pkt)
+{
+ return odp_packet_hdr(pkt)->user_ctx;
+}