diff mbox series

[ndctl,2/6] cxl/list: Add interleave parameters to decoder listings

Message ID 165973188300.1528532.222988685552982872.stgit@dwillia2-xfh.jf.intel.com
State New, archived
Headers show
Series cxl/test: Add more region ABI validation | expand

Commit Message

Dan Williams Aug. 5, 2022, 8:38 p.m. UTC
Emit interleave_ways and interleave_granularity in decoder output.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 cxl/json.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox series

Patch

diff --git a/cxl/json.c b/cxl/json.c
index ad93413b5f05..36b76d34b4e5 100644
--- a/cxl/json.c
+++ b/cxl/json.c
@@ -466,6 +466,26 @@  struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
 			json_object_object_add(jdecoder, "size", jobj);
 	}
 
+	val = cxl_decoder_get_interleave_ways(decoder);
+	if (val < UINT_MAX) {
+		jobj = json_object_new_int(val);
+		if (jobj)
+			json_object_object_add(jdecoder, "interleave_ways",
+					       jobj);
+
+		/* granularity is a don't care if not interleaving */
+		if (val > 1) {
+			val = cxl_decoder_get_interleave_granularity(decoder);
+			if (val < UINT_MAX) {
+				jobj = json_object_new_int(val);
+				if (jobj)
+					json_object_object_add(
+						jdecoder,
+						"interleave_granularity", jobj);
+			}
+		}
+	}
+
 	if (size == 0) {
 		jobj = json_object_new_string("disabled");
 		if (jobj)