Skip to content

Commit 8926ac1

Browse files
committed
zebra: Limit queue depth in dplane_fpm_nl
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 <sharpd@nvidia.com>
1 parent 3af381b commit 8926ac1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

zebra/dplane_fpm_nl.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,25 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov)
16781678

16791679
fnc = dplane_provider_get_data(prov);
16801680
limit = dplane_provider_get_work_limit(prov);
1681+
1682+
frr_with_mutex (&fnc->ctxqueue_mutex) {
1683+
cur_queue = dplane_ctx_queue_count(&fnc->ctxqueue);
1684+
}
1685+
1686+
if (cur_queue >= (uint64_t)limit) {
1687+
if (IS_ZEBRA_DEBUG_FPM)
1688+
zlog_debug("%s: Already at a limit(%" PRIu64
1689+
") of internal work, hold off",
1690+
__func__, cur_queue);
1691+
limit = 0;
1692+
} else if (cur_queue != 0) {
1693+
if (IS_ZEBRA_DEBUG_FPM)
1694+
zlog_debug("%s: current queue is %" PRIu64
1695+
", limiting to lesser amount of %" PRIu64,
1696+
__func__, cur_queue, limit - cur_queue);
1697+
limit -= cur_queue;
1698+
}
1699+
16811700
for (counter = 0; counter < limit; counter++) {
16821701
ctx = dplane_provider_dequeue_in_ctx(prov);
16831702
if (ctx == NULL)

0 commit comments

Comments
 (0)