[newlib 20/65] Convert route caching to nexthop caching.
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Jul 7 11:58:27 UTC 2022
From: "Alexander V. Chernikov" <melifaro at FreeBSD.org>
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
---
newlib/libc/sys/rtems/include/netinet6/in6.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/newlib/libc/sys/rtems/include/netinet6/in6.h b/newlib/libc/sys/rtems/include/netinet6/in6.h
index f6399eed1..68d4c3e4e 100644
--- a/newlib/libc/sys/rtems/include/netinet6/in6.h
+++ b/newlib/libc/sys/rtems/include/netinet6/in6.h
@@ -265,8 +265,13 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
* IP6 route structure
*/
#if __BSD_VISIBLE
+struct nhop_object;
struct route_in6 {
+#if __FreeBSD_version >= 1300092
+ struct nhop_object *ro_nh;
+#else
struct rtentry *ro_rt;
+#endif
struct llentry *ro_lle;
/*
* ro_prepend and ro_plen are only used for bpf to pass in a
--
2.35.3
More information about the devel
mailing list