DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
@ 2020-07-16 12:12 Raslan Darawsheh
  2020-07-21  0:05 ` Ferruh Yigit
  2020-07-21  8:31 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
  0 siblings, 2 replies; 8+ messages in thread
From: Raslan Darawsheh @ 2020-07-16 12:12 UTC (permalink / raw)
  To: dev; +Cc: olivier.matz, stable

when trying to compile rte_mpls with pedantic enabled,
it will complain about bit field defintion.
error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic]
error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic]
error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic]

This fixes the compilation error.

Fixes: e480cf487a0d ("net: add MPLS header structure")
Cc: olivier.matz@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
 lib/librte_net/rte_mpls.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h
index db91707..ecd1f64 100644
--- a/lib/librte_net/rte_mpls.h
+++ b/lib/librte_net/rte_mpls.h
@@ -24,13 +24,13 @@ extern "C" {
 struct rte_mpls_hdr {
 	uint16_t tag_msb;   /**< Label(msb). */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
-	uint8_t tag_lsb:4;  /**< Label(lsb). */
-	uint8_t tc:3;       /**< Traffic class. */
-	uint8_t bs:1;       /**< Bottom of stack. */
+	uint32_t tag_lsb:4;  /**< Label(lsb). */
+	uint32_t tc:3;       /**< Traffic class. */
+	uint32_t bs:1;       /**< Bottom of stack. */
 #else
-	uint8_t bs:1;       /**< Bottom of stack. */
-	uint8_t tc:3;       /**< Traffic class. */
-	uint8_t tag_lsb:4;  /**< label(lsb) */
+	uint32_t bs:1;       /**< Bottom of stack. */
+	uint32_t tc:3;       /**< Traffic class. */
+	uint32_t tag_lsb:4;  /**< label(lsb) */
 #endif
 	uint8_t  ttl;       /**< Time to live. */
 } __rte_packed;
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
  2020-07-16 12:12 [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled Raslan Darawsheh
@ 2020-07-21  0:05 ` Ferruh Yigit
  2020-07-21  7:09   ` Olivier Matz
  2020-07-21  8:31 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
  1 sibling, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2020-07-21  0:05 UTC (permalink / raw)
  To: Raslan Darawsheh, dev; +Cc: olivier.matz, stable

On 7/16/2020 1:12 PM, Raslan Darawsheh wrote:
> when trying to compile rte_mpls with pedantic enabled,
> it will complain about bit field defintion.
> error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic]
> error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic]
> error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic]
'
I tried to reproduce by adding to '-pedantic' to 'rte_net.c' (which uses
'rte_mpls.h') but not able to get the warning. Is this happen with specific
version of the compiler?

> 
> This fixes the compilation error.
> 
> Fixes: e480cf487a0d ("net: add MPLS header structure")
> Cc: olivier.matz@6wind.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> ---
>  lib/librte_net/rte_mpls.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h
> index db91707..ecd1f64 100644
> --- a/lib/librte_net/rte_mpls.h
> +++ b/lib/librte_net/rte_mpls.h
> @@ -24,13 +24,13 @@ extern "C" {
>  struct rte_mpls_hdr {
>  	uint16_t tag_msb;   /**< Label(msb). */
>  #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> -	uint8_t tag_lsb:4;  /**< Label(lsb). */
> -	uint8_t tc:3;       /**< Traffic class. */
> -	uint8_t bs:1;       /**< Bottom of stack. */
> +	uint32_t tag_lsb:4;  /**< Label(lsb). */
> +	uint32_t tc:3;       /**< Traffic class. */
> +	uint32_t bs:1;       /**< Bottom of stack. */
>  #else
> -	uint8_t bs:1;       /**< Bottom of stack. */
> -	uint8_t tc:3;       /**< Traffic class. */
> -	uint8_t tag_lsb:4;  /**< label(lsb) */
> +	uint32_t bs:1;       /**< Bottom of stack. */
> +	uint32_t tc:3;       /**< Traffic class. */
> +	uint32_t tag_lsb:4;  /**< label(lsb) */
>  #endif
>  	uint8_t  ttl;       /**< Time to live. */
>  } __rte_packed;

The struct size keeps same after change, do you know if this behavior is part of
standard and guaranteed?

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

* Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
  2020-07-21  0:05 ` Ferruh Yigit
@ 2020-07-21  7:09   ` Olivier Matz
  2020-07-21  7:37     ` Raslan Darawsheh
  0 siblings, 1 reply; 8+ messages in thread
