DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] replace GCC marker extension with C11 anonymous unions
@ 2024-01-30 23:26 Tyler Retzlaff
  2024-01-30 23:26 ` [PATCH] mbuf: " Tyler Retzlaff
                   ` (8 more replies)
  0 siblings, 9 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-01-30 23:26 UTC (permalink / raw)
  To: dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin, Tyler Retzlaff

The zero sized RTE_MARKER<n> typedefs are a GCC extension unsupported by
MSVC.  Replace the use of the RTE_MARKER typedefs with anonymous unions.

both lib/mbuf and consuming drivers have been updated in the same commit
to avoid driver build break.

note:
since rte_mbuf is a public structure it might be argued that the removal
of the ability to access the fields as an array could be an api break.
there is no intended change in the application abi.

Tyler Retzlaff (1):
  mbuf: replace GCC marker extension with C11 anonymous unions

 drivers/net/ionic/ionic_lif.c               |   8 +-
 drivers/net/ionic/ionic_rxtx_sg.c           |   4 +-
 drivers/net/ionic/ionic_rxtx_simple.c       |   2 +-
 drivers/net/sfc/sfc_ef100_rx.c              |   8 +-
 drivers/net/sfc/sfc_ef10_rx.c               |  12 +--
 drivers/net/virtio/virtio_rxtx_packed_avx.h |   8 +-
 lib/mbuf/rte_mbuf_core.h                    | 135 +++++++++++++++-------------
 7 files changed, 94 insertions(+), 83 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
@ 2024-01-30 23:26 ` Tyler Retzlaff
  2024-01-31  9:18   ` Morten Brørup
                     ` (3 more replies)
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                   ` (7 subsequent siblings)
  8 siblings, 4 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-01-30 23:26 UTC (permalink / raw)
  To: dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin, Tyler Retzlaff

Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
code portability between toolchains.

Update use of rte_mbuf rearm_data field in net/ionic, net/sfc and
net/virtio which were accessing field as a zero-length array.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ionic/ionic_lif.c               |   8 +-
 drivers/net/ionic/ionic_rxtx_sg.c           |   4 +-
 drivers/net/ionic/ionic_rxtx_simple.c       |   2 +-
 drivers/net/sfc/sfc_ef100_rx.c              |   8 +-
 drivers/net/sfc/sfc_ef10_rx.c               |  12 +--
 drivers/net/virtio/virtio_rxtx_packed_avx.h |   8 +-
 lib/mbuf/rte_mbuf_core.h                    | 135 +++++++++++++++-------------
 7 files changed, 94 insertions(+), 83 deletions(-)

diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index 25b490d..fd99f39 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -725,8 +725,8 @@
 
 	rte_compiler_barrier();
 
-	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data) != sizeof(uint64_t));
+	return rxm.rearm_data;
 }
 
 static uint64_t
@@ -743,8 +743,8 @@
 
 	rte_compiler_barrier();
 
-	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data) != sizeof(uint64_t));
+	return rxm.rearm_data;
 }
 
 int
diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c
index ab8e56e..a569dd1 100644
--- a/drivers/net/ionic/ionic_rxtx_sg.c
+++ b/drivers/net/ionic/ionic_rxtx_sg.c
@@ -285,7 +285,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	rxm->rearm_data = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc_len);
 	left = cq_desc_len - rxm->data_len;
@@ -298,7 +298,7 @@
 		info[i] = NULL;
 
 		/* Set the chained mbuf metadata */
-		rxm_seg->rearm_data[0] = rxq->rearm_seg_data;
+		rxm_seg->rearm_data = rxq->rearm_seg_data;
 		rxm_seg->data_len = RTE_MIN(rxq->seg_size, left);
 		left -= rxm_seg->data_len;
 
diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c
index 5f81856..1978610 100644
--- a/drivers/net/ionic/ionic_rxtx_simple.c
+++ b/drivers/net/ionic/ionic_rxtx_simple.c
@@ -256,7 +256,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	rxm->rearm_data = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = cq_desc_len;
 
diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c
index 2677003..23918d5 100644
--- a/drivers/net/sfc/sfc_ef100_rx.c
+++ b/drivers/net/sfc/sfc_ef100_rx.c
@@ -553,9 +553,9 @@ struct sfc_ef100_rxq {
 		pkt = sfc_ef100_rx_next_mbuf(rxq);
 		__rte_mbuf_raw_sanity_check(pkt);
 
-		RTE_BUILD_BUG_ON(sizeof(pkt->rearm_data[0]) !=
+		RTE_BUILD_BUG_ON(sizeof(pkt->rearm_data) !=
 				 sizeof(rxq->rearm_data));
-		pkt->rearm_data[0] = rxq->rearm_data;
+		pkt->rearm_data = rxq->rearm_data;
 
 		/* data_off already moved past Rx prefix */
 		rx_prefix = (const efx_xword_t *)sfc_ef100_rx_pkt_prefix(pkt);
@@ -759,8 +759,8 @@ struct sfc_ef100_rxq {
 
 	/* rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
-	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(m.rearm_data) != sizeof(uint64_t));
+	return m.rearm_data;
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef100_rx_qcreate;
diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c
index 30a320d..60bc098 100644
--- a/drivers/net/sfc/sfc_ef10_rx.c
+++ b/drivers/net/sfc/sfc_ef10_rx.c
@@ -322,8 +322,8 @@ struct sfc_ef10_rxq {
 
 	m = rxd->mbuf;
 
-	RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) != sizeof(rxq->rearm_data));
-	m->rearm_data[0] = rxq->rearm_data;
+	RTE_BUILD_BUG_ON(sizeof(m->rearm_data) != sizeof(rxq->rearm_data));
+	m->rearm_data = rxq->rearm_data;
 
 	/* Classify packet based on Rx event */
 	/* Mask RSS hash offload flag if RSS is not enabled */
@@ -377,9 +377,9 @@ struct sfc_ef10_rxq {
 			rxq->completed = pending;
 		}
 
-		RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) !=
+		RTE_BUILD_BUG_ON(sizeof(m->rearm_data) !=
 				 sizeof(rxq->rearm_data));
-		m->rearm_data[0] = rxq->rearm_data;
+		m->rearm_data = rxq->rearm_data;
 
 		/* Event-dependent information is the same */
 		m->ol_flags = m0->ol_flags;
@@ -633,8 +633,8 @@ struct sfc_ef10_rxq {
 
 	/* rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
-	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(m.rearm_data) != sizeof(uint64_t));
+	return m.rearm_data;
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef10_rx_qcreate;
diff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.h b/drivers/net/virtio/virtio_rxtx_packed_avx.h
index 584ac72..a9ce53f 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_avx.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h
@@ -36,10 +36,10 @@
 	/* Load four mbufs rearm data */
 	RTE_BUILD_BUG_ON(REFCNT_BITS_OFFSET >= 64);
 	RTE_BUILD_BUG_ON(SEG_NUM_BITS_OFFSET >= 64);
-	__m256i mbufs = _mm256_set_epi64x(*tx_pkts[3]->rearm_data,
-					  *tx_pkts[2]->rearm_data,
-					  *tx_pkts[1]->rearm_data,
-					  *tx_pkts[0]->rearm_data);
+	__m256i mbufs = _mm256_set_epi64x(tx_pkts[3]->rearm_data,
+					  tx_pkts[2]->rearm_data,
+					  tx_pkts[1]->rearm_data,
+					  tx_pkts[0]->rearm_data);
 
 	/* refcnt=1 and nb_segs=1 */
 	__m256i mbuf_ref = _mm256_set1_epi64x(DEFAULT_REARM_DATA);
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 5688683..d731ea0 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -464,9 +464,10 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct rte_mbuf {
-	RTE_MARKER cacheline0;
-
-	void *buf_addr;           /**< Virtual address of segment buffer. */
+	union {
+	    void *cacheline0;
+	    void *buf_addr;           /**< Virtual address of segment buffer. */
+	};
 #if RTE_IOVA_IN_MBUF
 	/**
 	 * Physical address of segment buffer.
@@ -487,69 +488,77 @@ struct rte_mbuf {
 #endif
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
+	union {
+		uint64_t rearm_data;
+		struct {
+			uint16_t data_off;
+
+			/**
+			 * Reference counter. Its size should at least equal to the size
+			 * of port field (16 bits), to support zero-copy broadcast.
+			 * It should only be accessed using the following functions:
+			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
+			 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
+			 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
+			 */
+			RTE_ATOMIC(uint16_t) refcnt;
 
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
+			/**
+			 * Number of segments. Only valid for the first segment of an mbuf
+			 * chain.
+			 */
+			uint16_t nb_segs;
 
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
+			/** Input port (16 bits to support more than 256 virtual ports).
+			 * The event eth Tx adapter uses this field to specify the output port.
+			 */
+			uint16_t port;
 
-	uint64_t ol_flags;        /**< Offload features. */
+			uint64_t ol_flags;        /**< Offload features. */
+		};
+	};
 
 	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
-
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
 	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
-		__extension__
+		void *rx_descriptor_fields1;
+
+		/*
+		 * The packet type, which is the combination of outer/inner L2, L3, L4
+		 * and tunnel types. The packet_type is about data really present in the
+		 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
+		 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
+		 * vlan is stripped from the data.
+		 */
 		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
-				 */
+				uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
 				__extension__
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					uint8_t l2_type:4;   /**< (Outer) L2 type. */
+					uint8_t l3_type:4;   /**< (Outer) L3 type. */
+					uint8_t l4_type:4;   /**< (Outer) L4 type. */
+					uint8_t tun_type:4;  /**< Tunnel type. */
+					union {
+						uint8_t inner_esp_next_proto;
+						/**< ESP next protocol type, valid if
+						 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
+						 * on both Tx and Rx.
+						 */
+						__extension__
+						struct {
+							uint8_t inner_l2_type:4;
+							/**< Inner L2 type. */
+							uint8_t inner_l3_type:4;
+							/**< Inner L3 type. */
+						};
+					};
+					uint8_t inner_l4_type:4; /**< Inner L4 type. */
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
+			uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
 		};
 	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
 	uint16_t data_len;        /**< Amount of data in segment buffer. */
 	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
 	uint16_t vlan_tci;
@@ -595,21 +604,23 @@ struct rte_mbuf {
 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
+	union {
+		void *cacheline1;
 
 #if RTE_IOVA_IN_MBUF
-	/**
-	 * Next segment of scattered packet. Must be NULL in the last
-	 * segment or in case of non-segmented packet.
-	 */
-	struct rte_mbuf *next;
+		/**
+		 * Next segment of scattered packet. Must be NULL in the last
+		 * segment or in case of non-segmented packet.
+		 */
+		struct rte_mbuf *next;
 #else
-	/**
-	 * Reserved for dynamic fields
-	 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
-	 */
-	uint64_t dynfield2;
+		/**
+		 * Reserved for dynamic fields
+		 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
+		 */
+		uint64_t dynfield2;
 #endif
+	};
 
 	/* fields to support TX offloads */
 	union {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-01-30 23:26 ` [PATCH] mbuf: " Tyler Retzlaff
@ 2024-01-31  9:18   ` Morten Brørup
  2024-01-31 21:09     ` Tyler Retzlaff
  2024-01-31 13:49   ` Bruce Richardson
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-01-31  9:18 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 31 January 2024 00.26
> 
> Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
> code portability between toolchains.
> 
> Update use of rte_mbuf rearm_data field in net/ionic, net/sfc and
> net/virtio which were accessing field as a zero-length array.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

I have some comments, putting weight on code readability rather than avoiding API breakage.

We can consider my suggested API breaking changes for the next API breaking release, and keep your goal of minimal API breakage with the current changes.

> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 5688683..d731ea0 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -464,9 +464,10 @@ enum {
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
>  struct rte_mbuf {
> -	RTE_MARKER cacheline0;
> -
> -	void *buf_addr;           /**< Virtual address of segment buffer.
> */
> +	union {
> +	    void *cacheline0;
> +	    void *buf_addr;           /**< Virtual address of segment
> buffer. */
> +	};

I suppose this is the least ugly workaround for not being able to use the RTE_MARKER hack here.

>  #if RTE_IOVA_IN_MBUF
>  	/**
>  	 * Physical address of segment buffer.
> @@ -487,69 +488,77 @@ struct rte_mbuf {
>  #endif
> 
>  	/* next 8 bytes are initialised on RX descriptor rearm */
> -	RTE_MARKER64 rearm_data;
> -	uint16_t data_off;
> -
> -	/**
> -	 * Reference counter. Its size should at least equal to the size
> -	 * of port field (16 bits), to support zero-copy broadcast.
> -	 * It should only be accessed using the following functions:
> -	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> -	 * rte_mbuf_refcnt_set(). The functionality of these functions
> (atomic,
> -	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC
> flag.
> -	 */
> -	RTE_ATOMIC(uint16_t) refcnt;
> +	union {
> +		uint64_t rearm_data;

I consider this union with uint64_t rearm_data an improvement for code readability. Using a marker here was weird.

> +		struct {
> +			uint16_t data_off;
> +
> +			/**
> +			 * Reference counter. Its size should at least equal
> to the size
> +			 * of port field (16 bits), to support zero-copy
> broadcast.
> +			 * It should only be accessed using the following
> functions:
> +			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(),
> and
> +			 * rte_mbuf_refcnt_set(). The functionality of these
> functions (atomic,
> +			 * or non-atomic) is controlled by the
> RTE_MBUF_REFCNT_ATOMIC flag.
> +			 */
> +			RTE_ATOMIC(uint16_t) refcnt;
> 
> -	/**
> -	 * Number of segments. Only valid for the first segment of an
> mbuf
> -	 * chain.
> -	 */
> -	uint16_t nb_segs;
> +			/**
> +			 * Number of segments. Only valid for the first
> segment of an mbuf
> +			 * chain.
> +			 */
> +			uint16_t nb_segs;
> 
> -	/** Input port (16 bits to support more than 256 virtual ports).
> -	 * The event eth Tx adapter uses this field to specify the output
> port.
> -	 */
> -	uint16_t port;
> +			/** Input port (16 bits to support more than 256
> virtual ports).
> +			 * The event eth Tx adapter uses this field to
> specify the output port.
> +			 */
> +			uint16_t port;
> 
> -	uint64_t ol_flags;        /**< Offload features. */
> +			uint64_t ol_flags;        /**< Offload features. */

Either:
1. If the comment about 8 bytes init on rearm is correct: ol_flags should remain outside the struct and union, i.e. at top level, else
2. It would be nice to increase the size of the rearm_data variable to 16 byte, so it covers the entire struct being rearmed. (And the incorrect comment about how many bytes are being rearmed should be fixed.)

> +		};
> +	};
> 
>  	/* remaining bytes are set on RX when pulling packet from
> descriptor */
> -	RTE_MARKER rx_descriptor_fields1;
> -
> -	/*
> -	 * The packet type, which is the combination of outer/inner L2,
> L3, L4
> -	 * and tunnel types. The packet_type is about data really present
> in the
> -	 * mbuf. Example: if vlan stripping is enabled, a received vlan
> packet
> -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN
> because the
> -	 * vlan is stripped from the data.
> -	 */
>  	union {
> -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information.
> */
> -		__extension__
> +		void *rx_descriptor_fields1;

Instead of using void* for rx_descriptor_fields1, it would be nice to make rx_descriptor_fields1 a type of the correct size. It might need to be an uint32_t array to avoid imposing additional alignment requirements.

> +
> +		/*
> +		 * The packet type, which is the combination of outer/inner
> L2, L3, L4
> +		 * and tunnel types. The packet_type is about data really
> present in the
> +		 * mbuf. Example: if vlan stripping is enabled, a received
> vlan packet
> +		 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN
> because the
> +		 * vlan is stripped from the data.
> +		 */
>  		struct {
> -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> -			uint8_t tun_type:4;  /**< Tunnel type. */
>  			union {
> -				uint8_t inner_esp_next_proto;
> -				/**< ESP next protocol type, valid if
> -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> -				 * on both Tx and Rx.
> -				 */
> +				uint32_t packet_type; /**< L2/L3/L4 and tunnel
> information. */
>  				__extension__
>  				struct {
> -					uint8_t inner_l2_type:4;
> -					/**< Inner L2 type. */
> -					uint8_t inner_l3_type:4;
> -					/**< Inner L3 type. */
> +					uint8_t l2_type:4;   /**< (Outer) L2
> type. */
> +					uint8_t l3_type:4;   /**< (Outer) L3
> type. */
> +					uint8_t l4_type:4;   /**< (Outer) L4
> type. */
> +					uint8_t tun_type:4;  /**< Tunnel type. */
> +					union {
> +						uint8_t inner_esp_next_proto;
> +						/**< ESP next protocol type, valid
> if
> +						 * RTE_PTYPE_TUNNEL_ESP tunnel type
> is set
> +						 * on both Tx and Rx.
> +						 */
> +						__extension__
> +						struct {
> +							uint8_t inner_l2_type:4;
> +							/**< Inner L2 type. */
> +							uint8_t inner_l3_type:4;
> +							/**< Inner L3 type. */
> +						};
> +					};
> +					uint8_t inner_l4_type:4; /**< Inner L4
> type. */
>  				};
>  			};
> -			uint8_t inner_l4_type:4; /**< Inner L4 type. */
> +			uint32_t pkt_len;         /**< Total pkt len: sum of
> all segments. */
>  		};
>  	};
> 
> -	uint32_t pkt_len;         /**< Total pkt len: sum of all
> segments. */
>  	uint16_t data_len;        /**< Amount of data in segment buffer.
> */
>  	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
>  	uint16_t vlan_tci;
> @@ -595,21 +604,23 @@ struct rte_mbuf {
>  	struct rte_mempool *pool; /**< Pool from which mbuf was
> allocated. */
> 
>  	/* second cache line - fields only used in slow path or on TX */
> -	RTE_MARKER cacheline1 __rte_cache_min_aligned;
> +	union {
> +		void *cacheline1;

The __rte_cache_min_aligned cannot be removed. It provides cache line alignment for 32 bit platforms, where pointers in the first cache line only use 4 byte.

NB: The rte_mbuf structure could be optimized for 32 bit platforms by moving fields from the second cache line to the holes in the first, but that's another discussion.

> 
>  #if RTE_IOVA_IN_MBUF
> -	/**
> -	 * Next segment of scattered packet. Must be NULL in the last
> -	 * segment or in case of non-segmented packet.
> -	 */
> -	struct rte_mbuf *next;
> +		/**
> +		 * Next segment of scattered packet. Must be NULL in the
> last
> +		 * segment or in case of non-segmented packet.
> +		 */
> +		struct rte_mbuf *next;
>  #else
> -	/**
> -	 * Reserved for dynamic fields
> -	 * when the next pointer is in first cache line (i.e.
> RTE_IOVA_IN_MBUF is 0).
> -	 */
> -	uint64_t dynfield2;
> +		/**
> +		 * Reserved for dynamic fields
> +		 * when the next pointer is in first cache line (i.e.
> RTE_IOVA_IN_MBUF is 0).
> +		 */
> +		uint64_t dynfield2;
>  #endif
> +	};
> 
>  	/* fields to support TX offloads */
>  	union {
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-01-30 23:26 ` [PATCH] mbuf: " Tyler Retzlaff
  2024-01-31  9:18   ` Morten Brørup
@ 2024-01-31 13:49   ` Bruce Richardson
  2024-01-31 20:45     ` Tyler Retzlaff
  2024-02-13  6:45   ` [PATCH v2] RFC: " Tyler Retzlaff
  2024-02-13 23:33   ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Tyler Retzlaff
  3 siblings, 1 reply; 171+ messages in thread
From: Bruce Richardson @ 2024-01-31 13:49 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin

On Tue, Jan 30, 2024 at 03:26:13PM -0800, Tyler Retzlaff wrote:
> Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
> code portability between toolchains.
> 
> Update use of rte_mbuf rearm_data field in net/ionic, net/sfc and
> net/virtio which were accessing field as a zero-length array.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  drivers/net/ionic/ionic_lif.c               |   8 +-
>  drivers/net/ionic/ionic_rxtx_sg.c           |   4 +-
>  drivers/net/ionic/ionic_rxtx_simple.c       |   2 +-
>  drivers/net/sfc/sfc_ef100_rx.c              |   8 +-
>  drivers/net/sfc/sfc_ef10_rx.c               |  12 +--
>  drivers/net/virtio/virtio_rxtx_packed_avx.h |   8 +-
>  lib/mbuf/rte_mbuf_core.h                    | 135 +++++++++++++++-------------
>  7 files changed, 94 insertions(+), 83 deletions(-)
> 
<snip>
@@ -464,9 +464,10 @@ enum {
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
>  struct rte_mbuf {
> -	RTE_MARKER cacheline0;
> -
> -	void *buf_addr;           /**< Virtual address of segment buffer. */
> +	union {
> +	    void *cacheline0;
> +	    void *buf_addr;           /**< Virtual address of segment buffer. */
> +	};

This marker is never used, so we should just look to drop it. I think it
was originally added to have an equivalent to the cacheline1 marker.

However, that would be an ABI change, so I'm ok to have this as-is for now.

/Bruce


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-01-31 13:49   ` Bruce Richardson
@ 2024-01-31 20:45     ` Tyler Retzlaff
  2024-01-31 22:55       ` Morten Brørup
  0 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-01-31 20:45 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin

On Wed, Jan 31, 2024 at 01:49:34PM +0000, Bruce Richardson wrote:
> On Tue, Jan 30, 2024 at 03:26:13PM -0800, Tyler Retzlaff wrote:
> > Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
> > code portability between toolchains.
> > 
> > Update use of rte_mbuf rearm_data field in net/ionic, net/sfc and
> > net/virtio which were accessing field as a zero-length array.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  drivers/net/ionic/ionic_lif.c               |   8 +-
> >  drivers/net/ionic/ionic_rxtx_sg.c           |   4 +-
> >  drivers/net/ionic/ionic_rxtx_simple.c       |   2 +-
> >  drivers/net/sfc/sfc_ef100_rx.c              |   8 +-
> >  drivers/net/sfc/sfc_ef10_rx.c               |  12 +--
> >  drivers/net/virtio/virtio_rxtx_packed_avx.h |   8 +-
> >  lib/mbuf/rte_mbuf_core.h                    | 135 +++++++++++++++-------------
> >  7 files changed, 94 insertions(+), 83 deletions(-)
> > 
> <snip>
> @@ -464,9 +464,10 @@ enum {
> >   * The generic rte_mbuf, containing a packet mbuf.
> >   */
> >  struct rte_mbuf {
> > -	RTE_MARKER cacheline0;
> > -
> > -	void *buf_addr;           /**< Virtual address of segment buffer. */
> > +	union {
> > +	    void *cacheline0;
> > +	    void *buf_addr;           /**< Virtual address of segment buffer. */
> > +	};
> 
> This marker is never used, so we should just look to drop it. I think it
> was originally added to have an equivalent to the cacheline1 marker.

it's actually got a use in one location.

rte_mbuf.h:

static inline void
rte_mbuf_prefetch_part1(struct rte_mbuf *m)
{
        rte_prefetch0(&m->cacheline0);
}

> However, that would be an ABI change, so I'm ok to have this as-is for now.

do you mean api change? just asking to make sure i understand what i'm
doing.

as i understand how this extension (marker) works removing the
cacheline0 marker would not alter the layout of the struct. that is the
sizeof the struct, sizeof any field nor the offset of any field changes
would change by the marker removal.

> 
> /Bruce

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-01-31  9:18   ` Morten Brørup
@ 2024-01-31 21:09     ` Tyler Retzlaff
  2024-01-31 22:39       ` Morten Brørup
  0 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-01-31 21:09 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Konstantin Ananyev, Maxime Coquelin

On Wed, Jan 31, 2024 at 10:18:37AM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Wednesday, 31 January 2024 00.26
> > 
> > Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
> > code portability between toolchains.
> > 
> > Update use of rte_mbuf rearm_data field in net/ionic, net/sfc and
> > net/virtio which were accessing field as a zero-length array.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> 
> I have some comments, putting weight on code readability rather than avoiding API breakage.
> 
> We can consider my suggested API breaking changes for the next API breaking release, and keep your goal of minimal API breakage with the current changes.

thanks appreciate your help with this one.

> 
> > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > index 5688683..d731ea0 100644
> > --- a/lib/mbuf/rte_mbuf_core.h
> > +++ b/lib/mbuf/rte_mbuf_core.h
> > @@ -464,9 +464,10 @@ enum {
> >   * The generic rte_mbuf, containing a packet mbuf.
> >   */
> >  struct rte_mbuf {
> > -	RTE_MARKER cacheline0;
> > -
> > -	void *buf_addr;           /**< Virtual address of segment buffer.
> > */
> > +	union {
> > +	    void *cacheline0;
> > +	    void *buf_addr;           /**< Virtual address of segment
> > buffer. */
> > +	};
> 
> I suppose this is the least ugly workaround for not being able to use the RTE_MARKER hack here.

it is but i'm absolutely open to alternatives that work with all
toolchains and both C and C++ if there are any.

> 
> >  #if RTE_IOVA_IN_MBUF
> >  	/**
> >  	 * Physical address of segment buffer.
> > @@ -487,69 +488,77 @@ struct rte_mbuf {
> >  #endif
> > 
> >  	/* next 8 bytes are initialised on RX descriptor rearm */
> > -	RTE_MARKER64 rearm_data;
> > -	uint16_t data_off;
> > -
> > -	/**
> > -	 * Reference counter. Its size should at least equal to the size
> > -	 * of port field (16 bits), to support zero-copy broadcast.
> > -	 * It should only be accessed using the following functions:
> > -	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> > -	 * rte_mbuf_refcnt_set(). The functionality of these functions
> > (atomic,
> > -	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC
> > flag.
> > -	 */
> > -	RTE_ATOMIC(uint16_t) refcnt;
> > +	union {
> > +		uint64_t rearm_data;
> 
> I consider this union with uint64_t rearm_data an improvement for code readability. Using a marker here was weird.
> 
> > +		struct {
> > +			uint16_t data_off;
> > +
> > +			/**
> > +			 * Reference counter. Its size should at least equal
> > to the size
> > +			 * of port field (16 bits), to support zero-copy
> > broadcast.
> > +			 * It should only be accessed using the following
> > functions:
> > +			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(),
> > and
> > +			 * rte_mbuf_refcnt_set(). The functionality of these
> > functions (atomic,
> > +			 * or non-atomic) is controlled by the
> > RTE_MBUF_REFCNT_ATOMIC flag.
> > +			 */
> > +			RTE_ATOMIC(uint16_t) refcnt;
> > 
> > -	/**
> > -	 * Number of segments. Only valid for the first segment of an
> > mbuf
> > -	 * chain.
> > -	 */
> > -	uint16_t nb_segs;
> > +			/**
> > +			 * Number of segments. Only valid for the first
> > segment of an mbuf
> > +			 * chain.
> > +			 */
> > +			uint16_t nb_segs;
> > 
> > -	/** Input port (16 bits to support more than 256 virtual ports).
> > -	 * The event eth Tx adapter uses this field to specify the output
> > port.
> > -	 */
> > -	uint16_t port;
> > +			/** Input port (16 bits to support more than 256
> > virtual ports).
> > +			 * The event eth Tx adapter uses this field to
> > specify the output port.
> > +			 */
> > +			uint16_t port;
> > 
> > -	uint64_t ol_flags;        /**< Offload features. */
> > +			uint64_t ol_flags;        /**< Offload features. */
> 
> Either:
> 1. If the comment about 8 bytes init on rearm is correct: ol_flags should remain outside the struct and union, i.e. at top level, else

> 2. It would be nice to increase the size of the rearm_data variable to 16 byte, so it covers the entire struct being rearmed. (And the incorrect comment about how many bytes are being rearmed should be fixed.)
> 

thanks for picking this up, i think i've actually just got a mistake
here. i don't think ol_flags should have been lifted into the union i'll
go back and do some double checking.

> > +		};
> > +	};
> > 
> >  	/* remaining bytes are set on RX when pulling packet from
> > descriptor */
> > -	RTE_MARKER rx_descriptor_fields1;
> > -
> > -	/*
> > -	 * The packet type, which is the combination of outer/inner L2,
> > L3, L4
> > -	 * and tunnel types. The packet_type is about data really present
> > in the
> > -	 * mbuf. Example: if vlan stripping is enabled, a received vlan
> > packet
> > -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN
> > because the
> > -	 * vlan is stripped from the data.
> > -	 */
> >  	union {
> > -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information.
> > */
> > -		__extension__
> > +		void *rx_descriptor_fields1;
> 
> Instead of using void* for rx_descriptor_fields1, it would be nice to make rx_descriptor_fields1 a type of the correct size. It might need to be an uint32_t array to avoid imposing additional alignment requirements.

as you've probably guessed i used the type from the original marker in
use. for api compat reasons i'll avoid changing type in this series.

> 
> > +
> > +		/*
> > +		 * The packet type, which is the combination of outer/inner
> > L2, L3, L4
> > +		 * and tunnel types. The packet_type is about data really
> > present in the
> > +		 * mbuf. Example: if vlan stripping is enabled, a received
> > vlan packet
> > +		 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN
> > because the
> > +		 * vlan is stripped from the data.
> > +		 */
> >  		struct {
> > -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> > -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> > -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> > -			uint8_t tun_type:4;  /**< Tunnel type. */
> >  			union {
> > -				uint8_t inner_esp_next_proto;
> > -				/**< ESP next protocol type, valid if
> > -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> > -				 * on both Tx and Rx.
> > -				 */
> > +				uint32_t packet_type; /**< L2/L3/L4 and tunnel
> > information. */
> >  				__extension__
> >  				struct {
> > -					uint8_t inner_l2_type:4;
> > -					/**< Inner L2 type. */
> > -					uint8_t inner_l3_type:4;
> > -					/**< Inner L3 type. */
> > +					uint8_t l2_type:4;   /**< (Outer) L2
> > type. */
> > +					uint8_t l3_type:4;   /**< (Outer) L3
> > type. */
> > +					uint8_t l4_type:4;   /**< (Outer) L4
> > type. */
> > +					uint8_t tun_type:4;  /**< Tunnel type. */
> > +					union {
> > +						uint8_t inner_esp_next_proto;
> > +						/**< ESP next protocol type, valid
> > if
> > +						 * RTE_PTYPE_TUNNEL_ESP tunnel type
> > is set
> > +						 * on both Tx and Rx.
> > +						 */
> > +						__extension__
> > +						struct {
> > +							uint8_t inner_l2_type:4;
> > +							/**< Inner L2 type. */
> > +							uint8_t inner_l3_type:4;
> > +							/**< Inner L3 type. */
> > +						};
> > +					};
> > +					uint8_t inner_l4_type:4; /**< Inner L4
> > type. */
> >  				};
> >  			};
> > -			uint8_t inner_l4_type:4; /**< Inner L4 type. */
> > +			uint32_t pkt_len;         /**< Total pkt len: sum of
> > all segments. */
> >  		};
> >  	};
> > 
> > -	uint32_t pkt_len;         /**< Total pkt len: sum of all
> > segments. */
> >  	uint16_t data_len;        /**< Amount of data in segment buffer.
> > */
> >  	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
> >  	uint16_t vlan_tci;
> > @@ -595,21 +604,23 @@ struct rte_mbuf {
> >  	struct rte_mempool *pool; /**< Pool from which mbuf was
> > allocated. */
> > 
> >  	/* second cache line - fields only used in slow path or on TX */
> > -	RTE_MARKER cacheline1 __rte_cache_min_aligned;
> > +	union {
> > +		void *cacheline1;
> 
> The __rte_cache_min_aligned cannot be removed. It provides cache line alignment for 32 bit platforms, where pointers in the first cache line only use 4 byte.

oh no i forgot i needed to figure this out before submission. now that
it's here though i could use some help / suggestions.

the existing __rte_cache_min_aligned (and indeed standard alignas)
facilities are not of great utility when applied to anonymous unions,
further complicating things is that it also has to work with C++.

i'll take this away and work on it some more but does anyone here have a
suggestion on how to align this anonymous union data member to the
desired alignment *without* the union being padded to min cache line
size and as a consequence causing the rte_mbuf struct to be 3 instead
of 2 cache lines? (that's essentially the problem i need help solving).

> 
> NB: The rte_mbuf structure could be optimized for 32 bit platforms by moving fields from the second cache line to the holes in the first, but that's another discussion.

likely could be optimized. a discussion for another time since we can't make
breaking abi changes.

> 
> > 
> >  #if RTE_IOVA_IN_MBUF
> > -	/**
> > -	 * Next segment of scattered packet. Must be NULL in the last
> > -	 * segment or in case of non-segmented packet.
> > -	 */
> > -	struct rte_mbuf *next;
> > +		/**
> > +		 * Next segment of scattered packet. Must be NULL in the
> > last
> > +		 * segment or in case of non-segmented packet.
> > +		 */
> > +		struct rte_mbuf *next;
> >  #else
> > -	/**
> > -	 * Reserved for dynamic fields
> > -	 * when the next pointer is in first cache line (i.e.
> > RTE_IOVA_IN_MBUF is 0).
> > -	 */
> > -	uint64_t dynfield2;
> > +		/**
> > +		 * Reserved for dynamic fields
> > +		 * when the next pointer is in first cache line (i.e.
> > RTE_IOVA_IN_MBUF is 0).
> > +		 */
> > +		uint64_t dynfield2;
> >  #endif
> > +	};
> > 
> >  	/* fields to support TX offloads */
> >  	union {
> > --
> > 1.8.3.1

^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-01-31 21:09     ` Tyler Retzlaff
@ 2024-01-31 22:39       ` Morten Brørup
  0 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-01-31 22:39 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Konstantin Ananyev, Maxime Coquelin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 31 January 2024 22.09
> 
> On Wed, Jan 31, 2024 at 10:18:37AM +0100, Morten Brørup wrote:
> > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > Sent: Wednesday, 31 January 2024 00.26
> > >

[...]

> > >  	struct rte_mempool *pool; /**< Pool from which mbuf was
> > > allocated. */
> > >
> > >  	/* second cache line - fields only used in slow path or on TX */
> > > -	RTE_MARKER cacheline1 __rte_cache_min_aligned;
> > > +	union {
> > > +		void *cacheline1;
> >
> > The __rte_cache_min_aligned cannot be removed. It provides cache line
> alignment for 32 bit platforms, where pointers in the first cache line
> only use 4 byte.
> 
> oh no i forgot i needed to figure this out before submission. now that
> it's here though i could use some help / suggestions.
> 
> the existing __rte_cache_min_aligned (and indeed standard alignas)
> facilities are not of great utility when applied to anonymous unions,
> further complicating things is that it also has to work with C++.
> 
> i'll take this away and work on it some more but does anyone here have
> a
> suggestion on how to align this anonymous union data member to the
> desired alignment *without* the union being padded to min cache line
> size and as a consequence causing the rte_mbuf struct to be 3 instead
> of 2 cache lines? (that's essentially the problem i need help solving).

I would suggest to simply remove __rte_cache_min_aligned (and the implicit padding that comes with it), and instead conditionally (#ifdef RTE_ARCH_32) add an explicit uintptr_t padding field after each pointer field in the rte_mbuf struct's first cache line.

But that would break the 32-bit ABI, so instead insert the explicit padding in the rte_mbuf struct at the end of its first cache line (where the implicit padding from __rte_cache_min_aligned is currently added), something like this:

	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */

+#ifdef RTE_ARCH_32
+	/* Padding to ensure correct alignment of cacheline1. */
+	uintptr_t pad_buf_addr;
+#if !RTE_IOVA_IN_MBUF
+	uintptr_t pad_next;
+#endif
+#endif /* RTE_ARCH_32 */

	/* second cache line - fields only used in slow path or on TX */

To be on the safe side, add a static_assert to verify that offsetof(struct rte_mbuf, cacheline1) == RTE_CACHE_LINE_MIN_SIZE. This should be true for all architectures, i.e. both 64 bit and 32 bit.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-01-31 20:45     ` Tyler Retzlaff
@ 2024-01-31 22:55       ` Morten Brørup
  0 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-01-31 22:55 UTC (permalink / raw)
  To: Tyler Retzlaff, Bruce Richardson
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 31 January 2024 21.46
> 
> On Wed, Jan 31, 2024 at 01:49:34PM +0000, Bruce Richardson wrote:
> > On Tue, Jan 30, 2024 at 03:26:13PM -0800, Tyler Retzlaff wrote:
> > > Replace the use of RTE_MARKER<x> with C11 anonymous unions to
> improve
> > > code portability between toolchains.
> > >
> > > Update use of rte_mbuf rearm_data field in net/ionic, net/sfc and
> > > net/virtio which were accessing field as a zero-length array.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > >  drivers/net/ionic/ionic_lif.c               |   8 +-
> > >  drivers/net/ionic/ionic_rxtx_sg.c           |   4 +-
> > >  drivers/net/ionic/ionic_rxtx_simple.c       |   2 +-
> > >  drivers/net/sfc/sfc_ef100_rx.c              |   8 +-
> > >  drivers/net/sfc/sfc_ef10_rx.c               |  12 +--
> > >  drivers/net/virtio/virtio_rxtx_packed_avx.h |   8 +-
> > >  lib/mbuf/rte_mbuf_core.h                    | 135 +++++++++++++++-
> ------------
> > >  7 files changed, 94 insertions(+), 83 deletions(-)
> > >
> > <snip>
> > @@ -464,9 +464,10 @@ enum {
> > >   * The generic rte_mbuf, containing a packet mbuf.
> > >   */
> > >  struct rte_mbuf {
> > > -	RTE_MARKER cacheline0;
> > > -
> > > -	void *buf_addr;           /**< Virtual address of segment buffer.
> */
> > > +	union {
> > > +	    void *cacheline0;
> > > +	    void *buf_addr;           /**< Virtual address of segment
> buffer. */
> > > +	};
> >
> > This marker is never used, so we should just look to drop it. I think
> it
> > was originally added to have an equivalent to the cacheline1 marker.
> 
> it's actually got a use in one location.
> 
> rte_mbuf.h:
> 
> static inline void
> rte_mbuf_prefetch_part1(struct rte_mbuf *m)
> {	
>         rte_prefetch0(&m->cacheline0);
> }	
> 
> > However, that would be an ABI change, so I'm ok to have this as-is
> for now.

Typo: API change, not ABI change.

> 
> do you mean api change? just asking to make sure i understand what i'm
> doing.
> 
> as i understand how this extension (marker) works removing the
> cacheline0 marker would not alter the layout of the struct. that is the
> sizeof the struct, sizeof any field nor the offset of any field changes
> would change by the marker removal.

Correctly understood, Tyler.

The struct layout is unmodified, so it's not an ABI change.
However, it's an API change, because applications cannot access the field anymore.

Although DPDK itself doesn't use the field, other applications might use rte_prefetch0(&m->cacheline0) instead of rte_mbuf_prefetch_part1(m).
After checking in-house, I can mention at least one company doing that. ;-)

We should keep the cacheline0 field and not break the API. Not for my sake, but for other applications. :-)


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v2] RFC: replace GCC marker extension with C11 anonymous unions
  2024-01-30 23:26 ` [PATCH] mbuf: " Tyler Retzlaff
  2024-01-31  9:18   ` Morten Brørup
  2024-01-31 13:49   ` Bruce Richardson
@ 2024-02-13  6:45   ` Tyler Retzlaff
  2024-02-13  6:45     ` [PATCH v2] mbuf: " Tyler Retzlaff
                       ` (2 more replies)
  2024-02-13 23:33   ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Tyler Retzlaff
  3 siblings, 3 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-13  6:45 UTC (permalink / raw)
  To: dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin, mb, Tyler Retzlaff

The zero sized RTE_MARKER<n> typedefs are a GCC extension unsupported by
MSVC.  Replace the use of the RTE_MARKER typedefs with anonymous unions.

Note:

v1 of the series tried to maintain the API after some study it has been
discovered that some existing uses of the markers do not produce compilation
failure but evaluate to unintended values in the absence of adaptation.
For this reason the existing markers cannot be removed because it is too hard
to identify what needs to be changed by consumers. While the ABI has been
maintained the subtle API change is just too risky.

The question I'm asking now is how to gracefully deprecate the markers
while allowing consumption of the struct on Windows.

I propose the following:

* Introduce the unions as per-this series except instead of adding members
  that match the original RTE_MARKER field names provide *new* names.
* Retain (conditionally compiled away on Windows) the existing RTE_MARKER
  fields with their original names.
* Convert in-tree code to use the new names in the unions.

The old names & markers would be announced for deprecation and eventually
removed and when they are the conditional compilation would also go away.

Thoughts?

v2:
    * Introduce additional union/struct to agnostically pad cachline0 to
      RTE_CACHE_LINE_MIN_SIZE without conditional compilation.
    * Adapt ixgbe access of rearm_data field.
    * Move ol_flags field out of rearm_data union where it didn't belong.
    * Added a couple of static_asserts for offset of cacheline1 and
      sizeof struct rte_mbuf.

Tyler Retzlaff (1):
  mbuf: replace GCC marker extension with C11 anonymous unions

 drivers/net/ionic/ionic_lif.c               |   8 +-
 drivers/net/ionic/ionic_rxtx_sg.c           |   4 +-
 drivers/net/ionic/ionic_rxtx_simple.c       |   2 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c      |   8 +-
 drivers/net/sfc/sfc_ef100_rx.c              |   8 +-
 drivers/net/sfc/sfc_ef10_rx.c               |  12 +-
 drivers/net/virtio/virtio_rxtx_packed_avx.h |   8 +-
 lib/mbuf/rte_mbuf_core.h                    | 276 ++++++++++++++++------------
 8 files changed, 179 insertions(+), 147 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v2] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-02-13  6:45   ` [PATCH v2] RFC: " Tyler Retzlaff
@ 2024-02-13  6:45     ` Tyler Retzlaff
  2024-02-13 16:58       ` Morten Brørup
  2024-02-13  8:57     ` [PATCH v2] RFC: " Bruce Richardson
  2024-02-13 17:09     ` Morten Brørup
  2 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-13  6:45 UTC (permalink / raw)
  To: dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin, mb, Tyler Retzlaff

Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
code portability between toolchains.

Update use of rte_mbuf rearm_data field in net/ionic, net/sfc, net/ixgbe
and net/virtio which were accessing field as a zero-length array.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ionic/ionic_lif.c               |   8 +-
 drivers/net/ionic/ionic_rxtx_sg.c           |   4 +-
 drivers/net/ionic/ionic_rxtx_simple.c       |   2 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c      |   8 +-
 drivers/net/sfc/sfc_ef100_rx.c              |   8 +-
 drivers/net/sfc/sfc_ef10_rx.c               |  12 +-
 drivers/net/virtio/virtio_rxtx_packed_avx.h |   8 +-
 lib/mbuf/rte_mbuf_core.h                    | 276 ++++++++++++++++------------
 8 files changed, 179 insertions(+), 147 deletions(-)

diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index 25b490d..fd99f39 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -725,8 +725,8 @@
 
 	rte_compiler_barrier();
 
-	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data) != sizeof(uint64_t));
+	return rxm.rearm_data;
 }
 
 static uint64_t
@@ -743,8 +743,8 @@
 
 	rte_compiler_barrier();
 
-	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data) != sizeof(uint64_t));
+	return rxm.rearm_data;
 }
 
 int
diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c
index ab8e56e..a569dd1 100644
--- a/drivers/net/ionic/ionic_rxtx_sg.c
+++ b/drivers/net/ionic/ionic_rxtx_sg.c
@@ -285,7 +285,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	rxm->rearm_data = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc_len);
 	left = cq_desc_len - rxm->data_len;
@@ -298,7 +298,7 @@
 		info[i] = NULL;
 
 		/* Set the chained mbuf metadata */
-		rxm_seg->rearm_data[0] = rxq->rearm_seg_data;
+		rxm_seg->rearm_data = rxq->rearm_seg_data;
 		rxm_seg->data_len = RTE_MIN(rxq->seg_size, left);
 		left -= rxm_seg->data_len;
 
diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c
index 5f81856..1978610 100644
--- a/drivers/net/ionic/ionic_rxtx_simple.c
+++ b/drivers/net/ionic/ionic_rxtx_simple.c
@@ -256,7 +256,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	rxm->rearm_data = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = cq_desc_len;
 
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index f60808d..bc0525b 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -98,10 +98,10 @@
 desc_to_olflags_v_ipsec(__m128i descs[4], struct rte_mbuf **rx_pkts)
 {
 	__m128i sterr, rearm, tmp_e, tmp_p;
-	uint32_t *rearm0 = (uint32_t *)rx_pkts[0]->rearm_data + 2;
-	uint32_t *rearm1 = (uint32_t *)rx_pkts[1]->rearm_data + 2;
-	uint32_t *rearm2 = (uint32_t *)rx_pkts[2]->rearm_data + 2;
-	uint32_t *rearm3 = (uint32_t *)rx_pkts[3]->rearm_data + 2;
+	uint32_t *rearm0 = (uint32_t *)&rx_pkts[0]->rearm_data + 2;
+	uint32_t *rearm1 = (uint32_t *)&rx_pkts[1]->rearm_data + 2;
+	uint32_t *rearm2 = (uint32_t *)&rx_pkts[2]->rearm_data + 2;
+	uint32_t *rearm3 = (uint32_t *)&rx_pkts[3]->rearm_data + 2;
 	const __m128i ipsec_sterr_msk =
 			_mm_set1_epi32(IXGBE_RXDADV_IPSEC_STATUS_SECP |
 				       IXGBE_RXDADV_IPSEC_ERROR_AUTH_FAILED);
diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c
index 2677003..23918d5 100644
--- a/drivers/net/sfc/sfc_ef100_rx.c
+++ b/drivers/net/sfc/sfc_ef100_rx.c
@@ -553,9 +553,9 @@ struct sfc_ef100_rxq {
 		pkt = sfc_ef100_rx_next_mbuf(rxq);
 		__rte_mbuf_raw_sanity_check(pkt);
 
-		RTE_BUILD_BUG_ON(sizeof(pkt->rearm_data[0]) !=
+		RTE_BUILD_BUG_ON(sizeof(pkt->rearm_data) !=
 				 sizeof(rxq->rearm_data));
-		pkt->rearm_data[0] = rxq->rearm_data;
+		pkt->rearm_data = rxq->rearm_data;
 
 		/* data_off already moved past Rx prefix */
 		rx_prefix = (const efx_xword_t *)sfc_ef100_rx_pkt_prefix(pkt);
@@ -759,8 +759,8 @@ struct sfc_ef100_rxq {
 
 	/* rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
-	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(m.rearm_data) != sizeof(uint64_t));
+	return m.rearm_data;
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef100_rx_qcreate;
diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c
index 30a320d..60bc098 100644
--- a/drivers/net/sfc/sfc_ef10_rx.c
+++ b/drivers/net/sfc/sfc_ef10_rx.c
@@ -322,8 +322,8 @@ struct sfc_ef10_rxq {
 
 	m = rxd->mbuf;
 
-	RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) != sizeof(rxq->rearm_data));
-	m->rearm_data[0] = rxq->rearm_data;
+	RTE_BUILD_BUG_ON(sizeof(m->rearm_data) != sizeof(rxq->rearm_data));
+	m->rearm_data = rxq->rearm_data;
 
 	/* Classify packet based on Rx event */
 	/* Mask RSS hash offload flag if RSS is not enabled */
@@ -377,9 +377,9 @@ struct sfc_ef10_rxq {
 			rxq->completed = pending;
 		}
 
-		RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) !=
+		RTE_BUILD_BUG_ON(sizeof(m->rearm_data) !=
 				 sizeof(rxq->rearm_data));
-		m->rearm_data[0] = rxq->rearm_data;
+		m->rearm_data = rxq->rearm_data;
 
 		/* Event-dependent information is the same */
 		m->ol_flags = m0->ol_flags;
@@ -633,8 +633,8 @@ struct sfc_ef10_rxq {
 
 	/* rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
-	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(m.rearm_data) != sizeof(uint64_t));
+	return m.rearm_data;
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef10_rx_qcreate;
diff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.h b/drivers/net/virtio/virtio_rxtx_packed_avx.h
index 584ac72..a9ce53f 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_avx.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h
@@ -36,10 +36,10 @@
 	/* Load four mbufs rearm data */
 	RTE_BUILD_BUG_ON(REFCNT_BITS_OFFSET >= 64);
 	RTE_BUILD_BUG_ON(SEG_NUM_BITS_OFFSET >= 64);
-	__m256i mbufs = _mm256_set_epi64x(*tx_pkts[3]->rearm_data,
-					  *tx_pkts[2]->rearm_data,
-					  *tx_pkts[1]->rearm_data,
-					  *tx_pkts[0]->rearm_data);
+	__m256i mbufs = _mm256_set_epi64x(tx_pkts[3]->rearm_data,
+					  tx_pkts[2]->rearm_data,
+					  tx_pkts[1]->rearm_data,
+					  tx_pkts[0]->rearm_data);
 
 	/* refcnt=1 and nb_segs=1 */
 	__m256i mbuf_ref = _mm256_set1_epi64x(DEFAULT_REARM_DATA);
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 5688683..3867c19 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -464,152 +464,179 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct rte_mbuf {
-	RTE_MARKER cacheline0;
-
-	void *buf_addr;           /**< Virtual address of segment buffer. */
+	union {
+		struct {
+			union {
+				void *cacheline0;
+				void *buf_addr; /**< Virtual address of segment buffer. */
+			};
 #if RTE_IOVA_IN_MBUF
-	/**
-	 * Physical address of segment buffer.
-	 * This field is undefined if the build is configured to use only
-	 * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
-	 * Force alignment to 8-bytes, so as to ensure we have the exact
-	 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
-	 * working on vector drivers easier.
-	 */
-	rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
+			/**
+			 * Physical address of segment buffer.
+			 * This field is undefined if the build is configured to use only
+			 * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
+			 * Force alignment to 8-bytes, so as to ensure we have the exact
+			 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
+			 * working on vector drivers easier.
+			 */
+			rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
 #else
-	/**
-	 * Next segment of scattered packet.
-	 * This field is valid when physical address field is undefined.
-	 * Otherwise next pointer in the second cache line will be used.
-	 */
-	struct rte_mbuf *next;
+			/**
+			 * Next segment of scattered packet.
+			 * This field is valid when physical address field is undefined.
+			 * Otherwise next pointer in the second cache line will be used.
+			 */
+			struct rte_mbuf *next;
 #endif
 
-	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
-
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
-
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
-
-	uint64_t ol_flags;        /**< Offload features. */
+			/* next 8 bytes are initialised on RX descriptor rearm */
+			union {
+				uint64_t rearm_data;
+				struct {
+					uint16_t data_off;
+
+					/**
+					 * Reference counter. Its size should at least equal to
+					 * the size of port field (16 bits), to support zero-copy
+					 * broadcast.
+					 * It should only be accessed using the following
+					 * functions: rte_mbuf_refcnt_update(),
+					 * rte_mbuf_refcnt_read(), and rte_mbuf_refcnt_set(). The
+					 * functionality of these functions (atomic, or non-atomic)
+					 * is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
+					 */
+					RTE_ATOMIC(uint16_t) refcnt;
+
+					/**
+					 * Number of segments. Only valid for the first segment of
+					 * an mbuf chain.
+					 */
+					uint16_t nb_segs;
+
+					/** Input port (16 bits to support more than 256 virtual
+					 * ports). The event eth Tx adapter uses this field to
+					 * specify the output port.
+					 */
+					uint16_t port;
+				};
+			};
 
-	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
+			uint64_t ol_flags;        /**< Offload features. */
 
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
-	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
-		__extension__
-		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
+			/* remaining bytes are set on RX when pulling packet from descriptor */
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
+				void *rx_descriptor_fields1;
+
+				/*
+				 * The packet type, which is the combination of outer/inner L2, L3,
+				 * L4 and tunnel types. The packet_type is about data really
+				 * present in the mbuf. Example: if vlan stripping is enabled, a
+				 * received vlan packet would have RTE_PTYPE_L2_ETHER and not
+				 * RTE_PTYPE_L2_VLAN because the vlan is stripped from the data.
 				 */
-				__extension__
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					union {
+						/** < L2/L3/L4 and tunnel information. */
+						uint32_t packet_type;
+						__extension__
+						struct {
+							/**< (Outer) L2 type. */
+							uint8_t l2_type:4;
+							/**< (Outer) L3 type. */
+							uint8_t l3_type:4;
+							/**< (Outer) L4 type. */
+							uint8_t l4_type:4;
+							/**< Tunnel type. */
+							uint8_t tun_type:4;
+							union {
+								uint8_t inner_esp_next_proto;
+								/**< ESP next protocol type, valid
+								 * if RTE_PTYPE_TUNNEL_ESP tunnel
+								 * type is set on both Tx and Rx.
+								 */
+								__extension__
+								struct {
+									uint8_t inner_l2_type:4;
+									/**< Inner L2 type. */
+									uint8_t inner_l3_type:4;
+									/**< Inner L3 type. */
+								};
+							};
+							/**< Inner L4 type. */
+							uint8_t inner_l4_type:4;
+						};
+					};
+					/**< Total pkt len: sum of all segments. */
+					uint32_t pkt_len;
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
-		};
-	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-	uint16_t data_len;        /**< Amount of data in segment buffer. */
-	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
-	uint16_t vlan_tci;
+			uint16_t data_len;        /**< Amount of data in segment buffer. */
+			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
+			uint16_t vlan_tci;
 
-	union {
-		union {
-			uint32_t rss;     /**< RSS hash result if RSS enabled */
-			struct {
+			union {
 				union {
+					uint32_t rss;     /**< RSS hash result if RSS enabled */
 					struct {
-						uint16_t hash;
-						uint16_t id;
-					};
-					uint32_t lo;
-					/**< Second 4 flexible bytes */
-				};
-				uint32_t hi;
-				/**< First 4 flexible bytes or FD ID, dependent
-				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
-				 */
-			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched sched;
-			/**< Hierarchical scheduler : 8 bytes */
-			struct {
-				uint32_t reserved1;
-				uint16_t reserved2;
-				uint16_t txq;
-				/**< The event eth Tx adapter uses this field
-				 * to store Tx queue id.
-				 * @see rte_event_eth_tx_adapter_txq_set()
-				 */
-			} txadapter; /**< Eventdev ethdev Tx adapter */
-			uint32_t usr;
-			/**< User defined tags. See rte_distributor_process() */
-		} hash;                   /**< hash information */
-	};
+						union {
+							struct {
+								uint16_t hash;
+								uint16_t id;
+							};
+							uint32_t lo;
+							/**< Second 4 flexible bytes */
+						};
+						uint32_t hi;
+						/**< First 4 flexible bytes or FD ID, dependent
+						 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
+						 */
+					} fdir;	/**< Filter identifier if FDIR enabled */
+					struct rte_mbuf_sched sched;
+					/**< Hierarchical scheduler : 8 bytes */
+					struct {
+						uint32_t reserved1;
+						uint16_t reserved2;
+						uint16_t txq;
+						/**< The event eth Tx adapter uses this field
+						 * to store Tx queue id.
+						 * @see rte_event_eth_tx_adapter_txq_set()
+						 */
+					} txadapter; /**< Eventdev ethdev Tx adapter */
+					uint32_t usr;
+					/**< User defined tags. See rte_distributor_process() */
+				} hash;                   /**< hash information */
+			};
 
-	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
-	uint16_t vlan_tci_outer;
+			/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
+			uint16_t vlan_tci_outer;
 
-	uint16_t buf_len;         /**< Length of segment buffer. */
+			uint16_t buf_len;         /**< Length of segment buffer. */
 
-	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
+			struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
+
+		};
+		uint8_t pad_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
+	}; /* cacheline0 */
 
 	/* second cache line - fields only used in slow path or on TX */
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
+	union {
+		void *cacheline1;
 
 #if RTE_IOVA_IN_MBUF
-	/**
-	 * Next segment of scattered packet. Must be NULL in the last
-	 * segment or in case of non-segmented packet.
-	 */
-	struct rte_mbuf *next;
+		/**
+		 * Next segment of scattered packet. Must be NULL in the last
+		 * segment or in case of non-segmented packet.
+		 */
+		struct rte_mbuf *next;
 #else
-	/**
-	 * Reserved for dynamic fields
-	 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
-	 */
-	uint64_t dynfield2;
+		/**
+		 * Reserved for dynamic fields
+		 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
+		 */
+		uint64_t dynfield2;
 #endif
+	};
 
 	/* fields to support TX offloads */
 	union {
@@ -664,6 +691,11 @@ struct rte_mbuf {
 	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
 } __rte_cache_aligned;
 
+static_assert(offsetof(struct rte_mbuf, cacheline1) == RTE_CACHE_LINE_MIN_SIZE,
+	"offsetof cacheline1");
+static_assert(sizeof(struct rte_mbuf) == RTE_CACHE_LINE_MIN_SIZE * 2,
+	"sizeof struct rte_mbuf");
+
 /**
  * Function typedef of callback to free externally attached buffer.
  */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v2] RFC: replace GCC marker extension with C11 anonymous unions
  2024-02-13  6:45   ` [PATCH v2] RFC: " Tyler Retzlaff
  2024-02-13  6:45     ` [PATCH v2] mbuf: " Tyler Retzlaff
@ 2024-02-13  8:57     ` Bruce Richardson
  2024-02-13 17:09     ` Morten Brørup
  2 siblings, 0 replies; 171+ messages in thread
From: Bruce Richardson @ 2024-02-13  8:57 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin, mb

On Mon, Feb 12, 2024 at 10:45:40PM -0800, Tyler Retzlaff wrote:
> The zero sized RTE_MARKER<n> typedefs are a GCC extension unsupported by
> MSVC.  Replace the use of the RTE_MARKER typedefs with anonymous unions.
> 
> Note:
> 
> v1 of the series tried to maintain the API after some study it has been
> discovered that some existing uses of the markers do not produce compilation
> failure but evaluate to unintended values in the absence of adaptation.
> For this reason the existing markers cannot be removed because it is too hard
> to identify what needs to be changed by consumers. While the ABI has been
> maintained the subtle API change is just too risky.
> 
> The question I'm asking now is how to gracefully deprecate the markers
> while allowing consumption of the struct on Windows.
> 
> I propose the following:
> 
> * Introduce the unions as per-this series except instead of adding members
>   that match the original RTE_MARKER field names provide *new* names.
> * Retain (conditionally compiled away on Windows) the existing RTE_MARKER
>   fields with their original names.
> * Convert in-tree code to use the new names in the unions.
> 
> The old names & markers would be announced for deprecation and eventually
> removed and when they are the conditional compilation would also go away.
> 
> Thoughts?
> 
This seems a good approach. +1 from me for the idea.

/Bruce

^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v2] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-02-13  6:45     ` [PATCH v2] mbuf: " Tyler Retzlaff
@ 2024-02-13 16:58       ` Morten Brørup
  2024-02-13 18:48         ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-02-13 16:58 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Tuesday, 13 February 2024 07.46
> 
> Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
> code portability between toolchains.

How about combining the cacheline 0 marker and padding, like this:

 struct rte_mbuf {
-	RTE_MARKER cacheline0;
+	union {
+		char cacheline0[RTE_CACHE_LINE_MIN_SIZE];
 
+		struct {
-	void *buf_addr;           /**< Virtual address of segment buffer. */
+			void *buf_addr; /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF


You could do the same with the cacheline1 marker:

	/* second cache line - fields only used in slow path or on TX */
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
+	union {
+		char cacheline1[RTE_CACHE_LINE_MIN_SIZE];
 
+		struct {
 #if RTE_IOVA_IN_MBUF
-	/**
-	 * Next segment of scattered packet. Must be NULL in the last
-	 * segment or in case of non-segmented packet.
-	 */
-	struct rte_mbuf *next;
+			/**
+			 * Next segment of scattered packet. Must be NULL in the last
+			 * segment or in case of non-segmented packet.
+			 */
+			struct rte_mbuf *next;
 #else


It also avoids the weird union between cacheline0 and buf_addr at the beginning of the structure, and between cacheline1 and next/dynfield2 at the beginning of the second cache line.

And then you can omit the pad_cacheline0 array at the end of the first part of the structure.


BTW: char is a weaker type than uint8_t - i.e. it is easier to cast to another type.
It might be a personal preference, but I would use char instead of uint8_t for the padding array.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v2] RFC: replace GCC marker extension with C11 anonymous unions
  2024-02-13  6:45   ` [PATCH v2] RFC: " Tyler Retzlaff
  2024-02-13  6:45     ` [PATCH v2] mbuf: " Tyler Retzlaff
  2024-02-13  8:57     ` [PATCH v2] RFC: " Bruce Richardson
@ 2024-02-13 17:09     ` Morten Brørup
  2 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-02-13 17:09 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Tuesday, 13 February 2024 07.46
> 
> The zero sized RTE_MARKER<n> typedefs are a GCC extension unsupported
> by
> MSVC.  Replace the use of the RTE_MARKER typedefs with anonymous
> unions.
> 
> Note:
> 
> v1 of the series tried to maintain the API after some study it has been
> discovered that some existing uses of the markers do not produce
> compilation
> failure but evaluate to unintended values in the absence of adaptation.
> For this reason the existing markers cannot be removed because it is
> too hard
> to identify what needs to be changed by consumers. While the ABI has
> been
> maintained the subtle API change is just too risky.
> 
> The question I'm asking now is how to gracefully deprecate the markers
> while allowing consumption of the struct on Windows.
> 
> I propose the following:
> 
> * Introduce the unions as per-this series except instead of adding
> members
>   that match the original RTE_MARKER field names provide *new* names.
> * Retain (conditionally compiled away on Windows) the existing
> RTE_MARKER
>   fields with their original names.
> * Convert in-tree code to use the new names in the unions.
> 
> The old names & markers would be announced for deprecation and
> eventually
> removed and when they are the conditional compilation would also go
> away.
> 
> Thoughts?

Seems like the right thing to do!

The modified type of rearm_data might not be noticed by out-of-tree PMD developers, so using a new name for the new type reduces the risk.

If some of the markers maintain their type or get a compatible type (from an API perspective), they can keep their names.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v2] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-02-13 16:58       ` Morten Brørup
@ 2024-02-13 18:48         ` Tyler Retzlaff
  2024-02-13 19:27           ` Morten Brørup
  0 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-13 18:48 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Konstantin Ananyev, Maxime Coquelin

On Tue, Feb 13, 2024 at 05:58:21PM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Tuesday, 13 February 2024 07.46
> > 
> > Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
> > code portability between toolchains.
> 
> How about combining the cacheline 0 marker and padding, like this:

this seems like a good suggestion i will evaluate it. at least it gets
rid of all the extra nesting if there are no unforseen problems.

> 
>  struct rte_mbuf {
> -	RTE_MARKER cacheline0;
> +	union {
> +		char cacheline0[RTE_CACHE_LINE_MIN_SIZE];
>  
> +		struct {
> -	void *buf_addr;           /**< Virtual address of segment buffer. */
> +			void *buf_addr; /**< Virtual address of segment buffer. */
>  #if RTE_IOVA_IN_MBUF
> 
> 
> You could do the same with the cacheline1 marker:

yeah, i wondered if i should. i'll do it since it does seem more
consistent to just pad out both cachelines explicitly instead of just
doing all but the last.

we probably don't need to align struct rte_mbuf type if we do since it
will cause it to be naturally aligned to RTE_CACHE_LINE_MIN_SIZE.

> 
> 	/* second cache line - fields only used in slow path or on TX */
> -	RTE_MARKER cacheline1 __rte_cache_min_aligned;
> +	union {
> +		char cacheline1[RTE_CACHE_LINE_MIN_SIZE];
>  
> +		struct {
>  #if RTE_IOVA_IN_MBUF
> -	/**
> -	 * Next segment of scattered packet. Must be NULL in the last
> -	 * segment or in case of non-segmented packet.
> -	 */
> -	struct rte_mbuf *next;
> +			/**
> +			 * Next segment of scattered packet. Must be NULL in the last
> +			 * segment or in case of non-segmented packet.
> +			 */
> +			struct rte_mbuf *next;
>  #else
> 
> 
> It also avoids the weird union between cacheline0 and buf_addr at the beginning of the structure, and between cacheline1 and next/dynfield2 at the beginning of the second cache line.
> 
> And then you can omit the pad_cacheline0 array at the end of the first part of the structure.
> 
> 
> BTW: char is a weaker type than uint8_t - i.e. it is easier to cast to another type.
> It might be a personal preference, but I would use char instead of uint8_t for the padding array.

noted, i'll make the change.

thanks!

^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v2] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-02-13 18:48         ` Tyler Retzlaff
@ 2024-02-13 19:27           ` Morten Brørup
  2024-02-13 20:00             ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-02-13 19:27 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Konstantin Ananyev, Maxime Coquelin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Tuesday, 13 February 2024 19.48
> 
> On Tue, Feb 13, 2024 at 05:58:21PM +0100, Morten Brørup wrote:
> > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > Sent: Tuesday, 13 February 2024 07.46
> > >
> > > Replace the use of RTE_MARKER<x> with C11 anonymous unions to
> improve
> > > code portability between toolchains.
> >
> > How about combining the cacheline 0 marker and padding, like this:
> 
> this seems like a good suggestion i will evaluate it. at least it gets
> rid of all the extra nesting if there are no unforseen problems.
> 
> >
> >  struct rte_mbuf {
> > -	RTE_MARKER cacheline0;
> > +	union {
> > +		char cacheline0[RTE_CACHE_LINE_MIN_SIZE];
> >
> > +		struct {
> > -	void *buf_addr;           /**< Virtual address of segment buffer.
> */
> > +			void *buf_addr; /**< Virtual address of segment
> buffer. */
> >  #if RTE_IOVA_IN_MBUF
> >
> >
> > You could do the same with the cacheline1 marker:
> 
> yeah, i wondered if i should. i'll do it since it does seem more
> consistent to just pad out both cachelines explicitly instead of just
> doing all but the last.
> 
> we probably don't need to align struct rte_mbuf type if we do since it
> will cause it to be naturally aligned to RTE_CACHE_LINE_MIN_SIZE.

We still need to align struct rte_mbuf to cache line size.
RTE_CACHE_LINE_MIN_SIZE is 64, like the cache line size on Intel arch,
but cache line size is 128 byte on POWER architecture and Apple M2.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v2] mbuf: replace GCC marker extension with C11 anonymous unions
  2024-02-13 19:27           ` Morten Brørup
@ 2024-02-13 20:00             ` Tyler Retzlaff
  0 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-13 20:00 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Konstantin Ananyev, Maxime Coquelin

On Tue, Feb 13, 2024 at 08:27:52PM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Tuesday, 13 February 2024 19.48
> > 
> > On Tue, Feb 13, 2024 at 05:58:21PM +0100, Morten Brørup wrote:
> > > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > > Sent: Tuesday, 13 February 2024 07.46
> > > >
> > > > Replace the use of RTE_MARKER<x> with C11 anonymous unions to
> > improve
> > > > code portability between toolchains.
> > >
> > > How about combining the cacheline 0 marker and padding, like this:
> > 
> > this seems like a good suggestion i will evaluate it. at least it gets
> > rid of all the extra nesting if there are no unforseen problems.
> > 
> > >
> > >  struct rte_mbuf {
> > > -	RTE_MARKER cacheline0;
> > > +	union {
> > > +		char cacheline0[RTE_CACHE_LINE_MIN_SIZE];
> > >
> > > +		struct {
> > > -	void *buf_addr;           /**< Virtual address of segment buffer.
> > */
> > > +			void *buf_addr; /**< Virtual address of segment
> > buffer. */
> > >  #if RTE_IOVA_IN_MBUF
> > >
> > >
> > > You could do the same with the cacheline1 marker:
> > 
> > yeah, i wondered if i should. i'll do it since it does seem more
> > consistent to just pad out both cachelines explicitly instead of just
> > doing all but the last.
> > 
> > we probably don't need to align struct rte_mbuf type if we do since it
> > will cause it to be naturally aligned to RTE_CACHE_LINE_MIN_SIZE.
> 
> We still need to align struct rte_mbuf to cache line size.
> RTE_CACHE_LINE_MIN_SIZE is 64, like the cache line size on Intel arch,
> but cache line size is 128 byte on POWER architecture and Apple M2.

RTE_CACHE_LINE_SIZE vs RTE_CACHE_LINE_MIN_SIZE forgot about that.

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf
  2024-01-30 23:26 ` [PATCH] mbuf: " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-13  6:45   ` [PATCH v2] RFC: " Tyler Retzlaff
@ 2024-02-13 23:33   ` Tyler Retzlaff
  2024-02-13 23:33     ` [PATCH v3] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
                       ` (2 more replies)
  3 siblings, 3 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-13 23:33 UTC (permalink / raw)
  To: dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin, mb, Tyler Retzlaff

Here is the latest iteration of the proposed change to allow struct rte_mbuf
to be consumed by MSVC.

* Introduce an internal __rte_marker macro conditionally expanded for MSVC
  vs existing users of the struct. At some point we can uncomment __rte_deprecated
  to assist migration away from the current marker fields for applications
  after appropriate announcement periods etc..

* Introduce anonymous unions to allow aliasing of the previous named
  offsets by a *new* name.  The intention would be to convert the dpdk tree
  to use the new names along with this change and enable __rte_deprecated
  for dpdk builds (not applications) to avoid accidental re-introduction.

* The anonymous unions are now also used to pad cacheline0 and cacheline1 instead
  of __rte_cache_min_aligned.

* Converted the type of the fields for the named markers to char[] instead of
  uint8_t[].

Tyler Retzlaff (1):
  mbuf: deprecate GCC marker in rte mbuf struct

 lib/eal/include/rte_common.h |   6 +
 lib/mbuf/rte_mbuf_core.h     | 365 +++++++++++++++++++++++--------------------
 2 files changed, 201 insertions(+), 170 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v3] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-13 23:33   ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Tyler Retzlaff
@ 2024-02-13 23:33     ` Tyler Retzlaff
  2024-02-14 10:46       ` Morten Brørup
  2024-02-14 10:49     ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Morten Brørup
  2024-02-26  1:18     ` Stephen Hemminger
  2 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-13 23:33 UTC (permalink / raw)
  To: dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin, mb, Tyler Retzlaff

Provide a macro that allows conditional expansion of RTE_MARKER fields
to empty to allow rte_mbuf to be used with MSVC. It is proposed that
we announce the fields to be __rte_deprecated (currently disabled).

Introduce C11 anonymous unions to permit aliasing of well-known
offsets by name into the rte_mbuf structure by a *new* name and to
provide padding for cache alignment.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_common.h |   6 +
 lib/mbuf/rte_mbuf_core.h     | 365 +++++++++++++++++++++++--------------------
 2 files changed, 201 insertions(+), 170 deletions(-)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index d7d6390..af73f67 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -582,6 +582,12 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
 /** Marker for 8B alignment in a structure. */
 __extension__ typedef uint64_t RTE_MARKER64[0];
 
+#define __rte_marker(type, name) type name /* __rte_deprecated */
+
+#else
+
+#define __rte_marker(type, name)
+
 #endif
 
 /*********** Macros for calculating min and max **********/
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 5688683..fd02353 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -16,7 +16,10 @@
  * New fields and flags should fit in the "dynamic space".
  */
 
+#include <assert.h>
+#include <stdalign.h>
 #include <stdint.h>
+#include <stddef.h>
 
 #include <rte_byteorder.h>
 #include <rte_stdatomic.h>
@@ -464,206 +467,228 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct rte_mbuf {
-	RTE_MARKER cacheline0;
-
-	void *buf_addr;           /**< Virtual address of segment buffer. */
+	__rte_marker(RTE_MARKER, cacheline0);
+	union {
+		char mbuf_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
+		struct {
+			void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
-	/**
-	 * Physical address of segment buffer.
-	 * This field is undefined if the build is configured to use only
-	 * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
-	 * Force alignment to 8-bytes, so as to ensure we have the exact
-	 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
-	 * working on vector drivers easier.
-	 */
-	rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
+			/**
+			 * Physical address of segment buffer.
+			 * This field is undefined if the build is configured to use only
+			 * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
+			 * Force alignment to 8-bytes, so as to ensure we have the exact
+			 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
+			 * working on vector drivers easier.
+			 */
+			rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
 #else
-	/**
-	 * Next segment of scattered packet.
-	 * This field is valid when physical address field is undefined.
-	 * Otherwise next pointer in the second cache line will be used.
-	 */
-	struct rte_mbuf *next;
+			/**
+			 * Next segment of scattered packet.
+			 * This field is valid when physical address field is undefined.
+			 * Otherwise next pointer in the second cache line will be used.
+			 */
+			struct rte_mbuf *next;
 #endif
 
-	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
-
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
-
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
-
-	uint64_t ol_flags;        /**< Offload features. */
+			/* next 8 bytes are initialised on RX descriptor rearm */
+			__rte_marker(RTE_MARKER64, rearm_data);
+			union {
+				char mbuf_rearm_data[8];
+				struct {
+					uint16_t data_off;
+
+					/**
+					 * Reference counter. Its size should at least equal to the size
+					 * of port field (16 bits), to support zero-copy broadcast.
+					 * It should only be accessed using the following functions:
+					 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
+					 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
+					 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
+					 */
+					RTE_ATOMIC(uint16_t) refcnt;
+
+					/**
+					 * Number of segments. Only valid for the first segment of an mbuf
+					 * chain.
+					 */
+					uint16_t nb_segs;
+
+					/** Input port (16 bits to support more than 256 virtual ports).
+					 * The event eth Tx adapter uses this field to specify the output port.
+					 */
+					uint16_t port;
+				};
+			};
 
-	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
+			uint64_t ol_flags;        /**< Offload features. */
 
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
-	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
-		__extension__
-		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
+			/* remaining bytes are set on RX when pulling packet from descriptor */
+			__rte_marker(RTE_MARKER, rx_descriptor_fields1);
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
-				 */
-				__extension__
+				char mbuf_rx_descriptor_fields1[sizeof(void *)];
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					/*
+					 * The packet type, which is the combination of outer/inner L2, L3, L4
+					 * and tunnel types. The packet_type is about data really present in the
+					 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
+					 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
+					 * vlan is stripped from the data.
+					 */
+					union {
+						uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
+						__extension__
+						struct {
+							uint8_t l2_type:4;   /**< (Outer) L2 type. */
+							uint8_t l3_type:4;   /**< (Outer) L3 type. */
+							uint8_t l4_type:4;   /**< (Outer) L4 type. */
+							uint8_t tun_type:4;  /**< Tunnel type. */
+							union {
+								uint8_t inner_esp_next_proto;
+								/**< ESP next protocol type, valid if
+								 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
+								 * on both Tx and Rx.
+								 */
+								__extension__
+								struct {
+									uint8_t inner_l2_type:4;
+									/**< Inner L2 type. */
+									uint8_t inner_l3_type:4;
+									/**< Inner L3 type. */
+								};
+							};
+							uint8_t inner_l4_type:4; /**< Inner L4 type. */
+						};
+					};
+					uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
-		};
-	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-	uint16_t data_len;        /**< Amount of data in segment buffer. */
-	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
-	uint16_t vlan_tci;
+			uint16_t data_len;        /**< Amount of data in segment buffer. */
+			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
+			uint16_t vlan_tci;
 
-	union {
-		union {
-			uint32_t rss;     /**< RSS hash result if RSS enabled */
-			struct {
+			union {
 				union {
+					uint32_t rss;     /**< RSS hash result if RSS enabled */
 					struct {
-						uint16_t hash;
-						uint16_t id;
-					};
-					uint32_t lo;
-					/**< Second 4 flexible bytes */
-				};
-				uint32_t hi;
-				/**< First 4 flexible bytes or FD ID, dependent
-				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
-				 */
-			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched sched;
-			/**< Hierarchical scheduler : 8 bytes */
-			struct {
-				uint32_t reserved1;
-				uint16_t reserved2;
-				uint16_t txq;
-				/**< The event eth Tx adapter uses this field
-				 * to store Tx queue id.
-				 * @see rte_event_eth_tx_adapter_txq_set()
-				 */
-			} txadapter; /**< Eventdev ethdev Tx adapter */
-			uint32_t usr;
-			/**< User defined tags. See rte_distributor_process() */
-		} hash;                   /**< hash information */
-	};
+						union {
+							struct {
+								uint16_t hash;
+								uint16_t id;
+							};
+							uint32_t lo;
+							/**< Second 4 flexible bytes */
+						};
+						uint32_t hi;
+						/**< First 4 flexible bytes or FD ID, dependent
+						 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
+						 */
+					} fdir;	/**< Filter identifier if FDIR enabled */
+					struct rte_mbuf_sched sched;
+					/**< Hierarchical scheduler : 8 bytes */
+					struct {
+						uint32_t reserved1;
+						uint16_t reserved2;
+						uint16_t txq;
+						/**< The event eth Tx adapter uses this field
+						 * to store Tx queue id.
+						 * @see rte_event_eth_tx_adapter_txq_set()
+						 */
+					} txadapter; /**< Eventdev ethdev Tx adapter */
+					uint32_t usr;
+					/**< User defined tags. See rte_distributor_process() */
+				} hash;                   /**< hash information */
+			};
 
-	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
-	uint16_t vlan_tci_outer;
+			/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
+			uint16_t vlan_tci_outer;
 
-	uint16_t buf_len;         /**< Length of segment buffer. */
+			uint16_t buf_len;         /**< Length of segment buffer. */
 
-	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
+			struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
+		};
+	};
 
 	/* second cache line - fields only used in slow path or on TX */
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
-
-#if RTE_IOVA_IN_MBUF
-	/**
-	 * Next segment of scattered packet. Must be NULL in the last
-	 * segment or in case of non-segmented packet.
-	 */
-	struct rte_mbuf *next;
-#else
-	/**
-	 * Reserved for dynamic fields
-	 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
-	 */
-	uint64_t dynfield2;
-#endif
-
-	/* fields to support TX offloads */
+	__rte_marker(RTE_MARKER, cacheline1);
 	union {
-		uint64_t tx_offload;       /**< combined for easy fetch */
-		__extension__
+		char mbuf_cacheline1[RTE_CACHE_LINE_MIN_SIZE];
 		struct {
-			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
-			/**< L2 (MAC) Header Length for non-tunneling pkt.
-			 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
+#if RTE_IOVA_IN_MBUF
+			/**
+			 * Next segment of scattered packet. Must be NULL in the last
+			 * segment or in case of non-segmented packet.
 			 */
-			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
-			/**< L3 (IP) Header Length. */
-			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
-			/**< L4 (TCP/UDP) Header Length. */
-			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
-			/**< TCP TSO segment size */
-
-			/*
-			 * Fields for Tx offloading of tunnels.
-			 * These are undefined for packets which don't request
-			 * any tunnel offloads (outer IP or UDP checksum,
-			 * tunnel TSO).
-			 *
-			 * PMDs should not use these fields unconditionally
-			 * when calculating offsets.
-			 *
-			 * Applications are expected to set appropriate tunnel
-			 * offload flags when they fill in these fields.
+			struct rte_mbuf *next;
+#else
+			/**
+			 * Reserved for dynamic fields
+			 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
 			 */
-			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
-			/**< Outer L3 (IP) Hdr Length. */
-			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
-			/**< Outer L2 (MAC) Hdr Length. */
+			uint64_t dynfield2;
+#endif
 
-			/* uint64_t unused:RTE_MBUF_TXOFLD_UNUSED_BITS; */
-		};
-	};
+			/* fields to support TX offloads */
+			union {
+				uint64_t tx_offload;       /**< combined for easy fetch */
+				__extension__
+				struct {
+					uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
+					/**< L2 (MAC) Header Length for non-tunneling pkt.
+					 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
+					 */
+					uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
+					/**< L3 (IP) Header Length. */
+					uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
+					/**< L4 (TCP/UDP) Header Length. */
+					uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
+					/**< TCP TSO segment size */
+
+					/*
+					 * Fields for Tx offloading of tunnels.
+					 * These are undefined for packets which don't request
+					 * any tunnel offloads (outer IP or UDP checksum,
+					 * tunnel TSO).
+					 *
+					 * PMDs should not use these fields unconditionally
+					 * when calculating offsets.
+					 *
+					 * Applications are expected to set appropriate tunnel
+					 * offload flags when they fill in these fields.
+					 */
+					uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
+					/**< Outer L3 (IP) Hdr Length. */
+					uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
+					/**< Outer L2 (MAC) Hdr Length. */
+
+					/* uint64_t unused:RTE_MBUF_TXOFLD_UNUSED_BITS; */
+				};
+			};
 
-	/** Shared data for external buffer attached to mbuf. See
-	 * rte_pktmbuf_attach_extbuf().
-	 */
-	struct rte_mbuf_ext_shared_info *shinfo;
+			/** Shared data for external buffer attached to mbuf. See
+			 * rte_pktmbuf_attach_extbuf().
+			 */
+			struct rte_mbuf_ext_shared_info *shinfo;
 
-	/** Size of the application private data. In case of an indirect
-	 * mbuf, it stores the direct mbuf private data size.
-	 */
-	uint16_t priv_size;
+			/** Size of the application private data. In case of an indirect
+			 * mbuf, it stores the direct mbuf private data size.
+			 */
+			uint16_t priv_size;
 
-	/** Timesync flags for use with IEEE1588. */
-	uint16_t timesync;
+			/** Timesync flags for use with IEEE1588. */
+			uint16_t timesync;
 
-	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
+			uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
+		};
+	};
 } __rte_cache_aligned;
 
+static_assert(alignof(struct rte_mbuf) == RTE_CACHE_LINE_SIZE, "alignof rte_mbuf");
+static_assert(offsetof(struct rte_mbuf, cacheline0) == 0, "cacheline0");
+static_assert(offsetof(struct rte_mbuf, cacheline1) == RTE_CACHE_LINE_MIN_SIZE, "cacheline1");
+static_assert(sizeof(struct rte_mbuf) == RTE_CACHE_LINE_MIN_SIZE * 2, "sizeof rte_mbuf");
+
 /**
  * Function typedef of callback to free externally attached buffer.
  */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v3] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-13 23:33     ` [PATCH v3] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
@ 2024-02-14 10:46       ` Morten Brørup
  2024-02-14 20:16         ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-02-14 10:46 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 14 February 2024 00.33
> 
> Provide a macro that allows conditional expansion of RTE_MARKER fields
> to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> we announce the fields to be __rte_deprecated (currently disabled).
> 
> Introduce C11 anonymous unions to permit aliasing of well-known
> offsets by name into the rte_mbuf structure by a *new* name and to
> provide padding for cache alignment.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

I think you are nearly there now. Beautiful solution. :-)

Only one comment inline below.

> -	/* remaining bytes are set on RX when pulling packet from
> descriptor */
> -	RTE_MARKER rx_descriptor_fields1;
> +			uint64_t ol_flags;        /**< Offload features. */
> 
> -	/*
> -	 * The packet type, which is the combination of outer/inner L2,
> L3, L4
> -	 * and tunnel types. The packet_type is about data really present
> in the
> -	 * mbuf. Example: if vlan stripping is enabled, a received vlan
> packet
> -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN
> because the
> -	 * vlan is stripped from the data.
> -	 */
> -	union {
> -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information.
> */
> -		__extension__
> -		struct {
> -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> -			uint8_t tun_type:4;  /**< Tunnel type. */
> +			/* remaining bytes are set on RX when pulling packet
> from descriptor */
> +			__rte_marker(RTE_MARKER, rx_descriptor_fields1);
>  			union {
> -				uint8_t inner_esp_next_proto;
> -				/**< ESP next protocol type, valid if
> -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> -				 * on both Tx and Rx.
> -				 */
> -				__extension__
> +				char mbuf_rx_descriptor_fields1[sizeof(void
> *)];

The size of the mbuf_rx_descriptor_fields1 array - and the union it belongs to - may not be accurate.

The existing rx_descriptor_fields1 effectively has no type/size, and the associated comment "/* remaining bytes are set on RX" doesn't help; it omits how many bytes it refers to. I'll call it "an already existing bug" for the sake of discussion.
I think the struct should go all the way to the pool pointer, to reflect which "remaining bytes" are set on RX.
You might consider taking the opportunity to fix this existing "bug", i.e. update the comment and move more fields into the struct unionized with the mbuf_rx_descriptor_fields1 array. (This suggestion is in the category NICE TO HAVE, and certainly not a requirement!)

Regardless if you fix this existing "bug" or not, the size of the mbuf_rx_descriptor_fields1 array should match the size of the struct it is unionized with, rather than using sizeof(void*) (which is either 4 or 8 bytes, depending on CPU architecture).
Instinctively, I think that it is a bad idea to carry over the "sizeless" aspect of the rx_descriptor_fields1 marker into the mbuf_rx_descriptor_fields1 array. However, you have been working more in depth with this patch series, so I'm open for arguments for the way you did it!

>  				struct {
> -					uint8_t inner_l2_type:4;
> -					/**< Inner L2 type. */
> -					uint8_t inner_l3_type:4;
> -					/**< Inner L3 type. */
> +					/*
> +					 * The packet type, which is the
> combination of outer/inner L2, L3, L4
> +					 * and tunnel types. The packet_type is
> about data really present in the
> +					 * mbuf. Example: if vlan stripping is
> enabled, a received vlan packet
> +					 * would have RTE_PTYPE_L2_ETHER and not
> RTE_PTYPE_L2_VLAN because the
> +					 * vlan is stripped from the data.
> +					 */
> +					union {
> +						uint32_t packet_type; /**< L2/L3/L4
> and tunnel information. */
> +						__extension__
> +						struct {
> +							uint8_t l2_type:4;   /**<
> (Outer) L2 type. */
> +							uint8_t l3_type:4;   /**<
> (Outer) L3 type. */
> +							uint8_t l4_type:4;   /**<
> (Outer) L4 type. */
> +							uint8_t tun_type:4;  /**<
> Tunnel type. */
> +							union {
> +								uint8_t
> inner_esp_next_proto;
> +								/**< ESP next protocol
> type, valid if
> +								 * RTE_PTYPE_TUNNEL_ESP
> tunnel type is set
> +								 * on both Tx and Rx.
> +								 */
> +								__extension__
> +								struct {
> +									uint8_t
> inner_l2_type:4;
> +									/**< Inner L2
> type. */
> +									uint8_t
> inner_l3_type:4;
> +									/**< Inner L3
> type. */
> +								};
> +							};
> +							uint8_t inner_l4_type:4; /**<
> Inner L4 type. */
> +						};
> +					};
> +					uint32_t pkt_len;         /**< Total pkt
> len: sum of all segments. */
>  				};
>  			};
> -			uint8_t inner_l4_type:4; /**< Inner L4 type. */
> -		};
> -	};
> 
> -	uint32_t pkt_len;         /**< Total pkt len: sum of all
> segments. */
> -	uint16_t data_len;        /**< Amount of data in segment buffer.
> */
> -	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
> -	uint16_t vlan_tci;
> +			uint16_t data_len;        /**< Amount of data in
> segment buffer. */
> +			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN
> is set. */
> +			uint16_t vlan_tci;
> 
> -	union {
> -		union {
> -			uint32_t rss;     /**< RSS hash result if RSS enabled
> */
> -			struct {
> +			union {
>  				union {
> +					uint32_t rss;     /**< RSS hash result if
> RSS enabled */
>  					struct {
> -						uint16_t hash;
> -						uint16_t id;
> -					};
> -					uint32_t lo;
> -					/**< Second 4 flexible bytes */
> -				};
> -				uint32_t hi;
> -				/**< First 4 flexible bytes or FD ID, dependent
> -				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
> -				 */
> -			} fdir;	/**< Filter identifier if FDIR enabled */
> -			struct rte_mbuf_sched sched;
> -			/**< Hierarchical scheduler : 8 bytes */
> -			struct {
> -				uint32_t reserved1;
> -				uint16_t reserved2;
> -				uint16_t txq;
> -				/**< The event eth Tx adapter uses this field
> -				 * to store Tx queue id.
> -				 * @see rte_event_eth_tx_adapter_txq_set()
> -				 */
> -			} txadapter; /**< Eventdev ethdev Tx adapter */
> -			uint32_t usr;
> -			/**< User defined tags. See rte_distributor_process()
> */
> -		} hash;                   /**< hash information */
> -	};
> +						union {
> +							struct {
> +								uint16_t hash;
> +								uint16_t id;
> +							};
> +							uint32_t lo;
> +							/**< Second 4 flexible bytes
> */
> +						};
> +						uint32_t hi;
> +						/**< First 4 flexible bytes or FD
> ID, dependent
> +						 * on RTE_MBUF_F_RX_FDIR_* flag in
> ol_flags.
> +						 */
> +					} fdir;	/**< Filter identifier if
> FDIR enabled */
> +					struct rte_mbuf_sched sched;
> +					/**< Hierarchical scheduler : 8 bytes */
> +					struct {
> +						uint32_t reserved1;
> +						uint16_t reserved2;
> +						uint16_t txq;
> +						/**< The event eth Tx adapter uses
> this field
> +						 * to store Tx queue id.
> +						 * @see
> rte_event_eth_tx_adapter_txq_set()
> +						 */
> +					} txadapter; /**< Eventdev ethdev Tx
> adapter */
> +					uint32_t usr;
> +					/**< User defined tags. See
> rte_distributor_process() */
> +				} hash;                   /**< hash information
> */
> +			};
> 
> -	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is
> set. */
> -	uint16_t vlan_tci_outer;
> +			/** Outer VLAN TCI (CPU order), valid if
> RTE_MBUF_F_RX_QINQ is set. */
> +			uint16_t vlan_tci_outer;
> 
> -	uint16_t buf_len;         /**< Length of segment buffer. */
> +			uint16_t buf_len;         /**< Length of segment
> buffer. */
> 
> -	struct rte_mempool *pool; /**< Pool from which mbuf was
> allocated. */
> +			struct rte_mempool *pool; /**< Pool from which mbuf
> was allocated. */
> +		};
> +	};
> 
>  	/* second cache line - fields only used in slow path or on TX */


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf
  2024-02-13 23:33   ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Tyler Retzlaff
  2024-02-13 23:33     ` [PATCH v3] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
@ 2024-02-14 10:49     ` Morten Brørup
  2024-02-26  1:18     ` Stephen Hemminger
  2 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-02-14 10:49 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Andrew Boyer, Andrew Rybchenko, Bruce Richardson, Chenbo Xia,
	Konstantin Ananyev, Maxime Coquelin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 14 February 2024 00.33
> 
> Here is the latest iteration of the proposed change to allow struct
> rte_mbuf
> to be consumed by MSVC.
> 
> * Introduce an internal __rte_marker macro conditionally expanded for
> MSVC
>   vs existing users of the struct. At some point we can uncomment
> __rte_deprecated
>   to assist migration away from the current marker fields for
> applications
>   after appropriate announcement periods etc..
> 
> * Introduce anonymous unions to allow aliasing of the previous named
>   offsets by a *new* name.  The intention would be to convert the dpdk
> tree
>   to use the new names along with this change and enable
> __rte_deprecated
>   for dpdk builds (not applications) to avoid accidental re-
> introduction.
> 
> * The anonymous unions are now also used to pad cacheline0 and
> cacheline1 instead
>   of __rte_cache_min_aligned.

ACK. This design also seems reusable for similar structures.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v3] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-14 10:46       ` Morten Brørup
@ 2024-02-14 20:16         ` Tyler Retzlaff
  0 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-14 20:16 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Konstantin Ananyev, Maxime Coquelin

On Wed, Feb 14, 2024 at 11:46:01AM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Wednesday, 14 February 2024 00.33
> > 
> > Provide a macro that allows conditional expansion of RTE_MARKER fields
> > to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> > we announce the fields to be __rte_deprecated (currently disabled).
> > 
> > Introduce C11 anonymous unions to permit aliasing of well-known
> > offsets by name into the rte_mbuf structure by a *new* name and to
> > provide padding for cache alignment.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> 
> I think you are nearly there now. Beautiful solution. :-)
> 
> Only one comment inline below.
> 
> > -	/* remaining bytes are set on RX when pulling packet from
> > descriptor */
> > -	RTE_MARKER rx_descriptor_fields1;
> > +			uint64_t ol_flags;        /**< Offload features. */
> > 
> > -	/*
> > -	 * The packet type, which is the combination of outer/inner L2,
> > L3, L4
> > -	 * and tunnel types. The packet_type is about data really present
> > in the
> > -	 * mbuf. Example: if vlan stripping is enabled, a received vlan
> > packet
> > -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN
> > because the
> > -	 * vlan is stripped from the data.
> > -	 */
> > -	union {
> > -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information.
> > */
> > -		__extension__
> > -		struct {
> > -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> > -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> > -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> > -			uint8_t tun_type:4;  /**< Tunnel type. */
> > +			/* remaining bytes are set on RX when pulling packet
> > from descriptor */
> > +			__rte_marker(RTE_MARKER, rx_descriptor_fields1);
> >  			union {
> > -				uint8_t inner_esp_next_proto;
> > -				/**< ESP next protocol type, valid if
> > -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> > -				 * on both Tx and Rx.
> > -				 */
> > -				__extension__
> > +				char mbuf_rx_descriptor_fields1[sizeof(void
> > *)];
> 
> The size of the mbuf_rx_descriptor_fields1 array - and the union it belongs to - may not be accurate.

yeah, i just cloned the type out of the marker.  but you are right it's
garbage. on 32-bit platforms access via that union member probably falls
into undefined behavior territory.

i'll replace it with [8] since that's the size of the struct member, at
least then it's as big as the other union fields.

i think my greatest concern at this point is making a mistake in adapting
the in-tree consumers to the new field that assumed the named thing was
void *[]. sometimes the address is taken, sometimes not, might be okay
since we're consistently using arrays now but it will likely need some
casts where previously didn't. definitely appreciate careful review.

thanks

> 
> The existing rx_descriptor_fields1 effectively has no type/size, and the associated comment "/* remaining bytes are set on RX" doesn't help; it omits how many bytes it refers to. I'll call it "an already existing bug" for the sake of discussion.
> I think the struct should go all the way to the pool pointer, to reflect which "remaining bytes" are set on RX.
> You might consider taking the opportunity to fix this existing "bug", i.e. update the comment and move more fields into the struct unionized with the mbuf_rx_descriptor_fields1 array. (This suggestion is in the category NICE TO HAVE, and certainly not a requirement!)
> 
> Regardless if you fix this existing "bug" or not, the size of the mbuf_rx_descriptor_fields1 array should match the size of the struct it is unionized with, rather than using sizeof(void*) (which is either 4 or 8 bytes, depending on CPU architecture).
> Instinctively, I think that it is a bad idea to carry over the "sizeless" aspect of the rx_descriptor_fields1 marker into the mbuf_rx_descriptor_fields1 array. However, you have been working more in depth with this patch series, so I'm open for arguments for the way you did it!
> 
> >  				struct {
> > -					uint8_t inner_l2_type:4;
> > -					/**< Inner L2 type. */
> > -					uint8_t inner_l3_type:4;
> > -					/**< Inner L3 type. */
> > +					/*
> > +					 * The packet type, which is the
> > combination of outer/inner L2, L3, L4
> > +					 * and tunnel types. The packet_type is
> > about data really present in the
> > +					 * mbuf. Example: if vlan stripping is
> > enabled, a received vlan packet
> > +					 * would have RTE_PTYPE_L2_ETHER and not
> > RTE_PTYPE_L2_VLAN because the
> > +					 * vlan is stripped from the data.
> > +					 */
> > +					union {
> > +						uint32_t packet_type; /**< L2/L3/L4
> > and tunnel information. */
> > +						__extension__
> > +						struct {
> > +							uint8_t l2_type:4;   /**<
> > (Outer) L2 type. */
> > +							uint8_t l3_type:4;   /**<
> > (Outer) L3 type. */
> > +							uint8_t l4_type:4;   /**<
> > (Outer) L4 type. */
> > +							uint8_t tun_type:4;  /**<
> > Tunnel type. */
> > +							union {
> > +								uint8_t
> > inner_esp_next_proto;
> > +								/**< ESP next protocol
> > type, valid if
> > +								 * RTE_PTYPE_TUNNEL_ESP
> > tunnel type is set
> > +								 * on both Tx and Rx.
> > +								 */
> > +								__extension__
> > +								struct {
> > +									uint8_t
> > inner_l2_type:4;
> > +									/**< Inner L2
> > type. */
> > +									uint8_t
> > inner_l3_type:4;
> > +									/**< Inner L3
> > type. */
> > +								};
> > +							};
> > +							uint8_t inner_l4_type:4; /**<
> > Inner L4 type. */
> > +						};
> > +					};
> > +					uint32_t pkt_len;         /**< Total pkt
> > len: sum of all segments. */
> >  				};
> >  			};
> > -			uint8_t inner_l4_type:4; /**< Inner L4 type. */
> > -		};
> > -	};
> > 
> > -	uint32_t pkt_len;         /**< Total pkt len: sum of all
> > segments. */
> > -	uint16_t data_len;        /**< Amount of data in segment buffer.
> > */
> > -	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
> > -	uint16_t vlan_tci;
> > +			uint16_t data_len;        /**< Amount of data in
> > segment buffer. */
> > +			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN
> > is set. */
> > +			uint16_t vlan_tci;
> > 
> > -	union {
> > -		union {
> > -			uint32_t rss;     /**< RSS hash result if RSS enabled
> > */
> > -			struct {
> > +			union {
> >  				union {
> > +					uint32_t rss;     /**< RSS hash result if
> > RSS enabled */
> >  					struct {
> > -						uint16_t hash;
> > -						uint16_t id;
> > -					};
> > -					uint32_t lo;
> > -					/**< Second 4 flexible bytes */
> > -				};
> > -				uint32_t hi;
> > -				/**< First 4 flexible bytes or FD ID, dependent
> > -				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
> > -				 */
> > -			} fdir;	/**< Filter identifier if FDIR enabled */
> > -			struct rte_mbuf_sched sched;
> > -			/**< Hierarchical scheduler : 8 bytes */
> > -			struct {
> > -				uint32_t reserved1;
> > -				uint16_t reserved2;
> > -				uint16_t txq;
> > -				/**< The event eth Tx adapter uses this field
> > -				 * to store Tx queue id.
> > -				 * @see rte_event_eth_tx_adapter_txq_set()
> > -				 */
> > -			} txadapter; /**< Eventdev ethdev Tx adapter */
> > -			uint32_t usr;
> > -			/**< User defined tags. See rte_distributor_process()
> > */
> > -		} hash;                   /**< hash information */
> > -	};
> > +						union {
> > +							struct {
> > +								uint16_t hash;
> > +								uint16_t id;
> > +							};
> > +							uint32_t lo;
> > +							/**< Second 4 flexible bytes
> > */
> > +						};
> > +						uint32_t hi;
> > +						/**< First 4 flexible bytes or FD
> > ID, dependent
> > +						 * on RTE_MBUF_F_RX_FDIR_* flag in
> > ol_flags.
> > +						 */
> > +					} fdir;	/**< Filter identifier if
> > FDIR enabled */
> > +					struct rte_mbuf_sched sched;
> > +					/**< Hierarchical scheduler : 8 bytes */
> > +					struct {
> > +						uint32_t reserved1;
> > +						uint16_t reserved2;
> > +						uint16_t txq;
> > +						/**< The event eth Tx adapter uses
> > this field
> > +						 * to store Tx queue id.
> > +						 * @see
> > rte_event_eth_tx_adapter_txq_set()
> > +						 */
> > +					} txadapter; /**< Eventdev ethdev Tx
> > adapter */
> > +					uint32_t usr;
> > +					/**< User defined tags. See
> > rte_distributor_process() */
> > +				} hash;                   /**< hash information
> > */
> > +			};
> > 
> > -	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is
> > set. */
> > -	uint16_t vlan_tci_outer;
> > +			/** Outer VLAN TCI (CPU order), valid if
> > RTE_MBUF_F_RX_QINQ is set. */
> > +			uint16_t vlan_tci_outer;
> > 
> > -	uint16_t buf_len;         /**< Length of segment buffer. */
> > +			uint16_t buf_len;         /**< Length of segment
> > buffer. */
> > 
> > -	struct rte_mempool *pool; /**< Pool from which mbuf was
> > allocated. */
> > +			struct rte_mempool *pool; /**< Pool from which mbuf
> > was allocated. */
> > +		};
> > +	};
> > 
> >  	/* second cache line - fields only used in slow path or on TX */

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 00/18] stop using zero sized marker fields
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
  2024-01-30 23:26 ` [PATCH] mbuf: " Tyler Retzlaff
@ 2024-02-15  6:21 ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
                     ` (18 more replies)
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                   ` (6 subsequent siblings)
  8 siblings, 19 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

The zero sized RTE_MARKER<n> typedefs are a GCC extension unsupported by
MSVC. This series adds new fields and allows deprecation of the old.

Introduce new anonymous union fields with mbuf_ prefix for cacheline0,
rearm_data, rx_descriptor_fields1, and cacheline1.

Remove in-tree use of the zero sized marker fields and adapt consuming
code to use the new anonymous union fields.

Question: what is the correct mechanism to allow uncommenting of
__rte_deprecated in __rte_marker when building DPDK itself but not
when building applications?

Tyler Retzlaff (18):
  mbuf: deprecate GCC marker in rte mbuf struct
  mbuf: stop using zero sized marker fields
  net/i40e: stop using zero sized marker fields
  net/iavf: stop using zero sized marker fields
  net/ice: stop using zero sized marker fields
  net/ixgbe: stop using zero sized marker fields
  net/mlx5: stop using zero sized marker fields
  net/sfc: stop using zero sized marker fields
  net/bnxt: stop using zero sized marker fields
  net/enic: stop using zero sized marker fields
  net/fm10k: stop using zero sized marker fields
  net/hns3: stop using zero sized marker fields
  net/ionic: stop using zero sized marker fields
  net/thunderx: stop using zero sized marker fields
  net/virtio: stop using zero sized marker fields
  net/cnxk: stop using zero sized marker fields
  common/idpf: stop using zero sized marker fields
  examples/dma: stop using zero sized marker fields

 doc/guides/rel_notes/deprecation.rst            |  20 ++
 drivers/common/idpf/idpf_common_rxtx.c          |   4 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c   |  60 ++--
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c           |  18 +-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h         |   4 +-
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c           |  20 +-
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c            |  20 +-
 drivers/net/cnxk/cn10k_rx.h                     |  50 ++--
 drivers/net/cnxk/cn9k_rx.h                      |  34 +--
 drivers/net/cnxk/cnxk_ethdev.c                  |   4 +-
 drivers/net/enic/enic.h                         |   2 +-
 drivers/net/enic/enic_main.c                    |   4 +-
 drivers/net/enic/enic_rxtx_vec_avx2.c           |  22 +-
 drivers/net/fm10k/fm10k_rxtx_vec.c              |  24 +-
 drivers/net/hns3/hns3_rxtx_vec.c                |  22 +-
 drivers/net/hns3/hns3_rxtx_vec_neon.h           |  28 +-
 drivers/net/hns3/hns3_rxtx_vec_sve.c            |   6 +-
 drivers/net/i40e/i40e_rxtx_vec_altivec.c        |  14 +-
 drivers/net/i40e/i40e_rxtx_vec_avx2.c           |  30 +-
 drivers/net/i40e/i40e_rxtx_vec_avx512.c         |  32 +-
 drivers/net/i40e/i40e_rxtx_vec_common.h         |   4 +-
 drivers/net/i40e/i40e_rxtx_vec_neon.c           |  16 +-
 drivers/net/i40e/i40e_rxtx_vec_sse.c            |  34 +--
 drivers/net/iavf/iavf_rxtx_vec_avx2.c           |  60 ++--
 drivers/net/iavf/iavf_rxtx_vec_avx512.c         |  60 ++--
 drivers/net/iavf/iavf_rxtx_vec_common.h         |   4 +-
 drivers/net/iavf/iavf_rxtx_vec_neon.c           |  16 +-
 drivers/net/iavf/iavf_rxtx_vec_sse.c            |  68 ++---
 drivers/net/ice/ice_rxtx_vec_avx2.c             |  30 +-
 drivers/net/ice/ice_rxtx_vec_avx512.c           |  30 +-
 drivers/net/ice/ice_rxtx_vec_common.h           |   4 +-
 drivers/net/ice/ice_rxtx_vec_sse.c              |  34 +--
 drivers/net/ionic/ionic_lif.c                   |   8 +-
 drivers/net/ionic/ionic_rxtx_sg.c               |   4 +-
 drivers/net/ionic/ionic_rxtx_simple.c           |   2 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h       |   4 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c         |  12 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c          |  42 +--
 drivers/net/mlx5/mlx5_rxq.c                     |   6 +-
 drivers/net/mlx5/mlx5_rxtx_vec.h                |  16 +-
 drivers/net/mlx5/mlx5_rxtx_vec_altivec.h        |  48 +--
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h           |  42 +--
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h            |  48 +--
 drivers/net/sfc/sfc_ef100_rx.c                  |  10 +-
 drivers/net/sfc/sfc_ef10_rx.c                   |  14 +-
 drivers/net/thunderx/nicvf_ethdev.c             |   4 +-
 drivers/net/thunderx/nicvf_rxtx.h               |   4 +-
 drivers/net/virtio/virtio_rxtx_packed.h         |   4 +-
 drivers/net/virtio/virtio_rxtx_packed_avx.h     |  14 +-
 drivers/net/virtio/virtio_rxtx_packed_neon.h    |  18 +-
 drivers/net/virtio/virtio_rxtx_simple.c         |   4 +-
 drivers/net/virtio/virtio_rxtx_simple.h         |   2 +-
 drivers/net/virtio/virtio_rxtx_simple_altivec.c |  16 +-
 drivers/net/virtio/virtio_rxtx_simple_neon.c    |  16 +-
 drivers/net/virtio/virtio_rxtx_simple_sse.c     |  16 +-
 examples/dma/dmafwd.c                           |   4 +-
 lib/eal/include/rte_common.h                    |   6 +
 lib/mbuf/rte_mbuf.h                             |   4 +-
 lib/mbuf/rte_mbuf_core.h                        | 375 +++++++++++++-----------
 59 files changed, 793 insertions(+), 728 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-18  2:28     ` fengchengwen
  2024-02-18 12:39     ` Thomas Monjalon
  2024-02-15  6:21   ` [PATCH v4 02/18] mbuf: stop using zero sized marker fields Tyler Retzlaff
                     ` (17 subsequent siblings)
  18 siblings, 2 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Provide a macro that allows conditional expansion of RTE_MARKER fields
to empty to allow rte_mbuf to be used with MSVC. It is proposed that
we announce the fields to be __rte_deprecated (currently disabled).

Introduce C11 anonymous unions to permit aliasing of well-known
offsets by name into the rte_mbuf structure by a *new* name and to
provide padding for cache alignment.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 doc/guides/rel_notes/deprecation.rst |  20 ++
 lib/eal/include/rte_common.h         |   6 +
 lib/mbuf/rte_mbuf_core.h             | 375 +++++++++++++++++++----------------
 3 files changed, 233 insertions(+), 168 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 10630ba..8594255 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -17,6 +17,26 @@ Other API and ABI deprecation notices are to be posted below.
 Deprecation Notices
 -------------------
 
+* mbuf: Named zero sized fields of type ``RTE_MARKER`` and ``RTE_MARKER64``
+  will be removed from ``struct rte_mbuf`` and replaced with new fields
+  in anonymous unions.
+
+  The names of the fields impacted are:
+
+    old name                  new name
+
+  ``cacheline0``            ``mbuf_cachelin0``
+  ``rearm_data``            ``mbuf_rearm_data``
+  ``rx_descriptor_fields1`` ``mbuf_rx_descriptor_fields1``
+  ``cacheline1``            ``mbuf_cachelin1``
+
+  Contributions to DPDK should immediately start using the new names,
+  applications should adapt to new names as soon as possible as the
+  old names will be removed in a future DPDK release.
+
+  Note: types of the new names are not API compatible with the old and
+  some code conversion is required to maintain correct behavior.
+
 * build: The ``enable_kmods`` option is deprecated and will be removed in a future release.
   Setting/clearing the option has no impact on the build.
   Instead, kernel modules will be always built for OS's where out-of-tree kernel modules
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index d7d6390..af73f67 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -582,6 +582,12 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
 /** Marker for 8B alignment in a structure. */
 __extension__ typedef uint64_t RTE_MARKER64[0];
 
+#define __rte_marker(type, name) type name /* __rte_deprecated */
+
+#else
+
+#define __rte_marker(type, name)
+
 #endif
 
 /*********** Macros for calculating min and max **********/
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 5688683..9e9590b 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -16,7 +16,10 @@
  * New fields and flags should fit in the "dynamic space".
  */
 
+#include <assert.h>
+#include <stdalign.h>
 #include <stdint.h>
+#include <stddef.h>
 
 #include <rte_byteorder.h>
 #include <rte_stdatomic.h>
@@ -464,204 +467,240 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct rte_mbuf {
-	RTE_MARKER cacheline0;
-
-	void *buf_addr;           /**< Virtual address of segment buffer. */
+	__rte_marker(RTE_MARKER, cacheline0);
+	union {
+		char mbuf_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
+		__extension__
+		struct {
+			void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
-	/**
-	 * Physical address of segment buffer.
-	 * This field is undefined if the build is configured to use only
-	 * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
-	 * Force alignment to 8-bytes, so as to ensure we have the exact
-	 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
-	 * working on vector drivers easier.
-	 */
-	rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
+			/**
+			 * Physical address of segment buffer.
+			 * This field is undefined if the build is configured to use only
+			 * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
+			 * Force alignment to 8-bytes, so as to ensure we have the exact
+			 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
+			 * working on vector drivers easier.
+			 */
+			rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
 #else
-	/**
-	 * Next segment of scattered packet.
-	 * This field is valid when physical address field is undefined.
-	 * Otherwise next pointer in the second cache line will be used.
-	 */
-	struct rte_mbuf *next;
+			/**
+			 * Next segment of scattered packet.
+			 * This field is valid when physical address field is undefined.
+			 * Otherwise next pointer in the second cache line will be used.
+			 */
+			struct rte_mbuf *next;
 #endif
 
-	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
-
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
-
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
-
-	uint64_t ol_flags;        /**< Offload features. */
+			/* next 8 bytes are initialised on RX descriptor rearm */
+			__rte_marker(RTE_MARKER64, rearm_data);
+			union {
+				char mbuf_rearm_data[8];
+				__extension__
+				struct {
+					uint16_t data_off;
+
+					/**
+					 * Reference counter. Its size should at least equal to the
+					 * size of port field (16 bits), to support zero-copy
+					 * broadcast.
+					 * It should only be accessed using the following
+					 * functions:
+					 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
+					 * rte_mbuf_refcnt_set(). The functionality of these
+					 * functions (atomic, or non-atomic) is controlled by the
+					 * RTE_MBUF_REFCNT_ATOMIC flag.
+					 */
+					RTE_ATOMIC(uint16_t) refcnt;
+
+					/**
+					 * Number of segments. Only valid for the first segment of
+					 * an mbuf chain.
+					 */
+					uint16_t nb_segs;
+
+					/**
+					 * Input port (16 bits to support more than 256 virtual
+					 * ports).  The event eth Tx adapter uses this field to
+					 * specify the output port.
+					 */
+					uint16_t port;
+				};
+			};
 
-	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
+			uint64_t ol_flags;        /**< Offload features. */
 
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
-	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
-		__extension__
-		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
+			/* remaining bytes are set on RX when pulling packet from descriptor */
+			__rte_marker(RTE_MARKER, rx_descriptor_fields1);
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
-				 */
+				char mbuf_rx_descriptor_fields1[8];
 				__extension__
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					/*
+					 * The packet type, which is the combination of outer/inner
+					 * L2, L3, L4 and tunnel types. The packet_type is about
+					 * data really present in the mbuf. Example: if vlan
+					 * stripping is enabled, a received vlan packet would have
+					 * RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
+					 * vlan is stripped from the data.
+					 */
+					union {
+						uint32_t packet_type;
+						/**< L2/L3/L4 and tunnel information. */
+						__extension__
+						struct {
+							uint8_t l2_type:4;
+							/**< (Outer) L2 type. */
+							uint8_t l3_type:4;
+							/**< (Outer) L3 type. */
+							uint8_t l4_type:4;
+							/**< (Outer) L4 type. */
+							uint8_t tun_type:4;
+							/**< Tunnel type. */
+							union {
+								uint8_t inner_esp_next_proto;
+								/**< ESP next protocol type, valid
+								 * if RTE_PTYPE_TUNNEL_ESP tunnel
+								 * type is set on both Tx and Rx.
+								 */
+								__extension__
+								struct {
+									uint8_t inner_l2_type:4;
+									/**< Inner L2 type. */
+									uint8_t inner_l3_type:4;
+									/**< Inner L3 type. */
+								};
+							};
+							uint8_t inner_l4_type:4;
+							/**< Inner L4 type. */
+						};
+					};
+					uint32_t pkt_len;
+					/**< Total pkt len: sum of all segments. */
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
-		};
-	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-	uint16_t data_len;        /**< Amount of data in segment buffer. */
-	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
-	uint16_t vlan_tci;
+			uint16_t data_len;        /**< Amount of data in segment buffer. */
+			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
+			uint16_t vlan_tci;
 
-	union {
-		union {
-			uint32_t rss;     /**< RSS hash result if RSS enabled */
-			struct {
+			union {
 				union {
+					uint32_t rss;     /**< RSS hash result if RSS enabled */
 					struct {
-						uint16_t hash;
-						uint16_t id;
-					};
-					uint32_t lo;
-					/**< Second 4 flexible bytes */
-				};
-				uint32_t hi;
-				/**< First 4 flexible bytes or FD ID, dependent
-				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
-				 */
-			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched sched;
-			/**< Hierarchical scheduler : 8 bytes */
-			struct {
-				uint32_t reserved1;
-				uint16_t reserved2;
-				uint16_t txq;
-				/**< The event eth Tx adapter uses this field
-				 * to store Tx queue id.
-				 * @see rte_event_eth_tx_adapter_txq_set()
-				 */
-			} txadapter; /**< Eventdev ethdev Tx adapter */
-			uint32_t usr;
-			/**< User defined tags. See rte_distributor_process() */
-		} hash;                   /**< hash information */
-	};
+						union {
+							__extension__
+							struct {
+								uint16_t hash;
+								uint16_t id;
+							};
+							uint32_t lo;
+							/**< Second 4 flexible bytes */
+						};
+						uint32_t hi;
+						/**< First 4 flexible bytes or FD ID, dependent
+						 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
+						 */
+					} fdir;	/**< Filter identifier if FDIR enabled */
+					struct rte_mbuf_sched sched;
+					/**< Hierarchical scheduler : 8 bytes */
+					struct {
+						uint32_t reserved1;
+						uint16_t reserved2;
+						uint16_t txq;
+						/**< The event eth Tx adapter uses this field
+						 * to store Tx queue id.
+						 * @see rte_event_eth_tx_adapter_txq_set()
+						 */
+					} txadapter; /**< Eventdev ethdev Tx adapter */
+					uint32_t usr;
+					/**< User defined tags. See rte_distributor_process() */
+				} hash;                   /**< hash information */
+			};
 
-	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
-	uint16_t vlan_tci_outer;
+			/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
+			uint16_t vlan_tci_outer;
 
-	uint16_t buf_len;         /**< Length of segment buffer. */
+			uint16_t buf_len;         /**< Length of segment buffer. */
 
-	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
+			struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
+		};
+	};
 
 	/* second cache line - fields only used in slow path or on TX */
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
-
-#if RTE_IOVA_IN_MBUF
-	/**
-	 * Next segment of scattered packet. Must be NULL in the last
-	 * segment or in case of non-segmented packet.
-	 */
-	struct rte_mbuf *next;
-#else
-	/**
-	 * Reserved for dynamic fields
-	 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
-	 */
-	uint64_t dynfield2;
-#endif
-
-	/* fields to support TX offloads */
+	__rte_marker(RTE_MARKER, cacheline1);
 	union {
-		uint64_t tx_offload;       /**< combined for easy fetch */
+		char mbuf_cacheline1[RTE_CACHE_LINE_MIN_SIZE];
 		__extension__
 		struct {
-			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
-			/**< L2 (MAC) Header Length for non-tunneling pkt.
-			 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
+#if RTE_IOVA_IN_MBUF
+			/**
+			 * Next segment of scattered packet. Must be NULL in the last
+			 * segment or in case of non-segmented packet.
 			 */
-			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
-			/**< L3 (IP) Header Length. */
-			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
-			/**< L4 (TCP/UDP) Header Length. */
-			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
-			/**< TCP TSO segment size */
-
-			/*
-			 * Fields for Tx offloading of tunnels.
-			 * These are undefined for packets which don't request
-			 * any tunnel offloads (outer IP or UDP checksum,
-			 * tunnel TSO).
-			 *
-			 * PMDs should not use these fields unconditionally
-			 * when calculating offsets.
-			 *
-			 * Applications are expected to set appropriate tunnel
-			 * offload flags when they fill in these fields.
+			struct rte_mbuf *next;
+#else
+			/**
+			 * Reserved for dynamic fields
+			 * when the next pointer is in first cache line
+			 * (i.e. RTE_IOVA_IN_MBUF is 0).
 			 */
-			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
-			/**< Outer L3 (IP) Hdr Length. */
-			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
-			/**< Outer L2 (MAC) Hdr Length. */
+			uint64_t dynfield2;
+#endif
 
-			/* uint64_t unused:RTE_MBUF_TXOFLD_UNUSED_BITS; */
-		};
-	};
+			/* fields to support TX offloads */
+			union {
+				uint64_t tx_offload;       /**< combined for easy fetch */
+				__extension__
+				struct {
+					uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
+					/**< L2 (MAC) Header Length for non-tunneling pkt.
+					 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
+					 */
+					uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
+					/**< L3 (IP) Header Length. */
+					uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
+					/**< L4 (TCP/UDP) Header Length. */
+					uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
+					/**< TCP TSO segment size */
+
+					/*
+					 * Fields for Tx offloading of tunnels.
+					 * These are undefined for packets which don't request
+					 * any tunnel offloads (outer IP or UDP checksum,
+					 * tunnel TSO).
+					 *
+					 * PMDs should not use these fields unconditionally
+					 * when calculating offsets.
+					 *
+					 * Applications are expected to set appropriate tunnel
+					 * offload flags when they fill in these fields.
+					 */
+					uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
+					/**< Outer L3 (IP) Hdr Length. */
+					uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
+					/**< Outer L2 (MAC) Hdr Length. */
+
+					/* uint64_t unused:RTE_MBUF_TXOFLD_UNUSED_BITS; */
+				};
+			};
 
-	/** Shared data for external buffer attached to mbuf. See
-	 * rte_pktmbuf_attach_extbuf().
-	 */
-	struct rte_mbuf_ext_shared_info *shinfo;
+			/** Shared data for external buffer attached to mbuf. See
+			 * rte_pktmbuf_attach_extbuf().
+			 */
+			struct rte_mbuf_ext_shared_info *shinfo;
 
-	/** Size of the application private data. In case of an indirect
-	 * mbuf, it stores the direct mbuf private data size.
-	 */
-	uint16_t priv_size;
+			/** Size of the application private data. In case of an indirect
+			 * mbuf, it stores the direct mbuf private data size.
+			 */
+			uint16_t priv_size;
 
-	/** Timesync flags for use with IEEE1588. */
-	uint16_t timesync;
+			/** Timesync flags for use with IEEE1588. */
+			uint16_t timesync;
 
-	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
+			uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
+		};
+	};
 } __rte_cache_aligned;
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 02/18] mbuf: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-18  2:38     ` fengchengwen
  2024-02-15  6:21   ` [PATCH v4 03/18] net/i40e: " Tyler Retzlaff
                     ` (16 subsequent siblings)
  18 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/mbuf/rte_mbuf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 286b32b..963f713 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -108,7 +108,7 @@
 static inline void
 rte_mbuf_prefetch_part1(struct rte_mbuf *m)
 {
-	rte_prefetch0(&m->cacheline0);
+	rte_prefetch0(&m->mbuf_cacheline0);
 }
 
 /**
@@ -126,7 +126,7 @@
 rte_mbuf_prefetch_part2(struct rte_mbuf *m)
 {
 #if RTE_CACHE_LINE_SIZE == 64
-	rte_prefetch0(&m->cacheline1);
+	rte_prefetch0(&m->mbuf_cacheline1);
 #else
 	RTE_SET_USED(m);
 #endif
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 03/18] net/i40e: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 02/18] mbuf: stop using zero sized marker fields Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 04/18] net/iavf: " Tyler Retzlaff
                     ` (15 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/i40e/i40e_rxtx_vec_altivec.c | 14 ++++++-------
 drivers/net/i40e/i40e_rxtx_vec_avx2.c    | 30 ++++++++++++++--------------
 drivers/net/i40e/i40e_rxtx_vec_avx512.c  | 32 +++++++++++++++---------------
 drivers/net/i40e/i40e_rxtx_vec_common.h  |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_neon.c    | 16 +++++++--------
 drivers/net/i40e/i40e_rxtx_vec_sse.c     | 34 ++++++++++++++++----------------
 6 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
index b6b0d38..0941335 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
@@ -64,11 +64,11 @@
 		  * Data to be rearmed is 6 bytes long.
 		  * Though, RX will overwrite ol_flags that are coming next
 		  * anyway. So overwrite whole 8 bytes with one load:
-		  * 6 bytes of rearm_data plus first 2 bytes of ol_flags.
+		  * 6 bytes of mbuf_rearm_data plus first 2 bytes of ol_flags.
 		  */
-		p0 = (uintptr_t)&mb0->rearm_data;
+		p0 = (uintptr_t)&mb0->mbuf_rearm_data;
 		*(uint64_t *)p0 = rxq->mbuf_initializer;
-		p1 = (uintptr_t)&mb1->rearm_data;
+		p1 = (uintptr_t)&mb1->mbuf_rearm_data;
 		*(uint64_t *)p1 = rxq->mbuf_initializer;
 
 		/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
@@ -371,11 +371,11 @@
 		/* D.3 copy final 3,4 data to rx_pkts */
 		vec_st(pkt_mb4, 0,
 		 (__vector unsigned char *)&rx_pkts[pos + 3]
-			->rx_descriptor_fields1
+			->mbuf_rx_descriptor_fields1
 		);
 		vec_st(pkt_mb3, 0,
 		 (__vector unsigned char *)&rx_pkts[pos + 2]
-			->rx_descriptor_fields1
+			->mbuf_rx_descriptor_fields1
 		);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -423,10 +423,10 @@
 		/* D.3 copy final 1,2 data to rx_pkts */
 		vec_st(pkt_mb2, 0,
 		 (__vector unsigned char *)&rx_pkts[pos + 1]
-			->rx_descriptor_fields1
+			->mbuf_rx_descriptor_fields1
 		);
 		vec_st(pkt_mb1, 0,
-		 (__vector unsigned char *)&rx_pkts[pos]->rx_descriptor_fields1
+		 (__vector unsigned char *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1
 		);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		desc_to_olflags_v(descs, &rx_pkts[pos]);
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index f468c1f..bf2570c 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -186,13 +186,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/*
@@ -527,9 +527,9 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
+				offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
+				RTE_ALIGN(offsetof(struct rte_mbuf, mbuf_rearm_data), 16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 				rearm6, rearm7;
@@ -543,10 +543,10 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data, rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data, rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data, rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data, rearm0);
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data, rearm6);
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data, rearm4);
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data, rearm2);
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data, rearm0);
 
 		/* repeat for the odd mbufs */
 		const __m256i odd_flags = _mm256_castsi128_si256(
@@ -561,10 +561,10 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data, rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data, rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data, rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data, rearm1);
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data, rearm7);
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data, rearm5);
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data, rearm3);
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data, rearm1);
 
 		/* extract and record EOP bit */
 		if (split_packet) {
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index f3050cd..d521281 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -175,13 +175,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/* mask everything except RSS, flow director and VLAN flags
@@ -559,9 +559,9 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
+				offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
+				RTE_ALIGN(offsetof(struct rte_mbuf, mbuf_rearm_data), 16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 				rearm6, rearm7;
@@ -580,13 +580,13 @@
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 6]->rearm_data, rearm6);
+			((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data, rearm6);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 4]->rearm_data, rearm4);
+			((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data, rearm4);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 2]->rearm_data, rearm2);
+			((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data, rearm2);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 0]->rearm_data, rearm0);
+			((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data, rearm0);
 
 		/* repeat for the odd mbufs */
 		const __m256i odd_flags = _mm256_castsi128_si256
@@ -606,13 +606,13 @@
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 7]->rearm_data, rearm7);
+			((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data, rearm7);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 5]->rearm_data, rearm5);
+			((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data, rearm5);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 3]->rearm_data, rearm3);
+			((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data, rearm3);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 1]->rearm_data, rearm1);
+			((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data, rearm1);
 
 		/* extract and record EOP bit */
 		if (split_packet) {
@@ -826,7 +826,7 @@
 		free[0] = m;
 		nb_free = 1;
 		for (i = 1; i < n; i++) {
-			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+			rte_prefetch0(&txep[i + 3].mbuf->mbuf_cacheline1);
 			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
 			if (likely(m)) {
 				if (likely(m->pool == free[0]->pool)) {
diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h
index 8b74563..57c2cd6 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_common.h
+++ b/drivers/net/i40e/i40e_rxtx_vec_common.h
@@ -197,9 +197,9 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 	rxq->rx_using_sse = 1;
 	return 0;
diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index d873e30..218c2ee 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -300,10 +300,10 @@
 	rearm2 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 2), mbuf_init, 1);
 	rearm3 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 3), mbuf_init, 1);
 
-	vst1q_u64((uint64_t *)&rx_pkts[0]->rearm_data, rearm0);
-	vst1q_u64((uint64_t *)&rx_pkts[1]->rearm_data, rearm1);
-	vst1q_u64((uint64_t *)&rx_pkts[2]->rearm_data, rearm2);
-	vst1q_u64((uint64_t *)&rx_pkts[3]->rearm_data, rearm3);
+	vst1q_u64((uint64_t *)&rx_pkts[0]->mbuf_rearm_data, rearm0);
+	vst1q_u64((uint64_t *)&rx_pkts[1]->mbuf_rearm_data, rearm1);
+	vst1q_u64((uint64_t *)&rx_pkts[2]->mbuf_rearm_data, rearm2);
+	vst1q_u64((uint64_t *)&rx_pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -492,13 +492,13 @@
 		pkt_mb1 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos + 3]->mbuf_rx_descriptor_fields1,
 				pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos + 2]->mbuf_rx_descriptor_fields1,
 				pkt_mb3);
-		vst1q_u8((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos + 1]->mbuf_rx_descriptor_fields1,
 				pkt_mb2);
-		vst1q_u8((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 9200a23..9380e38 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -318,13 +318,13 @@
 
 	/* write the rearm data and the olflags in one write */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+			offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
+			RTE_ALIGN(offsetof(struct rte_mbuf, mbuf_rearm_data), 16));
+	_mm_store_si128((__m128i *)&rx_pkts[0]->mbuf_rearm_data, rearm0);
+	_mm_store_si128((__m128i *)&rx_pkts[1]->mbuf_rearm_data, rearm1);
+	_mm_store_si128((__m128i *)&rx_pkts[2]->mbuf_rearm_data, rearm2);
+	_mm_store_si128((__m128i *)&rx_pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -377,9 +377,9 @@
 	 * call above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	__m128i dd_check, eop_check;
 
 	/* nb_pkts has to be floor-aligned to RTE_I40E_DESCS_PER_LOOP */
@@ -427,13 +427,13 @@
 	 * here for completeness in case of future modifications.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
@@ -537,9 +537,9 @@
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+3]->mbuf_rx_descriptor_fields1,
 				 pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+2]->mbuf_rx_descriptor_fields1,
 				 pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -573,9 +573,9 @@
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+1]->mbuf_rx_descriptor_fields1,
 				 pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 				 pkt_mb1);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 04/18] net/iavf: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 03/18] net/i40e: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 05/18] net/ice: " Tyler Retzlaff
                     ` (14 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/iavf/iavf_rxtx_vec_avx2.c   | 60 ++++++++++++++---------------
 drivers/net/iavf/iavf_rxtx_vec_avx512.c | 60 ++++++++++++++---------------
 drivers/net/iavf/iavf_rxtx_vec_common.h |  4 +-
 drivers/net/iavf/iavf_rxtx_vec_neon.c   | 16 ++++----
 drivers/net/iavf/iavf_rxtx_vec_sse.c    | 68 ++++++++++++++++-----------------
 5 files changed, 104 insertions(+), 104 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx2.c b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
index 510b4d8..e763b96 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx2.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
@@ -104,13 +104,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/**
@@ -374,10 +374,10 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+				 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
+						    mbuf_rearm_data),
 					   16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
@@ -398,13 +398,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -427,13 +427,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
 
 		/* extract and record EOP bit */
@@ -628,13 +628,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/**
@@ -1281,10 +1281,10 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+				 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
+						    mbuf_rearm_data),
 					   16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
@@ -1305,13 +1305,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -1334,13 +1334,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
index 3bb6f30..febc4fc 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
@@ -141,13 +141,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	uint16_t i, received;
 
@@ -414,10 +414,10 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+				 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
+						    mbuf_rearm_data),
 						    16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
@@ -450,13 +450,13 @@
 			rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 		}
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -486,13 +486,13 @@
 			rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 		}
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
 
 		/* extract and record EOP bit */
@@ -709,13 +709,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	uint16_t i, received;
 
@@ -1437,10 +1437,10 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+				 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
+						    mbuf_rearm_data),
 						    16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
@@ -1461,13 +1461,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -1490,13 +1490,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/iavf/iavf_rxtx_vec_common.h b/drivers/net/iavf/iavf_rxtx_vec_common.h
index 5c52200..4ce1196 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_common.h
+++ b/drivers/net/iavf/iavf_rxtx_vec_common.h
@@ -205,9 +205,9 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 	return 0;
 }
diff --git a/drivers/net/iavf/iavf_rxtx_vec_neon.c b/drivers/net/iavf/iavf_rxtx_vec_neon.c
index 83825aa..f4f6033 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_neon.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_neon.c
@@ -159,10 +159,10 @@
 	rearm2 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 2), mbuf_init, 1);
 	rearm3 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 3), mbuf_init, 1);
 
-	vst1q_u64((uint64_t *)&rx_pkts[0]->rearm_data, rearm0);
-	vst1q_u64((uint64_t *)&rx_pkts[1]->rearm_data, rearm1);
-	vst1q_u64((uint64_t *)&rx_pkts[2]->rearm_data, rearm2);
-	vst1q_u64((uint64_t *)&rx_pkts[3]->rearm_data, rearm3);
+	vst1q_u64((uint64_t *)&rx_pkts[0]->mbuf_rearm_data, rearm0);
+	vst1q_u64((uint64_t *)&rx_pkts[1]->mbuf_rearm_data, rearm1);
+	vst1q_u64((uint64_t *)&rx_pkts[2]->mbuf_rearm_data, rearm2);
+	vst1q_u64((uint64_t *)&rx_pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -332,13 +332,13 @@
 		pkt_mb1 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos + 3]->mbuf_rx_descriptor_fields1,
 				pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos + 2]->mbuf_rx_descriptor_fields1,
 				pkt_mb3);
-		vst1q_u8((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos + 1]->mbuf_rx_descriptor_fields1,
 				pkt_mb2);
-		vst1q_u8((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c b/drivers/net/iavf/iavf_rxtx_vec_sse.c
index 96f187f..fe33507 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_sse.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c
@@ -180,13 +180,13 @@
 
 	/* write the rearm data and the olflags in one write */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+			offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
+			RTE_ALIGN(offsetof(struct rte_mbuf, mbuf_rearm_data), 16));
+	_mm_store_si128((__m128i *)&rx_pkts[0]->mbuf_rearm_data, rearm0);
+	_mm_store_si128((__m128i *)&rx_pkts[1]->mbuf_rearm_data, rearm1);
+	_mm_store_si128((__m128i *)&rx_pkts[2]->mbuf_rearm_data, rearm2);
+	_mm_store_si128((__m128i *)&rx_pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 static inline __m128i
@@ -413,13 +413,13 @@
 
 	/* write the rearm data and the olflags in one write */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			 offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			 RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+			 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
+			 RTE_ALIGN(offsetof(struct rte_mbuf, mbuf_rearm_data), 16));
+	_mm_store_si128((__m128i *)&rx_pkts[0]->mbuf_rearm_data, rearm0);
+	_mm_store_si128((__m128i *)&rx_pkts[1]->mbuf_rearm_data, rearm1);
+	_mm_store_si128((__m128i *)&rx_pkts[2]->mbuf_rearm_data, rearm2);
+	_mm_store_si128((__m128i *)&rx_pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -493,9 +493,9 @@
 	 * call above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	__m128i dd_check, eop_check;
 
 	/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */
@@ -541,13 +541,13 @@
 	 * here for completeness in case of future modifications.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
@@ -651,10 +651,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			(void *)&rx_pkts[pos + 3]->mbuf_rx_descriptor_fields1,
 			pkt_mb4);
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			(void *)&rx_pkts[pos + 2]->mbuf_rx_descriptor_fields1,
 			pkt_mb3);
 
 		/* D.2 pkt 1,2 remove crc */
@@ -689,9 +689,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			(void *)&rx_pkts[pos + 1]->mbuf_rx_descriptor_fields1,
 			pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 				 pkt_mb1);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
@@ -766,9 +766,9 @@
 	 * call above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 
 	/* 4 packets DD mask */
 	const __m128i dd_check = _mm_set_epi64x(0x0000000100000001LL,
@@ -824,13 +824,13 @@
 	 * here for completeness in case of future modifications.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
@@ -1089,10 +1089,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			((void *)&rx_pkts[pos + 3]->mbuf_rx_descriptor_fields1,
 			 pkt_mb3);
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			((void *)&rx_pkts[pos + 2]->mbuf_rx_descriptor_fields1,
 			 pkt_mb2);
 
 		/* C* extract and record EOP bit */
@@ -1116,9 +1116,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			((void *)&rx_pkts[pos + 1]->mbuf_rx_descriptor_fields1,
 			 pkt_mb1);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 				 pkt_mb0);
 		flex_desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 05/18] net/ice: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 04/18] net/iavf: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 06/18] net/ixgbe: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 30 +++++++++++++++---------------
 drivers/net/ice/ice_rxtx_vec_avx512.c | 30 +++++++++++++++---------------
 drivers/net/ice/ice_rxtx_vec_common.h |  4 ++--
 drivers/net/ice/ice_rxtx_vec_sse.c    | 34 +++++++++++++++++-----------------
 4 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c b/drivers/net/ice/ice_rxtx_vec_avx2.c
index 6f6d790..2d27f1c 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -120,13 +120,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/**
@@ -572,10 +572,10 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+				 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
+						    mbuf_rearm_data),
 					   16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
@@ -596,13 +596,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -625,13 +625,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/ice/ice_rxtx_vec_avx512.c b/drivers/net/ice/ice_rxtx_vec_avx512.c
index 04148e8..a31f358 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx512.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx512.c
@@ -106,13 +106,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* following code block is for Rx Checksum Offload */
 	/* Status/Error flag masks */
@@ -570,10 +570,10 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+				 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
+						    mbuf_rearm_data),
 					   16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
@@ -597,13 +597,13 @@
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -627,13 +627,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index 4b73465..9b06206 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -240,9 +240,9 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 	return 0;
 }
diff --git a/drivers/net/ice/ice_rxtx_vec_sse.c b/drivers/net/ice/ice_rxtx_vec_sse.c
index 9a1b7e3..9fde848 100644
--- a/drivers/net/ice/ice_rxtx_vec_sse.c
+++ b/drivers/net/ice/ice_rxtx_vec_sse.c
@@ -268,13 +268,13 @@
 
 	/* write the rearm data and the olflags in one write */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			 offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			 RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+			 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
+			 RTE_ALIGN(offsetof(struct rte_mbuf, mbuf_rearm_data), 16));
+	_mm_store_si128((__m128i *)&rx_pkts[0]->mbuf_rearm_data, rearm0);
+	_mm_store_si128((__m128i *)&rx_pkts[1]->mbuf_rearm_data, rearm1);
+	_mm_store_si128((__m128i *)&rx_pkts[2]->mbuf_rearm_data, rearm2);
+	_mm_store_si128((__m128i *)&rx_pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 static inline void
@@ -348,9 +348,9 @@
 	 * call above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 
 	/* 4 packets DD mask */
 	const __m128i dd_check = _mm_set_epi64x(0x0000000100000001LL,
@@ -388,13 +388,13 @@
 	 * here for completeness in case of future modifications.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
@@ -542,10 +542,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			((void *)&rx_pkts[pos + 3]->mbuf_rx_descriptor_fields1,
 			 pkt_mb3);
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			((void *)&rx_pkts[pos + 2]->mbuf_rx_descriptor_fields1,
 			 pkt_mb2);
 
 		/* C* extract and record EOP bit */
@@ -569,9 +569,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			((void *)&rx_pkts[pos + 1]->mbuf_rx_descriptor_fields1,
 			 pkt_mb1);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 				 pkt_mb0);
 		ice_rx_desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 06/18] net/ixgbe: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 05/18] net/ice: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 07/18] net/mlx5: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h |  4 +--
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c   | 12 ++++-----
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c    | 42 +++++++++++++++----------------
 3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
index a4d9ec9..abb55a1 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
@@ -252,9 +252,9 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 	return 0;
 }
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index 952b032..6ad888f 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -56,13 +56,13 @@
 		 * Flush mbuf with pkt template.
 		 * Data to be rearmed is 6 bytes long.
 		 */
-		vst1_u8((uint8_t *)&mb0->rearm_data, p);
+		vst1_u8((uint8_t *)&mb0->mbuf_rearm_data, p);
 		paddr = mb0->buf_iova + RTE_PKTMBUF_HEADROOM;
 		dma_addr0 = vsetq_lane_u64(paddr, zero, 0);
 		/* flush desc with pa dma_addr */
 		vst1q_u64((uint64_t *)&rxdp++->read, dma_addr0);
 
-		vst1_u8((uint8_t *)&mb1->rearm_data, p);
+		vst1_u8((uint8_t *)&mb1->mbuf_rearm_data, p);
 		paddr = mb1->buf_iova + RTE_PKTMBUF_HEADROOM;
 		dma_addr1 = vsetq_lane_u64(paddr, zero, 0);
 		vst1q_u64((uint64_t *)&rxdp++->read, dma_addr1);
@@ -411,9 +411,9 @@
 		pkt_mb3 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos + 3]->mbuf_rx_descriptor_fields1,
 			 pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8((void *)&rx_pkts[pos + 2]->mbuf_rx_descriptor_fields1,
 			 pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -441,9 +441,9 @@
 		rte_prefetch_non_temporal(rxdp + RTE_IXGBE_DESCS_PER_LOOP);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		vst1q_u8((uint8_t *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8((uint8_t *)&rx_pkts[pos + 1]->mbuf_rx_descriptor_fields1,
 			 pkt_mb2);
-		vst1q_u8((uint8_t *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8((uint8_t *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 			 pkt_mb1);
 
 		desc_to_ptype_v(descs, rxq->pkt_type_mask, &rx_pkts[pos]);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index f60808d..adc4df1 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -98,10 +98,10 @@
 desc_to_olflags_v_ipsec(__m128i descs[4], struct rte_mbuf **rx_pkts)
 {
 	__m128i sterr, rearm, tmp_e, tmp_p;
-	uint32_t *rearm0 = (uint32_t *)rx_pkts[0]->rearm_data + 2;
-	uint32_t *rearm1 = (uint32_t *)rx_pkts[1]->rearm_data + 2;
-	uint32_t *rearm2 = (uint32_t *)rx_pkts[2]->rearm_data + 2;
-	uint32_t *rearm3 = (uint32_t *)rx_pkts[3]->rearm_data + 2;
+	uint32_t *rearm0 = (uint32_t *)rx_pkts[0]->mbuf_rearm_data + 2;
+	uint32_t *rearm1 = (uint32_t *)rx_pkts[1]->mbuf_rearm_data + 2;
+	uint32_t *rearm2 = (uint32_t *)rx_pkts[2]->mbuf_rearm_data + 2;
+	uint32_t *rearm3 = (uint32_t *)rx_pkts[3]->mbuf_rearm_data + 2;
 	const __m128i ipsec_sterr_msk =
 			_mm_set1_epi32(IXGBE_RXDADV_IPSEC_STATUS_SECP |
 				       IXGBE_RXDADV_IPSEC_ERROR_AUTH_FAILED);
@@ -252,13 +252,13 @@
 
 	/* write the rearm data and the olflags in one write */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+			offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
+			RTE_ALIGN(offsetof(struct rte_mbuf, mbuf_rearm_data), 16));
+	_mm_store_si128((__m128i *)&rx_pkts[0]->mbuf_rearm_data, rearm0);
+	_mm_store_si128((__m128i *)&rx_pkts[1]->mbuf_rearm_data, rearm1);
+	_mm_store_si128((__m128i *)&rx_pkts[2]->mbuf_rearm_data, rearm2);
+	_mm_store_si128((__m128i *)&rx_pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 static inline uint32_t get_packet_type(int index,
@@ -356,9 +356,9 @@ static inline uint32_t get_packet_type(int index,
 	 * call above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	__m128i dd_check, eop_check;
 	__m128i mbuf_init;
 	uint8_t vlan_flags;
@@ -423,13 +423,13 @@ static inline uint32_t get_packet_type(int index,
 	 * here for completeness in case of future modifications.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	mbuf_init = _mm_set_epi64x(0, rxq->mbuf_initializer);
 
@@ -530,9 +530,9 @@ static inline uint32_t get_packet_type(int index,
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+3]->mbuf_rx_descriptor_fields1,
 				pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+2]->mbuf_rx_descriptor_fields1,
 				pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -566,9 +566,9 @@ static inline uint32_t get_packet_type(int index,
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+1]->mbuf_rx_descriptor_fields1,
 				pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, rxq->pkt_type_mask, &rx_pkts[pos]);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 07/18] net/mlx5: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 06/18] net/ixgbe: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 08/18] net/sfc: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/mlx5_rxq.c              |  6 ++--
 drivers/net/mlx5/mlx5_rxtx_vec.h         | 16 +++++------
 drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 48 ++++++++++++++++----------------
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h    | 42 ++++++++++++++--------------
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h     | 48 ++++++++++++++++----------------
 5 files changed, 80 insertions(+), 80 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 1bb036a..b0a4610 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -186,7 +186,7 @@
 				rte_mempool_get_priv(rxq_ctrl->rxq.mp);
 		int j;
 
-		/* Initialize default rearm_data for vPMD. */
+		/* Initialize default mbuf_rearm_data for vPMD. */
 		mbuf_init->data_off = RTE_PKTMBUF_HEADROOM;
 		rte_mbuf_refcnt_set(mbuf_init, 1);
 		mbuf_init->nb_segs = 1;
@@ -196,11 +196,11 @@
 			mbuf_init->ol_flags = RTE_MBUF_F_EXTERNAL;
 		/*
 		 * prevent compiler reordering:
-		 * rearm_data covers previous fields.
+		 * mbuf_rearm_data covers previous fields.
 		 */
 		rte_compiler_barrier();
 		rxq->mbuf_initializer =
-			*(rte_xmm_t *)&mbuf_init->rearm_data;
+			*(rte_xmm_t *)&mbuf_init->mbuf_rearm_data;
 		/* Padding with a fake mbuf for vectorized Rx. */
 		for (j = 0; j < MLX5_VPMD_DESCS_PER_LOOP; ++j)
 			(*rxq->elts)[elts_n + j] = &rxq->fake_mbuf;
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.h b/drivers/net/mlx5/mlx5_rxtx_vec.h
index 77c3f4e..ee4e442 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.h
@@ -31,23 +31,23 @@
 
 /* rxq_cq_decompress_v() */
 S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, pkt_len) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+		  offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, data_len) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+		  offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, hash) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+		  offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 /* rxq_cq_to_ptype_oflags_v() */
 S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, ol_flags) ==
-		  offsetof(struct rte_mbuf, rearm_data) + 8);
-S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, rearm_data) ==
-		  RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
+		  offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, mbuf_rearm_data) ==
+		  RTE_ALIGN(offsetof(struct rte_mbuf, mbuf_rearm_data), 16));
 
 /* rxq_burst_v() */
 S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, pkt_len) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+		  offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, data_len) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+		  offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 #if (RTE_CACHE_LINE_SIZE == 128)
 S_ASSERT_MLX5_CQE(offsetof(struct mlx5_cqe, pkt_info) == 64);
 #else
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
index cccfa7f..462c988 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
@@ -101,10 +101,10 @@
 	uint16_t pkts_n = mcqe_n;
 	const __vector unsigned char rearm =
 		(__vector unsigned char)vec_vsx_ld(0,
-		(signed int const *)&t_pkt->rearm_data);
+		(signed int const *)&t_pkt->mbuf_rearm_data);
 	const __vector unsigned char rxdf =
 		(__vector unsigned char)vec_vsx_ld(0,
-		(signed int const *)&t_pkt->rx_descriptor_fields1);
+		(signed int const *)&t_pkt->mbuf_rx_descriptor_fields1);
 	const __vector unsigned char crc_adj =
 		(__vector unsigned char)(__vector unsigned short){
 			0, 0, rxq->crc_present * RTE_ETHER_CRC_LEN, 0,
@@ -132,8 +132,8 @@
 	/*
 	 * A. load mCQEs into a 128bit register.
 	 * B. store rearm data to mbuf.
-	 * C. combine data from mCQEs with rx_descriptor_fields1.
-	 * D. store rx_descriptor_fields1.
+	 * C. combine data from mCQEs with mbuf_rx_descriptor_fields1.
+	 * D. store mbuf_rx_descriptor_fields1.
 	 * E. store flow tag (rte_flow mark).
 	 */
 cycle:
@@ -173,11 +173,11 @@
 
 		/* B.1 store rearm data to mbuf. */
 		*(__vector unsigned char *)
-			&elts[pos]->rearm_data = rearm;
+			&elts[pos]->mbuf_rearm_data = rearm;
 		*(__vector unsigned char *)
-			&elts[pos + 1]->rearm_data = rearm;
+			&elts[pos + 1]->mbuf_rearm_data = rearm;
 
-		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
+		/* C.1 combine data from mCQEs with mbuf_rx_descriptor_fields1. */
 		rxdf1 = vec_perm(mcqe1, zero, shuf_mask1);
 		rxdf2 = vec_perm(mcqe1, zero, shuf_mask2);
 		rxdf1 = (__vector unsigned char)
@@ -193,19 +193,19 @@
 			vec_sel((__vector unsigned short)rxdf2,
 			(__vector unsigned short)rxdf, rxdf_sel_mask);
 
-		/* D.1 store rx_descriptor_fields1. */
+		/* D.1 store mbuf_rx_descriptor_fields1. */
 		*(__vector unsigned char *)
-			&elts[pos]->rx_descriptor_fields1 = rxdf1;
+			&elts[pos]->mbuf_rx_descriptor_fields1 = rxdf1;
 		*(__vector unsigned char *)
-			&elts[pos + 1]->rx_descriptor_fields1 = rxdf2;
+			&elts[pos + 1]->mbuf_rx_descriptor_fields1 = rxdf2;
 
 		/* B.1 store rearm data to mbuf. */
 		*(__vector unsigned char *)
-			&elts[pos + 2]->rearm_data = rearm;
+			&elts[pos + 2]->mbuf_rearm_data = rearm;
 		*(__vector unsigned char *)
-			&elts[pos + 3]->rearm_data = rearm;
+			&elts[pos + 3]->mbuf_rearm_data = rearm;
 
-		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
+		/* C.1 combine data from mCQEs with mbuf_rx_descriptor_fields1. */
 		rxdf1 = vec_perm(mcqe2, zero, shuf_mask1);
 		rxdf2 = vec_perm(mcqe2, zero, shuf_mask2);
 		rxdf1 = (__vector unsigned char)
@@ -221,11 +221,11 @@
 			vec_sel((__vector unsigned short)rxdf2,
 			(__vector unsigned short)rxdf, rxdf_sel_mask);
 
-		/* D.1 store rx_descriptor_fields1. */
+		/* D.1 store mbuf_rx_descriptor_fields1. */
 		*(__vector unsigned char *)
-			&elts[pos + 2]->rx_descriptor_fields1 = rxdf1;
+			&elts[pos + 2]->mbuf_rx_descriptor_fields1 = rxdf1;
 		*(__vector unsigned char *)
-			&elts[pos + 3]->rx_descriptor_fields1 = rxdf2;
+			&elts[pos + 3]->mbuf_rx_descriptor_fields1 = rxdf2;
 
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		invalid_mask = (__vector unsigned char)(__vector unsigned long){
@@ -767,15 +767,15 @@
 		vec_sro((__vector unsigned short)ol_flags,
 		(__vector unsigned char){32}), rearm_sel_mask);
 
-	/* Write 8B rearm_data and 8B ol_flags. */
+	/* Write 8B mbuf_rearm_data and 8B ol_flags. */
 	vec_vsx_st(rearm0, 0,
-		(__vector unsigned char *)&pkts[0]->rearm_data);
+		(__vector unsigned char *)&pkts[0]->mbuf_rearm_data);
 	vec_vsx_st(rearm1, 0,
-		(__vector unsigned char *)&pkts[1]->rearm_data);
+		(__vector unsigned char *)&pkts[1]->mbuf_rearm_data);
 	vec_vsx_st(rearm2, 0,
-		(__vector unsigned char *)&pkts[2]->rearm_data);
+		(__vector unsigned char *)&pkts[2]->mbuf_rearm_data);
 	vec_vsx_st(rearm3, 0,
-		(__vector unsigned char *)&pkts[3]->rearm_data);
+		(__vector unsigned char *)&pkts[3]->mbuf_rearm_data);
 }
 
 /**
@@ -1046,7 +1046,7 @@
 			((__vector unsigned int)pkt_mb2 +
 			(__vector unsigned int)flow_mark_adj);
 
-		/* D.1 fill in mbuf - rx_descriptor_fields1. */
+		/* D.1 fill in mbuf - mbuf_rx_descriptor_fields1. */
 		*(__vector unsigned char *)
 			&pkts[pos + 3]->pkt_len = pkt_mb3;
 		*(__vector unsigned char *)
@@ -1115,7 +1115,7 @@
 			vec_mergel((__vector unsigned long)op_own_tmp1,
 			(__vector unsigned long)op_own_tmp2);
 
-		/* D.1 fill in mbuf - rx_descriptor_fields1. */
+		/* D.1 fill in mbuf - mbuf_rx_descriptor_fields1. */
 		*(__vector unsigned char *)
 			&pkts[pos + 1]->pkt_len = pkt_mb1;
 		*(__vector unsigned char *)
@@ -1245,7 +1245,7 @@
 		/* D.4 mark if any error is set */
 		*err |= ((__vector unsigned long)opcode)[0];
 
-		/* D.5 fill in mbuf - rearm_data and packet_type. */
+		/* D.5 fill in mbuf - mbuf_rearm_data and packet_type. */
 		rxq_cq_to_ptype_oflags_v(rxq, cqes, opcode, &pkts[pos]);
 		if (unlikely(rxq->shared)) {
 			pkts[pos]->port = cq[pos].user_index_low;
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index 3ed6881..db7c11a 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -99,7 +99,7 @@
 		t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN);
 	uint16_t pkts_n = mcqe_n;
 	const uint64x2_t rearm =
-		vld1q_u64((void *)&t_pkt->rearm_data);
+		vld1q_u64((void *)&t_pkt->mbuf_rearm_data);
 	const uint32x4_t rxdf_mask = {
 		0xffffffff, /* packet_type */
 		0,          /* skip pkt_len */
@@ -107,7 +107,7 @@
 		0,          /* skip hash.rss */
 	};
 	const uint8x16_t rxdf =
-		vandq_u8(vld1q_u8((void *)&t_pkt->rx_descriptor_fields1),
+		vandq_u8(vld1q_u8((void *)&t_pkt->mbuf_rx_descriptor_fields1),
 			 vreinterpretq_u8_u32(rxdf_mask));
 	const uint16x8_t crc_adj = {
 		0, 0,
@@ -131,8 +131,8 @@
 	/*
 	 * A. load mCQEs into a 128bit register.
 	 * B. store rearm data to mbuf.
-	 * C. combine data from mCQEs with rx_descriptor_fields1.
-	 * D. store rx_descriptor_fields1.
+	 * C. combine data from mCQEs with mbuf_rx_descriptor_fields1.
+	 * D. store mbuf_rx_descriptor_fields1.
 	 * E. store flow tag (rte_flow mark).
 	 */
 cycle:
@@ -140,10 +140,10 @@
 		rte_prefetch0((void *)(cq + mcqe_n));
 	for (pos = 0; pos < mcqe_n; ) {
 		uint8_t *p = (void *)&mcq[pos % 8];
-		uint8_t *e0 = (void *)&elts[pos]->rearm_data;
-		uint8_t *e1 = (void *)&elts[pos + 1]->rearm_data;
-		uint8_t *e2 = (void *)&elts[pos + 2]->rearm_data;
-		uint8_t *e3 = (void *)&elts[pos + 3]->rearm_data;
+		uint8_t *e0 = (void *)&elts[pos]->mbuf_rearm_data;
+		uint8_t *e1 = (void *)&elts[pos + 1]->mbuf_rearm_data;
+		uint8_t *e2 = (void *)&elts[pos + 2]->mbuf_rearm_data;
+		uint8_t *e3 = (void *)&elts[pos + 3]->mbuf_rearm_data;
 		uint16x4_t byte_cnt;
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		uint16x4_t invalid_mask =
@@ -164,14 +164,14 @@
 		"add %[e0], %[e0], #16 \n\t"
 		"st1 {%[rearm].2d}, [%[e1]] \n\t"
 		"add %[e1], %[e1], #16 \n\t"
-		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
+		/* C.1 combine data from mCQEs with mbuf_rx_descriptor_fields1. */
 		"tbl v18.16b, {v16.16b}, %[mcqe_shuf_m1].16b \n\t"
 		"tbl v19.16b, {v16.16b}, %[mcqe_shuf_m2].16b \n\t"
 		"sub v18.8h, v18.8h, %[crc_adj].8h \n\t"
 		"sub v19.8h, v19.8h, %[crc_adj].8h \n\t"
 		"orr v18.16b, v18.16b, %[rxdf].16b \n\t"
 		"orr v19.16b, v19.16b, %[rxdf].16b \n\t"
-		/* D.1 store rx_descriptor_fields1. */
+		/* D.1 store mbuf_rx_descriptor_fields1. */
 		"st1 {v18.2d}, [%[e0]] \n\t"
 		"st1 {v19.2d}, [%[e1]] \n\t"
 		/* B.1 store rearm data to mbuf. */
@@ -179,14 +179,14 @@
 		"add %[e2], %[e2], #16 \n\t"
 		"st1 {%[rearm].2d}, [%[e3]] \n\t"
 		"add %[e3], %[e3], #16 \n\t"
-		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
+		/* C.1 combine data from mCQEs with mbuf_rx_descriptor_fields1. */
 		"tbl v18.16b, {v17.16b}, %[mcqe_shuf_m1].16b \n\t"
 		"tbl v19.16b, {v17.16b}, %[mcqe_shuf_m2].16b \n\t"
 		"sub v18.8h, v18.8h, %[crc_adj].8h \n\t"
 		"sub v19.8h, v19.8h, %[crc_adj].8h \n\t"
 		"orr v18.16b, v18.16b, %[rxdf].16b \n\t"
 		"orr v19.16b, v19.16b, %[rxdf].16b \n\t"
-		/* D.1 store rx_descriptor_fields1. */
+		/* D.1 store mbuf_rx_descriptor_fields1. */
 		"st1 {v18.2d}, [%[e2]] \n\t"
 		"st1 {v19.2d}, [%[e3]] \n\t"
 #ifdef MLX5_PMD_SOFT_COUNTERS
@@ -513,10 +513,10 @@
 					(vgetq_lane_u32(ol_flags, 0),
 					 vreinterpretq_u32_u64(mbuf_init), 2));
 
-	vst1q_u64((void *)&pkts[0]->rearm_data, rearm0);
-	vst1q_u64((void *)&pkts[1]->rearm_data, rearm1);
-	vst1q_u64((void *)&pkts[2]->rearm_data, rearm2);
-	vst1q_u64((void *)&pkts[3]->rearm_data, rearm3);
+	vst1q_u64((void *)&pkts[0]->mbuf_rearm_data, rearm0);
+	vst1q_u64((void *)&pkts[1]->mbuf_rearm_data, rearm1);
+	vst1q_u64((void *)&pkts[2]->mbuf_rearm_data, rearm2);
+	vst1q_u64((void *)&pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 /**
@@ -736,17 +736,17 @@
 		"tbl %[op_own].8b, {v20.16b - v23.16b}, %[owner_shuf_m].8b \n\t"
 		/* C.2 (CQE 3) adjust flow mark. */
 		"add v15.4s, v15.4s, %[flow_mark_adj].4s \n\t"
-		/* C.3 (CQE 3) fill in mbuf - rx_descriptor_fields1. */
+		/* C.3 (CQE 3) fill in mbuf - mbuf_rx_descriptor_fields1. */
 		"st1 {v15.2d}, [%[e3]] \n\t"
 		/* C.2 (CQE 2) adjust flow mark. */
 		"add v14.4s, v14.4s, %[flow_mark_adj].4s \n\t"
-		/* C.3 (CQE 2) fill in mbuf - rx_descriptor_fields1. */
+		/* C.3 (CQE 2) fill in mbuf - mbuf_rx_descriptor_fields1. */
 		"st1 {v14.2d}, [%[e2]] \n\t"
 		/* C.1 (CQE 0) generate final structure for mbuf. */
 		"tbl v12.16b, {v20.16b}, %[mb_shuf_m].16b \n\t"
 		/* C.2 (CQE 1) adjust flow mark. */
 		"add v13.4s, v13.4s, %[flow_mark_adj].4s \n\t"
-		/* C.3 (CQE 1) fill in mbuf - rx_descriptor_fields1. */
+		/* C.3 (CQE 1) fill in mbuf - mbuf_rx_descriptor_fields1. */
 		"st1 {v13.2d}, [%[e1]] \n\t"
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		/* Extract byte_cnt. */
@@ -760,7 +760,7 @@
 		"st1 {v24.2d - v25.2d}, [%[pkts_p]] \n\t"
 		/* C.2 (CQE 0) adjust flow mark. */
 		"add v12.4s, v12.4s, %[flow_mark_adj].4s \n\t"
-		/* C.3 (CQE 1) fill in mbuf - rx_descriptor_fields1. */
+		/* C.3 (CQE 1) fill in mbuf - mbuf_rx_descriptor_fields1. */
 		"st1 {v12.2d}, [%[e0]] \n\t"
 		:[op_own]"=&w"(op_own),
 		 [byte_cnt]"=&w"(byte_cnt),
@@ -831,7 +831,7 @@
 		opcode = vbic_u16(opcode, mini_mask);
 		/* D.4 mark if any error is set */
 		*err |= vget_lane_u64(vreinterpret_u64_u16(opcode), 0);
-		/* C.4 fill in mbuf - rearm_data and packet_type. */
+		/* C.4 fill in mbuf - mbuf_rearm_data and packet_type. */
 		rxq_cq_to_ptype_oflags_v(rxq, ptype_info, flow_tag,
 					 opcode, &elts[pos]);
 		if (unlikely(rxq->shared)) {
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index 2bdd1f6..a8bbdaa 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -98,9 +98,9 @@
 		t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN);
 	uint16_t pkts_n = mcqe_n;
 	const __m128i rearm =
-		_mm_loadu_si128((__m128i *)&t_pkt->rearm_data);
+		_mm_loadu_si128((__m128i *)&t_pkt->mbuf_rearm_data);
 	const __m128i rxdf =
-		_mm_loadu_si128((__m128i *)&t_pkt->rx_descriptor_fields1);
+		_mm_loadu_si128((__m128i *)&t_pkt->mbuf_rx_descriptor_fields1);
 	const __m128i crc_adj =
 		_mm_set_epi16(0, 0, 0,
 			      rxq->crc_present * RTE_ETHER_CRC_LEN,
@@ -123,8 +123,8 @@
 	/*
 	 * A. load mCQEs into a 128bit register.
 	 * B. store rearm data to mbuf.
-	 * C. combine data from mCQEs with rx_descriptor_fields1.
-	 * D. store rx_descriptor_fields1.
+	 * C. combine data from mCQEs with mbuf_rx_descriptor_fields1.
+	 * D. store mbuf_rx_descriptor_fields1.
 	 * E. store flow tag (rte_flow mark).
 	 */
 cycle:
@@ -145,38 +145,38 @@
 		mcqe1 = _mm_loadu_si128((__m128i *)&mcq[pos % 8]);
 		mcqe2 = _mm_loadu_si128((__m128i *)&mcq[pos % 8 + 2]);
 		/* B.1 store rearm data to mbuf. */
-		_mm_storeu_si128((__m128i *)&elts[pos]->rearm_data, rearm);
-		_mm_storeu_si128((__m128i *)&elts[pos + 1]->rearm_data, rearm);
-		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
+		_mm_storeu_si128((__m128i *)&elts[pos]->mbuf_rearm_data, rearm);
+		_mm_storeu_si128((__m128i *)&elts[pos + 1]->mbuf_rearm_data, rearm);
+		/* C.1 combine data from mCQEs with mbuf_rx_descriptor_fields1. */
 		rxdf1 = _mm_shuffle_epi8(mcqe1, shuf_mask1);
 		rxdf2 = _mm_shuffle_epi8(mcqe1, shuf_mask2);
 		rxdf1 = _mm_sub_epi16(rxdf1, crc_adj);
 		rxdf2 = _mm_sub_epi16(rxdf2, crc_adj);
 		rxdf1 = _mm_blend_epi16(rxdf1, rxdf, 0x23);
 		rxdf2 = _mm_blend_epi16(rxdf2, rxdf, 0x23);
-		/* D.1 store rx_descriptor_fields1. */
+		/* D.1 store mbuf_rx_descriptor_fields1. */
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos]->rx_descriptor_fields1,
+				  &elts[pos]->mbuf_rx_descriptor_fields1,
 				 rxdf1);
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 1]->rx_descriptor_fields1,
+				  &elts[pos + 1]->mbuf_rx_descriptor_fields1,
 				 rxdf2);
 		/* B.1 store rearm data to mbuf. */
-		_mm_storeu_si128((__m128i *)&elts[pos + 2]->rearm_data, rearm);
-		_mm_storeu_si128((__m128i *)&elts[pos + 3]->rearm_data, rearm);
-		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
+		_mm_storeu_si128((__m128i *)&elts[pos + 2]->mbuf_rearm_data, rearm);
+		_mm_storeu_si128((__m128i *)&elts[pos + 3]->mbuf_rearm_data, rearm);
+		/* C.1 combine data from mCQEs with mbuf_rx_descriptor_fields1. */
 		rxdf1 = _mm_shuffle_epi8(mcqe2, shuf_mask1);
 		rxdf2 = _mm_shuffle_epi8(mcqe2, shuf_mask2);
 		rxdf1 = _mm_sub_epi16(rxdf1, crc_adj);
 		rxdf2 = _mm_sub_epi16(rxdf2, crc_adj);
 		rxdf1 = _mm_blend_epi16(rxdf1, rxdf, 0x23);
 		rxdf2 = _mm_blend_epi16(rxdf2, rxdf, 0x23);
-		/* D.1 store rx_descriptor_fields1. */
+		/* D.1 store mbuf_rx_descriptor_fields1. */
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 2]->rx_descriptor_fields1,
+				  &elts[pos + 2]->mbuf_rx_descriptor_fields1,
 				 rxdf1);
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 3]->rx_descriptor_fields1,
+				  &elts[pos + 3]->mbuf_rx_descriptor_fields1,
 				 rxdf2);
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		invalid_mask = _mm_set_epi64x(0,
@@ -510,11 +510,11 @@
 	rearm1 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(ol_flags, 4), 0x30);
 	rearm2 = _mm_blend_epi16(mbuf_init, ol_flags, 0x30);
 	rearm3 = _mm_blend_epi16(mbuf_init, _mm_srli_si128(ol_flags, 4), 0x30);
-	/* Write 8B rearm_data and 8B ol_flags. */
-	_mm_store_si128((__m128i *)&pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&pkts[3]->rearm_data, rearm3);
+	/* Write 8B mbuf_rearm_data and 8B ol_flags. */
+	_mm_store_si128((__m128i *)&pkts[0]->mbuf_rearm_data, rearm0);
+	_mm_store_si128((__m128i *)&pkts[1]->mbuf_rearm_data, rearm1);
+	_mm_store_si128((__m128i *)&pkts[2]->mbuf_rearm_data, rearm2);
+	_mm_store_si128((__m128i *)&pkts[3]->mbuf_rearm_data, rearm3);
 }
 
 /**
@@ -693,7 +693,7 @@
 		/* C.4 adjust flow mark. */
 		pkt_mb3 = _mm_add_epi32(pkt_mb3, flow_mark_adj);
 		pkt_mb2 = _mm_add_epi32(pkt_mb2, flow_mark_adj);
-		/* D.1 fill in mbuf - rx_descriptor_fields1. */
+		/* D.1 fill in mbuf - mbuf_rx_descriptor_fields1. */
 		_mm_storeu_si128((void *)&pkts[pos + 3]->pkt_len, pkt_mb3);
 		_mm_storeu_si128((void *)&pkts[pos + 2]->pkt_len, pkt_mb2);
 		/* E.1 extract op_own field. */
@@ -723,7 +723,7 @@
 		/* E.1 extract op_own byte. */
 		op_own_tmp1 = _mm_unpacklo_epi32(cqes[0], cqes[1]);
 		op_own = _mm_unpackhi_epi64(op_own_tmp1, op_own_tmp2);
-		/* D.1 fill in mbuf - rx_descriptor_fields1. */
+		/* D.1 fill in mbuf - mbuf_rx_descriptor_fields1. */
 		_mm_storeu_si128((void *)&pkts[pos + 1]->pkt_len, pkt_mb1);
 		_mm_storeu_si128((void *)&pkts[pos]->pkt_len, pkt_mb0);
 		/* E.2 mask out CQEs belonging to HW. */
@@ -779,7 +779,7 @@
 		opcode = _mm_andnot_si128(mini_mask, opcode);
 		/* D.4 mark if any error is set */
 		*err |= _mm_cvtsi128_si64(opcode);
-		/* D.5 fill in mbuf - rearm_data and packet_type. */
+		/* D.5 fill in mbuf - mbuf_rearm_data and packet_type. */
 		rxq_cq_to_ptype_oflags_v(rxq, cqes, opcode, &pkts[pos]);
 		if (unlikely(rxq->shared)) {
 			pkts[pos]->port = cq[pos].user_index_low;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 08/18] net/sfc: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 07/18] net/mlx5: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 09/18] net/bnxt: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/sfc/sfc_ef100_rx.c | 10 +++++-----
 drivers/net/sfc/sfc_ef10_rx.c  | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c
index 2677003..b316a6d 100644
--- a/drivers/net/sfc/sfc_ef100_rx.c
+++ b/drivers/net/sfc/sfc_ef100_rx.c
@@ -553,9 +553,9 @@ struct sfc_ef100_rxq {
 		pkt = sfc_ef100_rx_next_mbuf(rxq);
 		__rte_mbuf_raw_sanity_check(pkt);
 
-		RTE_BUILD_BUG_ON(sizeof(pkt->rearm_data[0]) !=
+		RTE_BUILD_BUG_ON(sizeof(pkt->mbuf_rearm_data) !=
 				 sizeof(rxq->rearm_data));
-		pkt->rearm_data[0] = rxq->rearm_data;
+		*(uint64_t *)&pkt->mbuf_rearm_data[0] = rxq->rearm_data;
 
 		/* data_off already moved past Rx prefix */
 		rx_prefix = (const efx_xword_t *)sfc_ef100_rx_pkt_prefix(pkt);
@@ -757,10 +757,10 @@ struct sfc_ef100_rxq {
 	m.nb_segs = 1;
 	m.port = port_id;
 
-	/* rearm_data covers structure members filled in above */
+	/* mbuf_rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
-	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(m.mbuf_rearm_data) != sizeof(uint64_t));
+	return *(uint64_t *)&m.mbuf_rearm_data[0];
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef100_rx_qcreate;
diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c
index 30a320d..7b9103c 100644
--- a/drivers/net/sfc/sfc_ef10_rx.c
+++ b/drivers/net/sfc/sfc_ef10_rx.c
@@ -322,8 +322,8 @@ struct sfc_ef10_rxq {
 
 	m = rxd->mbuf;
 
-	RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) != sizeof(rxq->rearm_data));
-	m->rearm_data[0] = rxq->rearm_data;
+	RTE_BUILD_BUG_ON(sizeof(m->mbuf_rearm_data) != sizeof(rxq->rearm_data));
+	*(uint64_t *)&m->mbuf_rearm_data[0] = rxq->rearm_data;
 
 	/* Classify packet based on Rx event */
 	/* Mask RSS hash offload flag if RSS is not enabled */
@@ -377,9 +377,9 @@ struct sfc_ef10_rxq {
 			rxq->completed = pending;
 		}
 
-		RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) !=
+		RTE_BUILD_BUG_ON(sizeof(m->mbuf_rearm_data) !=
 				 sizeof(rxq->rearm_data));
-		m->rearm_data[0] = rxq->rearm_data;
+		*(uint64_t *)&m->mbuf_rearm_data[0] = rxq->rearm_data;
 
 		/* Event-dependent information is the same */
 		m->ol_flags = m0->ol_flags;
@@ -631,10 +631,10 @@ struct sfc_ef10_rxq {
 	m.nb_segs = 1;
 	m.port = port_id;
 
-	/* rearm_data covers structure members filled in above */
+	/* mbuf_rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
-	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(m.mbuf_rearm_data) != sizeof(uint64_t));
+	return *(uint64_t *)&m.mbuf_rearm_data[0];
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef10_rx_qcreate;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 09/18] net/bnxt: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 08/18] net/sfc: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 10/18] net/enic: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c   | 18 +++++++++---------
 drivers/net/bnxt/bnxt_rxtx_vec_common.h |  4 ++--
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c   | 20 ++++++++++----------
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c    | 20 ++++++++++----------
 4 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
index ea8dbaf..5f92e0f 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
@@ -266,7 +266,7 @@
 		if (num_valid == 0)
 			break;
 
-		/* Update mbuf rearm_data for eight packets. */
+		/* Update mbuf mbuf_rearm_data for eight packets. */
 		mbuf01 = _mm256_shuffle_epi8(rxcmp0_1, shuf_msk);
 		mbuf23 = _mm256_shuffle_epi8(rxcmp2_3, shuf_msk);
 		mbuf45 = _mm256_shuffle_epi8(rxcmp4_5, shuf_msk);
@@ -310,13 +310,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for first four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((void *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((void *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((void *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((void *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
 
 		/* Unpack rearm data, set fixed fields for final four mbufs. */
@@ -336,13 +336,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for final four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((void *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((void *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((void *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((void *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
 
 		nb_rx_pkts += num_valid;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_common.h b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
index 2294f0a..05a52d2 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
@@ -44,9 +44,9 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 	rxq->rxrearm_nb = 0;
 	rxq->rxrearm_start = 0;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index 775400f..7156f05 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -133,29 +133,29 @@
 	errors = vorrq_u32(errors, vshrq_n_u32(is_tunnel, 1));
 	index = vorrq_u32(index, is_tunnel);
 
-	/* Update mbuf rearm_data for four packets. */
+	/* Update mbuf mbuf_rearm_data for four packets. */
 	GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[0]->rearm_data,
+	vst1q_u32((uint32_t *)&mbuf[0]->mbuf_rearm_data,
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 1, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[1]->rearm_data,
+	vst1q_u32((uint32_t *)&mbuf[1]->mbuf_rearm_data,
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 2, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[2]->rearm_data,
+	vst1q_u32((uint32_t *)&mbuf[2]->mbuf_rearm_data,
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 3, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[3]->rearm_data,
+	vst1q_u32((uint32_t *)&mbuf[3]->mbuf_rearm_data,
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 
-	/* Update mbuf rx_descriptor_fields1 for four packets. */
+	/* Update mbuf mbuf_rx_descriptor_fields1 for four packets. */
 	GET_DESC_FIELDS(mm_rxcmp[0], mm_rxcmp1[0], shuf_msk, ptype_idx, 0, tmp);
-	vst1q_u32((uint32_t *)&mbuf[0]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)&mbuf[0]->mbuf_rx_descriptor_fields1, tmp);
 	GET_DESC_FIELDS(mm_rxcmp[1], mm_rxcmp1[1], shuf_msk, ptype_idx, 1, tmp);
-	vst1q_u32((uint32_t *)&mbuf[1]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)&mbuf[1]->mbuf_rx_descriptor_fields1, tmp);
 	GET_DESC_FIELDS(mm_rxcmp[2], mm_rxcmp1[2], shuf_msk, ptype_idx, 2, tmp);
-	vst1q_u32((uint32_t *)&mbuf[2]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)&mbuf[2]->mbuf_rx_descriptor_fields1, tmp);
 	GET_DESC_FIELDS(mm_rxcmp[3], mm_rxcmp1[3], shuf_msk, ptype_idx, 3, tmp);
-	vst1q_u32((uint32_t *)&mbuf[3]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)&mbuf[3]->mbuf_rx_descriptor_fields1, tmp);
 }
 
 static uint16_t
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 8ef51ce..b4e6fa6 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -118,35 +118,35 @@
 	errors = _mm_or_si128(errors, _mm_srli_epi32(is_tunnel, 1));
 	index = _mm_or_si128(index, is_tunnel);
 
-	/* Update mbuf rearm_data for four packets. */
+	/* Update mbuf mbuf_rearm_data for four packets. */
 	GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
-	_mm_store_si128((void *)&mbuf[0]->rearm_data,
+	_mm_store_si128((void *)&mbuf[0]->mbuf_rearm_data,
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 1, ol_flags);
-	_mm_store_si128((void *)&mbuf[1]->rearm_data,
+	_mm_store_si128((void *)&mbuf[1]->mbuf_rearm_data,
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 2, ol_flags);
-	_mm_store_si128((void *)&mbuf[2]->rearm_data,
+	_mm_store_si128((void *)&mbuf[2]->mbuf_rearm_data,
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 3, ol_flags);
-	_mm_store_si128((void *)&mbuf[3]->rearm_data,
+	_mm_store_si128((void *)&mbuf[3]->mbuf_rearm_data,
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
-	/* Update mbuf rx_descriptor_fields1 for four packes. */
+	/* Update mbuf mbuf_rx_descriptor_fields1 for four packes. */
 	GET_DESC_FIELDS(mm_rxcmp[0], mm_rxcmp1[0], shuf_msk, ptype_idx, 0, t0);
-	_mm_store_si128((void *)&mbuf[0]->rx_descriptor_fields1, t0);
+	_mm_store_si128((void *)&mbuf[0]->mbuf_rx_descriptor_fields1, t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[1], mm_rxcmp1[1], shuf_msk, ptype_idx, 1, t0);
-	_mm_store_si128((void *)&mbuf[1]->rx_descriptor_fields1, t0);
+	_mm_store_si128((void *)&mbuf[1]->mbuf_rx_descriptor_fields1, t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[2], mm_rxcmp1[2], shuf_msk, ptype_idx, 2, t0);
-	_mm_store_si128((void *)&mbuf[2]->rx_descriptor_fields1, t0);
+	_mm_store_si128((void *)&mbuf[2]->mbuf_rx_descriptor_fields1, t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[3], mm_rxcmp1[3], shuf_msk, ptype_idx, 3, t0);
-	_mm_store_si128((void *)&mbuf[3]->rx_descriptor_fields1, t0);
+	_mm_store_si128((void *)&mbuf[3]->mbuf_rx_descriptor_fields1, t0);
 }
 
 static uint16_t
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 10/18] net/enic: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 09/18] net/bnxt: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 11/18] net/fm10k: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/enic/enic.h               |  2 +-
 drivers/net/enic/enic_main.c          |  4 ++--
 drivers/net/enic/enic_rxtx_vec_avx2.c | 22 +++++++++++-----------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 7877870..f2064ad 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -92,7 +92,7 @@ struct enic {
 	struct vnic_dev *vdev;
 
 	/*
-	 * mbuf_initializer contains 64 bits of mbuf rearm_data, used by
+	 * mbuf_initializer contains 64 bits of mbuf mbuf_rearm_data, used by
 	 * the avx2 handler at this time.
 	 */
 	uint64_t mbuf_initializer;
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index a6aaa76..923f92f 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -584,7 +584,7 @@ int enic_enable(struct enic *enic)
 
 		/*
 		 * mbuf_initializer contains const-after-init fields of
-		 * receive mbufs (i.e. 64 bits of fields from rearm_data).
+		 * receive mbufs (i.e. 64 bits of fields from mbuf_rearm_data).
 		 * It is currently used by the vectorized handler.
 		 */
 		mb_def.nb_segs = 1;
@@ -592,7 +592,7 @@ int enic_enable(struct enic *enic)
 		mb_def.port = enic->port_id;
 		rte_mbuf_refcnt_set(&mb_def, 1);
 		rte_compiler_barrier();
-		p = (uintptr_t)&mb_def.rearm_data;
+		p = (uintptr_t)&mb_def.mbuf_rearm_data;
 		enic->mbuf_initializer = *(uint64_t *)p;
 	}
 
diff --git a/drivers/net/enic/enic_rxtx_vec_avx2.c b/drivers/net/enic/enic_rxtx_vec_avx2.c
index 600efff..bd495d7 100644
--- a/drivers/net/enic/enic_rxtx_vec_avx2.c
+++ b/drivers/net/enic/enic_rxtx_vec_avx2.c
@@ -19,7 +19,7 @@
 {
 	bool tnl;
 
-	*(uint64_t *)&mb->rearm_data = enic->mbuf_initializer;
+	*(uint64_t *)&mb->mbuf_rearm_data = enic->mbuf_initializer;
 	mb->data_len = cqd->bytes_written_flags &
 		CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK;
 	mb->pkt_len = mb->data_len;
@@ -394,13 +394,13 @@
 	 * type_color               - 15  (unused)
 	 *
 	 * --- mbuf fields ---       offset
-	 * rearm_data              ---- 16
+	 * mbuf_rearm_data            ---- 16
 	 * data_off    - 0      (mbuf_init) -+
 	 * refcnt      - 2      (mbuf_init)  |
 	 * nb_segs     - 4      (mbuf_init)  | 16B 128b
 	 * port        - 6      (mbuf_init)  |
 	 * ol_flag     - 8      (from cqd)  -+
-	 * rx_descriptor_fields1   ---- 32
+	 * mbuf_rx_descriptor_fields1 ---- 32
 	 * packet_type - 0      (from cqd)  -+
 	 * pkt_len     - 4      (from cqd)   |
 	 * data_len    - 8      (from cqd)   | 16B 128b
@@ -737,14 +737,14 @@
 		 * vlan_tci    - 26     (from cqd)
 		 * rss         - 28     (from cqd)
 		 */
-		_mm256_storeu_si256((__m256i *)&rxmb[0]->rearm_data, rearm0);
-		_mm256_storeu_si256((__m256i *)&rxmb[1]->rearm_data, rearm1);
-		_mm256_storeu_si256((__m256i *)&rxmb[2]->rearm_data, rearm2);
-		_mm256_storeu_si256((__m256i *)&rxmb[3]->rearm_data, rearm3);
-		_mm256_storeu_si256((__m256i *)&rxmb[4]->rearm_data, rearm4);
-		_mm256_storeu_si256((__m256i *)&rxmb[5]->rearm_data, rearm5);
-		_mm256_storeu_si256((__m256i *)&rxmb[6]->rearm_data, rearm6);
-		_mm256_storeu_si256((__m256i *)&rxmb[7]->rearm_data, rearm7);
+		_mm256_storeu_si256((__m256i *)&rxmb[0]->mbuf_rearm_data, rearm0);
+		_mm256_storeu_si256((__m256i *)&rxmb[1]->mbuf_rearm_data, rearm1);
+		_mm256_storeu_si256((__m256i *)&rxmb[2]->mbuf_rearm_data, rearm2);
+		_mm256_storeu_si256((__m256i *)&rxmb[3]->mbuf_rearm_data, rearm3);
+		_mm256_storeu_si256((__m256i *)&rxmb[4]->mbuf_rearm_data, rearm4);
+		_mm256_storeu_si256((__m256i *)&rxmb[5]->mbuf_rearm_data, rearm5);
+		_mm256_storeu_si256((__m256i *)&rxmb[6]->mbuf_rearm_data, rearm6);
+		_mm256_storeu_si256((__m256i *)&rxmb[7]->mbuf_rearm_data, rearm7);
 
 		max_rx -= 8;
 		cqd += 8;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 11/18] net/fm10k: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 10/18] net/enic: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 12/18] net/hns3: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/fm10k/fm10k_rxtx_vec.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 2b6914b..6668420 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -237,9 +237,9 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 	return 0;
 }
@@ -290,9 +290,9 @@
 		/* Flush mbuf with pkt template.
 		 * Data to be rearmed is 6 bytes long.
 		 */
-		p0 = (uintptr_t)&mb0->rearm_data;
+		p0 = (uintptr_t)&mb0->mbuf_rearm_data;
 		*(uint64_t *)p0 = rxq->mbuf_initializer;
-		p1 = (uintptr_t)&mb1->rearm_data;
+		p1 = (uintptr_t)&mb1->mbuf_rearm_data;
 		*(uint64_t *)p1 = rxq->mbuf_initializer;
 
 		/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
@@ -428,13 +428,13 @@
 	 * here for completeness in case of future modifications.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
@@ -519,9 +519,9 @@
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+3]->mbuf_rx_descriptor_fields1,
 				pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+2]->mbuf_rx_descriptor_fields1,
 				pkt_mb3);
 
 		/* C* extract and record EOP bit */
@@ -557,9 +557,9 @@
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos+1]->mbuf_rx_descriptor_fields1,
 				pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[pos]->mbuf_rx_descriptor_fields1,
 				pkt_mb1);
 
 		fm10k_desc_to_pktype_v(descs0, &rx_pkts[pos]);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 12/18] net/hns3: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 11/18] net/fm10k: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-18  3:00     ` fengchengwen
  2024-02-15  6:21   ` [PATCH v4 13/18] net/ionic: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  18 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/hns3/hns3_rxtx_vec.c      | 22 +++++++++++-----------
 drivers/net/hns3/hns3_rxtx_vec_neon.h | 28 ++++++++++++++--------------
 drivers/net/hns3/hns3_rxtx_vec_sve.c  |  6 +++---
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c
index 9708ec6..4888b3d 100644
--- a/drivers/net/hns3/hns3_rxtx_vec.c
+++ b/drivers/net/hns3/hns3_rxtx_vec.c
@@ -121,27 +121,27 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* compile-time verifies the rearm_data first 8bytes */
+	/* compile-time verifies the mbuf_rearm_data first 8bytes */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) <
-			 offsetof(struct rte_mbuf, rearm_data));
+			 offsetof(struct rte_mbuf, mbuf_rearm_data));
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) <
-			 offsetof(struct rte_mbuf, rearm_data));
+			 offsetof(struct rte_mbuf, mbuf_rearm_data));
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) <
-			 offsetof(struct rte_mbuf, rearm_data));
+			 offsetof(struct rte_mbuf, mbuf_rearm_data));
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) <
-			 offsetof(struct rte_mbuf, rearm_data));
+			 offsetof(struct rte_mbuf, mbuf_rearm_data));
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
+			 offsetof(struct rte_mbuf, mbuf_rearm_data) > 6);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
+			 offsetof(struct rte_mbuf, mbuf_rearm_data) > 6);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
+			 offsetof(struct rte_mbuf, mbuf_rearm_data) > 6);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
+			 offsetof(struct rte_mbuf, mbuf_rearm_data) > 6);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 }
 
diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h
index 0dc6b9f..b1717ae 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_neon.h
+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h
@@ -104,7 +104,7 @@
 	for (i = 0; i < bd_vld_num; i++) {
 		pkt = sw_ring[i].mbuf;
 
-		/* init rte_mbuf.rearm_data last 64-bit */
+		/* init rte_mbuf.mbuf_rearm_data last 64-bit */
 		pkt->ol_flags = RTE_MBUF_F_RX_RSS_HASH;
 
 		l234_info = rxdp[i].rx.l234_info;
@@ -139,7 +139,7 @@
 	uint32_t pos;
 	int offset;
 
-	/* mask to shuffle from desc to mbuf's rx_descriptor_fields1 */
+	/* mask to shuffle from desc to mbuf's mbuf_rx_descriptor_fields1 */
 	uint8x16_t shuf_desc_fields_msk = {
 		0xff, 0xff, 0xff, 0xff,  /* packet type init zero */
 		20, 21, 0xff, 0xff,      /* rx.pkt_len to rte_mbuf.pkt_len */
@@ -158,11 +158,11 @@
 
 	/* compile-time verifies the shuffle mask */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash.rss) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	for (pos = 0; pos < nb_pkts; pos += HNS3_DEFAULT_DESCS_PER_LOOP,
 				     rxdp += HNS3_DEFAULT_DESCS_PER_LOOP) {
@@ -236,23 +236,23 @@
 		pkt_mb4 = vreinterpretq_u8_u16(tmp);
 
 		/* save packet info to rx_pkts mbuf */
-		vst1q_u8((void *)&sw_ring[pos + 0].mbuf->rx_descriptor_fields1,
+		vst1q_u8((void *)&sw_ring[pos + 0].mbuf->mbuf_rx_descriptor_fields1,
 			 pkt_mb1);
-		vst1q_u8((void *)&sw_ring[pos + 1].mbuf->rx_descriptor_fields1,
+		vst1q_u8((void *)&sw_ring[pos + 1].mbuf->mbuf_rx_descriptor_fields1,
 			 pkt_mb2);
-		vst1q_u8((void *)&sw_ring[pos + 2].mbuf->rx_descriptor_fields1,
+		vst1q_u8((void *)&sw_ring[pos + 2].mbuf->mbuf_rx_descriptor_fields1,
 			 pkt_mb3);
-		vst1q_u8((void *)&sw_ring[pos + 3].mbuf->rx_descriptor_fields1,
+		vst1q_u8((void *)&sw_ring[pos + 3].mbuf->mbuf_rx_descriptor_fields1,
 			 pkt_mb4);
 
-		/* store the first 8 bytes of packets mbuf's rearm_data */
-		*(uint64_t *)&sw_ring[pos + 0].mbuf->rearm_data =
+		/* store the first 8 bytes of packets mbuf's mbuf_rearm_data */
+		*(uint64_t *)&sw_ring[pos + 0].mbuf->mbuf_rearm_data =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 1].mbuf->rearm_data =
+		*(uint64_t *)&sw_ring[pos + 1].mbuf->mbuf_rearm_data =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 2].mbuf->rearm_data =
+		*(uint64_t *)&sw_ring[pos + 2].mbuf->mbuf_rearm_data =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 3].mbuf->rearm_data =
+		*(uint64_t *)&sw_ring[pos + 3].mbuf->mbuf_rearm_data =
 			rxq->mbuf_initializer;
 
 		rte_prefetch_non_temporal(rxdp + HNS3_DEFAULT_DESCS_PER_LOOP);
diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c
index 8aa4448..57aeca9 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_sve.c
+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c
@@ -33,7 +33,7 @@
 	int ret, i;
 
 	for (i = 0; i < (int)bd_vld_num; i++) {
-		/* init rte_mbuf.rearm_data last 64-bit */
+		/* init rte_mbuf.mbuf_rearm_data last 64-bit */
 		rx_pkts[i]->ol_flags = RTE_MBUF_F_RX_RSS_HASH;
 		rx_pkts[i]->hash.rss = rxdp[i].rx.rss_hash;
 		rx_pkts[i]->pkt_len = rte_le_to_cpu_16(rxdp[i].rx.pkt_len) -
@@ -123,9 +123,9 @@
 		mbuf_init = svdup_n_u64(rxq->mbuf_initializer);
 		/* save mbuf_initializer */
 		svst1_scatter_u64base_offset_u64(PG64_256BIT, mbp1st,
-			offsetof(struct rte_mbuf, rearm_data), mbuf_init);
+			offsetof(struct rte_mbuf, mbuf_rearm_data), mbuf_init);
 		svst1_scatter_u64base_offset_u64(PG64_256BIT, mbp2st,
-			offsetof(struct rte_mbuf, rearm_data), mbuf_init);
+			offsetof(struct rte_mbuf, mbuf_rearm_data), mbuf_init);
 
 		next_rxdp = rxdp + HNS3_SVE_DEFAULT_DESCS_PER_LOOP;
 		rte_prefetch_non_temporal(next_rxdp);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 13/18] net/ionic: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 12/18] net/hns3: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 14/18] net/thunderx: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ionic/ionic_lif.c         | 8 ++++----
 drivers/net/ionic/ionic_rxtx_sg.c     | 4 ++--
 drivers/net/ionic/ionic_rxtx_simple.c | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index 25b490d..6497d43 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -725,8 +725,8 @@
 
 	rte_compiler_barrier();
 
-	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(rxm.mbuf_rearm_data) != sizeof(uint64_t));
+	return *(uint64_t *)&rxm.mbuf_rearm_data[0];
 }
 
 static uint64_t
@@ -743,8 +743,8 @@
 
 	rte_compiler_barrier();
 
-	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	RTE_BUILD_BUG_ON(sizeof(rxm.mbuf_rearm_data) != sizeof(uint64_t));
+	return *(uint64_t *)&rxm.mbuf_rearm_data[0];
 }
 
 int
diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c
index ab8e56e..b12a257 100644
--- a/drivers/net/ionic/ionic_rxtx_sg.c
+++ b/drivers/net/ionic/ionic_rxtx_sg.c
@@ -285,7 +285,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	*(uint64_t *)&rxm->mbuf_rearm_data[0] = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc_len);
 	left = cq_desc_len - rxm->data_len;
@@ -298,7 +298,7 @@
 		info[i] = NULL;
 
 		/* Set the chained mbuf metadata */
-		rxm_seg->rearm_data[0] = rxq->rearm_seg_data;
+		*(uint64_t *)&rxm_seg->mbuf_rearm_data[0] = rxq->rearm_seg_data;
 		rxm_seg->data_len = RTE_MIN(rxq->seg_size, left);
 		left -= rxm_seg->data_len;
 
diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c
index 5f81856..37b51a6 100644
--- a/drivers/net/ionic/ionic_rxtx_simple.c
+++ b/drivers/net/ionic/ionic_rxtx_simple.c
@@ -256,7 +256,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	*(uint64_t *)&rxm->mbuf_rearm_data[0] = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = cq_desc_len;
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 14/18] net/thunderx: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 13/18] net/ionic: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 15/18] net/virtio: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/thunderx/nicvf_ethdev.c | 4 ++--
 drivers/net/thunderx/nicvf_rxtx.h   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index a504d41..4dd5577 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1323,9 +1323,9 @@ enum nicvf_link_speed {
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* Prevent compiler reordering: rearm_data covers previous fields */
+	/* Prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer.value = *(uint64_t *)p;
 }
 
diff --git a/drivers/net/thunderx/nicvf_rxtx.h b/drivers/net/thunderx/nicvf_rxtx.h
index 4b83e33..67bc701 100644
--- a/drivers/net/thunderx/nicvf_rxtx.h
+++ b/drivers/net/thunderx/nicvf_rxtx.h
@@ -66,7 +66,7 @@ static inline uint16_t __attribute__((const))
 #else
 	init.value += apad;
 #endif
-	*(uint64_t *)(&pkt->rearm_data) = init.value;
+	*(uint64_t *)(&pkt->mbuf_rearm_data) = init.value;
 }
 
 static inline void
@@ -80,7 +80,7 @@ static inline uint16_t __attribute__((const))
 	init.value += apad;
 #endif
 	init.fields.nb_segs = nb_segs;
-	*(uint64_t *)(&pkt->rearm_data) = init.value;
+	*(uint64_t *)(&pkt->mbuf_rearm_data) = init.value;
 }
 
 uint32_t nicvf_dev_rx_queue_count(void *rx_queue);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 15/18] net/virtio: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 14/18] net/thunderx: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 16/18] net/cnxk: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/virtio/virtio_rxtx_packed.h         |  4 ++--
 drivers/net/virtio/virtio_rxtx_packed_avx.h     | 14 +++++++-------
 drivers/net/virtio/virtio_rxtx_packed_neon.h    | 18 +++++++++---------
 drivers/net/virtio/virtio_rxtx_simple.c         |  4 ++--
 drivers/net/virtio/virtio_rxtx_simple.h         |  2 +-
 drivers/net/virtio/virtio_rxtx_simple_altivec.c | 16 ++++++++--------
 drivers/net/virtio/virtio_rxtx_simple_neon.c    | 16 ++++++++--------
 drivers/net/virtio/virtio_rxtx_simple_sse.c     | 16 ++++++++--------
 8 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx_packed.h b/drivers/net/virtio/virtio_rxtx_packed.h
index 5361129..5bd6966 100644
--- a/drivers/net/virtio/virtio_rxtx_packed.h
+++ b/drivers/net/virtio/virtio_rxtx_packed.h
@@ -37,12 +37,12 @@
 
 /* reference count offset in mbuf rearm data */
 #define REFCNT_BITS_OFFSET ((offsetof(struct rte_mbuf, refcnt) - \
-	offsetof(struct rte_mbuf, rearm_data)) * BYTE_SIZE)
+	offsetof(struct rte_mbuf, mbuf_rearm_data)) * BYTE_SIZE)
 
 #ifdef CC_AVX512_SUPPORT
 /* segment number offset in mbuf rearm data */
 #define SEG_NUM_BITS_OFFSET ((offsetof(struct rte_mbuf, nb_segs) - \
-	offsetof(struct rte_mbuf, rearm_data)) * BYTE_SIZE)
+	offsetof(struct rte_mbuf, mbuf_rearm_data)) * BYTE_SIZE)
 /* default rearm data */
 #define DEFAULT_REARM_DATA (1ULL << SEG_NUM_BITS_OFFSET | \
 	1ULL << REFCNT_BITS_OFFSET)
diff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.h b/drivers/net/virtio/virtio_rxtx_packed_avx.h
index 584ac72..8780e8e 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_avx.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h
@@ -36,10 +36,10 @@
 	/* Load four mbufs rearm data */
 	RTE_BUILD_BUG_ON(REFCNT_BITS_OFFSET >= 64);
 	RTE_BUILD_BUG_ON(SEG_NUM_BITS_OFFSET >= 64);
-	__m256i mbufs = _mm256_set_epi64x(*tx_pkts[3]->rearm_data,
-					  *tx_pkts[2]->rearm_data,
-					  *tx_pkts[1]->rearm_data,
-					  *tx_pkts[0]->rearm_data);
+	__m256i mbufs = _mm256_set_epi64x(*(uint64_t *)tx_pkts[3]->mbuf_rearm_data,
+					  *(uint64_t *)tx_pkts[2]->mbuf_rearm_data,
+					  *(uint64_t *)tx_pkts[1]->mbuf_rearm_data,
+					  *(uint64_t *)tx_pkts[0]->mbuf_rearm_data);
 
 	/* refcnt=1 and nb_segs=1 */
 	__m256i mbuf_ref = _mm256_set1_epi64x(DEFAULT_REARM_DATA);
@@ -54,7 +54,7 @@
 	/* Check headroom is enough */
 	const __mmask16 data_mask = 0x1 | 0x1 << 4 | 0x1 << 8 | 0x1 << 12;
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) !=
-		offsetof(struct rte_mbuf, rearm_data));
+		offsetof(struct rte_mbuf, mbuf_rearm_data));
 	cmp = _mm256_mask_cmplt_epu16_mask(data_mask, mbufs, head_rooms);
 	if (unlikely(cmp))
 		return -1;
@@ -187,7 +187,7 @@
 		rx_pkts[i] = (struct rte_mbuf *)vq->vq_descx[id + i].cookie;
 		rte_packet_prefetch(rte_pktmbuf_mtod(rx_pkts[i], void *));
 
-		addrs[i] = (uintptr_t)rx_pkts[i]->rx_descriptor_fields1;
+		addrs[i] = (uintptr_t)rx_pkts[i]->mbuf_rx_descriptor_fields1;
 	}
 
 	/*
@@ -205,7 +205,7 @@
 
 	/* assert offset of data_len */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-		offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+		offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 
 	__m512i v_index = _mm512_set_epi64(addrs[3] + 8, addrs[3],
 					   addrs[2] + 8, addrs[2],
diff --git a/drivers/net/virtio/virtio_rxtx_packed_neon.h b/drivers/net/virtio/virtio_rxtx_packed_neon.h
index c222ebf..2432d0a 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_neon.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_neon.h
@@ -59,10 +59,10 @@
 	uint8x16x2_t mbuf;
 	/* Load four mbufs rearm data. */
 	RTE_BUILD_BUG_ON(REFCNT_BITS_OFFSET >= 64);
-	pkts[0] = vld1_u16((uint16_t *)&tx_pkts[0]->rearm_data);
-	pkts[1] = vld1_u16((uint16_t *)&tx_pkts[1]->rearm_data);
-	pkts[2] = vld1_u16((uint16_t *)&tx_pkts[2]->rearm_data);
-	pkts[3] = vld1_u16((uint16_t *)&tx_pkts[3]->rearm_data);
+	pkts[0] = vld1_u16((uint16_t *)&tx_pkts[0]->mbuf_rearm_data);
+	pkts[1] = vld1_u16((uint16_t *)&tx_pkts[1]->mbuf_rearm_data);
+	pkts[2] = vld1_u16((uint16_t *)&tx_pkts[2]->mbuf_rearm_data);
+	pkts[3] = vld1_u16((uint16_t *)&tx_pkts[3]->mbuf_rearm_data);
 
 	mbuf.val[0] = vreinterpretq_u8_u16(vcombine_u16(pkts[0], pkts[1]));
 	mbuf.val[1] = vreinterpretq_u8_u16(vcombine_u16(pkts[2], pkts[3]));
@@ -78,7 +78,7 @@
 	/* Check headroom is enough. */
 	uint16x4_t head_rooms = vdup_n_u16(head_size);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) !=
-			 offsetof(struct rte_mbuf, rearm_data));
+			 offsetof(struct rte_mbuf, mbuf_rearm_data));
 	uint16x4_t data_offset = vreinterpret_u16_u8(vqtbl2_u8(mbuf, data_msk));
 	uint64x1_t cmp2 = vreinterpret_u64_u16(vclt_u16(data_offset, head_rooms));
 	if (unlikely(vget_lane_u64(cmp2, 0)))
@@ -263,10 +263,10 @@
 	pkt_mb[3] = vreinterpretq_u64_u16(vsubq_u16(
 			vreinterpretq_u16_u64(pkt_mb[3]), len_adjust));
 
-	vst1q_u64((void *)&rx_pkts[0]->rx_descriptor_fields1, pkt_mb[0]);
-	vst1q_u64((void *)&rx_pkts[1]->rx_descriptor_fields1, pkt_mb[1]);
-	vst1q_u64((void *)&rx_pkts[2]->rx_descriptor_fields1, pkt_mb[2]);
-	vst1q_u64((void *)&rx_pkts[3]->rx_descriptor_fields1, pkt_mb[3]);
+	vst1q_u64((void *)&rx_pkts[0]->mbuf_rx_descriptor_fields1, pkt_mb[0]);
+	vst1q_u64((void *)&rx_pkts[1]->mbuf_rx_descriptor_fields1, pkt_mb[1]);
+	vst1q_u64((void *)&rx_pkts[2]->mbuf_rx_descriptor_fields1, pkt_mb[2]);
+	vst1q_u64((void *)&rx_pkts[3]->mbuf_rx_descriptor_fields1, pkt_mb[3]);
 
 	if (hw->has_rx_offload) {
 		virtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index 4382569..26b712b 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -39,9 +39,9 @@
 	mb_def.port = vq->hw->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 
 	return 0;
diff --git a/drivers/net/virtio/virtio_rxtx_simple.h b/drivers/net/virtio/virtio_rxtx_simple.h
index 79196ed..d00e51d 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.h
+++ b/drivers/net/virtio/virtio_rxtx_simple.h
@@ -41,7 +41,7 @@
 	for (i = 0; i < RTE_VIRTIO_VPMD_RX_REARM_THRESH; i++) {
 		uintptr_t p;
 
-		p = (uintptr_t)&sw_ring[i]->rearm_data;
+		p = (uintptr_t)&sw_ring[i]->mbuf_rearm_data;
 		*(uint64_t *)p = rxvq->mbuf_initializer;
 
 		start_dp[i].addr = VIRTIO_MBUF_ADDR(sw_ring[i], vq) +
diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
index 542ec3d..70c82d0 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
@@ -138,9 +138,9 @@
 			((__vector unsigned short)pkt_mb[0] + len_adjust);
 		pkt_mb[1] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[1] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[0]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)&rx_pkts[0]->mbuf_rx_descriptor_fields1 =
 			pkt_mb[0];
-		*(__vector unsigned char *)&rx_pkts[1]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)&rx_pkts[1]->mbuf_rx_descriptor_fields1 =
 			pkt_mb[1];
 
 		pkt_mb[2] = vec_perm(desc[1], zero, shuf_msk1);
@@ -149,9 +149,9 @@
 			((__vector unsigned short)pkt_mb[2] + len_adjust);
 		pkt_mb[3] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[3] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[2]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)&rx_pkts[2]->mbuf_rx_descriptor_fields1 =
 			pkt_mb[2];
-		*(__vector unsigned char *)&rx_pkts[3]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)&rx_pkts[3]->mbuf_rx_descriptor_fields1 =
 			pkt_mb[3];
 
 		pkt_mb[4] = vec_perm(desc[2], zero, shuf_msk1);
@@ -160,9 +160,9 @@
 			((__vector unsigned short)pkt_mb[4] + len_adjust);
 		pkt_mb[5] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[5] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[4]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)&rx_pkts[4]->mbuf_rx_descriptor_fields1 =
 			pkt_mb[4];
-		*(__vector unsigned char *)&rx_pkts[5]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)&rx_pkts[5]->mbuf_rx_descriptor_fields1 =
 			pkt_mb[5];
 
 		pkt_mb[6] = vec_perm(desc[3], zero, shuf_msk1);
@@ -171,9 +171,9 @@
 			((__vector unsigned short)pkt_mb[6] + len_adjust);
 		pkt_mb[7] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[7] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[6]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)&rx_pkts[6]->mbuf_rx_descriptor_fields1 =
 			pkt_mb[6];
-		*(__vector unsigned char *)&rx_pkts[7]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)&rx_pkts[7]->mbuf_rx_descriptor_fields1 =
 			pkt_mb[7];
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c
index 7139b31..5b8bd67 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_neon.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c
@@ -138,9 +138,9 @@
 				vreinterpretq_u16_u64(pkt_mb[1]), len_adjust));
 		pkt_mb[0] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[0]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[1]->rx_descriptor_fields1,
+		vst1q_u64((void *)&rx_pkts[1]->mbuf_rx_descriptor_fields1,
 			pkt_mb[1]);
-		vst1q_u64((void *)&rx_pkts[0]->rx_descriptor_fields1,
+		vst1q_u64((void *)&rx_pkts[0]->mbuf_rx_descriptor_fields1,
 			pkt_mb[0]);
 
 		pkt_mb[3] = vreinterpretq_u64_u8(vqtbl1q_u8(
@@ -151,9 +151,9 @@
 				vreinterpretq_u16_u64(pkt_mb[3]), len_adjust));
 		pkt_mb[2] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[2]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[3]->rx_descriptor_fields1,
+		vst1q_u64((void *)&rx_pkts[3]->mbuf_rx_descriptor_fields1,
 			pkt_mb[3]);
-		vst1q_u64((void *)&rx_pkts[2]->rx_descriptor_fields1,
+		vst1q_u64((void *)&rx_pkts[2]->mbuf_rx_descriptor_fields1,
 			pkt_mb[2]);
 
 		pkt_mb[5] = vreinterpretq_u64_u8(vqtbl1q_u8(
@@ -164,9 +164,9 @@
 				vreinterpretq_u16_u64(pkt_mb[5]), len_adjust));
 		pkt_mb[4] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[4]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[5]->rx_descriptor_fields1,
+		vst1q_u64((void *)&rx_pkts[5]->mbuf_rx_descriptor_fields1,
 			pkt_mb[5]);
-		vst1q_u64((void *)&rx_pkts[4]->rx_descriptor_fields1,
+		vst1q_u64((void *)&rx_pkts[4]->mbuf_rx_descriptor_fields1,
 			pkt_mb[4]);
 
 		pkt_mb[7] = vreinterpretq_u64_u8(vqtbl1q_u8(
@@ -177,9 +177,9 @@
 				vreinterpretq_u16_u64(pkt_mb[7]), len_adjust));
 		pkt_mb[6] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[6]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[7]->rx_descriptor_fields1,
+		vst1q_u64((void *)&rx_pkts[7]->mbuf_rx_descriptor_fields1,
 			pkt_mb[7]);
-		vst1q_u64((void *)&rx_pkts[6]->rx_descriptor_fields1,
+		vst1q_u64((void *)&rx_pkts[6]->mbuf_rx_descriptor_fields1,
 			pkt_mb[6]);
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
diff --git a/drivers/net/virtio/virtio_rxtx_simple_sse.c b/drivers/net/virtio/virtio_rxtx_simple_sse.c
index 6a18741..009c02d 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_sse.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_sse.c
@@ -134,36 +134,36 @@
 		pkt_mb[0] = _mm_shuffle_epi8(desc[0], shuf_msk1);
 		pkt_mb[1] = _mm_add_epi16(pkt_mb[1], len_adjust);
 		pkt_mb[0] = _mm_add_epi16(pkt_mb[0], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[1]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[1]->mbuf_rx_descriptor_fields1,
 			pkt_mb[1]);
-		_mm_storeu_si128((void *)&rx_pkts[0]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[0]->mbuf_rx_descriptor_fields1,
 			pkt_mb[0]);
 
 		pkt_mb[3] = _mm_shuffle_epi8(desc[1], shuf_msk2);
 		pkt_mb[2] = _mm_shuffle_epi8(desc[1], shuf_msk1);
 		pkt_mb[3] = _mm_add_epi16(pkt_mb[3], len_adjust);
 		pkt_mb[2] = _mm_add_epi16(pkt_mb[2], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[3]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[3]->mbuf_rx_descriptor_fields1,
 			pkt_mb[3]);
-		_mm_storeu_si128((void *)&rx_pkts[2]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[2]->mbuf_rx_descriptor_fields1,
 			pkt_mb[2]);
 
 		pkt_mb[5] = _mm_shuffle_epi8(desc[2], shuf_msk2);
 		pkt_mb[4] = _mm_shuffle_epi8(desc[2], shuf_msk1);
 		pkt_mb[5] = _mm_add_epi16(pkt_mb[5], len_adjust);
 		pkt_mb[4] = _mm_add_epi16(pkt_mb[4], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[5]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[5]->mbuf_rx_descriptor_fields1,
 			pkt_mb[5]);
-		_mm_storeu_si128((void *)&rx_pkts[4]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[4]->mbuf_rx_descriptor_fields1,
 			pkt_mb[4]);
 
 		pkt_mb[7] = _mm_shuffle_epi8(desc[3], shuf_msk2);
 		pkt_mb[6] = _mm_shuffle_epi8(desc[3], shuf_msk1);
 		pkt_mb[7] = _mm_add_epi16(pkt_mb[7], len_adjust);
 		pkt_mb[6] = _mm_add_epi16(pkt_mb[6], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[7]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[7]->mbuf_rx_descriptor_fields1,
 			pkt_mb[7]);
-		_mm_storeu_si128((void *)&rx_pkts[6]->rx_descriptor_fields1,
+		_mm_storeu_si128((void *)&rx_pkts[6]->mbuf_rx_descriptor_fields1,
 			pkt_mb[6]);
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 16/18] net/cnxk: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 15/18] net/virtio: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 17/18] common/idpf: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/cnxk/cn10k_rx.h    | 50 +++++++++++++++++++++---------------------
 drivers/net/cnxk/cn9k_rx.h     | 34 ++++++++++++++--------------
 drivers/net/cnxk/cnxk_ethdev.c |  4 ++--
 3 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/net/cnxk/cn10k_rx.h b/drivers/net/cnxk/cn10k_rx.h
index 7bb4c86..51333b0 100644
--- a/drivers/net/cnxk/cn10k_rx.h
+++ b/drivers/net/cnxk/cn10k_rx.h
@@ -309,7 +309,7 @@
 		frag_rx = (union nix_rx_parse_u *)(wqe + 1);
 		frag_size = rlen + frag_rx->lcptr - frag_rx->laptr;
 
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init;
+		*(uint64_t *)(&mbuf->mbuf_rearm_data) = mbuf_init;
 		mbuf->data_len = frag_size;
 		mbuf->pkt_len = frag_size;
 		mbuf->ol_flags = ol_flags;
@@ -368,7 +368,7 @@
 	fsz_w1 >>= 16;
 
 	data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-	*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+	*(uint64_t *)(&mbuf->mbuf_rearm_data) = mbuf_init | data_off;
 	mbuf->data_len = frag_size;
 
 	/* Mark frag as get */
@@ -384,7 +384,7 @@
 		fsz_w1 >>= 16;
 
 		data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+		*(uint64_t *)(&mbuf->mbuf_rearm_data) = mbuf_init | data_off;
 		mbuf->data_len = frag_size;
 
 		/* Mark frag as get */
@@ -401,7 +401,7 @@
 		fsz_w1 >>= 16;
 
 		data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+		*(uint64_t *)(&mbuf->mbuf_rearm_data) = mbuf_init | data_off;
 		mbuf->data_len = frag_size;
 
 		/* Mark frag as get */
@@ -502,7 +502,7 @@
 
 	inner->pkt_len = len;
 	inner->data_len = len;
-	*(uint64_t *)(&inner->rearm_data) = mbuf_init;
+	*(uint64_t *)(&inner->mbuf_rearm_data) = mbuf_init;
 
 	inner->ol_flags = ((CPT_COMP_HWGOOD_MASK & (1U << ucc)) ?
 			   RTE_MBUF_F_RX_SEC_OFFLOAD :
@@ -584,7 +584,7 @@
 			/* First frag len */
 			inner->pkt_len = vgetq_lane_u16(*rx_desc_field1, 2);
 			inner->data_len = vgetq_lane_u16(*rx_desc_field1, 4);
-			p = (uintptr_t)&inner->rearm_data;
+			p = (uintptr_t)&inner->mbuf_rearm_data;
 			*(uint64_t *)p = mbuf_init;
 
 			/* Reassembly success */
@@ -774,7 +774,7 @@
 
 		mbuf->data_len = sg_len;
 		sg = sg >> 16;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)&mbuf->mbuf_rearm_data;
 		*(uint64_t *)p = rearm & ~0xFFFF;
 		nb_segs--;
 		iova_list++;
@@ -825,7 +825,7 @@
 			head->nb_segs = nb_segs;
 		}
 		mbuf = next_frag;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)&mbuf->mbuf_rearm_data;
 		*(uint64_t *)p = rearm + ldptr;
 		mbuf->data_len = (sg & 0xFFFF) - ldptr -
 				 (flags & NIX_RX_OFFLOAD_TSTAMP_F ?
@@ -849,7 +849,7 @@
 
 
 		len = mbuf->pkt_len;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)&mbuf->mbuf_rearm_data;
 		*(uint64_t *)p = rearm;
 		mbuf->data_len = (sg & 0xFFFF) -
 				 (flags & NIX_RX_OFFLOAD_TSTAMP_F ?
@@ -917,7 +917,7 @@
 		mbuf->ol_flags = ol_flags;
 		mbuf->pkt_len = len;
 		mbuf->data_len = len;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)&mbuf->mbuf_rearm_data;
 		*(uint64_t *)p = val;
 	}
 
@@ -1464,7 +1464,7 @@
 				0,    1,    /* octet 1~0, 16 bits data_len */
 				0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
 
-			/* Form the rx_descriptor_fields1 with pkt_len and data_len */
+			/* Form the mbuf_rx_descriptor_fields1 with pkt_len and data_len */
 			f0 = vqtbl1q_u8(cq0_w8, shuf_msk);
 			f1 = vqtbl1q_u8(cq1_w8, shuf_msk);
 			f2 = vqtbl1q_u8(cq2_w8, shuf_msk);
@@ -1512,7 +1512,7 @@
 		}
 
 		if (flags & NIX_RX_OFFLOAD_RSS_F) {
-			/* Fill rss in the rx_descriptor_fields1 */
+			/* Fill rss in the mbuf_rx_descriptor_fields1 */
 			f0 = vsetq_lane_u32(cq0_w0, f0, 3);
 			f1 = vsetq_lane_u32(cq1_w0, f1, 3);
 			f2 = vsetq_lane_u32(cq2_w0, f2, 3);
@@ -1529,7 +1529,7 @@
 		}
 
 		if (flags & NIX_RX_OFFLOAD_PTYPE_F) {
-			/* Fill packet_type in the rx_descriptor_fields1 */
+			/* Fill packet_type in the mbuf_rx_descriptor_fields1 */
 			f0 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq0_w1),
 					    f0, 0);
 			f1 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq1_w1),
@@ -1959,23 +1959,23 @@
 			}
 		}
 
-		/* Form rearm_data with ol_flags */
+		/* Form mbuf_rearm_data with ol_flags */
 		rearm0 = vsetq_lane_u64(ol_flags0, rearm0, 1);
 		rearm1 = vsetq_lane_u64(ol_flags1, rearm1, 1);
 		rearm2 = vsetq_lane_u64(ol_flags2, rearm2, 1);
 		rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
 
-		/* Update rx_descriptor_fields1 */
-		vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
-		vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
-		vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
-		vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
-
-		/* Update rearm_data */
-		vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
-		vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
-		vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
-		vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
+		/* Update mbuf_rx_descriptor_fields1 */
+		vst1q_u64((uint64_t *)mbuf0->mbuf_rx_descriptor_fields1, f0);
+		vst1q_u64((uint64_t *)mbuf1->mbuf_rx_descriptor_fields1, f1);
+		vst1q_u64((uint64_t *)mbuf2->mbuf_rx_descriptor_fields1, f2);
+		vst1q_u64((uint64_t *)mbuf3->mbuf_rx_descriptor_fields1, f3);
+
+		/* Update mbuf_rearm_data */
+		vst1q_u64((uint64_t *)mbuf0->mbuf_rearm_data, rearm0);
+		vst1q_u64((uint64_t *)mbuf1->mbuf_rearm_data, rearm1);
+		vst1q_u64((uint64_t *)mbuf2->mbuf_rearm_data, rearm2);
+		vst1q_u64((uint64_t *)mbuf3->mbuf_rearm_data, rearm3);
 
 		if (flags & NIX_RX_MULTI_SEG_F) {
 			/* Multi segment is enable build mseg list for
diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h
index d8bb65c..1256640 100644
--- a/drivers/net/cnxk/cn9k_rx.h
+++ b/drivers/net/cnxk/cn9k_rx.h
@@ -155,7 +155,7 @@
 
 		mbuf->data_len = sg & 0xFFFF;
 		sg = sg >> 16;
-		*(uint64_t *)(&mbuf->rearm_data) = rearm;
+		*(uint64_t *)(&mbuf->mbuf_rearm_data) = rearm;
 		nb_segs--;
 		iova_list++;
 
@@ -398,7 +398,7 @@
 			nix_update_match_id(rx->cn9k.match_id, ol_flags, mbuf);
 
 	mbuf->ol_flags = ol_flags;
-	*(uint64_t *)(&mbuf->rearm_data) = val;
+	*(uint64_t *)(&mbuf->mbuf_rearm_data) = val;
 	mbuf->pkt_len = len;
 	mbuf->data_len = len;
 
@@ -615,7 +615,7 @@
 			0,    1,    /* octet 1~0, 16 bits data_len */
 			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
 
-		/* Form the rx_descriptor_fields1 with pkt_len and data_len */
+		/* Form the mbuf_rx_descriptor_fields1 with pkt_len and data_len */
 		f0 = vqtbl1q_u8(cq0_w8, shuf_msk);
 		f1 = vqtbl1q_u8(cq1_w8, shuf_msk);
 		f2 = vqtbl1q_u8(cq2_w8, shuf_msk);
@@ -632,7 +632,7 @@
 		uint64_t cq3_w1 = ((uint64_t *)(cq0 + CQE_SZ(3)))[1];
 
 		if (flags & NIX_RX_OFFLOAD_RSS_F) {
-			/* Fill rss in the rx_descriptor_fields1 */
+			/* Fill rss in the mbuf_rx_descriptor_fields1 */
 			f0 = vsetq_lane_u32(cq0_w0, f0, 3);
 			f1 = vsetq_lane_u32(cq1_w0, f1, 3);
 			f2 = vsetq_lane_u32(cq2_w0, f2, 3);
@@ -649,7 +649,7 @@
 		}
 
 		if (flags & NIX_RX_OFFLOAD_PTYPE_F) {
-			/* Fill packet_type in the rx_descriptor_fields1 */
+			/* Fill packet_type in the mbuf_rx_descriptor_fields1 */
 			f0 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq0_w1),
 					    f0, 0);
 			f1 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq1_w1),
@@ -792,23 +792,23 @@
 			}
 		}
 
-		/* Form rearm_data with ol_flags */
+		/* Form mbuf_rearm_data with ol_flags */
 		rearm0 = vsetq_lane_u64(ol_flags0, rearm0, 1);
 		rearm1 = vsetq_lane_u64(ol_flags1, rearm1, 1);
 		rearm2 = vsetq_lane_u64(ol_flags2, rearm2, 1);
 		rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
 
-		/* Update rx_descriptor_fields1 */
-		vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
-		vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
-		vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
-		vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
-
-		/* Update rearm_data */
-		vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
-		vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
-		vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
-		vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
+		/* Update mbuf_rx_descriptor_fields1 */
+		vst1q_u64((uint64_t *)mbuf0->mbuf_rx_descriptor_fields1, f0);
+		vst1q_u64((uint64_t *)mbuf1->mbuf_rx_descriptor_fields1, f1);
+		vst1q_u64((uint64_t *)mbuf2->mbuf_rx_descriptor_fields1, f2);
+		vst1q_u64((uint64_t *)mbuf3->mbuf_rx_descriptor_fields1, f3);
+
+		/* Update mbuf_rearm_data */
+		vst1q_u64((uint64_t *)mbuf0->mbuf_rearm_data, rearm0);
+		vst1q_u64((uint64_t *)mbuf1->mbuf_rearm_data, rearm1);
+		vst1q_u64((uint64_t *)mbuf2->mbuf_rearm_data, rearm2);
+		vst1q_u64((uint64_t *)mbuf3->mbuf_rearm_data, rearm3);
 
 		if (flags & NIX_RX_MULTI_SEG_F) {
 			/* Multi segment is enable build mseg list for
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 5e11bbb..4a02e35 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -435,9 +435,9 @@
 	mb_def.port = port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* Prevent compiler reordering: rearm_data covers previous fields */
+	/* Prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	tmp = (uint64_t *)&mb_def.rearm_data;
+	tmp = (uint64_t *)&mb_def.mbuf_rearm_data;
 
 	return *tmp;
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 17/18] common/idpf: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (15 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 16/18] net/cnxk: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  6:21   ` [PATCH v4 18/18] examples/dma: " Tyler Retzlaff
  2024-02-15  9:37   ` [PATCH v4 00/18] " Morten Brørup
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/idpf/idpf_common_rxtx.c        |  4 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c | 60 +++++++++++++--------------
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/common/idpf/idpf_common_rxtx.c b/drivers/common/idpf/idpf_common_rxtx.c
index 83b131e..06f1e9d 100644
--- a/drivers/common/idpf/idpf_common_rxtx.c
+++ b/drivers/common/idpf/idpf_common_rxtx.c
@@ -1603,9 +1603,9 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* prevent compiler reordering: rearm_data covers previous fields */
+	/* prevent compiler reordering: mbuf_rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
+	p = (uintptr_t)&mb_def.mbuf_rearm_data;
 	rxq->mbuf_initializer = *(uint64_t *)p;
 	return 0;
 }
diff --git a/drivers/common/idpf/idpf_common_rxtx_avx512.c b/drivers/common/idpf/idpf_common_rxtx_avx512.c
index f65e8d5..65c5bd1 100644
--- a/drivers/common/idpf/idpf_common_rxtx_avx512.c
+++ b/drivers/common/idpf/idpf_common_rxtx_avx512.c
@@ -313,13 +313,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	uint16_t i, received;
 
@@ -457,10 +457,10 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+				 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
+						    mbuf_rearm_data),
 						    16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
@@ -476,13 +476,13 @@
 		rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
 
 		rearm7 = _mm256_blend_epi32(mbuf_init, mb6_7, 0xF0);
@@ -491,13 +491,13 @@
 		rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
 
 		/* perform dd_check */
@@ -774,13 +774,13 @@
 	 * calls above.
 	 */
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 4);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 10);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
+			 offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1) + 12);
 
 	uint16_t i, received;
 
@@ -917,10 +917,10 @@
 		 */
 		/* check the structure matches expectations */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+				 offsetof(struct rte_mbuf, mbuf_rearm_data) + 8);
+		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, mbuf_rearm_data) !=
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
+						    mbuf_rearm_data),
 						    16));
 				/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
@@ -936,13 +936,13 @@
 		rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->mbuf_rearm_data,
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->mbuf_rearm_data,
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->mbuf_rearm_data,
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->mbuf_rearm_data,
 				    rearm0);
 
 		rearm7 = _mm256_blend_epi32(mbuf_init, mb6_7, 0xF0);
@@ -951,13 +951,13 @@
 		rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->mbuf_rearm_data,
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->mbuf_rearm_data,
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->mbuf_rearm_data,
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->mbuf_rearm_data,
 				    rearm1);
 
 		const __mmask8 dd_mask = _mm512_cmpeq_epi64_mask(
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v4 18/18] examples/dma: stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (16 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 17/18] common/idpf: " Tyler Retzlaff
@ 2024-02-15  6:21   ` Tyler Retzlaff
  2024-02-15  9:37   ` [PATCH v4 00/18] " Morten Brørup
  18 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-15  6:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update to reference newly named anonymous union markers supported by
standard C and stop referencing zero sized compiler extension markers.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 examples/dma/dmafwd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c
index f4a0bff..60313da 100644
--- a/examples/dma/dmafwd.c
+++ b/examples/dma/dmafwd.c
@@ -294,9 +294,9 @@ struct dma_bufs {
 pktmbuf_metadata_copy(const struct rte_mbuf *src, struct rte_mbuf *dst)
 {
 	dst->data_off = src->data_off;
-	memcpy(&dst->rx_descriptor_fields1, &src->rx_descriptor_fields1,
+	memcpy(&dst->mbuf_rx_descriptor_fields1, &src->mbuf_rx_descriptor_fields1,
 		offsetof(struct rte_mbuf, buf_len) -
-		offsetof(struct rte_mbuf, rx_descriptor_fields1));
+		offsetof(struct rte_mbuf, mbuf_rx_descriptor_fields1));
 }
 
 /* Copy packet data */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v4 00/18] stop using zero sized marker fields
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
                     ` (17 preceding siblings ...)
  2024-02-15  6:21   ` [PATCH v4 18/18] examples/dma: " Tyler Retzlaff
@ 2024-02-15  9:37   ` Morten Brørup
  18 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-02-15  9:37 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Thursday, 15 February 2024 07.21
> 
> The zero sized RTE_MARKER<n> typedefs are a GCC extension unsupported
> by
> MSVC. This series adds new fields and allows deprecation of the old.
> 
> Introduce new anonymous union fields with mbuf_ prefix for cacheline0,
> rearm_data, rx_descriptor_fields1, and cacheline1.
> 
> Remove in-tree use of the zero sized marker fields and adapt consuming
> code to use the new anonymous union fields.

Series-acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-15  6:21   ` [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
@ 2024-02-18  2:28     ` fengchengwen
  2024-02-18 12:39     ` Thomas Monjalon
  1 sibling, 0 replies; 171+ messages in thread
From: fengchengwen @ 2024-02-18  2:28 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

Some minor comments style may need adjust.

With above fixed,
Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2024/2/15 14:21, Tyler Retzlaff wrote:
> Provide a macro that allows conditional expansion of RTE_MARKER fields
> to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> we announce the fields to be __rte_deprecated (currently disabled).
> 
> Introduce C11 anonymous unions to permit aliasing of well-known
> offsets by name into the rte_mbuf structure by a *new* name and to
> provide padding for cache alignment.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

...

>  
> -	/* remaining bytes are set on RX when pulling packet from descriptor */
> -	RTE_MARKER rx_descriptor_fields1;
> +			uint64_t ol_flags;        /**< Offload features. */
>  
> -	/*
> -	 * The packet type, which is the combination of outer/inner L2, L3, L4
> -	 * and tunnel types. The packet_type is about data really present in the
> -	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
> -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> -	 * vlan is stripped from the data.
> -	 */
> -	union {
> -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
> -		__extension__
> -		struct {
> -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> -			uint8_t tun_type:4;  /**< Tunnel type. */
> +			/* remaining bytes are set on RX when pulling packet from descriptor */
> +			__rte_marker(RTE_MARKER, rx_descriptor_fields1);
>  			union {
> -				uint8_t inner_esp_next_proto;
> -				/**< ESP next protocol type, valid if
> -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> -				 * on both Tx and Rx.
> -				 */
> +				char mbuf_rx_descriptor_fields1[8];
>  				__extension__
>  				struct {
> -					uint8_t inner_l2_type:4;
> -					/**< Inner L2 type. */
> -					uint8_t inner_l3_type:4;
> -					/**< Inner L3 type. */
> +					/*
> +					 * The packet type, which is the combination of outer/inner
> +					 * L2, L3, L4 and tunnel types. The packet_type is about
> +					 * data really present in the mbuf. Example: if vlan
> +					 * stripping is enabled, a received vlan packet would have
> +					 * RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> +					 * vlan is stripped from the data.
> +					 */
> +					union {
> +						uint32_t packet_type;
> +						/**< L2/L3/L4 and tunnel information. */

According dpdk doxygen guidelines [1], prefer prefix comment in above case.

[1] https://doc.dpdk.org/guides/contributing/documentation.html#doxygen-guidelines

> +						__extension__
> +						struct {
> +							uint8_t l2_type:4;
> +							/**< (Outer) L2 type. */
> +							uint8_t l3_type:4;
> +							/**< (Outer) L3 type. */
> +							uint8_t l4_type:4;
> +							/**< (Outer) L4 type. */
> +							uint8_t tun_type:4;
> +							/**< Tunnel type. */
> +							union {
> +								uint8_t inner_esp_next_proto;
> +								/**< ESP next protocol type, valid
> +								 * if RTE_PTYPE_TUNNEL_ESP tunnel
> +								 * type is set on both Tx and Rx.
> +								 */
> +								__extension__
> +								struct {
> +									uint8_t inner_l2_type:4;
> +									/**< Inner L2 type. */
> +									uint8_t inner_l3_type:4;
> +									/**< Inner L3 type. */
> +								};
> +							};
> +							uint8_t inner_l4_type:4;
> +							/**< Inner L4 type. */
> +						};
> +					};
> +					uint32_t pkt_len;
> +					/**< Total pkt len: sum of all segments. */

The above should also use prefix comment type.

>  				};
>  			};
> -			uint8_t inner_l4_type:4; /**< Inner L4 type. */
> -		};
> -	};
>  

...

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 02/18] mbuf: stop using zero sized marker fields
  2024-02-15  6:21   ` [PATCH v4 02/18] mbuf: stop using zero sized marker fields Tyler Retzlaff
@ 2024-02-18  2:38     ` fengchengwen
  0 siblings, 0 replies; 171+ messages in thread
From: fengchengwen @ 2024-02-18  2:38 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2024/2/15 14:21, Tyler Retzlaff wrote:
> Update to reference newly named anonymous union markers supported by
> standard C and stop referencing zero sized compiler extension markers.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/mbuf/rte_mbuf.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> index 286b32b..963f713 100644
> --- a/lib/mbuf/rte_mbuf.h
> +++ b/lib/mbuf/rte_mbuf.h
> @@ -108,7 +108,7 @@
>  static inline void
>  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
>  {
> -	rte_prefetch0(&m->cacheline0);
> +	rte_prefetch0(&m->mbuf_cacheline0);
>  }
>  
>  /**
> @@ -126,7 +126,7 @@
>  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
>  {
>  #if RTE_CACHE_LINE_SIZE == 64
> -	rte_prefetch0(&m->cacheline1);
> +	rte_prefetch0(&m->mbuf_cacheline1);
>  #else
>  	RTE_SET_USED(m);
>  #endif
> 

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 12/18] net/hns3: stop using zero sized marker fields
  2024-02-15  6:21   ` [PATCH v4 12/18] net/hns3: " Tyler Retzlaff
@ 2024-02-18  3:00     ` fengchengwen
  0 siblings, 0 replies; 171+ messages in thread
From: fengchengwen @ 2024-02-18  3:00 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2024/2/15 14:21, Tyler Retzlaff wrote:
> Update to reference newly named anonymous union markers supported by
> standard C and stop referencing zero sized compiler extension markers.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

...

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-15  6:21   ` [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
  2024-02-18  2:28     ` fengchengwen
@ 2024-02-18 12:39     ` Thomas Monjalon
  2024-02-18 13:07       ` Morten Brørup
  2024-02-20 17:20       ` Tyler Retzlaff
  1 sibling, 2 replies; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-18 12:39 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

15/02/2024 07:21, Tyler Retzlaff:
> Provide a macro that allows conditional expansion of RTE_MARKER fields
> to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> we announce the fields to be __rte_deprecated (currently disabled).
> 
> Introduce C11 anonymous unions to permit aliasing of well-known
> offsets by name into the rte_mbuf structure by a *new* name and to
> provide padding for cache alignment.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  doc/guides/rel_notes/deprecation.rst |  20 ++
>  lib/eal/include/rte_common.h         |   6 +
>  lib/mbuf/rte_mbuf_core.h             | 375 +++++++++++++++++++----------------
>  3 files changed, 233 insertions(+), 168 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index 10630ba..8594255 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -17,6 +17,26 @@ Other API and ABI deprecation notices are to be posted below.
>  Deprecation Notices
>  -------------------
>  
> +* mbuf: Named zero sized fields of type ``RTE_MARKER`` and ``RTE_MARKER64``
> +  will be removed from ``struct rte_mbuf`` and replaced with new fields
> +  in anonymous unions.
> +
> +  The names of the fields impacted are:
> +
> +    old name                  new name
> +
> +  ``cacheline0``            ``mbuf_cachelin0``
> +  ``rearm_data``            ``mbuf_rearm_data``
> +  ``rx_descriptor_fields1`` ``mbuf_rx_descriptor_fields1``
> +  ``cacheline1``            ``mbuf_cachelin1``
> +
> +  Contributions to DPDK should immediately start using the new names,
> +  applications should adapt to new names as soon as possible as the
> +  old names will be removed in a future DPDK release.
> +
> +  Note: types of the new names are not API compatible with the old and
> +  some code conversion is required to maintain correct behavior.
> +
>  * build: The ``enable_kmods`` option is deprecated and will be removed in a future release.
>    Setting/clearing the option has no impact on the build.
>    Instead, kernel modules will be always built for OS's where out-of-tree kernel modules
> diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
> index d7d6390..af73f67 100644
> --- a/lib/eal/include/rte_common.h
> +++ b/lib/eal/include/rte_common.h
> @@ -582,6 +582,12 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
>  /** Marker for 8B alignment in a structure. */
>  __extension__ typedef uint64_t RTE_MARKER64[0];
>  
> +#define __rte_marker(type, name) type name /* __rte_deprecated */
> +
> +#else
> +
> +#define __rte_marker(type, name)
> +
>  #endif
>  
>  /*********** Macros for calculating min and max **********/
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 5688683..9e9590b 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -16,7 +16,10 @@
>   * New fields and flags should fit in the "dynamic space".
>   */
>  
> +#include <assert.h>
> +#include <stdalign.h>
>  #include <stdint.h>
> +#include <stddef.h>
>  
>  #include <rte_byteorder.h>
>  #include <rte_stdatomic.h>
> @@ -464,204 +467,240 @@ enum {
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
>  struct rte_mbuf {
> -	RTE_MARKER cacheline0;
> -
> -	void *buf_addr;           /**< Virtual address of segment buffer. */
> +	__rte_marker(RTE_MARKER, cacheline0);

You don't need to keep the first argument.
This would be simpler:
	__rte_marker(cacheline0);
You just need to create 2 functions: __rte_marker and __rte_marker64.

You should replace all occurrences of RTE_MARKER in DPDK in one patch,
and mark RTE_MARKER as deprecated (use #pragma GCC poison)

> +	union {
> +		char mbuf_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
> +		__extension__
> +		struct {
> +			void *buf_addr;           /**< Virtual address of segment buffer. 

I think it is ugly.

Changing mbuf API is a serious issue.



^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-18 12:39     ` Thomas Monjalon
@ 2024-02-18 13:07       ` Morten Brørup
  2024-02-18 15:22         ` Thomas Monjalon
  2024-02-20 17:20       ` Tyler Retzlaff
  1 sibling, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-02-18 13:07 UTC (permalink / raw)
  To: Thomas Monjalon, dev, Tyler Retzlaff
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Sunday, 18 February 2024 13.40
> 
> 15/02/2024 07:21, Tyler Retzlaff:
> > Provide a macro that allows conditional expansion of RTE_MARKER
> fields
> > to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> > we announce the fields to be __rte_deprecated (currently disabled).
> >
> > Introduce C11 anonymous unions to permit aliasing of well-known
> > offsets by name into the rte_mbuf structure by a *new* name and to
> > provide padding for cache alignment.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  doc/guides/rel_notes/deprecation.rst |  20 ++
> >  lib/eal/include/rte_common.h         |   6 +
> >  lib/mbuf/rte_mbuf_core.h             | 375 +++++++++++++++++++------
> ----------
> >  3 files changed, 233 insertions(+), 168 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/deprecation.rst
> b/doc/guides/rel_notes/deprecation.rst
> > index 10630ba..8594255 100644
> > --- a/doc/guides/rel_notes/deprecation.rst
> > +++ b/doc/guides/rel_notes/deprecation.rst
> > @@ -17,6 +17,26 @@ Other API and ABI deprecation notices are to be
> posted below.
> >  Deprecation Notices
> >  -------------------
> >
> > +* mbuf: Named zero sized fields of type ``RTE_MARKER`` and
> ``RTE_MARKER64``
> > +  will be removed from ``struct rte_mbuf`` and replaced with new
> fields
> > +  in anonymous unions.
> > +
> > +  The names of the fields impacted are:
> > +
> > +    old name                  new name
> > +
> > +  ``cacheline0``            ``mbuf_cachelin0``
> > +  ``rearm_data``            ``mbuf_rearm_data``
> > +  ``rx_descriptor_fields1`` ``mbuf_rx_descriptor_fields1``
> > +  ``cacheline1``            ``mbuf_cachelin1``
> > +
> > +  Contributions to DPDK should immediately start using the new
> names,
> > +  applications should adapt to new names as soon as possible as the
> > +  old names will be removed in a future DPDK release.
> > +
> > +  Note: types of the new names are not API compatible with the old
> and
> > +  some code conversion is required to maintain correct behavior.
> > +
> >  * build: The ``enable_kmods`` option is deprecated and will be
> removed in a future release.
> >    Setting/clearing the option has no impact on the build.
> >    Instead, kernel modules will be always built for OS's where out-
> of-tree kernel modules
> > diff --git a/lib/eal/include/rte_common.h
> b/lib/eal/include/rte_common.h
> > index d7d6390..af73f67 100644
> > --- a/lib/eal/include/rte_common.h
> > +++ b/lib/eal/include/rte_common.h
> > @@ -582,6 +582,12 @@ static void
> __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
> >  /** Marker for 8B alignment in a structure. */
> >  __extension__ typedef uint64_t RTE_MARKER64[0];
> >
> > +#define __rte_marker(type, name) type name /* __rte_deprecated */
> > +
> > +#else
> > +
> > +#define __rte_marker(type, name)
> > +
> >  #endif
> >
> >  /*********** Macros for calculating min and max **********/
> > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > index 5688683..9e9590b 100644
> > --- a/lib/mbuf/rte_mbuf_core.h
> > +++ b/lib/mbuf/rte_mbuf_core.h
> > @@ -16,7 +16,10 @@
> >   * New fields and flags should fit in the "dynamic space".
> >   */
> >
> > +#include <assert.h>
> > +#include <stdalign.h>
> >  #include <stdint.h>
> > +#include <stddef.h>
> >
> >  #include <rte_byteorder.h>
> >  #include <rte_stdatomic.h>
> > @@ -464,204 +467,240 @@ enum {
> >   * The generic rte_mbuf, containing a packet mbuf.
> >   */
> >  struct rte_mbuf {
> > -	RTE_MARKER cacheline0;
> > -
> > -	void *buf_addr;           /**< Virtual address of segment buffer.
> */
> > +	__rte_marker(RTE_MARKER, cacheline0);
> 
> You don't need to keep the first argument.
> This would be simpler:
> 	__rte_marker(cacheline0);
> You just need to create 2 functions: __rte_marker and __rte_marker64.
> 
> You should replace all occurrences of RTE_MARKER in DPDK in one patch,
> and mark RTE_MARKER as deprecated (use #pragma GCC poison)

I like this suggestion.
However, some applications might use RTE_MARKER in their own structures.
Wouldn't it be considered API breakage to mark RTE_MARKER as deprecated?

> 
> > +	union {
> > +		char mbuf_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
> > +		__extension__
> > +		struct {
> > +			void *buf_addr;           /**< Virtual address of
> segment buffer.
> 
> I think it is ugly.
> 
> Changing mbuf API is a serious issue.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-18 13:07       ` Morten Brørup
@ 2024-02-18 15:22         ` Thomas Monjalon
  2024-02-18 16:20           ` Morten Brørup
  2024-02-20 17:24           ` Tyler Retzlaff
  0 siblings, 2 replies; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-18 15:22 UTC (permalink / raw)
  To: dev, Tyler Retzlaff, Morten Brørup
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

18/02/2024 14:07, Morten Brørup:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 15/02/2024 07:21, Tyler Retzlaff:
> > > --- a/lib/eal/include/rte_common.h
> > > +++ b/lib/eal/include/rte_common.h
> > > @@ -582,6 +582,12 @@ static void
> > __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
> > >  /** Marker for 8B alignment in a structure. */
> > >  __extension__ typedef uint64_t RTE_MARKER64[0];
> > >
> > > +#define __rte_marker(type, name) type name /* __rte_deprecated */
> > > +
> > > +#else
> > > +
> > > +#define __rte_marker(type, name)
> > > +
> > >  #endif
> > >
> > >  /*********** Macros for calculating min and max **********/
> > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > > index 5688683..9e9590b 100644
> > > --- a/lib/mbuf/rte_mbuf_core.h
> > > +++ b/lib/mbuf/rte_mbuf_core.h
> > > @@ -16,7 +16,10 @@
> > >   * New fields and flags should fit in the "dynamic space".
> > >   */
> > >
> > > +#include <assert.h>
> > > +#include <stdalign.h>
> > >  #include <stdint.h>
> > > +#include <stddef.h>
> > >
> > >  #include <rte_byteorder.h>
> > >  #include <rte_stdatomic.h>
> > > @@ -464,204 +467,240 @@ enum {
> > >   * The generic rte_mbuf, containing a packet mbuf.
> > >   */
> > >  struct rte_mbuf {
> > > -	RTE_MARKER cacheline0;
> > > -
> > > -	void *buf_addr;           /**< Virtual address of segment buffer.
> > */
> > > +	__rte_marker(RTE_MARKER, cacheline0);
> > 
> > You don't need to keep the first argument.
> > This would be simpler:
> > 	__rte_marker(cacheline0);
> > You just need to create 2 functions: __rte_marker and __rte_marker64.
> > 
> > You should replace all occurrences of RTE_MARKER in DPDK in one patch,
> > and mark RTE_MARKER as deprecated (use #pragma GCC poison)
> 
> I like this suggestion.
> However, some applications might use RTE_MARKER in their own structures.
> Wouldn't it be considered API breakage to mark RTE_MARKER as deprecated?

Yes it is an API breakage.
Do we prefer waiting 24.11 for poisoning this macro?



^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-18 15:22         ` Thomas Monjalon
@ 2024-02-18 16:20           ` Morten Brørup
  2024-02-20 17:24           ` Tyler Retzlaff
  1 sibling, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-02-18 16:20 UTC (permalink / raw)
  To: Thomas Monjalon, dev, Tyler Retzlaff
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Sunday, 18 February 2024 16.22
> 
> 18/02/2024 14:07, Morten Brørup:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > 15/02/2024 07:21, Tyler Retzlaff:
> > > > --- a/lib/eal/include/rte_common.h
> > > > +++ b/lib/eal/include/rte_common.h
> > > > @@ -582,6 +582,12 @@ static void
> > > __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
> > > >  /** Marker for 8B alignment in a structure. */
> > > >  __extension__ typedef uint64_t RTE_MARKER64[0];
> > > >
> > > > +#define __rte_marker(type, name) type name /* __rte_deprecated
> */
> > > > +
> > > > +#else
> > > > +
> > > > +#define __rte_marker(type, name)
> > > > +
> > > >  #endif
> > > >
> > > >  /*********** Macros for calculating min and max **********/
> > > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > > > index 5688683..9e9590b 100644
> > > > --- a/lib/mbuf/rte_mbuf_core.h
> > > > +++ b/lib/mbuf/rte_mbuf_core.h
> > > > @@ -16,7 +16,10 @@
> > > >   * New fields and flags should fit in the "dynamic space".
> > > >   */
> > > >
> > > > +#include <assert.h>
> > > > +#include <stdalign.h>
> > > >  #include <stdint.h>
> > > > +#include <stddef.h>
> > > >
> > > >  #include <rte_byteorder.h>
> > > >  #include <rte_stdatomic.h>
> > > > @@ -464,204 +467,240 @@ enum {
> > > >   * The generic rte_mbuf, containing a packet mbuf.
> > > >   */
> > > >  struct rte_mbuf {
> > > > -	RTE_MARKER cacheline0;
> > > > -
> > > > -	void *buf_addr;           /**< Virtual address of segment
> buffer.
> > > */
> > > > +	__rte_marker(RTE_MARKER, cacheline0);
> > >
> > > You don't need to keep the first argument.
> > > This would be simpler:
> > > 	__rte_marker(cacheline0);
> > > You just need to create 2 functions: __rte_marker and
> __rte_marker64.
> > >
> > > You should replace all occurrences of RTE_MARKER in DPDK in one
> patch,
> > > and mark RTE_MARKER as deprecated (use #pragma GCC poison)
> >
> > I like this suggestion.
> > However, some applications might use RTE_MARKER in their own
> structures.
> > Wouldn't it be considered API breakage to mark RTE_MARKER as
> deprecated?
> 
> Yes it is an API breakage.
> Do we prefer waiting 24.11 for poisoning this macro?

Personally, I generally don't mind API breakages, assuming that they are visible and thus don't silently introduce bugs.
The distro people might have a different opinion.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-18 12:39     ` Thomas Monjalon
  2024-02-18 13:07       ` Morten Brørup
@ 2024-02-20 17:20       ` Tyler Retzlaff
  2024-02-20 17:53         ` Thomas Monjalon
  1 sibling, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-20 17:20 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Sun, Feb 18, 2024 at 01:39:52PM +0100, Thomas Monjalon wrote:
> 15/02/2024 07:21, Tyler Retzlaff:
> > Provide a macro that allows conditional expansion of RTE_MARKER fields
> > to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> > we announce the fields to be __rte_deprecated (currently disabled).
> > 
> > Introduce C11 anonymous unions to permit aliasing of well-known
> > offsets by name into the rte_mbuf structure by a *new* name and to
> > provide padding for cache alignment.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  doc/guides/rel_notes/deprecation.rst |  20 ++
> >  lib/eal/include/rte_common.h         |   6 +
> >  lib/mbuf/rte_mbuf_core.h             | 375 +++++++++++++++++++----------------
> >  3 files changed, 233 insertions(+), 168 deletions(-)
> > 
> > diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> > index 10630ba..8594255 100644
> > --- a/doc/guides/rel_notes/deprecation.rst
> > +++ b/doc/guides/rel_notes/deprecation.rst
> > @@ -17,6 +17,26 @@ Other API and ABI deprecation notices are to be posted below.
> >  Deprecation Notices
> >  -------------------
> >  
> > +* mbuf: Named zero sized fields of type ``RTE_MARKER`` and ``RTE_MARKER64``
> > +  will be removed from ``struct rte_mbuf`` and replaced with new fields
> > +  in anonymous unions.
> > +
> > +  The names of the fields impacted are:
> > +
> > +    old name                  new name
> > +
> > +  ``cacheline0``            ``mbuf_cachelin0``
> > +  ``rearm_data``            ``mbuf_rearm_data``
> > +  ``rx_descriptor_fields1`` ``mbuf_rx_descriptor_fields1``
> > +  ``cacheline1``            ``mbuf_cachelin1``
> > +
> > +  Contributions to DPDK should immediately start using the new names,
> > +  applications should adapt to new names as soon as possible as the
> > +  old names will be removed in a future DPDK release.
> > +
> > +  Note: types of the new names are not API compatible with the old and
> > +  some code conversion is required to maintain correct behavior.
> > +
> >  * build: The ``enable_kmods`` option is deprecated and will be removed in a future release.
> >    Setting/clearing the option has no impact on the build.
> >    Instead, kernel modules will be always built for OS's where out-of-tree kernel modules
> > diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
> > index d7d6390..af73f67 100644
> > --- a/lib/eal/include/rte_common.h
> > +++ b/lib/eal/include/rte_common.h
> > @@ -582,6 +582,12 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
> >  /** Marker for 8B alignment in a structure. */
> >  __extension__ typedef uint64_t RTE_MARKER64[0];
> >  
> > +#define __rte_marker(type, name) type name /* __rte_deprecated */
> > +
> > +#else
> > +
> > +#define __rte_marker(type, name)
> > +
> >  #endif
> >  
> >  /*********** Macros for calculating min and max **********/
> > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > index 5688683..9e9590b 100644
> > --- a/lib/mbuf/rte_mbuf_core.h
> > +++ b/lib/mbuf/rte_mbuf_core.h
> > @@ -16,7 +16,10 @@
> >   * New fields and flags should fit in the "dynamic space".
> >   */
> >  
> > +#include <assert.h>
> > +#include <stdalign.h>
> >  #include <stdint.h>
> > +#include <stddef.h>
> >  
> >  #include <rte_byteorder.h>
> >  #include <rte_stdatomic.h>
> > @@ -464,204 +467,240 @@ enum {
> >   * The generic rte_mbuf, containing a packet mbuf.
> >   */
> >  struct rte_mbuf {
> > -	RTE_MARKER cacheline0;
> > -
> > -	void *buf_addr;           /**< Virtual address of segment buffer. */
> > +	__rte_marker(RTE_MARKER, cacheline0);
> 
> You don't need to keep the first argument.
> This would be simpler:
> 	__rte_marker(cacheline0);
> You just need to create 2 functions: __rte_marker and __rte_marker64.

no objection, i'll add 2 macros and drop the first argument.

> 
> You should replace all occurrences of RTE_MARKER in DPDK in one patch,
> and mark RTE_MARKER as deprecated (use #pragma GCC poison)

will update to use pragma instead of __rte_deprecated

> 
> > +	union {
> > +		char mbuf_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
> > +		__extension__
> > +		struct {
> > +			void *buf_addr;           /**< Virtual address of segment buffer. 
> 
> I think it is ugly.
> 
> Changing mbuf API is a serious issue.

agreed, do you have an alternate proposal to solve problem?

> 

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-18 15:22         ` Thomas Monjalon
  2024-02-18 16:20           ` Morten Brørup
@ 2024-02-20 17:24           ` Tyler Retzlaff
  1 sibling, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-20 17:24 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Morten Brørup, Ajit Khaparde, Andrew Boyer,
	Andrew Rybchenko, Bruce Richardson, Chenbo Xia, Chengwen Feng,
	Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang

On Sun, Feb 18, 2024 at 04:22:15PM +0100, Thomas Monjalon wrote:
> 18/02/2024 14:07, Morten Brørup:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > 15/02/2024 07:21, Tyler Retzlaff:
> > > > --- a/lib/eal/include/rte_common.h
> > > > +++ b/lib/eal/include/rte_common.h
> > > > @@ -582,6 +582,12 @@ static void
> > > __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
> > > >  /** Marker for 8B alignment in a structure. */
> > > >  __extension__ typedef uint64_t RTE_MARKER64[0];
> > > >
> > > > +#define __rte_marker(type, name) type name /* __rte_deprecated */
> > > > +
> > > > +#else
> > > > +
> > > > +#define __rte_marker(type, name)
> > > > +
> > > >  #endif
> > > >
> > > >  /*********** Macros for calculating min and max **********/
> > > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > > > index 5688683..9e9590b 100644
> > > > --- a/lib/mbuf/rte_mbuf_core.h
> > > > +++ b/lib/mbuf/rte_mbuf_core.h
> > > > @@ -16,7 +16,10 @@
> > > >   * New fields and flags should fit in the "dynamic space".
> > > >   */
> > > >
> > > > +#include <assert.h>
> > > > +#include <stdalign.h>
> > > >  #include <stdint.h>
> > > > +#include <stddef.h>
> > > >
> > > >  #include <rte_byteorder.h>
> > > >  #include <rte_stdatomic.h>
> > > > @@ -464,204 +467,240 @@ enum {
> > > >   * The generic rte_mbuf, containing a packet mbuf.
> > > >   */
> > > >  struct rte_mbuf {
> > > > -	RTE_MARKER cacheline0;
> > > > -
> > > > -	void *buf_addr;           /**< Virtual address of segment buffer.
> > > */
> > > > +	__rte_marker(RTE_MARKER, cacheline0);
> > > 
> > > You don't need to keep the first argument.
> > > This would be simpler:
> > > 	__rte_marker(cacheline0);
> > > You just need to create 2 functions: __rte_marker and __rte_marker64.
> > > 
> > > You should replace all occurrences of RTE_MARKER in DPDK in one patch,
> > > and mark RTE_MARKER as deprecated (use #pragma GCC poison)
> > 
> > I like this suggestion.
> > However, some applications might use RTE_MARKER in their own structures.
> > Wouldn't it be considered API breakage to mark RTE_MARKER as deprecated?
> 
> Yes it is an API breakage.
> Do we prefer waiting 24.11 for poisoning this macro?

i only intend to announce deprecation now, actual poisoning given mbuf
is involved probably should be no earlier than 24.11 and possibly even
longer. though in my experience adaptation never really happens until it
is forced.

> 

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-20 17:20       ` Tyler Retzlaff
@ 2024-02-20 17:53         ` Thomas Monjalon
  2024-02-20 19:16           ` Thomas Monjalon
  0 siblings, 1 reply; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-20 17:53 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

20/02/2024 18:20, Tyler Retzlaff:
> On Sun, Feb 18, 2024 at 01:39:52PM +0100, Thomas Monjalon wrote:
> > 15/02/2024 07:21, Tyler Retzlaff:
> > > Provide a macro that allows conditional expansion of RTE_MARKER fields
> > > to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> > > we announce the fields to be __rte_deprecated (currently disabled).
> > > 
> > > Introduce C11 anonymous unions to permit aliasing of well-known
> > > offsets by name into the rte_mbuf structure by a *new* name and to
> > > provide padding for cache alignment.
[...]
> > >  struct rte_mbuf {
> > > -	RTE_MARKER cacheline0;
> > > -
> > > -	void *buf_addr;           /**< Virtual address of segment buffer. */
> > > +	__rte_marker(RTE_MARKER, cacheline0);
> > > +	union {
> > > +		char mbuf_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
> > > +		__extension__
> > > +		struct {
> > > +			void *buf_addr;           /**< Virtual address of segment buffer. 
> > 
> > I think it is ugly.
> > 
> > Changing mbuf API is a serious issue.
> 
> agreed, do you have an alternate proposal to solve problem?

The best would be that MSVC supports a kind of struct marker.



^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-20 17:53         ` Thomas Monjalon
@ 2024-02-20 19:16           ` Thomas Monjalon
  2024-02-20 19:37             ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-20 19:16 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb,
	david.marchand

20/02/2024 18:53, Thomas Monjalon:
> 20/02/2024 18:20, Tyler Retzlaff:
> > On Sun, Feb 18, 2024 at 01:39:52PM +0100, Thomas Monjalon wrote:
> > > 15/02/2024 07:21, Tyler Retzlaff:
> > > > Provide a macro that allows conditional expansion of RTE_MARKER fields
> > > > to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> > > > we announce the fields to be __rte_deprecated (currently disabled).
> > > > 
> > > > Introduce C11 anonymous unions to permit aliasing of well-known
> > > > offsets by name into the rte_mbuf structure by a *new* name and to
> > > > provide padding for cache alignment.
> [...]
> > > >  struct rte_mbuf {
> > > > -	RTE_MARKER cacheline0;
> > > > -
> > > > -	void *buf_addr;           /**< Virtual address of segment buffer. */
> > > > +	__rte_marker(RTE_MARKER, cacheline0);
> > > > +	union {
> > > > +		char mbuf_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
> > > > +		__extension__
> > > > +		struct {
> > > > +			void *buf_addr;           /**< Virtual address of segment buffer. 
> > > 
> > > I think it is ugly.
> > > 
> > > Changing mbuf API is a serious issue.
> > 
> > agreed, do you have an alternate proposal to solve problem?
> 
> The best would be that MSVC supports a kind of struct marker.

After more thoughts, it's OK to break API for mbuf markers.
There are 2 kind of markers in mbuf:
	1/ cacheline markers used only in rte_mbuf_prefetch_part functions
	2/ rearm_data and rx_descriptor_fields1 which are offsets used by drivers
The cacheline markers can be removed and offset calculated in prefetch functions.
The second type of markers are intended to be used by drivers only,
so there is not API compatibility concern.
Instead of complicated unions, I propose to replace them with inline functions
which return the offset in the same type as the markers.

As RTE_MARKER macros rely on a non-standard C feature,
I propose to mark them as non-recommended,
and stop using them in DPDK code.
We can keep them for compatibility and drop them when compiling with MSVC.

Some markers are used in crypto structures for cachelines,
we can probably drop them easily, they look unused.

The last thing to handle is cacheline padding.
It can be done on the first field of the next cacheline,
instead of using a zero-sized marker for padding.

Problem solved? Let's get rid of these markers?



^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct
  2024-02-20 19:16           ` Thomas Monjalon
@ 2024-02-20 19:37             ` Tyler Retzlaff
  0 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-20 19:37 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb,
	david.marchand

On Tue, Feb 20, 2024 at 08:16:23PM +0100, Thomas Monjalon wrote:
> 20/02/2024 18:53, Thomas Monjalon:
> > 20/02/2024 18:20, Tyler Retzlaff:
> > > On Sun, Feb 18, 2024 at 01:39:52PM +0100, Thomas Monjalon wrote:
> > > > 15/02/2024 07:21, Tyler Retzlaff:
> > > > > Provide a macro that allows conditional expansion of RTE_MARKER fields
> > > > > to empty to allow rte_mbuf to be used with MSVC. It is proposed that
> > > > > we announce the fields to be __rte_deprecated (currently disabled).
> > > > > 
> > > > > Introduce C11 anonymous unions to permit aliasing of well-known
> > > > > offsets by name into the rte_mbuf structure by a *new* name and to
> > > > > provide padding for cache alignment.
> > [...]
> > > > >  struct rte_mbuf {
> > > > > -	RTE_MARKER cacheline0;
> > > > > -
> > > > > -	void *buf_addr;           /**< Virtual address of segment buffer. */
> > > > > +	__rte_marker(RTE_MARKER, cacheline0);
> > > > > +	union {
> > > > > +		char mbuf_cacheline0[RTE_CACHE_LINE_MIN_SIZE];
> > > > > +		__extension__
> > > > > +		struct {
> > > > > +			void *buf_addr;           /**< Virtual address of segment buffer. 
> > > > 
> > > > I think it is ugly.
> > > > 
> > > > Changing mbuf API is a serious issue.
> > > 
> > > agreed, do you have an alternate proposal to solve problem?
> > 
> > The best would be that MSVC supports a kind of struct marker.
> 
> After more thoughts, it's OK to break API for mbuf markers.
> There are 2 kind of markers in mbuf:
> 	1/ cacheline markers used only in rte_mbuf_prefetch_part functions
> 	2/ rearm_data and rx_descriptor_fields1 which are offsets used by drivers
> The cacheline markers can be removed and offset calculated in prefetch functions.
> The second type of markers are intended to be used by drivers only,
> so there is not API compatibility concern.
> Instead of complicated unions, I propose to replace them with inline functions
> which return the offset in the same type as the markers.
> 
> As RTE_MARKER macros rely on a non-standard C feature,
> I propose to mark them as non-recommended,
> and stop using them in DPDK code.
> We can keep them for compatibility and drop them when compiling with MSVC.
> 
> Some markers are used in crypto structures for cachelines,
> we can probably drop them easily, they look unused.
> 
> The last thing to handle is cacheline padding.
> It can be done on the first field of the next cacheline,
> instead of using a zero-sized marker for padding.
> 
> Problem solved? Let's get rid of these markers?

certainly simplifies things, i don't object i'll submit a new revision
with the suggestions outlined above.

thanks Thomas
> 

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 00/22] stop using RTE_MARKER extensions
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
  2024-01-30 23:26 ` [PATCH] mbuf: " Tyler Retzlaff
  2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
@ 2024-02-24  8:21 ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 01/22] eal: provide macro to expand marker extensions Tyler Retzlaff
                     ` (22 more replies)
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                   ` (5 subsequent siblings)
  8 siblings, 23 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. This series
hides the markers when building with MSVC and updates libraries and
drivers to access compatibly typed pointers to the rte_mbuf struct offsets.

This series, does the following.

Introduces a new macro __rte_marker(type, name) which is used to
conditionally expand RTE_MARKER fields empty when building with GCC.

Updates existing inline functions accessing cacheline{0,1} markers in
the rte_mbuf struct to stop using the markers and instead uses the mbuf
fields directly.

Introduces 2 new inline functions to allow drivers to access rearm_data
and rx_descriptor_fields1 descriptors without using the RTE_MARKER fields.

Updates all drivers to use the new inline rte_mbuf struct accessors for
rearm_data and rx_descriptor_fields1.

Any previous Acks on the series are considered to be reset due to amount
of change.

v5:
  * update existing cacheline{0, 1} inline functions to access actual
    mbuf fields.
  * introduce new inline functions for accessing rearm_data and
    rx_descriptor_fields1 descriptors.
  * adapt drivers to use new inline functions.

prior versions not relevant due to re-work of entire series.


Tyler Retzlaff (22):
  eal: provide macro to expand marker extensions
  mbuf: expand rte markers empty when building with MSVC
  security: expand rte markers empty when building with MSVC
  cryptodev: expand rte markers empty when building with MSVC
  mbuf: stop using mbuf cacheline marker fields
  mbuf: add mbuf descriptor accessors
  common/idpf: use mbuf descriptor accessors
  net/bnxt: use mbuf descriptor accessors
  net/cnxk: use mbuf descriptor accessors
  net/enic: use mbuf descriptor accessors
  net/fm10k: use mbuf descriptor accessors
  net/hns3: use mbuf descriptor accessors
  net/i40e: use mbuf descriptor accessors
  net/iavf: use mbuf descriptor accessors
  net/ice: use mbuf descriptor accessors
  net/ionic: use mbuf descriptor accessors
  net/ixgbe: use mbuf descriptor accessors
  net/mlx5: use mbuf descriptor accessors
  net/octeon_ep: use mbuf descriptor accessors
  net/sfc: use mbuf descriptor accessors
  net/thunderx: use mbuf descriptor accessors
  net/virtio: use mbuf descriptor accessors

 drivers/common/idpf/idpf_common_rxtx.c          |  4 +--
 drivers/common/idpf/idpf_common_rxtx_avx512.c   | 33 ++++++++++++-----------
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c           | 32 +++++++++++-----------
 drivers/net/bnxt/bnxt_rxtx_vec_common.h         |  4 +--
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c           | 16 +++++------
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c            | 16 +++++------
 drivers/net/cnxk/cn10k_rx.h                     | 36 ++++++++++++-------------
 drivers/net/cnxk/cn9k_rx.h                      | 20 +++++++-------
 drivers/net/cnxk/cnxk_ethdev.c                  |  2 +-
 drivers/net/enic/enic_main.c                    |  4 +--
 drivers/net/enic/enic_rxtx_vec_avx2.c           | 18 ++++++-------
 drivers/net/fm10k/fm10k_rxtx_vec.c              | 19 +++++--------
 drivers/net/hns3/hns3_rxtx_vec.c                |  4 +--
 drivers/net/hns3/hns3_rxtx_vec_neon.h           | 16 +++++------
 drivers/net/i40e/i40e_rxtx_vec_altivec.c        | 18 +++++--------
 drivers/net/i40e/i40e_rxtx_vec_avx2.c           | 16 +++++------
 drivers/net/i40e/i40e_rxtx_vec_avx512.c         | 16 +++++------
 drivers/net/i40e/i40e_rxtx_vec_common.h         |  4 +--
 drivers/net/i40e/i40e_rxtx_vec_neon.c           | 16 +++++------
 drivers/net/i40e/i40e_rxtx_vec_sse.c            | 16 +++++------
 drivers/net/iavf/iavf_rxtx_vec_avx2.c           | 32 +++++++++++-----------
 drivers/net/iavf/iavf_rxtx_vec_avx512.c         | 32 +++++++++++-----------
 drivers/net/iavf/iavf_rxtx_vec_common.h         |  4 +--
 drivers/net/iavf/iavf_rxtx_vec_neon.c           | 16 +++++------
 drivers/net/iavf/iavf_rxtx_vec_sse.c            | 32 +++++++++++-----------
 drivers/net/ice/ice_rxtx_vec_avx2.c             | 16 +++++------
 drivers/net/ice/ice_rxtx_vec_avx512.c           | 16 +++++------
 drivers/net/ice/ice_rxtx_vec_common.h           |  4 +--
 drivers/net/ice/ice_rxtx_vec_sse.c              | 16 +++++------
 drivers/net/ionic/ionic_lif.c                   |  4 +--
 drivers/net/ionic/ionic_rxtx_sg.c               |  4 +--
 drivers/net/ionic/ionic_rxtx_simple.c           |  2 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h       |  4 +--
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c         | 12 ++++-----
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c          | 24 ++++++++---------
 drivers/net/mlx5/mlx5_rxq.c                     |  2 +-
 drivers/net/mlx5/mlx5_rxtx_vec_altivec.h        | 28 +++++++++----------
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h           | 20 +++++++-------
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h            | 28 +++++++++----------
 drivers/net/octeon_ep/cnxk_ep_rx.h              |  2 +-
 drivers/net/octeon_ep/cnxk_ep_rx_avx.c          |  2 +-
 drivers/net/octeon_ep/cnxk_ep_rx_neon.c         |  8 +++---
 drivers/net/octeon_ep/cnxk_ep_rx_sse.c          |  8 +++---
 drivers/net/octeon_ep/otx_ep_rxtx.c             |  5 +---
 drivers/net/sfc/sfc_ef100_rx.c                  |  4 +--
 drivers/net/sfc/sfc_ef10_rx.c                   |  6 ++---
 drivers/net/thunderx/nicvf_ethdev.c             |  4 +--
 drivers/net/thunderx/nicvf_rxtx.h               |  4 +--
 drivers/net/virtio/virtio_rxtx_packed_avx.h     | 10 +++----
 drivers/net/virtio/virtio_rxtx_packed_neon.h    | 16 +++++------
 drivers/net/virtio/virtio_rxtx_simple.c         |  4 +--
 drivers/net/virtio/virtio_rxtx_simple.h         |  5 +---
 drivers/net/virtio/virtio_rxtx_simple_altivec.c | 16 +++++------
 drivers/net/virtio/virtio_rxtx_simple_neon.c    | 24 ++++++-----------
 drivers/net/virtio/virtio_rxtx_simple_sse.c     | 16 +++++------
 lib/cryptodev/cryptodev_pmd.h                   |  5 ++--
 lib/eal/include/rte_common.h                    |  8 +++++-
 lib/mbuf/rte_mbuf.h                             | 28 +++++++++++++++++--
 lib/mbuf/rte_mbuf_core.h                        | 10 +++----
 lib/security/rte_security_driver.h              |  5 ++--
 60 files changed, 392 insertions(+), 404 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 01/22] eal: provide macro to expand marker extensions
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24 10:51     ` Thomas Monjalon
  2024-02-24  8:21   ` [PATCH v5 02/22] mbuf: expand rte markers empty when building with MSVC Tyler Retzlaff
                     ` (21 subsequent siblings)
  22 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide a
new macro __rte_marker(type, name) that may be used to expand RTE_MARKER
empty in struct definitions when building with MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_common.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 1cc1222..60d81a2 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -578,7 +578,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
 
 /*********** Structure alignment markers ********/
 
-#ifndef RTE_TOOLCHAIN_MSVC
+#ifdef RTE_TOOLCHAIN_MSVC
+
+#define __rte_marker(type, name)
+
+#else
 
 /** Generic marker for any place in a structure. */
 __extension__ typedef void    *RTE_MARKER[0];
@@ -591,6 +595,8 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
 /** Marker for 8B alignment in a structure. */
 __extension__ typedef uint64_t RTE_MARKER64[0];
 
+#define __rte_marker(type, name) type name;
+
 #endif
 
 /*********** Macros for calculating min and max **********/
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 02/22] mbuf: expand rte markers empty when building with MSVC
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 01/22] eal: provide macro to expand marker extensions Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 03/22] security: " Tyler Retzlaff
                     ` (20 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
__rte_marker to expand RTE_MARKER fields empty in rte_mbuf struct.

Make slight adjustment to cacheline1 __rte_cache_min_aligned as to
continue maintaining correct alignment with or without the marker
expanding empty.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/mbuf/rte_mbuf_core.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 5688683..4bf4587 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -464,7 +464,7 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct rte_mbuf {
-	RTE_MARKER cacheline0;
+	__rte_marker(RTE_MARKER, cacheline0)
 
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
@@ -487,7 +487,7 @@ struct rte_mbuf {
 #endif
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
+	__rte_marker(RTE_MARKER64, rearm_data)
 	uint16_t data_off;
 
 	/**
@@ -514,7 +514,7 @@ struct rte_mbuf {
 	uint64_t ol_flags;        /**< Offload features. */
 
 	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
+	__rte_marker(RTE_MARKER, rx_descriptor_fields1)
 
 	/*
 	 * The packet type, which is the combination of outer/inner L2, L3, L4
@@ -595,8 +595,8 @@ struct rte_mbuf {
 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
-
+	__rte_cache_min_aligned
+	__rte_marker(RTE_MARKER, cacheline1)
 #if RTE_IOVA_IN_MBUF
 	/**
 	 * Next segment of scattered packet. Must be NULL in the last
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 03/22] security: expand rte markers empty when building with MSVC
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 01/22] eal: provide macro to expand marker extensions Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 02/22] mbuf: expand rte markers empty when building with MSVC Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 04/22] cryptodev: " Tyler Retzlaff
                     ` (19 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
__rte_marker to expand RTE_MARKER fields empty in rte_security_session
struct.

Make slight adjustment to cacheline1 __rte_cache_min_aligned as to
continue maintaining correct alignment with or without the marker
expanding empty.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/security/rte_security_driver.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index faa4074..a25ccd0 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -24,7 +24,7 @@
  * Security session to be used by library for internal usage
  */
 struct rte_security_session {
-	RTE_MARKER cacheline0;
+	__rte_marker(RTE_MARKER, cacheline0)
 	uint64_t opaque_data;
 	/**< Opaque user defined data */
 	uint64_t fast_mdata;
@@ -32,7 +32,8 @@ struct rte_security_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< session private data IOVA address */
 
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
+	 __rte_cache_min_aligned
+	__rte_marker(RTE_MARKER, cacheline1)
 	uint8_t driver_priv_data[];
 	/**< Private session material, variable size (depends on driver) */
 };
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 04/22] cryptodev: expand rte markers empty when building with MSVC
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 03/22] security: " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 05/22] mbuf: stop using mbuf cacheline marker fields Tyler Retzlaff
                     ` (18 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
__rte_marker to expand RTE_MARKER fields empty in rte_security_session
struct.

Make slight adjustment to cacheline1 __rte_cache_min_aligned as to
continue maintaining correct alignment with or without the marker
expanding empty.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/cryptodev/cryptodev_pmd.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 0732b35..1d4810c 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -139,7 +139,7 @@ struct cryptodev_driver {
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	RTE_MARKER cacheline0;
+	__rte_marker(RTE_MARKER, cacheline0)
 	uint64_t opaque_data;
 	/**< Can be used for external metadata */
 	uint32_t sess_data_sz;
@@ -151,7 +151,8 @@ struct rte_cryptodev_sym_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< Session driver data IOVA address */
 
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
+	__rte_cache_min_aligned
+	__rte_marker(RTE_MARKER, cacheline1)
 	/**< Second cache line - start of the driver session data */
 	uint8_t driver_priv_data[];
 	/**< Driver specific session data, variable size */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 05/22] mbuf: stop using mbuf cacheline marker fields
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 04/22] cryptodev: " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24 10:58     ` Thomas Monjalon
  2024-02-24  8:21   ` [PATCH v5 06/22] mbuf: add mbuf descriptor accessors Tyler Retzlaff
                     ` (17 subsequent siblings)
  22 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Update prefetch inline functions to access rte_mbuf struct fields
directly instead of via cacheline{0,1} marker extension fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/mbuf/rte_mbuf.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 286b32b..04cde0f 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -108,7 +108,7 @@
 static inline void
 rte_mbuf_prefetch_part1(struct rte_mbuf *m)
 {
-	rte_prefetch0(&m->cacheline0);
+	rte_prefetch0(&m->buf_addr);
 }
 
 /**
@@ -126,7 +126,11 @@
 rte_mbuf_prefetch_part2(struct rte_mbuf *m)
 {
 #if RTE_CACHE_LINE_SIZE == 64
-	rte_prefetch0(&m->cacheline1);
+#if RTE_IOVA_IN_MBUF
+	rte_prefetch0(&m->next);
+#else
+	rte_prefetch0(&m->dynfield2);
+#endif
 #else
 	RTE_SET_USED(m);
 #endif
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 06/22] mbuf: add mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 05/22] mbuf: stop using mbuf cacheline marker fields Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24 11:01     ` Thomas Monjalon
  2024-02-24  8:21   ` [PATCH v5 07/22] common/idpf: use " Tyler Retzlaff
                     ` (16 subsequent siblings)
  22 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Provide inline functions to access rearm data and rx descriptor fields
in rte_mbuf struct.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/mbuf/rte_mbuf.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 04cde0f..7993730 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -136,6 +136,26 @@
 #endif
 }
 
+static inline
+uint64_t *
+rte_mbuf_rearm_data(struct rte_mbuf *m)
+{
+	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
+			 offsetof(struct rte_mbuf, data_off) + 8);
+	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
+			 RTE_ALIGN(offsetof(struct rte_mbuf,
+					    data_off),
+					    16));
+
+	return (uint64_t *)&m->data_off;
+}
+
+static inline
+void *
+rte_mbuf_rx_descriptor_fields1(struct rte_mbuf *m)
+{
+	return &m->packet_type;
+}
 
 static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 07/22] common/idpf: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 06/22] mbuf: add mbuf descriptor accessors Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 08/22] net/bnxt: " Tyler Retzlaff
                     ` (15 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/idpf/idpf_common_rxtx.c        |  4 +---
 drivers/common/idpf/idpf_common_rxtx_avx512.c | 33 ++++++++++++++-------------
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/common/idpf/idpf_common_rxtx.c b/drivers/common/idpf/idpf_common_rxtx.c
index 83b131e..62ddf2e 100644
--- a/drivers/common/idpf/idpf_common_rxtx.c
+++ b/drivers/common/idpf/idpf_common_rxtx.c
@@ -1595,7 +1595,6 @@
 static inline int
 idpf_rxq_vec_setup_default(struct idpf_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -1605,8 +1604,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
diff --git a/drivers/common/idpf/idpf_common_rxtx_avx512.c b/drivers/common/idpf/idpf_common_rxtx_avx512.c
index f65e8d5..f978a27 100644
--- a/drivers/common/idpf/idpf_common_rxtx_avx512.c
+++ b/drivers/common/idpf/idpf_common_rxtx_avx512.c
@@ -462,6 +462,7 @@
 				 RTE_ALIGN(offsetof(struct rte_mbuf,
 						    rearm_data),
 						    16));
+
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -476,13 +477,13 @@
 		rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		rearm7 = _mm256_blend_epi32(mbuf_init, mb6_7, 0xF0);
@@ -491,13 +492,13 @@
 		rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* perform dd_check */
@@ -936,13 +937,13 @@
 		rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		rearm7 = _mm256_blend_epi32(mbuf_init, mb6_7, 0xF0);
@@ -951,13 +952,13 @@
 		rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		const __mmask8 dd_mask = _mm512_cmpeq_epi64_mask(
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 08/22] net/bnxt: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 07/22] common/idpf: use " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 09/22] net/cnxk: " Tyler Retzlaff
                     ` (14 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c   | 32 ++++++++++++++++----------------
 drivers/net/bnxt/bnxt_rxtx_vec_common.h |  4 +---
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c   | 16 ++++++++--------
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c    | 16 ++++++++--------
 4 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
index ce6b597..5982d12 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
@@ -310,13 +310,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for first four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
 
 		/* Unpack rearm data, set fixed fields for final four mbufs. */
@@ -336,13 +336,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for final four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
 
 		nb_rx_pkts += num_valid;
@@ -598,13 +598,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for first four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
 
 		/* Unpack rearm data, set fixed fields for final four mbufs. */
@@ -624,13 +624,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for final four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
 
 		nb_rx_pkts += num_valid;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_common.h b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
index 2294f0a..fb0b1c1 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
@@ -36,7 +36,6 @@
 static inline int
 bnxt_rxq_vec_setup_common(struct bnxt_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -46,8 +45,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	rxq->rxrearm_nb = 0;
 	rxq->rxrearm_start = 0;
 	return 0;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index 775400f..9ca9903 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -135,27 +135,27 @@
 
 	/* Update mbuf rearm_data for four packets. */
 	GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[0]->rearm_data,
+	vst1q_u32((uint32_t *)rte_mbuf_rearm_data(mbuf[0]),
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 1, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[1]->rearm_data,
+	vst1q_u32((uint32_t *)rte_mbuf_rearm_data(mbuf[1]),
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 2, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[2]->rearm_data,
+	vst1q_u32((uint32_t *)rte_mbuf_rearm_data(mbuf[2]),
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 3, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[3]->rearm_data,
+	vst1q_u32((uint32_t *)rte_mbuf_rearm_data(mbuf[3]),
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 
 	/* Update mbuf rx_descriptor_fields1 for four packets. */
 	GET_DESC_FIELDS(mm_rxcmp[0], mm_rxcmp1[0], shuf_msk, ptype_idx, 0, tmp);
-	vst1q_u32((uint32_t *)&mbuf[0]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)rte_mbuf_rx_descriptor_fields1(mbuf[0]), tmp);
 	GET_DESC_FIELDS(mm_rxcmp[1], mm_rxcmp1[1], shuf_msk, ptype_idx, 1, tmp);
-	vst1q_u32((uint32_t *)&mbuf[1]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)rte_mbuf_rx_descriptor_fields1(mbuf[1]), tmp);
 	GET_DESC_FIELDS(mm_rxcmp[2], mm_rxcmp1[2], shuf_msk, ptype_idx, 2, tmp);
-	vst1q_u32((uint32_t *)&mbuf[2]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)rte_mbuf_rx_descriptor_fields1(mbuf[2]), tmp);
 	GET_DESC_FIELDS(mm_rxcmp[3], mm_rxcmp1[3], shuf_msk, ptype_idx, 3, tmp);
-	vst1q_u32((uint32_t *)&mbuf[3]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)rte_mbuf_rx_descriptor_fields1(mbuf[3]), tmp);
 }
 
 static uint16_t
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 6c0e332..080e990 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -114,33 +114,33 @@
 
 	/* Update mbuf rearm_data for four packets. */
 	GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
-	_mm_store_si128((void *)&mbuf[0]->rearm_data,
+	_mm_store_si128((void *)rte_mbuf_rearm_data(mbuf[0]),
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 1, ol_flags);
-	_mm_store_si128((void *)&mbuf[1]->rearm_data,
+	_mm_store_si128((void *)rte_mbuf_rearm_data(mbuf[1]),
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 2, ol_flags);
-	_mm_store_si128((void *)&mbuf[2]->rearm_data,
+	_mm_store_si128((void *)rte_mbuf_rearm_data(mbuf[2]),
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 3, ol_flags);
-	_mm_store_si128((void *)&mbuf[3]->rearm_data,
+	_mm_store_si128((void *)rte_mbuf_rearm_data(mbuf[3]),
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	/* Update mbuf rx_descriptor_fields1 for four packes. */
 	GET_DESC_FIELDS(mm_rxcmp[0], mm_rxcmp1[0], shuf_msk, ptype_idx, 0, t0);
-	_mm_store_si128((void *)&mbuf[0]->rx_descriptor_fields1, t0);
+	_mm_store_si128(rte_mbuf_rx_descriptor_fields1(mbuf[0]), t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[1], mm_rxcmp1[1], shuf_msk, ptype_idx, 1, t0);
-	_mm_store_si128((void *)&mbuf[1]->rx_descriptor_fields1, t0);
+	_mm_store_si128(rte_mbuf_rx_descriptor_fields1(mbuf[1]), t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[2], mm_rxcmp1[2], shuf_msk, ptype_idx, 2, t0);
-	_mm_store_si128((void *)&mbuf[2]->rx_descriptor_fields1, t0);
+	_mm_store_si128(rte_mbuf_rx_descriptor_fields1(mbuf[2]), t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[3], mm_rxcmp1[3], shuf_msk, ptype_idx, 3, t0);
-	_mm_store_si128((void *)&mbuf[3]->rx_descriptor_fields1, t0);
+	_mm_store_si128(rte_mbuf_rx_descriptor_fields1(mbuf[3]), t0);
 }
 
 static uint16_t
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 09/22] net/cnxk: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 08/22] net/bnxt: " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 10/22] net/enic: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/cnxk/cn10k_rx.h    | 36 ++++++++++++++++++------------------
 drivers/net/cnxk/cn9k_rx.h     | 20 ++++++++++----------
 drivers/net/cnxk/cnxk_ethdev.c |  2 +-
 3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/net/cnxk/cn10k_rx.h b/drivers/net/cnxk/cn10k_rx.h
index 7bb4c86..4bfb323 100644
--- a/drivers/net/cnxk/cn10k_rx.h
+++ b/drivers/net/cnxk/cn10k_rx.h
@@ -309,7 +309,7 @@
 		frag_rx = (union nix_rx_parse_u *)(wqe + 1);
 		frag_size = rlen + frag_rx->lcptr - frag_rx->laptr;
 
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init;
+		*rte_mbuf_rearm_data(mbuf) = mbuf_init;
 		mbuf->data_len = frag_size;
 		mbuf->pkt_len = frag_size;
 		mbuf->ol_flags = ol_flags;
@@ -368,7 +368,7 @@
 	fsz_w1 >>= 16;
 
 	data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-	*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+	*rte_mbuf_rearm_data(mbuf) = mbuf_init | data_off;
 	mbuf->data_len = frag_size;
 
 	/* Mark frag as get */
@@ -384,7 +384,7 @@
 		fsz_w1 >>= 16;
 
 		data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+		*rte_mbuf_rearm_data(mbuf) = mbuf_init | data_off;
 		mbuf->data_len = frag_size;
 
 		/* Mark frag as get */
@@ -401,7 +401,7 @@
 		fsz_w1 >>= 16;
 
 		data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+		*rte_mbuf_rearm_data(mbuf) = mbuf_init | data_off;
 		mbuf->data_len = frag_size;
 
 		/* Mark frag as get */
@@ -502,7 +502,7 @@
 
 	inner->pkt_len = len;
 	inner->data_len = len;
-	*(uint64_t *)(&inner->rearm_data) = mbuf_init;
+	*rte_mbuf_rearm_data(inner) = mbuf_init;
 
 	inner->ol_flags = ((CPT_COMP_HWGOOD_MASK & (1U << ucc)) ?
 			   RTE_MBUF_F_RX_SEC_OFFLOAD :
@@ -584,7 +584,7 @@
 			/* First frag len */
 			inner->pkt_len = vgetq_lane_u16(*rx_desc_field1, 2);
 			inner->data_len = vgetq_lane_u16(*rx_desc_field1, 4);
-			p = (uintptr_t)&inner->rearm_data;
+			p = (uintptr_t)rte_mbuf_rearm_data(inner);
 			*(uint64_t *)p = mbuf_init;
 
 			/* Reassembly success */
@@ -774,7 +774,7 @@
 
 		mbuf->data_len = sg_len;
 		sg = sg >> 16;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)rte_mbuf_rearm_data(mbuf);
 		*(uint64_t *)p = rearm & ~0xFFFF;
 		nb_segs--;
 		iova_list++;
@@ -825,7 +825,7 @@
 			head->nb_segs = nb_segs;
 		}
 		mbuf = next_frag;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)rte_mbuf_rearm_data(mbuf);
 		*(uint64_t *)p = rearm + ldptr;
 		mbuf->data_len = (sg & 0xFFFF) - ldptr -
 				 (flags & NIX_RX_OFFLOAD_TSTAMP_F ?
@@ -849,7 +849,7 @@
 
 
 		len = mbuf->pkt_len;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)rte_mbuf_rearm_data(mbuf);
 		*(uint64_t *)p = rearm;
 		mbuf->data_len = (sg & 0xFFFF) -
 				 (flags & NIX_RX_OFFLOAD_TSTAMP_F ?
@@ -917,7 +917,7 @@
 		mbuf->ol_flags = ol_flags;
 		mbuf->pkt_len = len;
 		mbuf->data_len = len;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)rte_mbuf_rearm_data(mbuf);
 		*(uint64_t *)p = val;
 	}
 
@@ -1966,16 +1966,16 @@
 		rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
 
 		/* Update rx_descriptor_fields1 */
-		vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
-		vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
-		vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
-		vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf0), f0);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf1), f1);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf2), f2);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf3), f3);
 
 		/* Update rearm_data */
-		vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
-		vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
-		vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
-		vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf0), rearm0);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf1), rearm1);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf2), rearm2);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf3), rearm3);
 
 		if (flags & NIX_RX_MULTI_SEG_F) {
 			/* Multi segment is enable build mseg list for
diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h
index d8bb65c..f1212f8 100644
--- a/drivers/net/cnxk/cn9k_rx.h
+++ b/drivers/net/cnxk/cn9k_rx.h
@@ -155,7 +155,7 @@
 
 		mbuf->data_len = sg & 0xFFFF;
 		sg = sg >> 16;
-		*(uint64_t *)(&mbuf->rearm_data) = rearm;
+		*rte_mbuf_rearm_data(mbuf) = rearm;
 		nb_segs--;
 		iova_list++;
 
@@ -398,7 +398,7 @@
 			nix_update_match_id(rx->cn9k.match_id, ol_flags, mbuf);
 
 	mbuf->ol_flags = ol_flags;
-	*(uint64_t *)(&mbuf->rearm_data) = val;
+	*rte_mbuf_rearm_data(mbuf) = val;
 	mbuf->pkt_len = len;
 	mbuf->data_len = len;
 
@@ -799,16 +799,16 @@
 		rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
 
 		/* Update rx_descriptor_fields1 */
-		vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
-		vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
-		vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
-		vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf0), f0);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf1), f1);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf2), f2);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf3), f3);
 
 		/* Update rearm_data */
-		vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
-		vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
-		vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
-		vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf0), rearm0);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf1), rearm1);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf2), rearm2);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf3), rearm3);
 
 		if (flags & NIX_RX_MULTI_SEG_F) {
 			/* Multi segment is enable build mseg list for
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 2372a4e..14f6b7c 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -437,7 +437,7 @@
 
 	/* Prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	tmp = (uint64_t *)&mb_def.rearm_data;
+	tmp = rte_mbuf_rearm_data(&mb_def);
 
 	return *tmp;
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 10/22] net/enic: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 09/22] net/cnxk: " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 11/22] net/fm10k: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/enic/enic_main.c          |  4 +---
 drivers/net/enic/enic_rxtx_vec_avx2.c | 18 +++++++++---------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index a6aaa76..59e0be4 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -577,7 +577,6 @@ int enic_enable(struct enic *enic)
 	int err;
 	struct rte_eth_dev *eth_dev = enic->rte_dev;
 	uint64_t simple_tx_offloads;
-	uintptr_t p;
 
 	if (enic->enable_avx2_rx) {
 		struct rte_mbuf mb_def = { .buf_addr = 0 };
@@ -592,8 +591,7 @@ int enic_enable(struct enic *enic)
 		mb_def.port = enic->port_id;
 		rte_mbuf_refcnt_set(&mb_def, 1);
 		rte_compiler_barrier();
-		p = (uintptr_t)&mb_def.rearm_data;
-		enic->mbuf_initializer = *(uint64_t *)p;
+		enic->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	}
 
 	eth_dev->data->dev_link.link_speed = vnic_dev_port_speed(enic->vdev);
diff --git a/drivers/net/enic/enic_rxtx_vec_avx2.c b/drivers/net/enic/enic_rxtx_vec_avx2.c
index 600efff..f6ab6e1 100644
--- a/drivers/net/enic/enic_rxtx_vec_avx2.c
+++ b/drivers/net/enic/enic_rxtx_vec_avx2.c
@@ -19,7 +19,7 @@
 {
 	bool tnl;
 
-	*(uint64_t *)&mb->rearm_data = enic->mbuf_initializer;
+	*rte_mbuf_rearm_data(mb) = enic->mbuf_initializer;
 	mb->data_len = cqd->bytes_written_flags &
 		CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK;
 	mb->pkt_len = mb->data_len;
@@ -737,14 +737,14 @@
 		 * vlan_tci    - 26     (from cqd)
 		 * rss         - 28     (from cqd)
 		 */
-		_mm256_storeu_si256((__m256i *)&rxmb[0]->rearm_data, rearm0);
-		_mm256_storeu_si256((__m256i *)&rxmb[1]->rearm_data, rearm1);
-		_mm256_storeu_si256((__m256i *)&rxmb[2]->rearm_data, rearm2);
-		_mm256_storeu_si256((__m256i *)&rxmb[3]->rearm_data, rearm3);
-		_mm256_storeu_si256((__m256i *)&rxmb[4]->rearm_data, rearm4);
-		_mm256_storeu_si256((__m256i *)&rxmb[5]->rearm_data, rearm5);
-		_mm256_storeu_si256((__m256i *)&rxmb[6]->rearm_data, rearm6);
-		_mm256_storeu_si256((__m256i *)&rxmb[7]->rearm_data, rearm7);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[0]), rearm0);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[1]), rearm1);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[2]), rearm2);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[3]), rearm3);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[4]), rearm4);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[5]), rearm5);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[6]), rearm6);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[7]), rearm7);
 
 		max_rx -= 8;
 		cqd += 8;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 11/22] net/fm10k: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 10/22] net/enic: " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 12/22] net/hns3: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/fm10k/fm10k_rxtx_vec.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 2b6914b..e7d3810 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -226,7 +226,6 @@
 int __rte_cold
 fm10k_rxq_vec_setup(struct fm10k_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -239,8 +238,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
@@ -282,7 +280,6 @@
 	/* Initialize the mbufs in vector, process 2 mbufs in one loop */
 	for (i = 0; i < RTE_FM10K_RXQ_REARM_THRESH; i += 2, mb_alloc += 2) {
 		__m128i vaddr0, vaddr1;
-		uintptr_t p0, p1;
 
 		mb0 = mb_alloc[0];
 		mb1 = mb_alloc[1];
@@ -290,10 +287,8 @@
 		/* Flush mbuf with pkt template.
 		 * Data to be rearmed is 6 bytes long.
 		 */
-		p0 = (uintptr_t)&mb0->rearm_data;
-		*(uint64_t *)p0 = rxq->mbuf_initializer;
-		p1 = (uintptr_t)&mb1->rearm_data;
-		*(uint64_t *)p1 = rxq->mbuf_initializer;
+		*rte_mbuf_rearm_data(mb0) = rxq->mbuf_initializer;
+		*rte_mbuf_rearm_data(mb1) = rxq->mbuf_initializer;
 
 		/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, buf_iova) !=
@@ -519,9 +514,9 @@
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+3]),
 				pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+2]),
 				pkt_mb3);
 
 		/* C* extract and record EOP bit */
@@ -557,9 +552,9 @@
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+1]),
 				pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				pkt_mb1);
 
 		fm10k_desc_to_pktype_v(descs0, &rx_pkts[pos]);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 12/22] net/hns3: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 11/22] net/fm10k: " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 13/22] net/i40e: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/hns3/hns3_rxtx_vec.c      |  4 +---
 drivers/net/hns3/hns3_rxtx_vec_neon.h | 16 ++++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c
index 9708ec6..174be45 100644
--- a/drivers/net/hns3/hns3_rxtx_vec.c
+++ b/drivers/net/hns3/hns3_rxtx_vec.c
@@ -113,7 +113,6 @@
 static void
 hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -141,8 +140,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 }
 
 void
diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h
index 0dc6b9f..7b2c3e3 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_neon.h
+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h
@@ -236,23 +236,23 @@
 		pkt_mb4 = vreinterpretq_u8_u16(tmp);
 
 		/* save packet info to rx_pkts mbuf */
-		vst1q_u8((void *)&sw_ring[pos + 0].mbuf->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 0].mbuf),
 			 pkt_mb1);
-		vst1q_u8((void *)&sw_ring[pos + 1].mbuf->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 1].mbuf),
 			 pkt_mb2);
-		vst1q_u8((void *)&sw_ring[pos + 2].mbuf->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 2].mbuf),
 			 pkt_mb3);
-		vst1q_u8((void *)&sw_ring[pos + 3].mbuf->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 3].mbuf),
 			 pkt_mb4);
 
 		/* store the first 8 bytes of packets mbuf's rearm_data */
-		*(uint64_t *)&sw_ring[pos + 0].mbuf->rearm_data =
+		*rte_mbuf_rearm_data(&sw_ring[pos + 0].mbuf) =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 1].mbuf->rearm_data =
+		*rte_mbuf_rearm_data(&sw_ring[pos + 1].mbuf) =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 2].mbuf->rearm_data =
+		*rte_mbuf_rearm_data(&sw_ring[pos + 2].mbuf) =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 3].mbuf->rearm_data =
+		*rte_mbuf_rearm_data(&sw_ring[pos + 3].mbuf) =
 			rxq->mbuf_initializer;
 
 		rte_prefetch_non_temporal(rxdp + HNS3_DEFAULT_DESCS_PER_LOOP);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 13/22] net/i40e: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 12/22] net/hns3: " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:21   ` [PATCH v5 14/22] net/iavf: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/i40e/i40e_rxtx_vec_altivec.c | 18 ++++++------------
 drivers/net/i40e/i40e_rxtx_vec_avx2.c    | 16 ++++++++--------
 drivers/net/i40e/i40e_rxtx_vec_avx512.c  | 16 ++++++++--------
 drivers/net/i40e/i40e_rxtx_vec_common.h  |  4 +---
 drivers/net/i40e/i40e_rxtx_vec_neon.c    | 16 ++++++++--------
 drivers/net/i40e/i40e_rxtx_vec_sse.c     | 16 ++++++++--------
 6 files changed, 39 insertions(+), 47 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
index b6b0d38..3e065ee 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
@@ -55,7 +55,6 @@
 	/* Initialize the mbufs in vector, process 2 mbufs in one loop */
 	for (i = 0; i < RTE_I40E_RXQ_REARM_THRESH; i += 2, rxep += 2) {
 		__vector unsigned long vaddr0, vaddr1;
-		uintptr_t p0, p1;
 
 		mb0 = rxep[0].mbuf;
 		mb1 = rxep[1].mbuf;
@@ -66,10 +65,8 @@
 		  * anyway. So overwrite whole 8 bytes with one load:
 		  * 6 bytes of rearm_data plus first 2 bytes of ol_flags.
 		  */
-		p0 = (uintptr_t)&mb0->rearm_data;
-		*(uint64_t *)p0 = rxq->mbuf_initializer;
-		p1 = (uintptr_t)&mb1->rearm_data;
-		*(uint64_t *)p1 = rxq->mbuf_initializer;
+		*rte_mbuf_rearm_data(mb0) = rxq->mbuf_initializer;
+		*rte_mbuf_rearm_data(mb1) = rxq->mbuf_initializer;
 
 		/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
 		vaddr0 = vec_ld(0, (__vector unsigned long *)&mb0->buf_addr);
@@ -370,12 +367,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		vec_st(pkt_mb4, 0,
-		 (__vector unsigned char *)&rx_pkts[pos + 3]
-			->rx_descriptor_fields1
+		 (__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3])
 		);
 		vec_st(pkt_mb3, 0,
-		 (__vector unsigned char *)&rx_pkts[pos + 2]
-			->rx_descriptor_fields1
+		 (__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2])
 		);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -422,11 +417,10 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		vec_st(pkt_mb2, 0,
-		 (__vector unsigned char *)&rx_pkts[pos + 1]
-			->rx_descriptor_fields1
+		 (__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1])
 		);
 		vec_st(pkt_mb1, 0,
-		 (__vector unsigned char *)&rx_pkts[pos]->rx_descriptor_fields1
+		 (__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos])
 		);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		desc_to_olflags_v(descs, &rx_pkts[pos]);
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index f468c1f..027afbe 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -543,10 +543,10 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data, rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data, rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data, rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data, rearm0);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]), rearm6);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]), rearm4);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]), rearm2);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]), rearm0);
 
 		/* repeat for the odd mbufs */
 		const __m256i odd_flags = _mm256_castsi128_si256(
@@ -561,10 +561,10 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data, rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data, rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data, rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data, rearm1);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]), rearm7);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]), rearm5);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]), rearm3);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]), rearm1);
 
 		/* extract and record EOP bit */
 		if (split_packet) {
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index f3050cd..91dda60 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -580,13 +580,13 @@
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 6]->rearm_data, rearm6);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]), rearm6);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 4]->rearm_data, rearm4);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]), rearm4);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 2]->rearm_data, rearm2);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]), rearm2);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 0]->rearm_data, rearm0);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]), rearm0);
 
 		/* repeat for the odd mbufs */
 		const __m256i odd_flags = _mm256_castsi128_si256
@@ -606,13 +606,13 @@
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 7]->rearm_data, rearm7);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]), rearm7);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 5]->rearm_data, rearm5);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]), rearm5);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 3]->rearm_data, rearm3);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]), rearm3);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 1]->rearm_data, rearm1);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]), rearm1);
 
 		/* extract and record EOP bit */
 		if (split_packet) {
diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h
index 8b74563..5633268 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_common.h
+++ b/drivers/net/i40e/i40e_rxtx_vec_common.h
@@ -189,7 +189,6 @@
 static inline int
 i40e_rxq_vec_setup_default(struct i40e_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -199,8 +198,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	rxq->rx_using_sse = 1;
 	return 0;
 }
diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index d873e30..29dfd92 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -300,10 +300,10 @@
 	rearm2 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 2), mbuf_init, 1);
 	rearm3 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 3), mbuf_init, 1);
 
-	vst1q_u64((uint64_t *)&rx_pkts[0]->rearm_data, rearm0);
-	vst1q_u64((uint64_t *)&rx_pkts[1]->rearm_data, rearm1);
-	vst1q_u64((uint64_t *)&rx_pkts[2]->rearm_data, rearm2);
-	vst1q_u64((uint64_t *)&rx_pkts[3]->rearm_data, rearm3);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -492,13 +492,13 @@
 		pkt_mb1 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 				pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 				pkt_mb3);
-		vst1q_u8((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 				pkt_mb2);
-		vst1q_u8((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 2d4480a..d87b5ba 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -319,10 +319,10 @@
 			offsetof(struct rte_mbuf, rearm_data) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
 			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -535,9 +535,9 @@
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+3]),
 				 pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+2]),
 				 pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -571,9 +571,9 @@
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+1]),
 				 pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				 pkt_mb1);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 14/22] net/iavf: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 13/22] net/i40e: " Tyler Retzlaff
@ 2024-02-24  8:21   ` Tyler Retzlaff
  2024-02-24  8:22   ` [PATCH v5 15/22] net/ice: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:21 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/iavf/iavf_rxtx_vec_avx2.c   | 32 ++++++++++++++++----------------
 drivers/net/iavf/iavf_rxtx_vec_avx512.c | 32 ++++++++++++++++----------------
 drivers/net/iavf/iavf_rxtx_vec_common.h |  4 +---
 drivers/net/iavf/iavf_rxtx_vec_neon.c   | 16 ++++++++--------
 drivers/net/iavf/iavf_rxtx_vec_sse.c    | 32 ++++++++++++++++----------------
 5 files changed, 57 insertions(+), 59 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx2.c b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
index 510b4d8..0211e83 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx2.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
@@ -398,13 +398,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -427,13 +427,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
@@ -1305,13 +1305,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -1334,13 +1334,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
index 3bb6f30..950ec91 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
@@ -450,13 +450,13 @@
 			rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 		}
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -486,13 +486,13 @@
 			rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 		}
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
@@ -1461,13 +1461,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -1490,13 +1490,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/iavf/iavf_rxtx_vec_common.h b/drivers/net/iavf/iavf_rxtx_vec_common.h
index 5c52200..71e3644 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_common.h
+++ b/drivers/net/iavf/iavf_rxtx_vec_common.h
@@ -197,7 +197,6 @@
 static inline int
 iavf_rxq_vec_setup_default(struct iavf_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -207,8 +206,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
diff --git a/drivers/net/iavf/iavf_rxtx_vec_neon.c b/drivers/net/iavf/iavf_rxtx_vec_neon.c
index 83825aa..d7ea940 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_neon.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_neon.c
@@ -159,10 +159,10 @@
 	rearm2 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 2), mbuf_init, 1);
 	rearm3 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 3), mbuf_init, 1);
 
-	vst1q_u64((uint64_t *)&rx_pkts[0]->rearm_data, rearm0);
-	vst1q_u64((uint64_t *)&rx_pkts[1]->rearm_data, rearm1);
-	vst1q_u64((uint64_t *)&rx_pkts[2]->rearm_data, rearm2);
-	vst1q_u64((uint64_t *)&rx_pkts[3]->rearm_data, rearm3);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -332,13 +332,13 @@
 		pkt_mb1 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 				pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 				pkt_mb3);
-		vst1q_u8((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 				pkt_mb2);
-		vst1q_u8((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c b/drivers/net/iavf/iavf_rxtx_vec_sse.c
index 96f187f..634d9f5 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_sse.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c
@@ -183,10 +183,10 @@
 			offsetof(struct rte_mbuf, rearm_data) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
 			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 static inline __m128i
@@ -416,10 +416,10 @@
 			 offsetof(struct rte_mbuf, rearm_data) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
 			 RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -651,10 +651,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 			pkt_mb4);
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 			pkt_mb3);
 
 		/* D.2 pkt 1,2 remove crc */
@@ -689,9 +689,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 			pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				 pkt_mb1);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
@@ -1089,10 +1089,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 			 pkt_mb3);
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 			 pkt_mb2);
 
 		/* C* extract and record EOP bit */
@@ -1116,9 +1116,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 			 pkt_mb1);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				 pkt_mb0);
 		flex_desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 15/22] net/ice: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-02-24  8:21   ` [PATCH v5 14/22] net/iavf: " Tyler Retzlaff
@ 2024-02-24  8:22   ` Tyler Retzlaff
  2024-02-24  8:22   ` [PATCH v5 16/22] net/ionic: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:22 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 16 ++++++++--------
 drivers/net/ice/ice_rxtx_vec_avx512.c | 16 ++++++++--------
 drivers/net/ice/ice_rxtx_vec_common.h |  4 +---
 drivers/net/ice/ice_rxtx_vec_sse.c    | 16 ++++++++--------
 4 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c b/drivers/net/ice/ice_rxtx_vec_avx2.c
index 6f6d790..fb3811a 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -596,13 +596,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -625,13 +625,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/ice/ice_rxtx_vec_avx512.c b/drivers/net/ice/ice_rxtx_vec_avx512.c
index 04148e8..46d471f 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx512.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx512.c
@@ -597,13 +597,13 @@
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -627,13 +627,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index 4b73465..c284d2d 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -232,7 +232,6 @@
 static inline int
 ice_rxq_vec_setup_default(struct ice_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -242,8 +241,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_sse.c b/drivers/net/ice/ice_rxtx_vec_sse.c
index 9a1b7e3..4a051b7 100644
--- a/drivers/net/ice/ice_rxtx_vec_sse.c
+++ b/drivers/net/ice/ice_rxtx_vec_sse.c
@@ -271,10 +271,10 @@
 			 offsetof(struct rte_mbuf, rearm_data) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
 			 RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 static inline void
@@ -542,10 +542,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 			 pkt_mb3);
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 			 pkt_mb2);
 
 		/* C* extract and record EOP bit */
@@ -569,9 +569,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 			 pkt_mb1);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				 pkt_mb0);
 		ice_rx_desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 16/22] net/ionic: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-02-24  8:22   ` [PATCH v5 15/22] net/ice: " Tyler Retzlaff
@ 2024-02-24  8:22   ` Tyler Retzlaff
  2024-02-24  8:22   ` [PATCH v5 17/22] net/ixgbe: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:22 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ionic/ionic_lif.c         | 4 ++--
 drivers/net/ionic/ionic_rxtx_sg.c     | 4 ++--
 drivers/net/ionic/ionic_rxtx_simple.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index 93a1011..cec9a38 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -745,7 +745,7 @@
 	rte_compiler_barrier();
 
 	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	return *rte_mbuf_rearm_data(&rxm);
 }
 
 static uint64_t
@@ -763,7 +763,7 @@
 	rte_compiler_barrier();
 
 	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	return *rte_mbuf_rearm_data(&rxm);
 }
 
 int
diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c
index 92e1d6e..4a6f3c2 100644
--- a/drivers/net/ionic/ionic_rxtx_sg.c
+++ b/drivers/net/ionic/ionic_rxtx_sg.c
@@ -286,7 +286,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	*rte_mbuf_rearm_data(rxm) = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc_len);
 	left = cq_desc_len - rxm->data_len;
@@ -299,7 +299,7 @@
 		info[i] = NULL;
 
 		/* Set the chained mbuf metadata */
-		rxm_seg->rearm_data[0] = rxq->rearm_seg_data;
+		*rte_mbuf_rearm_data(rxm_seg) = rxq->rearm_seg_data;
 		rxm_seg->data_len = RTE_MIN(rxq->seg_size, left);
 		left -= rxm_seg->data_len;
 
diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c
index f12f66f..02528e8 100644
--- a/drivers/net/ionic/ionic_rxtx_simple.c
+++ b/drivers/net/ionic/ionic_rxtx_simple.c
@@ -257,7 +257,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	*rte_mbuf_rearm_data(rxm) = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = cq_desc_len;
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 17/22] net/ixgbe: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (15 preceding siblings ...)
  2024-02-24  8:22   ` [PATCH v5 16/22] net/ionic: " Tyler Retzlaff
@ 2024-02-24  8:22   ` Tyler Retzlaff
  2024-02-24  8:22   ` [PATCH v5 18/22] net/mlx5: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:22 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h |  4 +---
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c   | 12 ++++++------
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c    | 24 ++++++++++++------------
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
index a4d9ec9..78ab168 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
@@ -244,7 +244,6 @@
 static inline int
 ixgbe_rxq_vec_setup_default(struct ixgbe_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -254,8 +253,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index 952b032..2e1d903 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -56,13 +56,13 @@
 		 * Flush mbuf with pkt template.
 		 * Data to be rearmed is 6 bytes long.
 		 */
-		vst1_u8((uint8_t *)&mb0->rearm_data, p);
+		vst1_u8((uint8_t *)rte_mbuf_rearm_data(mb0), p);
 		paddr = mb0->buf_iova + RTE_PKTMBUF_HEADROOM;
 		dma_addr0 = vsetq_lane_u64(paddr, zero, 0);
 		/* flush desc with pa dma_addr */
 		vst1q_u64((uint64_t *)&rxdp++->read, dma_addr0);
 
-		vst1_u8((uint8_t *)&mb1->rearm_data, p);
+		vst1_u8((uint8_t *)rte_mbuf_rearm_data(mb1), p);
 		paddr = mb1->buf_iova + RTE_PKTMBUF_HEADROOM;
 		dma_addr1 = vsetq_lane_u64(paddr, zero, 0);
 		vst1q_u64((uint64_t *)&rxdp++->read, dma_addr1);
@@ -411,9 +411,9 @@
 		pkt_mb3 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 			 pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 			 pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -441,9 +441,9 @@
 		rte_prefetch_non_temporal(rxdp + RTE_IXGBE_DESCS_PER_LOOP);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		vst1q_u8((uint8_t *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8((uint8_t *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 			 pkt_mb2);
-		vst1q_u8((uint8_t *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8((uint8_t *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 			 pkt_mb1);
 
 		desc_to_ptype_v(descs, rxq->pkt_type_mask, &rx_pkts[pos]);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index f60808d..d8de64c 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -98,10 +98,10 @@
 desc_to_olflags_v_ipsec(__m128i descs[4], struct rte_mbuf **rx_pkts)
 {
 	__m128i sterr, rearm, tmp_e, tmp_p;
-	uint32_t *rearm0 = (uint32_t *)rx_pkts[0]->rearm_data + 2;
-	uint32_t *rearm1 = (uint32_t *)rx_pkts[1]->rearm_data + 2;
-	uint32_t *rearm2 = (uint32_t *)rx_pkts[2]->rearm_data + 2;
-	uint32_t *rearm3 = (uint32_t *)rx_pkts[3]->rearm_data + 2;
+	uint32_t *rearm0 = (uint32_t *)rte_mbuf_rearm_data(rx_pkts[0]) + 2;
+	uint32_t *rearm1 = (uint32_t *)rte_mbuf_rearm_data(rx_pkts[1]) + 2;
+	uint32_t *rearm2 = (uint32_t *)rte_mbuf_rearm_data(rx_pkts[2]) + 2;
+	uint32_t *rearm3 = (uint32_t *)rte_mbuf_rearm_data(rx_pkts[3]) + 2;
 	const __m128i ipsec_sterr_msk =
 			_mm_set1_epi32(IXGBE_RXDADV_IPSEC_STATUS_SECP |
 				       IXGBE_RXDADV_IPSEC_ERROR_AUTH_FAILED);
@@ -255,10 +255,10 @@
 			offsetof(struct rte_mbuf, rearm_data) + 8);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
 			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 static inline uint32_t get_packet_type(int index,
@@ -530,9 +530,9 @@ static inline uint32_t get_packet_type(int index,
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+3]),
 				pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+2]),
 				pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -566,9 +566,9 @@ static inline uint32_t get_packet_type(int index,
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos+1]),
 				pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, rxq->pkt_type_mask, &rx_pkts[pos]);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 18/22] net/mlx5: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (16 preceding siblings ...)
  2024-02-24  8:22   ` [PATCH v5 17/22] net/ixgbe: " Tyler Retzlaff
@ 2024-02-24  8:22   ` Tyler Retzlaff
  2024-02-24  8:22   ` [PATCH v5 19/22] net/octeon_ep: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:22 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/mlx5_rxq.c              |  2 +-
 drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 28 ++++++++++++++--------------
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h    | 20 ++++++++++----------
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h     | 28 ++++++++++++++--------------
 4 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index ca2eeed..b854418 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -200,7 +200,7 @@
 		 */
 		rte_compiler_barrier();
 		rxq->mbuf_initializer =
-			*(rte_xmm_t *)&mbuf_init->rearm_data;
+			*(rte_xmm_t *)rte_mbuf_rearm_data(mbuf_init);
 		/* Padding with a fake mbuf for vectorized Rx. */
 		for (j = 0; j < MLX5_VPMD_DESCS_PER_LOOP; ++j)
 			(*rxq->elts)[elts_n + j] = &rxq->fake_mbuf;
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
index cccfa7f..9349c21 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
@@ -101,10 +101,10 @@
 	uint16_t pkts_n = mcqe_n;
 	const __vector unsigned char rearm =
 		(__vector unsigned char)vec_vsx_ld(0,
-		(signed int const *)&t_pkt->rearm_data);
+		(signed int const *)rte_mbuf_rearm_data(t_pkt));
 	const __vector unsigned char rxdf =
 		(__vector unsigned char)vec_vsx_ld(0,
-		(signed int const *)&t_pkt->rx_descriptor_fields1);
+		(signed int const *)rte_mbuf_rx_descriptor_fields1(t_pkt));
 	const __vector unsigned char crc_adj =
 		(__vector unsigned char)(__vector unsigned short){
 			0, 0, rxq->crc_present * RTE_ETHER_CRC_LEN, 0,
@@ -173,9 +173,9 @@
 
 		/* B.1 store rearm data to mbuf. */
 		*(__vector unsigned char *)
-			&elts[pos]->rearm_data = rearm;
+			rte_mbuf_rearm_data(elts[pos]) = rearm;
 		*(__vector unsigned char *)
-			&elts[pos + 1]->rearm_data = rearm;
+			rte_mbuf_rearm_data(elts[pos + 1]) = rearm;
 
 		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
 		rxdf1 = vec_perm(mcqe1, zero, shuf_mask1);
@@ -195,15 +195,15 @@
 
 		/* D.1 store rx_descriptor_fields1. */
 		*(__vector unsigned char *)
-			&elts[pos]->rx_descriptor_fields1 = rxdf1;
+			rte_mbuf_rx_descriptor_fields1(elts[pos]) = rxdf1;
 		*(__vector unsigned char *)
-			&elts[pos + 1]->rx_descriptor_fields1 = rxdf2;
+			rte_mbuf_rx_descriptor_fields1(elts[pos + 1]) = rxdf2;
 
 		/* B.1 store rearm data to mbuf. */
 		*(__vector unsigned char *)
-			&elts[pos + 2]->rearm_data = rearm;
+			rte_mbuf_rearm_data(elts[pos + 2]) = rearm;
 		*(__vector unsigned char *)
-			&elts[pos + 3]->rearm_data = rearm;
+			rte_mbuf_rearm_data(elts[pos + 3]) = rearm;
 
 		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
 		rxdf1 = vec_perm(mcqe2, zero, shuf_mask1);
@@ -223,9 +223,9 @@
 
 		/* D.1 store rx_descriptor_fields1. */
 		*(__vector unsigned char *)
-			&elts[pos + 2]->rx_descriptor_fields1 = rxdf1;
+			rte_mbuf_rx_descriptor_fields1(elts[pos + 2]) = rxdf1;
 		*(__vector unsigned char *)
-			&elts[pos + 3]->rx_descriptor_fields1 = rxdf2;
+			rte_mbuf_rx_descriptor_fields1(elts[pos + 3]) = rxdf2;
 
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		invalid_mask = (__vector unsigned char)(__vector unsigned long){
@@ -769,13 +769,13 @@
 
 	/* Write 8B rearm_data and 8B ol_flags. */
 	vec_vsx_st(rearm0, 0,
-		(__vector unsigned char *)&pkts[0]->rearm_data);
+		(__vector unsigned char *)rte_mbuf_rearm_data(pkts[0]));
 	vec_vsx_st(rearm1, 0,
-		(__vector unsigned char *)&pkts[1]->rearm_data);
+		(__vector unsigned char *)rte_mbuf_rearm_data(pkts[1]));
 	vec_vsx_st(rearm2, 0,
-		(__vector unsigned char *)&pkts[2]->rearm_data);
+		(__vector unsigned char *)rte_mbuf_rearm_data(pkts[2]));
 	vec_vsx_st(rearm3, 0,
-		(__vector unsigned char *)&pkts[3]->rearm_data);
+		(__vector unsigned char *)rte_mbuf_rearm_data(pkts[3]));
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index 3ed6881..97ea620 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -99,7 +99,7 @@
 		t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN);
 	uint16_t pkts_n = mcqe_n;
 	const uint64x2_t rearm =
-		vld1q_u64((void *)&t_pkt->rearm_data);
+		vld1q_u64((void *)rte_mbuf_rearm_data(t_pkt));
 	const uint32x4_t rxdf_mask = {
 		0xffffffff, /* packet_type */
 		0,          /* skip pkt_len */
@@ -107,7 +107,7 @@
 		0,          /* skip hash.rss */
 	};
 	const uint8x16_t rxdf =
-		vandq_u8(vld1q_u8((void *)&t_pkt->rx_descriptor_fields1),
+		vandq_u8(vld1q_u8(rte_mbuf_rx_descriptor_fields1(t_pkt)),
 			 vreinterpretq_u8_u32(rxdf_mask));
 	const uint16x8_t crc_adj = {
 		0, 0,
@@ -140,10 +140,10 @@
 		rte_prefetch0((void *)(cq + mcqe_n));
 	for (pos = 0; pos < mcqe_n; ) {
 		uint8_t *p = (void *)&mcq[pos % 8];
-		uint8_t *e0 = (void *)&elts[pos]->rearm_data;
-		uint8_t *e1 = (void *)&elts[pos + 1]->rearm_data;
-		uint8_t *e2 = (void *)&elts[pos + 2]->rearm_data;
-		uint8_t *e3 = (void *)&elts[pos + 3]->rearm_data;
+		uint8_t *e0 = (void *)rte_mbuf_rearm_data(elts[pos]);
+		uint8_t *e1 = (void *)rte_mbuf_rearm_data(elts[pos + 1]);
+		uint8_t *e2 = (void *)rte_mbuf_rearm_data(elts[pos + 2]);
+		uint8_t *e3 = (void *)rte_mbuf_rearm_data(elts[pos + 3]);
 		uint16x4_t byte_cnt;
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		uint16x4_t invalid_mask =
@@ -513,10 +513,10 @@
 					(vgetq_lane_u32(ol_flags, 0),
 					 vreinterpretq_u32_u64(mbuf_init), 2));
 
-	vst1q_u64((void *)&pkts[0]->rearm_data, rearm0);
-	vst1q_u64((void *)&pkts[1]->rearm_data, rearm1);
-	vst1q_u64((void *)&pkts[2]->rearm_data, rearm2);
-	vst1q_u64((void *)&pkts[3]->rearm_data, rearm3);
+	vst1q_u64((void *)rte_mbuf_rearm_data(pkts[0]), rearm0);
+	vst1q_u64((void *)rte_mbuf_rearm_data(pkts[1]), rearm1);
+	vst1q_u64((void *)rte_mbuf_rearm_data(pkts[2]), rearm2);
+	vst1q_u64((void *)rte_mbuf_rearm_data(pkts[3]), rearm3);
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index 2bdd1f6..088ce37 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -98,9 +98,9 @@
 		t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN);
 	uint16_t pkts_n = mcqe_n;
 	const __m128i rearm =
-		_mm_loadu_si128((__m128i *)&t_pkt->rearm_data);
+		_mm_loadu_si128((__m128i *)rte_mbuf_rearm_data(t_pkt));
 	const __m128i rxdf =
-		_mm_loadu_si128((__m128i *)&t_pkt->rx_descriptor_fields1);
+		_mm_loadu_si128((__m128i *)rte_mbuf_rx_descriptor_fields1(t_pkt));
 	const __m128i crc_adj =
 		_mm_set_epi16(0, 0, 0,
 			      rxq->crc_present * RTE_ETHER_CRC_LEN,
@@ -145,8 +145,8 @@
 		mcqe1 = _mm_loadu_si128((__m128i *)&mcq[pos % 8]);
 		mcqe2 = _mm_loadu_si128((__m128i *)&mcq[pos % 8 + 2]);
 		/* B.1 store rearm data to mbuf. */
-		_mm_storeu_si128((__m128i *)&elts[pos]->rearm_data, rearm);
-		_mm_storeu_si128((__m128i *)&elts[pos + 1]->rearm_data, rearm);
+		_mm_storeu_si128((__m128i *)rte_mbuf_rearm_data(elts[pos]), rearm);
+		_mm_storeu_si128((__m128i *)rte_mbuf_rearm_data(elts[pos + 1]), rearm);
 		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
 		rxdf1 = _mm_shuffle_epi8(mcqe1, shuf_mask1);
 		rxdf2 = _mm_shuffle_epi8(mcqe1, shuf_mask2);
@@ -156,14 +156,14 @@
 		rxdf2 = _mm_blend_epi16(rxdf2, rxdf, 0x23);
 		/* D.1 store rx_descriptor_fields1. */
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos]->rx_descriptor_fields1,
+				  rte_mbuf_rx_descriptor_fields1(elts[pos]),
 				 rxdf1);
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 1]->rx_descriptor_fields1,
+				  rte_mbuf_rx_descriptor_fields1(elts[pos + 1]),
 				 rxdf2);
 		/* B.1 store rearm data to mbuf. */
-		_mm_storeu_si128((__m128i *)&elts[pos + 2]->rearm_data, rearm);
-		_mm_storeu_si128((__m128i *)&elts[pos + 3]->rearm_data, rearm);
+		_mm_storeu_si128((__m128i *)rte_mbuf_rearm_data(elts[pos + 2]), rearm);
+		_mm_storeu_si128((__m128i *)rte_mbuf_rearm_data(elts[pos + 3]), rearm);
 		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
 		rxdf1 = _mm_shuffle_epi8(mcqe2, shuf_mask1);
 		rxdf2 = _mm_shuffle_epi8(mcqe2, shuf_mask2);
@@ -173,10 +173,10 @@
 		rxdf2 = _mm_blend_epi16(rxdf2, rxdf, 0x23);
 		/* D.1 store rx_descriptor_fields1. */
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 2]->rx_descriptor_fields1,
+				  rte_mbuf_rx_descriptor_fields1(elts[pos + 2]),
 				 rxdf1);
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 3]->rx_descriptor_fields1,
+				  rte_mbuf_rx_descriptor_fields1(elts[pos + 3]),
 				 rxdf2);
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		invalid_mask = _mm_set_epi64x(0,
@@ -511,10 +511,10 @@
 	rearm2 = _mm_blend_epi16(mbuf_init, ol_flags, 0x30);
 	rearm3 = _mm_blend_epi16(mbuf_init, _mm_srli_si128(ol_flags, 4), 0x30);
 	/* Write 8B rearm_data and 8B ol_flags. */
-	_mm_store_si128((__m128i *)&pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(pkts[3]), rearm3);
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 19/22] net/octeon_ep: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (17 preceding siblings ...)
  2024-02-24  8:22   ` [PATCH v5 18/22] net/mlx5: " Tyler Retzlaff
@ 2024-02-24  8:22   ` Tyler Retzlaff
  2024-02-24  8:22   ` [PATCH v5 20/22] net/sfc: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:22 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/octeon_ep/cnxk_ep_rx.h      | 2 +-
 drivers/net/octeon_ep/cnxk_ep_rx_avx.c  | 2 +-
 drivers/net/octeon_ep/cnxk_ep_rx_neon.c | 8 ++++----
 drivers/net/octeon_ep/cnxk_ep_rx_sse.c  | 8 ++++----
 drivers/net/octeon_ep/otx_ep_rxtx.c     | 5 +----
 5 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/net/octeon_ep/cnxk_ep_rx.h b/drivers/net/octeon_ep/cnxk_ep_rx.h
index 61263e6..1d706e2 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx.h
+++ b/drivers/net/octeon_ep/cnxk_ep_rx.h
@@ -158,7 +158,7 @@
 		mbuf->pkt_len = pkt_len;
 		mbuf->data_len = pkt_len;
 
-		*(uint64_t *)&mbuf->rearm_data = droq->rearm_data;
+		*rte_mbuf_rearm_data(mbuf) = droq->rearm_data;
 		rx_pkts[pkts] = mbuf;
 		bytes_rsvd += pkt_len;
 	}
diff --git a/drivers/net/octeon_ep/cnxk_ep_rx_avx.c b/drivers/net/octeon_ep/cnxk_ep_rx_avx.c
index 47eb1d2..3b8241c 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx_avx.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx_avx.c
@@ -60,7 +60,7 @@
 
 		/* Store the 256bit data to the mbuf. */
 		for (i = 0; i < CNXK_EP_OQ_DESC_PER_LOOP_AVX; i++)
-			_mm256_storeu_si256((__m256i *)&m[i]->rearm_data, data[i]);
+			_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(m[i]), data[i]);
 
 		for (i = 0; i < CNXK_EP_OQ_DESC_PER_LOOP_AVX; i++)
 			rx_pkts[pkts++] = m[i];
diff --git a/drivers/net/octeon_ep/cnxk_ep_rx_neon.c b/drivers/net/octeon_ep/cnxk_ep_rx_neon.c
index 4c46a7e..8797252 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx_neon.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx_neon.c
@@ -72,10 +72,10 @@
 		*(uint64_t *)&m3->pkt_len = vgetq_lane_u64(s23, 1);
 
 		/* Reset rearm data. */
-		*(uint64_t *)&m0->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m1->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m2->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m3->rearm_data = droq->rearm_data;
+		*rte_mbuf_rearm_data(m0) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m1) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m2) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m3) = droq->rearm_data;
 
 		rx_pkts[pkts++] = m0;
 		rx_pkts[pkts++] = m1;
diff --git a/drivers/net/octeon_ep/cnxk_ep_rx_sse.c b/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
index 308c8b2..1466217 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
@@ -64,10 +64,10 @@
 		*(uint64_t *)&m3->pkt_len = ((rte_xmm_t)s23).u64[1];
 
 		/* Reset rearm data. */
-		*(uint64_t *)&m0->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m1->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m2->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m3->rearm_data = droq->rearm_data;
+		*rte_mbuf_rearm_data(m0) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m1) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m2) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m3) = droq->rearm_data;
 
 		rx_pkts[pkts++] = m0;
 		rx_pkts[pkts++] = m1;
diff --git a/drivers/net/octeon_ep/otx_ep_rxtx.c b/drivers/net/octeon_ep/otx_ep_rxtx.c
index aea148e..4470599 100644
--- a/drivers/net/octeon_ep/otx_ep_rxtx.c
+++ b/drivers/net/octeon_ep/otx_ep_rxtx.c
@@ -289,7 +289,6 @@
 {
 	uint16_t port_id = otx_ep->port_id;
 	struct rte_mbuf mb_def;
-	uint64_t *tmp;
 
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) % 8 != 0);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) - offsetof(struct rte_mbuf, data_off) !=
@@ -305,9 +304,7 @@
 
 	/* Prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	tmp = (uint64_t *)&mb_def.rearm_data;
-
-	return *tmp;
+	return *rte_mbuf_rearm_data(&mb_def);
 }
 
 /* OQ initialization */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 20/22] net/sfc: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (18 preceding siblings ...)
  2024-02-24  8:22   ` [PATCH v5 19/22] net/octeon_ep: " Tyler Retzlaff
@ 2024-02-24  8:22   ` Tyler Retzlaff
  2024-02-24  8:22   ` [PATCH v5 21/22] net/thunderx: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:22 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/sfc/sfc_ef100_rx.c | 4 ++--
 drivers/net/sfc/sfc_ef10_rx.c  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c
index e283879..3d93a7c 100644
--- a/drivers/net/sfc/sfc_ef100_rx.c
+++ b/drivers/net/sfc/sfc_ef100_rx.c
@@ -555,7 +555,7 @@ struct sfc_ef100_rxq {
 
 		RTE_BUILD_BUG_ON(sizeof(pkt->rearm_data[0]) !=
 				 sizeof(rxq->rearm_data));
-		pkt->rearm_data[0] = rxq->rearm_data;
+		*rte_mbuf_rearm_data(pkt) = rxq->rearm_data;
 
 		/* data_off already moved past Rx prefix */
 		rx_prefix = (const efx_xword_t *)sfc_ef100_rx_pkt_prefix(pkt);
@@ -761,7 +761,7 @@ struct sfc_ef100_rxq {
 	/* rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
 	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	return *rte_mbuf_rearm_data(&m);
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef100_rx_qcreate;
diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c
index 6044293..9c993a3 100644
--- a/drivers/net/sfc/sfc_ef10_rx.c
+++ b/drivers/net/sfc/sfc_ef10_rx.c
@@ -323,7 +323,7 @@ struct sfc_ef10_rxq {
 	m = rxd->mbuf;
 
 	RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) != sizeof(rxq->rearm_data));
-	m->rearm_data[0] = rxq->rearm_data;
+	*rte_mbuf_rearm_data(m) = rxq->rearm_data;
 
 	/* Classify packet based on Rx event */
 	/* Mask RSS hash offload flag if RSS is not enabled */
@@ -379,7 +379,7 @@ struct sfc_ef10_rxq {
 
 		RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) !=
 				 sizeof(rxq->rearm_data));
-		m->rearm_data[0] = rxq->rearm_data;
+		*rte_mbuf_rearm_data(m) = rxq->rearm_data;
 
 		/* Event-dependent information is the same */
 		m->ol_flags = m0->ol_flags;
@@ -634,7 +634,7 @@ struct sfc_ef10_rxq {
 	/* rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
 	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	return *rte_mbuf_rearm_data(&m);
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef10_rx_qcreate;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 21/22] net/thunderx: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (19 preceding siblings ...)
  2024-02-24  8:22   ` [PATCH v5 20/22] net/sfc: " Tyler Retzlaff
@ 2024-02-24  8:22   ` Tyler Retzlaff
  2024-02-24  8:22   ` [PATCH v5 22/22] net/virtio: " Tyler Retzlaff
  2024-02-24 10:42   ` [PATCH v5 00/22] stop using RTE_MARKER extensions Morten Brørup
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:22 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/thunderx/nicvf_ethdev.c | 4 +---
 drivers/net/thunderx/nicvf_rxtx.h   | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 609d95d..722751c 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1306,7 +1306,6 @@ enum nicvf_link_speed {
 static inline void
 nicvf_rxq_mbuf_setup(struct nicvf_rxq *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def;
 	struct nicvf *nic = rxq->nic;
 
@@ -1328,8 +1327,7 @@ enum nicvf_link_speed {
 
 	/* Prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer.value = *(uint64_t *)p;
+	rxq->mbuf_initializer.value = *rte_mbuf_rearm_data(&mb_def);
 }
 
 static int
diff --git a/drivers/net/thunderx/nicvf_rxtx.h b/drivers/net/thunderx/nicvf_rxtx.h
index 4b83e33..7c07cde 100644
--- a/drivers/net/thunderx/nicvf_rxtx.h
+++ b/drivers/net/thunderx/nicvf_rxtx.h
@@ -66,7 +66,7 @@ static inline uint16_t __attribute__((const))
 #else
 	init.value += apad;
 #endif
-	*(uint64_t *)(&pkt->rearm_data) = init.value;
+	*rte_mbuf_rearm_data(pkt) = init.value;
 }
 
 static inline void
@@ -80,7 +80,7 @@ static inline uint16_t __attribute__((const))
 	init.value += apad;
 #endif
 	init.fields.nb_segs = nb_segs;
-	*(uint64_t *)(&pkt->rearm_data) = init.value;
+	*rte_mbuf_rearm_data(pkt) = init.value;
 }
 
 uint32_t nicvf_dev_rx_queue_count(void *rx_queue);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v5 22/22] net/virtio: use mbuf descriptor accessors
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (20 preceding siblings ...)
  2024-02-24  8:22   ` [PATCH v5 21/22] net/thunderx: " Tyler Retzlaff
@ 2024-02-24  8:22   ` Tyler Retzlaff
  2024-02-24 10:42   ` [PATCH v5 00/22] stop using RTE_MARKER extensions Morten Brørup
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-24  8:22 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/virtio/virtio_rxtx_packed_avx.h     | 10 +++++-----
 drivers/net/virtio/virtio_rxtx_packed_neon.h    | 16 ++++++++--------
 drivers/net/virtio/virtio_rxtx_simple.c         |  4 +---
 drivers/net/virtio/virtio_rxtx_simple.h         |  5 +----
 drivers/net/virtio/virtio_rxtx_simple_altivec.c | 16 ++++++++--------
 drivers/net/virtio/virtio_rxtx_simple_neon.c    | 24 ++++++++----------------
 drivers/net/virtio/virtio_rxtx_simple_sse.c     | 16 ++++++++--------
 7 files changed, 39 insertions(+), 52 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.h b/drivers/net/virtio/virtio_rxtx_packed_avx.h
index 584ac72..fc60179 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_avx.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h
@@ -36,10 +36,10 @@
 	/* Load four mbufs rearm data */
 	RTE_BUILD_BUG_ON(REFCNT_BITS_OFFSET >= 64);
 	RTE_BUILD_BUG_ON(SEG_NUM_BITS_OFFSET >= 64);
-	__m256i mbufs = _mm256_set_epi64x(*tx_pkts[3]->rearm_data,
-					  *tx_pkts[2]->rearm_data,
-					  *tx_pkts[1]->rearm_data,
-					  *tx_pkts[0]->rearm_data);
+	__m256i mbufs = _mm256_set_epi64x(*rte_mbuf_rearm_data(tx_pkts[3]),
+					  *rte_mbuf_rearm_data(tx_pkts[2]),
+					  *rte_mbuf_rearm_data(tx_pkts[1]),
+					  *rte_mbuf_rearm_data(tx_pkts[0]));
 
 	/* refcnt=1 and nb_segs=1 */
 	__m256i mbuf_ref = _mm256_set1_epi64x(DEFAULT_REARM_DATA);
@@ -187,7 +187,7 @@
 		rx_pkts[i] = (struct rte_mbuf *)vq->vq_descx[id + i].cookie;
 		rte_packet_prefetch(rte_pktmbuf_mtod(rx_pkts[i], void *));
 
-		addrs[i] = (uintptr_t)rx_pkts[i]->rx_descriptor_fields1;
+		addrs[i] = (uintptr_t)rte_mbuf_rx_descriptor_fields1(rx_pkts[i]);
 	}
 
 	/*
diff --git a/drivers/net/virtio/virtio_rxtx_packed_neon.h b/drivers/net/virtio/virtio_rxtx_packed_neon.h
index c222ebf..b33f29a 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_neon.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_neon.h
@@ -59,10 +59,10 @@
 	uint8x16x2_t mbuf;
 	/* Load four mbufs rearm data. */
 	RTE_BUILD_BUG_ON(REFCNT_BITS_OFFSET >= 64);
-	pkts[0] = vld1_u16((uint16_t *)&tx_pkts[0]->rearm_data);
-	pkts[1] = vld1_u16((uint16_t *)&tx_pkts[1]->rearm_data);
-	pkts[2] = vld1_u16((uint16_t *)&tx_pkts[2]->rearm_data);
-	pkts[3] = vld1_u16((uint16_t *)&tx_pkts[3]->rearm_data);
+	pkts[0] = vld1_u16((uint16_t *)rte_mbuf_rearm_data(tx_pkts[0]));
+	pkts[1] = vld1_u16((uint16_t *)rte_mbuf_rearm_data(tx_pkts[1]));
+	pkts[2] = vld1_u16((uint16_t *)rte_mbuf_rearm_data(tx_pkts[2]));
+	pkts[3] = vld1_u16((uint16_t *)rte_mbuf_rearm_data(tx_pkts[3]));
 
 	mbuf.val[0] = vreinterpretq_u8_u16(vcombine_u16(pkts[0], pkts[1]));
 	mbuf.val[1] = vreinterpretq_u8_u16(vcombine_u16(pkts[2], pkts[3]));
@@ -263,10 +263,10 @@
 	pkt_mb[3] = vreinterpretq_u64_u16(vsubq_u16(
 			vreinterpretq_u16_u64(pkt_mb[3]), len_adjust));
 
-	vst1q_u64((void *)&rx_pkts[0]->rx_descriptor_fields1, pkt_mb[0]);
-	vst1q_u64((void *)&rx_pkts[1]->rx_descriptor_fields1, pkt_mb[1]);
-	vst1q_u64((void *)&rx_pkts[2]->rx_descriptor_fields1, pkt_mb[2]);
-	vst1q_u64((void *)&rx_pkts[3]->rx_descriptor_fields1, pkt_mb[3]);
+	vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[0]), pkt_mb[0]);
+	vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[1]), pkt_mb[1]);
+	vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[2]), pkt_mb[2]);
+	vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[3]), pkt_mb[3]);
 
 	if (hw->has_rx_offload) {
 		virtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index 4382569..e6a82e5 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -31,7 +31,6 @@
 virtio_rxq_vec_setup(struct virtnet_rx *rxq)
 {
 	struct virtqueue *vq = virtnet_rxq_to_vq(rxq);
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -41,8 +40,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 
 	return 0;
 }
diff --git a/drivers/net/virtio/virtio_rxtx_simple.h b/drivers/net/virtio/virtio_rxtx_simple.h
index 79196ed..16fef0e 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.h
+++ b/drivers/net/virtio/virtio_rxtx_simple.h
@@ -39,10 +39,7 @@
 	}
 
 	for (i = 0; i < RTE_VIRTIO_VPMD_RX_REARM_THRESH; i++) {
-		uintptr_t p;
-
-		p = (uintptr_t)&sw_ring[i]->rearm_data;
-		*(uint64_t *)p = rxvq->mbuf_initializer;
+		*rte_mbuf_rearm_data(sw_ring[i]) = rxvq->mbuf_initializer;
 
 		start_dp[i].addr = VIRTIO_MBUF_ADDR(sw_ring[i], vq) +
 			RTE_PKTMBUF_HEADROOM - vq->hw->vtnet_hdr_size;
diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
index 542ec3d..39ec1ca 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
@@ -138,9 +138,9 @@
 			((__vector unsigned short)pkt_mb[0] + len_adjust);
 		pkt_mb[1] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[1] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[0]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[0]) =
 			pkt_mb[0];
-		*(__vector unsigned char *)&rx_pkts[1]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[1]) =
 			pkt_mb[1];
 
 		pkt_mb[2] = vec_perm(desc[1], zero, shuf_msk1);
@@ -149,9 +149,9 @@
 			((__vector unsigned short)pkt_mb[2] + len_adjust);
 		pkt_mb[3] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[3] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[2]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[2]) =
 			pkt_mb[2];
-		*(__vector unsigned char *)&rx_pkts[3]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[3]) =
 			pkt_mb[3];
 
 		pkt_mb[4] = vec_perm(desc[2], zero, shuf_msk1);
@@ -160,9 +160,9 @@
 			((__vector unsigned short)pkt_mb[4] + len_adjust);
 		pkt_mb[5] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[5] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[4]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[4]) =
 			pkt_mb[4];
-		*(__vector unsigned char *)&rx_pkts[5]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[5]) =
 			pkt_mb[5];
 
 		pkt_mb[6] = vec_perm(desc[3], zero, shuf_msk1);
@@ -171,9 +171,9 @@
 			((__vector unsigned short)pkt_mb[6] + len_adjust);
 		pkt_mb[7] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[7] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[6]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[6]) =
 			pkt_mb[6];
-		*(__vector unsigned char *)&rx_pkts[7]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[7]) =
 			pkt_mb[7];
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c
index 7139b31..873b42c 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_neon.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c
@@ -138,10 +138,8 @@
 				vreinterpretq_u16_u64(pkt_mb[1]), len_adjust));
 		pkt_mb[0] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[0]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[1]->rx_descriptor_fields1,
-			pkt_mb[1]);
-		vst1q_u64((void *)&rx_pkts[0]->rx_descriptor_fields1,
-			pkt_mb[0]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[1]), pkt_mb[1]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[0]), pkt_mb[0]);
 
 		pkt_mb[3] = vreinterpretq_u64_u8(vqtbl1q_u8(
 				vreinterpretq_u8_u64(desc[1]), shuf_msk2));
@@ -151,10 +149,8 @@
 				vreinterpretq_u16_u64(pkt_mb[3]), len_adjust));
 		pkt_mb[2] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[2]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[3]->rx_descriptor_fields1,
-			pkt_mb[3]);
-		vst1q_u64((void *)&rx_pkts[2]->rx_descriptor_fields1,
-			pkt_mb[2]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[3]), pkt_mb[3]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[2]), pkt_mb[2]);
 
 		pkt_mb[5] = vreinterpretq_u64_u8(vqtbl1q_u8(
 				vreinterpretq_u8_u64(desc[2]), shuf_msk2));
@@ -164,10 +160,8 @@
 				vreinterpretq_u16_u64(pkt_mb[5]), len_adjust));
 		pkt_mb[4] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[4]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[5]->rx_descriptor_fields1,
-			pkt_mb[5]);
-		vst1q_u64((void *)&rx_pkts[4]->rx_descriptor_fields1,
-			pkt_mb[4]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[5]), pkt_mb[5]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[4]), pkt_mb[4]);
 
 		pkt_mb[7] = vreinterpretq_u64_u8(vqtbl1q_u8(
 				vreinterpretq_u8_u64(desc[3]), shuf_msk2));
@@ -177,10 +171,8 @@
 				vreinterpretq_u16_u64(pkt_mb[7]), len_adjust));
 		pkt_mb[6] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[6]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[7]->rx_descriptor_fields1,
-			pkt_mb[7]);
-		vst1q_u64((void *)&rx_pkts[6]->rx_descriptor_fields1,
-			pkt_mb[6]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[7]), pkt_mb[7]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[6]), pkt_mb[6]);
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
 			if (sw_ring + nb_used <= sw_ring_end)
diff --git a/drivers/net/virtio/virtio_rxtx_simple_sse.c b/drivers/net/virtio/virtio_rxtx_simple_sse.c
index 6a18741..25db486 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_sse.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_sse.c
@@ -134,36 +134,36 @@
 		pkt_mb[0] = _mm_shuffle_epi8(desc[0], shuf_msk1);
 		pkt_mb[1] = _mm_add_epi16(pkt_mb[1], len_adjust);
 		pkt_mb[0] = _mm_add_epi16(pkt_mb[0], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[1]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[1]),
 			pkt_mb[1]);
-		_mm_storeu_si128((void *)&rx_pkts[0]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[0]),
 			pkt_mb[0]);
 
 		pkt_mb[3] = _mm_shuffle_epi8(desc[1], shuf_msk2);
 		pkt_mb[2] = _mm_shuffle_epi8(desc[1], shuf_msk1);
 		pkt_mb[3] = _mm_add_epi16(pkt_mb[3], len_adjust);
 		pkt_mb[2] = _mm_add_epi16(pkt_mb[2], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[3]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[3]),
 			pkt_mb[3]);
-		_mm_storeu_si128((void *)&rx_pkts[2]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[2]),
 			pkt_mb[2]);
 
 		pkt_mb[5] = _mm_shuffle_epi8(desc[2], shuf_msk2);
 		pkt_mb[4] = _mm_shuffle_epi8(desc[2], shuf_msk1);
 		pkt_mb[5] = _mm_add_epi16(pkt_mb[5], len_adjust);
 		pkt_mb[4] = _mm_add_epi16(pkt_mb[4], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[5]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[5]),
 			pkt_mb[5]);
-		_mm_storeu_si128((void *)&rx_pkts[4]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[4]),
 			pkt_mb[4]);
 
 		pkt_mb[7] = _mm_shuffle_epi8(desc[3], shuf_msk2);
 		pkt_mb[6] = _mm_shuffle_epi8(desc[3], shuf_msk1);
 		pkt_mb[7] = _mm_add_epi16(pkt_mb[7], len_adjust);
 		pkt_mb[6] = _mm_add_epi16(pkt_mb[6], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[7]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[7]),
 			pkt_mb[7]);
-		_mm_storeu_si128((void *)&rx_pkts[6]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[6]),
 			pkt_mb[6]);
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v5 00/22] stop using RTE_MARKER extensions
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
                     ` (21 preceding siblings ...)
  2024-02-24  8:22   ` [PATCH v5 22/22] net/virtio: " Tyler Retzlaff
@ 2024-02-24 10:42   ` Morten Brørup
  2024-02-24 11:13     ` Thomas Monjalon
  22 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-02-24 10:42 UTC (permalink / raw)
  To: Tyler Retzlaff, dev, thomas
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

+to: Thomas

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Saturday, 24 February 2024 09.22
> 
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. This series
> hides the markers when building with MSVC and updates libraries and
> drivers to access compatibly typed pointers to the rte_mbuf struct
> offsets.
> 
> This series, does the following.
> 
> Introduces a new macro __rte_marker(type, name) which is used to
> conditionally expand RTE_MARKER fields empty when building with GCC.

Important typo: GCC -> MSVC.

Correct me if I'm wrong: When building with MSVC, the RTE_MARKER fields don't exist at all.

> 
> Updates existing inline functions accessing cacheline{0,1} markers in
> the rte_mbuf struct to stop using the markers and instead uses the mbuf
> fields directly.
> 
> Introduces 2 new inline functions to allow drivers to access rearm_data
> and rx_descriptor_fields1 descriptors without using the RTE_MARKER
> fields.
> 
> Updates all drivers to use the new inline rte_mbuf struct accessors for
> rearm_data and rx_descriptor_fields1.
> 
> Any previous Acks on the series are considered to be reset due to amount
> of change.
> 
> v5:
>   * update existing cacheline{0, 1} inline functions to access actual
>     mbuf fields.
>   * introduce new inline functions for accessing rearm_data and
>     rx_descriptor_fields1 descriptors.
>   * adapt drivers to use new inline functions.

Accessor functions like these are BS for structures that are part of the public API.
Nobody will use the accessor functions! When developing an application (or lib or driver), the developer will look at the structure and access the relevant fields directly; why would the developer start looking elsewhere for accessor functions?

Another alternative would be to remove the rearm_data and rx_descriptor_fields1 fields from the structure, and in the drivers address the first field of the group, and preferably add some static_asserts to check the sequence of the fields they cover. I don't like this alternative, but I'm putting it out there for discussion/inspiration.
I prefer the union+struct approach to visibly group the fields together.


Overall, I dislike approach taken in this version of the patch series.
On the surface, it has minimal changes to the mbuf structure.
But underneath, some of the fields (the markers) may or may not exist, depending on compiler, and this fact is not obvious when looking at the structure. I think this will degrade future MSVC compatibility for both applications, libraries and PMDs.

As Thomas stressed, we should take special care of the mbuf structure!
It has to be modified for MSVC compatibility, so we have to find the best compromise.
Personally, I prefer the previous approach over this version.

Maybe we need to compromise on API compatibility to make this a beautiful modification.

@Thomas, looking at the mbuf and eal patches, what do you think about this version of the series?


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v5 01/22] eal: provide macro to expand marker extensions
  2024-02-24  8:21   ` [PATCH v5 01/22] eal: provide macro to expand marker extensions Tyler Retzlaff
@ 2024-02-24 10:51     ` Thomas Monjalon
  2024-02-24 11:18       ` Thomas Monjalon
  0 siblings, 1 reply; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-24 10:51 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

24/02/2024 09:21, Tyler Retzlaff:
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide a
> new macro __rte_marker(type, name) that may be used to expand RTE_MARKER
> empty in struct definitions when building with MSVC.

I don't think we need to define a new marker macro.
I propose to simply not define them with MSVC, triggering a compilation error.
So we keep the old markers for applications which were not using MSVC anyway.
And inside DPDK libraries and drivers, we remove their usages.




^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v5 05/22] mbuf: stop using mbuf cacheline marker fields
  2024-02-24  8:21   ` [PATCH v5 05/22] mbuf: stop using mbuf cacheline marker fields Tyler Retzlaff
@ 2024-02-24 10:58     ` Thomas Monjalon
  2024-02-26 18:20       ` Stephen Hemminger
  0 siblings, 1 reply; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-24 10:58 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

24/02/2024 09:21, Tyler Retzlaff:
> Update prefetch inline functions to access rte_mbuf struct fields
> directly instead of via cacheline{0,1} marker extension fields.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
[...]
>  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
>  {
> -	rte_prefetch0(&m->cacheline0);
> +	rte_prefetch0(&m->buf_addr);

Should be simply "m", no need to point to the first field explicitly.

[...]
>  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
>  {
>  #if RTE_CACHE_LINE_SIZE == 64
> -	rte_prefetch0(&m->cacheline1);
> +#if RTE_IOVA_IN_MBUF
> +	rte_prefetch0(&m->next);
> +#else
> +	rte_prefetch0(&m->dynfield2);
> +#endif

I think it is better to calculate m + min cache line size
instead of relying on fields.



^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v5 06/22] mbuf: add mbuf descriptor accessors
  2024-02-24  8:21   ` [PATCH v5 06/22] mbuf: add mbuf descriptor accessors Tyler Retzlaff
@ 2024-02-24 11:01     ` Thomas Monjalon
  0 siblings, 0 replies; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-24 11:01 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

24/02/2024 09:21, Tyler Retzlaff:
> Provide inline functions to access rearm data and rx descriptor fields
> in rte_mbuf struct.
[...]
> +static inline
> +uint64_t *
> +rte_mbuf_rearm_data(struct rte_mbuf *m)
> +{
> +	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
> +			 offsetof(struct rte_mbuf, data_off) + 8);
> +	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
> +			 RTE_ALIGN(offsetof(struct rte_mbuf,
> +					    data_off),
> +					    16));
> +
> +	return (uint64_t *)&m->data_off;
> +}
> +
> +static inline
> +void *
> +rte_mbuf_rx_descriptor_fields1(struct rte_mbuf *m)
> +{
> +	return &m->packet_type;
> +}

We need to enforce usage of these accessors.
Please add these 2 things:
1/ comments in the mbuf structure to encourage using these functions
2/ checkpatch warning if using the markers directly in new code



^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v5 00/22] stop using RTE_MARKER extensions
  2024-02-24 10:42   ` [PATCH v5 00/22] stop using RTE_MARKER extensions Morten Brørup
@ 2024-02-24 11:13     ` Thomas Monjalon
  2024-02-24 11:23       ` Morten Brørup
  0 siblings, 1 reply; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-24 11:13 UTC (permalink / raw)
  To: Tyler Retzlaff, Morten Brørup
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang

24/02/2024 11:42, Morten Brørup:
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. This series
> > hides the markers when building with MSVC and updates libraries and
> > drivers to access compatibly typed pointers to the rte_mbuf struct
> > offsets.
> > 
> > This series, does the following.
> > 
> > Introduces a new macro __rte_marker(type, name) which is used to
> > conditionally expand RTE_MARKER fields empty when building with GCC.
> 
> Important typo: GCC -> MSVC.
> 
> Correct me if I'm wrong: When building with MSVC, the RTE_MARKER fields don't exist at all.

Yes it should trigger a compiler error when using an old marker with MSVC.
So no need of this wrapper __rte_marker().

> > Updates existing inline functions accessing cacheline{0,1} markers in
> > the rte_mbuf struct to stop using the markers and instead uses the mbuf
> > fields directly.
> > 
> > Introduces 2 new inline functions to allow drivers to access rearm_data
> > and rx_descriptor_fields1 descriptors without using the RTE_MARKER
> > fields.
> > 
> > Updates all drivers to use the new inline rte_mbuf struct accessors for
> > rearm_data and rx_descriptor_fields1.
> 
> Accessor functions like these are BS for structures that are part of the public API.

What is BS?

> Nobody will use the accessor functions! When developing an application (or lib or driver), the developer will look at the structure and access the relevant fields directly; why would the developer start looking elsewhere for accessor functions?

Yes that's why we need to reference the accessors inside the mbuf structure.
Also we should check new code (with checkpatch) for not using markers anymore.

> Another alternative would be to remove the rearm_data and rx_descriptor_fields1 fields from the structure, and in the drivers address the first field of the group, and preferably add some static_asserts to check the sequence of the fields they cover. I don't like this alternative, but I'm putting it out there for discussion/inspiration.
> I prefer the union+struct approach to visibly group the fields together.

Unions make the mbuf struct more complicate just for compatibility.

> Overall, I dislike approach taken in this version of the patch series.
> On the surface, it has minimal changes to the mbuf structure.
> But underneath, some of the fields (the markers) may or may not exist, depending on compiler, and this fact is not obvious when looking at the structure. I think this will degrade future MSVC compatibility for both applications, libraries and PMDs.

With appropriate checks, we won't use markers anymore.

> As Thomas stressed, we should take special care of the mbuf structure!
> It has to be modified for MSVC compatibility, so we have to find the best compromise.
> Personally, I prefer the previous approach over this version.
> 
> Maybe we need to compromise on API compatibility to make this a beautiful modification.
> 
> @Thomas, looking at the mbuf and eal patches, what do you think about this version of the series?

I prefer this series with following changes:
- no __rte_marker wrapper
- make sure cache line padding is effective without markers
- no direct access of fields for cache line prefetch
- comments in mbuf
- checkpatch



^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v5 01/22] eal: provide macro to expand marker extensions
  2024-02-24 10:51     ` Thomas Monjalon
@ 2024-02-24 11:18       ` Thomas Monjalon
  0 siblings, 0 replies; 171+ messages in thread
From: Thomas Monjalon @ 2024-02-24 11:18 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

24/02/2024 11:51, Thomas Monjalon:
> 24/02/2024 09:21, Tyler Retzlaff:
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide a
> > new macro __rte_marker(type, name) that may be used to expand RTE_MARKER
> > empty in struct definitions when building with MSVC.
> 
> I don't think we need to define a new marker macro.
> I propose to simply not define them with MSVC, triggering a compilation error.
> So we keep the old markers for applications which were not using MSVC anyway.
> And inside DPDK libraries and drivers, we remove their usages.

One more thing to fix:
When padding is done on the marker, example:
	RTE_MARKER cacheline1 __rte_cache_min_aligned;
We need to move alignment on the first real field,
while keeping compatibility with the marker.
I'm afraid we need to have alignment done only once.

It may be difficult without using #ifdef inside the struct.

It's probably easier to replace alignment with explicit padding.



^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v5 00/22] stop using RTE_MARKER extensions
  2024-02-24 11:13     ` Thomas Monjalon
@ 2024-02-24 11:23       ` Morten Brørup
  0 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-02-24 11:23 UTC (permalink / raw)
  To: Thomas Monjalon, Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang

> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Saturday, 24 February 2024 12.14
> 
> 24/02/2024 11:42, Morten Brørup:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. This
> series
> > > hides the markers when building with MSVC and updates libraries and
> > > drivers to access compatibly typed pointers to the rte_mbuf struct
> > > offsets.
> > >
> > > This series, does the following.
> > >
> > > Introduces a new macro __rte_marker(type, name) which is used to
> > > conditionally expand RTE_MARKER fields empty when building with GCC.
> >
> > Important typo: GCC -> MSVC.
> >
> > Correct me if I'm wrong: When building with MSVC, the RTE_MARKER
> fields don't exist at all.
> 
> Yes it should trigger a compiler error when using an old marker with
> MSVC.
> So no need of this wrapper __rte_marker().
> 
> > > Updates existing inline functions accessing cacheline{0,1} markers
> in
> > > the rte_mbuf struct to stop using the markers and instead uses the
> mbuf
> > > fields directly.
> > >
> > > Introduces 2 new inline functions to allow drivers to access
> rearm_data
> > > and rx_descriptor_fields1 descriptors without using the RTE_MARKER
> > > fields.
> > >
> > > Updates all drivers to use the new inline rte_mbuf struct accessors
> for
> > > rearm_data and rx_descriptor_fields1.
> >
> > Accessor functions like these are BS for structures that are part of
> the public API.
> 
> What is BS?
> 
> > Nobody will use the accessor functions! When developing an application
> (or lib or driver), the developer will look at the structure and access
> the relevant fields directly; why would the developer start looking
> elsewhere for accessor functions?
> 
> Yes that's why we need to reference the accessors inside the mbuf
> structure.
> Also we should check new code (with checkpatch) for not using markers
> anymore.
> 
> > Another alternative would be to remove the rearm_data and
> rx_descriptor_fields1 fields from the structure, and in the drivers
> address the first field of the group, and preferably add some
> static_asserts to check the sequence of the fields they cover. I don't
> like this alternative, but I'm putting it out there for
> discussion/inspiration.
> > I prefer the union+struct approach to visibly group the fields
> together.
> 
> Unions make the mbuf struct more complicate just for compatibility.
> 
> > Overall, I dislike approach taken in this version of the patch series.
> > On the surface, it has minimal changes to the mbuf structure.
> > But underneath, some of the fields (the markers) may or may not exist,
> depending on compiler, and this fact is not obvious when looking at the
> structure. I think this will degrade future MSVC compatibility for both
> applications, libraries and PMDs.
> 
> With appropriate checks, we won't use markers anymore.
> 
> > As Thomas stressed, we should take special care of the mbuf structure!
> > It has to be modified for MSVC compatibility, so we have to find the
> best compromise.
> > Personally, I prefer the previous approach over this version.
> >
> > Maybe we need to compromise on API compatibility to make this a
> beautiful modification.
> >
> > @Thomas, looking at the mbuf and eal patches, what do you think about
> this version of the series?
> 
> I prefer this series with following changes:
> - no __rte_marker wrapper
> - make sure cache line padding is effective without markers
> - no direct access of fields for cache line prefetch
> - comments in mbuf
> - checkpatch
> 

Thomas has provided a lot of good feedback for this version of the series, showing that the path is worth exploring further.
In other words: I'm likely to be convinced. ;-)


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf
  2024-02-13 23:33   ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Tyler Retzlaff
  2024-02-13 23:33     ` [PATCH v3] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
  2024-02-14 10:49     ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Morten Brørup
@ 2024-02-26  1:18     ` Stephen Hemminger
  2 siblings, 0 replies; 171+ messages in thread
From: Stephen Hemminger @ 2024-02-26  1:18 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Konstantin Ananyev, Maxime Coquelin, mb

On Tue, 13 Feb 2024 15:33:28 -0800
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> Here is the latest iteration of the proposed change to allow struct rte_mbuf
> to be consumed by MSVC.
> 
> * Introduce an internal __rte_marker macro conditionally expanded for MSVC
>   vs existing users of the struct. At some point we can uncomment __rte_deprecated
>   to assist migration away from the current marker fields for applications
>   after appropriate announcement periods etc..
> 
> * Introduce anonymous unions to allow aliasing of the previous named
>   offsets by a *new* name.  The intention would be to convert the dpdk tree
>   to use the new names along with this change and enable __rte_deprecated
>   for dpdk builds (not applications) to avoid accidental re-introduction.
> 
> * The anonymous unions are now also used to pad cacheline0 and cacheline1 instead
>   of __rte_cache_min_aligned.
> 
> * Converted the type of the fields for the named markers to char[] instead of
>   uint8_t[].
> 
> Tyler Retzlaff (1):
>   mbuf: deprecate GCC marker in rte mbuf struct
> 
>  lib/eal/include/rte_common.h |   6 +
>  lib/mbuf/rte_mbuf_core.h     | 365 +++++++++++++++++++++++--------------------
>  2 files changed, 201 insertions(+), 170 deletions(-)
> 

I was never convinced that __rte_marker was good idea in the first place.

It seemed to be only useful as annotation or for use by pre-fetch.
The problem is that for annotation, it can easily be wrong if using different
cache size or structure chagnes.
For prefetch, just using the structure and pointer math based on cacheline
seems like a better option. Plus DPDK does excessive and unproved prefetching.
For real world cases prefetching doesn't help unless there is enough cycles
from when prefetch is issued and when it is used. If too long, the prefetch
is useless, if too close the extra overhead of the prefetch slows down the
intervening execution units.

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v5 05/22] mbuf: stop using mbuf cacheline marker fields
  2024-02-24 10:58     ` Thomas Monjalon
@ 2024-02-26 18:20       ` Stephen Hemminger
  0 siblings, 0 replies; 171+ messages in thread
From: Stephen Hemminger @ 2024-02-26 18:20 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Tyler Retzlaff, dev, Ajit Khaparde, Andrew Boyer,
	Andrew Rybchenko, Bruce Richardson, Chenbo Xia, Chengwen Feng,
	Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Sat, 24 Feb 2024 11:58:59 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:

> 24/02/2024 09:21, Tyler Retzlaff:
> > Update prefetch inline functions to access rte_mbuf struct fields
> > directly instead of via cacheline{0,1} marker extension fields.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>  
> [...]
> >  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
> >  {
> > -	rte_prefetch0(&m->cacheline0);
> > +	rte_prefetch0(&m->buf_addr);  
> 
> Should be simply "m", no need to point to the first field explicitly.
> 
> [...]
> >  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
> >  {
> >  #if RTE_CACHE_LINE_SIZE == 64
> > -	rte_prefetch0(&m->cacheline1);
> > +#if RTE_IOVA_IN_MBUF
> > +	rte_prefetch0(&m->next);
> > +#else
> > +	rte_prefetch0(&m->dynfield2);
> > +#endif  
> 
> I think it is better to calculate m + min cache line size
> instead of relying on fields.
> 
> 

Agree with Thomas, the markers and field dependency are bad idea.

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 00/23] stop and remove RTE_MARKER typedefs
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
                   ` (2 preceding siblings ...)
  2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
@ 2024-02-27  5:41 ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields Tyler Retzlaff
                     ` (22 more replies)
  2024-03-20 22:01 ` [PATCH v7 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
                   ` (4 subsequent siblings)
  8 siblings, 23 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. This series
stops referencing and removes the markers.

This series, does the following.

* RTE_MARKER{,816,32,64} fields are removed from all structures.
* Moves duplicated assertions referencing marker fields to
  rte_mbuf_core.h and updates them to be based on static_assert
  using non marker field names.
* Updates prefetch inline functions to calculate the address to
  prefetch for cachline0 and cacheline1 without the markers.
* Introduces 2 new inline functions for accessing rearm_data
  and rx_descriptor_fields1 descriptor to decouple from use
  of the marker field names so that they can be removed.
* Updates driver access to use new inline descriptors.

v6:
  * remove all rte marker fields and note their removal in release
    notes.
  * move duplicated assertions to global scope with struct rte_mbuf.
  * calculate cacheline{0,1} addresses without using struct rte_mbuf
    fields.
  * added comments into struct rte_mbuf field directing readers to
    use inline accessors for rearm_data and rx_descriptor_fields1
    descriptors.
  * added checkpatches check to block new additions using RTE_MARKER
    typedefs.
  * switch to using alignas to align cacheline1 in modified structs.
  * removed __rte_marker macro as it was not desired and is now not
    needed.

v5:
  * update existing cacheline{0, 1} inline functions to access actual
    mbuf fields.
  * introduce new inline functions for accessing rearm_data and
    rx_descriptor_fields1 descriptors.
  * adapt drivers to use new inline functions.

prior versions not relevant due to re-work of entire series.

Tyler Retzlaff (23):
  mbuf: add accessors for rearm and Rx descriptor fields
  mbuf: consolidate driver asserts for mbuf struct
  common/idpf: use mbuf descriptor accessors
  net/bnxt: use mbuf descriptor accessors
  net/cnxk: use mbuf descriptor accessors
  net/enic: use mbuf descriptor accessors
  net/fm10k: use mbuf descriptor accessors
  net/hns3: use mbuf descriptor accessors
  net/i40e: use mbuf descriptor accessors
  net/iavf: use mbuf descriptor accessors
  net/ice: use mbuf descriptor accessors
  net/ionic: use mbuf descriptor accessors
  net/ixgbe: use mbuf descriptor accessors
  net/mlx5: use mbuf descriptor accessors
  net/octeon_ep: use mbuf descriptor accessors
  net/sfc: use mbuf descriptor accessors
  net/thunderx: use mbuf descriptor accessors
  net/virtio: use mbuf descriptor accessors
  examples/dma: use mbuf descriptor accessor
  mbuf: remove and stop using rte marker fields
  security: remove rte marker fields
  cryptodev: remove rte marker fields
  devtools: forbid new use of rte marker typedefs

 devtools/checkpatches.sh                        |  8 +++
 doc/guides/rel_notes/release_24_03.rst          | 15 +++++
 drivers/common/idpf/idpf_common_rxtx.c          |  4 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c   | 73 +++++----------------
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c           | 32 +++++-----
 drivers/net/bnxt/bnxt_rxtx_vec_common.h         |  4 +-
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c           | 16 ++---
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c            | 16 ++---
 drivers/net/cnxk/cn10k_rx.h                     | 36 +++++------
 drivers/net/cnxk/cn9k_rx.h                      | 20 +++---
 drivers/net/cnxk/cnxk_ethdev.c                  |  2 +-
 drivers/net/enic/enic_main.c                    |  4 +-
 drivers/net/enic/enic_rxtx_vec_avx2.c           | 18 +++---
 drivers/net/fm10k/fm10k_rxtx_vec.c              | 32 ++--------
 drivers/net/hns3/hns3_rxtx_vec.c                | 22 +------
 drivers/net/hns3/hns3_rxtx_vec_neon.h           | 24 +++----
 drivers/net/hns3/hns3_rxtx_vec_sve.c            |  4 +-
 drivers/net/i40e/i40e_rxtx_vec_altivec.c        | 18 ++----
 drivers/net/i40e/i40e_rxtx_vec_avx2.c           | 34 +++-------
 drivers/net/i40e/i40e_rxtx_vec_avx512.c         | 35 +++-------
 drivers/net/i40e/i40e_rxtx_vec_common.h         |  4 +-
 drivers/net/i40e/i40e_rxtx_vec_neon.c           | 16 ++---
 drivers/net/i40e/i40e_rxtx_vec_sse.c            | 43 +++----------
 drivers/net/iavf/iavf_rxtx_vec_avx2.c           | 72 +++++----------------
 drivers/net/iavf/iavf_rxtx_vec_avx512.c         | 72 +++++----------------
 drivers/net/iavf/iavf_rxtx_vec_common.h         |  4 +-
 drivers/net/iavf/iavf_rxtx_vec_neon.c           | 16 ++---
 drivers/net/iavf/iavf_rxtx_vec_sse.c            | 85 +++++--------------------
 drivers/net/ice/ice_rxtx_vec_avx2.c             | 36 +++--------
 drivers/net/ice/ice_rxtx_vec_avx512.c           | 37 +++--------
 drivers/net/ice/ice_rxtx_vec_common.h           |  4 +-
 drivers/net/ice/ice_rxtx_vec_sse.c              | 44 +++----------
 drivers/net/ionic/ionic_lif.c                   |  6 +-
 drivers/net/ionic/ionic_rxtx_sg.c               |  4 +-
 drivers/net/ionic/ionic_rxtx_simple.c           |  2 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h       |  4 +-
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c         | 12 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c          | 51 ++++-----------
 drivers/net/mlx5/mlx5_rxq.c                     |  2 +-
 drivers/net/mlx5/mlx5_rxtx_vec.h                | 19 ------
 drivers/net/mlx5/mlx5_rxtx_vec_altivec.h        | 28 ++++----
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h           | 20 +++---
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h            | 28 ++++----
 drivers/net/octeon_ep/cnxk_ep_rx.h              |  2 +-
 drivers/net/octeon_ep/cnxk_ep_rx_avx.c          |  2 +-
 drivers/net/octeon_ep/cnxk_ep_rx_neon.c         |  8 +--
 drivers/net/octeon_ep/cnxk_ep_rx_sse.c          |  8 +--
 drivers/net/octeon_ep/otx_ep_rxtx.c             |  5 +-
 drivers/net/sfc/sfc_ef100_rx.c                  |  7 +-
 drivers/net/sfc/sfc_ef10_rx.c                   | 10 +--
 drivers/net/thunderx/nicvf_ethdev.c             |  4 +-
 drivers/net/thunderx/nicvf_rxtx.h               |  4 +-
 drivers/net/virtio/virtio_rxtx_packed.h         |  4 +-
 drivers/net/virtio/virtio_rxtx_packed_avx.h     | 16 ++---
 drivers/net/virtio/virtio_rxtx_packed_neon.h    | 18 +++---
 drivers/net/virtio/virtio_rxtx_simple.c         |  4 +-
 drivers/net/virtio/virtio_rxtx_simple.h         |  5 +-
 drivers/net/virtio/virtio_rxtx_simple_altivec.c | 16 ++---
 drivers/net/virtio/virtio_rxtx_simple_neon.c    | 24 +++----
 drivers/net/virtio/virtio_rxtx_simple_sse.c     | 16 ++---
 examples/dma/dmafwd.c                           |  5 +-
 lib/cryptodev/cryptodev_pmd.h                   |  5 +-
 lib/mbuf/rte_mbuf.h                             | 17 ++++-
 lib/mbuf/rte_mbuf_core.h                        | 50 ++++++++++++---
 lib/security/rte_security_driver.h              |  5 +-
 65 files changed, 445 insertions(+), 816 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  9:10     ` Morten Brørup
  2024-02-27  5:41   ` [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Tyler Retzlaff
                     ` (21 subsequent siblings)
  22 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide
inline functions to access compatible type pointer to rearm_data
and rx_descriptor_fields1 which will allow direct references on the
rte marker fields to be removed.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/mbuf/rte_mbuf.h      | 13 +++++++++++++
 lib/mbuf/rte_mbuf_core.h | 11 ++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 286b32b..aa7495b 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -132,6 +132,19 @@
 #endif
 }
 
+static inline
+uint64_t *
+rte_mbuf_rearm_data(struct rte_mbuf *m)
+{
+	return (uint64_t *)&m->data_off;
+}
+
+static inline
+void *
+rte_mbuf_rx_descriptor_fields1(struct rte_mbuf *m)
+{
+	return &m->packet_type;
+}
 
 static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
 
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 5688683..7000c04 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -486,7 +486,12 @@ struct rte_mbuf {
 	struct rte_mbuf *next;
 #endif
 
-	/* next 8 bytes are initialised on RX descriptor rearm */
+	/**
+	 * next 8 bytes are initialised on RX descriptor rearm
+	 *
+	 * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
+	 * accessor instead of directly referencing through the data_off field.
+	 */
 	RTE_MARKER64 rearm_data;
 	uint16_t data_off;
 
@@ -522,6 +527,10 @@ struct rte_mbuf {
 	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
 	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
 	 * vlan is stripped from the data.
+	 *
+	 * To obtain a pointer to rx_descriptor_fields1 use the
+	 * rte_mbuf_rx_descriptor_fields1() accessor instead of directly
+	 * referencing through the the anonymous union fields.
 	 */
 	union {
 		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27 10:02     ` Konstantin Ananyev
  2024-03-14 16:51     ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 03/23] common/idpf: use mbuf descriptor accessors Tyler Retzlaff
                     ` (20 subsequent siblings)
  22 siblings, 2 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Collect duplicated RTE_BUILD_BUG_ON checks from drivers and place them
at global scope with struct rte_mbuf definition using static_assert.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/mbuf/rte_mbuf_core.h | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 7000c04..36551c2 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -16,8 +16,11 @@
  * New fields and flags should fit in the "dynamic space".
  */
 
+#include <assert.h>
+#include <stddef.h>
 #include <stdint.h>
 
+#include <rte_common.h>
 #include <rte_byteorder.h>
 #include <rte_stdatomic.h>
 
@@ -673,6 +676,37 @@ struct rte_mbuf {
 	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
 } __rte_cache_aligned;
 
+static_assert(!(offsetof(struct rte_mbuf, ol_flags) !=
+	offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags");
+static_assert(!(offsetof(struct rte_mbuf, rearm_data) !=
+	RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data");
+static_assert(!(offsetof(struct rte_mbuf, data_off) !=
+	offsetof(struct rte_mbuf, rearm_data)), "data_off");
+static_assert(!(offsetof(struct rte_mbuf, data_off) <
+	offsetof(struct rte_mbuf, rearm_data)), "data_off");
+static_assert(!(offsetof(struct rte_mbuf, refcnt) <
+	offsetof(struct rte_mbuf, rearm_data)), "refcnt");
+static_assert(!(offsetof(struct rte_mbuf, nb_segs) <
+	offsetof(struct rte_mbuf, rearm_data)), "nb_segs");
+static_assert(!(offsetof(struct rte_mbuf, port) <
+	offsetof(struct rte_mbuf, rearm_data)), "port");
+static_assert(!(offsetof(struct rte_mbuf, data_off) -
+	offsetof(struct rte_mbuf, rearm_data) > 6), "data_off");
+static_assert(!(offsetof(struct rte_mbuf, refcnt) -
+	offsetof(struct rte_mbuf, rearm_data) > 6), "refcnt");
+static_assert(!(offsetof(struct rte_mbuf, nb_segs) -
+	offsetof(struct rte_mbuf, rearm_data) > 6), "nb_segs");
+static_assert(!(offsetof(struct rte_mbuf, port) -
+	offsetof(struct rte_mbuf, rearm_data) > 6), "port");
+static_assert(!(offsetof(struct rte_mbuf, pkt_len) !=
+	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len");
+static_assert(!(offsetof(struct rte_mbuf, data_len) !=
+	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len");
+static_assert(!(offsetof(struct rte_mbuf, vlan_tci) !=
+	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci");
+static_assert(!(offsetof(struct rte_mbuf, hash) !=
+	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash");
+
 /**
  * Function typedef of callback to free externally attached buffer.
  */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 03/23] common/idpf: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 04/23] net/bnxt: " Tyler Retzlaff
                     ` (19 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/idpf/idpf_common_rxtx.c        |  4 +-
 drivers/common/idpf/idpf_common_rxtx_avx512.c | 73 +++++++--------------------
 2 files changed, 18 insertions(+), 59 deletions(-)

diff --git a/drivers/common/idpf/idpf_common_rxtx.c b/drivers/common/idpf/idpf_common_rxtx.c
index 83b131e..62ddf2e 100644
--- a/drivers/common/idpf/idpf_common_rxtx.c
+++ b/drivers/common/idpf/idpf_common_rxtx.c
@@ -1595,7 +1595,6 @@
 static inline int
 idpf_rxq_vec_setup_default(struct idpf_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -1605,8 +1604,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
diff --git a/drivers/common/idpf/idpf_common_rxtx_avx512.c b/drivers/common/idpf/idpf_common_rxtx_avx512.c
index f65e8d5..f9e2939 100644
--- a/drivers/common/idpf/idpf_common_rxtx_avx512.c
+++ b/drivers/common/idpf/idpf_common_rxtx_avx512.c
@@ -307,19 +307,6 @@
 					/* octet 15~14, low 16 bits pkt_len */
 			 0xFFFFFFFF     /* pkt_type set as unknown */
 			);
-	/**
-	 * compile-time check the shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	uint16_t i, received;
 
@@ -455,13 +442,7 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
-						    16));
+
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -476,13 +457,13 @@
 		rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		rearm7 = _mm256_blend_epi32(mbuf_init, mb6_7, 0xF0);
@@ -491,13 +472,13 @@
 		rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* perform dd_check */
@@ -768,19 +749,6 @@
 					/* octet 15~14, low 16 bits pkt_len */
 			 0xFFFFFFFF     /* pkt_type set as unknown */
 			);
-	/**
-	 * compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	uint16_t i, received;
 
@@ -915,13 +883,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
-						    16));
 				/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -936,13 +897,13 @@
 		rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		rearm7 = _mm256_blend_epi32(mbuf_init, mb6_7, 0xF0);
@@ -951,13 +912,13 @@
 		rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		const __mmask8 dd_mask = _mm512_cmpeq_epi64_mask(
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 04/23] net/bnxt: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 03/23] common/idpf: use mbuf descriptor accessors Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 05/23] net/cnxk: " Tyler Retzlaff
                     ` (18 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c   | 32 ++++++++++++++++----------------
 drivers/net/bnxt/bnxt_rxtx_vec_common.h |  4 +---
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c   | 16 ++++++++--------
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c    | 16 ++++++++--------
 4 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
index ce6b597..5982d12 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c
@@ -310,13 +310,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for first four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
 
 		/* Unpack rearm data, set fixed fields for final four mbufs. */
@@ -336,13 +336,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for final four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
 
 		nb_rx_pkts += num_valid;
@@ -598,13 +598,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for first four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
 
 		/* Unpack rearm data, set fixed fields for final four mbufs. */
@@ -624,13 +624,13 @@
 					    0x04);
 
 		/* Store all mbuf fields for final four packets. */
-		_mm256_storeu_si256((void *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((void *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((void *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
 
 		nb_rx_pkts += num_valid;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_common.h b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
index 2294f0a..fb0b1c1 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
@@ -36,7 +36,6 @@
 static inline int
 bnxt_rxq_vec_setup_common(struct bnxt_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -46,8 +45,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	rxq->rxrearm_nb = 0;
 	rxq->rxrearm_start = 0;
 	return 0;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index 775400f..9ca9903 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -135,27 +135,27 @@
 
 	/* Update mbuf rearm_data for four packets. */
 	GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[0]->rearm_data,
+	vst1q_u32((uint32_t *)rte_mbuf_rearm_data(mbuf[0]),
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 1, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[1]->rearm_data,
+	vst1q_u32((uint32_t *)rte_mbuf_rearm_data(mbuf[1]),
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 2, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[2]->rearm_data,
+	vst1q_u32((uint32_t *)rte_mbuf_rearm_data(mbuf[2]),
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 	GET_OL_FLAGS(rss_flags, index, errors, 3, ol_flags);
-	vst1q_u32((uint32_t *)&mbuf[3]->rearm_data,
+	vst1q_u32((uint32_t *)rte_mbuf_rearm_data(mbuf[3]),
 		  vsetq_lane_u32(ol_flags, vreinterpretq_u32_u64(mb_init), 2));
 
 	/* Update mbuf rx_descriptor_fields1 for four packets. */
 	GET_DESC_FIELDS(mm_rxcmp[0], mm_rxcmp1[0], shuf_msk, ptype_idx, 0, tmp);
-	vst1q_u32((uint32_t *)&mbuf[0]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)rte_mbuf_rx_descriptor_fields1(mbuf[0]), tmp);
 	GET_DESC_FIELDS(mm_rxcmp[1], mm_rxcmp1[1], shuf_msk, ptype_idx, 1, tmp);
-	vst1q_u32((uint32_t *)&mbuf[1]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)rte_mbuf_rx_descriptor_fields1(mbuf[1]), tmp);
 	GET_DESC_FIELDS(mm_rxcmp[2], mm_rxcmp1[2], shuf_msk, ptype_idx, 2, tmp);
-	vst1q_u32((uint32_t *)&mbuf[2]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)rte_mbuf_rx_descriptor_fields1(mbuf[2]), tmp);
 	GET_DESC_FIELDS(mm_rxcmp[3], mm_rxcmp1[3], shuf_msk, ptype_idx, 3, tmp);
-	vst1q_u32((uint32_t *)&mbuf[3]->rx_descriptor_fields1, tmp);
+	vst1q_u32((uint32_t *)rte_mbuf_rx_descriptor_fields1(mbuf[3]), tmp);
 }
 
 static uint16_t
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 6c0e332..080e990 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -114,33 +114,33 @@
 
 	/* Update mbuf rearm_data for four packets. */
 	GET_OL_FLAGS(rss_flags, index, errors, 0, ol_flags);
-	_mm_store_si128((void *)&mbuf[0]->rearm_data,
+	_mm_store_si128((void *)rte_mbuf_rearm_data(mbuf[0]),
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 1, ol_flags);
-	_mm_store_si128((void *)&mbuf[1]->rearm_data,
+	_mm_store_si128((void *)rte_mbuf_rearm_data(mbuf[1]),
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 2, ol_flags);
-	_mm_store_si128((void *)&mbuf[2]->rearm_data,
+	_mm_store_si128((void *)rte_mbuf_rearm_data(mbuf[2]),
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	GET_OL_FLAGS(rss_flags, index, errors, 3, ol_flags);
-	_mm_store_si128((void *)&mbuf[3]->rearm_data,
+	_mm_store_si128((void *)rte_mbuf_rearm_data(mbuf[3]),
 			_mm_or_si128(mbuf_init, _mm_set_epi64x(ol_flags, 0)));
 
 	/* Update mbuf rx_descriptor_fields1 for four packes. */
 	GET_DESC_FIELDS(mm_rxcmp[0], mm_rxcmp1[0], shuf_msk, ptype_idx, 0, t0);
-	_mm_store_si128((void *)&mbuf[0]->rx_descriptor_fields1, t0);
+	_mm_store_si128(rte_mbuf_rx_descriptor_fields1(mbuf[0]), t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[1], mm_rxcmp1[1], shuf_msk, ptype_idx, 1, t0);
-	_mm_store_si128((void *)&mbuf[1]->rx_descriptor_fields1, t0);
+	_mm_store_si128(rte_mbuf_rx_descriptor_fields1(mbuf[1]), t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[2], mm_rxcmp1[2], shuf_msk, ptype_idx, 2, t0);
-	_mm_store_si128((void *)&mbuf[2]->rx_descriptor_fields1, t0);
+	_mm_store_si128(rte_mbuf_rx_descriptor_fields1(mbuf[2]), t0);
 
 	GET_DESC_FIELDS(mm_rxcmp[3], mm_rxcmp1[3], shuf_msk, ptype_idx, 3, t0);
-	_mm_store_si128((void *)&mbuf[3]->rx_descriptor_fields1, t0);
+	_mm_store_si128(rte_mbuf_rx_descriptor_fields1(mbuf[3]), t0);
 }
 
 static uint16_t
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 05/23] net/cnxk: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 04/23] net/bnxt: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 06/23] net/enic: " Tyler Retzlaff
                     ` (17 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/cnxk/cn10k_rx.h    | 36 ++++++++++++++++++------------------
 drivers/net/cnxk/cn9k_rx.h     | 20 ++++++++++----------
 drivers/net/cnxk/cnxk_ethdev.c |  2 +-
 3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/net/cnxk/cn10k_rx.h b/drivers/net/cnxk/cn10k_rx.h
index 7bb4c86..4bfb323 100644
--- a/drivers/net/cnxk/cn10k_rx.h
+++ b/drivers/net/cnxk/cn10k_rx.h
@@ -309,7 +309,7 @@
 		frag_rx = (union nix_rx_parse_u *)(wqe + 1);
 		frag_size = rlen + frag_rx->lcptr - frag_rx->laptr;
 
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init;
+		*rte_mbuf_rearm_data(mbuf) = mbuf_init;
 		mbuf->data_len = frag_size;
 		mbuf->pkt_len = frag_size;
 		mbuf->ol_flags = ol_flags;
@@ -368,7 +368,7 @@
 	fsz_w1 >>= 16;
 
 	data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-	*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+	*rte_mbuf_rearm_data(mbuf) = mbuf_init | data_off;
 	mbuf->data_len = frag_size;
 
 	/* Mark frag as get */
@@ -384,7 +384,7 @@
 		fsz_w1 >>= 16;
 
 		data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+		*rte_mbuf_rearm_data(mbuf) = mbuf_init | data_off;
 		mbuf->data_len = frag_size;
 
 		/* Mark frag as get */
@@ -401,7 +401,7 @@
 		fsz_w1 >>= 16;
 
 		data_off = b_off + frag_rx->lcptr + l3_hdr_size;
-		*(uint64_t *)(&mbuf->rearm_data) = mbuf_init | data_off;
+		*rte_mbuf_rearm_data(mbuf) = mbuf_init | data_off;
 		mbuf->data_len = frag_size;
 
 		/* Mark frag as get */
@@ -502,7 +502,7 @@
 
 	inner->pkt_len = len;
 	inner->data_len = len;
-	*(uint64_t *)(&inner->rearm_data) = mbuf_init;
+	*rte_mbuf_rearm_data(inner) = mbuf_init;
 
 	inner->ol_flags = ((CPT_COMP_HWGOOD_MASK & (1U << ucc)) ?
 			   RTE_MBUF_F_RX_SEC_OFFLOAD :
@@ -584,7 +584,7 @@
 			/* First frag len */
 			inner->pkt_len = vgetq_lane_u16(*rx_desc_field1, 2);
 			inner->data_len = vgetq_lane_u16(*rx_desc_field1, 4);
-			p = (uintptr_t)&inner->rearm_data;
+			p = (uintptr_t)rte_mbuf_rearm_data(inner);
 			*(uint64_t *)p = mbuf_init;
 
 			/* Reassembly success */
@@ -774,7 +774,7 @@
 
 		mbuf->data_len = sg_len;
 		sg = sg >> 16;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)rte_mbuf_rearm_data(mbuf);
 		*(uint64_t *)p = rearm & ~0xFFFF;
 		nb_segs--;
 		iova_list++;
@@ -825,7 +825,7 @@
 			head->nb_segs = nb_segs;
 		}
 		mbuf = next_frag;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)rte_mbuf_rearm_data(mbuf);
 		*(uint64_t *)p = rearm + ldptr;
 		mbuf->data_len = (sg & 0xFFFF) - ldptr -
 				 (flags & NIX_RX_OFFLOAD_TSTAMP_F ?
@@ -849,7 +849,7 @@
 
 
 		len = mbuf->pkt_len;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)rte_mbuf_rearm_data(mbuf);
 		*(uint64_t *)p = rearm;
 		mbuf->data_len = (sg & 0xFFFF) -
 				 (flags & NIX_RX_OFFLOAD_TSTAMP_F ?
@@ -917,7 +917,7 @@
 		mbuf->ol_flags = ol_flags;
 		mbuf->pkt_len = len;
 		mbuf->data_len = len;
-		p = (uintptr_t)&mbuf->rearm_data;
+		p = (uintptr_t)rte_mbuf_rearm_data(mbuf);
 		*(uint64_t *)p = val;
 	}
 
@@ -1966,16 +1966,16 @@
 		rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
 
 		/* Update rx_descriptor_fields1 */
-		vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
-		vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
-		vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
-		vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf0), f0);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf1), f1);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf2), f2);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf3), f3);
 
 		/* Update rearm_data */
-		vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
-		vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
-		vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
-		vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf0), rearm0);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf1), rearm1);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf2), rearm2);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf3), rearm3);
 
 		if (flags & NIX_RX_MULTI_SEG_F) {
 			/* Multi segment is enable build mseg list for
diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h
index d8bb65c..f1212f8 100644
--- a/drivers/net/cnxk/cn9k_rx.h
+++ b/drivers/net/cnxk/cn9k_rx.h
@@ -155,7 +155,7 @@
 
 		mbuf->data_len = sg & 0xFFFF;
 		sg = sg >> 16;
-		*(uint64_t *)(&mbuf->rearm_data) = rearm;
+		*rte_mbuf_rearm_data(mbuf) = rearm;
 		nb_segs--;
 		iova_list++;
 
@@ -398,7 +398,7 @@
 			nix_update_match_id(rx->cn9k.match_id, ol_flags, mbuf);
 
 	mbuf->ol_flags = ol_flags;
-	*(uint64_t *)(&mbuf->rearm_data) = val;
+	*rte_mbuf_rearm_data(mbuf) = val;
 	mbuf->pkt_len = len;
 	mbuf->data_len = len;
 
@@ -799,16 +799,16 @@
 		rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
 
 		/* Update rx_descriptor_fields1 */
-		vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
-		vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
-		vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
-		vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf0), f0);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf1), f1);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf2), f2);
+		vst1q_u64((uint64_t *)rte_mbuf_rx_descriptor_fields1(mbuf3), f3);
 
 		/* Update rearm_data */
-		vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
-		vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
-		vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
-		vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf0), rearm0);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf1), rearm1);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf2), rearm2);
+		vst1q_u64(rte_mbuf_rearm_data(mbuf3), rearm3);
 
 		if (flags & NIX_RX_MULTI_SEG_F) {
 			/* Multi segment is enable build mseg list for
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 2372a4e..14f6b7c 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -437,7 +437,7 @@
 
 	/* Prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	tmp = (uint64_t *)&mb_def.rearm_data;
+	tmp = rte_mbuf_rearm_data(&mb_def);
 
 	return *tmp;
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 06/23] net/enic: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 05/23] net/cnxk: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 07/23] net/fm10k: " Tyler Retzlaff
                     ` (16 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/enic/enic_main.c          |  4 +---
 drivers/net/enic/enic_rxtx_vec_avx2.c | 18 +++++++++---------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index a6aaa76..59e0be4 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -577,7 +577,6 @@ int enic_enable(struct enic *enic)
 	int err;
 	struct rte_eth_dev *eth_dev = enic->rte_dev;
 	uint64_t simple_tx_offloads;
-	uintptr_t p;
 
 	if (enic->enable_avx2_rx) {
 		struct rte_mbuf mb_def = { .buf_addr = 0 };
@@ -592,8 +591,7 @@ int enic_enable(struct enic *enic)
 		mb_def.port = enic->port_id;
 		rte_mbuf_refcnt_set(&mb_def, 1);
 		rte_compiler_barrier();
-		p = (uintptr_t)&mb_def.rearm_data;
-		enic->mbuf_initializer = *(uint64_t *)p;
+		enic->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	}
 
 	eth_dev->data->dev_link.link_speed = vnic_dev_port_speed(enic->vdev);
diff --git a/drivers/net/enic/enic_rxtx_vec_avx2.c b/drivers/net/enic/enic_rxtx_vec_avx2.c
index 600efff..f6ab6e1 100644
--- a/drivers/net/enic/enic_rxtx_vec_avx2.c
+++ b/drivers/net/enic/enic_rxtx_vec_avx2.c
@@ -19,7 +19,7 @@
 {
 	bool tnl;
 
-	*(uint64_t *)&mb->rearm_data = enic->mbuf_initializer;
+	*rte_mbuf_rearm_data(mb) = enic->mbuf_initializer;
 	mb->data_len = cqd->bytes_written_flags &
 		CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK;
 	mb->pkt_len = mb->data_len;
@@ -737,14 +737,14 @@
 		 * vlan_tci    - 26     (from cqd)
 		 * rss         - 28     (from cqd)
 		 */
-		_mm256_storeu_si256((__m256i *)&rxmb[0]->rearm_data, rearm0);
-		_mm256_storeu_si256((__m256i *)&rxmb[1]->rearm_data, rearm1);
-		_mm256_storeu_si256((__m256i *)&rxmb[2]->rearm_data, rearm2);
-		_mm256_storeu_si256((__m256i *)&rxmb[3]->rearm_data, rearm3);
-		_mm256_storeu_si256((__m256i *)&rxmb[4]->rearm_data, rearm4);
-		_mm256_storeu_si256((__m256i *)&rxmb[5]->rearm_data, rearm5);
-		_mm256_storeu_si256((__m256i *)&rxmb[6]->rearm_data, rearm6);
-		_mm256_storeu_si256((__m256i *)&rxmb[7]->rearm_data, rearm7);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[0]), rearm0);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[1]), rearm1);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[2]), rearm2);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[3]), rearm3);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[4]), rearm4);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[5]), rearm5);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[6]), rearm6);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rxmb[7]), rearm7);
 
 		max_rx -= 8;
 		cqd += 8;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 07/23] net/fm10k: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 06/23] net/enic: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 08/23] net/hns3: " Tyler Retzlaff
                     ` (15 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/fm10k/fm10k_rxtx_vec.c | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 2b6914b..795e70a 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -226,7 +226,6 @@
 int __rte_cold
 fm10k_rxq_vec_setup(struct fm10k_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -239,8 +238,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
@@ -282,7 +280,6 @@
 	/* Initialize the mbufs in vector, process 2 mbufs in one loop */
 	for (i = 0; i < RTE_FM10K_RXQ_REARM_THRESH; i += 2, mb_alloc += 2) {
 		__m128i vaddr0, vaddr1;
-		uintptr_t p0, p1;
 
 		mb0 = mb_alloc[0];
 		mb1 = mb_alloc[1];
@@ -290,10 +287,8 @@
 		/* Flush mbuf with pkt template.
 		 * Data to be rearmed is 6 bytes long.
 		 */
-		p0 = (uintptr_t)&mb0->rearm_data;
-		*(uint64_t *)p0 = rxq->mbuf_initializer;
-		p1 = (uintptr_t)&mb1->rearm_data;
-		*(uint64_t *)p1 = rxq->mbuf_initializer;
+		*rte_mbuf_rearm_data(mb0) = rxq->mbuf_initializer;
+		*rte_mbuf_rearm_data(mb1) = rxq->mbuf_initializer;
 
 		/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
 		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, buf_iova) !=
@@ -422,19 +417,6 @@
 		0xFF, 0xFF,  /* skip high 16 bits pkt_type */
 		0xFF, 0xFF   /* Skip pkt_type field in shuffle operation */
 		);
-	/*
-	 * Compile-time verify the shuffle mask
-	 * NOTE: some field positions already verified above, but duplicated
-	 * here for completeness in case of future modifications.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
@@ -519,9 +501,9 @@
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 				pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 				pkt_mb3);
 
 		/* C* extract and record EOP bit */
@@ -557,9 +539,9 @@
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 				pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				pkt_mb1);
 
 		fm10k_desc_to_pktype_v(descs0, &rx_pkts[pos]);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 08/23] net/hns3: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 07/23] net/fm10k: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 09/23] net/i40e: " Tyler Retzlaff
                     ` (14 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/hns3/hns3_rxtx_vec.c      | 22 +---------------------
 drivers/net/hns3/hns3_rxtx_vec_neon.h | 24 ++++++++----------------
 drivers/net/hns3/hns3_rxtx_vec_sve.c  |  4 ++--
 3 files changed, 11 insertions(+), 39 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c
index 9708ec6..d6c9e80 100644
--- a/drivers/net/hns3/hns3_rxtx_vec.c
+++ b/drivers/net/hns3/hns3_rxtx_vec.c
@@ -113,7 +113,6 @@
 static void
 hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -121,28 +120,9 @@
 	mb_def.port = rxq->port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
-	/* compile-time verifies the rearm_data first 8bytes */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) <
-			 offsetof(struct rte_mbuf, rearm_data));
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) <
-			 offsetof(struct rte_mbuf, rearm_data));
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) <
-			 offsetof(struct rte_mbuf, rearm_data));
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) <
-			 offsetof(struct rte_mbuf, rearm_data));
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) -
-			 offsetof(struct rte_mbuf, rearm_data) > 6);
-
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 }
 
 void
diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h
index 0dc6b9f..6f46131 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_neon.h
+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h
@@ -156,14 +156,6 @@
 		0, 0, 0,      /* ignore non-length fields */
 	};
 
-	/* compile-time verifies the shuffle mask */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash.rss) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
-
 	for (pos = 0; pos < nb_pkts; pos += HNS3_DEFAULT_DESCS_PER_LOOP,
 				     rxdp += HNS3_DEFAULT_DESCS_PER_LOOP) {
 		uint64x2x2_t descs[HNS3_DEFAULT_DESCS_PER_LOOP];
@@ -236,23 +228,23 @@
 		pkt_mb4 = vreinterpretq_u8_u16(tmp);
 
 		/* save packet info to rx_pkts mbuf */
-		vst1q_u8((void *)&sw_ring[pos + 0].mbuf->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 0].mbuf),
 			 pkt_mb1);
-		vst1q_u8((void *)&sw_ring[pos + 1].mbuf->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 1].mbuf),
 			 pkt_mb2);
-		vst1q_u8((void *)&sw_ring[pos + 2].mbuf->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 2].mbuf),
 			 pkt_mb3);
-		vst1q_u8((void *)&sw_ring[pos + 3].mbuf->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 3].mbuf),
 			 pkt_mb4);
 
 		/* store the first 8 bytes of packets mbuf's rearm_data */
-		*(uint64_t *)&sw_ring[pos + 0].mbuf->rearm_data =
+		*rte_mbuf_rearm_data(sw_ring[pos + 0].mbuf) =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 1].mbuf->rearm_data =
+		*rte_mbuf_rearm_data(sw_ring[pos + 1].mbuf) =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 2].mbuf->rearm_data =
+		*rte_mbuf_rearm_data(sw_ring[pos + 2].mbuf) =
 			rxq->mbuf_initializer;
-		*(uint64_t *)&sw_ring[pos + 3].mbuf->rearm_data =
+		*rte_mbuf_rearm_data(sw_ring[pos + 3].mbuf) =
 			rxq->mbuf_initializer;
 
 		rte_prefetch_non_temporal(rxdp + HNS3_DEFAULT_DESCS_PER_LOOP);
diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c
index 8aa4448..f6259d1 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_sve.c
+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c
@@ -123,9 +123,9 @@
 		mbuf_init = svdup_n_u64(rxq->mbuf_initializer);
 		/* save mbuf_initializer */
 		svst1_scatter_u64base_offset_u64(PG64_256BIT, mbp1st,
-			offsetof(struct rte_mbuf, rearm_data), mbuf_init);
+			offsetof(struct rte_mbuf, data_off), mbuf_init);
 		svst1_scatter_u64base_offset_u64(PG64_256BIT, mbp2st,
-			offsetof(struct rte_mbuf, rearm_data), mbuf_init);
+			offsetof(struct rte_mbuf, data_off), mbuf_init);
 
 		next_rxdp = rxdp + HNS3_SVE_DEFAULT_DESCS_PER_LOOP;
 		rte_prefetch_non_temporal(next_rxdp);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 09/23] net/i40e: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 08/23] net/hns3: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 10/23] net/iavf: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Use rte_mbuf_prefetch_part2() to prefetch cacheline1 and remove
reference to rte marker field.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/i40e/i40e_rxtx_vec_altivec.c | 18 +++++--------
 drivers/net/i40e/i40e_rxtx_vec_avx2.c    | 34 ++++++-------------------
 drivers/net/i40e/i40e_rxtx_vec_avx512.c  | 35 +++++++-------------------
 drivers/net/i40e/i40e_rxtx_vec_common.h  |  4 +--
 drivers/net/i40e/i40e_rxtx_vec_neon.c    | 16 ++++++------
 drivers/net/i40e/i40e_rxtx_vec_sse.c     | 43 +++++++-------------------------
 6 files changed, 41 insertions(+), 109 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
index b6b0d38..3e065ee 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
@@ -55,7 +55,6 @@
 	/* Initialize the mbufs in vector, process 2 mbufs in one loop */
 	for (i = 0; i < RTE_I40E_RXQ_REARM_THRESH; i += 2, rxep += 2) {
 		__vector unsigned long vaddr0, vaddr1;
-		uintptr_t p0, p1;
 
 		mb0 = rxep[0].mbuf;
 		mb1 = rxep[1].mbuf;
@@ -66,10 +65,8 @@
 		  * anyway. So overwrite whole 8 bytes with one load:
 		  * 6 bytes of rearm_data plus first 2 bytes of ol_flags.
 		  */
-		p0 = (uintptr_t)&mb0->rearm_data;
-		*(uint64_t *)p0 = rxq->mbuf_initializer;
-		p1 = (uintptr_t)&mb1->rearm_data;
-		*(uint64_t *)p1 = rxq->mbuf_initializer;
+		*rte_mbuf_rearm_data(mb0) = rxq->mbuf_initializer;
+		*rte_mbuf_rearm_data(mb1) = rxq->mbuf_initializer;
 
 		/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
 		vaddr0 = vec_ld(0, (__vector unsigned long *)&mb0->buf_addr);
@@ -370,12 +367,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		vec_st(pkt_mb4, 0,
-		 (__vector unsigned char *)&rx_pkts[pos + 3]
-			->rx_descriptor_fields1
+		 (__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3])
 		);
 		vec_st(pkt_mb3, 0,
-		 (__vector unsigned char *)&rx_pkts[pos + 2]
-			->rx_descriptor_fields1
+		 (__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2])
 		);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -422,11 +417,10 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		vec_st(pkt_mb2, 0,
-		 (__vector unsigned char *)&rx_pkts[pos + 1]
-			->rx_descriptor_fields1
+		 (__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1])
 		);
 		vec_st(pkt_mb1, 0,
-		 (__vector unsigned char *)&rx_pkts[pos]->rx_descriptor_fields1
+		 (__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos])
 		);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		desc_to_olflags_v(descs, &rx_pkts[pos]);
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index f468c1f..360d80f 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -180,19 +180,6 @@
 			0xFF, 0xFF,  /* pkt_type set as unknown */
 			0xFF, 0xFF   /*pkt_type set as unknown */
 	);
-	/*
-	 * compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/*
@@ -525,11 +512,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 				rearm6, rearm7;
@@ -543,10 +525,10 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data, rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data, rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data, rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data, rearm0);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]), rearm6);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]), rearm4);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]), rearm2);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]), rearm0);
 
 		/* repeat for the odd mbufs */
 		const __m256i odd_flags = _mm256_castsi128_si256(
@@ -561,10 +543,10 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data, rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data, rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data, rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data, rearm1);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]), rearm7);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]), rearm5);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]), rearm3);
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]), rearm1);
 
 		/* extract and record EOP bit */
 		if (split_packet) {
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index f3050cd..e13bd2f 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -170,18 +170,6 @@
 			 /* pkt_type set as unknown */
 			 0xFFFFFFFF
 			);
-	/* compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/* mask everything except RSS, flow director and VLAN flags
@@ -557,11 +545,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 				rearm6, rearm7;
@@ -580,13 +563,13 @@
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 6]->rearm_data, rearm6);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]), rearm6);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 4]->rearm_data, rearm4);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]), rearm4);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 2]->rearm_data, rearm2);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]), rearm2);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 0]->rearm_data, rearm0);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]), rearm0);
 
 		/* repeat for the odd mbufs */
 		const __m256i odd_flags = _mm256_castsi128_si256
@@ -606,13 +589,13 @@
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 7]->rearm_data, rearm7);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]), rearm7);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 5]->rearm_data, rearm5);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]), rearm5);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 3]->rearm_data, rearm3);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]), rearm3);
 		_mm256_storeu_si256
-			((__m256i *)&rx_pkts[i + 1]->rearm_data, rearm1);
+			((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]), rearm1);
 
 		/* extract and record EOP bit */
 		if (split_packet) {
@@ -826,7 +809,7 @@
 		free[0] = m;
 		nb_free = 1;
 		for (i = 1; i < n; i++) {
-			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
 			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
 			if (likely(m)) {
 				if (likely(m->pool == free[0]->pool)) {
diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h
index 8b74563..5633268 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_common.h
+++ b/drivers/net/i40e/i40e_rxtx_vec_common.h
@@ -189,7 +189,6 @@
 static inline int
 i40e_rxq_vec_setup_default(struct i40e_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -199,8 +198,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	rxq->rx_using_sse = 1;
 	return 0;
 }
diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index d873e30..29dfd92 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -300,10 +300,10 @@
 	rearm2 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 2), mbuf_init, 1);
 	rearm3 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 3), mbuf_init, 1);
 
-	vst1q_u64((uint64_t *)&rx_pkts[0]->rearm_data, rearm0);
-	vst1q_u64((uint64_t *)&rx_pkts[1]->rearm_data, rearm1);
-	vst1q_u64((uint64_t *)&rx_pkts[2]->rearm_data, rearm2);
-	vst1q_u64((uint64_t *)&rx_pkts[3]->rearm_data, rearm3);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -492,13 +492,13 @@
 		pkt_mb1 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 				pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 				pkt_mb3);
-		vst1q_u8((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 				pkt_mb2);
-		vst1q_u8((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 2d4480a..994c5e1 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -315,14 +315,10 @@
 	rearm3 = _mm_blend_epi16(mbuf_init, _mm_srli_si128(vlan0, 4), 0x10);
 
 	/* write the rearm data and the olflags in one write */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -369,15 +365,7 @@
 				-rxq->crc_len, /* sub crc on pkt_len */
 				0, 0            /* ignore pkt_type field */
 			);
-	/*
-	 * compile-time check the above crc_adjust layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi16
-	 * call above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+
 	__m128i dd_check, eop_check;
 
 	/* nb_pkts has to be floor-aligned to RTE_I40E_DESCS_PER_LOOP */
@@ -419,19 +407,6 @@
 		0xFF, 0xFF,  /* pkt_type set as unknown */
 		0xFF, 0xFF  /*pkt_type set as unknown */
 		);
-	/*
-	 * Compile-time verify the shuffle mask
-	 * NOTE: some field positions already verified above, but duplicated
-	 * here for completeness in case of future modifications.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
@@ -535,9 +510,9 @@
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 				 pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 				 pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -571,9 +546,9 @@
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 				 pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				 pkt_mb1);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 10/23] net/iavf: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 09/23] net/i40e: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 11/23] net/ice: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/iavf/iavf_rxtx_vec_avx2.c   | 72 +++++++---------------------
 drivers/net/iavf/iavf_rxtx_vec_avx512.c | 72 +++++++---------------------
 drivers/net/iavf/iavf_rxtx_vec_common.h |  4 +-
 drivers/net/iavf/iavf_rxtx_vec_neon.c   | 16 +++----
 drivers/net/iavf/iavf_rxtx_vec_sse.c    | 85 +++++++--------------------------
 5 files changed, 58 insertions(+), 191 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx2.c b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
index 510b4d8..33f2850 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx2.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
@@ -98,19 +98,6 @@
 			 0xFF, 0xFF,  /* pkt_type set as unknown */
 			 0xFF, 0xFF   /*pkt_type set as unknown */
 			);
-	/**
-	 * compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/**
@@ -372,13 +359,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
-					   16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -398,13 +378,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -427,13 +407,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
@@ -622,19 +602,6 @@
 			 0xFF, 0xFF,	/* pkt_type set as unknown */
 			 0xFF, 0xFF	/*pkt_type set as unknown */
 			);
-	/**
-	 * compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/**
@@ -1279,13 +1246,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
-					   16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -1305,13 +1265,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -1334,13 +1294,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
index 3bb6f30..38d0669 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
@@ -135,19 +135,6 @@
 					/* octet 15~14, low 16 bits pkt_len */
 			 0xFFFFFFFF     /* pkt_type set as unknown */
 			);
-	/**
-	 * compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	uint16_t i, received;
 
@@ -412,13 +399,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
-						    16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -450,13 +430,13 @@
 			rearm0 = _mm256_permute2f128_si256(mbuf_init, mb0_1, 0x20);
 		}
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -486,13 +466,13 @@
 			rearm1 = _mm256_blend_epi32(mbuf_init, mb0_1, 0xF0);
 		}
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
@@ -703,19 +683,6 @@
 					/* octet 4~5, 16 bits pkt_len */
 			 0xFFFFFFFF     /* pkt_type set as unknown */
 			);
-	/**
-	 * compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	uint16_t i, received;
 
@@ -1435,13 +1402,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
-						    16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -1461,13 +1421,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -1490,13 +1450,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/iavf/iavf_rxtx_vec_common.h b/drivers/net/iavf/iavf_rxtx_vec_common.h
index 5c52200..71e3644 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_common.h
+++ b/drivers/net/iavf/iavf_rxtx_vec_common.h
@@ -197,7 +197,6 @@
 static inline int
 iavf_rxq_vec_setup_default(struct iavf_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -207,8 +206,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
diff --git a/drivers/net/iavf/iavf_rxtx_vec_neon.c b/drivers/net/iavf/iavf_rxtx_vec_neon.c
index 83825aa..d7ea940 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_neon.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_neon.c
@@ -159,10 +159,10 @@
 	rearm2 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 2), mbuf_init, 1);
 	rearm3 = vsetq_lane_u64(vgetq_lane_u32(vlan0, 3), mbuf_init, 1);
 
-	vst1q_u64((uint64_t *)&rx_pkts[0]->rearm_data, rearm0);
-	vst1q_u64((uint64_t *)&rx_pkts[1]->rearm_data, rearm1);
-	vst1q_u64((uint64_t *)&rx_pkts[2]->rearm_data, rearm2);
-	vst1q_u64((uint64_t *)&rx_pkts[3]->rearm_data, rearm3);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	vst1q_u64(rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -332,13 +332,13 @@
 		pkt_mb1 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 				pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 				pkt_mb3);
-		vst1q_u8((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 				pkt_mb2);
-		vst1q_u8((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c b/drivers/net/iavf/iavf_rxtx_vec_sse.c
index 96f187f..9d6a453 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_sse.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c
@@ -179,14 +179,10 @@
 	rearm3 = _mm_blend_epi16(mbuf_init, _mm_srli_si128(vlan0, 4), 0x10);
 
 	/* write the rearm data and the olflags in one write */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 static inline __m128i
@@ -412,14 +408,10 @@
 	rearm3 = _mm_blend_epi16(mbuf_init, _mm_srli_si128(flags, 4), 0x30);
 
 	/* write the rearm data and the olflags in one write */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			 offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			 RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 #define PKTLEN_SHIFT     10
@@ -488,14 +480,7 @@
 				-rxq->crc_len, /* sub crc on pkt_len */
 				0, 0            /* ignore pkt_type field */
 			);
-	/* compile-time check the above crc_adjust layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi16
-	 * call above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+
 	__m128i dd_check, eop_check;
 
 	/* nb_pkts has to be floor-aligned to IAVF_VPMD_DESCS_PER_LOOP */
@@ -536,18 +521,6 @@
 		15, 14,      /* octet 15~14, low 16 bits pkt_len */
 		0xFF, 0xFF, 0xFF, 0xFF /* pkt_type set as unknown */
 		);
-	/* Compile-time verify the shuffle mask
-	 * NOTE: some field positions already verified above, but duplicated
-	 * here for completeness in case of future modifications.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
@@ -651,10 +624,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 			pkt_mb4);
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 			pkt_mb3);
 
 		/* D.2 pkt 1,2 remove crc */
@@ -689,9 +662,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128(
-			(void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 			pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				 pkt_mb1);
 		desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
@@ -760,16 +733,6 @@
 						   0x04, 0x0C,
 						   0x00, 0x08);
 
-	/**
-	 * compile-time check the above crc_adjust layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi16
-	 * call above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-
 	/* 4 packets DD mask */
 	const __m128i dd_check = _mm_set_epi64x(0x0000000100000001LL,
 						0x0000000100000001LL);
@@ -818,20 +781,6 @@
 
 #endif
 
-	/**
-	 * Compile-time verify the shuffle mask
-	 * NOTE: some field positions already verified above, but duplicated
-	 * here for completeness in case of future modifications.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
-
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
 	 */
@@ -1089,10 +1038,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 			 pkt_mb3);
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 			 pkt_mb2);
 
 		/* C* extract and record EOP bit */
@@ -1116,9 +1065,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 			 pkt_mb1);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				 pkt_mb0);
 		flex_desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 11/23] net/ice: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 10/23] net/iavf: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 12/23] net/ionic: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ice/ice_rxtx_vec_avx2.c   | 36 +++++++---------------------
 drivers/net/ice/ice_rxtx_vec_avx512.c | 37 +++++++----------------------
 drivers/net/ice/ice_rxtx_vec_common.h |  4 +---
 drivers/net/ice/ice_rxtx_vec_sse.c    | 44 +++++++----------------------------
 4 files changed, 25 insertions(+), 96 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c b/drivers/net/ice/ice_rxtx_vec_avx2.c
index 6f6d790..853f99b 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -114,19 +114,6 @@
 			 0xFF, 0xFF,	/* pkt_type set as unknown */
 			 0xFF, 0xFF	/*pkt_type set as unknown */
 			);
-	/**
-	 * compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	/* Status/Error flag masks */
 	/**
@@ -570,13 +557,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
-					   16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -596,13 +576,13 @@
 		rearm2 = _mm256_permute2f128_si256(rearm2, mb2_3, 0x20);
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -625,13 +605,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/ice/ice_rxtx_vec_avx512.c b/drivers/net/ice/ice_rxtx_vec_avx512.c
index 04148e8..6d04bf7 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx512.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx512.c
@@ -100,20 +100,6 @@
 			 0xFFFFFFFF
 			);
 
-	/**
-	 * compile-time check the above crc and shuffle layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi
-	 * calls above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
-
 	/* following code block is for Rx Checksum Offload */
 	/* Status/Error flag masks */
 	/**
@@ -568,13 +554,6 @@
 		 * add in the previously computed rx_descriptor fields to
 		 * make a single 256-bit write per mbuf
 		 */
-		/* check the structure matches expectations */
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-				 offsetof(struct rte_mbuf, rearm_data) + 8);
-		RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-				 RTE_ALIGN(offsetof(struct rte_mbuf,
-						    rearm_data),
-					   16));
 		/* build up data and do writes */
 		__m256i rearm0, rearm1, rearm2, rearm3, rearm4, rearm5,
 			rearm6, rearm7;
@@ -597,13 +576,13 @@
 		rearm0 = _mm256_permute2f128_si256(rearm0, mb0_1, 0x20);
 
 		/* write to mbuf */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 6]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 6]),
 				    rearm6);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 4]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 4]),
 				    rearm4);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 2]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 2]),
 				    rearm2);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 0]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 0]),
 				    rearm0);
 
 		/* repeat for the odd mbufs */
@@ -627,13 +606,13 @@
 		rearm3 = _mm256_blend_epi32(rearm3, mb2_3, 0xF0);
 		rearm1 = _mm256_blend_epi32(rearm1, mb0_1, 0xF0);
 		/* again write to mbufs */
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 7]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 7]),
 				    rearm7);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 5]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 5]),
 				    rearm5);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 3]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 3]),
 				    rearm3);
-		_mm256_storeu_si256((__m256i *)&rx_pkts[i + 1]->rearm_data,
+		_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(rx_pkts[i + 1]),
 				    rearm1);
 
 		/* extract and record EOP bit */
diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index 4b73465..c284d2d 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -232,7 +232,6 @@
 static inline int
 ice_rxq_vec_setup_default(struct ice_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -242,8 +241,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
diff --git a/drivers/net/ice/ice_rxtx_vec_sse.c b/drivers/net/ice/ice_rxtx_vec_sse.c
index 9a1b7e3..ed9928b 100644
--- a/drivers/net/ice/ice_rxtx_vec_sse.c
+++ b/drivers/net/ice/ice_rxtx_vec_sse.c
@@ -267,14 +267,10 @@
 	rearm3 = _mm_blend_epi16(mbuf_init, _mm_srli_si128(flags, 4), 0x30);
 
 	/* write the rearm data and the olflags in one write */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			 offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			 RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 static inline void
@@ -342,16 +338,6 @@
 						   0x04, 0x0C,
 						   0x00, 0x08);
 
-	/**
-	 * compile-time check the above crc_adjust layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi16
-	 * call above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-
 	/* 4 packets DD mask */
 	const __m128i dd_check = _mm_set_epi64x(0x0000000100000001LL,
 						0x0000000100000001LL);
@@ -382,20 +368,6 @@
 	      rte_cpu_to_le_32(1 << ICE_RX_FLEX_DESC_STATUS0_DD_S)))
 		return 0;
 
-	/**
-	 * Compile-time verify the shuffle mask
-	 * NOTE: some field positions already verified above, but duplicated
-	 * here for completeness in case of future modifications.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			 offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
-
 	/* Cache is empty -> need to scan the buffer rings, but first move
 	 * the next 'n' mbufs into the cache
 	 */
@@ -542,10 +514,10 @@
 
 		/* D.3 copy final 3,4 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 			 pkt_mb3);
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 			 pkt_mb2);
 
 		/* C* extract and record EOP bit */
@@ -569,9 +541,9 @@
 
 		/* D.3 copy final 1,2 data to rx_pkts */
 		_mm_storeu_si128
-			((void *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+			(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 			 pkt_mb1);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				 pkt_mb0);
 		ice_rx_desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
 		/* C.4 calc available number of desc */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 12/23] net/ionic: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 11/23] net/ice: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 13/23] net/ixgbe: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ionic/ionic_lif.c         | 6 ++----
 drivers/net/ionic/ionic_rxtx_sg.c     | 4 ++--
 drivers/net/ionic/ionic_rxtx_simple.c | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index 93a1011..4a5aa1e 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -744,8 +744,7 @@
 
 	rte_compiler_barrier();
 
-	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	return *rte_mbuf_rearm_data(&rxm);
 }
 
 static uint64_t
@@ -762,8 +761,7 @@
 
 	rte_compiler_barrier();
 
-	RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t));
-	return rxm.rearm_data[0];
+	return *rte_mbuf_rearm_data(&rxm);
 }
 
 int
diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c
index 92e1d6e..4a6f3c2 100644
--- a/drivers/net/ionic/ionic_rxtx_sg.c
+++ b/drivers/net/ionic/ionic_rxtx_sg.c
@@ -286,7 +286,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	*rte_mbuf_rearm_data(rxm) = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc_len);
 	left = cq_desc_len - rxm->data_len;
@@ -299,7 +299,7 @@
 		info[i] = NULL;
 
 		/* Set the chained mbuf metadata */
-		rxm_seg->rearm_data[0] = rxq->rearm_seg_data;
+		*rte_mbuf_rearm_data(rxm_seg) = rxq->rearm_seg_data;
 		rxm_seg->data_len = RTE_MIN(rxq->seg_size, left);
 		left -= rxm_seg->data_len;
 
diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c
index f12f66f..02528e8 100644
--- a/drivers/net/ionic/ionic_rxtx_simple.c
+++ b/drivers/net/ionic/ionic_rxtx_simple.c
@@ -257,7 +257,7 @@
 	info[0] = NULL;
 
 	/* Set the mbuf metadata based on the cq entry */
-	rxm->rearm_data[0] = rxq->rearm_data;
+	*rte_mbuf_rearm_data(rxm) = rxq->rearm_data;
 	rxm->pkt_len = cq_desc_len;
 	rxm->data_len = cq_desc_len;
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 13/23] net/ixgbe: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 12/23] net/ionic: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 14/23] net/mlx5: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h |  4 +--
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c   | 12 ++++----
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c    | 51 ++++++++-----------------------
 3 files changed, 20 insertions(+), 47 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
index a4d9ec9..78ab168 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
@@ -244,7 +244,6 @@
 static inline int
 ixgbe_rxq_vec_setup_default(struct ixgbe_rx_queue *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -254,8 +253,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 	return 0;
 }
 
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index 952b032..2e1d903 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -56,13 +56,13 @@
 		 * Flush mbuf with pkt template.
 		 * Data to be rearmed is 6 bytes long.
 		 */
-		vst1_u8((uint8_t *)&mb0->rearm_data, p);
+		vst1_u8((uint8_t *)rte_mbuf_rearm_data(mb0), p);
 		paddr = mb0->buf_iova + RTE_PKTMBUF_HEADROOM;
 		dma_addr0 = vsetq_lane_u64(paddr, zero, 0);
 		/* flush desc with pa dma_addr */
 		vst1q_u64((uint64_t *)&rxdp++->read, dma_addr0);
 
-		vst1_u8((uint8_t *)&mb1->rearm_data, p);
+		vst1_u8((uint8_t *)rte_mbuf_rearm_data(mb1), p);
 		paddr = mb1->buf_iova + RTE_PKTMBUF_HEADROOM;
 		dma_addr1 = vsetq_lane_u64(paddr, zero, 0);
 		vst1q_u64((uint64_t *)&rxdp++->read, dma_addr1);
@@ -411,9 +411,9 @@
 		pkt_mb3 = vreinterpretq_u8_u16(tmp);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		vst1q_u8((void *)&rx_pkts[pos + 3]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 			 pkt_mb4);
-		vst1q_u8((void *)&rx_pkts[pos + 2]->rx_descriptor_fields1,
+		vst1q_u8(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 			 pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -441,9 +441,9 @@
 		rte_prefetch_non_temporal(rxdp + RTE_IXGBE_DESCS_PER_LOOP);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		vst1q_u8((uint8_t *)&rx_pkts[pos + 1]->rx_descriptor_fields1,
+		vst1q_u8((uint8_t *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 			 pkt_mb2);
-		vst1q_u8((uint8_t *)&rx_pkts[pos]->rx_descriptor_fields1,
+		vst1q_u8((uint8_t *)rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 			 pkt_mb1);
 
 		desc_to_ptype_v(descs, rxq->pkt_type_mask, &rx_pkts[pos]);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index f60808d..e03daae 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -98,10 +98,10 @@
 desc_to_olflags_v_ipsec(__m128i descs[4], struct rte_mbuf **rx_pkts)
 {
 	__m128i sterr, rearm, tmp_e, tmp_p;
-	uint32_t *rearm0 = (uint32_t *)rx_pkts[0]->rearm_data + 2;
-	uint32_t *rearm1 = (uint32_t *)rx_pkts[1]->rearm_data + 2;
-	uint32_t *rearm2 = (uint32_t *)rx_pkts[2]->rearm_data + 2;
-	uint32_t *rearm3 = (uint32_t *)rx_pkts[3]->rearm_data + 2;
+	uint32_t *rearm0 = (uint32_t *)rte_mbuf_rearm_data(rx_pkts[0]) + 2;
+	uint32_t *rearm1 = (uint32_t *)rte_mbuf_rearm_data(rx_pkts[1]) + 2;
+	uint32_t *rearm2 = (uint32_t *)rte_mbuf_rearm_data(rx_pkts[2]) + 2;
+	uint32_t *rearm3 = (uint32_t *)rte_mbuf_rearm_data(rx_pkts[3]) + 2;
 	const __m128i ipsec_sterr_msk =
 			_mm_set1_epi32(IXGBE_RXDADV_IPSEC_STATUS_SECP |
 				       IXGBE_RXDADV_IPSEC_ERROR_AUTH_FAILED);
@@ -251,14 +251,10 @@
 	rearm3 = _mm_blend_epi16(mbuf_init, _mm_slli_si128(vtag1, 2), 0x10);
 
 	/* write the rearm data and the olflags in one write */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
-			offsetof(struct rte_mbuf, rearm_data) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
-			RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-	_mm_store_si128((__m128i *)&rx_pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&rx_pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&rx_pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&rx_pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(rx_pkts[3]), rearm3);
 }
 
 static inline uint32_t get_packet_type(int index,
@@ -350,15 +346,7 @@ static inline uint32_t get_packet_type(int index,
 				-rxq->crc_len, /* sub crc on pkt_len */
 				0, 0            /* ignore pkt_type field */
 			);
-	/*
-	 * compile-time check the above crc_adjust layout is correct.
-	 * NOTE: the first field (lowest address) is given last in set_epi16
-	 * call above.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
+
 	__m128i dd_check, eop_check;
 	__m128i mbuf_init;
 	uint8_t vlan_flags;
@@ -417,19 +405,6 @@ static inline uint32_t get_packet_type(int index,
 		0xFF, 0xFF,  /* skip 32 bit pkt_type */
 		0xFF, 0xFF
 		);
-	/*
-	 * Compile-time verify the shuffle mask
-	 * NOTE: some field positions already verified above, but duplicated
-	 * here for completeness in case of future modifications.
-	 */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash) !=
-			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
 
 	mbuf_init = _mm_set_epi64x(0, rxq->mbuf_initializer);
 
@@ -530,9 +505,9 @@ static inline uint32_t get_packet_type(int index,
 		staterr = _mm_unpacklo_epi32(sterr_tmp1, sterr_tmp2);
 
 		/* D.3 copy final 3,4 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+3]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 3]),
 				pkt_mb4);
-		_mm_storeu_si128((void *)&rx_pkts[pos+2]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 2]),
 				pkt_mb3);
 
 		/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
@@ -566,9 +541,9 @@ static inline uint32_t get_packet_type(int index,
 		staterr = _mm_packs_epi32(staterr, zero);
 
 		/* D.3 copy final 1,2 data to rx_pkts */
-		_mm_storeu_si128((void *)&rx_pkts[pos+1]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos + 1]),
 				pkt_mb2);
-		_mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[pos]),
 				pkt_mb1);
 
 		desc_to_ptype_v(descs, rxq->pkt_type_mask, &rx_pkts[pos]);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 14/23] net/mlx5: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 13/23] net/ixgbe: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 15/23] net/octeon_ep: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/mlx5_rxq.c              |  2 +-
 drivers/net/mlx5/mlx5_rxtx_vec.h         | 19 -------------------
 drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 28 ++++++++++++++--------------
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h    | 20 ++++++++++----------
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h     | 28 ++++++++++++++--------------
 5 files changed, 39 insertions(+), 58 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index ca2eeed..b854418 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -200,7 +200,7 @@
 		 */
 		rte_compiler_barrier();
 		rxq->mbuf_initializer =
-			*(rte_xmm_t *)&mbuf_init->rearm_data;
+			*(rte_xmm_t *)rte_mbuf_rearm_data(mbuf_init);
 		/* Padding with a fake mbuf for vectorized Rx. */
 		for (j = 0; j < MLX5_VPMD_DESCS_PER_LOOP; ++j)
 			(*rxq->elts)[elts_n + j] = &rxq->fake_mbuf;
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.h b/drivers/net/mlx5/mlx5_rxtx_vec.h
index 77c3f4e..43518c4 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.h
@@ -29,25 +29,6 @@
 #define S_ASSERT_MLX5_CQE(s) \
 	static_assert(s, "A field of struct mlx5_cqe is changed")
 
-/* rxq_cq_decompress_v() */
-S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, pkt_len) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, data_len) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, hash) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
-
-/* rxq_cq_to_ptype_oflags_v() */
-S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, ol_flags) ==
-		  offsetof(struct rte_mbuf, rearm_data) + 8);
-S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, rearm_data) ==
-		  RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16));
-
-/* rxq_burst_v() */
-S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, pkt_len) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
-S_ASSERT_RTE_MBUF(offsetof(struct rte_mbuf, data_len) ==
-		  offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
 #if (RTE_CACHE_LINE_SIZE == 128)
 S_ASSERT_MLX5_CQE(offsetof(struct mlx5_cqe, pkt_info) == 64);
 #else
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
index cccfa7f..9349c21 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
@@ -101,10 +101,10 @@
 	uint16_t pkts_n = mcqe_n;
 	const __vector unsigned char rearm =
 		(__vector unsigned char)vec_vsx_ld(0,
-		(signed int const *)&t_pkt->rearm_data);
+		(signed int const *)rte_mbuf_rearm_data(t_pkt));
 	const __vector unsigned char rxdf =
 		(__vector unsigned char)vec_vsx_ld(0,
-		(signed int const *)&t_pkt->rx_descriptor_fields1);
+		(signed int const *)rte_mbuf_rx_descriptor_fields1(t_pkt));
 	const __vector unsigned char crc_adj =
 		(__vector unsigned char)(__vector unsigned short){
 			0, 0, rxq->crc_present * RTE_ETHER_CRC_LEN, 0,
@@ -173,9 +173,9 @@
 
 		/* B.1 store rearm data to mbuf. */
 		*(__vector unsigned char *)
-			&elts[pos]->rearm_data = rearm;
+			rte_mbuf_rearm_data(elts[pos]) = rearm;
 		*(__vector unsigned char *)
-			&elts[pos + 1]->rearm_data = rearm;
+			rte_mbuf_rearm_data(elts[pos + 1]) = rearm;
 
 		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
 		rxdf1 = vec_perm(mcqe1, zero, shuf_mask1);
@@ -195,15 +195,15 @@
 
 		/* D.1 store rx_descriptor_fields1. */
 		*(__vector unsigned char *)
-			&elts[pos]->rx_descriptor_fields1 = rxdf1;
+			rte_mbuf_rx_descriptor_fields1(elts[pos]) = rxdf1;
 		*(__vector unsigned char *)
-			&elts[pos + 1]->rx_descriptor_fields1 = rxdf2;
+			rte_mbuf_rx_descriptor_fields1(elts[pos + 1]) = rxdf2;
 
 		/* B.1 store rearm data to mbuf. */
 		*(__vector unsigned char *)
-			&elts[pos + 2]->rearm_data = rearm;
+			rte_mbuf_rearm_data(elts[pos + 2]) = rearm;
 		*(__vector unsigned char *)
-			&elts[pos + 3]->rearm_data = rearm;
+			rte_mbuf_rearm_data(elts[pos + 3]) = rearm;
 
 		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
 		rxdf1 = vec_perm(mcqe2, zero, shuf_mask1);
@@ -223,9 +223,9 @@
 
 		/* D.1 store rx_descriptor_fields1. */
 		*(__vector unsigned char *)
-			&elts[pos + 2]->rx_descriptor_fields1 = rxdf1;
+			rte_mbuf_rx_descriptor_fields1(elts[pos + 2]) = rxdf1;
 		*(__vector unsigned char *)
-			&elts[pos + 3]->rx_descriptor_fields1 = rxdf2;
+			rte_mbuf_rx_descriptor_fields1(elts[pos + 3]) = rxdf2;
 
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		invalid_mask = (__vector unsigned char)(__vector unsigned long){
@@ -769,13 +769,13 @@
 
 	/* Write 8B rearm_data and 8B ol_flags. */
 	vec_vsx_st(rearm0, 0,
-		(__vector unsigned char *)&pkts[0]->rearm_data);
+		(__vector unsigned char *)rte_mbuf_rearm_data(pkts[0]));
 	vec_vsx_st(rearm1, 0,
-		(__vector unsigned char *)&pkts[1]->rearm_data);
+		(__vector unsigned char *)rte_mbuf_rearm_data(pkts[1]));
 	vec_vsx_st(rearm2, 0,
-		(__vector unsigned char *)&pkts[2]->rearm_data);
+		(__vector unsigned char *)rte_mbuf_rearm_data(pkts[2]));
 	vec_vsx_st(rearm3, 0,
-		(__vector unsigned char *)&pkts[3]->rearm_data);
+		(__vector unsigned char *)rte_mbuf_rearm_data(pkts[3]));
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index 3ed6881..97ea620 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -99,7 +99,7 @@
 		t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN);
 	uint16_t pkts_n = mcqe_n;
 	const uint64x2_t rearm =
-		vld1q_u64((void *)&t_pkt->rearm_data);
+		vld1q_u64((void *)rte_mbuf_rearm_data(t_pkt));
 	const uint32x4_t rxdf_mask = {
 		0xffffffff, /* packet_type */
 		0,          /* skip pkt_len */
@@ -107,7 +107,7 @@
 		0,          /* skip hash.rss */
 	};
 	const uint8x16_t rxdf =
-		vandq_u8(vld1q_u8((void *)&t_pkt->rx_descriptor_fields1),
+		vandq_u8(vld1q_u8(rte_mbuf_rx_descriptor_fields1(t_pkt)),
 			 vreinterpretq_u8_u32(rxdf_mask));
 	const uint16x8_t crc_adj = {
 		0, 0,
@@ -140,10 +140,10 @@
 		rte_prefetch0((void *)(cq + mcqe_n));
 	for (pos = 0; pos < mcqe_n; ) {
 		uint8_t *p = (void *)&mcq[pos % 8];
-		uint8_t *e0 = (void *)&elts[pos]->rearm_data;
-		uint8_t *e1 = (void *)&elts[pos + 1]->rearm_data;
-		uint8_t *e2 = (void *)&elts[pos + 2]->rearm_data;
-		uint8_t *e3 = (void *)&elts[pos + 3]->rearm_data;
+		uint8_t *e0 = (void *)rte_mbuf_rearm_data(elts[pos]);
+		uint8_t *e1 = (void *)rte_mbuf_rearm_data(elts[pos + 1]);
+		uint8_t *e2 = (void *)rte_mbuf_rearm_data(elts[pos + 2]);
+		uint8_t *e3 = (void *)rte_mbuf_rearm_data(elts[pos + 3]);
 		uint16x4_t byte_cnt;
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		uint16x4_t invalid_mask =
@@ -513,10 +513,10 @@
 					(vgetq_lane_u32(ol_flags, 0),
 					 vreinterpretq_u32_u64(mbuf_init), 2));
 
-	vst1q_u64((void *)&pkts[0]->rearm_data, rearm0);
-	vst1q_u64((void *)&pkts[1]->rearm_data, rearm1);
-	vst1q_u64((void *)&pkts[2]->rearm_data, rearm2);
-	vst1q_u64((void *)&pkts[3]->rearm_data, rearm3);
+	vst1q_u64((void *)rte_mbuf_rearm_data(pkts[0]), rearm0);
+	vst1q_u64((void *)rte_mbuf_rearm_data(pkts[1]), rearm1);
+	vst1q_u64((void *)rte_mbuf_rearm_data(pkts[2]), rearm2);
+	vst1q_u64((void *)rte_mbuf_rearm_data(pkts[3]), rearm3);
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index 2bdd1f6..088ce37 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -98,9 +98,9 @@
 		t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN);
 	uint16_t pkts_n = mcqe_n;
 	const __m128i rearm =
-		_mm_loadu_si128((__m128i *)&t_pkt->rearm_data);
+		_mm_loadu_si128((__m128i *)rte_mbuf_rearm_data(t_pkt));
 	const __m128i rxdf =
-		_mm_loadu_si128((__m128i *)&t_pkt->rx_descriptor_fields1);
+		_mm_loadu_si128((__m128i *)rte_mbuf_rx_descriptor_fields1(t_pkt));
 	const __m128i crc_adj =
 		_mm_set_epi16(0, 0, 0,
 			      rxq->crc_present * RTE_ETHER_CRC_LEN,
@@ -145,8 +145,8 @@
 		mcqe1 = _mm_loadu_si128((__m128i *)&mcq[pos % 8]);
 		mcqe2 = _mm_loadu_si128((__m128i *)&mcq[pos % 8 + 2]);
 		/* B.1 store rearm data to mbuf. */
-		_mm_storeu_si128((__m128i *)&elts[pos]->rearm_data, rearm);
-		_mm_storeu_si128((__m128i *)&elts[pos + 1]->rearm_data, rearm);
+		_mm_storeu_si128((__m128i *)rte_mbuf_rearm_data(elts[pos]), rearm);
+		_mm_storeu_si128((__m128i *)rte_mbuf_rearm_data(elts[pos + 1]), rearm);
 		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
 		rxdf1 = _mm_shuffle_epi8(mcqe1, shuf_mask1);
 		rxdf2 = _mm_shuffle_epi8(mcqe1, shuf_mask2);
@@ -156,14 +156,14 @@
 		rxdf2 = _mm_blend_epi16(rxdf2, rxdf, 0x23);
 		/* D.1 store rx_descriptor_fields1. */
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos]->rx_descriptor_fields1,
+				  rte_mbuf_rx_descriptor_fields1(elts[pos]),
 				 rxdf1);
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 1]->rx_descriptor_fields1,
+				  rte_mbuf_rx_descriptor_fields1(elts[pos + 1]),
 				 rxdf2);
 		/* B.1 store rearm data to mbuf. */
-		_mm_storeu_si128((__m128i *)&elts[pos + 2]->rearm_data, rearm);
-		_mm_storeu_si128((__m128i *)&elts[pos + 3]->rearm_data, rearm);
+		_mm_storeu_si128((__m128i *)rte_mbuf_rearm_data(elts[pos + 2]), rearm);
+		_mm_storeu_si128((__m128i *)rte_mbuf_rearm_data(elts[pos + 3]), rearm);
 		/* C.1 combine data from mCQEs with rx_descriptor_fields1. */
 		rxdf1 = _mm_shuffle_epi8(mcqe2, shuf_mask1);
 		rxdf2 = _mm_shuffle_epi8(mcqe2, shuf_mask2);
@@ -173,10 +173,10 @@
 		rxdf2 = _mm_blend_epi16(rxdf2, rxdf, 0x23);
 		/* D.1 store rx_descriptor_fields1. */
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 2]->rx_descriptor_fields1,
+				  rte_mbuf_rx_descriptor_fields1(elts[pos + 2]),
 				 rxdf1);
 		_mm_storeu_si128((__m128i *)
-				  &elts[pos + 3]->rx_descriptor_fields1,
+				  rte_mbuf_rx_descriptor_fields1(elts[pos + 3]),
 				 rxdf2);
 #ifdef MLX5_PMD_SOFT_COUNTERS
 		invalid_mask = _mm_set_epi64x(0,
@@ -511,10 +511,10 @@
 	rearm2 = _mm_blend_epi16(mbuf_init, ol_flags, 0x30);
 	rearm3 = _mm_blend_epi16(mbuf_init, _mm_srli_si128(ol_flags, 4), 0x30);
 	/* Write 8B rearm_data and 8B ol_flags. */
-	_mm_store_si128((__m128i *)&pkts[0]->rearm_data, rearm0);
-	_mm_store_si128((__m128i *)&pkts[1]->rearm_data, rearm1);
-	_mm_store_si128((__m128i *)&pkts[2]->rearm_data, rearm2);
-	_mm_store_si128((__m128i *)&pkts[3]->rearm_data, rearm3);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(pkts[0]), rearm0);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(pkts[1]), rearm1);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(pkts[2]), rearm2);
+	_mm_store_si128((__m128i *)rte_mbuf_rearm_data(pkts[3]), rearm3);
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 15/23] net/octeon_ep: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 14/23] net/mlx5: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 16/23] net/sfc: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/octeon_ep/cnxk_ep_rx.h      | 2 +-
 drivers/net/octeon_ep/cnxk_ep_rx_avx.c  | 2 +-
 drivers/net/octeon_ep/cnxk_ep_rx_neon.c | 8 ++++----
 drivers/net/octeon_ep/cnxk_ep_rx_sse.c  | 8 ++++----
 drivers/net/octeon_ep/otx_ep_rxtx.c     | 5 +----
 5 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/net/octeon_ep/cnxk_ep_rx.h b/drivers/net/octeon_ep/cnxk_ep_rx.h
index 61263e6..1d706e2 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx.h
+++ b/drivers/net/octeon_ep/cnxk_ep_rx.h
@@ -158,7 +158,7 @@
 		mbuf->pkt_len = pkt_len;
 		mbuf->data_len = pkt_len;
 
-		*(uint64_t *)&mbuf->rearm_data = droq->rearm_data;
+		*rte_mbuf_rearm_data(mbuf) = droq->rearm_data;
 		rx_pkts[pkts] = mbuf;
 		bytes_rsvd += pkt_len;
 	}
diff --git a/drivers/net/octeon_ep/cnxk_ep_rx_avx.c b/drivers/net/octeon_ep/cnxk_ep_rx_avx.c
index 47eb1d2..3b8241c 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx_avx.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx_avx.c
@@ -60,7 +60,7 @@
 
 		/* Store the 256bit data to the mbuf. */
 		for (i = 0; i < CNXK_EP_OQ_DESC_PER_LOOP_AVX; i++)
-			_mm256_storeu_si256((__m256i *)&m[i]->rearm_data, data[i]);
+			_mm256_storeu_si256((__m256i *)rte_mbuf_rearm_data(m[i]), data[i]);
 
 		for (i = 0; i < CNXK_EP_OQ_DESC_PER_LOOP_AVX; i++)
 			rx_pkts[pkts++] = m[i];
diff --git a/drivers/net/octeon_ep/cnxk_ep_rx_neon.c b/drivers/net/octeon_ep/cnxk_ep_rx_neon.c
index 4c46a7e..8797252 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx_neon.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx_neon.c
@@ -72,10 +72,10 @@
 		*(uint64_t *)&m3->pkt_len = vgetq_lane_u64(s23, 1);
 
 		/* Reset rearm data. */
-		*(uint64_t *)&m0->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m1->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m2->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m3->rearm_data = droq->rearm_data;
+		*rte_mbuf_rearm_data(m0) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m1) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m2) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m3) = droq->rearm_data;
 
 		rx_pkts[pkts++] = m0;
 		rx_pkts[pkts++] = m1;
diff --git a/drivers/net/octeon_ep/cnxk_ep_rx_sse.c b/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
index 308c8b2..1466217 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
@@ -64,10 +64,10 @@
 		*(uint64_t *)&m3->pkt_len = ((rte_xmm_t)s23).u64[1];
 
 		/* Reset rearm data. */
-		*(uint64_t *)&m0->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m1->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m2->rearm_data = droq->rearm_data;
-		*(uint64_t *)&m3->rearm_data = droq->rearm_data;
+		*rte_mbuf_rearm_data(m0) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m1) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m2) = droq->rearm_data;
+		*rte_mbuf_rearm_data(m3) = droq->rearm_data;
 
 		rx_pkts[pkts++] = m0;
 		rx_pkts[pkts++] = m1;
diff --git a/drivers/net/octeon_ep/otx_ep_rxtx.c b/drivers/net/octeon_ep/otx_ep_rxtx.c
index aea148e..4470599 100644
--- a/drivers/net/octeon_ep/otx_ep_rxtx.c
+++ b/drivers/net/octeon_ep/otx_ep_rxtx.c
@@ -289,7 +289,6 @@
 {
 	uint16_t port_id = otx_ep->port_id;
 	struct rte_mbuf mb_def;
-	uint64_t *tmp;
 
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) % 8 != 0);
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) - offsetof(struct rte_mbuf, data_off) !=
@@ -305,9 +304,7 @@
 
 	/* Prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	tmp = (uint64_t *)&mb_def.rearm_data;
-
-	return *tmp;
+	return *rte_mbuf_rearm_data(&mb_def);
 }
 
 /* OQ initialization */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 16/23] net/sfc: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 15/23] net/octeon_ep: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 17/23] net/thunderx: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/sfc/sfc_ef100_rx.c |  7 ++-----
 drivers/net/sfc/sfc_ef10_rx.c  | 10 +++-------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c
index e283879..51c7da0 100644
--- a/drivers/net/sfc/sfc_ef100_rx.c
+++ b/drivers/net/sfc/sfc_ef100_rx.c
@@ -553,9 +553,7 @@ struct sfc_ef100_rxq {
 		pkt = sfc_ef100_rx_next_mbuf(rxq);
 		__rte_mbuf_raw_sanity_check(pkt);
 
-		RTE_BUILD_BUG_ON(sizeof(pkt->rearm_data[0]) !=
-				 sizeof(rxq->rearm_data));
-		pkt->rearm_data[0] = rxq->rearm_data;
+		*rte_mbuf_rearm_data(pkt) = rxq->rearm_data;
 
 		/* data_off already moved past Rx prefix */
 		rx_prefix = (const efx_xword_t *)sfc_ef100_rx_pkt_prefix(pkt);
@@ -760,8 +758,7 @@ struct sfc_ef100_rxq {
 
 	/* rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
-	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	return *rte_mbuf_rearm_data(&m);
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef100_rx_qcreate;
diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c
index 6044293..2ac0203 100644
--- a/drivers/net/sfc/sfc_ef10_rx.c
+++ b/drivers/net/sfc/sfc_ef10_rx.c
@@ -322,8 +322,7 @@ struct sfc_ef10_rxq {
 
 	m = rxd->mbuf;
 
-	RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) != sizeof(rxq->rearm_data));
-	m->rearm_data[0] = rxq->rearm_data;
+	*rte_mbuf_rearm_data(m) = rxq->rearm_data;
 
 	/* Classify packet based on Rx event */
 	/* Mask RSS hash offload flag if RSS is not enabled */
@@ -377,9 +376,7 @@ struct sfc_ef10_rxq {
 			rxq->completed = pending;
 		}
 
-		RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) !=
-				 sizeof(rxq->rearm_data));
-		m->rearm_data[0] = rxq->rearm_data;
+		*rte_mbuf_rearm_data(m) = rxq->rearm_data;
 
 		/* Event-dependent information is the same */
 		m->ol_flags = m0->ol_flags;
@@ -633,8 +630,7 @@ struct sfc_ef10_rxq {
 
 	/* rearm_data covers structure members filled in above */
 	rte_compiler_barrier();
-	RTE_BUILD_BUG_ON(sizeof(m.rearm_data[0]) != sizeof(uint64_t));
-	return m.rearm_data[0];
+	return *rte_mbuf_rearm_data(&m);
 }
 
 static sfc_dp_rx_qcreate_t sfc_ef10_rx_qcreate;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 17/23] net/thunderx: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (15 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 16/23] net/sfc: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 18/23] net/virtio: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/thunderx/nicvf_ethdev.c | 4 +---
 drivers/net/thunderx/nicvf_rxtx.h   | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 609d95d..722751c 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1306,7 +1306,6 @@ enum nicvf_link_speed {
 static inline void
 nicvf_rxq_mbuf_setup(struct nicvf_rxq *rxq)
 {
-	uintptr_t p;
 	struct rte_mbuf mb_def;
 	struct nicvf *nic = rxq->nic;
 
@@ -1328,8 +1327,7 @@ enum nicvf_link_speed {
 
 	/* Prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer.value = *(uint64_t *)p;
+	rxq->mbuf_initializer.value = *rte_mbuf_rearm_data(&mb_def);
 }
 
 static int
diff --git a/drivers/net/thunderx/nicvf_rxtx.h b/drivers/net/thunderx/nicvf_rxtx.h
index 4b83e33..7c07cde 100644
--- a/drivers/net/thunderx/nicvf_rxtx.h
+++ b/drivers/net/thunderx/nicvf_rxtx.h
@@ -66,7 +66,7 @@ static inline uint16_t __attribute__((const))
 #else
 	init.value += apad;
 #endif
-	*(uint64_t *)(&pkt->rearm_data) = init.value;
+	*rte_mbuf_rearm_data(pkt) = init.value;
 }
 
 static inline void
@@ -80,7 +80,7 @@ static inline uint16_t __attribute__((const))
 	init.value += apad;
 #endif
 	init.fields.nb_segs = nb_segs;
-	*(uint64_t *)(&pkt->rearm_data) = init.value;
+	*rte_mbuf_rearm_data(pkt) = init.value;
 }
 
 uint32_t nicvf_dev_rx_queue_count(void *rx_queue);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 18/23] net/virtio: use mbuf descriptor accessors
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (16 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 17/23] net/thunderx: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 19/23] examples/dma: use mbuf descriptor accessor Tyler Retzlaff
                     ` (4 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors
that provide a compatible type pointer without using the marker fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/virtio/virtio_rxtx_packed.h         |  4 ++--
 drivers/net/virtio/virtio_rxtx_packed_avx.h     | 16 +++++-----------
 drivers/net/virtio/virtio_rxtx_packed_neon.h    | 18 ++++++++----------
 drivers/net/virtio/virtio_rxtx_simple.c         |  4 +---
 drivers/net/virtio/virtio_rxtx_simple.h         |  5 +----
 drivers/net/virtio/virtio_rxtx_simple_altivec.c | 16 ++++++++--------
 drivers/net/virtio/virtio_rxtx_simple_neon.c    | 24 ++++++++----------------
 drivers/net/virtio/virtio_rxtx_simple_sse.c     | 16 ++++++++--------
 8 files changed, 41 insertions(+), 62 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx_packed.h b/drivers/net/virtio/virtio_rxtx_packed.h
index 5361129..0a8c9f8 100644
--- a/drivers/net/virtio/virtio_rxtx_packed.h
+++ b/drivers/net/virtio/virtio_rxtx_packed.h
@@ -37,12 +37,12 @@
 
 /* reference count offset in mbuf rearm data */
 #define REFCNT_BITS_OFFSET ((offsetof(struct rte_mbuf, refcnt) - \
-	offsetof(struct rte_mbuf, rearm_data)) * BYTE_SIZE)
+	offsetof(struct rte_mbuf, data_off)) * BYTE_SIZE)
 
 #ifdef CC_AVX512_SUPPORT
 /* segment number offset in mbuf rearm data */
 #define SEG_NUM_BITS_OFFSET ((offsetof(struct rte_mbuf, nb_segs) - \
-	offsetof(struct rte_mbuf, rearm_data)) * BYTE_SIZE)
+	offsetof(struct rte_mbuf, data_off)) * BYTE_SIZE)
 /* default rearm data */
 #define DEFAULT_REARM_DATA (1ULL << SEG_NUM_BITS_OFFSET | \
 	1ULL << REFCNT_BITS_OFFSET)
diff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.h b/drivers/net/virtio/virtio_rxtx_packed_avx.h
index 584ac72..5d30e2a 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_avx.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h
@@ -36,10 +36,10 @@
 	/* Load four mbufs rearm data */
 	RTE_BUILD_BUG_ON(REFCNT_BITS_OFFSET >= 64);
 	RTE_BUILD_BUG_ON(SEG_NUM_BITS_OFFSET >= 64);
-	__m256i mbufs = _mm256_set_epi64x(*tx_pkts[3]->rearm_data,
-					  *tx_pkts[2]->rearm_data,
-					  *tx_pkts[1]->rearm_data,
-					  *tx_pkts[0]->rearm_data);
+	__m256i mbufs = _mm256_set_epi64x(*rte_mbuf_rearm_data(tx_pkts[3]),
+					  *rte_mbuf_rearm_data(tx_pkts[2]),
+					  *rte_mbuf_rearm_data(tx_pkts[1]),
+					  *rte_mbuf_rearm_data(tx_pkts[0]));
 
 	/* refcnt=1 and nb_segs=1 */
 	__m256i mbuf_ref = _mm256_set1_epi64x(DEFAULT_REARM_DATA);
@@ -53,8 +53,6 @@
 
 	/* Check headroom is enough */
 	const __mmask16 data_mask = 0x1 | 0x1 << 4 | 0x1 << 8 | 0x1 << 12;
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) !=
-		offsetof(struct rte_mbuf, rearm_data));
 	cmp = _mm256_mask_cmplt_epu16_mask(data_mask, mbufs, head_rooms);
 	if (unlikely(cmp))
 		return -1;
@@ -187,7 +185,7 @@
 		rx_pkts[i] = (struct rte_mbuf *)vq->vq_descx[id + i].cookie;
 		rte_packet_prefetch(rte_pktmbuf_mtod(rx_pkts[i], void *));
 
-		addrs[i] = (uintptr_t)rx_pkts[i]->rx_descriptor_fields1;
+		addrs[i] = (uintptr_t)rte_mbuf_rx_descriptor_fields1(rx_pkts[i]);
 	}
 
 	/*
@@ -203,10 +201,6 @@
 
 	__m512i v_value = _mm512_add_epi32(values, mbuf_len_offset);
 
-	/* assert offset of data_len */
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
-		offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
-
 	__m512i v_index = _mm512_set_epi64(addrs[3] + 8, addrs[3],
 					   addrs[2] + 8, addrs[2],
 					   addrs[1] + 8, addrs[1],
diff --git a/drivers/net/virtio/virtio_rxtx_packed_neon.h b/drivers/net/virtio/virtio_rxtx_packed_neon.h
index c222ebf..c172fad 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_neon.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_neon.h
@@ -59,10 +59,10 @@
 	uint8x16x2_t mbuf;
 	/* Load four mbufs rearm data. */
 	RTE_BUILD_BUG_ON(REFCNT_BITS_OFFSET >= 64);
-	pkts[0] = vld1_u16((uint16_t *)&tx_pkts[0]->rearm_data);
-	pkts[1] = vld1_u16((uint16_t *)&tx_pkts[1]->rearm_data);
-	pkts[2] = vld1_u16((uint16_t *)&tx_pkts[2]->rearm_data);
-	pkts[3] = vld1_u16((uint16_t *)&tx_pkts[3]->rearm_data);
+	pkts[0] = vld1_u16((uint16_t *)rte_mbuf_rearm_data(tx_pkts[0]));
+	pkts[1] = vld1_u16((uint16_t *)rte_mbuf_rearm_data(tx_pkts[1]));
+	pkts[2] = vld1_u16((uint16_t *)rte_mbuf_rearm_data(tx_pkts[2]));
+	pkts[3] = vld1_u16((uint16_t *)rte_mbuf_rearm_data(tx_pkts[3]));
 
 	mbuf.val[0] = vreinterpretq_u8_u16(vcombine_u16(pkts[0], pkts[1]));
 	mbuf.val[1] = vreinterpretq_u8_u16(vcombine_u16(pkts[2], pkts[3]));
@@ -77,8 +77,6 @@
 
 	/* Check headroom is enough. */
 	uint16x4_t head_rooms = vdup_n_u16(head_size);
-	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) !=
-			 offsetof(struct rte_mbuf, rearm_data));
 	uint16x4_t data_offset = vreinterpret_u16_u8(vqtbl2_u8(mbuf, data_msk));
 	uint64x1_t cmp2 = vreinterpret_u64_u16(vclt_u16(data_offset, head_rooms));
 	if (unlikely(vget_lane_u64(cmp2, 0)))
@@ -263,10 +261,10 @@
 	pkt_mb[3] = vreinterpretq_u64_u16(vsubq_u16(
 			vreinterpretq_u16_u64(pkt_mb[3]), len_adjust));
 
-	vst1q_u64((void *)&rx_pkts[0]->rx_descriptor_fields1, pkt_mb[0]);
-	vst1q_u64((void *)&rx_pkts[1]->rx_descriptor_fields1, pkt_mb[1]);
-	vst1q_u64((void *)&rx_pkts[2]->rx_descriptor_fields1, pkt_mb[2]);
-	vst1q_u64((void *)&rx_pkts[3]->rx_descriptor_fields1, pkt_mb[3]);
+	vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[0]), pkt_mb[0]);
+	vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[1]), pkt_mb[1]);
+	vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[2]), pkt_mb[2]);
+	vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[3]), pkt_mb[3]);
 
 	if (hw->has_rx_offload) {
 		virtio_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index 4382569..e6a82e5 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -31,7 +31,6 @@
 virtio_rxq_vec_setup(struct virtnet_rx *rxq)
 {
 	struct virtqueue *vq = virtnet_rxq_to_vq(rxq);
-	uintptr_t p;
 	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
 	mb_def.nb_segs = 1;
@@ -41,8 +40,7 @@
 
 	/* prevent compiler reordering: rearm_data covers previous fields */
 	rte_compiler_barrier();
-	p = (uintptr_t)&mb_def.rearm_data;
-	rxq->mbuf_initializer = *(uint64_t *)p;
+	rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
 
 	return 0;
 }
diff --git a/drivers/net/virtio/virtio_rxtx_simple.h b/drivers/net/virtio/virtio_rxtx_simple.h
index 79196ed..16fef0e 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.h
+++ b/drivers/net/virtio/virtio_rxtx_simple.h
@@ -39,10 +39,7 @@
 	}
 
 	for (i = 0; i < RTE_VIRTIO_VPMD_RX_REARM_THRESH; i++) {
-		uintptr_t p;
-
-		p = (uintptr_t)&sw_ring[i]->rearm_data;
-		*(uint64_t *)p = rxvq->mbuf_initializer;
+		*rte_mbuf_rearm_data(sw_ring[i]) = rxvq->mbuf_initializer;
 
 		start_dp[i].addr = VIRTIO_MBUF_ADDR(sw_ring[i], vq) +
 			RTE_PKTMBUF_HEADROOM - vq->hw->vtnet_hdr_size;
diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
index 542ec3d..39ec1ca 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c
@@ -138,9 +138,9 @@
 			((__vector unsigned short)pkt_mb[0] + len_adjust);
 		pkt_mb[1] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[1] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[0]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[0]) =
 			pkt_mb[0];
-		*(__vector unsigned char *)&rx_pkts[1]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[1]) =
 			pkt_mb[1];
 
 		pkt_mb[2] = vec_perm(desc[1], zero, shuf_msk1);
@@ -149,9 +149,9 @@
 			((__vector unsigned short)pkt_mb[2] + len_adjust);
 		pkt_mb[3] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[3] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[2]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[2]) =
 			pkt_mb[2];
-		*(__vector unsigned char *)&rx_pkts[3]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[3]) =
 			pkt_mb[3];
 
 		pkt_mb[4] = vec_perm(desc[2], zero, shuf_msk1);
@@ -160,9 +160,9 @@
 			((__vector unsigned short)pkt_mb[4] + len_adjust);
 		pkt_mb[5] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[5] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[4]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[4]) =
 			pkt_mb[4];
-		*(__vector unsigned char *)&rx_pkts[5]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[5]) =
 			pkt_mb[5];
 
 		pkt_mb[6] = vec_perm(desc[3], zero, shuf_msk1);
@@ -171,9 +171,9 @@
 			((__vector unsigned short)pkt_mb[6] + len_adjust);
 		pkt_mb[7] = (__vector unsigned char)
 			((__vector unsigned short)pkt_mb[7] + len_adjust);
-		*(__vector unsigned char *)&rx_pkts[6]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[6]) =
 			pkt_mb[6];
-		*(__vector unsigned char *)&rx_pkts[7]->rx_descriptor_fields1 =
+		*(__vector unsigned char *)rte_mbuf_rx_descriptor_fields1(rx_pkts[7]) =
 			pkt_mb[7];
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c
index 7139b31..873b42c 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_neon.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c
@@ -138,10 +138,8 @@
 				vreinterpretq_u16_u64(pkt_mb[1]), len_adjust));
 		pkt_mb[0] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[0]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[1]->rx_descriptor_fields1,
-			pkt_mb[1]);
-		vst1q_u64((void *)&rx_pkts[0]->rx_descriptor_fields1,
-			pkt_mb[0]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[1]), pkt_mb[1]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[0]), pkt_mb[0]);
 
 		pkt_mb[3] = vreinterpretq_u64_u8(vqtbl1q_u8(
 				vreinterpretq_u8_u64(desc[1]), shuf_msk2));
@@ -151,10 +149,8 @@
 				vreinterpretq_u16_u64(pkt_mb[3]), len_adjust));
 		pkt_mb[2] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[2]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[3]->rx_descriptor_fields1,
-			pkt_mb[3]);
-		vst1q_u64((void *)&rx_pkts[2]->rx_descriptor_fields1,
-			pkt_mb[2]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[3]), pkt_mb[3]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[2]), pkt_mb[2]);
 
 		pkt_mb[5] = vreinterpretq_u64_u8(vqtbl1q_u8(
 				vreinterpretq_u8_u64(desc[2]), shuf_msk2));
@@ -164,10 +160,8 @@
 				vreinterpretq_u16_u64(pkt_mb[5]), len_adjust));
 		pkt_mb[4] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[4]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[5]->rx_descriptor_fields1,
-			pkt_mb[5]);
-		vst1q_u64((void *)&rx_pkts[4]->rx_descriptor_fields1,
-			pkt_mb[4]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[5]), pkt_mb[5]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[4]), pkt_mb[4]);
 
 		pkt_mb[7] = vreinterpretq_u64_u8(vqtbl1q_u8(
 				vreinterpretq_u8_u64(desc[3]), shuf_msk2));
@@ -177,10 +171,8 @@
 				vreinterpretq_u16_u64(pkt_mb[7]), len_adjust));
 		pkt_mb[6] = vreinterpretq_u64_u16(vsubq_u16(
 				vreinterpretq_u16_u64(pkt_mb[6]), len_adjust));
-		vst1q_u64((void *)&rx_pkts[7]->rx_descriptor_fields1,
-			pkt_mb[7]);
-		vst1q_u64((void *)&rx_pkts[6]->rx_descriptor_fields1,
-			pkt_mb[6]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[7]), pkt_mb[7]);
+		vst1q_u64(rte_mbuf_rx_descriptor_fields1(rx_pkts[6]), pkt_mb[6]);
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
 			if (sw_ring + nb_used <= sw_ring_end)
diff --git a/drivers/net/virtio/virtio_rxtx_simple_sse.c b/drivers/net/virtio/virtio_rxtx_simple_sse.c
index 6a18741..25db486 100644
--- a/drivers/net/virtio/virtio_rxtx_simple_sse.c
+++ b/drivers/net/virtio/virtio_rxtx_simple_sse.c
@@ -134,36 +134,36 @@
 		pkt_mb[0] = _mm_shuffle_epi8(desc[0], shuf_msk1);
 		pkt_mb[1] = _mm_add_epi16(pkt_mb[1], len_adjust);
 		pkt_mb[0] = _mm_add_epi16(pkt_mb[0], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[1]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[1]),
 			pkt_mb[1]);
-		_mm_storeu_si128((void *)&rx_pkts[0]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[0]),
 			pkt_mb[0]);
 
 		pkt_mb[3] = _mm_shuffle_epi8(desc[1], shuf_msk2);
 		pkt_mb[2] = _mm_shuffle_epi8(desc[1], shuf_msk1);
 		pkt_mb[3] = _mm_add_epi16(pkt_mb[3], len_adjust);
 		pkt_mb[2] = _mm_add_epi16(pkt_mb[2], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[3]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[3]),
 			pkt_mb[3]);
-		_mm_storeu_si128((void *)&rx_pkts[2]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[2]),
 			pkt_mb[2]);
 
 		pkt_mb[5] = _mm_shuffle_epi8(desc[2], shuf_msk2);
 		pkt_mb[4] = _mm_shuffle_epi8(desc[2], shuf_msk1);
 		pkt_mb[5] = _mm_add_epi16(pkt_mb[5], len_adjust);
 		pkt_mb[4] = _mm_add_epi16(pkt_mb[4], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[5]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[5]),
 			pkt_mb[5]);
-		_mm_storeu_si128((void *)&rx_pkts[4]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[4]),
 			pkt_mb[4]);
 
 		pkt_mb[7] = _mm_shuffle_epi8(desc[3], shuf_msk2);
 		pkt_mb[6] = _mm_shuffle_epi8(desc[3], shuf_msk1);
 		pkt_mb[7] = _mm_add_epi16(pkt_mb[7], len_adjust);
 		pkt_mb[6] = _mm_add_epi16(pkt_mb[6], len_adjust);
-		_mm_storeu_si128((void *)&rx_pkts[7]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[7]),
 			pkt_mb[7]);
-		_mm_storeu_si128((void *)&rx_pkts[6]->rx_descriptor_fields1,
+		_mm_storeu_si128(rte_mbuf_rx_descriptor_fields1(rx_pkts[6]),
 			pkt_mb[6]);
 
 		if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 19/23] examples/dma: use mbuf descriptor accessor
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (17 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 18/23] net/virtio: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Tyler Retzlaff
                     ` (3 subsequent siblings)
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use
new rte_mbuf_rx_descriptor_fields1 accessor that provides a compatible
type pointer without using the marker field.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 examples/dma/dmafwd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c
index f4a0bff..54991f6 100644
--- a/examples/dma/dmafwd.c
+++ b/examples/dma/dmafwd.c
@@ -294,9 +294,10 @@ struct dma_bufs {
 pktmbuf_metadata_copy(const struct rte_mbuf *src, struct rte_mbuf *dst)
 {
 	dst->data_off = src->data_off;
-	memcpy(&dst->rx_descriptor_fields1, &src->rx_descriptor_fields1,
+	memcpy(rte_mbuf_rx_descriptor_fields1(dst),
+		rte_mbuf_rx_descriptor_fields1((struct rte_mbuf *)(uintptr_t)src),
 		offsetof(struct rte_mbuf, buf_len) -
-		offsetof(struct rte_mbuf, rx_descriptor_fields1));
+		offsetof(struct rte_mbuf, data_off));
 }
 
 /* Copy packet data */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (18 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 19/23] examples/dma: use mbuf descriptor accessor Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  9:15     ` Morten Brørup
                       ` (3 more replies)
  2024-02-27  5:41   ` [PATCH v6 21/23] security: remove " Tyler Retzlaff
                     ` (2 subsequent siblings)
  22 siblings, 4 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Update implementation of rte_mbuf_prefetch_part1() and
rte_mbuf_prefetch_part2() inline functions calculate pointer for
prefetch of cachline0 and cachline1 without using removed markers.

Update static_assert of rte_mbuf struct fields to reference data_off and
packet_type fields that occupy the original offsets of the marker
fields.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 doc/guides/rel_notes/release_24_03.rst |  9 ++++++++
 lib/mbuf/rte_mbuf.h                    |  4 ++--
 lib/mbuf/rte_mbuf_core.h               | 39 +++++++++++++---------------------
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 879bb49..67750f2 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -156,6 +156,15 @@ Removed Items
   The application reserved statically defined logtypes ``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8``
   are still defined.
 
+* mbuf: ``RTE_MARKER`` fields ``cacheline0`` ``cacheline1``
+  ``rx_descriptor_fields1`` and ``RTE_MARKER64`` field ``rearm_data``
+  have been removed from ``struct rte_mbuf``.
+  Prefetch of ``cacheline0`` and ``cacheline1`` may be achieved through
+  ``rte_mbuf_prefetch_part1()`` and ``rte_mbuf_prefetch_part2()`` inline
+  functions respectively.
+  Access to ``rearm_data`` and ``rx_descriptor_fields1`` should be
+  through new inline functions ``rte_mbuf_rearm_data()`` and
+  ``rte_mbuf_rx_descriptor_fields1()`` respectively.
 
 API Changes
 -----------
diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index aa7495b..61cda20 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -108,7 +108,7 @@
 static inline void
 rte_mbuf_prefetch_part1(struct rte_mbuf *m)
 {
-	rte_prefetch0(&m->cacheline0);
+	rte_prefetch0(m);
 }
 
 /**
@@ -126,7 +126,7 @@
 rte_mbuf_prefetch_part2(struct rte_mbuf *m)
 {
 #if RTE_CACHE_LINE_SIZE == 64
-	rte_prefetch0(&m->cacheline1);
+	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
 #else
 	RTE_SET_USED(m);
 #endif
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 36551c2..4e06f15 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -18,6 +18,7 @@
 
 #include <assert.h>
 #include <stddef.h>
+#include <stdalign.h>
 #include <stdint.h>
 
 #include <rte_common.h>
@@ -467,8 +468,6 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct rte_mbuf {
-	RTE_MARKER cacheline0;
-
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
 	/**
@@ -495,7 +494,6 @@ struct rte_mbuf {
 	 * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
 	 * accessor instead of directly referencing through the data_off field.
 	 */
-	RTE_MARKER64 rearm_data;
 	uint16_t data_off;
 
 	/**
@@ -522,8 +520,6 @@ struct rte_mbuf {
 	uint64_t ol_flags;        /**< Offload features. */
 
 	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
-
 	/*
 	 * The packet type, which is the combination of outer/inner L2, L3, L4
 	 * and tunnel types. The packet_type is about data really present in the
@@ -607,8 +603,7 @@ struct rte_mbuf {
 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
-
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 #if RTE_IOVA_IN_MBUF
 	/**
 	 * Next segment of scattered packet. Must be NULL in the last
@@ -677,35 +672,31 @@ struct rte_mbuf {
 } __rte_cache_aligned;
 
 static_assert(!(offsetof(struct rte_mbuf, ol_flags) !=
-	offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags");
-static_assert(!(offsetof(struct rte_mbuf, rearm_data) !=
-	RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data");
+	offsetof(struct rte_mbuf, data_off) + 8), "ol_flags");
 static_assert(!(offsetof(struct rte_mbuf, data_off) !=
-	offsetof(struct rte_mbuf, rearm_data)), "data_off");
-static_assert(!(offsetof(struct rte_mbuf, data_off) <
-	offsetof(struct rte_mbuf, rearm_data)), "data_off");
+	RTE_ALIGN(offsetof(struct rte_mbuf, data_off), 16)), "data_off");
 static_assert(!(offsetof(struct rte_mbuf, refcnt) <
-	offsetof(struct rte_mbuf, rearm_data)), "refcnt");
+	offsetof(struct rte_mbuf, data_off)), "refcnt");
 static_assert(!(offsetof(struct rte_mbuf, nb_segs) <
-	offsetof(struct rte_mbuf, rearm_data)), "nb_segs");
+	offsetof(struct rte_mbuf, data_off)), "nb_segs");
 static_assert(!(offsetof(struct rte_mbuf, port) <
-	offsetof(struct rte_mbuf, rearm_data)), "port");
+	offsetof(struct rte_mbuf, data_off)), "port");
 static_assert(!(offsetof(struct rte_mbuf, data_off) -
-	offsetof(struct rte_mbuf, rearm_data) > 6), "data_off");
+	offsetof(struct rte_mbuf, data_off) > 6), "data_off");
 static_assert(!(offsetof(struct rte_mbuf, refcnt) -
-	offsetof(struct rte_mbuf, rearm_data) > 6), "refcnt");
+	offsetof(struct rte_mbuf, data_off) > 6), "refcnt");
 static_assert(!(offsetof(struct rte_mbuf, nb_segs) -
-	offsetof(struct rte_mbuf, rearm_data) > 6), "nb_segs");
+	offsetof(struct rte_mbuf, data_off) > 6), "nb_segs");
 static_assert(!(offsetof(struct rte_mbuf, port) -
-	offsetof(struct rte_mbuf, rearm_data) > 6), "port");
+	offsetof(struct rte_mbuf, data_off) > 6), "port");
 static_assert(!(offsetof(struct rte_mbuf, pkt_len) !=
-	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len");
+	offsetof(struct rte_mbuf, packet_type) + 4), "pkt_len");
 static_assert(!(offsetof(struct rte_mbuf, data_len) !=
-	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len");
+	offsetof(struct rte_mbuf, packet_type) + 8), "data_len");
 static_assert(!(offsetof(struct rte_mbuf, vlan_tci) !=
-	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci");
+	offsetof(struct rte_mbuf, packet_type) + 10), "vlan_tci");
 static_assert(!(offsetof(struct rte_mbuf, hash) !=
-	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash");
+	offsetof(struct rte_mbuf, packet_type) + 12), "hash");
 
 /**
  * Function typedef of callback to free externally attached buffer.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 21/23] security: remove rte marker fields
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (19 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 22/23] cryptodev: " Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 23/23] devtools: forbid new use of rte marker typedefs Tyler Retzlaff
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 lib/security/rte_security_driver.h     | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 67750f2..9469b92 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -166,6 +166,9 @@ Removed Items
   through new inline functions ``rte_mbuf_rearm_data()`` and
   ``rte_mbuf_rx_descriptor_fields1()`` respectively.
 
+* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_security_session``.
+
 API Changes
 -----------
 
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index faa4074..18a1e3c 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -12,6 +12,8 @@
  * RTE Security Common Definitions
  */
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,7 +26,6 @@
  * Security session to be used by library for internal usage
  */
 struct rte_security_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Opaque user defined data */
 	uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< session private data IOVA address */
 
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint8_t driver_priv_data[];
 	/**< Private session material, variable size (depends on driver) */
 };
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 22/23] cryptodev: remove rte marker fields
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (20 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 21/23] security: remove " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  2024-02-27  5:41   ` [PATCH v6 23/23] devtools: forbid new use of rte marker typedefs Tyler Retzlaff
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 lib/cryptodev/cryptodev_pmd.h          | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 9469b92..2903f7e 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -169,6 +169,9 @@ Removed Items
 * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_security_session``.
 
+* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct cryptodev_driver``.
+
 API Changes
 -----------
 
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 0732b35..e676ef7 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -5,6 +5,8 @@
 #ifndef _CRYPTODEV_PMD_H_
 #define _CRYPTODEV_PMD_H_
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Can be used for external metadata */
 	uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< Session driver data IOVA address */
 
-	RTE_MARKER cacheline1 __rte_cache_min_aligned;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	/**< Second cache line - start of the driver session data */
 	uint8_t driver_priv_data[];
 	/**< Driver specific session data, variable size */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v6 23/23] devtools: forbid new use of rte marker typedefs
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
                     ` (21 preceding siblings ...)
  2024-02-27  5:41   ` [PATCH v6 22/23] cryptodev: " Tyler Retzlaff
@ 2024-02-27  5:41   ` Tyler Retzlaff
  22 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27  5:41 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Add a check for RTE_MARKER{,8,16,32,64} forbidding new use.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index e379700..ea31ba4 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -61,6 +61,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# refrain from new uses of RTE_MARKER
+	awk -v FOLDERS="lib drivers" \
+		-v EXPRESSIONS="RTE_MARKER(8|16|32|64)?" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using RTE_MARKER' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# no output on stdout or stderr
 	awk -v FOLDERS="lib drivers" \
 		-v EXPRESSIONS="\\\<printf\\\> \\\<fprintf\\\(stdout, \\\<fprintf\\\(stderr," \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields
  2024-02-27  5:41   ` [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields Tyler Retzlaff
@ 2024-02-27  9:10     ` Morten Brørup
  2024-02-27 17:17       ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-02-27  9:10 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Tuesday, 27 February 2024 06.41
> 
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide
> inline functions to access compatible type pointer to rearm_data
> and rx_descriptor_fields1 which will allow direct references on the
> rte marker fields to be removed.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/mbuf/rte_mbuf.h      | 13 +++++++++++++
>  lib/mbuf/rte_mbuf_core.h | 11 ++++++++++-
>  2 files changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> index 286b32b..aa7495b 100644
> --- a/lib/mbuf/rte_mbuf.h
> +++ b/lib/mbuf/rte_mbuf.h
> @@ -132,6 +132,19 @@
>  #endif
>  }
> 
> +static inline
> +uint64_t *
> +rte_mbuf_rearm_data(struct rte_mbuf *m)
> +{
> +	return (uint64_t *)&m->data_off;
> +}

Consider returning (void *) instead of (uint64_t *).
Just a suggestion; I don't know which is better.

> +
> +static inline
> +void *
> +rte_mbuf_rx_descriptor_fields1(struct rte_mbuf *m)
> +{
> +	return &m->packet_type;
> +}

The mbuf_rx_descriptor_fields1 field is disappearing in a later patch;
consider taking the opportunity to use a better name here.

> 
>  static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
> 
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 5688683..7000c04 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -486,7 +486,12 @@ struct rte_mbuf {
>  	struct rte_mbuf *next;
>  #endif
> 
> -	/* next 8 bytes are initialised on RX descriptor rearm */
> +	/**
> +	 * next 8 bytes are initialised on RX descriptor rearm
> +	 *
> +	 * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()

The "rearm_data" field is disappearing in a later patch;
don't refer to it by that name in the comments here.

> +	 * accessor instead of directly referencing through the data_off field.
> +	 */
>  	RTE_MARKER64 rearm_data;
>  	uint16_t data_off;
> 
> @@ -522,6 +527,10 @@ struct rte_mbuf {
>  	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
>  	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
>  	 * vlan is stripped from the data.
> +	 *
> +	 * To obtain a pointer to rx_descriptor_fields1 use the
> +	 * rte_mbuf_rx_descriptor_fields1() accessor instead of directly

The "rx_descriptor_fields1" field is disappearing in a later patch;
don't refer to it by that name in the comments here.
And if you update the access function's name, remember to update it in the comment here too.

> +	 * referencing through the the anonymous union fields.
>  	 */
>  	union {
>  		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27  5:41   ` [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Tyler Retzlaff
@ 2024-02-27  9:15     ` Morten Brørup
  2024-02-27 10:03     ` Konstantin Ananyev
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-02-27  9:15 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> @@ -607,8 +603,7 @@ struct rte_mbuf {
>  	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
> 
>  	/* second cache line - fields only used in slow path or on TX */
> -	RTE_MARKER cacheline1 __rte_cache_min_aligned;
> -
> +	alignas(RTE_CACHE_LINE_MIN_SIZE)

This comment is a matter of taste...

The alignas() is too far away from the field it applies to, and might get overlooked.
I would prefer it immediately before "struct rte_mbuf *next;" and "uint64_t dynfield2;".

>  #if RTE_IOVA_IN_MBUF
>  	/**
>  	 * Next segment of scattered packet. Must be NULL in the last



^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct
  2024-02-27  5:41   ` [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Tyler Retzlaff
@ 2024-02-27 10:02     ` Konstantin Ananyev
  2024-03-14 16:51     ` Tyler Retzlaff
  1 sibling, 0 replies; 171+ messages in thread
From: Konstantin Ananyev @ 2024-02-27 10:02 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Fengchengwen, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, haijie, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Zhuangyuzeng (Yisen),
	Yuying Zhang, mb



> Subject: [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct
> 
> Collect duplicated RTE_BUILD_BUG_ON checks from drivers and place them
> at global scope with struct rte_mbuf definition using static_assert.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/mbuf/rte_mbuf_core.h | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 7000c04..36551c2 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -16,8 +16,11 @@
>   * New fields and flags should fit in the "dynamic space".
>   */
> 
> +#include <assert.h>
> +#include <stddef.h>
>  #include <stdint.h>
> 
> +#include <rte_common.h>
>  #include <rte_byteorder.h>
>  #include <rte_stdatomic.h>
> 
> @@ -673,6 +676,37 @@ struct rte_mbuf {
>  	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
>  } __rte_cache_aligned;
> 
> +static_assert(!(offsetof(struct rte_mbuf, ol_flags) !=
> +	offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags");
> +static_assert(!(offsetof(struct rte_mbuf, rearm_data) !=
> +	RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data");
> +static_assert(!(offsetof(struct rte_mbuf, data_off) !=
> +	offsetof(struct rte_mbuf, rearm_data)), "data_off");
> +static_assert(!(offsetof(struct rte_mbuf, data_off) <
> +	offsetof(struct rte_mbuf, rearm_data)), "data_off");
> +static_assert(!(offsetof(struct rte_mbuf, refcnt) <
> +	offsetof(struct rte_mbuf, rearm_data)), "refcnt");
> +static_assert(!(offsetof(struct rte_mbuf, nb_segs) <
> +	offsetof(struct rte_mbuf, rearm_data)), "nb_segs");
> +static_assert(!(offsetof(struct rte_mbuf, port) <
> +	offsetof(struct rte_mbuf, rearm_data)), "port");
> +static_assert(!(offsetof(struct rte_mbuf, data_off) -
> +	offsetof(struct rte_mbuf, rearm_data) > 6), "data_off");
> +static_assert(!(offsetof(struct rte_mbuf, refcnt) -
> +	offsetof(struct rte_mbuf, rearm_data) > 6), "refcnt");
> +static_assert(!(offsetof(struct rte_mbuf, nb_segs) -
> +	offsetof(struct rte_mbuf, rearm_data) > 6), "nb_segs");
> +static_assert(!(offsetof(struct rte_mbuf, port) -
> +	offsetof(struct rte_mbuf, rearm_data) > 6), "port");
> +static_assert(!(offsetof(struct rte_mbuf, pkt_len) !=
> +	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len");
> +static_assert(!(offsetof(struct rte_mbuf, data_len) !=
> +	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len");
> +static_assert(!(offsetof(struct rte_mbuf, vlan_tci) !=
> +	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci");
> +static_assert(!(offsetof(struct rte_mbuf, hash) !=
> +	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash");
> +
>  /**
>   * Function typedef of callback to free externally attached buffer.
>   */
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
 

> 1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27  5:41   ` [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Tyler Retzlaff
  2024-02-27  9:15     ` Morten Brørup
@ 2024-02-27 10:03     ` Konstantin Ananyev
  2024-02-27 15:18     ` David Marchand
  2024-02-28 14:18     ` David Marchand
  3 siblings, 0 replies; 171+ messages in thread
From: Konstantin Ananyev @ 2024-02-27 10:03 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Fengchengwen, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, haijie, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Zhuangyuzeng (Yisen),
	Yuying Zhang, mb


> Subject: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
> 
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Update implementation of rte_mbuf_prefetch_part1() and
> rte_mbuf_prefetch_part2() inline functions calculate pointer for
> prefetch of cachline0 and cachline1 without using removed markers.
> 
> Update static_assert of rte_mbuf struct fields to reference data_off and
> packet_type fields that occupy the original offsets of the marker
> fields.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  doc/guides/rel_notes/release_24_03.rst |  9 ++++++++
>  lib/mbuf/rte_mbuf.h                    |  4 ++--
>  lib/mbuf/rte_mbuf_core.h               | 39 +++++++++++++---------------------
>  3 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
> index 879bb49..67750f2 100644
> --- a/doc/guides/rel_notes/release_24_03.rst
> +++ b/doc/guides/rel_notes/release_24_03.rst
> @@ -156,6 +156,15 @@ Removed Items
>    The application reserved statically defined logtypes ``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8``
>    are still defined.
> 
> +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` ``cacheline1``
> +  ``rx_descriptor_fields1`` and ``RTE_MARKER64`` field ``rearm_data``
> +  have been removed from ``struct rte_mbuf``.
> +  Prefetch of ``cacheline0`` and ``cacheline1`` may be achieved through
> +  ``rte_mbuf_prefetch_part1()`` and ``rte_mbuf_prefetch_part2()`` inline
> +  functions respectively.
> +  Access to ``rearm_data`` and ``rx_descriptor_fields1`` should be
> +  through new inline functions ``rte_mbuf_rearm_data()`` and
> +  ``rte_mbuf_rx_descriptor_fields1()`` respectively.
> 
>  API Changes
>  -----------
> diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> index aa7495b..61cda20 100644
> --- a/lib/mbuf/rte_mbuf.h
> +++ b/lib/mbuf/rte_mbuf.h
> @@ -108,7 +108,7 @@
>  static inline void
>  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
>  {
> -	rte_prefetch0(&m->cacheline0);
> +	rte_prefetch0(m);
>  }
> 
>  /**
> @@ -126,7 +126,7 @@
>  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
>  {
>  #if RTE_CACHE_LINE_SIZE == 64
> -	rte_prefetch0(&m->cacheline1);
> +	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
>  #else
>  	RTE_SET_USED(m);
>  #endif
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 36551c2..4e06f15 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -18,6 +18,7 @@
> 
>  #include <assert.h>
>  #include <stddef.h>
> +#include <stdalign.h>
>  #include <stdint.h>
> 
>  #include <rte_common.h>
> @@ -467,8 +468,6 @@ enum {
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
>  struct rte_mbuf {
> -	RTE_MARKER cacheline0;
> -
>  	void *buf_addr;           /**< Virtual address of segment buffer. */
>  #if RTE_IOVA_IN_MBUF
>  	/**
> @@ -495,7 +494,6 @@ struct rte_mbuf {
>  	 * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
>  	 * accessor instead of directly referencing through the data_off field.
>  	 */
> -	RTE_MARKER64 rearm_data;
>  	uint16_t data_off;
> 
>  	/**
> @@ -522,8 +520,6 @@ struct rte_mbuf {
>  	uint64_t ol_flags;        /**< Offload features. */
> 
>  	/* remaining bytes are set on RX when pulling packet from descriptor */
> -	RTE_MARKER rx_descriptor_fields1;
> -
>  	/*
>  	 * The packet type, which is the combination of outer/inner L2, L3, L4
>  	 * and tunnel types. The packet_type is about data really present in the
> @@ -607,8 +603,7 @@ struct rte_mbuf {
>  	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
> 
>  	/* second cache line - fields only used in slow path or on TX */
> -	RTE_MARKER cacheline1 __rte_cache_min_aligned;
> -
> +	alignas(RTE_CACHE_LINE_MIN_SIZE)
>  #if RTE_IOVA_IN_MBUF
>  	/**
>  	 * Next segment of scattered packet. Must be NULL in the last
> @@ -677,35 +672,31 @@ struct rte_mbuf {
>  } __rte_cache_aligned;
> 
>  static_assert(!(offsetof(struct rte_mbuf, ol_flags) !=
> -	offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags");
> -static_assert(!(offsetof(struct rte_mbuf, rearm_data) !=
> -	RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data");
> +	offsetof(struct rte_mbuf, data_off) + 8), "ol_flags");
>  static_assert(!(offsetof(struct rte_mbuf, data_off) !=
> -	offsetof(struct rte_mbuf, rearm_data)), "data_off");
> -static_assert(!(offsetof(struct rte_mbuf, data_off) <
> -	offsetof(struct rte_mbuf, rearm_data)), "data_off");
> +	RTE_ALIGN(offsetof(struct rte_mbuf, data_off), 16)), "data_off");
>  static_assert(!(offsetof(struct rte_mbuf, refcnt) <
> -	offsetof(struct rte_mbuf, rearm_data)), "refcnt");
> +	offsetof(struct rte_mbuf, data_off)), "refcnt");
>  static_assert(!(offsetof(struct rte_mbuf, nb_segs) <
> -	offsetof(struct rte_mbuf, rearm_data)), "nb_segs");
> +	offsetof(struct rte_mbuf, data_off)), "nb_segs");
>  static_assert(!(offsetof(struct rte_mbuf, port) <
> -	offsetof(struct rte_mbuf, rearm_data)), "port");
> +	offsetof(struct rte_mbuf, data_off)), "port");
>  static_assert(!(offsetof(struct rte_mbuf, data_off) -
> -	offsetof(struct rte_mbuf, rearm_data) > 6), "data_off");
> +	offsetof(struct rte_mbuf, data_off) > 6), "data_off");
>  static_assert(!(offsetof(struct rte_mbuf, refcnt) -
> -	offsetof(struct rte_mbuf, rearm_data) > 6), "refcnt");
> +	offsetof(struct rte_mbuf, data_off) > 6), "refcnt");
>  static_assert(!(offsetof(struct rte_mbuf, nb_segs) -
> -	offsetof(struct rte_mbuf, rearm_data) > 6), "nb_segs");
> +	offsetof(struct rte_mbuf, data_off) > 6), "nb_segs");
>  static_assert(!(offsetof(struct rte_mbuf, port) -
> -	offsetof(struct rte_mbuf, rearm_data) > 6), "port");
> +	offsetof(struct rte_mbuf, data_off) > 6), "port");
>  static_assert(!(offsetof(struct rte_mbuf, pkt_len) !=
> -	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len");
> +	offsetof(struct rte_mbuf, packet_type) + 4), "pkt_len");
>  static_assert(!(offsetof(struct rte_mbuf, data_len) !=
> -	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len");
> +	offsetof(struct rte_mbuf, packet_type) + 8), "data_len");
>  static_assert(!(offsetof(struct rte_mbuf, vlan_tci) !=
> -	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci");
> +	offsetof(struct rte_mbuf, packet_type) + 10), "vlan_tci");
>  static_assert(!(offsetof(struct rte_mbuf, hash) !=
> -	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash");
> +	offsetof(struct rte_mbuf, packet_type) + 12), "hash");
> 
>  /**
>   * Function typedef of callback to free externally attached buffer.
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
 

> 1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27  5:41   ` [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Tyler Retzlaff
  2024-02-27  9:15     ` Morten Brørup
  2024-02-27 10:03     ` Konstantin Ananyev
@ 2024-02-27 15:18     ` David Marchand
  2024-02-27 16:04       ` Morten Brørup
                         ` (2 more replies)
  2024-02-28 14:18     ` David Marchand
  3 siblings, 3 replies; 171+ messages in thread
From: David Marchand @ 2024-02-27 15:18 UTC (permalink / raw)
  To: Dodji Seketeli
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb,
	Tyler Retzlaff

Hello Dodji,

On Tue, Feb 27, 2024 at 6:44 AM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
>
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
>
> Update implementation of rte_mbuf_prefetch_part1() and
> rte_mbuf_prefetch_part2() inline functions calculate pointer for
> prefetch of cachline0 and cachline1 without using removed markers.
>
> Update static_assert of rte_mbuf struct fields to reference data_off and
> packet_type fields that occupy the original offsets of the marker
> fields.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

This change is reported as a potential ABI change.

For the context, this patch
https://patchwork.dpdk.org/project/dpdk/patch/1709012499-12813-21-git-send-email-roretzla@linux.microsoft.com/
removes null-sized markers (those fields were using RTE_MARKER, see
https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from
the rte_mbuf struct.
I would argue this change do not impact ABI as the layout of the mbuf
object is not impacted.

As reported by the CI:

  [C] 'function const rte_eth_rxtx_callback*
rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn,
void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
    parameter 3 of type 'typedef rte_rx_callback_fn' has sub-type changes:
      underlying type 'typedef uint16_t (typedef uint16_t, typedef
uint16_t, rte_mbuf**, typedef uint16_t, typedef uint16_t, void*)*'
changed:
        in pointed to type 'function type typedef uint16_t (typedef
uint16_t, typedef uint16_t, rte_mbuf**, typedef uint16_t, typedef
uint16_t, void*)':
          parameter 3 of type 'rte_mbuf**' has sub-type changes:
            in pointed to type 'rte_mbuf*':
              in pointed to type 'struct rte_mbuf' at rte_mbuf_core.h:470:1:
                type size hasn't changed
                4 data member deletions:
                  'RTE_MARKER cacheline0', at offset 0 (in bits) at
rte_mbuf_core.h:467:1
                  'RTE_MARKER64 rearm_data', at offset 128 (in bits)
at rte_mbuf_core.h:490:1
                  'RTE_MARKER rx_descriptor_fields1', at offset 256
(in bits) at rte_mbuf_core.h:517:1
                  'RTE_MARKER cacheline1', at offset 512 (in bits) at
rte_mbuf_core.h:598:1
                no data member change (1 filtered);

Error: ABI issue reported for abidiff --suppr
/home/runner/work/dpdk/dpdk/devtools/libabigail.abignore
--no-added-syms --headers-dir1 reference/usr/local/include
--headers-dir2 install/usr/local/include
reference/usr/local/lib/librte_ethdev.so.24.0
install/usr/local/lib/librte_ethdev.so.24.1
ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged
this as a potential issue).

Opinions?

Btw, I see no way to suppress this (except a global [suppress_type]
name = rte_mbuf)...


-- 
David Marchand


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27 15:18     ` David Marchand
@ 2024-02-27 16:04       ` Morten Brørup
  2024-02-27 17:23       ` Tyler Retzlaff
  2024-02-28 14:03       ` Dodji Seketeli
  2 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-02-27 16:04 UTC (permalink / raw)
  To: David Marchand, Dodji Seketeli
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, Tyler Retzlaff

> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Tuesday, 27 February 2024 16.18
> 
> Hello Dodji,
> 
> On Tue, Feb 27, 2024 at 6:44 AM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > RTE_MARKER fields from rte_mbuf struct.
> >
> > Maintain alignment of fields after removed cacheline1 marker by
> placing
> > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> >
> > Update implementation of rte_mbuf_prefetch_part1() and
> > rte_mbuf_prefetch_part2() inline functions calculate pointer for
> > prefetch of cachline0 and cachline1 without using removed markers.
> >
> > Update static_assert of rte_mbuf struct fields to reference data_off
> and
> > packet_type fields that occupy the original offsets of the marker
> > fields.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> This change is reported as a potential ABI change.
> 
> For the context, this patch
> https://patchwork.dpdk.org/project/dpdk/patch/1709012499-12813-21-git-
> send-email-roretzla@linux.microsoft.com/
> removes null-sized markers (those fields were using RTE_MARKER, see
> https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from
> the rte_mbuf struct.
> I would argue this change do not impact ABI as the layout of the mbuf
> object is not impacted.
> 
> As reported by the CI:
> 
>   [C] 'function const rte_eth_rxtx_callback*
> rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn,
> void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
>     parameter 3 of type 'typedef rte_rx_callback_fn' has sub-type
> changes:
>       underlying type 'typedef uint16_t (typedef uint16_t, typedef
> uint16_t, rte_mbuf**, typedef uint16_t, typedef uint16_t, void*)*'
> changed:
>         in pointed to type 'function type typedef uint16_t (typedef
> uint16_t, typedef uint16_t, rte_mbuf**, typedef uint16_t, typedef
> uint16_t, void*)':
>           parameter 3 of type 'rte_mbuf**' has sub-type changes:
>             in pointed to type 'rte_mbuf*':
>               in pointed to type 'struct rte_mbuf' at
> rte_mbuf_core.h:470:1:
>                 type size hasn't changed
>                 4 data member deletions:
>                   'RTE_MARKER cacheline0', at offset 0 (in bits) at
> rte_mbuf_core.h:467:1
>                   'RTE_MARKER64 rearm_data', at offset 128 (in bits)
> at rte_mbuf_core.h:490:1
>                   'RTE_MARKER rx_descriptor_fields1', at offset 256
> (in bits) at rte_mbuf_core.h:517:1
>                   'RTE_MARKER cacheline1', at offset 512 (in bits) at
> rte_mbuf_core.h:598:1
>                 no data member change (1 filtered);
> 
> Error: ABI issue reported for abidiff --suppr
> /home/runner/work/dpdk/dpdk/devtools/libabigail.abignore
> --no-added-syms --headers-dir1 reference/usr/local/include
> --headers-dir2 install/usr/local/include
> reference/usr/local/lib/librte_ethdev.so.24.0
> install/usr/local/lib/librte_ethdev.so.24.1
> ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged
> this as a potential issue).
> 
> Opinions?

Agree: Not an ABI change, only API change.

> 
> Btw, I see no way to suppress this (except a global [suppress_type]
> name = rte_mbuf)...
> 
> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields
  2024-02-27  9:10     ` Morten Brørup
@ 2024-02-27 17:17       ` Tyler Retzlaff
  2024-02-28  8:28         ` Morten Brørup
  0 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27 17:17 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang

On Tue, Feb 27, 2024 at 10:10:03AM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Tuesday, 27 February 2024 06.41
> > 
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide
> > inline functions to access compatible type pointer to rearm_data
> > and rx_descriptor_fields1 which will allow direct references on the
> > rte marker fields to be removed.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  lib/mbuf/rte_mbuf.h      | 13 +++++++++++++
> >  lib/mbuf/rte_mbuf_core.h | 11 ++++++++++-
> >  2 files changed, 23 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > index 286b32b..aa7495b 100644
> > --- a/lib/mbuf/rte_mbuf.h
> > +++ b/lib/mbuf/rte_mbuf.h
> > @@ -132,6 +132,19 @@
> >  #endif
> >  }
> > 
> > +static inline
> > +uint64_t *
> > +rte_mbuf_rearm_data(struct rte_mbuf *m)
> > +{
> > +	return (uint64_t *)&m->data_off;
> > +}
> 
> Consider returning (void *) instead of (uint64_t *).
> Just a suggestion; I don't know which is better.

if you mean just the cast i don't think it matters. arguably it could go
void * first but we're already aliasing through a different type. this
is one argument in favor of the union.

> 
> > +
> > +static inline
> > +void *
> > +rte_mbuf_rx_descriptor_fields1(struct rte_mbuf *m)
> > +{
> > +	return &m->packet_type;
> > +}
> 
> The mbuf_rx_descriptor_fields1 field is disappearing in a later patch;
> consider taking the opportunity to use a better name here.

oh boy. you're asking for a new name but not suggesting a new name.
naming is hard (no one is ever happy). for this and rearm_data if you
or anyone suggests a name i'll make the change ~everywhere including
comments across all drivers.

> 
> > 
> >  static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
> > 
> > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > index 5688683..7000c04 100644
> > --- a/lib/mbuf/rte_mbuf_core.h
> > +++ b/lib/mbuf/rte_mbuf_core.h
> > @@ -486,7 +486,12 @@ struct rte_mbuf {
> >  	struct rte_mbuf *next;
> >  #endif
> > 
> > -	/* next 8 bytes are initialised on RX descriptor rearm */
> > +	/**
> > +	 * next 8 bytes are initialised on RX descriptor rearm
> > +	 *
> > +	 * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
> 
> The "rearm_data" field is disappearing in a later patch;
> don't refer to it by that name in the comments here.

without having renamed the block of fields cheerfully known as
"rearm_data" i kept all documentation/comments here and in drivers
using rearm_data for familiarity. (unless someone suggests a new name for the group
of fields).

> 
> > +	 * accessor instead of directly referencing through the data_off field.
> > +	 */
> >  	RTE_MARKER64 rearm_data;
> >  	uint16_t data_off;
> > 
> > @@ -522,6 +527,10 @@ struct rte_mbuf {
> >  	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
> >  	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> >  	 * vlan is stripped from the data.
> > +	 *
> > +	 * To obtain a pointer to rx_descriptor_fields1 use the
> > +	 * rte_mbuf_rx_descriptor_fields1() accessor instead of directly
> 
> The "rx_descriptor_fields1" field is disappearing in a later patch;
> don't refer to it by that name in the comments here.
> And if you update the access function's name, remember to update it in the comment here too.

same as above.

> 
> > +	 * referencing through the the anonymous union fields.
> >  	 */
> >  	union {
> >  		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
> > --
> > 1.8.3.1

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27 15:18     ` David Marchand
  2024-02-27 16:04       ` Morten Brørup
@ 2024-02-27 17:23       ` Tyler Retzlaff
  2024-02-28 10:42         ` David Marchand
  2024-02-28 14:03       ` Dodji Seketeli
  2 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-27 17:23 UTC (permalink / raw)
  To: David Marchand
  Cc: Dodji Seketeli, dev, Ajit Khaparde, Andrew Boyer,
	Andrew Rybchenko, Bruce Richardson, Chenbo Xia, Chengwen Feng,
	Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Tue, Feb 27, 2024 at 04:18:10PM +0100, David Marchand wrote:
> Hello Dodji,
> 
> On Tue, Feb 27, 2024 at 6:44 AM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > RTE_MARKER fields from rte_mbuf struct.
> >
> > Maintain alignment of fields after removed cacheline1 marker by placing
> > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> >
> > Update implementation of rte_mbuf_prefetch_part1() and
> > rte_mbuf_prefetch_part2() inline functions calculate pointer for
> > prefetch of cachline0 and cachline1 without using removed markers.
> >
> > Update static_assert of rte_mbuf struct fields to reference data_off and
> > packet_type fields that occupy the original offsets of the marker
> > fields.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> This change is reported as a potential ABI change.
> 
> For the context, this patch
> https://patchwork.dpdk.org/project/dpdk/patch/1709012499-12813-21-git-send-email-roretzla@linux.microsoft.com/
> removes null-sized markers (those fields were using RTE_MARKER, see
> https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from
> the rte_mbuf struct.
> I would argue this change do not impact ABI as the layout of the mbuf
> object is not impacted.

It isn't a surprise that the change got flagged because the 0 sized
fields being removed probably not something the checker understands.
So no ABI change just API break (as was requested).

> As reported by the CI:
> 
>   [C] 'function const rte_eth_rxtx_callback*
> rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn,
> void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
>     parameter 3 of type 'typedef rte_rx_callback_fn' has sub-type changes:
>       underlying type 'typedef uint16_t (typedef uint16_t, typedef
> uint16_t, rte_mbuf**, typedef uint16_t, typedef uint16_t, void*)*'
> changed:
>         in pointed to type 'function type typedef uint16_t (typedef
> uint16_t, typedef uint16_t, rte_mbuf**, typedef uint16_t, typedef
> uint16_t, void*)':
>           parameter 3 of type 'rte_mbuf**' has sub-type changes:
>             in pointed to type 'rte_mbuf*':
>               in pointed to type 'struct rte_mbuf' at rte_mbuf_core.h:470:1:
>                 type size hasn't changed
>                 4 data member deletions:
>                   'RTE_MARKER cacheline0', at offset 0 (in bits) at
> rte_mbuf_core.h:467:1
>                   'RTE_MARKER64 rearm_data', at offset 128 (in bits)
> at rte_mbuf_core.h:490:1
>                   'RTE_MARKER rx_descriptor_fields1', at offset 256
> (in bits) at rte_mbuf_core.h:517:1
>                   'RTE_MARKER cacheline1', at offset 512 (in bits) at
> rte_mbuf_core.h:598:1
>                 no data member change (1 filtered);
> 
> Error: ABI issue reported for abidiff --suppr
> /home/runner/work/dpdk/dpdk/devtools/libabigail.abignore
> --no-added-syms --headers-dir1 reference/usr/local/include
> --headers-dir2 install/usr/local/include
> reference/usr/local/lib/librte_ethdev.so.24.0
> install/usr/local/lib/librte_ethdev.so.24.1
> ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged
> this as a potential issue).
> 
> Opinions?
> 
> Btw, I see no way to suppress this (except a global [suppress_type]
> name = rte_mbuf)...

I am unfamiliar with the ABI checker I'm afraid i have no suggestion to
offer. Maybe we can just ignore the failure for this one series when we
decide it is ready to be merged and don't suppress the checker?

> 
> 
> -- 
> David Marchand

^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields
  2024-02-27 17:17       ` Tyler Retzlaff
@ 2024-02-28  8:28         ` Morten Brørup
  2024-02-28 16:20           ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-02-28  8:28 UTC (permalink / raw)
  To: Tyler Retzlaff, thomas
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang

+To: Thomas, previously joined the discussion

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Tuesday, 27 February 2024 18.17
> 
> On Tue, Feb 27, 2024 at 10:10:03AM +0100, Morten Brørup wrote:
> > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > Sent: Tuesday, 27 February 2024 06.41
> > >
> > > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide
> > > inline functions to access compatible type pointer to rearm_data
> > > and rx_descriptor_fields1 which will allow direct references on the
> > > rte marker fields to be removed.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > >  lib/mbuf/rte_mbuf.h      | 13 +++++++++++++
> > >  lib/mbuf/rte_mbuf_core.h | 11 ++++++++++-
> > >  2 files changed, 23 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > > index 286b32b..aa7495b 100644
> > > --- a/lib/mbuf/rte_mbuf.h
> > > +++ b/lib/mbuf/rte_mbuf.h
> > > @@ -132,6 +132,19 @@
> > >  #endif
> > >  }
> > >
> > > +static inline
> > > +uint64_t *
> > > +rte_mbuf_rearm_data(struct rte_mbuf *m)
> > > +{
> > > +	return (uint64_t *)&m->data_off;
> > > +}
> >
> > Consider returning (void *) instead of (uint64_t *).
> > Just a suggestion; I don't know which is better.
> 
> if you mean just the cast i don't think it matters.

No, I meant the return type.
The type is opaque; only its size is fixed at 8 byte.
Maybe uint64_t * is the best type, after all.

> arguably it could go
> void * first but we're already aliasing through a different type. this
> is one argument in favor of the union.

The zero-size markers (rearm_data and rx_descriptor_fields1) were intended to be used like unions, which the drivers effectively do.
Previous C standards didn't allow anonymous structures, so using union+struct in pre-C11 DPDK would clutter the code with subfield names. But now that we moved on to C11, we don't have this problem anymore.

IMHO, replacing the zero-size markers - which are directly visible in the structure's source code - with access functions located in some other header file degrades source code readability.

I am in favor of union+struct in the mbuf structure over access functions. I think the explicit grouping of the fields improves the readability of the mbuf structure, also compared to the zero-size markers.

> 
> >
> > > +
> > > +static inline
> > > +void *
> > > +rte_mbuf_rx_descriptor_fields1(struct rte_mbuf *m)
> > > +{
> > > +	return &m->packet_type;
> > > +}
> >
> > The mbuf_rx_descriptor_fields1 field is disappearing in a later patch;
> > consider taking the opportunity to use a better name here.
> 
> oh boy. you're asking for a new name but not suggesting a new name.
> naming is hard (no one is ever happy). for this and rearm_data if you
> or anyone suggests a name i'll make the change ~everywhere including
> comments across all drivers.

As you mention below, keeping the current names is an advantage for familiarity.
Changing the name brings no real benefit, and although the current name is somewhat silly (perhaps anticipating a second group of rx descriptor fields), we should probably just keep it.

> 
> >
> > >
> > >  static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
> > >
> > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > > index 5688683..7000c04 100644
> > > --- a/lib/mbuf/rte_mbuf_core.h
> > > +++ b/lib/mbuf/rte_mbuf_core.h
> > > @@ -486,7 +486,12 @@ struct rte_mbuf {
> > >  	struct rte_mbuf *next;
> > >  #endif
> > >
> > > -	/* next 8 bytes are initialised on RX descriptor rearm */
> > > +	/**
> > > +	 * next 8 bytes are initialised on RX descriptor rearm
> > > +	 *
> > > +	 * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
> >
> > The "rearm_data" field is disappearing in a later patch;
> > don't refer to it by that name in the comments here.
> 
> without having renamed the block of fields cheerfully known as
> "rearm_data" i kept all documentation/comments here and in drivers
> using rearm_data for familiarity. (unless someone suggests a new name for the
> group
> of fields).

OK, you already thought about the use of the names in the documentation. I don't object to your conclusion.

> 
> >
> > > +	 * accessor instead of directly referencing through the data_off field.
> > > +	 */
> > >  	RTE_MARKER64 rearm_data;
> > >  	uint16_t data_off;
> > >
> > > @@ -522,6 +527,10 @@ struct rte_mbuf {
> > >  	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
> > >  	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> > >  	 * vlan is stripped from the data.
> > > +	 *
> > > +	 * To obtain a pointer to rx_descriptor_fields1 use the
> > > +	 * rte_mbuf_rx_descriptor_fields1() accessor instead of directly
> >
> > The "rx_descriptor_fields1" field is disappearing in a later patch;
> > don't refer to it by that name in the comments here.
> > And if you update the access function's name, remember to update it in the
> comment here too.
> 
> same as above.
> 
> >
> > > +	 * referencing through the the anonymous union fields.
> > >  	 */
> > >  	union {
> > >  		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
> > > --
> > > 1.8.3.1

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27 17:23       ` Tyler Retzlaff
@ 2024-02-28 10:42         ` David Marchand
  0 siblings, 0 replies; 171+ messages in thread
From: David Marchand @ 2024-02-28 10:42 UTC (permalink / raw)
  To: Tyler Retzlaff, Thomas Monjalon
  Cc: Dodji Seketeli, dev, Ajit Khaparde, Andrew Boyer,
	Andrew Rybchenko, Bruce Richardson, Chenbo Xia, Chengwen Feng,
	Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb, ci

On Tue, Feb 27, 2024 at 6:23 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> On Tue, Feb 27, 2024 at 04:18:10PM +0100, David Marchand wrote:
> > Hello Dodji,
> >
> > On Tue, Feb 27, 2024 at 6:44 AM Tyler Retzlaff
> > <roretzla@linux.microsoft.com> wrote:
> > >
> > > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > > RTE_MARKER fields from rte_mbuf struct.
> > >
> > > Maintain alignment of fields after removed cacheline1 marker by placing
> > > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> > >
> > > Update implementation of rte_mbuf_prefetch_part1() and
> > > rte_mbuf_prefetch_part2() inline functions calculate pointer for
> > > prefetch of cachline0 and cachline1 without using removed markers.
> > >
> > > Update static_assert of rte_mbuf struct fields to reference data_off and
> > > packet_type fields that occupy the original offsets of the marker
> > > fields.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> >
> > This change is reported as a potential ABI change.
> >
> > For the context, this patch
> > https://patchwork.dpdk.org/project/dpdk/patch/1709012499-12813-21-git-send-email-roretzla@linux.microsoft.com/
> > removes null-sized markers (those fields were using RTE_MARKER, see
> > https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from
> > the rte_mbuf struct.
> > I would argue this change do not impact ABI as the layout of the mbuf
> > object is not impacted.
>
> It isn't a surprise that the change got flagged because the 0 sized
> fields being removed probably not something the checker understands.
> So no ABI change just API break (as was requested).
>
> > As reported by the CI:
> >
> >   [C] 'function const rte_eth_rxtx_callback*
> > rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn,
> > void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
> >     parameter 3 of type 'typedef rte_rx_callback_fn' has sub-type changes:
> >       underlying type 'typedef uint16_t (typedef uint16_t, typedef
> > uint16_t, rte_mbuf**, typedef uint16_t, typedef uint16_t, void*)*'
> > changed:
> >         in pointed to type 'function type typedef uint16_t (typedef
> > uint16_t, typedef uint16_t, rte_mbuf**, typedef uint16_t, typedef
> > uint16_t, void*)':
> >           parameter 3 of type 'rte_mbuf**' has sub-type changes:
> >             in pointed to type 'rte_mbuf*':
> >               in pointed to type 'struct rte_mbuf' at rte_mbuf_core.h:470:1:
> >                 type size hasn't changed
> >                 4 data member deletions:
> >                   'RTE_MARKER cacheline0', at offset 0 (in bits) at
> > rte_mbuf_core.h:467:1
> >                   'RTE_MARKER64 rearm_data', at offset 128 (in bits)
> > at rte_mbuf_core.h:490:1
> >                   'RTE_MARKER rx_descriptor_fields1', at offset 256
> > (in bits) at rte_mbuf_core.h:517:1
> >                   'RTE_MARKER cacheline1', at offset 512 (in bits) at
> > rte_mbuf_core.h:598:1
> >                 no data member change (1 filtered);
> >
> > Error: ABI issue reported for abidiff --suppr
> > /home/runner/work/dpdk/dpdk/devtools/libabigail.abignore
> > --no-added-syms --headers-dir1 reference/usr/local/include
> > --headers-dir2 install/usr/local/include
> > reference/usr/local/lib/librte_ethdev.so.24.0
> > install/usr/local/lib/librte_ethdev.so.24.1
> > ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged
> > this as a potential issue).
> >
> > Opinions?
> >
> > Btw, I see no way to suppress this (except a global [suppress_type]
> > name = rte_mbuf)...
>
> I am unfamiliar with the ABI checker I'm afraid i have no suggestion to
> offer. Maybe we can just ignore the failure for this one series when we
> decide it is ready to be merged and don't suppress the checker?

The ABI check compares a current build with a (cached) reference build.
There is no "let's ignore this specific error" mechanism at the moment.
And I suspect it would be non-trivial to add (parsing abidiff text
output... brrr).

Changing the check so that it compares against origin/main (for
example) every time is doable *on paper*, but it would consume a lot
of cpu for maintainers (like Thomas, Ferruh or me) and the CI.
CI scripts would have to be updated too.


Fow now, one thing we can do is to change the reference to point at
the exact commit that introduces a change we know safe.
This requires a little sync between people (maintainers / users of
test-meson-builds.h) and UNH CI, but this is doable.

On the other hand, by the time we merge this series, libabigail may
have fixed this for us already? ;-)


-- 
David Marchand


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27 15:18     ` David Marchand
  2024-02-27 16:04       ` Morten Brørup
  2024-02-27 17:23       ` Tyler Retzlaff
@ 2024-02-28 14:03       ` Dodji Seketeli
  2024-02-28 14:43         ` David Marchand
  2 siblings, 1 reply; 171+ messages in thread
From: Dodji Seketeli @ 2024-02-28 14:03 UTC (permalink / raw)
  To: David Marchand
  Cc: Dodji Seketeli, dev, Ajit Khaparde, Andrew Boyer,
	Andrew Rybchenko, Bruce Richardson, Chenbo Xia, Chengwen Feng,
	Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb,
	Tyler Retzlaff

Hello,

David Marchand <david.marchand@redhat.com> writes:

> Hello Dodji,

o/

[...]


> This change is reported as a potential ABI change.
>
> For the context, this patch
> https://patchwork.dpdk.org/project/dpdk/patch/1709012499-12813-21-git-send-email-roretzla@linux.microsoft.com/
> removes null-sized markers (those fields were using RTE_MARKER, see
> https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from
> the rte_mbuf struct.

Thank you for the context.

[...]


> As reported by the CI:

[...]

>   [C] 'function const rte_eth_rxtx_callback*
> rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn,
> void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
>     parameter 3 of type 'typedef rte_rx_callback_fn' has sub-type changes:

[...]

>               in pointed to type 'struct rte_mbuf' at rte_mbuf_core.h:470:1:
>                 type size hasn't changed
>                 4 data member deletions:
>                   'RTE_MARKER cacheline0', at offset 0 (in bits) at
> rte_mbuf_core.h:467:1
>                   'RTE_MARKER64 rearm_data', at offset 128 (in bits)
> at rte_mbuf_core.h:490:1
>                   'RTE_MARKER rx_descriptor_fields1', at offset 256
> (in bits) at rte_mbuf_core.h:517:1
>                   'RTE_MARKER cacheline1', at offset 512 (in bits) at
> rte_mbuf_core.h:598:1
>                 no data member change (1 filtered);

[...]

> I would argue this change do not impact ABI as the layout of the mbuf
> object is not impacted.

I agree that on the /particular platform/ that the checker runs on,
there is no incompatible ABI change because no data member offset from
the 'struct rte_mbuf' type got modified and the size of the type hasn't
changed either.


>
> Error: ABI issue reported for abidiff --suppr
> /home/runner/work/dpdk/dpdk/devtools/libabigail.abignore
> --no-added-syms --headers-dir1 reference/usr/local/include
> --headers-dir2 install/usr/local/include
> reference/usr/local/lib/librte_ethdev.so.24.0
> install/usr/local/lib/librte_ethdev.so.24.1
> ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged
> this as a potential issue).
>
> Opinions?
>
> Btw, I see no way to suppress this (except a global [suppress_type]
> name = rte_mbuf)...

Right.

To avoid having subsequent changes to that type from being "overly"
suppressed, maybe do something like:

    [suppress_type]
     name = rte_mbuf
     has_size_change = no
     has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}

That way, only size-impacting changes to struct rte_mbuf in its form
that predates this patch would be suppressed, hopefully.

[...]

Cheers,

-- 
		Dodji


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-27  5:41   ` [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Tyler Retzlaff
                       ` (2 preceding siblings ...)
  2024-02-27 15:18     ` David Marchand
@ 2024-02-28 14:18     ` David Marchand
  2024-02-28 15:01       ` Morten Brørup
  2024-02-28 17:20       ` Tyler Retzlaff
  3 siblings, 2 replies; 171+ messages in thread
From: David Marchand @ 2024-02-28 14:18 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb,
	Thomas Monjalon

On Tue, Feb 27, 2024 at 6:44 AM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
>
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
>
> Update implementation of rte_mbuf_prefetch_part1() and
> rte_mbuf_prefetch_part2() inline functions calculate pointer for
> prefetch of cachline0 and cachline1 without using removed markers.
>
> Update static_assert of rte_mbuf struct fields to reference data_off and
> packet_type fields that occupy the original offsets of the marker
> fields.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  doc/guides/rel_notes/release_24_03.rst |  9 ++++++++
>  lib/mbuf/rte_mbuf.h                    |  4 ++--
>  lib/mbuf/rte_mbuf_core.h               | 39 +++++++++++++---------------------
>  3 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
> index 879bb49..67750f2 100644
> --- a/doc/guides/rel_notes/release_24_03.rst
> +++ b/doc/guides/rel_notes/release_24_03.rst
> @@ -156,6 +156,15 @@ Removed Items
>    The application reserved statically defined logtypes ``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8``
>    are still defined.
>
> +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` ``cacheline1``
> +  ``rx_descriptor_fields1`` and ``RTE_MARKER64`` field ``rearm_data``
> +  have been removed from ``struct rte_mbuf``.
> +  Prefetch of ``cacheline0`` and ``cacheline1`` may be achieved through
> +  ``rte_mbuf_prefetch_part1()`` and ``rte_mbuf_prefetch_part2()`` inline
> +  functions respectively.
> +  Access to ``rearm_data`` and ``rx_descriptor_fields1`` should be
> +  through new inline functions ``rte_mbuf_rearm_data()`` and
> +  ``rte_mbuf_rx_descriptor_fields1()`` respectively.
>
>  API Changes
>  -----------
> diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> index aa7495b..61cda20 100644
> --- a/lib/mbuf/rte_mbuf.h
> +++ b/lib/mbuf/rte_mbuf.h
> @@ -108,7 +108,7 @@
>  static inline void
>  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
>  {
> -       rte_prefetch0(&m->cacheline0);
> +       rte_prefetch0(m);
>  }
>
>  /**
> @@ -126,7 +126,7 @@
>  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
>  {
>  #if RTE_CACHE_LINE_SIZE == 64
> -       rte_prefetch0(&m->cacheline1);
> +       rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
>  #else
>         RTE_SET_USED(m);
>  #endif
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 36551c2..4e06f15 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -18,6 +18,7 @@
>
>  #include <assert.h>
>  #include <stddef.h>
> +#include <stdalign.h>
>  #include <stdint.h>
>
>  #include <rte_common.h>
> @@ -467,8 +468,6 @@ enum {
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
>  struct rte_mbuf {
> -       RTE_MARKER cacheline0;
> -
>         void *buf_addr;           /**< Virtual address of segment buffer. */
>  #if RTE_IOVA_IN_MBUF
>         /**
> @@ -495,7 +494,6 @@ struct rte_mbuf {
>          * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
>          * accessor instead of directly referencing through the data_off field.
>          */
> -       RTE_MARKER64 rearm_data;
>         uint16_t data_off;

One subtile change of removing the marker is that fields may not be
aligned as before.

#if RTE_IOVA_IN_MBUF
        /**
         * Physical address of segment buffer.
         * This field is undefined if the build is configured to use only
         * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
         * Force alignment to 8-bytes, so as to ensure we have the exact
         * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
         * working on vector drivers easier.
         */
        rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
#else
        /**
         * Next segment of scattered packet.
         * This field is valid when physical address field is undefined.
         * Otherwise next pointer in the second cache line will be used.
         */
        struct rte_mbuf *next;
#endif

When building ! RTE_IOVA_IN_MBUF on a 32 bits arch, the next pointer
is not force aligned to 64bits.
Which has a cascade effect on data_off alignement.

In file included from ../lib/mbuf/rte_mbuf_core.h:19,
                 from ../lib/mbuf/rte_mbuf.h:42,
                 from ../lib/mbuf/rte_mbuf_dyn.c:18:
../lib/mbuf/rte_mbuf_core.h:676:1: error: static assertion failed: "data_off"
  676 | static_assert(!(offsetof(struct rte_mbuf, data_off) !=
      | ^~~~~~~~~~~~~


I hope reviewers pay attention to the alignment changes when removing
those markers.
This is not trivial to catch in the CI.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-28 14:03       ` Dodji Seketeli
@ 2024-02-28 14:43         ` David Marchand
  2024-02-29 14:50           ` Dodji Seketeli
  0 siblings, 1 reply; 171+ messages in thread
From: David Marchand @ 2024-02-28 14:43 UTC (permalink / raw)
  To: Dodji Seketeli
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb,
	Tyler Retzlaff, Thomas Monjalon

On Wed, Feb 28, 2024 at 3:04 PM Dodji Seketeli <dodji@redhat.com> wrote:
> > Btw, I see no way to suppress this (except a global [suppress_type]
> > name = rte_mbuf)...
>
> Right.
>
> To avoid having subsequent changes to that type from being "overly"
> suppressed, maybe do something like:
>
>     [suppress_type]
>      name = rte_mbuf
>      has_size_change = no
>      has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
>
> That way, only size-impacting changes to struct rte_mbuf in its form
> that predates this patch would be suppressed, hopefully.

Do you mean, only changes *not* size-impacting would be suppressed?

This is slightly better than the suppression on the whole rte_mbuf
object, but it won't catch field reordering iiuc.

On the other hand, now that I try reordering fields (to test this
suggestion of yours), I get build failures all over the DPDK tree
because we have many build checks to ensure those fields are at known
locations...
So maybe we can relax and just go with the full suppression.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-28 14:18     ` David Marchand
@ 2024-02-28 15:01       ` Morten Brørup
  2024-02-28 15:33         ` David Marchand
  2024-02-28 17:20       ` Tyler Retzlaff
  1 sibling, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-02-28 15:01 UTC (permalink / raw)
  To: David Marchand, Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang,
	Thomas Monjalon

> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Wednesday, 28 February 2024 15.19
> 
> On Tue, Feb 27, 2024 at 6:44 AM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > RTE_MARKER fields from rte_mbuf struct.
> >
> > Maintain alignment of fields after removed cacheline1 marker by placing
> > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> >
> > Update implementation of rte_mbuf_prefetch_part1() and
> > rte_mbuf_prefetch_part2() inline functions calculate pointer for
> > prefetch of cachline0 and cachline1 without using removed markers.
> >
> > Update static_assert of rte_mbuf struct fields to reference data_off and
> > packet_type fields that occupy the original offsets of the marker
> > fields.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  doc/guides/rel_notes/release_24_03.rst |  9 ++++++++
> >  lib/mbuf/rte_mbuf.h                    |  4 ++--
> >  lib/mbuf/rte_mbuf_core.h               | 39 +++++++++++++------------------
> ---
> >  3 files changed, 26 insertions(+), 26 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/release_24_03.rst
> b/doc/guides/rel_notes/release_24_03.rst
> > index 879bb49..67750f2 100644
> > --- a/doc/guides/rel_notes/release_24_03.rst
> > +++ b/doc/guides/rel_notes/release_24_03.rst
> > @@ -156,6 +156,15 @@ Removed Items
> >    The application reserved statically defined logtypes
> ``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8``
> >    are still defined.
> >
> > +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` ``cacheline1``
> > +  ``rx_descriptor_fields1`` and ``RTE_MARKER64`` field ``rearm_data``
> > +  have been removed from ``struct rte_mbuf``.
> > +  Prefetch of ``cacheline0`` and ``cacheline1`` may be achieved through
> > +  ``rte_mbuf_prefetch_part1()`` and ``rte_mbuf_prefetch_part2()`` inline
> > +  functions respectively.
> > +  Access to ``rearm_data`` and ``rx_descriptor_fields1`` should be
> > +  through new inline functions ``rte_mbuf_rearm_data()`` and
> > +  ``rte_mbuf_rx_descriptor_fields1()`` respectively.
> >
> >  API Changes
> >  -----------
> > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > index aa7495b..61cda20 100644
> > --- a/lib/mbuf/rte_mbuf.h
> > +++ b/lib/mbuf/rte_mbuf.h
> > @@ -108,7 +108,7 @@
> >  static inline void
> >  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
> >  {
> > -       rte_prefetch0(&m->cacheline0);
> > +       rte_prefetch0(m);
> >  }
> >
> >  /**
> > @@ -126,7 +126,7 @@
> >  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
> >  {
> >  #if RTE_CACHE_LINE_SIZE == 64
> > -       rte_prefetch0(&m->cacheline1);
> > +       rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
> >  #else
> >         RTE_SET_USED(m);
> >  #endif
> > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > index 36551c2..4e06f15 100644
> > --- a/lib/mbuf/rte_mbuf_core.h
> > +++ b/lib/mbuf/rte_mbuf_core.h
> > @@ -18,6 +18,7 @@
> >
> >  #include <assert.h>
> >  #include <stddef.h>
> > +#include <stdalign.h>
> >  #include <stdint.h>
> >
> >  #include <rte_common.h>
> > @@ -467,8 +468,6 @@ enum {
> >   * The generic rte_mbuf, containing a packet mbuf.
> >   */
> >  struct rte_mbuf {
> > -       RTE_MARKER cacheline0;
> > -
> >         void *buf_addr;           /**< Virtual address of segment buffer. */
> >  #if RTE_IOVA_IN_MBUF
> >         /**
> > @@ -495,7 +494,6 @@ struct rte_mbuf {
> >          * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
> >          * accessor instead of directly referencing through the data_off
> field.
> >          */
> > -       RTE_MARKER64 rearm_data;
> >         uint16_t data_off;
> 
> One subtile change of removing the marker is that fields may not be
> aligned as before.
> 
> #if RTE_IOVA_IN_MBUF
>         /**
>          * Physical address of segment buffer.
>          * This field is undefined if the build is configured to use only
>          * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
>          * Force alignment to 8-bytes, so as to ensure we have the exact
>          * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
>          * working on vector drivers easier.
>          */
>         rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
> #else
>         /**
>          * Next segment of scattered packet.
>          * This field is valid when physical address field is undefined.
>          * Otherwise next pointer in the second cache line will be used.
>          */
>         struct rte_mbuf *next;
> #endif
> 
> When building ! RTE_IOVA_IN_MBUF on a 32 bits arch, the next pointer
> is not force aligned to 64bits.
> Which has a cascade effect on data_off alignement.
> 
> In file included from ../lib/mbuf/rte_mbuf_core.h:19,
>                  from ../lib/mbuf/rte_mbuf.h:42,
>                  from ../lib/mbuf/rte_mbuf_dyn.c:18:
> ../lib/mbuf/rte_mbuf_core.h:676:1: error: static assertion failed: "data_off"
>   676 | static_assert(!(offsetof(struct rte_mbuf, data_off) !=
>       | ^~~~~~~~~~~~~
> 
> 
> I hope reviewers pay attention to the alignment changes when removing
> those markers.
> This is not trivial to catch in the CI.

Good catch, David.

I wonder about the reason for 64 bit aligning the rearm_data group of fields? Perhaps it's there for (64 bit arch) vector instruction purposes?

Regardless, it's an ABI break, so padding or an alignment attribute must be added to avoid ABI breakage. If there is no valid reason for the 64 bit alignment, it could be noted that the padding (or alignment attribute) is there for 32 bit arch ABI compatibility reasons only.

Please note that only RTE_MARKER64 is affected by this. The other marker types have arch bit-width (or smaller) alignment, i.e. RTE_MARKER is 8 byte aligned on 64 bit arch and 4 byte aligned on 32 bit arch.

And RTE_MARKER64 is only used in the rte_mbuf structure.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-28 15:01       ` Morten Brørup
@ 2024-02-28 15:33         ` David Marchand
  0 siblings, 0 replies; 171+ messages in thread
From: David Marchand @ 2024-02-28 15:33 UTC (permalink / raw)
  To: Morten Brørup
  Cc: Tyler Retzlaff, dev, Ajit Khaparde, Andrew Boyer,
	Andrew Rybchenko, Bruce Richardson, Chenbo Xia, Chengwen Feng,
	Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang,
	Thomas Monjalon

On Wed, Feb 28, 2024 at 4:01 PM Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > From: David Marchand [mailto:david.marchand@redhat.com]
> > Sent: Wednesday, 28 February 2024 15.19
> >
> > On Tue, Feb 27, 2024 at 6:44 AM Tyler Retzlaff
> > <roretzla@linux.microsoft.com> wrote:
> > >
> > > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > > RTE_MARKER fields from rte_mbuf struct.
> > >
> > > Maintain alignment of fields after removed cacheline1 marker by placing
> > > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> > >
> > > Update implementation of rte_mbuf_prefetch_part1() and
> > > rte_mbuf_prefetch_part2() inline functions calculate pointer for
> > > prefetch of cachline0 and cachline1 without using removed markers.
> > >
> > > Update static_assert of rte_mbuf struct fields to reference data_off and
> > > packet_type fields that occupy the original offsets of the marker
> > > fields.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > >  doc/guides/rel_notes/release_24_03.rst |  9 ++++++++
> > >  lib/mbuf/rte_mbuf.h                    |  4 ++--
> > >  lib/mbuf/rte_mbuf_core.h               | 39 +++++++++++++------------------
> > ---
> > >  3 files changed, 26 insertions(+), 26 deletions(-)
> > >
> > > diff --git a/doc/guides/rel_notes/release_24_03.rst
> > b/doc/guides/rel_notes/release_24_03.rst
> > > index 879bb49..67750f2 100644
> > > --- a/doc/guides/rel_notes/release_24_03.rst
> > > +++ b/doc/guides/rel_notes/release_24_03.rst
> > > @@ -156,6 +156,15 @@ Removed Items
> > >    The application reserved statically defined logtypes
> > ``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8``
> > >    are still defined.
> > >
> > > +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` ``cacheline1``
> > > +  ``rx_descriptor_fields1`` and ``RTE_MARKER64`` field ``rearm_data``
> > > +  have been removed from ``struct rte_mbuf``.
> > > +  Prefetch of ``cacheline0`` and ``cacheline1`` may be achieved through
> > > +  ``rte_mbuf_prefetch_part1()`` and ``rte_mbuf_prefetch_part2()`` inline
> > > +  functions respectively.
> > > +  Access to ``rearm_data`` and ``rx_descriptor_fields1`` should be
> > > +  through new inline functions ``rte_mbuf_rearm_data()`` and
> > > +  ``rte_mbuf_rx_descriptor_fields1()`` respectively.
> > >
> > >  API Changes
> > >  -----------
> > > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > > index aa7495b..61cda20 100644
> > > --- a/lib/mbuf/rte_mbuf.h
> > > +++ b/lib/mbuf/rte_mbuf.h
> > > @@ -108,7 +108,7 @@
> > >  static inline void
> > >  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
> > >  {
> > > -       rte_prefetch0(&m->cacheline0);
> > > +       rte_prefetch0(m);
> > >  }
> > >
> > >  /**
> > > @@ -126,7 +126,7 @@
> > >  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
> > >  {
> > >  #if RTE_CACHE_LINE_SIZE == 64
> > > -       rte_prefetch0(&m->cacheline1);
> > > +       rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
> > >  #else
> > >         RTE_SET_USED(m);
> > >  #endif
> > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > > index 36551c2..4e06f15 100644
> > > --- a/lib/mbuf/rte_mbuf_core.h
> > > +++ b/lib/mbuf/rte_mbuf_core.h
> > > @@ -18,6 +18,7 @@
> > >
> > >  #include <assert.h>
> > >  #include <stddef.h>
> > > +#include <stdalign.h>
> > >  #include <stdint.h>
> > >
> > >  #include <rte_common.h>
> > > @@ -467,8 +468,6 @@ enum {
> > >   * The generic rte_mbuf, containing a packet mbuf.
> > >   */
> > >  struct rte_mbuf {
> > > -       RTE_MARKER cacheline0;
> > > -
> > >         void *buf_addr;           /**< Virtual address of segment buffer. */
> > >  #if RTE_IOVA_IN_MBUF
> > >         /**
> > > @@ -495,7 +494,6 @@ struct rte_mbuf {
> > >          * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
> > >          * accessor instead of directly referencing through the data_off
> > field.
> > >          */
> > > -       RTE_MARKER64 rearm_data;
> > >         uint16_t data_off;
> >
> > One subtile change of removing the marker is that fields may not be
> > aligned as before.
> >
> > #if RTE_IOVA_IN_MBUF
> >         /**
> >          * Physical address of segment buffer.
> >          * This field is undefined if the build is configured to use only
> >          * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
> >          * Force alignment to 8-bytes, so as to ensure we have the exact
> >          * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
> >          * working on vector drivers easier.
> >          */
> >         rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
> > #else
> >         /**
> >          * Next segment of scattered packet.
> >          * This field is valid when physical address field is undefined.
> >          * Otherwise next pointer in the second cache line will be used.
> >          */
> >         struct rte_mbuf *next;
> > #endif
> >
> > When building ! RTE_IOVA_IN_MBUF on a 32 bits arch, the next pointer
> > is not force aligned to 64bits.
> > Which has a cascade effect on data_off alignement.
> >
> > In file included from ../lib/mbuf/rte_mbuf_core.h:19,
> >                  from ../lib/mbuf/rte_mbuf.h:42,
> >                  from ../lib/mbuf/rte_mbuf_dyn.c:18:
> > ../lib/mbuf/rte_mbuf_core.h:676:1: error: static assertion failed: "data_off"
> >   676 | static_assert(!(offsetof(struct rte_mbuf, data_off) !=
> >       | ^~~~~~~~~~~~~
> >
> >
> > I hope reviewers pay attention to the alignment changes when removing
> > those markers.
> > This is not trivial to catch in the CI.
>
> Good catch, David.
>
> I wonder about the reason for 64 bit aligning the rearm_data group of fields? Perhaps it's there for (64 bit arch) vector instruction purposes?
>
> Regardless, it's an ABI break, so padding or an alignment attribute must be added to avoid ABI breakage. If there is no valid reason for the 64 bit alignment, it could be noted that the padding (or alignment attribute) is there for 32 bit arch ABI compatibility reasons only.
>
> Please note that only RTE_MARKER64 is affected by this. The other marker types have arch bit-width (or smaller) alignment, i.e. RTE_MARKER is 8 byte aligned on 64 bit arch and 4 byte aligned on 32 bit arch.

Well, strictly speaking other RTE_MARKER users *may* be affected,
depending on the alignement for the following fields.
For example, I think removing the rxq_fastpath_data_end RTE_MARKER in
struct nicvf_rxq
(https://git.dpdk.org/dpdk/tree/drivers/net/thunderx/nicvf_struct.h#n72)
impacts rx_drop_en alignment and subsequent fields.

Now, in practice and focusing only on what this series touches, either
the markers were coupled with an explicit alignment constraint
(__rte_cache*_aligned) which is preserved by the series, or the
alignement constraint is stronger than that of the marker.
So there is probably only this ABI breakage I reported.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields
  2024-02-28  8:28         ` Morten Brørup
@ 2024-02-28 16:20           ` Tyler Retzlaff
  0 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 16:20 UTC (permalink / raw)
  To: Morten Brørup
  Cc: thomas, dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang

On Wed, Feb 28, 2024 at 09:28:22AM +0100, Morten Brørup wrote:
> +To: Thomas, previously joined the discussion
> 
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Tuesday, 27 February 2024 18.17
> > 
> > On Tue, Feb 27, 2024 at 10:10:03AM +0100, Morten Brørup wrote:
> > > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > > Sent: Tuesday, 27 February 2024 06.41
> > > >
> > > > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Provide
> > > > inline functions to access compatible type pointer to rearm_data
> > > > and rx_descriptor_fields1 which will allow direct references on the
> > > > rte marker fields to be removed.
> > > >
> > > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > > ---
> > > >  lib/mbuf/rte_mbuf.h      | 13 +++++++++++++
> > > >  lib/mbuf/rte_mbuf_core.h | 11 ++++++++++-
> > > >  2 files changed, 23 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > > > index 286b32b..aa7495b 100644
> > > > --- a/lib/mbuf/rte_mbuf.h
> > > > +++ b/lib/mbuf/rte_mbuf.h
> > > > @@ -132,6 +132,19 @@
> > > >  #endif
> > > >  }
> > > >
> > > > +static inline
> > > > +uint64_t *
> > > > +rte_mbuf_rearm_data(struct rte_mbuf *m)
> > > > +{
> > > > +	return (uint64_t *)&m->data_off;
> > > > +}
> > >
> > > Consider returning (void *) instead of (uint64_t *).
> > > Just a suggestion; I don't know which is better.
> > 
> > if you mean just the cast i don't think it matters.
> 
> No, I meant the return type.
> The type is opaque; only its size is fixed at 8 byte.
> Maybe uint64_t * is the best type, after all.

ah, in many places the drivers want the uint64_t * keeping it here allows
for some of the casts (and potential for mistakes) to be discarded. if i
recall in some places they do math on the returned pointer.

> 
> > arguably it could go
> > void * first but we're already aliasing through a different type. this
> > is one argument in favor of the union.
> 
> The zero-size markers (rearm_data and rx_descriptor_fields1) were intended to be used like unions, which the drivers effectively do.
> Previous C standards didn't allow anonymous structures, so using union+struct in pre-C11 DPDK would clutter the code with subfield names. But now that we moved on to C11, we don't have this problem anymore.
> 
> IMHO, replacing the zero-size markers - which are directly visible in the structure's source code - with access functions located in some other header file degrades source code readability.
> 
> I am in favor of union+struct in the mbuf structure over access functions. I think the explicit grouping of the fields improves the readability of the mbuf structure, also compared to the zero-size markers.

it's unfortunate the zero-size markers could be accessed slightly
differently than the anonymous unions necessitating code referencing
them to be changed.

Thomas and i discussed rearm_data and rx_descriptor_fields1 at length
and it was understood why i had to add new field names if using the union
approach there was an expressed preference for accessors.

one possibly important detail that came out of our conversation was that
rearm_data rx_descriptor_fields1 are (I think) supposed to be internal
and that being the case means updading the dpdk drivers means i updated
*all* consumers i.e. i can break the api and adapt in the same commit if
they are truly internal because no application should be accessing the
fields.

one approach i've enjoyed some success with is to present semi-opaque
structures where the internal fields are by convention discouraged in
their use but doing this requires duplicating parts of the whole to e.g.
give the drivers the view of the struct they need and is an increased
burden for maintainers. again this relies on the fields actually being
internal only.

both approaches have been put up in this series now, just looking for
folks to look at the two and push for one or the other.

thanks!


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-28 14:18     ` David Marchand
  2024-02-28 15:01       ` Morten Brørup
@ 2024-02-28 17:20       ` Tyler Retzlaff
  1 sibling, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 17:20 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb,
	Thomas Monjalon

On Wed, Feb 28, 2024 at 03:18:40PM +0100, David Marchand wrote:
> On Tue, Feb 27, 2024 at 6:44 AM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > RTE_MARKER fields from rte_mbuf struct.
> >
> > Maintain alignment of fields after removed cacheline1 marker by placing
> > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> >
> > Update implementation of rte_mbuf_prefetch_part1() and
> > rte_mbuf_prefetch_part2() inline functions calculate pointer for
> > prefetch of cachline0 and cachline1 without using removed markers.
> >
> > Update static_assert of rte_mbuf struct fields to reference data_off and
> > packet_type fields that occupy the original offsets of the marker
> > fields.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  doc/guides/rel_notes/release_24_03.rst |  9 ++++++++
> >  lib/mbuf/rte_mbuf.h                    |  4 ++--
> >  lib/mbuf/rte_mbuf_core.h               | 39 +++++++++++++---------------------
> >  3 files changed, 26 insertions(+), 26 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
> > index 879bb49..67750f2 100644
> > --- a/doc/guides/rel_notes/release_24_03.rst
> > +++ b/doc/guides/rel_notes/release_24_03.rst
> > @@ -156,6 +156,15 @@ Removed Items
> >    The application reserved statically defined logtypes ``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8``
> >    are still defined.
> >
> > +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` ``cacheline1``
> > +  ``rx_descriptor_fields1`` and ``RTE_MARKER64`` field ``rearm_data``
> > +  have been removed from ``struct rte_mbuf``.
> > +  Prefetch of ``cacheline0`` and ``cacheline1`` may be achieved through
> > +  ``rte_mbuf_prefetch_part1()`` and ``rte_mbuf_prefetch_part2()`` inline
> > +  functions respectively.
> > +  Access to ``rearm_data`` and ``rx_descriptor_fields1`` should be
> > +  through new inline functions ``rte_mbuf_rearm_data()`` and
> > +  ``rte_mbuf_rx_descriptor_fields1()`` respectively.
> >
> >  API Changes
> >  -----------
> > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > index aa7495b..61cda20 100644
> > --- a/lib/mbuf/rte_mbuf.h
> > +++ b/lib/mbuf/rte_mbuf.h
> > @@ -108,7 +108,7 @@
> >  static inline void
> >  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
> >  {
> > -       rte_prefetch0(&m->cacheline0);
> > +       rte_prefetch0(m);
> >  }
> >
> >  /**
> > @@ -126,7 +126,7 @@
> >  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
> >  {
> >  #if RTE_CACHE_LINE_SIZE == 64
> > -       rte_prefetch0(&m->cacheline1);
> > +       rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
> >  #else
> >         RTE_SET_USED(m);
> >  #endif
> > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > index 36551c2..4e06f15 100644
> > --- a/lib/mbuf/rte_mbuf_core.h
> > +++ b/lib/mbuf/rte_mbuf_core.h
> > @@ -18,6 +18,7 @@
> >
> >  #include <assert.h>
> >  #include <stddef.h>
> > +#include <stdalign.h>
> >  #include <stdint.h>
> >
> >  #include <rte_common.h>
> > @@ -467,8 +468,6 @@ enum {
> >   * The generic rte_mbuf, containing a packet mbuf.
> >   */
> >  struct rte_mbuf {
> > -       RTE_MARKER cacheline0;
> > -
> >         void *buf_addr;           /**< Virtual address of segment buffer. */
> >  #if RTE_IOVA_IN_MBUF
> >         /**
> > @@ -495,7 +494,6 @@ struct rte_mbuf {
> >          * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data()
> >          * accessor instead of directly referencing through the data_off field.
> >          */
> > -       RTE_MARKER64 rearm_data;
> >         uint16_t data_off;
> 
> One subtile change of removing the marker is that fields may not be
> aligned as before.
> 
> #if RTE_IOVA_IN_MBUF
>         /**
>          * Physical address of segment buffer.
>          * This field is undefined if the build is configured to use only
>          * virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
>          * Force alignment to 8-bytes, so as to ensure we have the exact
>          * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
>          * working on vector drivers easier.
>          */
>         rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
> #else
>         /**
>          * Next segment of scattered packet.
>          * This field is valid when physical address field is undefined.
>          * Otherwise next pointer in the second cache line will be used.
>          */
>         struct rte_mbuf *next;
> #endif
> 
> When building ! RTE_IOVA_IN_MBUF on a 32 bits arch, the next pointer
> is not force aligned to 64bits.
> Which has a cascade effect on data_off alignement.
> 
> In file included from ../lib/mbuf/rte_mbuf_core.h:19,
>                  from ../lib/mbuf/rte_mbuf.h:42,
>                  from ../lib/mbuf/rte_mbuf_dyn.c:18:
> ../lib/mbuf/rte_mbuf_core.h:676:1: error: static assertion failed: "data_off"
>   676 | static_assert(!(offsetof(struct rte_mbuf, data_off) !=
>       | ^~~~~~~~~~~~~
> 

it is the assert that is wrong here not the offset/alignment of the fields,
i failed to notice when i moved the assert from drivers to rte_mbuf_core.h
that it was only being evaluated for drivers that *require*
enable_iova_as_pa=true.

you can easily test by adding just this assert alone and building with
enable_iova_as_pa=false for -m32 you'll see the assert trigger.

sorry i should have been more careful about which asserts i consolidated
here. i can wrap this one up in conditional compile to only fire when
RTE_IOVA_IN_MBUF=1.

> I hope reviewers pay attention to the alignment changes when removing
> those markers.
> This is not trivial to catch in the CI.
> 
> 
> -- 
> David Marchand

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
  2024-02-28 14:43         ` David Marchand
@ 2024-02-29 14:50           ` Dodji Seketeli
  0 siblings, 0 replies; 171+ messages in thread
From: Dodji Seketeli @ 2024-02-29 14:50 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb,
	Tyler Retzlaff, Thomas Monjalon

David Marchand <david.marchand@redhat.com> writes:

> On Wed, Feb 28, 2024 at 3:04 PM Dodji Seketeli <dodji@redhat.com> wrote:
>> > Btw, I see no way to suppress this (except a global [suppress_type]
>> > name = rte_mbuf)...
>>
>> Right.
>>
>> To avoid having subsequent changes to that type from being "overly"
>> suppressed, maybe do something like:
>>
>>     [suppress_type]
>>      name = rte_mbuf
>>      has_size_change = no
>>      has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
>>
>> That way, only size-impacting changes to struct rte_mbuf in its form
>> that predates this patch would be suppressed, hopefully.
>
> Do you mean, only changes *not* size-impacting would be suppressed?

Yes, of course.  Sorry for the typo.  You are right.

> This is slightly better than the suppression on the whole rte_mbuf
> object, but it won't catch field reordering iiuc.

Indeed.

>
> On the other hand, now that I try reordering fields (to test this
> suggestion of yours), I get build failures all over the DPDK tree
> because we have many build checks to ensure those fields are at known
> locations...
> So maybe we can relax and just go with the full suppression.

Yes, that would make sense.

Thanks!

-- 
		Dodji


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct
  2024-02-27  5:41   ` [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Tyler Retzlaff
  2024-02-27 10:02     ` Konstantin Ananyev
@ 2024-03-14 16:51     ` Tyler Retzlaff
  1 sibling, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-14 16:51 UTC (permalink / raw)
  To: dev, techboard
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb

We've gone around in circles a little on this series.  Let's discuss it
at the next techboard meeting, please put it on the agenda.

Summary

MSVC does not support the typedef of zero-sized typed arrays used in
struct rte_mbuf and a handful of other structs built on Windows. Better
known as ``RTE_MARKER`` fields.

There are two competing solutions we would like to know which to move
forward with.

1. Use C11 anonymous unions and anonymous struct extensions to replace
the RTE_MARKER fields which can maintain ABI and API compatibility.

2. Provide inline accessors for struct rte_mbuf for some fields and
removing others which maintains ABI but breaks API.

I'm proposing a mix of 1 & 2 to maintain ABI and some API for struct
rte_mbuf fields but remove (API breaking) cacheline{0,1} RTE_MARKER
fields in favor of existing inline functions for prefetching.

Thanks!

On Mon, Feb 26, 2024 at 09:41:18PM -0800, Tyler Retzlaff wrote:
> Collect duplicated RTE_BUILD_BUG_ON checks from drivers and place them
> at global scope with struct rte_mbuf definition using static_assert.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/mbuf/rte_mbuf_core.h | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 7000c04..36551c2 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -16,8 +16,11 @@
>   * New fields and flags should fit in the "dynamic space".
>   */
>  
> +#include <assert.h>
> +#include <stddef.h>
>  #include <stdint.h>
>  
> +#include <rte_common.h>
>  #include <rte_byteorder.h>
>  #include <rte_stdatomic.h>
>  
> @@ -673,6 +676,37 @@ struct rte_mbuf {
>  	uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */
>  } __rte_cache_aligned;
>  
> +static_assert(!(offsetof(struct rte_mbuf, ol_flags) !=
> +	offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags");
> +static_assert(!(offsetof(struct rte_mbuf, rearm_data) !=
> +	RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data");
> +static_assert(!(offsetof(struct rte_mbuf, data_off) !=
> +	offsetof(struct rte_mbuf, rearm_data)), "data_off");
> +static_assert(!(offsetof(struct rte_mbuf, data_off) <
> +	offsetof(struct rte_mbuf, rearm_data)), "data_off");
> +static_assert(!(offsetof(struct rte_mbuf, refcnt) <
> +	offsetof(struct rte_mbuf, rearm_data)), "refcnt");
> +static_assert(!(offsetof(struct rte_mbuf, nb_segs) <
> +	offsetof(struct rte_mbuf, rearm_data)), "nb_segs");
> +static_assert(!(offsetof(struct rte_mbuf, port) <
> +	offsetof(struct rte_mbuf, rearm_data)), "port");
> +static_assert(!(offsetof(struct rte_mbuf, data_off) -
> +	offsetof(struct rte_mbuf, rearm_data) > 6), "data_off");
> +static_assert(!(offsetof(struct rte_mbuf, refcnt) -
> +	offsetof(struct rte_mbuf, rearm_data) > 6), "refcnt");
> +static_assert(!(offsetof(struct rte_mbuf, nb_segs) -
> +	offsetof(struct rte_mbuf, rearm_data) > 6), "nb_segs");
> +static_assert(!(offsetof(struct rte_mbuf, port) -
> +	offsetof(struct rte_mbuf, rearm_data) > 6), "port");
> +static_assert(!(offsetof(struct rte_mbuf, pkt_len) !=
> +	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len");
> +static_assert(!(offsetof(struct rte_mbuf, data_len) !=
> +	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len");
> +static_assert(!(offsetof(struct rte_mbuf, vlan_tci) !=
> +	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci");
> +static_assert(!(offsetof(struct rte_mbuf, hash) !=
> +	offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash");
> +
>  /**
>   * Function typedef of callback to free externally attached buffer.
>   */
> -- 
> 1.8.3.1

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v7 0/4] remove use of RTE_MARKER fields in libraries
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
                   ` (3 preceding siblings ...)
  2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
@ 2024-03-20 22:01 ` Tyler Retzlaff
  2024-03-20 22:01   ` [PATCH v7 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
                     ` (3 more replies)
  2024-03-27 19:56 ` [PATCH v8 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
                   ` (3 subsequent siblings)
  8 siblings, 4 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 22:01 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

As per techboard meeting 2024/03/20 adopt hybrid proposal of adapting
descriptor fields and removing cachline fields.

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields.

For cacheline{0,1} fields remove fields entirely and use inline
functions to prefetch.

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

Tyler Retzlaff (4):
  net/i40e: use inline prefetch function
  mbuf: remove rte marker fields
  security: remove rte marker fields
  cryptodev: remove rte marker fields

 doc/guides/rel_notes/release_24_03.rst  |   8 ++
 drivers/net/i40e/i40e_rxtx_vec_avx512.c |   2 +-
 lib/cryptodev/cryptodev_pmd.h           |   5 +-
 lib/mbuf/rte_mbuf.h                     |   4 +-
 lib/mbuf/rte_mbuf_core.h                | 188 +++++++++++++++++---------------
 lib/security/rte_security_driver.h      |   5 +-
 6 files changed, 117 insertions(+), 95 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v7 1/4] net/i40e: use inline prefetch function
  2024-03-20 22:01 ` [PATCH v7 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-03-20 22:01   ` Tyler Retzlaff
  2024-03-26 10:16     ` Morten Brørup
  2024-03-20 22:01   ` [PATCH v7 2/4] mbuf: remove rte marker fields Tyler Retzlaff
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 22:01 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Don't directly access the cacheline1 field in rte_mbuf struct for
prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index f3050cd..0238b03 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -826,7 +826,7 @@
 		free[0] = m;
 		nb_free = 1;
 		for (i = 1; i < n; i++) {
-			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
 			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
 			if (likely(m)) {
 				if (likely(m->pool == free[0]->pool)) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v7 2/4] mbuf: remove rte marker fields
  2024-03-20 22:01 ` [PATCH v7 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-03-20 22:01   ` [PATCH v7 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
@ 2024-03-20 22:01   ` Tyler Retzlaff
  2024-03-21 10:32     ` Bruce Richardson
  2024-03-26 11:12     ` Morten Brørup
  2024-03-20 22:01   ` [PATCH v7 3/4] security: " Tyler Retzlaff
  2024-03-20 22:01   ` [PATCH v7 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 2 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 22:01 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 doc/guides/rel_notes/release_24_03.rst |   2 +
 lib/mbuf/rte_mbuf.h                    |   4 +-
 lib/mbuf/rte_mbuf_core.h               | 188 ++++++++++++++++++---------------
 3 files changed, 104 insertions(+), 90 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 14826ea..4f18cca 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -216,6 +216,8 @@ Removed Items
 
 * acc101: Removed obsolete code for non productized HW variant.
 
+* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_mbuf``.
 
 API Changes
 -----------
diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 286b32b..4c4722e 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -108,7 +108,7 @@
 static inline void
 rte_mbuf_prefetch_part1(struct rte_mbuf *m)
 {
-	rte_prefetch0(&m->cacheline0);
+	rte_prefetch0(m);
 }
 
 /**
@@ -126,7 +126,7 @@
 rte_mbuf_prefetch_part2(struct rte_mbuf *m)
 {
 #if RTE_CACHE_LINE_SIZE == 64
-	rte_prefetch0(&m->cacheline1);
+	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
 #else
 	RTE_SET_USED(m);
 #endif
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 9f58076..665213c 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -465,8 +465,6 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct __rte_cache_aligned rte_mbuf {
-	RTE_MARKER cacheline0;
-
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
 	/**
@@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {
 #endif
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
+	union {
+		uint64_t rearm_data[1];
+		__extension__
+		struct {
+			uint16_t data_off;
+
+			/**
+			 * Reference counter. Its size should at least equal to the size
+			 * of port field (16 bits), to support zero-copy broadcast.
+			 * It should only be accessed using the following functions:
+			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
+			 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
+			 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
+			 */
+			RTE_ATOMIC(uint16_t) refcnt;
 
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
+			/**
+			 * Number of segments. Only valid for the first segment of an mbuf
+			 * chain.
+			 */
+			uint16_t nb_segs;
 
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
+			/** Input port (16 bits to support more than 256 virtual ports).
+			 * The event eth Tx adapter uses this field to specify the output port.
+			 */
+			uint16_t port;
+		};
+	};
 
 	uint64_t ol_flags;        /**< Offload features. */
 
 	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
-
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
 	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
+		void *rx_descriptor_fields1[1];
 		__extension__
 		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
+			/*
+			 * The packet type, which is the combination of outer/inner L2, L3, L4
+			 * and tunnel types. The packet_type is about data really present in the
+			 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
+			 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
+			 * vlan is stripped from the data.
+			 */
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
-				 */
+				uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
 				__extension__
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					uint8_t l2_type:4;   /**< (Outer) L2 type. */
+					uint8_t l3_type:4;   /**< (Outer) L3 type. */
+					uint8_t l4_type:4;   /**< (Outer) L4 type. */
+					uint8_t tun_type:4;  /**< Tunnel type. */
+					union {
+						uint8_t inner_esp_next_proto;
+						/**< ESP next protocol type, valid if
+						 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
+						 * on both Tx and Rx.
+						 */
+						__extension__
+						struct {
+							uint8_t inner_l2_type:4;
+							/**< Inner L2 type. */
+							uint8_t inner_l3_type:4;
+							/**< Inner L3 type. */
+						};
+					};
+					uint8_t inner_l4_type:4; /**< Inner L4 type. */
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
-		};
-	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-	uint16_t data_len;        /**< Amount of data in segment buffer. */
-	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
-	uint16_t vlan_tci;
+			/*
+			 * pkt_len is not actually part of rx_descriptor_fields1
+			 * but is included here to account for changes in alignment
+			 * and offset for void * on 32-bit vs 64-bit targets.
+			 */
+			uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
 
-	union {
-		union {
-			uint32_t rss;     /**< RSS hash result if RSS enabled */
-			struct {
+			uint16_t data_len;        /**< Amount of data in segment buffer. */
+			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
+			uint16_t vlan_tci;
+
+			union {
 				union {
+					uint32_t rss;     /**< RSS hash result if RSS enabled */
 					struct {
-						uint16_t hash;
-						uint16_t id;
-					};
-					uint32_t lo;
-					/**< Second 4 flexible bytes */
-				};
-				uint32_t hi;
-				/**< First 4 flexible bytes or FD ID, dependent
-				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
-				 */
-			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched sched;
-			/**< Hierarchical scheduler : 8 bytes */
-			struct {
-				uint32_t reserved1;
-				uint16_t reserved2;
-				uint16_t txq;
-				/**< The event eth Tx adapter uses this field
-				 * to store Tx queue id.
-				 * @see rte_event_eth_tx_adapter_txq_set()
-				 */
-			} txadapter; /**< Eventdev ethdev Tx adapter */
-			uint32_t usr;
-			/**< User defined tags. See rte_distributor_process() */
-		} hash;                   /**< hash information */
-	};
+						union {
+							struct {
+								uint16_t hash;
+								uint16_t id;
+							};
+							uint32_t lo;
+							/**< Second 4 flexible bytes */
+						};
+						uint32_t hi;
+						/**< First 4 flexible bytes or FD ID, dependent
+						 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
+						 */
+					} fdir;	/**< Filter identifier if FDIR enabled */
+					struct rte_mbuf_sched sched;
+					/**< Hierarchical scheduler : 8 bytes */
+					struct {
+						uint32_t reserved1;
+						uint16_t reserved2;
+						uint16_t txq;
+						/**< The event eth Tx adapter uses this field
+						 * to store Tx queue id.
+						 * @see rte_event_eth_tx_adapter_txq_set()
+						 */
+					} txadapter; /**< Eventdev ethdev Tx adapter */
+					uint32_t usr;
+					/**< User defined tags. See rte_distributor_process() */
+				} hash;                   /**< hash information */
+			};
 
-	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
-	uint16_t vlan_tci_outer;
+			/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
+			uint16_t vlan_tci_outer;
 
-	uint16_t buf_len;         /**< Length of segment buffer. */
+			uint16_t buf_len;         /**< Length of segment buffer. */
+		};
+	};
 
 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
-
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 #if RTE_IOVA_IN_MBUF
 	/**
 	 * Next segment of scattered packet. Must be NULL in the last
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v7 3/4] security: remove rte marker fields
  2024-03-20 22:01 ` [PATCH v7 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-03-20 22:01   ` [PATCH v7 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
  2024-03-20 22:01   ` [PATCH v7 2/4] mbuf: remove rte marker fields Tyler Retzlaff
@ 2024-03-20 22:01   ` Tyler Retzlaff
  2024-03-26 10:28     ` Morten Brørup
  2024-03-20 22:01   ` [PATCH v7 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 22:01 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 lib/security/rte_security_driver.h     | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 4f18cca..75d40d4 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -219,6 +219,9 @@ Removed Items
 * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_mbuf``.
 
+* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_security_session``.
+
 API Changes
 -----------
 
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index 09829ab..18a1e3c 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -12,6 +12,8 @@
  * RTE Security Common Definitions
  */
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,7 +26,6 @@
  * Security session to be used by library for internal usage
  */
 struct rte_security_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Opaque user defined data */
 	uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< session private data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint8_t driver_priv_data[];
 	/**< Private session material, variable size (depends on driver) */
 };
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v7 4/4] cryptodev: remove rte marker fields
  2024-03-20 22:01 ` [PATCH v7 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-03-20 22:01   ` [PATCH v7 3/4] security: " Tyler Retzlaff
@ 2024-03-20 22:01   ` Tyler Retzlaff
  2024-03-26 10:31     ` Morten Brørup
  3 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-20 22:01 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 lib/cryptodev/cryptodev_pmd.h          | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 75d40d4..d3e5abe 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -222,6 +222,9 @@ Removed Items
 * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_security_session``.
 
+* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct cryptodev_driver``.
+
 API Changes
 -----------
 
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index d195b81..9daf129 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -5,6 +5,8 @@
 #ifndef _CRYPTODEV_PMD_H_
 #define _CRYPTODEV_PMD_H_
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Can be used for external metadata */
 	uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< Session driver data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	/**< Second cache line - start of the driver session data */
 	uint8_t driver_priv_data[];
 	/**< Driver specific session data, variable size */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v7 2/4] mbuf: remove rte marker fields
  2024-03-20 22:01   ` [PATCH v7 2/4] mbuf: remove rte marker fields Tyler Retzlaff
@ 2024-03-21 10:32     ` Bruce Richardson
  2024-03-21 15:31       ` Tyler Retzlaff
  2024-03-26 11:12     ` Morten Brørup
  1 sibling, 1 reply; 171+ messages in thread
From: Bruce Richardson @ 2024-03-21 10:32 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Chenbo Xia,
	Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb

On Wed, Mar 20, 2024 at 03:01:36PM -0700, Tyler Retzlaff wrote:
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> unions as single element arrays of with types matching the original
> markers to maintain API compatibility.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  doc/guides/rel_notes/release_24_03.rst |   2 +
>  lib/mbuf/rte_mbuf.h                    |   4 +-
>  lib/mbuf/rte_mbuf_core.h               | 188 ++++++++++++++++++---------------
>  3 files changed, 104 insertions(+), 90 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
> index 14826ea..4f18cca 100644
> --- a/doc/guides/rel_notes/release_24_03.rst
> +++ b/doc/guides/rel_notes/release_24_03.rst
> @@ -216,6 +216,8 @@ Removed Items
>  
>  * acc101: Removed obsolete code for non productized HW variant.
>  
> +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
> +  have been removed from ``struct rte_mbuf``.
>  
>  API Changes
>  -----------
> diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> index 286b32b..4c4722e 100644
> --- a/lib/mbuf/rte_mbuf.h
> +++ b/lib/mbuf/rte_mbuf.h
> @@ -108,7 +108,7 @@
>  static inline void
>  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
>  {
> -	rte_prefetch0(&m->cacheline0);
> +	rte_prefetch0(m);
>  }
>  
>  /**
> @@ -126,7 +126,7 @@
>  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
>  {
>  #if RTE_CACHE_LINE_SIZE == 64
> -	rte_prefetch0(&m->cacheline1);
> +	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
>  #else
>  	RTE_SET_USED(m);
>  #endif
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 9f58076..665213c 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -465,8 +465,6 @@ enum {
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
>  struct __rte_cache_aligned rte_mbuf {
> -	RTE_MARKER cacheline0;
> -
>  	void *buf_addr;           /**< Virtual address of segment buffer. */
>  #if RTE_IOVA_IN_MBUF
>  	/**
> @@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {
>  #endif
>  
>  	/* next 8 bytes are initialised on RX descriptor rearm */
> -	RTE_MARKER64 rearm_data;
> -	uint16_t data_off;
> -
> -	/**
> -	 * Reference counter. Its size should at least equal to the size
> -	 * of port field (16 bits), to support zero-copy broadcast.
> -	 * It should only be accessed using the following functions:
> -	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> -	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
> -	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
> -	 */
> -	RTE_ATOMIC(uint16_t) refcnt;
> +	union {
> +		uint64_t rearm_data[1];
> +		__extension__
> +		struct {
> +			uint16_t data_off;
> +
> +			/**
> +			 * Reference counter. Its size should at least equal to the size
> +			 * of port field (16 bits), to support zero-copy broadcast.
> +			 * It should only be accessed using the following functions:
> +			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> +			 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
> +			 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
> +			 */
> +			RTE_ATOMIC(uint16_t) refcnt;
>  
> -	/**
> -	 * Number of segments. Only valid for the first segment of an mbuf
> -	 * chain.
> -	 */
> -	uint16_t nb_segs;
> +			/**
> +			 * Number of segments. Only valid for the first segment of an mbuf
> +			 * chain.
> +			 */
> +			uint16_t nb_segs;
>  
> -	/** Input port (16 bits to support more than 256 virtual ports).
> -	 * The event eth Tx adapter uses this field to specify the output port.
> -	 */
> -	uint16_t port;
> +			/** Input port (16 bits to support more than 256 virtual ports).
> +			 * The event eth Tx adapter uses this field to specify the output port.
> +			 */
> +			uint16_t port;
> +		};
> +	};
>  
>  	uint64_t ol_flags;        /**< Offload features. */
>  
>  	/* remaining bytes are set on RX when pulling packet from descriptor */
> -	RTE_MARKER rx_descriptor_fields1;
> -
> -	/*
> -	 * The packet type, which is the combination of outer/inner L2, L3, L4
> -	 * and tunnel types. The packet_type is about data really present in the
> -	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
> -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> -	 * vlan is stripped from the data.
> -	 */
>  	union {
> -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
> +		void *rx_descriptor_fields1[1];

Can we make this array the actual size of all the fields, rather than just
an 8-byte value? That would allow the right think to be done if assigning
the descriptor fields from one mbuf to another, or when using memset or
memcpy on them.

/Bruce

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v7 2/4] mbuf: remove rte marker fields
  2024-03-21 10:32     ` Bruce Richardson
@ 2024-03-21 15:31       ` Tyler Retzlaff
  2024-03-21 16:19         ` Morten Brørup
  0 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-21 15:31 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Chenbo Xia,
	Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb

On Thu, Mar 21, 2024 at 10:32:02AM +0000, Bruce Richardson wrote:
> On Wed, Mar 20, 2024 at 03:01:36PM -0700, Tyler Retzlaff wrote:
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > RTE_MARKER fields from rte_mbuf struct.
> > 
> > Maintain alignment of fields after removed cacheline1 marker by placing
> > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> > 
> > Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> > unions as single element arrays of with types matching the original
> > markers to maintain API compatibility.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  doc/guides/rel_notes/release_24_03.rst |   2 +
> >  lib/mbuf/rte_mbuf.h                    |   4 +-
> >  lib/mbuf/rte_mbuf_core.h               | 188 ++++++++++++++++++---------------
> >  3 files changed, 104 insertions(+), 90 deletions(-)
> > 
> > diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
> > index 14826ea..4f18cca 100644
> > --- a/doc/guides/rel_notes/release_24_03.rst
> > +++ b/doc/guides/rel_notes/release_24_03.rst
> > @@ -216,6 +216,8 @@ Removed Items
> >  
> >  * acc101: Removed obsolete code for non productized HW variant.
> >  
> > +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
> > +  have been removed from ``struct rte_mbuf``.
> >  
> >  API Changes
> >  -----------
> > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > index 286b32b..4c4722e 100644
> > --- a/lib/mbuf/rte_mbuf.h
> > +++ b/lib/mbuf/rte_mbuf.h
> > @@ -108,7 +108,7 @@
> >  static inline void
> >  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
> >  {
> > -	rte_prefetch0(&m->cacheline0);
> > +	rte_prefetch0(m);
> >  }
> >  
> >  /**
> > @@ -126,7 +126,7 @@
> >  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
> >  {
> >  #if RTE_CACHE_LINE_SIZE == 64
> > -	rte_prefetch0(&m->cacheline1);
> > +	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
> >  #else
> >  	RTE_SET_USED(m);
> >  #endif
> > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > index 9f58076..665213c 100644
> > --- a/lib/mbuf/rte_mbuf_core.h
> > +++ b/lib/mbuf/rte_mbuf_core.h
> > @@ -465,8 +465,6 @@ enum {
> >   * The generic rte_mbuf, containing a packet mbuf.
> >   */
> >  struct __rte_cache_aligned rte_mbuf {
> > -	RTE_MARKER cacheline0;
> > -
> >  	void *buf_addr;           /**< Virtual address of segment buffer. */
> >  #if RTE_IOVA_IN_MBUF
> >  	/**
> > @@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {
> >  #endif
> >  
> >  	/* next 8 bytes are initialised on RX descriptor rearm */
> > -	RTE_MARKER64 rearm_data;
> > -	uint16_t data_off;
> > -
> > -	/**
> > -	 * Reference counter. Its size should at least equal to the size
> > -	 * of port field (16 bits), to support zero-copy broadcast.
> > -	 * It should only be accessed using the following functions:
> > -	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> > -	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
> > -	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
> > -	 */
> > -	RTE_ATOMIC(uint16_t) refcnt;
> > +	union {
> > +		uint64_t rearm_data[1];
> > +		__extension__
> > +		struct {
> > +			uint16_t data_off;
> > +
> > +			/**
> > +			 * Reference counter. Its size should at least equal to the size
> > +			 * of port field (16 bits), to support zero-copy broadcast.
> > +			 * It should only be accessed using the following functions:
> > +			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> > +			 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
> > +			 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
> > +			 */
> > +			RTE_ATOMIC(uint16_t) refcnt;
> >  
> > -	/**
> > -	 * Number of segments. Only valid for the first segment of an mbuf
> > -	 * chain.
> > -	 */
> > -	uint16_t nb_segs;
> > +			/**
> > +			 * Number of segments. Only valid for the first segment of an mbuf
> > +			 * chain.
> > +			 */
> > +			uint16_t nb_segs;
> >  
> > -	/** Input port (16 bits to support more than 256 virtual ports).
> > -	 * The event eth Tx adapter uses this field to specify the output port.
> > -	 */
> > -	uint16_t port;
> > +			/** Input port (16 bits to support more than 256 virtual ports).
> > +			 * The event eth Tx adapter uses this field to specify the output port.
> > +			 */
> > +			uint16_t port;
> > +		};
> > +	};
> >  
> >  	uint64_t ol_flags;        /**< Offload features. */
> >  
> >  	/* remaining bytes are set on RX when pulling packet from descriptor */
> > -	RTE_MARKER rx_descriptor_fields1;
> > -
> > -	/*
> > -	 * The packet type, which is the combination of outer/inner L2, L3, L4
> > -	 * and tunnel types. The packet_type is about data really present in the
> > -	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
> > -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> > -	 * vlan is stripped from the data.
> > -	 */
> >  	union {
> > -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
> > +		void *rx_descriptor_fields1[1];
> 
> Can we make this array the actual size of all the fields, rather than just
> an 8-byte value? That would allow the right think to be done if assigning
> the descriptor fields from one mbuf to another, or when using memset or
> memcpy on them.

Morten pointed out in a previous version that the marker being an array of
void * was a bug to begin with.

The other field of the union is 24 bytes. I suppose it would be possible
to conditionally compile the array to be either 3 or 6 elements. I guess
this would be an improvement over what the marker is doing now.

Just a reminder that we cannot 'correct' the type since that would
require adaptation of calling code.

What do others think? Keep it as a single element array or conditional
compile based on sizeof(void *)?

> 
> /Bruce

^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v7 2/4] mbuf: remove rte marker fields
  2024-03-21 15:31       ` Tyler Retzlaff
@ 2024-03-21 16:19         ` Morten Brørup
  0 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-03-21 16:19 UTC (permalink / raw)
  To: Tyler Retzlaff, Bruce Richardson
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Chenbo Xia,
	Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, David Marchand, Konstantin Ananyev, Dodji Seketeli

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Thursday, 21 March 2024 16.31
> 
> On Thu, Mar 21, 2024 at 10:32:02AM +0000, Bruce Richardson wrote:
> > On Wed, Mar 20, 2024 at 03:01:36PM -0700, Tyler Retzlaff wrote:
> > > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > > RTE_MARKER fields from rte_mbuf struct.
> > >
> > > Maintain alignment of fields after removed cacheline1 marker by placing
> > > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> > >
> > > Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> > > unions as single element arrays of with types matching the original
> > > markers to maintain API compatibility.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > >  doc/guides/rel_notes/release_24_03.rst |   2 +
> > >  lib/mbuf/rte_mbuf.h                    |   4 +-
> > >  lib/mbuf/rte_mbuf_core.h               | 188 ++++++++++++++++++----------
> -----
> > >  3 files changed, 104 insertions(+), 90 deletions(-)
> > >
> > > diff --git a/doc/guides/rel_notes/release_24_03.rst
> b/doc/guides/rel_notes/release_24_03.rst
> > > index 14826ea..4f18cca 100644
> > > --- a/doc/guides/rel_notes/release_24_03.rst
> > > +++ b/doc/guides/rel_notes/release_24_03.rst
> > > @@ -216,6 +216,8 @@ Removed Items
> > >
> > >  * acc101: Removed obsolete code for non productized HW variant.
> > >
> > > +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
> > > +  have been removed from ``struct rte_mbuf``.
> > >
> > >  API Changes
> > >  -----------
> > > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > > index 286b32b..4c4722e 100644
> > > --- a/lib/mbuf/rte_mbuf.h
> > > +++ b/lib/mbuf/rte_mbuf.h
> > > @@ -108,7 +108,7 @@
> > >  static inline void
> > >  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
> > >  {
> > > -	rte_prefetch0(&m->cacheline0);
> > > +	rte_prefetch0(m);
> > >  }
> > >
> > >  /**
> > > @@ -126,7 +126,7 @@
> > >  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
> > >  {
> > >  #if RTE_CACHE_LINE_SIZE == 64
> > > -	rte_prefetch0(&m->cacheline1);
> > > +	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
> > >  #else
> > >  	RTE_SET_USED(m);
> > >  #endif
> > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> > > index 9f58076..665213c 100644
> > > --- a/lib/mbuf/rte_mbuf_core.h
> > > +++ b/lib/mbuf/rte_mbuf_core.h
> > > @@ -465,8 +465,6 @@ enum {
> > >   * The generic rte_mbuf, containing a packet mbuf.
> > >   */
> > >  struct __rte_cache_aligned rte_mbuf {
> > > -	RTE_MARKER cacheline0;
> > > -
> > >  	void *buf_addr;           /**< Virtual address of segment buffer. */
> > >  #if RTE_IOVA_IN_MBUF
> > >  	/**
> > > @@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {
> > >  #endif
> > >
> > >  	/* next 8 bytes are initialised on RX descriptor rearm */
> > > -	RTE_MARKER64 rearm_data;
> > > -	uint16_t data_off;
> > > -
> > > -	/**
> > > -	 * Reference counter. Its size should at least equal to the size
> > > -	 * of port field (16 bits), to support zero-copy broadcast.
> > > -	 * It should only be accessed using the following functions:
> > > -	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> > > -	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
> > > -	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
> > > -	 */
> > > -	RTE_ATOMIC(uint16_t) refcnt;
> > > +	union {
> > > +		uint64_t rearm_data[1];
> > > +		__extension__
> > > +		struct {
> > > +			uint16_t data_off;
> > > +
> > > +			/**
> > > +			 * Reference counter. Its size should at least equal to
> the size
> > > +			 * of port field (16 bits), to support zero-copy
> broadcast.
> > > +			 * It should only be accessed using the following
> functions:
> > > +			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> > > +			 * rte_mbuf_refcnt_set(). The functionality of these
> functions (atomic,
> > > +			 * or non-atomic) is controlled by the
> RTE_MBUF_REFCNT_ATOMIC flag.
> > > +			 */
> > > +			RTE_ATOMIC(uint16_t) refcnt;
> > >
> > > -	/**
> > > -	 * Number of segments. Only valid for the first segment of an mbuf
> > > -	 * chain.
> > > -	 */
> > > -	uint16_t nb_segs;
> > > +			/**
> > > +			 * Number of segments. Only valid for the first segment of
> an mbuf
> > > +			 * chain.
> > > +			 */
> > > +			uint16_t nb_segs;
> > >
> > > -	/** Input port (16 bits to support more than 256 virtual ports).
> > > -	 * The event eth Tx adapter uses this field to specify the output port.
> > > -	 */
> > > -	uint16_t port;
> > > +			/** Input port (16 bits to support more than 256 virtual
> ports).
> > > +			 * The event eth Tx adapter uses this field to specify the
> output port.
> > > +			 */
> > > +			uint16_t port;
> > > +		};
> > > +	};
> > >
> > >  	uint64_t ol_flags;        /**< Offload features. */
> > >
> > >  	/* remaining bytes are set on RX when pulling packet from descriptor */
> > > -	RTE_MARKER rx_descriptor_fields1;
> > > -
> > > -	/*
> > > -	 * The packet type, which is the combination of outer/inner L2, L3, L4
> > > -	 * and tunnel types. The packet_type is about data really present in the
> > > -	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
> > > -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
> > > -	 * vlan is stripped from the data.
> > > -	 */
> > >  	union {
> > > -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
> > > +		void *rx_descriptor_fields1[1];
> >
> > Can we make this array the actual size of all the fields, rather than just
> > an 8-byte value? That would allow the right think to be done if assigning
> > the descriptor fields from one mbuf to another, or when using memset or
> > memcpy on them.
> 
> Morten pointed out in a previous version that the marker being an array of
> void * was a bug to begin with.
> 
> The other field of the union is 24 bytes. I suppose it would be possible
> to conditionally compile the array to be either 3 or 6 elements. I guess
> this would be an improvement over what the marker is doing now.

Agree; it would be an improvement to give it the same size as the other struct in the union.

> 
> Just a reminder that we cannot 'correct' the type since that would
> require adaptation of calling code.

I considered the following:
Only drivers should be using rx_descriptor_fields1.
We could probably change it to an array of uint64_t (or uint32_t, or even uint8_t) without breaking anything, because the drivers should only be using the address of rx_descriptor_fields1, not the value of it.
However, keeping it an array of void* is certain to avoid any 32/64 bit CPU alignment related issues, because void* is the natural size to any CPU.

> 
> What do others think? Keep it as a single element array or conditional
> compile based on sizeof(void *)?

Going for an array of 3/6 void pointers should be safe. I'm in favor of this.

At your discretion, if you think it clarifies anything, consider adding a comment that the type void* is used for historical reasons (or something similar).


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v7 1/4] net/i40e: use inline prefetch function
  2024-03-20 22:01   ` [PATCH v7 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
@ 2024-03-26 10:16     ` Morten Brørup
  2024-03-27 18:14       ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-03-26 10:16 UTC (permalink / raw)
  To: Tyler Retzlaff, dev, Yuying Zhang
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 20 March 2024 23.02
> 
> Don't directly access the cacheline1 field in rte_mbuf struct for
> prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> index f3050cd..0238b03 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> @@ -826,7 +826,7 @@
>  		free[0] = m;
>  		nb_free = 1;
>  		for (i = 1; i < n; i++) {
> -			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> +			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);

@Yuying Zhang:
If this prefetch is for m->next, I think it can be omitted if m->next is in the first cache line:

-			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+#if RTE_IOVA_IN_MBUF
+			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
+#endif

If so, it belongs in a separate patch anyway.

>  			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
>  			if (likely(m)) {
>  				if (likely(m->pool == free[0]->pool)) {
> --
> 1.8.3.1

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v7 3/4] security: remove rte marker fields
  2024-03-20 22:01   ` [PATCH v7 3/4] security: " Tyler Retzlaff
@ 2024-03-26 10:28     ` Morten Brørup
  2024-03-27 19:59       ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-03-26 10:28 UTC (permalink / raw)
  To: Tyler Retzlaff, dev, Akhil Goyal, Anoob Joseph
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 20 March 2024 23.02
> 
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  doc/guides/rel_notes/release_24_03.rst | 3 +++
>  lib/security/rte_security_driver.h     | 5 +++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_24_03.rst
> b/doc/guides/rel_notes/release_24_03.rst
> index 4f18cca..75d40d4 100644
> --- a/doc/guides/rel_notes/release_24_03.rst
> +++ b/doc/guides/rel_notes/release_24_03.rst
> @@ -219,6 +219,9 @@ Removed Items
>  * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
>    have been removed from ``struct rte_mbuf``.
> 
> +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
> +  have been removed from ``struct rte_security_session``.
> +
>  API Changes
>  -----------
> 
> diff --git a/lib/security/rte_security_driver.h
> b/lib/security/rte_security_driver.h
> index 09829ab..18a1e3c 100644
> --- a/lib/security/rte_security_driver.h
> +++ b/lib/security/rte_security_driver.h
> @@ -12,6 +12,8 @@
>   * RTE Security Common Definitions
>   */
> 
> +#include <stdalign.h>
> +
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
> @@ -24,7 +26,6 @@
>   * Security session to be used by library for internal usage
>   */
>  struct rte_security_session {
> -	RTE_MARKER cacheline0;
>  	uint64_t opaque_data;
>  	/**< Opaque user defined data */
>  	uint64_t fast_mdata;
> @@ -32,7 +33,7 @@ struct rte_security_session {
>  	rte_iova_t driver_priv_data_iova;
>  	/**< session private data IOVA address */
> 
> -	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
> +	alignas(RTE_CACHE_LINE_MIN_SIZE)
>  	uint8_t driver_priv_data[];
>  	/**< Private session material, variable size (depends on driver)
> */
>  };
> --
> 1.8.3.1

No explicit alignment was ever specified for the struct rte_security_session itself. I wonder which implicit alignment applies to it.

Anyway, the changes are correct, so
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v7 4/4] cryptodev: remove rte marker fields
  2024-03-20 22:01   ` [PATCH v7 4/4] cryptodev: " Tyler Retzlaff
@ 2024-03-26 10:31     ` Morten Brørup
  0 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-03-26 10:31 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 20 March 2024 23.02
> 
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  doc/guides/rel_notes/release_24_03.rst | 3 +++
>  lib/cryptodev/cryptodev_pmd.h          | 5 +++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_24_03.rst
> b/doc/guides/rel_notes/release_24_03.rst
> index 75d40d4..d3e5abe 100644
> --- a/doc/guides/rel_notes/release_24_03.rst
> +++ b/doc/guides/rel_notes/release_24_03.rst
> @@ -222,6 +222,9 @@ Removed Items
>  * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
>    have been removed from ``struct rte_security_session``.
> 
> +* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
> +  have been removed from ``struct cryptodev_driver``.
> +
>  API Changes
>  -----------
> 
> diff --git a/lib/cryptodev/cryptodev_pmd.h
> b/lib/cryptodev/cryptodev_pmd.h
> index d195b81..9daf129 100644
> --- a/lib/cryptodev/cryptodev_pmd.h
> +++ b/lib/cryptodev/cryptodev_pmd.h
> @@ -5,6 +5,8 @@
>  #ifndef _CRYPTODEV_PMD_H_
>  #define _CRYPTODEV_PMD_H_
> 
> +#include <stdalign.h>
> +
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
> @@ -139,7 +141,6 @@ struct cryptodev_driver {
>   * has a fixed algo, key, op-type, digest_len etc.
>   */
>  struct rte_cryptodev_sym_session {
> -	RTE_MARKER cacheline0;
>  	uint64_t opaque_data;
>  	/**< Can be used for external metadata */
>  	uint32_t sess_data_sz;
> @@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {
>  	rte_iova_t driver_priv_data_iova;
>  	/**< Session driver data IOVA address */
> 
> -	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
> +	alignas(RTE_CACHE_LINE_MIN_SIZE)
>  	/**< Second cache line - start of the driver session data */
>  	uint8_t driver_priv_data[];
>  	/**< Driver specific session data, variable size */
> --
> 1.8.3.1

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v7 2/4] mbuf: remove rte marker fields
  2024-03-20 22:01   ` [PATCH v7 2/4] mbuf: remove rte marker fields Tyler Retzlaff
  2024-03-21 10:32     ` Bruce Richardson
@ 2024-03-26 11:12     ` Morten Brørup
  1 sibling, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-03-26 11:12 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 20 March 2024 23.02
> 
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> unions as single element arrays of with types matching the original
> markers to maintain API compatibility.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

I agree with the concepts in this patch.
A few comments inline below.

> ---
>  doc/guides/rel_notes/release_24_03.rst |   2 +
>  lib/mbuf/rte_mbuf.h                    |   4 +-
>  lib/mbuf/rte_mbuf_core.h               | 188 ++++++++++++++++++--------
> -------
>  3 files changed, 104 insertions(+), 90 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_24_03.rst
> b/doc/guides/rel_notes/release_24_03.rst
> index 14826ea..4f18cca 100644
> --- a/doc/guides/rel_notes/release_24_03.rst
> +++ b/doc/guides/rel_notes/release_24_03.rst
> @@ -216,6 +216,8 @@ Removed Items
> 
>  * acc101: Removed obsolete code for non productized HW variant.
> 
> +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
> +  have been removed from ``struct rte_mbuf``.
> 
>  API Changes
>  -----------
> diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> index 286b32b..4c4722e 100644
> --- a/lib/mbuf/rte_mbuf.h
> +++ b/lib/mbuf/rte_mbuf.h
> @@ -108,7 +108,7 @@
>  static inline void
>  rte_mbuf_prefetch_part1(struct rte_mbuf *m)
>  {
> -	rte_prefetch0(&m->cacheline0);
> +	rte_prefetch0(m);
>  }
> 
>  /**
> @@ -126,7 +126,7 @@
>  rte_mbuf_prefetch_part2(struct rte_mbuf *m)
>  {
>  #if RTE_CACHE_LINE_SIZE == 64
> -	rte_prefetch0(&m->cacheline1);
> +	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
>  #else
>  	RTE_SET_USED(m);
>  #endif
> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
> index 9f58076..665213c 100644
> --- a/lib/mbuf/rte_mbuf_core.h
> +++ b/lib/mbuf/rte_mbuf_core.h
> @@ -465,8 +465,6 @@ enum {
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
>  struct __rte_cache_aligned rte_mbuf {
> -	RTE_MARKER cacheline0;
> -
>  	void *buf_addr;           /**< Virtual address of segment buffer.
> */
>  #if RTE_IOVA_IN_MBUF
>  	/**
> @@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {
>  #endif
> 
>  	/* next 8 bytes are initialised on RX descriptor rearm */
> -	RTE_MARKER64 rearm_data;
> -	uint16_t data_off;
> -
> -	/**
> -	 * Reference counter. Its size should at least equal to the size
> -	 * of port field (16 bits), to support zero-copy broadcast.
> -	 * It should only be accessed using the following functions:
> -	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
> -	 * rte_mbuf_refcnt_set(). The functionality of these functions
> (atomic,
> -	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC
> flag.
> -	 */
> -	RTE_ATOMIC(uint16_t) refcnt;
> +	union {
> +		uint64_t rearm_data[1];
> +		__extension__
> +		struct {
> +			uint16_t data_off;
> +
> +			/**
> +			 * Reference counter. Its size should at least equal
> to the size
> +			 * of port field (16 bits), to support zero-copy
> broadcast.
> +			 * It should only be accessed using the following
> functions:
> +			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(),
> and
> +			 * rte_mbuf_refcnt_set(). The functionality of these
> functions (atomic,
> +			 * or non-atomic) is controlled by the
> RTE_MBUF_REFCNT_ATOMIC flag.
> +			 */
> +			RTE_ATOMIC(uint16_t) refcnt;
> 
> -	/**
> -	 * Number of segments. Only valid for the first segment of an mbuf
> -	 * chain.
> -	 */
> -	uint16_t nb_segs;
> +			/**
> +			 * Number of segments. Only valid for the first
> segment of an mbuf
> +			 * chain.
> +			 */
> +			uint16_t nb_segs;
> 
> -	/** Input port (16 bits to support more than 256 virtual ports).
> -	 * The event eth Tx adapter uses this field to specify the output
> port.
> -	 */
> -	uint16_t port;
> +			/** Input port (16 bits to support more than 256
> virtual ports).
> +			 * The event eth Tx adapter uses this field to
> specify the output port.
> +			 */
> +			uint16_t port;
> +		};
> +	};
> 
>  	uint64_t ol_flags;        /**< Offload features. */
> 
>  	/* remaining bytes are set on RX when pulling packet from
> descriptor */
> -	RTE_MARKER rx_descriptor_fields1;
> -
> -	/*
> -	 * The packet type, which is the combination of outer/inner L2,
> L3, L4
> -	 * and tunnel types. The packet_type is about data really present
> in the
> -	 * mbuf. Example: if vlan stripping is enabled, a received vlan
> packet
> -	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because
> the
> -	 * vlan is stripped from the data.
> -	 */
>  	union {
> -		uint32_t packet_type; /**< L2/L3/L4 and tunnel information.
> */
> +		void *rx_descriptor_fields1[1];

(As suggested by Bruce, and already discussed, please make this array 3/6 elements.)

>  		__extension__
>  		struct {
> -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> -			uint8_t tun_type:4;  /**< Tunnel type. */
> +			/*
> +			 * The packet type, which is the combination of
> outer/inner L2, L3, L4
> +			 * and tunnel types. The packet_type is about data
> really present in the
> +			 * mbuf. Example: if vlan stripping is enabled, a
> received vlan packet
> +			 * would have RTE_PTYPE_L2_ETHER and not
> RTE_PTYPE_L2_VLAN because the
> +			 * vlan is stripped from the data.
> +			 */
>  			union {
> -				uint8_t inner_esp_next_proto;
> -				/**< ESP next protocol type, valid if
> -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> -				 * on both Tx and Rx.
> -				 */
> +				uint32_t packet_type; /**< L2/L3/L4 and tunnel
> information. */
>  				__extension__
>  				struct {
> -					uint8_t inner_l2_type:4;
> -					/**< Inner L2 type. */
> -					uint8_t inner_l3_type:4;
> -					/**< Inner L3 type. */
> +					uint8_t l2_type:4;   /**< (Outer) L2
> type. */
> +					uint8_t l3_type:4;   /**< (Outer) L3
> type. */
> +					uint8_t l4_type:4;   /**< (Outer) L4
> type. */
> +					uint8_t tun_type:4;  /**< Tunnel type. */
> +					union {
> +						uint8_t inner_esp_next_proto;
> +						/**< ESP next protocol type, valid
> if
> +						 * RTE_PTYPE_TUNNEL_ESP tunnel type
> is set
> +						 * on both Tx and Rx.
> +						 */

If the comment describing the field doesn't fit on the same line as the field, please put the description before the field, not after it.

This applies to many more field descriptions in the rte_mbuf structure.

Please note that multiple field's descriptions were also "after" before this patch, so perhaps the descriptions should be moved around in a preceding patch. Or not at all, if minimal changes are preferred.
I wouldn't mind moving them with this patch, but some people prefer multiple smaller patches for separate changes.

> +						__extension__
> +						struct {
> +							uint8_t inner_l2_type:4;
> +							/**< Inner L2 type. */
> +							uint8_t inner_l3_type:4;
> +							/**< Inner L3 type. */
> +						};
> +					};
> +					uint8_t inner_l4_type:4; /**< Inner L4
> type. */
>  				};
>  			};
> -			uint8_t inner_l4_type:4; /**< Inner L4 type. */
> -		};
> -	};
> 
> -	uint32_t pkt_len;         /**< Total pkt len: sum of all segments.
> */
> -	uint16_t data_len;        /**< Amount of data in segment buffer.
> */
> -	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
> -	uint16_t vlan_tci;
> +			/*
> +			 * pkt_len is not actually part of
> rx_descriptor_fields1
> +			 * but is included here to account for changes in
> alignment
> +			 * and offset for void * on 32-bit vs 64-bit targets.
> +			 */

I disagree with this comment.
For non-segmented packets, it is part of rx_descriptor_fields1.
Also, the high-level comment says "/* remaining bytes are set on RX when pulling packet from descriptor */", which also covers the pkt_len field.
I think you should not add the comment.

> +			uint32_t pkt_len;         /**< Total pkt len: sum of
> all segments. */
> 
> -	union {
> -		union {
> -			uint32_t rss;     /**< RSS hash result if RSS enabled
> */
> -			struct {
> +			uint16_t data_len;        /**< Amount of data in
> segment buffer. */
> +			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN
> is set. */
> +			uint16_t vlan_tci;
> +
> +			union {
>  				union {
> +					uint32_t rss;     /**< RSS hash result if
> RSS enabled */
>  					struct {
> -						uint16_t hash;
> -						uint16_t id;
> -					};
> -					uint32_t lo;
> -					/**< Second 4 flexible bytes */
> -				};
> -				uint32_t hi;
> -				/**< First 4 flexible bytes or FD ID, dependent
> -				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
> -				 */
> -			} fdir;	/**< Filter identifier if FDIR enabled */
> -			struct rte_mbuf_sched sched;
> -			/**< Hierarchical scheduler : 8 bytes */
> -			struct {
> -				uint32_t reserved1;
> -				uint16_t reserved2;
> -				uint16_t txq;
> -				/**< The event eth Tx adapter uses this field
> -				 * to store Tx queue id.
> -				 * @see rte_event_eth_tx_adapter_txq_set()
> -				 */
> -			} txadapter; /**< Eventdev ethdev Tx adapter */
> -			uint32_t usr;
> -			/**< User defined tags. See rte_distributor_process()
> */
> -		} hash;                   /**< hash information */
> -	};
> +						union {
> +							struct {
> +								uint16_t hash;
> +								uint16_t id;
> +							};
> +							uint32_t lo;
> +							/**< Second 4 flexible bytes
> */
> +						};
> +						uint32_t hi;
> +						/**< First 4 flexible bytes or FD
> ID, dependent
> +						 * on RTE_MBUF_F_RX_FDIR_* flag in
> ol_flags.
> +						 */
> +					} fdir;	/**< Filter identifier if
> FDIR enabled */
> +					struct rte_mbuf_sched sched;
> +					/**< Hierarchical scheduler : 8 bytes */
> +					struct {
> +						uint32_t reserved1;
> +						uint16_t reserved2;
> +						uint16_t txq;
> +						/**< The event eth Tx adapter uses
> this field
> +						 * to store Tx queue id.
> +						 * @see
> rte_event_eth_tx_adapter_txq_set()
> +						 */
> +					} txadapter; /**< Eventdev ethdev Tx
> adapter */
> +					uint32_t usr;
> +					/**< User defined tags. See
> rte_distributor_process() */
> +				} hash;                   /**< hash information
> */
> +			};
> 
> -	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is
> set. */
> -	uint16_t vlan_tci_outer;
> +			/** Outer VLAN TCI (CPU order), valid if
> RTE_MBUF_F_RX_QINQ is set. */
> +			uint16_t vlan_tci_outer;
> 
> -	uint16_t buf_len;         /**< Length of segment buffer. */
> +			uint16_t buf_len;         /**< Length of segment
> buffer. */
> +		};
> +	};
> 
>  	struct rte_mempool *pool; /**< Pool from which mbuf was allocated.
> */
> 
>  	/* second cache line - fields only used in slow path or on TX */
> -	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
> -
> +	alignas(RTE_CACHE_LINE_MIN_SIZE)

I strongly prefer having this alignas() immediately preceding the field it applies to; otherwise it might be overlooked.
I.e. both after #if RTE_IOVA_IN_MBUF and #else, instead of only before #if RTE_IOVA_IN_MBUF.

>  #if RTE_IOVA_IN_MBUF
>  	/**
>  	 * Next segment of scattered packet. Must be NULL in the last
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v7 1/4] net/i40e: use inline prefetch function
  2024-03-26 10:16     ` Morten Brørup
@ 2024-03-27 18:14       ` Tyler Retzlaff
  2024-03-27 19:45         ` Morten Brørup
  0 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 18:14 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Yuying Zhang, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang

On Tue, Mar 26, 2024 at 11:16:10AM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Wednesday, 20 March 2024 23.02
> > 
> > Don't directly access the cacheline1 field in rte_mbuf struct for
> > prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > index f3050cd..0238b03 100644
> > --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > @@ -826,7 +826,7 @@
> >  		free[0] = m;
> >  		nb_free = 1;
> >  		for (i = 1; i < n; i++) {
> > -			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> > +			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
> 
> @Yuying Zhang:
> If this prefetch is for m->next, I think it can be omitted if m->next is in the first cache line:
> 
> -			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> +#if RTE_IOVA_IN_MBUF
> +			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
> +#endif

Yuying Zhang any reply here to confirm?

If not I will leave it unconditionally prefetch.

> 
> If so, it belongs in a separate patch anyway.
> 
> >  			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
> >  			if (likely(m)) {
> >  				if (likely(m->pool == free[0]->pool)) {
> > --
> > 1.8.3.1
> 
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v7 1/4] net/i40e: use inline prefetch function
  2024-03-27 18:14       ` Tyler Retzlaff
@ 2024-03-27 19:45         ` Morten Brørup
  0 siblings, 0 replies; 171+ messages in thread
From: Morten Brørup @ 2024-03-27 19:45 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Yuying Zhang, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 27 March 2024 19.15
> 
> On Tue, Mar 26, 2024 at 11:16:10AM +0100, Morten Brørup wrote:
> > > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > > Sent: Wednesday, 20 March 2024 23.02
> > >
> > > Don't directly access the cacheline1 field in rte_mbuf struct for
> > > prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
> > >
> > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > >  drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > > b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > > index f3050cd..0238b03 100644
> > > --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > > +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > > @@ -826,7 +826,7 @@
> > >  		free[0] = m;
> > >  		nb_free = 1;
> > >  		for (i = 1; i < n; i++) {
> > > -			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> > > +			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
> >
> > @Yuying Zhang:
> > If this prefetch is for m->next, I think it can be omitted if m->next
> is in the first cache line:
> >
> > -			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
> > +#if RTE_IOVA_IN_MBUF
> > +			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
> > +#endif
> 
> Yuying Zhang any reply here to confirm?
> 
> If not I will leave it unconditionally prefetch.

I think you should leave it unconditionally prefetch under all circumstances.

An optimization to omit it (if it can be conditionally omitted) belongs in a separate patch. Also, Intel might want to test and document the performance improvement of such a patch.

> 
> >
> > If so, it belongs in a separate patch anyway.
> >
> > >  			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
> > >  			if (likely(m)) {
> > >  				if (likely(m->pool == free[0]->pool)) {
> > > --
> > > 1.8.3.1
> >
> > Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v8 0/4] remove use of RTE_MARKER fields in libraries
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
                   ` (4 preceding siblings ...)
  2024-03-20 22:01 ` [PATCH v7 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-03-27 19:56 ` Tyler Retzlaff
  2024-03-27 19:56   ` [PATCH v8 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
                     ` (3 more replies)
  2024-04-02 20:08 ` [PATCH v9 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
                   ` (2 subsequent siblings)
  8 siblings, 4 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 19:56 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

As per techboard meeting 2024/03/20 adopt hybrid proposal of adapting
descriptor fields and removing cachline fields.

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields.

For cacheline{0,1} fields remove fields entirely and use inline
functions to prefetch.

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

Note: diff is easier viewed with -b due to additional nesting from
      unions / structs that have been introduced.

v8:
  * rx_descriptor_fields1 array is now constexpr sized to
    24 / sizeof(void *) so that the array encompasses fields
    accessed via the array.
  * add a comment to rx_descriptor_fields1 array site noting
    that void * type of elements is retained for compatibility
    with existing drivers.
  * clean up comments of fields in rte_mbuf to be before the
    field they apply to instead of after.
  * duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of
    conditional compile for first field of cacheline 1 instead of
    once before conditional compile block.

v7:
  * complete re-write of series, previous versions not noted. all
    reviewed-by and acked-by tags (if any) were removed.

Tyler Retzlaff (4):
  net/i40e: use inline prefetch function
  mbuf: remove rte marker fields
  security: remove rte marker fields
  cryptodev: remove rte marker fields

 doc/guides/rel_notes/release_24_03.rst  |   8 ++
 drivers/net/i40e/i40e_rxtx_vec_avx512.c |   2 +-
 lib/cryptodev/cryptodev_pmd.h           |   5 +-
 lib/mbuf/rte_mbuf.h                     |   4 +-
 lib/mbuf/rte_mbuf_core.h                | 200 +++++++++++++++++---------------
 lib/security/rte_security_driver.h      |   5 +-
 6 files changed, 121 insertions(+), 103 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v8 1/4] net/i40e: use inline prefetch function
  2024-03-27 19:56 ` [PATCH v8 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-03-27 19:56   ` Tyler Retzlaff
  2024-03-27 19:56   ` [PATCH v8 2/4] mbuf: remove rte marker fields Tyler Retzlaff
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 19:56 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Don't directly access the cacheline1 field in rte_mbuf struct for
prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index f3050cd..0238b03 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -826,7 +826,7 @@
 		free[0] = m;
 		nb_free = 1;
 		for (i = 1; i < n; i++) {
-			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
 			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
 			if (likely(m)) {
 				if (likely(m->pool == free[0]->pool)) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v8 2/4] mbuf: remove rte marker fields
  2024-03-27 19:56 ` [PATCH v8 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-03-27 19:56   ` [PATCH v8 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
@ 2024-03-27 19:56   ` Tyler Retzlaff
  2024-03-27 19:56   ` [PATCH v8 3/4] security: " Tyler Retzlaff
  2024-03-27 19:56   ` [PATCH v8 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 19:56 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 doc/guides/rel_notes/release_24_03.rst |   2 +
 lib/mbuf/rte_mbuf.h                    |   4 +-
 lib/mbuf/rte_mbuf_core.h               | 200 +++++++++++++++++----------------
 3 files changed, 108 insertions(+), 98 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 34d7bad..a82bb4f 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -216,6 +216,8 @@ Removed Items
 
 * acc101: Removed obsolete code for non productized HW variant.
 
+* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_mbuf``.
 
 API Changes
 -----------
diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 286b32b..4c4722e 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -108,7 +108,7 @@
 static inline void
 rte_mbuf_prefetch_part1(struct rte_mbuf *m)
 {
-	rte_prefetch0(&m->cacheline0);
+	rte_prefetch0(m);
 }
 
 /**
@@ -126,7 +126,7 @@
 rte_mbuf_prefetch_part2(struct rte_mbuf *m)
 {
 #if RTE_CACHE_LINE_SIZE == 64
-	rte_prefetch0(&m->cacheline1);
+	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
 #else
 	RTE_SET_USED(m);
 #endif
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 9f58076..9d838b8 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -465,8 +465,6 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct __rte_cache_aligned rte_mbuf {
-	RTE_MARKER cacheline0;
-
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
 	/**
@@ -488,127 +486,138 @@ struct __rte_cache_aligned rte_mbuf {
 #endif
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
+	union {
+		uint64_t rearm_data[1];
+		__extension__
+		struct {
+			uint16_t data_off;
+
+			/**
+			 * Reference counter. Its size should at least equal to the size
+			 * of port field (16 bits), to support zero-copy broadcast.
+			 * It should only be accessed using the following functions:
+			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
+			 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
+			 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
+			 */
+			RTE_ATOMIC(uint16_t) refcnt;
 
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
+			/**
+			 * Number of segments. Only valid for the first segment of an mbuf
+			 * chain.
+			 */
+			uint16_t nb_segs;
 
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
+			/** Input port (16 bits to support more than 256 virtual ports).
+			 * The event eth Tx adapter uses this field to specify the output port.
+			 */
+			uint16_t port;
+		};
+	};
 
 	uint64_t ol_flags;        /**< Offload features. */
 
-	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
-
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
+	/* remaining 24 bytes are set on RX when pulling packet from descriptor */
 	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
+		/* void * type of the array elements is retained for driver compatibility. */
+		void *rx_descriptor_fields1[24 / sizeof(void *)];
 		__extension__
 		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
+			/*
+			 * The packet type, which is the combination of outer/inner L2, L3, L4
+			 * and tunnel types. The packet_type is about data really present in the
+			 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
+			 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
+			 * vlan is stripped from the data.
+			 */
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
-				 */
+				uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
 				__extension__
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					uint8_t l2_type:4;   /**< (Outer) L2 type. */
+					uint8_t l3_type:4;   /**< (Outer) L3 type. */
+					uint8_t l4_type:4;   /**< (Outer) L4 type. */
+					uint8_t tun_type:4;  /**< Tunnel type. */
+					union {
+						/**< ESP next protocol type, valid if
+						 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
+						 * on both Tx and Rx.
+						 */
+						uint8_t inner_esp_next_proto;
+						__extension__
+						struct {
+							/**< Inner L2 type. */
+							uint8_t inner_l2_type:4;
+							/**< Inner L3 type. */
+							uint8_t inner_l3_type:4;
+						};
+					};
+					uint8_t inner_l4_type:4; /**< Inner L4 type. */
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
-		};
-	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-	uint16_t data_len;        /**< Amount of data in segment buffer. */
-	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
-	uint16_t vlan_tci;
+			uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
 
-	union {
-		union {
-			uint32_t rss;     /**< RSS hash result if RSS enabled */
-			struct {
+			uint16_t data_len;        /**< Amount of data in segment buffer. */
+			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
+			uint16_t vlan_tci;
+
+			union {
 				union {
+					uint32_t rss;     /**< RSS hash result if RSS enabled */
 					struct {
-						uint16_t hash;
-						uint16_t id;
-					};
-					uint32_t lo;
-					/**< Second 4 flexible bytes */
-				};
-				uint32_t hi;
-				/**< First 4 flexible bytes or FD ID, dependent
-				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
-				 */
-			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched sched;
-			/**< Hierarchical scheduler : 8 bytes */
-			struct {
-				uint32_t reserved1;
-				uint16_t reserved2;
-				uint16_t txq;
-				/**< The event eth Tx adapter uses this field
-				 * to store Tx queue id.
-				 * @see rte_event_eth_tx_adapter_txq_set()
-				 */
-			} txadapter; /**< Eventdev ethdev Tx adapter */
-			uint32_t usr;
-			/**< User defined tags. See rte_distributor_process() */
-		} hash;                   /**< hash information */
-	};
+						union {
+							struct {
+								uint16_t hash;
+								uint16_t id;
+							};
+							/**< Second 4 flexible bytes */
+							uint32_t lo;
+						};
+						/**< First 4 flexible bytes or FD ID, dependent
+						 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
+						 */
+						uint32_t hi;
+					} fdir;	/**< Filter identifier if FDIR enabled */
+					struct rte_mbuf_sched sched;
+					/**< Hierarchical scheduler : 8 bytes */
+					struct {
+						uint32_t reserved1;
+						uint16_t reserved2;
+						/**< The event eth Tx adapter uses this field
+						 * to store Tx queue id.
+						 * @see rte_event_eth_tx_adapter_txq_set()
+						 */
+						uint16_t txq;
+					} txadapter; /**< Eventdev ethdev Tx adapter */
+					/**< User defined tags. See rte_distributor_process() */
+					uint32_t usr;
+				} hash;                   /**< hash information */
+			};
 
-	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
-	uint16_t vlan_tci_outer;
+			/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
+			uint16_t vlan_tci_outer;
 
-	uint16_t buf_len;         /**< Length of segment buffer. */
+			uint16_t buf_len;         /**< Length of segment buffer. */
+		};
+	};
 
 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
-
 #if RTE_IOVA_IN_MBUF
 	/**
 	 * Next segment of scattered packet. Must be NULL in the last
 	 * segment or in case of non-segmented packet.
 	 */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	struct rte_mbuf *next;
 #else
 	/**
 	 * Reserved for dynamic fields
 	 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
 	 */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint64_t dynfield2;
 #endif
 
@@ -617,17 +626,16 @@ struct __rte_cache_aligned rte_mbuf {
 		uint64_t tx_offload;       /**< combined for easy fetch */
 		__extension__
 		struct {
-			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
 			/**< L2 (MAC) Header Length for non-tunneling pkt.
 			 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
 			 */
-			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
+			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
 			/**< L3 (IP) Header Length. */
-			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
+			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
 			/**< L4 (TCP/UDP) Header Length. */
-			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
+			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
 			/**< TCP TSO segment size */
-
+			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
 			/*
 			 * Fields for Tx offloading of tunnels.
 			 * These are undefined for packets which don't request
@@ -640,10 +648,10 @@ struct __rte_cache_aligned rte_mbuf {
 			 * Applications are expected to set appropriate tunnel
 			 * offload flags when they fill in these fields.
 			 */
-			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
 			/**< Outer L3 (IP) Hdr Length. */
-			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
+			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
 			/**< Outer L2 (MAC) Hdr Length. */
+			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
 
 			/* uint64_t unused:RTE_MBUF_TXOFLD_UNUSED_BITS; */
 		};
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v8 3/4] security: remove rte marker fields
  2024-03-27 19:56 ` [PATCH v8 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-03-27 19:56   ` [PATCH v8 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
  2024-03-27 19:56   ` [PATCH v8 2/4] mbuf: remove rte marker fields Tyler Retzlaff
@ 2024-03-27 19:56   ` Tyler Retzlaff
  2024-03-27 19:56   ` [PATCH v8 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 19:56 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 lib/security/rte_security_driver.h     | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index a82bb4f..83ceea7 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -219,6 +219,9 @@ Removed Items
 * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_mbuf``.
 
+* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_security_session``.
+
 API Changes
 -----------
 
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index 09829ab..18a1e3c 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -12,6 +12,8 @@
  * RTE Security Common Definitions
  */
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,7 +26,6 @@
  * Security session to be used by library for internal usage
  */
 struct rte_security_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Opaque user defined data */
 	uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< session private data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint8_t driver_priv_data[];
 	/**< Private session material, variable size (depends on driver) */
 };
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v8 4/4] cryptodev: remove rte marker fields
  2024-03-27 19:56 ` [PATCH v8 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-03-27 19:56   ` [PATCH v8 3/4] security: " Tyler Retzlaff
@ 2024-03-27 19:56   ` Tyler Retzlaff
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 19:56 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 lib/cryptodev/cryptodev_pmd.h          | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 83ceea7..98ab3cd 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -222,6 +222,9 @@ Removed Items
 * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_security_session``.
 
+* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct cryptodev_driver``.
+
 API Changes
 -----------
 
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index d195b81..9daf129 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -5,6 +5,8 @@
 #ifndef _CRYPTODEV_PMD_H_
 #define _CRYPTODEV_PMD_H_
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Can be used for external metadata */
 	uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< Session driver data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	/**< Second cache line - start of the driver session data */
 	uint8_t driver_priv_data[];
 	/**< Driver specific session data, variable size */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v7 3/4] security: remove rte marker fields
  2024-03-26 10:28     ` Morten Brørup
@ 2024-03-27 19:59       ` Tyler Retzlaff
  0 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-03-27 19:59 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Akhil Goyal, Anoob Joseph, Ajit Khaparde, Andrew Boyer,
	Andrew Rybchenko, Bruce Richardson, Chenbo Xia, Chengwen Feng,
	Dariusz Sosnowski, David Christensen, Hyong Youb Kim,
	Jerin Jacob, Jie Hai, Jingjing Wu, John Daley, Kevin Laatz,
	Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj, Matan Azrad,
	Maxime Coquelin, Nithin Dabilpuram, Ori Kam, Ruifeng Wang,
	Satha Rao, Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang

On Tue, Mar 26, 2024 at 11:28:21AM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Wednesday, 20 March 2024 23.02
> > 
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > RTE_MARKER fields from rte_mbuf struct.
> > 
> > Maintain alignment of fields after removed cacheline1 marker by placing
> > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  doc/guides/rel_notes/release_24_03.rst | 3 +++
> >  lib/security/rte_security_driver.h     | 5 +++--
> >  2 files changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/doc/guides/rel_notes/release_24_03.rst
> > b/doc/guides/rel_notes/release_24_03.rst
> > index 4f18cca..75d40d4 100644
> > --- a/doc/guides/rel_notes/release_24_03.rst
> > +++ b/doc/guides/rel_notes/release_24_03.rst
> > @@ -219,6 +219,9 @@ Removed Items
> >  * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
> >    have been removed from ``struct rte_mbuf``.
> > 
> > +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
> > +  have been removed from ``struct rte_security_session``.
> > +
> >  API Changes
> >  -----------
> > 
> > diff --git a/lib/security/rte_security_driver.h
> > b/lib/security/rte_security_driver.h
> > index 09829ab..18a1e3c 100644
> > --- a/lib/security/rte_security_driver.h
> > +++ b/lib/security/rte_security_driver.h
> > @@ -12,6 +12,8 @@
> >   * RTE Security Common Definitions
> >   */
> > 
> > +#include <stdalign.h>
> > +
> >  #ifdef __cplusplus
> >  extern "C" {
> >  #endif
> > @@ -24,7 +26,6 @@
> >   * Security session to be used by library for internal usage
> >   */
> >  struct rte_security_session {
> > -	RTE_MARKER cacheline0;
> >  	uint64_t opaque_data;
> >  	/**< Opaque user defined data */
> >  	uint64_t fast_mdata;
> > @@ -32,7 +33,7 @@ struct rte_security_session {
> >  	rte_iova_t driver_priv_data_iova;
> >  	/**< session private data IOVA address */
> > 
> > -	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
> > +	alignas(RTE_CACHE_LINE_MIN_SIZE)
> >  	uint8_t driver_priv_data[];
> >  	/**< Private session material, variable size (depends on driver)
> > */
> >  };
> > --
> > 1.8.3.1
> 
> No explicit alignment was ever specified for the struct rte_security_session itself. I wonder which implicit alignment applies to it.

it falls back to standard C. it will be over aligned to the strictest
alignment of any of the struct fields. so it will be aligned to
alignas(RTE_CACHE_LINE_MIN_SIZE).

> 
> Anyway, the changes are correct, so

thanks!

> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v9 0/4] remove use of RTE_MARKER fields in libraries
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
                   ` (5 preceding siblings ...)
  2024-03-27 19:56 ` [PATCH v8 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-04-02 20:08 ` Tyler Retzlaff
  2024-04-02 20:08   ` [PATCH v9 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
                     ` (3 more replies)
  2024-04-03 17:53 ` [PATCH v10 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-04-04 17:51 ` [PATCH v11 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  8 siblings, 4 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-02 20:08 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

As per techboard meeting 2024/03/20 adopt hybrid proposal of adapting
descriptor fields and removing cachline fields.

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields.

For cacheline{0,1} fields remove fields entirely and use inline
functions to prefetch.

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

Note: diff is easier viewed with -b due to additional nesting from
      unions / structs that have been introduced.

v9:
  * provide narrowest possible libabigail.abignore to suppress
    removal of fields that were agreed are not actual abi changes.

v8:
  * rx_descriptor_fields1 array is now constexpr sized to
    24 / sizeof(void *) so that the array encompasses fields
    accessed via the array.
  * add a comment to rx_descriptor_fields1 array site noting
    that void * type of elements is retained for compatibility
    with existing drivers.
  * clean up comments of fields in rte_mbuf to be before the
    field they apply to instead of after.
  * duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of
    conditional compile for first field of cacheline 1 instead of
    once before conditional compile block.

v7:
  * complete re-write of series, previous versions not noted. all
    reviewed-by and acked-by tags (if any) were removed.

Tyler Retzlaff (4):
  net/i40e: use inline prefetch function
  mbuf: remove rte marker fields
  security: remove rte marker fields
  cryptodev: remove rte marker fields

 devtools/libabigail.abignore            |   6 +
 doc/guides/rel_notes/release_24_03.rst  |   8 ++
 drivers/net/i40e/i40e_rxtx_vec_avx512.c |   2 +-
 lib/cryptodev/cryptodev_pmd.h           |   5 +-
 lib/mbuf/rte_mbuf.h                     |   4 +-
 lib/mbuf/rte_mbuf_core.h                | 200 +++++++++++++++++---------------
 lib/security/rte_security_driver.h      |   5 +-
 7 files changed, 127 insertions(+), 103 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v9 1/4] net/i40e: use inline prefetch function
  2024-04-02 20:08 ` [PATCH v9 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-04-02 20:08   ` Tyler Retzlaff
  2024-04-02 20:08   ` [PATCH v9 2/4] mbuf: remove rte marker fields Tyler Retzlaff
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-02 20:08 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Don't directly access the cacheline1 field in rte_mbuf struct for
prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index f3050cd..0238b03 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -826,7 +826,7 @@
 		free[0] = m;
 		nb_free = 1;
 		for (i = 1; i < n; i++) {
-			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
 			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
 			if (likely(m)) {
 				if (likely(m->pool == free[0]->pool)) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v9 2/4] mbuf: remove rte marker fields
  2024-04-02 20:08 ` [PATCH v9 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-04-02 20:08   ` [PATCH v9 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
@ 2024-04-02 20:08   ` Tyler Retzlaff
  2024-04-02 20:45     ` Stephen Hemminger
  2024-04-02 20:08   ` [PATCH v9 3/4] security: " Tyler Retzlaff
  2024-04-02 20:08   ` [PATCH v9 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-02 20:08 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

This change breaks the API for cacheline{0,1} fields that have been
removed from rte_mbuf but it does not break the ABI, to address the
false positives of the removed (but 0 size fields) provide the minimum
libabigail.abignore for type = rte_mbuf.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 devtools/libabigail.abignore           |   6 +
 doc/guides/rel_notes/release_24_03.rst |   2 +
 lib/mbuf/rte_mbuf.h                    |   4 +-
 lib/mbuf/rte_mbuf_core.h               | 200 +++++++++++++++++----------------
 4 files changed, 114 insertions(+), 98 deletions(-)

diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
index 645d289..ad13179 100644
--- a/devtools/libabigail.abignore
+++ b/devtools/libabigail.abignore
@@ -37,3 +37,9 @@
 [suppress_type]
 	name = rte_eth_fp_ops
 	has_data_member_inserted_between = {offset_of(reserved2), end}
+
+[suppress_type]
+	name = rte_mbuf
+	type_kind = struct
+	has_size_change = no
+	has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 013c12f..ffc0d62 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -161,6 +161,8 @@ Removed Items
 
 * acc101: Removed obsolete code for non productized HW variant.
 
+* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_mbuf``.
 
 API Changes
 -----------
diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 286b32b..4c4722e 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -108,7 +108,7 @@
 static inline void
 rte_mbuf_prefetch_part1(struct rte_mbuf *m)
 {
-	rte_prefetch0(&m->cacheline0);
+	rte_prefetch0(m);
 }
 
 /**
@@ -126,7 +126,7 @@
 rte_mbuf_prefetch_part2(struct rte_mbuf *m)
 {
 #if RTE_CACHE_LINE_SIZE == 64
-	rte_prefetch0(&m->cacheline1);
+	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
 #else
 	RTE_SET_USED(m);
 #endif
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 9f58076..9d838b8 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -465,8 +465,6 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct __rte_cache_aligned rte_mbuf {
-	RTE_MARKER cacheline0;
-
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
 	/**
@@ -488,127 +486,138 @@ struct __rte_cache_aligned rte_mbuf {
 #endif
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
+	union {
+		uint64_t rearm_data[1];
+		__extension__
+		struct {
+			uint16_t data_off;
+
+			/**
+			 * Reference counter. Its size should at least equal to the size
+			 * of port field (16 bits), to support zero-copy broadcast.
+			 * It should only be accessed using the following functions:
+			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
+			 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
+			 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
+			 */
+			RTE_ATOMIC(uint16_t) refcnt;
 
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
+			/**
+			 * Number of segments. Only valid for the first segment of an mbuf
+			 * chain.
+			 */
+			uint16_t nb_segs;
 
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
+			/** Input port (16 bits to support more than 256 virtual ports).
+			 * The event eth Tx adapter uses this field to specify the output port.
+			 */
+			uint16_t port;
+		};
+	};
 
 	uint64_t ol_flags;        /**< Offload features. */
 
-	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
-
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
+	/* remaining 24 bytes are set on RX when pulling packet from descriptor */
 	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
+		/* void * type of the array elements is retained for driver compatibility. */
+		void *rx_descriptor_fields1[24 / sizeof(void *)];
 		__extension__
 		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
+			/*
+			 * The packet type, which is the combination of outer/inner L2, L3, L4
+			 * and tunnel types. The packet_type is about data really present in the
+			 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
+			 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
+			 * vlan is stripped from the data.
+			 */
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
-				 */
+				uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
 				__extension__
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					uint8_t l2_type:4;   /**< (Outer) L2 type. */
+					uint8_t l3_type:4;   /**< (Outer) L3 type. */
+					uint8_t l4_type:4;   /**< (Outer) L4 type. */
+					uint8_t tun_type:4;  /**< Tunnel type. */
+					union {
+						/**< ESP next protocol type, valid if
+						 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
+						 * on both Tx and Rx.
+						 */
+						uint8_t inner_esp_next_proto;
+						__extension__
+						struct {
+							/**< Inner L2 type. */
+							uint8_t inner_l2_type:4;
+							/**< Inner L3 type. */
+							uint8_t inner_l3_type:4;
+						};
+					};
+					uint8_t inner_l4_type:4; /**< Inner L4 type. */
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
-		};
-	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-	uint16_t data_len;        /**< Amount of data in segment buffer. */
-	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
-	uint16_t vlan_tci;
+			uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
 
-	union {
-		union {
-			uint32_t rss;     /**< RSS hash result if RSS enabled */
-			struct {
+			uint16_t data_len;        /**< Amount of data in segment buffer. */
+			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
+			uint16_t vlan_tci;
+
+			union {
 				union {
+					uint32_t rss;     /**< RSS hash result if RSS enabled */
 					struct {
-						uint16_t hash;
-						uint16_t id;
-					};
-					uint32_t lo;
-					/**< Second 4 flexible bytes */
-				};
-				uint32_t hi;
-				/**< First 4 flexible bytes or FD ID, dependent
-				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
-				 */
-			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched sched;
-			/**< Hierarchical scheduler : 8 bytes */
-			struct {
-				uint32_t reserved1;
-				uint16_t reserved2;
-				uint16_t txq;
-				/**< The event eth Tx adapter uses this field
-				 * to store Tx queue id.
-				 * @see rte_event_eth_tx_adapter_txq_set()
-				 */
-			} txadapter; /**< Eventdev ethdev Tx adapter */
-			uint32_t usr;
-			/**< User defined tags. See rte_distributor_process() */
-		} hash;                   /**< hash information */
-	};
+						union {
+							struct {
+								uint16_t hash;
+								uint16_t id;
+							};
+							/**< Second 4 flexible bytes */
+							uint32_t lo;
+						};
+						/**< First 4 flexible bytes or FD ID, dependent
+						 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
+						 */
+						uint32_t hi;
+					} fdir;	/**< Filter identifier if FDIR enabled */
+					struct rte_mbuf_sched sched;
+					/**< Hierarchical scheduler : 8 bytes */
+					struct {
+						uint32_t reserved1;
+						uint16_t reserved2;
+						/**< The event eth Tx adapter uses this field
+						 * to store Tx queue id.
+						 * @see rte_event_eth_tx_adapter_txq_set()
+						 */
+						uint16_t txq;
+					} txadapter; /**< Eventdev ethdev Tx adapter */
+					/**< User defined tags. See rte_distributor_process() */
+					uint32_t usr;
+				} hash;                   /**< hash information */
+			};
 
-	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
-	uint16_t vlan_tci_outer;
+			/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
+			uint16_t vlan_tci_outer;
 
-	uint16_t buf_len;         /**< Length of segment buffer. */
+			uint16_t buf_len;         /**< Length of segment buffer. */
+		};
+	};
 
 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
-
 #if RTE_IOVA_IN_MBUF
 	/**
 	 * Next segment of scattered packet. Must be NULL in the last
 	 * segment or in case of non-segmented packet.
 	 */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	struct rte_mbuf *next;
 #else
 	/**
 	 * Reserved for dynamic fields
 	 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
 	 */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint64_t dynfield2;
 #endif
 
@@ -617,17 +626,16 @@ struct __rte_cache_aligned rte_mbuf {
 		uint64_t tx_offload;       /**< combined for easy fetch */
 		__extension__
 		struct {
-			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
 			/**< L2 (MAC) Header Length for non-tunneling pkt.
 			 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
 			 */
-			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
+			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
 			/**< L3 (IP) Header Length. */
-			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
+			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
 			/**< L4 (TCP/UDP) Header Length. */
-			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
+			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
 			/**< TCP TSO segment size */
-
+			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
 			/*
 			 * Fields for Tx offloading of tunnels.
 			 * These are undefined for packets which don't request
@@ -640,10 +648,10 @@ struct __rte_cache_aligned rte_mbuf {
 			 * Applications are expected to set appropriate tunnel
 			 * offload flags when they fill in these fields.
 			 */
-			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
 			/**< Outer L3 (IP) Hdr Length. */
-			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
+			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
 			/**< Outer L2 (MAC) Hdr Length. */
+			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
 
 			/* uint64_t unused:RTE_MBUF_TXOFLD_UNUSED_BITS; */
 		};
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v9 3/4] security: remove rte marker fields
  2024-04-02 20:08 ` [PATCH v9 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-04-02 20:08   ` [PATCH v9 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
  2024-04-02 20:08   ` [PATCH v9 2/4] mbuf: remove rte marker fields Tyler Retzlaff
@ 2024-04-02 20:08   ` Tyler Retzlaff
  2024-04-02 20:08   ` [PATCH v9 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-02 20:08 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 lib/security/rte_security_driver.h     | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index ffc0d62..b0d53b6 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -164,6 +164,9 @@ Removed Items
 * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_mbuf``.
 
+* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_security_session``.
+
 API Changes
 -----------
 
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index 09829ab..18a1e3c 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -12,6 +12,8 @@
  * RTE Security Common Definitions
  */
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,7 +26,6 @@
  * Security session to be used by library for internal usage
  */
 struct rte_security_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Opaque user defined data */
 	uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< session private data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint8_t driver_priv_data[];
 	/**< Private session material, variable size (depends on driver) */
 };
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v9 4/4] cryptodev: remove rte marker fields
  2024-04-02 20:08 ` [PATCH v9 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-04-02 20:08   ` [PATCH v9 3/4] security: " Tyler Retzlaff
@ 2024-04-02 20:08   ` Tyler Retzlaff
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-02 20:08 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 lib/cryptodev/cryptodev_pmd.h          | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index b0d53b6..dfa326a 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -167,6 +167,9 @@ Removed Items
 * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_security_session``.
 
+* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct cryptodev_driver``.
+
 API Changes
 -----------
 
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index d195b81..9daf129 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -5,6 +5,8 @@
 #ifndef _CRYPTODEV_PMD_H_
 #define _CRYPTODEV_PMD_H_
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Can be used for external metadata */
 	uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< Session driver data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	/**< Second cache line - start of the driver session data */
 	uint8_t driver_priv_data[];
 	/**< Driver specific session data, variable size */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v9 2/4] mbuf: remove rte marker fields
  2024-04-02 20:08   ` [PATCH v9 2/4] mbuf: remove rte marker fields Tyler Retzlaff
@ 2024-04-02 20:45     ` Stephen Hemminger
  2024-04-02 20:51       ` Tyler Retzlaff
  0 siblings, 1 reply; 171+ messages in thread
From: Stephen Hemminger @ 2024-04-02 20:45 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Tue,  2 Apr 2024 13:08:48 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> unions as single element arrays of with types matching the original
> markers to maintain API compatibility.
> 
> This change breaks the API for cacheline{0,1} fields that have been
> removed from rte_mbuf but it does not break the ABI, to address the
> false positives of the removed (but 0 size fields) provide the minimum
> libabigail.abignore for type = rte_mbuf.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Release note should be for 24.07 not 24.03.

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v9 2/4] mbuf: remove rte marker fields
  2024-04-02 20:45     ` Stephen Hemminger
@ 2024-04-02 20:51       ` Tyler Retzlaff
  0 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-02 20:51 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Tue, Apr 02, 2024 at 01:45:49PM -0700, Stephen Hemminger wrote:
> On Tue,  2 Apr 2024 13:08:48 -0700
> Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> 
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > RTE_MARKER fields from rte_mbuf struct.
> > 
> > Maintain alignment of fields after removed cacheline1 marker by placing
> > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> > 
> > Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> > unions as single element arrays of with types matching the original
> > markers to maintain API compatibility.
> > 
> > This change breaks the API for cacheline{0,1} fields that have been
> > removed from rte_mbuf but it does not break the ABI, to address the
> > false positives of the removed (but 0 size fields) provide the minimum
> > libabigail.abignore for type = rte_mbuf.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> Release note should be for 24.07 not 24.03.

yeah, pressed send and noticed it seconds later. when the new empty
release notes are added i'll move the notes to 24.07.

thanks.

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v10 0/4] remove use of RTE_MARKER fields in libraries
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
                   ` (6 preceding siblings ...)
  2024-04-02 20:08 ` [PATCH v9 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-04-03 17:53 ` Tyler Retzlaff
  2024-04-03 17:53   ` [PATCH v10 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
                     ` (3 more replies)
  2024-04-04 17:51 ` [PATCH v11 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  8 siblings, 4 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-03 17:53 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

As per techboard meeting 2024/03/20 adopt hybrid proposal of adapting
descriptor fields and removing cachline fields.

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields.

For cacheline{0,1} fields remove fields entirely and use inline
functions to prefetch.

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

Note: diff is easier viewed with -b due to additional nesting from
      unions / structs that have been introduced.

v10:
  * move removal notices in in release notes from 24.03 to 24.07

v9:
  * provide narrowest possible libabigail.abignore to suppress
    removal of fields that were agreed are not actual abi changes.

v8:
  * rx_descriptor_fields1 array is now constexpr sized to
    24 / sizeof(void *) so that the array encompasses fields
    accessed via the array.
  * add a comment to rx_descriptor_fields1 array site noting
    that void * type of elements is retained for compatibility
    with existing drivers.
  * clean up comments of fields in rte_mbuf to be before the
    field they apply to instead of after.
  * duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of
    conditional compile for first field of cacheline 1 instead of
    once before conditional compile block.

v7:
  * complete re-write of series, previous versions not noted. all
    reviewed-by and acked-by tags (if any) were removed.

Tyler Retzlaff (4):
  net/i40e: use inline prefetch function
  mbuf: remove rte marker fields
  security: remove rte marker fields
  cryptodev: remove rte marker fields

 devtools/libabigail.abignore            |   6 +
 doc/guides/rel_notes/release_24_07.rst  |   9 ++
 drivers/net/i40e/i40e_rxtx_vec_avx512.c |   2 +-
 lib/cryptodev/cryptodev_pmd.h           |   5 +-
 lib/mbuf/rte_mbuf.h                     |   4 +-
 lib/mbuf/rte_mbuf_core.h                | 200 +++++++++++++++++---------------
 lib/security/rte_security_driver.h      |   5 +-
 7 files changed, 128 insertions(+), 103 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v10 1/4] net/i40e: use inline prefetch function
  2024-04-03 17:53 ` [PATCH v10 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-04-03 17:53   ` Tyler Retzlaff
  2024-04-03 21:49     ` Stephen Hemminger
  2024-04-03 17:53   ` [PATCH v10 2/4] mbuf: remove rte marker fields Tyler Retzlaff
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-03 17:53 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Don't directly access the cacheline1 field in rte_mbuf struct for
prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index f3050cd..0238b03 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -826,7 +826,7 @@
 		free[0] = m;
 		nb_free = 1;
 		for (i = 1; i < n; i++) {
-			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
 			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
 			if (likely(m)) {
 				if (likely(m->pool == free[0]->pool)) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v10 2/4] mbuf: remove rte marker fields
  2024-04-03 17:53 ` [PATCH v10 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-04-03 17:53   ` [PATCH v10 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
@ 2024-04-03 17:53   ` Tyler Retzlaff
  2024-04-03 19:32     ` Morten Brørup
  2024-04-03 21:49     ` Stephen Hemminger
  2024-04-03 17:53   ` [PATCH v10 3/4] security: " Tyler Retzlaff
  2024-04-03 17:53   ` [PATCH v10 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 2 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-03 17:53 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

This change breaks the API for cacheline{0,1} fields that have been
removed from rte_mbuf but it does not break the ABI, to address the
false positives of the removed (but 0 size fields) provide the minimum
libabigail.abignore for type = rte_mbuf.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 devtools/libabigail.abignore           |   6 +
 doc/guides/rel_notes/release_24_07.rst |   3 +
 lib/mbuf/rte_mbuf.h                    |   4 +-
 lib/mbuf/rte_mbuf_core.h               | 200 +++++++++++++++++----------------
 4 files changed, 115 insertions(+), 98 deletions(-)

diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
index 645d289..ad13179 100644
--- a/devtools/libabigail.abignore
+++ b/devtools/libabigail.abignore
@@ -37,3 +37,9 @@
 [suppress_type]
 	name = rte_eth_fp_ops
 	has_data_member_inserted_between = {offset_of(reserved2), end}
+
+[suppress_type]
+	name = rte_mbuf
+	type_kind = struct
+	has_size_change = no
+	has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index a69f24c..b240ee5 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -68,6 +68,9 @@ Removed Items
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_mbuf``.
+
 
 API Changes
 -----------
diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 286b32b..4c4722e 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -108,7 +108,7 @@
 static inline void
 rte_mbuf_prefetch_part1(struct rte_mbuf *m)
 {
-	rte_prefetch0(&m->cacheline0);
+	rte_prefetch0(m);
 }
 
 /**
@@ -126,7 +126,7 @@
 rte_mbuf_prefetch_part2(struct rte_mbuf *m)
 {
 #if RTE_CACHE_LINE_SIZE == 64
-	rte_prefetch0(&m->cacheline1);
+	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
 #else
 	RTE_SET_USED(m);
 #endif
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 9f58076..9d838b8 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -465,8 +465,6 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct __rte_cache_aligned rte_mbuf {
-	RTE_MARKER cacheline0;
-
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
 	/**
@@ -488,127 +486,138 @@ struct __rte_cache_aligned rte_mbuf {
 #endif
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
+	union {
+		uint64_t rearm_data[1];
+		__extension__
+		struct {
+			uint16_t data_off;
+
+			/**
+			 * Reference counter. Its size should at least equal to the size
+			 * of port field (16 bits), to support zero-copy broadcast.
+			 * It should only be accessed using the following functions:
+			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
+			 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
+			 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
+			 */
+			RTE_ATOMIC(uint16_t) refcnt;
 
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
+			/**
+			 * Number of segments. Only valid for the first segment of an mbuf
+			 * chain.
+			 */
+			uint16_t nb_segs;
 
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
+			/** Input port (16 bits to support more than 256 virtual ports).
+			 * The event eth Tx adapter uses this field to specify the output port.
+			 */
+			uint16_t port;
+		};
+	};
 
 	uint64_t ol_flags;        /**< Offload features. */
 
-	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
-
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
+	/* remaining 24 bytes are set on RX when pulling packet from descriptor */
 	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
+		/* void * type of the array elements is retained for driver compatibility. */
+		void *rx_descriptor_fields1[24 / sizeof(void *)];
 		__extension__
 		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
+			/*
+			 * The packet type, which is the combination of outer/inner L2, L3, L4
+			 * and tunnel types. The packet_type is about data really present in the
+			 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
+			 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
+			 * vlan is stripped from the data.
+			 */
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
-				 */
+				uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
 				__extension__
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					uint8_t l2_type:4;   /**< (Outer) L2 type. */
+					uint8_t l3_type:4;   /**< (Outer) L3 type. */
+					uint8_t l4_type:4;   /**< (Outer) L4 type. */
+					uint8_t tun_type:4;  /**< Tunnel type. */
+					union {
+						/**< ESP next protocol type, valid if
+						 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
+						 * on both Tx and Rx.
+						 */
+						uint8_t inner_esp_next_proto;
+						__extension__
+						struct {
+							/**< Inner L2 type. */
+							uint8_t inner_l2_type:4;
+							/**< Inner L3 type. */
+							uint8_t inner_l3_type:4;
+						};
+					};
+					uint8_t inner_l4_type:4; /**< Inner L4 type. */
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
-		};
-	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-	uint16_t data_len;        /**< Amount of data in segment buffer. */
-	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
-	uint16_t vlan_tci;
+			uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
 
-	union {
-		union {
-			uint32_t rss;     /**< RSS hash result if RSS enabled */
-			struct {
+			uint16_t data_len;        /**< Amount of data in segment buffer. */
+			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
+			uint16_t vlan_tci;
+
+			union {
 				union {
+					uint32_t rss;     /**< RSS hash result if RSS enabled */
 					struct {
-						uint16_t hash;
-						uint16_t id;
-					};
-					uint32_t lo;
-					/**< Second 4 flexible bytes */
-				};
-				uint32_t hi;
-				/**< First 4 flexible bytes or FD ID, dependent
-				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
-				 */
-			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched sched;
-			/**< Hierarchical scheduler : 8 bytes */
-			struct {
-				uint32_t reserved1;
-				uint16_t reserved2;
-				uint16_t txq;
-				/**< The event eth Tx adapter uses this field
-				 * to store Tx queue id.
-				 * @see rte_event_eth_tx_adapter_txq_set()
-				 */
-			} txadapter; /**< Eventdev ethdev Tx adapter */
-			uint32_t usr;
-			/**< User defined tags. See rte_distributor_process() */
-		} hash;                   /**< hash information */
-	};
+						union {
+							struct {
+								uint16_t hash;
+								uint16_t id;
+							};
+							/**< Second 4 flexible bytes */
+							uint32_t lo;
+						};
+						/**< First 4 flexible bytes or FD ID, dependent
+						 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
+						 */
+						uint32_t hi;
+					} fdir;	/**< Filter identifier if FDIR enabled */
+					struct rte_mbuf_sched sched;
+					/**< Hierarchical scheduler : 8 bytes */
+					struct {
+						uint32_t reserved1;
+						uint16_t reserved2;
+						/**< The event eth Tx adapter uses this field
+						 * to store Tx queue id.
+						 * @see rte_event_eth_tx_adapter_txq_set()
+						 */
+						uint16_t txq;
+					} txadapter; /**< Eventdev ethdev Tx adapter */
+					/**< User defined tags. See rte_distributor_process() */
+					uint32_t usr;
+				} hash;                   /**< hash information */
+			};
 
-	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
-	uint16_t vlan_tci_outer;
+			/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
+			uint16_t vlan_tci_outer;
 
-	uint16_t buf_len;         /**< Length of segment buffer. */
+			uint16_t buf_len;         /**< Length of segment buffer. */
+		};
+	};
 
 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
-
 #if RTE_IOVA_IN_MBUF
 	/**
 	 * Next segment of scattered packet. Must be NULL in the last
 	 * segment or in case of non-segmented packet.
 	 */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	struct rte_mbuf *next;
 #else
 	/**
 	 * Reserved for dynamic fields
 	 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
 	 */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint64_t dynfield2;
 #endif
 
@@ -617,17 +626,16 @@ struct __rte_cache_aligned rte_mbuf {
 		uint64_t tx_offload;       /**< combined for easy fetch */
 		__extension__
 		struct {
-			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
 			/**< L2 (MAC) Header Length for non-tunneling pkt.
 			 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
 			 */
-			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
+			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
 			/**< L3 (IP) Header Length. */
-			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
+			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
 			/**< L4 (TCP/UDP) Header Length. */
-			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
+			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
 			/**< TCP TSO segment size */
-
+			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
 			/*
 			 * Fields for Tx offloading of tunnels.
 			 * These are undefined for packets which don't request
@@ -640,10 +648,10 @@ struct __rte_cache_aligned rte_mbuf {
 			 * Applications are expected to set appropriate tunnel
 			 * offload flags when they fill in these fields.
 			 */
-			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
 			/**< Outer L3 (IP) Hdr Length. */
-			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
+			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
 			/**< Outer L2 (MAC) Hdr Length. */
+			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
 
 			/* uint64_t unused:RTE_MBUF_TXOFLD_UNUSED_BITS; */
 		};
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v10 3/4] security: remove rte marker fields
  2024-04-03 17:53 ` [PATCH v10 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-04-03 17:53   ` [PATCH v10 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
  2024-04-03 17:53   ` [PATCH v10 2/4] mbuf: remove rte marker fields Tyler Retzlaff
@ 2024-04-03 17:53   ` Tyler Retzlaff
  2024-04-03 21:50     ` Stephen Hemminger
  2024-04-03 17:53   ` [PATCH v10 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-03 17:53 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 doc/guides/rel_notes/release_24_07.rst | 3 +++
 lib/security/rte_security_driver.h     | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index b240ee5..c191f53 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -71,6 +71,9 @@ Removed Items
 * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_mbuf``.
 
+* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_security_session``.
+
 
 API Changes
 -----------
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index 09829ab..18a1e3c 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -12,6 +12,8 @@
  * RTE Security Common Definitions
  */
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,7 +26,6 @@
  * Security session to be used by library for internal usage
  */
 struct rte_security_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Opaque user defined data */
 	uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< session private data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint8_t driver_priv_data[];
 	/**< Private session material, variable size (depends on driver) */
 };
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v10 4/4] cryptodev: remove rte marker fields
  2024-04-03 17:53 ` [PATCH v10 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-04-03 17:53   ` [PATCH v10 3/4] security: " Tyler Retzlaff
@ 2024-04-03 17:53   ` Tyler Retzlaff
  2024-04-03 21:50     ` Stephen Hemminger
  3 siblings, 1 reply; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-03 17:53 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 doc/guides/rel_notes/release_24_07.rst | 3 +++
 lib/cryptodev/cryptodev_pmd.h          | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index c191f53..1d23b49 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -71,6 +71,9 @@ Removed Items
 * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_mbuf``.
 
+* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct cryptodev_driver``.
+
 * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_security_session``.
 
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index d195b81..9daf129 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -5,6 +5,8 @@
 #ifndef _CRYPTODEV_PMD_H_
 #define _CRYPTODEV_PMD_H_
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Can be used for external metadata */
 	uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< Session driver data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	/**< Second cache line - start of the driver session data */
 	uint8_t driver_priv_data[];
 	/**< Driver specific session data, variable size */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* RE: [PATCH v10 2/4] mbuf: remove rte marker fields
  2024-04-03 17:53   ` [PATCH v10 2/4] mbuf: remove rte marker fields Tyler Retzlaff
@ 2024-04-03 19:32     ` Morten Brørup
  2024-04-03 22:45       ` Tyler Retzlaff
  2024-04-03 21:49     ` Stephen Hemminger
  1 sibling, 1 reply; 171+ messages in thread
From: Morten Brørup @ 2024-04-03 19:32 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 3 April 2024 19.54
> 
> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> unions as single element arrays of with types matching the original
> markers to maintain API compatibility.
> 
> This change breaks the API for cacheline{0,1} fields that have been
> removed from rte_mbuf but it does not break the ABI, to address the
> false positives of the removed (but 0 size fields) provide the minimum
> libabigail.abignore for type = rte_mbuf.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

[...]

> +	/* remaining 24 bytes are set on RX when pulling packet from
> descriptor */

Good.

>  	union {
> +		/* void * type of the array elements is retained for driver
> compatibility. */
> +		void *rx_descriptor_fields1[24 / sizeof(void *)];

Good, also the description.

>  		__extension__
>  		struct {
> -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> -			uint8_t tun_type:4;  /**< Tunnel type. */
> +			/*
> +			 * The packet type, which is the combination of
> outer/inner L2, L3, L4
> +			 * and tunnel types. The packet_type is about data
> really present in the
> +			 * mbuf. Example: if vlan stripping is enabled, a
> received vlan packet
> +			 * would have RTE_PTYPE_L2_ETHER and not
> RTE_PTYPE_L2_VLAN because the
> +			 * vlan is stripped from the data.
> +			 */
>  			union {
> -				uint8_t inner_esp_next_proto;
> -				/**< ESP next protocol type, valid if
> -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> -				 * on both Tx and Rx.
> -				 */

[...]

> +						/**< ESP next protocol type, valid
> if
> +						 * RTE_PTYPE_TUNNEL_ESP tunnel type
> is set
> +						 * on both Tx and Rx.
> +						 */
> +						uint8_t inner_esp_next_proto;

Thank you for moving the comments up before the fields.

Please note that "/**<" means that the description is related to the field preceding the comment, so it should be replaced by "/**" when moving the description up above a field.

Maybe moving the descriptions as part of this patch was not a good idea after all; it doesn't improve the readability of the patch itself. I regret suggesting it.
If you leave the descriptions at their originals positions (relative to the fields), we can clean up the formatting of the descriptions in a later patch.

[...]

>  	/* second cache line - fields only used in slow path or on TX */
> -	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
> -
>  #if RTE_IOVA_IN_MBUF
>  	/**
>  	 * Next segment of scattered packet. Must be NULL in the last
>  	 * segment or in case of non-segmented packet.
>  	 */
> +	alignas(RTE_CACHE_LINE_MIN_SIZE)
>  	struct rte_mbuf *next;
>  #else
>  	/**
>  	 * Reserved for dynamic fields
>  	 * when the next pointer is in first cache line (i.e.
> RTE_IOVA_IN_MBUF is 0).
>  	 */
> +	alignas(RTE_CACHE_LINE_MIN_SIZE)

Good positioning of the alignas().

I like everything in this patch.

Please fix the descriptions preceding the fields "/**<" -> "/**" or move them back to their location after the fields; then you may add Reviewed-by: Morten Brørup <mb@smartsharesystems.com> to the next version.


^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v10 1/4] net/i40e: use inline prefetch function
  2024-04-03 17:53   ` [PATCH v10 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
@ 2024-04-03 21:49     ` Stephen Hemminger
  0 siblings, 0 replies; 171+ messages in thread
From: Stephen Hemminger @ 2024-04-03 21:49 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Wed,  3 Apr 2024 10:53:33 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> Don't directly access the cacheline1 field in rte_mbuf struct for
> prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v10 2/4] mbuf: remove rte marker fields
  2024-04-03 17:53   ` [PATCH v10 2/4] mbuf: remove rte marker fields Tyler Retzlaff
  2024-04-03 19:32     ` Morten Brørup
@ 2024-04-03 21:49     ` Stephen Hemminger
  1 sibling, 0 replies; 171+ messages in thread
From: Stephen Hemminger @ 2024-04-03 21:49 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Wed,  3 Apr 2024 10:53:34 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> unions as single element arrays of with types matching the original
> markers to maintain API compatibility.
> 
> This change breaks the API for cacheline{0,1} fields that have been
> removed from rte_mbuf but it does not break the ABI, to address the
> false positives of the removed (but 0 size fields) provide the minimum
> libabigail.abignore for type = rte_mbuf.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v10 3/4] security: remove rte marker fields
  2024-04-03 17:53   ` [PATCH v10 3/4] security: " Tyler Retzlaff
@ 2024-04-03 21:50     ` Stephen Hemminger
  0 siblings, 0 replies; 171+ messages in thread
From: Stephen Hemminger @ 2024-04-03 21:50 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Wed,  3 Apr 2024 10:53:35 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> ---

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v10 4/4] cryptodev: remove rte marker fields
  2024-04-03 17:53   ` [PATCH v10 4/4] cryptodev: " Tyler Retzlaff
@ 2024-04-03 21:50     ` Stephen Hemminger
  0 siblings, 0 replies; 171+ messages in thread
From: Stephen Hemminger @ 2024-04-03 21:50 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang, mb

On Wed,  3 Apr 2024 10:53:36 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> RTE_MARKER fields from rte_mbuf struct.
> 
> Maintain alignment of fields after removed cacheline1 marker by placing
> C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 171+ messages in thread

* Re: [PATCH v10 2/4] mbuf: remove rte marker fields
  2024-04-03 19:32     ` Morten Brørup
@ 2024-04-03 22:45       ` Tyler Retzlaff
  0 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-03 22:45 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Ajit Khaparde, Andrew Boyer, Andrew Rybchenko,
	Bruce Richardson, Chenbo Xia, Chengwen Feng, Dariusz Sosnowski,
	David Christensen, Hyong Youb Kim, Jerin Jacob, Jie Hai,
	Jingjing Wu, John Daley, Kevin Laatz, Kiran Kumar K,
	Konstantin Ananyev, Maciej Czekaj, Matan Azrad, Maxime Coquelin,
	Nithin Dabilpuram, Ori Kam, Ruifeng Wang, Satha Rao,
	Somnath Kotur, Suanming Mou, Sunil Kumar Kori,
	Viacheslav Ovsiienko, Yisen Zhuang, Yuying Zhang

On Wed, Apr 03, 2024 at 09:32:21PM +0200, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Wednesday, 3 April 2024 19.54
> > 
> > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
> > RTE_MARKER fields from rte_mbuf struct.
> > 
> > Maintain alignment of fields after removed cacheline1 marker by placing
> > C11 alignas(RTE_CACHE_LINE_MIN_SIZE).
> > 
> > Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
> > unions as single element arrays of with types matching the original
> > markers to maintain API compatibility.
> > 
> > This change breaks the API for cacheline{0,1} fields that have been
> > removed from rte_mbuf but it does not break the ABI, to address the
> > false positives of the removed (but 0 size fields) provide the minimum
> > libabigail.abignore for type = rte_mbuf.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> 
> [...]
> 
> > +	/* remaining 24 bytes are set on RX when pulling packet from
> > descriptor */
> 
> Good.
> 
> >  	union {
> > +		/* void * type of the array elements is retained for driver
> > compatibility. */
> > +		void *rx_descriptor_fields1[24 / sizeof(void *)];
> 
> Good, also the description.
> 
> >  		__extension__
> >  		struct {
> > -			uint8_t l2_type:4;   /**< (Outer) L2 type. */
> > -			uint8_t l3_type:4;   /**< (Outer) L3 type. */
> > -			uint8_t l4_type:4;   /**< (Outer) L4 type. */
> > -			uint8_t tun_type:4;  /**< Tunnel type. */
> > +			/*
> > +			 * The packet type, which is the combination of
> > outer/inner L2, L3, L4
> > +			 * and tunnel types. The packet_type is about data
> > really present in the
> > +			 * mbuf. Example: if vlan stripping is enabled, a
> > received vlan packet
> > +			 * would have RTE_PTYPE_L2_ETHER and not
> > RTE_PTYPE_L2_VLAN because the
> > +			 * vlan is stripped from the data.
> > +			 */
> >  			union {
> > -				uint8_t inner_esp_next_proto;
> > -				/**< ESP next protocol type, valid if
> > -				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
> > -				 * on both Tx and Rx.
> > -				 */
> 
> [...]
> 
> > +						/**< ESP next protocol type, valid
> > if
> > +						 * RTE_PTYPE_TUNNEL_ESP tunnel type
> > is set
> > +						 * on both Tx and Rx.
> > +						 */
> > +						uint8_t inner_esp_next_proto;
> 
> Thank you for moving the comments up before the fields.
> 
> Please note that "/**<" means that the description is related to the field preceding the comment, so it should be replaced by "/**" when moving the description up above a field.

ooh, i'll fix it i'm not well versed in doxygen documentation.

> 
> Maybe moving the descriptions as part of this patch was not a good idea after all; it doesn't improve the readability of the patch itself. I regret suggesting it.
> If you leave the descriptions at their originals positions (relative to the fields), we can clean up the formatting of the descriptions in a later patch.

it's easy enough for me to fix the comments in place and bring in a new
version of the series, assuming other reviewers don't object i'll do that.
the diff is already kind of annoying to review in mail without -b
anyway.

> 
> [...]
> 
> >  	/* second cache line - fields only used in slow path or on TX */
> > -	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
> > -
> >  #if RTE_IOVA_IN_MBUF
> >  	/**
> >  	 * Next segment of scattered packet. Must be NULL in the last
> >  	 * segment or in case of non-segmented packet.
> >  	 */
> > +	alignas(RTE_CACHE_LINE_MIN_SIZE)
> >  	struct rte_mbuf *next;
> >  #else
> >  	/**
> >  	 * Reserved for dynamic fields
> >  	 * when the next pointer is in first cache line (i.e.
> > RTE_IOVA_IN_MBUF is 0).
> >  	 */
> > +	alignas(RTE_CACHE_LINE_MIN_SIZE)
> 
> Good positioning of the alignas().
> 
> I like everything in this patch.
> 
> Please fix the descriptions preceding the fields "/**<" -> "/**" or move them back to their location after the fields; then you may add Reviewed-by: Morten Brørup <mb@smartsharesystems.com> to the next version.

ack, next rev.

^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v11 0/4] remove use of RTE_MARKER fields in libraries
  2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
                   ` (7 preceding siblings ...)
  2024-04-03 17:53 ` [PATCH v10 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-04-04 17:51 ` Tyler Retzlaff
  2024-04-04 17:51   ` [PATCH v11 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
                     ` (3 more replies)
  8 siblings, 4 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-04 17:51 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

As per techboard meeting 2024/03/20 adopt hybrid proposal of adapting
descriptor fields and removing cachline fields.

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields.

For cacheline{0,1} fields remove fields entirely and use inline
functions to prefetch.

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

Note: diff is easier viewed with -b due to additional nesting from
      unions / structs that have been introduced.

v11:
  * correct doxygen comment style for field documentation.

v10:
  * move removal notices in in release notes from 24.03 to 24.07.

v9:
  * provide narrowest possible libabigail.abignore to suppress
    removal of fields that were agreed are not actual abi changes.

v8:
  * rx_descriptor_fields1 array is now constexpr sized to
    24 / sizeof(void *) so that the array encompasses fields
    accessed via the array.
  * add a comment to rx_descriptor_fields1 array site noting
    that void * type of elements is retained for compatibility
    with existing drivers.
  * clean up comments of fields in rte_mbuf to be before the
    field they apply to instead of after.
  * duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of
    conditional compile for first field of cacheline 1 instead of
    once before conditional compile block.

v7:
  * complete re-write of series, previous versions not noted. all
    reviewed-by and acked-by tags (if any) were removed.

Tyler Retzlaff (4):
  net/i40e: use inline prefetch function
  mbuf: remove rte marker fields
  security: remove rte marker fields
  cryptodev: remove rte marker fields

 devtools/libabigail.abignore            |   6 +
 doc/guides/rel_notes/release_24_07.rst  |   9 ++
 drivers/net/i40e/i40e_rxtx_vec_avx512.c |   2 +-
 lib/cryptodev/cryptodev_pmd.h           |   5 +-
 lib/mbuf/rte_mbuf.h                     |   4 +-
 lib/mbuf/rte_mbuf_core.h                | 202 +++++++++++++++++---------------
 lib/security/rte_security_driver.h      |   5 +-
 7 files changed, 129 insertions(+), 104 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v11 1/4] net/i40e: use inline prefetch function
  2024-04-04 17:51 ` [PATCH v11 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
@ 2024-04-04 17:51   ` Tyler Retzlaff
  2024-04-04 17:51   ` [PATCH v11 2/4] mbuf: remove rte marker fields Tyler Retzlaff
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-04 17:51 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

Don't directly access the cacheline1 field in rte_mbuf struct for
prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index f3050cd..0238b03 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -826,7 +826,7 @@
 		free[0] = m;
 		nb_free = 1;
 		for (i = 1; i < n; i++) {
-			rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+			rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
 			m = rte_pktmbuf_prefree_seg(txep[i].mbuf);
 			if (likely(m)) {
 				if (likely(m->pool == free[0]->pool)) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v11 2/4] mbuf: remove rte marker fields
  2024-04-04 17:51 ` [PATCH v11 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-04-04 17:51   ` [PATCH v11 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
@ 2024-04-04 17:51   ` Tyler Retzlaff
  2024-04-04 17:51   ` [PATCH v11 3/4] security: " Tyler Retzlaff
  2024-04-04 17:51   ` [PATCH v11 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-04 17:51 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Provide new rearm_data and rx_descriptor_fields1 fields in anonymous
unions as single element arrays of with types matching the original
markers to maintain API compatibility.

This change breaks the API for cacheline{0,1} fields that have been
removed from rte_mbuf but it does not break the ABI, to address the
false positives of the removed (but 0 size fields) provide the minimum
libabigail.abignore for type = rte_mbuf.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 devtools/libabigail.abignore           |   6 +
 doc/guides/rel_notes/release_24_07.rst |   3 +
 lib/mbuf/rte_mbuf.h                    |   4 +-
 lib/mbuf/rte_mbuf_core.h               | 202 +++++++++++++++++----------------
 4 files changed, 116 insertions(+), 99 deletions(-)

diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
index 645d289..ad13179 100644
--- a/devtools/libabigail.abignore
+++ b/devtools/libabigail.abignore
@@ -37,3 +37,9 @@
 [suppress_type]
 	name = rte_eth_fp_ops
 	has_data_member_inserted_between = {offset_of(reserved2), end}
+
+[suppress_type]
+	name = rte_mbuf
+	type_kind = struct
+	has_size_change = no
+	has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index a69f24c..b240ee5 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -68,6 +68,9 @@ Removed Items
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_mbuf``.
+
 
 API Changes
 -----------
diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index 286b32b..4c4722e 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -108,7 +108,7 @@
 static inline void
 rte_mbuf_prefetch_part1(struct rte_mbuf *m)
 {
-	rte_prefetch0(&m->cacheline0);
+	rte_prefetch0(m);
 }
 
 /**
@@ -126,7 +126,7 @@
 rte_mbuf_prefetch_part2(struct rte_mbuf *m)
 {
 #if RTE_CACHE_LINE_SIZE == 64
-	rte_prefetch0(&m->cacheline1);
+	rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE));
 #else
 	RTE_SET_USED(m);
 #endif
diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h
index 9f58076..726c2cf 100644
--- a/lib/mbuf/rte_mbuf_core.h
+++ b/lib/mbuf/rte_mbuf_core.h
@@ -465,8 +465,6 @@ enum {
  * The generic rte_mbuf, containing a packet mbuf.
  */
 struct __rte_cache_aligned rte_mbuf {
-	RTE_MARKER cacheline0;
-
 	void *buf_addr;           /**< Virtual address of segment buffer. */
 #if RTE_IOVA_IN_MBUF
 	/**
@@ -488,127 +486,138 @@ struct __rte_cache_aligned rte_mbuf {
 #endif
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
-	RTE_MARKER64 rearm_data;
-	uint16_t data_off;
-
-	/**
-	 * Reference counter. Its size should at least equal to the size
-	 * of port field (16 bits), to support zero-copy broadcast.
-	 * It should only be accessed using the following functions:
-	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-	 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
-	 */
-	RTE_ATOMIC(uint16_t) refcnt;
+	union {
+		uint64_t rearm_data[1];
+		__extension__
+		struct {
+			uint16_t data_off;
+
+			/**
+			 * Reference counter. Its size should at least equal to the size
+			 * of port field (16 bits), to support zero-copy broadcast.
+			 * It should only be accessed using the following functions:
+			 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
+			 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
+			 * or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
+			 */
+			RTE_ATOMIC(uint16_t) refcnt;
 
-	/**
-	 * Number of segments. Only valid for the first segment of an mbuf
-	 * chain.
-	 */
-	uint16_t nb_segs;
+			/**
+			 * Number of segments. Only valid for the first segment of an mbuf
+			 * chain.
+			 */
+			uint16_t nb_segs;
 
-	/** Input port (16 bits to support more than 256 virtual ports).
-	 * The event eth Tx adapter uses this field to specify the output port.
-	 */
-	uint16_t port;
+			/** Input port (16 bits to support more than 256 virtual ports).
+			 * The event eth Tx adapter uses this field to specify the output port.
+			 */
+			uint16_t port;
+		};
+	};
 
 	uint64_t ol_flags;        /**< Offload features. */
 
-	/* remaining bytes are set on RX when pulling packet from descriptor */
-	RTE_MARKER rx_descriptor_fields1;
-
-	/*
-	 * The packet type, which is the combination of outer/inner L2, L3, L4
-	 * and tunnel types. The packet_type is about data really present in the
-	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
-	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
-	 * vlan is stripped from the data.
-	 */
+	/* remaining 24 bytes are set on RX when pulling packet from descriptor */
 	union {
-		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
+		/* void * type of the array elements is retained for driver compatibility. */
+		void *rx_descriptor_fields1[24 / sizeof(void *)];
 		__extension__
 		struct {
-			uint8_t l2_type:4;   /**< (Outer) L2 type. */
-			uint8_t l3_type:4;   /**< (Outer) L3 type. */
-			uint8_t l4_type:4;   /**< (Outer) L4 type. */
-			uint8_t tun_type:4;  /**< Tunnel type. */
+			/*
+			 * The packet type, which is the combination of outer/inner L2, L3, L4
+			 * and tunnel types. The packet_type is about data really present in the
+			 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
+			 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
+			 * vlan is stripped from the data.
+			 */
 			union {
-				uint8_t inner_esp_next_proto;
-				/**< ESP next protocol type, valid if
-				 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
-				 * on both Tx and Rx.
-				 */
+				uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
 				__extension__
 				struct {
-					uint8_t inner_l2_type:4;
-					/**< Inner L2 type. */
-					uint8_t inner_l3_type:4;
-					/**< Inner L3 type. */
+					uint8_t l2_type:4;   /**< (Outer) L2 type. */
+					uint8_t l3_type:4;   /**< (Outer) L3 type. */
+					uint8_t l4_type:4;   /**< (Outer) L4 type. */
+					uint8_t tun_type:4;  /**< Tunnel type. */
+					union {
+						/** ESP next protocol type, valid if
+						 * RTE_PTYPE_TUNNEL_ESP tunnel type is set
+						 * on both Tx and Rx.
+						 */
+						uint8_t inner_esp_next_proto;
+						__extension__
+						struct {
+							/** Inner L2 type. */
+							uint8_t inner_l2_type:4;
+							/** Inner L3 type. */
+							uint8_t inner_l3_type:4;
+						};
+					};
+					uint8_t inner_l4_type:4; /**< Inner L4 type. */
 				};
 			};
-			uint8_t inner_l4_type:4; /**< Inner L4 type. */
-		};
-	};
 
-	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
-	uint16_t data_len;        /**< Amount of data in segment buffer. */
-	/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
-	uint16_t vlan_tci;
+			uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
 
-	union {
-		union {
-			uint32_t rss;     /**< RSS hash result if RSS enabled */
-			struct {
+			uint16_t data_len;        /**< Amount of data in segment buffer. */
+			/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
+			uint16_t vlan_tci;
+
+			union {
 				union {
+					uint32_t rss;     /**< RSS hash result if RSS enabled */
 					struct {
-						uint16_t hash;
-						uint16_t id;
-					};
-					uint32_t lo;
-					/**< Second 4 flexible bytes */
-				};
-				uint32_t hi;
-				/**< First 4 flexible bytes or FD ID, dependent
-				 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
-				 */
-			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched sched;
-			/**< Hierarchical scheduler : 8 bytes */
-			struct {
-				uint32_t reserved1;
-				uint16_t reserved2;
-				uint16_t txq;
-				/**< The event eth Tx adapter uses this field
-				 * to store Tx queue id.
-				 * @see rte_event_eth_tx_adapter_txq_set()
-				 */
-			} txadapter; /**< Eventdev ethdev Tx adapter */
-			uint32_t usr;
-			/**< User defined tags. See rte_distributor_process() */
-		} hash;                   /**< hash information */
-	};
+						union {
+							struct {
+								uint16_t hash;
+								uint16_t id;
+							};
+							/** Second 4 flexible bytes */
+							uint32_t lo;
+						};
+						/** First 4 flexible bytes or FD ID, dependent
+						 * on RTE_MBUF_F_RX_FDIR_* flag in ol_flags.
+						 */
+						uint32_t hi;
+					} fdir;	/**< Filter identifier if FDIR enabled */
+					/** Hierarchical scheduler : 8 bytes */
+					struct rte_mbuf_sched sched;
+					struct {
+						uint32_t reserved1;
+						uint16_t reserved2;
+						/** The event eth Tx adapter uses this field
+						 * to store Tx queue id.
+						 * @see rte_event_eth_tx_adapter_txq_set()
+						 */
+						uint16_t txq;
+					} txadapter; /**< Eventdev ethdev Tx adapter */
+					/** User defined tags. See rte_distributor_process() */
+					uint32_t usr;
+				} hash;                   /**< hash information */
+			};
 
-	/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
-	uint16_t vlan_tci_outer;
+			/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
+			uint16_t vlan_tci_outer;
 
-	uint16_t buf_len;         /**< Length of segment buffer. */
+			uint16_t buf_len;         /**< Length of segment buffer. */
+		};
+	};
 
 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
 
 	/* second cache line - fields only used in slow path or on TX */
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
-
 #if RTE_IOVA_IN_MBUF
 	/**
 	 * Next segment of scattered packet. Must be NULL in the last
 	 * segment or in case of non-segmented packet.
 	 */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	struct rte_mbuf *next;
 #else
 	/**
 	 * Reserved for dynamic fields
 	 * when the next pointer is in first cache line (i.e. RTE_IOVA_IN_MBUF is 0).
 	 */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint64_t dynfield2;
 #endif
 
@@ -617,17 +626,16 @@ struct __rte_cache_aligned rte_mbuf {
 		uint64_t tx_offload;       /**< combined for easy fetch */
 		__extension__
 		struct {
-			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
-			/**< L2 (MAC) Header Length for non-tunneling pkt.
+			/** L2 (MAC) Header Length for non-tunneling pkt.
 			 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
 			 */
+			uint64_t l2_len:RTE_MBUF_L2_LEN_BITS;
+			/** L3 (IP) Header Length. */
 			uint64_t l3_len:RTE_MBUF_L3_LEN_BITS;
-			/**< L3 (IP) Header Length. */
+			/** L4 (TCP/UDP) Header Length. */
 			uint64_t l4_len:RTE_MBUF_L4_LEN_BITS;
-			/**< L4 (TCP/UDP) Header Length. */
+			/** TCP TSO segment size */
 			uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS;
-			/**< TCP TSO segment size */
-
 			/*
 			 * Fields for Tx offloading of tunnels.
 			 * These are undefined for packets which don't request
@@ -640,10 +648,10 @@ struct __rte_cache_aligned rte_mbuf {
 			 * Applications are expected to set appropriate tunnel
 			 * offload flags when they fill in these fields.
 			 */
+			/** Outer L3 (IP) Hdr Length. */
 			uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS;
-			/**< Outer L3 (IP) Hdr Length. */
+			/** Outer L2 (MAC) Hdr Length. */
 			uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;
-			/**< Outer L2 (MAC) Hdr Length. */
 
 			/* uint64_t unused:RTE_MBUF_TXOFLD_UNUSED_BITS; */
 		};
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v11 3/4] security: remove rte marker fields
  2024-04-04 17:51 ` [PATCH v11 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
  2024-04-04 17:51   ` [PATCH v11 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
  2024-04-04 17:51   ` [PATCH v11 2/4] mbuf: remove rte marker fields Tyler Retzlaff
@ 2024-04-04 17:51   ` Tyler Retzlaff
  2024-04-04 17:51   ` [PATCH v11 4/4] cryptodev: " Tyler Retzlaff
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-04 17:51 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 doc/guides/rel_notes/release_24_07.rst | 3 +++
 lib/security/rte_security_driver.h     | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index b240ee5..c191f53 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -71,6 +71,9 @@ Removed Items
 * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_mbuf``.
 
+* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct rte_security_session``.
+
 
 API Changes
 -----------
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index 09829ab..18a1e3c 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -12,6 +12,8 @@
  * RTE Security Common Definitions
  */
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,7 +26,6 @@
  * Security session to be used by library for internal usage
  */
 struct rte_security_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Opaque user defined data */
 	uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< session private data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	uint8_t driver_priv_data[];
 	/**< Private session material, variable size (depends on driver) */
 };
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

* [PATCH v11 4/4] cryptodev: remove rte marker fields
  2024-04-04 17:51 ` [PATCH v11 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-04-04 17:51   ` [PATCH v11 3/4] security: " Tyler Retzlaff
@ 2024-04-04 17:51   ` Tyler Retzlaff
  3 siblings, 0 replies; 171+ messages in thread
From: Tyler Retzlaff @ 2024-04-04 17:51 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Andrew Boyer, Andrew Rybchenko, Bruce Richardson,
	Chenbo Xia, Chengwen Feng, Dariusz Sosnowski, David Christensen,
	Hyong Youb Kim, Jerin Jacob, Jie Hai, Jingjing Wu, John Daley,
	Kevin Laatz, Kiran Kumar K, Konstantin Ananyev, Maciej Czekaj,
	Matan Azrad, Maxime Coquelin, Nithin Dabilpuram, Ori Kam,
	Ruifeng Wang, Satha Rao, Somnath Kotur, Suanming Mou,
	Sunil Kumar Kori, Viacheslav Ovsiienko, Yisen Zhuang,
	Yuying Zhang, mb, Tyler Retzlaff

RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove
RTE_MARKER fields from rte_mbuf struct.

Maintain alignment of fields after removed cacheline1 marker by placing
C11 alignas(RTE_CACHE_LINE_MIN_SIZE).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 doc/guides/rel_notes/release_24_07.rst | 3 +++
 lib/cryptodev/cryptodev_pmd.h          | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index c191f53..1d23b49 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -71,6 +71,9 @@ Removed Items
 * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_mbuf``.
 
+* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
+  have been removed from ``struct cryptodev_driver``.
+
 * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1``
   have been removed from ``struct rte_security_session``.
 
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index d195b81..9daf129 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -5,6 +5,8 @@
 #ifndef _CRYPTODEV_PMD_H_
 #define _CRYPTODEV_PMD_H_
 
+#include <stdalign.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {
  * has a fixed algo, key, op-type, digest_len etc.
  */
 struct rte_cryptodev_sym_session {
-	RTE_MARKER cacheline0;
 	uint64_t opaque_data;
 	/**< Can be used for external metadata */
 	uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {
 	rte_iova_t driver_priv_data_iova;
 	/**< Session driver data IOVA address */
 
-	alignas(RTE_CACHE_LINE_MIN_SIZE) RTE_MARKER cacheline1;
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
 	/**< Second cache line - start of the driver session data */
 	uint8_t driver_priv_data[];
 	/**< Driver specific session data, variable size */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 171+ messages in thread

end of thread, other threads:[~2024-04-04 17:52 UTC | newest]

Thread overview: 171+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 23:26 [PATCH] replace GCC marker extension with C11 anonymous unions Tyler Retzlaff
2024-01-30 23:26 ` [PATCH] mbuf: " Tyler Retzlaff
2024-01-31  9:18   ` Morten Brørup
2024-01-31 21:09     ` Tyler Retzlaff
2024-01-31 22:39       ` Morten Brørup
2024-01-31 13:49   ` Bruce Richardson
2024-01-31 20:45     ` Tyler Retzlaff
2024-01-31 22:55       ` Morten Brørup
2024-02-13  6:45   ` [PATCH v2] RFC: " Tyler Retzlaff
2024-02-13  6:45     ` [PATCH v2] mbuf: " Tyler Retzlaff
2024-02-13 16:58       ` Morten Brørup
2024-02-13 18:48         ` Tyler Retzlaff
2024-02-13 19:27           ` Morten Brørup
2024-02-13 20:00             ` Tyler Retzlaff
2024-02-13  8:57     ` [PATCH v2] RFC: " Bruce Richardson
2024-02-13 17:09     ` Morten Brørup
2024-02-13 23:33   ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Tyler Retzlaff
2024-02-13 23:33     ` [PATCH v3] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
2024-02-14 10:46       ` Morten Brørup
2024-02-14 20:16         ` Tyler Retzlaff
2024-02-14 10:49     ` [PATCH v3] RFC deprecate RTE_MARKER in struct rte_mbuf Morten Brørup
2024-02-26  1:18     ` Stephen Hemminger
2024-02-15  6:21 ` [PATCH v4 00/18] stop using zero sized marker fields Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 01/18] mbuf: deprecate GCC marker in rte mbuf struct Tyler Retzlaff
2024-02-18  2:28     ` fengchengwen
2024-02-18 12:39     ` Thomas Monjalon
2024-02-18 13:07       ` Morten Brørup
2024-02-18 15:22         ` Thomas Monjalon
2024-02-18 16:20           ` Morten Brørup
2024-02-20 17:24           ` Tyler Retzlaff
2024-02-20 17:20       ` Tyler Retzlaff
2024-02-20 17:53         ` Thomas Monjalon
2024-02-20 19:16           ` Thomas Monjalon
2024-02-20 19:37             ` Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 02/18] mbuf: stop using zero sized marker fields Tyler Retzlaff
2024-02-18  2:38     ` fengchengwen
2024-02-15  6:21   ` [PATCH v4 03/18] net/i40e: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 04/18] net/iavf: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 05/18] net/ice: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 06/18] net/ixgbe: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 07/18] net/mlx5: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 08/18] net/sfc: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 09/18] net/bnxt: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 10/18] net/enic: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 11/18] net/fm10k: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 12/18] net/hns3: " Tyler Retzlaff
2024-02-18  3:00     ` fengchengwen
2024-02-15  6:21   ` [PATCH v4 13/18] net/ionic: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 14/18] net/thunderx: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 15/18] net/virtio: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 16/18] net/cnxk: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 17/18] common/idpf: " Tyler Retzlaff
2024-02-15  6:21   ` [PATCH v4 18/18] examples/dma: " Tyler Retzlaff
2024-02-15  9:37   ` [PATCH v4 00/18] " Morten Brørup
2024-02-24  8:21 ` [PATCH v5 00/22] stop using RTE_MARKER extensions Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 01/22] eal: provide macro to expand marker extensions Tyler Retzlaff
2024-02-24 10:51     ` Thomas Monjalon
2024-02-24 11:18       ` Thomas Monjalon
2024-02-24  8:21   ` [PATCH v5 02/22] mbuf: expand rte markers empty when building with MSVC Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 03/22] security: " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 04/22] cryptodev: " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 05/22] mbuf: stop using mbuf cacheline marker fields Tyler Retzlaff
2024-02-24 10:58     ` Thomas Monjalon
2024-02-26 18:20       ` Stephen Hemminger
2024-02-24  8:21   ` [PATCH v5 06/22] mbuf: add mbuf descriptor accessors Tyler Retzlaff
2024-02-24 11:01     ` Thomas Monjalon
2024-02-24  8:21   ` [PATCH v5 07/22] common/idpf: use " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 08/22] net/bnxt: " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 09/22] net/cnxk: " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 10/22] net/enic: " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 11/22] net/fm10k: " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 12/22] net/hns3: " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 13/22] net/i40e: " Tyler Retzlaff
2024-02-24  8:21   ` [PATCH v5 14/22] net/iavf: " Tyler Retzlaff
2024-02-24  8:22   ` [PATCH v5 15/22] net/ice: " Tyler Retzlaff
2024-02-24  8:22   ` [PATCH v5 16/22] net/ionic: " Tyler Retzlaff
2024-02-24  8:22   ` [PATCH v5 17/22] net/ixgbe: " Tyler Retzlaff
2024-02-24  8:22   ` [PATCH v5 18/22] net/mlx5: " Tyler Retzlaff
2024-02-24  8:22   ` [PATCH v5 19/22] net/octeon_ep: " Tyler Retzlaff
2024-02-24  8:22   ` [PATCH v5 20/22] net/sfc: " Tyler Retzlaff
2024-02-24  8:22   ` [PATCH v5 21/22] net/thunderx: " Tyler Retzlaff
2024-02-24  8:22   ` [PATCH v5 22/22] net/virtio: " Tyler Retzlaff
2024-02-24 10:42   ` [PATCH v5 00/22] stop using RTE_MARKER extensions Morten Brørup
2024-02-24 11:13     ` Thomas Monjalon
2024-02-24 11:23       ` Morten Brørup
2024-02-27  5:41 ` [PATCH v6 00/23] stop and remove RTE_MARKER typedefs Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 01/23] mbuf: add accessors for rearm and Rx descriptor fields Tyler Retzlaff
2024-02-27  9:10     ` Morten Brørup
2024-02-27 17:17       ` Tyler Retzlaff
2024-02-28  8:28         ` Morten Brørup
2024-02-28 16:20           ` Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Tyler Retzlaff
2024-02-27 10:02     ` Konstantin Ananyev
2024-03-14 16:51     ` Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 03/23] common/idpf: use mbuf descriptor accessors Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 04/23] net/bnxt: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 05/23] net/cnxk: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 06/23] net/enic: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 07/23] net/fm10k: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 08/23] net/hns3: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 09/23] net/i40e: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 10/23] net/iavf: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 11/23] net/ice: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 12/23] net/ionic: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 13/23] net/ixgbe: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 14/23] net/mlx5: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 15/23] net/octeon_ep: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 16/23] net/sfc: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 17/23] net/thunderx: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 18/23] net/virtio: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 19/23] examples/dma: use mbuf descriptor accessor Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Tyler Retzlaff
2024-02-27  9:15     ` Morten Brørup
2024-02-27 10:03     ` Konstantin Ananyev
2024-02-27 15:18     ` David Marchand
2024-02-27 16:04       ` Morten Brørup
2024-02-27 17:23       ` Tyler Retzlaff
2024-02-28 10:42         ` David Marchand
2024-02-28 14:03       ` Dodji Seketeli
2024-02-28 14:43         ` David Marchand
2024-02-29 14:50           ` Dodji Seketeli
2024-02-28 14:18     ` David Marchand
2024-02-28 15:01       ` Morten Brørup
2024-02-28 15:33         ` David Marchand
2024-02-28 17:20       ` Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 21/23] security: remove " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 22/23] cryptodev: " Tyler Retzlaff
2024-02-27  5:41   ` [PATCH v6 23/23] devtools: forbid new use of rte marker typedefs Tyler Retzlaff
2024-03-20 22:01 ` [PATCH v7 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
2024-03-20 22:01   ` [PATCH v7 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
2024-03-26 10:16     ` Morten Brørup
2024-03-27 18:14       ` Tyler Retzlaff
2024-03-27 19:45         ` Morten Brørup
2024-03-20 22:01   ` [PATCH v7 2/4] mbuf: remove rte marker fields Tyler Retzlaff
2024-03-21 10:32     ` Bruce Richardson
2024-03-21 15:31       ` Tyler Retzlaff
2024-03-21 16:19         ` Morten Brørup
2024-03-26 11:12     ` Morten Brørup
2024-03-20 22:01   ` [PATCH v7 3/4] security: " Tyler Retzlaff
2024-03-26 10:28     ` Morten Brørup
2024-03-27 19:59       ` Tyler Retzlaff
2024-03-20 22:01   ` [PATCH v7 4/4] cryptodev: " Tyler Retzlaff
2024-03-26 10:31     ` Morten Brørup
2024-03-27 19:56 ` [PATCH v8 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
2024-03-27 19:56   ` [PATCH v8 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
2024-03-27 19:56   ` [PATCH v8 2/4] mbuf: remove rte marker fields Tyler Retzlaff
2024-03-27 19:56   ` [PATCH v8 3/4] security: " Tyler Retzlaff
2024-03-27 19:56   ` [PATCH v8 4/4] cryptodev: " Tyler Retzlaff
2024-04-02 20:08 ` [PATCH v9 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
2024-04-02 20:08   ` [PATCH v9 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
2024-04-02 20:08   ` [PATCH v9 2/4] mbuf: remove rte marker fields Tyler Retzlaff
2024-04-02 20:45     ` Stephen Hemminger
2024-04-02 20:51       ` Tyler Retzlaff
2024-04-02 20:08   ` [PATCH v9 3/4] security: " Tyler Retzlaff
2024-04-02 20:08   ` [PATCH v9 4/4] cryptodev: " Tyler Retzlaff
2024-04-03 17:53 ` [PATCH v10 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
2024-04-03 17:53   ` [PATCH v10 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
2024-04-03 21:49     ` Stephen Hemminger
2024-04-03 17:53   ` [PATCH v10 2/4] mbuf: remove rte marker fields Tyler Retzlaff
2024-04-03 19:32     ` Morten Brørup
2024-04-03 22:45       ` Tyler Retzlaff
2024-04-03 21:49     ` Stephen Hemminger
2024-04-03 17:53   ` [PATCH v10 3/4] security: " Tyler Retzlaff
2024-04-03 21:50     ` Stephen Hemminger
2024-04-03 17:53   ` [PATCH v10 4/4] cryptodev: " Tyler Retzlaff
2024-04-03 21:50     ` Stephen Hemminger
2024-04-04 17:51 ` [PATCH v11 0/4] remove use of RTE_MARKER fields in libraries Tyler Retzlaff
2024-04-04 17:51   ` [PATCH v11 1/4] net/i40e: use inline prefetch function Tyler Retzlaff
2024-04-04 17:51   ` [PATCH v11 2/4] mbuf: remove rte marker fields Tyler Retzlaff
2024-04-04 17:51   ` [PATCH v11 3/4] security: " Tyler Retzlaff
2024-04-04 17:51   ` [PATCH v11 4/4] cryptodev: " Tyler Retzlaff

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).