Skip to content

Commit

Permalink
Enable SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL attribute (#975)
Browse files Browse the repository at this point in the history
Enable SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL attribute for all platforms based on capability

Signed-off-by: Thushar Gowda <24815472+tbgowda@users.noreply.github.com>
  • Loading branch information
tbgowda authored Feb 1, 2022
1 parent 1b8ce97 commit 5d0b22d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
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

0 comments on commit 5d0b22d

Please sign in to comment.