[PATCH i-g-t v2 23/39] lib/chamelium/v3: Log port mapping for debugging purposes

Louis Chauvet louis.chauvet at bootlin.com
Tue Jul 9 15:34:39 UTC 2024


Port mapping is crucial information when attempting to understand why a
test is failing, as issues may arise from incorrect mapping. This commit
adds logging of the actual port mapping to aid in debugging and problem
resolution.

Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
 lib/chamelium/v3/igt_chamelium.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/lib/chamelium/v3/igt_chamelium.c b/lib/chamelium/v3/igt_chamelium.c
index e5a6a438924d..d528b40ca0c7 100644
--- a/lib/chamelium/v3/igt_chamelium.c
+++ b/lib/chamelium/v3/igt_chamelium.c
@@ -186,6 +186,27 @@ static void chamelium_v3_fill_port_mapping_from_config_v2(struct igt_chamelium_v
 	free(group_list);
 }
 
+/**
+ * chamelium_v3_port_mapping_info_list() - Display the current configured port mapping for the
+ *	chamelium
+ *
+ * @chamelium: chamelium to read the port mapping from
+ */
+static void chamelium_v3_port_mapping_info_list(struct igt_list_head *head)
+{
+	struct chamelium_v3_port_mapping *tmp, *pos;
+
+	igt_list_for_each_entry_safe(pos, tmp, head, link) {
+		if (pos->mst_path)
+			igt_info("\t%s: port_id=%d parent_id=%d is_children=%d\n",
+				 pos->mst_path, pos->port_id, pos->parent_id, pos->is_children);
+		else
+			igt_info("\t%s: port_id=%d parent_id=%d is_children=%d\n",
+				 pos->connector_name, pos->port_id, pos->parent_id,
+				 pos->is_children);
+	}
+}
+
 /**
  * chamelium_v3_fill_port_mapping() - Read the configuration file and fill the port_mapping
  *	structure.
@@ -196,6 +217,8 @@ void chamelium_v3_fill_port_mapping(struct igt_chamelium_v3 *chamelium)
 {
 	if (igt_key_file)
 		chamelium_v3_fill_port_mapping_from_config_v2(chamelium);
+
+	chamelium_v3_port_mapping_info_list(&chamelium->port_mapping);
 }
 
 /**

-- 
2.44.2



More information about the igt-dev mailing list