* 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 <roret...@linux.microsoft.com>
Acked-by: Morten Brørup <m...@smartsharesystems.com>
---
 lib/member/rte_member.h        | 8 ++++----
 lib/member/rte_member_ht.h     | 4 ++--
 lib/member/rte_member_sketch.c | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/member/rte_member.h b/lib/member/rte_member.h
index 3278bbb..aec192e 100644
--- a/lib/member/rte_member.h
+++ b/lib/member/rte_member.h
@@ -139,7 +139,7 @@ typedef void (*sketch_delete_fn_t)(const struct 
rte_member_setsum *ss,
                                   const void *key);
 
 /** @internal setsummary structure. */
-struct rte_member_setsum {
+struct __rte_cache_aligned rte_member_setsum {
        enum rte_member_setsum_type type; /* Type of the set summary. */
        uint32_t key_len;               /* Length of key. */
        uint32_t prim_hash_seed;        /* Primary hash function seed. */
@@ -185,14 +185,14 @@ struct rte_member_setsum {
 #ifdef RTE_ARCH_X86
        bool use_avx512;
 #endif
-} __rte_cache_aligned;
+};
 
 /**
  * Parameters used when create the set summary table. Currently user can
  * specify two types of setsummary: HT based and vBF. For HT based, user can
  * specify cache or non-cache mode. Here is a table to describe some 
differences
  */
-struct rte_member_parameters {
+struct __rte_cache_aligned rte_member_parameters {
        const char *name;                       /**< Name of the hash. */
 
        /**
@@ -326,7 +326,7 @@ struct rte_member_parameters {
        uint32_t extra_flag;
 
        int socket_id;                  /**< NUMA Socket ID for memory. */
-} __rte_cache_aligned;
+};
 
 /**
  * Find an existing set-summary and return a pointer to it.
diff --git a/lib/member/rte_member_ht.h b/lib/member/rte_member_ht.h
index 9e24ccd..c9673e3 100644
--- a/lib/member/rte_member_ht.h
+++ b/lib/member/rte_member_ht.h
@@ -15,10 +15,10 @@
 typedef uint16_t member_sig_t;                 /* signature size is 16 bit */
 
 /* The bucket struct for ht setsum */
-struct member_ht_bucket {
+struct __rte_cache_aligned member_ht_bucket {
        member_sig_t sigs[RTE_MEMBER_BUCKET_ENTRIES];   /* 2-byte signature */
        member_set_t sets[RTE_MEMBER_BUCKET_ENTRIES];   /* 2-byte set */
-} __rte_cache_aligned;
+};
 
 int
 rte_member_create_ht(struct rte_member_setsum *ss,
diff --git a/lib/member/rte_member_sketch.c b/lib/member/rte_member_sketch.c
index e006e83..15af678 100644
--- a/lib/member/rte_member_sketch.c
+++ b/lib/member/rte_member_sketch.c
@@ -23,7 +23,7 @@
 #include "rte_member_sketch_avx512.h"
 #endif /* CC_AVX512_SUPPORT */
 
-struct sketch_runtime {
+struct __rte_cache_aligned sketch_runtime {
        uint64_t pkt_cnt;
        uint32_t until_next;
        int converged;
@@ -31,7 +31,7 @@ struct sketch_runtime {
        struct node *report_array;
        void *key_slots;
        struct rte_ring *free_key_slots;
-} __rte_cache_aligned;
+};
 
 /*
  * Geometric sampling to calculate how many packets needs to be
-- 
1.8.3.1

Reply via email to