[v6,15/30] drivers/raw: replace packed attributes
Checks
Commit Message
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(-)
Comments
On Tue, Nov 26, 2024 at 04:52:26PM -0800, Andre Muezerie wrote:
> 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>
> ---
Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
@@ -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))
@@ -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,