<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src-test2/sys/netinet6/in6_pcb.c, branch stable/10</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src-test2/atom?h=stable%2F10</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src-test2/atom?h=stable%2F10'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/'/>
<updated>2016-11-24T14:48:46Z</updated>
<entry>
<title>MFC r286227, r286443:</title>
<updated>2016-11-24T14:48:46Z</updated>
<author>
<name>Julien Charbon</name>
<email>jch@FreeBSD.org</email>
</author>
<published>2016-11-24T14:48:46Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=cf08966db124bf0c5e98245d5f83d2df38481366'/>
<id>urn:sha1:cf08966db124bf0c5e98245d5f83d2df38481366</id>
<content type='text'>
r286227:

Decompose TCP INP_INFO lock to increase short-lived TCP connections scalability:

- The existing TCP INP_INFO lock continues to protect the global inpcb list
  stability during full list traversal (e.g. tcp_pcblist()).

- A new INP_LIST lock protects inpcb list actual modifications (inp allocation
  and free) and inpcb global counters.

It allows to use TCP INP_INFO_RLOCK lock in critical paths (e.g. tcp_input())
and INP_INFO_WLOCK only in occasional operations that walk all connections.

PR:			183659
Differential Revision:	https://reviews.freebsd.org/D2599
Reviewed by:		jhb, adrian
Tested by:		adrian, nitroboost-gmail.com
Sponsored by:		Verisign, Inc.

r286443:

Fix a kernel assertion issue introduced with r286227:
Avoid too strict INP_INFO_RLOCK_ASSERT checks due to
tcp_notify() being called from in6_pcbnotify().

Reported by:		Larry Rosenman &lt;ler@lerctr.org&gt;
Submitted by:		markj, jch
</content>
</entry>
<entry>
<title>MFC r279588:</title>
<updated>2015-03-12T09:04:19Z</updated>
<author>
<name>Andrey V. Elsukov</name>
<email>ae@FreeBSD.org</email>
</author>
<published>2015-03-12T09:04:19Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=ae1dc9567881a0f111709441c6afff5cbe2e63c4'/>
<id>urn:sha1:ae1dc9567881a0f111709441c6afff5cbe2e63c4</id>
<content type='text'>
  Fix deadlock in IPv6 PCB code.

  When several threads are trying to send datagram to the same destination,
  but fragmentation is disabled and datagram size exceeds link MTU,
  ip6_output() calls pfctlinput2(PRC_MSGSIZE). It does notify all
  sockets wanted to know MTU to this destination. And since all threads
  hold PCB lock while sending, taking the lock for each PCB in the
  in6_pcbnotify() leads to deadlock.

  RFC 3542 p.11.3 suggests notify all application wanted to receive
  IPV6_PATHMTU ancillary data for each ICMPv6 packet too big message.
  But it doesn't require this, when we don't receive ICMPv6 message.

  Change ip6_notify_pmtu() function to be able use it directly from
  ip6_output() to notify only one socket, and to notify all sockets
  when ICMPv6 packet too big message received.

MFC r279684:
  tcp6_ctlinput() doesn't pass MTU value to in6_pcbnotify().
  Check cmdarg isn't NULL before dereference, this check was in the
  ip6_notify_pmtu() before r279588.

PR:		197059
Sponsored by:	Yandex LLC
</content>
</entry>
<entry>
<title>A complete duplication of binding should be allowed if on both new and</title>
<updated>2013-07-12T19:08:33Z</updated>
<author>
<name>Mikolaj Golub</name>
<email>trociny@FreeBSD.org</email>
</author>
<published>2013-07-12T19:08:33Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=f122b319ebc379e9d4c8130724af4918c3d7b224'/>
<id>urn:sha1:f122b319ebc379e9d4c8130724af4918c3d7b224</id>
<content type='text'>
duplicated sockets a multicast address is bound and either
SO_REUSEPORT or SO_REUSEADDR is set.

