Skip to content
  • Alexander V. Chernikov's avatar
    Convert route caching to nexthop caching. · 983066f0
    Alexander V. Chernikov authored
    This change is build on top of nexthop objects introduced in r359823.
    
    Nexthops are separate datastructures, containing all necessary information
     to perform packet forwarding such as gateway interface and mtu. Nexthops
     are shared among the routes, providing more pre-computed cache-efficient
     data while requiring less memory. Splitting the LPM code and the attached
     data solves multiple long-standing problems in the routing layer,
     drastically reduces the coupling with outher parts of the stack and allows
     to transparently introduce faster lookup algorithms.
    
    Route caching was (re)introduced to minimise (slow) routing lookups, allowing
     for notably better performance for large TCP senders. Caching works by
     acquiring rtentry reference, which is protected by per-rtentry mutex.
     If the routing table is changed (checked by comparing the rtable generation id)
     or link goes down, cache record gets withdrawn.
    
    Nexthops have the same reference counting interface, backed by refcount(9).
    This change merely replaces rtentry with the actual forwarding nextop as a
     cached object, which is mostly mechanical. Other moving parts like cache
     cleanup on rtable change remains the same.
    
    Differential Revision:	https://reviews.freebsd.org/D24340
    983066f0