eal: small rte_common.h fixes and cleanup
Subsystems (4)
cover eal: small rte_common.h fixes and cleanup
Dmitry Kozlyuk (3):
eal: fix pointer arithmetic with an expression argument
eal: uninline rte_str_to_size
eal: deduplicate roundup code
app/test/test_common.c | 11 ++++++++ lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++ lib/eal/include/rte_common.h | 38 ++++---------------------- lib/eal/version.map | 1 + 4 files changed, 49 insertions(+), 33 deletions(-)
Signature · 1 line
2.33.1
PATCH 1/3 eal: fix pointer arithmetic with an expression argument
RTE_PTR_SUB(ptr, x) and RTE_PTR_ALIGN_FLOOR() worked incorrectly if "ptr" was an expression:
uint32_t arr[3];
RTE_PTR_SUB(arr + 1, sizeof(arr[0]));
// expected: (uint32_t *)((uintptr_t)(arr + 1) - 4) == arr
// actual: (uint32_t *)((uintptr_t) arr + 1 - 4) != arr
RTE_PTR_ALIGN_FLOOR(arr + 2, sizeof(arr[0]));
// expected: RTE_ALIGN_FLOOR((uintptr_t)(arr + 2), 4) == &arr[2]
// actual: RTE_ALIGN_FLOOR((uintptr_t) arr + 2, 4) == &arr[0]Fix the macros and extend the relevant unit test.
--- app/test/test_common.c | 11 +++++++++++ lib/eal/include/rte_common.h | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-)
app/test/test_common.c +11 -0
@@ -31,6 +31,7 @@ test_macros(int __rte_unused unused_parm)uintptr_t unused =0 ;unsigned int smaller =SMALLER , bigger =BIGGER ; +uint32_t arr[3 ];RTE_SET_USED (unused);
@@ -41,6 +42,16 @@ test_macros(int __rte_unused unused_parm)FAIL_MACRO (RTE_PTR_ADD );if ((uintptr_t )RTE_PTR_SUB (BIGGER ,PTR_DIFF ) !=SMALLER )FAIL_MACRO (RTE_PTR_SUB ); +if (RTE_PTR_ADD (arr +1 ,sizeof (arr[0 ])) != &arr[2 ]) +FAIL_MACRO (RTE_PTR_ADD ); +if (RTE_PTR_SUB (arr +1 ,sizeof (arr[0 ])) != &arr[0 ]) +FAIL_MACRO (RTE_PTR_SUB ); +if (RTE_PTR_ALIGN_FLOOR (arr +2 ,4 ) != &arr[2 ]) +FAIL_MACRO (RTE_PTR_ALIGN_FLOOR ); +if (RTE_PTR_ALIGN_CEIL (arr +2 ,4 ) != &arr[2 ]) +FAIL_MACRO (RTE_PTR_ALIGN_CEIL ); +if (RTE_PTR_ALIGN (arr +2 ,4 ) != &arr[2 ]) +FAIL_MACRO (RTE_PTR_ALIGN );if (RTE_PTR_DIFF (BIGGER ,SMALLER ) !=PTR_DIFF )FAIL_MACRO (RTE_PTR_DIFF );if (RTE_MAX (SMALLER ,BIGGER ) !=BIGGER )
lib/eal/include/rte_common.h +2 -2
@@ -295,7 +295,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)/** * subtract a byte-value offset from a pointer */ -#define RTE_PTR_SUB (ptr, x) ((void*)((uintptr_t)ptr - (x))) +#define RTE_PTR_SUB (ptr, x) ((void *)((uintptr_t)(ptr) - (x)))/** * get the difference between two pointer values, i.e. how far apart
@@ -320,7 +320,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* must be a power-of-two value. */ #define RTE_PTR_ALIGN_FLOOR (ptr, align) \ - ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)ptr, align)) + ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)(ptr), align))/** * Macro to align a value to a given power-of-two. The resultant value
Signature · 1 line
2.33.1
RE: [PATCH 1/3] eal: fix pointer arithmetic with an expression argument
Quoted 16 lines
From: Dmitry Kozlyuk [mailto:[email protected]]
Sent: Sunday, 21 August 2022 22.50
RTE_PTR_SUB(ptr, x)andRTE_PTR_ALIGN_FLOOR()worked incorrectly if "ptr" was an expression:uint32_t arr[3]; RTE_PTR_SUB(arr + 1, sizeof(arr[0])); // expected: (uint32_t *)((uintptr_t)(arr + 1) - 4) == arr // actual: (uint32_t *)((uintptr_t) arr + 1 - 4) != arr RTE_PTR_ALIGN_FLOOR(arr + 2, sizeof(arr[0])); // expected: RTE_ALIGN_FLOOR((uintptr_t)(arr + 2), 4) == &arr[2] // actual: RTE_ALIGN_FLOOR((uintptr_t) arr + 2, 4) == &arr[0]
Quoted 1 line
Fix the macros and extend the relevant unit test.
Good catch. Serious bugs!
Quoted 23 lines
Fixes af75078fece3 ("first public release")Signed-off-by Dmitry Kozlyuk <[email protected]>--- app/test/test_common.c | 11 +++++++++++ lib/eal/include/rte_common.h | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-)app/test/test_common.c +1
-0@@ -31,6 +31,7 @@ test_macros(int __rte_unused unused_parm)uintptr_t unused =0 ;unsigned int smaller =SMALLER , bigger =BIGGER ; +uint32_t arr[3 ];RTE_SET_USED (unused);
app/test/test_common.c test_macros(int __rte_unused unused_parm) · line 48
Quoted 7 lines
app/test/test_common.c +4
-0@@ -41,6 +42,16 @@ test_macros(int __rte_unused unused_parm)FAIL_MACRO (RTE_PTR_ADD );if ((uintptr_t )RTE_PTR_SUB (BIGGER ,PTR_DIFF ) !=SMALLER )FAIL_MACRO (RTE_PTR_SUB ); +if (RTE_PTR_ADD (arr +1 ,sizeof (arr[0 ])) != &arr[2 ]) +FAIL_MACRO (RTE_PTR_ADD ); +if (RTE_PTR_SUB (arr +1 ,sizeof (arr[0 ])) != &arr[0 ]) +FAIL_MACRO (RTE_PTR_SUB );
Very elegant test cases. :-)
app/test/test_common.c test_macros(int __rte_unused unused_parm) · line 52
Quoted 4 lines
app/test/test_common.c +4
-0+if (RTE_PTR_ALIGN_FLOOR (arr +2 ,4 ) != &arr[2 ]) +FAIL_MACRO (RTE_PTR_ALIGN_FLOOR ); +if (RTE_PTR_ALIGN_CEIL (arr +2 ,4 ) != &arr[2 ]) +FAIL_MACRO (RTE_PTR_ALIGN_CEIL );
While you are at it, consider adding a few more test cases, e.g.
RTE_PTR_ALIGN_FLOOR/CEIL(RTE_PTR_ADD(&arr[1], 1), 4), and RTE_PTR_ALIGN_FLOOR/CEIL(RTE_PTR_ADD(&arr[1], sizeof(uint32_t) - 1), 4)
Quoted 29 lines
app/test/test_common.c +2
-0+if (RTE_PTR_ALIGN (arr +2 ,4 ) != &arr[2 ]) +FAIL_MACRO (RTE_PTR_ALIGN );if (RTE_PTR_DIFF (BIGGER ,SMALLER ) !=PTR_DIFF )FAIL_MACRO (RTE_PTR_DIFF );if (RTE_MAX (SMALLER ,BIGGER ) !=BIGGER )lib/eal/include/rte_common.h +1
-1@@ -295,7 +295,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /** * subtract a byte-value offset from a pointer */ -#define RTE_PTR_SUB(ptr, x) ((void*)((uintptr_t)ptr - (x))) +#define RTE_PTR_SUB(ptr, x) ((void *)((uintptr_t)(ptr) - (x)))/** * get the difference between two pointer values, i.e. how far apart
lib/eal/include/rte_common.h +1
-1@@ -320,7 +320,7 @@ static void__attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * must be a power-of-two value. */ #define RTE_PTR_ALIGN_FLOOR (ptr, align) \ - ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)ptr, align)) + ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)(ptr), align))/**
Quoted 4 lines
* Macro to align a value to a given power-of-two. The resultant value
--
2.33.1
PATCH 2/3 eal: uninline rte_str_to_size
In reply to Dmitry KozlyukThere is no reason for rte_str_to_size() to be inline. Move the implementation out of <rte_common.h>. Export it as a stable ABI because it always has been public.
---
Now <rte_common.h> doesn't need to #include <ctypes.h> and <stdlib.h>, but removing them breaks some DPDK code, may break user code too. I'm not sure what is the compatibility policy in this regard. If such a breakage is allowed, I'd remove includes and fix DPDK code.
lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++ lib/eal/include/rte_common.h | 30 ++---------------------- lib/eal/version.map | 1 + 3 files changed, 35 insertions(+), 28 deletions(-)
lib/eal/common/eal_common_string_fns.c +32 -0
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize) rte_errno =E2BIG ;return -rte_errno; } + +uint64_t +rte_str_to_size (const char *str) +{ +char *endptr; +unsigned long long size; + +while (isspace ((int )*str)) + str++; +if (*str =='-' ) +return 0 ; + + errno =0 ; + size =strtoull (str, &endptr,0 ); +if (errno) +return 0 ; + +if (*endptr ==' ' ) + endptr++;/* allow 1 space gap */ + +switch (*endptr) { +case 'G' :case 'g' : + size *=1024 ;/* fall-through */ +case 'M' :case 'm' : + size *=1024 ;/* fall-through */ +case 'K' :case 'k' : + size *=1024 ;/* fall-through */ +default : +break ; + } +return size; +}
lib/eal/include/rte_common.h +2 -28
@@ -875,34 +875,8 @@ rte_log2_u64(uint64_t v)* @return * Number. */ -static inline uint64_t -rte_str_to_size (const char *str) -{ -char *endptr; -unsigned long long size; - -while (isspace ((int )*str)) - str++; -if (*str =='-' ) -return 0 ; - - errno =0 ; - size =strtoull (str, &endptr,0 ); -if (errno) -return 0 ; - -if (*endptr ==' ' ) - endptr++;/* allow 1 space gap */ - -switch (*endptr){ -case 'G' :case 'g' : size *=1024 ;/* fall-through */ -case 'M' :case 'm' : size *=1024 ;/* fall-through */ -case 'K' :case 'k' : size *=1024 ;/* fall-through */ -default : -break ; - } -return size; -} +uint64_t +rte_str_to_size (const char *str);/** * Function to terminate the application immediately, printing an error
lib/eal/version.map +1 -0
@@ -261,6 +261,7 @@ DPDK_23 { rte_socket_id; rte_socket_id_by_idx; rte_srand; + rte_str_to_size; rte_strerror; rte_strscpy; rte_strsplit;
Signature · 1 line
2.33.1
RE: [PATCH 2/3] eal: uninline rte_str_to_size
Quoted 11 lines
From: Dmitry Kozlyuk [mailto:[email protected]]
Sent: Sunday, 21 August 2022 22.50
To: [email protected]
Cc: Dmitry Kozlyuk; Ray Kinsella
Subject: [PATCH 2/3] eal: uninlinerte_str_to_sizeThere is no reason for
rte_str_to_size()to be inline. Move the implementation out of <rte_common.h>. Export it as a stable ABI because it always has been public.Signed-off-by Dmitry Kozlyuk <[email protected]>
Quoted 6 lines
---
Now <rte_common.h> doesn't need to #include <ctypes.h> and <stdlib.h>, but removing them breaks some DPDK code, may break user code too. I'm not sure what is the compatibility policy in this regard. If such a breakage is allowed, I'd remove includes and fix DPDK code.
The question I'm asking myself here is: Do we want rte_common.h to include common headers like these, just so we don't need to include them elsewhere? I think not.
I'm in favor of the principle of keeping it clean: Remove them from rte_common.h, and deal with the consequences.
If we keep them, we will forget why they are there, and some day in the future, someone will ask what these unused headers are doing in <rte_common.h>.
Re: [PATCH 2/3] eal: uninline rte_str_to_size
Quoted 21 lines · Morten Brørup
Quoted 11 lines
From: Dmitry Kozlyuk [mailto:[email protected]]
Sent: Sunday, 21 August 2022 22.50
To: [email protected]
Cc: Dmitry Kozlyuk; Ray Kinsella
Subject: [PATCH 2/3] eal: uninlinerte_str_to_sizeThere is no reason for
rte_str_to_size()to be inline. Move the implementation out of <rte_common.h>. Export it as a stable ABI because it always has been public.Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Morten Brørup <[email protected]>Quoted 6 lines
---
Now <rte_common.h> doesn't need to #include <ctypes.h> and <stdlib.h>, but removing them breaks some DPDK code, may break user code too. I'm not sure what is the compatibility policy in this regard. If such a breakage is allowed, I'd remove includes and fix DPDK code.
Quoted 6 lines
The question I'm asking myself here is: Do we want
rte_common.hto include common headers like these, just so we don't need to include them elsewhere? I think not.I'm in favor of the principle of keeping it clean: Remove them from
rte_common.h, and deal with the consequences.If we keep them, we will forget why they are there, and some day in the future, someone will ask what these unused headers are doing in <
rte_common.h>.
+1
Since removing headers is a build-time issue only and not runtime, I think we should just remove them.
/Bruce
PATCH 3/3 eal: deduplicate roundup code
In reply to Dmitry KozlyukRTE_CACHE_LINE_ROUNDUP() implementation repeated RTE_ALIGN_MUL_CEIL(). In other places RTE_CACHE_LINE_SIZE is assumed to be a power-of-2, so define RTE_CACHE_LINE_ROUNDUP() using RTE_ALIGN_CEIL().
--- lib/eal/include/rte_common.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
lib/eal/include/rte_common.h +1 -3
@@ -425,9 +425,7 @@ rte_is_aligned(void *ptr, unsigned align)#define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1)/** Return the first cache-aligned value greater or equal to size. */ -#define RTE_CACHE_LINE_ROUNDUP (size) \ - (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / \ - RTE_CACHE_LINE_SIZE)) +#define RTE_CACHE_LINE_ROUNDUP (size) RTE_ALIGN_CEIL(size, RTE_CACHE_LINE_SIZE)/** Cache line size in terms of log2 */ #if RTE_CACHE_LINE_SIZE ==64
Signature · 1 line
2.33.1
RE: [PATCH 3/3] eal: deduplicate roundup code
Quoted 28 lines
From: Dmitry Kozlyuk [mailto:[email protected]]
Sent: Sunday, 21 August 2022 22.50
RTE_CACHE_LINE_ROUNDUP()implementation repeatedRTE_ALIGN_MUL_CEIL(). In other placesRTE_CACHE_LINE_SIZEis assumed to be a power-of-2, so defineRTE_CACHE_LINE_ROUNDUP()usingRTE_ALIGN_CEIL().Signed-off-by Dmitry Kozlyuk <[email protected]>--- lib/eal/include/rte_common.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)lib/eal/include/rte_common.h +1
-3@@ -425,9 +425,7 @@ rte_is_aligned(void *ptr, unsigned align)#define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1)/** Return the first cache-aligned value greater or equal to size. */ -#define RTE_CACHE_LINE_ROUNDUP (size) \ - (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / \ - RTE_CACHE_LINE_SIZE)) +#define RTE_CACHE_LINE_ROUNDUP (size) RTE_ALIGN_CEIL(size, RTE_CACHE_LINE_SIZE)/** Cache line size in terms of log2 */
Quoted 4 lines
#if
RTE_CACHE_LINE_SIZE== 64
--
2.33.1
Quoted 11 lines · Dmitry Kozlyuk
Dmitry Kozlyuk (3):
eal: fix pointer arithmetic with an expression argument
eal: uninlinerte_str_to_size
eal: deduplicate roundup codeapp/test/test_common.c | 11 ++++++++ lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++ lib/eal/include/rte_common.h | 38 ++++---------------------- lib/eal/version.map | 1 + 4 files changed, 49 insertions(+), 33 deletions(-)
Thanks.
Quoted 11 lines · Dmitry Kozlyuk
Dmitry Kozlyuk (3):
eal: fix pointer arithmetic with an expression argument
eal: uninlinerte_str_to_size
eal: deduplicate roundup codeapp/test/test_common.c | 11 ++++++++ lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++ lib/eal/include/rte_common.h | 38 ++++---------------------- lib/eal/version.map | 1 + 4 files changed, 49 insertions(+), 33 deletions(-)
v2 cover eal: small rte_common.h fixes and cleanup
In reply to Dmitry Kozlyukv2:
* Extend and tidy up the macro unit test (Morten).
* Remove unneeded includes from rte_common.h (Morten, Bruce).
Dmitry Kozlyuk (4):
eal: fix pointer arithmetic with an expression argument
eal: deduplicate roundup code
eal: uninline rte_str_to_size
eal: remove unneeded includes from a public header
app/test-bbdev/test_bbdev_vector.c | 1 + .../cperf_test_vector_parsing.c | 1 + app/test-eventdev/parser.h | 1 + app/test-pmd/bpf_cmd.c | 2 + app/test-pmd/cmdline.c | 1 + app/test-pmd/cmdline_tm.c | 2 + app/test-pmd/config.c | 1 + app/test/test.h | 2 + app/test/test_common.c | 58 +++++++++++++------ drivers/bus/vdev/vdev_params.c | 1 + drivers/common/cnxk/cnxk_telemetry_nix.c | 1 + drivers/common/cnxk/cnxk_telemetry_npa.c | 1 + drivers/crypto/scheduler/scheduler_pmd.c | 2 + drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 2 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/softnic/parser.h | 1 + lib/dmadev/rte_dmadev.c | 1 + lib/eal/common/eal_common_debug.c | 2 + lib/eal/common/eal_common_string_fns.c | 36 +++++++++++- lib/eal/include/generic/rte_rwlock.h | 2 + lib/eal/include/rte_common.h | 41 ++----------- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_vfio_mp_sync.c | 1 + lib/eal/unix/eal_unix_timer.c | 1 + lib/eal/version.map | 1 + lib/eal/windows/rte_thread.c | 2 + lib/ethdev/sff_telemetry.c | 1 + lib/eventdev/rte_event_eth_rx_adapter.c | 1 + lib/eventdev/rte_event_timer_adapter.c | 1 + lib/meter/rte_meter.c | 1 + lib/pci/rte_pci.c | 1 + lib/pipeline/rte_swx_ctl.c | 1 + lib/sched/rte_pie.c | 1 + lib/security/rte_security.c | 2 + lib/telemetry/telemetry_data.c | 3 + lib/telemetry/telemetry_legacy.c | 1 + 38 files changed, 126 insertions(+), 55 deletions(-)
Signature · 1 line
2.33.1
PATCH v2 1/4 eal: fix pointer arithmetic with an expression argument
RTE_PTR_SUB(ptr, x) and RTE_PTR_ALIGN_FLOOR() worked incorrectly if "ptr" was an expression:
uint32_t arr[3];
RTE_PTR_SUB(arr + 1, sizeof(arr[0]));
// expected: (uint32_t *)((uintptr_t)(arr + 1) - 4) == arr
// actual: (uint32_t *)((uintptr_t) arr + 1 - 4) != arr
RTE_PTR_ALIGN_FLOOR(arr + 2, sizeof(arr[0]));
// expected: RTE_ALIGN_FLOOR((uintptr_t)(arr + 2), 4) == &arr[2]
// actual: RTE_ALIGN_FLOOR((uintptr_t) arr + 2, 4) == &arr[0]Fix the macros and extend the relevant unit test. Convert uses of a custom test failure macro to RTE_TEST_ASSERT*().
--- app/test/test_common.c | 58 +++++++++++++++++++++++++----------- lib/eal/include/rte_common.h | 4 +-- 2 files changed, 42 insertions(+), 20 deletions(-)
app/test/test_common.c +40 -18
@@ -25,31 +25,53 @@ test_macros(int __rte_unused unused_parm)#define SMALLER 0x1000U#define BIGGER 0x2000U#define PTR_DIFF BIGGER - SMALLER -#define FAIL_MACRO (x)\ - {printf(#x "() test failed!\n");\ - return -1;}uintptr_t unused =0 ;unsigned int smaller =SMALLER , bigger =BIGGER ; +uint32_t arr[3 ];RTE_SET_USED (unused);RTE_SWAP (smaller, bigger); -if (smaller !=BIGGER && bigger !=SMALLER ) -FAIL_MACRO (RTE_SWAP ); -if ((uintptr_t )RTE_PTR_ADD (SMALLER ,PTR_DIFF ) !=BIGGER ) -FAIL_MACRO (RTE_PTR_ADD ); -if ((uintptr_t )RTE_PTR_SUB (BIGGER ,PTR_DIFF ) !=SMALLER ) -FAIL_MACRO (RTE_PTR_SUB ); -if (RTE_PTR_DIFF (BIGGER ,SMALLER ) !=PTR_DIFF ) -FAIL_MACRO (RTE_PTR_DIFF ); -if (RTE_MAX (SMALLER ,BIGGER ) !=BIGGER ) -FAIL_MACRO (RTE_MAX ); -if (RTE_MIN (SMALLER ,BIGGER ) !=SMALLER ) -FAIL_MACRO (RTE_MIN ); - -if (strncmp (RTE_STR (test),"test" ,sizeof ("test" ))) -FAIL_MACRO (RTE_STR ); +RTE_TEST_ASSERT (smaller ==BIGGER && bigger ==SMALLER , +"RTE_SWAP" ); +RTE_TEST_ASSERT_EQUAL ((uintptr_t )RTE_PTR_ADD (SMALLER ,PTR_DIFF ),BIGGER , +"RTE_PTR_ADD" ); +RTE_TEST_ASSERT_EQUAL ((uintptr_t )RTE_PTR_SUB (BIGGER ,PTR_DIFF ),SMALLER , +"RTE_PTR_SUB" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_DIFF (BIGGER ,SMALLER ),PTR_DIFF , +"RTE_PTR_DIFF" ); +RTE_TEST_ASSERT_EQUAL (RTE_MAX (SMALLER ,BIGGER ),BIGGER , +"RTE_MAX" ); +RTE_TEST_ASSERT_EQUAL (RTE_MIN (SMALLER ,BIGGER ),SMALLER , +"RTE_MIN" ); + +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ADD (arr +1 ,sizeof (arr[0 ])), &arr[2 ], +"RTE_PTR_ADD(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_SUB (arr +1 ,sizeof (arr[0 ])), &arr[0 ], +"RTE_PTR_SUB(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN_FLOOR (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN_FLOOR(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN_CEIL (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN(expr, x)" ); + +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_FLOOR (RTE_PTR_ADD (&arr[1 ],1 ),4 ), &arr[1 ], +"RTE_PTR_ALIGN_FLOOR(x < y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_FLOOR (RTE_PTR_ADD (&arr[1 ],3 ),4 ), &arr[1 ], +"RTE_PTR_ALIGN_FLOOR(x > y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_CEIL (RTE_PTR_ADD (&arr[1 ],3 ),4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(x < y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_CEIL (RTE_PTR_ADD (&arr[1 ],1 ),4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(x > y/2, y)" ); + +RTE_TEST_ASSERT (strncmp (RTE_STR (test),"test" ,sizeof ("test" )) ==0 , +"RTE_STR" );return 0 ; }
lib/eal/include/rte_common.h +2 -2
@@ -295,7 +295,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)/** * subtract a byte-value offset from a pointer */ -#define RTE_PTR_SUB (ptr, x) ((void*)((uintptr_t)ptr - (x))) +#define RTE_PTR_SUB (ptr, x) ((void *)((uintptr_t)(ptr) - (x)))/** * get the difference between two pointer values, i.e. how far apart
@@ -320,7 +320,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* must be a power-of-two value. */ #define RTE_PTR_ALIGN_FLOOR (ptr, align) \ - ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)ptr, align)) + ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)(ptr), align))/** * Macro to align a value to a given power-of-two. The resultant value
Signature · 1 line
2.33.1
PATCH v2 2/4 eal: deduplicate roundup code
In reply to Dmitry KozlyukRTE_CACHE_LINE_ROUNDUP() implementation repeated RTE_ALIGN_MUL_CEIL(). In other places RTE_CACHE_LINE_SIZE is assumed to be a power-of-2, so define RTE_CACHE_LINE_ROUNDUP() using RTE_ALIGN_CEIL().
--- lib/eal/include/rte_common.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
lib/eal/include/rte_common.h +1 -3
@@ -425,9 +425,7 @@ rte_is_aligned(void *ptr, unsigned align)#define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1)/** Return the first cache-aligned value greater or equal to size. */ -#define RTE_CACHE_LINE_ROUNDUP (size) \ - (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / \ - RTE_CACHE_LINE_SIZE)) +#define RTE_CACHE_LINE_ROUNDUP (size) RTE_ALIGN_CEIL(size, RTE_CACHE_LINE_SIZE)/** Cache line size in terms of log2 */ #if RTE_CACHE_LINE_SIZE ==64
Signature · 1 line
2.33.1
PATCH v2 3/4 eal: uninline rte_str_to_size
In reply to Dmitry KozlyukThere is no reason for rte_str_to_size() to be inline. Move the implementation out of <rte_common.h>. Export it as a stable ABI because it always has been public.
--- lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++ lib/eal/include/rte_common.h | 30 ++---------------------- lib/eal/version.map | 1 + 3 files changed, 35 insertions(+), 28 deletions(-)
lib/eal/common/eal_common_string_fns.c +32 -0
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize) rte_errno =E2BIG ;return -rte_errno; } + +uint64_t +rte_str_to_size (const char *str) +{ +char *endptr; +unsigned long long size; + +while (isspace ((int )*str)) + str++; +if (*str =='-' ) +return 0 ; + + errno =0 ; + size =strtoull (str, &endptr,0 ); +if (errno) +return 0 ; + +if (*endptr ==' ' ) + endptr++;/* allow 1 space gap */ + +switch (*endptr) { +case 'G' :case 'g' : + size *=1024 ;/* fall-through */ +case 'M' :case 'm' : + size *=1024 ;/* fall-through */ +case 'K' :case 'k' : + size *=1024 ;/* fall-through */ +default : +break ; + } +return size; +}
lib/eal/include/rte_common.h +2 -28
@@ -873,34 +873,8 @@ rte_log2_u64(uint64_t v)* @return * Number. */ -static inline uint64_t -rte_str_to_size (const char *str) -{ -char *endptr; -unsigned long long size; - -while (isspace ((int )*str)) - str++; -if (*str =='-' ) -return 0 ; - - errno =0 ; - size =strtoull (str, &endptr,0 ); -if (errno) -return 0 ; - -if (*endptr ==' ' ) - endptr++;/* allow 1 space gap */ - -switch (*endptr){ -case 'G' :case 'g' : size *=1024 ;/* fall-through */ -case 'M' :case 'm' : size *=1024 ;/* fall-through */ -case 'K' :case 'k' : size *=1024 ;/* fall-through */ -default : -break ; - } -return size; -} +uint64_t +rte_str_to_size (const char *str);/** * Function to terminate the application immediately, printing an error
lib/eal/version.map +1 -0
@@ -261,6 +261,7 @@ DPDK_23 { rte_socket_id; rte_socket_id_by_idx; rte_srand; + rte_str_to_size; rte_strerror; rte_strscpy; rte_strsplit;
Signature · 1 line
2.33.1
PATCH v2 4/4 eal: remove unneeded includes from a public header
In reply to Dmitry KozlyukDo not include <ctype.h>, <errno.h>, and <stdlib.h> from <rte_common.h>, because they are not used by this file directly.
Include the needed headers directly from the files that need them.
---
Done as a separate commit to keep EAL change clean.
app/test-bbdev/test_bbdev_vector.c | 1 + app/test-crypto-perf/cperf_test_vector_parsing.c | 1 + app/test-eventdev/parser.h | 1 + app/test-pmd/bpf_cmd.c | 2 ++ app/test-pmd/cmdline.c | 1 + app/test-pmd/cmdline_tm.c | 2 ++ app/test-pmd/config.c | 1 + app/test/test.h | 2 ++ drivers/bus/vdev/vdev_params.c | 1 + drivers/common/cnxk/cnxk_telemetry_nix.c | 1 + drivers/common/cnxk/cnxk_telemetry_npa.c | 1 + drivers/crypto/scheduler/scheduler_pmd.c | 2 ++ drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 2 ++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/softnic/parser.h | 1 + lib/dmadev/rte_dmadev.c | 1 + lib/eal/common/eal_common_debug.c | 2 ++ lib/eal/common/eal_common_string_fns.c | 4 +++- lib/eal/include/generic/rte_rwlock.h | 2 ++ lib/eal/include/rte_common.h | 3 --- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_vfio_mp_sync.c | 1 + lib/eal/unix/eal_unix_timer.c | 1 + lib/eal/windows/rte_thread.c | 2 ++ lib/ethdev/sff_telemetry.c | 1 + lib/eventdev/rte_event_eth_rx_adapter.c | 1 + lib/eventdev/rte_event_timer_adapter.c | 1 + lib/meter/rte_meter.c | 1 + lib/pci/rte_pci.c | 1 + lib/pipeline/rte_swx_ctl.c | 1 + lib/sched/rte_pie.c | 1 + lib/security/rte_security.c | 2 ++ lib/telemetry/telemetry_data.c | 3 +++ lib/telemetry/telemetry_legacy.c | 1 + 36 files changed, 48 insertions(+), 4 deletions(-)
app/test-bbdev/test_bbdev_vector.c +1 -0
@@ -5,6 +5,7 @@#ifdef RTE_EXEC_ENV_FREEBSD #define _WITH_GETLINE#endif +#include <ctype.h> #include <stdio.h> #include <stdbool.h> #include <rte_malloc.h>
app/test-crypto-perf/cperf_test_vector_parsing.c +1 -0
@@ -4,6 +4,7 @@#ifdef RTE_EXEC_ENV_FREEBSD #define _WITH_GETLINE#endif +#include <ctype.h> #include <stdio.h> #include <rte_malloc.h>
app/test-eventdev/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __INCLUDE_PARSER_H__#define __INCLUDE_PARSER_H__ +#include <ctype.h> #include <stdint.h> #define PARSE_DELIMITER " \f\n\r\t\v"
app/test-pmd/bpf_cmd.c +2 -0
@@ -2,7 +2,9 @@* Copyright(c) 2018 Intel Corporation */ +#include <ctype.h> #include <stdio.h> +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <rte_flow.h>
app/test-pmd/cmdline.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2014 6WIND S.A. */ +#include <ctype.h> #include <stdarg.h> #include <errno.h> #include <stdio.h>
app/test-pmd/cmdline_tm.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> +#include <cmdline_parse.h> #include <cmdline_parse_num.h> #include <cmdline_parse_string.h>
app/test-pmd/config.c +1 -0
@@ -3,6 +3,7 @@* Copyright 2013-2014 6WIND S.A. */ +#include <ctype.h> #include <stdarg.h> #include <errno.h> #include <stdio.h>
app/test/test.h +2 -0
@@ -5,7 +5,9 @@#ifndef _TEST_H_#define _TEST_H_ +#include <errno.h> #include <stddef.h> +#include <stdlib.h> #include <sys/queue.h> #include <rte_hexdump.h>
drivers/bus/vdev/vdev_params.c +1 -0
@@ -2,6 +2,7 @@* Copyright 2018 Gaëtan Rivet */ +#include <errno.h> #include <string.h> #include <rte_dev.h>
drivers/common/cnxk/cnxk_telemetry_nix.c +1 -0
@@ -2,6 +2,7 @@* Copyright(C) 2021 Marvell. */ +#include <ctype.h> #include "cnxk_telemetry.h" #include "roc_api.h" #include "roc_priv.h"
drivers/common/cnxk/cnxk_telemetry_npa.c +1 -0
@@ -2,6 +2,7 @@* Copyright(C) 2021 Marvell. */ +#include <ctype.h> #include "cnxk_telemetry.h" #include "roc_api.h" #include "roc_priv.h"
drivers/crypto/scheduler/scheduler_pmd.c +2 -0
@@ -1,6 +1,8 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> +#include <rte_common.h> #include <rte_hexdump.h> #include <rte_cryptodev.h>
drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c +2 -0
@@ -2,6 +2,8 @@* Copyright(C) 2022 Marvell. */ +#include <ctype.h> +#include <rte_telemetry.h> #include <roc_api.h>
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2017 Intel Corporation */ +#include <ctype.h> #include <stdio.h> #include <errno.h> #include <stdint.h>
drivers/net/iavf/iavf_ethdev.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> #include <sys/queue.h> #include <stdio.h> #include <errno.h>
drivers/net/ice/ice_ethdev.c +1 -0
@@ -5,6 +5,7 @@#include <rte_string_fns.h> #include <ethdev_pci.h> +#include <ctype.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h>
drivers/net/softnic/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __INCLUDE_SOFTNIC_PARSER_H__#define __INCLUDE_SOFTNIC_PARSER_H__ +#include <ctype.h> #include <stdint.h> #include <rte_ip.h>
lib/dmadev/rte_dmadev.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2021 Intel Corporation */ +#include <ctype.h> #include <inttypes.h> #include <rte_eal.h>
lib/eal/common/eal_common_debug.c +2 -0
@@ -3,6 +3,8 @@*/ #include <stdarg.h> +#include <stdlib.h> +#include <rte_eal.h> #include <rte_log.h> #include <rte_debug.h>
lib/eal/common/eal_common_string_fns.c +3 -1
@@ -2,8 +2,10 @@* Copyright(c) 2010-2014 Intel Corporation */ -#include <stdio.h> +#include <ctype.h> #include <errno.h> +#include <stdio.h> +#include <stdlib.h> #include <rte_string_fns.h> #include <rte_errno.h>
lib/eal/include/generic/rte_rwlock.h +2 -0
@@ -21,6 +21,8 @@extern "C" {#endif +#include <errno.h> +#include <rte_common.h> #include <rte_atomic.h> #include <rte_pause.h>
lib/eal/include/rte_common.h +0 -3
@@ -17,9 +17,6 @@ extern "C" {#endif #include <stdint.h> -#include <stdlib.h> -#include <ctype.h> -#include <errno.h> #include <limits.h> #include <rte_config.h>
lib/eal/linux/eal.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2012-2014 6WIND S.A. */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h>
lib/eal/linux/eal_vfio_mp_sync.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2018 Intel Corporation */ +#include <errno.h> #include <unistd.h> #include <string.h>
lib/eal/unix/eal_unix_timer.c +1 -0
@@ -2,6 +2,7 @@* Copyright 2020 Mellanox Technologies, Ltd */ +#include <errno.h> #include <time.h> #include <rte_cycles.h>
lib/eal/windows/rte_thread.c +2 -0
@@ -3,6 +3,8 @@* Copyright (C) 2022 Microsoft Corporation */ +#include <errno.h> +#include <rte_common.h> #include <rte_errno.h> #include <rte_thread.h>
lib/ethdev/sff_telemetry.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2022 Intel Corporation */ +#include <ctype.h> #include <errno.h> #include "rte_ethdev.h"
lib/eventdev/rte_event_eth_rx_adapter.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation. * All rights reserved. */ +#include <ctype.h> #if defined(LINUX )#include <sys/epoll.h> #endif
lib/eventdev/rte_event_timer_adapter.c +1 -0
@@ -3,6 +3,7 @@* All rights reserved. */ +#include <ctype.h> #include <string.h> #include <inttypes.h> #include <stdbool.h>
lib/meter/rte_meter.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2014 Intel Corporation */ +#include <errno.h> #include <stdio.h> #include <math.h>
lib/pci/rte_pci.c +1 -0
@@ -3,6 +3,7 @@* Copyright 2013-2014 6WIND S.A. */ +#include <errno.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h>
lib/pipeline/rte_swx_ctl.c +1 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ +#include <errno.h> #include <stdlib.h> #include <string.h> #include <stdio.h>
lib/sched/rte_pie.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2020 Intel Corporation */ +#include <errno.h> #include <stdlib.h> #include <string.h>
lib/security/rte_security.c +2 -0
@@ -4,6 +4,8 @@* Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved */ +#include <ctype.h> +#include <rte_cryptodev.h> #include <rte_dev.h> #include <rte_telemetry.h>
lib/telemetry/telemetry_data.c +3 -0
@@ -2,6 +2,9 @@* Copyright(c) 2020 Intel Corporation */ +#include <errno.h> +#include <stdlib.h> +#undef RTE_USE_LIBBSD#include <rte_string_fns.h>
lib/telemetry/telemetry_legacy.c +1 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ +#include <ctype.h> #ifndef RTE_EXEC_ENV_WINDOWS #include <unistd.h>
Signature · 1 line
2.33.1
v3 cover eal: small rte_common.h fixes and cleanup
In reply to Dmitry Kozlyukv3: Fix build (CI).
v2:
* Extend and tidy up the macro unit test (Morten).
* Remove unneeded includes from rte_common.h (Morten, Bruce).
Dmitry Kozlyuk (4):
eal: fix pointer arithmetic with an expression argument
eal: deduplicate roundup code
eal: uninline rte_str_to_size
eal: remove unneeded includes from a public header
app/test-bbdev/test_bbdev_vector.c | 1 + .../cperf_test_vector_parsing.c | 1 + app/test-eventdev/parser.h | 1 + app/test-pmd/bpf_cmd.c | 2 + app/test-pmd/cmdline.c | 1 + app/test-pmd/cmdline_tm.c | 2 + app/test-pmd/config.c | 1 + app/test/test.h | 2 + app/test/test_common.c | 58 +++++++++++++------ drivers/bus/vdev/vdev_params.c | 1 + drivers/common/cnxk/cnxk_telemetry_nix.c | 1 + drivers/common/cnxk/cnxk_telemetry_npa.c | 1 + drivers/crypto/scheduler/scheduler_pmd.c | 2 + drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 2 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/softnic/parser.h | 1 + examples/eventdev_pipeline/main.c | 1 + examples/fips_validation/fips_validation.c | 1 + examples/ip_pipeline/parser.h | 1 + examples/ipsec-secgw/parser.h | 1 + examples/l3fwd-power/perf_core.c | 1 + examples/pipeline/cli.c | 1 + examples/vhost/main.c | 1 + lib/dmadev/rte_dmadev.c | 1 + lib/eal/common/eal_common_debug.c | 2 + lib/eal/common/eal_common_string_fns.c | 36 +++++++++++- lib/eal/freebsd/eal.c | 1 + lib/eal/include/generic/rte_rwlock.h | 2 + lib/eal/include/rte_common.h | 41 ++----------- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_vfio_mp_sync.c | 1 + lib/eal/unix/eal_unix_timer.c | 1 + lib/eal/version.map | 1 + lib/eal/windows/rte_thread.c | 2 + lib/ethdev/sff_telemetry.c | 1 + lib/eventdev/rte_event_eth_rx_adapter.c | 1 + lib/eventdev/rte_event_timer_adapter.c | 1 + lib/meter/rte_meter.c | 1 + lib/pci/rte_pci.c | 1 + lib/pipeline/rte_swx_ctl.c | 1 + lib/sched/rte_pie.c | 1 + lib/security/rte_security.c | 2 + lib/telemetry/telemetry.c | 1 + lib/telemetry/telemetry_data.c | 3 + lib/telemetry/telemetry_legacy.c | 2 + 47 files changed, 136 insertions(+), 55 deletions(-)
Signature · 1 line
2.33.1
PATCH v3 1/4 eal: fix pointer arithmetic with an expression argument
RTE_PTR_SUB(ptr, x) and RTE_PTR_ALIGN_FLOOR() worked incorrectly if "ptr" was an expression:
uint32_t arr[3];
RTE_PTR_SUB(arr + 1, sizeof(arr[0]));
// expected: (uint32_t *)((uintptr_t)(arr + 1) - 4) == arr
// actual: (uint32_t *)((uintptr_t) arr + 1 - 4) != arr
RTE_PTR_ALIGN_FLOOR(arr + 2, sizeof(arr[0]));
// expected: RTE_ALIGN_FLOOR((uintptr_t)(arr + 2), 4) == &arr[2]
// actual: RTE_ALIGN_FLOOR((uintptr_t) arr + 2, 4) == &arr[0]Fix the macros and extend the relevant unit test. Convert uses of a custom test failure macro to RTE_TEST_ASSERT*().
--- app/test/test_common.c | 58 +++++++++++++++++++++++++----------- lib/eal/include/rte_common.h | 4 +-- 2 files changed, 42 insertions(+), 20 deletions(-)
app/test/test_common.c +40 -18
@@ -25,31 +25,53 @@ test_macros(int __rte_unused unused_parm)#define SMALLER 0x1000U#define BIGGER 0x2000U#define PTR_DIFF BIGGER - SMALLER -#define FAIL_MACRO (x)\ - {printf(#x "() test failed!\n");\ - return -1;}uintptr_t unused =0 ;unsigned int smaller =SMALLER , bigger =BIGGER ; +uint32_t arr[3 ];RTE_SET_USED (unused);RTE_SWAP (smaller, bigger); -if (smaller !=BIGGER && bigger !=SMALLER ) -FAIL_MACRO (RTE_SWAP ); -if ((uintptr_t )RTE_PTR_ADD (SMALLER ,PTR_DIFF ) !=BIGGER ) -FAIL_MACRO (RTE_PTR_ADD ); -if ((uintptr_t )RTE_PTR_SUB (BIGGER ,PTR_DIFF ) !=SMALLER ) -FAIL_MACRO (RTE_PTR_SUB ); -if (RTE_PTR_DIFF (BIGGER ,SMALLER ) !=PTR_DIFF ) -FAIL_MACRO (RTE_PTR_DIFF ); -if (RTE_MAX (SMALLER ,BIGGER ) !=BIGGER ) -FAIL_MACRO (RTE_MAX ); -if (RTE_MIN (SMALLER ,BIGGER ) !=SMALLER ) -FAIL_MACRO (RTE_MIN ); - -if (strncmp (RTE_STR (test),"test" ,sizeof ("test" ))) -FAIL_MACRO (RTE_STR ); +RTE_TEST_ASSERT (smaller ==BIGGER && bigger ==SMALLER , +"RTE_SWAP" ); +RTE_TEST_ASSERT_EQUAL ((uintptr_t )RTE_PTR_ADD (SMALLER ,PTR_DIFF ),BIGGER , +"RTE_PTR_ADD" ); +RTE_TEST_ASSERT_EQUAL ((uintptr_t )RTE_PTR_SUB (BIGGER ,PTR_DIFF ),SMALLER , +"RTE_PTR_SUB" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_DIFF (BIGGER ,SMALLER ),PTR_DIFF , +"RTE_PTR_DIFF" ); +RTE_TEST_ASSERT_EQUAL (RTE_MAX (SMALLER ,BIGGER ),BIGGER , +"RTE_MAX" ); +RTE_TEST_ASSERT_EQUAL (RTE_MIN (SMALLER ,BIGGER ),SMALLER , +"RTE_MIN" ); + +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ADD (arr +1 ,sizeof (arr[0 ])), &arr[2 ], +"RTE_PTR_ADD(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_SUB (arr +1 ,sizeof (arr[0 ])), &arr[0 ], +"RTE_PTR_SUB(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN_FLOOR (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN_FLOOR(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN_CEIL (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN(expr, x)" ); + +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_FLOOR (RTE_PTR_ADD (&arr[1 ],1 ),4 ), &arr[1 ], +"RTE_PTR_ALIGN_FLOOR(x < y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_FLOOR (RTE_PTR_ADD (&arr[1 ],3 ),4 ), &arr[1 ], +"RTE_PTR_ALIGN_FLOOR(x > y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_CEIL (RTE_PTR_ADD (&arr[1 ],3 ),4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(x < y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_CEIL (RTE_PTR_ADD (&arr[1 ],1 ),4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(x > y/2, y)" ); + +RTE_TEST_ASSERT (strncmp (RTE_STR (test),"test" ,sizeof ("test" )) ==0 , +"RTE_STR" );return 0 ; }
lib/eal/include/rte_common.h +2 -2
@@ -295,7 +295,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)/** * subtract a byte-value offset from a pointer */ -#define RTE_PTR_SUB (ptr, x) ((void*)((uintptr_t)ptr - (x))) +#define RTE_PTR_SUB (ptr, x) ((void *)((uintptr_t)(ptr) - (x)))/** * get the difference between two pointer values, i.e. how far apart
@@ -320,7 +320,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* must be a power-of-two value. */ #define RTE_PTR_ALIGN_FLOOR (ptr, align) \ - ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)ptr, align)) + ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)(ptr), align))/** * Macro to align a value to a given power-of-two. The resultant value
Signature · 1 line
2.33.1
PATCH v3 2/4 eal: deduplicate roundup code
In reply to Dmitry KozlyukRTE_CACHE_LINE_ROUNDUP() implementation repeated RTE_ALIGN_MUL_CEIL(). In other places RTE_CACHE_LINE_SIZE is assumed to be a power-of-2, so define RTE_CACHE_LINE_ROUNDUP() using RTE_ALIGN_CEIL().
--- lib/eal/include/rte_common.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
lib/eal/include/rte_common.h +1 -3
@@ -425,9 +425,7 @@ rte_is_aligned(void *ptr, unsigned align)#define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1)/** Return the first cache-aligned value greater or equal to size. */ -#define RTE_CACHE_LINE_ROUNDUP (size) \ - (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / \ - RTE_CACHE_LINE_SIZE)) +#define RTE_CACHE_LINE_ROUNDUP (size) RTE_ALIGN_CEIL(size, RTE_CACHE_LINE_SIZE)/** Cache line size in terms of log2 */ #if RTE_CACHE_LINE_SIZE ==64
Signature · 1 line
2.33.1
PATCH v3 3/4 eal: uninline rte_str_to_size
In reply to Dmitry KozlyukThere is no reason for rte_str_to_size() to be inline. Move the implementation out of <rte_common.h>. Export it as a stable ABI because it always has been public.
--- lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++ lib/eal/include/rte_common.h | 30 ++---------------------- lib/eal/version.map | 1 + 3 files changed, 35 insertions(+), 28 deletions(-)
lib/eal/common/eal_common_string_fns.c +32 -0
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize) rte_errno =E2BIG ;return -rte_errno; } + +uint64_t +rte_str_to_size (const char *str) +{ +char *endptr; +unsigned long long size; + +while (isspace ((int )*str)) + str++; +if (*str =='-' ) +return 0 ; + + errno =0 ; + size =strtoull (str, &endptr,0 ); +if (errno) +return 0 ; + +if (*endptr ==' ' ) + endptr++;/* allow 1 space gap */ + +switch (*endptr) { +case 'G' :case 'g' : + size *=1024 ;/* fall-through */ +case 'M' :case 'm' : + size *=1024 ;/* fall-through */ +case 'K' :case 'k' : + size *=1024 ;/* fall-through */ +default : +break ; + } +return size; +}
lib/eal/include/rte_common.h +2 -28
@@ -873,34 +873,8 @@ rte_log2_u64(uint64_t v)* @return * Number. */ -static inline uint64_t -rte_str_to_size (const char *str) -{ -char *endptr; -unsigned long long size; - -while (isspace ((int )*str)) - str++; -if (*str =='-' ) -return 0 ; - - errno =0 ; - size =strtoull (str, &endptr,0 ); -if (errno) -return 0 ; - -if (*endptr ==' ' ) - endptr++;/* allow 1 space gap */ - -switch (*endptr){ -case 'G' :case 'g' : size *=1024 ;/* fall-through */ -case 'M' :case 'm' : size *=1024 ;/* fall-through */ -case 'K' :case 'k' : size *=1024 ;/* fall-through */ -default : -break ; - } -return size; -} +uint64_t +rte_str_to_size (const char *str);/** * Function to terminate the application immediately, printing an error
lib/eal/version.map +1 -0
@@ -261,6 +261,7 @@ DPDK_23 { rte_socket_id; rte_socket_id_by_idx; rte_srand; + rte_str_to_size; rte_strerror; rte_strscpy; rte_strsplit;
Signature · 1 line
2.33.1
PATCH v3 4/4 eal: remove unneeded includes from a public header
In reply to Dmitry KozlyukDo not include <ctype.h>, <errno.h>, and <stdlib.h> from <rte_common.h>, because they are not used by this file directly.
Include the needed headers directly from the files that need them.
--- app/test-bbdev/test_bbdev_vector.c | 1 + app/test-crypto-perf/cperf_test_vector_parsing.c | 1 + app/test-eventdev/parser.h | 1 + app/test-pmd/bpf_cmd.c | 2 ++ app/test-pmd/cmdline.c | 1 + app/test-pmd/cmdline_tm.c | 2 ++ app/test-pmd/config.c | 1 + app/test/test.h | 2 ++ drivers/bus/vdev/vdev_params.c | 1 + drivers/common/cnxk/cnxk_telemetry_nix.c | 1 + drivers/common/cnxk/cnxk_telemetry_npa.c | 1 + drivers/crypto/scheduler/scheduler_pmd.c | 2 ++ drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 2 ++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/softnic/parser.h | 1 + examples/eventdev_pipeline/main.c | 1 + examples/fips_validation/fips_validation.c | 1 + examples/ip_pipeline/parser.h | 1 + examples/ipsec-secgw/parser.h | 1 + examples/l3fwd-power/perf_core.c | 1 + examples/pipeline/cli.c | 1 + examples/vhost/main.c | 1 + lib/dmadev/rte_dmadev.c | 1 + lib/eal/common/eal_common_debug.c | 2 ++ lib/eal/common/eal_common_string_fns.c | 4 +++- lib/eal/freebsd/eal.c | 1 + lib/eal/include/generic/rte_rwlock.h | 2 ++ lib/eal/include/rte_common.h | 3 --- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_vfio_mp_sync.c | 1 + lib/eal/unix/eal_unix_timer.c | 1 + lib/eal/windows/rte_thread.c | 2 ++ lib/ethdev/sff_telemetry.c | 1 + lib/eventdev/rte_event_eth_rx_adapter.c | 1 + lib/eventdev/rte_event_timer_adapter.c | 1 + lib/meter/rte_meter.c | 1 + lib/pci/rte_pci.c | 1 + lib/pipeline/rte_swx_ctl.c | 1 + lib/sched/rte_pie.c | 1 + lib/security/rte_security.c | 2 ++ lib/telemetry/telemetry.c | 1 + lib/telemetry/telemetry_data.c | 3 +++ lib/telemetry/telemetry_legacy.c | 2 ++ 45 files changed, 58 insertions(+), 4 deletions(-)
app/test-bbdev/test_bbdev_vector.c +1 -0
@@ -5,6 +5,7 @@#ifdef RTE_EXEC_ENV_FREEBSD #define _WITH_GETLINE#endif +#include <ctype.h> #include <stdio.h> #include <stdbool.h> #include <rte_malloc.h>
app/test-crypto-perf/cperf_test_vector_parsing.c +1 -0
@@ -4,6 +4,7 @@#ifdef RTE_EXEC_ENV_FREEBSD #define _WITH_GETLINE#endif +#include <ctype.h> #include <stdio.h> #include <rte_malloc.h>
app/test-eventdev/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __INCLUDE_PARSER_H__#define __INCLUDE_PARSER_H__ +#include <ctype.h> #include <stdint.h> #define PARSE_DELIMITER " \f\n\r\t\v"
app/test-pmd/bpf_cmd.c +2 -0
@@ -2,7 +2,9 @@* Copyright(c) 2018 Intel Corporation */ +#include <ctype.h> #include <stdio.h> +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <rte_flow.h>
app/test-pmd/cmdline.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2014 6WIND S.A. */ +#include <ctype.h> #include <stdarg.h> #include <errno.h> #include <stdio.h>
app/test-pmd/cmdline_tm.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> +#include <cmdline_parse.h> #include <cmdline_parse_num.h> #include <cmdline_parse_string.h>
app/test-pmd/config.c +1 -0
@@ -3,6 +3,7 @@* Copyright 2013-2014 6WIND S.A. */ +#include <ctype.h> #include <stdarg.h> #include <errno.h> #include <stdio.h>
app/test/test.h +2 -0
@@ -5,7 +5,9 @@#ifndef _TEST_H_#define _TEST_H_ +#include <errno.h> #include <stddef.h> +#include <stdlib.h> #include <sys/queue.h> #include <rte_hexdump.h>
drivers/bus/vdev/vdev_params.c +1 -0
@@ -2,6 +2,7 @@* Copyright 2018 Gaëtan Rivet */ +#include <errno.h> #include <string.h> #include <rte_dev.h>
drivers/common/cnxk/cnxk_telemetry_nix.c +1 -0
@@ -2,6 +2,7 @@* Copyright(C) 2021 Marvell. */ +#include <ctype.h> #include "cnxk_telemetry.h" #include "roc_api.h" #include "roc_priv.h"
drivers/common/cnxk/cnxk_telemetry_npa.c +1 -0
@@ -2,6 +2,7 @@* Copyright(C) 2021 Marvell. */ +#include <ctype.h> #include "cnxk_telemetry.h" #include "roc_api.h" #include "roc_priv.h"
drivers/crypto/scheduler/scheduler_pmd.c +2 -0
@@ -1,6 +1,8 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> +#include <rte_common.h> #include <rte_hexdump.h> #include <rte_cryptodev.h>
drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c +2 -0
@@ -2,6 +2,8 @@* Copyright(C) 2022 Marvell. */ +#include <ctype.h> +#include <rte_telemetry.h> #include <roc_api.h>
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2017 Intel Corporation */ +#include <ctype.h> #include <stdio.h> #include <errno.h> #include <stdint.h>
drivers/net/iavf/iavf_ethdev.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> #include <sys/queue.h> #include <stdio.h> #include <errno.h>
drivers/net/ice/ice_ethdev.c +1 -0
@@ -5,6 +5,7 @@#include <rte_string_fns.h> #include <ethdev_pci.h> +#include <ctype.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h>
drivers/net/softnic/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __INCLUDE_SOFTNIC_PARSER_H__#define __INCLUDE_SOFTNIC_PARSER_H__ +#include <ctype.h> #include <stdint.h> #include <rte_ip.h>
examples/eventdev_pipeline/main.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2016-2017 Intel Corporation */ +#include <ctype.h> #include <getopt.h> #include <stdint.h> #include <stdio.h>
examples/fips_validation/fips_validation.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2018 Intel Corporation */ +#include <ctype.h> #include <stdio.h> #include <string.h>
examples/ip_pipeline/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __INCLUDE_PARSER_H__#define __INCLUDE_PARSER_H__ +#include <ctype.h> #include <stdint.h> #include <rte_ip.h>
examples/ipsec-secgw/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __PARSER_H#define __PARSER_H +#include <ctype.h> #include <sys/types.h> #include <netinet/in.h> #include <netinet/ip.h>
examples/l3fwd-power/perf_core.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2018 Intel Corporation */ +#include <ctype.h> #include <stdio.h> #include <string.h>
examples/pipeline/cli.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2020 Intel Corporation */ +#include <ctype.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h>
examples/vhost/main.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2017 Intel Corporation */ +#include <ctype.h> #include <arpa/inet.h> #include <getopt.h> #include <linux/if_ether.h>
lib/dmadev/rte_dmadev.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2021 Intel Corporation */ +#include <ctype.h> #include <inttypes.h> #include <rte_eal.h>
lib/eal/common/eal_common_debug.c +2 -0
@@ -3,6 +3,8 @@*/ #include <stdarg.h> +#include <stdlib.h> +#include <rte_eal.h> #include <rte_log.h> #include <rte_debug.h>
lib/eal/common/eal_common_string_fns.c +3 -1
@@ -2,8 +2,10 @@* Copyright(c) 2010-2014 Intel Corporation */ -#include <stdio.h> +#include <ctype.h> #include <errno.h> +#include <stdio.h> +#include <stdlib.h> #include <rte_string_fns.h> #include <rte_errno.h>
lib/eal/freebsd/eal.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2014 6WIND S.A. */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h>
lib/eal/include/generic/rte_rwlock.h +2 -0
@@ -21,6 +21,8 @@extern "C" {#endif +#include <errno.h> +#include <rte_common.h> #include <rte_atomic.h> #include <rte_pause.h>
lib/eal/include/rte_common.h +0 -3
@@ -17,9 +17,6 @@ extern "C" {#endif #include <stdint.h> -#include <stdlib.h> -#include <ctype.h> -#include <errno.h> #include <limits.h> #include <rte_config.h>
lib/eal/linux/eal.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2012-2014 6WIND S.A. */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h>
lib/eal/linux/eal_vfio_mp_sync.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2018 Intel Corporation */ +#include <errno.h> #include <unistd.h> #include <string.h>
lib/eal/unix/eal_unix_timer.c +1 -0
@@ -2,6 +2,7 @@* Copyright 2020 Mellanox Technologies, Ltd */ +#include <errno.h> #include <time.h> #include <rte_cycles.h>
lib/eal/windows/rte_thread.c +2 -0
@@ -3,6 +3,8 @@* Copyright (C) 2022 Microsoft Corporation */ +#include <errno.h> +#include <rte_common.h> #include <rte_errno.h> #include <rte_thread.h>
lib/ethdev/sff_telemetry.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2022 Intel Corporation */ +#include <ctype.h> #include <errno.h> #include "rte_ethdev.h"
lib/eventdev/rte_event_eth_rx_adapter.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation. * All rights reserved. */ +#include <ctype.h> #if defined(LINUX )#include <sys/epoll.h> #endif
lib/eventdev/rte_event_timer_adapter.c +1 -0
@@ -3,6 +3,7 @@* All rights reserved. */ +#include <ctype.h> #include <string.h> #include <inttypes.h> #include <stdbool.h>
lib/meter/rte_meter.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2014 Intel Corporation */ +#include <errno.h> #include <stdio.h> #include <math.h>
lib/pci/rte_pci.c +1 -0
@@ -3,6 +3,7 @@* Copyright 2013-2014 6WIND S.A. */ +#include <errno.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h>
lib/pipeline/rte_swx_ctl.c +1 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ +#include <errno.h> #include <stdlib.h> #include <string.h> #include <stdio.h>
lib/sched/rte_pie.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2020 Intel Corporation */ +#include <errno.h> #include <stdlib.h> #include <string.h>
lib/security/rte_security.c +2 -0
@@ -4,6 +4,8 @@* Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved */ +#include <ctype.h> +#include <rte_cryptodev.h> #include <rte_dev.h> #include <rte_telemetry.h>
lib/telemetry/telemetry.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2020 Intel Corporation */ +#include <errno.h> #ifndef RTE_EXEC_ENV_WINDOWS #include <unistd.h> #include <pthread.h>
lib/telemetry/telemetry_data.c +3 -0
@@ -2,6 +2,9 @@* Copyright(c) 2020 Intel Corporation */ +#include <errno.h> +#include <stdlib.h> +#undef RTE_USE_LIBBSD#include <rte_string_fns.h>
lib/telemetry/telemetry_legacy.c +2 -0
@@ -1,7 +1,9 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ +#include <ctype.h> +#include <errno.h> #ifndef RTE_EXEC_ENV_WINDOWS #include <unistd.h> #include <sys/socket.h>
Signature · 1 line
2.33.1
v4 cover eal: small rte_common.h fixes and cleanup
In reply to Dmitry Kozlyukv4: Fix build on ARM and RISC-V (CI).
v3: Fix build (CI).
v2:
* Extend and tidy up the macro unit test (Morten).
* Remove unneeded includes from rte_common.h (Morten, Bruce).
Dmitry Kozlyuk (4):
eal: fix pointer arithmetic with an expression argument
eal: deduplicate roundup code
eal: uninline rte_str_to_size
eal: remove unneeded includes from a public header
app/test-bbdev/main.c | 1 + app/test-bbdev/test_bbdev_perf.c | 1 + app/test-bbdev/test_bbdev_vector.c | 2 + .../comp_perf_test_cyclecount.c | 2 + .../comp_perf_test_throughput.c | 2 + .../comp_perf_test_verify.c | 2 + app/test-compress-perf/main.c | 1 + app/test-crypto-perf/cperf_options_parsing.c | 1 + .../cperf_test_pmd_cyclecount.c | 1 + app/test-crypto-perf/cperf_test_throughput.c | 2 + .../cperf_test_vector_parsing.c | 2 + app/test-crypto-perf/cperf_test_verify.c | 2 + app/test-crypto-perf/main.c | 1 + app/test-eventdev/evt_main.c | 1 + app/test-eventdev/evt_options.c | 1 + app/test-eventdev/parser.h | 1 + app/test-fib/main.c | 1 + app/test-flow-perf/actions_gen.c | 1 + app/test-pmd/bpf_cmd.c | 2 + app/test-pmd/cmdline.c | 1 + app/test-pmd/cmdline_tm.c | 2 + app/test-pmd/config.c | 1 + app/test-sad/main.c | 1 + app/test/test.h | 2 + app/test/test_common.c | 58 +++++++++++++------ drivers/baseband/la12xx/bbdev_la12xx.c | 1 + drivers/baseband/null/bbdev_null.c | 1 + .../baseband/turbo_sw/bbdev_turbo_software.c | 1 + drivers/bus/vdev/vdev_params.c | 1 + drivers/common/cnxk/cnxk_telemetry_nix.c | 1 + drivers/common/cnxk/cnxk_telemetry_npa.c | 1 + drivers/common/octeontx/octeontx_mbox.c | 1 + drivers/crypto/bcmfs/bcmfs_device.c | 1 + drivers/crypto/bcmfs/hw/bcmfs_rm_common.c | 2 + drivers/crypto/scheduler/scheduler_pmd.c | 3 + drivers/dma/skeleton/skeleton_dmadev.c | 1 + drivers/event/dsw/dsw_event.c | 1 + drivers/event/octeontx/ssovf_evdev.c | 1 + drivers/event/octeontx/ssovf_evdev_selftest.c | 2 + drivers/event/opdl/opdl_evdev.c | 1 + drivers/event/opdl/opdl_test.c | 1 + drivers/event/sw/sw_evdev.c | 1 + drivers/event/sw/sw_evdev_selftest.c | 1 + drivers/net/af_packet/rte_eth_af_packet.c | 1 + drivers/net/ark/ark_pktchkr.c | 1 + drivers/net/ark/ark_pktgen.c | 1 + drivers/net/atlantic/atl_hw_regs.h | 1 + drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 2 + drivers/net/failsafe/failsafe_intr.c | 1 + drivers/net/hns3/hns3_mp.c | 2 + drivers/net/i40e/base/i40e_adminq.h | 2 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_parent.c | 1 + drivers/net/ice/ice_ddp_package.c | 2 + drivers/net/ice/ice_ethdev.c | 1 + drivers/net/mlx4/mlx4_mp.c | 1 + drivers/net/null/rte_eth_null.c | 2 + drivers/net/octeontx/base/octeontx_bgx.c | 1 + drivers/net/octeontx/octeontx_ethdev.c | 1 + drivers/net/octeontx_ep/otx2_ep_vf.c | 2 + drivers/net/pcap/pcap_ethdev.c | 1 + drivers/net/ring/rte_eth_ring.c | 2 + drivers/net/softnic/parser.h | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/vhost/rte_eth_vhost.c | 1 + drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/virtio/virtio_user/vhost_kernel.c | 1 + drivers/net/virtio/virtio_user/vhost_user.c | 1 + drivers/net/virtio/virtio_user/vhost_vdpa.c | 1 + .../net/virtio/virtio_user/virtio_user_dev.c | 1 + drivers/net/virtio/virtio_user_ethdev.c | 1 + .../raw/ifpga/base/osdep_rte/osdep_generic.h | 2 + drivers/raw/skeleton/skeleton_rawdev.c | 1 + drivers/raw/skeleton/skeleton_rawdev_test.c | 2 + examples/distributor/main.c | 1 + examples/dma/dmafwd.c | 1 + examples/ethtool/ethtool-app/ethapp.c | 2 + examples/eventdev_pipeline/main.c | 2 + .../pipeline_worker_generic.c | 2 + .../eventdev_pipeline/pipeline_worker_tx.c | 2 + examples/fips_validation/fips_validation.c | 2 + .../fips_validation/fips_validation_gcm.c | 1 + examples/fips_validation/main.c | 1 + examples/ip_pipeline/main.c | 1 + examples/ip_pipeline/parser.h | 1 + examples/ipsec-secgw/event_helper.c | 2 + examples/ipsec-secgw/flow.c | 1 + examples/ipsec-secgw/parser.c | 1 + examples/ipsec-secgw/parser.h | 1 + examples/ipsec-secgw/rt.c | 1 + examples/ipsec-secgw/sa.c | 1 + examples/l3fwd-power/perf_core.c | 2 + .../client_server_mp/mp_server/init.c | 1 + examples/multi_process/simple_mp/main.c | 1 + examples/ntb/ntb_fwd.c | 1 + examples/packet_ordering/main.c | 1 + examples/pipeline/cli.c | 1 + examples/pipeline/main.c | 1 + examples/ptpclient/ptpclient.c | 1 + examples/qos_meter/main.c | 1 + examples/qos_sched/init.c | 1 + examples/rxtx_callbacks/main.c | 1 + examples/server_node_efd/server/init.c | 1 + examples/skeleton/basicfwd.c | 1 + examples/vdpa/main.c | 1 + examples/vhost/main.c | 2 + examples/vhost/virtio_net.c | 1 + examples/vhost_blk/vhost_blk.c | 1 + lib/bpf/bpf_jit_arm64.c | 1 + lib/bpf/bpf_validate.c | 1 + lib/compressdev/rte_compressdev_pmd.c | 2 + lib/cryptodev/cryptodev_pmd.c | 1 + lib/distributor/rte_distributor.c | 1 + lib/dmadev/rte_dmadev.c | 2 + lib/eal/arm/rte_power_intrinsics.c | 2 + lib/eal/common/eal_common_debug.c | 2 + lib/eal/common/eal_common_dev.c | 1 + lib/eal/common/eal_common_devargs.c | 1 + lib/eal/common/eal_common_dynmem.c | 1 + lib/eal/common/eal_common_lcore.c | 1 + lib/eal/common/eal_common_memalloc.c | 1 + lib/eal/common/eal_common_string_fns.c | 36 +++++++++++- lib/eal/common/eal_common_trace.c | 1 + lib/eal/common/eal_common_trace_ctf.c | 1 + lib/eal/common/hotplug_mp.c | 1 + lib/eal/common/malloc_mp.c | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/include/generic/rte_rwlock.h | 2 + lib/eal/include/rte_common.h | 41 ++----------- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 1 + lib/eal/linux/eal_dev.c | 1 + lib/eal/linux/eal_vfio_mp_sync.c | 1 + lib/eal/ppc/rte_power_intrinsics.c | 2 + lib/eal/riscv/rte_power_intrinsics.c | 2 + lib/eal/unix/eal_unix_timer.c | 1 + lib/eal/version.map | 1 + lib/eal/windows/rte_thread.c | 2 + lib/efd/rte_efd.c | 2 + lib/ethdev/ethdev_driver.c | 2 + lib/ethdev/rte_class_eth.c | 1 + lib/ethdev/sff_telemetry.c | 2 + lib/eventdev/rte_event_eth_rx_adapter.c | 2 + lib/eventdev/rte_event_timer_adapter.c | 2 + lib/gpudev/gpudev.c | 2 + lib/graph/graph.c | 1 + lib/graph/graph_ops.c | 1 + lib/graph/graph_stats.c | 1 + lib/graph/node.c | 1 + lib/ipsec/ipsec_telemetry.c | 1 + lib/meter/rte_meter.c | 1 + lib/metrics/rte_metrics.c | 1 + lib/node/ethdev_ctrl.c | 2 + lib/pci/rte_pci.c | 1 + lib/pdump/rte_pdump.c | 2 + lib/pipeline/rte_swx_ctl.c | 1 + lib/port/rte_swx_port_fd.c | 1 + lib/port/rte_swx_port_ring.c | 1 + lib/power/power_cppc_cpufreq.c | 2 + lib/power/rte_power.c | 2 + lib/power/rte_power_pmd_mgmt.c | 2 + lib/sched/rte_pie.c | 1 + lib/security/rte_security.c | 3 + lib/telemetry/telemetry.c | 2 + lib/telemetry/telemetry_data.c | 3 + lib/telemetry/telemetry_legacy.c | 3 +- lib/vhost/vhost.h | 1 + 168 files changed, 301 insertions(+), 56 deletions(-)
Signature · 1 line
2.33.1
PATCH v4 1/4 eal: fix pointer arithmetic with an expression argument
RTE_PTR_SUB(ptr, x) and RTE_PTR_ALIGN_FLOOR() worked incorrectly if "ptr" was an expression:
uint32_t arr[3];
RTE_PTR_SUB(arr + 1, sizeof(arr[0]));
// expected: (uint32_t *)((uintptr_t)(arr + 1) - 4) == arr
// actual: (uint32_t *)((uintptr_t) arr + 1 - 4) != arr
RTE_PTR_ALIGN_FLOOR(arr + 2, sizeof(arr[0]));
// expected: RTE_ALIGN_FLOOR((uintptr_t)(arr + 2), 4) == &arr[2]
// actual: RTE_ALIGN_FLOOR((uintptr_t) arr + 2, 4) == &arr[0]Fix the macros and extend the relevant unit test. Convert uses of a custom test failure macro to RTE_TEST_ASSERT*().
--- app/test/test_common.c | 58 +++++++++++++++++++++++++----------- lib/eal/include/rte_common.h | 4 +-- 2 files changed, 42 insertions(+), 20 deletions(-)
app/test/test_common.c +40 -18
@@ -25,31 +25,53 @@ test_macros(int __rte_unused unused_parm)#define SMALLER 0x1000U#define BIGGER 0x2000U#define PTR_DIFF BIGGER - SMALLER -#define FAIL_MACRO (x)\ - {printf(#x "() test failed!\n");\ - return -1;}uintptr_t unused =0 ;unsigned int smaller =SMALLER , bigger =BIGGER ; +uint32_t arr[3 ];RTE_SET_USED (unused);RTE_SWAP (smaller, bigger); -if (smaller !=BIGGER && bigger !=SMALLER ) -FAIL_MACRO (RTE_SWAP ); -if ((uintptr_t )RTE_PTR_ADD (SMALLER ,PTR_DIFF ) !=BIGGER ) -FAIL_MACRO (RTE_PTR_ADD ); -if ((uintptr_t )RTE_PTR_SUB (BIGGER ,PTR_DIFF ) !=SMALLER ) -FAIL_MACRO (RTE_PTR_SUB ); -if (RTE_PTR_DIFF (BIGGER ,SMALLER ) !=PTR_DIFF ) -FAIL_MACRO (RTE_PTR_DIFF ); -if (RTE_MAX (SMALLER ,BIGGER ) !=BIGGER ) -FAIL_MACRO (RTE_MAX ); -if (RTE_MIN (SMALLER ,BIGGER ) !=SMALLER ) -FAIL_MACRO (RTE_MIN ); - -if (strncmp (RTE_STR (test),"test" ,sizeof ("test" ))) -FAIL_MACRO (RTE_STR ); +RTE_TEST_ASSERT (smaller ==BIGGER && bigger ==SMALLER , +"RTE_SWAP" ); +RTE_TEST_ASSERT_EQUAL ((uintptr_t )RTE_PTR_ADD (SMALLER ,PTR_DIFF ),BIGGER , +"RTE_PTR_ADD" ); +RTE_TEST_ASSERT_EQUAL ((uintptr_t )RTE_PTR_SUB (BIGGER ,PTR_DIFF ),SMALLER , +"RTE_PTR_SUB" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_DIFF (BIGGER ,SMALLER ),PTR_DIFF , +"RTE_PTR_DIFF" ); +RTE_TEST_ASSERT_EQUAL (RTE_MAX (SMALLER ,BIGGER ),BIGGER , +"RTE_MAX" ); +RTE_TEST_ASSERT_EQUAL (RTE_MIN (SMALLER ,BIGGER ),SMALLER , +"RTE_MIN" ); + +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ADD (arr +1 ,sizeof (arr[0 ])), &arr[2 ], +"RTE_PTR_ADD(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_SUB (arr +1 ,sizeof (arr[0 ])), &arr[0 ], +"RTE_PTR_SUB(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN_FLOOR (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN_FLOOR(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN_CEIL (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(expr, x)" ); +RTE_TEST_ASSERT_EQUAL (RTE_PTR_ALIGN (arr +2 ,4 ), &arr[2 ], +"RTE_PTR_ALIGN(expr, x)" ); + +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_FLOOR (RTE_PTR_ADD (&arr[1 ],1 ),4 ), &arr[1 ], +"RTE_PTR_ALIGN_FLOOR(x < y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_FLOOR (RTE_PTR_ADD (&arr[1 ],3 ),4 ), &arr[1 ], +"RTE_PTR_ALIGN_FLOOR(x > y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_CEIL (RTE_PTR_ADD (&arr[1 ],3 ),4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(x < y/2, y)" ); +RTE_TEST_ASSERT_EQUAL ( +RTE_PTR_ALIGN_CEIL (RTE_PTR_ADD (&arr[1 ],1 ),4 ), &arr[2 ], +"RTE_PTR_ALIGN_CEIL(x > y/2, y)" ); + +RTE_TEST_ASSERT (strncmp (RTE_STR (test),"test" ,sizeof ("test" )) ==0 , +"RTE_STR" );return 0 ; }
lib/eal/include/rte_common.h +2 -2
@@ -295,7 +295,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)/** * subtract a byte-value offset from a pointer */ -#define RTE_PTR_SUB (ptr, x) ((void*)((uintptr_t)ptr - (x))) +#define RTE_PTR_SUB (ptr, x) ((void *)((uintptr_t)(ptr) - (x)))/** * get the difference between two pointer values, i.e. how far apart
@@ -320,7 +320,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)* must be a power-of-two value. */ #define RTE_PTR_ALIGN_FLOOR (ptr, align) \ - ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)ptr, align)) + ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)(ptr), align))/** * Macro to align a value to a given power-of-two. The resultant value
Signature · 1 line
2.33.1
PATCH v4 2/4 eal: deduplicate roundup code
In reply to Dmitry KozlyukRTE_CACHE_LINE_ROUNDUP() implementation repeated RTE_ALIGN_MUL_CEIL(). In other places RTE_CACHE_LINE_SIZE is assumed to be a power-of-2, so define RTE_CACHE_LINE_ROUNDUP() using RTE_ALIGN_CEIL().
--- lib/eal/include/rte_common.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
lib/eal/include/rte_common.h +1 -3
@@ -425,9 +425,7 @@ rte_is_aligned(void *ptr, unsigned align)#define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1)/** Return the first cache-aligned value greater or equal to size. */ -#define RTE_CACHE_LINE_ROUNDUP (size) \ - (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / \ - RTE_CACHE_LINE_SIZE)) +#define RTE_CACHE_LINE_ROUNDUP (size) RTE_ALIGN_CEIL(size, RTE_CACHE_LINE_SIZE)/** Cache line size in terms of log2 */ #if RTE_CACHE_LINE_SIZE ==64
Signature · 1 line
2.33.1
PATCH v4 3/4 eal: uninline rte_str_to_size
In reply to Dmitry KozlyukThere is no reason for rte_str_to_size() to be inline. Move the implementation out of <rte_common.h>. Export it as a stable ABI because it always has been public.
--- lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++ lib/eal/include/rte_common.h | 30 ++---------------------- lib/eal/version.map | 1 + 3 files changed, 35 insertions(+), 28 deletions(-)
lib/eal/common/eal_common_string_fns.c +32 -0
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize) rte_errno =E2BIG ;return -rte_errno; } + +uint64_t +rte_str_to_size (const char *str) +{ +char *endptr; +unsigned long long size; + +while (isspace ((int )*str)) + str++; +if (*str =='-' ) +return 0 ; + + errno =0 ; + size =strtoull (str, &endptr,0 ); +if (errno) +return 0 ; + +if (*endptr ==' ' ) + endptr++;/* allow 1 space gap */ + +switch (*endptr) { +case 'G' :case 'g' : + size *=1024 ;/* fall-through */ +case 'M' :case 'm' : + size *=1024 ;/* fall-through */ +case 'K' :case 'k' : + size *=1024 ;/* fall-through */ +default : +break ; + } +return size; +}
lib/eal/include/rte_common.h +2 -28
@@ -873,34 +873,8 @@ rte_log2_u64(uint64_t v)* @return * Number. */ -static inline uint64_t -rte_str_to_size (const char *str) -{ -char *endptr; -unsigned long long size; - -while (isspace ((int )*str)) - str++; -if (*str =='-' ) -return 0 ; - - errno =0 ; - size =strtoull (str, &endptr,0 ); -if (errno) -return 0 ; - -if (*endptr ==' ' ) - endptr++;/* allow 1 space gap */ - -switch (*endptr){ -case 'G' :case 'g' : size *=1024 ;/* fall-through */ -case 'M' :case 'm' : size *=1024 ;/* fall-through */ -case 'K' :case 'k' : size *=1024 ;/* fall-through */ -default : -break ; - } -return size; -} +uint64_t +rte_str_to_size (const char *str);/** * Function to terminate the application immediately, printing an error
lib/eal/version.map +1 -0
@@ -261,6 +261,7 @@ DPDK_23 { rte_socket_id; rte_socket_id_by_idx; rte_srand; + rte_str_to_size; rte_strerror; rte_strscpy; rte_strsplit;
Signature · 1 line
2.33.1
PATCH v4 4/4 eal: remove unneeded includes from a public header
In reply to Dmitry KozlyukDo not include <ctype.h>, <errno.h>, and <stdlib.h> from <rte_common.h>, because they are not used by this file.
Include the needed headers directly from the files that need them.
--- app/test-bbdev/main.c | 1 + app/test-bbdev/test_bbdev_perf.c | 1 + app/test-bbdev/test_bbdev_vector.c | 2 ++ app/test-compress-perf/comp_perf_test_cyclecount.c | 2 ++ app/test-compress-perf/comp_perf_test_throughput.c | 2 ++ app/test-compress-perf/comp_perf_test_verify.c | 2 ++ app/test-compress-perf/main.c | 1 + app/test-crypto-perf/cperf_options_parsing.c | 1 + app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 1 + app/test-crypto-perf/cperf_test_throughput.c | 2 ++ app/test-crypto-perf/cperf_test_vector_parsing.c | 2 ++ app/test-crypto-perf/cperf_test_verify.c | 2 ++ app/test-crypto-perf/main.c | 1 + app/test-eventdev/evt_main.c | 1 + app/test-eventdev/evt_options.c | 1 + app/test-eventdev/parser.h | 1 + app/test-fib/main.c | 1 + app/test-flow-perf/actions_gen.c | 1 + app/test-pmd/bpf_cmd.c | 2 ++ app/test-pmd/cmdline.c | 1 + app/test-pmd/cmdline_tm.c | 2 ++ app/test-pmd/config.c | 1 + app/test-sad/main.c | 1 + app/test/test.h | 2 ++ drivers/baseband/la12xx/bbdev_la12xx.c | 1 + drivers/baseband/null/bbdev_null.c | 1 + drivers/baseband/turbo_sw/bbdev_turbo_software.c | 1 + drivers/bus/vdev/vdev_params.c | 1 + drivers/common/cnxk/cnxk_telemetry_nix.c | 1 + drivers/common/cnxk/cnxk_telemetry_npa.c | 1 + drivers/common/octeontx/octeontx_mbox.c | 1 + drivers/crypto/bcmfs/bcmfs_device.c | 1 + drivers/crypto/bcmfs/hw/bcmfs_rm_common.c | 2 ++ drivers/crypto/scheduler/scheduler_pmd.c | 3 +++ drivers/dma/skeleton/skeleton_dmadev.c | 1 + drivers/event/dsw/dsw_event.c | 1 + drivers/event/octeontx/ssovf_evdev.c | 1 + drivers/event/octeontx/ssovf_evdev_selftest.c | 2 ++ drivers/event/opdl/opdl_evdev.c | 1 + drivers/event/opdl/opdl_test.c | 1 + drivers/event/sw/sw_evdev.c | 1 + drivers/event/sw/sw_evdev_selftest.c | 1 + drivers/net/af_packet/rte_eth_af_packet.c | 1 + drivers/net/ark/ark_pktchkr.c | 1 + drivers/net/ark/ark_pktgen.c | 1 + drivers/net/atlantic/atl_hw_regs.h | 1 + drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 2 ++ drivers/net/failsafe/failsafe_intr.c | 1 + drivers/net/hns3/hns3_mp.c | 2 ++ drivers/net/i40e/base/i40e_adminq.h | 2 ++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/iavf/iavf_ethdev.c | 1 + drivers/net/ice/ice_dcf_parent.c | 1 + drivers/net/ice/ice_ddp_package.c | 2 ++ drivers/net/ice/ice_ethdev.c | 1 + drivers/net/mlx4/mlx4_mp.c | 1 + drivers/net/null/rte_eth_null.c | 2 ++ drivers/net/octeontx/base/octeontx_bgx.c | 1 + drivers/net/octeontx/octeontx_ethdev.c | 1 + drivers/net/octeontx_ep/otx2_ep_vf.c | 2 ++ drivers/net/pcap/pcap_ethdev.c | 1 + drivers/net/ring/rte_eth_ring.c | 2 ++ drivers/net/softnic/parser.h | 1 + drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/vhost/rte_eth_vhost.c | 1 + drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/virtio/virtio_user/vhost_kernel.c | 1 + drivers/net/virtio/virtio_user/vhost_user.c | 1 + drivers/net/virtio/virtio_user/vhost_vdpa.c | 1 + drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 + drivers/net/virtio/virtio_user_ethdev.c | 1 + drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 2 ++ drivers/raw/skeleton/skeleton_rawdev.c | 1 + drivers/raw/skeleton/skeleton_rawdev_test.c | 2 ++ examples/distributor/main.c | 1 + examples/dma/dmafwd.c | 1 + examples/ethtool/ethtool-app/ethapp.c | 2 ++ examples/eventdev_pipeline/main.c | 2 ++ examples/eventdev_pipeline/pipeline_worker_generic.c | 2 ++ examples/eventdev_pipeline/pipeline_worker_tx.c | 2 ++ examples/fips_validation/fips_validation.c | 2 ++ examples/fips_validation/fips_validation_gcm.c | 1 + examples/fips_validation/main.c | 1 + examples/ip_pipeline/main.c | 1 + examples/ip_pipeline/parser.h | 1 + examples/ipsec-secgw/event_helper.c | 2 ++ examples/ipsec-secgw/flow.c | 1 + examples/ipsec-secgw/parser.c | 1 + examples/ipsec-secgw/parser.h | 1 + examples/ipsec-secgw/rt.c | 1 + examples/ipsec-secgw/sa.c | 1 + examples/l3fwd-power/perf_core.c | 2 ++ examples/multi_process/client_server_mp/mp_server/init.c | 1 + examples/multi_process/simple_mp/main.c | 1 + examples/ntb/ntb_fwd.c | 1 + examples/packet_ordering/main.c | 1 + examples/pipeline/cli.c | 1 + examples/pipeline/main.c | 1 + examples/ptpclient/ptpclient.c | 1 + examples/qos_meter/main.c | 1 + examples/qos_sched/init.c | 1 + examples/rxtx_callbacks/main.c | 1 + examples/server_node_efd/server/init.c | 1 + examples/skeleton/basicfwd.c | 1 + examples/vdpa/main.c | 1 + examples/vhost/main.c | 2 ++ examples/vhost/virtio_net.c | 1 + examples/vhost_blk/vhost_blk.c | 1 + lib/bpf/bpf_jit_arm64.c | 1 + lib/bpf/bpf_validate.c | 1 + lib/compressdev/rte_compressdev_pmd.c | 2 ++ lib/cryptodev/cryptodev_pmd.c | 1 + lib/distributor/rte_distributor.c | 1 + lib/dmadev/rte_dmadev.c | 2 ++ lib/eal/arm/rte_power_intrinsics.c | 2 ++ lib/eal/common/eal_common_debug.c | 2 ++ lib/eal/common/eal_common_dev.c | 1 + lib/eal/common/eal_common_devargs.c | 1 + lib/eal/common/eal_common_dynmem.c | 1 + lib/eal/common/eal_common_lcore.c | 1 + lib/eal/common/eal_common_memalloc.c | 1 + lib/eal/common/eal_common_string_fns.c | 4 +++- lib/eal/common/eal_common_trace.c | 1 + lib/eal/common/eal_common_trace_ctf.c | 1 + lib/eal/common/hotplug_mp.c | 1 + lib/eal/common/malloc_mp.c | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/include/generic/rte_rwlock.h | 2 ++ lib/eal/include/rte_common.h | 3 --- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 1 + lib/eal/linux/eal_dev.c | 1 + lib/eal/linux/eal_vfio_mp_sync.c | 1 + lib/eal/ppc/rte_power_intrinsics.c | 2 ++ lib/eal/riscv/rte_power_intrinsics.c | 2 ++ lib/eal/unix/eal_unix_timer.c | 1 + lib/eal/windows/rte_thread.c | 2 ++ lib/efd/rte_efd.c | 2 ++ lib/ethdev/ethdev_driver.c | 2 ++ lib/ethdev/rte_class_eth.c | 1 + lib/ethdev/sff_telemetry.c | 2 ++ lib/eventdev/rte_event_eth_rx_adapter.c | 2 ++ lib/eventdev/rte_event_timer_adapter.c | 2 ++ lib/gpudev/gpudev.c | 2 ++ lib/graph/graph.c | 1 + lib/graph/graph_ops.c | 1 + lib/graph/graph_stats.c | 1 + lib/graph/node.c | 1 + lib/ipsec/ipsec_telemetry.c | 1 + lib/meter/rte_meter.c | 1 + lib/metrics/rte_metrics.c | 1 + lib/node/ethdev_ctrl.c | 2 ++ lib/pci/rte_pci.c | 1 + lib/pdump/rte_pdump.c | 2 ++ lib/pipeline/rte_swx_ctl.c | 1 + lib/port/rte_swx_port_fd.c | 1 + lib/port/rte_swx_port_ring.c | 1 + lib/power/power_cppc_cpufreq.c | 2 ++ lib/power/rte_power.c | 2 ++ lib/power/rte_power_pmd_mgmt.c | 2 ++ lib/sched/rte_pie.c | 1 + lib/security/rte_security.c | 3 +++ lib/telemetry/telemetry.c | 2 ++ lib/telemetry/telemetry_data.c | 3 +++ lib/telemetry/telemetry_legacy.c | 3 ++- lib/vhost/vhost.h | 1 + 166 files changed, 223 insertions(+), 5 deletions(-)
app/test-bbdev/main.c +1 -0
@@ -7,6 +7,7 @@#include <stdio.h> #include <string.h> #include <stdbool.h> +#include <stdlib.h> #include <rte_eal.h> #include <rte_common.h>
app/test-bbdev/test_bbdev_perf.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <inttypes.h> #include <math.h>
app/test-bbdev/test_bbdev_vector.c +2 -0
@@ -5,7 +5,9 @@#ifdef RTE_EXEC_ENV_FREEBSD #define _WITH_GETLINE#endif +#include <ctype.h> #include <stdio.h> +#include <stdlib.h> #include <stdbool.h> #include <rte_malloc.h>
app/test-compress-perf/comp_perf_test_cyclecount.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2019 Intel Corporation */ +#include <stdlib.h> +#include <rte_malloc.h> #include <rte_eal.h> #include <rte_log.h>
app/test-compress-perf/comp_perf_test_throughput.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2018 Intel Corporation */ +#include <stdlib.h> +#include <rte_malloc.h> #include <rte_eal.h> #include <rte_log.h>
app/test-compress-perf/comp_perf_test_verify.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2018 Intel Corporation */ +#include <stdlib.h> +#include <rte_malloc.h> #include <rte_eal.h> #include <rte_log.h>
app/test-compress-perf/main.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2018 Intel Corporation */ +#include <stdlib.h> #include <signal.h> #include <sys/types.h> #include <unistd.h>
app/test-crypto-perf/cperf_options_parsing.c +1 -0
@@ -3,6 +3,7 @@*/ #include <getopt.h> +#include <stdlib.h> #include <unistd.h> #include <rte_cryptodev.h>
app/test-crypto-perf/cperf_test_pmd_cyclecount.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdbool.h> +#include <stdlib.h> #include <rte_crypto.h> #include <rte_cryptodev.h>
app/test-crypto-perf/cperf_test_throughput.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2016-2017 Intel Corporation */ +#include <stdlib.h> +#include <rte_malloc.h> #include <rte_cycles.h> #include <rte_crypto.h>
app/test-crypto-perf/cperf_test_vector_parsing.c +2 -0
@@ -4,7 +4,9 @@#ifdef RTE_EXEC_ENV_FREEBSD #define _WITH_GETLINE#endif +#include <ctype.h> #include <stdio.h> +#include <stdlib.h> #include <rte_malloc.h>
app/test-crypto-perf/cperf_test_verify.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2016-2017 Intel Corporation */ +#include <stdlib.h> +#include <rte_malloc.h> #include <rte_cycles.h> #include <rte_crypto.h>
app/test-crypto-perf/main.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <rte_malloc.h>
app/test-eventdev/evt_main.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <signal.h>
app/test-eventdev/evt_options.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <inttypes.h> #include <getopt.h>
app/test-eventdev/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __INCLUDE_PARSER_H__#define __INCLUDE_PARSER_H__ +#include <ctype.h> #include <stdint.h> #define PARSE_DELIMITER " \f\n\r\t\v"
app/test-fib/main.c +1 -0
@@ -3,6 +3,7 @@*/ #include <getopt.h> +#include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <sys/socket.h>
app/test-flow-perf/actions_gen.c +1 -0
@@ -6,6 +6,7 @@* and initializing it with needed data. */ +#include <stdlib.h> #include <sys/types.h> #include <rte_malloc.h> #include <rte_flow.h>
app/test-pmd/bpf_cmd.c +2 -0
@@ -2,7 +2,9 @@* Copyright(c) 2018 Intel Corporation */ +#include <ctype.h> #include <stdio.h> +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <rte_flow.h>
app/test-pmd/cmdline.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2014 6WIND S.A. */ +#include <ctype.h> #include <stdarg.h> #include <errno.h> #include <stdio.h>
app/test-pmd/cmdline_tm.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> +#include <cmdline_parse.h> #include <cmdline_parse_num.h> #include <cmdline_parse_string.h>
app/test-pmd/config.c +1 -0
@@ -3,6 +3,7 @@* Copyright 2013-2014 6WIND S.A. */ +#include <ctype.h> #include <stdarg.h> #include <errno.h> #include <stdio.h>
app/test-sad/main.c +1 -0
@@ -7,6 +7,7 @@#include <getopt.h> #include <string.h> #include <stdio.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h>
app/test/test.h +2 -0
@@ -5,7 +5,9 @@#ifndef _TEST_H_#define _TEST_H_ +#include <errno.h> #include <stddef.h> +#include <stdlib.h> #include <sys/queue.h> #include <rte_hexdump.h>
drivers/baseband/la12xx/bbdev_la12xx.c +1 -0
@@ -2,6 +2,7 @@* Copyright 2020-2021 NXP */ +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h>
drivers/baseband/null/bbdev_null.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation */ +#include <stdlib.h> #include <string.h> #include <rte_common.h>
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation */ +#include <stdlib.h> #include <string.h> #include <rte_common.h>
drivers/bus/vdev/vdev_params.c +1 -0
@@ -2,6 +2,7 @@* Copyright 2018 Gaëtan Rivet */ +#include <errno.h> #include <string.h> #include <rte_dev.h>
drivers/common/cnxk/cnxk_telemetry_nix.c +1 -0
@@ -2,6 +2,7 @@* Copyright(C) 2021 Marvell. */ +#include <ctype.h> #include "cnxk_telemetry.h" #include "roc_api.h" #include "roc_priv.h"
drivers/common/cnxk/cnxk_telemetry_npa.c +1 -0
@@ -2,6 +2,7 @@* Copyright(C) 2021 Marvell. */ +#include <ctype.h> #include "cnxk_telemetry.h" #include "roc_api.h" #include "roc_priv.h"
drivers/common/octeontx/octeontx_mbox.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Cavium, Inc */ +#include <errno.h> #include <string.h> #include <rte_atomic.h>
drivers/crypto/bcmfs/bcmfs_device.c +1 -0
@@ -5,6 +5,7 @@#include <dirent.h> #include <stdbool.h> +#include <stdlib.h> #include <sys/queue.h> #include <rte_malloc.h>
drivers/crypto/bcmfs/hw/bcmfs_rm_common.c +2 -0
@@ -3,6 +3,8 @@* All rights reserved. */ +#include <errno.h> +#include "bcmfs_hw_defs.h" #include "bcmfs_rm_common.h"
drivers/crypto/scheduler/scheduler_pmd.c +3 -0
@@ -1,6 +1,9 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> +#include <stdlib.h> +#include <rte_common.h> #include <rte_hexdump.h> #include <rte_cryptodev.h>
drivers/dma/skeleton/skeleton_dmadev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <inttypes.h> +#include <stdlib.h> #include <rte_bus_vdev.h> #include <rte_cycles.h>
drivers/event/dsw/dsw_event.c +1 -0
@@ -9,6 +9,7 @@#endif #include <stdbool.h> +#include <stdlib.h> #include <string.h> #include <rte_cycles.h>
drivers/event/octeontx/ssovf_evdev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <inttypes.h> +#include <stdlib.h> #include <rte_common.h> #include <cryptodev_pmd.h>
drivers/event/octeontx/ssovf_evdev_selftest.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2017 Cavium, Inc */ +#include <stdlib.h> +#include <rte_atomic.h> #include <rte_common.h> #include <rte_cycles.h>
drivers/event/opdl/opdl_evdev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <inttypes.h> +#include <stdlib.h> #include <string.h> #include <rte_bus_vdev.h>
drivers/event/opdl/opdl_test.c +1 -0
@@ -5,6 +5,7 @@#include <stdio.h> #include <string.h> #include <stdint.h> +#include <stdlib.h> #include <errno.h> #include <unistd.h> #include <sys/queue.h>
drivers/event/sw/sw_evdev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <inttypes.h> +#include <stdlib.h> #include <string.h> #include <rte_bus_vdev.h>
drivers/event/sw/sw_evdev_selftest.c +1 -0
@@ -5,6 +5,7 @@#include <stdio.h> #include <string.h> #include <stdint.h> +#include <stdlib.h> #include <errno.h> #include <unistd.h> #include <sys/queue.h>
drivers/net/af_packet/rte_eth_af_packet.c +1 -0
@@ -23,6 +23,7 @@#include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> +#include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <unistd.h>
drivers/net/ark/ark_pktchkr.c +1 -0
@@ -2,6 +2,7 @@* Copyright (c) 2015-2018 Atomic Rules LLC */ +#include <stdlib.h> #include <unistd.h> #include <rte_string_fns.h>
drivers/net/ark/ark_pktgen.c +1 -0
@@ -2,6 +2,7 @@* Copyright (c) 2015-2018 Atomic Rules LLC */ +#include <stdlib.h> #include <unistd.h> #include <pthread.h>
drivers/net/atlantic/atl_hw_regs.h +1 -0
@@ -8,6 +8,7 @@#ifndef AQ_HW_UTILS_H #define AQ_HW_UTILS_H +#include <errno.h> #include <rte_common.h> #include <rte_io.h> #include <rte_byteorder.h>
drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c +2 -0
@@ -2,6 +2,8 @@* Copyright(C) 2022 Marvell. */ +#include <ctype.h> +#include <rte_telemetry.h> #include <roc_api.h>
drivers/net/failsafe/failsafe_intr.c +1 -0
@@ -10,6 +10,7 @@#if defined(LINUX )#include <sys/epoll.h> #endif +#include <stdlib.h> #include <unistd.h> #include <rte_alarm.h>
drivers/net/hns3/hns3_mp.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2018-2021 HiSilicon Limited. */ +#include <stdlib.h> +#include <rte_eal.h> #include <ethdev_driver.h> #include <rte_string_fns.h>
drivers/net/i40e/base/i40e_adminq.h +2 -0
@@ -5,6 +5,8 @@#ifndef _I40E_ADMINQ_H_#define _I40E_ADMINQ_H_ +#include <errno.h> +#include "i40e_osdep.h" #include "i40e_status.h" #include "i40e_adminq_cmd.h"
drivers/net/i40e/i40e_ethdev.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2017 Intel Corporation */ +#include <ctype.h> #include <stdio.h> #include <errno.h> #include <stdint.h>
drivers/net/iavf/iavf_ethdev.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation */ +#include <ctype.h> #include <sys/queue.h> #include <stdio.h> #include <errno.h>
drivers/net/ice/ice_dcf_parent.c +1 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ +#include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <pthread.h>
drivers/net/ice/ice_ddp_package.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2022 Intel Corporation */ +#include <stdlib.h> +#include <rte_string_fns.h> #include <rte_malloc.h> #include <rte_tailq.h>
drivers/net/ice/ice_ethdev.c +1 -0
@@ -5,6 +5,7 @@#include <rte_string_fns.h> #include <ethdev_pci.h> +#include <ctype.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h>
drivers/net/mlx4/mlx4_mp.c +1 -0
@@ -4,6 +4,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <time.h> #include <rte_eal.h>
drivers/net/null/rte_eth_null.c +2 -0
@@ -3,6 +3,8 @@* All rights reserved. */ +#include <stdlib.h> +#include <rte_mbuf.h> #include <ethdev_driver.h> #include <ethdev_vdev.h>
drivers/net/octeontx/base/octeontx_bgx.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Cavium, Inc */ +#include <errno.h> #include <string.h> #include "octeontx_bgx.h"
drivers/net/octeontx/octeontx_ethdev.c +1 -0
@@ -6,6 +6,7 @@#include <stdarg.h> #include <stdbool.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> #include <unistd.h>
drivers/net/octeontx_ep/otx2_ep_vf.c +2 -0
@@ -2,6 +2,8 @@* Copyright(C) 2021 Marvell. */ +#include <errno.h> +#include <rte_common.h> #include <rte_cycles.h> #include "otx_ep_common.h"
drivers/net/pcap/pcap_ethdev.c +1 -0
@@ -4,6 +4,7 @@* All rights reserved. */ +#include <stdlib.h> #include <time.h> #include <pcap.h>
drivers/net/ring/rte_eth_ring.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2015 Intel Corporation */ +#include <stdlib.h> +#include "rte_eth_ring.h" #include <rte_mbuf.h> #include <ethdev_driver.h>
drivers/net/softnic/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __INCLUDE_SOFTNIC_PARSER_H__#define __INCLUDE_SOFTNIC_PARSER_H__ +#include <ctype.h> #include <stdint.h> #include <rte_ip.h>
drivers/net/tap/rte_eth_tap.c +1 -0
@@ -30,6 +30,7 @@#include <signal.h> #include <stdbool.h> #include <stdint.h> +#include <stdlib.h> #include <sys/uio.h> #include <unistd.h> #include <arpa/inet.h>
drivers/net/vhost/rte_eth_vhost.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2016 IGEL Co., Ltd. * Copyright(c) 2016-2018 Intel Corporation */ +#include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <stdbool.h>
drivers/net/virtio/virtio_ethdev.c +1 -0
@@ -5,6 +5,7 @@#include <stdint.h> #include <string.h> #include <stdio.h> +#include <stdlib.h> #include <errno.h> #include <unistd.h>
drivers/net/virtio/virtio_user/vhost_kernel.c +1 -0
@@ -7,6 +7,7 @@#include <fcntl.h> #include <unistd.h> #include <errno.h> +#include <stdlib.h> #include <rte_memory.h>
drivers/net/virtio/virtio_user/vhost_user.c +1 -0
@@ -8,6 +8,7 @@#include <unistd.h> #include <fcntl.h> #include <sys/un.h> +#include <stdlib.h> #include <string.h> #include <errno.h>
drivers/net/virtio/virtio_user/vhost_vdpa.c +1 -0
@@ -6,6 +6,7 @@#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <stdlib.h> #include <unistd.h> #include <rte_memory.h>
drivers/net/virtio/virtio_user/virtio_user_dev.c +1 -0
@@ -4,6 +4,7 @@#include <stdint.h> #include <stdio.h> +#include <stdlib.h> #include <fcntl.h> #include <string.h> #include <errno.h>
drivers/net/virtio/virtio_user_ethdev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdint.h> +#include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <fcntl.h>
drivers/raw/ifpga/base/osdep_rte/osdep_generic.h +2 -0
@@ -5,6 +5,8 @@#ifndef _OSDEP_RTE_GENERIC_H#define _OSDEP_RTE_GENERIC_H +#include <stdlib.h> +#include <rte_common.h> #include <rte_cycles.h> #include <rte_spinlock.h>
drivers/raw/skeleton/skeleton_rawdev.c +1 -0
@@ -5,6 +5,7 @@#include <assert.h> #include <stdio.h> #include <stdbool.h> +#include <stdlib.h> #include <errno.h> #include <stdint.h> #include <inttypes.h>
drivers/raw/skeleton/skeleton_rawdev_test.c +2 -0
@@ -2,6 +2,8 @@* Copyright 2017 NXP */ +#include <stdlib.h> +#include <rte_common.h> #include <rte_mbuf.h> #include <rte_malloc.h>
examples/distributor/main.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdint.h> +#include <stdlib.h> #include <inttypes.h> #include <unistd.h> #include <signal.h>
examples/dma/dmafwd.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdint.h> +#include <stdlib.h> #include <getopt.h> #include <signal.h> #include <stdbool.h>
examples/ethtool/ethtool-app/ethapp.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2015 Intel Corporation */ +#include <stdlib.h> +#include <cmdline_parse.h> #include <cmdline_parse_num.h> #include <cmdline_parse_string.h>
examples/eventdev_pipeline/main.c +2 -0
@@ -2,9 +2,11 @@* Copyright(c) 2016-2017 Intel Corporation */ +#include <ctype.h> #include <getopt.h> #include <stdint.h> #include <stdio.h> +#include <stdlib.h> #include <signal.h> #include <sched.h>
examples/eventdev_pipeline/pipeline_worker_generic.c +2 -0
@@ -4,6 +4,8 @@* Copyright 2017 Cavium, Inc. */ +#include <stdlib.h> +#include "pipeline_common.h" static __rte_always_inline int
examples/eventdev_pipeline/pipeline_worker_tx.c +2 -0
@@ -4,6 +4,8 @@* Copyright 2017 Cavium, Inc. */ +#include <stdlib.h> +#include "pipeline_common.h" static __rte_always_inline void
examples/fips_validation/fips_validation.c +2 -0
@@ -2,7 +2,9 @@* Copyright(c) 2018 Intel Corporation */ +#include <ctype.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <rte_string_fns.h>
examples/fips_validation/fips_validation_gcm.c +1 -0
@@ -5,6 +5,7 @@#include <string.h> #include <time.h> #include <stdio.h> +#include <stdlib.h> #ifdef USE_JANSSON #include <jansson.h>
examples/fips_validation/main.c +1 -0
@@ -5,6 +5,7 @@#include <sys/stat.h> #include <getopt.h> #include <dirent.h> +#include <stdlib.h> #include <rte_cryptodev.h> #include <rte_malloc.h>
examples/ip_pipeline/main.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h>
examples/ip_pipeline/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __INCLUDE_PARSER_H__#define __INCLUDE_PARSER_H__ +#include <ctype.h> #include <stdint.h> #include <rte_ip.h>
examples/ipsec-secgw/event_helper.c +2 -0
@@ -1,6 +1,8 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C) 2020 Marvell International Ltd. */ +#include <stdlib.h> +#include <rte_bitmap.h> #include <rte_ethdev.h> #include <rte_eventdev.h>
examples/ipsec-secgw/flow.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <rte_common.h> #include <rte_flow.h>
examples/ipsec-secgw/parser.c +1 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2016 Intel Corporation */ +#include <stdlib.h> #include <arpa/inet.h> #include <sys/socket.h>
examples/ipsec-secgw/parser.h +1 -0
@@ -5,6 +5,7 @@#ifndef __PARSER_H#define __PARSER_H +#include <ctype.h> #include <sys/types.h> #include <netinet/in.h> #include <netinet/ip.h>
examples/ipsec-secgw/rt.c +1 -0
@@ -5,6 +5,7 @@/* * Routing Table (RT) */ +#include <stdlib.h> #include <sys/types.h> #include <rte_lpm.h> #include <rte_lpm6.h>
examples/ipsec-secgw/sa.c +1 -0
@@ -5,6 +5,7 @@/* * Security Associations */ +#include <stdlib.h> #include <sys/types.h> #include <netinet/in.h> #include <netinet/ip.h>
examples/l3fwd-power/perf_core.c +2 -0
@@ -2,7 +2,9 @@* Copyright(c) 2010-2018 Intel Corporation */ +#include <ctype.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <rte_common.h>
examples/multi_process/client_server_mp/mp_server/init.c +1 -0
@@ -4,6 +4,7 @@#include <stdint.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <sys/queue.h> #include <errno.h>
examples/multi_process/simple_mp/main.c +1 -0
@@ -16,6 +16,7 @@#include <stdio.h> #include <string.h> #include <stdint.h> +#include <stdlib.h> #include <inttypes.h> #include <stdarg.h> #include <errno.h>
examples/ntb/ntb_fwd.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdint.h> #include <stdio.h> +#include <stdlib.h> #include <inttypes.h> #include <unistd.h> #include <signal.h>
examples/packet_ordering/main.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2016 Intel Corporation */ +#include <stdlib.h> #include <signal.h> #include <getopt.h>
examples/pipeline/cli.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2020 Intel Corporation */ +#include <ctype.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h>
examples/pipeline/main.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h>
examples/ptpclient/ptpclient.c +1 -0
@@ -9,6 +9,7 @@*/ #include <stdint.h> +#include <stdlib.h> #include <inttypes.h> #include <rte_eal.h> #include <rte_ethdev.h>
examples/qos_meter/main.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <getopt.h> #include <rte_common.h>
examples/qos_sched/init.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdint.h> +#include <stdlib.h> #include <memory.h> #include <rte_log.h>
examples/rxtx_callbacks/main.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdint.h> +#include <stdlib.h> #include <inttypes.h> #include <getopt.h> #include <rte_eal.h>
examples/server_node_efd/server/init.c +1 -0
@@ -4,6 +4,7 @@#include <stdint.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <sys/queue.h> #include <errno.h>
examples/skeleton/basicfwd.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdint.h> +#include <stdlib.h> #include <inttypes.h> #include <rte_eal.h> #include <rte_ethdev.h>
examples/vdpa/main.c +1 -0
@@ -5,6 +5,7 @@#include <getopt.h> #include <signal.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> #include <unistd.h>
examples/vhost/main.c +2 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2017 Intel Corporation */ +#include <ctype.h> #include <arpa/inet.h> #include <getopt.h> #include <linux/if_ether.h>
@@ -10,6 +11,7 @@#include <linux/virtio_ring.h> #include <signal.h> #include <stdint.h> +#include <stdlib.h> #include <sys/eventfd.h> #include <sys/param.h> #include <unistd.h>
examples/vhost/virtio_net.c +1 -0
@@ -4,6 +4,7 @@#include <stdint.h> #include <stdbool.h> +#include <stdlib.h> #include <linux/virtio_net.h> #include <rte_mbuf.h>
examples/vhost_blk/vhost_blk.c +1 -0
@@ -9,6 +9,7 @@#include <sched.h> #include <stdint.h> +#include <stdlib.h> #include <unistd.h> #include <stdbool.h> #include <signal.h>
lib/bpf/bpf_jit_arm64.c +1 -0
@@ -4,6 +4,7 @@#include <errno.h> #include <stdbool.h> +#include <stdlib.h> #include <rte_common.h> #include <rte_byteorder.h>
lib/bpf/bpf_validate.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <errno.h> #include <stdint.h>
lib/compressdev/rte_compressdev_pmd.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2017-2018 Intel Corporation */ +#include <stdlib.h> +#include <rte_string_fns.h> #include <rte_malloc.h> #include <rte_kvargs.h>
lib/cryptodev/cryptodev_pmd.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation */ +#include <stdlib.h> #include <sys/queue.h> #include <rte_errno.h> #include <rte_string_fns.h>
lib/distributor/rte_distributor.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <sys/queue.h> #include <string.h> #include <rte_mbuf.h>
lib/dmadev/rte_dmadev.c +2 -0
@@ -3,7 +3,9 @@* Copyright(c) 2021 Intel Corporation */ +#include <ctype.h> #include <inttypes.h> +#include <stdlib.h> #include <rte_eal.h> #include <rte_lcore.h>
lib/eal/arm/rte_power_intrinsics.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2021 Intel Corporation */ +#include <errno.h> +#include "rte_power_intrinsics.h" /**
lib/eal/common/eal_common_debug.c +2 -0
@@ -3,6 +3,8 @@*/ #include <stdarg.h> +#include <stdlib.h> +#include <rte_eal.h> #include <rte_log.h> #include <rte_debug.h>
lib/eal/common/eal_common_dev.c +1 -0
@@ -4,6 +4,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <sys/queue.h>
lib/eal/common/eal_common_devargs.c +1 -0
@@ -7,6 +7,7 @@*/ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <stdarg.h>
lib/eal/common/eal_common_dynmem.c +1 -0
@@ -4,6 +4,7 @@*/ #include <inttypes.h> +#include <stdlib.h> #include <string.h> #include <rte_log.h>
lib/eal/common/eal_common_lcore.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2014 Intel Corporation */ +#include <stdlib.h> #include <string.h> #include <rte_common.h>
lib/eal/common/eal_common_memalloc.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017-2018 Intel Corporation */ +#include <stdlib.h> #include <string.h> #include <rte_errno.h>
lib/eal/common/eal_common_string_fns.c +3 -1
@@ -2,8 +2,10 @@* Copyright(c) 2010-2014 Intel Corporation */ -#include <stdio.h> +#include <ctype.h> #include <errno.h> +#include <stdio.h> +#include <stdlib.h> #include <rte_string_fns.h> #include <rte_errno.h>
lib/eal/common/eal_common_trace.c +1 -0
@@ -2,6 +2,7 @@* Copyright(C) 2020 Marvell International Ltd. */ +#include <stdlib.h> #include <fnmatch.h> #include <sys/queue.h> #include <regex.h>
lib/eal/common/eal_common_trace_ctf.c +1 -0
@@ -3,6 +3,7 @@*/ #include <inttypes.h> +#include <stdlib.h> #include <time.h> #include <rte_byteorder.h>
lib/eal/common/hotplug_mp.c +1 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2018 Intel Corporation */ +#include <stdlib.h> #include <string.h> #include <rte_eal.h>
lib/eal/common/malloc_mp.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2018 Intel Corporation */ +#include <stdlib.h> #include <string.h> #include <sys/time.h>
lib/eal/freebsd/eal.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2014 6WIND S.A. */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h>
lib/eal/include/generic/rte_rwlock.h +2 -0
@@ -21,6 +21,8 @@extern "C" {#endif +#include <errno.h> +#include <rte_common.h> #include <rte_atomic.h> #include <rte_pause.h>
lib/eal/include/rte_common.h +0 -3
@@ -17,9 +17,6 @@ extern "C" {#endif #include <stdint.h> -#include <stdlib.h> -#include <ctype.h> -#include <errno.h> #include <limits.h> #include <rte_config.h>
lib/eal/linux/eal.c +1 -0
@@ -3,6 +3,7 @@* Copyright(c) 2012-2014 6WIND S.A. */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h>
lib/eal/linux/eal_alarm.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdio.h> #include <stdint.h> +#include <stdlib.h> #include <errno.h> #include <sys/queue.h> #include <sys/time.h>
lib/eal/linux/eal_dev.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2018 Intel Corporation */ +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <signal.h>
lib/eal/linux/eal_vfio_mp_sync.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2018 Intel Corporation */ +#include <errno.h> #include <unistd.h> #include <string.h>
lib/eal/ppc/rte_power_intrinsics.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2021 Intel Corporation */ +#include <errno.h> +#include "rte_power_intrinsics.h" /**
lib/eal/riscv/rte_power_intrinsics.c +2 -0
@@ -4,6 +4,8 @@* Copyright(c) 2022 Semihalf */ +#include <errno.h> +#include "rte_power_intrinsics.h" /**
lib/eal/unix/eal_unix_timer.c +1 -0
@@ -2,6 +2,7 @@* Copyright 2020 Mellanox Technologies, Ltd */ +#include <errno.h> #include <time.h> #include <rte_cycles.h>
lib/eal/windows/rte_thread.c +2 -0
@@ -3,6 +3,8 @@* Copyright (C) 2022 Microsoft Corporation */ +#include <errno.h> +#include <rte_common.h> #include <rte_errno.h> #include <rte_thread.h>
lib/efd/rte_efd.c +2 -0
@@ -1,9 +1,11 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2016-2017 Intel Corporation */ +#include <errno.h> #include <stdio.h> #include <string.h> #include <stdint.h> +#include <stdlib.h> #include <inttypes.h> #include <errno.h> #include <sys/queue.h>
lib/ethdev/ethdev_driver.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2022 Intel Corporation */ +#include <stdlib.h> +#include <rte_kvargs.h> #include <rte_malloc.h>
lib/ethdev/rte_class_eth.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2018 Gaëtan Rivet */ +#include <stdlib.h> #include <string.h> #include <rte_class.h>
lib/ethdev/sff_telemetry.c +2 -0
@@ -2,7 +2,9 @@* Copyright(c) 2022 Intel Corporation */ +#include <ctype.h> #include <errno.h> +#include <stdlib.h> #include "rte_ethdev.h" #include <rte_common.h>
lib/eventdev/rte_event_eth_rx_adapter.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2017 Intel Corporation. * All rights reserved. */ +#include <ctype.h> +#include <stdlib.h> #if defined(LINUX )#include <sys/epoll.h> #endif
lib/eventdev/rte_event_timer_adapter.c +2 -0
@@ -3,9 +3,11 @@* All rights reserved. */ +#include <ctype.h> #include <string.h> #include <inttypes.h> #include <stdbool.h> +#include <stdlib.h> #include <rte_memzone.h> #include <rte_errno.h>
lib/gpudev/gpudev.c +2 -0
@@ -2,6 +2,8 @@* Copyright (c) 2021 NVIDIA Corporation & Affiliates */ +#include <stdlib.h> +#include <rte_eal.h> #include <rte_tailq.h> #include <rte_string_fns.h>
lib/graph/graph.c +1 -0
@@ -4,6 +4,7 @@#include <fnmatch.h> #include <stdbool.h> +#include <stdlib.h> #include <rte_common.h> #include <rte_debug.h>
lib/graph/graph_ops.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdbool.h> +#include <stdlib.h> #include <string.h> #include <rte_errno.h>
lib/graph/graph_stats.c +1 -0
@@ -4,6 +4,7 @@#include <fnmatch.h> #include <stdbool.h> +#include <stdlib.h> #include <rte_common.h> #include <rte_errno.h>
lib/graph/node.c +1 -0
@@ -4,6 +4,7 @@#include <stdbool.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <rte_common.h>
lib/ipsec/ipsec_telemetry.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2021 Intel Corporation */ +#include <stdlib.h> #include <rte_ipsec.h> #include <rte_telemetry.h> #include <rte_malloc.h>
lib/meter/rte_meter.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2014 Intel Corporation */ +#include <errno.h> #include <stdio.h> #include <math.h>
lib/metrics/rte_metrics.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation */ +#include <stdlib.h> #include <string.h> #include <rte_common.h>
lib/node/ethdev_ctrl.c +2 -0
@@ -2,6 +2,8 @@* Copyright(C) 2020 Marvell International Ltd. */ +#include <stdlib.h> +#include <rte_ethdev.h> #include <rte_graph.h>
lib/pci/rte_pci.c +1 -0
@@ -3,6 +3,7 @@* Copyright 2013-2014 6WIND S.A. */ +#include <errno.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h>
lib/pdump/rte_pdump.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2016-2018 Intel Corporation */ +#include <stdlib.h> +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <rte_lcore.h>
lib/pipeline/rte_swx_ctl.c +1 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ +#include <errno.h> #include <stdlib.h> #include <string.h> #include <stdio.h>
lib/port/rte_swx_port_fd.c +1 -0
@@ -3,6 +3,7 @@*/ #include <string.h> #include <stdint.h> +#include <stdlib.h> #include <unistd.h> #include <rte_mbuf.h>
lib/port/rte_swx_port_ring.c +1 -0
@@ -3,6 +3,7 @@*/ #include <string.h> #include <stdint.h> +#include <stdlib.h> #include <rte_mbuf.h> #include <rte_ring.h>
lib/power/power_cppc_cpufreq.c +2 -0
@@ -3,6 +3,8 @@* Copyright(c) 2021 Arm Limited */ +#include <stdlib.h> +#include <rte_memcpy.h> #include "power_cppc_cpufreq.h"
lib/power/rte_power.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#include <errno.h> +#include <rte_errno.h> #include <rte_spinlock.h>
lib/power/rte_power_pmd_mgmt.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2020 Intel Corporation */ +#include <stdlib.h> +#include <rte_lcore.h> #include <rte_cycles.h> #include <rte_cpuflags.h>
lib/sched/rte_pie.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2020 Intel Corporation */ +#include <errno.h> #include <stdlib.h> #include <string.h>
lib/security/rte_security.c +3 -0
@@ -4,6 +4,9 @@* Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved */ +#include <ctype.h> +#include <stdlib.h> +#include <rte_cryptodev.h> #include <rte_dev.h> #include <rte_telemetry.h>
lib/telemetry/telemetry.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2020 Intel Corporation */ +#include <errno.h> +#include <stdlib.h> #ifndef RTE_EXEC_ENV_WINDOWS #include <unistd.h> #include <pthread.h>
lib/telemetry/telemetry_data.c +3 -0
@@ -2,6 +2,9 @@* Copyright(c) 2020 Intel Corporation */ +#include <errno.h> +#include <stdlib.h> +#undef RTE_USE_LIBBSD#include <rte_string_fns.h>
lib/telemetry/telemetry_legacy.c +2 -1
@@ -1,7 +1,8 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2020 Intel Corporation */ - +#include <ctype.h> +#include <errno.h> #ifndef RTE_EXEC_ENV_WINDOWS #include <unistd.h> #include <sys/socket.h>
lib/vhost/vhost.h +1 -0
@@ -7,6 +7,7 @@#include <stdint.h> #include <stdio.h> #include <stdbool.h> +#include <stdlib.h> #include <sys/queue.h> #include <unistd.h> #include <linux/virtio_net.h>
Signature · 1 line
2.33.1
Re: [PATCH v4 4/4] eal: remove unneeded includes from a public header
Quoted 6 lines · Dmitry Kozlyuk
Do not include <
ctype.h>, <errno.h>, and <stdlib.h> from <rte_common.h>, because they are not used by this file.
Include the needed headers directly from the files that need them.Signed-off-by Dmitry Kozlyuk <[email protected]>---
Re: [PATCH v4 4/4] eal: remove unneeded includes from a public header
In reply to Dmitry KozlyukQuoted 6 lines · Dmitry Kozlyuk
lib/efd/rte_efd.c +0
-0@@ -1,9 +1,11 @@/* SPDX-License-Identifier: BSD-3-Clause
lib/efd/rte_efd.c line 11
Quoted 10 lines
lib/efd/rte_efd.c +2
-0* Copyright(c) 2016-2017 Intel Corporation */ +#include <errno.h> #include <stdio.h> #include <string.h> #include <stdint.h> +#include <stdlib.h> #include <inttypes.h> #include <errno.h> #include <sys/queue.h>
errno is included twice.
I will fix while applying.
Signature · 1 line
David Marchand
Re: [PATCH v4 4/4] eal: remove unneeded includes from a public header
In reply to Dmitry KozlyukQuoted 7 lines · Dmitry Kozlyuk
Do not include <
ctype.h>, <errno.h>, and <stdlib.h> from <rte_common.h>, because they are not used by this file.
Include the needed headers directly from the files that need them.Signed-off-by Dmitry Kozlyuk <[email protected]>---
[snip]
Quoted 4 lines
examples/vdpa/main.c | 1 + examples/vhost/main.c | 2 ++ examples/vhost/virtio_net.c | 1 + examples/vhost_blk/vhost_blk.c | 1 +
We are missing an update of vm_power_manager example:
../../../dpdk/examples/vm_power_manager/parse.c: In function ‘parse_set’:../../../dpdk/examples/vm_power_manager/parse.c:28:16: error: implicit declaration of function ‘isblank’ [-Werror=implicit-function-declaration]
28 | while (isblank(*str))
| ^~~~~~~
../../../dpdk/examples/vm_power_manager/parse.c:9:1: note: include
‘<ctype.h>’ or provide a declaration of ‘isblank’
8 | #include "parse.h"
+++ |+#include <ctype.h>
9 |I am surprised the CI did not catch this issue.
I suspect some dependencies (probably libvirt-devel) are not installed in CI environments.
The following diff seems enough to fix the issue, can you double check?
(quoted diff) +0 -0
b/examples/vm_power_manager/channel_monitor.c
index 97b8def7ca..5fef268662 100644
examples/vm_power_manager/channel_monitor.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2010-2014 Intel Corporation */ +#include <ctype.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h>
(quoted diff) +0 -0
b/examples/vm_power_manager/guest_cli/parse.c
index 528df6d6f1..6ed2d5cb49 100644
examples/vm_power_manager/guest_cli/parse.c +4 -0
@@ -3,9 +3,13 @@* Copyright(c) 2014 6WIND S.A. */ +#include <ctype.h> +#include <errno.h> #include <stdlib.h> #include <string.h> +#include <rte_log.h> +#include "parse.h" /*
(quoted diff) +0 -0
b/examples/vm_power_manager/parse.c
index 8a8dcf05fe..5467035994 100644
examples/vm_power_manager/parse.c +5 -0
@@ -3,8 +3,13 @@* Copyright(c) 2014 6WIND S.A. */ +#include <ctype.h> +#include <errno.h> +#include <stdlib.h> #include <string.h> +#include <rte_log.h> +#include "parse.h" /*
Signature · 1 line
David Marchand
Quoted 10 lines · Dmitry Kozlyuk
v4: Fix build on ARM and RISC-V (CI).
v3: Fix build (CI).
v2:
* Extend and tidy up the macro unit test (Morten).
* Remove unneeded includes fromrte_common.h(Morten, Bruce).
Quoted 5 lines
Dmitry Kozlyuk (4):
eal: fix pointer arithmetic with an expression argument
eal: deduplicate roundup code
eal: uninlinerte_str_to_size
eal: remove unneeded includes from a public header
I fixed the reported issues on last patch, and applied the series. Thanks.
Signature · 1 line
David Marchand