[Accel-config] [PATCH 2/2] accel-config: Add occupancy attribute to json wq object

ramesh.thomas at intel.com Tue, 10 Aug 2021 22:57:35 -0400
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Add a json object for occupancy attribute in wq properties.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 util/json.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/util/json.c b/util/json.c
index 09d3a10..bd3f1ba 100644
--- a/util/json.c
+++ b/util/json.c
@@ -461,6 +461,13 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
 	if (jobj)
 		json_object_object_add(jaccfg, "ats_disable", jobj);
 
+	int_val = accfg_wq_get_occupancy(wq);
+	if (int_val >= 0) {
+		jobj = json_object_new_int(int_val);
+		if (jobj)
+			json_object_object_add(jaccfg, "occupancy", jobj);
+	}
+
 	if (!(flags & UTIL_JSON_SAVE)) {
 
 		switch (wq_state) {
-- 
2.26.3