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 744E645F25; Mon, 23 Dec 2024 20:14:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91F4A40B91; Mon, 23 Dec 2024 20:12:53 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EA9A3402E6 for ; Mon, 23 Dec 2024 20:12:16 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 05489206ADEA; Mon, 23 Dec 2024 11:12:14 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 05489206ADEA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1734981136; bh=y3f8Khj5na0CZqAgF1LrOY8lVh7a73gwZQhOF8TE834=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSoOozoyPm6Ra9T5kn8S8zNaLNwNNnvPZPRgY9scMJWB/UEJNBqgI9QXVY5OF6dmE rpgyf3W6xdkly51FXGCTRwJaieTF0tglET5yQ/zGY/Cxk8laJFRGuM0A7cBLuJTt7l SatR2prNqblrhk+og95HKHmYrD0eZ0m/CeJJZjf4= 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, 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 v7 28/29] lib/pipeline: replace packed attributes Date: Mon, 23 Dec 2024 11:12:01 -0800 Message-Id: <1734981122-4729-29-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1734981122-4729-1-git-send-email-andremue@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1734981122-4729-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..60cc9ae659 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 { +__rte_packed_begin struct 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 { +__rte_packed_begin struct 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 { +__rte_packed_begin struct __rte_aligned(2) 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 { +__rte_packed_begin struct __rte_aligned(2) 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 { +__rte_packed_begin struct __rte_aligned(2) 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 { +__rte_packed_begin struct __rte_aligned(2) 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 { +__rte_packed_begin struct __rte_aligned(2) 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 { +__rte_packed_begin struct __rte_aligned(2) 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 { +__rte_packed_begin struct nat_ipv4_data { uint32_t addr; uint16_t port; -} __rte_packed; +} __rte_packed_end; -struct nat_ipv6_data { +__rte_packed_begin struct 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 { +__rte_packed_begin struct 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 { +__rte_packed_begin struct 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 { +__rte_packed_begin struct 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 { +__rte_packed_begin struct 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 { +__rte_packed_begin struct 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 { +__rte_packed_begin struct decap_data { uint16_t n; -} __rte_packed; +} __rte_packed_end; static int decap_apply(struct decap_data *data, -- 2.47.0.vfs.0.3