diff --git a/fboss/agent/hw/sai/api/SwitchApi.h b/fboss/agent/hw/sai/api/SwitchApi.h index 5db7bff25895e..e724342f44829 100644 --- a/fboss/agent/hw/sai/api/SwitchApi.h +++ b/fboss/agent/hw/sai/api/SwitchApi.h @@ -671,6 +671,14 @@ struct SaiSwitchTraits { sai_uint32_t, AttributeShelPeriodicInterval, SaiIntDefault>; + + struct AttributeMaxSwitchId { + std::optional operator()(); + }; + using MaxSwitchId = SaiExtensionAttribute< + sai_uint32_t, + AttributeMaxSwitchId, + SaiIntDefault>; }; using AdapterKey = SwitchSaiId; using AdapterHostKey = std::monostate; diff --git a/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp b/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp index b222a652ba001..101059295b44a 100644 --- a/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp +++ b/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp @@ -525,4 +525,12 @@ SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() { return std::nullopt; } +std::optional +SaiSwitchTraits::Attributes::AttributeMaxSwitchId::operator()() { +#if defined(BRCM_SAI_SDK_DNX) && defined(BRCM_SAI_SDK_GTE_12_0) + return SAI_SWITCH_ATTR_MAX_SWITCH_ID; +#endif + return std::nullopt; +} + } // namespace facebook::fboss diff --git a/fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp b/fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp index 9a2982d2bf37b..abc248f11725f 100644 --- a/fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp +++ b/fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp @@ -591,4 +591,8 @@ SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() { return SAI_SWITCH_ATTR_FIRMWARE_LOG_FILE; } +std::optional +SaiSwitchTraits::Attributes::AttributeMaxSwitchId::operator()() { + return SAI_SWITCH_ATTR_MAX_SWITCH_ID; +} } // namespace facebook::fboss diff --git a/fboss/agent/hw/sai/api/fake/saifakeextensions.h b/fboss/agent/hw/sai/api/fake/saifakeextensions.h index 71557e1a2370c..e7cbd41c3d874 100644 --- a/fboss/agent/hw/sai/api/fake/saifakeextensions.h +++ b/fboss/agent/hw/sai/api/fake/saifakeextensions.h @@ -89,6 +89,7 @@ typedef enum _sai_switch_extensions_attr_t { SAI_SWITCH_ATTR_SHEL_PERIODIC_INTERVAL, SAI_SWITCH_ATTR_FIRMWARE_CORE_TO_USE, SAI_SWITCH_ATTR_FIRMWARE_LOG_FILE, + SAI_SWITCH_ATTR_MAX_SWITCH_ID, } sai_switch_extensions_attr_t; typedef enum _sai_tam_event_extensions_attr_t { diff --git a/fboss/agent/hw/sai/api/oss/SwitchApi.cpp b/fboss/agent/hw/sai/api/oss/SwitchApi.cpp index 25fee80c69cb3..ebb76415b8bbd 100644 --- a/fboss/agent/hw/sai/api/oss/SwitchApi.cpp +++ b/fboss/agent/hw/sai/api/oss/SwitchApi.cpp @@ -274,4 +274,8 @@ SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() { return std::nullopt; } +std::optional +SaiSwitchTraits::Attributes::AttributeMaxSwitchId::operator()() { + return std::nullopt; +} } // namespace facebook::fboss diff --git a/fboss/agent/hw/sai/api/tajo/SwitchApi.cpp b/fboss/agent/hw/sai/api/tajo/SwitchApi.cpp index 7e9cdb1cd4d7d..399ef36c5f1a1 100644 --- a/fboss/agent/hw/sai/api/tajo/SwitchApi.cpp +++ b/fboss/agent/hw/sai/api/tajo/SwitchApi.cpp @@ -296,4 +296,8 @@ SaiSwitchTraits::Attributes::AttributeFirmwareLogFile::operator()() { return std::nullopt; } +std::optional +SaiSwitchTraits::Attributes::AttributeMaxSwitchId::operator()() { + return std::nullopt; +} } // namespace facebook::fboss