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 C026646024; Thu, 9 Jan 2025 01:54:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7DEEC40B9B; Thu, 9 Jan 2025 01:49:10 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 85C3D402EA for ; Thu, 9 Jan 2025 01:48:42 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 9F19F206AB95; Wed, 8 Jan 2025 16:48:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9F19F206AB95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1736383721; bh=WY/YLJbKtortB+fkHUMUn1gBqpk0hakwVW8Y75JGIWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fE5pWq5A4jmNje8BS0Y8KGIPR2Tcv5F+RVdF6tPqXGac2X3U7ClKsHWyxRqsv6jFd mJTXd+ZGjuj+JBzdzL7ZlQ53sYFEgCa+GcYLiknbqLTwC+JtH+0/0MDsCZD/+/siCB 2eTAJm2TLzaZTJhXNMqBpNq61nRw5m9iG3VY9Tgs= 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 v9 28/30] lib/pipeline: replace packed attributes Date: Wed, 8 Jan 2025 16:48:33 -0800 Message-Id: <1736383715-31703-29-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1736383715-31703-1-git-send-email-andremue@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1736383715-31703-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/pipeline/rte_table_action.c | 64 ++++++++++++++++----------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c index a431f8f128..3a408e81b8 100644 --- a/lib/pipeline/rte_table_action.c +++ b/lib/pipeline/rte_table_action.c @@ -60,9 +60,9 @@ lb_cfg_check(struct rte_table_action_lb_config *cfg) return 0; } -struct lb_data { +struct __rte_packed_begin lb_data { uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE]; -} __rte_packed; +} __rte_packed_end; static int lb_apply(struct lb_data *data, @@ -356,10 +356,10 @@ tm_cfg_check(struct rte_table_action_tm_config *tm) return 0; } -struct tm_data { +struct __rte_packed_begin tm_data { uint32_t queue_id; uint32_t reserved; -} __rte_packed; +} __rte_packed_end; static int tm_apply_check(struct rte_table_action_tm_params *p, @@ -465,11 +465,11 @@ struct encap_qinq_data { ((((uint64_t)(s)) & 0x1LLU) << 8) | \ (((uint64_t)(ttl)) & 0xFFLLU))) -struct __rte_aligned(2) encap_mpls_data { +struct __rte_aligned(2) __rte_packed_begin encap_mpls_data { struct rte_ether_hdr ether; uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX]; uint32_t mpls_count; -} __rte_packed; +} __rte_packed_end; #define PPP_PROTOCOL_IP 0x0021 @@ -487,42 +487,42 @@ struct encap_pppoe_data { #define IP_PROTO_UDP 17 -struct __rte_aligned(2) encap_vxlan_ipv4_data { +struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv4_data { struct rte_ether_hdr ether; struct rte_ipv4_hdr ipv4; struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __rte_packed; +} __rte_packed_end; -struct __rte_aligned(2) encap_vxlan_ipv4_vlan_data { +struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv4_hdr ipv4; struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __rte_packed; +} __rte_packed_end; -struct __rte_aligned(2) encap_vxlan_ipv6_data { +struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv6_data { struct rte_ether_hdr ether; struct rte_ipv6_hdr ipv6; struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __rte_packed; +} __rte_packed_end; -struct __rte_aligned(2) encap_vxlan_ipv6_vlan_data { +struct __rte_aligned(2) __rte_packed_begin encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv6_hdr ipv6; struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __rte_packed; +} __rte_packed_end; -struct __rte_aligned(2) encap_qinq_pppoe_data { +struct __rte_aligned(2) __rte_packed_begin encap_qinq_pppoe_data { struct rte_ether_hdr ether; struct rte_vlan_hdr svlan; struct rte_vlan_hdr cvlan; struct pppoe_ppp_hdr pppoe_ppp; -} __rte_packed; +} __rte_packed_end; static size_t encap_data_size(struct rte_table_action_encap_config *encap) @@ -1196,15 +1196,15 @@ nat_cfg_check(struct rte_table_action_nat_config *nat) return 0; } -struct nat_ipv4_data { +struct __rte_packed_begin nat_ipv4_data { uint32_t addr; uint16_t port; -} __rte_packed; +} __rte_packed_end; -struct nat_ipv6_data { +struct __rte_packed_begin nat_ipv6_data { struct rte_ipv6_addr addr; uint16_t port; -} __rte_packed; +} __rte_packed_end; static size_t nat_data_size(struct rte_table_action_nat_config *nat __rte_unused, @@ -1493,9 +1493,9 @@ ttl_cfg_check(struct rte_table_action_ttl_config *ttl) return 0; } -struct ttl_data { +struct __rte_packed_begin ttl_data { uint32_t n_packets; -} __rte_packed; +} __rte_packed_end; #define TTL_INIT(data, decrement) \ ((data)->n_packets = (decrement) ? 1 : 0) @@ -1576,10 +1576,10 @@ stats_cfg_check(struct rte_table_action_stats_config *stats) return 0; } -struct stats_data { +struct __rte_packed_begin stats_data { uint64_t n_packets; uint64_t n_bytes; -} __rte_packed; +} __rte_packed_end; static int stats_apply(struct stats_data *data, @@ -1602,9 +1602,9 @@ pkt_work_stats(struct stats_data *data, /** * RTE_TABLE_ACTION_TIME */ -struct time_data { +struct __rte_packed_begin time_data { uint64_t time; -} __rte_packed; +} __rte_packed_end; static int time_apply(struct time_data *data, @@ -1649,7 +1649,7 @@ struct crypto_op_sym_iv_aad { } iv_aad; }; -struct sym_crypto_data { +struct __rte_packed_begin sym_crypto_data { union { struct { @@ -1717,7 +1717,7 @@ struct sym_crypto_data { /** Private data size to store cipher iv / aad. */ uint8_t iv_aad_data[32]; -} __rte_packed; +} __rte_packed_end; static int sym_crypto_cfg_check(struct rte_table_action_sym_crypto_config *cfg) @@ -2052,9 +2052,9 @@ pkt_work_sym_crypto(struct rte_mbuf *mbuf, struct sym_crypto_data *data, /** * RTE_TABLE_ACTION_TAG */ -struct tag_data { +struct __rte_packed_begin tag_data { uint32_t tag; -} __rte_packed; +} __rte_packed_end; static int tag_apply(struct tag_data *data, @@ -2096,9 +2096,9 @@ pkt4_work_tag(struct rte_mbuf *mbuf0, /** * RTE_TABLE_ACTION_DECAP */ -struct decap_data { +struct __rte_packed_begin decap_data { uint16_t n; -} __rte_packed; +} __rte_packed_end; static int decap_apply(struct decap_data *data, -- 2.47.0.vfs.0.3