From patchwork Wed Mar 27 23:09:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138922 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9776F43D5B; Thu, 28 Mar 2024 00:09:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D6AB40EE3; Thu, 28 Mar 2024 00:09:22 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 1E696402E7 for ; Thu, 28 Mar 2024 00:09:20 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 32E0D20E67D1; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 32E0D20E67D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=Voq+F+SyxuZBC+ZYqhgF2Bm6b+40Msje8TCyGJ0TmoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mcrfeaeo7BSIpxaLoIDQETGt6pTR9Fg5vdneqqRqaeGcSWHpSdz+R8oMrFZ3B7BVA OwGc4GY6jBpDT7ewipMV7ghxSOC22pCc/HB/H31H43d+99yDralmEWUrjlX+c3jUGA S76/kCPnkgji0OIKFgzB9Aj6Rne8dJU+83d8dCeg= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 01/15] eal: provide pack start macro for MSVC Date: Wed, 27 Mar 2024 16:09:04 -0700 Message-Id: <1711580958-20808-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 provide a macro that can be used to push existing pack value and sets packing to 1-byte. The existing __rte_packed macro is then used to restore the pack value prior to the push. Instead of providing macros exclusively for MSVC and for GCC the existing macro is deliberately utilized to trigger a warning if no existing packing has been pushed allowing easy identification of locations where the __rte_msvc_pack is missing. Signed-off-by: Tyler Retzlaff --- lib/eal/include/rte_common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 298a5c6..44825ed 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -97,8 +97,10 @@ * Force a structure to be packed */ #ifdef RTE_TOOLCHAIN_MSVC -#define __rte_packed +#define __rte_msvc_pack __pragma(pack(push, 1)) +#define __rte_packed __pragma(pack(pop)) #else +#define __rte_msvc_pack #define __rte_packed __attribute__((__packed__)) #endif From patchwork Wed Mar 27 23:09:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138923 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CEB8343D5B; Thu, 28 Mar 2024 00:09:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9147F410FC; Thu, 28 Mar 2024 00:09:23 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 17960402D8 for ; Thu, 28 Mar 2024 00:09:20 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 4210C20E67DF; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4210C20E67DF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=kp0voLVlsgnm3SiFtSQj+udwRi2MiyRQcwM5S0HhLJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZhkPPPlwz5L7khcjeJNjjIQnOp9IggSmUw6R/ArJzoDQPnYOcnEWNVbWmsxx5taP WMp5fbhV9e4ylQkWOACpGfRpxL1bSYVHC72sJtf1jw1SjidjivyjNsUA/20RXd3RiJ N8CbjeLHK1Q5Sj3UzoTBxd0ZMbxV5fnTPwk2BMps= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 02/15] eal: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:05 -0700 Message-Id: <1711580958-20808-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pack to all __rte_packed structs to cause packing when building with MSVC. Remove __rte_packed where it appears natural alignment without packing would produce the same layout or the struct is internal. Signed-off-by: Tyler Retzlaff --- lib/eal/common/eal_private.h | 2 +- lib/eal/include/rte_memory.h | 1 + lib/eal/include/rte_memzone.h | 1 + lib/eal/include/rte_trace_point.h | 2 +- lib/eal/x86/include/rte_memcpy.h | 3 +++ 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h index 71523cf..4c929fb 100644 --- a/lib/eal/common/eal_private.h +++ b/lib/eal/common/eal_private.h @@ -62,7 +62,7 @@ struct rte_config { * DPDK instances */ struct rte_mem_config *mem_config; -} __rte_packed; +}; /** * Get the global configuration structure. diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h index 842362d..73bb00d 100644 --- a/lib/eal/include/rte_memory.h +++ b/lib/eal/include/rte_memory.h @@ -46,6 +46,7 @@ /** * Physical memory segment descriptor. */ +__rte_msvc_pack struct rte_memseg { rte_iova_t iova; /**< Start IO address. */ union { diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h index 931497f..ca312c0 100644 --- a/lib/eal/include/rte_memzone.h +++ b/lib/eal/include/rte_memzone.h @@ -45,6 +45,7 @@ * A structure describing a memzone, which is a contiguous portion of * physical memory identified by a name. */ +__rte_msvc_pack struct rte_memzone { #define RTE_MEMZONE_NAMESIZE 32 /**< Maximum length of memory zone name.*/ diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h index 41e2a7f..e786ee3 100644 --- a/lib/eal/include/rte_trace_point.h +++ b/lib/eal/include/rte_trace_point.h @@ -297,7 +297,7 @@ struct __rte_trace_stream_header { rte_uuid_t uuid; uint32_t lcore_id; char thread_name[__RTE_TRACE_EMIT_STRING_LEN_MAX]; -} __rte_packed; +}; struct __rte_trace_header { uint32_t offset; diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h index 72a9229..fdc5df0 100644 --- a/lib/eal/x86/include/rte_memcpy.h +++ b/lib/eal/x86/include/rte_memcpy.h @@ -57,12 +57,15 @@ * Use the following structs to avoid violating C standard * alignment requirements and to avoid strict aliasing bugs */ + __rte_msvc_pack struct rte_uint64_alias { uint64_t val; } __rte_packed __rte_may_alias; + __rte_msvc_pack struct rte_uint32_alias { uint32_t val; } __rte_packed __rte_may_alias; + __rte_msvc_pack struct rte_uint16_alias { uint16_t val; } __rte_packed __rte_may_alias; From patchwork Wed Mar 27 23:09:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138924 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BDED43D5B; Thu, 28 Mar 2024 00:09:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF88941141; Thu, 28 Mar 2024 00:09:24 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 36C97406BC for ; Thu, 28 Mar 2024 00:09:20 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5206220E6924; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5206220E6924 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=Ki3JG4rhpX/MsUw/9yAbTgF1KlFKrDOKEmyyVmHufZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSuZu9XCI3xkI4HTqTJdsBDV0b9UbWr7QFhtwkJFLWOopWNLmQ6ZEtFer9MVA6PsU 1VjSyHRBm+xegM0XVDzwy8hvPqJd0U2WvmL4CuoYs7iNi5tKwWwPXYqOp2qSyz5tr5 a2/06HlfV97Gw+BO5+0XelC/KOiyXO5eARersV0E= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 03/15] net: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:06 -0700 Message-Id: <1711580958-20808-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- lib/net/rte_arp.h | 2 ++ lib/net/rte_dtls.h | 1 + lib/net/rte_esp.h | 2 ++ lib/net/rte_ether.h | 1 + lib/net/rte_geneve.h | 1 + lib/net/rte_gre.h | 4 ++++ lib/net/rte_gtp.h | 5 +++++ lib/net/rte_ib.h | 1 + lib/net/rte_icmp.h | 3 +++ lib/net/rte_ip.h | 4 ++++ lib/net/rte_l2tpv2.h | 4 ++++ lib/net/rte_macsec.h | 2 ++ lib/net/rte_mpls.h | 1 + lib/net/rte_pdcp_hdr.h | 4 ++++ lib/net/rte_ppp.h | 1 + lib/net/rte_sctp.h | 1 + lib/net/rte_tcp.h | 1 + lib/net/rte_tls.h | 1 + lib/net/rte_udp.h | 1 + lib/net/rte_vxlan.h | 2 ++ 20 files changed, 42 insertions(+) diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h index 668cea1..35d68c1 100644 --- a/lib/net/rte_arp.h +++ b/lib/net/rte_arp.h @@ -21,6 +21,7 @@ /** * ARP header IPv4 payload. */ +__rte_msvc_pack struct __rte_aligned(2) rte_arp_ipv4 { struct rte_ether_addr arp_sha; /**< sender hardware address */ rte_be32_t arp_sip; /**< sender IP address */ @@ -31,6 +32,7 @@ struct __rte_aligned(2) rte_arp_ipv4 { /** * ARP header. */ +__rte_msvc_pack 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 */ diff --git a/lib/net/rte_dtls.h b/lib/net/rte_dtls.h index 4f541df..0c75b06 100644 --- a/lib/net/rte_dtls.h +++ b/lib/net/rte_dtls.h @@ -34,6 +34,7 @@ * DTLS Header */ __extension__ +__rte_msvc_pack struct rte_dtls_hdr { /** Content type of DTLS packet. Defined as RTE_DTLS_TYPE_*. */ uint8_t type; diff --git a/lib/net/rte_esp.h b/lib/net/rte_esp.h index 464c513..27c9287 100644 --- a/lib/net/rte_esp.h +++ b/lib/net/rte_esp.h @@ -20,6 +20,7 @@ /** * ESP Header */ +__rte_msvc_pack struct rte_esp_hdr { rte_be32_t spi; /**< Security Parameters Index */ rte_be32_t seq; /**< packet sequence number */ @@ -28,6 +29,7 @@ struct rte_esp_hdr { /** * ESP Trailer */ +__rte_msvc_pack 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 */ diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h index 32ed515..354e3a5 100644 --- a/lib/net/rte_ether.h +++ b/lib/net/rte_ether.h @@ -301,6 +301,7 @@ struct __rte_aligned(2) rte_ether_hdr { * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type * of the encapsulated frame. */ +__rte_msvc_pack struct rte_vlan_hdr { rte_be16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */ rte_be16_t eth_proto; /**< Ethernet type of encapsulated frame. */ diff --git a/lib/net/rte_geneve.h b/lib/net/rte_geneve.h index 3bbc561..5c02526 100644 --- a/lib/net/rte_geneve.h +++ b/lib/net/rte_geneve.h @@ -38,6 +38,7 @@ * More-bits (optional) variable length options. */ __extension__ +__rte_msvc_pack struct rte_geneve_hdr { #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN uint8_t ver:2; /**< Version. */ diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h index 8da8027..77882e7 100644 --- a/lib/net/rte_gre.h +++ b/lib/net/rte_gre.h @@ -27,6 +27,7 @@ * GRE Header */ __extension__ +__rte_msvc_pack struct rte_gre_hdr { #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint16_t res2:4; /**< Reserved */ @@ -51,6 +52,7 @@ struct rte_gre_hdr { /** * Optional field checksum in GRE header */ +__rte_msvc_pack struct rte_gre_hdr_opt_checksum_rsvd { rte_be16_t checksum; rte_be16_t reserved1; @@ -59,6 +61,7 @@ struct rte_gre_hdr_opt_checksum_rsvd { /** * Optional field key in GRE header */ +__rte_msvc_pack struct rte_gre_hdr_opt_key { rte_be32_t key; } __rte_packed; @@ -66,6 +69,7 @@ struct rte_gre_hdr_opt_key { /** * Optional field sequence in GRE header */ +__rte_msvc_pack struct rte_gre_hdr_opt_sequence { rte_be32_t sequence; } __rte_packed; diff --git a/lib/net/rte_gtp.h b/lib/net/rte_gtp.h index 9849872..26fc80a 100644 --- a/lib/net/rte_gtp.h +++ b/lib/net/rte_gtp.h @@ -28,6 +28,7 @@ * No optional fields and next extension header. */ __extension__ +__rte_msvc_pack struct rte_gtp_hdr { union { uint8_t gtp_hdr_info; /**< GTP header info */ @@ -55,6 +56,7 @@ struct rte_gtp_hdr { } __rte_packed; /* Optional word of GTP header, present if any of E, S, PN is set. */ +__rte_msvc_pack struct rte_gtp_hdr_ext_word { rte_be16_t sqn; /**< Sequence Number. */ uint8_t npdu; /**< N-PDU number. */ @@ -66,6 +68,7 @@ struct rte_gtp_hdr_ext_word { * defined based on RFC 38415-g30. */ __extension__ +__rte_msvc_pack 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 @@ -89,6 +92,7 @@ struct rte_gtp_psc_generic_hdr { * type0 defined based on RFC 38415-g30 */ __extension__ +__rte_msvc_pack 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 @@ -116,6 +120,7 @@ struct rte_gtp_psc_type0_hdr { * type1 defined based on RFC 38415-g30 */ __extension__ +__rte_msvc_pack 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 diff --git a/lib/net/rte_ib.h b/lib/net/rte_ib.h index 9eab5f9..c4c5d39 100644 --- a/lib/net/rte_ib.h +++ b/lib/net/rte_ib.h @@ -26,6 +26,7 @@ * IB Specification Vol 1-Release-1.4. */ __extension__ +__rte_msvc_pack struct rte_ib_bth { uint8_t opcode; /**< Opcode. */ #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN diff --git a/lib/net/rte_icmp.h b/lib/net/rte_icmp.h index 4bf64d7..e865db4 100644 --- a/lib/net/rte_icmp.h +++ b/lib/net/rte_icmp.h @@ -25,6 +25,7 @@ /** * ICMP base header */ +__rte_msvc_pack struct rte_icmp_base_hdr { uint8_t type; uint8_t code; @@ -34,6 +35,7 @@ struct rte_icmp_base_hdr { /** * ICMP echo header */ +__rte_msvc_pack struct rte_icmp_echo_hdr { struct rte_icmp_base_hdr base; rte_be16_t identifier; @@ -45,6 +47,7 @@ struct rte_icmp_echo_hdr { * * @see rte_icmp_echo_hdr which is similar. */ +__rte_msvc_pack struct rte_icmp_hdr { uint8_t icmp_type; /* ICMP packet type. */ uint8_t icmp_code; /* ICMP packet code. */ diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h index 0d103d4..908a25c 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -38,6 +38,7 @@ /** * IPv4 Header */ +__rte_msvc_pack struct rte_ipv4_hdr { __extension__ union { @@ -523,6 +524,7 @@ struct rte_ipv4_hdr { /** * IPv6 Header */ +__rte_msvc_pack struct rte_ipv6_hdr { rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. */ rte_be16_t payload_len; /**< IP payload size, including ext. headers */ @@ -538,6 +540,7 @@ struct rte_ipv6_hdr { /** * IPv6 Routing Extension Header */ +__rte_msvc_pack struct rte_ipv6_routing_ext { uint8_t next_hdr; /**< Protocol, next header. */ uint8_t hdr_len; /**< Header length. */ @@ -783,6 +786,7 @@ struct rte_ipv6_routing_ext { #define RTE_IPV6_SET_FRAG_DATA(fo, mf) \ (((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK)) +__rte_msvc_pack struct rte_ipv6_fragment_ext { uint8_t next_header; /**< Next header type */ uint8_t reserved; /**< Reserved */ diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h index 9cda347..a917013 100644 --- a/lib/net/rte_l2tpv2.h +++ b/lib/net/rte_l2tpv2.h @@ -129,6 +129,7 @@ struct rte_l2tpv2_common_hdr { * L2TPv2 message Header contains all options(length, ns, nr, * offset size, offset padding). */ +__rte_msvc_pack struct rte_l2tpv2_msg_with_all_options { rte_be16_t length; /**< length(16) */ rte_be16_t tunnel_id; /**< tunnel ID(16) */ @@ -143,6 +144,7 @@ struct rte_l2tpv2_msg_with_all_options { * L2TPv2 message Header contains all options except length(ns, nr, * offset size, offset padding). */ +__rte_msvc_pack struct rte_l2tpv2_msg_without_length { rte_be16_t tunnel_id; /**< tunnel ID(16) */ rte_be16_t session_id; /**< session ID(16) */ @@ -180,6 +182,7 @@ struct rte_l2tpv2_msg_without_offset { /** * L2TPv2 message Header contains options offset size and offset padding. */ +__rte_msvc_pack struct rte_l2tpv2_msg_with_offset { rte_be16_t tunnel_id; /**< tunnel ID(16) */ rte_be16_t session_id; /**< session ID(16) */ @@ -217,6 +220,7 @@ struct rte_l2tpv2_msg_without_all_options { /** * L2TPv2 Combined Message Header Format: Common Header + Options */ +__rte_msvc_pack struct rte_l2tpv2_combined_msg_hdr { struct rte_l2tpv2_common_hdr common; /**< common header */ union { diff --git a/lib/net/rte_macsec.h b/lib/net/rte_macsec.h index d0cd2f6..54de1bd 100644 --- a/lib/net/rte_macsec.h +++ b/lib/net/rte_macsec.h @@ -29,6 +29,7 @@ * MACsec Header (SecTAG) */ __extension__ +__rte_msvc_pack struct rte_macsec_hdr { /** * Tag control information and Association number of secure channel. @@ -52,6 +53,7 @@ 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_msvc_pack struct rte_macsec_sci_hdr { uint8_t sci[RTE_MACSEC_SCI_LEN]; /**< Optional secure channel ID. */ } __rte_packed; diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h index 51523e7..d5f6026 100644 --- a/lib/net/rte_mpls.h +++ b/lib/net/rte_mpls.h @@ -22,6 +22,7 @@ * MPLS header. */ __extension__ +__rte_msvc_pack struct rte_mpls_hdr { rte_be16_t tag_msb; /**< Label(msb). */ #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN diff --git a/lib/net/rte_pdcp_hdr.h b/lib/net/rte_pdcp_hdr.h index 72ae9a6..6a20ad9 100644 --- a/lib/net/rte_pdcp_hdr.h +++ b/lib/net/rte_pdcp_hdr.h @@ -60,6 +60,7 @@ enum rte_pdcp_pdu_type { * 6.2.2.1 Data PDU for SRBs */ __extension__ +__rte_msvc_pack 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 */ @@ -75,6 +76,7 @@ struct rte_pdcp_cp_data_pdu_sn_12_hdr { * 6.2.2.2 Data PDU for DRBs and MRBs with 12 bits PDCP SN */ __extension__ +__rte_msvc_pack 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 */ @@ -92,6 +94,7 @@ struct rte_pdcp_up_data_pdu_sn_12_hdr { * 6.2.2.3 Data PDU for DRBs and MRBs with 18 bits PDCP SN */ __extension__ +__rte_msvc_pack 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 */ @@ -110,6 +113,7 @@ struct rte_pdcp_up_data_pdu_sn_18_hdr { * 6.2.3.1 Control PDU for PDCP status report */ __extension__ +__rte_msvc_pack struct rte_pdcp_up_ctrl_pdu_hdr { #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint8_t r : 4; /**< Reserved */ diff --git a/lib/net/rte_ppp.h b/lib/net/rte_ppp.h index 7b86ac4..fde585f 100644 --- a/lib/net/rte_ppp.h +++ b/lib/net/rte_ppp.h @@ -21,6 +21,7 @@ /** * PPP Header */ +__rte_msvc_pack struct rte_ppp_hdr { uint8_t addr; /**< PPP address(8) */ uint8_t ctrl; /**< PPP control(8) */ diff --git a/lib/net/rte_sctp.h b/lib/net/rte_sctp.h index 965682d..a6cfe8f 100644 --- a/lib/net/rte_sctp.h +++ b/lib/net/rte_sctp.h @@ -25,6 +25,7 @@ /** * SCTP Header */ +__rte_msvc_pack struct rte_sctp_hdr { rte_be16_t src_port; /**< Source port. */ rte_be16_t dst_port; /**< Destin port. */ diff --git a/lib/net/rte_tcp.h b/lib/net/rte_tcp.h index 506ac4e..d11cb2c 100644 --- a/lib/net/rte_tcp.h +++ b/lib/net/rte_tcp.h @@ -25,6 +25,7 @@ /** * TCP Header */ +__rte_msvc_pack struct rte_tcp_hdr { rte_be16_t src_port; /**< TCP source port. */ rte_be16_t dst_port; /**< TCP destination port. */ diff --git a/lib/net/rte_tls.h b/lib/net/rte_tls.h index 2eb3c6d..81af4c7 100644 --- a/lib/net/rte_tls.h +++ b/lib/net/rte_tls.h @@ -32,6 +32,7 @@ * TLS Header */ __extension__ +__rte_msvc_pack struct rte_tls_hdr { /** Content type of TLS packet. Defined as RTE_TLS_TYPE_*. */ uint8_t type; diff --git a/lib/net/rte_udp.h b/lib/net/rte_udp.h index 6135494..5416855 100644 --- a/lib/net/rte_udp.h +++ b/lib/net/rte_udp.h @@ -25,6 +25,7 @@ /** * UDP Header */ +__rte_msvc_pack struct rte_udp_hdr { rte_be16_t src_port; /**< UDP source port. */ rte_be16_t dst_port; /**< UDP destination port. */ diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h index 997fc78..bcfd579 100644 --- a/lib/net/rte_vxlan.h +++ b/lib/net/rte_vxlan.h @@ -31,6 +31,7 @@ * Reserved fields (24 bits and 8 bits) */ __extension__ /* no named member in struct */ +__rte_msvc_pack struct rte_vxlan_hdr { union { struct { @@ -57,6 +58,7 @@ struct rte_vxlan_hdr { * Identifier and Reserved fields (16 bits and 8 bits). */ __extension__ /* no named member in struct */ +__rte_msvc_pack struct rte_vxlan_gpe_hdr { union { struct { From patchwork Wed Mar 27 23:09:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138925 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 600DA43D5B; Thu, 28 Mar 2024 00:09:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AD8E41151; Thu, 28 Mar 2024 00:09:26 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3FAFF40EE3 for ; Thu, 28 Mar 2024 00:09:20 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 62AC120E6940; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 62AC120E6940 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=vlaWpD6eQhjJAAAnq4XOEGcsLTHA5jfWElbk++Td5tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grEIZCFvp8nTL2hhDis8H8U0SQYXMXoS8vly8RqzpiyEq9JoeULtI35pwKVkAi7Ow OB1XWFWiGcRlGM6IfO1NP3unsGM8duMemFG4DCAf7kZzCcWQUUc2KN0h68vobJXwEQ yWGdXRMuAiOk8oQOJeEX5Q2+k6Z+z7onqPgrUyIw= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 04/15] common/iavf: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:07 -0700 Message-Id: <1711580958-20808-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- drivers/common/iavf/iavf_osdep.h | 2 ++ drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/common/iavf/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h index 263d924..1fb057c 100644 --- a/drivers/common/iavf/iavf_osdep.h +++ b/drivers/common/iavf/iavf_osdep.h @@ -158,6 +158,7 @@ } while (0) /* memory allocation tracking */ +__rte_msvc_pack struct iavf_dma_mem { void *va; u64 pa; @@ -165,6 +166,7 @@ struct iavf_dma_mem { const void *zone; } __rte_packed; +__rte_msvc_pack struct iavf_virt_mem { void *va; u32 size; diff --git a/drivers/common/iavf/virtchnl_inline_ipsec.h b/drivers/common/iavf/virtchnl_inline_ipsec.h index 2f4bf15..feb0f44 100644 --- a/drivers/common/iavf/virtchnl_inline_ipsec.h +++ b/drivers/common/iavf/virtchnl_inline_ipsec.h @@ -109,6 +109,7 @@ enum inline_ipsec_ops { }; /* Not all valid, if certain field is invalid, set 1 for all bits */ +__rte_msvc_pack struct virtchnl_algo_cap { u32 algo_type; @@ -132,6 +133,7 @@ struct virtchnl_algo_cap { } __rte_packed; /* vf record the capability of crypto from the virtchnl */ +__rte_msvc_pack struct virtchnl_sym_crypto_cap { u8 crypto_type; u8 algo_cap_num; @@ -142,6 +144,7 @@ struct virtchnl_sym_crypto_cap { * VF pass virtchnl_ipsec_cap to PF * and PF return capability of ipsec from virtchnl. */ +__rte_msvc_pack struct virtchnl_ipsec_cap { /* max number of SA per VF */ u16 max_sa_num; @@ -172,6 +175,7 @@ struct virtchnl_ipsec_cap { } __rte_packed; /* configuration of crypto function */ +__rte_msvc_pack struct virtchnl_ipsec_crypto_cfg_item { u8 crypto_type; @@ -203,6 +207,7 @@ struct virtchnl_ipsec_sym_crypto_cfg { * PF create SA as configuration and PF driver will return * an unique index (sa_idx) for the created SA. */ +__rte_msvc_pack struct virtchnl_ipsec_sa_cfg { /* IPsec SA Protocol - AH/ESP */ u8 virtchnl_protocol_type; @@ -298,6 +303,7 @@ struct virtchnl_ipsec_sa_cfg { * VF send configuration of index of SA to PF * PF will update SA according to configuration */ +__rte_msvc_pack struct virtchnl_ipsec_sa_update { u32 sa_index; /* SA to update */ u32 esn_hi; /* high 32 bits of esn */ @@ -310,6 +316,7 @@ struct virtchnl_ipsec_sa_update { * flag bitmap indicate all SA or just selected SA will * be destroyed */ +__rte_msvc_pack struct virtchnl_ipsec_sa_destroy { /* All zero bitmap indicates all SA will be destroyed. * Non-zero bitmap indicates the selected SA in @@ -325,6 +332,7 @@ struct virtchnl_ipsec_sa_destroy { * VF send this SA configuration to PF using virtchnl; * PF read SA and will return configuration for the created SA. */ +__rte_msvc_pack struct virtchnl_ipsec_sa_read { /* SA valid - invalid/valid */ u8 valid; @@ -431,6 +439,7 @@ struct virtchnl_ipsec_sa_read { #define VIRTCHNL_IPSEC_INBOUND_SPD_TBL_IPV6 (1) /* Add allowlist entry in IES */ +__rte_msvc_pack struct virtchnl_ipsec_sp_cfg { u32 spi; u32 dip[4]; @@ -459,6 +468,7 @@ struct virtchnl_ipsec_sp_cfg { /* Delete allowlist entry in IES */ +__rte_msvc_pack struct virtchnl_ipsec_sp_destroy { /* 0 for IPv4 table, 1 for IPv6 table. */ u8 table_id; @@ -494,6 +504,7 @@ struct virtchnl_ipsec_resp { }; /* Internal message descriptor for VF <-> IPsec communication */ +__rte_msvc_pack struct inline_ipsec_msg { u16 ipsec_opcode; u16 req_id; From patchwork Wed Mar 27 23:09:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138926 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C28CF43D5B; Thu, 28 Mar 2024 00:09:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1706427DA; Thu, 28 Mar 2024 00:09:30 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id F0F37402AC for ; Thu, 28 Mar 2024 00:09:20 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 715DE20E6947; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 715DE20E6947 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=TCI9oKwE1vzcdtcqvMR/Fb2+LqyXEfz+U+tyPNHYGJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JtMFcPvOkLcjgx4XEdXZVN9LZY5J1q9dAsS70RrhXKcW+MTGAF8H9Jjf2vqFKUKBF jwLfC9RPVUl+Hz66wZgqBNRSrFDtWtF3H4yx+dN/k9NDMFVC3m62aGPHmVWxyFnBn7 OVXSI9Z+A2+bnDOVTQJm6OcskJsusM3lr5QleAjI= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 05/15] common/idpf: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:08 -0700 Message-Id: <1711580958-20808-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- drivers/common/idpf/base/idpf_osdep.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h index 74a376c..f5fcdc3 100644 --- a/drivers/common/idpf/base/idpf_osdep.h +++ b/drivers/common/idpf/base/idpf_osdep.h @@ -180,6 +180,7 @@ static inline uint64_t idpf_read_addr64(volatile void *addr) #define BITS_PER_BYTE 8 /* memory allocation tracking */ +__rte_msvc_pack struct idpf_dma_mem { void *va; u64 pa; @@ -187,6 +188,7 @@ struct idpf_dma_mem { const void *zone; } __rte_packed; +__rte_msvc_pack struct idpf_virt_mem { void *va; u32 size; From patchwork Wed Mar 27 23:09:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138929 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7FCEE43D5B; Thu, 28 Mar 2024 00:10:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2390B42D45; Thu, 28 Mar 2024 00:09:34 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 0E6A7406BC for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8179C20E6948; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8179C20E6948 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=ooRKZKpQqT6Xz3T4PN3KAauYAiKEPc2MXyayPWFB/FY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b/z7B3r0fxdTou4rn89ZNDpXF8imGe/TonCEoRZ7RURxjlAVM2MMEy+mZTtIrK6y4 h7j5aHnm5YRkMVZNopEfd/T0KVKkU3uLCYFKpm5goEWa70kvC8csFEb6hUc0F2kVhA 8SfDv4TtqscPUgDSCn+UK7IMO5iL8LLY0L5h8Wxs= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 06/15] common/mlx5: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:09 -0700 Message-Id: <1711580958-20808-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- drivers/common/mlx5/mlx5_common_mr.h | 4 ++++ drivers/common/mlx5/mlx5_common_utils.h | 1 + drivers/common/mlx5/mlx5_prm.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h index 8789d40..4f4bd73 100644 --- a/drivers/common/mlx5/mlx5_common_mr.h +++ b/drivers/common/mlx5/mlx5_common_mr.h @@ -49,6 +49,7 @@ struct mlx5_mr { }; /* Cache entry for Memory Region. */ +__rte_msvc_pack struct mr_cache_entry { uintptr_t start; /* Start address of MR. */ uintptr_t end; /* End address of MR. */ @@ -56,6 +57,7 @@ struct mr_cache_entry { } __rte_packed; /* MR Cache table for Binary search. */ +__rte_msvc_pack struct mlx5_mr_btree { uint32_t len; /* Number of entries. */ uint32_t size; /* Total number of entries. */ @@ -65,6 +67,7 @@ struct mlx5_mr_btree { struct mlx5_common_device; /* Per-queue MR control descriptor. */ +__rte_msvc_pack struct mlx5_mr_ctrl { uint32_t *dev_gen_ptr; /* Generation number of device to poll. */ uint32_t cur_gen; /* Generation number saved to flush caches. */ @@ -78,6 +81,7 @@ struct mlx5_mr_ctrl { LIST_HEAD(mlx5_mempool_reg_list, mlx5_mempool_reg); /* Global per-device MR cache. */ +__rte_msvc_pack struct mlx5_mr_share_cache { uint32_t dev_gen; /* Generation number to flush local caches. */ rte_rwlock_t rwlock; /* MR cache Lock. */ diff --git a/drivers/common/mlx5/mlx5_common_utils.h b/drivers/common/mlx5/mlx5_common_utils.h index ae15119..a44975c 100644 --- a/drivers/common/mlx5/mlx5_common_utils.h +++ b/drivers/common/mlx5/mlx5_common_utils.h @@ -27,6 +27,7 @@ * Structure of the entry in the mlx5 list, user should define its own struct * that contains this in order to store the data. */ +__rte_msvc_pack struct mlx5_list_entry { LIST_ENTRY(mlx5_list_entry) next; /* Entry pointers in the list. */ uint32_t ref_cnt __rte_aligned(8); /* 0 means, entry is invalid. */ diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index c671c75..bf9ecd1 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -319,6 +319,7 @@ enum mlx5_mpw_mode { }; /* WQE Control segment. */ +__rte_msvc_pack struct mlx5_wqe_cseg { uint32_t opcode; uint32_t sq_ds; @@ -336,10 +337,12 @@ struct mlx5_wqe_cseg { #define WQE_CSEG_WQE_INDEX_OFFSET 8 /* Header of data segment. Minimal size Data Segment */ +__rte_msvc_pack struct mlx5_wqe_dseg { uint32_t bcount; union { uint8_t inline_data[MLX5_DSEG_MIN_INLINE_SIZE]; + __rte_msvc_pack struct { uint32_t lkey; uint64_t pbuf; @@ -348,8 +351,10 @@ struct mlx5_wqe_dseg { } __rte_packed; /* Subset of struct WQE Ethernet Segment. */ +__rte_msvc_pack struct mlx5_wqe_eseg { union { + __rte_msvc_pack struct { uint32_t swp_offs; uint8_t cs_flags; @@ -362,6 +367,7 @@ struct mlx5_wqe_eseg { uint16_t vlan_tag; }; } __rte_packed; + __rte_msvc_pack struct { uint32_t offsets; uint32_t flags; @@ -371,6 +377,7 @@ struct mlx5_wqe_eseg { }; } __rte_packed; +__rte_msvc_pack struct mlx5_wqe_qseg { uint32_t reserved0; uint32_t reserved1; @@ -378,6 +385,7 @@ struct mlx5_wqe_qseg { uint32_t qpn_cqn; } __rte_packed; +__rte_msvc_pack struct mlx5_wqe_wseg { uint32_t operation; uint32_t lkey; @@ -388,6 +396,7 @@ struct mlx5_wqe_wseg { } __rte_packed; /* The title WQEBB, header of WQE. */ +__rte_msvc_pack struct mlx5_wqe { union { struct mlx5_wqe_cseg cseg; @@ -437,6 +446,7 @@ struct mlx5_cqe { uint8_t lro_num_seg; union { uint8_t user_index_bytes[3]; + __rte_msvc_pack struct { uint8_t user_index_hi; uint16_t user_index_low; @@ -460,6 +470,7 @@ struct mlx5_cqe_ts { uint8_t op_own; }; +__rte_msvc_pack struct mlx5_wqe_rseg { uint64_t raddr; uint32_t rkey; @@ -479,6 +490,7 @@ struct mlx5_wqe_rseg { #define MLX5_UMR_KLM_NUM_ALIGN \ (MLX5_UMR_KLM_PTR_ALIGN / sizeof(struct mlx5_klm)) +__rte_msvc_pack struct mlx5_wqe_umr_cseg { uint32_t if_cf_toe_cq_res; uint32_t ko_to_bs; @@ -486,6 +498,7 @@ struct mlx5_wqe_umr_cseg { uint32_t rsvd1[8]; } __rte_packed; +__rte_msvc_pack struct mlx5_wqe_mkey_cseg { uint32_t fr_res_af_sf; uint32_t qpn_mkey; @@ -549,6 +562,7 @@ enum { #define MLX5_CRYPTO_MMO_TYPE_OFFSET 24 #define MLX5_CRYPTO_MMO_OP_OFFSET 20 +__rte_msvc_pack struct mlx5_wqe_umr_bsf_seg { /* * bs_bpt_eo_es contains: @@ -582,6 +596,7 @@ struct mlx5_wqe_umr_bsf_seg { #pragma GCC diagnostic ignored "-Wpedantic" #endif +__rte_msvc_pack struct mlx5_umr_wqe { struct mlx5_wqe_cseg ctr; struct mlx5_wqe_umr_cseg ucseg; @@ -592,18 +607,21 @@ struct mlx5_umr_wqe { }; } __rte_packed; +__rte_msvc_pack struct mlx5_rdma_write_wqe { struct mlx5_wqe_cseg ctr; struct mlx5_wqe_rseg rseg; struct mlx5_wqe_dseg dseg[]; } __rte_packed; +__rte_msvc_pack struct mlx5_wqe_send_en_seg { uint32_t reserve[2]; uint32_t sqnpc; uint32_t qpn; } __rte_packed; +__rte_msvc_pack struct mlx5_wqe_send_en_wqe { struct mlx5_wqe_cseg ctr; struct mlx5_wqe_send_en_seg sseg; @@ -650,6 +668,7 @@ struct mlx5_wqe_metadata_seg { uint64_t addr; }; +__rte_msvc_pack struct mlx5_gga_wqe { uint32_t opcode; uint32_t sq_ds; @@ -663,16 +682,19 @@ struct mlx5_gga_wqe { } __rte_packed; union mlx5_gga_compress_opaque { + __rte_msvc_pack struct { uint32_t syndrome; uint32_t reserved0; uint32_t scattered_length; union { + __rte_msvc_pack struct { uint32_t reserved1[5]; uint32_t crc32; uint32_t adler32; } v1 __rte_packed; + __rte_msvc_pack struct { uint32_t crc32; uint32_t adler32; @@ -685,9 +707,11 @@ struct mlx5_gga_wqe { }; union mlx5_gga_crypto_opaque { + __rte_msvc_pack struct { uint32_t syndrome; uint32_t reserved0[2]; + __rte_msvc_pack struct { uint32_t iv[3]; uint32_t tag_size; @@ -4134,6 +4158,7 @@ enum mlx5_aso_op { #define MLX5_ASO_CSEG_READ_ENABLE 1 /* ASO WQE CTRL segment. */ +__rte_msvc_pack struct mlx5_aso_cseg { uint32_t va_h; uint32_t va_l_r; @@ -4150,6 +4175,7 @@ struct mlx5_aso_cseg { #define MLX5_MTR_MAX_TOKEN_VALUE INT32_MAX /* A meter data segment - 2 per ASO WQE. */ +__rte_msvc_pack struct mlx5_aso_mtr_dseg { uint32_t v_bo_sc_bbog_mm; /* @@ -4191,6 +4217,7 @@ struct mlx5_aso_mtr_dseg { #define MLX5_ASO_MTRS_PER_POOL 128 /* ASO WQE data segment. */ +__rte_msvc_pack struct mlx5_aso_dseg { union { uint8_t data[MLX5_ASO_WQE_DSEG_SIZE]; @@ -4199,6 +4226,7 @@ struct mlx5_aso_dseg { } __rte_packed; /* ASO WQE. */ +__rte_msvc_pack struct mlx5_aso_wqe { struct mlx5_wqe_cseg general_cseg; struct mlx5_aso_cseg aso_cseg; From patchwork Wed Mar 27 23:09:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138927 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD99943D5B; Thu, 28 Mar 2024 00:09:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA97C427E4; Thu, 28 Mar 2024 00:09:31 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 092B0402E7 for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 9057920E6951; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9057920E6951 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=BrT9hdACPdp/8EWGtE/394YhBVX42Ds6F0MPJEnqGB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RmB9Fq+7Aw/c6j3aUjiWSfh3vBrOFR9Py/04GZxfWp0Mpqt4J4qEuYTpx7aogJ9WP 4+5YDNQgi/cen6jMjH7LUNU+v2QgKqzD2Km1FamWDtyZ9bdD2RWjHdrCEHF9l1H+GK 8AYy11/6yhC+q4WgldzCMOZzGrf1NJlYdmT428Rg= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 07/15] dma/ioat: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:10 -0700 Message-Id: <1711580958-20808-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- drivers/dma/ioat/ioat_hw_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/ioat/ioat_hw_defs.h b/drivers/dma/ioat/ioat_hw_defs.h index dc3493a..6e32807 100644 --- a/drivers/dma/ioat/ioat_hw_defs.h +++ b/drivers/dma/ioat/ioat_hw_defs.h @@ -52,6 +52,7 @@ #define IOAT_DMACAP_PQ (1 << 9) #define IOAT_DMACAP_DMA_DIF (1 << 10) +__rte_msvc_pack struct ioat_registers { uint8_t chancnt; uint8_t xfercap; From patchwork Wed Mar 27 23:09:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138932 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7179C43D5B; Thu, 28 Mar 2024 00:10:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9738842D9D; Thu, 28 Mar 2024 00:09:37 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3B0D4410E3 for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 9F44820E6957; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9F44820E6957 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=yStJIWTkNq1mauAAUvOVNYWqC2J6+RwdtGkcltk/yPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZKanizTURKF3Q/awhtGCBBbhJKLZYS/g9eJ+KCQk3T8QfYW19jjqyCQ27suxtWqz0 NYXbt8o6abv6HWxKhqnKs1KXcwlkyeGFVeAKsjOzAJsawG3vUDRwV21S8ujVeSr4oW kqGbYfhghq4Y6sAzduC1nyru1BycllrFzrAG2Tgc= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 08/15] net/i40e: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:11 -0700 Message-Id: <1711580958-20808-9-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- drivers/net/i40e/base/i40e_osdep.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h index aa5dc61..28439e3 100644 --- a/drivers/net/i40e/base/i40e_osdep.h +++ b/drivers/net/i40e/base/i40e_osdep.h @@ -177,6 +177,7 @@ static inline uint64_t i40e_read64_addr(volatile void *addr) #define ARRAY_SIZE(arr) RTE_DIM(arr) /* memory allocation tracking */ +__rte_msvc_pack struct i40e_dma_mem { void *va; u64 pa; @@ -188,6 +189,7 @@ struct i40e_dma_mem { i40e_allocate_dma_mem_d(h, m, s, a) #define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m) +__rte_msvc_pack struct i40e_virt_mem { void *va; u32 size; From patchwork Wed Mar 27 23:09:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138933 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5D51643D5B; Thu, 28 Mar 2024 00:10:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DEC3542DA3; Thu, 28 Mar 2024 00:09:38 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3D205410EA for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id ADFBE20E695F; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com ADFBE20E695F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=1H9Z4GJTk+mQFUXDeRVs2qv3Nnpyn89EB1Wy+4ojCo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F8rZKY0jKxZld+Yp3OJS3ehfm0kKC2UZ516N4wXmlM7MuySeZqsHg9VMU51oHFp2S eHcr/IEZRI5V4VamzMTu/FKkhTwI63EeBgkVJrZd5e7xhJcOdCdTPFJ6eACsZFSdmX 1JxbMHVsC7DNh+X8yWbB4fU65i575jIMSZshoG6g= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 09/15] net/iavf: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:12 -0700 Message-Id: <1711580958-20808-10-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Remove __rte_packed where it appears natural alignment without packing would produce the same layout or the struct is internal. Signed-off-by: Tyler Retzlaff --- drivers/net/iavf/iavf_ipsec_crypto.h | 4 +++- drivers/net/iavf/iavf_rxtx.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_ipsec_crypto.h b/drivers/net/iavf/iavf_ipsec_crypto.h index 49f9202..0637ce2 100644 --- a/drivers/net/iavf/iavf_ipsec_crypto.h +++ b/drivers/net/iavf/iavf_ipsec_crypto.h @@ -11,12 +11,14 @@ +__rte_msvc_pack struct iavf_tx_ipsec_desc { union { struct { __le64 qw0; __le64 qw1; }; + __rte_msvc_pack struct { __le16 l4payload_length; __le32 esn; @@ -97,7 +99,7 @@ struct iavf_ipsec_crypto_pkt_metadata { uint8_t next_proto; /* Next Protocol (8b/1B) */ uint32_t esn; /* Extended Sequence Number (32b/4B) */ -} __rte_packed; +}; /** * Inline IPsec Crypto offload is supported diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 0a5246d..61309c3 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -53,7 +53,7 @@ struct simple_gre_hdr { uint16_t flags; uint16_t proto; -} __rte_packed; +}; /* structure that caches offload info for the current packet */ struct offload_info { From patchwork Wed Mar 27 23:09:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138928 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C739243D5B; Thu, 28 Mar 2024 00:10:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF13A42B71; Thu, 28 Mar 2024 00:09:32 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 0E6F040EE3 for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id BD0E820E6AC1; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BD0E820E6AC1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=CKn7LnCS5LX2sYLBMnqqGX8cxAq9eKt2rPCekkxgqnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kaoSAdGT/cx1HKl46cX/Be234W0GrukfUD9MEGejhaSkQUrUbQW5Wwfb4SG856V9Z NlKjZXjplSMV+CEcELgieTqX7cfW3AafFsRxPa7SBZu2+dlg9BCa/GjXl06QN2TBH6 VKHKrZeprQJY8H8mIdzADWBhUjGYV6Y3wQmNCXdg= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 10/15] net/ice: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:13 -0700 Message-Id: <1711580958-20808-11-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- drivers/net/ice/base/ice_osdep.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h index 0e14b93..087dc6a 100644 --- a/drivers/net/ice/base/ice_osdep.h +++ b/drivers/net/ice/base/ice_osdep.h @@ -187,6 +187,7 @@ #define BITS_PER_BYTE 8 /* memory allocation tracking */ +__rte_msvc_pack struct ice_dma_mem { void *va; u64 pa; @@ -194,6 +195,7 @@ struct ice_dma_mem { const void *zone; } __rte_packed; +__rte_msvc_pack struct ice_virt_mem { void *va; u32 size; From patchwork Wed Mar 27 23:09:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138935 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DAD9243D5B; Thu, 28 Mar 2024 00:10:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 74C0D42DB4; Thu, 28 Mar 2024 00:09:41 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 57B5F410FC for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id CC62C20E6ACA; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CC62C20E6ACA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=b8K15zDL4DfHaMM+UJbBWd+7iLlta4TID5ATz0iGua8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gXM5mG74bxE7swZQJTigxJeIZknm9VwKxgFXd/gAtF96xkNq9NmbSgZQ7ngWLVsVb Y++LjbODu8NDX3tost6UYGAnhbNadsVFGjfFxfRhDBjBrmtTT+N5dond4FY3gxxyru nwEbeJvHRDpLN/zjqI/xml6Il/L88ZQk15ZTE/H0= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 11/15] net/mlx5: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:14 -0700 Message-Id: <1711580958-20808-12-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- drivers/net/mlx5/hws/mlx5dr.h | 1 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.h | 5 +++++ drivers/net/mlx5/mlx5_hws_cnt.h | 1 + drivers/net/mlx5/mlx5_utils.h | 4 ++++ 5 files changed, 12 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index 80e118a..cd5bb05 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -300,6 +300,7 @@ struct mlx5dr_action_dest_attr { }; }; +__rte_msvc_pack struct mlx5dr_crc_encap_entropy_hash_fields { union mlx5dr_crc_encap_entropy_hash_ip_field dst; union mlx5dr_crc_encap_entropy_hash_ip_field src; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 0091a24..6228ee8 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -221,6 +221,7 @@ struct mlx5_dev_spawn_data { } /** Data associated with socket messages. */ +__rte_msvc_pack struct mlx5_flow_dump_req { uint32_t port_id; /**< There are plans in DPDK to extend port_id. */ uint64_t flow_id; diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 0065727..da0f8b7 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -658,6 +658,7 @@ struct mlx5_flow_dv_tag_resource { }; /* Modify resource structure */ +__rte_msvc_pack struct mlx5_flow_dv_modify_hdr_resource { struct mlx5_list_entry entry; void *action; /**< Modify header action object. */ @@ -812,6 +813,7 @@ struct mlx5_flow_dv_dest_array_resource { /** Device flow handle structure for DV mode only. */ +__rte_msvc_pack struct mlx5_flow_handle_dv { /* Flow DV api: */ struct mlx5_flow_dv_matcher *matcher; /**< Cache to matcher. */ @@ -830,6 +832,7 @@ struct mlx5_flow_handle_dv { } __rte_packed; /** Device flow handle structure: used both for creating & destroying. */ +__rte_msvc_pack struct mlx5_flow_handle { SILIST_ENTRY(uint32_t)next; struct mlx5_vf_vlan vf_vlan; /**< Structure for VF VLAN workaround. */ @@ -1231,6 +1234,7 @@ struct mlx5_flow_attr { }; /* Flow structure. */ +__rte_msvc_pack struct rte_flow { uint32_t dev_handles; /**< Device flow handles that are part of the flow. */ @@ -1304,6 +1308,7 @@ enum { #endif /** HWS flow struct. */ +__rte_msvc_pack struct rte_flow_hw { /** The table flow allcated from. */ struct rte_flow_template_table *table; diff --git a/drivers/net/mlx5/mlx5_hws_cnt.h b/drivers/net/mlx5/mlx5_hws_cnt.h index e005960..1f53a1a 100644 --- a/drivers/net/mlx5/mlx5_hws_cnt.h +++ b/drivers/net/mlx5/mlx5_hws_cnt.h @@ -133,6 +133,7 @@ enum { }; /* HWS counter age parameter. */ +__rte_msvc_pack struct mlx5_hws_age_param { uint32_t timeout; /* Aging timeout in seconds (atomically accessed). */ uint32_t sec_since_last_hit; diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h index f3c0d76..cf80e5e 100644 --- a/drivers/net/mlx5/mlx5_utils.h +++ b/drivers/net/mlx5/mlx5_utils.h @@ -118,6 +118,7 @@ struct mlx5_l3t_level_tbl { }; /* L3 word entry table data structure. */ +__rte_msvc_pack struct mlx5_l3t_entry_word { uint32_t idx; /* Table index. */ uint64_t ref_cnt; /* Table ref_cnt. */ @@ -128,6 +129,7 @@ struct mlx5_l3t_entry_word { } __rte_packed; /* L3 double word entry table data structure. */ +__rte_msvc_pack struct mlx5_l3t_entry_dword { uint32_t idx; /* Table index. */ uint64_t ref_cnt; /* Table ref_cnt. */ @@ -138,6 +140,7 @@ struct mlx5_l3t_entry_dword { } __rte_packed; /* L3 quad word entry table data structure. */ +__rte_msvc_pack struct mlx5_l3t_entry_qword { uint32_t idx; /* Table index. */ uint64_t ref_cnt; /* Table ref_cnt. */ @@ -148,6 +151,7 @@ struct mlx5_l3t_entry_qword { } __rte_packed; /* L3 pointer entry table data structure. */ +__rte_msvc_pack struct mlx5_l3t_entry_ptr { uint32_t idx; /* Table index. */ uint64_t ref_cnt; /* Table ref_cnt. */ From patchwork Wed Mar 27 23:09:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138930 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6203F43D5B; Thu, 28 Mar 2024 00:10:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A70142D76; Thu, 28 Mar 2024 00:09:35 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2CB98410DD for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id DAFBD20E6AD5; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DAFBD20E6AD5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=+Gt2Ujcp8ffg6sdAuce7CnWDPKVt1tDwuzxYlL2+DmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PZ+pK+N5JtQBEcd6uB6adeGrU0sofR+czJmNskDkJ/gG3Dye1L0jfyHpXlurPwU0H AC12gk9rwO5aNS0zONOjLAMKE8N3uSSqxrNf/VEnuD6We4oLWKoQtt6OGfFHyB2o5Z WklfI1SZCSzHicU6r+nn8SGrdp1VbkFT30tczKlc= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 12/15] net/octeon_ep: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:15 -0700 Message-Id: <1711580958-20808-13-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- drivers/net/octeon_ep/otx_ep_mbox.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/octeon_ep/otx_ep_mbox.h b/drivers/net/octeon_ep/otx_ep_mbox.h index a3fc15c..005fce3 100644 --- a/drivers/net/octeon_ep/otx_ep_mbox.h +++ b/drivers/net/octeon_ep/otx_ep_mbox.h @@ -70,6 +70,7 @@ enum otx_ep_link_autoneg { #define OTX_EP_MBOX_MORE_FRAG_FLAG 1 #define OTX_EP_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1) +__rte_msvc_pack union otx_ep_mbox_word { uint64_t u64; struct { From patchwork Wed Mar 27 23:09:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138931 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 44A2943D5B; Thu, 28 Mar 2024 00:10:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81EA242D8C; Thu, 28 Mar 2024 00:09:36 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 42C47410F9 for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id E9E3C20E6ADB; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E9E3C20E6ADB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=S0VgUs9OepMugf70vIeZrjjB+iLp8hwl/oRIu6k1Abc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJN7c7pv4NpYtuFvS7mRhCT6LHpyGRjfnxXFpwK4huou2ny1G88Q+ICiSmtB948TH 5xOQoP8fZ7yrr4I3CfBoWvLbB9AzgQ3/VX1IiLJmqkvlgZ3TQDv2XblFBZZax0AL9f 8m4dbCeDhL3g0pM1EL6s1zrhTTLAHuD+jztMi524= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 13/15] app/testpmd: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:16 -0700 Message-Id: <1711580958-20808-14-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Remove __rte_packed where it appears natural alignment without packing would produce the same layout or the struct is internal. Signed-off-by: Tyler Retzlaff --- app/test-pmd/csumonly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 6711dda..f24c381 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -92,7 +92,7 @@ struct testpmd_offload_info { struct simple_gre_hdr { uint16_t flags; uint16_t proto; -} __rte_packed; +}; static uint16_t get_udptcp_checksum(struct rte_mbuf *m, void *l3_hdr, uint16_t l4_off, From patchwork Wed Mar 27 23:09:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138934 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C797943D5B; Thu, 28 Mar 2024 00:10:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3348042DBB; Thu, 28 Mar 2024 00:09:40 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3CC3C410E6 for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 046AC20E6AE4; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 046AC20E6AE4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580960; bh=m9q1GVR4DcfZGfendWPRU0HvrjyPwayvBZ66pgp3jVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/ylZV7LRs8HXGO1T69uZzsUozFFxS4L7o5HDaeOCPcgvlKPo/DuNk7FW4+mzdusk k6t8EfJAYXg4XyoqrKYHtf2seRKY+9S0EefCbAbWhPSK+fDJKMNXcyNrXIPXagYK6K KolE8o1dszy0QzO3Nd2o4IOCDXv+maAfmUNrmMT0= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 14/15] app/test: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:17 -0700 Message-Id: <1711580958-20808-15-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Signed-off-by: Tyler Retzlaff --- app/test/test_efd.c | 1 + app/test/test_hash.c | 1 + app/test/test_member.c | 1 + 3 files changed, 3 insertions(+) diff --git a/app/test/test_efd.c b/app/test/test_efd.c index 1c0986b..df176a0 100644 --- a/app/test/test_efd.c +++ b/app/test/test_efd.c @@ -33,6 +33,7 @@ static unsigned int test_socket_id; /* 5-tuple key type */ +__rte_msvc_pack struct flow_key { uint32_t ip_src; uint32_t ip_dst; diff --git a/app/test/test_hash.c b/app/test/test_hash.c index d586878..08c1773 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -79,6 +79,7 @@ * Should be packed to avoid holes with potentially * undefined content in the middle. */ +__rte_msvc_pack struct flow_key { uint32_t ip_src; uint32_t ip_dst; diff --git a/app/test/test_member.c b/app/test/test_member.c index 5a4d275..ccd481a 100644 --- a/app/test/test_member.c +++ b/app/test/test_member.c @@ -32,6 +32,7 @@ struct rte_member_setsum *setsum_sketch; /* 5-tuple key type */ +__rte_msvc_pack struct flow_key { uint32_t ip_src; uint32_t ip_dst; From patchwork Wed Mar 27 23:09:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138936 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C133943D5B; Thu, 28 Mar 2024 00:10:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D44642DCE; Thu, 28 Mar 2024 00:09:42 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AB228410FD for ; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 13C0220E6AE7; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 13C0220E6AE7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580960; bh=IiLvykGt2iCEyJSJ5MTAhrQafAxWQvwwTxjRVRlQqWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJMuJsjjWkSGfXqR7ZxLiQhSoZ7soum1BEuXN2NVWilCrylFSaiMoo8xDR1YhjjQX 3oyynVNEFXujeWJzIqtL+8tNe94DgScV7+ltDD7JrLleHqS8a4BLm3Gu4pY8CdDlrZ O8W22QclCGQLZVzxZMuJe97AfsPEINougJE++8UA= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 15/15] examples: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:18 -0700 Message-Id: <1711580958-20808-16-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 Add __rte_msvc_pushpack(1) to all __rte_packed structs to cause packing when building with MSVC. Remove __rte_packed where it appears natural alignment without packing would produce the same layout or the struct is internal. Signed-off-by: Tyler Retzlaff --- examples/common/neon/port_group.h | 1 + examples/ip_pipeline/cli.c | 10 +++++----- examples/ipsec-secgw/ipsec.h | 1 + examples/l3fwd-power/main.c | 2 ++ examples/ptpclient/ptpclient.c | 8 ++++++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/examples/common/neon/port_group.h b/examples/common/neon/port_group.h index 421e2e8..bd40590 100644 --- a/examples/common/neon/port_group.h +++ b/examples/common/neon/port_group.h @@ -21,6 +21,7 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, uint16x8_t dp2) { + __rte_msvc_pack union { uint16_t u16[FWDSTEP + 1]; uint64_t u64; diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index e8269ea..aad6c78 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -2571,7 +2571,7 @@ struct pkt_key_qinq { uint16_t svlan; uint16_t ethertype_cvlan; uint16_t cvlan; -} __rte_packed; +}; struct pkt_key_ipv4_5tuple { uint8_t time_to_live; @@ -2581,7 +2581,7 @@ struct pkt_key_ipv4_5tuple { uint32_t da; uint16_t sp; uint16_t dp; -} __rte_packed; +}; struct pkt_key_ipv6_5tuple { uint16_t payload_length; @@ -2591,15 +2591,15 @@ struct pkt_key_ipv6_5tuple { uint8_t da[16]; uint16_t sp; uint16_t dp; -} __rte_packed; +}; struct pkt_key_ipv4_addr { uint32_t addr; -} __rte_packed; +}; struct pkt_key_ipv6_addr { uint8_t addr[16]; -} __rte_packed; +}; static uint32_t parse_match(char **tokens, diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index bdcada1..bdc6045 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -277,6 +277,7 @@ struct socket_ctx { struct rte_mempool *session_pool; }; +__rte_msvc_pack struct cnt_blk { uint32_t salt; uint64_t iv; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index f4adcf4..a3be37b 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -278,6 +278,7 @@ struct lcore_rx_queue { #define DEFAULT_HASH_FUNC rte_jhash #endif +__rte_msvc_pack struct ipv4_5tuple { uint32_t ip_dst; uint32_t ip_src; @@ -286,6 +287,7 @@ struct ipv4_5tuple { uint8_t proto; } __rte_packed; +__rte_msvc_pack struct ipv6_5tuple { uint8_t ip_dst[IPV6_ADDR_LEN]; uint8_t ip_src[IPV6_ADDR_LEN]; diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index afb61bb..cdd73fd 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -56,6 +56,7 @@ }; /* Structs used for PTP handling. */ +__rte_msvc_pack struct tstamp { uint16_t sec_msb; uint32_t sec_lsb; @@ -66,11 +67,13 @@ struct clock_id { uint8_t id[8]; }; +__rte_msvc_pack struct port_id { struct clock_id clock_id; uint16_t port_number; } __rte_packed; +__rte_msvc_pack struct ptp_header { uint8_t msg_type; uint8_t ver; @@ -86,22 +89,26 @@ struct ptp_header { int8_t log_message_interval; } __rte_packed; +__rte_msvc_pack struct sync_msg { struct ptp_header hdr; struct tstamp origin_tstamp; } __rte_packed; +__rte_msvc_pack struct follow_up_msg { struct ptp_header hdr; struct tstamp precise_origin_tstamp; uint8_t suffix[]; } __rte_packed; +__rte_msvc_pack struct delay_req_msg { struct ptp_header hdr; struct tstamp origin_tstamp; } __rte_packed; +__rte_msvc_pack struct delay_resp_msg { struct ptp_header hdr; struct tstamp rx_tstamp; @@ -110,6 +117,7 @@ struct delay_resp_msg { } __rte_packed; struct ptp_message { + __rte_msvc_pack union { struct ptp_header header; struct sync_msg sync;