From d0aaeb382e21f1d8562f759274db0508799c9f33 Mon Sep 17 00:00:00 2001 From: kcudnik Date: Fri, 19 May 2023 15:03:58 +0200 Subject: [PATCH 1/2] [configure] Check for minimal SAI version since commit 8e1fb37 (v1.8.0) there is check enum binary backward compatibility so we are relaxing this check below, versions do not have to be equal but both need to be at least 2ebde24 (v1.9.0), this will make sure that enums are always ok, but since that commit some data structures changed and are not binary backwad compatible like next hop group api, acl_capability, structs are backward binary compatible from commit aed34c8, which closest tag version for it is commit 3ff228a (v1.12.0), so min version check should be set to (v1.12.0), but some production branches do not use that high SAI version yet, some use even version v1.7.0 which then it is impossible to provide even enum backward compatibility, check those links: https://github.com/opencomputeproject/SAI/pull/1297 (enums) https://github.com/opencomputeproject/SAI/pull/1795 (structs) --- configure.ac | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 409eccfbaf..dedab0cfca 100644 --- a/configure.ac +++ b/configure.ac @@ -199,7 +199,24 @@ int main() { { return 1; } - return (version != SAI_API_VERSION); +/* +since commit 8e1fb37 (v1.8.0) there is check enum binary backward compatibility +so we are relaxing this check below, versions do not have to be equal but both +need to be at least 2ebde24 (v1.9.0), this will make sure that enums are always +ok, but since that commit some data structures changed and are not binary +backwad compatible like next hop group api, acl_capability, structs are +backward binary compatible from commit aed34c8, which closest tag version for +it is commit 3ff228a (v1.12.0), so min version check should be set to +(v1.12.0), but some production branches do not use that high SAI version yet, +some use even version v1.7.0 which then it is impossible to provide even enum +backward compatibility, check those links: +https://github.com/opencomputeproject/SAI/pull/1297 (enums) +https://github.com/opencomputeproject/SAI/pull/1795 (structs) +*/ + sai_api_version_t minversion = SAI_VERSION(1,9,0); + printf("min SAI version: %ld, sairedis SAI headers version: %ld, vendor lib SAI query api version: %ld\n", + minversion, SAI_API_VERSION, version); + return (version >= minversion) && (SAI_API_VERSION >= minversion); }], [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(failed) From bcde3e94062473e7afe092bc00ef95a84c98b42c Mon Sep 17 00:00:00 2001 From: kcudnik Date: Fri, 19 May 2023 18:23:38 +0200 Subject: [PATCH 2/2] Fix condition --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index dedab0cfca..b95367ef5d 100644 --- a/configure.ac +++ b/configure.ac @@ -192,6 +192,7 @@ AC_MSG_CHECKING([SAI headers API version and library version check]) AC_TRY_RUN([ extern "C" { #include +#include } int main() { sai_api_version_t version; @@ -216,7 +217,7 @@ https://github.com/opencomputeproject/SAI/pull/1795 (structs) sai_api_version_t minversion = SAI_VERSION(1,9,0); printf("min SAI version: %ld, sairedis SAI headers version: %ld, vendor lib SAI query api version: %ld\n", minversion, SAI_API_VERSION, version); - return (version >= minversion) && (SAI_API_VERSION >= minversion); + return (version < minversion) || (SAI_API_VERSION < minversion); }], [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(failed)