]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Fix dp_out_queued counter to actually reflect real life 13520/head
authorDonald Sharp <sharpd@nvidia.com>
Fri, 5 May 2023 14:37:11 +0000 (10:37 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 12 May 2023 18:54:55 +0000 (18:54 +0000)
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>
(cherry picked from commit 995d810d08109d8c7eca0d23710a2043711411d9)

zebra/zebra_dplane.c

index f6f436f39f61b1a5d9401ddc6a78c876e302b860..eb408232ab90a1f34cf5b1c9bd552f0a93a354e5 100644 (file)
@@ -5774,6 +5774,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
  */
@@ -6805,7 +6820,7 @@ static void dplane_thread_loop(struct thread *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++;