DPDK: Fix info fetch for mellanox NICs (#3491)

* Dpdk: add log print for annotation

* Dpdk: fix device_id -> device_info

* Dpdk: move annotation in build before test run
This commit is contained in:
mcgov 2024-10-30 21:30:10 -07:00 коммит произвёл GitHub
Родитель 4b203222e7
Коммит 2627dbcab7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 20 добавлений и 10 удалений

Просмотреть файл

@ -501,7 +501,9 @@ def verify_dpdk_build(
except (NotEnoughMemoryException, UnsupportedOperationException) as err:
raise SkippedException(err)
testpmd = test_kit.testpmd
# annotate testpmd result
if result is not None:
annotate_dpdk_test_result(test_kit, test_result=result, log=log)
# grab a nic and run testpmd
test_nic = node.nics.get_secondary_nic()
@ -517,8 +519,7 @@ def verify_dpdk_build(
assert_that(tx_pps).described_as(
f"TX-PPS ({tx_pps}) should have been greater than 2^20 (~1m) PPS."
).is_greater_than(2**20)
if result is not None:
annotate_dpdk_test_result(test_kit, test_result=result, log=log)
return test_kit
@ -1122,15 +1123,15 @@ def get_node_nic_short_name(node: Node) -> str:
devices = node.tools[Lspci].get_devices_by_type(DEVICE_TYPE_SRIOV)
if node.nics.is_mana_device_present():
return NIC_SHORT_NAMES[NicType.MANA]
for nic_name in [NicType.CX3, NicType.CX4, NicType.CX5]:
if any([str(nic_name) in x.device_id for x in devices]):
non_mana_nics = [NicType.CX3, NicType.CX4, NicType.CX5]
for nic_name in non_mana_nics:
if any([nic_name.value in x.device_info for x in devices]):
return NIC_SHORT_NAMES[nic_name]
# We assert much earlier to enforce that SRIOV is enabled,
# so we should never hit this unless someone is testing a new platform.
# Instead of asserting, just log that the short name was not found.
known_nic_types = ",".join(
map(str, [NicType.CX3, NicType.CX4, NicType.CX5, NicType.MANA])
)
short_names = map(lambda x: x.value, non_mana_nics)
known_nic_types = ",".join(short_names)
found_nic_types = ",".join(map(str, [x.device_id for x in devices]))
node.log.debug(
"Unknown NIC hardware was detected during DPDK test case. "
@ -1141,6 +1142,12 @@ def get_node_nic_short_name(node: Node) -> str:
return found_nic_types
def _format_version_str(version: VersionInfo) -> str:
# get a smaller version string, we don't really care about build
major_minor_patch = [version.major, version.minor, version.patch]
return ".".join([str(x) for x in major_minor_patch if x is not None])
# Add dpdk/rdma/nic info to dpdk test result
# Enables rich reporting, coverage, and issue triage.
def annotate_dpdk_test_result(
@ -1151,16 +1158,19 @@ def annotate_dpdk_test_result(
nic_hw = None
try:
dpdk_version = test_kit.testpmd.get_dpdk_version()
test_result.information["dpdk_version"] = str(dpdk_version)
test_result.information["dpdk_version"] = _format_version_str(dpdk_version)
log.debug(f"Adding dpdk version: {dpdk_version}")
except AssertionError as err:
test_kit.node.log.debug(f"Could not fetch DPDK version info: {str(err)}")
try:
rdma_version = test_kit.rdma_core.get_installed_version()
test_result.information["rdma_version"] = str(rdma_version)
test_result.information["rdma_version"] = _format_version_str(rdma_version)
log.debug(f"Adding rdma version: {rdma_version}")
except AssertionError as err:
test_kit.node.log.debug(f"Could not fetch RDMA version info: {str(err)}")
try:
nic_hw = get_node_nic_short_name(test_kit.node)
test_result.information["nic_hw"] = nic_hw
log.debug(f"Adding nic version: {nic_hw}")
except AssertionError as err:
test_kit.node.log.debug(f"Could not fetch NIC short name: {str(err)}")