Skip to content

Commit

Permalink
Enable firmware for 12.x
Browse files Browse the repository at this point in the history
Summary: As titled.

Reviewed By: jasmeetbagga

Differential Revision: D66928580

fbshipit-source-id: ac161fde6a76849de201c6b18c8823ae59b7fc5c
  • Loading branch information
Shrikrishna (Shri) Khare authored and facebook-github-bot committed Dec 9, 2024
1 parent 70374b4 commit f7ef03a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
19 changes: 13 additions & 6 deletions fboss/agent/hw/sai/api/bcm/SwitchApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,8 @@ void SwitchApi::registerSwitchEventCallback(
rv, ApiType, "Unable to register parity error switch event callback");

// Register switch events
// TODO(zecheng): Update flag when new 12.0 release has the attribute
// TODO(zecheng): Update flag when new 12.0 release has the attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
// SAI_SWITCH_EVENT_TYPE_FIRMWARE_CRASHED is not supported on 12.0 yet
std::array<uint32_t, 9> events = {
SAI_SWITCH_EVENT_TYPE_PARITY_ERROR,
SAI_SWITCH_EVENT_TYPE_STABLE_FULL,
Expand All @@ -262,6 +261,16 @@ void SwitchApi::registerSwitchEventCallback(
SAI_SWITCH_EVENT_TYPE_FABRIC_AUTO_ISOLATE,
SAI_SWITCH_EVENT_TYPE_FIRMWARE_CRASHED,
SAI_SWITCH_EVENT_TYPE_REMOTE_LINK_CHANGE};
#elif defined(SAI_VERSION_12_0_EA_DNX_ODP)
std::array<uint32_t, 8> events = {
SAI_SWITCH_EVENT_TYPE_PARITY_ERROR,
SAI_SWITCH_EVENT_TYPE_STABLE_FULL,
SAI_SWITCH_EVENT_TYPE_STABLE_ERROR,
SAI_SWITCH_EVENT_TYPE_UNCONTROLLED_SHUTDOWN,
SAI_SWITCH_EVENT_TYPE_WARM_BOOT_DOWNGRADE,
SAI_SWITCH_EVENT_TYPE_INTERRUPT,
SAI_SWITCH_EVENT_TYPE_FABRIC_AUTO_ISOLATE,
SAI_SWITCH_EVENT_TYPE_FIRMWARE_CRASHED};
#elif defined BRCM_SAI_SDK_GTE_11_0
std::array<uint32_t, 7> events = {
SAI_SWITCH_EVENT_TYPE_PARITY_ERROR,
Expand Down Expand Up @@ -502,17 +511,15 @@ SaiSwitchTraits::Attributes::AttributeShelPeriodicInterval::operator()() {

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeFirmwareCoreTouse::operator()() {
// TODO(skhare): Update when 12.x supports this attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_7)
return SAI_SWITCH_ATTR_FIRMWARE_CORE_TO_USE;
#endif
return std::nullopt;
}

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() {
// TODO(skhare): Update when 12.x supports this attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_7)
return SAI_SWITCH_ATTR_FIRMWARE_LOG_FILE;
#endif
return std::nullopt;
Expand Down
6 changes: 4 additions & 2 deletions fboss/agent/hw/sai/switch/npu/bcm/SaiSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ std::string errorType(sai_switch_error_type_t type) {
case SAI_SWITCH_ERROR_TYPE_FABRIC_AUTO_ISOLATION:
return "SAI_SWITCH_ERROR_TYPE_FABRIC_AUTO_ISOLATION";
#endif
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_7)
case SAI_SWITCH_ERROR_TYPE_FIRMWARE_CRASH:
return "SAI_SWITCH_ERROR_TYPE_FIRMWARE_CRASH";
#endif
Expand Down Expand Up @@ -545,7 +545,7 @@ void SaiSwitch::switchEventCallback(
break;
}
#endif
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_7)
case SAI_SWITCH_EVENT_TYPE_FIRMWARE_CRASHED: {
// TODO(skhare) Process this callback
XLOG(ERR) << "Firmware Crash callback received: " << " error type: "
Expand All @@ -554,6 +554,8 @@ void SaiSwitch::switchEventCallback(
<< " reload status: " << static_cast<int>(eventInfo->index2);
break;
}
#endif
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
// TODO(zecheng): Update flag when new 12.0 release has the attribute
case SAI_SWITCH_EVENT_TYPE_REMOTE_LINK_CHANGE:
auto isUp = eventInfo->index;
Expand Down
2 changes: 1 addition & 1 deletion fboss/agent/platforms/sai/SaiPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ SaiSwitchTraits::CreateAttributes SaiPlatform::getSwitchAttributes(
std::optional<SaiSwitchTraits::Attributes::FirmwareLoadType> firmwareLoadType{
std::nullopt};

#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_7)
if (swId.has_value()) {
const auto& firmwareNameToFirmwareInfo = getFirmwareForSwitch(
switchSettings->switchIdToSwitchInfo(), swId.value());
Expand Down

0 comments on commit f7ef03a

Please sign in to comment.