[1/3] eal: introduce structure marker typedefs

Message ID 20191208113413.2179329-1-jerinj@marvell.com (mailing list archive)
State Superseded, archived
Headers
Series [1/3] eal: introduce structure marker typedefs |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Jerin Jacob Kollanukkaran Dec. 8, 2019, 11:34 a.m. UTC
  From: Jerin Jacob <jerinj@marvell.com>

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 <jerinj@marvell.com>
---
 lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Thomas Monjalon Dec. 10, 2019, 10:46 p.m. UTC | #1
08/12/2019 12:34, jerinj@marvell.com:
> From: Jerin Jacob <jerinj@marvell.com>
> 
> 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 <jerinj@marvell.com>
> ---
>  lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++

Good idea, thanks.

> +/** Generic marker for a point in a structure. */

I think "a point" may be replaced with "any place" or something else?

> +__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.
  
Jerin Jacob Dec. 19, 2019, 10:34 a.m. UTC | #2
On Wed, Dec 11, 2019 at 4:16 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 08/12/2019 12:34, jerinj@marvell.com:
> > From: Jerin Jacob <jerinj@marvell.com>
> >
> > 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 <jerinj@marvell.com>
> > ---
> >  lib/librte_eal/common/include/rte_common.h | 12 ++++++++++++
>
> Good idea, thanks.
>
> > +/** 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.

>
> > +__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.

Will fix it v2.

> If it is another reason, we could create another meaningful EAL macro.
>
>
>
  

Patch

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 459d082d1..9556299ba 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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