From: Andre Muezerie <andremue@linux.microsoft.com>
To: roretzla@linux.microsoft.com
Cc: aman.deep.singh@intel.com, anatoly.burakov@intel.com,
bruce.richardson@intel.com, byron.marohn@intel.com,
conor.walsh@intel.com, cristian.dumitrescu@intel.com,
david.hunt@intel.com, dev@dpdk.org, dsosnowski@nvidia.com,
gakhil@marvell.com, jerinj@marvell.com, jingjing.wu@intel.com,
kirill.rybalchenko@intel.com, konstantin.v.ananyev@yandex.ru,
matan@nvidia.com, orika@nvidia.com, radu.nicolau@intel.com,
ruifeng.wang@arm.com, sameh.gobriel@intel.com,
sivaprasad.tummala@amd.com, skori@marvell.com,
stephen@networkplumber.org, suanmingm@nvidia.com,
vattunuru@marvell.com, viacheslavo@nvidia.com,
vladimir.medvedkin@intel.com, yipeng1.wang@intel.com,
Andre Muezerie <andremue@linux.microsoft.com>
Subject: [PATCH v6 27/30] lib/net: replace packed attributes
Date: Tue, 26 Nov 2024 16:52:38 -0800 [thread overview]
Message-ID: <1732668761-5556-28-git-send-email-andremue@linux.microsoft.com> (raw)
In-Reply-To: <1732668761-5556-1-git-send-email-andremue@linux.microsoft.com>
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/net/rte_arp.h | 6 ++++--
lib/net/rte_dtls.h | 3 ++-
lib/net/rte_esp.h | 6 ++++--
lib/net/rte_geneve.h | 3 ++-
lib/net/rte_gre.h | 12 ++++++++----
lib/net/rte_gtp.h | 15 ++++++++++-----
lib/net/rte_ib.h | 3 ++-
lib/net/rte_icmp.h | 9 ++++++---
lib/net/rte_ip4.h | 3 ++-
lib/net/rte_ip6.h | 12 ++++++++----
lib/net/rte_l2tpv2.h | 12 ++++++++----
lib/net/rte_macsec.h | 6 ++++--
lib/net/rte_mpls.h | 3 ++-
lib/net/rte_pdcp_hdr.h | 12 ++++++++----
lib/net/rte_ppp.h | 3 ++-
lib/net/rte_sctp.h | 3 ++-
lib/net/rte_tcp.h | 3 ++-
lib/net/rte_tls.h | 3 ++-
lib/net/rte_udp.h | 3 ++-
lib/net/rte_vxlan.h | 21 ++++++++++++++-------
20 files changed, 94 insertions(+), 47 deletions(-)
diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h
index 668cea1704..4032dd72a5 100644
--- a/lib/net/rte_arp.h
+++ b/lib/net/rte_arp.h
@@ -21,16 +21,18 @@ extern "C" {
/**
* ARP header IPv4 payload.
*/
+__rte_packed_begin
struct __rte_aligned(2) rte_arp_ipv4 {
struct rte_ether_addr arp_sha; /**< sender hardware address */
rte_be32_t arp_sip; /**< sender IP address */
struct rte_ether_addr arp_tha; /**< target hardware address */
rte_be32_t arp_tip; /**< target IP address */
-} __rte_packed;
+} __rte_packed_end;
/**
* ARP header.
*/
+__rte_packed_begin
struct __rte_aligned(2) rte_arp_hdr {
rte_be16_t arp_hardware; /**< format of hardware address */
#define RTE_ARP_HRD_ETHER 1 /**< ARP Ethernet address format */
@@ -47,7 +49,7 @@ struct __rte_aligned(2) rte_arp_hdr {
#define RTE_ARP_OP_INVREPLY 9 /**< response identifying peer */
struct rte_arp_ipv4 arp_data;
-} __rte_packed;
+} __rte_packed_end;
/**
* Make a RARP packet based on MAC addr.
diff --git a/lib/net/rte_dtls.h b/lib/net/rte_dtls.h
index 246cd8a72d..a341b2155e 100644
--- a/lib/net/rte_dtls.h
+++ b/lib/net/rte_dtls.h
@@ -30,6 +30,7 @@
* DTLS Header
*/
__extension__
+__rte_packed_begin
struct rte_dtls_hdr {
/** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */
uint8_t type;
@@ -48,6 +49,6 @@ struct rte_dtls_hdr {
#endif
/** The length (in bytes) of the following DTLS packet. */
rte_be16_t length;
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_DTLS_H */
diff --git a/lib/net/rte_esp.h b/lib/net/rte_esp.h
index 745a9847fe..156e26ec0a 100644
--- a/lib/net/rte_esp.h
+++ b/lib/net/rte_esp.h
@@ -16,17 +16,19 @@
/**
* ESP Header
*/
+__rte_packed_begin
struct rte_esp_hdr {
rte_be32_t spi; /**< Security Parameters Index */
rte_be32_t seq; /**< packet sequence number */
-} __rte_packed;
+} __rte_packed_end;
/**
* ESP Trailer
*/
+__rte_packed_begin
struct rte_esp_tail {
uint8_t pad_len; /**< number of pad bytes (0-255) */
uint8_t next_proto; /**< IPv4 or IPv6 or next layer header */
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_ESP_H_ */
diff --git a/lib/net/rte_geneve.h b/lib/net/rte_geneve.h
index eb2c85f1e9..66489c524e 100644
--- a/lib/net/rte_geneve.h
+++ b/lib/net/rte_geneve.h
@@ -34,6 +34,7 @@
* More-bits (optional) variable length options.
*/
__extension__
+__rte_packed_begin
struct rte_geneve_hdr {
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
uint8_t ver:2; /**< Version. */
@@ -52,7 +53,7 @@ struct rte_geneve_hdr {
uint8_t vni[3]; /**< Virtual network identifier. */
uint8_t reserved2; /**< Reserved. */
uint32_t opts[]; /**< Variable length options. */
-} __rte_packed;
+} __rte_packed_end;
/* GENEVE ETH next protocol types */
#define RTE_GENEVE_TYPE_ETH 0x6558 /**< Ethernet Protocol. */
diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h
index 1483e1b42d..d9e70c43c6 100644
--- a/lib/net/rte_gre.h
+++ b/lib/net/rte_gre.h
@@ -23,6 +23,7 @@
* GRE Header
*/
__extension__
+__rte_packed_begin
struct rte_gre_hdr {
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
uint16_t res2:4; /**< Reserved */
@@ -42,28 +43,31 @@ struct rte_gre_hdr {
uint16_t ver:3; /**< Version Number */
#endif
rte_be16_t proto; /**< Protocol Type */
-} __rte_packed;
+} __rte_packed_end;
/**
* Optional field checksum in GRE header
*/
+__rte_packed_begin
struct rte_gre_hdr_opt_checksum_rsvd {
rte_be16_t checksum;
rte_be16_t reserved1;
-} __rte_packed;
+} __rte_packed_end;
/**
* Optional field key in GRE header
*/
+__rte_packed_begin
struct rte_gre_hdr_opt_key {
rte_be32_t key;
-} __rte_packed;
+} __rte_packed_end;
/**
* Optional field sequence in GRE header
*/
+__rte_packed_begin
struct rte_gre_hdr_opt_sequence {
rte_be32_t sequence;
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_GRE_H_ */
diff --git a/lib/net/rte_gtp.h b/lib/net/rte_gtp.h
index ab06e23a6e..e2d3711304 100644
--- a/lib/net/rte_gtp.h
+++ b/lib/net/rte_gtp.h
@@ -24,6 +24,7 @@
* No optional fields and next extension header.
*/
__extension__
+__rte_packed_begin
struct rte_gtp_hdr {
union {
uint8_t gtp_hdr_info; /**< GTP header info */
@@ -48,20 +49,22 @@ struct rte_gtp_hdr {
uint8_t msg_type; /**< GTP message type */
rte_be16_t plen; /**< Total payload length */
rte_be32_t teid; /**< Tunnel endpoint ID */
-} __rte_packed;
+} __rte_packed_end;
/* Optional word of GTP header, present if any of E, S, PN is set. */
+__rte_packed_begin
struct rte_gtp_hdr_ext_word {
rte_be16_t sqn; /**< Sequence Number. */
uint8_t npdu; /**< N-PDU number. */
uint8_t next_ext; /**< Next Extension Header Type. */
-} __rte_packed;
+} __rte_packed_end;
/**
* Optional extension for GTP with next_ext set to 0x85
* defined based on RFC 38415-g30.
*/
__extension__
+__rte_packed_begin
struct rte_gtp_psc_generic_hdr {
uint8_t ext_hdr_len; /**< PDU ext hdr len in multiples of 4 bytes */
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -78,13 +81,14 @@ struct rte_gtp_psc_generic_hdr {
uint8_t spare:2; /**< type specific spare bits */
#endif
uint8_t data[0]; /**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
/**
* Optional extension for GTP with next_ext set to 0x85
* type0 defined based on RFC 38415-g30
*/
__extension__
+__rte_packed_begin
struct rte_gtp_psc_type0_hdr {
uint8_t ext_hdr_len; /**< PDU ext hdr len in multiples of 4 bytes */
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -105,13 +109,14 @@ struct rte_gtp_psc_type0_hdr {
uint8_t ppp:1; /**< Paging policy presence */
#endif
uint8_t data[0]; /**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
/**
* Optional extension for GTP with next_ext set to 0x85
* type1 defined based on RFC 38415-g30
*/
__extension__
+__rte_packed_begin
struct rte_gtp_psc_type1_hdr {
uint8_t ext_hdr_len; /**< PDU ext hdr len in multiples of 4 bytes */
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -134,7 +139,7 @@ struct rte_gtp_psc_type1_hdr {
uint8_t n_delay_ind:1; /**< N3/N9 delay result presence */
#endif
uint8_t data[0]; /**< variable length data fields */
-} __rte_packed;
+} __rte_packed_end;
/** GTP header length */
#define RTE_ETHER_GTP_HLEN \
diff --git a/lib/net/rte_ib.h b/lib/net/rte_ib.h
index a551f3753f..989d9d53b3 100644
--- a/lib/net/rte_ib.h
+++ b/lib/net/rte_ib.h
@@ -22,6 +22,7 @@
* IB Specification Vol 1-Release-1.4.
*/
__extension__
+__rte_packed_begin
struct rte_ib_bth {
uint8_t opcode; /**< Opcode. */
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
@@ -54,7 +55,7 @@ struct rte_ib_bth {
uint8_t rsvd1:7; /**< Reserved. */
#endif
uint8_t psn[3]; /**< Packet Sequence Number */
-} __rte_packed;
+} __rte_packed_end;
/** RoCEv2 default port. */
#define RTE_ROCEV2_DEFAULT_PORT 4791
diff --git a/lib/net/rte_icmp.h b/lib/net/rte_icmp.h
index e69d68ab6e..912d79a1cf 100644
--- a/lib/net/rte_icmp.h
+++ b/lib/net/rte_icmp.h
@@ -21,33 +21,36 @@
/**
* ICMP base header
*/
+__rte_packed_begin
struct rte_icmp_base_hdr {
uint8_t type;
uint8_t code;
rte_be16_t checksum;
-} __rte_packed;
+} __rte_packed_end;
/**
* ICMP echo header
*/
+__rte_packed_begin
struct rte_icmp_echo_hdr {
struct rte_icmp_base_hdr base;
rte_be16_t identifier;
rte_be16_t sequence;
-} __rte_packed;
+} __rte_packed_end;
/**
* ICMP Header
*
* @see rte_icmp_echo_hdr which is similar.
*/
+__rte_packed_begin
struct rte_icmp_hdr {
uint8_t icmp_type; /* ICMP packet type. */
uint8_t icmp_code; /* ICMP packet code. */
rte_be16_t icmp_cksum; /* ICMP packet checksum. */
rte_be16_t icmp_ident; /* ICMP packet identifier. */
rte_be16_t icmp_seq_nb; /* ICMP packet sequence number. */
-} __rte_packed;
+} __rte_packed_end;
/* ICMP packet types */
#define RTE_ICMP_TYPE_ECHO_REPLY 0
diff --git a/lib/net/rte_ip4.h b/lib/net/rte_ip4.h
index f9b8333332..30bbe1541d 100644
--- a/lib/net/rte_ip4.h
+++ b/lib/net/rte_ip4.h
@@ -39,6 +39,7 @@ extern "C" {
/**
* IPv4 Header
*/
+__rte_packed_begin
struct __rte_aligned(2) rte_ipv4_hdr {
__extension__
union {
@@ -62,7 +63,7 @@ struct __rte_aligned(2) rte_ipv4_hdr {
rte_be16_t hdr_checksum; /**< header checksum */
rte_be32_t src_addr; /**< source address */
rte_be32_t dst_addr; /**< destination address */
-} __rte_packed;
+} __rte_packed_end;
/** Create IPv4 address */
#define RTE_IPV4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \
diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h
index 992ab5ee1f..c92753b3f2 100644
--- a/lib/net/rte_ip6.h
+++ b/lib/net/rte_ip6.h
@@ -345,6 +345,7 @@ rte_ipv6_addr_is_mcast(const struct rte_ipv6_addr *ip)
/**
* IPv6 multicast scope values as defined in RFC 4291, section 2.7.
*/
+__rte_packed_begin
enum rte_ipv6_mc_scope {
/** Invalid multicast scope. */
RTE_IPV6_MC_SCOPE_NONE = 0x00,
@@ -358,7 +359,7 @@ enum rte_ipv6_mc_scope {
RTE_IPV6_MC_SCOPE_ORGLOCAL = 0x08,
/** Global multicast scope. */
RTE_IPV6_MC_SCOPE_GLOBAL = 0x0e,
-} __rte_packed;
+} __rte_packed_end;
/**
* Extract the IPv6 multicast scope value as defined in RFC 4291, section 2.7.
@@ -461,6 +462,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr *mac, const struct rte_ipv6_addr
/**
* IPv6 Header
*/
+__rte_packed_begin
struct __rte_aligned(2) rte_ipv6_hdr {
union {
rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. */
@@ -484,7 +486,7 @@ struct __rte_aligned(2) rte_ipv6_hdr {
uint8_t hop_limits; /**< Hop limits. */
struct rte_ipv6_addr src_addr; /**< IP address of source host. */
struct rte_ipv6_addr dst_addr; /**< IP address of destination host(s). */
-} __rte_packed;
+} __rte_packed_end;
/**
* Check that the IPv6 header version field is valid according to RFC 8200 section 3.
@@ -508,6 +510,7 @@ static inline int rte_ipv6_check_version(const struct rte_ipv6_hdr *ip)
/**
* IPv6 Routing Extension Header
*/
+__rte_packed_begin
struct __rte_aligned(2) rte_ipv6_routing_ext {
uint8_t next_hdr; /**< Protocol, next header. */
uint8_t hdr_len; /**< Header length. */
@@ -523,7 +526,7 @@ struct __rte_aligned(2) rte_ipv6_routing_ext {
};
};
/* Next are 128-bit IPv6 address fields to describe segments. */
-} __rte_packed;
+} __rte_packed_end;
/* IPv6 vtc_flow: IPv / TC / flow_label */
#define RTE_IPV6_HDR_FL_SHIFT 0
@@ -752,12 +755,13 @@ rte_ipv6_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m,
#define RTE_IPV6_SET_FRAG_DATA(fo, mf) \
(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
+__rte_packed_begin
struct __rte_aligned(2) rte_ipv6_fragment_ext {
uint8_t next_header; /**< Next header type */
uint8_t reserved; /**< Reserved */
rte_be16_t frag_data; /**< All fragmentation data */
rte_be32_t id; /**< Packet ID */
-} __rte_packed;
+} __rte_packed_end;
/* IPv6 fragment extension header size */
#define RTE_IPV6_FRAG_HDR_SIZE sizeof(struct rte_ipv6_fragment_ext)
diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index ac16657856..f035a0d5b3 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -125,6 +125,7 @@ struct rte_l2tpv2_common_hdr {
* L2TPv2 message Header contains all options(length, ns, nr,
* offset size, offset padding).
*/
+__rte_packed_begin
struct rte_l2tpv2_msg_with_all_options {
rte_be16_t length; /**< length(16) */
rte_be16_t tunnel_id; /**< tunnel ID(16) */
@@ -133,12 +134,13 @@ struct rte_l2tpv2_msg_with_all_options {
rte_be16_t nr; /**< Nr(16) */
rte_be16_t offset_size; /**< offset size(16) */
uint8_t *offset_padding; /**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
/**
* L2TPv2 message Header contains all options except length(ns, nr,
* offset size, offset padding).
*/
+__rte_packed_begin
struct rte_l2tpv2_msg_without_length {
rte_be16_t tunnel_id; /**< tunnel ID(16) */
rte_be16_t session_id; /**< session ID(16) */
@@ -146,7 +148,7 @@ struct rte_l2tpv2_msg_without_length {
rte_be16_t nr; /**< Nr(16) */
rte_be16_t offset_size; /**< offset size(16) */
uint8_t *offset_padding; /**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
/**
* L2TPv2 message Header contains all options except ns_nr(length,
@@ -176,12 +178,13 @@ struct rte_l2tpv2_msg_without_offset {
/**
* L2TPv2 message Header contains options offset size and offset padding.
*/
+__rte_packed_begin
struct rte_l2tpv2_msg_with_offset {
rte_be16_t tunnel_id; /**< tunnel ID(16) */
rte_be16_t session_id; /**< session ID(16) */
rte_be16_t offset_size; /**< offset size(16) */
uint8_t *offset_padding; /**< offset padding(variable length) */
-} __rte_packed;
+} __rte_packed_end;
/**
* L2TPv2 message Header contains options ns and nr.
@@ -213,6 +216,7 @@ struct rte_l2tpv2_msg_without_all_options {
/**
* L2TPv2 Combined Message Header Format: Common Header + Options
*/
+__rte_packed_begin
struct rte_l2tpv2_combined_msg_hdr {
struct rte_l2tpv2_common_hdr common; /**< common header */
union {
@@ -233,6 +237,6 @@ struct rte_l2tpv2_combined_msg_hdr {
/** header without all options */
struct rte_l2tpv2_msg_without_all_options type7;
};
-} __rte_packed;
+} __rte_packed_end;
#endif /* _RTE_L2TPV2_H_ */
diff --git a/lib/net/rte_macsec.h b/lib/net/rte_macsec.h
index beeeb8effe..088f60417e 100644
--- a/lib/net/rte_macsec.h
+++ b/lib/net/rte_macsec.h
@@ -25,6 +25,7 @@
* MACsec Header (SecTAG)
*/
__extension__
+__rte_packed_begin
struct rte_macsec_hdr {
/**
* Tag control information and Association number of secure channel.
@@ -39,7 +40,7 @@ struct rte_macsec_hdr {
uint8_t short_length:6; /**< Short Length. */
#endif
rte_be32_t packet_number; /**< Packet number to support replay protection. */
-} __rte_packed;
+} __rte_packed_end;
/** SCI length in MACsec header if present. */
#define RTE_MACSEC_SCI_LEN 8
@@ -48,8 +49,9 @@ struct rte_macsec_hdr {
* MACsec SCI header (8 bytes) after the MACsec header
* which is present if SC bit is set in tci_an.
*/
+__rte_packed_begin
struct rte_macsec_sci_hdr {
uint8_t sci[RTE_MACSEC_SCI_LEN]; /**< Optional secure channel ID. */
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_MACSEC_H */
diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h
index 35a356efd3..a5dda16db7 100644
--- a/lib/net/rte_mpls.h
+++ b/lib/net/rte_mpls.h
@@ -18,6 +18,7 @@
* MPLS header.
*/
__extension__
+__rte_packed_begin
struct rte_mpls_hdr {
rte_be16_t tag_msb; /**< Label(msb). */
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
@@ -30,6 +31,6 @@ struct rte_mpls_hdr {
uint8_t tag_lsb:4; /**< label(lsb) */
#endif
uint8_t ttl; /**< Time to live. */
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_MPLS_H_ */
diff --git a/lib/net/rte_pdcp_hdr.h b/lib/net/rte_pdcp_hdr.h
index c22b66bf93..e05fcf83f2 100644
--- a/lib/net/rte_pdcp_hdr.h
+++ b/lib/net/rte_pdcp_hdr.h
@@ -56,6 +56,7 @@ enum rte_pdcp_pdu_type {
* 6.2.2.1 Data PDU for SRBs
*/
__extension__
+__rte_packed_begin
struct rte_pdcp_cp_data_pdu_sn_12_hdr {
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
uint8_t sn_11_8 : 4; /**< Sequence number bits 8-11 */
@@ -65,12 +66,13 @@ struct rte_pdcp_cp_data_pdu_sn_12_hdr {
uint8_t sn_11_8 : 4; /**< Sequence number bits 8-11 */
#endif
uint8_t sn_7_0; /**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
/**
* 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN
*/
__extension__
+__rte_packed_begin
struct rte_pdcp_up_data_pdu_sn_12_hdr {
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
uint8_t sn_11_8 : 4; /**< Sequence number bits 8-11 */
@@ -82,12 +84,13 @@ struct rte_pdcp_up_data_pdu_sn_12_hdr {
uint8_t sn_11_8 : 4; /**< Sequence number bits 8-11 */
#endif
uint8_t sn_7_0; /**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
/**
* 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN
*/
__extension__
+__rte_packed_begin
struct rte_pdcp_up_data_pdu_sn_18_hdr {
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
uint8_t sn_17_16 : 2; /**< Sequence number bits 16-17 */
@@ -100,12 +103,13 @@ struct rte_pdcp_up_data_pdu_sn_18_hdr {
#endif
uint8_t sn_15_8; /**< Sequence number bits 8-15 */
uint8_t sn_7_0; /**< Sequence number bits 0-7 */
-} __rte_packed;
+} __rte_packed_end;
/**
* 6.2.3.1 Control PDU for PDCP status report
*/
__extension__
+__rte_packed_begin
struct rte_pdcp_up_ctrl_pdu_hdr {
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
uint8_t r : 4; /**< Reserved */
@@ -134,6 +138,6 @@ struct rte_pdcp_up_ctrl_pdu_hdr {
* in the Bitmap is 1.
*/
uint8_t bitmap[];
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_PDCP_HDR_H */
diff --git a/lib/net/rte_ppp.h b/lib/net/rte_ppp.h
index 63c72a9392..bda693a1e7 100644
--- a/lib/net/rte_ppp.h
+++ b/lib/net/rte_ppp.h
@@ -17,10 +17,11 @@
/**
* PPP Header
*/
+__rte_packed_begin
struct rte_ppp_hdr {
uint8_t addr; /**< PPP address(8) */
uint8_t ctrl; /**< PPP control(8) */
rte_be16_t proto_id; /**< PPP protocol identifier(16) */
-} __rte_packed;
+} __rte_packed_end;
#endif /* _RTE_PPP_H_ */
diff --git a/lib/net/rte_sctp.h b/lib/net/rte_sctp.h
index e757c57db3..f9dfac2ba7 100644
--- a/lib/net/rte_sctp.h
+++ b/lib/net/rte_sctp.h
@@ -21,11 +21,12 @@
/**
* SCTP Header
*/
+__rte_packed_begin
struct rte_sctp_hdr {
rte_be16_t src_port; /**< Source port. */
rte_be16_t dst_port; /**< Destin port. */
rte_be32_t tag; /**< Validation tag. */
rte_be32_t cksum; /**< Checksum. */
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_SCTP_H_ */
diff --git a/lib/net/rte_tcp.h b/lib/net/rte_tcp.h
index 1bcacbf038..218599f790 100644
--- a/lib/net/rte_tcp.h
+++ b/lib/net/rte_tcp.h
@@ -21,6 +21,7 @@
/**
* TCP Header
*/
+__rte_packed_begin
struct rte_tcp_hdr {
rte_be16_t src_port; /**< TCP source port. */
rte_be16_t dst_port; /**< TCP destination port. */
@@ -31,7 +32,7 @@ struct rte_tcp_hdr {
rte_be16_t rx_win; /**< RX flow control window. */
rte_be16_t cksum; /**< TCP checksum. */
rte_be16_t tcp_urp; /**< TCP urgent pointer, if any. */
-} __rte_packed;
+} __rte_packed_end;
/**
* TCP Flags
diff --git a/lib/net/rte_tls.h b/lib/net/rte_tls.h
index 595567e3e9..33411f83f2 100644
--- a/lib/net/rte_tls.h
+++ b/lib/net/rte_tls.h
@@ -28,6 +28,7 @@
* TLS Header
*/
__extension__
+__rte_packed_begin
struct rte_tls_hdr {
/** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */
uint8_t type;
@@ -35,6 +36,6 @@ struct rte_tls_hdr {
rte_be16_t version;
/** The length (in bytes) of the following TLS packet. */
rte_be16_t length;
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_TLS_H */
diff --git a/lib/net/rte_udp.h b/lib/net/rte_udp.h
index c01dad9c9b..548a063dab 100644
--- a/lib/net/rte_udp.h
+++ b/lib/net/rte_udp.h
@@ -21,11 +21,12 @@
/**
* UDP Header
*/
+__rte_packed_begin
struct rte_udp_hdr {
rte_be16_t src_port; /**< UDP source port. */
rte_be16_t dst_port; /**< UDP destination port. */
rte_be16_t dgram_len; /**< UDP datagram length */
rte_be16_t dgram_cksum; /**< UDP datagram checksum */
-} __rte_packed;
+} __rte_packed_end;
#endif /* RTE_UDP_H_ */
diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h
index bd1c89835e..f54e4206b6 100644
--- a/lib/net/rte_vxlan.h
+++ b/lib/net/rte_vxlan.h
@@ -27,12 +27,15 @@
* Reserved fields (24 bits and 8 bits)
*/
__extension__ /* no named member in struct */
+__rte_packed_begin
struct rte_vxlan_hdr {
union {
rte_be32_t vx_flags; /**< flags (8 bits) + extensions (24 bits). */
+ __rte_packed_begin
struct {
union {
uint8_t flags; /**< Default is I bit, others are extensions. */
+ __rte_packed_begin
struct {
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
uint8_t flag_g:1, /**< GBP bit. */
@@ -51,10 +54,11 @@ struct rte_vxlan_hdr {
flag_rsvd:1,
flag_g:1;
#endif
- } __rte_packed;
+ } __rte_packed_end;
}; /* end of 1st byte */
union {
uint8_t rsvd0[3]; /* Reserved for extensions. */
+ __rte_packed_begin
struct {
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
uint8_t rsvd0_gbp1:1, /* Reserved. */
@@ -71,6 +75,7 @@ struct rte_vxlan_hdr {
#endif
union {
uint16_t policy_id; /**< GBP Identifier. */
+ __rte_packed_begin
struct {
uint8_t rsvd0_gpe; /* Reserved. */
uint8_t proto; /**< GPE Next protocol. */
@@ -79,23 +84,24 @@ struct rte_vxlan_hdr {
* 0x03 : Ethernet
* 0x04 : Network Service Header
*/
- } __rte_packed;
+ } __rte_packed_end;
};
- } __rte_packed;
+ } __rte_packed_end;
};
- } __rte_packed;
+ } __rte_packed_end;
}; /* end of 1st 32-bit word */
union {
rte_be32_t vx_vni; /**< VNI (24 bits) + reserved (8 bits). */
+ __rte_packed_begin
struct {
uint8_t vni[3]; /**< VXLAN Identifier. */
union {
uint8_t rsvd1; /**< Reserved. */
uint8_t last_rsvd; /**< Reserved. */
};
- } __rte_packed;
+ } __rte_packed_end;
}; /* end of 2nd 32-bit word */
-} __rte_packed;
+} __rte_packed_end;
/** VXLAN tunnel header length. */
#define RTE_ETHER_VXLAN_HLEN \
@@ -111,6 +117,7 @@ struct rte_vxlan_hdr {
* Identifier and Reserved fields (16 bits and 8 bits).
*/
__extension__ /* no named member in struct */
+__rte_packed_begin
struct rte_vxlan_gpe_hdr {
union {
struct {
@@ -127,7 +134,7 @@ struct rte_vxlan_gpe_hdr {
uint8_t rsvd1; /**< Reserved. */
};
};
-} __rte_packed;
+} __rte_packed_end;
/**
* @deprecated
--
2.34.1
next prev parent reply other threads:[~2024-11-27 0:55 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
2024-03-20 21:05 ` [PATCH 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-03-20 21:05 ` [PATCH 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
2024-03-21 16:02 ` Bruce Richardson
2024-03-20 21:05 ` [PATCH 03/15] net: " Tyler Retzlaff
2024-10-07 1:14 ` Stephen Hemminger
2024-03-20 21:06 ` [PATCH 04/15] common/iavf: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 05/15] common/idpf: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 06/15] common/mlx5: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 07/15] dma/ioat: " Tyler Retzlaff
2024-03-21 16:13 ` Bruce Richardson
2024-03-27 22:51 ` Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 08/15] net/i40e: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 09/15] net/iavf: " Tyler Retzlaff
2024-03-21 16:26 ` Bruce Richardson
2024-03-20 21:06 ` [PATCH 10/15] net/ice: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 11/15] net/mlx5: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 12/15] net/octeon_ep: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 13/15] app/testpmd: " Tyler Retzlaff
2024-03-21 16:28 ` Bruce Richardson
2024-03-20 21:06 ` [PATCH 14/15] app/test: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 15/15] examples: " Tyler Retzlaff
2024-03-21 16:31 ` Bruce Richardson
2024-03-21 15:32 ` [PATCH 00/15] fix packing of structs " Stephen Hemminger
2024-03-21 15:46 ` Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 03/15] net: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 04/15] common/iavf: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 05/15] common/idpf: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 06/15] common/mlx5: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 07/15] dma/ioat: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 08/15] net/i40e: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 09/15] net/iavf: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 10/15] net/ice: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 11/15] net/mlx5: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 12/15] net/octeon_ep: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 13/15] app/testpmd: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 14/15] app/test: " Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 15/15] examples: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 03/16] net: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 04/16] common/iavf: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 05/16] common/idpf: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 06/16] common/mlx5: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 07/16] dma/ioat: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 08/16] net/i40e: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 09/16] net/iavf: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 10/16] net/ice: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 11/16] net/mlx5: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 12/16] net/octeon_ep: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 13/16] app/testpmd: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 14/16] app/test: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 15/16] examples: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 16/16] crypto/mlx5: " Tyler Retzlaff
2024-04-16 0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
2024-04-16 0:04 ` [PATCH v4 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-04-16 0:04 ` [PATCH v4 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 03/16] net: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 04/16] common/iavf: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 05/16] common/idpf: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 06/16] common/mlx5: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 07/16] dma/ioat: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 08/16] net/i40e: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 09/16] net/iavf: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 10/16] net/ice: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 11/16] net/mlx5: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 12/16] net/octeon_ep: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 13/16] app/testpmd: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 14/16] app/test: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 15/16] examples: " Tyler Retzlaff
2024-04-16 0:05 ` [PATCH v4 16/16] crypto/mlx5: " Tyler Retzlaff
2024-11-19 4:35 ` [PATCH v5 00/16] fix packing of structs " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 01/16] eal: provide pack start macro for MSVC Andre Muezerie
2024-11-19 8:32 ` Morten Brørup
2024-11-19 11:00 ` Konstantin Ananyev
2024-11-19 16:23 ` Andre Muezerie
2024-11-21 19:39 ` Andre Muezerie
2024-11-21 20:51 ` Thomas Monjalon
2024-11-22 0:11 ` Andre Muezerie
2024-11-22 8:13 ` Morten Brørup
2024-11-25 22:15 ` Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 02/16] eal: pack structures when building with MSVC Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 03/16] net: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 04/16] common/iavf: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 05/16] common/idpf: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 06/16] common/mlx5: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 07/16] dma/ioat: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 08/16] net/i40e: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 09/16] net/iavf: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 10/16] net/ice: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 11/16] net/mlx5: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 12/16] net/octeon_ep: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 13/16] app/testpmd: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 14/16] app/test: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 15/16] examples: " Andre Muezerie
2024-11-19 4:35 ` [PATCH v5 16/16] crypto/mlx5: " Andre Muezerie
2024-11-20 21:13 ` [PATCH v5 00/16] fix packing of structs " Patrick Robb
2024-11-27 0:52 ` [PATCH v6 00/30] " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 01/30] devtools: check packed attributes Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 02/30] eal/include: add new packing macros Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 03/30] app/test-pmd: remove unnecessary packed attributes Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 04/30] app/test: replace " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 05/30] doc/guides: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 06/30] drivers/baseband: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 07/30] drivers/bus: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 08/30] drivers/common: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 09/30] drivers/compress: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 10/30] drivers/crypto: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 11/30] drivers/dma: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 12/30] drivers/event: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 13/30] drivers/mempool: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 14/30] drivers/net: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 15/30] drivers/raw: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 16/30] drivers/regex: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 17/30] drivers/vdpa: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 18/30] examples/common: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 19/30] examples/ip-pipeline: remove " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 20/30] examples/ipsec_secgw: replace " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 21/30] examples/l3fwd-power: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 22/30] examples/l3fwd: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 23/30] examples/ptpclient: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 24/30] examples/vhost_blk: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 25/30] lib/eal: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 26/30] lib/ipsec: " Andre Muezerie
2024-11-27 0:52 ` Andre Muezerie [this message]
2024-11-27 0:52 ` [PATCH v6 28/30] lib/pipeline: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 29/30] lib/vhost: " Andre Muezerie
2024-11-27 0:52 ` [PATCH v6 30/30] lib/eal: remove __rte_packed Andre Muezerie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1732668761-5556-28-git-send-email-andremue@linux.microsoft.com \
--to=andremue@linux.microsoft.com \
--cc=aman.deep.singh@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=byron.marohn@intel.com \
--cc=conor.walsh@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
--cc=jingjing.wu@intel.com \
--cc=kirill.rybalchenko@intel.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=radu.nicolau@intel.com \
--cc=roretzla@linux.microsoft.com \
--cc=ruifeng.wang@arm.com \
--cc=sameh.gobriel@intel.com \
--cc=sivaprasad.tummala@amd.com \
--cc=skori@marvell.com \
--cc=stephen@networkplumber.org \
--cc=suanmingm@nvidia.com \
--cc=vattunuru@marvell.com \
--cc=viacheslavo@nvidia.com \
--cc=vladimir.medvedkin@intel.com \
--cc=yipeng1.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).