But actually it works for the following combinations:

  * SO_REUSEPORT is set for the fist socket and SO_REUSEPORT for the new;
  * SO_REUSEADDR is set for the fist socket and SO_REUSEADDR for the new;
  * SO_REUSEPORT is set for the fist socket and SO_REUSEADDR for the new;

and fails for this:

  * SO_REUSEADDR is set for the fist socket and SO_REUSEPORT for the new.

Fix the last case.

PR:		179901
MFC after:	1 month
</content>
</entry>
<entry>
<title>In r227207, to fix the issue with possible NULL inp_socket pointer</title>
<updated>2013-07-04T18:38:00Z</updated>
<author>
<name>Mikolaj Golub</name>
<email>trociny@FreeBSD.org</email>
</author>
<published>2013-07-04T18:38:00Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=efdf104bcaa311832127176959eb5f7d1a4e0fb8'/>
<id>urn:sha1:efdf104bcaa311832127176959eb5f7d1a4e0fb8</id>
<content type='text'>
dereferencing, when checking for SO_REUSEPORT option (and SO_REUSEADDR
for multicast), INP_REUSEPORT flag was introduced to cache the socket
option.  It was decided then that one flag would be enough to cache
both SO_REUSEPORT and SO_REUSEADDR: when processing SO_REUSEADDR
setsockopt(2), it was checked if it was called for a multicast address
and INP_REUSEPORT was set accordingly.

Unfortunately that approach does not work when setsockopt(2) is called
before binding to a multicast address: the multicast check fails and
INP_REUSEPORT is not set.

Fix this by adding INP_REUSEADDR flag to unconditionally cache
SO_REUSEADDR.

PR:		179901
Submitted by:	Michael Gmelin freebsd grem.de (initial version)
Reviewed by:	rwatson
MFC after:	1 week
</content>
</entry>
<entry>
<title>Remove unused variable.</title>
<updated>2013-04-24T10:24:01Z</updated>
<author>
<name>Andrey V. Elsukov</name>
<email>ae@FreeBSD.org</email>
</author>
<published>2013-04-24T10:24:01Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=817f395375cd8440a1f5197e46b549322e7f1e12'/>
<id>urn:sha1:817f395375cd8440a1f5197e46b549322e7f1e12</id>
<content type='text'>
MFC after:	1 week
</content>
</entry>
<entry>
<title>in6_pcblookup_local() still can return a pcb with NULL</title>
<updated>2012-03-21T08:43:38Z</updated>
<author>
<name>Gleb Smirnoff</name>
<email>glebius@FreeBSD.org</email>
</author>
<published>2012-03-21T08:43:38Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=d0e6c546a23f0f65006eacf515ba4c36d70a8ed0'/>
<id>urn:sha1:d0e6c546a23f0f65006eacf515ba4c36d70a8ed0</id>
<content type='text'>
inp_socket. To avoid panic, do not dereference inp_socket,
but obtain reuse port option from inp_flags2, like this
is done after next call to in_pcblookup_local() a few lines
down below.

Submitted by:	rwatson
</content>
</entry>
<entry>
<title>Fix false positive EADDRINUSE that could be returned by bind, due to</title>
<updated>2011-11-11T14:09:09Z</updated>
<author>
<name>Mikolaj Golub</name>
<email>trociny@FreeBSD.org</email>
</author>
<published>2011-11-11T14:09:09Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=040ee1ec9574d05f86e6c2bdfb38d50eea2f4a58'/>
<id>urn:sha1:040ee1ec9574d05f86e6c2bdfb38d50eea2f4a58</id>
<content type='text'>
the typo made in r227207.

Reported by:	kib
Tested by:	kib
</content>
</entry>
<entry>
<title>Cache SO_REUSEPORT socket option in inpcb-layer in order to avoid</title>
<updated>2011-11-06T10:47:20Z</updated>
<author>
<name>Mikolaj Golub</name>
<email>trociny@FreeBSD.org</email>
</author>
<published>2011-11-06T10:47:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=fc06cd427e7c610593bec0235364432eb98f9cb9'/>
<id>urn:sha1:fc06cd427e7c610593bec0235364432eb98f9cb9</id>
<content type='text'>
inp_socket-&gt;so_options dereference when we may not acquire the lock on
the inpcb.

