Skip to content

Commit

Permalink
bgpd: fix simplify 'pending_count' labelpool value
Browse files Browse the repository at this point in the history
The 'pending_count' value was originally used to store
the asyncronous requests from BGP when requesting label
chunks.

Remove this usage because the requests are synchronous.
Keep the value to store the pending_count errors due to
zebra label manager could not give proper request to BGP.

note: the pending_count value is synced only in the case
where zebra up event happens.

Fixes: 0043eba ("bgpd: Use synchronous way to get labels from Zebra")
Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed Sep 29, 2023
1 parent cae1418 commit 298bea2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bgpd/bgp_labelpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,11 @@ void bgp_lp_get(

if (lp_fifo_count(&lp->requests) > lp->pending_count) {
if (!bgp_zebra_request_label_range(MPLS_LABEL_BASE_ANY,
lp->next_chunksize, true))
lp->next_chunksize, true)) {
lp->pending_count += lp->next_chunksize;
return;
}

lp->pending_count += lp->next_chunksize;
if ((lp->next_chunksize << 1) <= LP_CHUNK_SIZE_MAX)
lp->next_chunksize <<= 1;
}
Expand Down Expand Up @@ -612,8 +613,6 @@ void bgp_lp_event_chunk(uint32_t first, uint32_t last)
* chunk at the head of the list so it is examined first.
*/
listnode_add_head(lp->chunks, chunk);

lp->pending_count -= labelcount;
}

/*
Expand Down Expand Up @@ -663,12 +662,13 @@ void bgp_lp_event_zebra_up(void)
*/
list_delete_all_node(lp->chunks);

if (labels_needed && !bgp_zebra_request_label_range(MPLS_LABEL_BASE_ANY,
labels_needed, true))
if (labels_needed &&
!bgp_zebra_request_label_range(MPLS_LABEL_BASE_ANY, labels_needed,
true)) {
return;

lp->pending_count = labels_needed;

}
if (lp->pending_count >= labels_needed)
lp->pending_count -= labels_needed;
/*
* Invalidate any existing labels and requeue them as requests
*/
Expand Down

0 comments on commit 298bea2

Please sign in to comment.