20.05-rc1 fixes for OVS
cover 20.05-rc1 fixes for OVS
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
Signature · 14 lines
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
PATCH 1/3 ring: fix build with -Wswitch-enum
Some popular vswitch implementation might use a gcc option that complains about missing enums in switch statements. Fix this by listing all possible values.
--- lib/librte_ring/rte_ring_peek.h | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/librte_ring/rte_ring_peek.h +8 -0
@@ -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 );
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH 1/3] ring: fix build with -Wswitch-enum
Quoted 44 lines
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 <[email protected]>--- lib/librte_ring/rte_ring_peek.h | 8 ++++++++ 1 file changed, 8 insertions(+)lib/librte_ring/rte_ring_peek.h +6
-0@@ -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 );
lib/librte_ring/rte_ring_peek.h rte_ring_dequeue_elem_finish(struct rte_ring *r, unsigned int n)
Quoted 9 lines
lib/librte_ring/rte_ring_peek.h +2
-1@@ -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 ); --
Quoted 1 line
2.23.0
PATCH 2/3 eal: fix typo in endian conversion macros
In reply to David MarchandCaught by code inspection, for little endian, RTE_LEXX macros should provide rte_leXX_t type values.
--- lib/librte_eal/include/generic/rte_byteorder.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/librte_eal/include/generic/rte_byteorder.h +3 -3
@@ -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
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH 2/3] eal: fix typo in endian conversion macros
Quoted 8 lines · David Marchand
Caught by code inspection, for little endian,
RTE_LEXXmacros should providerte_leXX_ttype values.Fixes b75667ef9f7e ("eal: add static endianness conversion macros")Signed-off-by David Marchand <[email protected]>---
PATCH 3/3 ethdev: fix build warning on 64-bit value
In reply to David MarchandBuilding 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
--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_ethdev/rte_flow.h +1 -1
@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 17 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_ethdev/rte_flow.h +0
-0
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1540
Quoted 8 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
In reply to David MarchandQuoted 16 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_ethdev/rte_flow.h +0
-0
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 5 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 13 lines · Bruce Richardson
Quoted 11 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 10 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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.
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 39 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of David Marchand
Sent: Monday, April 27, 2020 2:37 PM
To: Richardson, Bruce <[email protected]>
Cc: dev <[email protected]>; Ori Kam <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Zhang, Xiao <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit valueQuoted 13 lines · Bruce Richardson
Quoted 11 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 10 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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.
Quoted 3 lines
I preferred this form in the hope future developers who want
0x0fffffffffffffffwill copy/paste this.
As I remember there should be UINT64_MAX in stdint.h.
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 40 lines · Konstantin
Quoted 40 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of David Marchand
Sent: Monday, April 27, 2020 2:37 PM
To: Richardson, Bruce <[email protected]>
Cc: dev <[email protected]>; Ori Kam <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Zhang, Xiao <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit valueQuoted 26 lines · Bruce Richardson
Quoted 16 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_ethdev/rte_flow.h +0
-0lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 5 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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.
Quoted 5 lines
Quoted 3 lines
I preferred this form in the hope future developers who want
0x0fffffffffffffffwill copy/paste this.As I remember there should be
UINT64_MAXinstdint.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
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 42 lines · David Marchand
Quoted 40 lines · Konstantin
Quoted 40 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of David Marchand
Sent: Monday, April 27, 2020 2:37 PM
To: Richardson, Bruce <[email protected]>
Cc: dev <[email protected]>; Ori Kam <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Zhang, Xiao <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit valueQuoted 26 lines · Bruce Richardson
Quoted 16 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_ethdev/rte_flow.h +0
-0lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 5 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I preferred this form in the hope future developers who want
0x0fffffffffffffffwill copy/paste this.As I remember there should be
UINT64_MAXinstdint.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?
Quoted 9 lines
And then next time, for any value like
0x0fffffff 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
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 48 lines · Ferruh Yigit
Quoted 46 lines · David Marchand
Quoted 44 lines · Konstantin
Quoted 43 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of David Marchand
Sent: Monday, April 27, 2020 2:37 PM
To: Richardson, Bruce <[email protected]>
Cc: dev <[email protected]>; Ori Kam <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Zhang, Xiao <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit valueQuoted 13 lines · Bruce Richardson
Quoted 11 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 10 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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
0x0fffffffffffffffwill copy/paste this.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
As I remember there should be
UINT64_MAXinstdint.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
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 57 lines · David Marchand
Quoted 48 lines · Ferruh Yigit
Quoted 46 lines · David Marchand
Quoted 44 lines · Konstantin
Quoted 43 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of David Marchand
Sent: Monday, April 27, 2020 2:37 PM
To: Richardson, Bruce <[email protected]>
Cc: dev <[email protected]>; Ori Kam <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Zhang, Xiao <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit valueQuoted 13 lines · Bruce Richardson
Quoted 11 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 10 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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
0x0fffffffffffffffwill copy/paste this.Quoted 7 lines
Quoted 4 lines
Quoted 1 line
As I remember there should be
UINT64_MAXinstdint.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?
Quoted 10 lines
In OVS case, sparse validates that a
rte_be64_tvalue (mapped toovs_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
restrictedovs_be64[usertype] seid.../build/install/usr/local/include/rte_flow.h:1537:17: got unsigned long
Got it, thanks for clarification.
Thomas Monjalon
Acked-byRe: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
In reply to David Marchand27/04/2020 16:00, David Marchand:
Quoted 27 lines · Konstantin
Quoted 26 lines
From: dev <[email protected]> On Behalf Of David Marchand
Quoted 24 lines
Quoted 7 lines · Bruce Richardson
Quoted 6 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Quoted 11 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 8 lines
Signed-off-by David Marchand <[email protected]>---
lib/librte_ethdev/rte_flow.h +1
-1static 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
0x0fffffffffffffffwill copy/paste this.
Quoted 8 lines
Quoted 1 line
As I remember there should be
UINT64_MAXinstdint.h.Yes, we could go with:
+ .seid =RTE_BE64(UINT64_MAX),And then next time, for any value like
0x0fffffff 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
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 45 lines
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Tuesday, April 28, 2020 11:28 AM27/04/2020 16:00, David Marchand:
Quoted 6 lines · Konstantin
Quoted 5 lines
From: dev <[email protected]> On Behalf Of David Marchand
Quoted 4 lines
Quoted 2 lines · Bruce Richardson
Quoted 1 line · David Marchand
Building OVS with dpdk, sparse complains about 64-bit
constant being
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsignedlong
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
lib/librte_ethdev/rte_flow.h
Quoted 8 lines
Fixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>---
lib/librte_ethdev/rte_flow.h +0
-0static const struct rte_flow_item_pfcp
rte_flow_item_pfcp_mask= {Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 3 lines
.s_field = 0x01,lib/librte_ethdev/rte_flow.h +1
-1- .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,
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
why not just put "-1" in to save some digits.
I preferred this form in the hope future developers who want
0x0fffffffffffffffwill copy/paste this.Quoted 7 lines
Quoted 1 line
As I remember there should be
UINT64_MAXinstdint.h.Yes, we could go with:
+ .seid =RTE_BE64(UINT64_MAX),And then next time, for any value like
0x0fffffff ffff ffff (had to group the digits of what I had written), pretty sure we will missthis
Quoted 1 line
and I will catch it only when building ovs.
Quoted 7 lines
I agree with David (in general and especially here).
RTE_BE64is required for static analyzers and is an explicit info.
UINT64_Cis 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.
Quoted 7 lines
UINT64_C(0xffffffffffffffff)is better thanUINT64_MAXbecause
-rte_flow.hhas a lot of bitmasks
- it is copy/paste safeAcked-by Thomas Monjalon <[email protected]>
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
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
In reply to Bruce RichardsonQuoted 12 lines · Bruce Richardson
Quoted 11 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 10 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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
Quoted 3 lines
If we are going to cast, why not just put "-1" in to save some digits.
/Bruce
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 26 lines · Andrew Rybchenko
Quoted 12 lines · Bruce Richardson
Quoted 11 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 11 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 10 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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.
Quoted 7 lines
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.
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value
Quoted 36 lines · David Marchand
Quoted 26 lines · Andrew Rybchenko
Quoted 12 lines · Bruce Richardson
Quoted 11 lines · David Marchand
Building OVS with dpdk, sparse complains about 64-bit constant being passed as a normal integer that can't fit it:
error: constant0xffffffffffffffffis so big it is unsigned longFixes ecbc8570131d ("ethdev: add PFCP header to flow API")Signed-off-by David Marchand <[email protected]>--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 11 lines
lib/librte_ethdev/rte_flow.h struct rte_flow_item_pfcp { · line 1537
Quoted 10 lines
lib/librte_ethdev/rte_flow.h +1
-1@@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {#ifndef __cplusplusstatic 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.
Quoted 7 lines
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
Quoted 2 lines
Yes.
Thanks. I'd prefer just sticking on the "ULL" myself as it's shorter, but this is ok.
Quoted 8 lines · David Marchand
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
Quoted 5 lines
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.
Signature · 1 line
David Marchand