From 23ba68b4d22d6eba90299e94043f1cf8f4a84360 Mon Sep 17 00:00:00 2001 From: Ignatious Johnson Date: Sat, 13 Jun 2026 20:49:23 -0400 Subject: [PATCH] fix(pcie): handle unknown PCIe capability IDs without crashing The PCIe collector raised an unhandled ValueError when the config space exposed a capability ID not modeled in CapabilityEnum / ExtendedCapabilityEnum (e.g. 0x2F / IDE on MI300X), aborting the entire PCIe plugin run. - Add ExtendedCapabilityEnum.IDE = 0x2F (Integrity and Data Encryption) - Guard the enum conversion in get_cap_cfg so any unknown cap id is skipped with a warning instead of taking down the whole collection. Fixes #224 Co-authored-by: Cursor --- .../plugins/inband/pcie/pcie_collector.py | 18 ++++++++++++++---- nodescraper/plugins/inband/pcie/pcie_data.py | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/nodescraper/plugins/inband/pcie/pcie_collector.py b/nodescraper/plugins/inband/pcie/pcie_collector.py index eb3bb5f7..624122ec 100755 --- a/nodescraper/plugins/inband/pcie/pcie_collector.py +++ b/nodescraper/plugins/inband/pcie/pcie_collector.py @@ -489,10 +489,20 @@ def get_cap_cfg( for cap_id, cap_addr in cap_data.items(): if cap_id == 0: continue - if cap_addr >= 0x100: - cap_enum: Enum = ExtendedCapabilityEnum(cap_id) - else: - cap_enum = CapabilityEnum(cap_id) + cap_type = ExtendedCapabilityEnum if cap_addr >= 0x100 else CapabilityEnum + try: + cap_enum: Enum = cap_type(cap_id) + except ValueError: + # Unknown / not-yet-modeled capability id. Skip it instead of + # aborting the whole collection so one new cap id can't take + # down the entire PCIe plugin. + self.logger.warning( + "Skipping unknown %s id 0x%X at offset 0x%X", + cap_type.__name__, + cap_id, + cap_addr, + ) + continue cap_cls = self.get_cap_struct(cap_enum) if cap_cls is None: continue diff --git a/nodescraper/plugins/inband/pcie/pcie_data.py b/nodescraper/plugins/inband/pcie/pcie_data.py index 83a03403..70da6375 100644 --- a/nodescraper/plugins/inband/pcie/pcie_data.py +++ b/nodescraper/plugins/inband/pcie/pcie_data.py @@ -157,6 +157,7 @@ class ExtendedCapabilityEnum(Enum): ALT_PROTOCOL = 0x002B # Alternate Protocol Extended Capability SFI = 0x002C # System Firmware Intermediary (SFI)Extended Capability DOE = 0x2E # 0x2e Data Object Exchange + IDE = 0x2F # 0x2f Integrity and Data Encryption (IDE) INT_DOE = 0x30 # 0x30 Integrity and Data Encryption