]>
git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_labelpool.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * BGP Label Pool - Manage label chunk allocations from zebra asynchronously
5 * Copyright (C) 2018 LabN Consulting, L.L.C.
8 #ifndef _FRR_BGP_LABELPOOL_H
9 #define _FRR_BGP_LABELPOOL_H
16 * Types used in bgp_lp_get for debug tracking; add more as needed
18 #define LP_TYPE_VRF 0x00000001
19 #define LP_TYPE_BGP_LU 0x00000002
20 #define LP_TYPE_NEXTHOP 0x00000003
22 PREDECL_LIST(lp_fifo
);
25 struct skiplist
*ledger
; /* all requests */
26 struct skiplist
*inuse
; /* individual labels */
27 struct list
*chunks
; /* granted by zebra */
28 struct lp_fifo_head requests
; /* blocked on zebra */
29 struct work_queue
*callback_q
;
30 uint32_t pending_count
; /* requested from zebra */
31 uint32_t reconnect_count
; /* zebra reconnections */
32 uint32_t next_chunksize
; /* request this many labels */
35 extern void bgp_lp_init(struct event_loop
*master
, struct labelpool
*pool
);
36 extern void bgp_lp_finish(void);
37 extern void bgp_lp_get(int type
, void *labelid
,
38 int (*cbfunc
)(mpls_label_t label
, void *labelid
, bool allocated
));
39 extern void bgp_lp_release(int type
, void *labelid
, mpls_label_t label
);
40 extern void bgp_lp_event_chunk(uint8_t keep
, uint32_t first
, uint32_t last
);
41 extern void bgp_lp_event_zebra_down(void);
42 extern void bgp_lp_event_zebra_up(void);
43 extern void bgp_lp_vty_init(void);
45 #endif /* _FRR_BGP_LABELPOOL_H */