[PATCH v9 17/30] drivers/vdpa: replace packed attributes
Andre Muezerie
andremue at linux.microsoft.com
Thu Jan 9 01:48:22 CET 2025
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 at linux.microsoft.com>
Reviewed-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
drivers/vdpa/ifc/base/ifcvf.h | 4 ++--
drivers/vdpa/mlx5/mlx5_vdpa.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.h
index 04c81c8196..0c3b8956c5 100644
--- a/drivers/vdpa/ifc/base/ifcvf.h
+++ b/drivers/vdpa/ifc/base/ifcvf.h
@@ -115,11 +115,11 @@ struct ifcvf_pci_common_cfg {
u32 queue_used_hi;
};
-struct ifcvf_net_config {
+struct __rte_packed_begin ifcvf_net_config {
u8 mac[6];
u16 status;
u16 max_virtqueue_pairs;
-} __rte_packed;
+} __rte_packed_end;
struct ifcvf_pci_mem_resource {
u64 phys_addr; /**< Physical address, 0 if not resource. */
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h
index e156520172..a398aa22ce 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.h
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.h
@@ -90,13 +90,13 @@ enum mlx5_vdpa_task_type {
};
/* Generic task information and size must be multiple of 4B. */
-struct __rte_aligned(4) mlx5_vdpa_task {
+struct __rte_aligned(4) __rte_packed_begin mlx5_vdpa_task {
struct mlx5_vdpa_priv *priv;
enum mlx5_vdpa_task_type type;
RTE_ATOMIC(uint32_t) *remaining_cnt;
RTE_ATOMIC(uint32_t) *err_cnt;
uint32_t idx;
-} __rte_packed;
+} __rte_packed_end;
/* Generic mlx5_vdpa_c_thread information. */
struct mlx5_vdpa_c_thread {
--
2.47.0.vfs.0.3
More information about the dev
mailing list