Skip to content

Commit

Permalink
Revert "[syncd] Add attribute version check feature (sonic-net#1470)"
Browse files Browse the repository at this point in the history
This reverts commit e6ec142.
  • Loading branch information
yxieca committed Dec 5, 2024
1 parent 0901dd7 commit 0383740
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 371 deletions.
107 changes: 0 additions & 107 deletions syncd/AttrVersionChecker.cpp

This file was deleted.

40 changes: 0 additions & 40 deletions syncd/AttrVersionChecker.h

This file was deleted.

4 changes: 0 additions & 4 deletions syncd/CommandLineOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ CommandLineOptions::CommandLineOptions()

#endif // SAITHRIFT

m_supportingBulkCounterGroups = "";

m_enableAttrVersionCheck = false;
}

std::string CommandLineOptions::getCommandLineString() const
Expand All @@ -70,7 +67,6 @@ std::string CommandLineOptions::getCommandLineString() const
ss << " BreakConfig=" << m_breakConfig;
ss << " WatchdogWarnTimeSpan=" << m_watchdogWarnTimeSpan;
ss << " SupportingBulkCounters=" << m_supportingBulkCounterGroups;
ss << " EnableAttrVersionCheck=" << (m_enableAttrVersionCheck ? "YES" : "NO");

#ifdef SAITHRIFT

Expand Down
1 change: 0 additions & 1 deletion syncd/CommandLineOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,5 @@ namespace syncd

std::string m_supportingBulkCounterGroups;

bool m_enableAttrVersionCheck;
};
}
11 changes: 2 additions & 9 deletions syncd/CommandLineOptionsParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
auto options = std::make_shared<CommandLineOptions>();

#ifdef SAITHRIFT
const char* const optstring = "dp:t:g:x:b:B:aw:uSUCsz:lrm:h";
const char* const optstring = "dp:t:g:x:b:B:w:uSUCsz:lrm:h";
#else
const char* const optstring = "dp:t:g:x:b:B:aw:uSUCsz:lh";
const char* const optstring = "dp:t:g:x:b:B:w:uSUCsz:lh";
#endif // SAITHRIFT

while (true)
Expand All @@ -43,7 +43,6 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
{ "breakConfig", required_argument, 0, 'b' },
{ "watchdogWarnTimeSpan", optional_argument, 0, 'w' },
{ "supportingBulkCounters", required_argument, 0, 'B' },
{ "enableAttrVersionCheck", no_argument, 0, 'a' },
#ifdef SAITHRIFT
{ "rpcserver", no_argument, 0, 'r' },
{ "portmap", required_argument, 0, 'm' },
Expand Down Expand Up @@ -139,10 +138,6 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
options->m_supportingBulkCounterGroups = std::string(optarg);
break;

case 'a':
options->m_enableAttrVersionCheck = true;
break;

case 'h':
printUsage();
exit(EXIT_SUCCESS);
Expand Down Expand Up @@ -201,8 +196,6 @@ void CommandLineOptionsParser::printUsage()
std::cout << " Watchdog time span (in microseconds) to watch for execution" << std::endl;
std::cout << " -B --supportingBulkCounters" << std::endl;
std::cout << " Counter groups those support bulk polling" << std::endl;
std::cout << " -a --enableAttrVersionCheck" << std::endl;
std::cout << " Enable attribute SAI version check when performing SAI discovery" << std::endl;

#ifdef SAITHRIFT

Expand Down
9 changes: 3 additions & 6 deletions syncd/HardReiniter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ HardReiniter::HardReiniter(
_In_ std::shared_ptr<RedisClient> client,
_In_ std::shared_ptr<VirtualOidTranslator> translator,
_In_ std::shared_ptr<sairedis::SaiInterface> sai,
_In_ std::shared_ptr<NotificationHandler> handler,
_In_ bool checkAttrVersion):
_In_ std::shared_ptr<NotificationHandler> handler):
m_vendorSai(sai),
m_translator(translator),
m_client(client),
m_handler(handler),
m_checkAttrVersion(checkAttrVersion)
m_handler(handler)
{
SWSS_LOG_ENTER();

Expand Down Expand Up @@ -101,8 +99,7 @@ std::map<sai_object_id_t, std::shared_ptr<syncd::SaiSwitch>> HardReiniter::hardR
m_handler,
m_switchVidToRid.at(kvp.first),
m_switchRidToVid.at(kvp.first),
kvp.second,
m_checkAttrVersion);
kvp.second);

sr->hardReinit();

Expand Down
5 changes: 1 addition & 4 deletions syncd/HardReiniter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ namespace syncd
_In_ std::shared_ptr<RedisClient> client,
_In_ std::shared_ptr<VirtualOidTranslator> translator,
_In_ std::shared_ptr<sairedis::SaiInterface> sai,
_In_ std::shared_ptr<NotificationHandler> handler,
_In_ bool checkAttrVersion);
_In_ std::shared_ptr<NotificationHandler> handler);

