DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Akhil Goyal <gakhil@marvell.com>,
	Aman Singh <aman.deep.singh@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Byron Marohn <byron.marohn@intel.com>,
	Conor Walsh <conor.walsh@intel.com>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>,
	David Hunt <david.hunt@intel.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Kirill Rybalchenko <kirill.rybalchenko@intel.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	Matan Azrad <matan@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Radu Nicolau <radu.nicolau@intel.com>,
	Ruifeng Wang <ruifeng.wang@arm.com>,
	Sameh Gobriel <sameh.gobriel@intel.com>,
	Sivaprasad Tummala <sivaprasad.tummala@amd.com>,
	Suanming Mou <suanmingm@nvidia.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Vamsi Attunuru <vattunuru@marvell.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Yipeng Wang <yipeng1.wang@intel.com>,
	Yuying Zhang <Yuying.Zhang@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v2 06/15] common/mlx5: pack structures when building with MSVC
Date: Wed, 27 Mar 2024 16:09:09 -0700	[thread overview]
Message-ID: <1711580958-20808-7-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com>

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


  parent reply	other threads:[~2024-03-27 23:10 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 21:05 [PATCH 00/15] fix packing of structs " 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-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   ` Tyler Retzlaff [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1711580958-20808-7-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=Yuying.Zhang@intel.com \
    --cc=aman.deep.singh@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=byron.marohn@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=gakhil@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=jingjing.wu@intel.com \
    --cc=kirill.rybalchenko@intel.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=radu.nicolau@intel.com \
    --cc=ruifeng.wang@arm.com \
    --cc=sameh.gobriel@intel.com \
    --cc=sivaprasad.tummala@amd.com \
    --cc=skori@marvell.com \
    --cc=suanmingm@nvidia.com \
    --cc=vattunuru@marvell.com \
    --cc=viacheslavo@nvidia.com \
    --cc=vladimir.medvedkin@intel.com \
    --cc=yipeng1.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).