Skip to content

Commit

Permalink
extend yangra platform support
Browse files Browse the repository at this point in the history
Summary:
as titled

Facebook

vendor patch

Reviewed By: shri-khare

Differential Revision:
D66852144

Privacy Context Container: L1125642

fbshipit-source-id: cd7770e5c8b54eaddba19ae7e2d5191bf4ceef23
  • Loading branch information
Parvez Shaikh authored and facebook-github-bot committed Dec 6, 2024
1 parent 053145f commit 753ed77
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
26 changes: 23 additions & 3 deletions fboss/agent/platforms/sai/SaiYangraPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ HwAsic* SaiYangraPlatform::getAsic() const {
}
const std::unordered_map<std::string, std::string>
SaiYangraPlatform::getSaiProfileVendorExtensionValues() const {
return std::unordered_map<std::string, std::string>();
std::unordered_map<std::string, std::string> kv_map;
kv_map.insert(std::make_pair("SAI_KEY_NOT_DROP_SMAC_DMAC_EQUAL", "1"));
kv_map.insert(std::make_pair("SAI_KEY_RECLAIM_BUFFER_ENABLED", "0"));
kv_map.insert(std::make_pair("SAI_KEY_TRAP_PACKETS_USING_CALLBACK", "1"));
return kv_map;
}

const std::set<sai_api_t>& SaiYangraPlatform::getSupportedApiList() const {
Expand All @@ -70,13 +74,29 @@ SaiYangraPlatform::getAclFieldList() const {
return std::nullopt;
}
std::string SaiYangraPlatform::getHwConfig() {
std::string xml_filename = "/usr/share/sai_5600.xml";
std::ifstream xml_file(xml_filename);
std::string xml_filename =
*config()->thrift.platform()->get_chip().get_asic().config();
std::string base_filename =
xml_filename.substr(0, xml_filename.find(".xml") + 4);
std::ifstream xml_file(base_filename);
std::string xml_config(
(std::istreambuf_iterator<char>(xml_file)),
std::istreambuf_iterator<char>());
// std::cout << "Read config from: " << xml_filename << std::endl;
// std::cout << "Content:" << std::endl << xml_config << std::endl;
if (xml_filename.find(";disable_lb_filter") != std::string::npos) {
std::string keyTag = "</issu-enabled>";
std::string newKeyTag = "<lb_filter_disable>1</lb_filter_disable>";
int indentSpaces = 8;

size_t pos = xml_config.find(keyTag);
if (pos != std::string::npos) {
xml_config.insert(
pos + keyTag.length(), std::string(indentSpaces, ' ') + newKeyTag);
} else {
std::cerr << "Tag " << keyTag << " not found in XML." << std::endl;
}
}
return xml_config;
}

Expand Down
5 changes: 2 additions & 3 deletions fboss/oss/hw_test_configs/yangra.agent.materialized_JSON
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@
},
"platform": {
"chip": {
"bcm": {
"config": {
}
"asic": {
"config": "/usr/share/sai_5600.xml"
}
}
}
Expand Down

0 comments on commit 753ed77

Please sign in to comment.