]>
git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_mpath.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2010 Google Inc.
6 * This file is part of Quagga
9 #ifndef _FRR_BGP_MPATH_H
10 #define _FRR_BGP_MPATH_H
12 /* Supplemental information linked to bgp_path_info for keeping track of
13 * multipath selections, lazily allocated to save memory
15 struct bgp_path_info_mpath
{
16 /* Points to the first multipath (on bestpath) or the next multipath */
17 struct bgp_path_info_mpath
*mp_next
;
19 /* Points to the previous multipath or NULL on bestpath */
20 struct bgp_path_info_mpath
*mp_prev
;
22 /* Points to bgp_path_info associated with this multipath info */
23 struct bgp_path_info
*mp_info
;
25 /* When attached to best path, the number of selected multipaths */
28 /* Flags - relevant as noted. */
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 */
33 /* Aggregated attribute for advertising multipath route */
36 /* Cumulative bandiwdth of all multipaths - attached to best path. */
40 /* Functions to support maximum-paths configuration */
41 extern int bgp_maximum_paths_set(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
42 int peertype
, uint16_t maxpaths
,
44 extern int bgp_maximum_paths_unset(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
47 /* Functions used by bgp_best_selection to record current
48 * multipath selections
50 extern int bgp_path_info_nexthop_cmp(struct bgp_path_info
*bpi1
,
51 struct bgp_path_info
*bpi2
);
52 extern void bgp_mp_list_init(struct list
*mp_list
);
53 extern void bgp_mp_list_clear(struct list
*mp_list
);
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
);
56 extern void bgp_path_info_mpath_update(struct bgp
*bgp
, struct bgp_dest
*dest
,
57 struct bgp_path_info
*new_best
,
58 struct bgp_path_info
*old_best
,
60 struct bgp_maxpaths_cfg
*mpath_cfg
);
62 bgp_path_info_mpath_aggregate_update(struct bgp_path_info
*new_best
,
63 struct bgp_path_info
*old_best
);
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
);
69 /* Walk list of multipaths associated with a best path */
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
);
75 /* Accessors for multipath information */
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
);
78 extern bool bgp_path_info_mpath_chkwtd(struct bgp
*bgp
,
79 struct bgp_path_info
*path
);
80 extern uint64_t bgp_path_info_mpath_cumbw(struct bgp_path_info
*path
);
82 #endif /* _FRR_BGP_MPATH_H */