All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS
@ 2020-04-27 13:23 David Marchand
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 1/3] ring: fix build with -Wswitch-enum David Marchand
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: David Marchand @ 2020-04-27 13:23 UTC (permalink / raw)
  To: dev

Couple of fixes caught while checking OVS integration.

Extra bonus points for reviewers that will review the OVS series :-)
https://patchwork.ozlabs.org/project/openvswitch/list/?series=172917

-- 
David Marchand

David Marchand (3):
  ring: fix build with -Wswitch-enum
  eal: fix typo in endian conversion macros
  ethdev: fix build warning on 64-bit value

 lib/librte_eal/include/generic/rte_byteorder.h | 6 +++---
 lib/librte_ethdev/rte_flow.h                   | 2 +-
 lib/librte_ring/rte_ring_peek.h                | 8 ++++++++
 3 files changed, 12 insertions(+), 4 deletions(-)

-- 
2.23.0


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

* [dpdk-dev] [PATCH 1/3] ring: fix build with -Wswitch-enum
  2020-04-27 13:23 [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS David Marchand
@ 2020-04-27 13:23 ` David Marchand
  2020-04-27 14:55   ` Ananyev, Konstantin
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 2/3] eal: fix typo in endian conversion macros David Marchand
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 20+ messages in thread
From: David Marchand @ 2020-04-27 13:23 UTC (permalink / raw)
  To: dev; +Cc: Honnappa Nagarahalli, Konstantin Ananyev

Some popular vswitch implementation might use a gcc option that
complains about missing enums in switch statements.
Fix this by listing all possible values.

