DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 00/15] fix packing of structs when building with MSVC
@ 2024-03-20 21:05 Tyler Retzlaff
  2024-03-20 21:05 ` [PATCH 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
                   ` (18 more replies)
  0 siblings, 19 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

MSVC struct packing is not compatible with GCC provide a macro that can
be used to push existing pack value and sets packing to 1-byte. The
existing __rte_packed macro is then used to restore the pack value
prior to the push.

Instead of providing macros exclusively for MSVC and for GCC the
existing macro is deliberately utilized to trigger a warning if no
existing packing has been pushed allowing easy identification of
locations where the __rte_msvc_pack is missing.

I've decided to only add the macro to packed structs that are built
for Windows. It seems there is little value in adding the macro tree
wide and if new code arrives that is built on Windows the __rte_packed
will flag where the preamble macro is required.

Tyler Retzlaff (15):
  eal: provide pack start macro for MSVC
  eal: pack structures when building with MSVC
  net: pack structures when building with MSVC
  common/iavf: pack structures when building with MSVC
  common/idpf: pack structures when building with MSVC
  common/mlx5: pack structures when building with MSVC
  dma/ioat: pack structures when building with MSVC
  net/i40e: pack structures when building with MSVC
  net/iavf: pack structures when building with MSVC
  net/ice: pack structures when building with MSVC
  net/mlx5: pack structures when building with MSVC
  net/octeon_ep: pack structures when building with MSVC
  app/testpmd: pack structures when building with MSVC
  app/test: pack structures when building with MSVC
  examples: pack structures when building with MSVC

 app/test-pmd/csumonly.c                     |  1 +
 app/test/test_efd.c                         |  1 +
 app/test/test_hash.c                        |  1 +
 app/test/test_member.c                      |  1 +
 drivers/common/iavf/iavf_osdep.h            |  2 ++
 drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++
 drivers/common/idpf/base/idpf_osdep.h       |  2 ++
 drivers/common/mlx5/mlx5_common_mr.h        |  4 ++++
 drivers/common/mlx5/mlx5_common_utils.h     |  1 +
 drivers/common/mlx5/mlx5_prm.h              | 28 ++++++++++++++++++++++++++++
 drivers/dma/ioat/ioat_hw_defs.h             |  1 +
 drivers/net/i40e/base/i40e_osdep.h          |  2 ++
 drivers/net/iavf/iavf_ipsec_crypto.h        |  3 +++
 drivers/net/iavf/iavf_rxtx.c                |  1 +
 drivers/net/ice/base/ice_osdep.h            |  2 ++
 drivers/net/mlx5/hws/mlx5dr.h               |  1 +
 drivers/net/mlx5/mlx5.h                     |  1 +
 drivers/net/mlx5/mlx5_flow.h                |  5 +++++
 drivers/net/mlx5/mlx5_hws_cnt.h             |  1 +
 drivers/net/mlx5/mlx5_utils.h               |  4 ++++
 drivers/net/octeon_ep/otx_ep_mbox.h         |  1 +
 examples/common/neon/port_group.h           |  1 +
 examples/ip_pipeline/cli.c                  |  5 +++++
 examples/ipsec-secgw/ipsec.h                |  1 +
 examples/l3fwd-power/main.c                 |  2 ++
 examples/ptpclient/ptpclient.c              |  8 ++++++++
 lib/eal/common/eal_private.h                |  1 +
 lib/eal/include/rte_common.h                |  4 +++-
 lib/eal/include/rte_memory.h                |  1 +
 lib/eal/include/rte_memzone.h               |  1 +
 lib/eal/include/rte_trace_point.h           |  1 +
 lib/eal/x86/include/rte_memcpy.h            |  3 +++
 lib/net/rte_arp.h                           |  2 ++
 lib/net/rte_dtls.h                          |  1 +
 lib/net/rte_esp.h                           |  2 ++
 lib/net/rte_ether.h                         |  1 +
 lib/net/rte_geneve.h                        |  1 +
 lib/net/rte_gre.h                           |  4 ++++
 lib/net/rte_gtp.h                           |  5 +++++
 lib/net/rte_ib.h                            |  1 +
 lib/net/rte_icmp.h                          |  3 +++
 lib/net/rte_ip.h                            |  4 ++++
 lib/net/rte_l2tpv2.h                        |  4 ++++
 lib/net/rte_macsec.h                        |  2 ++
 lib/net/rte_mpls.h                          |  1 +
 lib/net/rte_pdcp_hdr.h                      |  4 ++++
 lib/net/rte_ppp.h                           |  1 +
 lib/net/rte_sctp.h                          |  1 +
 lib/net/rte_tcp.h                           |  1 +
 lib/net/rte_tls.h                           |  1 +
 lib/net/rte_udp.h                           |  1 +
 lib/net/rte_vxlan.h                         |  2 ++
 52 files changed, 143 insertions(+), 1 deletion(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 01/15] eal: provide pack start macro for MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
