freebsd-skq/lib/libc
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
..
aarch64 Attach the cortex strings library to the build. Only a subset of functions 2016-09-19 15:08:03 +00:00
amd64 Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
arm Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
capability
compat-43
db Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
gdtoa
gen Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
gmon Replace the last non-optional use of sbrk() in the tree with mmap(). 2016-01-21 18:17:19 +00:00
i386 Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
iconv citrus: Remove redundant code in _citrus_esdb_get_list(). 2016-06-02 17:28:39 +00:00
include Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit. 2017-01-07 16:05:19 +00:00
inet Update ^/vendor/NetBSD/tests/dist to a more recent snapshot 2016-08-12 01:05:07 +00:00
isc libc: do not include <sys/types.h> where <sys/param.h> was already included 2016-04-18 21:05:15 +00:00
locale Move __hidden attribute towards the end of the declaration. 2016-12-31 15:30:00 +00:00
md
mips Add full softfloat and hardfloat support for MIPS. 2016-10-31 15:33:58 +00:00
nameser libc: spelling fixes. 2016-04-30 01:24:24 +00:00
net Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
nls Use current locale (f.e. set by thread). It was global locale always 2016-08-24 16:44:27 +00:00
posix1e libc: spelling fixes. 2016-04-30 01:24:24 +00:00
powerpc Fix a typo which broke the build for powerpc. 2016-10-25 01:32:35 +00:00
powerpc64 Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
powerpcspe Fix a copy&paste-o causing a segfault with sigsetjmp. 2016-10-29 01:22:55 +00:00
quad
regex Use SRCTOP where possible and use :H to manipulate .CURDIR to get rid of 2017-01-17 03:58:37 +00:00
resolv Don't leak addrinfo if ai->ai_addrlen <= minsiz test fails. 2016-06-08 09:40:06 +00:00
riscv Add full softfloat and hardfloat support for RISC-V. 2016-11-16 15:21:32 +00:00
rpc Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
secure libc: do not include <sys/types.h> where <sys/param.h> was already included 2016-04-18 21:05:15 +00:00
softfloat Add full softfloat and hardfloat support for RISC-V. 2016-11-16 15:21:32 +00:00
sparc64 Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
stdio Revert r310138 2016-12-22 22:30:42 +00:00
stdlib Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit. 2017-01-07 16:05:19 +00:00
stdtime 1) For already non-standard %z extension implement GNU compatible formats: 2016-09-21 15:47:40 +00:00
string Commit updates accepted upstream (NetBSD) 2017-01-12 07:21:56 +00:00
sys Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
tests Upgrade NetBSD tests to 01.11.2017_23.20 snapshot 2017-01-13 03:33:57 +00:00
uuid libc: replace 0 with NULL for pointers. 2016-04-10 19:33:58 +00:00
x86/sys __vdso_gettc(): be extra careful with /dev/hpet mappings, never unmap 2017-01-04 16:10:52 +00:00
xdr libc/xdr: unsign some loop indexes. 2016-05-06 16:03:40 +00:00
yp Use on crypto.x and rpc.x from the source tree. 2016-06-28 19:53:16 +00:00
libc_nossp.ldscript Add different libc ldscript: the one without libssp -- 2016-10-12 13:19:21 +00:00
libc.ldscript
Makefile Add full softfloat and hardfloat support for RISC-V. 2016-11-16 15:21:32 +00:00
Makefile.depend DIRDEPS_BUILD: Regenerate without local dependencies. 2016-02-24 17:20:11 +00:00
Versions.def Create namespace for the symbols added during 12-CURRENT cycle. 2016-08-06 13:28:58 +00:00