Fixes: 664ff4b1729b ("ring: introduce peek style API")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/librte_ring/rte_ring_peek.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_ring/rte_ring_peek.h b/lib/librte_ring/rte_ring_peek.h
index 9e7f4db323..d5e6ea1cf3 100644
--- a/lib/librte_ring/rte_ring_peek.h
+++ b/lib/librte_ring/rte_ring_peek.h
@@ -68,6 +68,8 @@ __rte_ring_do_enqueue_start(struct rte_ring *r, uint32_t n,
 		n =  __rte_ring_hts_move_prod_head(r, n, behavior,
 			&head, &free);
 		break;
+	case RTE_RING_SYNC_MT:
+	case RTE_RING_SYNC_MT_RTS:
 	default:
 		/* unsupported mode, shouldn't be here */
 		RTE_ASSERT(0);
@@ -217,6 +219,8 @@ rte_ring_enqueue_elem_finish(struct rte_ring *r, const void *obj_table,
 			__rte_ring_enqueue_elems(r, tail, obj_table, esize, n);
 		__rte_ring_hts_set_head_tail(&r->hts_prod, tail, n, 1);
 		break;
+	case RTE_RING_SYNC_MT:
+	case RTE_RING_SYNC_MT_RTS:
 	default:
 		/* unsupported mode, shouldn't be here */
 		RTE_ASSERT(0);
@@ -263,6 +267,8 @@ __rte_ring_do_dequeue_start(struct rte_ring *r, void *obj_table,
 		n =  __rte_ring_hts_move_cons_head(r, n, behavior,
 			&head, &avail);
 		break;
+	case RTE_RING_SYNC_MT:
+	case RTE_RING_SYNC_MT_RTS:
 	default:
 		/* unsupported mode, shouldn't be here */
 		RTE_ASSERT(0);
@@ -414,6 +420,8 @@ rte_ring_dequeue_elem_finish(struct rte_ring *r, unsigned int n)
 		n = __rte_ring_hts_get_tail(&r->hts_cons, &tail, n);
 		__rte_ring_hts_set_head_tail(&r->hts_cons, tail, n, 0);
 		break;
+	case RTE_RING_SYNC_MT:
+	case RTE_RING_SYNC_MT_RTS:
 	default:
 		/* unsupported mode, shouldn't be here */
 		RTE_ASSERT(0);
-- 
2.23.0


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

* [dpdk-dev] [PATCH 2/3] eal: fix typo in endian conversion macros
  2020-04-27 13:23 [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS David Marchand
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 1/3] ring: fix build with -Wswitch-enum David Marchand
@ 2020-04-27 13:23 ` David Marchand
  2020-04-27 13:35   ` Bruce Richardson
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value David Marchand
  2020-04-28  9:53 ` [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS David Marchand
  3 siblings, 1 reply; 20+ messages in thread
From: David Marchand @ 2020-04-27 13:23 UTC (permalink / raw)
  To: dev; +Cc: stable, Adrien Mazarguil

Caught by code inspection, for little endian, RTE_LEXX macros should
provide rte_leXX_t type values.

Fixes: b75667ef9f7e ("eal: add static endianness conversion macros")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/librte_eal/include/generic/rte_byteorder.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/include/generic/rte_byteorder.h b/lib/librte_eal/include/generic/rte_byteorder.h
index 38e8cfd32b..9ca960932f 100644
--- a/lib/librte_eal/include/generic/rte_byteorder.h
+++ b/lib/librte_eal/include/generic/rte_byteorder.h
@@ -93,9 +93,9 @@
 #define RTE_BE16(v) (rte_be16_t)(RTE_STATIC_BSWAP16(v))
 #define RTE_BE32(v) (rte_be32_t)(RTE_STATIC_BSWAP32(v))
 #define RTE_BE64(v) (rte_be64_t)(RTE_STATIC_BSWAP64(v))
-#define RTE_LE16(v) (rte_be16_t)(v)
-#define RTE_LE32(v) (rte_be32_t)(v)
-#define RTE_LE64(v) (rte_be64_t)(v)
+#define RTE_LE16(v) (rte_le16_t)(v)
+#define RTE_LE32(v) (rte_le32_t)(v)
+#define RTE_LE64(v) (rte_le64_t)(v)
 #else
 #error Unsupported endianness.
 #endif
-- 
2.23.0


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

* [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:23 [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS David Marchand
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 1/3] ring: fix build with -Wswitch-enum David Marchand
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 2/3] eal: fix typo in endian conversion macros David Marchand
@ 2020-04-27 13:23 ` David Marchand
  2020-04-27 13:33   ` Andrew Rybchenko
  2020-04-27 13:34   ` Bruce Richardson
  2020-04-28  9:53 ` [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS David Marchand
  3 siblings, 2 replies; 20+ messages in thread
From: David Marchand @ 2020-04-27 13:23 UTC (permalink / raw)
  To: dev; +Cc: Ori Kam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Xiao Zhang

Building OVS with dpdk, sparse complains about 64-bit constant being
passed as a normal integer that can't fit it:
error: constant 0xffffffffffffffff is so big it is unsigned long

Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/librte_ethdev/rte_flow.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 132b44edc6..1fb94f35e8 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
 #ifndef __cplusplus
 static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
 	.s_field = 0x01,
-	.seid = RTE_BE64(0xffffffffffffffff),
+	.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
 };
 #endif
 
-- 
2.23.0


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value David Marchand
@ 2020-04-27 13:33   ` Andrew Rybchenko
  2020-04-27 13:34   ` Bruce Richardson
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Rybchenko @ 2020-04-27 13:33 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Ori Kam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Xiao Zhang

On 4/27/20 4:23 PM, David Marchand wrote:
> Building OVS with dpdk, sparse complains about 64-bit constant being
> passed as a normal integer that can't fit it:
> error: constant 0xffffffffffffffff is so big it is unsigned long
> 
> Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/librte_ethdev/rte_flow.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 132b44edc6..1fb94f35e8 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
>  #ifndef __cplusplus
>  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
>  	.s_field = 0x01,
> -	.seid = RTE_BE64(0xffffffffffffffff),
> +	.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
>  };
>  #endif
>  
> 

Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value David Marchand
  2020-04-27 13:33   ` Andrew Rybchenko
@ 2020-04-27 13:34   ` Bruce Richardson
  2020-04-27 13:36     ` David Marchand
  2020-04-27 13:39     ` Andrew Rybchenko
  1 sibling, 2 replies; 20+ messages in thread
From: Bruce Richardson @ 2020-04-27 13:34 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Ori Kam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Xiao Zhang

On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> Building OVS with dpdk, sparse complains about 64-bit constant being
> passed as a normal integer that can't fit it:
> error: constant 0xffffffffffffffff is so big it is unsigned long
> 
> Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/librte_ethdev/rte_flow.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 132b44edc6..1fb94f35e8 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
>  #ifndef __cplusplus
>  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
>  	.s_field = 0x01,
> -	.seid = RTE_BE64(0xffffffffffffffff),
> +	.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),

Rather than cast, why not put "ULL" at the end. If we are going to cast,
why not just put "-1" in to save some digits.

/Bruce

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

* Re: [dpdk-dev] [PATCH 2/3] eal: fix typo in endian conversion macros
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 2/3] eal: fix typo in endian conversion macros David Marchand
@ 2020-04-27 13:35   ` Bruce Richardson
  0 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2020-04-27 13:35 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, stable, Adrien Mazarguil

On Mon, Apr 27, 2020 at 03:23:40PM +0200, David Marchand wrote:
> Caught by code inspection, for little endian, RTE_LEXX macros should
> provide rte_leXX_t type values.
> 
> Fixes: b75667ef9f7e ("eal: add static endianness conversion macros")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:34   ` Bruce Richardson
@ 2020-04-27 13:36     ` David Marchand
  2020-04-27 13:46       ` Ananyev, Konstantin
  2020-04-27 13:39     ` Andrew Rybchenko
  1 sibling, 1 reply; 20+ messages in thread
From: David Marchand @ 2020-04-27 13:36 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Ori Kam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Xiao Zhang

On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> > Building OVS with dpdk, sparse complains about 64-bit constant being
> > passed as a normal integer that can't fit it:
> > error: constant 0xffffffffffffffff is so big it is unsigned long
> >
> > Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> >  lib/librte_ethdev/rte_flow.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> > index 132b44edc6..1fb94f35e8 100644
> > --- a/lib/librte_ethdev/rte_flow.h
> > +++ b/lib/librte_ethdev/rte_flow.h
> > @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
> >  #ifndef __cplusplus
> >  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> >       .s_field = 0x01,
> > -     .seid = RTE_BE64(0xffffffffffffffff),
> > +     .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
>
> Rather than cast, why not put "ULL" at the end. If we are going to cast,
> why not just put "-1" in to save some digits.

I preferred this form in the hope future developers who want
0x0fffffffffffffff will copy/paste this.

-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:34   ` Bruce Richardson
  2020-04-27 13:36     ` David Marchand
@ 2020-04-27 13:39     ` Andrew Rybchenko
  2020-04-27 13:40       ` David Marchand
  1 sibling, 1 reply; 20+ messages in thread
From: Andrew Rybchenko @ 2020-04-27 13:39 UTC (permalink / raw)
  To: Bruce Richardson, David Marchand
  Cc: dev, Ori Kam, Thomas Monjalon, Ferruh Yigit, Xiao Zhang

On 4/27/20 4:34 PM, Bruce Richardson wrote:
> On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
>> Building OVS with dpdk, sparse complains about 64-bit constant being
>> passed as a normal integer that can't fit it:
>> error: constant 0xffffffffffffffff is so big it is unsigned long
>>
>> Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
>>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>> ---
>>  lib/librte_ethdev/rte_flow.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
>> index 132b44edc6..1fb94f35e8 100644
>> --- a/lib/librte_ethdev/rte_flow.h
>> +++ b/lib/librte_ethdev/rte_flow.h
>> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
>>  #ifndef __cplusplus
>>  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
>>  	.s_field = 0x01,
>> -	.seid = RTE_BE64(0xffffffffffffffff),
>> +	.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
> Rather than cast, why not put "ULL" at the end.

It is not a cast as far as I can see, it is exactly ULL (or UL):
/usr/include/stdint.h
# if __WORDSIZE == 64
#  define UINT64_C(c)   c ## UL
# else
#  define UINT64_C(c)   c ## ULL
# endif

> If we are going to cast, why not just put "-1" in to save some digits.
>
> /Bruce


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:39     ` Andrew Rybchenko
@ 2020-04-27 13:40       ` David Marchand
  2020-04-27 13:43         ` Bruce Richardson
  0 siblings, 1 reply; 20+ messages in thread
From: David Marchand @ 2020-04-27 13:40 UTC (permalink / raw)
  To: Andrew Rybchenko
  Cc: Bruce Richardson, dev, Ori Kam, Thomas Monjalon, Ferruh Yigit,
	Xiao Zhang

On Mon, Apr 27, 2020 at 3:39 PM Andrew Rybchenko
<arybchenko@solarflare.com> wrote:
>
> On 4/27/20 4:34 PM, Bruce Richardson wrote:
> > On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> >> Building OVS with dpdk, sparse complains about 64-bit constant being
> >> passed as a normal integer that can't fit it:
> >> error: constant 0xffffffffffffffff is so big it is unsigned long
> >>
> >> Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> >>
> >> Signed-off-by: David Marchand <david.marchand@redhat.com>
> >> ---
> >>  lib/librte_ethdev/rte_flow.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> >> index 132b44edc6..1fb94f35e8 100644
> >> --- a/lib/librte_ethdev/rte_flow.h
> >> +++ b/lib/librte_ethdev/rte_flow.h
> >> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
> >>  #ifndef __cplusplus
> >>  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> >>      .s_field = 0x01,
> >> -    .seid = RTE_BE64(0xffffffffffffffff),
> >> +    .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
> > Rather than cast, why not put "ULL" at the end.
>
> It is not a cast as far as I can see, it is exactly ULL (or UL):
> /usr/include/stdint.h
> # if __WORDSIZE == 64
> #  define UINT64_C(c)   c ## UL
> # else
> #  define UINT64_C(c)   c ## ULL
> # endif

Yes.


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:40       ` David Marchand
@ 2020-04-27 13:43         ` Bruce Richardson
  0 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2020-04-27 13:43 UTC (permalink / raw)
  To: David Marchand
  Cc: Andrew Rybchenko, dev, Ori Kam, Thomas Monjalon, Ferruh Yigit,
	Xiao Zhang

On Mon, Apr 27, 2020 at 03:40:30PM +0200, David Marchand wrote:
> On Mon, Apr 27, 2020 at 3:39 PM Andrew Rybchenko
> <arybchenko@solarflare.com> wrote:
> >
> > On 4/27/20 4:34 PM, Bruce Richardson wrote:
> > > On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> > >> Building OVS with dpdk, sparse complains about 64-bit constant being
> > >> passed as a normal integer that can't fit it:
> > >> error: constant 0xffffffffffffffff is so big it is unsigned long
> > >>
> > >> Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> > >>
> > >> Signed-off-by: David Marchand <david.marchand@redhat.com>
> > >> ---
> > >>  lib/librte_ethdev/rte_flow.h | 2 +-
> > >>  1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> > >> index 132b44edc6..1fb94f35e8 100644
> > >> --- a/lib/librte_ethdev/rte_flow.h
> > >> +++ b/lib/librte_ethdev/rte_flow.h
> > >> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
> > >>  #ifndef __cplusplus
> > >>  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> > >>      .s_field = 0x01,
> > >> -    .seid = RTE_BE64(0xffffffffffffffff),
> > >> +    .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
> > > Rather than cast, why not put "ULL" at the end.
> >
> > It is not a cast as far as I can see, it is exactly ULL (or UL):
> > /usr/include/stdint.h
> > # if __WORDSIZE == 64
> > #  define UINT64_C(c)   c ## UL
> > # else
> > #  define UINT64_C(c)   c ## ULL
> > # endif
> 
> Yes.
> 
Thanks. I'd prefer just sticking on the "ULL" myself as it's shorter, but
this is ok.

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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:36     ` David Marchand
@ 2020-04-27 13:46       ` Ananyev, Konstantin
  2020-04-27 14:00         ` David Marchand
  0 siblings, 1 reply; 20+ messages in thread
From: Ananyev, Konstantin @ 2020-04-27 13:46 UTC (permalink / raw)
  To: David Marchand, Richardson, Bruce
  Cc: dev, Ori Kam, Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko,
	Zhang, Xiao



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of David Marchand
> Sent: Monday, April 27, 2020 2:37 PM
> To: Richardson, Bruce <bruce.richardson@intel.com>
> Cc: dev <dev@dpdk.org>; Ori Kam <orika@mellanox.com>; Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Andrew Rybchenko <arybchenko@solarflare.com>; Zhang, Xiao <xiao.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
> 
> On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> > > Building OVS with dpdk, sparse complains about 64-bit constant being
> > > passed as a normal integer that can't fit it:
> > > error: constant 0xffffffffffffffff is so big it is unsigned long
> > >
> > > Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---
> > >  lib/librte_ethdev/rte_flow.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> > > index 132b44edc6..1fb94f35e8 100644
> > > --- a/lib/librte_ethdev/rte_flow.h
> > > +++ b/lib/librte_ethdev/rte_flow.h
> > > @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
> > >  #ifndef __cplusplus
> > >  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> > >       .s_field = 0x01,
> > > -     .seid = RTE_BE64(0xffffffffffffffff),
> > > +     .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
> >
> > Rather than cast, why not put "ULL" at the end. If we are going to cast,
> > why not just put "-1" in to save some digits.
> 
> I preferred this form in the hope future developers who want
> 0x0fffffffffffffff will copy/paste this.
> 

As I remember there should be UINT64_MAX in stdint.h.

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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 13:46       ` Ananyev, Konstantin
@ 2020-04-27 14:00         ` David Marchand
  2020-04-27 14:07           ` Ferruh Yigit
  2020-04-28  9:27           ` Thomas Monjalon
  0 siblings, 2 replies; 20+ messages in thread
From: David Marchand @ 2020-04-27 14:00 UTC (permalink / raw)
  To: Ananyev, Konstantin
  Cc: Richardson, Bruce, dev, Ori Kam, Thomas Monjalon, Yigit, Ferruh,
	Andrew Rybchenko, Zhang, Xiao

On Mon, Apr 27, 2020 at 3:47 PM Ananyev, Konstantin
<konstantin.ananyev@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of David Marchand
> > Sent: Monday, April 27, 2020 2:37 PM
> > To: Richardson, Bruce <bruce.richardson@intel.com>
> > Cc: dev <dev@dpdk.org>; Ori Kam <orika@mellanox.com>; Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> > <ferruh.yigit@intel.com>; Andrew Rybchenko <arybchenko@solarflare.com>; Zhang, Xiao <xiao.zhang@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
> >
> > On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson
> > <bruce.richardson@intel.com> wrote:
> > >
> > > On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> > > > Building OVS with dpdk, sparse complains about 64-bit constant being
> > > > passed as a normal integer that can't fit it:
> > > > error: constant 0xffffffffffffffff is so big it is unsigned long
> > > >
> > > > Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> > > >
> > > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > > ---
> > > >  lib/librte_ethdev/rte_flow.h | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> > > > index 132b44edc6..1fb94f35e8 100644
> > > > --- a/lib/librte_ethdev/rte_flow.h
> > > > +++ b/lib/librte_ethdev/rte_flow.h
> > > > @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
> > > >  #ifndef __cplusplus
> > > >  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> > > >       .s_field = 0x01,
> > > > -     .seid = RTE_BE64(0xffffffffffffffff),
> > > > +     .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
> > >
> > > Rather than cast, why not put "ULL" at the end. If we are going to cast,
> > > why not just put "-1" in to save some digits.
> >
> > I preferred this form in the hope future developers who want
> > 0x0fffffffffffffff will copy/paste this.
> >
>
> As I remember there should be UINT64_MAX in stdint.h.

Yes, we could go with:
+     .seid = RTE_BE64(UINT64_MAX),

And then next time, for any value like 0x0fff ffff ffff ffff (had to
group the digits of what I had written), pretty sure we will miss this
and I will catch it only when building ovs.


--
David Marchand


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 14:00         ` David Marchand
@ 2020-04-27 14:07           ` Ferruh Yigit
  2020-04-27 14:12             ` David Marchand
  2020-04-28  9:27           ` Thomas Monjalon
  1 sibling, 1 reply; 20+ messages in thread
From: Ferruh Yigit @ 2020-04-27 14:07 UTC (permalink / raw)
  To: David Marchand, Ananyev, Konstantin
  Cc: Richardson, Bruce, dev, Ori Kam, Thomas Monjalon,
	Andrew Rybchenko, Zhang, Xiao

On 4/27/2020 3:00 PM, David Marchand wrote:
> On Mon, Apr 27, 2020 at 3:47 PM Ananyev, Konstantin
> <konstantin.ananyev@intel.com> wrote:
>>
>>
>>
>>> -----Original Message-----
>>> From: dev <dev-bounces@dpdk.org> On Behalf Of David Marchand
>>> Sent: Monday, April 27, 2020 2:37 PM
>>> To: Richardson, Bruce <bruce.richardson@intel.com>
>>> Cc: dev <dev@dpdk.org>; Ori Kam <orika@mellanox.com>; Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
>>> <ferruh.yigit@intel.com>; Andrew Rybchenko <arybchenko@solarflare.com>; Zhang, Xiao <xiao.zhang@intel.com>
>>> Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
>>>
>>> On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson
>>> <bruce.richardson@intel.com> wrote:
>>>>
>>>> On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
>>>>> Building OVS with dpdk, sparse complains about 64-bit constant being
>>>>> passed as a normal integer that can't fit it:
>>>>> error: constant 0xffffffffffffffff is so big it is unsigned long
>>>>>
>>>>> Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
>>>>>
>>>>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>>>>> ---
>>>>>  lib/librte_ethdev/rte_flow.h | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
>>>>> index 132b44edc6..1fb94f35e8 100644
>>>>> --- a/lib/librte_ethdev/rte_flow.h
>>>>> +++ b/lib/librte_ethdev/rte_flow.h
>>>>> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
>>>>>  #ifndef __cplusplus
>>>>>  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
>>>>>       .s_field = 0x01,
>>>>> -     .seid = RTE_BE64(0xffffffffffffffff),
>>>>> +     .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
>>>>
>>>> Rather than cast, why not put "ULL" at the end. If we are going to cast,
>>>> why not just put "-1" in to save some digits.
>>>
>>> I preferred this form in the hope future developers who want
>>> 0x0fffffffffffffff will copy/paste this.
>>>
>>
>> As I remember there should be UINT64_MAX in stdint.h.
> 
> Yes, we could go with:
> +     .seid = RTE_BE64(UINT64_MAX),

This is something else but if the value is 'UINT64_MAX', do we need 'RTE_BE64'
macro?

> 
> And then next time, for any value like 0x0fff ffff ffff ffff (had to
> group the digits of what I had written), pretty sure we will miss this
> and I will catch it only when building ovs.
> 
> 
> --
> David Marchand
> 


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 14:07           ` Ferruh Yigit
@ 2020-04-27 14:12             ` David Marchand
  2020-04-27 14:14               ` Ferruh Yigit
  0 siblings, 1 reply; 20+ messages in thread
From: David Marchand @ 2020-04-27 14:12 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Ananyev, Konstantin, Richardson, Bruce, dev, Ori Kam,
	Thomas Monjalon, Andrew Rybchenko, Zhang, Xiao

On Mon, Apr 27, 2020 at 4:07 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 4/27/2020 3:00 PM, David Marchand wrote:
> > On Mon, Apr 27, 2020 at 3:47 PM Ananyev, Konstantin
> > <konstantin.ananyev@intel.com> wrote:
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: dev <dev-bounces@dpdk.org> On Behalf Of David Marchand
> >>> Sent: Monday, April 27, 2020 2:37 PM
> >>> To: Richardson, Bruce <bruce.richardson@intel.com>
> >>> Cc: dev <dev@dpdk.org>; Ori Kam <orika@mellanox.com>; Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> >>> <ferruh.yigit@intel.com>; Andrew Rybchenko <arybchenko@solarflare.com>; Zhang, Xiao <xiao.zhang@intel.com>
> >>> Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
> >>>
> >>> On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson
> >>> <bruce.richardson@intel.com> wrote:
> >>>>
> >>>> On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> >>>>> Building OVS with dpdk, sparse complains about 64-bit constant being
> >>>>> passed as a normal integer that can't fit it:
> >>>>> error: constant 0xffffffffffffffff is so big it is unsigned long
> >>>>>
> >>>>> Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> >>>>>
> >>>>> Signed-off-by: David Marchand <david.marchand@redhat.com>
> >>>>> ---
> >>>>>  lib/librte_ethdev/rte_flow.h | 2 +-
> >>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>
> >>>>> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> >>>>> index 132b44edc6..1fb94f35e8 100644
> >>>>> --- a/lib/librte_ethdev/rte_flow.h
> >>>>> +++ b/lib/librte_ethdev/rte_flow.h
> >>>>> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
> >>>>>  #ifndef __cplusplus
> >>>>>  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> >>>>>       .s_field = 0x01,
> >>>>> -     .seid = RTE_BE64(0xffffffffffffffff),
> >>>>> +     .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
> >>>>
> >>>> Rather than cast, why not put "ULL" at the end. If we are going to cast,
> >>>> why not just put "-1" in to save some digits.
> >>>
> >>> I preferred this form in the hope future developers who want
> >>> 0x0fffffffffffffff will copy/paste this.
> >>>
> >>
> >> As I remember there should be UINT64_MAX in stdint.h.
> >
> > Yes, we could go with:
> > +     .seid = RTE_BE64(UINT64_MAX),
>
> This is something else but if the value is 'UINT64_MAX', do we need 'RTE_BE64'
> macro?

In OVS case, sparse validates that a rte_be64_t value (mapped to
ovs_be64_t) is passed to .seid.

.../build/install/usr/local/include/rte_flow.h:1537:17: error:
incorrect type in initializer (different base types)
.../build/install/usr/local/include/rte_flow.h:1537:17:    expected
restricted ovs_be64 [usertype] seid
.../build/install/usr/local/include/rte_flow.h:1537:17:    got unsigned long


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 14:12             ` David Marchand
@ 2020-04-27 14:14               ` Ferruh Yigit
  0 siblings, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2020-04-27 14:14 UTC (permalink / raw)
  To: David Marchand
  Cc: Ananyev, Konstantin, Richardson, Bruce, dev, Ori Kam,
	Thomas Monjalon, Andrew Rybchenko, Zhang, Xiao

On 4/27/2020 3:12 PM, David Marchand wrote:
> On Mon, Apr 27, 2020 at 4:07 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> On 4/27/2020 3:00 PM, David Marchand wrote:
>>> On Mon, Apr 27, 2020 at 3:47 PM Ananyev, Konstantin
>>> <konstantin.ananyev@intel.com> wrote:
>>>>
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: dev <dev-bounces@dpdk.org> On Behalf Of David Marchand
>>>>> Sent: Monday, April 27, 2020 2:37 PM
>>>>> To: Richardson, Bruce <bruce.richardson@intel.com>
>>>>> Cc: dev <dev@dpdk.org>; Ori Kam <orika@mellanox.com>; Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
>>>>> <ferruh.yigit@intel.com>; Andrew Rybchenko <arybchenko@solarflare.com>; Zhang, Xiao <xiao.zhang@intel.com>
>>>>> Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
>>>>>
>>>>> On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson
>>>>> <bruce.richardson@intel.com> wrote:
>>>>>>
>>>>>> On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
>>>>>>> Building OVS with dpdk, sparse complains about 64-bit constant being
>>>>>>> passed as a normal integer that can't fit it:
>>>>>>> error: constant 0xffffffffffffffff is so big it is unsigned long
>>>>>>>
>>>>>>> Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
>>>>>>>
>>>>>>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>>>>>>> ---
>>>>>>>  lib/librte_ethdev/rte_flow.h | 2 +-
>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>
>>>>>>> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
>>>>>>> index 132b44edc6..1fb94f35e8 100644
>>>>>>> --- a/lib/librte_ethdev/rte_flow.h
>>>>>>> +++ b/lib/librte_ethdev/rte_flow.h
>>>>>>> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
>>>>>>>  #ifndef __cplusplus
>>>>>>>  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
>>>>>>>       .s_field = 0x01,
>>>>>>> -     .seid = RTE_BE64(0xffffffffffffffff),
>>>>>>> +     .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
>>>>>>
>>>>>> Rather than cast, why not put "ULL" at the end. If we are going to cast,
>>>>>> why not just put "-1" in to save some digits.
>>>>>
>>>>> I preferred this form in the hope future developers who want
>>>>> 0x0fffffffffffffff will copy/paste this.
>>>>>
>>>>
>>>> As I remember there should be UINT64_MAX in stdint.h.
>>>
>>> Yes, we could go with:
>>> +     .seid = RTE_BE64(UINT64_MAX),
>>
>> This is something else but if the value is 'UINT64_MAX', do we need 'RTE_BE64'
>> macro?
> 
> In OVS case, sparse validates that a rte_be64_t value (mapped to
> ovs_be64_t) is passed to .seid.
> 
> .../build/install/usr/local/include/rte_flow.h:1537:17: error:
> incorrect type in initializer (different base types)
> .../build/install/usr/local/include/rte_flow.h:1537:17:    expected
> restricted ovs_be64 [usertype] seid
> .../build/install/usr/local/include/rte_flow.h:1537:17:    got unsigned long
> 
> 

Got it, thanks for clarification.

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

* Re: [dpdk-dev] [PATCH 1/3] ring: fix build with -Wswitch-enum
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 1/3] ring: fix build with -Wswitch-enum David Marchand
@ 2020-04-27 14:55   ` Ananyev, Konstantin
  0 siblings, 0 replies; 20+ messages in thread
From: Ananyev, Konstantin @ 2020-04-27 14:55 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: Honnappa Nagarahalli

> 
> Some popular vswitch implementation might use a gcc option that
> complains about missing enums in switch statements.
> Fix this by listing all possible values.
> 
> Fixes: 664ff4b1729b ("ring: introduce peek style API")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/librte_ring/rte_ring_peek.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/lib/librte_ring/rte_ring_peek.h b/lib/librte_ring/rte_ring_peek.h
> index 9e7f4db323..d5e6ea1cf3 100644
> --- a/lib/librte_ring/rte_ring_peek.h
> +++ b/lib/librte_ring/rte_ring_peek.h
> @@ -68,6 +68,8 @@ __rte_ring_do_enqueue_start(struct rte_ring *r, uint32_t n,
>  		n =  __rte_ring_hts_move_prod_head(r, n, behavior,
>  			&head, &free);
>  		break;
> +	case RTE_RING_SYNC_MT:
> +	case RTE_RING_SYNC_MT_RTS:
>  	default:
>  		/* unsupported mode, shouldn't be here */
>  		RTE_ASSERT(0);
> @@ -217,6 +219,8 @@ rte_ring_enqueue_elem_finish(struct rte_ring *r, const void *obj_table,
>  			__rte_ring_enqueue_elems(r, tail, obj_table, esize, n);
>  		__rte_ring_hts_set_head_tail(&r->hts_prod, tail, n, 1);
>  		break;
> +	case RTE_RING_SYNC_MT:
> +	case RTE_RING_SYNC_MT_RTS:
>  	default:
>  		/* unsupported mode, shouldn't be here */
>  		RTE_ASSERT(0);
> @@ -263,6 +267,8 @@ __rte_ring_do_dequeue_start(struct rte_ring *r, void *obj_table,
>  		n =  __rte_ring_hts_move_cons_head(r, n, behavior,
>  			&head, &avail);
>  		break;
> +	case RTE_RING_SYNC_MT:
> +	case RTE_RING_SYNC_MT_RTS:
>  	default:
>  		/* unsupported mode, shouldn't be here */
>  		RTE_ASSERT(0);
> @@ -414,6 +420,8 @@ rte_ring_dequeue_elem_finish(struct rte_ring *r, unsigned int n)
>  		n = __rte_ring_hts_get_tail(&r->hts_cons, &tail, n);
>  		__rte_ring_hts_set_head_tail(&r->hts_cons, tail, n, 0);
>  		break;
> +	case RTE_RING_SYNC_MT:
> +	case RTE_RING_SYNC_MT_RTS:
>  	default:
>  		/* unsupported mode, shouldn't be here */
>  		RTE_ASSERT(0);
> --

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

> 2.23.0


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-27 14:00         ` David Marchand
  2020-04-27 14:07           ` Ferruh Yigit
@ 2020-04-28  9:27           ` Thomas Monjalon
  2020-05-06 14:37             ` Morten Brørup
  1 sibling, 1 reply; 20+ messages in thread
From: Thomas Monjalon @ 2020-04-28  9:27 UTC (permalink / raw)
  To: David Marchand
  Cc: Ananyev, Konstantin, dev, Richardson, Bruce, Ori Kam, Yigit,
	Ferruh, Andrew Rybchenko, Zhang, Xiao

27/04/2020 16:00, David Marchand:
> On Mon, Apr 27, 2020 at 3:47 PM Ananyev, Konstantin wrote:
> > From: dev <dev-bounces@dpdk.org> On Behalf Of David Marchand
> > > On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson
> > > <bruce.richardson@intel.com> wrote:
> > > > On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> > > > > Building OVS with dpdk, sparse complains about 64-bit constant being
> > > > > passed as a normal integer that can't fit it:
> > > > > error: constant 0xffffffffffffffff is so big it is unsigned long
> > > > >
> > > > > Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> > > > >
> > > > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > > > ---
> > > > > --- a/lib/librte_ethdev/rte_flow.h
> > > > > +++ b/lib/librte_ethdev/rte_flow.h
> > > > >  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> > > > >       .s_field = 0x01,
> > > > > -     .seid = RTE_BE64(0xffffffffffffffff),
> > > > > +     .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
> > > >
> > > > Rather than cast, why not put "ULL" at the end. If we are going to cast,
> > > > why not just put "-1" in to save some digits.
> > >
> > > I preferred this form in the hope future developers who want
> > > 0x0fffffffffffffff will copy/paste this.
> > >
> >
> > As I remember there should be UINT64_MAX in stdint.h.
> 
> Yes, we could go with:
> +     .seid = RTE_BE64(UINT64_MAX),
> 
> And then next time, for any value like 0x0fff ffff ffff ffff (had to
> group the digits of what I had written), pretty sure we will miss this
> and I will catch it only when building ovs.

I agree with David (in general and especially here).

RTE_BE64 is required for static analyzers and is an explicit info.

UINT64_C is better than ULL suffix because it
	- is generic
	- gives size explicitly

UINT64_C(0xffffffffffffffff) is better than UINT64_MAX because
	- rte_flow.h has a lot of bitmasks
	- it is copy/paste safe

Acked-by: Thomas Monjalon <thomas@monjalon.net>



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

* Re: [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS
  2020-04-27 13:23 [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS David Marchand
                   ` (2 preceding siblings ...)
  2020-04-27 13:23 ` [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value David Marchand
@ 2020-04-28  9:53 ` David Marchand
  3 siblings, 0 replies; 20+ messages in thread
From: David Marchand @ 2020-04-28  9:53 UTC (permalink / raw)
  To: dev

On Mon, Apr 27, 2020 at 3:24 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> Couple of fixes caught while checking OVS integration.
>
> David Marchand (3):
>   ring: fix build with -Wswitch-enum
>   eal: fix typo in endian conversion macros
>   ethdev: fix build warning on 64-bit value
>
>  lib/librte_eal/include/generic/rte_byteorder.h | 6 +++---
>  lib/librte_ethdev/rte_flow.h                   | 2 +-
>  lib/librte_ring/rte_ring_peek.h                | 8 ++++++++
>  3 files changed, 12 insertions(+), 4 deletions(-)
>

Series applied.


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
  2020-04-28  9:27           ` Thomas Monjalon
@ 2020-05-06 14:37             ` Morten Brørup
  0 siblings, 0 replies; 20+ messages in thread
From: Morten Brørup @ 2020-05-06 14:37 UTC (permalink / raw)
  To: Thomas Monjalon, David Marchand
  Cc: Ananyev, Konstantin, dev, Richardson, Bruce, Ori Kam, Yigit,
	Ferruh, Andrew Rybchenko, Zhang, Xiao

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Tuesday, April 28, 2020 11:28 AM
> 
> 27/04/2020 16:00, David Marchand:
> > On Mon, Apr 27, 2020 at 3:47 PM Ananyev, Konstantin wrote:
> > > From: dev <dev-bounces@dpdk.org> On Behalf Of David Marchand
> > > > On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson
> > > > <bruce.richardson@intel.com> wrote:
> > > > > On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote:
> > > > > > Building OVS with dpdk, sparse complains about 64-bit
> constant being
> > > > > > passed as a normal integer that can't fit it:
> > > > > > error: constant 0xffffffffffffffff is so big it is unsigned
> long
> > > > > >
> > > > > > Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")
> > > > > >
> > > > > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > > > > ---
> > > > > > --- a/lib/librte_ethdev/rte_flow.h
> > > > > > +++ b/lib/librte_ethdev/rte_flow.h
> > > > > >  static const struct rte_flow_item_pfcp
> rte_flow_item_pfcp_mask = {
> > > > > >       .s_field = 0x01,
> > > > > > -     .seid = RTE_BE64(0xffffffffffffffff),
> > > > > > +     .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
> > > > >
> > > > > Rather than cast, why not put "ULL" at the end. If we are going
> to cast,
> > > > > why not just put "-1" in to save some digits.
> > > >
> > > > I preferred this form in the hope future developers who want
> > > > 0x0fffffffffffffff will copy/paste this.
> > > >
> > >
> > > As I remember there should be UINT64_MAX in stdint.h.
> >
> > Yes, we could go with:
> > +     .seid = RTE_BE64(UINT64_MAX),
> >
> > And then next time, for any value like 0x0fff ffff ffff ffff (had to
> > group the digits of what I had written), pretty sure we will miss
> this
> > and I will catch it only when building ovs.
> 
> I agree with David (in general and especially here).
> 
> RTE_BE64 is required for static analyzers and is an explicit info.
> 
> UINT64_C is better than ULL suffix because it
> 	- is generic
> 	- gives size explicitly

Certainly. Explicit is preferred in code for embedded systems.
"unsigned long long" means 64 bit or more, which also applies to the "ULL" postfix.
"uint64_t" and "UINT64_C" means exactly 64 bit.

> 
> UINT64_C(0xffffffffffffffff) is better than UINT64_MAX because
> 	- rte_flow.h has a lot of bitmasks
> 	- it is copy/paste safe
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> 

And shouldn't the struct rte_flow_item_pfcp be packed? I would expect the compiler to add 32 bit padding before seid to ensure its 64 bit alignment.


Med venlig hilsen / kind regards
- Morten Brørup


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

end of thread, other threads:[~2020-05-06 14:37 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 13:23 [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS David Marchand
2020-04-27 13:23 ` [dpdk-dev] [PATCH 1/3] ring: fix build with -Wswitch-enum David Marchand
2020-04-27 14:55   ` Ananyev, Konstantin
2020-04-27 13:23 ` [dpdk-dev] [PATCH 2/3] eal: fix typo in endian conversion macros David Marchand
2020-04-27 13:35   ` Bruce Richardson
2020-04-27 13:23 ` [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value David Marchand
2020-04-27 13:33   ` Andrew Rybchenko
2020-04-27 13:34   ` Bruce Richardson
2020-04-27 13:36     ` David Marchand
2020-04-27 13:46       ` Ananyev, Konstantin
2020-04-27 14:00         ` David Marchand
2020-04-27 14:07           ` Ferruh Yigit
2020-04-27 14:12             ` David Marchand
2020-04-27 14:14               ` Ferruh Yigit
2020-04-28  9:27           ` Thomas Monjalon
2020-05-06 14:37             ` Morten Brørup
2020-04-27 13:39     ` Andrew Rybchenko
2020-04-27 13:40       ` David Marchand
2020-04-27 13:43         ` Bruce Richardson
2020-04-28  9:53 ` [dpdk-dev] [PATCH 0/3] 20.05-rc1 fixes for OVS David Marchand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.