virtual ~HardReiniter();

Expand Down Expand Up @@ -60,7 +59,5 @@ namespace syncd
std::shared_ptr<RedisClient> m_client;

std::shared_ptr<NotificationHandler> m_handler;

bool m_checkAttrVersion;
};
}
1 change: 0 additions & 1 deletion syncd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ noinst_LIBRARIES = libSyncd.a libSyncdRequestShutdown.a libMdioIpcClient.a
libSyncd_a_SOURCES = \
AsicOperation.cpp \
AsicView.cpp \
AttrVersionChecker.cpp \
BestCandidateFinder.cpp \
BreakConfig.cpp \
BreakConfigParser.cpp \
Expand Down
30 changes: 2 additions & 28 deletions syncd/SaiDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,12 @@ using namespace syncd;
#define SAI_DISCOVERY_LIST_MAX_ELEMENTS 1024

SaiDiscovery::SaiDiscovery(
_In_ std::shared_ptr<sairedis::SaiInterface> sai,
_In_ bool checkAttrVersion):
_In_ std::shared_ptr<sairedis::SaiInterface> sai):
m_sai(sai)
{
SWSS_LOG_ENTER();

sai_api_version_t version = SAI_VERSION(0,0,0);

sai_status_t status = m_sai->queryApiVersion(&version);

if (status == SAI_STATUS_SUCCESS)
{
m_attrVersionChecker.enable(checkAttrVersion);
m_attrVersionChecker.setSaiApiVersion(version);

SWSS_LOG_NOTICE("check attr version ENABLED, libsai api version: %lu", version);
}
else
{
m_attrVersionChecker.enable(false);
m_attrVersionChecker.setSaiApiVersion(SAI_API_VERSION);

SWSS_LOG_WARN("failed to obtain libsai api version: %s, will discover all attributes",
sai_serialize_status(status).c_str());
}
// empty
}

SaiDiscovery::~SaiDiscovery()
Expand Down Expand Up @@ -129,11 +110,6 @@ void SaiDiscovery::discover(

attr.id = md->attrid;

if (!m_attrVersionChecker.isSufficientVersion(md))
{
continue;
}

if (md->attrvaluetype == SAI_ATTR_VALUE_TYPE_OBJECT_ID)
{
if (md->defaultvaluetype == SAI_DEFAULT_VALUE_TYPE_CONST)
Expand Down Expand Up @@ -283,8 +259,6 @@ std::set<sai_object_id_t> SaiDiscovery::discover(

m_defaultOidMap.clear();

m_attrVersionChecker.reset();

std::set<sai_object_id_t> discovered_rids;

{
Expand Down
7 changes: 1 addition & 6 deletions syncd/SaiDiscovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "meta/SaiInterface.h"

#include "AttrVersionChecker.h"

#include <memory>
#include <set>
#include <map>
Expand All @@ -20,8 +18,7 @@ namespace syncd
public:

SaiDiscovery(
_In_ std::shared_ptr<sairedis::SaiInterface> sai,
_In_ bool checkAttrVersion);
_In_ std::shared_ptr<sairedis::SaiInterface> sai);

virtual ~SaiDiscovery();

Expand Down Expand Up @@ -64,7 +61,5 @@ namespace syncd
std::shared_ptr<sairedis::SaiInterface> m_sai;

DefaultOidMap m_defaultOidMap;

AttrVersionChecker m_attrVersionChecker;
};
}
10 changes: 4 additions & 6 deletions syncd/SaiSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ SaiSwitch::SaiSwitch(
_In_ std::shared_ptr<RedisClient> client,
_In_ std::shared_ptr<VirtualOidTranslator> translator,
_In_ std::shared_ptr<sairedis::SaiInterface> vendorSai,
_In_ bool warmBoot,
_In_ bool checkAttrVersion):
_In_ bool warmBoot):
SaiSwitchInterface(switch_vid, switch_rid),
m_vendorSai(vendorSai),
m_warmBoot(warmBoot),
m_translator(translator),
m_client(client),
m_checkAttrVersion(checkAttrVersion)
m_client(client)
{
SWSS_LOG_ENTER();

Expand Down Expand Up @@ -663,7 +661,7 @@ void SaiSwitch::helperDiscover()
{
SWSS_LOG_ENTER();

SaiDiscovery sd(m_vendorSai, m_checkAttrVersion);
SaiDiscovery sd(m_vendorSai);

m_discovered_rids = sd.discover(m_switch_rid);

Expand Down Expand Up @@ -954,7 +952,7 @@ void SaiSwitch::onPostPortCreate(
{
SWSS_LOG_ENTER();

SaiDiscovery sd(m_vendorSai, m_checkAttrVersion);
SaiDiscovery sd(m_vendorSai);

auto discovered = sd.discover(port_rid);

Expand Down
Loading

0 comments on commit 0383740

Please sign in to comment.