freebsd-skq/sys
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
..
amd64 Catch up with changes to structure member names. 2017-01-17 22:05:52 +00:00
arm Catch up with changes to structure member names. 2017-01-17 22:05:52 +00:00
arm64 Catch up with changes to structure member names. 2017-01-17 22:05:52 +00:00
boot loader: efi devpath api usage should be more aware of NULL pointers 2017-01-18 08:18:07 +00:00
bsm
cam Remove writing 'residual' field of struct ctl_scsiio. 2017-01-17 18:32:47 +00:00
cddl Use the kernel stack in the ARM FBT DTrace provider. This is used to find 2017-01-18 13:27:24 +00:00
compat Catch up with changes to structure member names. 2017-01-17 22:05:52 +00:00
conf Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
contrib Sync in the latest CloudABI generated source files. 2017-01-17 22:03:08 +00:00
crypto libmd: add noexec stack annotation in skein_block_asm.s 2017-01-07 19:26:25 +00:00
ddb Revert r311952. 2017-01-14 22:06:25 +00:00
dev cxgbe/tom: Fix a case where do_pass_accept_req wasn't properly restoring 2017-01-18 03:35:42 +00:00
fs tmpfs: manage tm_pages_used with atomics 2017-01-14 06:20:36 +00:00
gdb
geom Report random flash storage as non-rotating to GEOM_DISK. 2017-01-12 08:53:10 +00:00
gnu Add Ingenic X1000 DTS files (unofficial). 2016-11-19 15:03:49 +00:00
i386 Catch up with changes to structure member names. 2017-01-17 22:05:52 +00:00
isa
kern Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
kgssapi
libkern libkern: Remove obsolete 'register' keyword 2017-01-12 17:02:29 +00:00
mips [ar71xx] add EARLY_PRINTF support for the rest of the non-AR933x SoCs. 2017-01-15 06:35:00 +00:00
modules Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
net Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
net80211 [net80211] add some more "is this XXX" macros for CTRL and DATA. 2017-01-15 19:49:47 +00:00
netgraph Changes to allow the patching of packets with an offset (and other changes.. see man page) 2016-12-02 10:47:10 +00:00
netinet Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
netinet6 Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
netipsec Add direction argument to ipsec_setspidx_inpcb() function. 2017-01-08 12:40:07 +00:00
netnatm
netpfil Initialize IPFW static rules rmlock with RM_RECURSE flag. 2017-01-17 10:50:28 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed
opencrypto Add support for the fpu_kern(9) KPI on arm64. It hooks into the existing 2016-10-20 09:22:10 +00:00
pc98 Add a COMPAT_FREEBSD11 kernel option. 2016-12-09 18:54:12 +00:00
powerpc Use the explicit expanded form of cmp. 2017-01-18 03:42:21 +00:00
riscv Disable superpages reservations as we don't have implemented them yet. 2016-11-21 12:00:31 +00:00
rpc
security Audit 'fd' and 'cmd' arguments to fcntl(2), and when generating BSM, 2016-11-22 00:41:24 +00:00
sparc64 Trim a few comments on platforms that did not implement mmap of /dev/kmem. 2017-01-13 21:52:53 +00:00
sys Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
teken
tests
tools Replace using of objdump with elfdump 2017-01-10 18:46:40 +00:00
ufs Use type-independent formats for printing nlink_t and ino_t. 2017-01-06 16:59:33 +00:00
vm Avoid unnecessary page lookups in vm_object_madvise(). 2017-01-15 03:50:08 +00:00
x86 "Buses" is the preferred plural of "bus" 2017-01-15 17:54:01 +00:00
xdr
xen "Buses" is the preferred plural of "bus" 2017-01-15 17:54:01 +00:00
Makefile