diff --git a/fboss/agent/hw/sai/api/SwitchApi.h b/fboss/agent/hw/sai/api/SwitchApi.h index eba19bfa0eee3..455cfbe1ad670 100644 --- a/fboss/agent/hw/sai/api/SwitchApi.h +++ b/fboss/agent/hw/sai/api/SwitchApi.h @@ -420,6 +420,11 @@ struct SaiSwitchTraits { }; using RestartIssu = SaiExtensionAttribute; + struct AttributeDelayDropCongThreshold { + std::optional operator()(); + }; + using DelayDropCongThreshold = + SaiExtensionAttribute; struct AttributeForceTrafficOverFabricWrapper { std::optional operator()(); }; @@ -614,7 +619,8 @@ struct SaiSwitchTraits { , std::optional #endif - >; + , + std::optional>; #if SAI_API_VERSION >= SAI_VERSION(1, 12, 0) static constexpr std::array CounterIdsToRead = { @@ -721,6 +727,7 @@ SAI_ATTRIBUTE_NAME(Switch, EcmpMemberCount) #endif SAI_ATTRIBUTE_NAME(Switch, DllPath) SAI_ATTRIBUTE_NAME(Switch, RestartIssu) +SAI_ATTRIBUTE_NAME(Switch, DelayDropCongThreshold) SAI_ATTRIBUTE_NAME(Switch, ForceTrafficOverFabric) SAI_ATTRIBUTE_NAME(Switch, WarmBootTargetVersion) SAI_ATTRIBUTE_NAME(Switch, SwitchIsolate) diff --git a/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp b/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp index 49df1f972de8e..733ca496e7f40 100644 --- a/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp +++ b/fboss/agent/hw/sai/api/bcm/SwitchApi.cpp @@ -184,6 +184,11 @@ void SwitchApi::registerSwitchEventCallback( #endif } +std::optional +SaiSwitchTraits::Attributes::AttributeDelayDropCongThreshold::operator()() { + return std::nullopt; +} + std::optional SaiSwitchTraits::Attributes:: AttributeForceTrafficOverFabricWrapper::operator()() { #if defined(BRCM_SAI_SDK_DNX) diff --git a/fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp b/fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp index 9f02b3c6df901..512fb50e21aaa 100644 --- a/fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp +++ b/fboss/agent/hw/sai/api/fake/FakeSaiExtensions.cpp @@ -130,6 +130,11 @@ SaiSwitchTraits::Attributes::AttributeRestartIssuWrapper::operator()() { return SAI_SWITCH_ATTR_EXT_RESTART_ISSU; } +std::optional +SaiSwitchTraits::Attributes::AttributeDelayDropCongThreshold::operator()() { + return std::nullopt; +} + std::optional SaiSwitchTraits::Attributes:: AttributeForceTrafficOverFabricWrapper::operator()() { return SAI_SWITCH_ATTR_FORCE_TRAFFIC_OVER_FABRIC; diff --git a/fboss/agent/hw/sai/api/oss/SwitchApi.cpp b/fboss/agent/hw/sai/api/oss/SwitchApi.cpp index 214fa555b2e62..b63773b352d0b 100644 --- a/fboss/agent/hw/sai/api/oss/SwitchApi.cpp +++ b/fboss/agent/hw/sai/api/oss/SwitchApi.cpp @@ -38,6 +38,11 @@ SaiSwitchTraits::Attributes::AttributeRestartIssuWrapper::operator()() { return std::nullopt; } +std::optional +SaiSwitchTraits::Attributes::AttributeDelayDropCongThreshold::operator()() { + return std::nullopt; +} + std::optional SaiSwitchTraits::Attributes:: AttributeForceTrafficOverFabricWrapper::operator()() { return std::nullopt; diff --git a/fboss/agent/hw/sai/api/tajo/SwitchApi.cpp b/fboss/agent/hw/sai/api/tajo/SwitchApi.cpp index 8594e82ff48be..2865254e1189e 100644 --- a/fboss/agent/hw/sai/api/tajo/SwitchApi.cpp +++ b/fboss/agent/hw/sai/api/tajo/SwitchApi.cpp @@ -52,6 +52,15 @@ SaiSwitchTraits::Attributes::AttributeRestartIssuWrapper::operator()() { #endif } +std::optional +SaiSwitchTraits::Attributes::AttributeDelayDropCongThreshold::operator()() { +#if defined(TAJO_SDK_VERSION_1_42_8) + return SAI_SWITCH_ATTR_EXT_DELAY_DROP_CONG_THRESHOLD; +#else + return std::nullopt; +#endif +} + std::optional SaiSwitchTraits::Attributes:: AttributeForceTrafficOverFabricWrapper::operator()() { return std::nullopt; diff --git a/fboss/agent/hw/sai/switch/SaiSwitchManager.cpp b/fboss/agent/hw/sai/switch/SaiSwitchManager.cpp index 047fedc6b96e6..9a0e778eab4c4 100644 --- a/fboss/agent/hw/sai/switch/SaiSwitchManager.cpp +++ b/fboss/agent/hw/sai/switch/SaiSwitchManager.cpp @@ -45,6 +45,11 @@ DEFINE_bool( false, "Flag to indicate whether to skip setting source mac in Sai switch during wb"); +DEFINE_uint32( + delay_drop_congestion_threshold, + 0, + "Delay drop congestion threshold"); + namespace { using namespace facebook::fboss; sai_hash_algorithm_t toSaiHashAlgo(cfg::HashingAlgorithm algo) { diff --git a/fboss/agent/hw/sai/tracer/SwitchApiTracer.cpp b/fboss/agent/hw/sai/tracer/SwitchApiTracer.cpp index 18d66820487e6..d7479bf81610e 100644 --- a/fboss/agent/hw/sai/tracer/SwitchApiTracer.cpp +++ b/fboss/agent/hw/sai/tracer/SwitchApiTracer.cpp @@ -122,6 +122,7 @@ void handleExtensionAttributes() { SAI_EXT_ATTR_MAP(Switch, VoqLatencyMinLevel2Ns); SAI_EXT_ATTR_MAP(Switch, VoqLatencyMaxLevel2Ns); SAI_EXT_ATTR_MAP(Switch, ReachabilityGroupList); + SAI_EXT_ATTR_MAP(Switch, DelayDropCongThreshold); } } // namespace diff --git a/fboss/agent/platforms/sai/SaiPlatform.cpp b/fboss/agent/platforms/sai/SaiPlatform.cpp index 5e07ee9c26ad1..3f693dc56c4d5 100644 --- a/fboss/agent/platforms/sai/SaiPlatform.cpp +++ b/fboss/agent/platforms/sai/SaiPlatform.cpp @@ -642,6 +642,7 @@ SaiSwitchTraits::CreateAttributes SaiPlatform::getSwitchAttributes( #if SAI_API_VERSION >= SAI_VERSION(1, 14, 0) std::nullopt, // ARS profile #endif + std::nullopt, // Delay Drop Cong Threshold }; }