On Tue, Sep 20, 2022 at 12:20:11PM +0200, Claudio Jeker wrote:
> This is the first step to speed up add-path send. In the add-path all case
> the situation is rather simple and the current way the update is done is
> overly complex.
>
> Right now up_generate_addpath() re-evaluates all prefixes for every
> update. It first marks all Adj-RIB-Out entires stale, does a full update
> and the clears the stale entries.
>
> Now for add-path all this is massive overkill. When all valid paths are
> announced then the system can shortcut by just tracking the path that is
> added / removed / reevaluated (variable newpath, oldpath). All other
> paths in the Adj-RIB-Out are not affected and can remain.
>
> This diff extends rde_generate_updates() and related functions to pass
> newbest, oldbest (the head of the RIB list / best path) and newpath,
> oldpath (the prefix that is altered). One of newpath and oldpath is often
> NULL. Both are only set when a) an update happens b) a prefix needs to be
> reevaluated. Inserts only use newpath, withdraws only oldpath.
>
> If rde_generate_updates() is called with just newbest set and oldbest,
> oldpath, newpath == NULL then this indicates that all prefixes for this
> rib entry need to be reevaluated. This is used for initial table dumps and
> for soft-reconfiguration.
>
> It should be possible to use similar tricks to speed up the other add-path
> cases but it is more complex and less gain there because only a limited
> set of paths are announced.
This all makes sense and reads fine to me.
ok tb.
One typo below
> Index: rde_update.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/rde_update.c,v
> retrieving revision 1.147
> diff -u -p -r1.147 rde_update.c
> --- rde_update.c 1 Sep 2022 13:19:11 -0000 1.147
> +++ rde_update.c 20 Sep 2022 09:30:00 -0000
> @@ -361,6 +361,113 @@ up_generate_addpath(struct filter_head *
> }
> }
>
> +/*
> + * Generate updates for the add-path send all case. Since all prefixes
> + * are distributed just remove old and add new.
> + */
> +void
> +up_generate_addpath_all(struct filter_head *rules, struct rde_peer *peer,
> + struct prefix *best, struct prefix *new, struct prefix *old)
> +{
> + struct filterstate state;
> + struct bgpd_addr addr;
> + struct prefix *p, *next, *head = NULL;
> + uint8_t prefixlen;
> + int all = 0;
> +
> + /*
> + * if old and new are NULL then insert all from best,
> + * clearing all old routes in this progress
> + */
in the process?