eal: fix version macro
PATCH 1/1 eal: fix version macro
The macro RTE_VERSION is broken since updated with function calls. It is a build-time version number, and must be built with macros. For a run-time version number, there is the function rte_version().
--- lib/librte_eal/include/rte_version.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_eal/include/rte_version.h +4 -4
@@ -28,10 +28,10 @@ extern "C" {* All version numbers in one to compare with RTE_VERSION_NUM() */ #define RTE_VERSION RTE_VERSION_NUM( \ - rte_version_year(), \ - rte_version_month(), \ - rte_version_minor(), \ - rte_version_release()) + RTE_VER_YEAR, \ + RTE_VER_MONTH, \ + RTE_VER_MINOR, \ + RTE_VER_RELEASE)/** * Function to return DPDK version prefix string
Signature · 1 line
2.30.1
Quoted 23 lines · Thomas Monjalon
The macro
RTE_VERSIONis broken since updated with function calls. It is a build-time version number, and must be built with macros. For a run-time version number, there is the functionrte_version().Fixes 5b637a848195 ("eal: fix querying DPDK version at runtime")Reported-by David Marchand <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- lib/librte_eal/include/rte_version.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)lib/librte_eal/include/rte_version.h +0
-1@@ -28,10 +28,10 @@ extern "C" {* All version numbers in one to compare with RTE_VERSION_NUM() */ #define RTE_VERSION RTE_VERSION_NUM( \ - rte_version_year(), \
lib/librte_eal/include/rte_version.h extern "C" { · line 37
Quoted 10 lines
lib/librte_eal/include/rte_version.h +4
-3-rte_version_month (), \ -rte_version_minor (), \ - rte_version_release()) +RTE_VER_YEAR , \ +RTE_VER_MONTH , \ +RTE_VER_MINOR , \ + RTE_VER_RELEASE)/** * Function to return DPDK version prefix string
The original patch wanted to fix rte_version() at runtime. I don't see the need to keep the rte_version_XXX exports now that RTE_VERSION is reverted.
Signature · 1 line
David Marchand
17/03/2021 10:48, David Marchand:
Quoted 32 lines · Thomas Monjalon
Quoted 31 lines
The macro
RTE_VERSIONis broken since updated with function calls. It is a build-time version number, and must be built with macros. For a run-time version number, there is the functionrte_version().Fixes 5b637a848195 ("eal: fix querying DPDK version at runtime")Reported-by David Marchand <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- lib/librte_eal/include/rte_version.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)lib/librte_eal/include/rte_version.h +4
-4@@ -28,10 +28,10 @@ extern "C" {* All version numbers in one to compare with RTE_VERSION_NUM() */ #define RTE_VERSION RTE_VERSION_NUM( \ - rte_version_year(), \ - rte_version_month(), \ - rte_version_minor(), \ - rte_version_release()) + RTE_VER_YEAR, \ + RTE_VER_MONTH, \ + RTE_VER_MINOR, \ + RTE_VER_RELEASE)
Quoted 6 lines
lib/librte_eal/include/rte_version.h extern "C" { · line 37
Quoted 2 lines
lib/librte_eal/include/rte_version.h +0
-0/** * Function to return DPDK version prefix string The original patch wanted to fix
rte_version()at runtime. I don't see the need to keep therte_version_XXXexports now thatRTE_VERSIONis reverted.
I think it may help to query the version numbers at runtime, in "if" condition. Is there another way I'm missing? We may argue that the runtime version number should not be used to decide how to behave in an application.
Quoted 40 lines · Thomas Monjalon
17/03/2021 10:48, David Marchand:
Quoted 32 lines · Thomas Monjalon
Quoted 31 lines
The macro
RTE_VERSIONis broken since updated with function calls. It is a build-time version number, and must be built with macros. For a run-time version number, there is the functionrte_version().Fixes 5b637a848195 ("eal: fix querying DPDK version at runtime")Reported-by David Marchand <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- lib/librte_eal/include/rte_version.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)lib/librte_eal/include/rte_version.h +4
-4@@ -28,10 +28,10 @@ extern "C" {* All version numbers in one to compare with RTE_VERSION_NUM() */ #define RTE_VERSION RTE_VERSION_NUM( \ - rte_version_year(), \ - rte_version_month(), \ - rte_version_minor(), \ - rte_version_release()) + RTE_VER_YEAR, \ + RTE_VER_MONTH, \ + RTE_VER_MINOR, \ + RTE_VER_RELEASE)Quoted 6 lines
lib/librte_eal/include/rte_version.h extern "C" { · line 37
Quoted 2 lines
lib/librte_eal/include/rte_version.h +0
-0/** * Function to return DPDK version prefix string The original patch wanted to fix
rte_version()at runtime. I don't see the need to keep therte_version_XXXexports now thatRTE_VERSIONis reverted.
Quoted 5 lines
I think it may help to query the version numbers at runtime, in "if" condition. Is there another way I'm missing? We may argue that the runtime version number should not be used to decide how to behave in an application.
I would also tend toward keeping them, for the same reason that runtime is definitely to be preferred over build time, and they are not like to be much of a maintenance burden.
Also, next time we have an ABI break, I wonder if the existing macros should be renamed to have an RTE_BUILD_VER_ prefix, to make it clear that it's the build version only that is being reported rather than the version actually being used. Similarly the functions could be renamed to have rte_runtime_ prefix, ensuring that in all cases the user is clear whether they are getting the build version or the runtime version.
/Bruce
18/03/2021 13:28, Bruce Richardson:
Quoted 50 lines · Thomas Monjalon
Quoted 40 lines
17/03/2021 10:48, David Marchand:
Quoted 32 lines · Thomas Monjalon
Quoted 31 lines
The macro
RTE_VERSIONis broken since updated with function calls. It is a build-time version number, and must be built with macros. For a run-time version number, there is the functionrte_version().Fixes 5b637a848195 ("eal: fix querying DPDK version at runtime")Reported-by David Marchand <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- lib/librte_eal/include/rte_version.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)lib/librte_eal/include/rte_version.h +4
-4@@ -28,10 +28,10 @@ extern "C" {* All version numbers in one to compare with RTE_VERSION_NUM() */ #define RTE_VERSION RTE_VERSION_NUM( \ - rte_version_year(), \ - rte_version_month(), \ - rte_version_minor(), \ - rte_version_release()) + RTE_VER_YEAR, \ + RTE_VER_MONTH, \ + RTE_VER_MINOR, \ + RTE_VER_RELEASE)Quoted 6 lines
lib/librte_eal/include/rte_version.h extern "C" { · line 37
Quoted 2 lines
lib/librte_eal/include/rte_version.h +0
-0/** * Function to return DPDK version prefix string The original patch wanted to fix
rte_version()at runtime. I don't see the need to keep therte_version_XXXexports now thatRTE_VERSIONis reverted.Quoted 5 lines
I think it may help to query the version numbers at runtime, in "if" condition. Is there another way I'm missing? We may argue that the runtime version number should not be used to decide how to behave in an application.
I would also tend toward keeping them, for the same reason that runtime is definitely to be preferred over build time, and they are not like to be much of a maintenance burden.
Quoted 6 lines
Also, next time we have an ABI break, I wonder if the existing macros should be renamed to have an
RTE_BUILD_VER_prefix, to make it clear that it's the build version only that is being reported rather than the version actually being used. Similarly the functions could be renamed to haverte_runtime_prefix, ensuring that in all cases the user is clear whether they are getting the build version or the runtime version.
I am fine with such rename,
but that's already quite clear that a macro is at build time, and a function is usually evaluated at runtime.
Quoted 58 lines · Thomas Monjalon
18/03/2021 13:28, Bruce Richardson:
Quoted 50 lines · Thomas Monjalon
Quoted 40 lines
17/03/2021 10:48, David Marchand:
Quoted 32 lines · Thomas Monjalon
Quoted 31 lines
The macro
RTE_VERSIONis broken since updated with function calls. It is a build-time version number, and must be built with macros. For a run-time version number, there is the functionrte_version().Fixes 5b637a848195 ("eal: fix querying DPDK version at runtime")Reported-by David Marchand <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- lib/librte_eal/include/rte_version.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)lib/librte_eal/include/rte_version.h +4
-4@@ -28,10 +28,10 @@ extern "C" {* All version numbers in one to compare with RTE_VERSION_NUM() */ #define RTE_VERSION RTE_VERSION_NUM( \ - rte_version_year(), \ - rte_version_month(), \ - rte_version_minor(), \ - rte_version_release()) + RTE_VER_YEAR, \ + RTE_VER_MONTH, \ + RTE_VER_MINOR, \ + RTE_VER_RELEASE)Quoted 6 lines
lib/librte_eal/include/rte_version.h extern "C" { · line 37
Quoted 2 lines
lib/librte_eal/include/rte_version.h +0
-0/** * Function to return DPDK version prefix string The original patch wanted to fix
rte_version()at runtime. I don't see the need to keep therte_version_XXXexports now thatRTE_VERSIONis reverted.Quoted 5 lines
I think it may help to query the version numbers at runtime, in "if" condition. Is there another way I'm missing? We may argue that the runtime version number should not be used to decide how to behave in an application.
I would also tend toward keeping them, for the same reason that runtime is definitely to be preferred over build time, and they are not like to be much of a maintenance burden.
Quoted 6 lines
Also, next time we have an ABI break, I wonder if the existing macros should be renamed to have an
RTE_BUILD_VER_prefix, to make it clear that it's the build version only that is being reported rather than the version actually being used. Similarly the functions could be renamed to haverte_runtime_prefix, ensuring that in all cases the user is clear whether they are getting the build version or the runtime version.
Quoted 4 lines
I am fine with such rename,
but that's already quite clear that a macro is at build time, and a function is usually evaluated at runtime.
If we take the existing rte_version function, without checking the source code, one has no way of checking if that is resolved at runtime (as it is now) or at compile-time (as it was). However, if we assume that that is a bug and that all such functions should be run-time operations, then there is no difficulty.
/Bruce
Quoted 10 lines · Thomas Monjalon
The macro
RTE_VERSIONis broken since updated with function calls. It is a build-time version number, and must be built with macros. For a run-time version number, there is the functionrte_version().Fixes 5b637a848195 ("eal: fix querying DPDK version at runtime")Reported-by David Marchand <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>
Let's discuss the versioning of the new symbols in the other thread. Thanks.
Signature · 1 line
David Marchand
17/03/2021 16:36, David Marchand:
Quoted 6 lines · Thomas Monjalon
Quoted 5 lines
The macro
RTE_VERSIONis broken since updated with function calls. It is a build-time version number, and must be built with macros. For a run-time version number, there is the functionrte_version().
Quoted 7 lines
Quoted 5 lines
Fixes 5b637a848195 ("eal: fix querying DPDK version at runtime")Reported-by David Marchand <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>Acked-by David Marchand <[email protected]>
Applied quickly because the compilation of some apps are broken.
Quoted 1 line
Let's discuss the versioning of the new symbols in the other thread.
OK, in this thread:
https://inbox.dpdk.org/dev/[email protected]/