[v2,1/3] eal: introduce structure marker typedefs

Message ID 20191219112507.3142025-1-jerinj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,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/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Jerin Jacob Kollanukkaran Dec. 19, 2019, 11:25 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>
---

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(+)
  

Comments

Gavin Hu Dec. 20, 2019, 4:21 a.m. UTC | #1
Series-reviewed-by: Gavin Hu <gavin.hu@arm.com>
  
Matan Azrad Dec. 26, 2019, 8:15 a.m. UTC | #2
Hi

From: Jerin Jacob
> 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>
> ---
> 
> 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(+)
> 
> diff --git a/lib/librte_eal/common/include/rte_common.h
> b/lib/librte_eal/common/include/rte_common.h
> index 459d082d1..00c8b8434 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 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?

>  /**
>   * Combines 32b inputs most significant set bits into the least
> --
> 2.24.1
  
Jerin Jacob Jan. 2, 2020, 6:27 a.m. UTC | #3
On Thu, Dec 26, 2019 at 1:45 PM Matan Azrad <matan@mellanox.com> wrote:
>
> Hi
>
> From: Jerin Jacob
> > 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>
> > ---
> >
> > 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(+)
> >
> > diff --git a/lib/librte_eal/common/include/rte_common.h
> > b/lib/librte_eal/common/include/rte_common.h
> > index 459d082d1..00c8b8434 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 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.

>
> >  /**
> >   * Combines 32b inputs most significant set bits into the least
> > --
> > 2.24.1
>
  
Matan Azrad Jan. 2, 2020, 9:48 a.m. UTC | #4
From: Jerin Jacob 
> On Thu, Dec 26, 2019 at 1:45 PM Matan Azrad <matan@mellanox.com>
> wrote:
> >
> > Hi
> >
> > From: Jerin Jacob
> > > 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>
> > > ---
> > >
> > > 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(+)
> > >
> > > diff --git a/lib/librte_eal/common/include/rte_common.h
> > > b/lib/librte_eal/common/include/rte_common.h
> > > index 459d082d1..00c8b8434 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 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.

Sorry, missed it.
Series-acked-by: Matan Azrad <matan@mellanox.com>


> >
> > >  /**
> > >   * Combines 32b inputs most significant set bits into the least
> > > --
> > > 2.24.1
> >
  
Jerin Jacob Jan. 16, 2020, 1:09 p.m. UTC | #5
On Thu, Jan 2, 2020 at 3:18 PM Matan Azrad <matan@mellanox.com> wrote:
>
>
>
> From: Jerin Jacob
> > On Thu, Dec 26, 2019 at 1:45 PM Matan Azrad <matan@mellanox.com>
> > wrote:
> > >
> > > Hi

>
> Sorry, missed it.
> Series-acked-by: Matan Azrad <matan@mellanox.com>

Ping for merge.


>
>
> > >
> > > >  /**
> > > >   * Combines 32b inputs most significant set bits into the least
> > > > --
> > > > 2.24.1
> > >
  
Thomas Monjalon Jan. 20, 2020, 8:11 p.m. UTC | #6
19/12/2019 12:25, 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>
> ---
> 
> v2:
> - Changed __extension__  to  RTE_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.
  

Patch

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 459d082d1..00c8b8434 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 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