diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-05-05 16:37:11 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-05-12 17:34:56 +0200 |
commit | 995d810d08109d8c7eca0d23710a2043711411d9 (patch) | |
tree | dd2b7923bdfd80f49d250d0040399d2d15495422 /zebra | |
parent | Merge pull request #13517 from Keelan10/ospf_ti_lfa-memory-leak (diff) | |
download | frr-995d810d08109d8c7eca0d23710a2043711411d9.tar.xz frr-995d810d08109d8c7eca0d23710a2043711411d9.zip |
zebra: Fix dp_out_queued counter to actually reflect real life
The prov->dp_out_queued counter was never being decremented
when a ctx was pulled off of the list. Let's change it to
accurately reflect real life.
Broken:
janelle.pinkbelly.org# show zebra dplane providers detailed
Zebra dataplane providers:
Kernel (1): in: 330872, q: 0, q_max: 100, out: 330872, q: 330872, q_max: 330872
janelle.pinkbelly.org#
Fixed:
sharpd@janelle:/tmp/topotests$ vtysh -c "show zebra dplane providers detailed"
Zebra dataplane providers:
Kernel (1): in: 221495, q: 0, q_max: 100, out: 221495, q: 0, q_max: 100
sharpd@janelle:/tmp/topotests$
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/zebra_dplane.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index a3b61c904..3653f7152 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -5736,6 +5736,21 @@ void dplane_provider_enqueue_out_ctx(struct zebra_dplane_provider *prov, memory_order_relaxed); } +static struct zebra_dplane_ctx * +dplane_provider_dequeue_out_ctx(struct zebra_dplane_provider *prov) +{ + struct zebra_dplane_ctx *ctx; + + ctx = dplane_ctx_list_pop(&(prov->dp_ctx_out_list)); + if (!ctx) + return NULL; + + atomic_fetch_sub_explicit(&(prov->dp_out_queued), 1, + memory_order_relaxed); + + return ctx; +} + /* * Accessor for provider object */ @@ -6763,7 +6778,7 @@ static void dplane_thread_loop(struct event *event) dplane_provider_lock(prov); while (counter < limit) { - ctx = dplane_ctx_list_pop(&(prov->dp_ctx_out_list)); + ctx = dplane_provider_dequeue_out_ctx(prov); if (ctx) { dplane_ctx_list_add_tail(&work_list, ctx); counter++; |