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 EF5AA45D31;
	Wed, 27 Nov 2024 01:54:46 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C7BF342DA6;
	Wed, 27 Nov 2024 01:53:25 +0100 (CET)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id 57CF5402E0
 for <dev@dpdk.org>; Wed, 27 Nov 2024 01:53:04 +0100 (CET)
Received: by linux.microsoft.com (Postfix, from userid 1213)
 id 3FDA92057220; Tue, 26 Nov 2024 16:53:02 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3FDA92057220
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1732668783;
 bh=Nb7LVScUlg8etU769Fjg7eQZPfceqjyrqLkPjWDaUnY=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=BTOewsRGHeU1sCg+6Y/9+zDXSsul4+9MH1+HP/svS6WzVvSHuib+BzbAF4M/Fq8Ig
 P5WW9gy97/Klli58lQYrPoxuEhZhdShARSVNn4k/stVjlrCZ6uJZTO/FjXr1BLMjwx
 iMG0aUQVkolRny8EO9lC3Hy2AolyNpnFt5BslxkU=
From: Andre Muezerie <andremue@linux.microsoft.com>
To: roretzla@linux.microsoft.com
Cc: aman.deep.singh@intel.com, anatoly.burakov@intel.com,
 bruce.richardson@intel.com, byron.marohn@intel.com, conor.walsh@intel.com,
 cristian.dumitrescu@intel.com, david.hunt@intel.com, dev@dpdk.org,
 dsosnowski@nvidia.com, gakhil@marvell.com, jerinj@marvell.com,
 jingjing.wu@intel.com, kirill.rybalchenko@intel.com,
 konstantin.v.ananyev@yandex.ru, matan@nvidia.com, orika@nvidia.com,
 radu.nicolau@intel.com, ruifeng.wang@arm.com, sameh.gobriel@intel.com,
 sivaprasad.tummala@amd.com, skori@marvell.com, stephen@networkplumber.org,
 suanmingm@nvidia.com, vattunuru@marvell.com, viacheslavo@nvidia.com,
 vladimir.medvedkin@intel.com, yipeng1.wang@intel.com,
 Andre Muezerie <andremue@linux.microsoft.com>
Subject: [PATCH v6 15/30] drivers/raw: replace packed attributes
Date: Tue, 26 Nov 2024 16:52:26 -0800
Message-Id: <1732668761-5556-16-git-send-email-andremue@linux.microsoft.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1732668761-5556-1-git-send-email-andremue@linux.microsoft.com>
References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com>
 <1732668761-5556-1-git-send-email-andremue@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

MSVC struct packing is not compatible with GCC. Replace macro
__rte_packed with __rte_packed_begin to push existing pack value
and set packing to 1-byte and macro __rte_packed_end to restore
the pack value prior to the push.

Macro __rte_packed_end is deliberately utilized to trigger a
MSVC compiler warning if no existing packing has been pushed allowing
easy identification of locations where the __rte_packed_begin is
missing.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 drivers/raw/ifpga/afu_pmd_n3000.h    | 8 ++++----
 drivers/raw/ifpga/base/opae_hw_api.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/raw/ifpga/afu_pmd_n3000.h b/drivers/raw/ifpga/afu_pmd_n3000.h
index f6b6e07c6b..a74025cb3c 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.h
+++ b/drivers/raw/ifpga/afu_pmd_n3000.h
@@ -211,7 +211,7 @@ typedef union {
 	};
 } msgdma_desc_ctrl;
 
-typedef struct __rte_packed {
+typedef __rte_packed_begin struct {
 	uint32_t rd_address;
 	uint32_t wr_address;
 	uint32_t len;
@@ -223,7 +223,7 @@ typedef struct __rte_packed {
 	uint32_t rd_address_ext;
 	uint32_t wr_address_ext;
 	msgdma_desc_ctrl control;
-} msgdma_ext_desc;
+} __rte_packed_end msgdma_ext_desc;
 
 typedef union {
 	uint32_t csr;
@@ -279,13 +279,13 @@ typedef union {
 	};
 } msgdma_seq_num;
 
-typedef struct __rte_packed {
+typedef __rte_packed_begin struct {
 	msgdma_status status;
 	msgdma_ctrl ctrl;
 	msgdma_fill_level fill_level;
 	msgdma_rsp_level rsp;
 	msgdma_seq_num seq_num;
-} msgdma_csr;
+} __rte_packed_end msgdma_csr;
 
 #define CSR_STATUS(csr)   (&(((msgdma_csr *)(csr))->status))
 #define CSR_CONTROL(csr)  (&(((msgdma_csr *)(csr))->ctrl))
diff --git a/drivers/raw/ifpga/base/opae_hw_api.h b/drivers/raw/ifpga/base/opae_hw_api.h
index 613563a0b4..5957f67417 100644
--- a/drivers/raw/ifpga/base/opae_hw_api.h
+++ b/drivers/raw/ifpga/base/opae_hw_api.h
@@ -343,9 +343,9 @@ static inline void opae_adapter_remove_acc(struct opae_adapter *adapter,
 /* OPAE vBNG network datastruct */
 #define OPAE_ETHER_ADDR_LEN 6
 
-struct opae_ether_addr {
+__rte_packed_begin struct opae_ether_addr {
 	unsigned char addr_bytes[OPAE_ETHER_ADDR_LEN];
-} __rte_packed;
+} __rte_packed_end;
 
 /* OPAE vBNG network API*/
 int opae_manager_read_mac_rom(struct opae_manager *mgr, int port,
-- 
2.34.1