Skip to content

Commit

Permalink
Enable SHEL attributes and callbacks for 12.0
Browse files Browse the repository at this point in the history
Summary: As titled.

Reviewed By: jasmeetbagga

Differential Revision: D66864919

fbshipit-source-id: 5dd17e61e973020547e67b6a7f952cb46bf18be8
  • Loading branch information
Ron He authored and facebook-github-bot committed Dec 20, 2024
1 parent 6edcf84 commit 18edf23
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 22 deletions.
3 changes: 1 addition & 2 deletions fboss/agent/hw/sai/api/bcm/PortApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ SaiPortTraits::Attributes::AttributeCondEntropyRehashSeed::operator()() {

std::optional<sai_attr_id_t>
SaiPortTraits::Attributes::AttributeShelEnable::operator()() {
// TODO(zecheng): Update flag when new 12.0 release has the attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
return SAI_PORT_ATTR_SHEL_ENABLE;
#else
return std::nullopt;
Expand Down
18 changes: 7 additions & 11 deletions fboss/agent/hw/sai/api/bcm/SwitchApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ 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
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
std::array<uint32_t, 9> events = {
SAI_SWITCH_EVENT_TYPE_PARITY_ERROR,
Expand All @@ -262,15 +261,16 @@ void SwitchApi::registerSwitchEventCallback(
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 = {
std::array<uint32_t, 9> 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};
SAI_SWITCH_EVENT_TYPE_FIRMWARE_CRASHED,
SAI_SWITCH_EVENT_TYPE_REMOTE_LINK_CHANGE};
#elif defined BRCM_SAI_SDK_GTE_11_0
std::array<uint32_t, 7> events = {
SAI_SWITCH_EVENT_TYPE_PARITY_ERROR,
Expand Down Expand Up @@ -475,35 +475,31 @@ SaiSwitchTraits::Attributes::AttributeCondEntropyRehashPeriodUS::operator()() {

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeShelSrcIp::operator()() {
// TODO(zecheng): Update flag when new 12.0 release has the attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
return SAI_SWITCH_ATTR_SHEL_SRC_IP;
#endif
return std::nullopt;
}

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeShelDstIp::operator()() {
// TODO(zecheng): Update flag when new 12.0 release has the attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
return SAI_SWITCH_ATTR_SHEL_DST_IP;
#endif
return std::nullopt;
}

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeShelSrcMac::operator()() {
// TODO(zecheng): Update flag when new 12.0 release has the attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
return SAI_SWITCH_ATTR_SHEL_SRC_MAC;
#endif
return std::nullopt;
}

std::optional<sai_attr_id_t>
SaiSwitchTraits::Attributes::AttributeShelPeriodicInterval::operator()() {
// TODO(zecheng): Update flag when new 12.0 release has the attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
return SAI_SWITCH_ATTR_SHEL_PERIODIC_INTERVAL;
#endif
return std::nullopt;
Expand Down
3 changes: 1 addition & 2 deletions fboss/agent/hw/sai/api/bcm/SystemPortApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ namespace facebook::fboss {

std::optional<sai_attr_id_t>
SaiSystemPortTraits::Attributes::AttributeShelPktDstEnable::operator()() {
// TODO(zecheng): Update flag when new 12.0 release has the attribute
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
return SAI_SYSTEM_PORT_ATTR_SHEL_PKT_DEST_ENABLE;
#else
return std::nullopt;
Expand Down
2 changes: 1 addition & 1 deletion fboss/agent/hw/sai/switch/SaiPortManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ std::shared_ptr<Port> SaiPortManager::swPortFromAttributes(
#endif
port->setScope(platform_->getPlatformMapping()->getPortScope(port->getID()));

#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
auto shelEnable = GET_OPT_ATTR(Port, ShelEnable, attributes);
port->setSelfHealingECMPLagEnable(shelEnable);
#endif
Expand Down
2 changes: 1 addition & 1 deletion fboss/agent/hw/sai/switch/SaiSystemPortManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ SaiSystemPortManager::attributesFromSwSystemPort(
}
std::optional<SaiSystemPortTraits::Attributes::ShelPktDstEnable>
shelPktDstEnable = std::nullopt;
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
if (swSystemPort->getShelDestinationEnabled()) {
shelPktDstEnable = true;
}
Expand Down
2 changes: 1 addition & 1 deletion fboss/agent/hw/sai/switch/npu/SaiPortManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ SaiPortTraits::CreateAttributes SaiPortManager::attributesFromSwPort(
condEntropyRehashEnable = swPort->getConditionalEntropyRehash();
#endif
std::optional<SaiPortTraits::Attributes::ShelEnable> shelEnable{};
#if defined(SAI_VERSION_11_7_0_0_DNX_ODP)
#if defined(BRCM_SAI_SDK_DNX_GTE_11_0)
shelEnable = SaiPortTraits::Attributes::ShelEnable{
swPort->getSelfHealingECMPLagEnable()};
#endif
Expand Down
6 changes: 2 additions & 4 deletions fboss/agent/hw/sai/switch/npu/bcm/SaiSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,17 +705,15 @@ 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:
case SAI_SWITCH_EVENT_TYPE_REMOTE_LINK_CHANGE: {
auto isUp = eventInfo->index;
auto sysPortId = eventInfo->index2;
XLOG(DBG2) << "[SHEL] Received remote link change event: " << "isUp: "
<< static_cast<int>(isUp)
<< " sysPortId: " << static_cast<int>(sysPortId);
// TODO(zecheng): Handle and log remote link change
break;
}
#endif
}
}
Expand Down

0 comments on commit 18edf23

Please sign in to comment.