[v4,22/39] rawdev: use C11 alignas

Message ID 1707928564-28796-23-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Series use C11 alignas and normalize type alignment |


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Feb. 14, 2024, 4:35 p.m. UTC
  * Move __rte_aligned from the end of {struct,union} definitions to
  be between {struct,union} and tag.

  The placement between {struct,union} and the tag allows the desired
  alignment to be imparted on the type regardless of the toolchain being
  used for all of GCC, LLVM, MSVC compilers building both C and C++.

* Replace use of __rte_aligned(a) on variables/fields with alignas(a).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
 lib/rawdev/rte_rawdev.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


diff --git a/lib/rawdev/rte_rawdev.h b/lib/rawdev/rte_rawdev.h
index 7d5764d..640037b 100644
--- a/lib/rawdev/rte_rawdev.h
+++ b/lib/rawdev/rte_rawdev.h
@@ -279,7 +279,7 @@ 
  * It is a placeholder for PMD specific data, encapsulating only information
  * related to framework.
-struct rte_rawdev {
+struct __rte_cache_aligned rte_rawdev {
 	/**< Socket ID where memory is allocated */
 	int socket_id;
 	/**< Device ID for this instance */
@@ -300,7 +300,7 @@  struct rte_rawdev {
 	rte_rawdev_obj_t dev_private;
 	/**< Device name */
-} __rte_cache_aligned;
 /** @internal The pool of rte_rawdev structures. */
 extern struct rte_rawdev *rte_rawdevs;