aboutsummaryrefslogtreecommitdiff
path: root/sys/modules
diff options
context:
space:
mode:
authorMarko Zec <zec@FreeBSD.org>2021-05-05 11:45:52 +0000
committerMarko Zec <zec@FreeBSD.org>2021-06-17 10:07:05 +0000
commit4715d948c593b5bb3d2e2129ed299becec566373 (patch)
tree0465ba7f2c3207dd8c273b13ae08d2c475839368 /sys/modules
parent7da8312f7bf050be4fe436ea66ac46414312ae26 (diff)
downloadsrc-4715d948c593b5bb3d2e2129ed299becec566373.tar.gz
src-4715d948c593b5bb3d2e2129ed299becec566373.zip
Introduce DXR as an IPv4 longest prefix matching / FIB module
DXR maintains compressed lookup structures with a trivial search procedure. A two-stage trie is indexed by the more significant bits of the search key (IPv4 address), while the remaining bits are used for finding the next hop in a sorted array. The tradeoff between memory footprint and search speed depends on the split between the trie and the remaining binary search. The default of 20 bits of the key being used for trie indexing yields good performance (see below) with footprints of around 2.5 Bytes per prefix with current BGP snapshots. Rebuilding lookup structures takes some time, which is compensated for by batching several RIB change requests into a single FIB update, i.e. FIB synchronization with the RIB may be delayed for a fraction of a second. RIB to FIB synchronization, next-hop table housekeeping, and lockless lookup capability is provided by the FIB_ALGO infrastructure. DXR works well on modern CPUs with several MBytes of caches, especially in VMs, where is outperforms other currently available IPv4 FIB algorithms by a large margin. Reviewed by: melifaro MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29821 (cherry picked from commit 2aca58e16f507bfcad127a0865a9d5c75c5eedc3)
Diffstat (limited to 'sys/modules')
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/fib_dxr/Makefile11
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 7574c612f49c..ec5dd9a047c2 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -120,6 +120,7 @@ SUBDIR= \
fdc \
fdescfs \
${_ffec} \
+ ${_fib_dxr} \
filemon \
firewire \
firmware \
@@ -476,6 +477,7 @@ _ipfilter= ipfilter
.if ${MK_INET_SUPPORT} != "no" && ${KERN_OPTS:MFIB_ALGO}
_dpdk_lpm4= dpdk_lpm4
+_fib_dxr= fib_dxr
.endif
.if ${MK_INET6_SUPPORT} != "no" && ${KERN_OPTS:MFIB_ALGO}
diff --git a/sys/modules/fib_dxr/Makefile b/sys/modules/fib_dxr/Makefile
new file mode 100644
index 000000000000..c1a704beb535
--- /dev/null
+++ b/sys/modules/fib_dxr/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+SYSDIR?=${SRCTOP}/sys
+.include "${SYSDIR}/conf/kern.opts.mk"
+
+.PATH: ${SYSDIR}/netinet
+
+KMOD= fib_dxr
+SRCS= in_fib_dxr.c opt_inet.h
+
+.include <bsd.kmod.mk>