From 6d94a02b8d5d760cb9051e6cb9a76570b1632250 Mon Sep 17 00:00:00 2001 From: junchao Date: Fri, 24 Feb 2023 10:44:10 +0800 Subject: [PATCH 1/3] Ignore removing switch for mellanox platform due to known limitation --- configure.ac | 4 ++++ syncd/Syncd.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 57a8eb693..d7d324562 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,10 @@ AM_PATH_PYTHON3 AX_CODE_COVERAGE AX_ADD_AM_MACRO_STATIC([]) +AC_DEFINE_UNQUOTED([SONIC_ASIC_PLATFORM], + ["$CONFIGURED_PLATFORM"], + [SONiC ASIC Platform]) + AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BAREFOOT, test x$CONFIGURED_PLATFORM = xbarefoot) AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BROADCOM, test x$CONFIGURED_PLATFORM = xbroadcom) diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index 78a1ea2d0..b7b8811a5 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -1,3 +1,4 @@ +#include "config.h" #include "Syncd.h" #include "VidManager.h" #include "NotificationHandler.h" @@ -4738,7 +4739,11 @@ void Syncd::run() m_mdioIpcServer->stopMdioThread(); - sai_status_t status = removeAllSwitches(); + sai_status_t status = SAI_STATUS_SUCCESS; + if (shutdownType != SYNCD_RESTART_TYPE_COLD || 0 != strcmp(SONIC_ASIC_PLATFORM, "mellanox")) + { + status = removeAllSwitches(); + } // Stop notification thread after removing switch m_processor->stopNotificationsProcessingThread(); From 12008fad0165694377e0627ba34188030c2e30e6 Mon Sep 17 00:00:00 2001 From: junchao Date: Mon, 6 Mar 2023 18:26:03 +0800 Subject: [PATCH 2/3] Fix review comment --- configure.ac | 13 +++++++------ syncd/Syncd.cpp | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index d7d324562..62080af10 100644 --- a/configure.ac +++ b/configure.ac @@ -15,9 +15,10 @@ AM_PATH_PYTHON3 AX_CODE_COVERAGE AX_ADD_AM_MACRO_STATIC([]) -AC_DEFINE_UNQUOTED([SONIC_ASIC_PLATFORM], - ["$CONFIGURED_PLATFORM"], - [SONiC ASIC Platform]) +# Generate a macro "#define MELLANOX_PLATFORM 1" in config.h +if test x$CONFIGURED_PLATFORM = xmellanox; then + AC_DEFINE([MELLANOX], [1], [Define to 1 on Mellanox platform]) +fi AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BAREFOOT, test x$CONFIGURED_PLATFORM = xbarefoot) AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BROADCOM, test x$CONFIGURED_PLATFORM = xbroadcom) @@ -66,9 +67,9 @@ AC_ARG_ENABLE(syncd, esac],[syncd=true]) AS_IF([test "x${ENABLESYNCD}" = "xno" ],[syncd=false],[]) AM_CONDITIONAL(SYNCD, test x$syncd = xtrue) -AM_COND_IF([SYNCD], [ - AM_COND_IF([SAIVS], [], [AC_CHECK_LIB([sai], [main], [AC_MSG_NOTICE(libsai found)], [AC_MSG_ERROR(libsai is required for syncd)]) -])]) +#AM_COND_IF([SYNCD], [ +# AM_COND_IF([SAIVS], [], [AC_CHECK_LIB([sai], [main], [AC_MSG_NOTICE(libsai found)], [AC_MSG_ERROR(libsai is required for syncd)]) +#])]) AC_ARG_ENABLE(rpcserver, [ --enable-rpcserver compile with thrift rpcserver included], diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index b7b8811a5..f6ebd904f 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -4740,10 +4740,14 @@ void Syncd::run() m_mdioIpcServer->stopMdioThread(); sai_status_t status = SAI_STATUS_SUCCESS; - if (shutdownType != SYNCD_RESTART_TYPE_COLD || 0 != strcmp(SONIC_ASIC_PLATFORM, "mellanox")) +#ifdef MELLANOX + if (shutdownType != SYNCD_RESTART_TYPE_COLD) { status = removeAllSwitches(); } +#else + status = removeAllSwitches(); +#endif // Stop notification thread after removing switch m_processor->stopNotificationsProcessingThread(); From b42fcef9172245250c8693a27ba142888ee6e1b7 Mon Sep 17 00:00:00 2001 From: junchao Date: Tue, 7 Mar 2023 11:48:54 +0800 Subject: [PATCH 3/3] Fix review comment --- configure.ac | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 62080af10..fc16d55ad 100644 --- a/configure.ac +++ b/configure.ac @@ -15,13 +15,12 @@ AM_PATH_PYTHON3 AX_CODE_COVERAGE AX_ADD_AM_MACRO_STATIC([]) -# Generate a macro "#define MELLANOX_PLATFORM 1" in config.h -if test x$CONFIGURED_PLATFORM = xmellanox; then - AC_DEFINE([MELLANOX], [1], [Define to 1 on Mellanox platform]) -fi - AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BAREFOOT, test x$CONFIGURED_PLATFORM = xbarefoot) AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BROADCOM, test x$CONFIGURED_PLATFORM = xbroadcom) +AM_CONDITIONAL(SONIC_ASIC_PLATFORM_MELLANOX, test x$CONFIGURED_PLATFORM = xmellanox) + +AM_COND_IF([SONIC_ASIC_PLATFORM_MELLANOX], + AC_DEFINE([MELLANOX], [1], [Define to 1 on Mellanox Platform])) AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging], @@ -67,9 +66,9 @@ AC_ARG_ENABLE(syncd, esac],[syncd=true]) AS_IF([test "x${ENABLESYNCD}" = "xno" ],[syncd=false],[]) AM_CONDITIONAL(SYNCD, test x$syncd = xtrue) -#AM_COND_IF([SYNCD], [ -# AM_COND_IF([SAIVS], [], [AC_CHECK_LIB([sai], [main], [AC_MSG_NOTICE(libsai found)], [AC_MSG_ERROR(libsai is required for syncd)]) -#])]) +AM_COND_IF([SYNCD], [ + AM_COND_IF([SAIVS], [], [AC_CHECK_LIB([sai], [main], [AC_MSG_NOTICE(libsai found)], [AC_MSG_ERROR(libsai is required for syncd)]) +])]) AC_ARG_ENABLE(rpcserver, [ --enable-rpcserver compile with thrift rpcserver included],