freebsd-skq/lib
Hans Petter Selasky f3e7afe2d7 Implement kernel support for hardware rate limited sockets.
- Add RATELIMIT kernel configuration keyword which must be set to
enable the new functionality.

- Add support for hardware driven, Receive Side Scaling, RSS aware, rate
limited sendqueues and expose the functionality through the already
established SO_MAX_PACING_RATE setsockopt(). The API support rates in
the range from 1 to 4Gbytes/s which are suitable for regular TCP and
UDP streams. The setsockopt(2) manual page has been updated.

- Add rate limit function callback API to "struct ifnet" which supports
the following operations: if_snd_tag_alloc(), if_snd_tag_modify(),
if_snd_tag_query() and if_snd_tag_free().

- Add support to ifconfig to view, set and clear the IFCAP_TXRTLMT
flag, which tells if a network driver supports rate limiting or not.

- This patch also adds support for rate limiting through VLAN and LAGG
intermediate network devices.

- How rate limiting works:

1) The userspace application calls setsockopt() after accepting or
making a new connection to set the rate which is then stored in the
socket structure in the kernel. Later on when packets are transmitted
a check is made in the transmit path for rate changes. A rate change
implies a non-blocking ifp->if_snd_tag_alloc() call will be made to the
destination network interface, which then sets up a custom sendqueue
with the given rate limitation parameter. A "struct m_snd_tag" pointer is
returned which serves as a "snd_tag" hint in the m_pkthdr for the
subsequently transmitted mbufs.

2) When the network driver sees the "m->m_pkthdr.snd_tag" different
from NULL, it will move the packets into a designated rate limited sendqueue
given by the snd_tag pointer. It is up to the individual drivers how the rate
limited traffic will be rate limited.

3) Route changes are detected by the NIC drivers in the ifp->if_transmit()
routine when the ifnet pointer in the incoming snd_tag mismatches the
one of the network interface. The network adapter frees the mbuf and
returns EAGAIN which causes the ip_output() to release and clear the send
tag. Upon next ip_output() a new "snd_tag" will be tried allocated.

4) When the PCB is detached the custom sendqueue will be released by a
non-blocking ifp->if_snd_tag_free() call to the currently bound network
interface.

