Skip to content

Commit

Permalink
zebra: Limit queue depth in dplane_fpm_nl
Browse files Browse the repository at this point in the history
The dplane providers have a concept of input queues
and output queues.  These queues are chained together
during normal operation.  The code in zebra also has
a feedback mechanism where the MetaQ will not run when
the first input queue is backed up.  Having the dplane_fpm_nl
code grab all contexts when it is backed up prevents
this system from behaving appropriately.

Modify the code to not add to the dplane_fpm_nl's internal
queue when it is already full.  This will allow the backpressure
to work appropriately in zebra proper.

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Jun 13, 2024
1 parent 00150d2 commit d41ca8a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions zebra/dplane_fpm_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,24 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov)

fnc = dplane_provider_get_data(prov);
limit = dplane_provider_get_work_limit(prov);

cur_queue = atomic_load_explicit(&fnc->counters.ctxqueue_len,
memory_order_relaxed);

if (cur_queue >= (uint64_t)limit) {
if (IS_ZEBRA_DEBUG_FPM)
zlog_debug("%s: Already at a limit(%" PRIu64
") of internal work, hold off",
__func__, cur_queue);
limit = 0;
} else {
if (IS_ZEBRA_DEBUG_FPM)
zlog_debug("%s: current queue is %" PRIu64
", limiting to lesser amount of %" PRIu64,
__func__, cur_queue, limit - cur_queue);
limit -= cur_queue;
}

for (counter = 0; counter < limit; counter++) {
ctx = dplane_provider_dequeue_in_ctx(prov);
if (ctx == NULL)
Expand Down

0 comments on commit d41ca8a

Please sign in to comment.