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>
---
lib/pipeline/rte_table_action.c | 64 ++++++++++++++++-----------------
1 file changed, 32 insertions(+), 32 deletions(-)
@@ -60,9 +60,9 @@ lb_cfg_check(struct rte_table_action_lb_config *cfg)
return 0;
}
-struct lb_data {
+__rte_packed_begin struct lb_data {
uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE];
-} __rte_packed;
+} __rte_packed_end;
static int
lb_apply(struct lb_data *data,
@@ -356,10 +356,10 @@ tm_cfg_check(struct rte_table_action_tm_config *tm)
return 0;
}
-struct tm_data {
+__rte_packed_begin struct tm_data {
uint32_t queue_id;
uint32_t reserved;
-} __rte_packed;
+} __rte_packed_end;
static int
tm_apply_check(struct rte_table_action_tm_params *p,
@@ -465,11 +465,11 @@ struct encap_qinq_data {
((((uint64_t)(s)) & 0x1LLU) << 8) | \
(((uint64_t)(ttl)) & 0xFFLLU)))
-struct __rte_aligned(2) encap_mpls_data {
+__rte_packed_begin struct __rte_aligned(2) encap_mpls_data {
struct rte_ether_hdr ether;
uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX];
uint32_t mpls_count;
-} __rte_packed;
+} __rte_packed_end;
#define PPP_PROTOCOL_IP 0x0021
@@ -487,42 +487,42 @@ struct encap_pppoe_data {
#define IP_PROTO_UDP 17
-struct __rte_aligned(2) encap_vxlan_ipv4_data {
+__rte_packed_begin struct __rte_aligned(2) encap_vxlan_ipv4_data {
struct rte_ether_hdr ether;
struct rte_ipv4_hdr ipv4;
struct rte_udp_hdr udp;
struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
-struct __rte_aligned(2) encap_vxlan_ipv4_vlan_data {
+__rte_packed_begin struct __rte_aligned(2) encap_vxlan_ipv4_vlan_data {
struct rte_ether_hdr ether;
struct rte_vlan_hdr vlan;
struct rte_ipv4_hdr ipv4;
struct rte_udp_hdr udp;
struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
-struct __rte_aligned(2) encap_vxlan_ipv6_data {
+__rte_packed_begin struct __rte_aligned(2) encap_vxlan_ipv6_data {
struct rte_ether_hdr ether;
struct rte_ipv6_hdr ipv6;
struct rte_udp_hdr udp;
struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
-struct __rte_aligned(2) encap_vxlan_ipv6_vlan_data {
+__rte_packed_begin struct __rte_aligned(2) encap_vxlan_ipv6_vlan_data {
struct rte_ether_hdr ether;
struct rte_vlan_hdr vlan;
struct rte_ipv6_hdr ipv6;
struct rte_udp_hdr udp;
struct rte_vxlan_hdr vxlan;
-} __rte_packed;
+} __rte_packed_end;
-struct __rte_aligned(2) encap_qinq_pppoe_data {
+__rte_packed_begin struct __rte_aligned(2) encap_qinq_pppoe_data {
struct rte_ether_hdr ether;
struct rte_vlan_hdr svlan;
struct rte_vlan_hdr cvlan;
struct pppoe_ppp_hdr pppoe_ppp;
-} __rte_packed;
+} __rte_packed_end;
static size_t
encap_data_size(struct rte_table_action_encap_config *encap)
@@ -1196,15 +1196,15 @@ nat_cfg_check(struct rte_table_action_nat_config *nat)
return 0;
}
-struct nat_ipv4_data {
+__rte_packed_begin struct nat_ipv4_data {
uint32_t addr;
uint16_t port;
-} __rte_packed;
+} __rte_packed_end;
-struct nat_ipv6_data {
+__rte_packed_begin struct nat_ipv6_data {
struct rte_ipv6_addr addr;
uint16_t port;
-} __rte_packed;
+} __rte_packed_end;
static size_t
nat_data_size(struct rte_table_action_nat_config *nat __rte_unused,
@@ -1493,9 +1493,9 @@ ttl_cfg_check(struct rte_table_action_ttl_config *ttl)
return 0;
}
-struct ttl_data {
+__rte_packed_begin struct ttl_data {
uint32_t n_packets;
-} __rte_packed;
+} __rte_packed_end;
#define TTL_INIT(data, decrement) \
((data)->n_packets = (decrement) ? 1 : 0)
@@ -1576,10 +1576,10 @@ stats_cfg_check(struct rte_table_action_stats_config *stats)
return 0;
}
-struct stats_data {
+__rte_packed_begin struct stats_data {
uint64_t n_packets;
uint64_t n_bytes;
-} __rte_packed;
+} __rte_packed_end;
static int
stats_apply(struct stats_data *data,
@@ -1602,9 +1602,9 @@ pkt_work_stats(struct stats_data *data,
/**
* RTE_TABLE_ACTION_TIME
*/
-struct time_data {
+__rte_packed_begin struct time_data {
uint64_t time;
-} __rte_packed;
+} __rte_packed_end;
static int
time_apply(struct time_data *data,
@@ -1649,7 +1649,7 @@ struct crypto_op_sym_iv_aad {
} iv_aad;
};
-struct sym_crypto_data {
+__rte_packed_begin struct sym_crypto_data {
union {
struct {
@@ -1717,7 +1717,7 @@ struct sym_crypto_data {
/** Private data size to store cipher iv / aad. */
uint8_t iv_aad_data[32];
-} __rte_packed;
+} __rte_packed_end;
static int
sym_crypto_cfg_check(struct rte_table_action_sym_crypto_config *cfg)
@@ -2052,9 +2052,9 @@ pkt_work_sym_crypto(struct rte_mbuf *mbuf, struct sym_crypto_data *data,
/**
* RTE_TABLE_ACTION_TAG
*/
-struct tag_data {
+__rte_packed_begin struct tag_data {
uint32_t tag;
-} __rte_packed;
+} __rte_packed_end;
static int
tag_apply(struct tag_data *data,
@@ -2096,9 +2096,9 @@ pkt4_work_tag(struct rte_mbuf *mbuf0,
/**
* RTE_TABLE_ACTION_DECAP
*/
-struct decap_data {
+__rte_packed_begin struct decap_data {
uint16_t n;
-} __rte_packed;
+} __rte_packed_end;
static int
decap_apply(struct decap_data *data,