From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1E61443E80;
	Tue, 16 Apr 2024 02:06:37 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0DFE240EF0;
	Tue, 16 Apr 2024 02:05:42 +0200 (CEST)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id A1C9740647
 for <dev@dpdk.org>; Tue, 16 Apr 2024 02:05:16 +0200 (CEST)
Received: by linux.microsoft.com (Postfix, from userid 1086)
 id 7D98D20FD454; Mon, 15 Apr 2024 17:05:15 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7D98D20FD454
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1713225915;
 bh=FwzU4Tynj385YOa5Ce/7bdtn47N8DAUvd61/GghvVvE=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=n2s4ulTdxnz/PaXXVagpzPVdOJCIdIGVYgdJvgBmnV0QobtkBa4DjeTOt8uX1Smcf
 DpytYMoS5oCW51jkklXXjfqd4e61vJa4x8LrfJd6LwpV0faL2J3EVke9C8j1jR9jz0
 bRoK2rpUzKIrZyjngpWxJ8JVsUg6dekHxI6eknKw=
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 v4 11/16] net/mlx5: pack structures when building with MSVC
Date: Mon, 15 Apr 2024 17:05:08 -0700
Message-Id: <1713225913-20792-12-git-send-email-roretzla@linux.microsoft.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1713225913-20792-1-git-send-email-roretzla@linux.microsoft.com>
References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com>
 <1713225913-20792-1-git-send-email-roretzla@linux.microsoft.com>
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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