Skip to content

Commit

Permalink
Set DataCellFabric from SDK correctly
Browse files Browse the repository at this point in the history
Summary:
The earlier code took the form:

std::optional<bool> var1{false};
std::optional<bool> var2 = var1 ? true : false;

var2 will always be set to 1 if var1 carries value (false or true)
since "var 1 ?" checks if var1 carries value.

Reviewed By: jasmeetbagga

Differential Revision: D66745826

fbshipit-source-id: 3d77cf18e970fdc0df08285f40b9deb2fd89457b
  • Loading branch information
Shrikrishna (Shri) Khare authored and facebook-github-bot committed Dec 4, 2024
1 parent 1e5ed4b commit 5056a60
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fboss/agent/hw/sai/switch/SaiPortManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1966,11 +1966,15 @@ void SaiPortManager::updateStats(
platform_->getAsic()->isSupported(HwAsic::Feature::DATA_CELL_FILTER)) {
std::optional<SaiPortTraits::Attributes::FabricDataCellsFilterStatus>
attrT = SaiPortTraits::Attributes::FabricDataCellsFilterStatus{};
curPortStats.dataCellsFilterOn() =

auto dataCelllsFilterOn =
SaiApiTable::getInstance()->portApi().getAttribute(
handle->port->adapterKey(), attrT)
? true
: false;
handle->port->adapterKey(), attrT);
if (dataCelllsFilterOn.has_value() && dataCelllsFilterOn.value() == true) {
curPortStats.dataCellsFilterOn() = true;
} else {
curPortStats.dataCellsFilterOn() = false;
}
}
portStats_[portId]->updateStats(curPortStats, now);
auto lastPrbsRxStateReadTimeIt = lastPrbsRxStateReadTime_.find(portId);
Expand Down

0 comments on commit 5056a60

Please sign in to comment.