Skip to content

Commit

Permalink
Sai switch handling new reachability group field
Browse files Browse the repository at this point in the history
Summary:
As titled. Process reachability group list in sai switch.

Also need to sort the entries - at wb GET would return sorted order.

Reviewed By: jasmeetbagga

Differential Revision: D66029979

fbshipit-source-id: 2ae0ca3279c8d4888d5a694ef3821de620c5c88a
  • Loading branch information
Ron He authored and facebook-github-bot committed Nov 22, 2024
1 parent fbf7ea9 commit 8df9624
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
7 changes: 3 additions & 4 deletions fboss/agent/hw/sai/switch/SaiSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1338,11 +1338,10 @@ void SaiSwitch::processSwitchSettingsChangeSansDrainedEntryLocked(
}

{
const auto oldVal = oldSwitchSettings->getReachabilityGroupListSize();
const auto newVal = newSwitchSettings->getReachabilityGroupListSize();
auto oldVal = oldSwitchSettings->getReachabilityGroups();
auto newVal = newSwitchSettings->getReachabilityGroups();
if (oldVal != newVal) {
managerTable_->switchManager().setReachabilityGroupList(
newVal.has_value() ? newVal.value() : 0);
managerTable_->switchManager().setReachabilityGroupList(newVal);
}
}

Expand Down
16 changes: 7 additions & 9 deletions fboss/agent/hw/sai/switch/SaiSwitchManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,16 +1009,14 @@ void SaiSwitchManager::setLocalCapsuleSwitchIds(
SaiSwitchTraits::Attributes::MultiStageLocalSwitchIds{values});
}

void SaiSwitchManager::setReachabilityGroupList(int reachabilityGroupListSize) {
void SaiSwitchManager::setReachabilityGroupList(
const std::vector<int>& reachabilityGroups) {
#if defined(BRCM_SAI_SDK_DNX_GTE_12_0)
if (reachabilityGroupListSize > 0) {
std::vector<uint32_t> list;
for (int i = 0; i < reachabilityGroupListSize; i++) {
list.push_back(i + 1);
}
switch_->setOptionalAttribute(
SaiSwitchTraits::Attributes::ReachabilityGroupList{list});
}
std::vector<uint32_t> groupList(
reachabilityGroups.begin(), reachabilityGroups.end());
std::sort(groupList.begin(), groupList.end());
switch_->setOptionalAttribute(
SaiSwitchTraits::Attributes::ReachabilityGroupList{groupList});
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion fboss/agent/hw/sai/switch/SaiSwitchManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class SaiSwitchManager {
}
void setLocalCapsuleSwitchIds(
const std::map<SwitchID, int>& switchIdToNumCores);
void setReachabilityGroupList(int reachabilityGroupListSize);
void setReachabilityGroupList(const std::vector<int>& reachabilityGroups);
void setSramGlobalFreePercentXoffTh(uint8_t sramFreePercentXoffThreshold);
void setSramGlobalFreePercentXonTh(uint8_t sramFreePercentXonThreshold);
void setLinkFlowControlCreditTh(uint16_t linkFlowControlThreshold);
Expand Down

0 comments on commit 8df9624

Please sign in to comment.