[v2,09/15] net/iavf: pack structures when building with MSVC

Message ID 1711580958-20808-10-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series fix packing of structs when building with MSVC |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff March 27, 2024, 11:09 p.m. UTC
  Add __rte_msvc_pushpack(1) 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>
---
 drivers/net/iavf/iavf_ipsec_crypto.h | 4 +++-
 drivers/net/iavf/iavf_rxtx.c         | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/iavf/iavf_ipsec_crypto.h b/drivers/net/iavf/iavf_ipsec_crypto.h
index 49f9202..0637ce2 100644
--- a/drivers/net/iavf/iavf_ipsec_crypto.h
+++ b/drivers/net/iavf/iavf_ipsec_crypto.h
@@ -11,12 +11,14 @@ 
 
 
 
+__rte_msvc_pack
 struct iavf_tx_ipsec_desc {
 	union {
 		struct {
 			__le64 qw0;
 			__le64 qw1;
 		};
+		__rte_msvc_pack
 		struct {
 			__le16 l4payload_length;
 			__le32 esn;
@@ -97,7 +99,7 @@  struct iavf_ipsec_crypto_pkt_metadata {
 	uint8_t next_proto;		/* Next Protocol (8b/1B) */
 
 	uint32_t esn;		        /* Extended Sequence Number (32b/4B) */
-} __rte_packed;
+};
 
 /**
  * Inline IPsec Crypto offload is supported
diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 0a5246d..61309c3 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -53,7 +53,7 @@ 
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
-} __rte_packed;
+};
 
 /* structure that caches offload info for the current packet */
 struct offload_info {