[v6,16/30] drivers/regex: 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/regex/cn9k/cn9k_regexdev.c | 4 ++--
drivers/regex/mlx5/mlx5_rxp.h | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
Comments
On Tue, Nov 26, 2024 at 04:52:27PM -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>
@@ -40,12 +40,12 @@ struct ree_rule_db_entry {
uint64_t value;
};
-struct ree_rule_db {
+__rte_packed_begin struct 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)
@@ -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 {
+__rte_packed_begin struct 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 {
+__rte_packed_begin struct 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 {
+__rte_packed_begin struct 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 {
+__rte_packed_begin struct 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 {