Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL attribute #975

Merged
merged 3 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ AX_CODE_COVERAGE
AX_ADD_AM_MACRO_STATIC([])

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],
Expand Down
5 changes: 0 additions & 5 deletions syncd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ syncd_CXXFLAGS += -DSAITHRIFT=yes
syncd_LDADD += -lrpcserver -lthrift
endif

if SONIC_ASIC_PLATFORM_MELLANOX
syncd_CXXFLAGS += -DSAI_SUPPORT_UNINIT_DATA_PLANE_ON_REMOVAL
libSyncd_a_CXXFLAGS += -DSAI_SUPPORT_UNINIT_DATA_PLANE_ON_REMOVAL
endif

libSyncdRequestShutdown_a_SOURCES = \
RequestShutdown.cpp \
RequestShutdownCommandLineOptions.cpp \
Expand Down
37 changes: 27 additions & 10 deletions syncd/Syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4393,15 +4393,36 @@ sai_status_t Syncd::setUninitDataPlaneOnRemovalOnAllSwitches()

auto strRid = sai_serialize_object_id(rid);

auto status = m_vendorSai->set(SAI_OBJECT_TYPE_SWITCH, rid, &attr);
sai_attr_capability_t attr_capability = {};

if (status != SAI_STATUS_SUCCESS)
sai_status_t queryStatus;

queryStatus = sai_query_attribute_capability(rid,
SAI_OBJECT_TYPE_SWITCH,
SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL,
&attr_capability);
if (queryStatus != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL=false: %s:%s",
strRid.c_str(),
sai_serialize_status(status).c_str());
SWSS_LOG_ERROR("Failed to get SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL capabilities: %s:%s",
strRid.c_str(),
sai_serialize_status(queryStatus).c_str());

result = status;
result = queryStatus;
continue;
}

if (attr_capability.set_implemented)
{
auto status = m_vendorSai->set(SAI_OBJECT_TYPE_SWITCH, rid, &attr);

if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL=false: %s:%s",
strRid.c_str(),
sai_serialize_status(status).c_str());

result = status;
}
}
}

Expand Down Expand Up @@ -4650,15 +4671,11 @@ void Syncd::run()
}
}

#ifdef SAI_SUPPORT_UNINIT_DATA_PLANE_ON_REMOVAL

if (shutdownType == SYNCD_RESTART_TYPE_FAST || shutdownType == SYNCD_RESTART_TYPE_WARM)
{
setUninitDataPlaneOnRemovalOnAllSwitches();
}

#endif

m_manager->removeAllCounters();

sai_status_t status = removeAllSwitches();
Expand Down