From patchwork Wed Mar 27 23:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 816 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 B829943D5B; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1339640F16; Thu, 28 Mar 2024 00:09:21 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EE1AD402AC for ; Thu, 28 Mar 2024 00:09:19 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2335020E65C9; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2335020E65C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=Qf/C5JjapehETxF6QJTW8iFCg+xAwXdGGB0JPTy2AX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cir/lJj6VjkWHU7w4Bu+wB551TfFMcseD9GywXos+md953vK6x7MFQ+lXlDVbELW7 Zp9e2NgAGUfQfBZzrT0HE3Y1HyejBlsb8+D7kyu9a/mlcnzaBMEMm1g2Jflri7+6sV M5ypDgCqg7uozeCZh3TS+DpKsFPn+D2jm7Khdyks= 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 00/15] fix packing of structs when building with MSVC Date: Wed, 27 Mar 2024 16:09:03 -0700 Message-Id: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-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. I've decided to only add the macro to packed structs that are built for Windows. It seems there is little value in adding the macro tree wide and if new code arrives that is built on Windows the __rte_packed will flag where the preamble macro is required. If as a part of review maintainers identify structs they believe don't require packing so long as they are explicitly identified i'll remove the __rte_packed as a part of this series. v2: * app/testpmd, remove packing from simple_gre_hdr * net/iavf, remove packing from iavf_ipsec_crypto_pkt_metadata, simple_gre_hdr * examples, remove packing from pkt_key_qinq, pkt_key_ipv4_5tuple, pkt_key_ipv6_5tuple, pkt_key_ipv4_addr, pkt_key_ipv6_addr * eal, remove packing from rte_config, __rte_trace_stream_header Tyler Retzlaff (15): eal: provide pack start macro for MSVC eal: pack structures when building with MSVC net: pack structures when building with MSVC common/iavf: pack structures when building with MSVC common/idpf: pack structures when building with MSVC common/mlx5: pack structures when building with MSVC dma/ioat: pack structures when building with MSVC net/i40e: pack structures when building with MSVC net/iavf: pack structures when building with MSVC net/ice: pack structures when building with MSVC net/mlx5: pack structures when building with MSVC net/octeon_ep: pack structures when building with MSVC app/testpmd: pack structures when building with MSVC app/test: pack structures when building with MSVC examples: pack structures when building with MSVC app/test-pmd/csumonly.c | 2 +- app/test/test_efd.c | 1 + app/test/test_hash.c | 1 + app/test/test_member.c | 1 + drivers/common/iavf/iavf_osdep.h | 2 ++ drivers/common/iavf/virtchnl_inline_ipsec.h | 11 +++++++++++ drivers/common/idpf/base/idpf_osdep.h | 2 ++ drivers/common/mlx5/mlx5_common_mr.h | 4 ++++ drivers/common/mlx5/mlx5_common_utils.h | 1 + drivers/common/mlx5/mlx5_prm.h | 28 ++++++++++++++++++++++++++++ drivers/dma/ioat/ioat_hw_defs.h | 1 + drivers/net/i40e/base/i40e_osdep.h | 2 ++ drivers/net/iavf/iavf_ipsec_crypto.h | 4 +++- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/base/ice_osdep.h | 2 ++ 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 ++++ drivers/net/octeon_ep/otx_ep_mbox.h | 1 + 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 ++++++++ lib/eal/common/eal_private.h | 2 +- lib/eal/include/rte_common.h | 4 +++- 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 +++ 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 ++ 52 files changed, 143 insertions(+), 11 deletions(-)