Create personal branch for tcp and network related works that should
sooner or later be committed to head.
Adjust the default initial CWND upon connection establishment to the
new and larger values specified by RFC5681 Section 3.1.

The larger initial CWND per RFC3390, if enabled, is not affected.
When SYN or SYN/ACK had to be retransmitted RFC5681 requires us to
reduce the initial CWND to one segment.  This reduction got lost
some time ago due to a change initialization ordering.
Increase the initial CWND to 10 segments as defined in IETF TCPM
draft-ietf-tcpm-initcwnd-03 discussing why the higher initial window
improves the overall performance of many web services without risking
congestion collapse.

As long as it remains a draft it is not enabled by default and placed
under a sysctl marking it clearly as experimental:
 net.inet.tcp.exprimental.initcwnd10

Linux as of kernel 3.0 has enabled it by default.
Work around a bug in path MTU discovery where it never managages to update
to the new and lower MTU when the tcp hostcache is full.

When an ICMP fragmentation needed message comes in, it is dispatched through
tcp_ctlinput() which determines the tcp connection it belongs to and then
updates the tcp hostcache with the new MTU.  After that tcp_mtudisc() is
called, recalculates the MSS from tcp hostcache for this connection and
resends some data.

If the tcp hostcache is full, the update with the new MTU fails and the
MSS recalculation doesn't take the MTU reduction into consideration which
leads to a too large segment to be sent causing an ICMP message again...

The workaround abuses the errno field in tcp_mtudisc() to communicate the
new MTU directly and to have it included in the MSS recalculation in any
case and independent of the tcp hostcache.
Fix typo.
Defer sending an independent window update if a delayed ACK is pending
saving a packet.  The window update then gets piggy-backed on the next
already scheduled ACK.
Prevent a flurry of forced window updates when an application is
doing small reads on a (partially) filled receive socket buffer.

Normally one would a send a window update every time the available
space in the socket buffer increases by two times MSS.  This leads
to a flurry of window updates that do not provide any meaningful
new information to the sender.  There still is available space in
the window and the sender can continue sending data.  All window
updates then get carried by the regular ACKs.  Only when the socket
buffer was (almost) full and the window closed accordingly a window
updates delivery new information and allows the sender to start
sending more data again.

Send window updates only every two MSS when the socket buffer
has less than 1/8 space available, or the available space in the
socket buffer increased by 1/4 its full capacity, or the socket
buffer is very small.  The next regular data ACK will carry and
report the exact window size again.

Reported by:	sbruno
Tested by:	Darren Baginsky
PR:		kern/116335
Simplify reporting of global maximum number of TCP segments in
reassembly queue.
Remove the need for routes to have the MTU explicitly set or inherited
from their interface.  Unless explicitly set the route MTU is zero and
the current interface MTU is being used.

This allows interface MTU to be increased even after it got an IP address
assigned.

If a route has an MTU set that is lower than the interface MTU it will
be used instead.  If a route has an MTU set that is higher than the
interface MTU it will be adjusted and the interface MTU will be used
as before.
If the user has closed the socket then drop a persisting connection
after a much reduced timeout.

Typically web servers close their sockets quickly under the assumption
that the TCP connections goes away as well.  That is not entirely true
however.  If the peer closed the window we're going to wait for a long
time with lots of data in the send buffer.
Add logging for socket attach failures in sonewconn() while accepting
a new connection to make problems easier to track.
Allow arbitrary MSS sizes and don't mind about the cluster size anymore.
We've got more cluster sizes for quite some time now and the orginally
imposed limits and the previously codified thoughts on efficiency gains
are no longer true.
Slight improvement in readability of macro sowriteable().
Improve m_cat() by being able to also merge contents from M_EXT
mbuf's by doing proper testing with M_WRITABLE().

In m_collapse() replace an incomplete manual check for M_RDONLY
with the M_WRITABLE() macro that also tests for shared buffers
and other cases that make a particular mbuf immutable.
Integrate from HEAD up to r232610.
In soreceive_stream() don't drop an already dequeued mbuf chain by
overwriting the return mbuf pointer with newly received data after
a loop.  Instead append the new mbuf chain to the existing one.

Fix up sb_lastrecord when dequeuing mbuf's so that sbappend_stream()
doesn't get confused.

For the remainder copy case in the mbuf delivery part deduct the
copied length len instead of the whole mbuf length.  Additionally
don't depend on 'n' being being available which isn't true in the
case of MSG_PEEK.

Submitted by:	trociny (slightly different version)
Fix the MSG_WAITALL case by comparing against sb_hiwat.  Before
it was looping for every receive as sb_lowat normally is zero.

Add comment about issue with (MSG_WAITALL | MSG_PEEK) which isn't
properly handled.
Move *mp0 initialization for the direct mbuf dequeue case before the
for() loop to correctly move the mbuf's.

Reported by:	trociny
Change the syncache count reporting the current number of entries
from an unprotected u_int that reports garbage on SMP to a function
based sysctl obtaining the current value from UMA.

Also read back the actual cache_limit after page size rounding by UMA.

PR:	kern/165879