This fixes the crash due to NULL pointer dereference in
in_pcbbind_setup() when inp_socket-&gt;so_options in a pcb returned by
in_pcblookup_local() was checked.

Reported by:	dave jones &lt;s.dave.jones@gmail.com&gt;, Arnaud Lacombe &lt;lacombar@gmail.com&gt;
Suggested by:	rwatson
Glanced by:	rwatson
Tested by:	dave jones &lt;s.dave.jones@gmail.com&gt;
</content>
</entry>
<entry>
<title>Before dereferencing intotw() check for NULL, the same way as it is</title>
<updated>2011-11-06T09:29:52Z</updated>
<author>
<name>Mikolaj Golub</name>
<email>trociny@FreeBSD.org</email>
</author>
<published>2011-11-06T09:29:52Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=29381b363b3d557c239246b42f6512b10407cd2f'/>
<id>urn:sha1:29381b363b3d557c239246b42f6512b10407cd2f</id>
<content type='text'>
done for in_pcb (see r157474).

MFC after:	1 week
</content>
</entry>
<entry>
<title>Implement a CPU-affine TCP and UDP connection lookup data structure,</title>
<updated>2011-06-06T12:55:02Z</updated>
<author>
<name>Robert Watson</name>
<email>rwatson@FreeBSD.org</email>
</author>
<published>2011-06-06T12:55:02Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=52cd27cb588a528b10a4998de95434af22ae0c06'/>
<id>urn:sha1:52cd27cb588a528b10a4998de95434af22ae0c06</id>
<content type='text'>
struct inpcbgroup.  pcbgroups, or "connection groups", supplement the
existing inpcbinfo connection hash table, which when pcbgroups are
enabled, might now be thought of more usefully as a per-protocol
4-tuple reservation table.

Connections are assigned to connection groups base on a hash of their
4-tuple; wildcard sockets require special handling, and are members
of all connection groups.  During a connection lookup, a
per-connection group lock is employed rather than the global pcbinfo
lock.  By aligning connection groups with input path processing,
connection groups take on an effective CPU affinity, especially when
aligned with RSS work placement (see a forthcoming commit for
details).  This eliminates cache line migration associated with
global, protocol-layer data structures in steady state TCP and UDP
processing (with the exception of protocol-layer statistics; further
commit to follow).

Elements of this approach were inspired by Willman, Rixner, and Cox's
2006 USENIX paper, "An Evaluation of Network Stack Parallelization
Strategies in Modern Operating Systems".  However, there are also
significant differences: we maintain the inpcb lock, rather than using
the connection group lock for per-connection state.

Likewise, the focus of this implementation is alignment with NIC
packet distribution strategies such as RSS, rather than pure software
strategies.  Despite that focus, software distribution is supported
through the parallel netisr implementation, and works well in
configurations where the number of hardware threads is greater than
the number of NIC input queues, such as in the RMI XLR threaded MIPS
architecture.

Another important difference is the continued maintenance of existing
hash tables as "reservation tables" -- these are useful both to
distinguish the resource allocation aspect of protocol name management
and the more common-case lookup aspect.  In configurations where
connection tables are aligned with hardware hashes, it is desirable to
use the traditional lookup tables for loopback or encapsulated traffic
rather than take the expense of hardware hashes that are hard to
implement efficiently in software (such as RSS Toeplitz).

Connection group support is enabled by compiling "options PCBGROUP"
into your kernel configuration; for the time being, this is an
experimental feature, and hence is not enabled by default.

Subject to the limited MFCability of change dependencies in inpcb,
and its change to the inpcbinfo init function signature, this change
in principle could be merged to FreeBSD 8.x.

Reviewed by:    bz
Sponsored by:   Juniper Networks, Inc.
</content>
</entry>
</feed>
