mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-28 14:21:45 +00:00
bgpd: fix label allocation should not be allocated at startup
BGP always asks zebra for a chunk of MPLS label even if it doesn't need it.
Fix this by correcting the rounding up "labels_needed" formula.
Fixes: 80853c2ec7
("bgpd: improve labelpool performance at scale")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
d162d5f6f5
commit
cb86d8e3a4
@ -642,7 +642,11 @@ void bgp_lp_event_zebra_up(void)
|
||||
}
|
||||
|
||||
/* round up */
|
||||
chunks_needed = (labels_needed / lp->next_chunksize) + 1;
|
||||
if (((float)labels_needed / (float)lp->next_chunksize) >
|
||||
(labels_needed / lp->next_chunksize))
|
||||
chunks_needed = (labels_needed / lp->next_chunksize) + 1;
|
||||
else
|
||||
chunks_needed = (labels_needed / lp->next_chunksize);
|
||||
labels_needed = chunks_needed * lp->next_chunksize;
|
||||
|
||||
/*
|
||||
@ -650,8 +654,8 @@ void bgp_lp_event_zebra_up(void)
|
||||
*/
|
||||
list_delete_all_node(lp->chunks);
|
||||
|
||||
if (!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;
|
||||
|
@ -2,5 +2,5 @@
|
||||
"ledger":0,
|
||||
"inUse":0,
|
||||
"requests":0,
|
||||
"labelChunks":1
|
||||
"labelChunks":0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user