Skip to content
2 changes: 1 addition & 1 deletion sos-nvdebug.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
batch = yes
log-size = 10
journal_size = 50
plugin_timeout = 2000
plugin_timeout = 2160
cmd_timeout = 300
low_priority = True

Expand Down
2 changes: 1 addition & 1 deletion sos-nvidia.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ batch = yes
log-size = 10
# 50 MB per journalctl capture, 7 days of journal text rarely exceeds this
journal_size = 50
plugin_timeout = 2000
plugin_timeout = 2160
cmd_timeout = 300
low_priority = True

Expand Down
13 changes: 13 additions & 0 deletions sos/report/mellanox_firmware_suite/collectors/collector_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from .system_collector import SystemCollector
from .firmware_collector import FirmwareCollector
from .cable_collector import CableCollector
from .pcc_collector import PccCollector
from .doca_pcc_collector import DocaPccCollector


class CollectorManager(object):
Expand All @@ -12,6 +14,7 @@ def collect_all(self):
self.collect_system_info()
self.collect_firmware_info()
self.collect_cable_info()
self.collect_pcc_info()

def collect_system_info(self):
for ctx in self.device_contexts:
Expand All @@ -26,3 +29,13 @@ def collect_firmware_info(self):
def collect_cable_info(self):
for ctx in self.device_contexts:
CableCollector().run(self.plugin, ctx)

def collect_pcc_info(self):
if not self.plugin.get_option("pcc", default=False):
return

for ctx in self.device_contexts:
PccCollector().run(self.plugin, ctx)

for ctx in self.device_contexts:
DocaPccCollector().run(self.plugin, ctx)
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os
import re


class DocaPccCollector(object):
_TOOL_PATH = "/opt/mellanox/doca/tools/pcc_counters.sh"
_OUTPUT_SUBDIR = "pcc_info/doca_pcc_counters"

# sw_dev_id values embedded in MST device names for supported devices:
# ConnectX6DX: 4125 (/dev/mst/mt4125_*)
# ConnectX7: 4129 (/dev/mst/mt4129_*)
# BlueField3: 41692 (/dev/mst/mt41692_*)
_SUPPORTED_DEV_IDS = frozenset({"4125", "4129", "41692"})
_MST_DEV_ID_RE = re.compile(r"/dev/mst/mt(\d+)_")

def _is_supported_device(self, mst_device):
match = self._MST_DEV_ID_RE.search(mst_device)
return match is not None and match.group(1) in self._SUPPORTED_DEV_IDS

def run(self, plugin, ctx):
if not ctx.primary:
return

if ctx.mst_device is None:
plugin._log_info(
f"doca_pcc: skipping {ctx.pci} — no MST device path available"
)
return

if not self._is_supported_device(ctx.mst_device):
plugin._log_info(
f"doca_pcc: skipping {ctx.pci} — "
f"{ctx.mst_device!r} is not a supported device"
)
return

if not os.path.isfile(self._TOOL_PATH):
plugin._log_info(
f"doca_pcc: {self._TOOL_PATH} not found; skipping collection"
)
return

self._collect(plugin, ctx)

def _collect(self, plugin, ctx):
mst_dev = ctx.mst_device

result = plugin.exec_cmd(cmd=f"{self._TOOL_PATH} set {mst_dev}")
rc = result.get("status", 1)

if rc != 0:
plugin._log_info(
f"doca_pcc: setting counters failed for {mst_dev} (rc={rc}); "
"skipping query"
)
return
Comment thread
DanGoldberg marked this conversation as resolved.
Outdated

filename = f"pcc_counters_{ctx.bdf}_query"

plugin._collect_cmd_output(
cmd=f"{self._TOOL_PATH} query {mst_dev}",
suggest_filename=filename,
subdir=self._OUTPUT_SUBDIR,
stderr=True,
)
Loading
Loading