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.richard...@intel.com>
Acked-by: Morten Brørup <m...@smartsharesystems.com>
Acked-by: Jerin Jacob <jer...@marvell.com>

---
v4: change _Static_assert to static_assert for fwd compatibility
    moved size check on event structure to C file from header file

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.c            | 3 +++
 lib/eventdev/rte_eventdev.h            | 4 +++-
 3 files changed, 10 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.c b/lib/eventdev/rte_eventdev.c
index 95373bbaad..adc9751cef 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <stdint.h>
 #include <inttypes.h>
+#include <assert.h>
 
 #include <rte_string_fns.h>
 #include <rte_log.h>
@@ -28,6 +29,8 @@
 #include "eventdev_pmd.h"
 #include "eventdev_trace.h"
 
+static_assert(sizeof(struct rte_event) == 16, "Event structure size is not 
16-bytes in size");
+
 static struct rte_eventdev rte_event_devices[RTE_EVENT_MAX_DEVS];
 
 struct rte_eventdev *rte_eventdevs = rte_event_devices;
diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
index 2ea98302b8..758ee83a3f 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,7 @@ struct rte_event {
                struct rte_event_vector *vec;
                /**< Event vector pointer. */
        };
-};
+} __rte_aligned(16);
 
 /* Ethdev Rx adapter capability bitmap flags */
 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT     0x1
-- 
2.39.2

Reply via email to