Reviewed by:		wblock (manpages), adrian, gallatin, scottl (network)
Differential Revision:	https://reviews.freebsd.org/D3687
Sponsored by:		Mellanox Technologies
MFC after:		3 months
2017-01-18 13:31:17 +00:00
..
atf Don't bake all of CC/CPP/CXX into CFLAGS 2016-09-01 02:42:11 +00:00
clang Reapply 310775, now it also builds correctly if lldb is disabled: 2016-12-30 18:00:31 +00:00
csu Make MIPS startup assembly files use neutral float ABI. 2016-11-16 03:21:49 +00:00
lib80211 [lib80211] add VHT bands and channel flags. 2017-01-07 01:56:10 +00:00
libalias Update libalias and libpam packaged files. 2016-02-05 01:03:38 +00:00
libarchive Build libarchive tests missing in r311899 2017-01-10 22:01:37 +00:00
libauditd First pass through library packaging. 2016-02-04 21:16:35 +00:00
libbegemot First pass through library packaging. 2016-02-04 21:16:35 +00:00
libblacklist DIRDEPS_BUILD: Connect new directories and update dependencies. 2016-06-03 19:25:30 +00:00
libblocksruntime First pass through library packaging. 2016-02-04 21:16:35 +00:00
libbluetooth Improve performance and functionality of the bitstring(3) api 2016-05-04 22:34:11 +00:00
libbsdstat Fix off by one error in index limit calculation 2016-05-16 15:42:59 +00:00
libbsm First pass through library packaging. 2016-02-04 21:16:35 +00:00
libbsnmp Install bsnmpclient(3) as snmp_client_{init,set_host,set_port}(3) 2017-01-01 05:21:08 +00:00
libbz2 First pass through library packaging. 2016-02-04 21:16:35 +00:00
libc Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
libc_nonshared Add META_MODE support. 2015-06-13 19:20:56 +00:00
libc++ Now that external gcc directly natively links to libc++ we can remove 2016-12-10 18:29:39 +00:00
libcalendar First pass through library packaging. 2016-02-04 21:16:35 +00:00
libcam Make do_buff_decode() not read past the end of the buffer. 2017-01-07 09:33:11 +00:00
libcapsicum capsicum_helpers: Add LOOKUP flag 2016-12-16 01:37:44 +00:00
libcasper Set SHLIBDIR before .including src.opts.mk in libcapser services 2016-10-24 14:37:18 +00:00
libclang_rt Update build glue for llvm/clang 3.9.1. 2016-11-26 01:13:53 +00:00
libcom_err First pass through library packaging. 2016-02-04 21:16:35 +00:00
libcompat Fix Coverity CID 978183 Resource leak in rexec(). 2016-05-25 07:26:22 +00:00
libcompiler_rt Update compiler-rt to release_39 branch r288513. Since this contains a 2016-12-02 20:17:41 +00:00
libcrypt Make libcrypt thread-safe. Add crypt_r(3). 2016-08-10 15:16:28 +00:00
libcuse libcuse: make more use of the howmany() macro when available. 2016-04-26 01:20:16 +00:00
libcxxrt libcxxrt: correct mangled "typeinfo name" symbols in Version.map 2016-06-29 11:48:42 +00:00
libdevctl Implement 'devctl clear driver' to undo a previous 'devctl set driver'. 2016-08-29 22:48:36 +00:00
libdevdctl directly create the socket with SOCK_NONBLOCK instead of calling fcntl(2) 2016-10-15 13:16:52 +00:00
libdevinfo MFH 2016-04-04 23:55:32 +00:00
libdevstat First pass through library packaging. 2016-02-04 21:16:35 +00:00
libdpv MFH 2016-03-02 16:14:46 +00:00
libdwarf elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree 2016-04-21 12:58:29 +00:00
libedit When MAKEOBJDIRPREFIX points to a case-insensitive file system, the 2016-09-24 15:11:27 +00:00
libefivar DIRDEPS_BUILD: Connect new dependencies. 2016-11-13 00:11:23 +00:00
libelf elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree 2016-04-21 12:58:29 +00:00
libelftc Install the lib/libelftc manpages 2016-12-17 03:34:51 +00:00
libevent First pass through library packaging. 2016-02-04 21:16:35 +00:00
libexecinfo Update ^/vendor/NetBSD/tests/dist to a more recent snapshot 2016-08-12 01:05:07 +00:00
libexpat First pass through library packaging. 2016-02-04 21:16:35 +00:00
libfetch Fix inverted loop condition which broke multi-line responses to CONNECT. 2016-12-30 14:54:54 +00:00
libfigpar MFH 2016-03-02 16:14:46 +00:00
libgcc_eh libcc_{s,eh}: build without SSP 2016-11-11 23:28:07 +00:00
libgcc_s libgcc_s: add libc DT_NEEDED to fix underlinking 2017-01-13 15:17:25 +00:00
libgeom First pass through library packaging. 2016-02-04 21:16:35 +00:00
libgpio Use GPIOTOGGLE to toggle the pin state instead of read, modify and write. 2016-04-19 15:18:31 +00:00
libgssapi lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libiconv_modules META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host. 2015-11-25 19:10:28 +00:00
libifconfig Mark libifconfig as private until the API/ABI is stable 2016-09-11 17:44:35 +00:00
libipsec IPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets. 2016-11-25 14:44:49 +00:00
libjail Fix libjail reached latest sysctl entry. 2016-10-02 11:56:17 +00:00
libkiconv lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libkvm libkvm - extend a bit the swap statistics field. 2017-01-02 15:12:11 +00:00
libldns First pass through library packaging. 2016-02-04 21:16:35 +00:00
liblzma MFV r311477: xz 5.2.3. 2017-01-06 07:54:53 +00:00
libmagic MFV r308392: file 5.29. 2016-11-07 15:54:47 +00:00
libmd Fix C++ includability of crypto headers with static array sizes 2016-10-18 23:20:49 +00:00
libmemstat Fix buildworld for powerpc. 2016-11-20 06:10:12 +00:00
libmilter MFH 2016-03-02 16:14:46 +00:00
libmp libmp: Fix trivial buffer overrun 2016-05-12 03:53:20 +00:00
libmt Add the density code for LTO-7 to libmt and the mt(1) man page. 2016-05-20 19:30:52 +00:00
libnandfs First pass through library packaging. 2016-02-04 21:16:35 +00:00
libnetbsd Add __BIT and __BITS macros from NetBSD to help support new testcases 2017-01-12 09:01:14 +00:00
libnetgraph First pass through library packaging. 2016-02-04 21:16:35 +00:00
libngatm First pass through library packaging. 2016-02-04 21:16:35 +00:00
libnv Fix style issue in the cnv API. 2016-08-27 13:40:27 +00:00
libopenbsd First pass through library packaging. 2016-02-04 21:16:35 +00:00
libopie First pass through library packaging. 2016-02-04 21:16:35 +00:00
libpam Use compiler driver to build relocatable object 2016-12-29 21:30:52 +00:00
libpathconv This little BSD licensed library has been kicking around for years. 2016-11-23 07:57:52 +00:00
libpcap libpcap: replace comma with semicolon when pertinent. 2016-08-09 19:44:33 +00:00
libpe DIRDEPS_BUILD: Update dependencies. 2016-02-16 02:14:30 +00:00
libpjdlog MFH 2016-03-02 16:14:46 +00:00
libpmc lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libproc Add a reasonable bound on the symbol table index size. 2017-01-05 02:33:10 +00:00
libprocstat Use standard Versions.def for libprocstat. 2017-01-09 11:11:52 +00:00
libradius The NAS-Identifier attribute is a string, not an integer. 2016-05-24 11:44:43 +00:00
librpcsec_gss librpcsec_gss: remove redundant code. 2016-05-11 14:37:33 +00:00
librpcsvc MFH 2016-03-02 16:14:46 +00:00
librss [rss] manpage improvements. 2016-10-23 20:42:32 +00:00
librt Export the mq_getfd_np() symbol from librt.so, which allows to get 2016-10-02 17:02:59 +00:00
librtld_db Fix style bugs and remove trailing whitespace in libproc and librtld_db. 2016-12-06 04:13:02 +00:00
libsbuf First pass through library packaging. 2016-02-04 21:16:35 +00:00
libsdp lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libsm MFH 2016-03-02 16:14:46 +00:00
libsmb First pass through library packaging. 2016-02-04 21:16:35 +00:00
libsmdb MFH 2016-03-02 16:14:46 +00:00
libsmutil MFH 2016-03-02 16:14:46 +00:00
libsqlite3 First pass through library packaging. 2016-02-04 21:16:35 +00:00
libstand remove network mask calculation for Classful network 2017-01-07 23:42:17 +00:00
libstdbuf First pass through library packaging. 2016-02-04 21:16:35 +00:00
libstdthreads First pass through library packaging. 2016-02-04 21:16:35 +00:00
libsysdecode Unbreak lib/libsysdecode after r311568 by decoding MSG_MORETOCOME flag 2017-01-07 07:54:23 +00:00
libtacplus First pass through library packaging. 2016-02-04 21:16:35 +00:00
libtelnet First pass through library packaging. 2016-02-04 21:16:35 +00:00
libthr Upgrade NetBSD tests to 01.11.2017_23.20 snapshot 2017-01-13 03:33:57 +00:00
libthread_db First pass through library packaging. 2016-02-04 21:16:35 +00:00
libucl Use SRCTOP to find the sources of libucl 2016-10-15 13:17:27 +00:00
libufs libufs: Simplify generation number calculation. 2016-05-18 19:59:05 +00:00
libugidfw First pass through library packaging. 2016-02-04 21:16:35 +00:00
libulog First pass through library packaging. 2016-02-04 21:16:35 +00:00
libunbound Upgrade to Unbound 1.5.9. 2016-09-04 12:17:57 +00:00
libusb Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not 2016-10-22 14:37:13 +00:00
libusbhid Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
libutil lib/libutil/kinfo_*: style cleanup 2017-01-09 00:47:23 +00:00
libvgl MFH 2016-04-13 16:19:50 +00:00
libvmmapi Fix possible integer overflow in guest memory bounds checking, which could 2016-12-06 18:50:44 +00:00
libwrap First pass through library packaging. 2016-02-04 21:16:35 +00:00
libxo Submitted by: phil 2016-05-29 01:43:28 +00:00
liby First pass through library packaging. 2016-02-04 21:16:35 +00:00
libypclnt MFH 2016-04-16 02:32:12 +00:00
libz MFV r311279: zlib 1.2.10. 2017-01-04 16:09:08 +00:00
msun Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check 2017-01-15 09:05:26 +00:00
ncurses DIRDEPS_BUILD: Run the staged bootstrap-tools version of build-tools. 2016-05-09 22:21:09 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
Makefile Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
Makefile.inc