From: Olivier Matz @ 2020-07-21  7:09 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Raslan Darawsheh, dev, stable

Hi,

On Tue, Jul 21, 2020 at 01:05:57AM +0100, Ferruh Yigit wrote:
> On 7/16/2020 1:12 PM, Raslan Darawsheh wrote:
> > when trying to compile rte_mpls with pedantic enabled,
> > it will complain about bit field defintion.
> > error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic]
> > error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic]
> > error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic]
> '
> I tried to reproduce by adding to '-pedantic' to 'rte_net.c' (which uses
> 'rte_mpls.h') but not able to get the warning. Is this happen with specific
> version of the compiler?
> 
> > 
> > This fixes the compilation error.
> > 
> > Fixes: e480cf487a0d ("net: add MPLS header structure")
> > Cc: olivier.matz@6wind.com
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> > ---
> >  lib/librte_net/rte_mpls.h | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h
> > index db91707..ecd1f64 100644
> > --- a/lib/librte_net/rte_mpls.h
> > +++ b/lib/librte_net/rte_mpls.h
> > @@ -24,13 +24,13 @@ extern "C" {
> >  struct rte_mpls_hdr {
> >  	uint16_t tag_msb;   /**< Label(msb). */
> >  #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> > -	uint8_t tag_lsb:4;  /**< Label(lsb). */
> > -	uint8_t tc:3;       /**< Traffic class. */
> > -	uint8_t bs:1;       /**< Bottom of stack. */
> > +	uint32_t tag_lsb:4;  /**< Label(lsb). */
> > +	uint32_t tc:3;       /**< Traffic class. */
> > +	uint32_t bs:1;       /**< Bottom of stack. */
> >  #else
> > -	uint8_t bs:1;       /**< Bottom of stack. */
> > -	uint8_t tc:3;       /**< Traffic class. */
> > -	uint8_t tag_lsb:4;  /**< label(lsb) */
> > +	uint32_t bs:1;       /**< Bottom of stack. */
> > +	uint32_t tc:3;       /**< Traffic class. */
> > +	uint32_t tag_lsb:4;  /**< label(lsb) */
> >  #endif
> >  	uint8_t  ttl;       /**< Time to live. */
> >  } __rte_packed;
> 
> The struct size keeps same after change, do you know if this behavior is part of
> standard and guaranteed?

I have the same fear.

Would it make sense to add __extension__ instead? We already do that
for gre, for instance.

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

* Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
  2020-07-21  7:09   ` Olivier Matz
@ 2020-07-21  7:37     ` Raslan Darawsheh
  2020-07-21  7:50       ` Olivier Matz
  0 siblings, 1 reply; 8+ messages in thread
From: Raslan Darawsheh @ 2020-07-21  7:37 UTC (permalink / raw)
  To: Olivier Matz, Ferruh Yigit; +Cc: dev, stable

Hi,
> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Tuesday, July 21, 2020 10:09 AM
> To: Ferruh Yigit <ferruh.yigit@intel.com>
> Cc: Raslan Darawsheh <rasland@mellanox.com>; dev@dpdk.org;
> stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
> 
> Hi,
> 
> On Tue, Jul 21, 2020 at 01:05:57AM +0100, Ferruh Yigit wrote:
> > On 7/16/2020 1:12 PM, Raslan Darawsheh wrote:
> > > when trying to compile rte_mpls with pedantic enabled,
> > > it will complain about bit field defintion.
> > > error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic]
> > > error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic]
> > > error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic]
> > '
> > I tried to reproduce by adding to '-pedantic' to 'rte_net.c' (which uses
> > 'rte_mpls.h') but not able to get the warning. Is this happen with specific
> > version of the compiler?

Yes It happens only with old compilers, maybe I should have mentioned that in the commit log (my mistake).
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)

> >
> > >
> > > This fixes the compilation error.
> > >
> > > Fixes: e480cf487a0d ("net: add MPLS header structure")
> > > Cc: olivier.matz@6wind.com
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> > > ---
> > >  lib/librte_net/rte_mpls.h | 12 ++++++------
> > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h
> > > index db91707..ecd1f64 100644
> > > --- a/lib/librte_net/rte_mpls.h
> > > +++ b/lib/librte_net/rte_mpls.h
> > > @@ -24,13 +24,13 @@ extern "C" {
> > >  struct rte_mpls_hdr {
> > >  	uint16_t tag_msb;   /**< Label(msb). */
> > >  #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> > > -	uint8_t tag_lsb:4;  /**< Label(lsb). */
> > > -	uint8_t tc:3;       /**< Traffic class. */
> > > -	uint8_t bs:1;       /**< Bottom of stack. */
> > > +	uint32_t tag_lsb:4;  /**< Label(lsb). */
> > > +	uint32_t tc:3;       /**< Traffic class. */
> > > +	uint32_t bs:1;       /**< Bottom of stack. */
> > >  #else
> > > -	uint8_t bs:1;       /**< Bottom of stack. */
> > > -	uint8_t tc:3;       /**< Traffic class. */
> > > -	uint8_t tag_lsb:4;  /**< label(lsb) */
> > > +	uint32_t bs:1;       /**< Bottom of stack. */
> > > +	uint32_t tc:3;       /**< Traffic class. */
> > > +	uint32_t tag_lsb:4;  /**< label(lsb) */
> > >  #endif
> > >  	uint8_t  ttl;       /**< Time to live. */
> > >  } __rte_packed;
> >
> > The struct size keeps same after change, do you know if this behavior is
> part of
> > standard and guaranteed?
> 
> I have the same fear.
To my understanding and please correct me if I'm wrong, the type of the bit fields shouldn't change the size of the structure,
As long as the bit order is kept the same, and I made a small test for it and checked the size of the struct it gave 4 bytes (sizeof()) with both definitions.

> 
> Would it make sense to add __extension__ instead? We already do that
> for gre, for instance.
Yes I guess this can work as well,

Kindest regards
Raslan Darawsheh

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

* Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
  2020-07-21  7:37     ` Raslan Darawsheh
@ 2020-07-21  7:50       ` Olivier Matz
  2020-07-21  8:11         ` Raslan Darawsheh
  0 siblings, 1 reply; 8+ messages in thread
From: Olivier Matz @ 2020-07-21  7:50 UTC (permalink / raw)
  To: Raslan Darawsheh; +Cc: Ferruh Yigit, dev, stable

Hi Raslan,

On Tue, Jul 21, 2020 at 07:37:51AM +0000, Raslan Darawsheh wrote:
> Hi,
> > -----Original Message-----
> > From: Olivier Matz <olivier.matz@6wind.com>
> > Sent: Tuesday, July 21, 2020 10:09 AM
> > To: Ferruh Yigit <ferruh.yigit@intel.com>
> > Cc: Raslan Darawsheh <rasland@mellanox.com>; dev@dpdk.org;
> > stable@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
> > 
> > Hi,
> > 
> > On Tue, Jul 21, 2020 at 01:05:57AM +0100, Ferruh Yigit wrote:
> > > On 7/16/2020 1:12 PM, Raslan Darawsheh wrote:
> > > > when trying to compile rte_mpls with pedantic enabled,
> > > > it will complain about bit field defintion.
> > > > error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic]
> > > > error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic]
> > > > error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic]
> > > '
> > > I tried to reproduce by adding to '-pedantic' to 'rte_net.c' (which uses
> > > 'rte_mpls.h') but not able to get the warning. Is this happen with specific
> > > version of the compiler?
> 
> Yes It happens only with old compilers, maybe I should have mentioned that in the commit log (my mistake).
> gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
> 
> > >
> > > >
> > > > This fixes the compilation error.
> > > >
> > > > Fixes: e480cf487a0d ("net: add MPLS header structure")
> > > > Cc: olivier.matz@6wind.com
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> > > > ---
> > > >  lib/librte_net/rte_mpls.h | 12 ++++++------
> > > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h
> > > > index db91707..ecd1f64 100644
> > > > --- a/lib/librte_net/rte_mpls.h
> > > > +++ b/lib/librte_net/rte_mpls.h
> > > > @@ -24,13 +24,13 @@ extern "C" {
> > > >  struct rte_mpls_hdr {
> > > >  	uint16_t tag_msb;   /**< Label(msb). */
> > > >  #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> > > > -	uint8_t tag_lsb:4;  /**< Label(lsb). */
> > > > -	uint8_t tc:3;       /**< Traffic class. */
> > > > -	uint8_t bs:1;       /**< Bottom of stack. */
> > > > +	uint32_t tag_lsb:4;  /**< Label(lsb). */
> > > > +	uint32_t tc:3;       /**< Traffic class. */
> > > > +	uint32_t bs:1;       /**< Bottom of stack. */
> > > >  #else
> > > > -	uint8_t bs:1;       /**< Bottom of stack. */
> > > > -	uint8_t tc:3;       /**< Traffic class. */
> > > > -	uint8_t tag_lsb:4;  /**< label(lsb) */
> > > > +	uint32_t bs:1;       /**< Bottom of stack. */
> > > > +	uint32_t tc:3;       /**< Traffic class. */
> > > > +	uint32_t tag_lsb:4;  /**< label(lsb) */
> > > >  #endif
> > > >  	uint8_t  ttl;       /**< Time to live. */
> > > >  } __rte_packed;
> > >
> > > The struct size keeps same after change, do you know if this behavior is
> > part of
> > > standard and guaranteed?
> > 
> > I have the same fear.
> To my understanding and please correct me if I'm wrong, the type of the bit fields shouldn't change the size of the structure,
> As long as the bit order is kept the same, and I made a small test for it and checked the size of the struct it gave 4 bytes (sizeof()) with both definitions.

You are probably right, however we saw some differences in the
behavior in specific conditions.
See https://patchwork.dpdk.org/patch/70458/ for instance.

> > 
> > Would it make sense to add __extension__ instead? We already do that
> > for gre, for instance.
> Yes I guess this can work as well,
> 
> Kindest regards
> Raslan Darawsheh

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

* Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
  2020-07-21  7:50       ` Olivier Matz
@ 2020-07-21  8:11         ` Raslan Darawsheh
  0 siblings, 0 replies; 8+ messages in thread
From: Raslan Darawsheh @ 2020-07-21  8:11 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Ferruh Yigit, dev, stable

Hi Olivier,

> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Tuesday, July 21, 2020 10:50 AM
> To: Raslan Darawsheh <rasland@mellanox.com>
> Cc: Ferruh Yigit <ferruh.yigit@intel.com>; dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled
> 
> Hi Raslan,
> 
> On Tue, Jul 21, 2020 at 07:37:51AM +0000, Raslan Darawsheh wrote:
> > Hi,
> > > -----Original Message-----
> > > From: Olivier Matz <olivier.matz@6wind.com>
> > > Sent: Tuesday, July 21, 2020 10:09 AM
> > > To: Ferruh Yigit <ferruh.yigit@intel.com>
> > > Cc: Raslan Darawsheh <rasland@mellanox.com>; dev@dpdk.org;
> > > stable@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic
> enabled
> > >
> > > Hi,
> > >
> > > On Tue, Jul 21, 2020 at 01:05:57AM +0100, Ferruh Yigit wrote:
> > > > On 7/16/2020 1:12 PM, Raslan Darawsheh wrote:
> > > > > when trying to compile rte_mpls with pedantic enabled,
> > > > > it will complain about bit field defintion.
> > > > > error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic]
> > > > > error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic]
> > > > > error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic]
> > > > '
> > > > I tried to reproduce by adding to '-pedantic' to 'rte_net.c' (which uses
> > > > 'rte_mpls.h') but not able to get the warning. Is this happen with
> specific
> > > > version of the compiler?
> >
> > Yes It happens only with old compilers, maybe I should have mentioned
> that in the commit log (my mistake).
> > gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
> >
> > > >
> > > > >
> > > > > This fixes the compilation error.
> > > > >
> > > > > Fixes: e480cf487a0d ("net: add MPLS header structure")
> > > > > Cc: olivier.matz@6wind.com
> > > > > Cc: stable@dpdk.org
> > > > >
> > > > > Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> > > > > ---
> > > > >  lib/librte_net/rte_mpls.h | 12 ++++++------
> > > > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > > > >
> > > > > diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h
> > > > > index db91707..ecd1f64 100644
> > > > > --- a/lib/librte_net/rte_mpls.h
> > > > > +++ b/lib/librte_net/rte_mpls.h
> > > > > @@ -24,13 +24,13 @@ extern "C" {
> > > > >  struct rte_mpls_hdr {
> > > > >  	uint16_t tag_msb;   /**< Label(msb). */
> > > > >  #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> > > > > -	uint8_t tag_lsb:4;  /**< Label(lsb). */
> > > > > -	uint8_t tc:3;       /**< Traffic class. */
> > > > > -	uint8_t bs:1;       /**< Bottom of stack. */
> > > > > +	uint32_t tag_lsb:4;  /**< Label(lsb). */
> > > > > +	uint32_t tc:3;       /**< Traffic class. */
> > > > > +	uint32_t bs:1;       /**< Bottom of stack. */
> > > > >  #else
> > > > > -	uint8_t bs:1;       /**< Bottom of stack. */
> > > > > -	uint8_t tc:3;       /**< Traffic class. */
> > > > > -	uint8_t tag_lsb:4;  /**< label(lsb) */
> > > > > +	uint32_t bs:1;       /**< Bottom of stack. */
> > > > > +	uint32_t tc:3;       /**< Traffic class. */
> > > > > +	uint32_t tag_lsb:4;  /**< label(lsb) */
> > > > >  #endif
> > > > >  	uint8_t  ttl;       /**< Time to live. */
> > > > >  } __rte_packed;
> > > >
> > > > The struct size keeps same after change, do you know if this behavior is
> > > part of
> > > > standard and guaranteed?
> > >
> > > I have the same fear.
> > To my understanding and please correct me if I'm wrong, the type of the
> bit fields shouldn't change the size of the structure,
> > As long as the bit order is kept the same, and I made a small test for it and
> checked the size of the struct it gave 4 bytes (sizeof()) with both definitions.
> 
> You are probably right, however we saw some differences in the
> behavior in specific conditions.
> See
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> work.dpdk.org%2Fpatch%2F70458%2F&amp;data=02%7C01%7Crasland%40
> mellanox.com%7C023ed8bf39414a67c72a08d82d4abcd8%7Ca652971c7d2e4d
> 9ba6a4d149256f461b%7C0%7C0%7C637309146327936161&amp;sdata=FloAa6
> Xhg%2FNwIyUSNER808q%2FYJ3ZsunczM%2FyQKxs5NA%3D&amp;reserved=
> 0 for instance.
> 
Thanks for pointing me to this, I'll send a V2 having __extension__ instead then,

> > >
> > > Would it make sense to add __extension__ instead? We already do that
> > > for gre, for instance.
> > Yes I guess this can work as well,
> >
> > Kindest regards
> > Raslan Darawsheh


Kindest regards,
Raslan Darawsheh

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

* [dpdk-dev] [PATCH v2] net: fix compilation with pedantic enabled
  2020-07-16 12:12 [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled Raslan Darawsheh
  2020-07-21  0:05 ` Ferruh Yigit
@ 2020-07-21  8:31 ` Raslan Darawsheh
  2020-07-21 15:43   ` Ferruh Yigit
  1 sibling, 1 reply; 8+ messages in thread
From: Raslan Darawsheh @ 2020-07-21  8:31 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, olivier.matz, stable

when trying to compile rte_mpls with pedantic enabled,
on old compilers like 4.8 it will complain about bit field definition.

error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic]
error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic]
error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic]

This fixes the compilation error by adding extension to the header
definition.

Fixes: e480cf487a0d ("net: add MPLS header structure")
Cc: olivier.matz@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
v2: fixed commit log spelling issue
    added reference to old compilers where it fail.
    change the implementation from changing the type of the bit fields
    to adding __extension__ to the header definition
---
 lib/librte_net/rte_mpls.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h
index db91707..3e8cb90 100644
--- a/lib/librte_net/rte_mpls.h
+++ b/lib/librte_net/rte_mpls.h
@@ -21,6 +21,7 @@ extern "C" {
 /**
  * MPLS header.
  */
+__extension__
 struct rte_mpls_hdr {
 	uint16_t tag_msb;   /**< Label(msb). */
 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH v2] net: fix compilation with pedantic enabled
  2020-07-21  8:31 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
@ 2020-07-21 15:43   ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-07-21 15:43 UTC (permalink / raw)
  To: Raslan Darawsheh, dev; +Cc: olivier.matz, stable

On 7/21/2020 9:31 AM, Raslan Darawsheh wrote:
> when trying to compile rte_mpls with pedantic enabled,
> on old compilers like 4.8 it will complain about bit field definition.
> 
> error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic]
> error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic]
> error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic]
> 
> This fixes the compilation error by adding extension to the header
> definition.
> 
> Fixes: e480cf487a0d ("net: add MPLS header structure")
> Cc: olivier.matz@6wind.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2020-07-21 15:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 12:12 [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled Raslan Darawsheh
2020-07-21  0:05 ` Ferruh Yigit
2020-07-21  7:09   ` Olivier Matz
2020-07-21  7:37     ` Raslan Darawsheh
2020-07-21  7:50       ` Olivier Matz
2020-07-21  8:11         ` Raslan Darawsheh
2020-07-21  8:31 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
2020-07-21 15:43   ` Ferruh Yigit

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).