[v3,02/16] eal: pack structures when building with MSVC
Checks
Commit Message
Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.
Remove __rte_packed where it appears natural alignment without
packing would produce the same layout or the struct is internal.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
lib/eal/common/eal_private.h | 2 +-
lib/eal/include/rte_memory.h | 1 +
lib/eal/include/rte_memzone.h | 1 +
lib/eal/include/rte_trace_point.h | 2 +-
lib/eal/x86/include/rte_memcpy.h | 3 +++
5 files changed, 7 insertions(+), 2 deletions(-)
@@ -62,7 +62,7 @@ struct rte_config {
* DPDK instances
*/
struct rte_mem_config *mem_config;
-} __rte_packed;
+};
/**
* Get the global configuration structure.
@@ -46,6 +46,7 @@
/**
* Physical memory segment descriptor.
*/
+__rte_msvc_pack
struct rte_memseg {
rte_iova_t iova; /**< Start IO address. */
union {
@@ -45,6 +45,7 @@
* A structure describing a memzone, which is a contiguous portion of
* physical memory identified by a name.
*/
+__rte_msvc_pack
struct rte_memzone {
#define RTE_MEMZONE_NAMESIZE 32 /**< Maximum length of memory zone name.*/
@@ -297,7 +297,7 @@ struct __rte_trace_stream_header {
rte_uuid_t uuid;
uint32_t lcore_id;
char thread_name[__RTE_TRACE_EMIT_STRING_LEN_MAX];
-} __rte_packed;
+};
struct __rte_trace_header {
uint32_t offset;
@@ -57,12 +57,15 @@
* Use the following structs to avoid violating C standard
* alignment requirements and to avoid strict aliasing bugs
*/
+ __rte_msvc_pack
struct rte_uint64_alias {
uint64_t val;
} __rte_packed __rte_may_alias;
+ __rte_msvc_pack
struct rte_uint32_alias {
uint32_t val;
} __rte_packed __rte_may_alias;
+ __rte_msvc_pack
struct rte_uint16_alias {
uint16_t val;
} __rte_packed __rte_may_alias;