]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
8ef0791c | 2 | /* |
165b5fff JB |
3 | * BGP Multipath |
4 | * Copyright (C) 2010 Google Inc. | |
5 | * | |
6 | * This file is part of Quagga | |
165b5fff JB |
7 | */ |
8 | ||
0cf4a768 DS |
9 | #ifndef _FRR_BGP_MPATH_H |
10 | #define _FRR_BGP_MPATH_H | |
165b5fff | 11 | |
18ee8310 | 12 | /* Supplemental information linked to bgp_path_info for keeping track of |
de8d5dff JB |
13 | * multipath selections, lazily allocated to save memory |
14 | */ | |
4b7e6066 | 15 | struct bgp_path_info_mpath { |
d62a17ae | 16 | /* Points to the first multipath (on bestpath) or the next multipath */ |
4b7e6066 | 17 | struct bgp_path_info_mpath *mp_next; |
de8d5dff | 18 | |
d62a17ae | 19 | /* Points to the previous multipath or NULL on bestpath */ |
4b7e6066 | 20 | struct bgp_path_info_mpath *mp_prev; |
de8d5dff | 21 | |
18ee8310 | 22 | /* Points to bgp_path_info associated with this multipath info */ |
4b7e6066 | 23 | struct bgp_path_info *mp_info; |
de8d5dff | 24 | |
d62a17ae | 25 | /* When attached to best path, the number of selected multipaths */ |
50346a98 | 26 | uint16_t mp_count; |
27 | ||
28 | /* Flags - relevant as noted. */ | |
29 | uint16_t mp_flags; | |
f7e1c681 | 30 | #define BGP_MP_LB_PRESENT 0x1 /* Link-bandwidth present for >= 1 path */ |
31 | #define BGP_MP_LB_ALL 0x2 /* Link-bandwidth present for all multipaths */ | |
0b597ef0 | 32 | |
d62a17ae | 33 | /* Aggregated attribute for advertising multipath route */ |
34 | struct attr *mp_attr; | |
50346a98 | 35 | |
36 | /* Cumulative bandiwdth of all multipaths - attached to best path. */ | |
37 | uint64_t cum_bw; | |
de8d5dff JB |
38 | }; |
39 | ||
165b5fff | 40 | /* Functions to support maximum-paths configuration */ |
aa53c036 DS |
41 | extern int bgp_maximum_paths_set(struct bgp *bgp, afi_t afi, safi_t safi, |
42 | int peertype, uint16_t maxpaths, | |
43 | bool clusterlen); | |
0cf4a768 DS |
44 | extern int bgp_maximum_paths_unset(struct bgp *bgp, afi_t afi, safi_t safi, |
45 | int peertype); | |
165b5fff | 46 | |
96450faf JB |
47 | /* Functions used by bgp_best_selection to record current |
48 | * multipath selections | |
49 | */ | |
40381db7 DS |
50 | extern int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1, |
51 | struct bgp_path_info *bpi2); | |
0cf4a768 DS |
52 | extern void bgp_mp_list_init(struct list *mp_list); |
53 | extern void bgp_mp_list_clear(struct list *mp_list); | |
4b7e6066 DS |
54 | extern void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo); |
55 | extern void bgp_mp_dmed_deselect(struct bgp_path_info *dmed_best); | |
4378495a | 56 | extern void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest, |
18ee8310 DS |
57 | struct bgp_path_info *new_best, |
58 | struct bgp_path_info *old_best, | |
59 | struct list *mp_list, | |
60 | struct bgp_maxpaths_cfg *mpath_cfg); | |
61 | extern void | |
62 | bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best, | |
63 | struct bgp_path_info *old_best); | |
de8d5dff | 64 | |
18ee8310 DS |
65 | /* Unlink and free multipath information associated with a bgp_path_info */ |
66 | extern void bgp_path_info_mpath_dequeue(struct bgp_path_info *path); | |
67 | extern void bgp_path_info_mpath_free(struct bgp_path_info_mpath **mpath); | |
de8d5dff JB |
68 | |
69 | /* Walk list of multipaths associated with a best path */ | |
18ee8310 DS |
70 | extern struct bgp_path_info * |
71 | bgp_path_info_mpath_first(struct bgp_path_info *path); | |
72 | extern struct bgp_path_info * | |
73 | bgp_path_info_mpath_next(struct bgp_path_info *path); | |
de8d5dff JB |
74 | |
75 | /* Accessors for multipath information */ | |
18ee8310 DS |
76 | extern uint32_t bgp_path_info_mpath_count(struct bgp_path_info *path); |
77 | extern struct attr *bgp_path_info_mpath_attr(struct bgp_path_info *path); | |
f7e1c681 | 78 | extern bool bgp_path_info_mpath_chkwtd(struct bgp *bgp, |
79 | struct bgp_path_info *path); | |
4e30bc2b | 80 | extern uint64_t bgp_path_info_mpath_cumbw(struct bgp_path_info *path); |
96450faf | 81 | |
0cf4a768 | 82 | #endif /* _FRR_BGP_MPATH_H */ |