eal: introduce structure marker typedefs
PATCH 1/3 eal: introduce structure marker typedefs
From: Jerin Jacob <[email protected]>
Introduce EAL typedef for structure 1B, 2B, 4B, 8B alignment marking and a generic marker for a point in a structure.
--- lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
lib/librte_eal/common/include/rte_common.h +12 -0
@@ -335,6 +335,18 @@ typedef uint64_t phys_addr_t;typedef uint64_t rte_iova_t ;#define RTE_BAD_IOVA ((rte_iova_t)-1) +/*********** Structure alignment markers ********/ + +/** Generic marker for a point in a structure. */ +__extension__typedef void *RTE_MARKER [0 ]; +/** Marker for 1B alignment in a structure. */ +__extension__typedef uint8_t RTE_MARKER8 [0 ]; +/** Marker for 2B alignment in a structure. */ +__extension__typedef uint16_t RTE_MARKER16 [0 ]; +/** Marker for 4B alignment in a structure. */ +__extension__typedef uint16_t RTE_MARKER32 [0 ]; +/** Marker for 8B alignment in a structure. */ +__extension__typedef uint64_t RTE_MARKER64 [0 ];/** * Combines 32b inputs most significant set bits into the least
Signature · 1 line
2.24.0
PATCH 2/3 drivers: use structure marker typedef in eal
From: Jerin Jacob <[email protected]>
Use new marker typedef available in EAL.
--- drivers/net/ark/ark_ethdev_rx.c | 2 +- drivers/net/ark/ark_ethdev_tx.c | 2 +- drivers/net/octeontx2/otx2_ethdev.h | 6 +++--- drivers/net/thunderx/nicvf_struct.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ark/ark_ethdev_rx.c +1 -1
@@ -57,7 +57,7 @@ struct ark_rx_queue {/* separate cache line */ /* second cache line - fields only used in slow path */ - MARKER cacheline1 __rte_cache_min_aligned; + RTE_MARKER cacheline1 __rte_cache_min_aligned;volatile uint32_t prod_index;/* step 2 filled by FPGA */ } __rte_cache_aligned;
drivers/net/ark/ark_ethdev_tx.c +1 -1
@@ -42,7 +42,7 @@ struct ark_tx_queue {uint32_t pad[1 ];/* second cache line - fields only used in slow path */ - MARKER cacheline1 __rte_cache_min_aligned; + RTE_MARKER cacheline1 __rte_cache_min_aligned;uint32_t cons_index;/* hw is done, can be freed */ } __rte_cache_aligned;
drivers/net/octeontx2/otx2_ethdev.h +3 -3
@@ -254,7 +254,7 @@ struct otx2_vlan_info {struct otx2_eth_dev {OTX2_DEV ;/* Base class */ -MARKER otx2_eth_dev_data_start; +RTE_MARKER otx2_eth_dev_data_start;uint16_t sqb_size;uint16_t rx_chan_base;uint16_t tx_chan_base;
@@ -335,7 +335,7 @@ struct otx2_eth_txq {rte_iova_t fc_iova;uint16_t sqes_per_sqb_log2;int16_t nb_sqb_bufs_adj; -MARKER slow_path_start; +RTE_MARKER slow_path_start;uint16_t nb_sqb_bufs;uint16_t sq;uint64_t offloads;
@@ -357,7 +357,7 @@ struct otx2_eth_rxq {uint32_t available;uint16_t rq;struct otx2_timesync_info *tstamp; -MARKER slow_path_start; +RTE_MARKER slow_path_start;uint64_t aura;uint64_t offloads;uint32_t qlen;
drivers/net/thunderx/nicvf_struct.h +2 -2
@@ -55,7 +55,7 @@ union mbuf_initializer { };struct nicvf_rxq { -MARKER rxq_fastpath_data_start; +RTE_MARKER rxq_fastpath_data_start;uint8_t rbptr_offset;uint16_t rx_free_thresh;uint32_t head;
@@ -69,7 +69,7 @@ struct nicvf_rxq {struct rte_mempool *pool;union cq_entry_t *desc;union mbuf_initializer mbuf_initializer; -MARKER rxq_fastpath_data_end; +RTE_MARKER rxq_fastpath_data_end;uint8_t rx_drop_en;uint16_t precharge_cnt;uint16_t port_id;
Signature · 1 line
2.24.0
PATCH 3/3 mbuf: use structure marker typedef in eal
In reply to [email protected]From: Jerin Jacob <[email protected]>
Use new marker typedef available in EAL and remove private marker typedef.
--- lib/librte_mbuf/rte_mbuf_core.h | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +4 -17
@@ -406,19 +406,6 @@ extern "C" {#define RTE_MBUF_DEFAULT_BUF_SIZE \ (RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM) -/* -* define a set of marker types that can be used to refer to set points in the -* mbuf. -*/ -__extension__ -typedef void *MARKER [0 ];/**< generic marker for a point in a structure */ -__extension__ -typedef uint8_t MARKER8 [0 ];/**< generic marker with 1B alignment */ - -/** marker that allows us to overwrite 8 bytes with a single assignment */ -__extension__ -typedef uint64_t MARKER64 [0 ]; -struct rte_mbuf_sched {uint32_t queue_id;/**< Queue ID. */ uint8_t traffic_class;
@@ -478,7 +465,7 @@ enum {* The generic rte_mbuf, containing a packet mbuf. */ struct rte_mbuf { -MARKER cacheline0; +RTE_MARKER cacheline0;void *buf_addr;/**< Virtual address of segment buffer. */ /**
@@ -494,7 +481,7 @@ struct rte_mbuf { }__rte_aligned (sizeof (rte_iova_t));/* next 8 bytes are initialised on RX descriptor rearm */ -MARKER64 rearm_data; +RTE_MARKER64 rearm_data;uint16_t data_off;/**
@@ -522,7 +509,7 @@ struct rte_mbuf {uint64_t ol_flags;/**< Offload features. */ /* remaining bytes are set on RX when pulling packet from descriptor */ -MARKER rx_descriptor_fields1; +RTE_MARKER rx_descriptor_fields1;/* * The packet type, which is the combination of outer/inner L2, L3, L4
@@ -610,7 +597,7 @@ struct rte_mbuf {uint64_t timestamp;/* second cache line - fields only used in slow path or on TX */ - MARKER cacheline1 __rte_cache_min_aligned; + RTE_MARKER cacheline1 __rte_cache_min_aligned;RTE_STD_C11 union {
Signature · 1 line
2.24.0
08/12/2019 12:34, [email protected]:
Quoted 8 lines
From: Jerin Jacob <[email protected]>
Introduce EAL typedef for structure 1B, 2B, 4B, 8B alignment marking and a generic marker for a point in a structure.
Signed-off-by Jerin Jacob <[email protected]>--- lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++
Good idea, thanks.
Quoted 1 line
+/** Generic marker for a point in a structure. */
I think "a point" may be replaced with "any place" or something else?
Quoted 1 line
+__extension__ typedef void *RTE_MARKER[0];
Why do we need an extension?
If it is part of C11, we should use RTE_STD_C11 instead.
If it is another reason, we could create another meaningful EAL macro.
Quoted 11 lines · Thomas Monjalon
08/12/2019 12:34, [email protected]:
Quoted 8 lines
From: Jerin Jacob <[email protected]>
Introduce EAL typedef for structure 1B, 2B, 4B, 8B alignment marking and a generic marker for a point in a structure.
Signed-off-by Jerin Jacob <[email protected]>--- lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++
Quoted 5 lines
Good idea, thanks.
Quoted 1 line
+/** Generic marker for a point in a structure. */
I think "a point" may be replaced with "any place" or something else?
Will fix it v2.
Quoted 5 lines
Quoted 2 lines
+__extension__ typedef void *RTE_MARKER[0];
Why do we need an extension?
If it is part of C11, we should useRTE_STD_C11instead.
Will fix it v2.
Quoted 4 lines
If it is another reason, we could create another meaningful EAL macro.
PATCH v2 1/3 eal: introduce structure marker typedefs
In reply to [email protected]From: Jerin Jacob <[email protected]>
Introduce EAL typedef for structure 1B, 2B, 4B, 8B alignment marking and a generic marker for a point in a structure.
---
v2:
- Changed __extension__ to RTE_STD_C11 (Thomas)
- Change "a point" to "any place" of RTE_MARKER comment(Thomas)
lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
lib/librte_eal/common/include/rte_common.h +12 -0
@@ -335,6 +335,18 @@ typedef uint64_t phys_addr_t;typedef uint64_t rte_iova_t ;#define RTE_BAD_IOVA ((rte_iova_t)-1) +/*********** Structure alignment markers ********/ + +/** Generic marker for any place in a structure. */ +RTE_STD_C11 typedef void *RTE_MARKER[0]; +/** Marker for 1B alignment in a structure. */ +RTE_STD_C11 typedef uint8_t RTE_MARKER8[0]; +/** Marker for 2B alignment in a structure. */ +RTE_STD_C11 typedef uint16_t RTE_MARKER16[0]; +/** Marker for 4B alignment in a structure. */ +RTE_STD_C11 typedef uint16_t RTE_MARKER32[0]; +/** Marker for 8B alignment in a structure. */ +RTE_STD_C11 typedef uint64_t RTE_MARKER64[0];/** * Combines 32b inputs most significant set bits into the least
Signature · 1 line
2.24.1
PATCH v2 2/3 drivers: use structure marker typedef in eal
From: Jerin Jacob <[email protected]>
Use new marker typedef available in EAL.
--- drivers/net/ark/ark_ethdev_rx.c | 2 +- drivers/net/ark/ark_ethdev_tx.c | 2 +- drivers/net/octeontx2/otx2_ethdev.h | 6 +++--- drivers/net/thunderx/nicvf_struct.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ark/ark_ethdev_rx.c +1 -1
@@ -57,7 +57,7 @@ struct ark_rx_queue {/* separate cache line */ /* second cache line - fields only used in slow path */ - MARKER cacheline1 __rte_cache_min_aligned; + RTE_MARKER cacheline1 __rte_cache_min_aligned;volatile uint32_t prod_index;/* step 2 filled by FPGA */ } __rte_cache_aligned;
drivers/net/ark/ark_ethdev_tx.c +1 -1
@@ -42,7 +42,7 @@ struct ark_tx_queue {uint32_t pad[1 ];/* second cache line - fields only used in slow path */ - MARKER cacheline1 __rte_cache_min_aligned; + RTE_MARKER cacheline1 __rte_cache_min_aligned;uint32_t cons_index;/* hw is done, can be freed */ } __rte_cache_aligned;
drivers/net/octeontx2/otx2_ethdev.h +3 -3
@@ -254,7 +254,7 @@ struct otx2_vlan_info {struct otx2_eth_dev {OTX2_DEV ;/* Base class */ -MARKER otx2_eth_dev_data_start; +RTE_MARKER otx2_eth_dev_data_start;uint16_t sqb_size;uint16_t rx_chan_base;uint16_t tx_chan_base;
@@ -335,7 +335,7 @@ struct otx2_eth_txq {rte_iova_t fc_iova;uint16_t sqes_per_sqb_log2;int16_t nb_sqb_bufs_adj; -MARKER slow_path_start; +RTE_MARKER slow_path_start;uint16_t nb_sqb_bufs;uint16_t sq;uint64_t offloads;
@@ -357,7 +357,7 @@ struct otx2_eth_rxq {uint32_t available;uint16_t rq;struct otx2_timesync_info *tstamp; -MARKER slow_path_start; +RTE_MARKER slow_path_start;uint64_t aura;uint64_t offloads;uint32_t qlen;
drivers/net/thunderx/nicvf_struct.h +2 -2
@@ -55,7 +55,7 @@ union mbuf_initializer { };struct nicvf_rxq { -MARKER rxq_fastpath_data_start; +RTE_MARKER rxq_fastpath_data_start;uint8_t rbptr_offset;uint16_t rx_free_thresh;uint32_t head;
@@ -69,7 +69,7 @@ struct nicvf_rxq {struct rte_mempool *pool;union cq_entry_t *desc;union mbuf_initializer mbuf_initializer; -MARKER rxq_fastpath_data_end; +RTE_MARKER rxq_fastpath_data_end;uint8_t rx_drop_en;uint16_t precharge_cnt;uint16_t port_id;
Signature · 1 line
2.24.1
PATCH v2 3/3 mbuf: use structure marker typedef in eal
In reply to [email protected]From: Jerin Jacob <[email protected]>
Use new marker typedef available in EAL and remove private marker typedef.
--- lib/librte_mbuf/rte_mbuf_core.h | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-)
lib/librte_mbuf/rte_mbuf_core.h +4 -17
@@ -406,19 +406,6 @@ extern "C" {#define RTE_MBUF_DEFAULT_BUF_SIZE \ (RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM) -/* -* define a set of marker types that can be used to refer to set points in the -* mbuf. -*/ -__extension__ -typedef void *MARKER [0 ];/**< generic marker for a point in a structure */ -__extension__ -typedef uint8_t MARKER8 [0 ];/**< generic marker with 1B alignment */ - -/** marker that allows us to overwrite 8 bytes with a single assignment */ -__extension__ -typedef uint64_t MARKER64 [0 ]; -struct rte_mbuf_sched {uint32_t queue_id;/**< Queue ID. */ uint8_t traffic_class;
@@ -478,7 +465,7 @@ enum {* The generic rte_mbuf, containing a packet mbuf. */ struct rte_mbuf { -MARKER cacheline0; +RTE_MARKER cacheline0;void *buf_addr;/**< Virtual address of segment buffer. */ /**
@@ -494,7 +481,7 @@ struct rte_mbuf { }__rte_aligned (sizeof (rte_iova_t));/* next 8 bytes are initialised on RX descriptor rearm */ -MARKER64 rearm_data; +RTE_MARKER64 rearm_data;uint16_t data_off;/**
@@ -522,7 +509,7 @@ struct rte_mbuf {uint64_t ol_flags;/**< Offload features. */ /* remaining bytes are set on RX when pulling packet from descriptor */ -MARKER rx_descriptor_fields1; +RTE_MARKER rx_descriptor_fields1;/* * The packet type, which is the combination of outer/inner L2, L3, L4
@@ -610,7 +597,7 @@ struct rte_mbuf {uint64_t timestamp;/* second cache line - fields only used in slow path or on TX */ - MARKER cacheline1 __rte_cache_min_aligned; + RTE_MARKER cacheline1 __rte_cache_min_aligned;RTE_STD_C11 union {
Signature · 1 line
2.24.1
Re: [dpdk-dev] [PATCH v2 3/3] mbuf: use structure marker typedef in eal
Quoted 6 lines · On Thu, Dec 19, 2019 at 04:55:07PM +0530, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Use new marker typedef available in EAL and remove private marker typedef.
Signed-off-by Jerin Jacob <[email protected]>
Thanks
Re: [dpdk-dev] [PATCH v2 3/3] mbuf: use structure marker typedef in eal
26/12/2019 17:24, Olivier Matz:
Quoted 9 lines · On Thu, Dec 19, 2019 at 04:55:07PM +0530, [email protected] wrote:
Quoted 6 lines
From: Jerin Jacob <[email protected]>
Use new marker typedef available in EAL and remove private marker typedef.
Signed-off-by Jerin Jacob <[email protected]>Acked-by Olivier Matz <[email protected]>
Series applied, thanks
Note: I reverted the use of RTE_STD_C11 to __extension__ (as in your v1) which seems more correct (and allow pedantic mlx PMDs to build).
Hi
From: Jerin Jacob
Quoted 25 lines
From: Jerin Jacob <[email protected]>
Introduce EAL typedef for structure 1B, 2B, 4B, 8B alignment marking and a generic marker for a point in a structure.
Signed-off-by Jerin Jacob <[email protected]>---
v2:
- Changed__extension__toRTE_STD_C11(Thomas)
- Change "a point" to "any place" ofRTE_MARKERcomment(Thomas)lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/librte_eal/common/include/rte_common.h +2
-0@@ -335,6 +335,18 @@ typedef uint64_t phys_addr_t; typedef uint64_t rte_iova_t;#define RTE_BAD_IOVA ((rte_iova_t)-1) +/*********** Structure alignment markers ********/ +
lib/librte_eal/common/include/rte_common.h typedef uint64_t phys_addr_t; typedef uint64_t · line 348
Quoted 10 lines
lib/librte_eal/common/include/rte_common.h +10
-0+/** Generic marker for any place in a structure. */ +RTE_STD_C11 typedef void *RTE_MARKER[0]; +/** Marker for 1B alignment in a structure. */ +RTE_STD_C11 typedef uint8_t RTE_MARKER8[0]; +/** Marker for 2B alignment in a structure. */ +RTE_STD_C11 typedef uint16_t RTE_MARKER16[0]; +/** Marker for 4B alignment in a structure. */ +RTE_STD_C11 typedef uint16_t RTE_MARKER32[0]; +/** Marker for 8B alignment in a structure. */ +RTE_STD_C11 typedef uint64_t RTE_MARKER64[0];
I saw there are similar definitions in mbuf library.
What do you think about moving all libraries to use the same define from EAL?
Quoted 4 lines
lib/librte_eal/common/include/rte_common.h +0
-1/** * Combines 32b inputs most significant set bits into the least -- 2.24.1
Quoted 27 lines · Matan Azrad
Hi
From: Jerin Jacob
Quoted 23 lines
From: Jerin Jacob <[email protected]>
Introduce EAL typedef for structure 1B, 2B, 4B, 8B alignment marking and a generic marker for a point in a structure.
Signed-off-by Jerin Jacob <[email protected]>---
v2:
- Changed__extension__toRTE_STD_C11(Thomas)
- Change "a point" to "any place" ofRTE_MARKERcomment(Thomas)lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/librte_eal/common/include/rte_common.h +0
-0@@ -335,6 +335,18 @@ typedef uint64_t phys_addr_t; typedef uint64_t rte_iova_t;#define RTE_BAD_IOVA ((rte_iova_t)-1)
Quoted 15 lines
lib/librte_eal/common/include/rte_common.h typedef uint64_t phys_addr_t; · line 349
Quoted 12 lines
lib/librte_eal/common/include/rte_common.h +12
-0+/*********** Structure alignment markers ********/ + +/** Generic marker for any place in a structure. */ +RTE_STD_C11 typedef void *RTE_MARKER[0]; +/** Marker for 1B alignment in a structure. */ +RTE_STD_C11 typedef uint8_t RTE_MARKER8[0]; +/** Marker for 2B alignment in a structure. */ +RTE_STD_C11 typedef uint16_t RTE_MARKER16[0]; +/** Marker for 4B alignment in a structure. */ +RTE_STD_C11 typedef uint16_t RTE_MARKER32[0]; +/** Marker for 8B alignment in a structure. */ +RTE_STD_C11 typedef uint64_t RTE_MARKER64[0];I saw there are similar definitions in mbuf library.
What do you think about moving all libraries to use the same define from EAL?
It is already done in 2/3 and 3/3 patches in the series.
Quoted 6 lines
Quoted 5 lines
lib/librte_eal/common/include/rte_common.h +0
-1/** * Combines 32b inputs most significant set bits into the least -- 2.24.1
From: Jerin Jacob
Quoted 44 lines
Quoted 27 lines · Matan Azrad
Hi
From: Jerin Jacob
Quoted 23 lines
From: Jerin Jacob <[email protected]>
Introduce EAL typedef for structure 1B, 2B, 4B, 8B alignment marking and a generic marker for a point in a structure.
Signed-off-by Jerin Jacob <[email protected]>---
v2:
- Changed__extension__toRTE_STD_C11(Thomas)
- Change "a point" to "any place" ofRTE_MARKERcomment(Thomas)lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/librte_eal/common/include/rte_common.h +0
-0@@ -335,6 +335,18 @@ typedef uint64_t phys_addr_t; typedef uint64_t rte_iova_t;#define RTE_BAD_IOVA ((rte_iova_t)-1)Quoted 15 lines
lib/librte_eal/common/include/rte_common.h typedef uint64_t phys_addr_t; · line 349
Quoted 12 lines
lib/librte_eal/common/include/rte_common.h +12
-0+/*********** Structure alignment markers ********/ + +/** Generic marker for any place in a structure. */ +RTE_STD_C11 typedef void *RTE_MARKER[0]; +/** Marker for 1B alignment in a structure. */ +RTE_STD_C11 typedef uint8_t RTE_MARKER8[0]; +/** Marker for 2B alignment in a structure. */ +RTE_STD_C11 typedef uint16_t RTE_MARKER16[0]; +/** Marker for 4B alignment in a structure. */ +RTE_STD_C11 typedef uint16_t RTE_MARKER32[0]; +/** Marker for 8B alignment in a structure. */ +RTE_STD_C11 typedef uint64_t RTE_MARKER64[0];I saw there are similar definitions in mbuf library.
What do you think about moving all libraries to use the same define from
Quoted 3 lines
EAL?
It is already done in 2/3 and 3/3 patches in the series.
Sorry, missed it.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
lib/librte_eal/common/include/rte_common.h +0
-1/** * Combines 32b inputs most significant set bits into the least -- 2.24.1
Quoted 4 lines · Matan Azrad
From: Jerin Jacob
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines · Matan Azrad
Hi
Sorry, missed it.
Series-acked-by Matan Azrad <[email protected]>
Ping for merge.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
/**
* Combines 32b inputs most significant set bits into the least
--
2.24.1
19/12/2019 12:25, [email protected]:
Quoted 10 lines
From: Jerin Jacob <[email protected]>
Introduce EAL typedef for structure 1B, 2B, 4B, 8B alignment marking and a generic marker for a point in a structure.
Signed-off-by Jerin Jacob <[email protected]>---
v2:
- Changed__extension__toRTE_STD_C11(Thomas)
Actually I was just asking a question to know if zero-size arrays are part of C11 or not. It seems not, so better to keep as __extension__. Or it could be a new macro.