summaryrefslogtreecommitdiff
path: root/lib/hash/rte_cuckoo_hash.h
diff options
context:
space:
mode:
authorTyler Retzlaff <roretzla@linux.microsoft.com>2024-03-04 09:52:44 -0800
committerDavid Marchand <david.marchand@redhat.com>2024-03-06 11:01:24 +0100
commite9fd1ebf981f361844aea9ec94e17f4bda5e1479 (patch)
tree4d0c5fac07d7549d9206dbbe6f1443db8fa02ba4 /lib/hash/rte_cuckoo_hash.h
parent7fcf4e8a03c4b0d2c6cec11ddd18c7bf88ba0384 (diff)
lib: use C11 alignment attribute on variables
The current location used for __rte_aligned(a) for alignment of variables is not compatible with MSVC. For variables, standard C11 offers alignas(a) supported by conformant compilers i.e. both MSVC and GCC. 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> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com> Signed-off-by: David Marchand <david.marchand@redhat.com>
Diffstat (limited to 'lib/hash/rte_cuckoo_hash.h')
-rw-r--r--lib/hash/rte_cuckoo_hash.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/hash/rte_cuckoo_hash.h b/lib/hash/rte_cuckoo_hash.h
index 8ea793c66e..b2ccc5f669 100644
--- a/lib/hash/rte_cuckoo_hash.h
+++ b/lib/hash/rte_cuckoo_hash.h
@@ -11,6 +11,8 @@
#ifndef _RTE_CUCKOO_HASH_H_
#define _RTE_CUCKOO_HASH_H_
+#include <stdalign.h>
+
#if defined(RTE_ARCH_X86)
#include "rte_cmp_x86.h"
#endif
@@ -170,7 +172,7 @@ struct rte_hash {
/* Fields used in lookup */
- uint32_t key_len __rte_cache_aligned;
+ alignas(RTE_CACHE_LINE_SIZE) uint32_t key_len;
/**< Length of hash key. */
uint8_t hw_trans_mem_support;
/**< If hardware transactional memory is used. */