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 <andre...@linux.microsoft.com> Reviewed-by: Tyler Retzlaff <roret...@linux.microsoft.com> --- drivers/regex/cn9k/cn9k_regexdev.c | 4 ++-- drivers/regex/mlx5/mlx5_rxp.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/regex/cn9k/cn9k_regexdev.c b/drivers/regex/cn9k/cn9k_regexdev.c index aa809ab5bf..5abc7e22bc 100644 --- a/drivers/regex/cn9k/cn9k_regexdev.c +++ b/drivers/regex/cn9k/cn9k_regexdev.c @@ -40,12 +40,12 @@ struct ree_rule_db_entry { uint64_t value; }; -struct ree_rule_db { +struct __rte_packed_begin ree_rule_db { uint32_t version; uint32_t revision; uint32_t number_of_entries; struct ree_rule_db_entry entries[]; -} __rte_packed; +} __rte_packed_end; static void qp_memzone_name_get(char *name, int size, int dev_id, int qp_id) diff --git a/drivers/regex/mlx5/mlx5_rxp.h b/drivers/regex/mlx5/mlx5_rxp.h index b38b53cc14..08b9a2680b 100644 --- a/drivers/regex/mlx5/mlx5_rxp.h +++ b/drivers/regex/mlx5/mlx5_rxp.h @@ -42,14 +42,14 @@ #define MLX5_RXP_RESP_STATUS_PMI_EOJ (1 << 14) /* This describes the header the RXP expects for any search data. */ -struct mlx5_rxp_job_desc { +struct __rte_packed_begin mlx5_rxp_job_desc { uint32_t job_id; uint16_t ctrl; uint16_t len; uint16_t subset[4]; -} __rte_packed; +} __rte_packed_end; -struct mlx5_rxp_response_desc { +struct __rte_packed_begin mlx5_rxp_response_desc { uint32_t job_id; uint16_t status; uint8_t detected_match_count; @@ -58,13 +58,13 @@ struct mlx5_rxp_response_desc { uint16_t instruction_count; uint16_t latency_count; uint16_t pmi_min_byte_ptr; -} __rte_packed; +} __rte_packed_end; -struct mlx5_rxp_match_tuple { +struct __rte_packed_begin mlx5_rxp_match_tuple { uint32_t rule_id; uint16_t start_ptr; uint16_t length; -} __rte_packed; +} __rte_packed_end; struct mlx5_rxp_response { struct mlx5_rxp_response_desc header; @@ -115,11 +115,11 @@ struct mlx5_rxp_rof { struct mlx5_rxp_rof_entry *rof_entries; }; -struct mlx5_rxp_ctl_rules_pgm { +struct __rte_packed_begin mlx5_rxp_ctl_rules_pgm { struct mlx5_rxp_ctl_hdr hdr; uint32_t count; struct mlx5_rxp_rof_entry rules[]; -} __rte_packed; +} __rte_packed_end; /* RXP programming mode setting. */ enum mlx5_rxp_program_mode { -- 2.47.0.vfs.0.3