freebsd-dev/sbin/ifconfig
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
..
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
af_inet6.c Fix spurious white space introduced in r301059 2016-10-09 03:20:58 +00:00
af_inet.c Fix spurious white space introduced in r301059 2016-10-09 03:20:58 +00:00
af_link.c Indicate that this is a locally administered MAC address. 2016-09-27 17:37:23 +00:00
af_nd6.c Use strlcpy() instead of strncpy() when copying ifname to ensure 2016-05-16 00:25:24 +00:00
carp.c Replace N #defines with nitems to simplify ifconfig code slightly 2015-09-27 07:51:18 +00:00
ifbridge.c Use nitems() from sys/param.h. 2016-04-19 04:42:34 +00:00
ifclone.c Use strlcpy() instead of strncpy() when copying ifname to ensure 2016-05-16 00:25:24 +00:00
ifconfig.8 Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
ifconfig.c Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
ifconfig.h ifconfig(8): can't use 'name' or 'description' when creating interface with auto numbering 2016-02-20 11:36:35 +00:00
iffib.c Use strlcpy() instead of strncpy() when copying ifname to ensure 2016-05-16 00:25:24 +00:00
ifgif.c - Remove GIF_{SEND,ACCEPT}_REVETHIP. 2015-09-10 05:59:39 +00:00
ifgre.c Use strlcpy() instead of strncpy() when copying ifname to ensure 2016-05-16 00:25:24 +00:00
ifgroup.c Replace N #defines with nitems to simplify ifconfig code slightly 2015-09-27 07:51:18 +00:00
ifieee80211.c [ifconfig] add initial VHT (802.11ac) configuration and channel support to ifconfig. 2017-01-07 02:07:05 +00:00
iflagg.c Use nitems() from sys/param.h. 2016-04-19 04:42:34 +00:00
ifmac.c Use strlcpy() instead of strncpy() when copying ifname to ensure 2016-05-16 00:25:24 +00:00
ifmedia.c Use strlcpy() instead of strncpy() when copying ifname to ensure 2016-05-16 00:25:24 +00:00
ifpfsync.c Replace N #defines with nitems to simplify ifconfig code slightly 2015-09-27 07:51:18 +00:00
ifvlan.c Add support to priority code point (PCP) that is an 3-bit field 2016-06-06 09:51:58 +00:00
ifvxlan.c Replace N #defines with nitems to simplify ifconfig code slightly 2015-09-27 07:51:18 +00:00
Makefile Explicitly add more files to the 'runtime' package. 2016-02-09 20:19:31 +00:00
Makefile.depend META MODE: Update dependencies with 'the-lot' and add missing directories. 2015-12-01 05:23:19 +00:00
sfp.c Use macro MIN() from sys/param.h. 2016-04-27 02:02:44 +00:00