]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Merge pull request #18497 from krishna-samy/show-metaq-counters
authorMark Stapp <mjs.ietf@gmail.com>
Wed, 16 Apr 2025 13:16:40 +0000 (09:16 -0400)
committerGitHub <noreply@github.com>
Wed, 16 Apr 2025 13:16:40 +0000 (09:16 -0400)
zebra: show command to display metaq info

1  2 
zebra/rib.h
zebra/zebra_rib.c
zebra/zebra_vty.c

diff --cc zebra/rib.h
Simple merge
index e32b004ae9eecebd9edc06ecfa54608d67ac3980,a1975b8e675cb9bd6b88fdefb349d769a2bb901a..c7dc5e5d076f05c3b07b55e62ebb3953854f0082
@@@ -3300,10 -3359,19 +3359,19 @@@ static int rib_meta_queue_add(struct me
        listnode_add(mq->subq[qindex], rn);
        route_lock_node(rn);
        mq->size++;
+       atomic_fetch_add_explicit(&mq->total_metaq, 1, memory_order_relaxed);
+       atomic_fetch_add_explicit(&mq->total_subq[qindex], 1, memory_order_relaxed);
+       curr = listcount(mq->subq[qindex]);
+       high = atomic_load_explicit(&mq->max_subq[qindex], memory_order_relaxed);
+       if (curr > high)
+               atomic_store_explicit(&mq->max_subq[qindex], curr, memory_order_relaxed);
+       high = atomic_load_explicit(&mq->max_metaq, memory_order_relaxed);
+       if (mq->size > high)
+               atomic_store_explicit(&mq->max_metaq, mq->size, memory_order_relaxed);
  
        if (IS_ZEBRA_DEBUG_RIB_DETAILED)
 -              rnode_debug(rn, re->vrf_id, "queued rn %p into sub-queue %s",
 -                          (void *)rn, subqueue2str(qindex));
 +              rnode_debug(rn, re->vrf_id, "queued rn %p into sub-queue %s mq size %u", (void *)rn,
 +                          subqueue2str(qindex), zrouter.mq->size);
  
        return 0;
  }
@@@ -3333,10 -3415,19 +3415,19 @@@ static int rib_meta_queue_nhg_ctx_add(s
  
        listnode_add(mq->subq[qindex], w);
        mq->size++;
+       atomic_fetch_add_explicit(&mq->total_metaq, 1, memory_order_relaxed);
+       atomic_fetch_add_explicit(&mq->total_subq[qindex], 1, memory_order_relaxed);
+       curr = listcount(mq->subq[qindex]);
+       high = atomic_load_explicit(&mq->max_subq[qindex], memory_order_relaxed);
+       if (curr > high)
+               atomic_store_explicit(&mq->max_subq[qindex], curr, memory_order_relaxed);
+       high = atomic_load_explicit(&mq->max_metaq, memory_order_relaxed);
+       if (mq->size > high)
+               atomic_store_explicit(&mq->max_metaq, mq->size, memory_order_relaxed);
  
        if (IS_ZEBRA_DEBUG_RIB_DETAILED)
 -              zlog_debug("NHG Context id=%u queued into sub-queue %s",
 -                         ctx->id, subqueue2str(qindex));
 +              zlog_debug("NHG Context id=%u queued into sub-queue %s mq size %u", ctx->id,
 +                         subqueue2str(qindex), zrouter.mq->size);
  
        return 0;
  }
@@@ -3361,10 -3453,19 +3453,19 @@@ static int rib_meta_queue_nhg_process(s
  
        listnode_add(mq->subq[qindex], w);
        mq->size++;
+       atomic_fetch_add_explicit(&mq->total_metaq, 1, memory_order_relaxed);
+       atomic_fetch_add_explicit(&mq->total_subq[qindex], 1, memory_order_relaxed);
+       curr = listcount(mq->subq[qindex]);
+       high = atomic_load_explicit(&mq->max_subq[qindex], memory_order_relaxed);
+       if (curr > high)
+               atomic_store_explicit(&mq->max_subq[qindex], curr, memory_order_relaxed);
+       high = atomic_load_explicit(&mq->max_metaq, memory_order_relaxed);
+       if (mq->size > high)
+               atomic_store_explicit(&mq->max_metaq, mq->size, memory_order_relaxed);
  
        if (IS_ZEBRA_DEBUG_RIB_DETAILED)
 -              zlog_debug("NHG id=%u queued into sub-queue %s", nhe->id,
 -                         subqueue2str(qindex));
 +              zlog_debug("NHG id=%u queued into sub-queue %s mq size %u", nhe->id,
 +                         subqueue2str(qindex), zrouter.mq->size);
  
        return 0;
  }
@@@ -4227,11 -4334,22 +4339,22 @@@ void _route_entry_dump(const char *func
  
  static int rib_meta_queue_gr_run_add(struct meta_queue *mq, void *data)
  {
+       uint64_t curr, high;
        listnode_add(mq->subq[META_QUEUE_GR_RUN], data);
        mq->size++;
+       atomic_fetch_add_explicit(&mq->total_metaq, 1, memory_order_relaxed);
+       atomic_fetch_add_explicit(&mq->total_subq[META_QUEUE_GR_RUN], 1, memory_order_relaxed);
+       curr = listcount(mq->subq[META_QUEUE_GR_RUN]);
+       high = atomic_load_explicit(&mq->max_subq[META_QUEUE_GR_RUN], memory_order_relaxed);
+       if (curr > high)
+               atomic_store_explicit(&mq->max_subq[META_QUEUE_GR_RUN], curr, memory_order_relaxed);
+       high = atomic_load_explicit(&mq->max_metaq, memory_order_relaxed);
+       if (mq->size > high)
+               atomic_store_explicit(&mq->max_metaq, mq->size, memory_order_relaxed);
  
        if (IS_ZEBRA_DEBUG_RIB_DETAILED)
 -              zlog_debug("Graceful Run adding");
 +              zlog_debug("Graceful Run adding mq size %u", zrouter.mq->size);
  
        return 0;
  }
Simple merge