anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

Blame SOURCES/0202-cxl-list-Add-interleave-parameters-to-decoder-listin.patch

e0018b
From 0ee9ca3f6423a2af8ade983f596274f6fcfe66d6 Mon Sep 17 00:00:00 2001
e0018b
From: Dan Williams <dan.j.williams@intel.com>
e0018b
Date: Fri, 5 Aug 2022 13:38:03 -0700
e0018b
Subject: [PATCH 202/217] cxl/list: Add interleave parameters to decoder
e0018b
 listings
e0018b
e0018b
Emit interleave_ways and interleave_granularity in decoder output.
e0018b
e0018b
Link: https://lore.kernel.org/r/165973188300.1528532.222988685552982872.stgit@dwillia2-xfh.jf.intel.com
e0018b
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
---
e0018b
 cxl/json.c | 20 ++++++++++++++++++++
e0018b
 1 file changed, 20 insertions(+)
e0018b
e0018b
diff --git a/cxl/json.c b/cxl/json.c
e0018b
index 9cec58b..ada1dbe 100644
e0018b
--- a/cxl/json.c
e0018b
+++ b/cxl/json.c
e0018b
@@ -466,6 +466,26 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
e0018b
 			json_object_object_add(jdecoder, "size", jobj);
e0018b
 	}
e0018b
 
e0018b
+	val = cxl_decoder_get_interleave_ways(decoder);
e0018b
+	if (val < UINT_MAX) {
e0018b
+		jobj = json_object_new_int(val);
e0018b
+		if (jobj)
e0018b
+			json_object_object_add(jdecoder, "interleave_ways",
e0018b
+					       jobj);
e0018b
+
e0018b
+		/* granularity is a don't care if not interleaving */
e0018b
+		if (val > 1) {
e0018b
+			val = cxl_decoder_get_interleave_granularity(decoder);
e0018b
+			if (val < UINT_MAX) {
e0018b
+				jobj = json_object_new_int(val);
e0018b
+				if (jobj)
e0018b
+					json_object_object_add(
e0018b
+						jdecoder,
e0018b
+						"interleave_granularity", jobj);
e0018b
+			}
e0018b
+		}
e0018b
+	}
e0018b
+
e0018b
 	if (size == 0) {
e0018b
 		jobj = json_object_new_string("disabled");
e0018b
 		if (jobj)
e0018b
-- 
e0018b
2.27.0
e0018b