freebsd-dev/sys/netinet
Marko Zec 2aca58e16f 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.

Synthetic single-thread LPM throughput test method:

kldload test_lookup; kldload dpdk_lpm4; kldload fib_dxr
sysctl net.route.test.run_lps_rnd=N
sysctl net.route.test.run_lps_seq=N

where N is the number of randomly generated keys (IPv4 addresses) which
should be chosen so that each test iteration runs for several seconds.

Each reported score represents the best of three runs, in million
lookups per second (MLPS), for two bechmarks (RND & SEQ) with two FIBs:

host: single interface address, local subnet route + default route
BGP: snapshot from linx.routeviews.org, 887957 prefixes, 496 next hops

Bhyve VM on an Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60 GHz:
inet.algo         host, RND    host, SEQ    BGP, RND    BGP, SEQ
bsearch4             40.6         20.2         N/A         N/A
radix4                7.8          3.8         1.2         0.6
radix4_lockless      18.0          9.0         1.6         0.8
dpdk_lpm4            14.4          5.0        14.6         5.0
dxr                  70.3         34.7        43.0        19.5

Intel(R) Core(TM) i5-5300U CPU @ 2.30 GHz:
inet.algo         host, RND    host, SEQ    BGP, RND    BGP, SEQ
bsearch4             47.0         23.1         N/A         N/A
radix4                8.5          4.2         1.9         1.0
radix4_lockless      19.2          9.5         2.5         1.2
dpdk_lpm4            31.2          9.4        31.6         9.3
dxr                  84.9         41.4        51.7        23.6

Intel(R) Core(TM) i7-4771 CPU @ 3.50 GHz:
inet.algo         host, RND    host, SEQ    BGP, RND    BGP, SEQ
bsearch4             59.5         29.4         N/A         N/A
radix4               10.8          5.5         2.5         1.3
radix4_lockless      24.7         12.0         3.1         1.6
dpdk_lpm4            29.1          9.0        30.2         9.1
dxr                 101.3         49.9        69.8        32.5

AMD Ryzen 7 3700X 8-Core Processor @ 3.60 GHz:
inet.algo         host, RND    host, SEQ    BGP, RND    BGP, SEQ
bsearch4             70.8         35.4         N/A         N/A
radix4               14.4          7.2         2.8         1.4
radix4_lockless      30.2         15.1         3.7         1.8
dpdk_lpm4            29.9          9.0        30.0         8.9
dxr                 163.3         81.5        99.5        44.4

AMD Ryzen 5 5600X 6-Core Processor @ 3.70 GHz:
inet.algo         host, RND    host, SEQ    BGP, RND    BGP, SEQ
bsearch4             93.6         46.7         N/A         N/A
radix4               18.9          9.3         4.3         2.1
radix4_lockless      37.2         18.6         5.3         2.7
dpdk_lpm4            51.8         15.1        51.6        14.9
dxr                 218.2        103.3       114.0        49.0

