aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk/include
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2021-12-13 12:49:26 +0200
committerMatias Elo <matias.elo@nokia.com>2021-12-17 12:33:43 +0200
commit2e5755f186c65834c758f2459dcc7bdd846a0d9c (patch)
tree8b409af6df1c164d15b7066c041ef819212e3534 /platform/linux-dpdk/include
parentb24def24ac56bcb1ccebe0331bd39c835eb1f54c (diff)
Port d59962b5a "linux-gen: packet_vector: use common event header"
Port original commit from linux-generic. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'platform/linux-dpdk/include')
-rw-r--r--platform/linux-dpdk/include/odp_event_vector_internal.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/platform/linux-dpdk/include/odp_event_vector_internal.h b/platform/linux-dpdk/include/odp_event_vector_internal.h
new file mode 100644
index 000000000..c866d9036
--- /dev/null
+++ b/platform/linux-dpdk/include/odp_event_vector_internal.h
@@ -0,0 +1,60 @@
+/* Copyright (c) 2020-2021, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP event vector descriptor - implementation internal
+ */
+
+#ifndef ODP_EVENT_VECTOR_INTERNAL_H_
+#define ODP_EVENT_VECTOR_INTERNAL_H_
+
+#include <odp/api/align.h>
+#include <odp/api/debug.h>
+#include <odp/api/packet.h>
+
+#include <odp_event_internal.h>
+
+#include <stdint.h>
+
+/**
+ * Internal event vector header
+ */
+typedef struct ODP_ALIGNED_CACHE odp_event_vector_hdr_t {
+ /* Common event header */
+ _odp_event_hdr_t event_hdr;
+
+ /* Event vector size */
+ uint32_t size;
+
+ /* Vector of packet handles */
+ odp_packet_t packet[];
+
+} odp_event_vector_hdr_t;
+
+/**
+ * Return the vector header
+ */
+static inline odp_event_vector_hdr_t *_odp_packet_vector_hdr(odp_packet_vector_t pktv)
+{
+ return (odp_event_vector_hdr_t *)(uintptr_t)pktv;
+}
+
+/**
+ * Free packet vector and contained packets
+ */
+static inline void _odp_packet_vector_free_full(odp_packet_vector_t pktv)
+{
+ odp_event_vector_hdr_t *pktv_hdr = _odp_packet_vector_hdr(pktv);
+
+ if (pktv_hdr->size)
+ odp_packet_free_multi(pktv_hdr->packet, pktv_hdr->size);
+
+ odp_packet_vector_free(pktv);
+}
+
+#endif /* ODP_EVENT_VECTOR_INTERNAL_H_ */