diff --git a/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp b/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp index c4e61a25e719f..b222a652ba001 100644 --- a/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp +++ b/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp @@ -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 events = { SAI_SWITCH_EVENT_TYPE_PARITY_ERROR, SAI_SWITCH_EVENT_TYPE_STABLE_FULL, @@ -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 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 events = { SAI_SWITCH_EVENT_TYPE_PARITY_ERROR, @@ -502,8 +511,7 @@ SaiSwitchTraits::Attributes::AttributeShelPeriodicInterval::operator()() { std::optional 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; @@ -511,8 +519,7 @@ SaiSwitchTraits::Attributes::AttributeFirmwareCoreTouse::operator()() { std::optional 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; diff --git a/fboss/agent/hw/sai/switch/npu/bcm/SaiSwitch.cpp b/fboss/agent/hw/sai/switch/npu/bcm/SaiSwitch.cpp index 3fcc57aa00458..9482c082e56b3 100644 --- a/fboss/agent/hw/sai/switch/npu/bcm/SaiSwitch.cpp +++ b/fboss/agent/hw/sai/switch/npu/bcm/SaiSwitch.cpp @@ -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 @@ -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: " @@ -554,6 +554,8 @@ void SaiSwitch::switchEventCallback( << " reload status: " << static_cast(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; diff --git a/fboss/agent/platforms/sai/SaiPlatform.cpp b/fboss/agent/platforms/sai/SaiPlatform.cpp index 41659eba9c6b8..ddd26073ccf49 100644 --- a/fboss/agent/platforms/sai/SaiPlatform.cpp +++ b/fboss/agent/platforms/sai/SaiPlatform.cpp @@ -591,7 +591,7 @@ SaiSwitchTraits::CreateAttributes SaiPlatform::getSwitchAttributes( std::optional 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());