summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_mpath.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-09-30 21:09:42 +0200
committerDonald Sharp <sharpd@nvidia.com>2024-10-01 18:25:57 +0200
commit421cf856ef86db250a86be01437d0a668b463dcc (patch)
treea18603ba35a03b081cd2176891982725a898d12b /bgpd/bgp_mpath.h
parenttests: Clean up some logging in test_bgp_default_originate_2links.py (diff)
downloadfrr-421cf856ef86db250a86be01437d0a668b463dcc.tar.xz
frr-421cf856ef86db250a86be01437d0a668b463dcc.zip
bgpd: Cleanup multipath figuring out in bgp
Currently bgp multipath has these properties: a) mp_info may or may not be on a single path, based upon path perturbations in the past. b) mp_info->count started counting at 0( meaning 1 ). As that the bestpath path_info was never included in the count c) The first mp_info in the list held the multipath data associated with the multipath. As such if you were at any other node that data was not filled in. d) As such the mp_info's that are not first on the list basically were just pointers to the corresponding bgp_path_info that was in the multipath. e) On bestpath calculation, a linklist(struct linklist *) of bgp_path_info's was created. f) This linklist was passed in to a comparison function that took the old mpinfo list and compared it item by item to the linklist and doing magic to figure out how to create a new mp_info list. g) the old mp_info and the link list had to be memory managed and freed up. h) BGP_PATH_MULTIPATH is only set on non bestpath nodes in the multipath. This is really complicated. Let's change the algorithm to this: a) When running bestpath, mark a bgp_path_info node that could be in the ecmp path as BGP_PATH_MULTIPATH_NEW. b) When running multipath, just walk the list of bgp_path_info's and if it has BGP_PATH_MULTIPATH_NEW on it, decide if it is in BGP_MULTIPATH. If we run out of space to put in the ecmp, clear the flag on the rest. c) Clean up the counting of sometimes adding 1 to the mpath count. d) Only allocate a mpath_info node for the bestpath. Clean it up when done with it. e) remove the unneeded list management associated with the linklist and the mp_list. This greatly simplifies multipath computation for bgp and reduces memory load for large scale deployments. 2 full feeds in work_queue_run prior: 0 56367.471 1123 50193 493695 50362 493791 0 0 0 TE work_queue_run BGP multipath info : 1941844 48 110780992 1941844 110780992 2 full feeds in work_queue_run after change: 1 52924.931 1296 40837 465968 41025 487390 0 0 1 TE work_queue_run BGP multipath info : 970860 32 38836880 970866 38837120 Aproximately 4 seconds of saved cpu time for convergence and ~75 mb smaller run time. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_mpath.h')
-rw-r--r--bgpd/bgp_mpath.h18
1 files changed, 4 insertions, 14 deletions
diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h
index 267d729e0..a7107deb0 100644
--- a/bgpd/bgp_mpath.h
+++ b/bgpd/bgp_mpath.h
@@ -2,8 +2,9 @@
/*
* BGP Multipath
* Copyright (C) 2010 Google Inc.
+ * 2024 Nvidia Corporation
*
- * This file is part of Quagga
+ * This file is part of FRR
*/
#ifndef _FRR_BGP_MPATH_H
@@ -13,12 +14,6 @@
* multipath selections, lazily allocated to save memory
*/
struct bgp_path_info_mpath {
- /* Points to the first multipath (on bestpath) or the next multipath */
- struct bgp_path_info_mpath *mp_next;
-
- /* Points to the previous multipath or NULL on bestpath */
- struct bgp_path_info_mpath *mp_prev;
-
/* Points to bgp_path_info associated with this multipath info */
struct bgp_path_info *mp_info;
@@ -50,16 +45,11 @@ extern int bgp_maximum_paths_unset(struct bgp *bgp, afi_t afi, safi_t safi,
/* Functions used by bgp_best_selection to record current
* multipath selections
*/
-extern int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1,
- struct bgp_path_info *bpi2);
-extern void bgp_mp_list_init(struct list *mp_list);
-extern void bgp_mp_list_clear(struct list *mp_list);
-extern void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo);
+extern int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1, struct bgp_path_info *bpi2);
extern void bgp_mp_dmed_deselect(struct bgp_path_info *dmed_best);
extern void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
struct bgp_path_info *new_best,
- struct bgp_path_info *old_best,
- struct list *mp_list,
+ struct bgp_path_info *old_best, uint32_t num_candidates,
struct bgp_maxpaths_cfg *mpath_cfg);
extern void
bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,