Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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