]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
955bfd98 PZ |
2 | /* |
3 | * BGP Label Pool - Manage label chunk allocations from zebra asynchronously | |
4 | * | |
5 | * Copyright (C) 2018 LabN Consulting, L.L.C. | |
955bfd98 PZ |
6 | */ |
7 | ||
8 | #ifndef _FRR_BGP_LABELPOOL_H | |
9 | #define _FRR_BGP_LABELPOOL_H | |
10 | ||
11 | #include <zebra.h> | |
12 | ||
13 | #include "mpls.h" | |
14 | ||
15 | /* | |
16 | * Types used in bgp_lp_get for debug tracking; add more as needed | |
17 | */ | |
18 | #define LP_TYPE_VRF 0x00000001 | |
57592a53 | 19 | #define LP_TYPE_BGP_LU 0x00000002 |
955bfd98 | 20 | |
960b9a53 | 21 | PREDECL_LIST(lp_fifo); |
41397f2e | 22 | |
955bfd98 PZ |
23 | struct labelpool { |
24 | struct skiplist *ledger; /* all requests */ | |
25 | struct skiplist *inuse; /* individual labels */ | |
26 | struct list *chunks; /* granted by zebra */ | |
41397f2e | 27 | struct lp_fifo_head requests; /* blocked on zebra */ |
955bfd98 PZ |
28 | struct work_queue *callback_q; |
29 | uint32_t pending_count; /* requested from zebra */ | |
e3ea6503 | 30 | uint32_t reconnect_count; /* zebra reconnections */ |
80853c2e | 31 | uint32_t next_chunksize; /* request this many labels */ |
955bfd98 PZ |
32 | }; |
33 | ||
cd9d0537 | 34 | extern void bgp_lp_init(struct event_loop *master, struct labelpool *pool); |
955bfd98 PZ |
35 | extern void bgp_lp_finish(void); |
36 | extern void bgp_lp_get(int type, void *labelid, | |
37 | int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated)); | |
38 | extern void bgp_lp_release(int type, void *labelid, mpls_label_t label); | |
39 | extern void bgp_lp_event_chunk(uint8_t keep, uint32_t first, uint32_t last); | |
40 | extern void bgp_lp_event_zebra_down(void); | |
41 | extern void bgp_lp_event_zebra_up(void); | |
e3ea6503 | 42 | extern void bgp_lp_vty_init(void); |
955bfd98 PZ |
43 | |
44 | #endif /* _FRR_BGP_LABELPOOL_H */ |