Skip to content

Commit e643d0b

Browse files
committed
[Celestica] Leh800bcls: Support NPU-specific yamlConfig to allow differing polarity settings on multi-NPU platforms
1 parent 7257b63 commit e643d0b

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

‎fboss/agent/platforms/sai/SaiBcmPlatform.cpp‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,35 @@ std::string SaiBcmPlatform::getHwConfig() {
2525
if (getAsic()->isSupported(HwAsic::Feature::HSDK)) {
2626
std::string yamlConfig;
2727
try {
28-
yamlConfig = config()
29-
->thrift.platform()
30-
->chip()
31-
->get_asicConfig()
32-
.common()
33-
->get_yamlConfig();
34-
} catch (const std::exception&) {
28+
auto asicConfig = config()->thrift.platform()->chip()->get_asicConfig();
29+
if (asicConfig.npuEntries()) {
30+
int16_t switchIndex = getAsic()->getSwitchIndex();
31+
XLOG(INFO)
32+
<< "Loading HSDK config: found npuEntries, current switchIndex="
33+
<< switchIndex;
34+
auto& npuEntries = asicConfig.npuEntries().value();
35+
auto npuEntry = npuEntries.find(switchIndex);
36+
if (npuEntry != npuEntries.end() &&
37+
npuEntry->second.getType() ==
38+
cfg::AsicConfigEntry::Type::yamlConfig) {
39+
XLOG(INFO) << "Loading NPU-specific yamlConfig for switchIndex="
40+
<< switchIndex;
41+
yamlConfig = npuEntry->second.get_yamlConfig();
42+
} else {
43+
XLOG(INFO) << "No NPU-specific yamlConfig found for switchIndex="
44+
<< switchIndex << ", falling back to common config";
45+
}
46+
}
47+
if (yamlConfig.empty()) {
48+
yamlConfig = asicConfig.common()->get_yamlConfig();
49+
}
50+
} catch (const std::exception& e) {
3551
/*
3652
* (TODO): Once asic config v2 is rolled out to the fleet, we
3753
* should remove this fallback and always use the config v2
3854
*/
55+
XLOG(INFO) << "Exception in SaiBcmPlatform::getHwConfig: " << e.what()
56+
<< ", falling back to bcm.yamlConfig()";
3957
yamlConfig =
4058
*(config()->thrift.platform()->chip()->get_bcm().yamlConfig());
4159
}

0 commit comments

Comments
 (0)