Skip to content

Commit

Permalink
routing: add nexthop module.
Browse files Browse the repository at this point in the history
The next-hop module implements a next-hop store of shared next-hop
objects. The model is as follows.

- next-hop objects (type Nhop) are identified by a key (NhopKey),
  which contains the information that uniquely identifies a next-hop.
  The NhopKey object is defined because the next-hop must have
  interior mutability and having a specific type simplifies the code.
- next-hop objects are shared in that many routes may refer to the
  same next-hops. This is to be exploited in two ways.
    1) by storing next-hop information once, thereby saving memory.
    2) since next-hops are shared, their resolution may be greatly
       expedited. E.g. if 10K routes share the same next-hop, a
       single resolution is needed (instead of 10k).
- sharing is accomplished with multiple ownership, storing Nhops
  wrapped into an Rc<> that gets cloned (refcounted) by every
  route using it.
- The speedup/caching in resolution, which may not be initially
  exploited as the resolution itself is external to this module,
  may be achieved by allowing Nhops to have 'resolving' references
  to other next-hops such that, once a next-hop is resolved, any
  other next-hop referring to (resolving via) it may be
  automatically resolved. This way, to resolve 10K routes, a single
  next-hop may be resolved and, to resolve that single next-hop,
  a small update to its references may produce the same effect
  instead of N LPM operations. None of this is shown in this
  commit but can be inferred.

Signed-off-by: Fredi Raspall <[email protected]>
  • Loading branch information
Fredi-raspall committed Feb 6, 2025
1 parent e17aa05 commit 79ad72e
Show file tree
Hide file tree
Showing 2 changed files with 616 additions and 0 deletions.
1 change: 1 addition & 0 deletions routing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ mod adjacency;
mod encapsulation;
mod errors;
mod interface;
mod nexthop;
mod prefix;
mod rmac;
Loading

0 comments on commit 79ad72e

Please sign in to comment.