@ 2024-03-20 21:05 ` Tyler Retzlaff
  2024-03-20 21:05 ` [PATCH 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

MSVC struct packing is not compatible with GCC provide a macro that can
be used to push existing pack value and sets packing to 1-byte. The
existing __rte_packed macro is then used to restore the pack value
prior to the push.

Instead of providing macros exclusively for MSVC and for GCC the
existing macro is deliberately utilized to trigger a warning if no
existing packing has been pushed allowing easy identification of
locations where the __rte_msvc_pack is missing.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_common.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 298a5c6..44825ed 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -97,8 +97,10 @@
  * Force a structure to be packed
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_packed
+#define __rte_msvc_pack __pragma(pack(push, 1))
+#define __rte_packed __pragma(pack(pop))
 #else
+#define __rte_msvc_pack
 #define __rte_packed __attribute__((__packed__))
 #endif
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 02/15] eal: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
  2024-03-20 21:05 ` [PATCH 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
@ 2024-03-20 21:05 ` Tyler Retzlaff
  2024-03-21 16:02   ` Bruce Richardson
  2024-03-20 21:05 ` [PATCH 03/15] net: " Tyler Retzlaff
                   ` (16 subsequent siblings)
  18 siblings, 1 reply; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/common/eal_private.h      | 1 +
 lib/eal/include/rte_memory.h      | 1 +
 lib/eal/include/rte_memzone.h     | 1 +
 lib/eal/include/rte_trace_point.h | 1 +
 lib/eal/x86/include/rte_memcpy.h  | 3 +++
 5 files changed, 7 insertions(+)

diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 71523cf..21ace2a 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -43,6 +43,7 @@ struct lcore_config {
 /**
  * The global RTE configuration structure.
  */
+__rte_msvc_pack
 struct rte_config {
 	uint32_t main_lcore;         /**< Id of the main lcore */
 	uint32_t lcore_count;        /**< Number of available logical cores. */
diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h
index 842362d..73bb00d 100644
--- a/lib/eal/include/rte_memory.h
+++ b/lib/eal/include/rte_memory.h
@@ -46,6 +46,7 @@
 /**
  * Physical memory segment descriptor.
  */
+__rte_msvc_pack
 struct rte_memseg {
 	rte_iova_t iova;            /**< Start IO address. */
 	union {
diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h
index 931497f..ca312c0 100644
--- a/lib/eal/include/rte_memzone.h
+++ b/lib/eal/include/rte_memzone.h
@@ -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.*/
diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h
index 41e2a7f..63f333c 100644
--- a/lib/eal/include/rte_trace_point.h
+++ b/lib/eal/include/rte_trace_point.h
@@ -292,6 +292,7 @@ int __rte_trace_point_register(rte_trace_point_t *trace, const char *name,
 #define __RTE_TRACE_FIELD_ENABLE_MASK (1ULL << 63)
 #define __RTE_TRACE_FIELD_ENABLE_DISCARD (1ULL << 62)
 
+__rte_msvc_pack
 struct __rte_trace_stream_header {
 	uint32_t magic;
 	rte_uuid_t uuid;
diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h
index 72a9229..fdc5df0 100644
--- a/lib/eal/x86/include/rte_memcpy.h
+++ b/lib/eal/x86/include/rte_memcpy.h
@@ -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;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 03/15] net: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
  2024-03-20 21:05 ` [PATCH 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
  2024-03-20 21:05 ` [PATCH 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
@ 2024-03-20 21:05 ` Tyler Retzlaff
  2024-10-07  1:14   ` Stephen Hemminger
  2024-03-20 21:06 ` [PATCH 04/15] common/iavf: " Tyler Retzlaff
                   ` (15 subsequent siblings)
  18 siblings, 1 reply; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/net/rte_arp.h      | 2 ++
 lib/net/rte_dtls.h     | 1 +
 lib/net/rte_esp.h      | 2 ++
 lib/net/rte_ether.h    | 1 +
 lib/net/rte_geneve.h   | 1 +
 lib/net/rte_gre.h      | 4 ++++
 lib/net/rte_gtp.h      | 5 +++++
 lib/net/rte_ib.h       | 1 +
 lib/net/rte_icmp.h     | 3 +++
 lib/net/rte_ip.h       | 4 ++++
 lib/net/rte_l2tpv2.h   | 4 ++++
 lib/net/rte_macsec.h   | 2 ++
 lib/net/rte_mpls.h     | 1 +
 lib/net/rte_pdcp_hdr.h | 4 ++++
 lib/net/rte_ppp.h      | 1 +
 lib/net/rte_sctp.h     | 1 +
 lib/net/rte_tcp.h      | 1 +
 lib/net/rte_tls.h      | 1 +
 lib/net/rte_udp.h      | 1 +
 lib/net/rte_vxlan.h    | 2 ++
 20 files changed, 42 insertions(+)

diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h
index 668cea1..35d68c1 100644
--- a/lib/net/rte_arp.h
+++ b/lib/net/rte_arp.h
@@ -21,6 +21,7 @@
 /**
  * ARP header IPv4 payload.
  */
+__rte_msvc_pack
 struct __rte_aligned(2) rte_arp_ipv4 {
 	struct rte_ether_addr arp_sha;  /**< sender hardware address */
 	rte_be32_t            arp_sip;  /**< sender IP address */
@@ -31,6 +32,7 @@ struct __rte_aligned(2) rte_arp_ipv4 {
 /**
  * ARP header.
  */
+__rte_msvc_pack
 struct __rte_aligned(2) rte_arp_hdr {
 	rte_be16_t arp_hardware; /**< format of hardware address */
 #define RTE_ARP_HRD_ETHER     1  /**< ARP Ethernet address format */
diff --git a/lib/net/rte_dtls.h b/lib/net/rte_dtls.h
index 4f541df..0c75b06 100644
--- a/lib/net/rte_dtls.h
+++ b/lib/net/rte_dtls.h
@@ -34,6 +34,7 @@
  * DTLS Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_dtls_hdr {
 	/** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */
 	uint8_t type;
diff --git a/lib/net/rte_esp.h b/lib/net/rte_esp.h
index 464c513..27c9287 100644
--- a/lib/net/rte_esp.h
+++ b/lib/net/rte_esp.h
@@ -20,6 +20,7 @@
 /**
  * ESP Header
  */
+__rte_msvc_pack
 struct rte_esp_hdr {
 	rte_be32_t spi;  /**< Security Parameters Index */
 	rte_be32_t seq;  /**< packet sequence number */
@@ -28,6 +29,7 @@ struct rte_esp_hdr {
 /**
  * ESP Trailer
  */
+__rte_msvc_pack
 struct rte_esp_tail {
 	uint8_t pad_len;     /**< number of pad bytes (0-255) */
 	uint8_t next_proto;  /**< IPv4 or IPv6 or next layer header */
diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h
index 32ed515..354e3a5 100644
--- a/lib/net/rte_ether.h
+++ b/lib/net/rte_ether.h
@@ -301,6 +301,7 @@ struct __rte_aligned(2) rte_ether_hdr {
  * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type
  * of the encapsulated frame.
  */
+__rte_msvc_pack
 struct rte_vlan_hdr {
 	rte_be16_t vlan_tci;  /**< Priority (3) + CFI (1) + Identifier Code (12) */
 	rte_be16_t eth_proto; /**< Ethernet type of encapsulated frame. */
diff --git a/lib/net/rte_geneve.h b/lib/net/rte_geneve.h
index 3bbc561..5c02526 100644
--- a/lib/net/rte_geneve.h
+++ b/lib/net/rte_geneve.h
@@ -38,6 +38,7 @@
  * More-bits (optional) variable length options.
  */
 __extension__
+__rte_msvc_pack
 struct rte_geneve_hdr {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t ver:2;		/**< Version. */
diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h
index 8da8027..77882e7 100644
--- a/lib/net/rte_gre.h
+++ b/lib/net/rte_gre.h
@@ -27,6 +27,7 @@
  * GRE Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_gre_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint16_t res2:4; /**< Reserved */
@@ -51,6 +52,7 @@ struct rte_gre_hdr {
 /**
  * Optional field checksum in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_checksum_rsvd {
 	rte_be16_t checksum;
 	rte_be16_t reserved1;
@@ -59,6 +61,7 @@ struct rte_gre_hdr_opt_checksum_rsvd {
 /**
  * Optional field key in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_key {
 	rte_be32_t key;
 } __rte_packed;
@@ -66,6 +69,7 @@ struct rte_gre_hdr_opt_key {
 /**
  * Optional field sequence in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_sequence {
 	rte_be32_t sequence;
 } __rte_packed;
diff --git a/lib/net/rte_gtp.h b/lib/net/rte_gtp.h
index 9849872..26fc80a 100644
--- a/lib/net/rte_gtp.h
+++ b/lib/net/rte_gtp.h
@@ -28,6 +28,7 @@
  * No optional fields and next extension header.
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_hdr {
 	union {
 		uint8_t gtp_hdr_info; /**< GTP header info */
@@ -55,6 +56,7 @@ struct rte_gtp_hdr {
 } __rte_packed;
 
 /* Optional word of GTP header, present if any of E, S, PN is set. */
+__rte_msvc_pack
 struct rte_gtp_hdr_ext_word {
 	rte_be16_t sqn;	      /**< Sequence Number. */
 	uint8_t npdu;	      /**< N-PDU number. */
@@ -66,6 +68,7 @@ struct rte_gtp_hdr_ext_word {
  * defined based on RFC 38415-g30.
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_generic_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -89,6 +92,7 @@ struct rte_gtp_psc_generic_hdr {
  * type0 defined based on RFC 38415-g30
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_type0_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -116,6 +120,7 @@ struct rte_gtp_psc_type0_hdr {
  * type1 defined based on RFC 38415-g30
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_type1_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
diff --git a/lib/net/rte_ib.h b/lib/net/rte_ib.h
index 9eab5f9..c4c5d39 100644
--- a/lib/net/rte_ib.h
+++ b/lib/net/rte_ib.h
@@ -26,6 +26,7 @@
  * IB Specification Vol 1-Release-1.4.
  */
 __extension__
+__rte_msvc_pack
 struct rte_ib_bth {
 	uint8_t	opcode;		/**< Opcode. */
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
diff --git a/lib/net/rte_icmp.h b/lib/net/rte_icmp.h
index 4bf64d7..e865db4 100644
--- a/lib/net/rte_icmp.h
+++ b/lib/net/rte_icmp.h
@@ -25,6 +25,7 @@
 /**
  * ICMP base header
  */
+__rte_msvc_pack
 struct rte_icmp_base_hdr {
 	uint8_t type;
 	uint8_t code;
@@ -34,6 +35,7 @@ struct rte_icmp_base_hdr {
 /**
  * ICMP echo header
  */
+__rte_msvc_pack
 struct rte_icmp_echo_hdr {
 	struct rte_icmp_base_hdr base;
 	rte_be16_t identifier;
@@ -45,6 +47,7 @@ struct rte_icmp_echo_hdr {
  *
  * @see rte_icmp_echo_hdr which is similar.
  */
+__rte_msvc_pack
 struct rte_icmp_hdr {
 	uint8_t  icmp_type;     /* ICMP packet type. */
 	uint8_t  icmp_code;     /* ICMP packet code. */
diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 0d103d4..908a25c 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -38,6 +38,7 @@
 /**
  * IPv4 Header
  */
+__rte_msvc_pack
 struct rte_ipv4_hdr {
 	__extension__
 	union {
@@ -523,6 +524,7 @@ struct rte_ipv4_hdr {
 /**
  * IPv6 Header
  */
+__rte_msvc_pack
 struct rte_ipv6_hdr {
 	rte_be32_t vtc_flow;	/**< IP version, traffic class & flow label. */
 	rte_be16_t payload_len;	/**< IP payload size, including ext. headers */
@@ -538,6 +540,7 @@ struct rte_ipv6_hdr {
 /**
  * IPv6 Routing Extension Header
  */
+__rte_msvc_pack
 struct rte_ipv6_routing_ext {
 	uint8_t next_hdr;			/**< Protocol, next header. */
 	uint8_t hdr_len;			/**< Header length. */
@@ -783,6 +786,7 @@ struct rte_ipv6_routing_ext {
 #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
 	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
 
+__rte_msvc_pack
 struct rte_ipv6_fragment_ext {
 	uint8_t next_header;	/**< Next header type */
 	uint8_t reserved;	/**< Reserved */
diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 9cda347..a917013 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -129,6 +129,7 @@ struct rte_l2tpv2_common_hdr {
  * L2TPv2 message Header contains all options(length, ns, nr,
  * offset size, offset padding).
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_with_all_options {
 	rte_be16_t length;		/**< length(16) */
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
@@ -143,6 +144,7 @@ struct rte_l2tpv2_msg_with_all_options {
  * L2TPv2 message Header contains all options except length(ns, nr,
  * offset size, offset padding).
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_without_length {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -180,6 +182,7 @@ struct rte_l2tpv2_msg_without_offset {
 /**
  * L2TPv2 message Header contains options offset size and offset padding.
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_with_offset {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -217,6 +220,7 @@ struct rte_l2tpv2_msg_without_all_options {
 /**
  * L2TPv2 Combined Message Header Format: Common Header + Options
  */
+__rte_msvc_pack
 struct rte_l2tpv2_combined_msg_hdr {
 	struct rte_l2tpv2_common_hdr common; /**< common header */
 	union {
diff --git a/lib/net/rte_macsec.h b/lib/net/rte_macsec.h
index d0cd2f6..54de1bd 100644
--- a/lib/net/rte_macsec.h
+++ b/lib/net/rte_macsec.h
@@ -29,6 +29,7 @@
  * MACsec Header (SecTAG)
  */
 __extension__
+__rte_msvc_pack
 struct rte_macsec_hdr {
 	/**
 	 * Tag control information and Association number of secure channel.
@@ -52,6 +53,7 @@ struct rte_macsec_hdr {
  * MACsec SCI header (8 bytes) after the MACsec header
  * which is present if SC bit is set in tci_an.
  */
+__rte_msvc_pack
 struct rte_macsec_sci_hdr {
 	uint8_t sci[RTE_MACSEC_SCI_LEN]; /**< Optional secure channel ID. */
 } __rte_packed;
diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h
index 51523e7..d5f6026 100644
--- a/lib/net/rte_mpls.h
+++ b/lib/net/rte_mpls.h
@@ -22,6 +22,7 @@
  * MPLS header.
  */
 __extension__
+__rte_msvc_pack
 struct rte_mpls_hdr {
 	rte_be16_t tag_msb; /**< Label(msb). */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
diff --git a/lib/net/rte_pdcp_hdr.h b/lib/net/rte_pdcp_hdr.h
index 72ae9a6..6a20ad9 100644
--- a/lib/net/rte_pdcp_hdr.h
+++ b/lib/net/rte_pdcp_hdr.h
@@ -60,6 +60,7 @@ enum rte_pdcp_pdu_type {
  * 6.2.2.1 Data PDU for SRBs
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_cp_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
@@ -75,6 +76,7 @@ struct rte_pdcp_cp_data_pdu_sn_12_hdr {
  * 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
@@ -92,6 +94,7 @@ struct rte_pdcp_up_data_pdu_sn_12_hdr {
  * 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_data_pdu_sn_18_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_17_16 : 2;	/**< Sequence number bits 16-17 */
@@ -110,6 +113,7 @@ struct rte_pdcp_up_data_pdu_sn_18_hdr {
  * 6.2.3.1 Control PDU for PDCP status report
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_ctrl_pdu_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t r : 4;		/**< Reserved */
diff --git a/lib/net/rte_ppp.h b/lib/net/rte_ppp.h
index 7b86ac4..fde585f 100644
--- a/lib/net/rte_ppp.h
+++ b/lib/net/rte_ppp.h
@@ -21,6 +21,7 @@
 /**
  * PPP Header
  */
+__rte_msvc_pack
 struct rte_ppp_hdr {
 	uint8_t addr; /**< PPP address(8) */
 	uint8_t ctrl; /**< PPP control(8) */
diff --git a/lib/net/rte_sctp.h b/lib/net/rte_sctp.h
index 965682d..a6cfe8f 100644
--- a/lib/net/rte_sctp.h
+++ b/lib/net/rte_sctp.h
@@ -25,6 +25,7 @@
 /**
  * SCTP Header
  */
+__rte_msvc_pack
 struct rte_sctp_hdr {
 	rte_be16_t src_port; /**< Source port. */
 	rte_be16_t dst_port; /**< Destin port. */
diff --git a/lib/net/rte_tcp.h b/lib/net/rte_tcp.h
index 506ac4e..d11cb2c 100644
--- a/lib/net/rte_tcp.h
+++ b/lib/net/rte_tcp.h
@@ -25,6 +25,7 @@
 /**
  * TCP Header
  */
+__rte_msvc_pack
 struct rte_tcp_hdr {
 	rte_be16_t src_port; /**< TCP source port. */
 	rte_be16_t dst_port; /**< TCP destination port. */
diff --git a/lib/net/rte_tls.h b/lib/net/rte_tls.h
index 2eb3c6d..81af4c7 100644
--- a/lib/net/rte_tls.h
+++ b/lib/net/rte_tls.h
@@ -32,6 +32,7 @@
  * TLS Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_tls_hdr {
 	/** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */
 	uint8_t type;
diff --git a/lib/net/rte_udp.h b/lib/net/rte_udp.h
index 6135494..5416855 100644
--- a/lib/net/rte_udp.h
+++ b/lib/net/rte_udp.h
@@ -25,6 +25,7 @@
 /**
  * UDP Header
  */
+__rte_msvc_pack
 struct rte_udp_hdr {
 	rte_be16_t src_port;    /**< UDP source port. */
 	rte_be16_t dst_port;    /**< UDP destination port. */
diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h
index 997fc78..bcfd579 100644
--- a/lib/net/rte_vxlan.h
+++ b/lib/net/rte_vxlan.h
@@ -31,6 +31,7 @@
  * Reserved fields (24 bits and 8 bits)
  */
 __extension__ /* no named member in struct */
+__rte_msvc_pack
 struct rte_vxlan_hdr {
 	union {
 		struct {
@@ -57,6 +58,7 @@ struct rte_vxlan_hdr {
  * Identifier and Reserved fields (16 bits and 8 bits).
  */
 __extension__ /* no named member in struct */
+__rte_msvc_pack
 struct rte_vxlan_gpe_hdr {
 	union {
 		struct {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 04/15] common/iavf: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (2 preceding siblings ...)
  2024-03-20 21:05 ` [PATCH 03/15] net: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-20 21:06 ` [PATCH 05/15] common/idpf: " Tyler Retzlaff
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/iavf/iavf_osdep.h            |  2 ++
 drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/common/iavf/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h
index 263d924..1fb057c 100644
--- a/drivers/common/iavf/iavf_osdep.h
+++ b/drivers/common/iavf/iavf_osdep.h
@@ -158,6 +158,7 @@
 } while (0)
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct iavf_dma_mem {
 	void *va;
 	u64 pa;
@@ -165,6 +166,7 @@ struct iavf_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct iavf_virt_mem {
 	void *va;
 	u32 size;
diff --git a/drivers/common/iavf/virtchnl_inline_ipsec.h b/drivers/common/iavf/virtchnl_inline_ipsec.h
index 2f4bf15..feb0f44 100644
--- a/drivers/common/iavf/virtchnl_inline_ipsec.h
+++ b/drivers/common/iavf/virtchnl_inline_ipsec.h
@@ -109,6 +109,7 @@ enum inline_ipsec_ops {
 };
 
 /* Not all valid, if certain field is invalid, set 1 for all bits */
+__rte_msvc_pack
 struct virtchnl_algo_cap  {
 	u32 algo_type;
 
@@ -132,6 +133,7 @@ struct virtchnl_algo_cap  {
 } __rte_packed;
 
 /* vf record the capability of crypto from the virtchnl */
+__rte_msvc_pack
 struct virtchnl_sym_crypto_cap {
 	u8 crypto_type;
 	u8 algo_cap_num;
@@ -142,6 +144,7 @@ struct virtchnl_sym_crypto_cap {
  * VF pass virtchnl_ipsec_cap to PF
  * and PF return capability of ipsec from virtchnl.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_cap {
 	/* max number of SA per VF */
 	u16 max_sa_num;
@@ -172,6 +175,7 @@ struct virtchnl_ipsec_cap {
 } __rte_packed;
 
 /* configuration of crypto function */
+__rte_msvc_pack
 struct virtchnl_ipsec_crypto_cfg_item {
 	u8 crypto_type;
 
@@ -203,6 +207,7 @@ struct virtchnl_ipsec_sym_crypto_cfg {
  * PF create SA as configuration and PF driver will return
  * an unique index (sa_idx) for the created SA.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_cfg {
 	/* IPsec SA Protocol - AH/ESP */
 	u8 virtchnl_protocol_type;
@@ -298,6 +303,7 @@ struct virtchnl_ipsec_sa_cfg {
  * VF send configuration of index of SA to PF
  * PF will update SA according to configuration
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_update {
 	u32 sa_index; /* SA to update */
 	u32 esn_hi; /* high 32 bits of esn */
@@ -310,6 +316,7 @@ struct virtchnl_ipsec_sa_update {
  * flag bitmap indicate all SA or just selected SA will
  * be destroyed
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_destroy {
 	/* All zero bitmap indicates all SA will be destroyed.
 	 * Non-zero bitmap indicates the selected SA in
@@ -325,6 +332,7 @@ struct virtchnl_ipsec_sa_destroy {
  * VF send this SA configuration to PF using virtchnl;
  * PF read SA and will return configuration for the created SA.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_read {
 	/* SA valid - invalid/valid */
 	u8 valid;
@@ -431,6 +439,7 @@ struct virtchnl_ipsec_sa_read {
 #define VIRTCHNL_IPSEC_INBOUND_SPD_TBL_IPV6	(1)
 
 /* Add allowlist entry in IES */
+__rte_msvc_pack
 struct virtchnl_ipsec_sp_cfg {
 	u32 spi;
 	u32 dip[4];
@@ -459,6 +468,7 @@ struct virtchnl_ipsec_sp_cfg {
 
 
 /* Delete allowlist entry in IES */
+__rte_msvc_pack
 struct virtchnl_ipsec_sp_destroy {
 	/* 0 for IPv4 table, 1 for IPv6 table. */
 	u8 table_id;
@@ -494,6 +504,7 @@ struct virtchnl_ipsec_resp {
 };
 
 /* Internal message descriptor for VF <-> IPsec communication */
+__rte_msvc_pack
 struct inline_ipsec_msg {
 	u16 ipsec_opcode;
 	u16 req_id;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 05/15] common/idpf: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (3 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 04/15] common/iavf: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-20 21:06 ` [PATCH 06/15] common/mlx5: " Tyler Retzlaff
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/idpf/base/idpf_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h
index 74a376c..f5fcdc3 100644
--- a/drivers/common/idpf/base/idpf_osdep.h
+++ b/drivers/common/idpf/base/idpf_osdep.h
@@ -180,6 +180,7 @@ static inline uint64_t idpf_read_addr64(volatile void *addr)
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct idpf_dma_mem {
 	void *va;
 	u64 pa;
@@ -187,6 +188,7 @@ struct idpf_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct idpf_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 06/15] common/mlx5: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (4 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 05/15] common/idpf: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-20 21:06 ` [PATCH 07/15] dma/ioat: " Tyler Retzlaff
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/mlx5/mlx5_common_mr.h    |  4 ++++
 drivers/common/mlx5/mlx5_common_utils.h |  1 +
 drivers/common/mlx5/mlx5_prm.h          | 28 ++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h
index 8789d40..4f4bd73 100644
--- a/drivers/common/mlx5/mlx5_common_mr.h
+++ b/drivers/common/mlx5/mlx5_common_mr.h
@@ -49,6 +49,7 @@ struct mlx5_mr {
 };
 
 /* Cache entry for Memory Region. */
+__rte_msvc_pack
 struct mr_cache_entry {
 	uintptr_t start; /* Start address of MR. */
 	uintptr_t end; /* End address of MR. */
@@ -56,6 +57,7 @@ struct mr_cache_entry {
 } __rte_packed;
 
 /* MR Cache table for Binary search. */
+__rte_msvc_pack
 struct mlx5_mr_btree {
 	uint32_t len; /* Number of entries. */
 	uint32_t size; /* Total number of entries. */
@@ -65,6 +67,7 @@ struct mlx5_mr_btree {
 struct mlx5_common_device;
 
 /* Per-queue MR control descriptor. */
+__rte_msvc_pack
 struct mlx5_mr_ctrl {
 	uint32_t *dev_gen_ptr; /* Generation number of device to poll. */
 	uint32_t cur_gen; /* Generation number saved to flush caches. */
@@ -78,6 +81,7 @@ struct mlx5_mr_ctrl {
 LIST_HEAD(mlx5_mempool_reg_list, mlx5_mempool_reg);
 
 /* Global per-device MR cache. */
+__rte_msvc_pack
 struct mlx5_mr_share_cache {
 	uint32_t dev_gen; /* Generation number to flush local caches. */
 	rte_rwlock_t rwlock; /* MR cache Lock. */
diff --git a/drivers/common/mlx5/mlx5_common_utils.h b/drivers/common/mlx5/mlx5_common_utils.h
index ae15119..a44975c 100644
--- a/drivers/common/mlx5/mlx5_common_utils.h
+++ b/drivers/common/mlx5/mlx5_common_utils.h
@@ -27,6 +27,7 @@
  * Structure of the entry in the mlx5 list, user should define its own struct
  * that contains this in order to store the data.
  */
+__rte_msvc_pack
 struct mlx5_list_entry {
 	LIST_ENTRY(mlx5_list_entry) next; /* Entry pointers in the list. */
 	uint32_t ref_cnt __rte_aligned(8); /* 0 means, entry is invalid. */
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index c671c75..bf9ecd1 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -319,6 +319,7 @@ enum mlx5_mpw_mode {
 };
 
 /* WQE Control segment. */
+__rte_msvc_pack
 struct mlx5_wqe_cseg {
 	uint32_t opcode;
 	uint32_t sq_ds;
@@ -336,10 +337,12 @@ struct mlx5_wqe_cseg {
 #define WQE_CSEG_WQE_INDEX_OFFSET	 8
 
 /* Header of data segment. Minimal size Data Segment */
+__rte_msvc_pack
 struct mlx5_wqe_dseg {
 	uint32_t bcount;
 	union {
 		uint8_t inline_data[MLX5_DSEG_MIN_INLINE_SIZE];
+		__rte_msvc_pack
 		struct {
 			uint32_t lkey;
 			uint64_t pbuf;
@@ -348,8 +351,10 @@ struct mlx5_wqe_dseg {
 } __rte_packed;
 
 /* Subset of struct WQE Ethernet Segment. */
+__rte_msvc_pack
 struct mlx5_wqe_eseg {
 	union {
+		__rte_msvc_pack
 		struct {
 			uint32_t swp_offs;
 			uint8_t	cs_flags;
@@ -362,6 +367,7 @@ struct mlx5_wqe_eseg {
 				uint16_t vlan_tag;
 			};
 		} __rte_packed;
+		__rte_msvc_pack
 		struct {
 			uint32_t offsets;
 			uint32_t flags;
@@ -371,6 +377,7 @@ struct mlx5_wqe_eseg {
 	};
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_qseg {
 	uint32_t reserved0;
 	uint32_t reserved1;
@@ -378,6 +385,7 @@ struct mlx5_wqe_qseg {
 	uint32_t qpn_cqn;
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_wseg {
 	uint32_t operation;
 	uint32_t lkey;
@@ -388,6 +396,7 @@ struct mlx5_wqe_wseg {
 } __rte_packed;
 
 /* The title WQEBB, header of WQE. */
+__rte_msvc_pack
 struct mlx5_wqe {
 	union {
 		struct mlx5_wqe_cseg cseg;
@@ -437,6 +446,7 @@ struct mlx5_cqe {
 	uint8_t lro_num_seg;
 	union {
 		uint8_t user_index_bytes[3];
+		__rte_msvc_pack
 		struct {
 			uint8_t user_index_hi;
 			uint16_t user_index_low;
@@ -460,6 +470,7 @@ struct mlx5_cqe_ts {
 	uint8_t op_own;
 };
 
+__rte_msvc_pack
 struct mlx5_wqe_rseg {
 	uint64_t raddr;
 	uint32_t rkey;
@@ -479,6 +490,7 @@ struct mlx5_wqe_rseg {
 #define MLX5_UMR_KLM_NUM_ALIGN \
 	(MLX5_UMR_KLM_PTR_ALIGN / sizeof(struct mlx5_klm))
 
+__rte_msvc_pack
 struct mlx5_wqe_umr_cseg {
 	uint32_t if_cf_toe_cq_res;
 	uint32_t ko_to_bs;
@@ -486,6 +498,7 @@ struct mlx5_wqe_umr_cseg {
 	uint32_t rsvd1[8];
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_mkey_cseg {
 	uint32_t fr_res_af_sf;
 	uint32_t qpn_mkey;
@@ -549,6 +562,7 @@ enum {
 #define MLX5_CRYPTO_MMO_TYPE_OFFSET 24
 #define MLX5_CRYPTO_MMO_OP_OFFSET 20
 
+__rte_msvc_pack
 struct mlx5_wqe_umr_bsf_seg {
 	/*
 	 * bs_bpt_eo_es contains:
@@ -582,6 +596,7 @@ struct mlx5_wqe_umr_bsf_seg {
 #pragma GCC diagnostic ignored "-Wpedantic"
 #endif
 
+__rte_msvc_pack
 struct mlx5_umr_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_umr_cseg ucseg;
@@ -592,18 +607,21 @@ struct mlx5_umr_wqe {
 	};
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_rdma_write_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_rseg rseg;
 	struct mlx5_wqe_dseg dseg[];
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_send_en_seg {
 	uint32_t reserve[2];
 	uint32_t sqnpc;
 	uint32_t qpn;
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_send_en_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_send_en_seg sseg;
@@ -650,6 +668,7 @@ struct mlx5_wqe_metadata_seg {
 	uint64_t addr;
 };
 
+__rte_msvc_pack
 struct mlx5_gga_wqe {
 	uint32_t opcode;
 	uint32_t sq_ds;
@@ -663,16 +682,19 @@ struct mlx5_gga_wqe {
 } __rte_packed;
 
 union mlx5_gga_compress_opaque {
+	__rte_msvc_pack
 	struct {
 		uint32_t syndrome;
 		uint32_t reserved0;
 		uint32_t scattered_length;
 		union {
+			__rte_msvc_pack
 			struct {
 				uint32_t reserved1[5];
 				uint32_t crc32;
 				uint32_t adler32;
 			} v1 __rte_packed;
+			__rte_msvc_pack
 			struct {
 				uint32_t crc32;
 				uint32_t adler32;
@@ -685,9 +707,11 @@ struct mlx5_gga_wqe {
 };
 
 union mlx5_gga_crypto_opaque {
+	__rte_msvc_pack
 	struct {
 		uint32_t syndrome;
 		uint32_t reserved0[2];
+		__rte_msvc_pack
 		struct {
 			uint32_t iv[3];
 			uint32_t tag_size;
@@ -4134,6 +4158,7 @@ enum mlx5_aso_op {
 #define MLX5_ASO_CSEG_READ_ENABLE 1
 
 /* ASO WQE CTRL segment. */
+__rte_msvc_pack
 struct mlx5_aso_cseg {
 	uint32_t va_h;
 	uint32_t va_l_r;
@@ -4150,6 +4175,7 @@ struct mlx5_aso_cseg {
 #define MLX5_MTR_MAX_TOKEN_VALUE INT32_MAX
 
 /* A meter data segment - 2 per ASO WQE. */
+__rte_msvc_pack
 struct mlx5_aso_mtr_dseg {
 	uint32_t v_bo_sc_bbog_mm;
 	/*
@@ -4191,6 +4217,7 @@ struct mlx5_aso_mtr_dseg {
 #define MLX5_ASO_MTRS_PER_POOL 128
 
 /* ASO WQE data segment. */
+__rte_msvc_pack
 struct mlx5_aso_dseg {
 	union {
 		uint8_t data[MLX5_ASO_WQE_DSEG_SIZE];
@@ -4199,6 +4226,7 @@ struct mlx5_aso_dseg {
 } __rte_packed;
 
 /* ASO WQE. */
+__rte_msvc_pack
 struct mlx5_aso_wqe {
 	struct mlx5_wqe_cseg general_cseg;
 	struct mlx5_aso_cseg aso_cseg;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 07/15] dma/ioat: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (5 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 06/15] common/mlx5: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-21 16:13   ` Bruce Richardson
  2024-03-20 21:06 ` [PATCH 08/15] net/i40e: " Tyler Retzlaff
                   ` (11 subsequent siblings)
  18 siblings, 1 reply; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/dma/ioat/ioat_hw_defs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/ioat/ioat_hw_defs.h b/drivers/dma/ioat/ioat_hw_defs.h
index dc3493a..6e32807 100644
--- a/drivers/dma/ioat/ioat_hw_defs.h
+++ b/drivers/dma/ioat/ioat_hw_defs.h
@@ -52,6 +52,7 @@
 #define	IOAT_DMACAP_PQ		(1 << 9)
 #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
 
+__rte_msvc_pack
 struct ioat_registers {
 	uint8_t		chancnt;
 	uint8_t		xfercap;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 08/15] net/i40e: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (6 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 07/15] dma/ioat: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-20 21:06 ` [PATCH 09/15] net/iavf: " Tyler Retzlaff
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/i40e/base/i40e_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index aa5dc61..28439e3 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -177,6 +177,7 @@ static inline uint64_t i40e_read64_addr(volatile void *addr)
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct i40e_dma_mem {
 	void *va;
 	u64 pa;
@@ -188,6 +189,7 @@ struct i40e_dma_mem {
 			i40e_allocate_dma_mem_d(h, m, s, a)
 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
 
+__rte_msvc_pack
 struct i40e_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 09/15] net/iavf: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (7 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 08/15] net/i40e: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-21 16:26   ` Bruce Richardson
  2024-03-20 21:06 ` [PATCH 10/15] net/ice: " Tyler Retzlaff
                   ` (9 subsequent siblings)
  18 siblings, 1 reply; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/iavf/iavf_ipsec_crypto.h | 3 +++
 drivers/net/iavf/iavf_rxtx.c         | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/iavf/iavf_ipsec_crypto.h b/drivers/net/iavf/iavf_ipsec_crypto.h
index 49f9202..36ced50 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;
@@ -84,6 +86,7 @@ enum iavf_ipsec_iv_len {
  * transmit data path. Parameters set for session by calling
  * rte_security_set_pkt_metadata() API.
  */
+__rte_msvc_pack
 struct iavf_ipsec_crypto_pkt_metadata {
 	uint32_t sa_idx;                /* SA hardware index (20b/4B) */
 
diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 0a5246d..ba0fa6f 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -50,6 +50,7 @@
 static uint16_t vxlan_gpe_udp_port = RTE_VXLAN_GPE_DEFAULT_PORT;
 static uint16_t geneve_udp_port = RTE_GENEVE_DEFAULT_PORT;
 
+__rte_msvc_pack
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 10/15] net/ice: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (8 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 09/15] net/iavf: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-20 21:06 ` [PATCH 11/15] net/mlx5: " Tyler Retzlaff
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ice/base/ice_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 0e14b93..087dc6a 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -187,6 +187,7 @@
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct ice_dma_mem {
 	void *va;
 	u64 pa;
@@ -194,6 +195,7 @@ struct ice_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct ice_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 11/15] net/mlx5: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (9 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 10/15] net/ice: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-20 21:06 ` [PATCH 12/15] net/octeon_ep: " Tyler Retzlaff
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/hws/mlx5dr.h   | 1 +
 drivers/net/mlx5/mlx5.h         | 1 +
 drivers/net/mlx5/mlx5_flow.h    | 5 +++++
 drivers/net/mlx5/mlx5_hws_cnt.h | 1 +
 drivers/net/mlx5/mlx5_utils.h   | 4 ++++
 5 files changed, 12 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 80e118a..cd5bb05 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -300,6 +300,7 @@ struct mlx5dr_action_dest_attr {
 	};
 };
 
+__rte_msvc_pack
 struct mlx5dr_crc_encap_entropy_hash_fields {
 	union mlx5dr_crc_encap_entropy_hash_ip_field dst;
 	union mlx5dr_crc_encap_entropy_hash_ip_field src;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 0091a24..6228ee8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -221,6 +221,7 @@ struct mlx5_dev_spawn_data {
 }
 
 /** Data associated with socket messages. */
+__rte_msvc_pack
 struct mlx5_flow_dump_req  {
 	uint32_t port_id; /**< There are plans in DPDK to extend port_id. */
 	uint64_t flow_id;
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 34b5e0f..172b023 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -658,6 +658,7 @@ struct mlx5_flow_dv_tag_resource {
 };
 
 /* Modify resource structure */
+__rte_msvc_pack
 struct mlx5_flow_dv_modify_hdr_resource {
 	struct mlx5_list_entry entry;
 	void *action; /**< Modify header action object. */
@@ -812,6 +813,7 @@ struct mlx5_flow_dv_dest_array_resource {
 
 
 /** Device flow handle structure for DV mode only. */
+__rte_msvc_pack
 struct mlx5_flow_handle_dv {
 	/* Flow DV api: */
 	struct mlx5_flow_dv_matcher *matcher; /**< Cache to matcher. */
@@ -830,6 +832,7 @@ struct mlx5_flow_handle_dv {
 } __rte_packed;
 
 /** Device flow handle structure: used both for creating & destroying. */
+__rte_msvc_pack
 struct mlx5_flow_handle {
 	SILIST_ENTRY(uint32_t)next;
 	struct mlx5_vf_vlan vf_vlan; /**< Structure for VF VLAN workaround. */
@@ -1231,6 +1234,7 @@ struct mlx5_flow_attr {
 };
 
 /* Flow structure. */
+__rte_msvc_pack
 struct rte_flow {
 	uint32_t dev_handles;
 	/**< Device flow handles that are part of the flow. */
@@ -1304,6 +1308,7 @@ enum {
 #endif
 
 /** HWS flow struct. */
+__rte_msvc_pack
 struct rte_flow_hw {
 	/** The table flow allcated from. */
 	struct rte_flow_template_table *table;
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h
index e005960..1f53a1a 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.h
+++ b/drivers/net/mlx5/mlx5_hws_cnt.h
@@ -133,6 +133,7 @@ enum {
 };
 
 /* HWS counter age parameter. */
+__rte_msvc_pack
 struct mlx5_hws_age_param {
 	uint32_t timeout; /* Aging timeout in seconds (atomically accessed). */
 	uint32_t sec_since_last_hit;
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index f3c0d76..cf80e5e 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -118,6 +118,7 @@ struct mlx5_l3t_level_tbl {
 };
 
 /* L3 word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_word {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -128,6 +129,7 @@ struct mlx5_l3t_entry_word {
 } __rte_packed;
 
 /* L3 double word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_dword {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -138,6 +140,7 @@ struct mlx5_l3t_entry_dword {
 } __rte_packed;
 
 /* L3 quad word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_qword {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -148,6 +151,7 @@ struct mlx5_l3t_entry_qword {
 } __rte_packed;
 
 /* L3 pointer entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_ptr {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 12/15] net/octeon_ep: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (10 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 11/15] net/mlx5: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-20 21:06 ` [PATCH 13/15] app/testpmd: " Tyler Retzlaff
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/octeon_ep/otx_ep_mbox.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/octeon_ep/otx_ep_mbox.h b/drivers/net/octeon_ep/otx_ep_mbox.h
index a3fc15c..005fce3 100644
--- a/drivers/net/octeon_ep/otx_ep_mbox.h
+++ b/drivers/net/octeon_ep/otx_ep_mbox.h
@@ -70,6 +70,7 @@ enum otx_ep_link_autoneg {
 #define OTX_EP_MBOX_MORE_FRAG_FLAG 1
 #define OTX_EP_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1)
 
+__rte_msvc_pack
 union otx_ep_mbox_word {
 	uint64_t u64;
 	struct {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 13/15] app/testpmd: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (11 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 12/15] net/octeon_ep: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-21 16:28   ` Bruce Richardson
  2024-03-20 21:06 ` [PATCH 14/15] app/test: " Tyler Retzlaff
                   ` (5 subsequent siblings)
  18 siblings, 1 reply; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test-pmd/csumonly.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 6711dda..638e607 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -89,6 +89,7 @@ struct testpmd_offload_info {
 };
 
 /* simplified GRE header */
+__rte_msvc_pack
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 14/15] app/test: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (12 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 13/15] app/testpmd: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-20 21:06 ` [PATCH 15/15] examples: " Tyler Retzlaff
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test/test_efd.c    | 1 +
 app/test/test_hash.c   | 1 +
 app/test/test_member.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/app/test/test_efd.c b/app/test/test_efd.c
index 1c0986b..df176a0 100644
--- a/app/test/test_efd.c
+++ b/app/test/test_efd.c
@@ -33,6 +33,7 @@
 static unsigned int test_socket_id;
 
 /* 5-tuple key type */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index d586878..08c1773 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -79,6 +79,7 @@
  * Should be packed to avoid holes with potentially
  * undefined content in the middle.
  */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
diff --git a/app/test/test_member.c b/app/test/test_member.c
index 5a4d275..ccd481a 100644
--- a/app/test/test_member.c
+++ b/app/test/test_member.c
@@ -32,6 +32,7 @@
 struct rte_member_setsum *setsum_sketch;
 
 /* 5-tuple key type */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 15/15] examples: pack structures when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (13 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 14/15] app/test: " Tyler Retzlaff
@ 2024-03-20 21:06 ` Tyler Retzlaff
  2024-03-21 16:31   ` Bruce Richardson
  2024-03-21 15:32 ` [PATCH 00/15] fix packing of structs " Stephen Hemminger
                   ` (3 subsequent siblings)
  18 siblings, 1 reply; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 21:06 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 examples/common/neon/port_group.h | 1 +
 examples/ip_pipeline/cli.c        | 5 +++++
 examples/ipsec-secgw/ipsec.h      | 1 +
 examples/l3fwd-power/main.c       | 2 ++
 examples/ptpclient/ptpclient.c    | 8 ++++++++
 5 files changed, 17 insertions(+)

diff --git a/examples/common/neon/port_group.h b/examples/common/neon/port_group.h
index 421e2e8..bd40590 100644
--- a/examples/common/neon/port_group.h
+++ b/examples/common/neon/port_group.h
@@ -21,6 +21,7 @@
 port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
 		  uint16x8_t dp2)
 {
+	__rte_msvc_pack
 	union {
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index e8269ea..cae5c1f 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -2566,6 +2566,7 @@
  *    | lpm
  *       ipv4 | ipv6 <addr> <depth>
  */
+__rte_msvc_pack
 struct pkt_key_qinq {
 	uint16_t ethertype_svlan;
 	uint16_t svlan;
@@ -2573,6 +2574,7 @@ struct pkt_key_qinq {
 	uint16_t cvlan;
 } __rte_packed;
 
+__rte_msvc_pack
 struct pkt_key_ipv4_5tuple {
 	uint8_t time_to_live;
 	uint8_t proto;
@@ -2583,6 +2585,7 @@ struct pkt_key_ipv4_5tuple {
 	uint16_t dp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct pkt_key_ipv6_5tuple {
 	uint16_t payload_length;
 	uint8_t proto;
@@ -2593,10 +2596,12 @@ struct pkt_key_ipv6_5tuple {
 	uint16_t dp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct pkt_key_ipv4_addr {
 	uint32_t addr;
 } __rte_packed;
 
+__rte_msvc_pack
 struct pkt_key_ipv6_addr {
 	uint8_t addr[16];
 } __rte_packed;
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index bdcada1..bdc6045 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -277,6 +277,7 @@ struct socket_ctx {
 	struct rte_mempool *session_pool;
 };
 
+__rte_msvc_pack
 struct cnt_blk {
 	uint32_t salt;
 	uint64_t iv;
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index f4adcf4..a3be37b 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -278,6 +278,7 @@ struct lcore_rx_queue {
 #define DEFAULT_HASH_FUNC       rte_jhash
 #endif
 
+__rte_msvc_pack
 struct ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
@@ -286,6 +287,7 @@ struct ipv4_5tuple {
 	uint8_t  proto;
 } __rte_packed;
 
+__rte_msvc_pack
 struct ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index afb61bb..cdd73fd 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -56,6 +56,7 @@
 };
 
 /* Structs used for PTP handling. */
+__rte_msvc_pack
 struct tstamp {
 	uint16_t   sec_msb;
 	uint32_t   sec_lsb;
@@ -66,11 +67,13 @@ struct clock_id {
 	uint8_t id[8];
 };
 
+__rte_msvc_pack
 struct port_id {
 	struct clock_id        clock_id;
 	uint16_t               port_number;
 }  __rte_packed;
 
+__rte_msvc_pack
 struct ptp_header {
 	uint8_t              msg_type;
 	uint8_t              ver;
@@ -86,22 +89,26 @@ struct ptp_header {
 	int8_t               log_message_interval;
 } __rte_packed;
 
+__rte_msvc_pack
 struct sync_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct follow_up_msg {
 	struct ptp_header   hdr;
 	struct tstamp       precise_origin_tstamp;
 	uint8_t             suffix[];
 } __rte_packed;
 
+__rte_msvc_pack
 struct delay_req_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct delay_resp_msg {
 	struct ptp_header    hdr;
 	struct tstamp        rx_tstamp;
@@ -110,6 +117,7 @@ struct delay_resp_msg {
 } __rte_packed;
 
 struct ptp_message {
+	__rte_msvc_pack
 	union {
 		struct ptp_header          header;
 		struct sync_msg            sync;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 00/15] fix packing of structs when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (14 preceding siblings ...)
  2024-03-20 21:06 ` [PATCH 15/15] examples: " Tyler Retzlaff
@ 2024-03-21 15:32 ` Stephen Hemminger
  2024-03-21 15:46   ` Tyler Retzlaff
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                   ` (2 subsequent siblings)
  18 siblings, 1 reply; 75+ messages in thread
From: Stephen Hemminger @ 2024-03-21 15:32 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang

On Wed, 20 Mar 2024 14:05:56 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> MSVC struct packing is not compatible with GCC provide a macro that can
> be used to push existing pack value and sets packing to 1-byte. The
> existing __rte_packed macro is then used to restore the pack value
> prior to the push.
> 
> Instead of providing macros exclusively for MSVC and for GCC the
> existing macro is deliberately utilized to trigger a warning if no
> existing packing has been pushed allowing easy identification of
> locations where the __rte_msvc_pack is missing.
> 
> I've decided to only add the macro to packed structs that are built
> for Windows. It seems there is little value in adding the macro tree
> wide and if new code arrives that is built on Windows the __rte_packed
> will flag where the preamble macro is required.
> 

Why is packed used so many places in DPDK?
Packed should be reserved for things like network protocols
with unaligned fields.

Many of these structure have no holes and are naturally packed.
Adding packed attribute unnecessarily can generate poor code on
architectures that do not support unaligned access.


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 00/15] fix packing of structs when building with MSVC
  2024-03-21 15:32 ` [PATCH 00/15] fix packing of structs " Stephen Hemminger
@ 2024-03-21 15:46   ` Tyler Retzlaff
  0 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-21 15:46 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang

On Thu, Mar 21, 2024 at 08:32:19AM -0700, Stephen Hemminger wrote:
> On Wed, 20 Mar 2024 14:05:56 -0700
> Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> 
> > MSVC struct packing is not compatible with GCC provide a macro that can
> > be used to push existing pack value and sets packing to 1-byte. The
> > existing __rte_packed macro is then used to restore the pack value
> > prior to the push.
> > 
> > Instead of providing macros exclusively for MSVC and for GCC the
> > existing macro is deliberately utilized to trigger a warning if no
> > existing packing has been pushed allowing easy identification of
> > locations where the __rte_msvc_pack is missing.
> > 
> > I've decided to only add the macro to packed structs that are built
> > for Windows. It seems there is little value in adding the macro tree
> > wide and if new code arrives that is built on Windows the __rte_packed
> > will flag where the preamble macro is required.
> > 
> 
> Why is packed used so many places in DPDK?
> Packed should be reserved for things like network protocols
> with unaligned fields.

I made the same observation. Even network frame formats can be handled
without packing so long as you do some extra work to copy small units
of data out which is often worth doing manually and once only instead
of obfuscated behind codegen and direct field access.

> Many of these structure have no holes and are naturally packed.
> Adding packed attribute unnecessarily can generate poor code on
> architectures that do not support unaligned access.

For the specific case where their fields and alignments are naturally
packed I'm not entirely certain you get different codegen but I agree
it might and we'd like to avoid it if it does.

In a lot of the cases it seems to be drivers and often appears like it
is either structs that are used to hardware registers or firmware
protocol data units. Both of which may be need packing.

I will commit to removing packing in structs in this series iff
individual maintainers identify the specific structs in reply to the
series.  If there is no request I'll leave it to them to figure out.

Maintainers should review and request removal as appropriate.

Thanks!

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 02/15] eal: pack structures when building with MSVC
  2024-03-20 21:05 ` [PATCH 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
@ 2024-03-21 16:02   ` Bruce Richardson
  0 siblings, 0 replies; 75+ messages in thread
From: Bruce Richardson @ 2024-03-21 16:02 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Byron Marohn,
	Conor Walsh, Cristian Dumitrescu, Dariusz Sosnowski, David Hunt,
	Jerin Jacob, Jingjing Wu, Kirill Rybalchenko, Konstantin Ananyev,
	Matan Azrad, Ori Kam, Radu Nicolau, Ruifeng Wang, Sameh Gobriel,
	Sivaprasad Tummala, Suanming Mou, Sunil Kumar Kori,
	Vamsi Attunuru, Viacheslav Ovsiienko, Vladimir Medvedkin,
	Yipeng Wang, Yuying Zhang

On Wed, Mar 20, 2024 at 02:05:58PM -0700, Tyler Retzlaff wrote:
> Add __rte_msvc_pack to all __rte_packed structs to cause packing
> when building with MSVC.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/eal/common/eal_private.h      | 1 +
>  lib/eal/include/rte_memory.h      | 1 +
>  lib/eal/include/rte_memzone.h     | 1 +
>  lib/eal/include/rte_trace_point.h | 1 +
>  lib/eal/x86/include/rte_memcpy.h  | 3 +++
>  5 files changed, 7 insertions(+)
> 
> diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
> index 71523cf..21ace2a 100644
> --- a/lib/eal/common/eal_private.h
> +++ b/lib/eal/common/eal_private.h
> @@ -43,6 +43,7 @@ struct lcore_config {
>  /**
>   * The global RTE configuration structure.
>   */
> +__rte_msvc_pack
>  struct rte_config {
>  	uint32_t main_lcore;         /**< Id of the main lcore */
>  	uint32_t lcore_count;        /**< Number of available logical cores. */

This struct almost certainly doesn't need to be packed - since it's in a
private header, I would imagine removing packing wouldn't be an ABI
break.
Also, removing rte_packed doesn't change the size for me for a 64-bit x86
build. Looking at the struct, I don't see why it would change on a 32-bit
build either.

> diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h
> index 842362d..73bb00d 100644
> --- a/lib/eal/include/rte_memory.h
> +++ b/lib/eal/include/rte_memory.h
> @@ -46,6 +46,7 @@
>  /**
>   * Physical memory segment descriptor.
>   */
> +__rte_msvc_pack
>  struct rte_memseg {
>  	rte_iova_t iova;            /**< Start IO address. */
>  	union {
> diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h
> index 931497f..ca312c0 100644
> --- a/lib/eal/include/rte_memzone.h
> +++ b/lib/eal/include/rte_memzone.h
> @@ -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 {
> 

This also doesn't look like it should be packed. It is a public header
though so we may need to be more careful. Checking a 64-bit x86 build shows
no size change when removing the "packed" attribute, though. For 32-bit, I
think the "size_t" field in the middle would be followed by padding on
32-bit if we removed the "packed" attribute, so it may be a no-go for now.
:-(

>  #define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
> diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h
> index 41e2a7f..63f333c 100644
> --- a/lib/eal/include/rte_trace_point.h
> +++ b/lib/eal/include/rte_trace_point.h
> @@ -292,6 +292,7 @@ int __rte_trace_point_register(rte_trace_point_t *trace, const char *name,
>  #define __RTE_TRACE_FIELD_ENABLE_MASK (1ULL << 63)
>  #define __RTE_TRACE_FIELD_ENABLE_DISCARD (1ULL << 62)
>  
> +__rte_msvc_pack
>  struct __rte_trace_stream_header {
>  	uint32_t magic;
>  	rte_uuid_t uuid;

From code review, this doesn't look like "packed" has any impact, since all
fields should naturally be aligned on both 32-bit and 64-bit builds.

/Bruce


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 07/15] dma/ioat: pack structures when building with MSVC
  2024-03-20 21:06 ` [PATCH 07/15] dma/ioat: " Tyler Retzlaff
@ 2024-03-21 16:13   ` Bruce Richardson
  2024-03-27 22:51     ` Tyler Retzlaff
  0 siblings, 1 reply; 75+ messages in thread
From: Bruce Richardson @ 2024-03-21 16:13 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Byron Marohn,
	Conor Walsh, Cristian Dumitrescu, Dariusz Sosnowski, David Hunt,
	Jerin Jacob, Jingjing Wu, Kirill Rybalchenko, Konstantin Ananyev,
	Matan Azrad, Ori Kam, Radu Nicolau, Ruifeng Wang, Sameh Gobriel,
	Sivaprasad Tummala, Suanming Mou, Sunil Kumar Kori,
	Vamsi Attunuru, Viacheslav Ovsiienko, Vladimir Medvedkin,
	Yipeng Wang, Yuying Zhang

On Wed, Mar 20, 2024 at 02:06:03PM -0700, Tyler Retzlaff wrote:
> Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
> when building with MSVC.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  drivers/dma/ioat/ioat_hw_defs.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/dma/ioat/ioat_hw_defs.h b/drivers/dma/ioat/ioat_hw_defs.h
> index dc3493a..6e32807 100644
> --- a/drivers/dma/ioat/ioat_hw_defs.h
> +++ b/drivers/dma/ioat/ioat_hw_defs.h
> @@ -52,6 +52,7 @@
>  #define	IOAT_DMACAP_PQ		(1 << 9)
>  #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
>  
> +__rte_msvc_pack
>  struct ioat_registers {
>  	uint8_t		chancnt;
>  	uint8_t		xfercap;

This struct has all gaps explicitly filled, so packed should not be
necessary. Struct has same size with and without the attribute.

/Bruce

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 09/15] net/iavf: pack structures when building with MSVC
  2024-03-20 21:06 ` [PATCH 09/15] net/iavf: " Tyler Retzlaff
@ 2024-03-21 16:26   ` Bruce Richardson
  0 siblings, 0 replies; 75+ messages in thread
From: Bruce Richardson @ 2024-03-21 16:26 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Byron Marohn,
	Conor Walsh, Cristian Dumitrescu, Dariusz Sosnowski, David Hunt,
	Jerin Jacob, Jingjing Wu, Kirill Rybalchenko, Konstantin Ananyev,
	Matan Azrad, Ori Kam, Radu Nicolau, Ruifeng Wang, Sameh Gobriel,
	Sivaprasad Tummala, Suanming Mou, Sunil Kumar Kori,
	Vamsi Attunuru, Viacheslav Ovsiienko, Vladimir Medvedkin,
	Yipeng Wang, Yuying Zhang

On Wed, Mar 20, 2024 at 02:06:05PM -0700, Tyler Retzlaff wrote:
> Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
> when building with MSVC.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  drivers/net/iavf/iavf_ipsec_crypto.h | 3 +++
>  drivers/net/iavf/iavf_rxtx.c         | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/net/iavf/iavf_ipsec_crypto.h b/drivers/net/iavf/iavf_ipsec_crypto.h
> index 49f9202..36ced50 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;

Looking at the structure, I believe only the inner packed attribute is
necessary. However, given that we need packed attributes, for safety, let's
keep them both.

> @@ -84,6 +86,7 @@ enum iavf_ipsec_iv_len {
>   * transmit data path. Parameters set for session by calling
>   * rte_security_set_pkt_metadata() API.
>   */
> +__rte_msvc_pack
>  struct iavf_ipsec_crypto_pkt_metadata {
>  	uint32_t sa_idx;                /* SA hardware index (20b/4B) */
>  

This is exactly 16-bytes in size, with all members explicitly sized and
properly aligned. Therefore we can drop the packed atttribute.

> diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
> index 0a5246d..ba0fa6f 100644
> --- a/drivers/net/iavf/iavf_rxtx.c
> +++ b/drivers/net/iavf/iavf_rxtx.c
> @@ -50,6 +50,7 @@
>  static uint16_t vxlan_gpe_udp_port = RTE_VXLAN_GPE_DEFAULT_PORT;
>  static uint16_t geneve_udp_port = RTE_GENEVE_DEFAULT_PORT;
>  
> +__rte_msvc_pack
>  struct simple_gre_hdr {
>  	uint16_t flags;
>  	uint16_t proto;

Two 16-bit fields only, so no need to pack this struct either.

/Bruce

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 13/15] app/testpmd: pack structures when building with MSVC
  2024-03-20 21:06 ` [PATCH 13/15] app/testpmd: " Tyler Retzlaff
@ 2024-03-21 16:28   ` Bruce Richardson
  0 siblings, 0 replies; 75+ messages in thread
From: Bruce Richardson @ 2024-03-21 16:28 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Byron Marohn,
	Conor Walsh, Cristian Dumitrescu, Dariusz Sosnowski, David Hunt,
	Jerin Jacob, Jingjing Wu, Kirill Rybalchenko, Konstantin Ananyev,
	Matan Azrad, Ori Kam, Radu Nicolau, Ruifeng Wang, Sameh Gobriel,
	Sivaprasad Tummala, Suanming Mou, Sunil Kumar Kori,
	Vamsi Attunuru, Viacheslav Ovsiienko, Vladimir Medvedkin,
	Yipeng Wang, Yuying Zhang

On Wed, Mar 20, 2024 at 02:06:09PM -0700, Tyler Retzlaff wrote:
> Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
> when building with MSVC.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  app/test-pmd/csumonly.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
> index 6711dda..638e607 100644
> --- a/app/test-pmd/csumonly.c
> +++ b/app/test-pmd/csumonly.c
> @@ -89,6 +89,7 @@ struct testpmd_offload_info {
>  };
>  
>  /* simplified GRE header */
> +__rte_msvc_pack
>  struct simple_gre_hdr {
>  	uint16_t flags;
>  	uint16_t proto;

Should not need to be packed, as no padding.

However, if we don't mark this as packed could we hit problems if (for
whatever reason) we ever receive a packet where the gre_hdr is not aligned
on an even byte boundary? Does packing affect the minimum alignment
requirements of the whole struct, as well as removing padding?

/Bruce

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 15/15] examples: pack structures when building with MSVC
  2024-03-20 21:06 ` [PATCH 15/15] examples: " Tyler Retzlaff
@ 2024-03-21 16:31   ` Bruce Richardson
  0 siblings, 0 replies; 75+ messages in thread
From: Bruce Richardson @ 2024-03-21 16:31 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Byron Marohn,
	Conor Walsh, Cristian Dumitrescu, Dariusz Sosnowski, David Hunt,
	Jerin Jacob, Jingjing Wu, Kirill Rybalchenko, Konstantin Ananyev,
	Matan Azrad, Ori Kam, Radu Nicolau, Ruifeng Wang, Sameh Gobriel,
	Sivaprasad Tummala, Suanming Mou, Sunil Kumar Kori,
	Vamsi Attunuru, Viacheslav Ovsiienko, Vladimir Medvedkin,
	Yipeng Wang, Yuying Zhang

On Wed, Mar 20, 2024 at 02:06:11PM -0700, Tyler Retzlaff wrote:
> Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
> when building with MSVC.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  examples/common/neon/port_group.h | 1 +
>  examples/ip_pipeline/cli.c        | 5 +++++
>  examples/ipsec-secgw/ipsec.h      | 1 +
>  examples/l3fwd-power/main.c       | 2 ++
>  examples/ptpclient/ptpclient.c    | 8 ++++++++
>  5 files changed, 17 insertions(+)
> 
> diff --git a/examples/common/neon/port_group.h b/examples/common/neon/port_group.h
> index 421e2e8..bd40590 100644
> --- a/examples/common/neon/port_group.h
> +++ b/examples/common/neon/port_group.h
> @@ -21,6 +21,7 @@
>  port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
>  		  uint16x8_t dp2)
>  {
> +	__rte_msvc_pack
>  	union {
>  		uint16_t u16[FWDSTEP + 1];
>  		uint64_t u64;
> diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
> index e8269ea..cae5c1f 100644
> --- a/examples/ip_pipeline/cli.c
> +++ b/examples/ip_pipeline/cli.c
> @@ -2566,6 +2566,7 @@
>   *    | lpm
>   *       ipv4 | ipv6 <addr> <depth>
>   */
> +__rte_msvc_pack
>  struct pkt_key_qinq {
>  	uint16_t ethertype_svlan;
>  	uint16_t svlan;
> @@ -2573,6 +2574,7 @@ struct pkt_key_qinq {
>  	uint16_t cvlan;
>  } __rte_packed;
>  
> +__rte_msvc_pack
>  struct pkt_key_ipv4_5tuple {
>  	uint8_t time_to_live;
>  	uint8_t proto;
> @@ -2583,6 +2585,7 @@ struct pkt_key_ipv4_5tuple {
>  	uint16_t dp;
>  } __rte_packed;
>  
> +__rte_msvc_pack
>  struct pkt_key_ipv6_5tuple {
>  	uint16_t payload_length;
>  	uint8_t proto;
> @@ -2593,10 +2596,12 @@ struct pkt_key_ipv6_5tuple {
>  	uint16_t dp;
>  } __rte_packed;
>  
> +__rte_msvc_pack
>  struct pkt_key_ipv4_addr {
>  	uint32_t addr;
>  } __rte_packed;
>  
> +__rte_msvc_pack
>  struct pkt_key_ipv6_addr {
>  	uint8_t addr[16];
>  } __rte_packed;

These structs don't look to me like they need packing. No padding should
appear between elements of the structs. The last struct definitely doesn't
need it, as it's a uint8_t array.

/Bruce

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 07/15] dma/ioat: pack structures when building with MSVC
  2024-03-21 16:13   ` Bruce Richardson
@ 2024-03-27 22:51     ` Tyler Retzlaff
  0 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 22:51 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Byron Marohn,
	Conor Walsh, Cristian Dumitrescu, Dariusz Sosnowski, David Hunt,
	Jerin Jacob, Jingjing Wu, Kirill Rybalchenko, Konstantin Ananyev,
	Matan Azrad, Ori Kam, Radu Nicolau, Ruifeng Wang, Sameh Gobriel,
	Sivaprasad Tummala, Suanming Mou, Sunil Kumar Kori,
	Vamsi Attunuru, Viacheslav Ovsiienko, Vladimir Medvedkin,
	Yipeng Wang, Yuying Zhang

On Thu, Mar 21, 2024 at 04:13:32PM +0000, Bruce Richardson wrote:
> On Wed, Mar 20, 2024 at 02:06:03PM -0700, Tyler Retzlaff wrote:
> > Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
> > when building with MSVC.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  drivers/dma/ioat/ioat_hw_defs.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/dma/ioat/ioat_hw_defs.h b/drivers/dma/ioat/ioat_hw_defs.h
> > index dc3493a..6e32807 100644
> > --- a/drivers/dma/ioat/ioat_hw_defs.h
> > +++ b/drivers/dma/ioat/ioat_hw_defs.h
> > @@ -52,6 +52,7 @@
> >  #define	IOAT_DMACAP_PQ		(1 << 9)
> >  #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
> >  
> > +__rte_msvc_pack
> >  struct ioat_registers {
> >  	uint8_t		chancnt;
> >  	uint8_t		xfercap;
> 
> This struct has all gaps explicitly filled, so packed should not be
> necessary. Struct has same size with and without the attribute.

just eyeballing it i think

        uint32_t        dmacapability;  /* 0x10 */

with packing will not be aligned on a 4-byte boundary.

maybe i miscounted though.

> 
> /Bruce

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 00/15] fix packing of structs when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (15 preceding siblings ...)
  2024-03-21 15:32 ` [PATCH 00/15] fix packing of structs " Stephen Hemminger
@ 2024-03-27 23:09 ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
                     ` (14 more replies)
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
  18 siblings, 15 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

MSVC struct packing is not compatible with GCC provide a macro that can
be used to push existing pack value and sets packing to 1-byte. The
existing __rte_packed macro is then used to restore the pack value
prior to the push.

Instead of providing macros exclusively for MSVC and for GCC the
existing macro is deliberately utilized to trigger a warning if no
existing packing has been pushed allowing easy identification of
locations where the __rte_msvc_pack is missing.

I've decided to only add the macro to packed structs that are built
for Windows. It seems there is little value in adding the macro tree
wide and if new code arrives that is built on Windows the __rte_packed
will flag where the preamble macro is required.

If as a part of review maintainers identify structs they believe
don't require packing so long as they are explicitly identified
i'll remove the __rte_packed as a part of this series.

v2:
  * app/testpmd, remove packing from simple_gre_hdr
  * net/iavf, remove packing from iavf_ipsec_crypto_pkt_metadata,
    simple_gre_hdr
  * examples, remove packing from pkt_key_qinq, pkt_key_ipv4_5tuple,
    pkt_key_ipv6_5tuple, pkt_key_ipv4_addr, pkt_key_ipv6_addr
  * eal, remove packing from rte_config, __rte_trace_stream_header

Tyler Retzlaff (15):
  eal: provide pack start macro for MSVC
  eal: pack structures when building with MSVC
  net: pack structures when building with MSVC
  common/iavf: pack structures when building with MSVC
  common/idpf: pack structures when building with MSVC
  common/mlx5: pack structures when building with MSVC
  dma/ioat: pack structures when building with MSVC
  net/i40e: pack structures when building with MSVC
  net/iavf: pack structures when building with MSVC
  net/ice: pack structures when building with MSVC
  net/mlx5: pack structures when building with MSVC
  net/octeon_ep: pack structures when building with MSVC
  app/testpmd: pack structures when building with MSVC
  app/test: pack structures when building with MSVC
  examples: pack structures when building with MSVC

 app/test-pmd/csumonly.c                     |  2 +-
 app/test/test_efd.c                         |  1 +
 app/test/test_hash.c                        |  1 +
 app/test/test_member.c                      |  1 +
 drivers/common/iavf/iavf_osdep.h            |  2 ++
 drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++
 drivers/common/idpf/base/idpf_osdep.h       |  2 ++
 drivers/common/mlx5/mlx5_common_mr.h        |  4 ++++
 drivers/common/mlx5/mlx5_common_utils.h     |  1 +
 drivers/common/mlx5/mlx5_prm.h              | 28 ++++++++++++++++++++++++++++
 drivers/dma/ioat/ioat_hw_defs.h             |  1 +
 drivers/net/i40e/base/i40e_osdep.h          |  2 ++
 drivers/net/iavf/iavf_ipsec_crypto.h        |  4 +++-
 drivers/net/iavf/iavf_rxtx.c                |  2 +-
 drivers/net/ice/base/ice_osdep.h            |  2 ++
 drivers/net/mlx5/hws/mlx5dr.h               |  1 +
 drivers/net/mlx5/mlx5.h                     |  1 +
 drivers/net/mlx5/mlx5_flow.h                |  5 +++++
 drivers/net/mlx5/mlx5_hws_cnt.h             |  1 +
 drivers/net/mlx5/mlx5_utils.h               |  4 ++++
 drivers/net/octeon_ep/otx_ep_mbox.h         |  1 +
 examples/common/neon/port_group.h           |  1 +
 examples/ip_pipeline/cli.c                  | 10 +++++-----
 examples/ipsec-secgw/ipsec.h                |  1 +
 examples/l3fwd-power/main.c                 |  2 ++
 examples/ptpclient/ptpclient.c              |  8 ++++++++
 lib/eal/common/eal_private.h                |  2 +-
 lib/eal/include/rte_common.h                |  4 +++-
 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 +++
 lib/net/rte_arp.h                           |  2 ++
 lib/net/rte_dtls.h                          |  1 +
 lib/net/rte_esp.h                           |  2 ++
 lib/net/rte_ether.h                         |  1 +
 lib/net/rte_geneve.h                        |  1 +
 lib/net/rte_gre.h                           |  4 ++++
 lib/net/rte_gtp.h                           |  5 +++++
 lib/net/rte_ib.h                            |  1 +
 lib/net/rte_icmp.h                          |  3 +++
 lib/net/rte_ip.h                            |  4 ++++
 lib/net/rte_l2tpv2.h                        |  4 ++++
 lib/net/rte_macsec.h                        |  2 ++
 lib/net/rte_mpls.h                          |  1 +
 lib/net/rte_pdcp_hdr.h                      |  4 ++++
 lib/net/rte_ppp.h                           |  1 +
 lib/net/rte_sctp.h                          |  1 +
 lib/net/rte_tcp.h                           |  1 +
 lib/net/rte_tls.h                           |  1 +
 lib/net/rte_udp.h                           |  1 +
 lib/net/rte_vxlan.h                         |  2 ++
 52 files changed, 143 insertions(+), 11 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 01/15] eal: provide pack start macro for MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
                     ` (13 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

MSVC struct packing is not compatible with GCC provide a macro that can
be used to push existing pack value and sets packing to 1-byte. The
existing __rte_packed macro is then used to restore the pack value
prior to the push.

Instead of providing macros exclusively for MSVC and for GCC the
existing macro is deliberately utilized to trigger a warning if no
existing packing has been pushed allowing easy identification of
locations where the __rte_msvc_pack is missing.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_common.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 298a5c6..44825ed 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -97,8 +97,10 @@
  * Force a structure to be packed
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_packed
+#define __rte_msvc_pack __pragma(pack(push, 1))
+#define __rte_packed __pragma(pack(pop))
 #else
+#define __rte_msvc_pack
 #define __rte_packed __attribute__((__packed__))
 #endif
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 02/15] eal: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 03/15] net: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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(-)

diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 71523cf..4c929fb 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -62,7 +62,7 @@ struct rte_config {
 	 * DPDK instances
 	 */
 	struct rte_mem_config *mem_config;
-} __rte_packed;
+};
 
 /**
  * Get the global configuration structure.
diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h
index 842362d..73bb00d 100644
--- a/lib/eal/include/rte_memory.h
+++ b/lib/eal/include/rte_memory.h
@@ -46,6 +46,7 @@
 /**
  * Physical memory segment descriptor.
  */
+__rte_msvc_pack
 struct rte_memseg {
 	rte_iova_t iova;            /**< Start IO address. */
 	union {
diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h
index 931497f..ca312c0 100644
--- a/lib/eal/include/rte_memzone.h
+++ b/lib/eal/include/rte_memzone.h
@@ -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.*/
diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h
index 41e2a7f..e786ee3 100644
--- a/lib/eal/include/rte_trace_point.h
+++ b/lib/eal/include/rte_trace_point.h
@@ -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;
diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h
index 72a9229..fdc5df0 100644
--- a/lib/eal/x86/include/rte_memcpy.h
+++ b/lib/eal/x86/include/rte_memcpy.h
@@ -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;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 03/15] net: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 04/15] common/iavf: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/net/rte_arp.h      | 2 ++
 lib/net/rte_dtls.h     | 1 +
 lib/net/rte_esp.h      | 2 ++
 lib/net/rte_ether.h    | 1 +
 lib/net/rte_geneve.h   | 1 +
 lib/net/rte_gre.h      | 4 ++++
 lib/net/rte_gtp.h      | 5 +++++
 lib/net/rte_ib.h       | 1 +
 lib/net/rte_icmp.h     | 3 +++
 lib/net/rte_ip.h       | 4 ++++
 lib/net/rte_l2tpv2.h   | 4 ++++
 lib/net/rte_macsec.h   | 2 ++
 lib/net/rte_mpls.h     | 1 +
 lib/net/rte_pdcp_hdr.h | 4 ++++
 lib/net/rte_ppp.h      | 1 +
 lib/net/rte_sctp.h     | 1 +
 lib/net/rte_tcp.h      | 1 +
 lib/net/rte_tls.h      | 1 +
 lib/net/rte_udp.h      | 1 +
 lib/net/rte_vxlan.h    | 2 ++
 20 files changed, 42 insertions(+)

diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h
index 668cea1..35d68c1 100644
--- a/lib/net/rte_arp.h
+++ b/lib/net/rte_arp.h
@@ -21,6 +21,7 @@
 /**
  * ARP header IPv4 payload.
  */
+__rte_msvc_pack
 struct __rte_aligned(2) rte_arp_ipv4 {
 	struct rte_ether_addr arp_sha;  /**< sender hardware address */
 	rte_be32_t            arp_sip;  /**< sender IP address */
@@ -31,6 +32,7 @@ struct __rte_aligned(2) rte_arp_ipv4 {
 /**
  * ARP header.
  */
+__rte_msvc_pack
 struct __rte_aligned(2) rte_arp_hdr {
 	rte_be16_t arp_hardware; /**< format of hardware address */
 #define RTE_ARP_HRD_ETHER     1  /**< ARP Ethernet address format */
diff --git a/lib/net/rte_dtls.h b/lib/net/rte_dtls.h
index 4f541df..0c75b06 100644
--- a/lib/net/rte_dtls.h
+++ b/lib/net/rte_dtls.h
@@ -34,6 +34,7 @@
  * DTLS Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_dtls_hdr {
 	/** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */
 	uint8_t type;
diff --git a/lib/net/rte_esp.h b/lib/net/rte_esp.h
index 464c513..27c9287 100644
--- a/lib/net/rte_esp.h
+++ b/lib/net/rte_esp.h
@@ -20,6 +20,7 @@
 /**
  * ESP Header
  */
+__rte_msvc_pack
 struct rte_esp_hdr {
 	rte_be32_t spi;  /**< Security Parameters Index */
 	rte_be32_t seq;  /**< packet sequence number */
@@ -28,6 +29,7 @@ struct rte_esp_hdr {
 /**
  * ESP Trailer
  */
+__rte_msvc_pack
 struct rte_esp_tail {
 	uint8_t pad_len;     /**< number of pad bytes (0-255) */
 	uint8_t next_proto;  /**< IPv4 or IPv6 or next layer header */
diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h
index 32ed515..354e3a5 100644
--- a/lib/net/rte_ether.h
+++ b/lib/net/rte_ether.h
@@ -301,6 +301,7 @@ struct __rte_aligned(2) rte_ether_hdr {
  * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type
  * of the encapsulated frame.
  */
+__rte_msvc_pack
 struct rte_vlan_hdr {
 	rte_be16_t vlan_tci;  /**< Priority (3) + CFI (1) + Identifier Code (12) */
 	rte_be16_t eth_proto; /**< Ethernet type of encapsulated frame. */
diff --git a/lib/net/rte_geneve.h b/lib/net/rte_geneve.h
index 3bbc561..5c02526 100644
--- a/lib/net/rte_geneve.h
+++ b/lib/net/rte_geneve.h
@@ -38,6 +38,7 @@
  * More-bits (optional) variable length options.
  */
 __extension__
+__rte_msvc_pack
 struct rte_geneve_hdr {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t ver:2;		/**< Version. */
diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h
index 8da8027..77882e7 100644
--- a/lib/net/rte_gre.h
+++ b/lib/net/rte_gre.h
@@ -27,6 +27,7 @@
  * GRE Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_gre_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint16_t res2:4; /**< Reserved */
@@ -51,6 +52,7 @@ struct rte_gre_hdr {
 /**
  * Optional field checksum in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_checksum_rsvd {
 	rte_be16_t checksum;
 	rte_be16_t reserved1;
@@ -59,6 +61,7 @@ struct rte_gre_hdr_opt_checksum_rsvd {
 /**
  * Optional field key in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_key {
 	rte_be32_t key;
 } __rte_packed;
@@ -66,6 +69,7 @@ struct rte_gre_hdr_opt_key {
 /**
  * Optional field sequence in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_sequence {
 	rte_be32_t sequence;
 } __rte_packed;
diff --git a/lib/net/rte_gtp.h b/lib/net/rte_gtp.h
index 9849872..26fc80a 100644
--- a/lib/net/rte_gtp.h
+++ b/lib/net/rte_gtp.h
@@ -28,6 +28,7 @@
  * No optional fields and next extension header.
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_hdr {
 	union {
 		uint8_t gtp_hdr_info; /**< GTP header info */
@@ -55,6 +56,7 @@ struct rte_gtp_hdr {
 } __rte_packed;
 
 /* Optional word of GTP header, present if any of E, S, PN is set. */
+__rte_msvc_pack
 struct rte_gtp_hdr_ext_word {
 	rte_be16_t sqn;	      /**< Sequence Number. */
 	uint8_t npdu;	      /**< N-PDU number. */
@@ -66,6 +68,7 @@ struct rte_gtp_hdr_ext_word {
  * defined based on RFC 38415-g30.
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_generic_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -89,6 +92,7 @@ struct rte_gtp_psc_generic_hdr {
  * type0 defined based on RFC 38415-g30
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_type0_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -116,6 +120,7 @@ struct rte_gtp_psc_type0_hdr {
  * type1 defined based on RFC 38415-g30
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_type1_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
diff --git a/lib/net/rte_ib.h b/lib/net/rte_ib.h
index 9eab5f9..c4c5d39 100644
--- a/lib/net/rte_ib.h
+++ b/lib/net/rte_ib.h
@@ -26,6 +26,7 @@
  * IB Specification Vol 1-Release-1.4.
  */
 __extension__
+__rte_msvc_pack
 struct rte_ib_bth {
 	uint8_t	opcode;		/**< Opcode. */
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
diff --git a/lib/net/rte_icmp.h b/lib/net/rte_icmp.h
index 4bf64d7..e865db4 100644
--- a/lib/net/rte_icmp.h
+++ b/lib/net/rte_icmp.h
@@ -25,6 +25,7 @@
 /**
  * ICMP base header
  */
+__rte_msvc_pack
 struct rte_icmp_base_hdr {
 	uint8_t type;
 	uint8_t code;
@@ -34,6 +35,7 @@ struct rte_icmp_base_hdr {
 /**
  * ICMP echo header
  */
+__rte_msvc_pack
 struct rte_icmp_echo_hdr {
 	struct rte_icmp_base_hdr base;
 	rte_be16_t identifier;
@@ -45,6 +47,7 @@ struct rte_icmp_echo_hdr {
  *
  * @see rte_icmp_echo_hdr which is similar.
  */
+__rte_msvc_pack
 struct rte_icmp_hdr {
 	uint8_t  icmp_type;     /* ICMP packet type. */
 	uint8_t  icmp_code;     /* ICMP packet code. */
diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 0d103d4..908a25c 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -38,6 +38,7 @@
 /**
  * IPv4 Header
  */
+__rte_msvc_pack
 struct rte_ipv4_hdr {
 	__extension__
 	union {
@@ -523,6 +524,7 @@ struct rte_ipv4_hdr {
 /**
  * IPv6 Header
  */
+__rte_msvc_pack
 struct rte_ipv6_hdr {
 	rte_be32_t vtc_flow;	/**< IP version, traffic class & flow label. */
 	rte_be16_t payload_len;	/**< IP payload size, including ext. headers */
@@ -538,6 +540,7 @@ struct rte_ipv6_hdr {
 /**
  * IPv6 Routing Extension Header
  */
+__rte_msvc_pack
 struct rte_ipv6_routing_ext {
 	uint8_t next_hdr;			/**< Protocol, next header. */
 	uint8_t hdr_len;			/**< Header length. */
@@ -783,6 +786,7 @@ struct rte_ipv6_routing_ext {
 #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
 	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
 
+__rte_msvc_pack
 struct rte_ipv6_fragment_ext {
 	uint8_t next_header;	/**< Next header type */
 	uint8_t reserved;	/**< Reserved */
diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 9cda347..a917013 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -129,6 +129,7 @@ struct rte_l2tpv2_common_hdr {
  * L2TPv2 message Header contains all options(length, ns, nr,
  * offset size, offset padding).
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_with_all_options {
 	rte_be16_t length;		/**< length(16) */
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
@@ -143,6 +144,7 @@ struct rte_l2tpv2_msg_with_all_options {
  * L2TPv2 message Header contains all options except length(ns, nr,
  * offset size, offset padding).
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_without_length {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -180,6 +182,7 @@ struct rte_l2tpv2_msg_without_offset {
 /**
  * L2TPv2 message Header contains options offset size and offset padding.
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_with_offset {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -217,6 +220,7 @@ struct rte_l2tpv2_msg_without_all_options {
 /**
  * L2TPv2 Combined Message Header Format: Common Header + Options
  */
+__rte_msvc_pack
 struct rte_l2tpv2_combined_msg_hdr {
 	struct rte_l2tpv2_common_hdr common; /**< common header */
 	union {
diff --git a/lib/net/rte_macsec.h b/lib/net/rte_macsec.h
index d0cd2f6..54de1bd 100644
--- a/lib/net/rte_macsec.h
+++ b/lib/net/rte_macsec.h
@@ -29,6 +29,7 @@
  * MACsec Header (SecTAG)
  */
 __extension__
+__rte_msvc_pack
 struct rte_macsec_hdr {
 	/**
 	 * Tag control information and Association number of secure channel.
@@ -52,6 +53,7 @@ struct rte_macsec_hdr {
  * MACsec SCI header (8 bytes) after the MACsec header
  * which is present if SC bit is set in tci_an.
  */
+__rte_msvc_pack
 struct rte_macsec_sci_hdr {
 	uint8_t sci[RTE_MACSEC_SCI_LEN]; /**< Optional secure channel ID. */
 } __rte_packed;
diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h
index 51523e7..d5f6026 100644
--- a/lib/net/rte_mpls.h
+++ b/lib/net/rte_mpls.h
@@ -22,6 +22,7 @@
  * MPLS header.
  */
 __extension__
+__rte_msvc_pack
 struct rte_mpls_hdr {
 	rte_be16_t tag_msb; /**< Label(msb). */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
diff --git a/lib/net/rte_pdcp_hdr.h b/lib/net/rte_pdcp_hdr.h
index 72ae9a6..6a20ad9 100644
--- a/lib/net/rte_pdcp_hdr.h
+++ b/lib/net/rte_pdcp_hdr.h
@@ -60,6 +60,7 @@ enum rte_pdcp_pdu_type {
  * 6.2.2.1 Data PDU for SRBs
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_cp_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
@@ -75,6 +76,7 @@ struct rte_pdcp_cp_data_pdu_sn_12_hdr {
  * 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
@@ -92,6 +94,7 @@ struct rte_pdcp_up_data_pdu_sn_12_hdr {
  * 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_data_pdu_sn_18_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_17_16 : 2;	/**< Sequence number bits 16-17 */
@@ -110,6 +113,7 @@ struct rte_pdcp_up_data_pdu_sn_18_hdr {
  * 6.2.3.1 Control PDU for PDCP status report
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_ctrl_pdu_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t r : 4;		/**< Reserved */
diff --git a/lib/net/rte_ppp.h b/lib/net/rte_ppp.h
index 7b86ac4..fde585f 100644
--- a/lib/net/rte_ppp.h
+++ b/lib/net/rte_ppp.h
@@ -21,6 +21,7 @@
 /**
  * PPP Header
  */
+__rte_msvc_pack
 struct rte_ppp_hdr {
 	uint8_t addr; /**< PPP address(8) */
 	uint8_t ctrl; /**< PPP control(8) */
diff --git a/lib/net/rte_sctp.h b/lib/net/rte_sctp.h
index 965682d..a6cfe8f 100644
--- a/lib/net/rte_sctp.h
+++ b/lib/net/rte_sctp.h
@@ -25,6 +25,7 @@
 /**
  * SCTP Header
  */
+__rte_msvc_pack
 struct rte_sctp_hdr {
 	rte_be16_t src_port; /**< Source port. */
 	rte_be16_t dst_port; /**< Destin port. */
diff --git a/lib/net/rte_tcp.h b/lib/net/rte_tcp.h
index 506ac4e..d11cb2c 100644
--- a/lib/net/rte_tcp.h
+++ b/lib/net/rte_tcp.h
@@ -25,6 +25,7 @@
 /**
  * TCP Header
  */
+__rte_msvc_pack
 struct rte_tcp_hdr {
 	rte_be16_t src_port; /**< TCP source port. */
 	rte_be16_t dst_port; /**< TCP destination port. */
diff --git a/lib/net/rte_tls.h b/lib/net/rte_tls.h
index 2eb3c6d..81af4c7 100644
--- a/lib/net/rte_tls.h
+++ b/lib/net/rte_tls.h
@@ -32,6 +32,7 @@
  * TLS Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_tls_hdr {
 	/** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */
 	uint8_t type;
diff --git a/lib/net/rte_udp.h b/lib/net/rte_udp.h
index 6135494..5416855 100644
--- a/lib/net/rte_udp.h
+++ b/lib/net/rte_udp.h
@@ -25,6 +25,7 @@
 /**
  * UDP Header
  */
+__rte_msvc_pack
 struct rte_udp_hdr {
 	rte_be16_t src_port;    /**< UDP source port. */
 	rte_be16_t dst_port;    /**< UDP destination port. */
diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h
index 997fc78..bcfd579 100644
--- a/lib/net/rte_vxlan.h
+++ b/lib/net/rte_vxlan.h
@@ -31,6 +31,7 @@
  * Reserved fields (24 bits and 8 bits)
  */
 __extension__ /* no named member in struct */
+__rte_msvc_pack
 struct rte_vxlan_hdr {
 	union {
 		struct {
@@ -57,6 +58,7 @@ struct rte_vxlan_hdr {
  * Identifier and Reserved fields (16 bits and 8 bits).
  */
 __extension__ /* no named member in struct */
+__rte_msvc_pack
 struct rte_vxlan_gpe_hdr {
 	union {
 		struct {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 04/15] common/iavf: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 03/15] net: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 05/15] common/idpf: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/iavf/iavf_osdep.h            |  2 ++
 drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/common/iavf/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h
index 263d924..1fb057c 100644
--- a/drivers/common/iavf/iavf_osdep.h
+++ b/drivers/common/iavf/iavf_osdep.h
@@ -158,6 +158,7 @@
 } while (0)
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct iavf_dma_mem {
 	void *va;
 	u64 pa;
@@ -165,6 +166,7 @@ struct iavf_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct iavf_virt_mem {
 	void *va;
 	u32 size;
diff --git a/drivers/common/iavf/virtchnl_inline_ipsec.h b/drivers/common/iavf/virtchnl_inline_ipsec.h
index 2f4bf15..feb0f44 100644
--- a/drivers/common/iavf/virtchnl_inline_ipsec.h
+++ b/drivers/common/iavf/virtchnl_inline_ipsec.h
@@ -109,6 +109,7 @@ enum inline_ipsec_ops {
 };
 
 /* Not all valid, if certain field is invalid, set 1 for all bits */
+__rte_msvc_pack
 struct virtchnl_algo_cap  {
 	u32 algo_type;
 
@@ -132,6 +133,7 @@ struct virtchnl_algo_cap  {
 } __rte_packed;
 
 /* vf record the capability of crypto from the virtchnl */
+__rte_msvc_pack
 struct virtchnl_sym_crypto_cap {
 	u8 crypto_type;
 	u8 algo_cap_num;
@@ -142,6 +144,7 @@ struct virtchnl_sym_crypto_cap {
  * VF pass virtchnl_ipsec_cap to PF
  * and PF return capability of ipsec from virtchnl.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_cap {
 	/* max number of SA per VF */
 	u16 max_sa_num;
@@ -172,6 +175,7 @@ struct virtchnl_ipsec_cap {
 } __rte_packed;
 
 /* configuration of crypto function */
+__rte_msvc_pack
 struct virtchnl_ipsec_crypto_cfg_item {
 	u8 crypto_type;
 
@@ -203,6 +207,7 @@ struct virtchnl_ipsec_sym_crypto_cfg {
  * PF create SA as configuration and PF driver will return
  * an unique index (sa_idx) for the created SA.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_cfg {
 	/* IPsec SA Protocol - AH/ESP */
 	u8 virtchnl_protocol_type;
@@ -298,6 +303,7 @@ struct virtchnl_ipsec_sa_cfg {
  * VF send configuration of index of SA to PF
  * PF will update SA according to configuration
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_update {
 	u32 sa_index; /* SA to update */
 	u32 esn_hi; /* high 32 bits of esn */
@@ -310,6 +316,7 @@ struct virtchnl_ipsec_sa_update {
  * flag bitmap indicate all SA or just selected SA will
  * be destroyed
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_destroy {
 	/* All zero bitmap indicates all SA will be destroyed.
 	 * Non-zero bitmap indicates the selected SA in
@@ -325,6 +332,7 @@ struct virtchnl_ipsec_sa_destroy {
  * VF send this SA configuration to PF using virtchnl;
  * PF read SA and will return configuration for the created SA.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_read {
 	/* SA valid - invalid/valid */
 	u8 valid;
@@ -431,6 +439,7 @@ struct virtchnl_ipsec_sa_read {
 #define VIRTCHNL_IPSEC_INBOUND_SPD_TBL_IPV6	(1)
 
 /* Add allowlist entry in IES */
+__rte_msvc_pack
 struct virtchnl_ipsec_sp_cfg {
 	u32 spi;
 	u32 dip[4];
@@ -459,6 +468,7 @@ struct virtchnl_ipsec_sp_cfg {
 
 
 /* Delete allowlist entry in IES */
+__rte_msvc_pack
 struct virtchnl_ipsec_sp_destroy {
 	/* 0 for IPv4 table, 1 for IPv6 table. */
 	u8 table_id;
@@ -494,6 +504,7 @@ struct virtchnl_ipsec_resp {
 };
 
 /* Internal message descriptor for VF <-> IPsec communication */
+__rte_msvc_pack
 struct inline_ipsec_msg {
 	u16 ipsec_opcode;
 	u16 req_id;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 05/15] common/idpf: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 04/15] common/iavf: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 06/15] common/mlx5: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/idpf/base/idpf_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h
index 74a376c..f5fcdc3 100644
--- a/drivers/common/idpf/base/idpf_osdep.h
+++ b/drivers/common/idpf/base/idpf_osdep.h
@@ -180,6 +180,7 @@ static inline uint64_t idpf_read_addr64(volatile void *addr)
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct idpf_dma_mem {
 	void *va;
 	u64 pa;
@@ -187,6 +188,7 @@ struct idpf_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct idpf_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 06/15] common/mlx5: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 05/15] common/idpf: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 07/15] dma/ioat: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/mlx5/mlx5_common_mr.h    |  4 ++++
 drivers/common/mlx5/mlx5_common_utils.h |  1 +
 drivers/common/mlx5/mlx5_prm.h          | 28 ++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h
index 8789d40..4f4bd73 100644
--- a/drivers/common/mlx5/mlx5_common_mr.h
+++ b/drivers/common/mlx5/mlx5_common_mr.h
@@ -49,6 +49,7 @@ struct mlx5_mr {
 };
 
 /* Cache entry for Memory Region. */
+__rte_msvc_pack
 struct mr_cache_entry {
 	uintptr_t start; /* Start address of MR. */
 	uintptr_t end; /* End address of MR. */
@@ -56,6 +57,7 @@ struct mr_cache_entry {
 } __rte_packed;
 
 /* MR Cache table for Binary search. */
+__rte_msvc_pack
 struct mlx5_mr_btree {
 	uint32_t len; /* Number of entries. */
 	uint32_t size; /* Total number of entries. */
@@ -65,6 +67,7 @@ struct mlx5_mr_btree {
 struct mlx5_common_device;
 
 /* Per-queue MR control descriptor. */
+__rte_msvc_pack
 struct mlx5_mr_ctrl {
 	uint32_t *dev_gen_ptr; /* Generation number of device to poll. */
 	uint32_t cur_gen; /* Generation number saved to flush caches. */
@@ -78,6 +81,7 @@ struct mlx5_mr_ctrl {
 LIST_HEAD(mlx5_mempool_reg_list, mlx5_mempool_reg);
 
 /* Global per-device MR cache. */
+__rte_msvc_pack
 struct mlx5_mr_share_cache {
 	uint32_t dev_gen; /* Generation number to flush local caches. */
 	rte_rwlock_t rwlock; /* MR cache Lock. */
diff --git a/drivers/common/mlx5/mlx5_common_utils.h b/drivers/common/mlx5/mlx5_common_utils.h
index ae15119..a44975c 100644
--- a/drivers/common/mlx5/mlx5_common_utils.h
+++ b/drivers/common/mlx5/mlx5_common_utils.h
@@ -27,6 +27,7 @@
  * Structure of the entry in the mlx5 list, user should define its own struct
  * that contains this in order to store the data.
  */
+__rte_msvc_pack
 struct mlx5_list_entry {
 	LIST_ENTRY(mlx5_list_entry) next; /* Entry pointers in the list. */
 	uint32_t ref_cnt __rte_aligned(8); /* 0 means, entry is invalid. */
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index c671c75..bf9ecd1 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -319,6 +319,7 @@ enum mlx5_mpw_mode {
 };
 
 /* WQE Control segment. */
+__rte_msvc_pack
 struct mlx5_wqe_cseg {
 	uint32_t opcode;
 	uint32_t sq_ds;
@@ -336,10 +337,12 @@ struct mlx5_wqe_cseg {
 #define WQE_CSEG_WQE_INDEX_OFFSET	 8
 
 /* Header of data segment. Minimal size Data Segment */
+__rte_msvc_pack
 struct mlx5_wqe_dseg {
 	uint32_t bcount;
 	union {
 		uint8_t inline_data[MLX5_DSEG_MIN_INLINE_SIZE];
+		__rte_msvc_pack
 		struct {
 			uint32_t lkey;
 			uint64_t pbuf;
@@ -348,8 +351,10 @@ struct mlx5_wqe_dseg {
 } __rte_packed;
 
 /* Subset of struct WQE Ethernet Segment. */
+__rte_msvc_pack
 struct mlx5_wqe_eseg {
 	union {
+		__rte_msvc_pack
 		struct {
 			uint32_t swp_offs;
 			uint8_t	cs_flags;
@@ -362,6 +367,7 @@ struct mlx5_wqe_eseg {
 				uint16_t vlan_tag;
 			};
 		} __rte_packed;
+		__rte_msvc_pack
 		struct {
 			uint32_t offsets;
 			uint32_t flags;
@@ -371,6 +377,7 @@ struct mlx5_wqe_eseg {
 	};
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_qseg {
 	uint32_t reserved0;
 	uint32_t reserved1;
@@ -378,6 +385,7 @@ struct mlx5_wqe_qseg {
 	uint32_t qpn_cqn;
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_wseg {
 	uint32_t operation;
 	uint32_t lkey;
@@ -388,6 +396,7 @@ struct mlx5_wqe_wseg {
 } __rte_packed;
 
 /* The title WQEBB, header of WQE. */
+__rte_msvc_pack
 struct mlx5_wqe {
 	union {
 		struct mlx5_wqe_cseg cseg;
@@ -437,6 +446,7 @@ struct mlx5_cqe {
 	uint8_t lro_num_seg;
 	union {
 		uint8_t user_index_bytes[3];
+		__rte_msvc_pack
 		struct {
 			uint8_t user_index_hi;
 			uint16_t user_index_low;
@@ -460,6 +470,7 @@ struct mlx5_cqe_ts {
 	uint8_t op_own;
 };
 
+__rte_msvc_pack
 struct mlx5_wqe_rseg {
 	uint64_t raddr;
 	uint32_t rkey;
@@ -479,6 +490,7 @@ struct mlx5_wqe_rseg {
 #define MLX5_UMR_KLM_NUM_ALIGN \
 	(MLX5_UMR_KLM_PTR_ALIGN / sizeof(struct mlx5_klm))
 
+__rte_msvc_pack
 struct mlx5_wqe_umr_cseg {
 	uint32_t if_cf_toe_cq_res;
 	uint32_t ko_to_bs;
@@ -486,6 +498,7 @@ struct mlx5_wqe_umr_cseg {
 	uint32_t rsvd1[8];
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_mkey_cseg {
 	uint32_t fr_res_af_sf;
 	uint32_t qpn_mkey;
@@ -549,6 +562,7 @@ enum {
 #define MLX5_CRYPTO_MMO_TYPE_OFFSET 24
 #define MLX5_CRYPTO_MMO_OP_OFFSET 20
 
+__rte_msvc_pack
 struct mlx5_wqe_umr_bsf_seg {
 	/*
 	 * bs_bpt_eo_es contains:
@@ -582,6 +596,7 @@ struct mlx5_wqe_umr_bsf_seg {
 #pragma GCC diagnostic ignored "-Wpedantic"
 #endif
 
+__rte_msvc_pack
 struct mlx5_umr_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_umr_cseg ucseg;
@@ -592,18 +607,21 @@ struct mlx5_umr_wqe {
 	};
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_rdma_write_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_rseg rseg;
 	struct mlx5_wqe_dseg dseg[];
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_send_en_seg {
 	uint32_t reserve[2];
 	uint32_t sqnpc;
 	uint32_t qpn;
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_send_en_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_send_en_seg sseg;
@@ -650,6 +668,7 @@ struct mlx5_wqe_metadata_seg {
 	uint64_t addr;
 };
 
+__rte_msvc_pack
 struct mlx5_gga_wqe {
 	uint32_t opcode;
 	uint32_t sq_ds;
@@ -663,16 +682,19 @@ struct mlx5_gga_wqe {
 } __rte_packed;
 
 union mlx5_gga_compress_opaque {
+	__rte_msvc_pack
 	struct {
 		uint32_t syndrome;
 		uint32_t reserved0;
 		uint32_t scattered_length;
 		union {
+			__rte_msvc_pack
 			struct {
 				uint32_t reserved1[5];
 				uint32_t crc32;
 				uint32_t adler32;
 			} v1 __rte_packed;
+			__rte_msvc_pack
 			struct {
 				uint32_t crc32;
 				uint32_t adler32;
@@ -685,9 +707,11 @@ struct mlx5_gga_wqe {
 };
 
 union mlx5_gga_crypto_opaque {
+	__rte_msvc_pack
 	struct {
 		uint32_t syndrome;
 		uint32_t reserved0[2];
+		__rte_msvc_pack
 		struct {
 			uint32_t iv[3];
 			uint32_t tag_size;
@@ -4134,6 +4158,7 @@ enum mlx5_aso_op {
 #define MLX5_ASO_CSEG_READ_ENABLE 1
 
 /* ASO WQE CTRL segment. */
+__rte_msvc_pack
 struct mlx5_aso_cseg {
 	uint32_t va_h;
 	uint32_t va_l_r;
@@ -4150,6 +4175,7 @@ struct mlx5_aso_cseg {
 #define MLX5_MTR_MAX_TOKEN_VALUE INT32_MAX
 
 /* A meter data segment - 2 per ASO WQE. */
+__rte_msvc_pack
 struct mlx5_aso_mtr_dseg {
 	uint32_t v_bo_sc_bbog_mm;
 	/*
@@ -4191,6 +4217,7 @@ struct mlx5_aso_mtr_dseg {
 #define MLX5_ASO_MTRS_PER_POOL 128
 
 /* ASO WQE data segment. */
+__rte_msvc_pack
 struct mlx5_aso_dseg {
 	union {
 		uint8_t data[MLX5_ASO_WQE_DSEG_SIZE];
@@ -4199,6 +4226,7 @@ struct mlx5_aso_dseg {
 } __rte_packed;
 
 /* ASO WQE. */
+__rte_msvc_pack
 struct mlx5_aso_wqe {
 	struct mlx5_wqe_cseg general_cseg;
 	struct mlx5_aso_cseg aso_cseg;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 07/15] dma/ioat: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 06/15] common/mlx5: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 08/15] net/i40e: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/dma/ioat/ioat_hw_defs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/ioat/ioat_hw_defs.h b/drivers/dma/ioat/ioat_hw_defs.h
index dc3493a..6e32807 100644
--- a/drivers/dma/ioat/ioat_hw_defs.h
+++ b/drivers/dma/ioat/ioat_hw_defs.h
@@ -52,6 +52,7 @@
 #define	IOAT_DMACAP_PQ		(1 << 9)
 #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
 
+__rte_msvc_pack
 struct ioat_registers {
 	uint8_t		chancnt;
 	uint8_t		xfercap;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 08/15] net/i40e: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 07/15] dma/ioat: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 09/15] net/iavf: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/i40e/base/i40e_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index aa5dc61..28439e3 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -177,6 +177,7 @@ static inline uint64_t i40e_read64_addr(volatile void *addr)
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct i40e_dma_mem {
 	void *va;
 	u64 pa;
@@ -188,6 +189,7 @@ struct i40e_dma_mem {
 			i40e_allocate_dma_mem_d(h, m, s, a)
 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
 
+__rte_msvc_pack
 struct i40e_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 09/15] net/iavf: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 08/15] net/i40e: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 10/15] net/ice: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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(-)

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 {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 10/15] net/ice: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 09/15] net/iavf: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 11/15] net/mlx5: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ice/base/ice_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 0e14b93..087dc6a 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -187,6 +187,7 @@
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct ice_dma_mem {
 	void *va;
 	u64 pa;
@@ -194,6 +195,7 @@ struct ice_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct ice_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 11/15] net/mlx5: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 10/15] net/ice: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 12/15] net/octeon_ep: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/hws/mlx5dr.h   | 1 +
 drivers/net/mlx5/mlx5.h         | 1 +
 drivers/net/mlx5/mlx5_flow.h    | 5 +++++
 drivers/net/mlx5/mlx5_hws_cnt.h | 1 +
 drivers/net/mlx5/mlx5_utils.h   | 4 ++++
 5 files changed, 12 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 80e118a..cd5bb05 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -300,6 +300,7 @@ struct mlx5dr_action_dest_attr {
 	};
 };
 
+__rte_msvc_pack
 struct mlx5dr_crc_encap_entropy_hash_fields {
 	union mlx5dr_crc_encap_entropy_hash_ip_field dst;
 	union mlx5dr_crc_encap_entropy_hash_ip_field src;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 0091a24..6228ee8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -221,6 +221,7 @@ struct mlx5_dev_spawn_data {
 }
 
 /** Data associated with socket messages. */
+__rte_msvc_pack
 struct mlx5_flow_dump_req  {
 	uint32_t port_id; /**< There are plans in DPDK to extend port_id. */
 	uint64_t flow_id;
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 0065727..da0f8b7 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -658,6 +658,7 @@ struct mlx5_flow_dv_tag_resource {
 };
 
 /* Modify resource structure */
+__rte_msvc_pack
 struct mlx5_flow_dv_modify_hdr_resource {
 	struct mlx5_list_entry entry;
 	void *action; /**< Modify header action object. */
@@ -812,6 +813,7 @@ struct mlx5_flow_dv_dest_array_resource {
 
 
 /** Device flow handle structure for DV mode only. */
+__rte_msvc_pack
 struct mlx5_flow_handle_dv {
 	/* Flow DV api: */
 	struct mlx5_flow_dv_matcher *matcher; /**< Cache to matcher. */
@@ -830,6 +832,7 @@ struct mlx5_flow_handle_dv {
 } __rte_packed;
 
 /** Device flow handle structure: used both for creating & destroying. */
+__rte_msvc_pack
 struct mlx5_flow_handle {
 	SILIST_ENTRY(uint32_t)next;
 	struct mlx5_vf_vlan vf_vlan; /**< Structure for VF VLAN workaround. */
@@ -1231,6 +1234,7 @@ struct mlx5_flow_attr {
 };
 
 /* Flow structure. */
+__rte_msvc_pack
 struct rte_flow {
 	uint32_t dev_handles;
 	/**< Device flow handles that are part of the flow. */
@@ -1304,6 +1308,7 @@ enum {
 #endif
 
 /** HWS flow struct. */
+__rte_msvc_pack
 struct rte_flow_hw {
 	/** The table flow allcated from. */
 	struct rte_flow_template_table *table;
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h
index e005960..1f53a1a 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.h
+++ b/drivers/net/mlx5/mlx5_hws_cnt.h
@@ -133,6 +133,7 @@ enum {
 };
 
 /* HWS counter age parameter. */
+__rte_msvc_pack
 struct mlx5_hws_age_param {
 	uint32_t timeout; /* Aging timeout in seconds (atomically accessed). */
 	uint32_t sec_since_last_hit;
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index f3c0d76..cf80e5e 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -118,6 +118,7 @@ struct mlx5_l3t_level_tbl {
 };
 
 /* L3 word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_word {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -128,6 +129,7 @@ struct mlx5_l3t_entry_word {
 } __rte_packed;
 
 /* L3 double word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_dword {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -138,6 +140,7 @@ struct mlx5_l3t_entry_dword {
 } __rte_packed;
 
 /* L3 quad word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_qword {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -148,6 +151,7 @@ struct mlx5_l3t_entry_qword {
 } __rte_packed;
 
 /* L3 pointer entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_ptr {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 12/15] net/octeon_ep: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 11/15] net/mlx5: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 13/15] app/testpmd: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/octeon_ep/otx_ep_mbox.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/octeon_ep/otx_ep_mbox.h b/drivers/net/octeon_ep/otx_ep_mbox.h
index a3fc15c..005fce3 100644
--- a/drivers/net/octeon_ep/otx_ep_mbox.h
+++ b/drivers/net/octeon_ep/otx_ep_mbox.h
@@ -70,6 +70,7 @@ enum otx_ep_link_autoneg {
 #define OTX_EP_MBOX_MORE_FRAG_FLAG 1
 #define OTX_EP_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1)
 
+__rte_msvc_pack
 union otx_ep_mbox_word {
 	uint64_t u64;
 	struct {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 13/15] app/testpmd: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 12/15] net/octeon_ep: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 14/15] app/test: " Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 15/15] examples: " Tyler Retzlaff
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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>
---
 app/test-pmd/csumonly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 6711dda..f24c381 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -92,7 +92,7 @@ struct testpmd_offload_info {
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
-} __rte_packed;
+};
 
 static uint16_t
 get_udptcp_checksum(struct rte_mbuf *m, void *l3_hdr, uint16_t l4_off,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 14/15] app/test: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 13/15] app/testpmd: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  2024-03-27 23:09   ` [PATCH v2 15/15] examples: " Tyler Retzlaff
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test/test_efd.c    | 1 +
 app/test/test_hash.c   | 1 +
 app/test/test_member.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/app/test/test_efd.c b/app/test/test_efd.c
index 1c0986b..df176a0 100644
--- a/app/test/test_efd.c
+++ b/app/test/test_efd.c
@@ -33,6 +33,7 @@
 static unsigned int test_socket_id;
 
 /* 5-tuple key type */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index d586878..08c1773 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -79,6 +79,7 @@
  * Should be packed to avoid holes with potentially
  * undefined content in the middle.
  */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
diff --git a/app/test/test_member.c b/app/test/test_member.c
index 5a4d275..ccd481a 100644
--- a/app/test/test_member.c
+++ b/app/test/test_member.c
@@ -32,6 +32,7 @@
 struct rte_member_setsum *setsum_sketch;
 
 /* 5-tuple key type */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v2 15/15] examples: pack structures when building with MSVC
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-03-27 23:09   ` [PATCH v2 14/15] app/test: " Tyler Retzlaff
@ 2024-03-27 23:09   ` Tyler Retzlaff
  14 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 23:09 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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>
---
 examples/common/neon/port_group.h |  1 +
 examples/ip_pipeline/cli.c        | 10 +++++-----
 examples/ipsec-secgw/ipsec.h      |  1 +
 examples/l3fwd-power/main.c       |  2 ++
 examples/ptpclient/ptpclient.c    |  8 ++++++++
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/examples/common/neon/port_group.h b/examples/common/neon/port_group.h
index 421e2e8..bd40590 100644
--- a/examples/common/neon/port_group.h
+++ b/examples/common/neon/port_group.h
@@ -21,6 +21,7 @@
 port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
 		  uint16x8_t dp2)
 {
+	__rte_msvc_pack
 	union {
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index e8269ea..aad6c78 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -2571,7 +2571,7 @@ struct pkt_key_qinq {
 	uint16_t svlan;
 	uint16_t ethertype_cvlan;
 	uint16_t cvlan;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_5tuple {
 	uint8_t time_to_live;
@@ -2581,7 +2581,7 @@ struct pkt_key_ipv4_5tuple {
 	uint32_t da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_5tuple {
 	uint16_t payload_length;
@@ -2591,15 +2591,15 @@ struct pkt_key_ipv6_5tuple {
 	uint8_t da[16];
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_addr {
 	uint32_t addr;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_addr {
 	uint8_t addr[16];
-} __rte_packed;
+};
 
 static uint32_t
 parse_match(char **tokens,
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index bdcada1..bdc6045 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -277,6 +277,7 @@ struct socket_ctx {
 	struct rte_mempool *session_pool;
 };
 
+__rte_msvc_pack
 struct cnt_blk {
 	uint32_t salt;
 	uint64_t iv;
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index f4adcf4..a3be37b 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -278,6 +278,7 @@ struct lcore_rx_queue {
 #define DEFAULT_HASH_FUNC       rte_jhash
 #endif
 
+__rte_msvc_pack
 struct ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
@@ -286,6 +287,7 @@ struct ipv4_5tuple {
 	uint8_t  proto;
 } __rte_packed;
 
+__rte_msvc_pack
 struct ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index afb61bb..cdd73fd 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -56,6 +56,7 @@
 };
 
 /* Structs used for PTP handling. */
+__rte_msvc_pack
 struct tstamp {
 	uint16_t   sec_msb;
 	uint32_t   sec_lsb;
@@ -66,11 +67,13 @@ struct clock_id {
 	uint8_t id[8];
 };
 
+__rte_msvc_pack
 struct port_id {
 	struct clock_id        clock_id;
 	uint16_t               port_number;
 }  __rte_packed;
 
+__rte_msvc_pack
 struct ptp_header {
 	uint8_t              msg_type;
 	uint8_t              ver;
@@ -86,22 +89,26 @@ struct ptp_header {
 	int8_t               log_message_interval;
 } __rte_packed;
 
+__rte_msvc_pack
 struct sync_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct follow_up_msg {
 	struct ptp_header   hdr;
 	struct tstamp       precise_origin_tstamp;
 	uint8_t             suffix[];
 } __rte_packed;
 
+__rte_msvc_pack
 struct delay_req_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct delay_resp_msg {
 	struct ptp_header    hdr;
 	struct tstamp        rx_tstamp;
@@ -110,6 +117,7 @@ struct delay_resp_msg {
 } __rte_packed;
 
 struct ptp_message {
+	__rte_msvc_pack
 	union {
 		struct ptp_header          header;
 		struct sync_msg            sync;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 00/16] fix packing of structs when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (16 preceding siblings ...)
  2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
@ 2024-04-15 23:51 ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
                     ` (15 more replies)
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
  18 siblings, 16 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

MSVC struct packing is not compatible with GCC provide a macro that can
be used to push existing pack value and sets packing to 1-byte. The
existing __rte_packed macro is then used to restore the pack value
prior to the push.

Instead of providing macros exclusively for MSVC and for GCC the
existing macro is deliberately utilized to trigger a warning if no
existing packing has been pushed allowing easy identification of
locations where the __rte_msvc_pack is missing.

I've decided to only add the macro to packed structs that are built
for Windows. It seems there is little value in adding the macro tree
wide and if new code arrives that is built on Windows the __rte_packed
will flag where the preamble macro is required.

If as a part of review maintainers identify structs they believe
don't require packing so long as they are explicitly identified
i'll remove the __rte_packed as a part of this series.

v3:
  * add missing __rte_msvc_pack to crypto/mlx5
  * fix commit messages to reference __rte_msvc_pack macro instead
    of __rte_msvc_pushpack(1)

v2:
  * app/testpmd, remove packing from simple_gre_hdr
  * net/iavf, remove packing from iavf_ipsec_crypto_pkt_metadata,
    simple_gre_hdr
  * examples, remove packing from pkt_key_qinq, pkt_key_ipv4_5tuple,
    pkt_key_ipv6_5tuple, pkt_key_ipv4_addr, pkt_key_ipv6_addr
  * eal, remove packing from rte_config, __rte_trace_stream_header

Tyler Retzlaff (16):
  eal: provide pack start macro for MSVC
  eal: pack structures when building with MSVC
  net: pack structures when building with MSVC
  common/iavf: pack structures when building with MSVC
  common/idpf: pack structures when building with MSVC
  common/mlx5: pack structures when building with MSVC
  dma/ioat: pack structures when building with MSVC
  net/i40e: pack structures when building with MSVC
  net/iavf: pack structures when building with MSVC
  net/ice: pack structures when building with MSVC
  net/mlx5: pack structures when building with MSVC
  net/octeon_ep: pack structures when building with MSVC
  app/testpmd: pack structures when building with MSVC
  app/test: pack structures when building with MSVC
  examples: pack structures when building with MSVC
  crypto/mlx5: pack structures when building with MSVC

 app/test-pmd/csumonly.c                     |  2 +-
 app/test/test_efd.c                         |  1 +
 app/test/test_hash.c                        |  1 +
 app/test/test_member.c                      |  1 +
 drivers/common/iavf/iavf_osdep.h            |  2 ++
 drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++
 drivers/common/idpf/base/idpf_osdep.h       |  2 ++
 drivers/common/mlx5/mlx5_common_mr.h        |  4 ++++
 drivers/common/mlx5/mlx5_common_utils.h     |  1 +
 drivers/common/mlx5/mlx5_prm.h              | 28 ++++++++++++++++++++++++++++
 drivers/crypto/mlx5/mlx5_crypto.h           |  1 +
 drivers/dma/ioat/ioat_hw_defs.h             |  1 +
 drivers/net/i40e/base/i40e_osdep.h          |  2 ++
 drivers/net/iavf/iavf_ipsec_crypto.h        |  4 +++-
 drivers/net/iavf/iavf_rxtx.c                |  2 +-
 drivers/net/ice/base/ice_osdep.h            |  2 ++
 drivers/net/mlx5/hws/mlx5dr.h               |  1 +
 drivers/net/mlx5/mlx5.h                     |  1 +
 drivers/net/mlx5/mlx5_flow.h                |  5 +++++
 drivers/net/mlx5/mlx5_hws_cnt.h             |  1 +
 drivers/net/mlx5/mlx5_utils.h               |  4 ++++
 drivers/net/octeon_ep/otx_ep_mbox.h         |  1 +
 examples/common/neon/port_group.h           |  1 +
 examples/ip_pipeline/cli.c                  | 10 +++++-----
 examples/ipsec-secgw/ipsec.h                |  1 +
 examples/l3fwd-power/main.c                 |  2 ++
 examples/ptpclient/ptpclient.c              |  8 ++++++++
 lib/eal/common/eal_private.h                |  2 +-
 lib/eal/include/rte_common.h                |  4 +++-
 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 +++
 lib/net/rte_arp.h                           |  2 ++
 lib/net/rte_dtls.h                          |  1 +
 lib/net/rte_esp.h                           |  2 ++
 lib/net/rte_ether.h                         |  1 +
 lib/net/rte_geneve.h                        |  1 +
 lib/net/rte_gre.h                           |  4 ++++
 lib/net/rte_gtp.h                           |  5 +++++
 lib/net/rte_ib.h                            |  1 +
 lib/net/rte_icmp.h                          |  3 +++
 lib/net/rte_ip.h                            |  4 ++++
 lib/net/rte_l2tpv2.h                        |  4 ++++
 lib/net/rte_macsec.h                        |  2 ++
 lib/net/rte_mpls.h                          |  1 +
 lib/net/rte_pdcp_hdr.h                      |  4 ++++
 lib/net/rte_ppp.h                           |  1 +
 lib/net/rte_sctp.h                          |  1 +
 lib/net/rte_tcp.h                           |  1 +
 lib/net/rte_tls.h                           |  1 +
 lib/net/rte_udp.h                           |  1 +
 lib/net/rte_vxlan.h                         |  2 ++
 53 files changed, 144 insertions(+), 11 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 01/16] eal: provide pack start macro for MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
                     ` (14 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

MSVC struct packing is not compatible with GCC provide a macro that can
be used to push existing pack value and sets packing to 1-byte. The
existing __rte_packed macro is then used to restore the pack value
prior to the push.

Instead of providing macros exclusively for MSVC and for GCC the
existing macro is deliberately utilized to trigger a warning if no
existing packing has been pushed allowing easy identification of
locations where the __rte_msvc_pack is missing.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_common.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 298a5c6..44825ed 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -97,8 +97,10 @@
  * Force a structure to be packed
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_packed
+#define __rte_msvc_pack __pragma(pack(push, 1))
+#define __rte_packed __pragma(pack(pop))
 #else
+#define __rte_msvc_pack
 #define __rte_packed __attribute__((__packed__))
 #endif
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 02/16] eal: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 03/16] net: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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(-)

diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 71523cf..4c929fb 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -62,7 +62,7 @@ struct rte_config {
 	 * DPDK instances
 	 */
 	struct rte_mem_config *mem_config;
-} __rte_packed;
+};
 
 /**
  * Get the global configuration structure.
diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h
index 842362d..73bb00d 100644
--- a/lib/eal/include/rte_memory.h
+++ b/lib/eal/include/rte_memory.h
@@ -46,6 +46,7 @@
 /**
  * Physical memory segment descriptor.
  */
+__rte_msvc_pack
 struct rte_memseg {
 	rte_iova_t iova;            /**< Start IO address. */
 	union {
diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h
index 931497f..ca312c0 100644
--- a/lib/eal/include/rte_memzone.h
+++ b/lib/eal/include/rte_memzone.h
@@ -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.*/
diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h
index 41e2a7f..e786ee3 100644
--- a/lib/eal/include/rte_trace_point.h
+++ b/lib/eal/include/rte_trace_point.h
@@ -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;
diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h
index 72a9229..fdc5df0 100644
--- a/lib/eal/x86/include/rte_memcpy.h
+++ b/lib/eal/x86/include/rte_memcpy.h
@@ -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;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 03/16] net: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 04/16] common/iavf: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/net/rte_arp.h      | 2 ++
 lib/net/rte_dtls.h     | 1 +
 lib/net/rte_esp.h      | 2 ++
 lib/net/rte_ether.h    | 1 +
 lib/net/rte_geneve.h   | 1 +
 lib/net/rte_gre.h      | 4 ++++
 lib/net/rte_gtp.h      | 5 +++++
 lib/net/rte_ib.h       | 1 +
 lib/net/rte_icmp.h     | 3 +++
 lib/net/rte_ip.h       | 4 ++++
 lib/net/rte_l2tpv2.h   | 4 ++++
 lib/net/rte_macsec.h   | 2 ++
 lib/net/rte_mpls.h     | 1 +
 lib/net/rte_pdcp_hdr.h | 4 ++++
 lib/net/rte_ppp.h      | 1 +
 lib/net/rte_sctp.h     | 1 +
 lib/net/rte_tcp.h      | 1 +
 lib/net/rte_tls.h      | 1 +
 lib/net/rte_udp.h      | 1 +
 lib/net/rte_vxlan.h    | 2 ++
 20 files changed, 42 insertions(+)

diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h
index 668cea1..35d68c1 100644
--- a/lib/net/rte_arp.h
+++ b/lib/net/rte_arp.h
@@ -21,6 +21,7 @@
 /**
  * ARP header IPv4 payload.
  */
+__rte_msvc_pack
 struct __rte_aligned(2) rte_arp_ipv4 {
 	struct rte_ether_addr arp_sha;  /**< sender hardware address */
 	rte_be32_t            arp_sip;  /**< sender IP address */
@@ -31,6 +32,7 @@ struct __rte_aligned(2) rte_arp_ipv4 {
 /**
  * ARP header.
  */
+__rte_msvc_pack
 struct __rte_aligned(2) rte_arp_hdr {
 	rte_be16_t arp_hardware; /**< format of hardware address */
 #define RTE_ARP_HRD_ETHER     1  /**< ARP Ethernet address format */
diff --git a/lib/net/rte_dtls.h b/lib/net/rte_dtls.h
index 4f541df..0c75b06 100644
--- a/lib/net/rte_dtls.h
+++ b/lib/net/rte_dtls.h
@@ -34,6 +34,7 @@
  * DTLS Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_dtls_hdr {
 	/** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */
 	uint8_t type;
diff --git a/lib/net/rte_esp.h b/lib/net/rte_esp.h
index 464c513..27c9287 100644
--- a/lib/net/rte_esp.h
+++ b/lib/net/rte_esp.h
@@ -20,6 +20,7 @@
 /**
  * ESP Header
  */
+__rte_msvc_pack
 struct rte_esp_hdr {
 	rte_be32_t spi;  /**< Security Parameters Index */
 	rte_be32_t seq;  /**< packet sequence number */
@@ -28,6 +29,7 @@ struct rte_esp_hdr {
 /**
  * ESP Trailer
  */
+__rte_msvc_pack
 struct rte_esp_tail {
 	uint8_t pad_len;     /**< number of pad bytes (0-255) */
 	uint8_t next_proto;  /**< IPv4 or IPv6 or next layer header */
diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h
index 32ed515..354e3a5 100644
--- a/lib/net/rte_ether.h
+++ b/lib/net/rte_ether.h
@@ -301,6 +301,7 @@ struct __rte_aligned(2) rte_ether_hdr {
  * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type
  * of the encapsulated frame.
  */
+__rte_msvc_pack
 struct rte_vlan_hdr {
 	rte_be16_t vlan_tci;  /**< Priority (3) + CFI (1) + Identifier Code (12) */
 	rte_be16_t eth_proto; /**< Ethernet type of encapsulated frame. */
diff --git a/lib/net/rte_geneve.h b/lib/net/rte_geneve.h
index 3bbc561..5c02526 100644
--- a/lib/net/rte_geneve.h
+++ b/lib/net/rte_geneve.h
@@ -38,6 +38,7 @@
  * More-bits (optional) variable length options.
  */
 __extension__
+__rte_msvc_pack
 struct rte_geneve_hdr {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t ver:2;		/**< Version. */
diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h
index 8da8027..77882e7 100644
--- a/lib/net/rte_gre.h
+++ b/lib/net/rte_gre.h
@@ -27,6 +27,7 @@
  * GRE Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_gre_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint16_t res2:4; /**< Reserved */
@@ -51,6 +52,7 @@ struct rte_gre_hdr {
 /**
  * Optional field checksum in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_checksum_rsvd {
 	rte_be16_t checksum;
 	rte_be16_t reserved1;
@@ -59,6 +61,7 @@ struct rte_gre_hdr_opt_checksum_rsvd {
 /**
  * Optional field key in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_key {
 	rte_be32_t key;
 } __rte_packed;
@@ -66,6 +69,7 @@ struct rte_gre_hdr_opt_key {
 /**
  * Optional field sequence in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_sequence {
 	rte_be32_t sequence;
 } __rte_packed;
diff --git a/lib/net/rte_gtp.h b/lib/net/rte_gtp.h
index 9849872..26fc80a 100644
--- a/lib/net/rte_gtp.h
+++ b/lib/net/rte_gtp.h
@@ -28,6 +28,7 @@
  * No optional fields and next extension header.
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_hdr {
 	union {
 		uint8_t gtp_hdr_info; /**< GTP header info */
@@ -55,6 +56,7 @@ struct rte_gtp_hdr {
 } __rte_packed;
 
 /* Optional word of GTP header, present if any of E, S, PN is set. */
+__rte_msvc_pack
 struct rte_gtp_hdr_ext_word {
 	rte_be16_t sqn;	      /**< Sequence Number. */
 	uint8_t npdu;	      /**< N-PDU number. */
@@ -66,6 +68,7 @@ struct rte_gtp_hdr_ext_word {
  * defined based on RFC 38415-g30.
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_generic_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -89,6 +92,7 @@ struct rte_gtp_psc_generic_hdr {
  * type0 defined based on RFC 38415-g30
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_type0_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -116,6 +120,7 @@ struct rte_gtp_psc_type0_hdr {
  * type1 defined based on RFC 38415-g30
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_type1_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
diff --git a/lib/net/rte_ib.h b/lib/net/rte_ib.h
index 9eab5f9..c4c5d39 100644
--- a/lib/net/rte_ib.h
+++ b/lib/net/rte_ib.h
@@ -26,6 +26,7 @@
  * IB Specification Vol 1-Release-1.4.
  */
 __extension__
+__rte_msvc_pack
 struct rte_ib_bth {
 	uint8_t	opcode;		/**< Opcode. */
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
diff --git a/lib/net/rte_icmp.h b/lib/net/rte_icmp.h
index 4bf64d7..e865db4 100644
--- a/lib/net/rte_icmp.h
+++ b/lib/net/rte_icmp.h
@@ -25,6 +25,7 @@
 /**
  * ICMP base header
  */
+__rte_msvc_pack
 struct rte_icmp_base_hdr {
 	uint8_t type;
 	uint8_t code;
@@ -34,6 +35,7 @@ struct rte_icmp_base_hdr {
 /**
  * ICMP echo header
  */
+__rte_msvc_pack
 struct rte_icmp_echo_hdr {
 	struct rte_icmp_base_hdr base;
 	rte_be16_t identifier;
@@ -45,6 +47,7 @@ struct rte_icmp_echo_hdr {
  *
  * @see rte_icmp_echo_hdr which is similar.
  */
+__rte_msvc_pack
 struct rte_icmp_hdr {
 	uint8_t  icmp_type;     /* ICMP packet type. */
 	uint8_t  icmp_code;     /* ICMP packet code. */
diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 0d103d4..908a25c 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -38,6 +38,7 @@
 /**
  * IPv4 Header
  */
+__rte_msvc_pack
 struct rte_ipv4_hdr {
 	__extension__
 	union {
@@ -523,6 +524,7 @@ struct rte_ipv4_hdr {
 /**
  * IPv6 Header
  */
+__rte_msvc_pack
 struct rte_ipv6_hdr {
 	rte_be32_t vtc_flow;	/**< IP version, traffic class & flow label. */
 	rte_be16_t payload_len;	/**< IP payload size, including ext. headers */
@@ -538,6 +540,7 @@ struct rte_ipv6_hdr {
 /**
  * IPv6 Routing Extension Header
  */
+__rte_msvc_pack
 struct rte_ipv6_routing_ext {
 	uint8_t next_hdr;			/**< Protocol, next header. */
 	uint8_t hdr_len;			/**< Header length. */
@@ -783,6 +786,7 @@ struct rte_ipv6_routing_ext {
 #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
 	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
 
+__rte_msvc_pack
 struct rte_ipv6_fragment_ext {
 	uint8_t next_header;	/**< Next header type */
 	uint8_t reserved;	/**< Reserved */
diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 9cda347..a917013 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -129,6 +129,7 @@ struct rte_l2tpv2_common_hdr {
  * L2TPv2 message Header contains all options(length, ns, nr,
  * offset size, offset padding).
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_with_all_options {
 	rte_be16_t length;		/**< length(16) */
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
@@ -143,6 +144,7 @@ struct rte_l2tpv2_msg_with_all_options {
  * L2TPv2 message Header contains all options except length(ns, nr,
  * offset size, offset padding).
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_without_length {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -180,6 +182,7 @@ struct rte_l2tpv2_msg_without_offset {
 /**
  * L2TPv2 message Header contains options offset size and offset padding.
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_with_offset {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -217,6 +220,7 @@ struct rte_l2tpv2_msg_without_all_options {
 /**
  * L2TPv2 Combined Message Header Format: Common Header + Options
  */
+__rte_msvc_pack
 struct rte_l2tpv2_combined_msg_hdr {
 	struct rte_l2tpv2_common_hdr common; /**< common header */
 	union {
diff --git a/lib/net/rte_macsec.h b/lib/net/rte_macsec.h
index d0cd2f6..54de1bd 100644
--- a/lib/net/rte_macsec.h
+++ b/lib/net/rte_macsec.h
@@ -29,6 +29,7 @@
  * MACsec Header (SecTAG)
  */
 __extension__
+__rte_msvc_pack
 struct rte_macsec_hdr {
 	/**
 	 * Tag control information and Association number of secure channel.
@@ -52,6 +53,7 @@ struct rte_macsec_hdr {
  * MACsec SCI header (8 bytes) after the MACsec header
  * which is present if SC bit is set in tci_an.
  */
+__rte_msvc_pack
 struct rte_macsec_sci_hdr {
 	uint8_t sci[RTE_MACSEC_SCI_LEN]; /**< Optional secure channel ID. */
 } __rte_packed;
diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h
index 51523e7..d5f6026 100644
--- a/lib/net/rte_mpls.h
+++ b/lib/net/rte_mpls.h
@@ -22,6 +22,7 @@
  * MPLS header.
  */
 __extension__
+__rte_msvc_pack
 struct rte_mpls_hdr {
 	rte_be16_t tag_msb; /**< Label(msb). */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
diff --git a/lib/net/rte_pdcp_hdr.h b/lib/net/rte_pdcp_hdr.h
index 72ae9a6..6a20ad9 100644
--- a/lib/net/rte_pdcp_hdr.h
+++ b/lib/net/rte_pdcp_hdr.h
@@ -60,6 +60,7 @@ enum rte_pdcp_pdu_type {
  * 6.2.2.1 Data PDU for SRBs
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_cp_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
@@ -75,6 +76,7 @@ struct rte_pdcp_cp_data_pdu_sn_12_hdr {
  * 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
@@ -92,6 +94,7 @@ struct rte_pdcp_up_data_pdu_sn_12_hdr {
  * 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_data_pdu_sn_18_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_17_16 : 2;	/**< Sequence number bits 16-17 */
@@ -110,6 +113,7 @@ struct rte_pdcp_up_data_pdu_sn_18_hdr {
  * 6.2.3.1 Control PDU for PDCP status report
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_ctrl_pdu_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t r : 4;		/**< Reserved */
diff --git a/lib/net/rte_ppp.h b/lib/net/rte_ppp.h
index 7b86ac4..fde585f 100644
--- a/lib/net/rte_ppp.h
+++ b/lib/net/rte_ppp.h
@@ -21,6 +21,7 @@
 /**
  * PPP Header
  */
+__rte_msvc_pack
 struct rte_ppp_hdr {
 	uint8_t addr; /**< PPP address(8) */
 	uint8_t ctrl; /**< PPP control(8) */
diff --git a/lib/net/rte_sctp.h b/lib/net/rte_sctp.h
index 965682d..a6cfe8f 100644
--- a/lib/net/rte_sctp.h
+++ b/lib/net/rte_sctp.h
@@ -25,6 +25,7 @@
 /**
  * SCTP Header
  */
+__rte_msvc_pack
 struct rte_sctp_hdr {
 	rte_be16_t src_port; /**< Source port. */
 	rte_be16_t dst_port; /**< Destin port. */
diff --git a/lib/net/rte_tcp.h b/lib/net/rte_tcp.h
index 506ac4e..d11cb2c 100644
--- a/lib/net/rte_tcp.h
+++ b/lib/net/rte_tcp.h
@@ -25,6 +25,7 @@
 /**
  * TCP Header
  */
+__rte_msvc_pack
 struct rte_tcp_hdr {
 	rte_be16_t src_port; /**< TCP source port. */
 	rte_be16_t dst_port; /**< TCP destination port. */
diff --git a/lib/net/rte_tls.h b/lib/net/rte_tls.h
index 2eb3c6d..81af4c7 100644
--- a/lib/net/rte_tls.h
+++ b/lib/net/rte_tls.h
@@ -32,6 +32,7 @@
  * TLS Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_tls_hdr {
 	/** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */
 	uint8_t type;
diff --git a/lib/net/rte_udp.h b/lib/net/rte_udp.h
index 6135494..5416855 100644
--- a/lib/net/rte_udp.h
+++ b/lib/net/rte_udp.h
@@ -25,6 +25,7 @@
 /**
  * UDP Header
  */
+__rte_msvc_pack
 struct rte_udp_hdr {
 	rte_be16_t src_port;    /**< UDP source port. */
 	rte_be16_t dst_port;    /**< UDP destination port. */
diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h
index 997fc78..bcfd579 100644
--- a/lib/net/rte_vxlan.h
+++ b/lib/net/rte_vxlan.h
@@ -31,6 +31,7 @@
  * Reserved fields (24 bits and 8 bits)
  */
 __extension__ /* no named member in struct */
+__rte_msvc_pack
 struct rte_vxlan_hdr {
 	union {
 		struct {
@@ -57,6 +58,7 @@ struct rte_vxlan_hdr {
  * Identifier and Reserved fields (16 bits and 8 bits).
  */
 __extension__ /* no named member in struct */
+__rte_msvc_pack
 struct rte_vxlan_gpe_hdr {
 	union {
 		struct {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 04/16] common/iavf: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 03/16] net: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 05/16] common/idpf: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/iavf/iavf_osdep.h            |  2 ++
 drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/common/iavf/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h
index 263d924..1fb057c 100644
--- a/drivers/common/iavf/iavf_osdep.h
+++ b/drivers/common/iavf/iavf_osdep.h
@@ -158,6 +158,7 @@
 } while (0)
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct iavf_dma_mem {
 	void *va;
 	u64 pa;
@@ -165,6 +166,7 @@ struct iavf_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct iavf_virt_mem {
 	void *va;
 	u32 size;
diff --git a/drivers/common/iavf/virtchnl_inline_ipsec.h b/drivers/common/iavf/virtchnl_inline_ipsec.h
index 2f4bf15..feb0f44 100644
--- a/drivers/common/iavf/virtchnl_inline_ipsec.h
+++ b/drivers/common/iavf/virtchnl_inline_ipsec.h
@@ -109,6 +109,7 @@ enum inline_ipsec_ops {
 };
 
 /* Not all valid, if certain field is invalid, set 1 for all bits */
+__rte_msvc_pack
 struct virtchnl_algo_cap  {
 	u32 algo_type;
 
@@ -132,6 +133,7 @@ struct virtchnl_algo_cap  {
 } __rte_packed;
 
 /* vf record the capability of crypto from the virtchnl */
+__rte_msvc_pack
 struct virtchnl_sym_crypto_cap {
 	u8 crypto_type;
 	u8 algo_cap_num;
@@ -142,6 +144,7 @@ struct virtchnl_sym_crypto_cap {
  * VF pass virtchnl_ipsec_cap to PF
  * and PF return capability of ipsec from virtchnl.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_cap {
 	/* max number of SA per VF */
 	u16 max_sa_num;
@@ -172,6 +175,7 @@ struct virtchnl_ipsec_cap {
 } __rte_packed;
 
 /* configuration of crypto function */
+__rte_msvc_pack
 struct virtchnl_ipsec_crypto_cfg_item {
 	u8 crypto_type;
 
@@ -203,6 +207,7 @@ struct virtchnl_ipsec_sym_crypto_cfg {
  * PF create SA as configuration and PF driver will return
  * an unique index (sa_idx) for the created SA.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_cfg {
 	/* IPsec SA Protocol - AH/ESP */
 	u8 virtchnl_protocol_type;
@@ -298,6 +303,7 @@ struct virtchnl_ipsec_sa_cfg {
  * VF send configuration of index of SA to PF
  * PF will update SA according to configuration
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_update {
 	u32 sa_index; /* SA to update */
 	u32 esn_hi; /* high 32 bits of esn */
@@ -310,6 +316,7 @@ struct virtchnl_ipsec_sa_update {
  * flag bitmap indicate all SA or just selected SA will
  * be destroyed
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_destroy {
 	/* All zero bitmap indicates all SA will be destroyed.
 	 * Non-zero bitmap indicates the selected SA in
@@ -325,6 +332,7 @@ struct virtchnl_ipsec_sa_destroy {
  * VF send this SA configuration to PF using virtchnl;
  * PF read SA and will return configuration for the created SA.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_read {
 	/* SA valid - invalid/valid */
 	u8 valid;
@@ -431,6 +439,7 @@ struct virtchnl_ipsec_sa_read {
 #define VIRTCHNL_IPSEC_INBOUND_SPD_TBL_IPV6	(1)
 
 /* Add allowlist entry in IES */
+__rte_msvc_pack
 struct virtchnl_ipsec_sp_cfg {
 	u32 spi;
 	u32 dip[4];
@@ -459,6 +468,7 @@ struct virtchnl_ipsec_sp_cfg {
 
 
 /* Delete allowlist entry in IES */
+__rte_msvc_pack
 struct virtchnl_ipsec_sp_destroy {
 	/* 0 for IPv4 table, 1 for IPv6 table. */
 	u8 table_id;
@@ -494,6 +504,7 @@ struct virtchnl_ipsec_resp {
 };
 
 /* Internal message descriptor for VF <-> IPsec communication */
+__rte_msvc_pack
 struct inline_ipsec_msg {
 	u16 ipsec_opcode;
 	u16 req_id;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 05/16] common/idpf: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 04/16] common/iavf: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 06/16] common/mlx5: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/idpf/base/idpf_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h
index 74a376c..f5fcdc3 100644
--- a/drivers/common/idpf/base/idpf_osdep.h
+++ b/drivers/common/idpf/base/idpf_osdep.h
@@ -180,6 +180,7 @@ static inline uint64_t idpf_read_addr64(volatile void *addr)
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct idpf_dma_mem {
 	void *va;
 	u64 pa;
@@ -187,6 +188,7 @@ struct idpf_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct idpf_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 06/16] common/mlx5: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 05/16] common/idpf: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 07/16] dma/ioat: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/mlx5/mlx5_common_mr.h    |  4 ++++
 drivers/common/mlx5/mlx5_common_utils.h |  1 +
 drivers/common/mlx5/mlx5_prm.h          | 28 ++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h
index 8789d40..4f4bd73 100644
--- a/drivers/common/mlx5/mlx5_common_mr.h
+++ b/drivers/common/mlx5/mlx5_common_mr.h
@@ -49,6 +49,7 @@ struct mlx5_mr {
 };
 
 /* Cache entry for Memory Region. */
+__rte_msvc_pack
 struct mr_cache_entry {
 	uintptr_t start; /* Start address of MR. */
 	uintptr_t end; /* End address of MR. */
@@ -56,6 +57,7 @@ struct mr_cache_entry {
 } __rte_packed;
 
 /* MR Cache table for Binary search. */
+__rte_msvc_pack
 struct mlx5_mr_btree {
 	uint32_t len; /* Number of entries. */
 	uint32_t size; /* Total number of entries. */
@@ -65,6 +67,7 @@ struct mlx5_mr_btree {
 struct mlx5_common_device;
 
 /* Per-queue MR control descriptor. */
+__rte_msvc_pack
 struct mlx5_mr_ctrl {
 	uint32_t *dev_gen_ptr; /* Generation number of device to poll. */
 	uint32_t cur_gen; /* Generation number saved to flush caches. */
@@ -78,6 +81,7 @@ struct mlx5_mr_ctrl {
 LIST_HEAD(mlx5_mempool_reg_list, mlx5_mempool_reg);
 
 /* Global per-device MR cache. */
+__rte_msvc_pack
 struct mlx5_mr_share_cache {
 	uint32_t dev_gen; /* Generation number to flush local caches. */
 	rte_rwlock_t rwlock; /* MR cache Lock. */
diff --git a/drivers/common/mlx5/mlx5_common_utils.h b/drivers/common/mlx5/mlx5_common_utils.h
index ae15119..a44975c 100644
--- a/drivers/common/mlx5/mlx5_common_utils.h
+++ b/drivers/common/mlx5/mlx5_common_utils.h
@@ -27,6 +27,7 @@
  * Structure of the entry in the mlx5 list, user should define its own struct
  * that contains this in order to store the data.
  */
+__rte_msvc_pack
 struct mlx5_list_entry {
 	LIST_ENTRY(mlx5_list_entry) next; /* Entry pointers in the list. */
 	uint32_t ref_cnt __rte_aligned(8); /* 0 means, entry is invalid. */
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index c671c75..bf9ecd1 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -319,6 +319,7 @@ enum mlx5_mpw_mode {
 };
 
 /* WQE Control segment. */
+__rte_msvc_pack
 struct mlx5_wqe_cseg {
 	uint32_t opcode;
 	uint32_t sq_ds;
@@ -336,10 +337,12 @@ struct mlx5_wqe_cseg {
 #define WQE_CSEG_WQE_INDEX_OFFSET	 8
 
 /* Header of data segment. Minimal size Data Segment */
+__rte_msvc_pack
 struct mlx5_wqe_dseg {
 	uint32_t bcount;
 	union {
 		uint8_t inline_data[MLX5_DSEG_MIN_INLINE_SIZE];
+		__rte_msvc_pack
 		struct {
 			uint32_t lkey;
 			uint64_t pbuf;
@@ -348,8 +351,10 @@ struct mlx5_wqe_dseg {
 } __rte_packed;
 
 /* Subset of struct WQE Ethernet Segment. */
+__rte_msvc_pack
 struct mlx5_wqe_eseg {
 	union {
+		__rte_msvc_pack
 		struct {
 			uint32_t swp_offs;
 			uint8_t	cs_flags;
@@ -362,6 +367,7 @@ struct mlx5_wqe_eseg {
 				uint16_t vlan_tag;
 			};
 		} __rte_packed;
+		__rte_msvc_pack
 		struct {
 			uint32_t offsets;
 			uint32_t flags;
@@ -371,6 +377,7 @@ struct mlx5_wqe_eseg {
 	};
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_qseg {
 	uint32_t reserved0;
 	uint32_t reserved1;
@@ -378,6 +385,7 @@ struct mlx5_wqe_qseg {
 	uint32_t qpn_cqn;
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_wseg {
 	uint32_t operation;
 	uint32_t lkey;
@@ -388,6 +396,7 @@ struct mlx5_wqe_wseg {
 } __rte_packed;
 
 /* The title WQEBB, header of WQE. */
+__rte_msvc_pack
 struct mlx5_wqe {
 	union {
 		struct mlx5_wqe_cseg cseg;
@@ -437,6 +446,7 @@ struct mlx5_cqe {
 	uint8_t lro_num_seg;
 	union {
 		uint8_t user_index_bytes[3];
+		__rte_msvc_pack
 		struct {
 			uint8_t user_index_hi;
 			uint16_t user_index_low;
@@ -460,6 +470,7 @@ struct mlx5_cqe_ts {
 	uint8_t op_own;
 };
 
+__rte_msvc_pack
 struct mlx5_wqe_rseg {
 	uint64_t raddr;
 	uint32_t rkey;
@@ -479,6 +490,7 @@ struct mlx5_wqe_rseg {
 #define MLX5_UMR_KLM_NUM_ALIGN \
 	(MLX5_UMR_KLM_PTR_ALIGN / sizeof(struct mlx5_klm))
 
+__rte_msvc_pack
 struct mlx5_wqe_umr_cseg {
 	uint32_t if_cf_toe_cq_res;
 	uint32_t ko_to_bs;
@@ -486,6 +498,7 @@ struct mlx5_wqe_umr_cseg {
 	uint32_t rsvd1[8];
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_mkey_cseg {
 	uint32_t fr_res_af_sf;
 	uint32_t qpn_mkey;
@@ -549,6 +562,7 @@ enum {
 #define MLX5_CRYPTO_MMO_TYPE_OFFSET 24
 #define MLX5_CRYPTO_MMO_OP_OFFSET 20
 
+__rte_msvc_pack
 struct mlx5_wqe_umr_bsf_seg {
 	/*
 	 * bs_bpt_eo_es contains:
@@ -582,6 +596,7 @@ struct mlx5_wqe_umr_bsf_seg {
 #pragma GCC diagnostic ignored "-Wpedantic"
 #endif
 
+__rte_msvc_pack
 struct mlx5_umr_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_umr_cseg ucseg;
@@ -592,18 +607,21 @@ struct mlx5_umr_wqe {
 	};
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_rdma_write_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_rseg rseg;
 	struct mlx5_wqe_dseg dseg[];
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_send_en_seg {
 	uint32_t reserve[2];
 	uint32_t sqnpc;
 	uint32_t qpn;
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_send_en_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_send_en_seg sseg;
@@ -650,6 +668,7 @@ struct mlx5_wqe_metadata_seg {
 	uint64_t addr;
 };
 
+__rte_msvc_pack
 struct mlx5_gga_wqe {
 	uint32_t opcode;
 	uint32_t sq_ds;
@@ -663,16 +682,19 @@ struct mlx5_gga_wqe {
 } __rte_packed;
 
 union mlx5_gga_compress_opaque {
+	__rte_msvc_pack
 	struct {
 		uint32_t syndrome;
 		uint32_t reserved0;
 		uint32_t scattered_length;
 		union {
+			__rte_msvc_pack
 			struct {
 				uint32_t reserved1[5];
 				uint32_t crc32;
 				uint32_t adler32;
 			} v1 __rte_packed;
+			__rte_msvc_pack
 			struct {
 				uint32_t crc32;
 				uint32_t adler32;
@@ -685,9 +707,11 @@ struct mlx5_gga_wqe {
 };
 
 union mlx5_gga_crypto_opaque {
+	__rte_msvc_pack
 	struct {
 		uint32_t syndrome;
 		uint32_t reserved0[2];
+		__rte_msvc_pack
 		struct {
 			uint32_t iv[3];
 			uint32_t tag_size;
@@ -4134,6 +4158,7 @@ enum mlx5_aso_op {
 #define MLX5_ASO_CSEG_READ_ENABLE 1
 
 /* ASO WQE CTRL segment. */
+__rte_msvc_pack
 struct mlx5_aso_cseg {
 	uint32_t va_h;
 	uint32_t va_l_r;
@@ -4150,6 +4175,7 @@ struct mlx5_aso_cseg {
 #define MLX5_MTR_MAX_TOKEN_VALUE INT32_MAX
 
 /* A meter data segment - 2 per ASO WQE. */
+__rte_msvc_pack
 struct mlx5_aso_mtr_dseg {
 	uint32_t v_bo_sc_bbog_mm;
 	/*
@@ -4191,6 +4217,7 @@ struct mlx5_aso_mtr_dseg {
 #define MLX5_ASO_MTRS_PER_POOL 128
 
 /* ASO WQE data segment. */
+__rte_msvc_pack
 struct mlx5_aso_dseg {
 	union {
 		uint8_t data[MLX5_ASO_WQE_DSEG_SIZE];
@@ -4199,6 +4226,7 @@ struct mlx5_aso_dseg {
 } __rte_packed;
 
 /* ASO WQE. */
+__rte_msvc_pack
 struct mlx5_aso_wqe {
 	struct mlx5_wqe_cseg general_cseg;
 	struct mlx5_aso_cseg aso_cseg;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 07/16] dma/ioat: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 06/16] common/mlx5: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 08/16] net/i40e: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/dma/ioat/ioat_hw_defs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/ioat/ioat_hw_defs.h b/drivers/dma/ioat/ioat_hw_defs.h
index dc3493a..6e32807 100644
--- a/drivers/dma/ioat/ioat_hw_defs.h
+++ b/drivers/dma/ioat/ioat_hw_defs.h
@@ -52,6 +52,7 @@
 #define	IOAT_DMACAP_PQ		(1 << 9)
 #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
 
+__rte_msvc_pack
 struct ioat_registers {
 	uint8_t		chancnt;
 	uint8_t		xfercap;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 08/16] net/i40e: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 07/16] dma/ioat: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 09/16] net/iavf: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/i40e/base/i40e_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index aa5dc61..28439e3 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -177,6 +177,7 @@ static inline uint64_t i40e_read64_addr(volatile void *addr)
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct i40e_dma_mem {
 	void *va;
 	u64 pa;
@@ -188,6 +189,7 @@ struct i40e_dma_mem {
 			i40e_allocate_dma_mem_d(h, m, s, a)
 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
 
+__rte_msvc_pack
 struct i40e_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 09/16] net/iavf: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 08/16] net/i40e: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 10/16] net/ice: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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>
---
 drivers/net/iavf/iavf_ipsec_crypto.h | 4 +++-
 drivers/net/iavf/iavf_rxtx.c         | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

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 {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 10/16] net/ice: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 09/16] net/iavf: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 11/16] net/mlx5: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ice/base/ice_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 0e14b93..087dc6a 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -187,6 +187,7 @@
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct ice_dma_mem {
 	void *va;
 	u64 pa;
@@ -194,6 +195,7 @@ struct ice_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct ice_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 11/16] net/mlx5: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 10/16] net/ice: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 12/16] net/octeon_ep: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/hws/mlx5dr.h   | 1 +
 drivers/net/mlx5/mlx5.h         | 1 +
 drivers/net/mlx5/mlx5_flow.h    | 5 +++++
 drivers/net/mlx5/mlx5_hws_cnt.h | 1 +
 drivers/net/mlx5/mlx5_utils.h   | 4 ++++
 5 files changed, 12 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 80e118a..cd5bb05 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -300,6 +300,7 @@ struct mlx5dr_action_dest_attr {
 	};
 };
 
+__rte_msvc_pack
 struct mlx5dr_crc_encap_entropy_hash_fields {
 	union mlx5dr_crc_encap_entropy_hash_ip_field dst;
 	union mlx5dr_crc_encap_entropy_hash_ip_field src;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 0091a24..6228ee8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -221,6 +221,7 @@ struct mlx5_dev_spawn_data {
 }
 
 /** Data associated with socket messages. */
+__rte_msvc_pack
 struct mlx5_flow_dump_req  {
 	uint32_t port_id; /**< There are plans in DPDK to extend port_id. */
 	uint64_t flow_id;
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 0065727..da0f8b7 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -658,6 +658,7 @@ struct mlx5_flow_dv_tag_resource {
 };
 
 /* Modify resource structure */
+__rte_msvc_pack
 struct mlx5_flow_dv_modify_hdr_resource {
 	struct mlx5_list_entry entry;
 	void *action; /**< Modify header action object. */
@@ -812,6 +813,7 @@ struct mlx5_flow_dv_dest_array_resource {
 
 
 /** Device flow handle structure for DV mode only. */
+__rte_msvc_pack
 struct mlx5_flow_handle_dv {
 	/* Flow DV api: */
 	struct mlx5_flow_dv_matcher *matcher; /**< Cache to matcher. */
@@ -830,6 +832,7 @@ struct mlx5_flow_handle_dv {
 } __rte_packed;
 
 /** Device flow handle structure: used both for creating & destroying. */
+__rte_msvc_pack
 struct mlx5_flow_handle {
 	SILIST_ENTRY(uint32_t)next;
 	struct mlx5_vf_vlan vf_vlan; /**< Structure for VF VLAN workaround. */
@@ -1231,6 +1234,7 @@ struct mlx5_flow_attr {
 };
 
 /* Flow structure. */
+__rte_msvc_pack
 struct rte_flow {
 	uint32_t dev_handles;
 	/**< Device flow handles that are part of the flow. */
@@ -1304,6 +1308,7 @@ enum {
 #endif
 
 /** HWS flow struct. */
+__rte_msvc_pack
 struct rte_flow_hw {
 	/** The table flow allcated from. */
 	struct rte_flow_template_table *table;
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h
index e005960..1f53a1a 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.h
+++ b/drivers/net/mlx5/mlx5_hws_cnt.h
@@ -133,6 +133,7 @@ enum {
 };
 
 /* HWS counter age parameter. */
+__rte_msvc_pack
 struct mlx5_hws_age_param {
 	uint32_t timeout; /* Aging timeout in seconds (atomically accessed). */
 	uint32_t sec_since_last_hit;
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index f3c0d76..cf80e5e 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -118,6 +118,7 @@ struct mlx5_l3t_level_tbl {
 };
 
 /* L3 word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_word {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -128,6 +129,7 @@ struct mlx5_l3t_entry_word {
 } __rte_packed;
 
 /* L3 double word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_dword {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -138,6 +140,7 @@ struct mlx5_l3t_entry_dword {
 } __rte_packed;
 
 /* L3 quad word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_qword {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -148,6 +151,7 @@ struct mlx5_l3t_entry_qword {
 } __rte_packed;
 
 /* L3 pointer entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_ptr {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 12/16] net/octeon_ep: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 11/16] net/mlx5: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 13/16] app/testpmd: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/octeon_ep/otx_ep_mbox.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/octeon_ep/otx_ep_mbox.h b/drivers/net/octeon_ep/otx_ep_mbox.h
index a3fc15c..005fce3 100644
--- a/drivers/net/octeon_ep/otx_ep_mbox.h
+++ b/drivers/net/octeon_ep/otx_ep_mbox.h
@@ -70,6 +70,7 @@ enum otx_ep_link_autoneg {
 #define OTX_EP_MBOX_MORE_FRAG_FLAG 1
 #define OTX_EP_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1)
 
+__rte_msvc_pack
 union otx_ep_mbox_word {
 	uint64_t u64;
 	struct {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 13/16] app/testpmd: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 12/16] net/octeon_ep: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 14/16] app/test: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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>
---
 app/test-pmd/csumonly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 6711dda..f24c381 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -92,7 +92,7 @@ struct testpmd_offload_info {
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
-} __rte_packed;
+};
 
 static uint16_t
 get_udptcp_checksum(struct rte_mbuf *m, void *l3_hdr, uint16_t l4_off,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 14/16] app/test: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 13/16] app/testpmd: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 15/16] examples: " Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 16/16] crypto/mlx5: " Tyler Retzlaff
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test/test_efd.c    | 1 +
 app/test/test_hash.c   | 1 +
 app/test/test_member.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/app/test/test_efd.c b/app/test/test_efd.c
index 1c0986b..df176a0 100644
--- a/app/test/test_efd.c
+++ b/app/test/test_efd.c
@@ -33,6 +33,7 @@
 static unsigned int test_socket_id;
 
 /* 5-tuple key type */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index d586878..08c1773 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -79,6 +79,7 @@
  * Should be packed to avoid holes with potentially
  * undefined content in the middle.
  */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
diff --git a/app/test/test_member.c b/app/test/test_member.c
index 5a4d275..ccd481a 100644
--- a/app/test/test_member.c
+++ b/app/test/test_member.c
@@ -32,6 +32,7 @@
 struct rte_member_setsum *setsum_sketch;
 
 /* 5-tuple key type */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 15/16] examples: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 14/16] app/test: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  2024-04-15 23:51   ` [PATCH v3 16/16] crypto/mlx5: " Tyler Retzlaff
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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>
---
 examples/common/neon/port_group.h |  1 +
 examples/ip_pipeline/cli.c        | 10 +++++-----
 examples/ipsec-secgw/ipsec.h      |  1 +
 examples/l3fwd-power/main.c       |  2 ++
 examples/ptpclient/ptpclient.c    |  8 ++++++++
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/examples/common/neon/port_group.h b/examples/common/neon/port_group.h
index 421e2e8..bd40590 100644
--- a/examples/common/neon/port_group.h
+++ b/examples/common/neon/port_group.h
@@ -21,6 +21,7 @@
 port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
 		  uint16x8_t dp2)
 {
+	__rte_msvc_pack
 	union {
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index e8269ea..aad6c78 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -2571,7 +2571,7 @@ struct pkt_key_qinq {
 	uint16_t svlan;
 	uint16_t ethertype_cvlan;
 	uint16_t cvlan;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_5tuple {
 	uint8_t time_to_live;
@@ -2581,7 +2581,7 @@ struct pkt_key_ipv4_5tuple {
 	uint32_t da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_5tuple {
 	uint16_t payload_length;
@@ -2591,15 +2591,15 @@ struct pkt_key_ipv6_5tuple {
 	uint8_t da[16];
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_addr {
 	uint32_t addr;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_addr {
 	uint8_t addr[16];
-} __rte_packed;
+};
 
 static uint32_t
 parse_match(char **tokens,
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index bdcada1..bdc6045 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -277,6 +277,7 @@ struct socket_ctx {
 	struct rte_mempool *session_pool;
 };
 
+__rte_msvc_pack
 struct cnt_blk {
 	uint32_t salt;
 	uint64_t iv;
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index f4adcf4..a3be37b 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -278,6 +278,7 @@ struct lcore_rx_queue {
 #define DEFAULT_HASH_FUNC       rte_jhash
 #endif
 
+__rte_msvc_pack
 struct ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
@@ -286,6 +287,7 @@ struct ipv4_5tuple {
 	uint8_t  proto;
 } __rte_packed;
 
+__rte_msvc_pack
 struct ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index afb61bb..cdd73fd 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -56,6 +56,7 @@
 };
 
 /* Structs used for PTP handling. */
+__rte_msvc_pack
 struct tstamp {
 	uint16_t   sec_msb;
 	uint32_t   sec_lsb;
@@ -66,11 +67,13 @@ struct clock_id {
 	uint8_t id[8];
 };
 
+__rte_msvc_pack
 struct port_id {
 	struct clock_id        clock_id;
 	uint16_t               port_number;
 }  __rte_packed;
 
+__rte_msvc_pack
 struct ptp_header {
 	uint8_t              msg_type;
 	uint8_t              ver;
@@ -86,22 +89,26 @@ struct ptp_header {
 	int8_t               log_message_interval;
 } __rte_packed;
 
+__rte_msvc_pack
 struct sync_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct follow_up_msg {
 	struct ptp_header   hdr;
 	struct tstamp       precise_origin_tstamp;
 	uint8_t             suffix[];
 } __rte_packed;
 
+__rte_msvc_pack
 struct delay_req_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct delay_resp_msg {
 	struct ptp_header    hdr;
 	struct tstamp        rx_tstamp;
@@ -110,6 +117,7 @@ struct delay_resp_msg {
 } __rte_packed;
 
 struct ptp_message {
+	__rte_msvc_pack
 	union {
 		struct ptp_header          header;
 		struct sync_msg            sync;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v3 16/16] crypto/mlx5: pack structures when building with MSVC
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-04-15 23:51   ` [PATCH v3 15/16] examples: " Tyler Retzlaff
@ 2024-04-15 23:51   ` Tyler Retzlaff
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-15 23:51 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
packing when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/crypto/mlx5/mlx5_crypto.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/mlx5/mlx5_crypto.h b/drivers/crypto/mlx5/mlx5_crypto.h
index 36dacdc..3b4916d 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.h
+++ b/drivers/crypto/mlx5/mlx5_crypto.h
@@ -95,6 +95,7 @@ struct mlx5_crypto_devarg_params {
 	uint32_t is_aes_gcm:1;
 };
 
+__rte_msvc_pack
 struct mlx5_crypto_session {
 	union {
 		/**< AES-XTS configuration. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 00/16] fix packing of structs when building with MSVC
  2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
                   ` (17 preceding siblings ...)
  2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
@ 2024-04-16  0:04 ` Tyler Retzlaff
  2024-04-16  0:04   ` [PATCH v4 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
                     ` (15 more replies)
  18 siblings, 16 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:04 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

MSVC struct packing is not compatible with GCC provide a macro that can
be used to push existing pack value and sets packing to 1-byte. The
existing __rte_packed macro is then used to restore the pack value
prior to the push.

Instead of providing macros exclusively for MSVC and for GCC the
existing macro is deliberately utilized to trigger a warning if no
existing packing has been pushed allowing easy identification of
locations where the __rte_msvc_pack is missing.

I've decided to only add the macro to packed structs that are built
for Windows. It seems there is little value in adding the macro tree
wide and if new code arrives that is built on Windows the __rte_packed
will flag where the preamble macro is required.

If as a part of review maintainers identify structs they believe
don't require packing so long as they are explicitly identified
i'll remove the __rte_packed as a part of this series.

v4:
  * add another missing __rte_msvc_pack to crypto/mlx5 patch
  * correct commit message for duplicated packing packing in
    crypto/mlx5 patch

v3:
  * add missing __rte_msvc_pack to crypto/mlx5
  * fix commit messages to reference __rte_msvc_pack macro instead
    of __rte_msvc_pushpack(1)

v2:
  * app/testpmd, remove packing from simple_gre_hdr
  * net/iavf, remove packing from iavf_ipsec_crypto_pkt_metadata,
    simple_gre_hdr
  * examples, remove packing from pkt_key_qinq, pkt_key_ipv4_5tuple,
    pkt_key_ipv6_5tuple, pkt_key_ipv4_addr, pkt_key_ipv6_addr
  * eal, remove packing from rte_config, __rte_trace_stream_header

Tyler Retzlaff (16):
  eal: provide pack start macro for MSVC
  eal: pack structures when building with MSVC
  net: pack structures when building with MSVC
  common/iavf: pack structures when building with MSVC
  common/idpf: pack structures when building with MSVC
  common/mlx5: pack structures when building with MSVC
  dma/ioat: pack structures when building with MSVC
  net/i40e: pack structures when building with MSVC
  net/iavf: pack structures when building with MSVC
  net/ice: pack structures when building with MSVC
  net/mlx5: pack structures when building with MSVC
  net/octeon_ep: pack structures when building with MSVC
  app/testpmd: pack structures when building with MSVC
  app/test: pack structures when building with MSVC
  examples: pack structures when building with MSVC
  crypto/mlx5: pack structures when building with MSVC

 app/test-pmd/csumonly.c                     |  2 +-
 app/test/test_efd.c                         |  1 +
 app/test/test_hash.c                        |  1 +
 app/test/test_member.c                      |  1 +
 drivers/common/iavf/iavf_osdep.h            |  2 ++
 drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++
 drivers/common/idpf/base/idpf_osdep.h       |  2 ++
 drivers/common/mlx5/mlx5_common_mr.h        |  4 ++++
 drivers/common/mlx5/mlx5_common_utils.h     |  1 +
 drivers/common/mlx5/mlx5_prm.h              | 28 ++++++++++++++++++++++++++++
 drivers/crypto/mlx5/mlx5_crypto.h           |  1 +
 drivers/crypto/mlx5/mlx5_crypto_gcm.c       |  1 +
 drivers/dma/ioat/ioat_hw_defs.h             |  1 +
 drivers/net/i40e/base/i40e_osdep.h          |  2 ++
 drivers/net/iavf/iavf_ipsec_crypto.h        |  4 +++-
 drivers/net/iavf/iavf_rxtx.c                |  2 +-
 drivers/net/ice/base/ice_osdep.h            |  2 ++
 drivers/net/mlx5/hws/mlx5dr.h               |  1 +
 drivers/net/mlx5/mlx5.h                     |  1 +
 drivers/net/mlx5/mlx5_flow.h                |  5 +++++
 drivers/net/mlx5/mlx5_hws_cnt.h             |  1 +
 drivers/net/mlx5/mlx5_utils.h               |  4 ++++
 drivers/net/octeon_ep/otx_ep_mbox.h         |  1 +
 examples/common/neon/port_group.h           |  1 +
 examples/ip_pipeline/cli.c                  | 10 +++++-----
 examples/ipsec-secgw/ipsec.h                |  1 +
 examples/l3fwd-power/main.c                 |  2 ++
 examples/ptpclient/ptpclient.c              |  8 ++++++++
 lib/eal/common/eal_private.h                |  2 +-
 lib/eal/include/rte_common.h                |  4 +++-
 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 +++
 lib/net/rte_arp.h                           |  2 ++
 lib/net/rte_dtls.h                          |  1 +
 lib/net/rte_esp.h                           |  2 ++
 lib/net/rte_ether.h                         |  1 +
 lib/net/rte_geneve.h                        |  1 +
 lib/net/rte_gre.h                           |  4 ++++
 lib/net/rte_gtp.h                           |  5 +++++
 lib/net/rte_ib.h                            |  1 +
 lib/net/rte_icmp.h                          |  3 +++
 lib/net/rte_ip.h                            |  4 ++++
 lib/net/rte_l2tpv2.h                        |  4 ++++
 lib/net/rte_macsec.h                        |  2 ++
 lib/net/rte_mpls.h                          |  1 +
 lib/net/rte_pdcp_hdr.h                      |  4 ++++
 lib/net/rte_ppp.h                           |  1 +
 lib/net/rte_sctp.h                          |  1 +
 lib/net/rte_tcp.h                           |  1 +
 lib/net/rte_tls.h                           |  1 +
 lib/net/rte_udp.h                           |  1 +
 lib/net/rte_vxlan.h                         |  2 ++
 54 files changed, 145 insertions(+), 11 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 01/16] eal: provide pack start macro for MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
@ 2024-04-16  0:04   ` Tyler Retzlaff
  2024-04-16  0:04   ` [PATCH v4 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
                     ` (14 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:04 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

MSVC struct packing is not compatible with GCC provide a macro that can
be used to push existing pack value and sets packing to 1-byte. The
existing __rte_packed macro is then used to restore the pack value
prior to the push.

Instead of providing macros exclusively for MSVC and for GCC the
existing macro is deliberately utilized to trigger a warning if no
existing packing has been pushed allowing easy identification of
locations where the __rte_msvc_pack is missing.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_common.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 298a5c6..44825ed 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -97,8 +97,10 @@
  * Force a structure to be packed
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_packed
+#define __rte_msvc_pack __pragma(pack(push, 1))
+#define __rte_packed __pragma(pack(pop))
 #else
+#define __rte_msvc_pack
 #define __rte_packed __attribute__((__packed__))
 #endif
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 02/16] eal: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
  2024-04-16  0:04   ` [PATCH v4 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
@ 2024-04-16  0:04   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 03/16] net: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:04 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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(-)

diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 71523cf..4c929fb 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -62,7 +62,7 @@ struct rte_config {
 	 * DPDK instances
 	 */
 	struct rte_mem_config *mem_config;
-} __rte_packed;
+};
 
 /**
  * Get the global configuration structure.
diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h
index 842362d..73bb00d 100644
--- a/lib/eal/include/rte_memory.h
+++ b/lib/eal/include/rte_memory.h
@@ -46,6 +46,7 @@
 /**
  * Physical memory segment descriptor.
  */
+__rte_msvc_pack
 struct rte_memseg {
 	rte_iova_t iova;            /**< Start IO address. */
 	union {
diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h
index 931497f..ca312c0 100644
--- a/lib/eal/include/rte_memzone.h
+++ b/lib/eal/include/rte_memzone.h
@@ -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.*/
diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h
index 41e2a7f..e786ee3 100644
--- a/lib/eal/include/rte_trace_point.h
+++ b/lib/eal/include/rte_trace_point.h
@@ -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;
diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h
index 72a9229..fdc5df0 100644
--- a/lib/eal/x86/include/rte_memcpy.h
+++ b/lib/eal/x86/include/rte_memcpy.h
@@ -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;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 03/16] net: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
  2024-04-16  0:04   ` [PATCH v4 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
  2024-04-16  0:04   ` [PATCH v4 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 04/16] common/iavf: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/net/rte_arp.h      | 2 ++
 lib/net/rte_dtls.h     | 1 +
 lib/net/rte_esp.h      | 2 ++
 lib/net/rte_ether.h    | 1 +
 lib/net/rte_geneve.h   | 1 +
 lib/net/rte_gre.h      | 4 ++++
 lib/net/rte_gtp.h      | 5 +++++
 lib/net/rte_ib.h       | 1 +
 lib/net/rte_icmp.h     | 3 +++
 lib/net/rte_ip.h       | 4 ++++
 lib/net/rte_l2tpv2.h   | 4 ++++
 lib/net/rte_macsec.h   | 2 ++
 lib/net/rte_mpls.h     | 1 +
 lib/net/rte_pdcp_hdr.h | 4 ++++
 lib/net/rte_ppp.h      | 1 +
 lib/net/rte_sctp.h     | 1 +
 lib/net/rte_tcp.h      | 1 +
 lib/net/rte_tls.h      | 1 +
 lib/net/rte_udp.h      | 1 +
 lib/net/rte_vxlan.h    | 2 ++
 20 files changed, 42 insertions(+)

diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h
index 668cea1..35d68c1 100644
--- a/lib/net/rte_arp.h
+++ b/lib/net/rte_arp.h
@@ -21,6 +21,7 @@
 /**
  * ARP header IPv4 payload.
  */
+__rte_msvc_pack
 struct __rte_aligned(2) rte_arp_ipv4 {
 	struct rte_ether_addr arp_sha;  /**< sender hardware address */
 	rte_be32_t            arp_sip;  /**< sender IP address */
@@ -31,6 +32,7 @@ struct __rte_aligned(2) rte_arp_ipv4 {
 /**
  * ARP header.
  */
+__rte_msvc_pack
 struct __rte_aligned(2) rte_arp_hdr {
 	rte_be16_t arp_hardware; /**< format of hardware address */
 #define RTE_ARP_HRD_ETHER     1  /**< ARP Ethernet address format */
diff --git a/lib/net/rte_dtls.h b/lib/net/rte_dtls.h
index 4f541df..0c75b06 100644
--- a/lib/net/rte_dtls.h
+++ b/lib/net/rte_dtls.h
@@ -34,6 +34,7 @@
  * DTLS Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_dtls_hdr {
 	/** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */
 	uint8_t type;
diff --git a/lib/net/rte_esp.h b/lib/net/rte_esp.h
index 464c513..27c9287 100644
--- a/lib/net/rte_esp.h
+++ b/lib/net/rte_esp.h
@@ -20,6 +20,7 @@
 /**
  * ESP Header
  */
+__rte_msvc_pack
 struct rte_esp_hdr {
 	rte_be32_t spi;  /**< Security Parameters Index */
 	rte_be32_t seq;  /**< packet sequence number */
@@ -28,6 +29,7 @@ struct rte_esp_hdr {
 /**
  * ESP Trailer
  */
+__rte_msvc_pack
 struct rte_esp_tail {
 	uint8_t pad_len;     /**< number of pad bytes (0-255) */
 	uint8_t next_proto;  /**< IPv4 or IPv6 or next layer header */
diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h
index 32ed515..354e3a5 100644
--- a/lib/net/rte_ether.h
+++ b/lib/net/rte_ether.h
@@ -301,6 +301,7 @@ struct __rte_aligned(2) rte_ether_hdr {
  * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type
  * of the encapsulated frame.
  */
+__rte_msvc_pack
 struct rte_vlan_hdr {
 	rte_be16_t vlan_tci;  /**< Priority (3) + CFI (1) + Identifier Code (12) */
 	rte_be16_t eth_proto; /**< Ethernet type of encapsulated frame. */
diff --git a/lib/net/rte_geneve.h b/lib/net/rte_geneve.h
index 3bbc561..5c02526 100644
--- a/lib/net/rte_geneve.h
+++ b/lib/net/rte_geneve.h
@@ -38,6 +38,7 @@
  * More-bits (optional) variable length options.
  */
 __extension__
+__rte_msvc_pack
 struct rte_geneve_hdr {
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 	uint8_t ver:2;		/**< Version. */
diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h
index 8da8027..77882e7 100644
--- a/lib/net/rte_gre.h
+++ b/lib/net/rte_gre.h
@@ -27,6 +27,7 @@
  * GRE Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_gre_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint16_t res2:4; /**< Reserved */
@@ -51,6 +52,7 @@ struct rte_gre_hdr {
 /**
  * Optional field checksum in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_checksum_rsvd {
 	rte_be16_t checksum;
 	rte_be16_t reserved1;
@@ -59,6 +61,7 @@ struct rte_gre_hdr_opt_checksum_rsvd {
 /**
  * Optional field key in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_key {
 	rte_be32_t key;
 } __rte_packed;
@@ -66,6 +69,7 @@ struct rte_gre_hdr_opt_key {
 /**
  * Optional field sequence in GRE header
  */
+__rte_msvc_pack
 struct rte_gre_hdr_opt_sequence {
 	rte_be32_t sequence;
 } __rte_packed;
diff --git a/lib/net/rte_gtp.h b/lib/net/rte_gtp.h
index 9849872..26fc80a 100644
--- a/lib/net/rte_gtp.h
+++ b/lib/net/rte_gtp.h
@@ -28,6 +28,7 @@
  * No optional fields and next extension header.
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_hdr {
 	union {
 		uint8_t gtp_hdr_info; /**< GTP header info */
@@ -55,6 +56,7 @@ struct rte_gtp_hdr {
 } __rte_packed;
 
 /* Optional word of GTP header, present if any of E, S, PN is set. */
+__rte_msvc_pack
 struct rte_gtp_hdr_ext_word {
 	rte_be16_t sqn;	      /**< Sequence Number. */
 	uint8_t npdu;	      /**< N-PDU number. */
@@ -66,6 +68,7 @@ struct rte_gtp_hdr_ext_word {
  * defined based on RFC 38415-g30.
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_generic_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -89,6 +92,7 @@ struct rte_gtp_psc_generic_hdr {
  * type0 defined based on RFC 38415-g30
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_type0_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -116,6 +120,7 @@ struct rte_gtp_psc_type0_hdr {
  * type1 defined based on RFC 38415-g30
  */
 __extension__
+__rte_msvc_pack
 struct rte_gtp_psc_type1_hdr {
 	uint8_t ext_hdr_len;	/**< PDU ext hdr len in multiples of 4 bytes */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
diff --git a/lib/net/rte_ib.h b/lib/net/rte_ib.h
index 9eab5f9..c4c5d39 100644
--- a/lib/net/rte_ib.h
+++ b/lib/net/rte_ib.h
@@ -26,6 +26,7 @@
  * IB Specification Vol 1-Release-1.4.
  */
 __extension__
+__rte_msvc_pack
 struct rte_ib_bth {
 	uint8_t	opcode;		/**< Opcode. */
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
diff --git a/lib/net/rte_icmp.h b/lib/net/rte_icmp.h
index 4bf64d7..e865db4 100644
--- a/lib/net/rte_icmp.h
+++ b/lib/net/rte_icmp.h
@@ -25,6 +25,7 @@
 /**
  * ICMP base header
  */
+__rte_msvc_pack
 struct rte_icmp_base_hdr {
 	uint8_t type;
 	uint8_t code;
@@ -34,6 +35,7 @@ struct rte_icmp_base_hdr {
 /**
  * ICMP echo header
  */
+__rte_msvc_pack
 struct rte_icmp_echo_hdr {
 	struct rte_icmp_base_hdr base;
 	rte_be16_t identifier;
@@ -45,6 +47,7 @@ struct rte_icmp_echo_hdr {
  *
  * @see rte_icmp_echo_hdr which is similar.
  */
+__rte_msvc_pack
 struct rte_icmp_hdr {
 	uint8_t  icmp_type;     /* ICMP packet type. */
 	uint8_t  icmp_code;     /* ICMP packet code. */
diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 0d103d4..908a25c 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -38,6 +38,7 @@
 /**
  * IPv4 Header
  */
+__rte_msvc_pack
 struct rte_ipv4_hdr {
 	__extension__
 	union {
@@ -523,6 +524,7 @@ struct rte_ipv4_hdr {
 /**
  * IPv6 Header
  */
+__rte_msvc_pack
 struct rte_ipv6_hdr {
 	rte_be32_t vtc_flow;	/**< IP version, traffic class & flow label. */
 	rte_be16_t payload_len;	/**< IP payload size, including ext. headers */
@@ -538,6 +540,7 @@ struct rte_ipv6_hdr {
 /**
  * IPv6 Routing Extension Header
  */
+__rte_msvc_pack
 struct rte_ipv6_routing_ext {
 	uint8_t next_hdr;			/**< Protocol, next header. */
 	uint8_t hdr_len;			/**< Header length. */
@@ -783,6 +786,7 @@ struct rte_ipv6_routing_ext {
 #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
 	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
 
+__rte_msvc_pack
 struct rte_ipv6_fragment_ext {
 	uint8_t next_header;	/**< Next header type */
 	uint8_t reserved;	/**< Reserved */
diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 9cda347..a917013 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -129,6 +129,7 @@ struct rte_l2tpv2_common_hdr {
  * L2TPv2 message Header contains all options(length, ns, nr,
  * offset size, offset padding).
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_with_all_options {
 	rte_be16_t length;		/**< length(16) */
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
@@ -143,6 +144,7 @@ struct rte_l2tpv2_msg_with_all_options {
  * L2TPv2 message Header contains all options except length(ns, nr,
  * offset size, offset padding).
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_without_length {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -180,6 +182,7 @@ struct rte_l2tpv2_msg_without_offset {
 /**
  * L2TPv2 message Header contains options offset size and offset padding.
  */
+__rte_msvc_pack
 struct rte_l2tpv2_msg_with_offset {
 	rte_be16_t tunnel_id;		/**< tunnel ID(16) */
 	rte_be16_t session_id;		/**< session ID(16) */
@@ -217,6 +220,7 @@ struct rte_l2tpv2_msg_without_all_options {
 /**
  * L2TPv2 Combined Message Header Format: Common Header + Options
  */
+__rte_msvc_pack
 struct rte_l2tpv2_combined_msg_hdr {
 	struct rte_l2tpv2_common_hdr common; /**< common header */
 	union {
diff --git a/lib/net/rte_macsec.h b/lib/net/rte_macsec.h
index d0cd2f6..54de1bd 100644
--- a/lib/net/rte_macsec.h
+++ b/lib/net/rte_macsec.h
@@ -29,6 +29,7 @@
  * MACsec Header (SecTAG)
  */
 __extension__
+__rte_msvc_pack
 struct rte_macsec_hdr {
 	/**
 	 * Tag control information and Association number of secure channel.
@@ -52,6 +53,7 @@ struct rte_macsec_hdr {
  * MACsec SCI header (8 bytes) after the MACsec header
  * which is present if SC bit is set in tci_an.
  */
+__rte_msvc_pack
 struct rte_macsec_sci_hdr {
 	uint8_t sci[RTE_MACSEC_SCI_LEN]; /**< Optional secure channel ID. */
 } __rte_packed;
diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h
index 51523e7..d5f6026 100644
--- a/lib/net/rte_mpls.h
+++ b/lib/net/rte_mpls.h
@@ -22,6 +22,7 @@
  * MPLS header.
  */
 __extension__
+__rte_msvc_pack
 struct rte_mpls_hdr {
 	rte_be16_t tag_msb; /**< Label(msb). */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
diff --git a/lib/net/rte_pdcp_hdr.h b/lib/net/rte_pdcp_hdr.h
index 72ae9a6..6a20ad9 100644
--- a/lib/net/rte_pdcp_hdr.h
+++ b/lib/net/rte_pdcp_hdr.h
@@ -60,6 +60,7 @@ enum rte_pdcp_pdu_type {
  * 6.2.2.1 Data PDU for SRBs
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_cp_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
@@ -75,6 +76,7 @@ struct rte_pdcp_cp_data_pdu_sn_12_hdr {
  * 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_data_pdu_sn_12_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_11_8 : 4;	/**< Sequence number bits 8-11 */
@@ -92,6 +94,7 @@ struct rte_pdcp_up_data_pdu_sn_12_hdr {
  * 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_data_pdu_sn_18_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t sn_17_16 : 2;	/**< Sequence number bits 16-17 */
@@ -110,6 +113,7 @@ struct rte_pdcp_up_data_pdu_sn_18_hdr {
  * 6.2.3.1 Control PDU for PDCP status report
  */
 __extension__
+__rte_msvc_pack
 struct rte_pdcp_up_ctrl_pdu_hdr {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 	uint8_t r : 4;		/**< Reserved */
diff --git a/lib/net/rte_ppp.h b/lib/net/rte_ppp.h
index 7b86ac4..fde585f 100644
--- a/lib/net/rte_ppp.h
+++ b/lib/net/rte_ppp.h
@@ -21,6 +21,7 @@
 /**
  * PPP Header
  */
+__rte_msvc_pack
 struct rte_ppp_hdr {
 	uint8_t addr; /**< PPP address(8) */
 	uint8_t ctrl; /**< PPP control(8) */
diff --git a/lib/net/rte_sctp.h b/lib/net/rte_sctp.h
index 965682d..a6cfe8f 100644
--- a/lib/net/rte_sctp.h
+++ b/lib/net/rte_sctp.h
@@ -25,6 +25,7 @@
 /**
  * SCTP Header
  */
+__rte_msvc_pack
 struct rte_sctp_hdr {
 	rte_be16_t src_port; /**< Source port. */
 	rte_be16_t dst_port; /**< Destin port. */
diff --git a/lib/net/rte_tcp.h b/lib/net/rte_tcp.h
index 506ac4e..d11cb2c 100644
--- a/lib/net/rte_tcp.h
+++ b/lib/net/rte_tcp.h
@@ -25,6 +25,7 @@
 /**
  * TCP Header
  */
+__rte_msvc_pack
 struct rte_tcp_hdr {
 	rte_be16_t src_port; /**< TCP source port. */
 	rte_be16_t dst_port; /**< TCP destination port. */
diff --git a/lib/net/rte_tls.h b/lib/net/rte_tls.h
index 2eb3c6d..81af4c7 100644
--- a/lib/net/rte_tls.h
+++ b/lib/net/rte_tls.h
@@ -32,6 +32,7 @@
  * TLS Header
  */
 __extension__
+__rte_msvc_pack
 struct rte_tls_hdr {
 	/** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */
 	uint8_t type;
diff --git a/lib/net/rte_udp.h b/lib/net/rte_udp.h
index 6135494..5416855 100644
--- a/lib/net/rte_udp.h
+++ b/lib/net/rte_udp.h
@@ -25,6 +25,7 @@
 /**
  * UDP Header
  */
+__rte_msvc_pack
 struct rte_udp_hdr {
 	rte_be16_t src_port;    /**< UDP source port. */
 	rte_be16_t dst_port;    /**< UDP destination port. */
diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h
index 997fc78..bcfd579 100644
--- a/lib/net/rte_vxlan.h
+++ b/lib/net/rte_vxlan.h
@@ -31,6 +31,7 @@
  * Reserved fields (24 bits and 8 bits)
  */
 __extension__ /* no named member in struct */
+__rte_msvc_pack
 struct rte_vxlan_hdr {
 	union {
 		struct {
@@ -57,6 +58,7 @@ struct rte_vxlan_hdr {
  * Identifier and Reserved fields (16 bits and 8 bits).
  */
 __extension__ /* no named member in struct */
+__rte_msvc_pack
 struct rte_vxlan_gpe_hdr {
 	union {
 		struct {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 04/16] common/iavf: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 03/16] net: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 05/16] common/idpf: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/iavf/iavf_osdep.h            |  2 ++
 drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/common/iavf/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h
index 263d924..1fb057c 100644
--- a/drivers/common/iavf/iavf_osdep.h
+++ b/drivers/common/iavf/iavf_osdep.h
@@ -158,6 +158,7 @@
 } while (0)
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct iavf_dma_mem {
 	void *va;
 	u64 pa;
@@ -165,6 +166,7 @@ struct iavf_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct iavf_virt_mem {
 	void *va;
 	u32 size;
diff --git a/drivers/common/iavf/virtchnl_inline_ipsec.h b/drivers/common/iavf/virtchnl_inline_ipsec.h
index 2f4bf15..feb0f44 100644
--- a/drivers/common/iavf/virtchnl_inline_ipsec.h
+++ b/drivers/common/iavf/virtchnl_inline_ipsec.h
@@ -109,6 +109,7 @@ enum inline_ipsec_ops {
 };
 
 /* Not all valid, if certain field is invalid, set 1 for all bits */
+__rte_msvc_pack
 struct virtchnl_algo_cap  {
 	u32 algo_type;
 
@@ -132,6 +133,7 @@ struct virtchnl_algo_cap  {
 } __rte_packed;
 
 /* vf record the capability of crypto from the virtchnl */
+__rte_msvc_pack
 struct virtchnl_sym_crypto_cap {
 	u8 crypto_type;
 	u8 algo_cap_num;
@@ -142,6 +144,7 @@ struct virtchnl_sym_crypto_cap {
  * VF pass virtchnl_ipsec_cap to PF
  * and PF return capability of ipsec from virtchnl.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_cap {
 	/* max number of SA per VF */
 	u16 max_sa_num;
@@ -172,6 +175,7 @@ struct virtchnl_ipsec_cap {
 } __rte_packed;
 
 /* configuration of crypto function */
+__rte_msvc_pack
 struct virtchnl_ipsec_crypto_cfg_item {
 	u8 crypto_type;
 
@@ -203,6 +207,7 @@ struct virtchnl_ipsec_sym_crypto_cfg {
  * PF create SA as configuration and PF driver will return
  * an unique index (sa_idx) for the created SA.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_cfg {
 	/* IPsec SA Protocol - AH/ESP */
 	u8 virtchnl_protocol_type;
@@ -298,6 +303,7 @@ struct virtchnl_ipsec_sa_cfg {
  * VF send configuration of index of SA to PF
  * PF will update SA according to configuration
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_update {
 	u32 sa_index; /* SA to update */
 	u32 esn_hi; /* high 32 bits of esn */
@@ -310,6 +316,7 @@ struct virtchnl_ipsec_sa_update {
  * flag bitmap indicate all SA or just selected SA will
  * be destroyed
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_destroy {
 	/* All zero bitmap indicates all SA will be destroyed.
 	 * Non-zero bitmap indicates the selected SA in
@@ -325,6 +332,7 @@ struct virtchnl_ipsec_sa_destroy {
  * VF send this SA configuration to PF using virtchnl;
  * PF read SA and will return configuration for the created SA.
  */
+__rte_msvc_pack
 struct virtchnl_ipsec_sa_read {
 	/* SA valid - invalid/valid */
 	u8 valid;
@@ -431,6 +439,7 @@ struct virtchnl_ipsec_sa_read {
 #define VIRTCHNL_IPSEC_INBOUND_SPD_TBL_IPV6	(1)
 
 /* Add allowlist entry in IES */
+__rte_msvc_pack
 struct virtchnl_ipsec_sp_cfg {
 	u32 spi;
 	u32 dip[4];
@@ -459,6 +468,7 @@ struct virtchnl_ipsec_sp_cfg {
 
 
 /* Delete allowlist entry in IES */
+__rte_msvc_pack
 struct virtchnl_ipsec_sp_destroy {
 	/* 0 for IPv4 table, 1 for IPv6 table. */
 	u8 table_id;
@@ -494,6 +504,7 @@ struct virtchnl_ipsec_resp {
 };
 
 /* Internal message descriptor for VF <-> IPsec communication */
+__rte_msvc_pack
 struct inline_ipsec_msg {
 	u16 ipsec_opcode;
 	u16 req_id;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 05/16] common/idpf: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 04/16] common/iavf: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 06/16] common/mlx5: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/idpf/base/idpf_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h
index 74a376c..f5fcdc3 100644
--- a/drivers/common/idpf/base/idpf_osdep.h
+++ b/drivers/common/idpf/base/idpf_osdep.h
@@ -180,6 +180,7 @@ static inline uint64_t idpf_read_addr64(volatile void *addr)
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct idpf_dma_mem {
 	void *va;
 	u64 pa;
@@ -187,6 +188,7 @@ struct idpf_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct idpf_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 06/16] common/mlx5: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 05/16] common/idpf: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 07/16] dma/ioat: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/mlx5/mlx5_common_mr.h    |  4 ++++
 drivers/common/mlx5/mlx5_common_utils.h |  1 +
 drivers/common/mlx5/mlx5_prm.h          | 28 ++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h
index 8789d40..4f4bd73 100644
--- a/drivers/common/mlx5/mlx5_common_mr.h
+++ b/drivers/common/mlx5/mlx5_common_mr.h
@@ -49,6 +49,7 @@ struct mlx5_mr {
 };
 
 /* Cache entry for Memory Region. */
+__rte_msvc_pack
 struct mr_cache_entry {
 	uintptr_t start; /* Start address of MR. */
 	uintptr_t end; /* End address of MR. */
@@ -56,6 +57,7 @@ struct mr_cache_entry {
 } __rte_packed;
 
 /* MR Cache table for Binary search. */
+__rte_msvc_pack
 struct mlx5_mr_btree {
 	uint32_t len; /* Number of entries. */
 	uint32_t size; /* Total number of entries. */
@@ -65,6 +67,7 @@ struct mlx5_mr_btree {
 struct mlx5_common_device;
 
 /* Per-queue MR control descriptor. */
+__rte_msvc_pack
 struct mlx5_mr_ctrl {
 	uint32_t *dev_gen_ptr; /* Generation number of device to poll. */
 	uint32_t cur_gen; /* Generation number saved to flush caches. */
@@ -78,6 +81,7 @@ struct mlx5_mr_ctrl {
 LIST_HEAD(mlx5_mempool_reg_list, mlx5_mempool_reg);
 
 /* Global per-device MR cache. */
+__rte_msvc_pack
 struct mlx5_mr_share_cache {
 	uint32_t dev_gen; /* Generation number to flush local caches. */
 	rte_rwlock_t rwlock; /* MR cache Lock. */
diff --git a/drivers/common/mlx5/mlx5_common_utils.h b/drivers/common/mlx5/mlx5_common_utils.h
index ae15119..a44975c 100644
--- a/drivers/common/mlx5/mlx5_common_utils.h
+++ b/drivers/common/mlx5/mlx5_common_utils.h
@@ -27,6 +27,7 @@
  * Structure of the entry in the mlx5 list, user should define its own struct
  * that contains this in order to store the data.
  */
+__rte_msvc_pack
 struct mlx5_list_entry {
 	LIST_ENTRY(mlx5_list_entry) next; /* Entry pointers in the list. */
 	uint32_t ref_cnt __rte_aligned(8); /* 0 means, entry is invalid. */
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index c671c75..bf9ecd1 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -319,6 +319,7 @@ enum mlx5_mpw_mode {
 };
 
 /* WQE Control segment. */
+__rte_msvc_pack
 struct mlx5_wqe_cseg {
 	uint32_t opcode;
 	uint32_t sq_ds;
@@ -336,10 +337,12 @@ struct mlx5_wqe_cseg {
 #define WQE_CSEG_WQE_INDEX_OFFSET	 8
 
 /* Header of data segment. Minimal size Data Segment */
+__rte_msvc_pack
 struct mlx5_wqe_dseg {
 	uint32_t bcount;
 	union {
 		uint8_t inline_data[MLX5_DSEG_MIN_INLINE_SIZE];
+		__rte_msvc_pack
 		struct {
 			uint32_t lkey;
 			uint64_t pbuf;
@@ -348,8 +351,10 @@ struct mlx5_wqe_dseg {
 } __rte_packed;
 
 /* Subset of struct WQE Ethernet Segment. */
+__rte_msvc_pack
 struct mlx5_wqe_eseg {
 	union {
+		__rte_msvc_pack
 		struct {
 			uint32_t swp_offs;
 			uint8_t	cs_flags;
@@ -362,6 +367,7 @@ struct mlx5_wqe_eseg {
 				uint16_t vlan_tag;
 			};
 		} __rte_packed;
+		__rte_msvc_pack
 		struct {
 			uint32_t offsets;
 			uint32_t flags;
@@ -371,6 +377,7 @@ struct mlx5_wqe_eseg {
 	};
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_qseg {
 	uint32_t reserved0;
 	uint32_t reserved1;
@@ -378,6 +385,7 @@ struct mlx5_wqe_qseg {
 	uint32_t qpn_cqn;
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_wseg {
 	uint32_t operation;
 	uint32_t lkey;
@@ -388,6 +396,7 @@ struct mlx5_wqe_wseg {
 } __rte_packed;
 
 /* The title WQEBB, header of WQE. */
+__rte_msvc_pack
 struct mlx5_wqe {
 	union {
 		struct mlx5_wqe_cseg cseg;
@@ -437,6 +446,7 @@ struct mlx5_cqe {
 	uint8_t lro_num_seg;
 	union {
 		uint8_t user_index_bytes[3];
+		__rte_msvc_pack
 		struct {
 			uint8_t user_index_hi;
 			uint16_t user_index_low;
@@ -460,6 +470,7 @@ struct mlx5_cqe_ts {
 	uint8_t op_own;
 };
 
+__rte_msvc_pack
 struct mlx5_wqe_rseg {
 	uint64_t raddr;
 	uint32_t rkey;
@@ -479,6 +490,7 @@ struct mlx5_wqe_rseg {
 #define MLX5_UMR_KLM_NUM_ALIGN \
 	(MLX5_UMR_KLM_PTR_ALIGN / sizeof(struct mlx5_klm))
 
+__rte_msvc_pack
 struct mlx5_wqe_umr_cseg {
 	uint32_t if_cf_toe_cq_res;
 	uint32_t ko_to_bs;
@@ -486,6 +498,7 @@ struct mlx5_wqe_umr_cseg {
 	uint32_t rsvd1[8];
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_mkey_cseg {
 	uint32_t fr_res_af_sf;
 	uint32_t qpn_mkey;
@@ -549,6 +562,7 @@ enum {
 #define MLX5_CRYPTO_MMO_TYPE_OFFSET 24
 #define MLX5_CRYPTO_MMO_OP_OFFSET 20
 
+__rte_msvc_pack
 struct mlx5_wqe_umr_bsf_seg {
 	/*
 	 * bs_bpt_eo_es contains:
@@ -582,6 +596,7 @@ struct mlx5_wqe_umr_bsf_seg {
 #pragma GCC diagnostic ignored "-Wpedantic"
 #endif
 
+__rte_msvc_pack
 struct mlx5_umr_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_umr_cseg ucseg;
@@ -592,18 +607,21 @@ struct mlx5_umr_wqe {
 	};
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_rdma_write_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_rseg rseg;
 	struct mlx5_wqe_dseg dseg[];
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_send_en_seg {
 	uint32_t reserve[2];
 	uint32_t sqnpc;
 	uint32_t qpn;
 } __rte_packed;
 
+__rte_msvc_pack
 struct mlx5_wqe_send_en_wqe {
 	struct mlx5_wqe_cseg ctr;
 	struct mlx5_wqe_send_en_seg sseg;
@@ -650,6 +668,7 @@ struct mlx5_wqe_metadata_seg {
 	uint64_t addr;
 };
 
+__rte_msvc_pack
 struct mlx5_gga_wqe {
 	uint32_t opcode;
 	uint32_t sq_ds;
@@ -663,16 +682,19 @@ struct mlx5_gga_wqe {
 } __rte_packed;
 
 union mlx5_gga_compress_opaque {
+	__rte_msvc_pack
 	struct {
 		uint32_t syndrome;
 		uint32_t reserved0;
 		uint32_t scattered_length;
 		union {
+			__rte_msvc_pack
 			struct {
 				uint32_t reserved1[5];
 				uint32_t crc32;
 				uint32_t adler32;
 			} v1 __rte_packed;
+			__rte_msvc_pack
 			struct {
 				uint32_t crc32;
 				uint32_t adler32;
@@ -685,9 +707,11 @@ struct mlx5_gga_wqe {
 };
 
 union mlx5_gga_crypto_opaque {
+	__rte_msvc_pack
 	struct {
 		uint32_t syndrome;
 		uint32_t reserved0[2];
+		__rte_msvc_pack
 		struct {
 			uint32_t iv[3];
 			uint32_t tag_size;
@@ -4134,6 +4158,7 @@ enum mlx5_aso_op {
 #define MLX5_ASO_CSEG_READ_ENABLE 1
 
 /* ASO WQE CTRL segment. */
+__rte_msvc_pack
 struct mlx5_aso_cseg {
 	uint32_t va_h;
 	uint32_t va_l_r;
@@ -4150,6 +4175,7 @@ struct mlx5_aso_cseg {
 #define MLX5_MTR_MAX_TOKEN_VALUE INT32_MAX
 
 /* A meter data segment - 2 per ASO WQE. */
+__rte_msvc_pack
 struct mlx5_aso_mtr_dseg {
 	uint32_t v_bo_sc_bbog_mm;
 	/*
@@ -4191,6 +4217,7 @@ struct mlx5_aso_mtr_dseg {
 #define MLX5_ASO_MTRS_PER_POOL 128
 
 /* ASO WQE data segment. */
+__rte_msvc_pack
 struct mlx5_aso_dseg {
 	union {
 		uint8_t data[MLX5_ASO_WQE_DSEG_SIZE];
@@ -4199,6 +4226,7 @@ struct mlx5_aso_dseg {
 } __rte_packed;
 
 /* ASO WQE. */
+__rte_msvc_pack
 struct mlx5_aso_wqe {
 	struct mlx5_wqe_cseg general_cseg;
 	struct mlx5_aso_cseg aso_cseg;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 07/16] dma/ioat: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 06/16] common/mlx5: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 08/16] net/i40e: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/dma/ioat/ioat_hw_defs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/ioat/ioat_hw_defs.h b/drivers/dma/ioat/ioat_hw_defs.h
index dc3493a..6e32807 100644
--- a/drivers/dma/ioat/ioat_hw_defs.h
+++ b/drivers/dma/ioat/ioat_hw_defs.h
@@ -52,6 +52,7 @@
 #define	IOAT_DMACAP_PQ		(1 << 9)
 #define	IOAT_DMACAP_DMA_DIF	(1 << 10)
 
+__rte_msvc_pack
 struct ioat_registers {
 	uint8_t		chancnt;
 	uint8_t		xfercap;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 08/16] net/i40e: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 07/16] dma/ioat: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 09/16] net/iavf: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/i40e/base/i40e_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index aa5dc61..28439e3 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -177,6 +177,7 @@ static inline uint64_t i40e_read64_addr(volatile void *addr)
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct i40e_dma_mem {
 	void *va;
 	u64 pa;
@@ -188,6 +189,7 @@ struct i40e_dma_mem {
 			i40e_allocate_dma_mem_d(h, m, s, a)
 #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
 
+__rte_msvc_pack
 struct i40e_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 09/16] net/iavf: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 08/16] net/i40e: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 10/16] net/ice: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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>
---
 drivers/net/iavf/iavf_ipsec_crypto.h | 4 +++-
 drivers/net/iavf/iavf_rxtx.c         | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

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 {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 10/16] net/ice: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 09/16] net/iavf: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 11/16] net/mlx5: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ice/base/ice_osdep.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 0e14b93..087dc6a 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -187,6 +187,7 @@
 #define BITS_PER_BYTE       8
 
 /* memory allocation tracking */
+__rte_msvc_pack
 struct ice_dma_mem {
 	void *va;
 	u64 pa;
@@ -194,6 +195,7 @@ struct ice_dma_mem {
 	const void *zone;
 } __rte_packed;
 
+__rte_msvc_pack
 struct ice_virt_mem {
 	void *va;
 	u32 size;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 11/16] net/mlx5: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 10/16] net/ice: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 12/16] net/octeon_ep: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/hws/mlx5dr.h   | 1 +
 drivers/net/mlx5/mlx5.h         | 1 +
 drivers/net/mlx5/mlx5_flow.h    | 5 +++++
 drivers/net/mlx5/mlx5_hws_cnt.h | 1 +
 drivers/net/mlx5/mlx5_utils.h   | 4 ++++
 5 files changed, 12 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 80e118a..cd5bb05 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -300,6 +300,7 @@ struct mlx5dr_action_dest_attr {
 	};
 };
 
+__rte_msvc_pack
 struct mlx5dr_crc_encap_entropy_hash_fields {
 	union mlx5dr_crc_encap_entropy_hash_ip_field dst;
 	union mlx5dr_crc_encap_entropy_hash_ip_field src;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 0091a24..6228ee8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -221,6 +221,7 @@ struct mlx5_dev_spawn_data {
 }
 
 /** Data associated with socket messages. */
+__rte_msvc_pack
 struct mlx5_flow_dump_req  {
 	uint32_t port_id; /**< There are plans in DPDK to extend port_id. */
 	uint64_t flow_id;
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 0065727..da0f8b7 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -658,6 +658,7 @@ struct mlx5_flow_dv_tag_resource {
 };
 
 /* Modify resource structure */
+__rte_msvc_pack
 struct mlx5_flow_dv_modify_hdr_resource {
 	struct mlx5_list_entry entry;
 	void *action; /**< Modify header action object. */
@@ -812,6 +813,7 @@ struct mlx5_flow_dv_dest_array_resource {
 
 
 /** Device flow handle structure for DV mode only. */
+__rte_msvc_pack
 struct mlx5_flow_handle_dv {
 	/* Flow DV api: */
 	struct mlx5_flow_dv_matcher *matcher; /**< Cache to matcher. */
@@ -830,6 +832,7 @@ struct mlx5_flow_handle_dv {
 } __rte_packed;
 
 /** Device flow handle structure: used both for creating & destroying. */
+__rte_msvc_pack
 struct mlx5_flow_handle {
 	SILIST_ENTRY(uint32_t)next;
 	struct mlx5_vf_vlan vf_vlan; /**< Structure for VF VLAN workaround. */
@@ -1231,6 +1234,7 @@ struct mlx5_flow_attr {
 };
 
 /* Flow structure. */
+__rte_msvc_pack
 struct rte_flow {
 	uint32_t dev_handles;
 	/**< Device flow handles that are part of the flow. */
@@ -1304,6 +1308,7 @@ enum {
 #endif
 
 /** HWS flow struct. */
+__rte_msvc_pack
 struct rte_flow_hw {
 	/** The table flow allcated from. */
 	struct rte_flow_template_table *table;
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h
index e005960..1f53a1a 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.h
+++ b/drivers/net/mlx5/mlx5_hws_cnt.h
@@ -133,6 +133,7 @@ enum {
 };
 
 /* HWS counter age parameter. */
+__rte_msvc_pack
 struct mlx5_hws_age_param {
 	uint32_t timeout; /* Aging timeout in seconds (atomically accessed). */
 	uint32_t sec_since_last_hit;
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index f3c0d76..cf80e5e 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -118,6 +118,7 @@ struct mlx5_l3t_level_tbl {
 };
 
 /* L3 word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_word {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -128,6 +129,7 @@ struct mlx5_l3t_entry_word {
 } __rte_packed;
 
 /* L3 double word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_dword {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -138,6 +140,7 @@ struct mlx5_l3t_entry_dword {
 } __rte_packed;
 
 /* L3 quad word entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_qword {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
@@ -148,6 +151,7 @@ struct mlx5_l3t_entry_qword {
 } __rte_packed;
 
 /* L3 pointer entry table data structure. */
+__rte_msvc_pack
 struct mlx5_l3t_entry_ptr {
 	uint32_t idx; /* Table index. */
 	uint64_t ref_cnt; /* Table ref_cnt. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 12/16] net/octeon_ep: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 11/16] net/mlx5: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 13/16] app/testpmd: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/octeon_ep/otx_ep_mbox.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/octeon_ep/otx_ep_mbox.h b/drivers/net/octeon_ep/otx_ep_mbox.h
index a3fc15c..005fce3 100644
--- a/drivers/net/octeon_ep/otx_ep_mbox.h
+++ b/drivers/net/octeon_ep/otx_ep_mbox.h
@@ -70,6 +70,7 @@ enum otx_ep_link_autoneg {
 #define OTX_EP_MBOX_MORE_FRAG_FLAG 1
 #define OTX_EP_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1)
 
+__rte_msvc_pack
 union otx_ep_mbox_word {
 	uint64_t u64;
 	struct {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 13/16] app/testpmd: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 12/16] net/octeon_ep: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 14/16] app/test: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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>
---
 app/test-pmd/csumonly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 6711dda..f24c381 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -92,7 +92,7 @@ struct testpmd_offload_info {
 struct simple_gre_hdr {
 	uint16_t flags;
 	uint16_t proto;
-} __rte_packed;
+};
 
 static uint16_t
 get_udptcp_checksum(struct rte_mbuf *m, void *l3_hdr, uint16_t l4_off,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 14/16] app/test: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 13/16] app/testpmd: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 15/16] examples: " Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 16/16] crypto/mlx5: " Tyler Retzlaff
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test/test_efd.c    | 1 +
 app/test/test_hash.c   | 1 +
 app/test/test_member.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/app/test/test_efd.c b/app/test/test_efd.c
index 1c0986b..df176a0 100644
--- a/app/test/test_efd.c
+++ b/app/test/test_efd.c
@@ -33,6 +33,7 @@
 static unsigned int test_socket_id;
 
 /* 5-tuple key type */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index d586878..08c1773 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -79,6 +79,7 @@
  * Should be packed to avoid holes with potentially
  * undefined content in the middle.
  */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
diff --git a/app/test/test_member.c b/app/test/test_member.c
index 5a4d275..ccd481a 100644
--- a/app/test/test_member.c
+++ b/app/test/test_member.c
@@ -32,6 +32,7 @@
 struct rte_member_setsum *setsum_sketch;
 
 /* 5-tuple key type */
+__rte_msvc_pack
 struct flow_key {
 	uint32_t ip_src;
 	uint32_t ip_dst;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 15/16] examples: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 14/16] app/test: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  2024-04-16  0:05   ` [PATCH v4 16/16] crypto/mlx5: " Tyler Retzlaff
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

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>
---
 examples/common/neon/port_group.h |  1 +
 examples/ip_pipeline/cli.c        | 10 +++++-----
 examples/ipsec-secgw/ipsec.h      |  1 +
 examples/l3fwd-power/main.c       |  2 ++
 examples/ptpclient/ptpclient.c    |  8 ++++++++
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/examples/common/neon/port_group.h b/examples/common/neon/port_group.h
index 421e2e8..bd40590 100644
--- a/examples/common/neon/port_group.h
+++ b/examples/common/neon/port_group.h
@@ -21,6 +21,7 @@
 port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1,
 		  uint16x8_t dp2)
 {
+	__rte_msvc_pack
 	union {
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index e8269ea..aad6c78 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -2571,7 +2571,7 @@ struct pkt_key_qinq {
 	uint16_t svlan;
 	uint16_t ethertype_cvlan;
 	uint16_t cvlan;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_5tuple {
 	uint8_t time_to_live;
@@ -2581,7 +2581,7 @@ struct pkt_key_ipv4_5tuple {
 	uint32_t da;
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_5tuple {
 	uint16_t payload_length;
@@ -2591,15 +2591,15 @@ struct pkt_key_ipv6_5tuple {
 	uint8_t da[16];
 	uint16_t sp;
 	uint16_t dp;
-} __rte_packed;
+};
 
 struct pkt_key_ipv4_addr {
 	uint32_t addr;
-} __rte_packed;
+};
 
 struct pkt_key_ipv6_addr {
 	uint8_t addr[16];
-} __rte_packed;
+};
 
 static uint32_t
 parse_match(char **tokens,
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index bdcada1..bdc6045 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -277,6 +277,7 @@ struct socket_ctx {
 	struct rte_mempool *session_pool;
 };
 
+__rte_msvc_pack
 struct cnt_blk {
 	uint32_t salt;
 	uint64_t iv;
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index f4adcf4..a3be37b 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -278,6 +278,7 @@ struct lcore_rx_queue {
 #define DEFAULT_HASH_FUNC       rte_jhash
 #endif
 
+__rte_msvc_pack
 struct ipv4_5tuple {
 	uint32_t ip_dst;
 	uint32_t ip_src;
@@ -286,6 +287,7 @@ struct ipv4_5tuple {
 	uint8_t  proto;
 } __rte_packed;
 
+__rte_msvc_pack
 struct ipv6_5tuple {
 	uint8_t  ip_dst[IPV6_ADDR_LEN];
 	uint8_t  ip_src[IPV6_ADDR_LEN];
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index afb61bb..cdd73fd 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -56,6 +56,7 @@
 };
 
 /* Structs used for PTP handling. */
+__rte_msvc_pack
 struct tstamp {
 	uint16_t   sec_msb;
 	uint32_t   sec_lsb;
@@ -66,11 +67,13 @@ struct clock_id {
 	uint8_t id[8];
 };
 
+__rte_msvc_pack
 struct port_id {
 	struct clock_id        clock_id;
 	uint16_t               port_number;
 }  __rte_packed;
 
+__rte_msvc_pack
 struct ptp_header {
 	uint8_t              msg_type;
 	uint8_t              ver;
@@ -86,22 +89,26 @@ struct ptp_header {
 	int8_t               log_message_interval;
 } __rte_packed;
 
+__rte_msvc_pack
 struct sync_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct follow_up_msg {
 	struct ptp_header   hdr;
 	struct tstamp       precise_origin_tstamp;
 	uint8_t             suffix[];
 } __rte_packed;
 
+__rte_msvc_pack
 struct delay_req_msg {
 	struct ptp_header   hdr;
 	struct tstamp       origin_tstamp;
 } __rte_packed;
 
+__rte_msvc_pack
 struct delay_resp_msg {
 	struct ptp_header    hdr;
 	struct tstamp        rx_tstamp;
@@ -110,6 +117,7 @@ struct delay_resp_msg {
 } __rte_packed;
 
 struct ptp_message {
+	__rte_msvc_pack
 	union {
 		struct ptp_header          header;
 		struct sync_msg            sync;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH v4 16/16] crypto/mlx5: pack structures when building with MSVC
  2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-04-16  0:05   ` [PATCH v4 15/16] examples: " Tyler Retzlaff
@ 2024-04-16  0:05   ` Tyler Retzlaff
  15 siblings, 0 replies; 75+ messages in thread
From: Tyler Retzlaff @ 2024-04-16  0:05 UTC (permalink / raw)
  To: dev
  Cc: Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang, Yuying Zhang, Tyler Retzlaff

Add __rte_msvc_pack to all __rte_packed structs to cause packing
when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/crypto/mlx5/mlx5_crypto.h     | 1 +
 drivers/crypto/mlx5/mlx5_crypto_gcm.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/crypto/mlx5/mlx5_crypto.h b/drivers/crypto/mlx5/mlx5_crypto.h
index 36dacdc..3b4916d 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.h
+++ b/drivers/crypto/mlx5/mlx5_crypto.h
@@ -95,6 +95,7 @@ struct mlx5_crypto_devarg_params {
 	uint32_t is_aes_gcm:1;
 };
 
+__rte_msvc_pack
 struct mlx5_crypto_session {
 	union {
 		/**< AES-XTS configuration. */
diff --git a/drivers/crypto/mlx5/mlx5_crypto_gcm.c b/drivers/crypto/mlx5/mlx5_crypto_gcm.c
index fc6ade6..9a2c438 100644
--- a/drivers/crypto/mlx5/mlx5_crypto_gcm.c
+++ b/drivers/crypto/mlx5/mlx5_crypto_gcm.c
@@ -62,6 +62,7 @@ struct mlx5_crypto_gcm_data {
 	uint32_t dst_mkey;
 };
 
+__rte_msvc_pack
 struct mlx5_crypto_gcm_tag_cpy_info {
 	void *digest;
 	uint8_t tag_len;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 03/15] net: pack structures when building with MSVC
  2024-03-20 21:05 ` [PATCH 03/15] net: " Tyler Retzlaff
@ 2024-10-07  1:14   ` Stephen Hemminger
  0 siblings, 0 replies; 75+ messages in thread
From: Stephen Hemminger @ 2024-10-07  1:14 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Akhil Goyal, Aman Singh, Anatoly Burakov, Bruce Richardson,
	Byron Marohn, Conor Walsh, Cristian Dumitrescu,
	Dariusz Sosnowski, David Hunt, Jerin Jacob, Jingjing Wu,
	Kirill Rybalchenko, Konstantin Ananyev, Matan Azrad, Ori Kam,
	Radu Nicolau, Ruifeng Wang, Sameh Gobriel, Sivaprasad Tummala,
	Suanming Mou, Sunil Kumar Kori, Vamsi Attunuru,
	Viacheslav Ovsiienko, Vladimir Medvedkin, Yipeng Wang,
	Yuying Zhang

On Wed, 20 Mar 2024 14:05:59 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing
> when building with MSVC.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/net/rte_arp.h      | 2 ++
>  lib/net/rte_dtls.h     | 1 +
>  lib/net/rte_esp.h      | 2 ++
>  lib/net/rte_ether.h    | 1 +
>  lib/net/rte_geneve.h   | 1 +
>  lib/net/rte_gre.h      | 4 ++++
>  lib/net/rte_gtp.h      | 5 +++++
>  lib/net/rte_ib.h       | 1 +
>  lib/net/rte_icmp.h     | 3 +++
>  lib/net/rte_ip.h       | 4 ++++
>  lib/net/rte_l2tpv2.h   | 4 ++++
>  lib/net/rte_macsec.h   | 2 ++
>  lib/net/rte_mpls.h     | 1 +
>  lib/net/rte_pdcp_hdr.h | 4 ++++
>  lib/net/rte_ppp.h      | 1 +
>  lib/net/rte_sctp.h     | 1 +
>  lib/net/rte_tcp.h      | 1 +
>  lib/net/rte_tls.h      | 1 +
>  lib/net/rte_udp.h      | 1 +
>  lib/net/rte_vxlan.h    | 2 ++

This no longer applies, need to rebase this series.
Address the comments from Bruce in previous patch as well.

^ permalink raw reply	[flat|nested] 75+ messages in thread

end of thread, other threads:[~2024-10-07  1:14 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
2024-03-20 21:05 ` [PATCH 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-03-20 21:05 ` [PATCH 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
2024-03-21 16:02   ` Bruce Richardson
2024-03-20 21:05 ` [PATCH 03/15] net: " Tyler Retzlaff
2024-10-07  1:14   ` Stephen Hemminger
2024-03-20 21:06 ` [PATCH 04/15] common/iavf: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 05/15] common/idpf: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 06/15] common/mlx5: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 07/15] dma/ioat: " Tyler Retzlaff
2024-03-21 16:13   ` Bruce Richardson
2024-03-27 22:51     ` Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 08/15] net/i40e: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 09/15] net/iavf: " Tyler Retzlaff
2024-03-21 16:26   ` Bruce Richardson
2024-03-20 21:06 ` [PATCH 10/15] net/ice: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 11/15] net/mlx5: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 12/15] net/octeon_ep: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 13/15] app/testpmd: " Tyler Retzlaff
2024-03-21 16:28   ` Bruce Richardson
2024-03-20 21:06 ` [PATCH 14/15] app/test: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 15/15] examples: " Tyler Retzlaff
2024-03-21 16:31   ` Bruce Richardson
2024-03-21 15:32 ` [PATCH 00/15] fix packing of structs " Stephen Hemminger
2024-03-21 15:46   ` Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 03/15] net: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 04/15] common/iavf: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 05/15] common/idpf: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 06/15] common/mlx5: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 07/15] dma/ioat: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 08/15] net/i40e: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 09/15] net/iavf: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 10/15] net/ice: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 11/15] net/mlx5: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 12/15] net/octeon_ep: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 13/15] app/testpmd: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 14/15] app/test: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 15/15] examples: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 03/16] net: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 04/16] common/iavf: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 05/16] common/idpf: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 06/16] common/mlx5: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 07/16] dma/ioat: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 08/16] net/i40e: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 09/16] net/iavf: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 10/16] net/ice: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 11/16] net/mlx5: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 12/16] net/octeon_ep: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 13/16] app/testpmd: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 14/16] app/test: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 15/16] examples: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 16/16] crypto/mlx5: " Tyler Retzlaff
2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
2024-04-16  0:04   ` [PATCH v4 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-04-16  0:04   ` [PATCH v4 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 03/16] net: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 04/16] common/iavf: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 05/16] common/idpf: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 06/16] common/mlx5: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 07/16] dma/ioat: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 08/16] net/i40e: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 09/16] net/iavf: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 10/16] net/ice: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 11/16] net/mlx5: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 12/16] net/octeon_ep: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 13/16] app/testpmd: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 14/16] app/test: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 15/16] examples: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 16/16] crypto/mlx5: " Tyler Retzlaff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).