diff --git a/configure.ac b/configure.ac index acbd8716aa48..6acb71610342 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,7 @@ AC_PROG_LIBTOOL AC_HEADER_STDC AM_CONDITIONAL(sonic_asic_platform_barefoot, test x$CONFIGURED_PLATFORM = xbarefoot) +AM_CONDITIONAL(sonic_asic_platform_mellanox, test x$CONFIGURED_PLATFORM = xmellanox) AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging], diff --git a/syncd/Makefile.am b/syncd/Makefile.am index 619befac932d..0719a2da00bb 100644 --- a/syncd/Makefile.am +++ b/syncd/Makefile.am @@ -37,6 +37,10 @@ syncd_CPPFLAGS += -DSAITHRIFT=yes syncd_LDADD += -lrpcserver -lthrift endif +if sonic_asic_platform_mellanox +syncd_CPPFLAGS += -DSAI_SUPPORT_UNINIT_DATA_PLANE_ON_REMOVAL +endif + syncd_request_shutdown_SOURCES = syncd_request_shutdown.cpp syncd_request_shutdown_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) syncd_request_shutdown_LDADD = -lhiredis -lswsscommon -lpthread diff --git a/syncd/scripts/syncd_init_common.sh b/syncd/scripts/syncd_init_common.sh index 2d8ee66625be..b76c9ec80710 100755 --- a/syncd/scripts/syncd_init_common.sh +++ b/syncd/scripts/syncd_init_common.sh @@ -31,7 +31,7 @@ case "$BOOT_TYPE" in FAST_REBOOT='yes' ;; fastfast) - if [ -e /var/warmboot/issu_started ]; then + if [ -e /var/warmboot/warm-starting ]; then FASTFAST_REBOOT='yes' fi ;; diff --git a/syncd/scripts/syncd_start.sh b/syncd/scripts/syncd_start.sh index ac68066684d7..1c061b4c2a0f 100755 --- a/syncd/scripts/syncd_start.sh +++ b/syncd/scripts/syncd_start.sh @@ -6,7 +6,6 @@ # Source the file that holds common code for systemd and supervisord . /usr/bin/syncd_init_common.sh - config_syncd exec ${CMD} ${CMD_ARGS} diff --git a/syncd/syncd.cpp b/syncd/syncd.cpp index 41b96db44f71..49c7fae1fbda 100644 --- a/syncd/syncd.cpp +++ b/syncd/syncd.cpp @@ -1626,6 +1626,28 @@ void InspectAsic() } } +sai_status_t onApplyViewInFastFastBoot() +{ + SWSS_LOG_ENTER(); + + sai_switch_api_t* sai_switch_api = nullptr; + sai_api_query(SAI_API_SWITCH, (void**)&sai_switch_api); + + sai_attribute_t attr; + + attr.id = SAI_SWITCH_ATTR_FAST_API_ENABLE; + attr.value.booldata = false; + + sai_status_t status = sai_switch_api->set_switch_attribute(gSwitchId, &attr); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to set SAI_SWITCH_ATTR_FAST_API_ENABLE=false: %s", sai_serialize_status(status).c_str()); + } + + return status; +} + sai_status_t notifySyncd( _In_ const std::string& op) { @@ -1657,6 +1679,8 @@ sai_status_t notifySyncd( { SWSS_LOG_NOTICE("very first run is TRUE, op = %s", op.c_str()); + sai_status_t status = SAI_STATUS_SUCCESS; + /* * On the very first start of syncd, "compile" view is directly applied * on device, since it will make it easier to switch to new asic state @@ -1686,6 +1710,12 @@ sai_status_t notifySyncd( g_asicInitViewMode = false; + if (options.startType == SAI_FASTFAST_BOOT) + { + /* fastfast boot configuration end */ + status = onApplyViewInFastFastBoot(); + } + SWSS_LOG_NOTICE("setting very first run to FALSE, op = %s", op.c_str()); } else @@ -1693,9 +1723,9 @@ sai_status_t notifySyncd( SWSS_LOG_THROW("unknown operation: %s", op.c_str()); } - sendNotifyResponse(SAI_STATUS_SUCCESS); + sendNotifyResponse(status); - return SAI_STATUS_SUCCESS; + return status; } if (op == SYNCD_INIT_VIEW) @@ -3246,35 +3276,6 @@ syncd_restart_type_t handleRestartQuery(swss::NotificationConsumer &restartQuery return SYNCD_RESTART_TYPE_COLD; } -void handleFfbEvent(swss::NotificationConsumer &ffb) -{ - SWSS_LOG_ENTER(); - - std::string op; - std::string data; - std::vector values; - - ffb.pop(op, data, values); - - if ((op == "SET") && (data == "ISSU_END")) - { - sai_switch_api_t *sai_switch_api = NULL; - sai_api_query(SAI_API_SWITCH, (void**)&sai_switch_api); - - sai_attribute_t attr; - - attr.id = SAI_SWITCH_ATTR_FAST_API_ENABLE; - attr.value.booldata = false; - - sai_status_t status = sai_switch_api->set_switch_attribute(gSwitchId, &attr); - - if (status != SAI_STATUS_SUCCESS) - { - SWSS_LOG_ERROR("Failed to set SAI_SWITCH_ATTR_FAST_API_ENABLE=false: %s", sai_serialize_status(status).c_str()); - } - } -} - bool isVeryFirstRun() { SWSS_LOG_ENTER(); @@ -3530,7 +3531,6 @@ int syncd_main(int argc, char **argv) std::shared_ptr restartQuery = std::make_shared(dbAsic.get(), "RESTARTQUERY"); std::shared_ptr flexCounter = std::make_shared(dbFlexCounter.get(), FLEX_COUNTER_TABLE); std::shared_ptr flexCounterGroup = std::make_shared(dbFlexCounter.get(), FLEX_COUNTER_GROUP_TABLE); - std::shared_ptr ffb = std::make_shared(dbAsic.get(), "MLNX_FFB"); /* * At the end we cant use producer consumer concept since if one process @@ -3543,7 +3543,8 @@ int syncd_main(int argc, char **argv) g_veryFirstRun = isVeryFirstRun(); - if (swss::WarmStart::isWarmStart()) + /* ignore warm logic here if syncd starts in Mellanox fastfast boot mode */ + if (swss::WarmStart::isWarmStart() && (options.startType != SAI_FASTFAST_BOOT)) { options.startType = SAI_WARM_BOOT; } @@ -3580,7 +3581,7 @@ int syncd_main(int argc, char **argv) { /* * Mellanox SAI requires to pass SAI_WARM_BOOT as SAI_BOOT_KEY - * to start 'fast-fast' + * to start 'fastfast' */ gProfileMap[SAI_KEY_BOOT_TYPE] = std::to_string(SAI_WARM_BOOT); } else { @@ -3639,7 +3640,6 @@ int syncd_main(int argc, char **argv) s->addSelectable(restartQuery.get()); s->addSelectable(flexCounter.get()); s->addSelectable(flexCounterGroup.get()); - s->addSelectable(ffb.get()); SWSS_LOG_NOTICE("starting main loop"); @@ -3728,10 +3728,6 @@ int syncd_main(int argc, char **argv) status = sai_switch_api->set_switch_attribute(gSwitchId, &attr); } } - else if (sel == ffb.get()) - { - handleFfbEvent(*ffb); - } else if (sel == flexCounter.get()) { processFlexCounterEvent(*(swss::ConsumerTable*)sel); @@ -3789,11 +3785,11 @@ int syncd_main(int argc, char **argv) SWSS_LOG_NOTICE("Removing the switch gSwitchId=0x%lx", gSwitchId); -#ifdef SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL +#ifdef SAI_SUPPORT_UNINIT_DATA_PLANE_ON_REMOVAL - if (shutdownType == SYNCD_RESTART_TYPE_FAST) + if (shutdownType == SYNCD_RESTART_TYPE_FAST || shutdownType == SYNCD_RESTART_TYPE_WARM) { - SWSS_LOG_NOTICE("Fast Reboot requested, keeping data plane running"); + SWSS_LOG_NOTICE("Fast/warm reboot requested, keeping data plane running"); sai_attribute_t attr;