DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andre Muezerie <andremue@linux.microsoft.com>
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 <andremue@linux.microsoft.com>
Subject: [PATCH v6 28/30] lib/pipeline: replace packed attributes
Date: Tue, 26 Nov 2024 16:52:39 -0800	[thread overview]
Message-ID: <1732668761-5556-29-git-send-email-andremue@linux.microsoft.com> (raw)
In-Reply-To: <1732668761-5556-1-git-send-email-andremue@linux.microsoft.com>

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 <andremue@linux.microsoft.com>
---
 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.34.1


  parent reply	other threads:[~2024-11-27  0:55 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 21:05 [PATCH 00/15] fix packing of structs when building with MSVC Tyler Retzlaff
2024-03-20 21:05 ` [PATCH 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-03-20 21:05 ` [PATCH 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
2024-03-21 16:02   ` Bruce Richardson
2024-03-20 21:05 ` [PATCH 03/15] net: " Tyler Retzlaff
2024-10-07  1:14   ` Stephen Hemminger
2024-03-20 21:06 ` [PATCH 04/15] common/iavf: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 05/15] common/idpf: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 06/15] common/mlx5: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 07/15] dma/ioat: " Tyler Retzlaff
2024-03-21 16:13   ` Bruce Richardson
2024-03-27 22:51     ` Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 08/15] net/i40e: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 09/15] net/iavf: " Tyler Retzlaff
2024-03-21 16:26   ` Bruce Richardson
2024-03-20 21:06 ` [PATCH 10/15] net/ice: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 11/15] net/mlx5: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 12/15] net/octeon_ep: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 13/15] app/testpmd: " Tyler Retzlaff
2024-03-21 16:28   ` Bruce Richardson
2024-03-20 21:06 ` [PATCH 14/15] app/test: " Tyler Retzlaff
2024-03-20 21:06 ` [PATCH 15/15] examples: " Tyler Retzlaff
2024-03-21 16:31   ` Bruce Richardson
2024-03-21 15:32 ` [PATCH 00/15] fix packing of structs " Stephen Hemminger
2024-03-21 15:46   ` Tyler Retzlaff
2024-03-27 23:09 ` [PATCH v2 " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 01/15] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 02/15] eal: pack structures when building with MSVC Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 03/15] net: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 04/15] common/iavf: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 05/15] common/idpf: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 06/15] common/mlx5: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 07/15] dma/ioat: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 08/15] net/i40e: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 09/15] net/iavf: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 10/15] net/ice: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 11/15] net/mlx5: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 12/15] net/octeon_ep: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 13/15] app/testpmd: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 14/15] app/test: " Tyler Retzlaff
2024-03-27 23:09   ` [PATCH v2 15/15] examples: " Tyler Retzlaff
2024-04-15 23:51 ` [PATCH v3 00/16] fix packing of structs " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 03/16] net: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 04/16] common/iavf: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 05/16] common/idpf: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 06/16] common/mlx5: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 07/16] dma/ioat: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 08/16] net/i40e: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 09/16] net/iavf: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 10/16] net/ice: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 11/16] net/mlx5: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 12/16] net/octeon_ep: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 13/16] app/testpmd: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 14/16] app/test: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 15/16] examples: " Tyler Retzlaff
2024-04-15 23:51   ` [PATCH v3 16/16] crypto/mlx5: " Tyler Retzlaff
2024-04-16  0:04 ` [PATCH v4 00/16] fix packing of structs " Tyler Retzlaff
2024-04-16  0:04   ` [PATCH v4 01/16] eal: provide pack start macro for MSVC Tyler Retzlaff
2024-04-16  0:04   ` [PATCH v4 02/16] eal: pack structures when building with MSVC Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 03/16] net: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 04/16] common/iavf: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 05/16] common/idpf: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 06/16] common/mlx5: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 07/16] dma/ioat: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 08/16] net/i40e: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 09/16] net/iavf: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 10/16] net/ice: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 11/16] net/mlx5: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 12/16] net/octeon_ep: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 13/16] app/testpmd: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 14/16] app/test: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 15/16] examples: " Tyler Retzlaff
2024-04-16  0:05   ` [PATCH v4 16/16] crypto/mlx5: " Tyler Retzlaff
2024-11-19  4:35 ` [PATCH v5 00/16] fix packing of structs " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 01/16] eal: provide pack start macro for MSVC Andre Muezerie
2024-11-19  8:32     ` Morten Brørup
2024-11-19 11:00       ` Konstantin Ananyev
2024-11-19 16:23         ` Andre Muezerie
2024-11-21 19:39       ` Andre Muezerie
2024-11-21 20:51         ` Thomas Monjalon
2024-11-22  0:11           ` Andre Muezerie
2024-11-22  8:13             ` Morten Brørup
2024-11-25 22:15               ` Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 02/16] eal: pack structures when building with MSVC Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 03/16] net: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 04/16] common/iavf: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 05/16] common/idpf: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 06/16] common/mlx5: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 07/16] dma/ioat: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 08/16] net/i40e: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 09/16] net/iavf: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 10/16] net/ice: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 11/16] net/mlx5: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 12/16] net/octeon_ep: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 13/16] app/testpmd: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 14/16] app/test: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 15/16] examples: " Andre Muezerie
2024-11-19  4:35   ` [PATCH v5 16/16] crypto/mlx5: " Andre Muezerie
2024-11-20 21:13   ` [PATCH v5 00/16] fix packing of structs " Patrick Robb
2024-11-27  0:52 ` [PATCH v6 00/30] " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 01/30] devtools: check packed attributes Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 02/30] eal/include: add new packing macros Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 03/30] app/test-pmd: remove unnecessary packed attributes Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 04/30] app/test: replace " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 05/30] doc/guides: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 06/30] drivers/baseband: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 07/30] drivers/bus: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 08/30] drivers/common: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 09/30] drivers/compress: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 10/30] drivers/crypto: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 11/30] drivers/dma: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 12/30] drivers/event: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 13/30] drivers/mempool: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 14/30] drivers/net: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 15/30] drivers/raw: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 16/30] drivers/regex: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 17/30] drivers/vdpa: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 18/30] examples/common: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 19/30] examples/ip-pipeline: remove " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 20/30] examples/ipsec_secgw: replace " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 21/30] examples/l3fwd-power: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 22/30] examples/l3fwd: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 23/30] examples/ptpclient: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 24/30] examples/vhost_blk: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 25/30] lib/eal: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 26/30] lib/ipsec: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 27/30] lib/net: " Andre Muezerie
2024-11-27  0:52   ` Andre Muezerie [this message]
2024-11-27  0:52   ` [PATCH v6 29/30] lib/vhost: " Andre Muezerie
2024-11-27  0:52   ` [PATCH v6 30/30] lib/eal: remove __rte_packed Andre Muezerie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1732668761-5556-29-git-send-email-andremue@linux.microsoft.com \
    --to=andremue@linux.microsoft.com \
    --cc=aman.deep.singh@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=byron.marohn@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=gakhil@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=jingjing.wu@intel.com \
    --cc=kirill.rybalchenko@intel.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=radu.nicolau@intel.com \
    --cc=roretzla@linux.microsoft.com \
    --cc=ruifeng.wang@arm.com \
    --cc=sameh.gobriel@intel.com \
    --cc=sivaprasad.tummala@amd.com \
    --cc=skori@marvell.com \
    --cc=stephen@networkplumber.org \
    --cc=suanmingm@nvidia.com \
    --cc=vattunuru@marvell.com \
    --cc=viacheslavo@nvidia.com \
    --cc=vladimir.medvedkin@intel.com \
    --cc=yipeng1.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).