[PATCH v3] eventdev: ensure 16-byte alignment for events
Bruce Richardson
bruce.richardson at intel.com
Fri Oct 6 11:45:27 CEST 2023
The event structure in DPDK is 16-bytes in size, and events are
regularly passed as parameters directly rather than being passed as
pointers. To help compiler optimize correctly, we can explicitly request
16-byte alignment for events, which means that we should be able
to do aligned vector loads/stores (e.g. with SSE or Neon) when working
with those events.
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
Acked-by: Jerin Jacob <jerinj at marvell.com>
---
v3: Fix spelling mistake in RN entry
rebase on latest eventdev tree HEAD
v2: added release note entry for ABI change
added structure comment on 16-byte size and alignment
added static assert for structure size
---
doc/guides/rel_notes/release_23_11.rst | 4 ++++
lib/eventdev/rte_eventdev.h | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 0903046b0c..33fed3e433 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -209,6 +209,10 @@ ABI Changes
fields, to move ``rxq`` and ``txq`` fields, to change the size of
``reserved1`` and ``reserved2`` fields.
+* The ``rte_event`` structure, used by eventdev library and DPDK "event" class drivers,
+ is now 16-byte aligned, as well as being 16-bytes in size.
+ In previous releases, the structure only required 8-byte alignment.
+
Known Issues
------------
diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
index 2ea98302b8..5b7c5b3399 100644
--- a/lib/eventdev/rte_eventdev.h
+++ b/lib/eventdev/rte_eventdev.h
@@ -1284,6 +1284,8 @@ struct rte_event_vector {
/**
* The generic *rte_event* structure to hold the event attributes
* for dequeue and enqueue operation
+ *
+ * This structure must be kept at 16-bytes in size, and has 16-byte alignment.
*/
struct rte_event {
/** WORD0 */
@@ -1356,7 +1358,9 @@ struct rte_event {
struct rte_event_vector *vec;
/**< Event vector pointer. */
};
-};
+} __rte_aligned(16);
+
+_Static_assert(sizeof(struct rte_event) == 16, "Event structure size is not 16-bytes in size");
/* Ethdev Rx adapter capability bitmap flags */
#define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT 0x1
--
2.39.2
More information about the dev
mailing list