[v2] eventdev: ensure 16-byte alignment for events

Message ID 20231006093733.73420-1-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series [v2] eventdev: ensure 16-byte alignment for events |

Checks

Context Check Description
ci/loongarch-compilation warning apply patch failure
ci/checkpatch warning coding style issues

Commit Message

Bruce Richardson Oct. 6, 2023, 9:37 a.m. UTC
  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@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---
 doc/guides/rel_notes/release_23_11.rst | 4 ++++
 lib/eventdev/rte_eventdev.h            | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
  

Patch

diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 261594aacc..48c19ae52a 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -158,6 +158,10 @@  ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* 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 alignement.
+
 
 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