Skip to content

Commit

Permalink
Add micrologs for connectivity delta tracking
Browse files Browse the repository at this point in the history
Summary: Add micrologs for tracking connectivity delta comparisons and cases.

Reviewed By: zechengh09

Differential Revision:
D69838593

Privacy Context Container: L1125642

fbshipit-source-id: 4593cd46c6316aaac323e5c872087055d38ca027
  • Loading branch information
jleung51 authored and facebook-github-bot committed Feb 20, 2025
1 parent 2187ca6 commit 58f97dc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fboss/agent/FabricConnectivityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ FabricConnectivityManager::processConnectivityInfoForPort(
// actual{switchID, portID} == expected{switchID, portID}
iter->second.switchName() = iter->second.expectedSwitchName().value();
iter->second.portName() = iter->second.expectedPortName().value();
XLOG(DBG5) << "Cabling is correct on port ID "
<< static_cast<int>(portId);
} else if (*iter->second.isAttached()) {
// Attached but miscabled:
// - Connected to expected Switch but on wrong port
Expand All @@ -407,17 +409,30 @@ FabricConnectivityManager::processConnectivityInfoForPort(
if (portName.has_value()) {
iter->second.portName() = portName.value();
}
XLOG(DBG5) << "Attached but miscabled on port ID "
<< static_cast<int>(portId) << ". Switch name: "
<< iter->second.switchName().value_or("unknown")
<< " Port name: "
<< iter->second.portName().value_or("unknown");
}
} else {
XLOG(DBG2) << "Adding new entry for port ID " << static_cast<int>(portId);
iter = currentNeighborConnectivity_.insert({portId, hwEndpoint}).first;
}

if (!old || (old != iter->second)) {
XLOG(DBG5) << "Connectivity changed on port ID " << static_cast<int>(portId)
<< ". Processing delta.";
delta = multiswitch::FabricConnectivityDelta();
if (old.has_value()) {
delta->oldConnectivity() = *old;
}
delta->newConnectivity() = iter->second;
} else {
XLOG(DBG5) << "No connectivity change on port ID "
<< static_cast<int>(portId) << ".";
}

return delta;
}

Expand Down
11 changes: 11 additions & 0 deletions fboss/agent/hw/sai/switch/npu/SaiSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,24 @@ void SaiSwitch::updateStatsImpl() {
auto delta = fabricConnectivityManager_->processConnectivityInfoForPort(
portsIter->second.portID, *endpointOpt);
if (delta) {
XLOG(DBG5) << "Connectivity delta found for port ID "
<< portsIter->second.portID;
connectivityDelta.insert({portsIter->second.portID, *delta});
} else {
XLOG(DBG5) << "No connectivity delta for port ID "
<< portsIter->second.portID;
}
if (fabricConnectivityManager_->isConnectivityInfoMissing(
portsIter->second.portID)) {
missingCount++;
XLOG(DBG5) << "Connectivity missing for port ID "
<< portsIter->second.portID;
}
if (fabricConnectivityManager_->isConnectivityInfoMismatch(
portsIter->second.portID)) {
mismatchCount++;
XLOG(DBG5) << "Connectivity mismatch for port ID "
<< portsIter->second.portID;
}
}
managerTable_->portManager().updateStats(
Expand Down Expand Up @@ -138,6 +147,8 @@ void SaiSwitch::updateStatsImpl() {
reportAsymmetricTopology();
reportInterPortGroupCableSkew();
if (!connectivityDelta.empty()) {
XLOG(DBG2)
<< "Connectivity delta is not empty. Sending callback to SwSwitch";
linkConnectivityChangeBottomHalfEventBase_.runInFbossEventBaseThread(
[this, connectivityDelta = std::move(connectivityDelta)] {
linkConnectivityChanged(connectivityDelta);
Expand Down

0 comments on commit 58f97dc

Please sign in to comment.