From 366c1d5f295ab6406cc684c28740226c3fab80a6 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Fri, 28 Aug 2026 11:30:57 +0300 Subject: [PATCH] fix(pcie): compare retrain verdict against peer-capped max speed The downstream-capability adjustment lowered f.MaxSpeed/f.MaxWidth to the rate the endpoint supports, but the Degraded verdict still compared the retrained speed against the stale local maxSpeed holding the bridge's own uncapped capability. A Gen5 root port feeding a Gen4 HBA (or a Gen2 NIC) was flagged DEGRADED even though the link ran at the fastest rate the pair supports, failing the PCIe link check on healthy hardware. Keep the local maxSpeed in sync with the peer-capped f.MaxSpeed so both the pre-retrain and post-retrain verdicts use the real target. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Mx6AvuXcJNT7jx3jjWw4hc --- audit/internal/platform/pcie_link_check.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/audit/internal/platform/pcie_link_check.go b/audit/internal/platform/pcie_link_check.go index 262dc15..e4add98 100644 --- a/audit/internal/platform/pcie_link_check.go +++ b/audit/internal/platform/pcie_link_check.go @@ -169,6 +169,12 @@ func retrainAndSamplePCIeDevice(ctx context.Context, verboseLog, bdf string, log f.PortMaxWidth = f.MaxWidth f.MaxSpeed = minPCIeLinkSpeed(f.MaxSpeed, peerSpeed) f.MaxWidth = minPositiveInt(f.MaxWidth, peerWidth) + // The degradation verdict below compares against maxSpeed, so + // it has to track the peer-capped target too — otherwise a + // bridge whose port out-specs its downstream device (e.g. a + // Gen5 root port feeding a Gen4 HBA) is flagged DEGRADED even + // though the link is at the fastest rate the pair supports. + maxSpeed = f.MaxSpeed } }