]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_mpath.h
*: manual SPDX License ID conversions
[mirror_frr.git] / bgpd / bgp_mpath.h
CommitLineData
8ef0791c 1/*
165b5fff
JB
2 * BGP Multipath
3 * Copyright (C) 2010 Google Inc.
4 *
5 * This file is part of Quagga
6 *
7 * Quagga is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * Quagga is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
896014f4
DL
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
165b5fff
JB
20 */
21
0cf4a768
DS
22#ifndef _FRR_BGP_MPATH_H
23#define _FRR_BGP_MPATH_H
165b5fff 24
18ee8310 25/* Supplemental information linked to bgp_path_info for keeping track of
de8d5dff
JB
26 * multipath selections, lazily allocated to save memory
27 */
4b7e6066 28struct bgp_path_info_mpath {
d62a17ae 29 /* Points to the first multipath (on bestpath) or the next multipath */
4b7e6066 30 struct bgp_path_info_mpath *mp_next;
de8d5dff 31
d62a17ae 32 /* Points to the previous multipath or NULL on bestpath */
4b7e6066 33 struct bgp_path_info_mpath *mp_prev;
de8d5dff 34
18ee8310 35 /* Points to bgp_path_info associated with this multipath info */
4b7e6066 36 struct bgp_path_info *mp_info;
de8d5dff 37
d62a17ae 38 /* When attached to best path, the number of selected multipaths */
50346a98 39 uint16_t mp_count;
40
41 /* Flags - relevant as noted. */
42 uint16_t mp_flags;
f7e1c681 43#define BGP_MP_LB_PRESENT 0x1 /* Link-bandwidth present for >= 1 path */
44#define BGP_MP_LB_ALL 0x2 /* Link-bandwidth present for all multipaths */
0b597ef0 45
d62a17ae 46 /* Aggregated attribute for advertising multipath route */
47 struct attr *mp_attr;
50346a98 48
49 /* Cumulative bandiwdth of all multipaths - attached to best path. */
50 uint64_t cum_bw;
de8d5dff
JB
51};
52
165b5fff 53/* Functions to support maximum-paths configuration */
aa53c036
DS
54extern int bgp_maximum_paths_set(struct bgp *bgp, afi_t afi, safi_t safi,
55 int peertype, uint16_t maxpaths,
56 bool clusterlen);
0cf4a768
DS
57extern int bgp_maximum_paths_unset(struct bgp *bgp, afi_t afi, safi_t safi,
58 int peertype);
165b5fff 59
96450faf
JB
60/* Functions used by bgp_best_selection to record current
61 * multipath selections
62 */
40381db7
DS
63extern int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1,
64 struct bgp_path_info *bpi2);
0cf4a768
DS
65extern void bgp_mp_list_init(struct list *mp_list);
66extern void bgp_mp_list_clear(struct list *mp_list);
4b7e6066
DS
67extern void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo);
68extern void bgp_mp_dmed_deselect(struct bgp_path_info *dmed_best);
4378495a 69extern void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
18ee8310
DS
70 struct bgp_path_info *new_best,
71 struct bgp_path_info *old_best,
72 struct list *mp_list,
73 struct bgp_maxpaths_cfg *mpath_cfg);
74extern void
75bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,
76 struct bgp_path_info *old_best);
de8d5dff 77
18ee8310
DS
78/* Unlink and free multipath information associated with a bgp_path_info */
79extern void bgp_path_info_mpath_dequeue(struct bgp_path_info *path);
80extern void bgp_path_info_mpath_free(struct bgp_path_info_mpath **mpath);
de8d5dff
JB
81
82/* Walk list of multipaths associated with a best path */
18ee8310
DS
83extern struct bgp_path_info *
84bgp_path_info_mpath_first(struct bgp_path_info *path);
85extern struct bgp_path_info *
86bgp_path_info_mpath_next(struct bgp_path_info *path);
de8d5dff
JB
87
88/* Accessors for multipath information */
18ee8310
DS
89extern uint32_t bgp_path_info_mpath_count(struct bgp_path_info *path);
90extern struct attr *bgp_path_info_mpath_attr(struct bgp_path_info *path);
f7e1c681 91extern bool bgp_path_info_mpath_chkwtd(struct bgp *bgp,
92 struct bgp_path_info *path);
4e30bc2b 93extern uint64_t bgp_path_info_mpath_cumbw(struct bgp_path_info *path);
96450faf 94
0cf4a768 95#endif /* _FRR_BGP_MPATH_H */