doc: propose correction rte_bsf64 return type declaration
PATCH 1/1 doc: propose correction rte_bsf64 return type declaration
It is clear from the change that introduced the rte_bsf64 inline function and an evaluation of usage that the initial revision was intended to return uint32_t and not int.
It is proposed the return type of int be changed to uint32_t.
-static inline int
+static inline uint32_t
rte_bsf64(uint64_t v)
{
return (uint32_t)__builtin_ctzll(v);}
--- doc/guides/rel_notes/deprecation.rst | 3 +++ 1 file changed, 3 insertions(+)
doc/guides/rel_notes/deprecation.rst +3 -0
@@ -17,6 +17,9 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. +* eal: The inline function ``rte_bsf64`` will be changed to return ``uint32_t`` + instead of ``int`` as originally intended. + * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does not allow for writing optimized code for all the CPU architectures supported in DPDK. DPDK will adopt C11 atomic operations semantics and provide wrappers
Signature · 1 line
2.30.0.vfs.0.2
PATCH v2 1/1 doc: propose correction rte_{bsf, fls} inline functions type use
The proposal has resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()
[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
--- doc/guides/rel_notes/deprecation.rst | 7 +++++++ 1 file changed, 7 insertions(+)
doc/guides/rel_notes/deprecation.rst +7 -0
@@ -17,6 +17,13 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. +* eal: Fix inline function return and parameter types for rte_{bsf,fls} + inline functions to be consistent. + Change ``rte_bsf32_safe`` parameter ``v`` from ``uint64_t`` to ``uint32_t``. + Change ``rte_bsf64`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u32`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u64`` return type to ``uint32_t`` instead of ``int``. + * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does not allow for writing optimized code for all the CPU architectures supported in DPDK. DPDK will adopt C11 atomic operations semantics and provide wrappers
Signature · 1 line
2.30.0.vfs.0.2
Re: [dpdk-dev] [PATCH v2] doc: propose correction rte_{bsf, fls} inline functions type use
15/03/2021 20:34, Tyler Retzlaff:
Quoted 19 lines
The proposal has resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Signed-off-by Tyler Retzlaff <[email protected]>---
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 25
Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +6
-0+* eal: Fix inline function return and parameter types for rte_{bsf,fls} + inline functions to be consistent. + Change ``rte_bsf32_safe`` parameter ``v`` from ``uint64_t`` to ``uint32_t``. + Change ``rte_bsf64`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u32`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u64`` return type to ``uint32_t`` instead of ``int``.
It seems we completely forgot this.
How critical is it?
Re: [dpdk-dev] [PATCH v2] doc: propose correction rte_{bsf, fls} inline functions type use
Quoted 29 lines
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Monday, 25 October 2021 21.1415/03/2021 20:34, Tyler Retzlaff:
Quoted 19 lines
The proposal has resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Signed-off-by Tyler Retzlaff <[email protected]>---
doc/guides/rel_notes/deprecation.rst
Quoted 1 line
doc/guides/rel_notes/deprecation.rst +1
-0+* eal: Fix inline function return and parameter types forrte_{bsf,fls}
doc/guides/rel_notes/deprecation.rst
Quoted 2 lines
doc/guides/rel_notes/deprecation.rst +2
-0+ inline functions to be consistent. + Change ``rte_bsf32_safe`` parameter ``v`` from ``uint64_t`` to``uint32_t``.
Quoted 1 line
+ Change ``rte_bsf64`` return type to ``uint32_t`` instead of
Quoted 8 lines
``int``.
Quoted 1 line
+ Change ``rte_fls_u32`` return type to ``uint32_t`` instead of
``int``.
Quoted 1 line
+ Change ``rte_fls_u64`` return type to ``uint32_t`` instead of
``int``.
It seems we completely forgot this.
How critical is it?
Not updating has near zero effect on bug probability: Incorrectly returning signed int instead of unsigned int is extremely unlikely to cause problems.
Updating has near zero performance improvement: The unnecessary expansion of a parameter value from 32 to 64 bits is cheap.
The update's only tangible benefit is API consistency. :-)
-Morten
Re: [dpdk-dev] [PATCH v2] doc: propose correction rte_{bsf, fls} inline functions type use
Quoted 29 lines · Morten Brørup
Quoted 29 lines
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Monday, 25 October 2021 21.1415/03/2021 20:34, Tyler Retzlaff:
Quoted 19 lines
The proposal has resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Signed-off-by Tyler Retzlaff <[email protected]>---
doc/guides/rel_notes/deprecation.rst
Quoted 1 line
doc/guides/rel_notes/deprecation.rst +1
-0+* eal: Fix inline function return and parameter types forrte_{bsf,fls}
doc/guides/rel_notes/deprecation.rst
Quoted 2 lines
doc/guides/rel_notes/deprecation.rst +2
-0+ inline functions to be consistent. + Change ``rte_bsf32_safe`` parameter ``v`` from ``uint64_t`` to``uint32_t``.
Quoted 1 line
+ Change ``rte_bsf64`` return type to ``uint32_t`` instead of
Quoted 9 lines
Quoted 8 lines
``int``.
Quoted 1 line
+ Change ``rte_fls_u32`` return type to ``uint32_t`` instead of
``int``.
Quoted 1 line
+ Change ``rte_fls_u64`` return type to ``uint32_t`` instead of
``int``.
It seems we completely forgot this.
How critical is it?
our organization as a matter of internal security policy requires these sorts of things to be fixed. while i didn't see any bugs in the dpdk code there is an opportunity for users of these functions to accidentally write code that is prone to integer and buffer overflow class bugs.
there is no urgency, but why leave things sloppy? though i do wish this had been responded to in a more timely manner 7 months for something that should have almost been rubber stamped.
Quoted 7 lines
Not updating has near zero effect on bug probability: Incorrectly returning signed int instead of unsigned int is extremely unlikely to cause problems.
Updating has near zero performance improvement: The unnecessary expansion of a parameter value from 32 to 64 bits is cheap.
The update's only tangible benefit is API consistency. :-)
-Morten
Re: [dpdk-dev] [PATCH v2] doc: propose correction rte_{bsf, fls} inline functions type use
11/11/2021 05:15, Tyler Retzlaff:
Quoted 46 lines · Morten Brørup
Quoted 29 lines
Quoted 29 lines
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Monday, 25 October 2021 21.1415/03/2021 20:34, Tyler Retzlaff:
Quoted 19 lines
The proposal has resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Signed-off-by Tyler Retzlaff <[email protected]>---
doc/guides/rel_notes/deprecation.rst
Quoted 1 line
doc/guides/rel_notes/deprecation.rst +1
-0+* eal: Fix inline function return and parameter types forrte_{bsf,fls}
doc/guides/rel_notes/deprecation.rst
Quoted 2 lines
doc/guides/rel_notes/deprecation.rst +2
-0+ inline functions to be consistent. + Change ``rte_bsf32_safe`` parameter ``v`` from ``uint64_t`` to``uint32_t``.
Quoted 1 line
+ Change ``rte_bsf64`` return type to ``uint32_t`` instead of
Quoted 9 lines
Quoted 8 lines
``int``.
Quoted 1 line
+ Change ``rte_fls_u32`` return type to ``uint32_t`` instead of
``int``.
Quoted 1 line
+ Change ``rte_fls_u64`` return type to ``uint32_t`` instead of
``int``.
It seems we completely forgot this.
How critical is it?our organization as a matter of internal security policy requires these sorts of things to be fixed. while i didn't see any bugs in the dpdk code there is an opportunity for users of these functions to accidentally write code that is prone to integer and buffer overflow class bugs.
Quoted 3 lines
there is no urgency, but why leave things sloppy? though i do wish this had been responded to in a more timely manner 7 months for something that should have almost been rubber stamped.
It's difficult to be on all topics.
The best way to avoid such miss is to ping when you see no progress.
So what's next?
They are only inline functions, right? so no ABI breakage. Is it going to require any change on application-side? I guess no. Is it acceptable in 21.11-rc3? maybe too late?
Is it acceptable in 22.02?
RE: [dpdk-dev] [PATCH v2] doc: propose correction rte_{bsf, fls} inline functions type use
Quoted 63 lines
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, 11 November 2021 12.5511/11/2021 05:15, Tyler Retzlaff:
Quoted 2 lines · Morten Brørup
Quoted 1 line
Quoted 1 line
From: dev [mailto:[email protected]] On Behalf Of Thomas
Monjalon
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Sent: Monday, 25 October 2021 21.14
15/03/2021 20:34, Tyler Retzlaff:
Quoted 1 line
The proposal has resulted from request to review [1] the
following
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
functions where there appeared to be inconsistency in return
type
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
or parameter type selections for the following inline
functions.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
doc/guides/rel_notes/deprecation.rst
Quoted 5 lines
Signed-off-by Tyler Retzlaff <[email protected]>---
doc/guides/rel_notes/deprecation.rst +1
-0+* eal: Fix inline function return and parameter types forrte_{bsf,fls}
Quoted 2 lines
doc/guides/rel_notes/deprecation.rst +2
-0+ inline functions to be consistent. + Change ``rte_bsf32_safe`` parameter ``v`` from ``uint64_t``to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
``uint32_t``.
Quoted 1 line
+ Change ``rte_bsf64`` return type to ``uint32_t`` instead of
``int``.
Quoted 1 line
+ Change ``rte_fls_u32`` return type to ``uint32_t`` instead
of
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
``int``.
Quoted 1 line
+ Change ``rte_fls_u64`` return type to ``uint32_t`` instead
of
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
``int``.
It seems we completely forgot this.
How critical is it?our organization as a matter of internal security policy requires
these
Quoted 6 lines
sorts of things to be fixed. while i didn't see any bugs in the dpdk code there is an opportunity for users of these functions to accidentally write code that is prone to integer and buffer overflow class bugs.
there is no urgency, but why leave things sloppy? though i do wish
this
Quoted 2 lines
had been responded to in a more timely manner 7 months for something that should have almost been rubber stamped.
Quoted 8 lines
It's difficult to be on all topics.
The best way to avoid such miss is to ping when you see no progress.So what's next?
They are only inline functions, right? so no ABI breakage. Is it going to require any change on application-side? I guess no. Is it acceptable in 21.11-rc3? maybe too late?
Is it acceptable in 22.02?
If Microsoft (represented by Tyler in this case) considers this a bug, I would prefer getting it into 21.11 - especially because it is an LTS release.
-Morten
Jerin Jacob
Acked-byRe: [dpdk-dev] [PATCH v2] doc: propose correction rte_{bsf, fls} inline functions type use
Quoted 27 lines · Morten Brørup
Quoted 27 lines
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, 11 November 2021 12.5511/11/2021 05:15, Tyler Retzlaff:
Quoted 2 lines · Morten Brørup
Quoted 1 line
Quoted 1 line
From: dev [mailto:[email protected]] On Behalf Of Thomas
Monjalon
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Sent: Monday, 25 October 2021 21.14
15/03/2021 20:34, Tyler Retzlaff:
Quoted 1 line
The proposal has resulted from request to review [1] the
following
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
functions where there appeared to be inconsistency in return
type
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
or parameter type selections for the following inline
functions.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Signed-off-by Tyler Retzlaff <[email protected]>
Quoted 47 lines
Quoted 34 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
doc/guides/rel_notes/deprecation.rst
Quoted 4 lines
---
doc/guides/rel_notes/deprecation.rst +1
-0+* eal: Fix inline function return and parameter types forrte_{bsf,fls}
Quoted 2 lines
doc/guides/rel_notes/deprecation.rst +2
-0+ inline functions to be consistent. + Change ``rte_bsf32_safe`` parameter ``v`` from ``uint64_t``to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
``uint32_t``.
Quoted 1 line
+ Change ``rte_bsf64`` return type to ``uint32_t`` instead of
``int``.
Quoted 1 line
+ Change ``rte_fls_u32`` return type to ``uint32_t`` instead
of
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
``int``.
Quoted 1 line
+ Change ``rte_fls_u64`` return type to ``uint32_t`` instead
of
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
``int``.
It seems we completely forgot this.
How critical is it?our organization as a matter of internal security policy requires
these
Quoted 6 lines
sorts of things to be fixed. while i didn't see any bugs in the dpdk code there is an opportunity for users of these functions to accidentally write code that is prone to integer and buffer overflow class bugs.
there is no urgency, but why leave things sloppy? though i do wish
this
Quoted 2 lines
had been responded to in a more timely manner 7 months for something that should have almost been rubber stamped.
Quoted 8 lines
It's difficult to be on all topics.
The best way to avoid such miss is to ping when you see no progress.So what's next?
They are only inline functions, right? so no ABI breakage. Is it going to require any change on application-side? I guess no. Is it acceptable in 21.11-rc3? maybe too late?
Is it acceptable in 22.02?If Microsoft (represented by Tyler in this case) considers this a bug, I would prefer getting it into 21.11 - especially because it is an LTS release.
-Morten
Re: [dpdk-dev] [PATCH v2] doc: propose correction rte_{bsf, fls} inline functions type use
In reply to Morten BrørupTyler, there was no progress on this topic during the past year. Please could you send the patch to fix API inconsistencies, so we will merge it in 22.11?
Re: [dpdk-dev] [PATCH v2] doc: propose correction rte_{bsf, fls} inline functions type use
Hi Thomas,
I will see if i can carve out some time budget for it, it's a pretty old patch so it could take some time to review.
Quoted 4 lines · Thomas Monjalon
Tyler, there was no progress on this topic during the past year. Please could you send the patch to fix API inconsistencies, so we will merge it in 22.11?
cover cleanup bsf and fls inline function return types
In reply to Tyler RetzlaffThe cleanup resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
Since the original request some instances have been fixed so this series completes the outstanding return value type updates.
[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Tyler Retzlaff (3):
doc: announce cleanup of rte_{bsf, fls} inline functions type use
eal: change rte_fls and rte_bsf to return uint32_t
test: fix sign compare warning for rte_bsf64 return type change
app/test/test_mbuf.c | 2 +- doc/guides/rel_notes/deprecation.rst | 6 ++++++ lib/eal/include/rte_common.h | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 doc: announce cleanup of rte_{bsf, fls} inline functions type use
From: Tyler Retzlaff <[email protected]>
The cleanup resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()
[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
--- doc/guides/rel_notes/deprecation.rst | 6 ++++++ 1 file changed, 6 insertions(+)
doc/guides/rel_notes/deprecation.rst +6 -0
@@ -17,6 +17,12 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. +* eal: Fix inline function return and parameter types for rte_{bsf,fls} + inline functions to be consistent in DPDK 22.11. + Change ``rte_bsf64`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u32`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u64`` return type to ``uint32_t`` instead of ``int``. + * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does not allow for writing optimized code for all the CPU architectures supported in DPDK. DPDK has adopted the atomic operations from
Signature · 1 line
1.8.3.1
Re: [PATCH 1/3] doc: announce cleanup of rte_{bsf, fls} inline functions type use
08/08/2022 23:21, Tyler Retzlaff:
Quoted 10 lines
From: Tyler Retzlaff <[email protected]>
The cleanup resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
rte_bsf32()rte_bsf32_safe()rte_bsf64()rte_bsf64_safe()
Why _safe functions are not changed?
Quoted 16 lines
rte_fls_u32()rte_fls_u64()rte_log2_u32()rte_log2_u64()[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/deprecation.rst | 6 ++++++ 1 file changed, 6 insertions(+)doc/guides/rel_notes/deprecation.rst +0
-0
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 24
Quoted 5 lines
doc/guides/rel_notes/deprecation.rst +5
-0+* eal: Fix inline function return and parameter types for rte_{bsf,fls} + inline functions to be consistent in DPDK 22.11. + Change ``rte_bsf64`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u32`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u64`` return type to ``uint32_t`` instead of ``int``.
It is too late for the announce,
but the release notes requires to be updated.
PATCH 2/3 eal: change rte_fls and rte_bsf to return uint32_t
In reply to Tyler RetzlaffFrom: Tyler Retzlaff <[email protected]>
return fixed width uint32_t to be consistent with what appears to be the original authors intent. it doesn't make much sense to return signed integers for these functions.
--- lib/eal/include/rte_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/eal/include/rte_common.h +3 -3
@@ -707,7 +707,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* @return * The last (most-significant) bit set, or 0 if the input is 0. */ -static inline int +static inline uint32_t rte_fls_u32 (uint32_t x) {return (x ==0 ) ?0 :32 -__builtin_clz (x);
@@ -724,7 +724,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* @return * least significant set bit in the input parameter. */ -static inline int +static inline uint32_t rte_bsf64 (uint64_t v) {return (uint32_t )__builtin_ctzll (v);
@@ -766,7 +766,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* @return * The last (most-significant) bit set, or 0 if the input is 0. */ -static inline int +static inline uint32_t rte_fls_u64 (uint64_t x) {return (x ==0 ) ?0 :64 -__builtin_clzll (x);
Signature · 1 line
1.8.3.1
Re: [PATCH 2/3] eal: change rte_fls and rte_bsf to return uint32_t
08/08/2022 23:21, Tyler Retzlaff:
Quoted 35 lines
From: Tyler Retzlaff <[email protected]>
return fixed width
uint32_tto be consistent with what appears to be the original authors intent. it doesn't make much sense to return signed integers for these functions.Signed-off-by Tyler Retzlaff <[email protected]>--- lib/eal/include/rte_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)lib/eal/include/rte_common.h +2
-2@@ -707,7 +707,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* @return * The last (most-significant) bit set, or 0 if the input is 0. */ -static inline int +static inline uint32_t rte_fls_u32 (uint32_t x) {return (x ==0 ) ?0 :32 -__builtin_clz (x);@@ -724,7 +724,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* @return * least significant set bit in the input parameter. */ -static inline int +static inline uint32_t rte_bsf64 (uint64_t v) {return (uint32_t )__builtin_ctzll (v);
lib/eal/include/rte_common.h static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) · line 772
Quoted 8 lines
lib/eal/include/rte_common.h +1
-1@@ -766,7 +766,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* @return * The last (most-significant) bit set, or 0 if the input is 0. */ -static inline int +static inline uint32_t rte_fls_u64 (uint64_t x) {return (x ==0 ) ?0 :64 -__builtin_clzll (x);
You forgot the _safe versions:
lib/eal/include/rte_common.h +2 -2
@@ -660,7 +660,7 @@ rte_bsf32(uint32_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline int +static inline uint32_t rte_bsf32_safe (uint32_t v,uint32_t *pos) {if (v ==0 )
@@ -739,7 +739,7 @@ rte_bsf64(uint64_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline int +static inline uint32_t rte_bsf64_safe (uint64_t v,uint32_t *pos) {if (v ==0 )
Re: [PATCH 2/3] eal: change rte_fls and rte_bsf to return uint32_t
Quoted 23 lines · Thomas Monjalon
08/08/2022 23:21, Tyler Retzlaff:
Quoted 2 lines
From: Tyler Retzlaff <[email protected]>
You forgot the
_safeversions:lib/eal/include/rte_common.h +1
-1@@ -660,7 +660,7 @@ rte_bsf32(uint32_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline int +static inline uint32_t rte_bsf32_safe (uint32_t v,uint32_t *pos) {if (v ==0 )
lib/eal/include/rte_common.h rte_bsf64(uint64_t v) · line 745
Quoted 8 lines
lib/eal/include/rte_common.h +1
-1@@ -739,7 +739,7 @@ rte_bsf64(uint64_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline int +static inline uint32_t rte_bsf64_safe (uint64_t v,uint32_t *pos) {if (v ==0 )
the return values from the _safe versions are `int' treated like a bool type. they have been left as is to be consistent with the rest of dpdk return value types.
the non-safe version returns were returning actual values and not an indication of success or failure.
they could certainly be changed to C99 fixed width types but if they are changed at all perhaps they should be changed to _Bool or bool from stdbool.h?
it looks like this change has been merged already but if you would like to make any further changes let me know i'll take care of it.
thanks
Re: [PATCH 2/3] eal: change rte_fls and rte_bsf to return uint32_t
05/10/2022 17:15, Tyler Retzlaff:
Quoted 40 lines · Thomas Monjalon
Quoted 23 lines
08/08/2022 23:21, Tyler Retzlaff:
Quoted 2 lines
From: Tyler Retzlaff <[email protected]>
You forgot the
_safeversions:lib/eal/include/rte_common.h +1
-1@@ -660,7 +660,7 @@ rte_bsf32(uint32_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline int +static inline uint32_t rte_bsf32_safe (uint32_t v,uint32_t *pos) {if (v ==0 )lib/eal/include/rte_common.h rte_bsf64(uint64_t v) · line 745
Quoted 8 lines
lib/eal/include/rte_common.h +1
-1@@ -739,7 +739,7 @@ rte_bsf64(uint64_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline int +static inline uint32_t rte_bsf64_safe (uint64_t v,uint32_t *pos) {if (v ==0 )the return values from the
_safeversions are `int' treated like a bool type. they have been left as is to be consistent with the rest of dpdk return value types.the non-safe version returns were returning actual values and not an indication of success or failure.
Quoted 7 lines
they could certainly be changed to C99 fixed width types but if they are changed at all perhaps they should be changed to
_Boolor bool fromstdbool.h?it looks like this change has been merged already but if you would like to make any further changes let me know i'll take care of it.
Sorry, it's my mistake, I went too fast.
I'll revert them to int.
PATCH 1/1 eal: fix return type of bsf safe functions
In a recent commit, changing return type from int to uint32_t, I did a last minute change to functions rte_bsf32_safe and rte_bsf64_safe, because thought they were forgotten.
Actually these functions are returning 0 or 1, so it should be int. The return type is reverted to the original type for these 2 functions.
--- lib/eal/include/rte_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/eal/include/rte_common.h +2 -2
@@ -660,7 +660,7 @@ rte_bsf32(uint32_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline uint32_t +static inline int rte_bsf32_safe (uint32_t v,uint32_t *pos) {if (v ==0 )
@@ -739,7 +739,7 @@ rte_bsf64(uint64_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline uint32_t +static inline int rte_bsf64_safe (uint64_t v,uint32_t *pos) {if (v ==0 )
Signature · 1 line
2.36.1
Re: [PATCH] eal: fix return type of bsf safe functions
Quoted 10 lines · Thomas Monjalon
In a recent commit, changing return type from int to
uint32_t, I did a last minute change to functionsrte_bsf32_safeandrte_bsf64_safe, because thought they were forgotten.
Actually these functions are returning 0 or 1, so it should be int. The return type is reverted to the original type for these 2 functions.Fixes 4b81c145ae37 ("eal: change return type of bsf/fls functions")Signed-off-by Thomas Monjalon <[email protected]>
Signature · 1 line
David Marchand
Tyler Retzlaff
Acked-byRe: [PATCH] eal: fix return type of bsf safe functions
Quoted 8 lines · David Marchand
Quoted 7 lines · Thomas Monjalon
In a recent commit, changing return type from int to
uint32_t, I did a last minute change to functionsrte_bsf32_safeandrte_bsf64_safe, because thought they were forgotten.
Actually these functions are returning 0 or 1, so it should be int. The return type is reverted to the original type for these 2 functions.
Quoted 5 lines
Quoted 3 lines
Fixes 4b81c145ae37 ("eal: change return type of bsf/fls functions")Signed-off-by Thomas Monjalon <[email protected]>Reviewed-by David Marchand <[email protected]>
Thomas Monjalon
AppliedRe: [PATCH] eal: fix return type of bsf safe functions
06/10/2022 00:20, Tyler Retzlaff:
Quoted 9 lines · David Marchand
Quoted 8 lines · Thomas Monjalon
Quoted 7 lines
In a recent commit, changing return type from int to
uint32_t, I did a last minute change to functionsrte_bsf32_safeandrte_bsf64_safe, because thought they were forgotten.
Actually these functions are returning 0 or 1, so it should be int. The return type is reverted to the original type for these 2 functions.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Fixes 4b81c145ae37 ("eal: change return type of bsf/fls functions")Signed-off-by Thomas Monjalon <[email protected]>Reviewed-by David Marchand <[email protected]>Acked-by Tyler Retzlaff <[email protected]>
Applied, sorry for the noise.
Re: [PATCH] eal: fix return type of bsf safe functions
In reply to Thomas MonjalonQuoted 4 lines · Thomas Monjalon
In a recent commit, changing return type from int to
uint32_t, I did a last minute change to functionsrte_bsf32_safeandrte_bsf64_safe, because thought they were forgotten.
Actually these functions are returning 0 or 1, so it should be int.
Wouldn't bool be a better choice?
Quoted 31 lines
The return type is reverted to the original type for these 2 functions.
Fixes 4b81c145ae37 ("eal: change return type of bsf/fls functions")Signed-off-by Thomas Monjalon <[email protected]>--- lib/eal/include/rte_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/eal/include/rte_common.h +2
-2@@ -660,7 +660,7 @@ rte_bsf32(uint32_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline uint32_t +static inline int rte_bsf32_safe (uint32_t v,uint32_t *pos) {if (v ==0 )@@ -739,7 +739,7 @@ rte_bsf64(uint64_t v)* @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline uint32_t +static inline int rte_bsf64_safe (uint64_t v,uint32_t *pos) {if (v ==0 )
PATCH 3/3 test: fix sign compare warning for rte_bsf64 return type change
In reply to Tyler RetzlaffFrom: Tyler Retzlaff <[email protected]>
rte_bsf64 return type has been changed insert cast to suppress sign-comapre warning with int.
--- app/test/test_mbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_mbuf.c +1 -1
@@ -2677,7 +2677,7 @@ struct test_case { flag3 =rte_mbuf_dynflag_register_bitnum (&dynflag3,rte_bsf64 (RTE_MBUF_F_LAST_FREE )); -if (flag3 !=rte_bsf64 (RTE_MBUF_F_LAST_FREE )) +if ((uint32_t )flag3 !=rte_bsf64 (RTE_MBUF_F_LAST_FREE ))GOTO_FAIL ("failed to register dynamic flag 3, flag3=%d: %s" , flag3,strerror (errno));
Signature · 1 line
1.8.3.1
Re: [PATCH 0/3] cleanup bsf and fls inline function return types
In reply to Tyler RetzlaffQuoted 14 lines · On Mon, 8 Aug 2022 14:21:29 -0700 Tyler Retzlaff…
The cleanup resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
Since the original request some instances have been fixed so this series completes the outstanding return value type updates.
[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Tyler Retzlaff (3):
doc: announce cleanup of rte_{bsf, fls} inline functions type use
eal: changerte_flsandrte_bsfto returnuint32_t
test: fix sign compare warning forrte_bsf64return type change
Quoted 5 lines
app/test/test_mbuf.c | 2 +- doc/guides/rel_notes/deprecation.rst | 6 ++++++ lib/eal/include/rte_common.h | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-)
RE: [PATCH 0/3] cleanup bsf and fls inline function return types
In reply to Tyler RetzlaffQuoted 17 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Monday, 8 August 2022 23.21The cleanup resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
Since the original request some instances have been fixed so this series completes the outstanding return value type updates.
[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Tyler Retzlaff (3):
doc: announce cleanup of rte_{bsf, fls} inline functions type use
eal: changerte_flsandrte_bsfto returnuint32_t
test: fix sign compare warning forrte_bsf64return type change
Quoted 8 lines
app/test/test_mbuf.c | 2 +- doc/guides/rel_notes/deprecation.rst | 6 ++++++ lib/eal/include/rte_common.h | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-)--
1.8.3.1
Re: [PATCH 0/3] cleanup bsf and fls inline function return types
09/08/2022 10:26, Morten Brørup:
Quoted 17 lines
Quoted 17 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Monday, 8 August 2022 23.21The cleanup resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions.
Since the original request some instances have been fixed so this series completes the outstanding return value type updates.
[1] http://mails.dpdk.org/archives/dev/2021-March/201590.html
Tyler Retzlaff (3):
doc: announce cleanup of rte_{bsf, fls} inline functions type use
eal: changerte_flsandrte_bsfto returnuint32_t
test: fix sign compare warning forrte_bsf64return type change
Quoted 6 lines
Quoted 4 lines
app/test/test_mbuf.c | 2 +- doc/guides/rel_notes/deprecation.rst | 6 ++++++ lib/eal/include/rte_common.h | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-)Series-Acked-by Morten Brørup <[email protected]>
Applied and completed.
Release notes added.
All squashed.