diff --git a/internal/exporter/reanimator_converter.go b/internal/exporter/reanimator_converter.go index b0fe113..36031b2 100644 --- a/internal/exporter/reanimator_converter.go +++ b/internal/exporter/reanimator_converter.go @@ -718,10 +718,19 @@ func mergeDetailMaps(primary, secondary map[string]any) map[string]any { func canonicalKey(item models.HardwareDevice) string { kind := canonicalMergeKind(item.Kind) + bdf := strings.ToLower(strings.TrimSpace(item.BDF)) + if kind == "pcie-class" && bdf != "" { + // BDF identifies one physical PCI function; prefer it over serial for + // pcie-class devices. Multi-port NICs commonly report the same serial + // (the physical card's serial) across several BDFs/ports — keying on + // serial first would collapse distinct ports into a single record and + // silently drop the others. + return kind + "|bdf:" + bdf + } if sn := normalizedSerial(item.SerialNumber); sn != "" { return kind + "|sn:" + strings.ToLower(sn) } - if bdf := strings.ToLower(strings.TrimSpace(item.BDF)); bdf != "" { + if bdf != "" { return kind + "|bdf:" + bdf } return ""