-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sonic-net:master' into SAI_DBG_GEN_DUMP_support
- Loading branch information
Showing
30 changed files
with
621 additions
and
49 deletions.
There are no files selected for viewing
Submodule SAI
updated
28 files
+1 −0 | .gitignore | |
+85 −0 | doc/ECMP/NextHopGroup_with_members.md | |
+425 −0 | doc/SAI-Proposal-Prefix-Compression.md | |
+1 −1 | experimental/saiexperimentaldashappliance.h | |
+27 −0 | experimental/saiexperimentaldashflow.h | |
+217 −8 | experimental/saiexperimentaldashtunnel.h | |
+44 −1 | experimental/saitypesextensions.h | |
+1 −0 | inc/sai.h | |
+70 −2 | inc/saiacl.h | |
+11 −0 | inc/saimacsec.h | |
+46 −0 | inc/sainexthopgroup.h | |
+6 −0 | inc/saiobject.h | |
+9 −0 | inc/saipolicer.h | |
+313 −0 | inc/saiprefixcompression.h | |
+9 −0 | inc/sairouterinterface.h | |
+9 −0 | inc/saischeduler.h | |
+16 −1 | inc/saisrv6.h | |
+31 −0 | inc/saitypes.h | |
+9 −0 | inc/saiudf.h | |
+1 −1 | inc/saiversion.h | |
+5 −2 | meta/Makefile | |
+4 −0 | meta/aspell.en.pws | |
+48 −0 | meta/attrversion.sh | |
+2 −1 | meta/gensairpc.pl | |
+77 −1 | meta/parse.pl | |
+23 −0 | meta/saimetadatatypes.h | |
+22 −0 | meta/saisanitycheck.c | |
+2 −0 | meta/style.pm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#include "AttrVersionChecker.h" | ||
|
||
#include "swss/logger.h" | ||
|
||
using namespace syncd; | ||
|
||
AttrVersionChecker::AttrVersionChecker(): | ||
m_enabled(false), | ||
m_saiApiVersion(SAI_VERSION(0,0,0)) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
// empty | ||
} | ||
|
||
void AttrVersionChecker::enable( | ||
_In_ bool enable) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
m_enabled = enable; | ||
} | ||
|
||
void AttrVersionChecker::setSaiApiVersion( | ||
_In_ sai_api_version_t version) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
m_saiApiVersion = version; | ||
} | ||
|
||
void AttrVersionChecker::reset() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
m_visitedAttributes.clear(); | ||
} | ||
|
||
bool AttrVersionChecker::isSufficientVersion( | ||
_In_ const sai_attr_metadata_t *md) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (md == nullptr) | ||
{ | ||
SWSS_LOG_ERROR("md is NULL"); | ||
|
||
return false; | ||
} | ||
|
||
if (!m_enabled) | ||
{ | ||
return true; | ||
} | ||
|
||
if (SAI_METADATA_HAVE_ATTR_VERSION == 0) | ||
{ | ||
// metadata does not contain attr versions, no check will be preformed | ||
return true; | ||
} | ||
|
||
// check attr version if metadata have version defined | ||
|
||
if (m_saiApiVersion > md->apiversion) | ||
{ | ||
// ok, SAI version is bigger than attribute release version | ||
|
||
return true; | ||
} | ||
|
||
if (m_saiApiVersion < md->apiversion) | ||
{ | ||
// skip, SAI version is not sufficient | ||
|
||
if (m_visitedAttributes.find(md->attridname) == m_visitedAttributes.end()) | ||
{ | ||
m_visitedAttributes.insert(md->attridname); | ||
|
||
// log only once | ||
|
||
SWSS_LOG_WARN("SAI version %lu, not sufficient to discover %s", m_saiApiVersion, md->attridname); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
// m_saiApiVersion == md->apiversion | ||
|
||
if (md->nextrelease == false) | ||
{ | ||
// ok, SAI version is equal to attribute version | ||
return true; | ||
} | ||
|
||
// next release == true | ||
|
||
if (m_visitedAttributes.find(md->attridname) == m_visitedAttributes.end()) | ||
{ | ||
m_visitedAttributes.insert(md->attridname); | ||
|
||
// warn only once | ||
|
||
SWSS_LOG_WARN("%s is ment for next release after %lu, will not discover", md->attridname, m_saiApiVersion); | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#pragma once | ||
|
||
extern "C" { | ||
#include "sai.h" | ||
#include "saimetadata.h" | ||
} | ||
|
||
#include <set> | ||
#include <string> | ||
|
||
namespace syncd | ||
{ | ||
class AttrVersionChecker | ||
{ | ||
public: | ||
|
||
AttrVersionChecker(); | ||
|
||
public: | ||
|
||
void enable( | ||
_In_ bool enable); | ||
|
||
void setSaiApiVersion( | ||
_In_ sai_api_version_t version); | ||
|
||
void reset(); | ||
|
||
bool isSufficientVersion( | ||
_In_ const sai_attr_metadata_t *md); | ||
|
||
private: | ||
|
||
bool m_enabled; | ||
|
||
sai_api_version_t m_saiApiVersion; | ||
|
||
std::set<std::string> m_visitedAttributes; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,5 +100,6 @@ namespace syncd | |
|
||
std::string m_supportingBulkCounterGroups; | ||
|
||
bool m_enableAttrVersionCheck; | ||
}; | ||
} |
Oops, something went wrong.