From b1ad26eb8839e57bf3064c4e000011aa3e761eff Mon Sep 17 00:00:00 2001 From: Duncan Eastoe Date: Fri, 11 Dec 2020 11:03:53 +0000 Subject: [PATCH] zebra: dplane API to get provider output q length Returns the current number of (completed) contexts in the provider's output queue (dp_ctx_out_q), allowing access to this data from the provider itself. Signed-off-by: Duncan Eastoe (cherry picked from commit 53706b4e5114e18a68ad3ab2a4cd9ca9433e4cb2) --- zebra/zebra_dplane.c | 6 ++++++ zebra/zebra_dplane.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index abd0adb64e..c094a8e3f7 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -3643,6 +3643,12 @@ int dplane_provider_dequeue_in_list(struct zebra_dplane_provider *prov, return ret; } +uint32_t dplane_provider_out_ctx_queue_len(struct zebra_dplane_provider *prov) +{ + return atomic_load_explicit(&(prov->dp_out_counter), + memory_order_relaxed); +} + /* * Enqueue and maintain associated counter */ diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h index 1d852b1bac..55e2d47b75 100644 --- a/zebra/zebra_dplane.h +++ b/zebra/zebra_dplane.h @@ -715,6 +715,9 @@ struct zebra_dplane_ctx *dplane_provider_dequeue_in_ctx( int dplane_provider_dequeue_in_list(struct zebra_dplane_provider *prov, struct dplane_ctx_q *listp); +/* Current completed work queue length */ +uint32_t dplane_provider_out_ctx_queue_len(struct zebra_dplane_provider *prov); + /* Enqueue completed work, maintain associated counter and locking */ void dplane_provider_enqueue_out_ctx(struct zebra_dplane_provider *prov, struct zebra_dplane_ctx *ctx); -- 2.39.5