Reviewed by:	melifaro
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D29821
2021-05-05 13:45:52 +02:00
..
cc tcp: Rename rfc6675_pipe to sack.revised, and enable by default 2021-04-17 14:59:45 +02:00
khelp
libalias Fix for natd(8) sending wrong sequence number after TCP retransmission, 2021-02-22 17:13:58 +01:00
netdump Use zfree() instead of explicit_bzero() and free(). 2020-06-25 20:17:34 +00:00
tcp_stacks tcp: add support for TCP over UDP 2021-04-18 16:16:42 +02:00
accf_data.c Define a module version for accept filter modules. 2020-05-19 18:35:08 +00:00
accf_dns.c Define a module version for accept filter modules. 2020-05-19 18:35:08 +00:00
accf_http.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
dccp.h Add header definition for RFC4340, Datagram Congestion Control Protocol 2020-06-17 13:27:13 +00:00
icmp6.h icmp6: Count packets dropped due to an invalid hop limit 2020-10-19 17:07:19 +00:00
icmp_var.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_ether.c arp/nd: Cope with late calls to iflladdr_event 2021-02-23 13:54:07 +01:00
if_ether.h
igmp_var.h igmp: convert igmpstat to use PCPU counters 2020-11-08 18:49:23 +00:00
igmp.c igmp: Avoid leaking mbuf when source validation fails 2021-01-08 13:32:04 -05:00
igmp.h
in_cksum.c
in_debug.c
in_fib_algo.c Fix IPv4 fib bsearch4() lookup array construction. 2021-01-17 20:32:26 +00:00
in_fib_dxr.c Introduce DXR as an IPv4 longest prefix matching / FIB module 2021-05-05 13:45:52 +02:00
in_fib.c Add modular fib lookup framework. 2020-12-25 11:33:17 +00:00
in_fib.h Refactor fib4/fib6 functions. 2020-11-29 13:41:49 +00:00
in_gif.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
in_jail.c
in_kdtrace.c Separate out SCTP related dtrace code. 2019-10-14 20:32:11 +00:00
in_kdtrace.h Separate out SCTP related dtrace code. 2019-10-14 20:32:11 +00:00
in_mcast.c Always use inp fib in the inp_lookup_mcast_ifp(). 2021-04-10 13:47:49 +00:00
in_pcb.c Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
in_pcb.h tcp_input: always request read-locking of PCB for any pure SYN segment. 2021-04-20 10:02:20 -07:00
in_pcbgroup.c
in_prot.c
in_proto.c capsicum: Limit socket operations in capability mode 2021-04-07 14:32:56 -04:00
in_rmx.c Refactor rib iterator functions. 2020-11-22 20:21:10 +00:00
in_rss.c Implement flowid calculation for outbound connections to balance 2020-10-18 17:15:47 +00:00
in_rss.h Implement flowid calculation for outbound connections to balance 2020-10-18 17:15:47 +00:00
in_systm.h
in_var.h net: remove legacy in_addmulti() 2021-02-25 10:13:52 +01:00
in.c Re-enable network ioctls in capability mode 2021-04-23 09:22:49 -04:00
in.h Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow. 2020-10-09 12:06:43 +00:00
ip6.h net: Introduce IPV6_DSCP(), IPV6_ECN() and IPV6_TRAFFIC_CLASS() macros 2021-03-04 20:56:48 +01:00
ip_carp.c Further refactor IPv4 interface route creation. 2021-01-21 21:48:49 +00:00
ip_carp.h carp: replace caddr_t with char * 2019-12-06 16:35:48 +00:00
ip_divert.c Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
ip_divert.h
ip_dummynet.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
ip_ecn.c
ip_ecn.h
ip_encap.c Widen NET_EPOCH coverage. 2019-10-07 22:40:05 +00:00
ip_encap.h
ip_fastfwd.c ip_fastfwd: style(9) tidy for r367628 2020-11-13 18:25:07 +00:00
ip_fw.h Allow setting alias port ranges in libalias and ipfw. This will allow a system 2021-02-02 13:24:17 -08:00
ip_gre.c Introduce NET_EPOCH_CALL() macro and use it everywhere where we free 2020-01-15 06:05:20 +00:00
ip_icmp.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
ip_icmp.h
ip_id.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
ip_input.c Flush remaining routes from the routing table during VNET shutdown. 2021-03-10 21:10:14 +00:00
ip_mroute.c Revert "SO_RERROR indicates that receive buffer overflows should be handled as errors." 2021-02-08 22:32:32 +00:00
ip_mroute.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
ip_options.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
ip_options.h
ip_output.c Catch up with 6edfd179c8: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG. 2021-01-29 11:46:24 -08:00
ip_reass.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
ip_var.h An earlier commit effectively turned out the fast forwading path 2020-11-12 21:58:47 +00:00
ip.h
pim_var.h
pim.h
raw_ip.c Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
sctp_asconf.c Improve input validation for parameters in ASCONF and ASCONF-ACK chunks 2020-12-23 18:03:47 +01:00
sctp_asconf.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_auth.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_auth.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_bsd_addr.c Don't pass RFPROC to kproc_create(), it is redundant. 2021-03-12 09:48:10 -08:00
sctp_bsd_addr.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_cc_functions.c Minor cleanups. 2020-10-07 15:22:48 +00:00
sctp_constants.h sctp: use RTO.Initial of 1 second as specified in RFC 4960bis 2021-04-30 00:45:56 +02:00
sctp_crc32.c No need to include netinet/sctp_crc32.h twice. 2020-06-22 14:36:14 +00:00
sctp_crc32.h Add the SCTP_SUPPORT kernel option. 2020-06-18 19:32:34 +00:00
sctp_header.h Whitespace changes. 2020-09-24 12:26:06 +00:00
sctp_indata.c sctp: fix a locking issue for old unordered data 2021-01-31 10:46:23 +01:00
sctp_indata.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_input.c sctp: drop packet with SHUTDOWN-ACK chunks with wrong vtags 2021-05-04 18:43:31 +02:00
sctp_input.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_kdtrace.c Separate out SCTP related dtrace code. 2019-10-14 20:32:11 +00:00
sctp_kdtrace.h Separate out SCTP related dtrace code. 2019-10-14 20:32:11 +00:00
sctp_lock_bsd.h Whitespace changes. 2020-09-24 12:26:06 +00:00
sctp_module.c Provide support for building SCTP as a loadable module. 2020-07-10 14:56:05 +00:00
sctp_os_bsd.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_os.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_output.c sctp: improve input validation 2021-01-31 23:46:53 +01:00
sctp_output.h Whitespace changes. 2020-09-24 12:26:06 +00:00
sctp_pcb.c sctp: improve address list scanning 2021-05-03 02:50:05 +02:00
sctp_pcb.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_peeloff.c Non-functional changes due to upstream cleanup. 2020-06-11 13:34:09 +00:00
sctp_peeloff.h
sctp_ss_functions.c Fix a few typos in comments 2021-03-13 16:37:28 +01:00
sctp_structs.h sctp: improve consistency 2021-01-24 00:07:41 +01:00
sctp_syscalls.c Convert remaining cap_rights_init users to cap_rights_init_one 2021-01-12 13:16:10 +00:00
sctp_sysctl.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_sysctl.h Improve the handling of cookie life times. 2020-10-16 10:44:48 +00:00
sctp_timer.c sctp: improve computation of an alternate net 2021-02-21 17:13:06 +01:00
sctp_timer.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_uio.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp_usrreq.c Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
sctp_var.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sctp.h Improve the handling of cookie life times. 2020-10-16 10:44:48 +00:00
sctputil.c sctp: update the vtag for INIT and INIT-ACK chunks 2021-04-30 13:33:16 +02:00
sctputil.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
siftr.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
tcp_debug.c
tcp_debug.h
tcp_fastopen.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
tcp_fastopen.h
tcp_fsm.h White space cleanup -- remove trailing tab's or spaces 2020-02-12 13:31:36 +00:00
tcp_hostcache.c tcp_hostcache: use SMR for lookups, mutex(9) for updates. 2021-04-20 10:02:20 -07:00
tcp_hpts.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
tcp_hpts.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
tcp_input.c tcp: stop spurious rescue retransmissions and potential asserts 2021-04-28 15:01:10 +02:00
tcp_log_buf.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
tcp_log_buf.h Fix some common typos in comments 2021-03-13 18:26:15 +01:00
tcp_lro.c Allow the tcp_lro_flush_all() function to be called when the control 2021-04-24 12:23:42 +02:00
tcp_lro.h Add TCP LRO support for VLAN and VxLAN. 2021-04-20 13:36:22 +02:00
tcp_offload.c Path MTU discovery hooks for offloaded TCP connections. 2021-04-21 13:00:16 -07:00
tcp_offload.h Path MTU discovery hooks for offloaded TCP connections. 2021-04-21 13:00:16 -07:00
tcp_output.c tcp: add support for TCP over UDP 2021-04-18 16:16:42 +02:00
tcp_pcap.c Step 4.2: start divorce of M_EXT and M_EXTPG 2020-05-03 00:37:16 +00:00
tcp_pcap.h
tcp_ratelimit.c Fix LINT kernel builds after 1a714ff204 . 2021-02-01 14:24:15 +01:00
tcp_ratelimit.h Fix LINT kernel builds after 1a714ff204 . 2021-02-01 14:24:15 +01:00
tcp_reass.c Prevent premature SACK block transmission during loss recovery 2020-11-08 18:47:05 +00:00
tcp_sack.c tcp: stop spurious rescue retransmissions and potential asserts 2021-04-28 15:01:10 +02:00
tcp_seq.h
tcp_stats.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
tcp_subr.c Path MTU discovery hooks for offloaded TCP connections. 2021-04-21 13:00:16 -07:00
tcp_syncache.c tcp: add support for TCP over UDP 2021-04-18 16:16:42 +02:00
tcp_syncache.h tcp: add support for TCP over UDP 2021-04-18 16:16:42 +02:00
tcp_timer.c Improve the TCP blackhole detection. The principle is to reduce the 2020-04-14 16:35:05 +00:00
tcp_timer.h kern: net: remove TCP_LINGERTIME 2021-02-18 22:36:01 -06:00
tcp_timewait.c tcp_input: always request read-locking of PCB for any pure SYN segment. 2021-04-20 10:02:20 -07:00
tcp_usrreq.c Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
tcp_var.h Add TCP LRO support for VLAN and VxLAN. 2021-04-20 13:36:22 +02:00
tcp.h tcp: add support for TCP over UDP 2021-04-18 16:16:42 +02:00
tcpip.h
toecore.c Path MTU discovery hooks for offloaded TCP connections. 2021-04-21 13:00:16 -07:00
toecore.h Path MTU discovery hooks for offloaded TCP connections. 2021-04-21 13:00:16 -07:00
udp_usrreq.c Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
udp_var.h Add a knob to allow zero UDP checksums for UDP/IPv6 traffic on the given UDP port. 2020-09-18 02:21:15 +00:00
udp.h White space cleanup -- remove trailing tab's or spaces 2020-02-12 13:31:36 +00:00
udplite.h White space cleanup -- remove trailing tab's or spaces 2020-02-12 13:31:36 +00:00