Blame SOURCES/0205-cxl-list-Add-depth-to-port-listings.patch

2eb93d
From 2ceddb91d3a0d70a59242b3a9dab401be6e5c825 Mon Sep 17 00:00:00 2001
2eb93d
From: Dan Williams <dan.j.williams@intel.com>
2eb93d
Date: Fri, 5 Aug 2022 13:38:20 -0700
2eb93d
Subject: [PATCH 205/217] cxl/list: Add 'depth' to port listings
2eb93d
2eb93d
Simplify the task of determining how deep a port is in the hierarchy by
2eb93d
just emitting what libcxl already counted. This is useful for validating
2eb93d
interleave math.
2eb93d
2eb93d
Link: https://lore.kernel.org/r/165973190022.1528532.6351628365510289908.stgit@dwillia2-xfh.jf.intel.com
2eb93d
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2eb93d
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
2eb93d
---
2eb93d
 Documentation/cxl/lib/libcxl.txt | 1 +
2eb93d
 cxl/json.c                       | 4 ++++
2eb93d
 cxl/lib/libcxl.c                 | 5 +++++
2eb93d
 cxl/lib/libcxl.sym               | 1 +
2eb93d
 cxl/libcxl.h                     | 1 +
2eb93d
 5 files changed, 12 insertions(+)
2eb93d
2eb93d
diff --git a/Documentation/cxl/lib/libcxl.txt b/Documentation/cxl/lib/libcxl.txt
2eb93d
index 6756d2f..fd2962a 100644
2eb93d
--- a/Documentation/cxl/lib/libcxl.txt
2eb93d
+++ b/Documentation/cxl/lib/libcxl.txt
2eb93d
@@ -290,6 +290,7 @@ int cxl_port_is_enabled(struct cxl_port *port);
2eb93d
 bool cxl_port_is_root(struct cxl_port *port);
2eb93d
 bool cxl_port_is_switch(struct cxl_port *port);
2eb93d
 bool cxl_port_is_endpoint(struct cxl_port *port);
2eb93d
+int cxl_port_get_depth(struct cxl_port *port);
2eb93d
 bool cxl_port_hosts_memdev(struct cxl_port *port, struct cxl_memdev *memdev);
2eb93d
 int cxl_port_get_nr_dports(struct cxl_port *port);
2eb93d
 ----
2eb93d
diff --git a/cxl/json.c b/cxl/json.c
2eb93d
index c3d9299..63c1751 100644
2eb93d
--- a/cxl/json.c
2eb93d
+++ b/cxl/json.c
2eb93d
@@ -769,6 +769,10 @@ static struct json_object *__util_cxl_port_to_json(struct cxl_port *port,
2eb93d
 	if (jobj)
2eb93d
 		json_object_object_add(jport, "host", jobj);
2eb93d
 
2eb93d
+	jobj = json_object_new_int(cxl_port_get_depth(port));
2eb93d
+	if (jobj)
2eb93d
+		json_object_object_add(jport, "depth", jobj);
2eb93d
+
2eb93d
 	if (!cxl_port_is_enabled(port)) {
2eb93d
 		jobj = json_object_new_string("disabled");
2eb93d
 		if (jobj)
2eb93d
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
2eb93d
index ff85b23..021d59f 100644
2eb93d
--- a/cxl/lib/libcxl.c
2eb93d
+++ b/cxl/lib/libcxl.c
2eb93d
@@ -2417,6 +2417,11 @@ CXL_EXPORT bool cxl_port_is_endpoint(struct cxl_port *port)
2eb93d
 	return port->type == CXL_PORT_ENDPOINT;
2eb93d
 }
2eb93d
 
2eb93d
+CXL_EXPORT int cxl_port_get_depth(struct cxl_port *port)
2eb93d
+{
2eb93d
+	return port->depth;
2eb93d
+}
2eb93d
+
2eb93d
 CXL_EXPORT struct cxl_bus *cxl_port_get_bus(struct cxl_port *port)
2eb93d
 {
2eb93d
 	struct cxl_bus *bus;
2eb93d
diff --git a/cxl/lib/libcxl.sym b/cxl/lib/libcxl.sym
2eb93d
index 385a8f0..8bb91e0 100644
2eb93d
--- a/cxl/lib/libcxl.sym
2eb93d
+++ b/cxl/lib/libcxl.sym
2eb93d
@@ -96,6 +96,7 @@ global:
2eb93d
 	cxl_port_get_parent;
2eb93d
 	cxl_port_is_root;
2eb93d
 	cxl_port_is_switch;
2eb93d
+	cxl_port_get_depth;
2eb93d
 	cxl_port_to_bus;
2eb93d
 	cxl_port_is_endpoint;
2eb93d
 	cxl_port_to_endpoint;
2eb93d
diff --git a/cxl/libcxl.h b/cxl/libcxl.h
2eb93d
index 2498fa1..9fe4e99 100644
2eb93d
--- a/cxl/libcxl.h
2eb93d
+++ b/cxl/libcxl.h
2eb93d
@@ -90,6 +90,7 @@ int cxl_port_is_enabled(struct cxl_port *port);
2eb93d
 struct cxl_port *cxl_port_get_parent(struct cxl_port *port);
2eb93d
 bool cxl_port_is_root(struct cxl_port *port);
2eb93d
 bool cxl_port_is_switch(struct cxl_port *port);
2eb93d
+int cxl_port_get_depth(struct cxl_port *port);
2eb93d
 struct cxl_bus *cxl_port_to_bus(struct cxl_port *port);
2eb93d
 bool cxl_port_is_endpoint(struct cxl_port *port);
2eb93d
 struct cxl_endpoint *cxl_port_to_endpoint(struct cxl_port *port);
2eb93d
-- 
2eb93d
2.27.0
2eb93d