[v4,25/39] node: use C11 alignas
Checks
Commit Message
* 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/node/node_private.h | 4 ++--
lib/node/pkt_cls.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
@@ -51,9 +51,9 @@ struct node_mbuf_priv1 {
/**
* Node mbuf private area 2.
*/
-struct node_mbuf_priv2 {
+struct __rte_cache_aligned node_mbuf_priv2 {
uint64_t priv_data;
-} __rte_cache_aligned;
+};
#define NODE_MBUF_PRIV2_SIZE sizeof(struct node_mbuf_priv2)
@@ -2,6 +2,8 @@
* Copyright (C) 2020 Marvell.
*/
+#include <stdalign.h>
+
#include <rte_graph.h>
#include <rte_graph_worker.h>
@@ -9,7 +11,7 @@
#include "node_private.h"
/* Next node for each ptype, default is '0' is "pkt_drop" */
-static const uint8_t p_nxt[256] __rte_cache_aligned = {
+static const alignas(RTE_CACHE_LINE_SIZE) uint8_t p_nxt[256] = {
[RTE_PTYPE_L3_IPV4] = PKT_CLS_NEXT_IP4_LOOKUP,
[RTE_PTYPE_L3_IPV4_EXT] = PKT_CLS_NEXT_IP4_LOOKUP,