Merge pull request #13444 from donaldsharp/fix_dplane_provider_counter

zebra: Fix dp_out_queued counter to actually reflect real life
This commit is contained in:
Mark Stapp 2023-05-12 14:54:13 -04:00 committed by GitHub
commit e8224402cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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++;