aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/uipc_ktls.c
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2020-04-25 09:06:11 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2020-04-25 09:06:11 +0000
commit983066f05bacda3e18aae456e56feb00f70c0b55 (patch)
tree0d49459a664c8afd72259c14574ada801277c7c2 /sys/kern/uipc_ktls.c
parente4a458bb1b31a0893296b17369163bdf4b492835 (diff)
downloadsrc-983066f05bacda3e18aae456e56feb00f70c0b55.tar.gz
src-983066f05bacda3e18aae456e56feb00f70c0b55.zip
Convert route caching to nexthop caching.
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
Notes
Notes: svn path=/head/; revision=360292
Diffstat (limited to 'sys/kern/uipc_ktls.c')
-rw-r--r--sys/kern/uipc_ktls.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c
index 1d96c56265f3..85508cc72cc2 100644
--- a/sys/kern/uipc_ktls.c
+++ b/sys/kern/uipc_ktls.c
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_var.h>
#ifdef RSS
#include <net/netisr.h>
+#include <net/nhop.h>
#include <net/rss_config.h>
#endif
#if defined(INET) || defined(INET6)
@@ -754,7 +755,7 @@ ktls_alloc_snd_tag(struct inpcb *inp, struct ktls_session *tls, bool force,
{
union if_snd_tag_alloc_params params;
struct ifnet *ifp;
- struct rtentry *rt;
+ struct nhop_object *nh;
struct tcpcb *tp;
int error;
@@ -792,12 +793,12 @@ ktls_alloc_snd_tag(struct inpcb *inp, struct ktls_session *tls, bool force,
* enabled after a connection has completed key negotiation in
* userland, the cached route will be present in practice.
*/
- rt = inp->inp_route.ro_rt;
- if (rt == NULL || rt->rt_ifp == NULL) {
+ nh = inp->inp_route.ro_nh;
+ if (nh == NULL) {
INP_RUNLOCK(inp);
return (ENXIO);
}
- ifp = rt->rt_ifp;
+ ifp = nh->nh_ifp;
if_ref(ifp);
params.hdr.type = IF_SND_TAG_TYPE_TLS;