All of lore.kernel.org
 help / color / mirror / Atom feed
* [Accel-config] [PATCH] accel-config: Add API to retrieve wq occupancy attribute
@ 2021-08-11 20:22 ramesh.thomas
  0 siblings, 0 replies; only message in thread
From: ramesh.thomas @ 2021-08-11 20:22 UTC (permalink / raw)
  To: accel-config

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Add API to get wq occupancy

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/lib/libaccel-config.sym |  5 +++++
 accfg/lib/libaccfg.c          | 12 ++++++++++++
 accfg/libaccel_config.h       |  1 +
 3 files changed, 18 insertions(+)

diff --git a/accfg/lib/libaccel-config.sym b/accfg/lib/libaccel-config.sym
index f44a3ca..7d6b396 100644
--- a/accfg/lib/libaccel-config.sym
+++ b/accfg/lib/libaccel-config.sym
@@ -161,3 +161,8 @@ global:
 	accfg_ctx_get_last_error_group;
 	accfg_ctx_get_last_error_engine;
 } LIBACCFG_9;
+
+LIBACCFG_11 {
+global:
+	accfg_wq_get_occupancy;
+} LIBACCFG_10;
diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 5b63b62..f4fc17e 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -2033,6 +2033,18 @@ ACCFG_EXPORT uint64_t accfg_wq_get_max_transfer_size(struct accfg_wq *wq)
 	return wq->max_transfer_size;
 }
 
+ACCFG_EXPORT int accfg_wq_get_occupancy(struct accfg_wq *wq)
+{
+	int dfd;
+	struct accfg_ctx *ctx = accfg_wq_get_ctx(wq);
+
+	dfd = open(wq->wq_path, O_PATH);
+	if (dfd < 0)
+		return -ENXIO;
+
+	return accfg_get_param_long(ctx, dfd, "occupancy");
+}
+
 ACCFG_EXPORT int accfg_wq_get_clients(struct accfg_wq *wq)
 {
 	struct accfg_ctx *ctx = accfg_wq_get_ctx(wq);
diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
index f8b9bf9..92b1da5 100644
--- a/accfg/libaccel_config.h
+++ b/accfg/libaccel_config.h
@@ -277,6 +277,7 @@ uint64_t accfg_wq_get_max_transfer_size(struct accfg_wq *wq);
 int accfg_wq_get_threshold(struct accfg_wq *wq);
 int accfg_wq_get_clients(struct accfg_wq *wq);
 int accfg_wq_get_ats_disable(struct accfg_wq *wq);
+int accfg_wq_get_occupancy(struct accfg_wq *wq);
 int accfg_wq_is_enabled(struct accfg_wq *wq);
 int accfg_wq_set_size(struct accfg_wq *wq, int val);
 int accfg_wq_set_priority(struct accfg_wq *wq, int val);
-- 
2.26.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-11 20:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 20:22 [Accel-config] [PATCH] accel-config: Add API to retrieve wq occupancy attribute ramesh.thomas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.