On 8/10/2021 7:57 PM, ramesh.thomas(a)intel.com wrote:
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add library implementation of 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 | 2 ++
accfg/lib/private.h | 1 +
accfg/libaccel_config.h | 1 +
4 files changed, 9 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..d41a6b3 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -801,6 +801,7 @@ static void *add_wq(void *parent, int id, const char *wq_base,
wq->max_batch_size = accfg_get_param_long(ctx, dfd, "max_batch_size");
wq->max_transfer_size = accfg_get_param_long(ctx, dfd,
"max_transfer_size");
wq->ats_disable = accfg_get_param_long(ctx, dfd, "ats_disable");
+ wq->occupancy = accfg_get_param_long(ctx, dfd, "occupancy");
We need
to read this value real time. When the user calls it, we need to
read from sysfs directly. We don't need to store it though.
>
> wq_parse_type(wq, wq_type);
> free(wq_type);
> @@ -2452,6 +2453,7 @@ accfg_wq_get_field(wq, threshold)
> accfg_wq_get_field(wq, group_id)
> accfg_wq_get_field(wq, block_on_fault)
> accfg_wq_get_field(wq, ats_disable)
> +accfg_wq_get_field(wq, occupancy)
>
> ACCFG_EXPORT int accfg_wq_set_mode(struct accfg_wq *wq,
> enum accfg_wq_mode wq_mode)
> diff --git a/accfg/lib/private.h b/accfg/lib/private.h
> index 57aa1ed..579fa6b 100644
> --- a/accfg/lib/private.h
> +++ b/accfg/lib/private.h
> @@ -127,6 +127,7 @@ struct accfg_wq {
> unsigned int max_batch_size;
> uint64_t max_transfer_size;
> int ats_disable;
> + int occupancy;
> };
>
> #define ACCFG_EXPORT __attribute__ ((visibility("default")))
> 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);