From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9CC8C45C45; Tue, 31 Dec 2024 19:40:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E70A4402F1; Tue, 31 Dec 2024 19:39:03 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8827C402E0 for ; Tue, 31 Dec 2024 19:38:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id CADFB2066C1A; Tue, 31 Dec 2024 10:38:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CADFB2066C1A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1735670309; bh=8dHRI0gXxbqLm5o9aXXOg3menK7N9mugE9c78VVyQJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NzkzBV6yEuCD6cFb2NyYmVQRoTZ1jyNCvQ9fxcsS7sCV47n2wDidSqaFXc83ik9ya tINs4thlfQKCklJNsMqqaKBAMu6DilNlaokuOPcKpMsxeIlN753N63haYslDzm4Pu0 g84tLWtYkj0M8Y9/sri+EDCpmpzgpI7Mo51jFSKo= From: Andre Muezerie 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, mb@smartsharesystems.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 Subject: [PATCH v8 27/29] lib/net: replace packed attributes Date: Tue, 31 Dec 2024 10:38:09 -0800 Message-Id: <1735670291-23224-28-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1735670291-23224-1-git-send-email-andremue@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1735670291-23224-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- lib/net/rte_arp.h | 8 ++++---- lib/net/rte_dtls.h | 4 ++-- lib/net/rte_esp.h | 8 ++++---- lib/net/rte_geneve.h | 4 ++-- lib/net/rte_gre.h | 16 ++++++++-------- lib/net/rte_gtp.h | 20 ++++++++++---------- lib/net/rte_ib.h | 4 ++-- lib/net/rte_icmp.h | 12 ++++++------ lib/net/rte_ip4.h | 4 ++-- lib/net/rte_ip6.h | 14 +++++++------- lib/net/rte_l2tpv2.h | 16 ++++++++-------- lib/net/rte_macsec.h | 8 ++++---- lib/net/rte_mpls.h | 4 ++-- lib/net/rte_pdcp_hdr.h | 16 ++++++++-------- lib/net/rte_ppp.h | 4 ++-- lib/net/rte_sctp.h | 4 ++-- lib/net/rte_tcp.h | 4 ++-- lib/net/rte_tls.h | 4 ++-- lib/net/rte_udp.h | 4 ++-- lib/net/rte_vxlan.h | 28 ++++++++++++++-------------- 20 files changed, 93 insertions(+), 93 deletions(-) diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h index 668cea1704..e885a71292 100644 --- a/lib/net/rte_arp.h +++ b/lib/net/rte_arp.h @@ -21,17 +21,17 @@ extern "C" { /** * ARP header IPv4 payload. */ -struct __rte_aligned(2) rte_arp_ipv4 { +struct __rte_aligned(2) __rte_packed_begin 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. */ -struct __rte_aligned(2) rte_arp_hdr { +struct __rte_aligned(2) __rte_packed_begin rte_arp_hdr { rte_be16_t arp_hardware; /**< format of hardware address */ #define RTE_ARP_HRD_ETHER 1 /**< ARP Ethernet address format */ @@ -47,7 +47,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..1dd95ce899 100644 --- a/lib/net/rte_dtls.h +++ b/lib/net/rte_dtls.h @@ -30,7 +30,7 @@ * DTLS Header */ __extension__ -struct rte_dtls_hdr { +struct __rte_packed_begin rte_dtls_hdr { /** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */ uint8_t type; /** DTLS Version defined as RTE_DTLS_VERSION*. */ @@ -48,6 +48,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..2a0002f4d9 100644 --- a/lib/net/rte_esp.h +++ b/lib/net/rte_esp.h @@ -16,17 +16,17 @@ /** * ESP Header */ -struct rte_esp_hdr { +struct __rte_packed_begin rte_esp_hdr { rte_be32_t spi; /**< Security Parameters Index */ rte_be32_t seq; /**< packet sequence number */ -} __rte_packed; +} __rte_packed_end; /** * ESP Trailer */ -struct rte_esp_tail { +struct __rte_packed_begin 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..f962c587ee 100644 --- a/lib/net/rte_geneve.h +++ b/lib/net/rte_geneve.h @@ -34,7 +34,7 @@ * More-bits (optional) variable length options. */ __extension__ -struct rte_geneve_hdr { +struct __rte_packed_begin rte_geneve_hdr { #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN uint8_t ver:2; /**< Version. */ uint8_t opt_len:6; /**< Options length. */ @@ -52,7 +52,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..768c4ce7b5 100644 --- a/lib/net/rte_gre.h +++ b/lib/net/rte_gre.h @@ -23,7 +23,7 @@ * GRE Header */ __extension__ -struct rte_gre_hdr { +struct __rte_packed_begin rte_gre_hdr { #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint16_t res2:4; /**< Reserved */ uint16_t s:1; /**< Sequence Number Present bit */ @@ -42,28 +42,28 @@ 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 */ -struct rte_gre_hdr_opt_checksum_rsvd { +struct __rte_packed_begin 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 */ -struct rte_gre_hdr_opt_key { +struct __rte_packed_begin rte_gre_hdr_opt_key { rte_be32_t key; -} __rte_packed; +} __rte_packed_end; /** * Optional field sequence in GRE header */ -struct rte_gre_hdr_opt_sequence { +struct __rte_packed_begin 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..0332d35c16 100644 --- a/lib/net/rte_gtp.h +++ b/lib/net/rte_gtp.h @@ -24,7 +24,7 @@ * No optional fields and next extension header. */ __extension__ -struct rte_gtp_hdr { +struct __rte_packed_begin rte_gtp_hdr { union { uint8_t gtp_hdr_info; /**< GTP header info */ struct { @@ -48,21 +48,21 @@ 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. */ -struct rte_gtp_hdr_ext_word { +struct __rte_packed_begin 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__ -struct rte_gtp_psc_generic_hdr { +struct __rte_packed_begin 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 uint8_t type:4; /**< PDU type */ @@ -78,14 +78,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__ -struct rte_gtp_psc_type0_hdr { +struct __rte_packed_begin 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 uint8_t type:4; /**< PDU type */ @@ -105,14 +105,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__ -struct rte_gtp_psc_type1_hdr { +struct __rte_packed_begin 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 uint8_t type:4; /**< PDU type */ @@ -134,7 +134,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..f1b455cea0 100644 --- a/lib/net/rte_ib.h +++ b/lib/net/rte_ib.h @@ -22,7 +22,7 @@ * IB Specification Vol 1-Release-1.4. */ __extension__ -struct rte_ib_bth { +struct __rte_packed_begin rte_ib_bth { uint8_t opcode; /**< Opcode. */ #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint8_t tver:4; /**< Transport Header Version. */ @@ -54,7 +54,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..cca73b3733 100644 --- a/lib/net/rte_icmp.h +++ b/lib/net/rte_icmp.h @@ -21,33 +21,33 @@ /** * ICMP base header */ -struct rte_icmp_base_hdr { +struct __rte_packed_begin rte_icmp_base_hdr { uint8_t type; uint8_t code; rte_be16_t checksum; -} __rte_packed; +} __rte_packed_end; /** * ICMP echo header */ -struct rte_icmp_echo_hdr { +struct __rte_packed_begin 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. */ -struct rte_icmp_hdr { +struct __rte_packed_begin 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..d4b38c513c 100644 --- a/lib/net/rte_ip4.h +++ b/lib/net/rte_ip4.h @@ -39,7 +39,7 @@ extern "C" { /** * IPv4 Header */ -struct __rte_aligned(2) rte_ipv4_hdr { +struct __rte_aligned(2) __rte_packed_begin rte_ipv4_hdr { __extension__ union { uint8_t version_ihl; /**< version and header length */ @@ -62,7 +62,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..92558a124a 100644 --- a/lib/net/rte_ip6.h +++ b/lib/net/rte_ip6.h @@ -358,7 +358,7 @@ enum rte_ipv6_mc_scope { RTE_IPV6_MC_SCOPE_ORGLOCAL = 0x08, /** Global multicast scope. */ RTE_IPV6_MC_SCOPE_GLOBAL = 0x0e, -} __rte_packed; +}; /** * Extract the IPv6 multicast scope value as defined in RFC 4291, section 2.7. @@ -461,7 +461,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr *mac, const struct rte_ipv6_addr /** * IPv6 Header */ -struct __rte_aligned(2) rte_ipv6_hdr { +struct __rte_aligned(2) __rte_packed_begin rte_ipv6_hdr { union { rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. */ __extension__ @@ -484,7 +484,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,7 +508,7 @@ static inline int rte_ipv6_check_version(const struct rte_ipv6_hdr *ip) /** * IPv6 Routing Extension Header */ -struct __rte_aligned(2) rte_ipv6_routing_ext { +struct __rte_aligned(2) __rte_packed_begin rte_ipv6_routing_ext { uint8_t next_hdr; /**< Protocol, next header. */ uint8_t hdr_len; /**< Header length. */ uint8_t type; /**< Extension header type. */ @@ -523,7 +523,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 +752,12 @@ 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)) -struct __rte_aligned(2) rte_ipv6_fragment_ext { +struct __rte_aligned(2) __rte_packed_begin 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..728dc01506 100644 --- a/lib/net/rte_l2tpv2.h +++ b/lib/net/rte_l2tpv2.h @@ -125,7 +125,7 @@ struct rte_l2tpv2_common_hdr { * L2TPv2 message Header contains all options(length, ns, nr, * offset size, offset padding). */ -struct rte_l2tpv2_msg_with_all_options { +struct __rte_packed_begin rte_l2tpv2_msg_with_all_options { rte_be16_t length; /**< length(16) */ rte_be16_t tunnel_id; /**< tunnel ID(16) */ rte_be16_t session_id; /**< session ID(16) */ @@ -133,20 +133,20 @@ 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). */ -struct rte_l2tpv2_msg_without_length { +struct __rte_packed_begin rte_l2tpv2_msg_without_length { rte_be16_t tunnel_id; /**< tunnel ID(16) */ rte_be16_t session_id; /**< session ID(16) */ rte_be16_t ns; /**< Ns(16) */ 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 +176,12 @@ struct rte_l2tpv2_msg_without_offset { /** * L2TPv2 message Header contains options offset size and offset padding. */ -struct rte_l2tpv2_msg_with_offset { +struct __rte_packed_begin 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,7 +213,7 @@ struct rte_l2tpv2_msg_without_all_options { /** * L2TPv2 Combined Message Header Format: Common Header + Options */ -struct rte_l2tpv2_combined_msg_hdr { +struct __rte_packed_begin rte_l2tpv2_combined_msg_hdr { struct rte_l2tpv2_common_hdr common; /**< common header */ union { /** header with all options */ @@ -233,6 +233,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..c694c37b4b 100644 --- a/lib/net/rte_macsec.h +++ b/lib/net/rte_macsec.h @@ -25,7 +25,7 @@ * MACsec Header (SecTAG) */ __extension__ -struct rte_macsec_hdr { +struct __rte_packed_begin rte_macsec_hdr { /** * Tag control information and Association number of secure channel. * Various bits of TCI and AN are masked using RTE_MACSEC_TCI_* and RTE_MACSEC_AN_MASK. @@ -39,7 +39,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 +48,8 @@ struct rte_macsec_hdr { * MACsec SCI header (8 bytes) after the MACsec header * which is present if SC bit is set in tci_an. */ -struct rte_macsec_sci_hdr { +struct __rte_packed_begin 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..53614a0b88 100644 --- a/lib/net/rte_mpls.h +++ b/lib/net/rte_mpls.h @@ -18,7 +18,7 @@ * MPLS header. */ __extension__ -struct rte_mpls_hdr { +struct __rte_packed_begin rte_mpls_hdr { rte_be16_t tag_msb; /**< Label(msb). */ #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN uint8_t tag_lsb:4; /**< Label(lsb). */ @@ -30,6 +30,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..2e8da1e1d3 100644 --- a/lib/net/rte_pdcp_hdr.h +++ b/lib/net/rte_pdcp_hdr.h @@ -56,7 +56,7 @@ enum rte_pdcp_pdu_type { * 6.2.2.1 Data PDU for SRBs */ __extension__ -struct rte_pdcp_cp_data_pdu_sn_12_hdr { +struct __rte_packed_begin 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 */ uint8_t r : 4; /**< Reserved */ @@ -65,13 +65,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__ -struct rte_pdcp_up_data_pdu_sn_12_hdr { +struct __rte_packed_begin 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 */ uint8_t r : 3; /**< Reserved */ @@ -82,13 +82,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__ -struct rte_pdcp_up_data_pdu_sn_18_hdr { +struct __rte_packed_begin 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 */ uint8_t r : 5; /**< Reserved */ @@ -100,13 +100,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__ -struct rte_pdcp_up_ctrl_pdu_hdr { +struct __rte_packed_begin rte_pdcp_up_ctrl_pdu_hdr { #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint8_t r : 4; /**< Reserved */ uint8_t pdu_type : 3; /**< Control PDU type */ @@ -134,6 +134,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..02bfb03c03 100644 --- a/lib/net/rte_ppp.h +++ b/lib/net/rte_ppp.h @@ -17,10 +17,10 @@ /** * PPP Header */ -struct rte_ppp_hdr { +struct __rte_packed_begin 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..73051b94fd 100644 --- a/lib/net/rte_sctp.h +++ b/lib/net/rte_sctp.h @@ -21,11 +21,11 @@ /** * SCTP Header */ -struct rte_sctp_hdr { +struct __rte_packed_begin 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..fb0eb308f5 100644 --- a/lib/net/rte_tcp.h +++ b/lib/net/rte_tcp.h @@ -21,7 +21,7 @@ /** * TCP Header */ -struct rte_tcp_hdr { +struct __rte_packed_begin rte_tcp_hdr { rte_be16_t src_port; /**< TCP source port. */ rte_be16_t dst_port; /**< TCP destination port. */ rte_be32_t sent_seq; /**< TX data sequence number. */ @@ -31,7 +31,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..f27db3acb1 100644 --- a/lib/net/rte_tls.h +++ b/lib/net/rte_tls.h @@ -28,13 +28,13 @@ * TLS Header */ __extension__ -struct rte_tls_hdr { +struct __rte_packed_begin rte_tls_hdr { /** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */ uint8_t type; /** TLS Version defined as RTE_TLS_VERSION*. */ 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..94f5304e6d 100644 --- a/lib/net/rte_udp.h +++ b/lib/net/rte_udp.h @@ -21,11 +21,11 @@ /** * UDP Header */ -struct rte_udp_hdr { +struct __rte_packed_begin 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..f59829b182 100644 --- a/lib/net/rte_vxlan.h +++ b/lib/net/rte_vxlan.h @@ -27,13 +27,13 @@ * Reserved fields (24 bits and 8 bits) */ __extension__ /* no named member in struct */ -struct rte_vxlan_hdr { +struct __rte_packed_begin rte_vxlan_hdr { union { rte_be32_t vx_flags; /**< flags (8 bits) + extensions (24 bits). */ - struct { + struct __rte_packed_begin { union { uint8_t flags; /**< Default is I bit, others are extensions. */ - struct { + struct __rte_packed_begin { #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN uint8_t flag_g:1, /**< GBP bit. */ flag_rsvd:1, /* Reserved. */ @@ -51,11 +51,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. */ - struct { + struct __rte_packed_begin { #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN uint8_t rsvd0_gbp1:1, /* Reserved. */ flag_d:1, /**< GBP Don't Learn bit. */ @@ -71,7 +71,7 @@ struct rte_vxlan_hdr { #endif union { uint16_t policy_id; /**< GBP Identifier. */ - struct { + struct __rte_packed_begin { uint8_t rsvd0_gpe; /* Reserved. */ uint8_t proto; /**< GPE Next protocol. */ /* 0x01 : IPv4 @@ -79,23 +79,23 @@ 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). */ - struct { + struct __rte_packed_begin { 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,7 +111,7 @@ struct rte_vxlan_hdr { * Identifier and Reserved fields (16 bits and 8 bits). */ __extension__ /* no named member in struct */ -struct rte_vxlan_gpe_hdr { +struct __rte_packed_begin rte_vxlan_gpe_hdr { union { struct { uint8_t vx_flags; /**< flag (8). */ @@ -127,7 +127,7 @@ struct rte_vxlan_gpe_hdr { uint8_t rsvd1; /**< Reserved. */ }; }; -} __rte_packed; +} __rte_packed_end; /** * @deprecated -- 2.47.0.vfs.0.3