author | Robert Mustacchi <rm@joyent.com> |
Fri, 28 Oct 2011 20:17:44 -0400 | |
changeset 13496 | 732144cfe2ef |
parent 13494 | 9dc2083cc403 |
child 13521 | 901a793ed0dd |
permissions | -rw-r--r-- |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2 |
* CDDL HEADER START |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4 |
* The contents of this file are subject to the terms of the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
7 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
9 |
* or http://www.opensolaris.org/os/licensing. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
10 |
* See the License for the specific language governing permissions |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
11 |
* and limitations under the License. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
12 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
18 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
19 |
* CDDL HEADER END |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
20 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
21 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
22 |
/* |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
23 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
24 |
* Copyright 2011 Nexenta Systems, Inc. All rights reserved. |
13496
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
25 |
* Copyright (c) 2011 Joyent, Inc. All rights reserved. |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
26 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
27 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
28 |
/* This file contains all TCP input processing functions. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
29 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
30 |
#include <sys/types.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
31 |
#include <sys/stream.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
32 |
#include <sys/strsun.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
33 |
#include <sys/strsubr.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
34 |
#include <sys/stropts.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
35 |
#include <sys/strlog.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
36 |
#define _SUN_TPI_VERSION 2 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
37 |
#include <sys/tihdr.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
38 |
#include <sys/suntpi.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
39 |
#include <sys/xti_inet.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
40 |
#include <sys/squeue_impl.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
41 |
#include <sys/squeue.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
42 |
#include <sys/tsol/tnet.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
43 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
44 |
#include <inet/common.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
45 |
#include <inet/ip.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
46 |
#include <inet/tcp.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
47 |
#include <inet/tcp_impl.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
48 |
#include <inet/tcp_cluster.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
49 |
#include <inet/proto_set.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
50 |
#include <inet/ipsec_impl.h> |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
51 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
52 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
53 |
* RFC1323-recommended phrasing of TSTAMP option, for easier parsing |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
54 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
55 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
56 |
#ifdef _BIG_ENDIAN |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
57 |
#define TCPOPT_NOP_NOP_TSTAMP ((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
58 |
(TCPOPT_TSTAMP << 8) | 10) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
59 |
#else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
60 |
#define TCPOPT_NOP_NOP_TSTAMP ((10 << 24) | (TCPOPT_TSTAMP << 16) | \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
61 |
(TCPOPT_NOP << 8) | TCPOPT_NOP) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
62 |
#endif |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
63 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
64 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
65 |
* Flags returned from tcp_parse_options. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
66 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
67 |
#define TCP_OPT_MSS_PRESENT 1 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
68 |
#define TCP_OPT_WSCALE_PRESENT 2 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
69 |
#define TCP_OPT_TSTAMP_PRESENT 4 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
70 |
#define TCP_OPT_SACK_OK_PRESENT 8 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
71 |
#define TCP_OPT_SACK_PRESENT 16 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
72 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
73 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
74 |
* PAWS needs a timer for 24 days. This is the number of ticks in 24 days |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
75 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
76 |
#define PAWS_TIMEOUT ((clock_t)(24*24*60*60*hz)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
77 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
78 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
79 |
* Since tcp_listener is not cleared atomically with tcp_detached |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
80 |
* being cleared we need this extra bit to tell a detached connection |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
81 |
* apart from one that is in the process of being accepted. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
82 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
83 |
#define TCP_IS_DETACHED_NONEAGER(tcp) \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
84 |
(TCP_IS_DETACHED(tcp) && \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
85 |
(!(tcp)->tcp_hard_binding)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
86 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
87 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
88 |
* Steps to do when a tcp_t moves to TIME-WAIT state. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
89 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
90 |
* This connection is done, we don't need to account for it. Decrement |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
91 |
* the listener connection counter if needed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
92 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
93 |
* Decrement the connection counter of the stack. Note that this counter |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
94 |
* is per CPU. So the total number of connections in a stack is the sum of all |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
95 |
* of them. Since there is no lock for handling all of them exclusively, the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
96 |
* resulting sum is only an approximation. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
97 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
98 |
* Unconditionally clear the exclusive binding bit so this TIME-WAIT |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
99 |
* connection won't interfere with new ones. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
100 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
101 |
* Start the TIME-WAIT timer. If upper layer has not closed the connection, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
102 |
* the timer is handled within the context of this tcp_t. When the timer |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
103 |
* fires, tcp_clean_death() is called. If upper layer closes the connection |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
104 |
* during this period, tcp_time_wait_append() will be called to add this |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
105 |
* tcp_t to the global TIME-WAIT list. Note that this means that the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
106 |
* actual wait time in TIME-WAIT state will be longer than the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
107 |
* tcps_time_wait_interval since the period before upper layer closes the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
108 |
* connection is not accounted for when tcp_time_wait_append() is called. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
109 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
110 |
* If uppser layer has closed the connection, call tcp_time_wait_append() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
111 |
* directly. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
112 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
113 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
114 |
#define SET_TIME_WAIT(tcps, tcp, connp) \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
115 |
{ \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
116 |
(tcp)->tcp_state = TCPS_TIME_WAIT; \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
117 |
if ((tcp)->tcp_listen_cnt != NULL) \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
118 |
TCP_DECR_LISTEN_CNT(tcp); \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
119 |
atomic_dec_64( \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
120 |
(uint64_t *)&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_conn_cnt); \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
121 |
(connp)->conn_exclbind = 0; \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
122 |
if (!TCP_IS_DETACHED(tcp)) { \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
123 |
TCP_TIMER_RESTART(tcp, (tcps)->tcps_time_wait_interval); \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
124 |
} else { \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
125 |
tcp_time_wait_append(tcp); \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
126 |
TCP_DBGSTAT(tcps, tcp_rput_time_wait); \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
127 |
} \ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
128 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
129 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
130 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
131 |
* If tcp_drop_ack_unsent_cnt is greater than 0, when TCP receives more |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
132 |
* than tcp_drop_ack_unsent_cnt number of ACKs which acknowledge unsent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
133 |
* data, TCP will not respond with an ACK. RFC 793 requires that |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
134 |
* TCP responds with an ACK for such a bogus ACK. By not following |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
135 |
* the RFC, we prevent TCP from getting into an ACK storm if somehow |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
136 |
* an attacker successfully spoofs an acceptable segment to our |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
137 |
* peer; or when our peer is "confused." |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
138 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
139 |
static uint32_t tcp_drop_ack_unsent_cnt = 10; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
140 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
141 |
/* |
13020
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
142 |
* To protect TCP against attacker using a small window and requesting |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
143 |
* large amount of data (DoS attack by conuming memory), TCP checks the |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
144 |
* window advertised in the last ACK of the 3-way handshake. TCP uses |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
145 |
* the tcp_mss (the size of one packet) value for comparion. The window |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
146 |
* should be larger than tcp_mss. But while a sane TCP should advertise |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
147 |
* a receive window larger than or equal to 4*MSS to avoid stop and go |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
148 |
* tarrfic, not all TCP stacks do that. This is especially true when |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
149 |
* tcp_mss is a big value. |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
150 |
* |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
151 |
* To work around this issue, an additional fixed value for comparison |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
152 |
* is also used. If the advertised window is smaller than both tcp_mss |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
153 |
* and tcp_init_wnd_chk, the ACK is considered as invalid. So for large |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
154 |
* tcp_mss value (say, 8K), a window larger than tcp_init_wnd_chk but |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
155 |
* smaller than 8K is considered to be OK. |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
156 |
*/ |
13020
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
157 |
static uint32_t tcp_init_wnd_chk = 4096; |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
158 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
159 |
/* Process ICMP source quench message or not. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
160 |
static boolean_t tcp_icmp_source_quench = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
161 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
162 |
static boolean_t tcp_outbound_squeue_switch = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
163 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
164 |
static mblk_t *tcp_conn_create_v4(conn_t *, conn_t *, mblk_t *, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
165 |
ip_recv_attr_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
166 |
static mblk_t *tcp_conn_create_v6(conn_t *, conn_t *, mblk_t *, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
167 |
ip_recv_attr_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
168 |
static boolean_t tcp_drop_q0(tcp_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
169 |
static void tcp_icmp_error_ipv6(tcp_t *, mblk_t *, ip_recv_attr_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
170 |
static mblk_t *tcp_input_add_ancillary(tcp_t *, mblk_t *, ip_pkt_t *, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
171 |
ip_recv_attr_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
172 |
static void tcp_input_listener(void *, mblk_t *, void *, ip_recv_attr_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
173 |
static int tcp_parse_options(tcpha_t *, tcp_opt_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
174 |
static void tcp_process_options(tcp_t *, tcpha_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
175 |
static mblk_t *tcp_reass(tcp_t *, mblk_t *, uint32_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
176 |
static void tcp_reass_elim_overlap(tcp_t *, mblk_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
177 |
static void tcp_rsrv_input(void *, mblk_t *, void *, ip_recv_attr_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
178 |
static void tcp_set_rto(tcp_t *, time_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
179 |
static void tcp_setcred_data(mblk_t *, ip_recv_attr_t *); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
180 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
181 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
182 |
* Set the MSS associated with a particular tcp based on its current value, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
183 |
* and a new one passed in. Observe minimums and maximums, and reset other |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
184 |
* state variables that we want to view as multiples of MSS. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
185 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
186 |
* The value of MSS could be either increased or descreased. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
187 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
188 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
189 |
tcp_mss_set(tcp_t *tcp, uint32_t mss) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
190 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
191 |
uint32_t mss_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
192 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
193 |
conn_t *connp = tcp->tcp_connp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
194 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
195 |
if (connp->conn_ipversion == IPV4_VERSION) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
196 |
mss_max = tcps->tcps_mss_max_ipv4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
197 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
198 |
mss_max = tcps->tcps_mss_max_ipv6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
199 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
200 |
if (mss < tcps->tcps_mss_min) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
201 |
mss = tcps->tcps_mss_min; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
202 |
if (mss > mss_max) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
203 |
mss = mss_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
204 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
205 |
* Unless naglim has been set by our client to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
206 |
* a non-mss value, force naglim to track mss. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
207 |
* This can help to aggregate small writes. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
208 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
209 |
if (mss < tcp->tcp_naglim || tcp->tcp_mss == tcp->tcp_naglim) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
210 |
tcp->tcp_naglim = mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
211 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
212 |
* TCP should be able to buffer at least 4 MSS data for obvious |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
213 |
* performance reason. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
214 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
215 |
if ((mss << 2) > connp->conn_sndbuf) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
216 |
connp->conn_sndbuf = mss << 2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
217 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
218 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
219 |
* Set the send lowater to at least twice of MSS. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
220 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
221 |
if ((mss << 1) > connp->conn_sndlowat) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
222 |
connp->conn_sndlowat = mss << 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
223 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
224 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
225 |
* Update tcp_cwnd according to the new value of MSS. Keep the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
226 |
* previous ratio to preserve the transmit rate. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
227 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
228 |
tcp->tcp_cwnd = (tcp->tcp_cwnd / tcp->tcp_mss) * mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
229 |
tcp->tcp_cwnd_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
230 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
231 |
tcp->tcp_mss = mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
232 |
(void) tcp_maxpsz_set(tcp, B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
233 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
234 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
235 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
236 |
* Extract option values from a tcp header. We put any found values into the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
237 |
* tcpopt struct and return a bitmask saying which options were found. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
238 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
239 |
static int |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
240 |
tcp_parse_options(tcpha_t *tcpha, tcp_opt_t *tcpopt) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
241 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
242 |
uchar_t *endp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
243 |
int len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
244 |
uint32_t mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
245 |
uchar_t *up = (uchar_t *)tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
246 |
int found = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
247 |
int32_t sack_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
248 |
tcp_seq sack_begin, sack_end; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
249 |
tcp_t *tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
250 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
251 |
endp = up + TCP_HDR_LENGTH(tcpha); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
252 |
up += TCP_MIN_HEADER_LENGTH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
253 |
while (up < endp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
254 |
len = endp - up; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
255 |
switch (*up) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
256 |
case TCPOPT_EOL: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
257 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
258 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
259 |
case TCPOPT_NOP: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
260 |
up++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
261 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
262 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
263 |
case TCPOPT_MAXSEG: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
264 |
if (len < TCPOPT_MAXSEG_LEN || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
265 |
up[1] != TCPOPT_MAXSEG_LEN) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
266 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
267 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
268 |
mss = BE16_TO_U16(up+2); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
269 |
/* Caller must handle tcp_mss_min and tcp_mss_max_* */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
270 |
tcpopt->tcp_opt_mss = mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
271 |
found |= TCP_OPT_MSS_PRESENT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
272 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
273 |
up += TCPOPT_MAXSEG_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
274 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
275 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
276 |
case TCPOPT_WSCALE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
277 |
if (len < TCPOPT_WS_LEN || up[1] != TCPOPT_WS_LEN) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
278 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
279 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
280 |
if (up[2] > TCP_MAX_WINSHIFT) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
281 |
tcpopt->tcp_opt_wscale = TCP_MAX_WINSHIFT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
282 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
283 |
tcpopt->tcp_opt_wscale = up[2]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
284 |
found |= TCP_OPT_WSCALE_PRESENT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
285 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
286 |
up += TCPOPT_WS_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
287 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
288 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
289 |
case TCPOPT_SACK_PERMITTED: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
290 |
if (len < TCPOPT_SACK_OK_LEN || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
291 |
up[1] != TCPOPT_SACK_OK_LEN) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
292 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
293 |
found |= TCP_OPT_SACK_OK_PRESENT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
294 |
up += TCPOPT_SACK_OK_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
295 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
296 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
297 |
case TCPOPT_SACK: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
298 |
if (len <= 2 || up[1] <= 2 || len < up[1]) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
299 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
300 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
301 |
/* If TCP is not interested in SACK blks... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
302 |
if ((tcp = tcpopt->tcp) == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
303 |
up += up[1]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
304 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
305 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
306 |
sack_len = up[1] - TCPOPT_HEADER_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
307 |
up += TCPOPT_HEADER_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
308 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
309 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
310 |
* If the list is empty, allocate one and assume |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
311 |
* nothing is sack'ed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
312 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
313 |
if (tcp->tcp_notsack_list == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
314 |
tcp_notsack_update(&(tcp->tcp_notsack_list), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
315 |
tcp->tcp_suna, tcp->tcp_snxt, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
316 |
&(tcp->tcp_num_notsack_blk), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
317 |
&(tcp->tcp_cnt_notsack_list)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
318 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
319 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
320 |
* Make sure tcp_notsack_list is not NULL. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
321 |
* This happens when kmem_alloc(KM_NOSLEEP) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
322 |
* returns NULL. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
323 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
324 |
if (tcp->tcp_notsack_list == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
325 |
up += sack_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
326 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
327 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
328 |
tcp->tcp_fack = tcp->tcp_suna; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
329 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
330 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
331 |
while (sack_len > 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
332 |
if (up + 8 > endp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
333 |
up = endp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
334 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
335 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
336 |
sack_begin = BE32_TO_U32(up); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
337 |
up += 4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
338 |
sack_end = BE32_TO_U32(up); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
339 |
up += 4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
340 |
sack_len -= 8; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
341 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
342 |
* Bounds checking. Make sure the SACK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
343 |
* info is within tcp_suna and tcp_snxt. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
344 |
* If this SACK blk is out of bound, ignore |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
345 |
* it but continue to parse the following |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
346 |
* blks. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
347 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
348 |
if (SEQ_LEQ(sack_end, sack_begin) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
349 |
SEQ_LT(sack_begin, tcp->tcp_suna) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
350 |
SEQ_GT(sack_end, tcp->tcp_snxt)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
351 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
352 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
353 |
tcp_notsack_insert(&(tcp->tcp_notsack_list), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
354 |
sack_begin, sack_end, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
355 |
&(tcp->tcp_num_notsack_blk), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
356 |
&(tcp->tcp_cnt_notsack_list)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
357 |
if (SEQ_GT(sack_end, tcp->tcp_fack)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
358 |
tcp->tcp_fack = sack_end; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
359 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
360 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
361 |
found |= TCP_OPT_SACK_PRESENT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
362 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
363 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
364 |
case TCPOPT_TSTAMP: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
365 |
if (len < TCPOPT_TSTAMP_LEN || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
366 |
up[1] != TCPOPT_TSTAMP_LEN) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
367 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
368 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
369 |
tcpopt->tcp_opt_ts_val = BE32_TO_U32(up+2); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
370 |
tcpopt->tcp_opt_ts_ecr = BE32_TO_U32(up+6); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
371 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
372 |
found |= TCP_OPT_TSTAMP_PRESENT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
373 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
374 |
up += TCPOPT_TSTAMP_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
375 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
376 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
377 |
default: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
378 |
if (len <= 1 || len < (int)up[1] || up[1] == 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
379 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
380 |
up += up[1]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
381 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
382 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
383 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
384 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
385 |
return (found); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
386 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
387 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
388 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
389 |
* Process all TCP option in SYN segment. Note that this function should |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
390 |
* be called after tcp_set_destination() is called so that the necessary info |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
391 |
* from IRE is already set in the tcp structure. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
392 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
393 |
* This function sets up the correct tcp_mss value according to the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
394 |
* MSS option value and our header size. It also sets up the window scale |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
395 |
* and timestamp values, and initialize SACK info blocks. But it does not |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
396 |
* change receive window size after setting the tcp_mss value. The caller |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
397 |
* should do the appropriate change. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
398 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
399 |
static void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
400 |
tcp_process_options(tcp_t *tcp, tcpha_t *tcpha) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
401 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
402 |
int options; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
403 |
tcp_opt_t tcpopt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
404 |
uint32_t mss_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
405 |
char *tmp_tcph; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
406 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
407 |
conn_t *connp = tcp->tcp_connp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
408 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
409 |
tcpopt.tcp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
410 |
options = tcp_parse_options(tcpha, &tcpopt); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
411 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
412 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
413 |
* Process MSS option. Note that MSS option value does not account |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
414 |
* for IP or TCP options. This means that it is equal to MTU - minimum |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
415 |
* IP+TCP header size, which is 40 bytes for IPv4 and 60 bytes for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
416 |
* IPv6. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
417 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
418 |
if (!(options & TCP_OPT_MSS_PRESENT)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
419 |
if (connp->conn_ipversion == IPV4_VERSION) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
420 |
tcpopt.tcp_opt_mss = tcps->tcps_mss_def_ipv4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
421 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
422 |
tcpopt.tcp_opt_mss = tcps->tcps_mss_def_ipv6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
423 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
424 |
if (connp->conn_ipversion == IPV4_VERSION) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
425 |
mss_max = tcps->tcps_mss_max_ipv4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
426 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
427 |
mss_max = tcps->tcps_mss_max_ipv6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
428 |
if (tcpopt.tcp_opt_mss < tcps->tcps_mss_min) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
429 |
tcpopt.tcp_opt_mss = tcps->tcps_mss_min; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
430 |
else if (tcpopt.tcp_opt_mss > mss_max) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
431 |
tcpopt.tcp_opt_mss = mss_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
432 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
433 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
434 |
/* Process Window Scale option. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
435 |
if (options & TCP_OPT_WSCALE_PRESENT) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
436 |
tcp->tcp_snd_ws = tcpopt.tcp_opt_wscale; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
437 |
tcp->tcp_snd_ws_ok = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
438 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
439 |
tcp->tcp_snd_ws = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
440 |
tcp->tcp_snd_ws_ok = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
441 |
tcp->tcp_rcv_ws = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
442 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
443 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
444 |
/* Process Timestamp option. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
445 |
if ((options & TCP_OPT_TSTAMP_PRESENT) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
446 |
(tcp->tcp_snd_ts_ok || TCP_IS_DETACHED(tcp))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
447 |
tmp_tcph = (char *)tcp->tcp_tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
448 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
449 |
tcp->tcp_snd_ts_ok = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
450 |
tcp->tcp_ts_recent = tcpopt.tcp_opt_ts_val; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
451 |
tcp->tcp_last_rcv_lbolt = ddi_get_lbolt64(); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
452 |
ASSERT(OK_32PTR(tmp_tcph)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
453 |
ASSERT(connp->conn_ht_ulp_len == TCP_MIN_HEADER_LENGTH); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
454 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
455 |
/* Fill in our template header with basic timestamp option. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
456 |
tmp_tcph += connp->conn_ht_ulp_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
457 |
tmp_tcph[0] = TCPOPT_NOP; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
458 |
tmp_tcph[1] = TCPOPT_NOP; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
459 |
tmp_tcph[2] = TCPOPT_TSTAMP; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
460 |
tmp_tcph[3] = TCPOPT_TSTAMP_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
461 |
connp->conn_ht_iphc_len += TCPOPT_REAL_TS_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
462 |
connp->conn_ht_ulp_len += TCPOPT_REAL_TS_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
463 |
tcp->tcp_tcpha->tha_offset_and_reserved += (3 << 4); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
464 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
465 |
tcp->tcp_snd_ts_ok = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
466 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
467 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
468 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
469 |
* Process SACK options. If SACK is enabled for this connection, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
470 |
* then allocate the SACK info structure. Note the following ways |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
471 |
* when tcp_snd_sack_ok is set to true. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
472 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
473 |
* For active connection: in tcp_set_destination() called in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
474 |
* tcp_connect(). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
475 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
476 |
* For passive connection: in tcp_set_destination() called in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
477 |
* tcp_input_listener(). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
478 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
479 |
* That's the reason why the extra TCP_IS_DETACHED() check is there. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
480 |
* That check makes sure that if we did not send a SACK OK option, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
481 |
* we will not enable SACK for this connection even though the other |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
482 |
* side sends us SACK OK option. For active connection, the SACK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
483 |
* info structure has already been allocated. So we need to free |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
484 |
* it if SACK is disabled. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
485 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
486 |
if ((options & TCP_OPT_SACK_OK_PRESENT) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
487 |
(tcp->tcp_snd_sack_ok || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
488 |
(tcps->tcps_sack_permitted != 0 && TCP_IS_DETACHED(tcp)))) { |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
489 |
ASSERT(tcp->tcp_num_sack_blk == 0); |
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
490 |
ASSERT(tcp->tcp_notsack_list == NULL); |
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
491 |
|
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
492 |
tcp->tcp_snd_sack_ok = B_TRUE; |
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
493 |
if (tcp->tcp_snd_ts_ok) { |
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
494 |
tcp->tcp_max_sack_blk = 3; |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
495 |
} else { |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
496 |
tcp->tcp_max_sack_blk = 4; |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
497 |
} |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
498 |
} else if (tcp->tcp_snd_sack_ok) { |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
499 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
500 |
* Resetting tcp_snd_sack_ok to B_FALSE so that |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
501 |
* no SACK info will be used for this |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
502 |
* connection. This assumes that SACK usage |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
503 |
* permission is negotiated. This may need |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
504 |
* to be changed once this is clarified. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
505 |
*/ |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
506 |
ASSERT(tcp->tcp_num_sack_blk == 0); |
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
507 |
ASSERT(tcp->tcp_notsack_list == NULL); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
508 |
tcp->tcp_snd_sack_ok = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
509 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
510 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
511 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
512 |
* Now we know the exact TCP/IP header length, subtract |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
513 |
* that from tcp_mss to get our side's MSS. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
514 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
515 |
tcp->tcp_mss -= connp->conn_ht_iphc_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
516 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
517 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
518 |
* Here we assume that the other side's header size will be equal to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
519 |
* our header size. We calculate the real MSS accordingly. Need to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
520 |
* take into additional stuffs IPsec puts in. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
521 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
522 |
* Real MSS = Opt.MSS - (our TCP/IP header - min TCP/IP header) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
523 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
524 |
tcpopt.tcp_opt_mss -= connp->conn_ht_iphc_len + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
525 |
tcp->tcp_ipsec_overhead - |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
526 |
((connp->conn_ipversion == IPV4_VERSION ? |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
527 |
IP_SIMPLE_HDR_LENGTH : IPV6_HDR_LEN) + TCP_MIN_HEADER_LENGTH); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
528 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
529 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
530 |
* Set MSS to the smaller one of both ends of the connection. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
531 |
* We should not have called tcp_mss_set() before, but our |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
532 |
* side of the MSS should have been set to a proper value |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
533 |
* by tcp_set_destination(). tcp_mss_set() will also set up the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
534 |
* STREAM head parameters properly. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
535 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
536 |
* If we have a larger-than-16-bit window but the other side |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
537 |
* didn't want to do window scale, tcp_rwnd_set() will take |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
538 |
* care of that. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
539 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
540 |
tcp_mss_set(tcp, MIN(tcpopt.tcp_opt_mss, tcp->tcp_mss)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
541 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
542 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
543 |
* Initialize tcp_cwnd value. After tcp_mss_set(), tcp_mss has been |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
544 |
* updated properly. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
545 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
546 |
TCP_SET_INIT_CWND(tcp, tcp->tcp_mss, tcps->tcps_slow_start_initial); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
547 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
548 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
549 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
550 |
* Add a new piece to the tcp reassembly queue. If the gap at the beginning |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
551 |
* is filled, return as much as we can. The message passed in may be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
552 |
* multi-part, chained using b_cont. "start" is the starting sequence |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
553 |
* number for this piece. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
554 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
555 |
static mblk_t * |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
556 |
tcp_reass(tcp_t *tcp, mblk_t *mp, uint32_t start) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
557 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
558 |
uint32_t end; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
559 |
mblk_t *mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
560 |
mblk_t *mp2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
561 |
mblk_t *next_mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
562 |
uint32_t u1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
563 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
564 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
565 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
566 |
/* Walk through all the new pieces. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
567 |
do { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
568 |
ASSERT((uintptr_t)(mp->b_wptr - mp->b_rptr) <= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
569 |
(uintptr_t)INT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
570 |
end = start + (int)(mp->b_wptr - mp->b_rptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
571 |
next_mp = mp->b_cont; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
572 |
if (start == end) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
573 |
/* Empty. Blast it. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
574 |
freeb(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
575 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
576 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
577 |
mp->b_cont = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
578 |
TCP_REASS_SET_SEQ(mp, start); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
579 |
TCP_REASS_SET_END(mp, end); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
580 |
mp1 = tcp->tcp_reass_tail; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
581 |
if (!mp1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
582 |
tcp->tcp_reass_tail = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
583 |
tcp->tcp_reass_head = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
584 |
TCPS_BUMP_MIB(tcps, tcpInDataUnorderSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
585 |
TCPS_UPDATE_MIB(tcps, tcpInDataUnorderBytes, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
586 |
end - start); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
587 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
588 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
589 |
/* New stuff completely beyond tail? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
590 |
if (SEQ_GEQ(start, TCP_REASS_END(mp1))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
591 |
/* Link it on end. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
592 |
mp1->b_cont = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
593 |
tcp->tcp_reass_tail = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
594 |
TCPS_BUMP_MIB(tcps, tcpInDataUnorderSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
595 |
TCPS_UPDATE_MIB(tcps, tcpInDataUnorderBytes, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
596 |
end - start); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
597 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
598 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
599 |
mp1 = tcp->tcp_reass_head; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
600 |
u1 = TCP_REASS_SEQ(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
601 |
/* New stuff at the front? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
602 |
if (SEQ_LT(start, u1)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
603 |
/* Yes... Check for overlap. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
604 |
mp->b_cont = mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
605 |
tcp->tcp_reass_head = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
606 |
tcp_reass_elim_overlap(tcp, mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
607 |
continue; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
608 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
609 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
610 |
* The new piece fits somewhere between the head and tail. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
611 |
* We find our slot, where mp1 precedes us and mp2 trails. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
612 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
613 |
for (; (mp2 = mp1->b_cont) != NULL; mp1 = mp2) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
614 |
u1 = TCP_REASS_SEQ(mp2); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
615 |
if (SEQ_LEQ(start, u1)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
616 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
617 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
618 |
/* Link ourselves in */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
619 |
mp->b_cont = mp2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
620 |
mp1->b_cont = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
621 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
622 |
/* Trim overlap with following mblk(s) first */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
623 |
tcp_reass_elim_overlap(tcp, mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
624 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
625 |
/* Trim overlap with preceding mblk */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
626 |
tcp_reass_elim_overlap(tcp, mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
627 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
628 |
} while (start = end, mp = next_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
629 |
mp1 = tcp->tcp_reass_head; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
630 |
/* Anything ready to go? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
631 |
if (TCP_REASS_SEQ(mp1) != tcp->tcp_rnxt) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
632 |
return (NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
633 |
/* Eat what we can off the queue */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
634 |
for (;;) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
635 |
mp = mp1->b_cont; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
636 |
end = TCP_REASS_END(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
637 |
TCP_REASS_SET_SEQ(mp1, 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
638 |
TCP_REASS_SET_END(mp1, 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
639 |
if (!mp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
640 |
tcp->tcp_reass_tail = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
641 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
642 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
643 |
if (end != TCP_REASS_SEQ(mp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
644 |
mp1->b_cont = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
645 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
646 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
647 |
mp1 = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
648 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
649 |
mp1 = tcp->tcp_reass_head; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
650 |
tcp->tcp_reass_head = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
651 |
return (mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
652 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
653 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
654 |
/* Eliminate any overlap that mp may have over later mblks */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
655 |
static void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
656 |
tcp_reass_elim_overlap(tcp_t *tcp, mblk_t *mp) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
657 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
658 |
uint32_t end; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
659 |
mblk_t *mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
660 |
uint32_t u1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
661 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
662 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
663 |
end = TCP_REASS_END(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
664 |
while ((mp1 = mp->b_cont) != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
665 |
u1 = TCP_REASS_SEQ(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
666 |
if (!SEQ_GT(end, u1)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
667 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
668 |
if (!SEQ_GEQ(end, TCP_REASS_END(mp1))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
669 |
mp->b_wptr -= end - u1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
670 |
TCP_REASS_SET_END(mp, u1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
671 |
TCPS_BUMP_MIB(tcps, tcpInDataPartDupSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
672 |
TCPS_UPDATE_MIB(tcps, tcpInDataPartDupBytes, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
673 |
end - u1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
674 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
675 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
676 |
mp->b_cont = mp1->b_cont; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
677 |
TCP_REASS_SET_SEQ(mp1, 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
678 |
TCP_REASS_SET_END(mp1, 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
679 |
freeb(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
680 |
TCPS_BUMP_MIB(tcps, tcpInDataDupSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
681 |
TCPS_UPDATE_MIB(tcps, tcpInDataDupBytes, end - u1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
682 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
683 |
if (!mp1) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
684 |
tcp->tcp_reass_tail = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
685 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
686 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
687 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
688 |
* This function does PAWS protection check. Returns B_TRUE if the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
689 |
* segment passes the PAWS test, else returns B_FALSE. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
690 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
691 |
boolean_t |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
692 |
tcp_paws_check(tcp_t *tcp, tcpha_t *tcpha, tcp_opt_t *tcpoptp) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
693 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
694 |
uint8_t flags; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
695 |
int options; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
696 |
uint8_t *up; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
697 |
conn_t *connp = tcp->tcp_connp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
698 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
699 |
flags = (unsigned int)tcpha->tha_flags & 0xFF; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
700 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
701 |
* If timestamp option is aligned nicely, get values inline, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
702 |
* otherwise call general routine to parse. Only do that |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
703 |
* if timestamp is the only option. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
704 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
705 |
if (TCP_HDR_LENGTH(tcpha) == (uint32_t)TCP_MIN_HEADER_LENGTH + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
706 |
TCPOPT_REAL_TS_LEN && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
707 |
OK_32PTR((up = ((uint8_t *)tcpha) + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
708 |
TCP_MIN_HEADER_LENGTH)) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
709 |
*(uint32_t *)up == TCPOPT_NOP_NOP_TSTAMP) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
710 |
tcpoptp->tcp_opt_ts_val = ABE32_TO_U32((up+4)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
711 |
tcpoptp->tcp_opt_ts_ecr = ABE32_TO_U32((up+8)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
712 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
713 |
options = TCP_OPT_TSTAMP_PRESENT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
714 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
715 |
if (tcp->tcp_snd_sack_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
716 |
tcpoptp->tcp = tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
717 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
718 |
tcpoptp->tcp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
719 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
720 |
options = tcp_parse_options(tcpha, tcpoptp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
721 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
722 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
723 |
if (options & TCP_OPT_TSTAMP_PRESENT) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
724 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
725 |
* Do PAWS per RFC 1323 section 4.2. Accept RST |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
726 |
* regardless of the timestamp, page 18 RFC 1323.bis. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
727 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
728 |
if ((flags & TH_RST) == 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
729 |
TSTMP_LT(tcpoptp->tcp_opt_ts_val, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
730 |
tcp->tcp_ts_recent)) { |
12818
1eda4f2ee0e0
6964207 the FireEngine project seems to have backed out the fix for 4840464
George Shepherd <George.Shepherd@Sun.COM>
parents:
12644
diff
changeset
|
731 |
if (LBOLT_FASTPATH64 < |
1eda4f2ee0e0
6964207 the FireEngine project seems to have backed out the fix for 4840464
George Shepherd <George.Shepherd@Sun.COM>
parents:
12644
diff
changeset
|
732 |
(tcp->tcp_last_rcv_lbolt + PAWS_TIMEOUT)) { |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
733 |
/* This segment is not acceptable. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
734 |
return (B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
735 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
736 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
737 |
* Connection has been idle for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
738 |
* too long. Reset the timestamp |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
739 |
* and assume the segment is valid. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
740 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
741 |
tcp->tcp_ts_recent = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
742 |
tcpoptp->tcp_opt_ts_val; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
743 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
744 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
745 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
746 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
747 |
* If we don't get a timestamp on every packet, we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
748 |
* figure we can't really trust 'em, so we stop sending |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
749 |
* and parsing them. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
750 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
751 |
tcp->tcp_snd_ts_ok = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
752 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
753 |
connp->conn_ht_iphc_len -= TCPOPT_REAL_TS_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
754 |
connp->conn_ht_ulp_len -= TCPOPT_REAL_TS_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
755 |
tcp->tcp_tcpha->tha_offset_and_reserved -= (3 << 4); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
756 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
757 |
* Adjust the tcp_mss and tcp_cwnd accordingly. We avoid |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
758 |
* doing a slow start here so as to not to lose on the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
759 |
* transfer rate built up so far. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
760 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
761 |
tcp_mss_set(tcp, tcp->tcp_mss + TCPOPT_REAL_TS_LEN); |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
762 |
if (tcp->tcp_snd_sack_ok) |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
763 |
tcp->tcp_max_sack_blk = 4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
764 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
765 |
return (B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
766 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
767 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
768 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
769 |
* Defense for the SYN attack - |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
770 |
* 1. When q0 is full, drop from the tail (tcp_eager_prev_drop_q0) the oldest |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
771 |
* one from the list of droppable eagers. This list is a subset of q0. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
772 |
* see comments before the definition of MAKE_DROPPABLE(). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
773 |
* 2. Don't drop a SYN request before its first timeout. This gives every |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
774 |
* request at least til the first timeout to complete its 3-way handshake. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
775 |
* 3. Maintain tcp_syn_rcvd_timeout as an accurate count of how many |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
776 |
* requests currently on the queue that has timed out. This will be used |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
777 |
* as an indicator of whether an attack is under way, so that appropriate |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
778 |
* actions can be taken. (It's incremented in tcp_timer() and decremented |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
779 |
* either when eager goes into ESTABLISHED, or gets freed up.) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
780 |
* 4. The current threshold is - # of timeout > q0len/4 => SYN alert on |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
781 |
* # of timeout drops back to <= q0len/32 => SYN alert off |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
782 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
783 |
static boolean_t |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
784 |
tcp_drop_q0(tcp_t *tcp) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
785 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
786 |
tcp_t *eager; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
787 |
mblk_t *mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
788 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
789 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
790 |
ASSERT(MUTEX_HELD(&tcp->tcp_eager_lock)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
791 |
ASSERT(tcp->tcp_eager_next_q0 != tcp->tcp_eager_prev_q0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
792 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
793 |
/* Pick oldest eager from the list of droppable eagers */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
794 |
eager = tcp->tcp_eager_prev_drop_q0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
795 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
796 |
/* If list is empty. return B_FALSE */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
797 |
if (eager == tcp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
798 |
return (B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
799 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
800 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
801 |
/* If allocated, the mp will be freed in tcp_clean_death_wrapper() */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
802 |
if ((mp = allocb(0, BPRI_HI)) == NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
803 |
return (B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
804 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
805 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
806 |
* Take this eager out from the list of droppable eagers since we are |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
807 |
* going to drop it. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
808 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
809 |
MAKE_UNDROPPABLE(eager); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
810 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
811 |
if (tcp->tcp_connp->conn_debug) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
812 |
(void) strlog(TCP_MOD_ID, 0, 3, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
813 |
"tcp_drop_q0: listen half-open queue (max=%d) overflow" |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
814 |
" (%d pending) on %s, drop one", tcps->tcps_conn_req_max_q0, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
815 |
tcp->tcp_conn_req_cnt_q0, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
816 |
tcp_display(tcp, NULL, DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
817 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
818 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
819 |
TCPS_BUMP_MIB(tcps, tcpHalfOpenDrop); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
820 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
821 |
/* Put a reference on the conn as we are enqueueing it in the sqeue */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
822 |
CONN_INC_REF(eager->tcp_connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
823 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
824 |
SQUEUE_ENTER_ONE(eager->tcp_connp->conn_sqp, mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
825 |
tcp_clean_death_wrapper, eager->tcp_connp, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
826 |
SQ_FILL, SQTAG_TCP_DROP_Q0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
827 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
828 |
return (B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
829 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
830 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
831 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
832 |
* Handle a SYN on an AF_INET6 socket; can be either IPv4 or IPv6 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
833 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
834 |
static mblk_t * |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
835 |
tcp_conn_create_v6(conn_t *lconnp, conn_t *connp, mblk_t *mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
836 |
ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
837 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
838 |
tcp_t *ltcp = lconnp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
839 |
tcp_t *tcp = connp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
840 |
mblk_t *tpi_mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
841 |
ipha_t *ipha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
842 |
ip6_t *ip6h; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
843 |
sin6_t sin6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
844 |
uint_t ifindex = ira->ira_ruifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
845 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
846 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
847 |
if (ira->ira_flags & IRAF_IS_IPV4) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
848 |
ipha = (ipha_t *)mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
849 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
850 |
connp->conn_ipversion = IPV4_VERSION; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
851 |
IN6_IPADDR_TO_V4MAPPED(ipha->ipha_dst, &connp->conn_laddr_v6); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
852 |
IN6_IPADDR_TO_V4MAPPED(ipha->ipha_src, &connp->conn_faddr_v6); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
853 |
connp->conn_saddr_v6 = connp->conn_laddr_v6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
854 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
855 |
sin6 = sin6_null; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
856 |
sin6.sin6_addr = connp->conn_faddr_v6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
857 |
sin6.sin6_port = connp->conn_fport; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
858 |
sin6.sin6_family = AF_INET6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
859 |
sin6.__sin6_src_id = ip_srcid_find_addr(&connp->conn_laddr_v6, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
860 |
IPCL_ZONEID(lconnp), tcps->tcps_netstack); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
861 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
862 |
if (connp->conn_recv_ancillary.crb_recvdstaddr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
863 |
sin6_t sin6d; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
864 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
865 |
sin6d = sin6_null; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
866 |
sin6d.sin6_addr = connp->conn_laddr_v6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
867 |
sin6d.sin6_port = connp->conn_lport; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
868 |
sin6d.sin6_family = AF_INET; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
869 |
tpi_mp = mi_tpi_extconn_ind(NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
870 |
(char *)&sin6d, sizeof (sin6_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
871 |
(char *)&tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
872 |
(t_scalar_t)sizeof (intptr_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
873 |
(char *)&sin6d, sizeof (sin6_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
874 |
(t_scalar_t)ltcp->tcp_conn_req_seqnum); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
875 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
876 |
tpi_mp = mi_tpi_conn_ind(NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
877 |
(char *)&sin6, sizeof (sin6_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
878 |
(char *)&tcp, (t_scalar_t)sizeof (intptr_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
879 |
(t_scalar_t)ltcp->tcp_conn_req_seqnum); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
880 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
881 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
882 |
ip6h = (ip6_t *)mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
883 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
884 |
connp->conn_ipversion = IPV6_VERSION; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
885 |
connp->conn_laddr_v6 = ip6h->ip6_dst; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
886 |
connp->conn_faddr_v6 = ip6h->ip6_src; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
887 |
connp->conn_saddr_v6 = connp->conn_laddr_v6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
888 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
889 |
sin6 = sin6_null; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
890 |
sin6.sin6_addr = connp->conn_faddr_v6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
891 |
sin6.sin6_port = connp->conn_fport; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
892 |
sin6.sin6_family = AF_INET6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
893 |
sin6.sin6_flowinfo = ip6h->ip6_vcf & ~IPV6_VERS_AND_FLOW_MASK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
894 |
sin6.__sin6_src_id = ip_srcid_find_addr(&connp->conn_laddr_v6, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
895 |
IPCL_ZONEID(lconnp), tcps->tcps_netstack); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
896 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
897 |
if (IN6_IS_ADDR_LINKSCOPE(&ip6h->ip6_src)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
898 |
/* Pass up the scope_id of remote addr */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
899 |
sin6.sin6_scope_id = ifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
900 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
901 |
sin6.sin6_scope_id = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
902 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
903 |
if (connp->conn_recv_ancillary.crb_recvdstaddr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
904 |
sin6_t sin6d; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
905 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
906 |
sin6d = sin6_null; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
907 |
sin6.sin6_addr = connp->conn_laddr_v6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
908 |
sin6d.sin6_port = connp->conn_lport; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
909 |
sin6d.sin6_family = AF_INET6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
910 |
if (IN6_IS_ADDR_LINKSCOPE(&connp->conn_laddr_v6)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
911 |
sin6d.sin6_scope_id = ifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
912 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
913 |
tpi_mp = mi_tpi_extconn_ind(NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
914 |
(char *)&sin6d, sizeof (sin6_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
915 |
(char *)&tcp, (t_scalar_t)sizeof (intptr_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
916 |
(char *)&sin6d, sizeof (sin6_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
917 |
(t_scalar_t)ltcp->tcp_conn_req_seqnum); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
918 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
919 |
tpi_mp = mi_tpi_conn_ind(NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
920 |
(char *)&sin6, sizeof (sin6_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
921 |
(char *)&tcp, (t_scalar_t)sizeof (intptr_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
922 |
(t_scalar_t)ltcp->tcp_conn_req_seqnum); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
923 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
924 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
925 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
926 |
tcp->tcp_mss = tcps->tcps_mss_def_ipv6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
927 |
return (tpi_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
928 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
929 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
930 |
/* Handle a SYN on an AF_INET socket */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
931 |
static mblk_t * |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
932 |
tcp_conn_create_v4(conn_t *lconnp, conn_t *connp, mblk_t *mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
933 |
ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
934 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
935 |
tcp_t *ltcp = lconnp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
936 |
tcp_t *tcp = connp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
937 |
sin_t sin; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
938 |
mblk_t *tpi_mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
939 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
940 |
ipha_t *ipha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
941 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
942 |
ASSERT(ira->ira_flags & IRAF_IS_IPV4); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
943 |
ipha = (ipha_t *)mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
944 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
945 |
connp->conn_ipversion = IPV4_VERSION; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
946 |
IN6_IPADDR_TO_V4MAPPED(ipha->ipha_dst, &connp->conn_laddr_v6); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
947 |
IN6_IPADDR_TO_V4MAPPED(ipha->ipha_src, &connp->conn_faddr_v6); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
948 |
connp->conn_saddr_v6 = connp->conn_laddr_v6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
949 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
950 |
sin = sin_null; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
951 |
sin.sin_addr.s_addr = connp->conn_faddr_v4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
952 |
sin.sin_port = connp->conn_fport; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
953 |
sin.sin_family = AF_INET; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
954 |
if (lconnp->conn_recv_ancillary.crb_recvdstaddr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
955 |
sin_t sind; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
956 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
957 |
sind = sin_null; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
958 |
sind.sin_addr.s_addr = connp->conn_laddr_v4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
959 |
sind.sin_port = connp->conn_lport; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
960 |
sind.sin_family = AF_INET; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
961 |
tpi_mp = mi_tpi_extconn_ind(NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
962 |
(char *)&sind, sizeof (sin_t), (char *)&tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
963 |
(t_scalar_t)sizeof (intptr_t), (char *)&sind, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
964 |
sizeof (sin_t), (t_scalar_t)ltcp->tcp_conn_req_seqnum); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
965 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
966 |
tpi_mp = mi_tpi_conn_ind(NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
967 |
(char *)&sin, sizeof (sin_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
968 |
(char *)&tcp, (t_scalar_t)sizeof (intptr_t), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
969 |
(t_scalar_t)ltcp->tcp_conn_req_seqnum); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
970 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
971 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
972 |
tcp->tcp_mss = tcps->tcps_mss_def_ipv4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
973 |
return (tpi_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
974 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
975 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
976 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
977 |
* Called via squeue to get on to eager's perimeter. It sends a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
978 |
* TH_RST if eager is in the fanout table. The listener wants the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
979 |
* eager to disappear either by means of tcp_eager_blowoff() or |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
980 |
* tcp_eager_cleanup() being called. tcp_eager_kill() can also be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
981 |
* called (via squeue) if the eager cannot be inserted in the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
982 |
* fanout table in tcp_input_listener(). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
983 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
984 |
/* ARGSUSED */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
985 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
986 |
tcp_eager_kill(void *arg, mblk_t *mp, void *arg2, ip_recv_attr_t *dummy) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
987 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
988 |
conn_t *econnp = (conn_t *)arg; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
989 |
tcp_t *eager = econnp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
990 |
tcp_t *listener = eager->tcp_listener; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
991 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
992 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
993 |
* We could be called because listener is closing. Since |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
994 |
* the eager was using listener's queue's, we avoid |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
995 |
* using the listeners queues from now on. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
996 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
997 |
ASSERT(eager->tcp_detached); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
998 |
econnp->conn_rq = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
999 |
econnp->conn_wq = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1000 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1001 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1002 |
* An eager's conn_fanout will be NULL if it's a duplicate |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1003 |
* for an existing 4-tuples in the conn fanout table. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1004 |
* We don't want to send an RST out in such case. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1005 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1006 |
if (econnp->conn_fanout != NULL && eager->tcp_state > TCPS_LISTEN) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1007 |
tcp_xmit_ctl("tcp_eager_kill, can't wait", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1008 |
eager, eager->tcp_snxt, 0, TH_RST); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1009 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1010 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1011 |
/* We are here because listener wants this eager gone */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1012 |
if (listener != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1013 |
mutex_enter(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1014 |
tcp_eager_unlink(eager); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1015 |
if (eager->tcp_tconnind_started) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1016 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1017 |
* The eager has sent a conn_ind up to the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1018 |
* listener but listener decides to close |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1019 |
* instead. We need to drop the extra ref |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1020 |
* placed on eager in tcp_input_data() before |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1021 |
* sending the conn_ind to listener. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1022 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1023 |
CONN_DEC_REF(econnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1024 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1025 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1026 |
CONN_DEC_REF(listener->tcp_connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1027 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1028 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1029 |
if (eager->tcp_state != TCPS_CLOSED) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1030 |
tcp_close_detached(eager); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1031 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1032 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1033 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1034 |
* Reset any eager connection hanging off this listener marked |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1035 |
* with 'seqnum' and then reclaim it's resources. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1036 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1037 |
boolean_t |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1038 |
tcp_eager_blowoff(tcp_t *listener, t_scalar_t seqnum) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1039 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1040 |
tcp_t *eager; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1041 |
mblk_t *mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1042 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1043 |
eager = listener; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1044 |
mutex_enter(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1045 |
do { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1046 |
eager = eager->tcp_eager_next_q; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1047 |
if (eager == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1048 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1049 |
return (B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1050 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1051 |
} while (eager->tcp_conn_req_seqnum != seqnum); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1052 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1053 |
if (eager->tcp_closemp_used) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1054 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1055 |
return (B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1056 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1057 |
eager->tcp_closemp_used = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1058 |
TCP_DEBUG_GETPCSTACK(eager->tcmp_stk, 15); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1059 |
CONN_INC_REF(eager->tcp_connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1060 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1061 |
mp = &eager->tcp_closemp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1062 |
SQUEUE_ENTER_ONE(eager->tcp_connp->conn_sqp, mp, tcp_eager_kill, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1063 |
eager->tcp_connp, NULL, SQ_FILL, SQTAG_TCP_EAGER_BLOWOFF); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1064 |
return (B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1065 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1066 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1067 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1068 |
* Reset any eager connection hanging off this listener |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1069 |
* and then reclaim it's resources. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1070 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1071 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1072 |
tcp_eager_cleanup(tcp_t *listener, boolean_t q0_only) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1073 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1074 |
tcp_t *eager; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1075 |
mblk_t *mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1076 |
tcp_stack_t *tcps = listener->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1077 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1078 |
ASSERT(MUTEX_HELD(&listener->tcp_eager_lock)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1079 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1080 |
if (!q0_only) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1081 |
/* First cleanup q */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1082 |
TCP_STAT(tcps, tcp_eager_blowoff_q); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1083 |
eager = listener->tcp_eager_next_q; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1084 |
while (eager != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1085 |
if (!eager->tcp_closemp_used) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1086 |
eager->tcp_closemp_used = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1087 |
TCP_DEBUG_GETPCSTACK(eager->tcmp_stk, 15); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1088 |
CONN_INC_REF(eager->tcp_connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1089 |
mp = &eager->tcp_closemp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1090 |
SQUEUE_ENTER_ONE(eager->tcp_connp->conn_sqp, mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1091 |
tcp_eager_kill, eager->tcp_connp, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1092 |
SQ_FILL, SQTAG_TCP_EAGER_CLEANUP); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1093 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1094 |
eager = eager->tcp_eager_next_q; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1095 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1096 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1097 |
/* Then cleanup q0 */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1098 |
TCP_STAT(tcps, tcp_eager_blowoff_q0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1099 |
eager = listener->tcp_eager_next_q0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1100 |
while (eager != listener) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1101 |
if (!eager->tcp_closemp_used) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1102 |
eager->tcp_closemp_used = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1103 |
TCP_DEBUG_GETPCSTACK(eager->tcmp_stk, 15); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1104 |
CONN_INC_REF(eager->tcp_connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1105 |
mp = &eager->tcp_closemp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1106 |
SQUEUE_ENTER_ONE(eager->tcp_connp->conn_sqp, mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1107 |
tcp_eager_kill, eager->tcp_connp, NULL, SQ_FILL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1108 |
SQTAG_TCP_EAGER_CLEANUP_Q0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1109 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1110 |
eager = eager->tcp_eager_next_q0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1111 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1112 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1113 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1114 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1115 |
* If we are an eager connection hanging off a listener that hasn't |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1116 |
* formally accepted the connection yet, get off his list and blow off |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1117 |
* any data that we have accumulated. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1118 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1119 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1120 |
tcp_eager_unlink(tcp_t *tcp) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1121 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1122 |
tcp_t *listener = tcp->tcp_listener; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1123 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1124 |
ASSERT(listener != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1125 |
ASSERT(MUTEX_HELD(&listener->tcp_eager_lock)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1126 |
if (tcp->tcp_eager_next_q0 != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1127 |
ASSERT(tcp->tcp_eager_prev_q0 != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1128 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1129 |
/* Remove the eager tcp from q0 */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1130 |
tcp->tcp_eager_next_q0->tcp_eager_prev_q0 = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1131 |
tcp->tcp_eager_prev_q0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1132 |
tcp->tcp_eager_prev_q0->tcp_eager_next_q0 = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1133 |
tcp->tcp_eager_next_q0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1134 |
ASSERT(listener->tcp_conn_req_cnt_q0 > 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1135 |
listener->tcp_conn_req_cnt_q0--; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1136 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1137 |
tcp->tcp_eager_next_q0 = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1138 |
tcp->tcp_eager_prev_q0 = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1139 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1140 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1141 |
* Take the eager out, if it is in the list of droppable |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1142 |
* eagers. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1143 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1144 |
MAKE_UNDROPPABLE(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1145 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1146 |
if (tcp->tcp_syn_rcvd_timeout != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1147 |
/* we have timed out before */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1148 |
ASSERT(listener->tcp_syn_rcvd_timeout > 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1149 |
listener->tcp_syn_rcvd_timeout--; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1150 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1151 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1152 |
tcp_t **tcpp = &listener->tcp_eager_next_q; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1153 |
tcp_t *prev = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1154 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1155 |
for (; tcpp[0]; tcpp = &tcpp[0]->tcp_eager_next_q) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1156 |
if (tcpp[0] == tcp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1157 |
if (listener->tcp_eager_last_q == tcp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1158 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1159 |
* If we are unlinking the last |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1160 |
* element on the list, adjust |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1161 |
* tail pointer. Set tail pointer |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1162 |
* to nil when list is empty. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1163 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1164 |
ASSERT(tcp->tcp_eager_next_q == NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1165 |
if (listener->tcp_eager_last_q == |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1166 |
listener->tcp_eager_next_q) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1167 |
listener->tcp_eager_last_q = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1168 |
NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1169 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1170 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1171 |
* We won't get here if there |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1172 |
* is only one eager in the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1173 |
* list. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1174 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1175 |
ASSERT(prev != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1176 |
listener->tcp_eager_last_q = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1177 |
prev; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1178 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1179 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1180 |
tcpp[0] = tcp->tcp_eager_next_q; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1181 |
tcp->tcp_eager_next_q = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1182 |
tcp->tcp_eager_last_q = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1183 |
ASSERT(listener->tcp_conn_req_cnt_q > 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1184 |
listener->tcp_conn_req_cnt_q--; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1185 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1186 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1187 |
prev = tcpp[0]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1188 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1189 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1190 |
tcp->tcp_listener = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1191 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1192 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1193 |
/* BEGIN CSTYLED */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1194 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1195 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1196 |
* The sockfs ACCEPT path: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1197 |
* ======================= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1198 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1199 |
* The eager is now established in its own perimeter as soon as SYN is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1200 |
* received in tcp_input_listener(). When sockfs receives conn_ind, it |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1201 |
* completes the accept processing on the acceptor STREAM. The sending |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1202 |
* of conn_ind part is common for both sockfs listener and a TLI/XTI |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1203 |
* listener but a TLI/XTI listener completes the accept processing |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1204 |
* on the listener perimeter. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1205 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1206 |
* Common control flow for 3 way handshake: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1207 |
* ---------------------------------------- |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1208 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1209 |
* incoming SYN (listener perimeter) -> tcp_input_listener() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1210 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1211 |
* incoming SYN-ACK-ACK (eager perim) -> tcp_input_data() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1212 |
* send T_CONN_IND (listener perim) -> tcp_send_conn_ind() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1213 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1214 |
* Sockfs ACCEPT Path: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1215 |
* ------------------- |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1216 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1217 |
* open acceptor stream (tcp_open allocates tcp_tli_accept() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1218 |
* as STREAM entry point) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1219 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1220 |
* soaccept() sends T_CONN_RES on the acceptor STREAM to tcp_tli_accept() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1221 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1222 |
* tcp_tli_accept() extracts the eager and makes the q->q_ptr <-> eager |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1223 |
* association (we are not behind eager's squeue but sockfs is protecting us |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1224 |
* and no one knows about this stream yet. The STREAMS entry point q->q_info |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1225 |
* is changed to point at tcp_wput(). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1226 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1227 |
* tcp_accept_common() sends any deferred eagers via tcp_send_pending() to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1228 |
* listener (done on listener's perimeter). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1229 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1230 |
* tcp_tli_accept() calls tcp_accept_finish() on eagers perimeter to finish |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1231 |
* accept. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1232 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1233 |
* TLI/XTI client ACCEPT path: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1234 |
* --------------------------- |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1235 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1236 |
* soaccept() sends T_CONN_RES on the listener STREAM. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1237 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1238 |
* tcp_tli_accept() -> tcp_accept_swap() complete the processing and send |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1239 |
* a M_SETOPS mblk to eager perimeter to finish accept (tcp_accept_finish()). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1240 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1241 |
* Locks: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1242 |
* ====== |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1243 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1244 |
* listener->tcp_eager_lock protects the listeners->tcp_eager_next_q0 and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1245 |
* and listeners->tcp_eager_next_q. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1246 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1247 |
* Referencing: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1248 |
* ============ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1249 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1250 |
* 1) We start out in tcp_input_listener by eager placing a ref on |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1251 |
* listener and listener adding eager to listeners->tcp_eager_next_q0. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1252 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1253 |
* 2) When a SYN-ACK-ACK arrives, we send the conn_ind to listener. Before |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1254 |
* doing so we place a ref on the eager. This ref is finally dropped at the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1255 |
* end of tcp_accept_finish() while unwinding from the squeue, i.e. the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1256 |
* reference is dropped by the squeue framework. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1257 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1258 |
* 3) The ref on listener placed in 1 above is dropped in tcp_accept_finish |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1259 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1260 |
* The reference must be released by the same entity that added the reference |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1261 |
* In the above scheme, the eager is the entity that adds and releases the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1262 |
* references. Note that tcp_accept_finish executes in the squeue of the eager |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1263 |
* (albeit after it is attached to the acceptor stream). Though 1. executes |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1264 |
* in the listener's squeue, the eager is nascent at this point and the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1265 |
* reference can be considered to have been added on behalf of the eager. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1266 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1267 |
* Eager getting a Reset or listener closing: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1268 |
* ========================================== |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1269 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1270 |
* Once the listener and eager are linked, the listener never does the unlink. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1271 |
* If the listener needs to close, tcp_eager_cleanup() is called which queues |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1272 |
* a message on all eager perimeter. The eager then does the unlink, clears |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1273 |
* any pointers to the listener's queue and drops the reference to the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1274 |
* listener. The listener waits in tcp_close outside the squeue until its |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1275 |
* refcount has dropped to 1. This ensures that the listener has waited for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1276 |
* all eagers to clear their association with the listener. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1277 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1278 |
* Similarly, if eager decides to go away, it can unlink itself and close. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1279 |
* When the T_CONN_RES comes down, we check if eager has closed. Note that |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1280 |
* the reference to eager is still valid because of the extra ref we put |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1281 |
* in tcp_send_conn_ind. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1282 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1283 |
* Listener can always locate the eager under the protection |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1284 |
* of the listener->tcp_eager_lock, and then do a refhold |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1285 |
* on the eager during the accept processing. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1286 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1287 |
* The acceptor stream accesses the eager in the accept processing |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1288 |
* based on the ref placed on eager before sending T_conn_ind. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1289 |
* The only entity that can negate this refhold is a listener close |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1290 |
* which is mutually exclusive with an active acceptor stream. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1291 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1292 |
* Eager's reference on the listener |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1293 |
* =================================== |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1294 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1295 |
* If the accept happens (even on a closed eager) the eager drops its |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1296 |
* reference on the listener at the start of tcp_accept_finish. If the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1297 |
* eager is killed due to an incoming RST before the T_conn_ind is sent up, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1298 |
* the reference is dropped in tcp_closei_local. If the listener closes, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1299 |
* the reference is dropped in tcp_eager_kill. In all cases the reference |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1300 |
* is dropped while executing in the eager's context (squeue). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1301 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1302 |
/* END CSTYLED */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1303 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1304 |
/* Process the SYN packet, mp, directed at the listener 'tcp' */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1305 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1306 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1307 |
* THIS FUNCTION IS DIRECTLY CALLED BY IP VIA SQUEUE FOR SYN. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1308 |
* tcp_input_data will not see any packets for listeners since the listener |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1309 |
* has conn_recv set to tcp_input_listener. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1310 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1311 |
/* ARGSUSED */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1312 |
static void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1313 |
tcp_input_listener(void *arg, mblk_t *mp, void *arg2, ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1314 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1315 |
tcpha_t *tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1316 |
uint32_t seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1317 |
tcp_t *eager; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1318 |
int err; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1319 |
conn_t *econnp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1320 |
squeue_t *new_sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1321 |
mblk_t *mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1322 |
uint_t ip_hdr_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1323 |
conn_t *lconnp = (conn_t *)arg; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1324 |
tcp_t *listener = lconnp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1325 |
tcp_stack_t *tcps = listener->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1326 |
ip_stack_t *ipst = tcps->tcps_netstack->netstack_ip; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1327 |
uint_t flags; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1328 |
mblk_t *tpi_mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1329 |
uint_t ifindex = ira->ira_ruifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1330 |
boolean_t tlc_set = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1331 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1332 |
ip_hdr_len = ira->ira_ip_hdr_length; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1333 |
tcpha = (tcpha_t *)&mp->b_rptr[ip_hdr_len]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1334 |
flags = (unsigned int)tcpha->tha_flags & 0xFF; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1335 |
|
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1336 |
DTRACE_TCP5(receive, mblk_t *, NULL, ip_xmit_attr_t *, lconnp->conn_ixa, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1337 |
__dtrace_tcp_void_ip_t *, mp->b_rptr, tcp_t *, listener, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1338 |
__dtrace_tcp_tcph_t *, tcpha); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1339 |
|
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1340 |
if (!(flags & TH_SYN)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1341 |
if ((flags & TH_RST) || (flags & TH_URG)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1342 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1343 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1344 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1345 |
if (flags & TH_ACK) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1346 |
/* Note this executes in listener's squeue */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1347 |
tcp_xmit_listeners_reset(mp, ira, ipst, lconnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1348 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1349 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1350 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1351 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1352 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1353 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1354 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1355 |
if (listener->tcp_state != TCPS_LISTEN) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1356 |
goto error2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1357 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1358 |
ASSERT(IPCL_IS_BOUND(lconnp)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1359 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1360 |
mutex_enter(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1361 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1362 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1363 |
* The system is under memory pressure, so we need to do our part |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1364 |
* to relieve the pressure. So we only accept new request if there |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1365 |
* is nothing waiting to be accepted or waiting to complete the 3-way |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1366 |
* handshake. This means that busy listener will not get too many |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1367 |
* new requests which they cannot handle in time while non-busy |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1368 |
* listener is still functioning properly. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1369 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1370 |
if (tcps->tcps_reclaim && (listener->tcp_conn_req_cnt_q > 0 || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1371 |
listener->tcp_conn_req_cnt_q0 > 0)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1372 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1373 |
TCP_STAT(tcps, tcp_listen_mem_drop); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1374 |
goto error2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1375 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1376 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1377 |
if (listener->tcp_conn_req_cnt_q >= listener->tcp_conn_req_max) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1378 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1379 |
TCP_STAT(tcps, tcp_listendrop); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1380 |
TCPS_BUMP_MIB(tcps, tcpListenDrop); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1381 |
if (lconnp->conn_debug) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1382 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE|SL_ERROR, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1383 |
"tcp_input_listener: listen backlog (max=%d) " |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1384 |
"overflow (%d pending) on %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1385 |
listener->tcp_conn_req_max, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1386 |
listener->tcp_conn_req_cnt_q, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1387 |
tcp_display(listener, NULL, DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1388 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1389 |
goto error2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1390 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1391 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1392 |
if (listener->tcp_conn_req_cnt_q0 >= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1393 |
listener->tcp_conn_req_max + tcps->tcps_conn_req_max_q0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1394 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1395 |
* Q0 is full. Drop a pending half-open req from the queue |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1396 |
* to make room for the new SYN req. Also mark the time we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1397 |
* drop a SYN. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1398 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1399 |
* A more aggressive defense against SYN attack will |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1400 |
* be to set the "tcp_syn_defense" flag now. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1401 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1402 |
TCP_STAT(tcps, tcp_listendropq0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1403 |
listener->tcp_last_rcv_lbolt = ddi_get_lbolt64(); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1404 |
if (!tcp_drop_q0(listener)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1405 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1406 |
TCPS_BUMP_MIB(tcps, tcpListenDropQ0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1407 |
if (lconnp->conn_debug) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1408 |
(void) strlog(TCP_MOD_ID, 0, 3, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1409 |
"tcp_input_listener: listen half-open " |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1410 |
"queue (max=%d) full (%d pending) on %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1411 |
tcps->tcps_conn_req_max_q0, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1412 |
listener->tcp_conn_req_cnt_q0, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1413 |
tcp_display(listener, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1414 |
DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1415 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1416 |
goto error2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1417 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1418 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1419 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1420 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1421 |
* Enforce the limit set on the number of connections per listener. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1422 |
* Note that tlc_cnt starts with 1. So need to add 1 to tlc_max |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1423 |
* for comparison. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1424 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1425 |
if (listener->tcp_listen_cnt != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1426 |
tcp_listen_cnt_t *tlc = listener->tcp_listen_cnt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1427 |
int64_t now; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1428 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1429 |
if (atomic_add_32_nv(&tlc->tlc_cnt, 1) > tlc->tlc_max + 1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1430 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1431 |
now = ddi_get_lbolt64(); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1432 |
atomic_add_32(&tlc->tlc_cnt, -1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1433 |
TCP_STAT(tcps, tcp_listen_cnt_drop); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1434 |
tlc->tlc_drop++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1435 |
if (now - tlc->tlc_report_time > |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1436 |
MSEC_TO_TICK(TCP_TLC_REPORT_INTERVAL)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1437 |
zcmn_err(lconnp->conn_zoneid, CE_WARN, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1438 |
"Listener (port %d) connection max (%u) " |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1439 |
"reached: %u attempts dropped total\n", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1440 |
ntohs(listener->tcp_connp->conn_lport), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1441 |
tlc->tlc_max, tlc->tlc_drop); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1442 |
tlc->tlc_report_time = now; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1443 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1444 |
goto error2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1445 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1446 |
tlc_set = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1447 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1448 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1449 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1450 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1451 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1452 |
* IP sets ira_sqp to either the senders conn_sqp (for loopback) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1453 |
* or based on the ring (for packets from GLD). Otherwise it is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1454 |
* set based on lbolt i.e., a somewhat random number. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1455 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1456 |
ASSERT(ira->ira_sqp != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1457 |
new_sqp = ira->ira_sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1458 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1459 |
econnp = (conn_t *)tcp_get_conn(arg2, tcps); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1460 |
if (econnp == NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1461 |
goto error2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1462 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1463 |
ASSERT(econnp->conn_netstack == lconnp->conn_netstack); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1464 |
econnp->conn_sqp = new_sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1465 |
econnp->conn_initial_sqp = new_sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1466 |
econnp->conn_ixa->ixa_sqp = new_sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1467 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1468 |
econnp->conn_fport = tcpha->tha_lport; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1469 |
econnp->conn_lport = tcpha->tha_fport; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1470 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1471 |
err = conn_inherit_parent(lconnp, econnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1472 |
if (err != 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1473 |
goto error3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1474 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1475 |
/* We already know the laddr of the new connection is ours */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1476 |
econnp->conn_ixa->ixa_src_generation = ipst->ips_src_generation; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1477 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1478 |
ASSERT(OK_32PTR(mp->b_rptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1479 |
ASSERT(IPH_HDR_VERSION(mp->b_rptr) == IPV4_VERSION || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1480 |
IPH_HDR_VERSION(mp->b_rptr) == IPV6_VERSION); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1481 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1482 |
if (lconnp->conn_family == AF_INET) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1483 |
ASSERT(IPH_HDR_VERSION(mp->b_rptr) == IPV4_VERSION); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1484 |
tpi_mp = tcp_conn_create_v4(lconnp, econnp, mp, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1485 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1486 |
tpi_mp = tcp_conn_create_v6(lconnp, econnp, mp, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1487 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1488 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1489 |
if (tpi_mp == NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1490 |
goto error3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1491 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1492 |
eager = econnp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1493 |
eager->tcp_detached = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1494 |
SOCK_CONNID_INIT(eager->tcp_connid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1495 |
|
12544
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12507
diff
changeset
|
1496 |
/* |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12507
diff
changeset
|
1497 |
* Initialize the eager's tcp_t and inherit some parameters from |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12507
diff
changeset
|
1498 |
* the listener. |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12507
diff
changeset
|
1499 |
*/ |
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12507
diff
changeset
|
1500 |
tcp_init_values(eager, listener); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1501 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1502 |
ASSERT((econnp->conn_ixa->ixa_flags & |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1503 |
(IXAF_SET_ULP_CKSUM | IXAF_VERIFY_SOURCE | |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1504 |
IXAF_VERIFY_PMTU | IXAF_VERIFY_LSO)) == |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1505 |
(IXAF_SET_ULP_CKSUM | IXAF_VERIFY_SOURCE | |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1506 |
IXAF_VERIFY_PMTU | IXAF_VERIFY_LSO)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1507 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1508 |
if (!tcps->tcps_dev_flow_ctl) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1509 |
econnp->conn_ixa->ixa_flags |= IXAF_NO_DEV_FLOW_CTL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1510 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1511 |
/* Prepare for diffing against previous packets */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1512 |
eager->tcp_recvifindex = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1513 |
eager->tcp_recvhops = 0xffffffffU; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1514 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1515 |
if (!(ira->ira_flags & IRAF_IS_IPV4) && econnp->conn_bound_if == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1516 |
if (IN6_IS_ADDR_LINKSCOPE(&econnp->conn_faddr_v6) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1517 |
IN6_IS_ADDR_LINKSCOPE(&econnp->conn_laddr_v6)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1518 |
econnp->conn_incoming_ifindex = ifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1519 |
econnp->conn_ixa->ixa_flags |= IXAF_SCOPEID_SET; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1520 |
econnp->conn_ixa->ixa_scopeid = ifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1521 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1522 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1523 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1524 |
if ((ira->ira_flags & (IRAF_IS_IPV4|IRAF_IPV4_OPTIONS)) == |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1525 |
(IRAF_IS_IPV4|IRAF_IPV4_OPTIONS) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1526 |
tcps->tcps_rev_src_routes) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1527 |
ipha_t *ipha = (ipha_t *)mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1528 |
ip_pkt_t *ipp = &econnp->conn_xmit_ipp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1529 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1530 |
/* Source routing option copyover (reverse it) */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1531 |
err = ip_find_hdr_v4(ipha, ipp, B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1532 |
if (err != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1533 |
freemsg(tpi_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1534 |
goto error3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1535 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1536 |
ip_pkt_source_route_reverse_v4(ipp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1537 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1538 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1539 |
ASSERT(eager->tcp_conn.tcp_eager_conn_ind == NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1540 |
ASSERT(!eager->tcp_tconnind_started); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1541 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1542 |
* If the SYN came with a credential, it's a loopback packet or a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1543 |
* labeled packet; attach the credential to the TPI message. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1544 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1545 |
if (ira->ira_cred != NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1546 |
mblk_setcred(tpi_mp, ira->ira_cred, ira->ira_cpid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1547 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1548 |
eager->tcp_conn.tcp_eager_conn_ind = tpi_mp; |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
1549 |
ASSERT(eager->tcp_ordrel_mp == NULL); |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
1550 |
|
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1551 |
/* Inherit the listener's non-STREAMS flag */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1552 |
if (IPCL_IS_NONSTR(lconnp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1553 |
econnp->conn_flags |= IPCL_NONSTR; |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
1554 |
/* All non-STREAMS tcp_ts are sockets */ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
1555 |
eager->tcp_issocket = B_TRUE; |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
1556 |
} else { |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1557 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1558 |
* Pre-allocate the T_ordrel_ind mblk for TPI socket so that |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1559 |
* at close time, we will always have that to send up. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1560 |
* Otherwise, we need to do special handling in case the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1561 |
* allocation fails at that time. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1562 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1563 |
if ((eager->tcp_ordrel_mp = mi_tpi_ordrel_ind()) == NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1564 |
goto error3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1565 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1566 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1567 |
* Now that the IP addresses and ports are setup in econnp we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1568 |
* can do the IPsec policy work. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1569 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1570 |
if (ira->ira_flags & IRAF_IPSEC_SECURE) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1571 |
if (lconnp->conn_policy != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1572 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1573 |
* Inherit the policy from the listener; use |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1574 |
* actions from ira |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1575 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1576 |
if (!ip_ipsec_policy_inherit(econnp, lconnp, ira)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1577 |
CONN_DEC_REF(econnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1578 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1579 |
goto error3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1580 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1581 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1582 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1583 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1584 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1585 |
* tcp_set_destination() may set tcp_rwnd according to the route |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1586 |
* metrics. If it does not, the eager's receive window will be set |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1587 |
* to the listener's receive window later in this function. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1588 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1589 |
eager->tcp_rwnd = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1590 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1591 |
if (is_system_labeled()) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1592 |
ip_xmit_attr_t *ixa = econnp->conn_ixa; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1593 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1594 |
ASSERT(ira->ira_tsl != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1595 |
/* Discard any old label */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1596 |
if (ixa->ixa_free_flags & IXA_FREE_TSL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1597 |
ASSERT(ixa->ixa_tsl != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1598 |
label_rele(ixa->ixa_tsl); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1599 |
ixa->ixa_free_flags &= ~IXA_FREE_TSL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1600 |
ixa->ixa_tsl = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1601 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1602 |
if ((lconnp->conn_mlp_type != mlptSingle || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1603 |
lconnp->conn_mac_mode != CONN_MAC_DEFAULT) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1604 |
ira->ira_tsl != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1605 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1606 |
* If this is an MLP connection or a MAC-Exempt |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1607 |
* connection with an unlabeled node, packets are to be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1608 |
* exchanged using the security label of the received |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1609 |
* SYN packet instead of the server application's label. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1610 |
* tsol_check_dest called from ip_set_destination |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1611 |
* might later update TSF_UNLABELED by replacing |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1612 |
* ixa_tsl with a new label. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1613 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1614 |
label_hold(ira->ira_tsl); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1615 |
ip_xmit_attr_replace_tsl(ixa, ira->ira_tsl); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1616 |
DTRACE_PROBE2(mlp_syn_accept, conn_t *, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1617 |
econnp, ts_label_t *, ixa->ixa_tsl) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1618 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1619 |
ixa->ixa_tsl = crgetlabel(econnp->conn_cred); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1620 |
DTRACE_PROBE2(syn_accept, conn_t *, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1621 |
econnp, ts_label_t *, ixa->ixa_tsl) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1622 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1623 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1624 |
* conn_connect() called from tcp_set_destination will verify |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1625 |
* the destination is allowed to receive packets at the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1626 |
* security label of the SYN-ACK we are generating. As part of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1627 |
* that, tsol_check_dest() may create a new effective label for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1628 |
* this connection. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1629 |
* Finally conn_connect() will call conn_update_label. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1630 |
* All that remains for TCP to do is to call |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1631 |
* conn_build_hdr_template which is done as part of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1632 |
* tcp_set_destination. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1633 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1634 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1635 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1636 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1637 |
* Since we will clear tcp_listener before we clear tcp_detached |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1638 |
* in the accept code we need tcp_hard_binding aka tcp_accept_inprogress |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
1639 |
* so we can tell a TCP_IS_DETACHED_NONEAGER apart. |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1640 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1641 |
eager->tcp_hard_binding = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1642 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1643 |
tcp_bind_hash_insert(&tcps->tcps_bind_fanout[ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1644 |
TCP_BIND_HASH(econnp->conn_lport)], eager, 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1645 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1646 |
CL_INET_CONNECT(econnp, B_FALSE, err); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1647 |
if (err != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1648 |
tcp_bind_hash_remove(eager); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1649 |
goto error3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1650 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1651 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1652 |
SOCK_CONNID_BUMP(eager->tcp_connid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1653 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1654 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1655 |
* Adapt our mss, ttl, ... based on the remote address. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1656 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1657 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1658 |
if (tcp_set_destination(eager) != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1659 |
TCPS_BUMP_MIB(tcps, tcpAttemptFails); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1660 |
/* Undo the bind_hash_insert */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1661 |
tcp_bind_hash_remove(eager); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1662 |
goto error3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1663 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1664 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1665 |
/* Process all TCP options. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1666 |
tcp_process_options(eager, tcpha); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1667 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1668 |
/* Is the other end ECN capable? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1669 |
if (tcps->tcps_ecn_permitted >= 1 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1670 |
(tcpha->tha_flags & (TH_ECE|TH_CWR)) == (TH_ECE|TH_CWR)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1671 |
eager->tcp_ecn_ok = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1672 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1673 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1674 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1675 |
* The listener's conn_rcvbuf should be the default window size or a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1676 |
* window size changed via SO_RCVBUF option. First round up the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1677 |
* eager's tcp_rwnd to the nearest MSS. Then find out the window |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1678 |
* scale option value if needed. Call tcp_rwnd_set() to finish the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1679 |
* setting. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1680 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1681 |
* Note if there is a rpipe metric associated with the remote host, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1682 |
* we should not inherit receive window size from listener. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1683 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1684 |
eager->tcp_rwnd = MSS_ROUNDUP( |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1685 |
(eager->tcp_rwnd == 0 ? econnp->conn_rcvbuf : |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1686 |
eager->tcp_rwnd), eager->tcp_mss); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1687 |
if (eager->tcp_snd_ws_ok) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1688 |
tcp_set_ws_value(eager); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1689 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1690 |
* Note that this is the only place tcp_rwnd_set() is called for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1691 |
* accepting a connection. We need to call it here instead of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1692 |
* after the 3-way handshake because we need to tell the other |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1693 |
* side our rwnd in the SYN-ACK segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1694 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1695 |
(void) tcp_rwnd_set(eager, eager->tcp_rwnd); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1696 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1697 |
ASSERT(eager->tcp_connp->conn_rcvbuf != 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1698 |
eager->tcp_connp->conn_rcvbuf == eager->tcp_rwnd); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1699 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1700 |
ASSERT(econnp->conn_rcvbuf != 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1701 |
econnp->conn_rcvbuf == eager->tcp_rwnd); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1702 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1703 |
/* Put a ref on the listener for the eager. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1704 |
CONN_INC_REF(lconnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1705 |
mutex_enter(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1706 |
listener->tcp_eager_next_q0->tcp_eager_prev_q0 = eager; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1707 |
eager->tcp_eager_next_q0 = listener->tcp_eager_next_q0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1708 |
listener->tcp_eager_next_q0 = eager; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1709 |
eager->tcp_eager_prev_q0 = listener; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1710 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1711 |
/* Set tcp_listener before adding it to tcp_conn_fanout */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1712 |
eager->tcp_listener = listener; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1713 |
eager->tcp_saved_listener = listener; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1714 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1715 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1716 |
* Set tcp_listen_cnt so that when the connection is done, the counter |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1717 |
* is decremented. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1718 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1719 |
eager->tcp_listen_cnt = listener->tcp_listen_cnt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1720 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1721 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1722 |
* Tag this detached tcp vector for later retrieval |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1723 |
* by our listener client in tcp_accept(). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1724 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1725 |
eager->tcp_conn_req_seqnum = listener->tcp_conn_req_seqnum; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1726 |
listener->tcp_conn_req_cnt_q0++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1727 |
if (++listener->tcp_conn_req_seqnum == -1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1728 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1729 |
* -1 is "special" and defined in TPI as something |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1730 |
* that should never be used in T_CONN_IND |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1731 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1732 |
++listener->tcp_conn_req_seqnum; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1733 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1734 |
mutex_exit(&listener->tcp_eager_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1735 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1736 |
if (listener->tcp_syn_defense) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1737 |
/* Don't drop the SYN that comes from a good IP source */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1738 |
ipaddr_t *addr_cache; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1739 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1740 |
addr_cache = (ipaddr_t *)(listener->tcp_ip_addr_cache); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1741 |
if (addr_cache != NULL && econnp->conn_faddr_v4 == |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1742 |
addr_cache[IP_ADDR_CACHE_HASH(econnp->conn_faddr_v4)]) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1743 |
eager->tcp_dontdrop = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1744 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1745 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1746 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1747 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1748 |
* We need to insert the eager in its own perimeter but as soon |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1749 |
* as we do that, we expose the eager to the classifier and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1750 |
* should not touch any field outside the eager's perimeter. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1751 |
* So do all the work necessary before inserting the eager |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1752 |
* in its own perimeter. Be optimistic that conn_connect() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1753 |
* will succeed but undo everything if it fails. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1754 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1755 |
seg_seq = ntohl(tcpha->tha_seq); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1756 |
eager->tcp_irs = seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1757 |
eager->tcp_rack = seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1758 |
eager->tcp_rnxt = seg_seq + 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1759 |
eager->tcp_tcpha->tha_ack = htonl(eager->tcp_rnxt); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1760 |
TCPS_BUMP_MIB(tcps, tcpPassiveOpens); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1761 |
eager->tcp_state = TCPS_SYN_RCVD; |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1762 |
DTRACE_TCP6(state__change, void, NULL, ip_xmit_attr_t *, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1763 |
econnp->conn_ixa, void, NULL, tcp_t *, eager, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1764 |
int32_t, TCPS_LISTEN); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1765 |
|
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1766 |
mp1 = tcp_xmit_mp(eager, eager->tcp_xmit_head, eager->tcp_mss, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1767 |
NULL, NULL, eager->tcp_iss, B_FALSE, NULL, B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1768 |
if (mp1 == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1769 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1770 |
* Increment the ref count as we are going to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1771 |
* enqueueing an mp in squeue |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1772 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1773 |
CONN_INC_REF(econnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1774 |
goto error; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1775 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1776 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1777 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1778 |
* We need to start the rto timer. In normal case, we start |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1779 |
* the timer after sending the packet on the wire (or at |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1780 |
* least believing that packet was sent by waiting for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1781 |
* conn_ip_output() to return). Since this is the first packet |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1782 |
* being sent on the wire for the eager, our initial tcp_rto |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1783 |
* is at least tcp_rexmit_interval_min which is a fairly |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1784 |
* large value to allow the algorithm to adjust slowly to large |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1785 |
* fluctuations of RTT during first few transmissions. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1786 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1787 |
* Starting the timer first and then sending the packet in this |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1788 |
* case shouldn't make much difference since tcp_rexmit_interval_min |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1789 |
* is of the order of several 100ms and starting the timer |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1790 |
* first and then sending the packet will result in difference |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1791 |
* of few micro seconds. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1792 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1793 |
* Without this optimization, we are forced to hold the fanout |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1794 |
* lock across the ipcl_bind_insert() and sending the packet |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1795 |
* so that we don't race against an incoming packet (maybe RST) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1796 |
* for this eager. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1797 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1798 |
* It is necessary to acquire an extra reference on the eager |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1799 |
* at this point and hold it until after tcp_send_data() to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1800 |
* ensure against an eager close race. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1801 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1802 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1803 |
CONN_INC_REF(econnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1804 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1805 |
TCP_TIMER_RESTART(eager, eager->tcp_rto); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1806 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1807 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1808 |
* Insert the eager in its own perimeter now. We are ready to deal |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1809 |
* with any packets on eager. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1810 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1811 |
if (ipcl_conn_insert(econnp) != 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1812 |
goto error; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1813 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1814 |
ASSERT(econnp->conn_ixa->ixa_notify_cookie == econnp->conn_tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1815 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1816 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1817 |
* Send the SYN-ACK. Use the right squeue so that conn_ixa is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1818 |
* only used by one thread at a time. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1819 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1820 |
if (econnp->conn_sqp == lconnp->conn_sqp) { |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1821 |
DTRACE_TCP5(send, mblk_t *, NULL, ip_xmit_attr_t *, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1822 |
econnp->conn_ixa, __dtrace_tcp_void_ip_t *, mp1->b_rptr, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1823 |
tcp_t *, eager, __dtrace_tcp_tcph_t *, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
1824 |
&mp1->b_rptr[econnp->conn_ixa->ixa_ip_hdr_length]); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1825 |
(void) conn_ip_output(mp1, econnp->conn_ixa); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1826 |
CONN_DEC_REF(econnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1827 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1828 |
SQUEUE_ENTER_ONE(econnp->conn_sqp, mp1, tcp_send_synack, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1829 |
econnp, NULL, SQ_PROCESS, SQTAG_TCP_SEND_SYNACK); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1830 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1831 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1832 |
error: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1833 |
freemsg(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1834 |
eager->tcp_closemp_used = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1835 |
TCP_DEBUG_GETPCSTACK(eager->tcmp_stk, 15); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1836 |
mp1 = &eager->tcp_closemp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1837 |
SQUEUE_ENTER_ONE(econnp->conn_sqp, mp1, tcp_eager_kill, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1838 |
econnp, NULL, SQ_FILL, SQTAG_TCP_CONN_REQ_2); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1839 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1840 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1841 |
* If a connection already exists, send the mp to that connections so |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1842 |
* that it can be appropriately dealt with. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1843 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1844 |
ipst = tcps->tcps_netstack->netstack_ip; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1845 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1846 |
if ((econnp = ipcl_classify(mp, ira, ipst)) != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1847 |
if (!IPCL_IS_CONNECTED(econnp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1848 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1849 |
* Something bad happened. ipcl_conn_insert() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1850 |
* failed because a connection already existed |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1851 |
* in connected hash but we can't find it |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1852 |
* anymore (someone blew it away). Just |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1853 |
* free this message and hopefully remote |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1854 |
* will retransmit at which time the SYN can be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1855 |
* treated as a new connection or dealth with |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1856 |
* a TH_RST if a connection already exists. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1857 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1858 |
CONN_DEC_REF(econnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1859 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1860 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1861 |
SQUEUE_ENTER_ONE(econnp->conn_sqp, mp, tcp_input_data, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1862 |
econnp, ira, SQ_FILL, SQTAG_TCP_CONN_REQ_1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1863 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1864 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1865 |
/* Nobody wants this packet */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1866 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1867 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1868 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1869 |
error3: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1870 |
CONN_DEC_REF(econnp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1871 |
error2: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1872 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1873 |
if (tlc_set) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1874 |
atomic_add_32(&listener->tcp_listen_cnt->tlc_cnt, -1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1875 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1876 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1877 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1878 |
* In an ideal case of vertical partition in NUMA architecture, its |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1879 |
* beneficial to have the listener and all the incoming connections |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1880 |
* tied to the same squeue. The other constraint is that incoming |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1881 |
* connections should be tied to the squeue attached to interrupted |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1882 |
* CPU for obvious locality reason so this leaves the listener to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1883 |
* be tied to the same squeue. Our only problem is that when listener |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1884 |
* is binding, the CPU that will get interrupted by the NIC whose |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1885 |
* IP address the listener is binding to is not even known. So |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1886 |
* the code below allows us to change that binding at the time the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1887 |
* CPU is interrupted by virtue of incoming connection's squeue. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1888 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1889 |
* This is usefull only in case of a listener bound to a specific IP |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1890 |
* address. For other kind of listeners, they get bound the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1891 |
* very first time and there is no attempt to rebind them. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1892 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1893 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1894 |
tcp_input_listener_unbound(void *arg, mblk_t *mp, void *arg2, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1895 |
ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1896 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1897 |
conn_t *connp = (conn_t *)arg; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1898 |
squeue_t *sqp = (squeue_t *)arg2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1899 |
squeue_t *new_sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1900 |
uint32_t conn_flags; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1901 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1902 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1903 |
* IP sets ira_sqp to either the senders conn_sqp (for loopback) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1904 |
* or based on the ring (for packets from GLD). Otherwise it is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1905 |
* set based on lbolt i.e., a somewhat random number. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1906 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1907 |
ASSERT(ira->ira_sqp != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1908 |
new_sqp = ira->ira_sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1909 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1910 |
if (connp->conn_fanout == NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1911 |
goto done; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1912 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1913 |
if (!(connp->conn_flags & IPCL_FULLY_BOUND)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1914 |
mutex_enter(&connp->conn_fanout->connf_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1915 |
mutex_enter(&connp->conn_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1916 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1917 |
* No one from read or write side can access us now |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1918 |
* except for already queued packets on this squeue. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1919 |
* But since we haven't changed the squeue yet, they |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1920 |
* can't execute. If they are processed after we have |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1921 |
* changed the squeue, they are sent back to the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1922 |
* correct squeue down below. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1923 |
* But a listner close can race with processing of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1924 |
* incoming SYN. If incoming SYN processing changes |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1925 |
* the squeue then the listener close which is waiting |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1926 |
* to enter the squeue would operate on the wrong |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1927 |
* squeue. Hence we don't change the squeue here unless |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1928 |
* the refcount is exactly the minimum refcount. The |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1929 |
* minimum refcount of 4 is counted as - 1 each for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1930 |
* TCP and IP, 1 for being in the classifier hash, and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1931 |
* 1 for the mblk being processed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1932 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1933 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1934 |
if (connp->conn_ref != 4 || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1935 |
connp->conn_tcp->tcp_state != TCPS_LISTEN) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1936 |
mutex_exit(&connp->conn_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1937 |
mutex_exit(&connp->conn_fanout->connf_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1938 |
goto done; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1939 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1940 |
if (connp->conn_sqp != new_sqp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1941 |
while (connp->conn_sqp != new_sqp) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1942 |
(void) casptr(&connp->conn_sqp, sqp, new_sqp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1943 |
/* No special MT issues for outbound ixa_sqp hint */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1944 |
connp->conn_ixa->ixa_sqp = new_sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1945 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1946 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1947 |
do { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1948 |
conn_flags = connp->conn_flags; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1949 |
conn_flags |= IPCL_FULLY_BOUND; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1950 |
(void) cas32(&connp->conn_flags, connp->conn_flags, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1951 |
conn_flags); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1952 |
} while (!(connp->conn_flags & IPCL_FULLY_BOUND)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1953 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1954 |
mutex_exit(&connp->conn_fanout->connf_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1955 |
mutex_exit(&connp->conn_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1956 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1957 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1958 |
* Assume we have picked a good squeue for the listener. Make |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1959 |
* subsequent SYNs not try to change the squeue. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1960 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1961 |
connp->conn_recv = tcp_input_listener; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1962 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1963 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1964 |
done: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1965 |
if (connp->conn_sqp != sqp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1966 |
CONN_INC_REF(connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1967 |
SQUEUE_ENTER_ONE(connp->conn_sqp, mp, connp->conn_recv, connp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1968 |
ira, SQ_FILL, SQTAG_TCP_CONN_REQ_UNBOUND); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1969 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1970 |
tcp_input_listener(connp, mp, sqp, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1971 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1972 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1973 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1974 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1975 |
* Send up all messages queued on tcp_rcv_list. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1976 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1977 |
uint_t |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1978 |
tcp_rcv_drain(tcp_t *tcp) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1979 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1980 |
mblk_t *mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1981 |
uint_t ret = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1982 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1983 |
uint_t cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1984 |
#endif |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1985 |
queue_t *q = tcp->tcp_connp->conn_rq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1986 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1987 |
/* Can't drain on an eager connection */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1988 |
if (tcp->tcp_listener != NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1989 |
return (ret); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1990 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1991 |
/* Can't be a non-STREAMS connection */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1992 |
ASSERT(!IPCL_IS_NONSTR(tcp->tcp_connp)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1993 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1994 |
/* No need for the push timer now. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1995 |
if (tcp->tcp_push_tid != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1996 |
(void) TCP_TIMER_CANCEL(tcp, tcp->tcp_push_tid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1997 |
tcp->tcp_push_tid = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1998 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
1999 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2000 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2001 |
* Handle two cases here: we are currently fused or we were |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2002 |
* previously fused and have some urgent data to be delivered |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2003 |
* upstream. The latter happens because we either ran out of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2004 |
* memory or were detached and therefore sending the SIGURG was |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2005 |
* deferred until this point. In either case we pass control |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2006 |
* over to tcp_fuse_rcv_drain() since it may need to complete |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2007 |
* some work. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2008 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2009 |
if ((tcp->tcp_fused || tcp->tcp_fused_sigurg)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2010 |
if (tcp_fuse_rcv_drain(q, tcp, tcp->tcp_fused ? NULL : |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2011 |
&tcp->tcp_fused_sigurg_mp)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2012 |
return (ret); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2013 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2014 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2015 |
while ((mp = tcp->tcp_rcv_list) != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2016 |
tcp->tcp_rcv_list = mp->b_next; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2017 |
mp->b_next = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2018 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2019 |
cnt += msgdsize(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2020 |
#endif |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2021 |
putnext(q, mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2022 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2023 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2024 |
ASSERT(cnt == tcp->tcp_rcv_cnt); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2025 |
#endif |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2026 |
tcp->tcp_rcv_last_head = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2027 |
tcp->tcp_rcv_last_tail = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2028 |
tcp->tcp_rcv_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2029 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2030 |
if (canputnext(q)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2031 |
return (tcp_rwnd_reopen(tcp)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2032 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2033 |
return (ret); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2034 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2035 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2036 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2037 |
* Queue data on tcp_rcv_list which is a b_next chain. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2038 |
* tcp_rcv_last_head/tail is the last element of this chain. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2039 |
* Each element of the chain is a b_cont chain. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2040 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2041 |
* M_DATA messages are added to the current element. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2042 |
* Other messages are added as new (b_next) elements. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2043 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2044 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2045 |
tcp_rcv_enqueue(tcp_t *tcp, mblk_t *mp, uint_t seg_len, cred_t *cr) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2046 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2047 |
ASSERT(seg_len == msgdsize(mp)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2048 |
ASSERT(tcp->tcp_rcv_list == NULL || tcp->tcp_rcv_last_head != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2049 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2050 |
if (is_system_labeled()) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2051 |
ASSERT(cr != NULL || msg_getcred(mp, NULL) != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2052 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2053 |
* Provide for protocols above TCP such as RPC. NOPID leaves |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2054 |
* db_cpid unchanged. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2055 |
* The cred could have already been set. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2056 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2057 |
if (cr != NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2058 |
mblk_setcred(mp, cr, NOPID); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2059 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2060 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2061 |
if (tcp->tcp_rcv_list == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2062 |
ASSERT(tcp->tcp_rcv_last_head == NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2063 |
tcp->tcp_rcv_list = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2064 |
tcp->tcp_rcv_last_head = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2065 |
} else if (DB_TYPE(mp) == DB_TYPE(tcp->tcp_rcv_last_head)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2066 |
tcp->tcp_rcv_last_tail->b_cont = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2067 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2068 |
tcp->tcp_rcv_last_head->b_next = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2069 |
tcp->tcp_rcv_last_head = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2070 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2071 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2072 |
while (mp->b_cont) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2073 |
mp = mp->b_cont; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2074 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2075 |
tcp->tcp_rcv_last_tail = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2076 |
tcp->tcp_rcv_cnt += seg_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2077 |
tcp->tcp_rwnd -= seg_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2078 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2079 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2080 |
/* Generate an ACK-only (no data) segment for a TCP endpoint */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2081 |
mblk_t * |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2082 |
tcp_ack_mp(tcp_t *tcp) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2083 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2084 |
uint32_t seq_no; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2085 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2086 |
conn_t *connp = tcp->tcp_connp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2087 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2088 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2089 |
* There are a few cases to be considered while setting the sequence no. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2090 |
* Essentially, we can come here while processing an unacceptable pkt |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2091 |
* in the TCPS_SYN_RCVD state, in which case we set the sequence number |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2092 |
* to snxt (per RFC 793), note the swnd wouldn't have been set yet. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2093 |
* If we are here for a zero window probe, stick with suna. In all |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2094 |
* other cases, we check if suna + swnd encompasses snxt and set |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2095 |
* the sequence number to snxt, if so. If snxt falls outside the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2096 |
* window (the receiver probably shrunk its window), we will go with |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2097 |
* suna + swnd, otherwise the sequence no will be unacceptable to the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2098 |
* receiver. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2099 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2100 |
if (tcp->tcp_zero_win_probe) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2101 |
seq_no = tcp->tcp_suna; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2102 |
} else if (tcp->tcp_state == TCPS_SYN_RCVD) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2103 |
ASSERT(tcp->tcp_swnd == 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2104 |
seq_no = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2105 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2106 |
seq_no = SEQ_GT(tcp->tcp_snxt, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2107 |
(tcp->tcp_suna + tcp->tcp_swnd)) ? |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2108 |
(tcp->tcp_suna + tcp->tcp_swnd) : tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2109 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2110 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2111 |
if (tcp->tcp_valid_bits) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2112 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2113 |
* For the complex case where we have to send some |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2114 |
* controls (FIN or SYN), let tcp_xmit_mp do it. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2115 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2116 |
return (tcp_xmit_mp(tcp, NULL, 0, NULL, NULL, seq_no, B_FALSE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2117 |
NULL, B_FALSE)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2118 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2119 |
/* Generate a simple ACK */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2120 |
int data_length; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2121 |
uchar_t *rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2122 |
tcpha_t *tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2123 |
mblk_t *mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2124 |
int32_t total_hdr_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2125 |
int32_t tcp_hdr_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2126 |
int32_t num_sack_blk = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2127 |
int32_t sack_opt_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2128 |
ip_xmit_attr_t *ixa = connp->conn_ixa; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2129 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2130 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2131 |
* Allocate space for TCP + IP headers |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2132 |
* and link-level header |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2133 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2134 |
if (tcp->tcp_snd_sack_ok && tcp->tcp_num_sack_blk > 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2135 |
num_sack_blk = MIN(tcp->tcp_max_sack_blk, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2136 |
tcp->tcp_num_sack_blk); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2137 |
sack_opt_len = num_sack_blk * sizeof (sack_blk_t) + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2138 |
TCPOPT_NOP_LEN * 2 + TCPOPT_HEADER_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2139 |
total_hdr_len = connp->conn_ht_iphc_len + sack_opt_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2140 |
tcp_hdr_len = connp->conn_ht_ulp_len + sack_opt_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2141 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2142 |
total_hdr_len = connp->conn_ht_iphc_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2143 |
tcp_hdr_len = connp->conn_ht_ulp_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2144 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2145 |
mp1 = allocb(total_hdr_len + tcps->tcps_wroff_xtra, BPRI_MED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2146 |
if (!mp1) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2147 |
return (NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2148 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2149 |
/* Update the latest receive window size in TCP header. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2150 |
tcp->tcp_tcpha->tha_win = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2151 |
htons(tcp->tcp_rwnd >> tcp->tcp_rcv_ws); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2152 |
/* copy in prototype TCP + IP header */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2153 |
rptr = mp1->b_rptr + tcps->tcps_wroff_xtra; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2154 |
mp1->b_rptr = rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2155 |
mp1->b_wptr = rptr + total_hdr_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2156 |
bcopy(connp->conn_ht_iphc, rptr, connp->conn_ht_iphc_len); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2157 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2158 |
tcpha = (tcpha_t *)&rptr[ixa->ixa_ip_hdr_length]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2159 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2160 |
/* Set the TCP sequence number. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2161 |
tcpha->tha_seq = htonl(seq_no); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2162 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2163 |
/* Set up the TCP flag field. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2164 |
tcpha->tha_flags = (uchar_t)TH_ACK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2165 |
if (tcp->tcp_ecn_echo_on) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2166 |
tcpha->tha_flags |= TH_ECE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2167 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2168 |
tcp->tcp_rack = tcp->tcp_rnxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2169 |
tcp->tcp_rack_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2170 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2171 |
/* fill in timestamp option if in use */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2172 |
if (tcp->tcp_snd_ts_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2173 |
uint32_t llbolt = (uint32_t)LBOLT_FASTPATH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2174 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2175 |
U32_TO_BE32(llbolt, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2176 |
(char *)tcpha + TCP_MIN_HEADER_LENGTH+4); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2177 |
U32_TO_BE32(tcp->tcp_ts_recent, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2178 |
(char *)tcpha + TCP_MIN_HEADER_LENGTH+8); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2179 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2180 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2181 |
/* Fill in SACK options */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2182 |
if (num_sack_blk > 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2183 |
uchar_t *wptr = (uchar_t *)tcpha + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2184 |
connp->conn_ht_ulp_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2185 |
sack_blk_t *tmp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2186 |
int32_t i; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2187 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2188 |
wptr[0] = TCPOPT_NOP; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2189 |
wptr[1] = TCPOPT_NOP; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2190 |
wptr[2] = TCPOPT_SACK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2191 |
wptr[3] = TCPOPT_HEADER_LEN + num_sack_blk * |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2192 |
sizeof (sack_blk_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2193 |
wptr += TCPOPT_REAL_SACK_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2194 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2195 |
tmp = tcp->tcp_sack_list; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2196 |
for (i = 0; i < num_sack_blk; i++) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2197 |
U32_TO_BE32(tmp[i].begin, wptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2198 |
wptr += sizeof (tcp_seq); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2199 |
U32_TO_BE32(tmp[i].end, wptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2200 |
wptr += sizeof (tcp_seq); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2201 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2202 |
tcpha->tha_offset_and_reserved += |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2203 |
((num_sack_blk * 2 + 1) << 4); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2204 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2205 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2206 |
ixa->ixa_pktlen = total_hdr_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2207 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2208 |
if (ixa->ixa_flags & IXAF_IS_IPV4) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2209 |
((ipha_t *)rptr)->ipha_length = htons(total_hdr_len); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2210 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2211 |
ip6_t *ip6 = (ip6_t *)rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2212 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2213 |
ip6->ip6_plen = htons(total_hdr_len - IPV6_HDR_LEN); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2214 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2215 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2216 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2217 |
* Prime pump for checksum calculation in IP. Include the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2218 |
* adjustment for a source route if any. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2219 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2220 |
data_length = tcp_hdr_len + connp->conn_sum; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2221 |
data_length = (data_length >> 16) + (data_length & 0xFFFF); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2222 |
tcpha->tha_sum = htons(data_length); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2223 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2224 |
if (tcp->tcp_ip_forward_progress) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2225 |
tcp->tcp_ip_forward_progress = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2226 |
connp->conn_ixa->ixa_flags |= IXAF_REACH_CONF; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2227 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2228 |
connp->conn_ixa->ixa_flags &= ~IXAF_REACH_CONF; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2229 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2230 |
return (mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2231 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2232 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2233 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2234 |
/* |
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2235 |
* Dummy socket upcalls for if/when the conn_t gets detached from a |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2236 |
* direct-callback sonode via a user-driven close(). Easy to catch with |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2237 |
* DTrace FBT, and should be mostly harmless. |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2238 |
*/ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2239 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2240 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2241 |
static sock_upper_handle_t |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2242 |
tcp_dummy_newconn(sock_upper_handle_t x, sock_lower_handle_t y, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2243 |
sock_downcalls_t *z, cred_t *cr, pid_t pid, sock_upcalls_t **ignored) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2244 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2245 |
ASSERT(0); /* Panic in debug, otherwise ignore. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2246 |
return (NULL); |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2247 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2248 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2249 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2250 |
static void |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2251 |
tcp_dummy_connected(sock_upper_handle_t x, sock_connid_t y, cred_t *cr, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2252 |
pid_t pid) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2253 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2254 |
ASSERT(x == NULL); |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2255 |
/* Normally we'd crhold(cr) and attach it to socket state. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2256 |
/* LINTED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2257 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2258 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2259 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2260 |
static int |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2261 |
tcp_dummy_disconnected(sock_upper_handle_t x, sock_connid_t y, int blah) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2262 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2263 |
ASSERT(0); /* Panic in debug, otherwise ignore. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2264 |
return (-1); |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2265 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2266 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2267 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2268 |
static void |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2269 |
tcp_dummy_opctl(sock_upper_handle_t x, sock_opctl_action_t y, uintptr_t blah) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2270 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2271 |
ASSERT(x == NULL); |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2272 |
/* We really want this one to be a harmless NOP for now. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2273 |
/* LINTED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2274 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2275 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2276 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2277 |
static ssize_t |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2278 |
tcp_dummy_recv(sock_upper_handle_t x, mblk_t *mp, size_t len, int flags, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2279 |
int *error, boolean_t *push) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2280 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2281 |
ASSERT(x == NULL); |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2282 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2283 |
/* |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2284 |
* Consume the message, set ESHUTDOWN, and return an error. |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2285 |
* Nobody's home! |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2286 |
*/ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2287 |
freemsg(mp); |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2288 |
*error = ESHUTDOWN; |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2289 |
return (-1); |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2290 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2291 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2292 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2293 |
static void |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2294 |
tcp_dummy_set_proto_props(sock_upper_handle_t x, struct sock_proto_props *y) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2295 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2296 |
ASSERT(0); /* Panic in debug, otherwise ignore. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2297 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2298 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2299 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2300 |
static void |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2301 |
tcp_dummy_txq_full(sock_upper_handle_t x, boolean_t y) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2302 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2303 |
ASSERT(0); /* Panic in debug, otherwise ignore. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2304 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2305 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2306 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2307 |
static void |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2308 |
tcp_dummy_signal_oob(sock_upper_handle_t x, ssize_t len) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2309 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2310 |
ASSERT(x == NULL); |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2311 |
/* Otherwise, this would signal socket state about OOB data. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2312 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2313 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2314 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2315 |
static void |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2316 |
tcp_dummy_set_error(sock_upper_handle_t x, int err) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2317 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2318 |
ASSERT(0); /* Panic in debug, otherwise ignore. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2319 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2320 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2321 |
/* ARGSUSED */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2322 |
static void |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2323 |
tcp_dummy_onearg(sock_upper_handle_t x) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2324 |
{ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2325 |
ASSERT(0); /* Panic in debug, otherwise ignore. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2326 |
} |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2327 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2328 |
static sock_upcalls_t tcp_dummy_upcalls = { |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2329 |
tcp_dummy_newconn, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2330 |
tcp_dummy_connected, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2331 |
tcp_dummy_disconnected, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2332 |
tcp_dummy_opctl, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2333 |
tcp_dummy_recv, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2334 |
tcp_dummy_set_proto_props, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2335 |
tcp_dummy_txq_full, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2336 |
tcp_dummy_signal_oob, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2337 |
tcp_dummy_onearg, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2338 |
tcp_dummy_set_error, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2339 |
tcp_dummy_onearg |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2340 |
}; |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2341 |
|
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2342 |
/* |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2343 |
* Handle M_DATA messages from IP. Its called directly from IP via |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2344 |
* squeue for received IP packets. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2345 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2346 |
* The first argument is always the connp/tcp to which the mp belongs. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2347 |
* There are no exceptions to this rule. The caller has already put |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2348 |
* a reference on this connp/tcp and once tcp_input_data() returns, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2349 |
* the squeue will do the refrele. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2350 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2351 |
* The TH_SYN for the listener directly go to tcp_input_listener via |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2352 |
* squeue. ICMP errors go directly to tcp_icmp_input(). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2353 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2354 |
* sqp: NULL = recursive, sqp != NULL means called from squeue |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2355 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2356 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2357 |
tcp_input_data(void *arg, mblk_t *mp, void *arg2, ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2358 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2359 |
int32_t bytes_acked; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2360 |
int32_t gap; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2361 |
mblk_t *mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2362 |
uint_t flags; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2363 |
uint32_t new_swnd = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2364 |
uchar_t *iphdr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2365 |
uchar_t *rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2366 |
int32_t rgap; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2367 |
uint32_t seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2368 |
int seg_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2369 |
uint_t ip_hdr_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2370 |
uint32_t seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2371 |
tcpha_t *tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2372 |
int urp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2373 |
tcp_opt_t tcpopt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2374 |
ip_pkt_t ipp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2375 |
boolean_t ofo_seg = B_FALSE; /* Out of order segment */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2376 |
uint32_t cwnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2377 |
uint32_t add; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2378 |
int npkt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2379 |
int mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2380 |
conn_t *connp = (conn_t *)arg; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2381 |
squeue_t *sqp = (squeue_t *)arg2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2382 |
tcp_t *tcp = connp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2383 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2384 |
sock_upcalls_t *sockupcalls; |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2385 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2386 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2387 |
* RST from fused tcp loopback peer should trigger an unfuse. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2388 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2389 |
if (tcp->tcp_fused) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2390 |
TCP_STAT(tcps, tcp_fusion_aborted); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2391 |
tcp_unfuse(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2392 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2393 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2394 |
iphdr = mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2395 |
rptr = mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2396 |
ASSERT(OK_32PTR(rptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2397 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2398 |
ip_hdr_len = ira->ira_ip_hdr_length; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2399 |
if (connp->conn_recv_ancillary.crb_all != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2400 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2401 |
* Record packet information in the ip_pkt_t |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2402 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2403 |
ipp.ipp_fields = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2404 |
if (ira->ira_flags & IRAF_IS_IPV4) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2405 |
(void) ip_find_hdr_v4((ipha_t *)rptr, &ipp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2406 |
B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2407 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2408 |
uint8_t nexthdrp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2409 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2410 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2411 |
* IPv6 packets can only be received by applications |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2412 |
* that are prepared to receive IPv6 addresses. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2413 |
* The IP fanout must ensure this. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2414 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2415 |
ASSERT(connp->conn_family == AF_INET6); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2416 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2417 |
(void) ip_find_hdr_v6(mp, (ip6_t *)rptr, B_TRUE, &ipp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2418 |
&nexthdrp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2419 |
ASSERT(nexthdrp == IPPROTO_TCP); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2420 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2421 |
/* Could have caused a pullup? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2422 |
iphdr = mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2423 |
rptr = mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2424 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2425 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2426 |
ASSERT(DB_TYPE(mp) == M_DATA); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2427 |
ASSERT(mp->b_next == NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2428 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2429 |
tcpha = (tcpha_t *)&rptr[ip_hdr_len]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2430 |
seg_seq = ntohl(tcpha->tha_seq); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2431 |
seg_ack = ntohl(tcpha->tha_ack); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2432 |
ASSERT((uintptr_t)(mp->b_wptr - rptr) <= (uintptr_t)INT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2433 |
seg_len = (int)(mp->b_wptr - rptr) - |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2434 |
(ip_hdr_len + TCP_HDR_LENGTH(tcpha)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2435 |
if ((mp1 = mp->b_cont) != NULL && mp1->b_datap->db_type == M_DATA) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2436 |
do { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2437 |
ASSERT((uintptr_t)(mp1->b_wptr - mp1->b_rptr) <= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2438 |
(uintptr_t)INT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2439 |
seg_len += (int)(mp1->b_wptr - mp1->b_rptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2440 |
} while ((mp1 = mp1->b_cont) != NULL && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2441 |
mp1->b_datap->db_type == M_DATA); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2442 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2443 |
|
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2444 |
DTRACE_TCP5(receive, mblk_t *, NULL, ip_xmit_attr_t *, connp->conn_ixa, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2445 |
__dtrace_tcp_void_ip_t *, iphdr, tcp_t *, tcp, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2446 |
__dtrace_tcp_tcph_t *, tcpha); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2447 |
|
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2448 |
if (tcp->tcp_state == TCPS_TIME_WAIT) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2449 |
tcp_time_wait_processing(tcp, mp, seg_seq, seg_ack, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2450 |
seg_len, tcpha, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2451 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2452 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2453 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2454 |
if (sqp != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2455 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2456 |
* This is the correct place to update tcp_last_recv_time. Note |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2457 |
* that it is also updated for tcp structure that belongs to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2458 |
* global and listener queues which do not really need updating. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2459 |
* But that should not cause any harm. And it is updated for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2460 |
* all kinds of incoming segments, not only for data segments. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2461 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2462 |
tcp->tcp_last_recv_time = LBOLT_FASTPATH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2463 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2464 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2465 |
flags = (unsigned int)tcpha->tha_flags & 0xFF; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2466 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2467 |
BUMP_LOCAL(tcp->tcp_ibsegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2468 |
DTRACE_PROBE2(tcp__trace__recv, mblk_t *, mp, tcp_t *, tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2469 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2470 |
if ((flags & TH_URG) && sqp != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2471 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2472 |
* TCP can't handle urgent pointers that arrive before |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2473 |
* the connection has been accept()ed since it can't |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2474 |
* buffer OOB data. Discard segment if this happens. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2475 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2476 |
* We can't just rely on a non-null tcp_listener to indicate |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2477 |
* that the accept() has completed since unlinking of the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2478 |
* eager and completion of the accept are not atomic. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2479 |
* tcp_detached, when it is not set (B_FALSE) indicates |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2480 |
* that the accept() has completed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2481 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2482 |
* Nor can it reassemble urgent pointers, so discard |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2483 |
* if it's not the next segment expected. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2484 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2485 |
* Otherwise, collapse chain into one mblk (discard if |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2486 |
* that fails). This makes sure the headers, retransmitted |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2487 |
* data, and new data all are in the same mblk. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2488 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2489 |
ASSERT(mp != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2490 |
if (tcp->tcp_detached || !pullupmsg(mp, -1)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2491 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2492 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2493 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2494 |
/* Update pointers into message */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2495 |
iphdr = rptr = mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2496 |
tcpha = (tcpha_t *)&rptr[ip_hdr_len]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2497 |
if (SEQ_GT(seg_seq, tcp->tcp_rnxt)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2498 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2499 |
* Since we can't handle any data with this urgent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2500 |
* pointer that is out of sequence, we expunge |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2501 |
* the data. This allows us to still register |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2502 |
* the urgent mark and generate the M_PCSIG, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2503 |
* which we can do. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2504 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2505 |
mp->b_wptr = (uchar_t *)tcpha + TCP_HDR_LENGTH(tcpha); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2506 |
seg_len = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2507 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2508 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2509 |
|
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2510 |
sockupcalls = connp->conn_upcalls; |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2511 |
/* A conn_t may have belonged to a now-closed socket. Be careful. */ |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2512 |
if (sockupcalls == NULL) |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2513 |
sockupcalls = &tcp_dummy_upcalls; |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2514 |
|
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2515 |
switch (tcp->tcp_state) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2516 |
case TCPS_SYN_SENT: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2517 |
if (connp->conn_final_sqp == NULL && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2518 |
tcp_outbound_squeue_switch && sqp != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2519 |
ASSERT(connp->conn_initial_sqp == connp->conn_sqp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2520 |
connp->conn_final_sqp = sqp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2521 |
if (connp->conn_final_sqp != connp->conn_sqp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2522 |
DTRACE_PROBE1(conn__final__sqp__switch, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2523 |
conn_t *, connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2524 |
CONN_INC_REF(connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2525 |
SQUEUE_SWITCH(connp, connp->conn_final_sqp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2526 |
SQUEUE_ENTER_ONE(connp->conn_sqp, mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2527 |
tcp_input_data, connp, ira, ip_squeue_flag, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2528 |
SQTAG_CONNECT_FINISH); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2529 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2530 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2531 |
DTRACE_PROBE1(conn__final__sqp__same, conn_t *, connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2532 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2533 |
if (flags & TH_ACK) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2534 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2535 |
* Note that our stack cannot send data before a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2536 |
* connection is established, therefore the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2537 |
* following check is valid. Otherwise, it has |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2538 |
* to be changed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2539 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2540 |
if (SEQ_LEQ(seg_ack, tcp->tcp_iss) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2541 |
SEQ_GT(seg_ack, tcp->tcp_snxt)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2542 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2543 |
if (flags & TH_RST) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2544 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2545 |
tcp_xmit_ctl("TCPS_SYN_SENT-Bad_seq", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2546 |
tcp, seg_ack, 0, TH_RST); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2547 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2548 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2549 |
ASSERT(tcp->tcp_suna + 1 == seg_ack); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2550 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2551 |
if (flags & TH_RST) { |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2552 |
if (flags & TH_ACK) { |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2553 |
DTRACE_TCP5(connect__refused, mblk_t *, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2554 |
ip_xmit_attr_t *, connp->conn_ixa, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2555 |
void_ip_t *, iphdr, tcp_t *, tcp, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2556 |
tcph_t *, tcpha); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2557 |
(void) tcp_clean_death(tcp, ECONNREFUSED); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2558 |
} |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2559 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2560 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2561 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2562 |
if (!(flags & TH_SYN)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2563 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2564 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2565 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2566 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2567 |
/* Process all TCP options. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2568 |
tcp_process_options(tcp, tcpha); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2569 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2570 |
* The following changes our rwnd to be a multiple of the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2571 |
* MIN(peer MSS, our MSS) for performance reason. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2572 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2573 |
(void) tcp_rwnd_set(tcp, MSS_ROUNDUP(connp->conn_rcvbuf, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2574 |
tcp->tcp_mss)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2575 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2576 |
/* Is the other end ECN capable? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2577 |
if (tcp->tcp_ecn_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2578 |
if ((flags & (TH_ECE|TH_CWR)) != TH_ECE) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2579 |
tcp->tcp_ecn_ok = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2580 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2581 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2582 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2583 |
* Clear ECN flags because it may interfere with later |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2584 |
* processing. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2585 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2586 |
flags &= ~(TH_ECE|TH_CWR); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2587 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2588 |
tcp->tcp_irs = seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2589 |
tcp->tcp_rack = seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2590 |
tcp->tcp_rnxt = seg_seq + 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2591 |
tcp->tcp_tcpha->tha_ack = htonl(tcp->tcp_rnxt); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2592 |
if (!TCP_IS_DETACHED(tcp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2593 |
/* Allocate room for SACK options if needed. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2594 |
connp->conn_wroff = connp->conn_ht_iphc_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2595 |
if (tcp->tcp_snd_sack_ok) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2596 |
connp->conn_wroff += TCPOPT_MAX_SACK_LEN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2597 |
if (!tcp->tcp_loopback) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2598 |
connp->conn_wroff += tcps->tcps_wroff_xtra; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2599 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2600 |
(void) proto_set_tx_wroff(connp->conn_rq, connp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2601 |
connp->conn_wroff); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2602 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2603 |
if (flags & TH_ACK) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2604 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2605 |
* If we can't get the confirmation upstream, pretend |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2606 |
* we didn't even see this one. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2607 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2608 |
* XXX: how can we pretend we didn't see it if we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2609 |
* have updated rnxt et. al. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2610 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2611 |
* For loopback we defer sending up the T_CONN_CON |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2612 |
* until after some checks below. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2613 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2614 |
mp1 = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2615 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2616 |
* tcp_sendmsg() checks tcp_state without entering |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2617 |
* the squeue so tcp_state should be updated before |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2618 |
* sending up connection confirmation. Probe the |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2619 |
* state change below when we are sure the connection |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2620 |
* confirmation has been sent. |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2621 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2622 |
tcp->tcp_state = TCPS_ESTABLISHED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2623 |
if (!tcp_conn_con(tcp, iphdr, mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2624 |
tcp->tcp_loopback ? &mp1 : NULL, ira)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2625 |
tcp->tcp_state = TCPS_SYN_SENT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2626 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2627 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2628 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2629 |
TCPS_CONN_INC(tcps); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2630 |
/* SYN was acked - making progress */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2631 |
tcp->tcp_ip_forward_progress = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2632 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2633 |
/* One for the SYN */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2634 |
tcp->tcp_suna = tcp->tcp_iss + 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2635 |
tcp->tcp_valid_bits &= ~TCP_ISS_VALID; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2636 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2637 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2638 |
* If SYN was retransmitted, need to reset all |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2639 |
* retransmission info. This is because this |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2640 |
* segment will be treated as a dup ACK. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2641 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2642 |
if (tcp->tcp_rexmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2643 |
tcp->tcp_rexmit = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2644 |
tcp->tcp_rexmit_nxt = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2645 |
tcp->tcp_rexmit_max = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2646 |
tcp->tcp_snd_burst = tcp->tcp_localnet ? |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2647 |
TCP_CWND_INFINITE : TCP_CWND_NORMAL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2648 |
tcp->tcp_ms_we_have_waited = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2649 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2650 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2651 |
* Set tcp_cwnd back to 1 MSS, per |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2652 |
* recommendation from |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2653 |
* draft-floyd-incr-init-win-01.txt, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2654 |
* Increasing TCP's Initial Window. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2655 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2656 |
tcp->tcp_cwnd = tcp->tcp_mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2657 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2658 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2659 |
tcp->tcp_swl1 = seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2660 |
tcp->tcp_swl2 = seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2661 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2662 |
new_swnd = ntohs(tcpha->tha_win); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2663 |
tcp->tcp_swnd = new_swnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2664 |
if (new_swnd > tcp->tcp_max_swnd) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2665 |
tcp->tcp_max_swnd = new_swnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2666 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2667 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2668 |
* Always send the three-way handshake ack immediately |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2669 |
* in order to make the connection complete as soon as |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2670 |
* possible on the accepting host. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2671 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2672 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2673 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2674 |
/* |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2675 |
* Trace connect-established here. |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2676 |
*/ |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2677 |
DTRACE_TCP5(connect__established, mblk_t *, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2678 |
ip_xmit_attr_t *, tcp->tcp_connp->conn_ixa, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2679 |
void_ip_t *, iphdr, tcp_t *, tcp, tcph_t *, tcpha); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2680 |
|
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2681 |
/* Trace change from SYN_SENT -> ESTABLISHED here */ |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2682 |
DTRACE_TCP6(state__change, void, NULL, ip_xmit_attr_t *, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2683 |
connp->conn_ixa, void, NULL, tcp_t *, tcp, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2684 |
void, NULL, int32_t, TCPS_SYN_SENT); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2685 |
|
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2686 |
/* |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2687 |
* Special case for loopback. At this point we have |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2688 |
* received SYN-ACK from the remote endpoint. In |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2689 |
* order to ensure that both endpoints reach the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2690 |
* fused state prior to any data exchange, the final |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2691 |
* ACK needs to be sent before we indicate T_CONN_CON |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2692 |
* to the module upstream. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2693 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2694 |
if (tcp->tcp_loopback) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2695 |
mblk_t *ack_mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2696 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2697 |
ASSERT(!tcp->tcp_unfusable); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2698 |
ASSERT(mp1 != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2699 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2700 |
* For loopback, we always get a pure SYN-ACK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2701 |
* and only need to send back the final ACK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2702 |
* with no data (this is because the other |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2703 |
* tcp is ours and we don't do T/TCP). This |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2704 |
* final ACK triggers the passive side to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2705 |
* perform fusion in ESTABLISHED state. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2706 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2707 |
if ((ack_mp = tcp_ack_mp(tcp)) != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2708 |
if (tcp->tcp_ack_tid != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2709 |
(void) TCP_TIMER_CANCEL(tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2710 |
tcp->tcp_ack_tid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2711 |
tcp->tcp_ack_tid = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2712 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2713 |
tcp_send_data(tcp, ack_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2714 |
BUMP_LOCAL(tcp->tcp_obsegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2715 |
TCPS_BUMP_MIB(tcps, tcpOutAck); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2716 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2717 |
if (!IPCL_IS_NONSTR(connp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2718 |
/* Send up T_CONN_CON */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2719 |
if (ira->ira_cred != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2720 |
mblk_setcred(mp1, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2721 |
ira->ira_cred, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2722 |
ira->ira_cpid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2723 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2724 |
putnext(connp->conn_rq, mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2725 |
} else { |
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2726 |
(*sockupcalls->su_connected) |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2727 |
(connp->conn_upper_handle, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2728 |
tcp->tcp_connid, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2729 |
ira->ira_cred, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2730 |
ira->ira_cpid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2731 |
freemsg(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2732 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2733 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2734 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2735 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2736 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2737 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2738 |
* Forget fusion; we need to handle more |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2739 |
* complex cases below. Send the deferred |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2740 |
* T_CONN_CON message upstream and proceed |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2741 |
* as usual. Mark this tcp as not capable |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2742 |
* of fusion. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2743 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2744 |
TCP_STAT(tcps, tcp_fusion_unfusable); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2745 |
tcp->tcp_unfusable = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2746 |
if (!IPCL_IS_NONSTR(connp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2747 |
if (ira->ira_cred != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2748 |
mblk_setcred(mp1, ira->ira_cred, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2749 |
ira->ira_cpid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2750 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2751 |
putnext(connp->conn_rq, mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2752 |
} else { |
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
2753 |
(*sockupcalls->su_connected) |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2754 |
(connp->conn_upper_handle, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2755 |
tcp->tcp_connid, ira->ira_cred, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2756 |
ira->ira_cpid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2757 |
freemsg(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2758 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2759 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2760 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2761 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2762 |
* Check to see if there is data to be sent. If |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2763 |
* yes, set the transmit flag. Then check to see |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2764 |
* if received data processing needs to be done. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2765 |
* If not, go straight to xmit_check. This short |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2766 |
* cut is OK as we don't support T/TCP. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2767 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2768 |
if (tcp->tcp_unsent) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2769 |
flags |= TH_XMIT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2770 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2771 |
if (seg_len == 0 && !(flags & TH_URG)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2772 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2773 |
goto xmit_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2774 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2775 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2776 |
flags &= ~TH_SYN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2777 |
seg_seq++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2778 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2779 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2780 |
tcp->tcp_state = TCPS_SYN_RCVD; |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2781 |
DTRACE_TCP6(state__change, void, NULL, ip_xmit_attr_t *, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2782 |
connp->conn_ixa, void_ip_t *, NULL, tcp_t *, tcp, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
2783 |
tcph_t *, NULL, int32_t, TCPS_SYN_SENT); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2784 |
mp1 = tcp_xmit_mp(tcp, tcp->tcp_xmit_head, tcp->tcp_mss, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2785 |
NULL, NULL, tcp->tcp_iss, B_FALSE, NULL, B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2786 |
if (mp1 != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2787 |
tcp_send_data(tcp, mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2788 |
TCP_TIMER_RESTART(tcp, tcp->tcp_rto); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2789 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2790 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2791 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2792 |
case TCPS_SYN_RCVD: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2793 |
if (flags & TH_ACK) { |
13020
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
2794 |
uint32_t pinit_wnd; |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
2795 |
|
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2796 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2797 |
* In this state, a SYN|ACK packet is either bogus |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2798 |
* because the other side must be ACKing our SYN which |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2799 |
* indicates it has seen the ACK for their SYN and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2800 |
* shouldn't retransmit it or we're crossing SYNs |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2801 |
* on active open. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2802 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2803 |
if ((flags & TH_SYN) && !tcp->tcp_active_open) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2804 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2805 |
tcp_xmit_ctl("TCPS_SYN_RCVD-bad_syn", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2806 |
tcp, seg_ack, 0, TH_RST); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2807 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2808 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2809 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2810 |
* NOTE: RFC 793 pg. 72 says this should be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2811 |
* tcp->tcp_suna <= seg_ack <= tcp->tcp_snxt |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2812 |
* but that would mean we have an ack that ignored |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2813 |
* our SYN. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2814 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2815 |
if (SEQ_LEQ(seg_ack, tcp->tcp_suna) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2816 |
SEQ_GT(seg_ack, tcp->tcp_snxt)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2817 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2818 |
tcp_xmit_ctl("TCPS_SYN_RCVD-bad_ack", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2819 |
tcp, seg_ack, 0, TH_RST); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2820 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2821 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2822 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2823 |
* No sane TCP stack will send such a small window |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2824 |
* without receiving any data. Just drop this invalid |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2825 |
* ACK. We also shorten the abort timeout in case |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2826 |
* this is an attack. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2827 |
*/ |
13020
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
2828 |
pinit_wnd = ntohs(tcpha->tha_win) << tcp->tcp_snd_ws; |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
2829 |
if (pinit_wnd < tcp->tcp_mss && |
a2b26a53fd00
6972966 SYN-ACK-ACK is not handled properly when accepting connection from Linux client using HTTP benchmark
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12818
diff
changeset
|
2830 |
pinit_wnd < tcp_init_wnd_chk) { |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2831 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2832 |
TCP_STAT(tcps, tcp_zwin_ack_syn); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2833 |
tcp->tcp_second_ctimer_threshold = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2834 |
tcp_early_abort * SECONDS; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2835 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2836 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2837 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2838 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2839 |
case TCPS_LISTEN: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2840 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2841 |
* Only a TLI listener can come through this path when a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2842 |
* acceptor is going back to be a listener and a packet |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2843 |
* for the acceptor hits the classifier. For a socket |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2844 |
* listener, this can never happen because a listener |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2845 |
* can never accept connection on itself and hence a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2846 |
* socket acceptor can not go back to being a listener. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2847 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2848 |
ASSERT(!TCP_IS_SOCKET(tcp)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2849 |
/*FALLTHRU*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2850 |
case TCPS_CLOSED: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2851 |
case TCPS_BOUND: { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2852 |
conn_t *new_connp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2853 |
ip_stack_t *ipst = tcps->tcps_netstack->netstack_ip; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2854 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2855 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2856 |
* Don't accept any input on a closed tcp as this TCP logically |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2857 |
* does not exist on the system. Don't proceed further with |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2858 |
* this TCP. For instance, this packet could trigger another |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2859 |
* close of this tcp which would be disastrous for tcp_refcnt. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2860 |
* tcp_close_detached / tcp_clean_death / tcp_closei_local must |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2861 |
* be called at most once on a TCP. In this case we need to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2862 |
* refeed the packet into the classifier and figure out where |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2863 |
* the packet should go. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2864 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2865 |
new_connp = ipcl_classify(mp, ira, ipst); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2866 |
if (new_connp != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2867 |
/* Drops ref on new_connp */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2868 |
tcp_reinput(new_connp, mp, ira, ipst); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2869 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2870 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2871 |
/* We failed to classify. For now just drop the packet */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2872 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2873 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2874 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2875 |
case TCPS_IDLE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2876 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2877 |
* Handle the case where the tcp_clean_death() has happened |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2878 |
* on a connection (application hasn't closed yet) but a packet |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2879 |
* was already queued on squeue before tcp_clean_death() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2880 |
* was processed. Calling tcp_clean_death() twice on same |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2881 |
* connection can result in weird behaviour. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2882 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2883 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2884 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2885 |
default: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2886 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2887 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2888 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2889 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2890 |
* Already on the correct queue/perimeter. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2891 |
* If this is a detached connection and not an eager |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2892 |
* connection hanging off a listener then new data |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2893 |
* (past the FIN) will cause a reset. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2894 |
* We do a special check here where it |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2895 |
* is out of the main line, rather than check |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2896 |
* if we are detached every time we see new |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2897 |
* data down below. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2898 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2899 |
if (TCP_IS_DETACHED_NONEAGER(tcp) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2900 |
(seg_len > 0 && SEQ_GT(seg_seq + seg_len, tcp->tcp_rnxt))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2901 |
TCPS_BUMP_MIB(tcps, tcpInClosed); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2902 |
DTRACE_PROBE2(tcp__trace__recv, mblk_t *, mp, tcp_t *, tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2903 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2904 |
tcp_xmit_ctl("new data when detached", tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2905 |
tcp->tcp_snxt, 0, TH_RST); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2906 |
(void) tcp_clean_death(tcp, EPROTO); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2907 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2908 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2909 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2910 |
mp->b_rptr = (uchar_t *)tcpha + TCP_HDR_LENGTH(tcpha); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2911 |
urp = ntohs(tcpha->tha_urp) - TCP_OLD_URP_INTERPRETATION; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2912 |
new_swnd = ntohs(tcpha->tha_win) << |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2913 |
((tcpha->tha_flags & TH_SYN) ? 0 : tcp->tcp_snd_ws); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2914 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2915 |
if (tcp->tcp_snd_ts_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2916 |
if (!tcp_paws_check(tcp, tcpha, &tcpopt)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2917 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2918 |
* This segment is not acceptable. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2919 |
* Drop it and send back an ACK. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2920 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2921 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2922 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2923 |
goto ack_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2924 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2925 |
} else if (tcp->tcp_snd_sack_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2926 |
tcpopt.tcp = tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2927 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2928 |
* SACK info in already updated in tcp_parse_options. Ignore |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2929 |
* all other TCP options... |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2930 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2931 |
(void) tcp_parse_options(tcpha, &tcpopt); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2932 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2933 |
try_again:; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2934 |
mss = tcp->tcp_mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2935 |
gap = seg_seq - tcp->tcp_rnxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2936 |
rgap = tcp->tcp_rwnd - (gap + seg_len); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2937 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2938 |
* gap is the amount of sequence space between what we expect to see |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2939 |
* and what we got for seg_seq. A positive value for gap means |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2940 |
* something got lost. A negative value means we got some old stuff. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2941 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2942 |
if (gap < 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2943 |
/* Old stuff present. Is the SYN in there? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2944 |
if (seg_seq == tcp->tcp_irs && (flags & TH_SYN) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2945 |
(seg_len != 0)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2946 |
flags &= ~TH_SYN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2947 |
seg_seq++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2948 |
urp--; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2949 |
/* Recompute the gaps after noting the SYN. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2950 |
goto try_again; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2951 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2952 |
TCPS_BUMP_MIB(tcps, tcpInDataDupSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2953 |
TCPS_UPDATE_MIB(tcps, tcpInDataDupBytes, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2954 |
(seg_len > -gap ? -gap : seg_len)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2955 |
/* Remove the old stuff from seg_len. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2956 |
seg_len += gap; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2957 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2958 |
* Anything left? |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2959 |
* Make sure to check for unack'd FIN when rest of data |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2960 |
* has been previously ack'd. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2961 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2962 |
if (seg_len < 0 || (seg_len == 0 && !(flags & TH_FIN))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2963 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2964 |
* Resets are only valid if they lie within our offered |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2965 |
* window. If the RST bit is set, we just ignore this |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2966 |
* segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2967 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2968 |
if (flags & TH_RST) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2969 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2970 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2971 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2972 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2973 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2974 |
* The arriving of dup data packets indicate that we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2975 |
* may have postponed an ack for too long, or the other |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2976 |
* side's RTT estimate is out of shape. Start acking |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2977 |
* more often. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2978 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2979 |
if (SEQ_GEQ(seg_seq + seg_len - gap, tcp->tcp_rack) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2980 |
tcp->tcp_rack_cnt >= 1 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2981 |
tcp->tcp_rack_abs_max > 2) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2982 |
tcp->tcp_rack_abs_max--; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2983 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2984 |
tcp->tcp_rack_cur_max = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2985 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2986 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2987 |
* This segment is "unacceptable". None of its |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2988 |
* sequence space lies within our advertized window. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2989 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2990 |
* Adjust seg_len to the original value for tracing. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2991 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2992 |
seg_len -= gap; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2993 |
if (connp->conn_debug) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2994 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2995 |
"tcp_rput: unacceptable, gap %d, rgap %d, " |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2996 |
"flags 0x%x, seg_seq %u, seg_ack %u, " |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2997 |
"seg_len %d, rnxt %u, snxt %u, %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2998 |
gap, rgap, flags, seg_seq, seg_ack, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
2999 |
seg_len, tcp->tcp_rnxt, tcp->tcp_snxt, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3000 |
tcp_display(tcp, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3001 |
DISP_ADDR_AND_PORT)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3002 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3003 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3004 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3005 |
* Arrange to send an ACK in response to the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3006 |
* unacceptable segment per RFC 793 page 69. There |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3007 |
* is only one small difference between ours and the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3008 |
* acceptability test in the RFC - we accept ACK-only |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3009 |
* packet with SEG.SEQ = RCV.NXT+RCV.WND and no ACK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3010 |
* will be generated. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3011 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3012 |
* Note that we have to ACK an ACK-only packet at least |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3013 |
* for stacks that send 0-length keep-alives with |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3014 |
* SEG.SEQ = SND.NXT-1 as recommended by RFC1122, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3015 |
* section 4.2.3.6. As long as we don't ever generate |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3016 |
* an unacceptable packet in response to an incoming |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3017 |
* packet that is unacceptable, it should not cause |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3018 |
* "ACK wars". |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3019 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3020 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3021 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3022 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3023 |
* Continue processing this segment in order to use the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3024 |
* ACK information it contains, but skip all other |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3025 |
* sequence-number processing. Processing the ACK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3026 |
* information is necessary in order to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3027 |
* re-synchronize connections that may have lost |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3028 |
* synchronization. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3029 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3030 |
* We clear seg_len and flag fields related to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3031 |
* sequence number processing as they are not |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3032 |
* to be trusted for an unacceptable segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3033 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3034 |
seg_len = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3035 |
flags &= ~(TH_SYN | TH_FIN | TH_URG); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3036 |
goto process_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3037 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3038 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3039 |
/* Fix seg_seq, and chew the gap off the front. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3040 |
seg_seq = tcp->tcp_rnxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3041 |
urp += gap; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3042 |
do { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3043 |
mblk_t *mp2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3044 |
ASSERT((uintptr_t)(mp->b_wptr - mp->b_rptr) <= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3045 |
(uintptr_t)UINT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3046 |
gap += (uint_t)(mp->b_wptr - mp->b_rptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3047 |
if (gap > 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3048 |
mp->b_rptr = mp->b_wptr - gap; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3049 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3050 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3051 |
mp2 = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3052 |
mp = mp->b_cont; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3053 |
freeb(mp2); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3054 |
} while (gap < 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3055 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3056 |
* If the urgent data has already been acknowledged, we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3057 |
* should ignore TH_URG below |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3058 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3059 |
if (urp < 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3060 |
flags &= ~TH_URG; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3061 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3062 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3063 |
* rgap is the amount of stuff received out of window. A negative |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3064 |
* value is the amount out of window. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3065 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3066 |
if (rgap < 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3067 |
mblk_t *mp2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3068 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3069 |
if (tcp->tcp_rwnd == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3070 |
TCPS_BUMP_MIB(tcps, tcpInWinProbe); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3071 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3072 |
TCPS_BUMP_MIB(tcps, tcpInDataPastWinSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3073 |
TCPS_UPDATE_MIB(tcps, tcpInDataPastWinBytes, -rgap); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3074 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3075 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3076 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3077 |
* seg_len does not include the FIN, so if more than |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3078 |
* just the FIN is out of window, we act like we don't |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3079 |
* see it. (If just the FIN is out of window, rgap |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3080 |
* will be zero and we will go ahead and acknowledge |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3081 |
* the FIN.) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3082 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3083 |
flags &= ~TH_FIN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3084 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3085 |
/* Fix seg_len and make sure there is something left. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3086 |
seg_len += rgap; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3087 |
if (seg_len <= 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3088 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3089 |
* Resets are only valid if they lie within our offered |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3090 |
* window. If the RST bit is set, we just ignore this |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3091 |
* segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3092 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3093 |
if (flags & TH_RST) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3094 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3095 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3096 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3097 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3098 |
/* Per RFC 793, we need to send back an ACK. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3099 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3100 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3101 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3102 |
* Send SIGURG as soon as possible i.e. even |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3103 |
* if the TH_URG was delivered in a window probe |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3104 |
* packet (which will be unacceptable). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3105 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3106 |
* We generate a signal if none has been generated |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3107 |
* for this connection or if this is a new urgent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3108 |
* byte. Also send a zero-length "unmarked" message |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3109 |
* to inform SIOCATMARK that this is not the mark. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3110 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3111 |
* tcp_urp_last_valid is cleared when the T_exdata_ind |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3112 |
* is sent up. This plus the check for old data |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3113 |
* (gap >= 0) handles the wraparound of the sequence |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3114 |
* number space without having to always track the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3115 |
* correct MAX(tcp_urp_last, tcp_rnxt). (BSD tracks |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3116 |
* this max in its rcv_up variable). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3117 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3118 |
* This prevents duplicate SIGURGS due to a "late" |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3119 |
* zero-window probe when the T_EXDATA_IND has already |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3120 |
* been sent up. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3121 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3122 |
if ((flags & TH_URG) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3123 |
(!tcp->tcp_urp_last_valid || SEQ_GT(urp + seg_seq, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3124 |
tcp->tcp_urp_last))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3125 |
if (IPCL_IS_NONSTR(connp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3126 |
if (!TCP_IS_DETACHED(tcp)) { |
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
3127 |
(*sockupcalls->su_signal_oob) |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3128 |
(connp->conn_upper_handle, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3129 |
urp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3130 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3131 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3132 |
mp1 = allocb(0, BPRI_MED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3133 |
if (mp1 == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3134 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3135 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3136 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3137 |
if (!TCP_IS_DETACHED(tcp) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3138 |
!putnextctl1(connp->conn_rq, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3139 |
M_PCSIG, SIGURG)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3140 |
/* Try again on the rexmit. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3141 |
freemsg(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3142 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3143 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3144 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3145 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3146 |
* If the next byte would be the mark |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3147 |
* then mark with MARKNEXT else mark |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3148 |
* with NOTMARKNEXT. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3149 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3150 |
if (gap == 0 && urp == 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3151 |
mp1->b_flag |= MSGMARKNEXT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3152 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3153 |
mp1->b_flag |= MSGNOTMARKNEXT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3154 |
freemsg(tcp->tcp_urp_mark_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3155 |
tcp->tcp_urp_mark_mp = mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3156 |
flags |= TH_SEND_URP_MARK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3157 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3158 |
tcp->tcp_urp_last_valid = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3159 |
tcp->tcp_urp_last = urp + seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3160 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3161 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3162 |
* If this is a zero window probe, continue to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3163 |
* process the ACK part. But we need to set seg_len |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3164 |
* to 0 to avoid data processing. Otherwise just |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3165 |
* drop the segment and send back an ACK. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3166 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3167 |
if (tcp->tcp_rwnd == 0 && seg_seq == tcp->tcp_rnxt) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3168 |
flags &= ~(TH_SYN | TH_URG); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3169 |
seg_len = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3170 |
goto process_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3171 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3172 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3173 |
goto ack_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3174 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3175 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3176 |
/* Pitch out of window stuff off the end. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3177 |
rgap = seg_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3178 |
mp2 = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3179 |
do { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3180 |
ASSERT((uintptr_t)(mp2->b_wptr - mp2->b_rptr) <= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3181 |
(uintptr_t)INT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3182 |
rgap -= (int)(mp2->b_wptr - mp2->b_rptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3183 |
if (rgap < 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3184 |
mp2->b_wptr += rgap; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3185 |
if ((mp1 = mp2->b_cont) != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3186 |
mp2->b_cont = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3187 |
freemsg(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3188 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3189 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3190 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3191 |
} while ((mp2 = mp2->b_cont) != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3192 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3193 |
ok:; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3194 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3195 |
* TCP should check ECN info for segments inside the window only. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3196 |
* Therefore the check should be done here. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3197 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3198 |
if (tcp->tcp_ecn_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3199 |
if (flags & TH_CWR) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3200 |
tcp->tcp_ecn_echo_on = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3201 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3202 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3203 |
* Note that both ECN_CE and CWR can be set in the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3204 |
* same segment. In this case, we once again turn |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3205 |
* on ECN_ECHO. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3206 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3207 |
if (connp->conn_ipversion == IPV4_VERSION) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3208 |
uchar_t tos = ((ipha_t *)rptr)->ipha_type_of_service; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3209 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3210 |
if ((tos & IPH_ECN_CE) == IPH_ECN_CE) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3211 |
tcp->tcp_ecn_echo_on = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3212 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3213 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3214 |
uint32_t vcf = ((ip6_t *)rptr)->ip6_vcf; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3215 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3216 |
if ((vcf & htonl(IPH_ECN_CE << 20)) == |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3217 |
htonl(IPH_ECN_CE << 20)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3218 |
tcp->tcp_ecn_echo_on = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3219 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3220 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3221 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3222 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3223 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3224 |
* Check whether we can update tcp_ts_recent. This test is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3225 |
* NOT the one in RFC 1323 3.4. It is from Braden, 1993, "TCP |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3226 |
* Extensions for High Performance: An Update", Internet Draft. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3227 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3228 |
if (tcp->tcp_snd_ts_ok && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3229 |
TSTMP_GEQ(tcpopt.tcp_opt_ts_val, tcp->tcp_ts_recent) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3230 |
SEQ_LEQ(seg_seq, tcp->tcp_rack)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3231 |
tcp->tcp_ts_recent = tcpopt.tcp_opt_ts_val; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3232 |
tcp->tcp_last_rcv_lbolt = LBOLT_FASTPATH64; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3233 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3234 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3235 |
if (seg_seq != tcp->tcp_rnxt || tcp->tcp_reass_head) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3236 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3237 |
* FIN in an out of order segment. We record this in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3238 |
* tcp_valid_bits and the seq num of FIN in tcp_ofo_fin_seq. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3239 |
* Clear the FIN so that any check on FIN flag will fail. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3240 |
* Remember that FIN also counts in the sequence number |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3241 |
* space. So we need to ack out of order FIN only segments. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3242 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3243 |
if (flags & TH_FIN) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3244 |
tcp->tcp_valid_bits |= TCP_OFO_FIN_VALID; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3245 |
tcp->tcp_ofo_fin_seq = seg_seq + seg_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3246 |
flags &= ~TH_FIN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3247 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3248 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3249 |
if (seg_len > 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3250 |
/* Fill in the SACK blk list. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3251 |
if (tcp->tcp_snd_sack_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3252 |
tcp_sack_insert(tcp->tcp_sack_list, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3253 |
seg_seq, seg_seq + seg_len, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3254 |
&(tcp->tcp_num_sack_blk)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3255 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3256 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3257 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3258 |
* Attempt reassembly and see if we have something |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3259 |
* ready to go. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3260 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3261 |
mp = tcp_reass(tcp, mp, seg_seq); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3262 |
/* Always ack out of order packets */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3263 |
flags |= TH_ACK_NEEDED | TH_PUSH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3264 |
if (mp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3265 |
ASSERT((uintptr_t)(mp->b_wptr - mp->b_rptr) <= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3266 |
(uintptr_t)INT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3267 |
seg_len = mp->b_cont ? msgdsize(mp) : |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3268 |
(int)(mp->b_wptr - mp->b_rptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3269 |
seg_seq = tcp->tcp_rnxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3270 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3271 |
* A gap is filled and the seq num and len |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3272 |
* of the gap match that of a previously |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3273 |
* received FIN, put the FIN flag back in. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3274 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3275 |
if ((tcp->tcp_valid_bits & TCP_OFO_FIN_VALID) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3276 |
seg_seq + seg_len == tcp->tcp_ofo_fin_seq) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3277 |
flags |= TH_FIN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3278 |
tcp->tcp_valid_bits &= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3279 |
~TCP_OFO_FIN_VALID; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3280 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3281 |
if (tcp->tcp_reass_tid != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3282 |
(void) TCP_TIMER_CANCEL(tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3283 |
tcp->tcp_reass_tid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3284 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3285 |
* Restart the timer if there is still |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3286 |
* data in the reassembly queue. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3287 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3288 |
if (tcp->tcp_reass_head != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3289 |
tcp->tcp_reass_tid = TCP_TIMER( |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3290 |
tcp, tcp_reass_timer, |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
3291 |
tcps->tcps_reass_timeout); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3292 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3293 |
tcp->tcp_reass_tid = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3294 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3295 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3296 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3297 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3298 |
* Keep going even with NULL mp. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3299 |
* There may be a useful ACK or something else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3300 |
* we don't want to miss. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3301 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3302 |
* But TCP should not perform fast retransmit |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3303 |
* because of the ack number. TCP uses |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3304 |
* seg_len == 0 to determine if it is a pure |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3305 |
* ACK. And this is not a pure ACK. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3306 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3307 |
seg_len = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3308 |
ofo_seg = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3309 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3310 |
if (tcps->tcps_reass_timeout != 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3311 |
tcp->tcp_reass_tid == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3312 |
tcp->tcp_reass_tid = TCP_TIMER(tcp, |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
3313 |
tcp_reass_timer, |
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
3314 |
tcps->tcps_reass_timeout); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3315 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3316 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3317 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3318 |
} else if (seg_len > 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3319 |
TCPS_BUMP_MIB(tcps, tcpInDataInorderSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3320 |
TCPS_UPDATE_MIB(tcps, tcpInDataInorderBytes, seg_len); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3321 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3322 |
* If an out of order FIN was received before, and the seq |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3323 |
* num and len of the new segment match that of the FIN, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3324 |
* put the FIN flag back in. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3325 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3326 |
if ((tcp->tcp_valid_bits & TCP_OFO_FIN_VALID) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3327 |
seg_seq + seg_len == tcp->tcp_ofo_fin_seq) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3328 |
flags |= TH_FIN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3329 |
tcp->tcp_valid_bits &= ~TCP_OFO_FIN_VALID; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3330 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3331 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3332 |
if ((flags & (TH_RST | TH_SYN | TH_URG | TH_ACK)) != TH_ACK) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3333 |
if (flags & TH_RST) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3334 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3335 |
switch (tcp->tcp_state) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3336 |
case TCPS_SYN_RCVD: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3337 |
(void) tcp_clean_death(tcp, ECONNREFUSED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3338 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3339 |
case TCPS_ESTABLISHED: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3340 |
case TCPS_FIN_WAIT_1: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3341 |
case TCPS_FIN_WAIT_2: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3342 |
case TCPS_CLOSE_WAIT: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3343 |
(void) tcp_clean_death(tcp, ECONNRESET); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3344 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3345 |
case TCPS_CLOSING: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3346 |
case TCPS_LAST_ACK: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3347 |
(void) tcp_clean_death(tcp, 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3348 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3349 |
default: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3350 |
ASSERT(tcp->tcp_state != TCPS_TIME_WAIT); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3351 |
(void) tcp_clean_death(tcp, ENXIO); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3352 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3353 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3354 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3355 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3356 |
if (flags & TH_SYN) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3357 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3358 |
* See RFC 793, Page 71 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3359 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3360 |
* The seq number must be in the window as it should |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3361 |
* be "fixed" above. If it is outside window, it should |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3362 |
* be already rejected. Note that we allow seg_seq to be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3363 |
* rnxt + rwnd because we want to accept 0 window probe. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3364 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3365 |
ASSERT(SEQ_GEQ(seg_seq, tcp->tcp_rnxt) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3366 |
SEQ_LEQ(seg_seq, tcp->tcp_rnxt + tcp->tcp_rwnd)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3367 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3368 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3369 |
* If the ACK flag is not set, just use our snxt as the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3370 |
* seq number of the RST segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3371 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3372 |
if (!(flags & TH_ACK)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3373 |
seg_ack = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3374 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3375 |
tcp_xmit_ctl("TH_SYN", tcp, seg_ack, seg_seq + 1, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3376 |
TH_RST|TH_ACK); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3377 |
ASSERT(tcp->tcp_state != TCPS_TIME_WAIT); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3378 |
(void) tcp_clean_death(tcp, ECONNRESET); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3379 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3380 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3381 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3382 |
* urp could be -1 when the urp field in the packet is 0 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3383 |
* and TCP_OLD_URP_INTERPRETATION is set. This implies that the urgent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3384 |
* byte was at seg_seq - 1, in which case we ignore the urgent flag. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3385 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3386 |
if (flags & TH_URG && urp >= 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3387 |
if (!tcp->tcp_urp_last_valid || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3388 |
SEQ_GT(urp + seg_seq, tcp->tcp_urp_last)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3389 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3390 |
* Non-STREAMS sockets handle the urgent data a litte |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3391 |
* differently from STREAMS based sockets. There is no |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3392 |
* need to mark any mblks with the MSG{NOT,}MARKNEXT |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3393 |
* flags to keep SIOCATMARK happy. Instead a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3394 |
* su_signal_oob upcall is made to update the mark. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3395 |
* Neither is a T_EXDATA_IND mblk needed to be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3396 |
* prepended to the urgent data. The urgent data is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3397 |
* delivered using the su_recv upcall, where we set |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3398 |
* the MSG_OOB flag to indicate that it is urg data. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3399 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3400 |
* Neither TH_SEND_URP_MARK nor TH_MARKNEXT_NEEDED |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3401 |
* are used by non-STREAMS sockets. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3402 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3403 |
if (IPCL_IS_NONSTR(connp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3404 |
if (!TCP_IS_DETACHED(tcp)) { |
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
3405 |
(*sockupcalls->su_signal_oob) |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3406 |
(connp->conn_upper_handle, urp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3407 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3408 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3409 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3410 |
* If we haven't generated the signal yet for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3411 |
* this urgent pointer value, do it now. Also, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3412 |
* send up a zero-length M_DATA indicating |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3413 |
* whether or not this is the mark. The latter |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3414 |
* is not needed when a T_EXDATA_IND is sent up. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3415 |
* However, if there are allocation failures |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3416 |
* this code relies on the sender retransmitting |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3417 |
* and the socket code for determining the mark |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3418 |
* should not block waiting for the peer to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3419 |
* transmit. Thus, for simplicity we always |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3420 |
* send up the mark indication. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3421 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3422 |
mp1 = allocb(0, BPRI_MED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3423 |
if (mp1 == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3424 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3425 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3426 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3427 |
if (!TCP_IS_DETACHED(tcp) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3428 |
!putnextctl1(connp->conn_rq, M_PCSIG, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3429 |
SIGURG)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3430 |
/* Try again on the rexmit. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3431 |
freemsg(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3432 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3433 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3434 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3435 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3436 |
* Mark with NOTMARKNEXT for now. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3437 |
* The code below will change this to MARKNEXT |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3438 |
* if we are at the mark. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3439 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3440 |
* If there are allocation failures (e.g. in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3441 |
* dupmsg below) the next time tcp_input_data |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3442 |
* sees the urgent segment it will send up the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3443 |
* MSGMARKNEXT message. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3444 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3445 |
mp1->b_flag |= MSGNOTMARKNEXT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3446 |
freemsg(tcp->tcp_urp_mark_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3447 |
tcp->tcp_urp_mark_mp = mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3448 |
flags |= TH_SEND_URP_MARK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3449 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3450 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3451 |
"tcp_rput: sent M_PCSIG 2 seq %x urp %x " |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3452 |
"last %x, %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3453 |
seg_seq, urp, tcp->tcp_urp_last, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3454 |
tcp_display(tcp, NULL, DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3455 |
#endif /* DEBUG */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3456 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3457 |
tcp->tcp_urp_last_valid = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3458 |
tcp->tcp_urp_last = urp + seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3459 |
} else if (tcp->tcp_urp_mark_mp != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3460 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3461 |
* An allocation failure prevented the previous |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3462 |
* tcp_input_data from sending up the allocated |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3463 |
* MSG*MARKNEXT message - send it up this time |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3464 |
* around. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3465 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3466 |
flags |= TH_SEND_URP_MARK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3467 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3468 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3469 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3470 |
* If the urgent byte is in this segment, make sure that it is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3471 |
* all by itself. This makes it much easier to deal with the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3472 |
* possibility of an allocation failure on the T_exdata_ind. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3473 |
* Note that seg_len is the number of bytes in the segment, and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3474 |
* urp is the offset into the segment of the urgent byte. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3475 |
* urp < seg_len means that the urgent byte is in this segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3476 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3477 |
if (urp < seg_len) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3478 |
if (seg_len != 1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3479 |
uint32_t tmp_rnxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3480 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3481 |
* Break it up and feed it back in. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3482 |
* Re-attach the IP header. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3483 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3484 |
mp->b_rptr = iphdr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3485 |
if (urp > 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3486 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3487 |
* There is stuff before the urgent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3488 |
* byte. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3489 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3490 |
mp1 = dupmsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3491 |
if (!mp1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3492 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3493 |
* Trim from urgent byte on. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3494 |
* The rest will come back. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3495 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3496 |
(void) adjmsg(mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3497 |
urp - seg_len); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3498 |
tcp_input_data(connp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3499 |
mp, NULL, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3500 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3501 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3502 |
(void) adjmsg(mp1, urp - seg_len); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3503 |
/* Feed this piece back in. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3504 |
tmp_rnxt = tcp->tcp_rnxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3505 |
tcp_input_data(connp, mp1, NULL, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3506 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3507 |
* If the data passed back in was not |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3508 |
* processed (ie: bad ACK) sending |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3509 |
* the remainder back in will cause a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3510 |
* loop. In this case, drop the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3511 |
* packet and let the sender try |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3512 |
* sending a good packet. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3513 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3514 |
if (tmp_rnxt == tcp->tcp_rnxt) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3515 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3516 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3517 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3518 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3519 |
if (urp != seg_len - 1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3520 |
uint32_t tmp_rnxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3521 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3522 |
* There is stuff after the urgent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3523 |
* byte. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3524 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3525 |
mp1 = dupmsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3526 |
if (!mp1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3527 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3528 |
* Trim everything beyond the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3529 |
* urgent byte. The rest will |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3530 |
* come back. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3531 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3532 |
(void) adjmsg(mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3533 |
urp + 1 - seg_len); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3534 |
tcp_input_data(connp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3535 |
mp, NULL, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3536 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3537 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3538 |
(void) adjmsg(mp1, urp + 1 - seg_len); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3539 |
tmp_rnxt = tcp->tcp_rnxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3540 |
tcp_input_data(connp, mp1, NULL, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3541 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3542 |
* If the data passed back in was not |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3543 |
* processed (ie: bad ACK) sending |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3544 |
* the remainder back in will cause a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3545 |
* loop. In this case, drop the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3546 |
* packet and let the sender try |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3547 |
* sending a good packet. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3548 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3549 |
if (tmp_rnxt == tcp->tcp_rnxt) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3550 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3551 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3552 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3553 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3554 |
tcp_input_data(connp, mp, NULL, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3555 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3556 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3557 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3558 |
* This segment contains only the urgent byte. We |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3559 |
* have to allocate the T_exdata_ind, if we can. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3560 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3561 |
if (IPCL_IS_NONSTR(connp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3562 |
int error; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3563 |
|
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
3564 |
(*sockupcalls->su_recv) |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3565 |
(connp->conn_upper_handle, mp, seg_len, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3566 |
MSG_OOB, &error, NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3567 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3568 |
* We should never be in middle of a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3569 |
* fallback, the squeue guarantees that. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3570 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3571 |
ASSERT(error != EOPNOTSUPP); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3572 |
mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3573 |
goto update_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3574 |
} else if (!tcp->tcp_urp_mp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3575 |
struct T_exdata_ind *tei; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3576 |
mp1 = allocb(sizeof (struct T_exdata_ind), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3577 |
BPRI_MED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3578 |
if (!mp1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3579 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3580 |
* Sigh... It'll be back. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3581 |
* Generate any MSG*MARK message now. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3582 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3583 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3584 |
seg_len = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3585 |
if (flags & TH_SEND_URP_MARK) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3586 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3587 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3588 |
ASSERT(tcp->tcp_urp_mark_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3589 |
tcp->tcp_urp_mark_mp->b_flag &= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3590 |
~MSGNOTMARKNEXT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3591 |
tcp->tcp_urp_mark_mp->b_flag |= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3592 |
MSGMARKNEXT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3593 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3594 |
goto ack_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3595 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3596 |
mp1->b_datap->db_type = M_PROTO; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3597 |
tei = (struct T_exdata_ind *)mp1->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3598 |
tei->PRIM_type = T_EXDATA_IND; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3599 |
tei->MORE_flag = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3600 |
mp1->b_wptr = (uchar_t *)&tei[1]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3601 |
tcp->tcp_urp_mp = mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3602 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3603 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3604 |
"tcp_rput: allocated exdata_ind %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3605 |
tcp_display(tcp, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3606 |
DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3607 |
#endif /* DEBUG */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3608 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3609 |
* There is no need to send a separate MSG*MARK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3610 |
* message since the T_EXDATA_IND will be sent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3611 |
* now. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3612 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3613 |
flags &= ~TH_SEND_URP_MARK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3614 |
freemsg(tcp->tcp_urp_mark_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3615 |
tcp->tcp_urp_mark_mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3616 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3617 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3618 |
* Now we are all set. On the next putnext upstream, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3619 |
* tcp_urp_mp will be non-NULL and will get prepended |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3620 |
* to what has to be this piece containing the urgent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3621 |
* byte. If for any reason we abort this segment below, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3622 |
* if it comes back, we will have this ready, or it |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3623 |
* will get blown off in close. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3624 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3625 |
} else if (urp == seg_len) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3626 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3627 |
* The urgent byte is the next byte after this sequence |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3628 |
* number. If this endpoint is non-STREAMS, then there |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3629 |
* is nothing to do here since the socket has already |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3630 |
* been notified about the urg pointer by the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3631 |
* su_signal_oob call above. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3632 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3633 |
* In case of STREAMS, some more work might be needed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3634 |
* If there is data it is marked with MSGMARKNEXT and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3635 |
* and any tcp_urp_mark_mp is discarded since it is not |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3636 |
* needed. Otherwise, if the code above just allocated |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3637 |
* a zero-length tcp_urp_mark_mp message, that message |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3638 |
* is tagged with MSGMARKNEXT. Sending up these |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3639 |
* MSGMARKNEXT messages makes SIOCATMARK work correctly |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3640 |
* even though the T_EXDATA_IND will not be sent up |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3641 |
* until the urgent byte arrives. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3642 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3643 |
if (!IPCL_IS_NONSTR(tcp->tcp_connp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3644 |
if (seg_len != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3645 |
flags |= TH_MARKNEXT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3646 |
freemsg(tcp->tcp_urp_mark_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3647 |
tcp->tcp_urp_mark_mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3648 |
flags &= ~TH_SEND_URP_MARK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3649 |
} else if (tcp->tcp_urp_mark_mp != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3650 |
flags |= TH_SEND_URP_MARK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3651 |
tcp->tcp_urp_mark_mp->b_flag &= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3652 |
~MSGNOTMARKNEXT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3653 |
tcp->tcp_urp_mark_mp->b_flag |= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3654 |
MSGMARKNEXT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3655 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3656 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3657 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3658 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3659 |
"tcp_rput: AT MARK, len %d, flags 0x%x, %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3660 |
seg_len, flags, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3661 |
tcp_display(tcp, NULL, DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3662 |
#endif /* DEBUG */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3663 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3664 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3665 |
else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3666 |
/* Data left until we hit mark */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3667 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3668 |
"tcp_rput: URP %d bytes left, %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3669 |
urp - seg_len, tcp_display(tcp, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3670 |
DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3671 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3672 |
#endif /* DEBUG */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3673 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3674 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3675 |
process_ack: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3676 |
if (!(flags & TH_ACK)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3677 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3678 |
goto xmit_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3679 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3680 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3681 |
bytes_acked = (int)(seg_ack - tcp->tcp_suna); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3682 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3683 |
if (bytes_acked > 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3684 |
tcp->tcp_ip_forward_progress = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3685 |
if (tcp->tcp_state == TCPS_SYN_RCVD) { |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3686 |
/* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3687 |
* tcp_sendmsg() checks tcp_state without entering |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3688 |
* the squeue so tcp_state should be updated before |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3689 |
* sending up a connection confirmation or a new |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3690 |
* connection indication. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3691 |
*/ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3692 |
tcp->tcp_state = TCPS_ESTABLISHED; |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3693 |
|
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3694 |
/* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3695 |
* We are seeing the final ack in the three way |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3696 |
* hand shake of a active open'ed connection |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3697 |
* so we must send up a T_CONN_CON |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3698 |
*/ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3699 |
if (tcp->tcp_active_open) { |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3700 |
if (!tcp_conn_con(tcp, iphdr, mp, NULL, ira)) { |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3701 |
freemsg(mp); |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3702 |
tcp->tcp_state = TCPS_SYN_RCVD; |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3703 |
return; |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3704 |
} |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3705 |
/* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3706 |
* Don't fuse the loopback endpoints for |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3707 |
* simultaneous active opens. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3708 |
*/ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3709 |
if (tcp->tcp_loopback) { |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3710 |
TCP_STAT(tcps, tcp_fusion_unfusable); |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3711 |
tcp->tcp_unfusable = B_TRUE; |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3712 |
} |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3713 |
/* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3714 |
* For simultaneous active open, trace receipt of final |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3715 |
* ACK as tcp:::connect-established. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3716 |
*/ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3717 |
DTRACE_TCP5(connect__established, mblk_t *, NULL, |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3718 |
ip_xmit_attr_t *, connp->conn_ixa, void_ip_t *, |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3719 |
iphdr, tcp_t *, tcp, tcph_t *, tcpha); |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3720 |
} else if (IPCL_IS_NONSTR(connp)) { |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3721 |
/* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3722 |
* 3-way handshake has completed, so notify socket |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3723 |
* of the new connection. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3724 |
* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3725 |
* We are here means eager is fine but it can |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3726 |
* get a TH_RST at any point between now and till |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3727 |
* accept completes and disappear. We need to |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3728 |
* ensure that reference to eager is valid after |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3729 |
* we get out of eager's perimeter. So we do |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3730 |
* an extra refhold. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3731 |
*/ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3732 |
CONN_INC_REF(connp); |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3733 |
|
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3734 |
if (!tcp_newconn_notify(tcp, ira)) { |
13074
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3735 |
/* |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3736 |
* The state-change probe for SYN_RCVD -> |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3737 |
* ESTABLISHED has not fired yet. We reset |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3738 |
* the state to SYN_RCVD so that future |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3739 |
* state-change probes report correct state |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3740 |
* transistions. |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3741 |
*/ |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3742 |
tcp->tcp_state = TCPS_SYN_RCVD; |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3743 |
freemsg(mp); |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3744 |
/* notification did not go up, so drop ref */ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3745 |
CONN_DEC_REF(connp); |
13074
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3746 |
/* ... and close the eager */ |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3747 |
ASSERT(TCP_IS_DETACHED(tcp)); |
36a559d3de13
6972175 assertion failed: tcp->tcp_fin_sent, file: ../../common/inet/tcp/tcp_input.c, line: 4306
Anders Persson <Anders.Persson@Sun.COM>
parents:
13020
diff
changeset
|
3748 |
(void) tcp_close_detached(tcp); |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3749 |
return; |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3750 |
} |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3751 |
/* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3752 |
* For passive open, trace receipt of final ACK as |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3753 |
* tcp:::accept-established. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3754 |
*/ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3755 |
DTRACE_TCP5(accept__established, mlbk_t *, NULL, |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3756 |
ip_xmit_attr_t *, connp->conn_ixa, void_ip_t *, |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3757 |
iphdr, tcp_t *, tcp, tcph_t *, tcpha); |
12644
4f9a0cd40c5f
6939100 convert KSSL into a socket filter
Anders Persson <Anders.Persson@Sun.COM>
parents:
12643
diff
changeset
|
3758 |
} else { |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3759 |
/* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3760 |
* 3-way handshake complete - this is a STREAMS based |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3761 |
* socket, so pass up the T_CONN_IND. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3762 |
*/ |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3763 |
tcp_t *listener = tcp->tcp_listener; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3764 |
mblk_t *mp = tcp->tcp_conn.tcp_eager_conn_ind; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3765 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3766 |
tcp->tcp_tconnind_started = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3767 |
tcp->tcp_conn.tcp_eager_conn_ind = NULL; |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
3768 |
ASSERT(mp != NULL); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3769 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3770 |
* We are here means eager is fine but it can |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3771 |
* get a TH_RST at any point between now and till |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3772 |
* accept completes and disappear. We need to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3773 |
* ensure that reference to eager is valid after |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3774 |
* we get out of eager's perimeter. So we do |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3775 |
* an extra refhold. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3776 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3777 |
CONN_INC_REF(connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3778 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3779 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3780 |
* The listener also exists because of the refhold |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3781 |
* done in tcp_input_listener. Its possible that it |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3782 |
* might have closed. We will check that once we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3783 |
* get inside listeners context. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3784 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3785 |
CONN_INC_REF(listener->tcp_connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3786 |
if (listener->tcp_connp->conn_sqp == |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3787 |
connp->conn_sqp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3788 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3789 |
* We optimize by not calling an SQUEUE_ENTER |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3790 |
* on the listener since we know that the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3791 |
* listener and eager squeues are the same. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3792 |
* We are able to make this check safely only |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3793 |
* because neither the eager nor the listener |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3794 |
* can change its squeue. Only an active connect |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3795 |
* can change its squeue |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3796 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3797 |
tcp_send_conn_ind(listener->tcp_connp, mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3798 |
listener->tcp_connp->conn_sqp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3799 |
CONN_DEC_REF(listener->tcp_connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3800 |
} else if (!tcp->tcp_loopback) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3801 |
SQUEUE_ENTER_ONE(listener->tcp_connp->conn_sqp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3802 |
mp, tcp_send_conn_ind, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3803 |
listener->tcp_connp, NULL, SQ_FILL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3804 |
SQTAG_TCP_CONN_IND); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3805 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3806 |
SQUEUE_ENTER_ONE(listener->tcp_connp->conn_sqp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3807 |
mp, tcp_send_conn_ind, |
12438
415bb0d1a02b
6929733 Cascaded squeue_drain can still induce stack overflow
George Shepherd <George.Shepherd@Sun.COM>
parents:
12056
diff
changeset
|
3808 |
listener->tcp_connp, NULL, SQ_NODRAIN, |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3809 |
SQTAG_TCP_CONN_IND); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3810 |
} |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3811 |
/* |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3812 |
* For passive open, trace receipt of final ACK as |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3813 |
* tcp:::accept-established. |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3814 |
*/ |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3815 |
DTRACE_TCP5(accept__established, mlbk_t *, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3816 |
ip_xmit_attr_t *, connp->conn_ixa, void_ip_t *, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3817 |
iphdr, tcp_t *, tcp, tcph_t *, tcpha); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3818 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3819 |
TCPS_CONN_INC(tcps); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3820 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3821 |
tcp->tcp_suna = tcp->tcp_iss + 1; /* One for the SYN */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3822 |
bytes_acked--; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3823 |
/* SYN was acked - making progress */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3824 |
tcp->tcp_ip_forward_progress = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3825 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3826 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3827 |
* If SYN was retransmitted, need to reset all |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3828 |
* retransmission info as this segment will be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3829 |
* treated as a dup ACK. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3830 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3831 |
if (tcp->tcp_rexmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3832 |
tcp->tcp_rexmit = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3833 |
tcp->tcp_rexmit_nxt = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3834 |
tcp->tcp_rexmit_max = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3835 |
tcp->tcp_snd_burst = tcp->tcp_localnet ? |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3836 |
TCP_CWND_INFINITE : TCP_CWND_NORMAL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3837 |
tcp->tcp_ms_we_have_waited = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3838 |
tcp->tcp_cwnd = mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3839 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3840 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3841 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3842 |
* We set the send window to zero here. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3843 |
* This is needed if there is data to be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3844 |
* processed already on the queue. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3845 |
* Later (at swnd_update label), the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3846 |
* "new_swnd > tcp_swnd" condition is satisfied |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3847 |
* the XMIT_NEEDED flag is set in the current |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3848 |
* (SYN_RCVD) state. This ensures tcp_wput_data() is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3849 |
* called if there is already data on queue in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3850 |
* this state. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3851 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3852 |
tcp->tcp_swnd = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3853 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3854 |
if (new_swnd > tcp->tcp_max_swnd) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3855 |
tcp->tcp_max_swnd = new_swnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3856 |
tcp->tcp_swl1 = seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3857 |
tcp->tcp_swl2 = seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3858 |
tcp->tcp_valid_bits &= ~TCP_ISS_VALID; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3859 |
|
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3860 |
/* Trace change from SYN_RCVD -> ESTABLISHED here */ |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3861 |
DTRACE_TCP6(state__change, void, NULL, ip_xmit_attr_t *, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3862 |
connp->conn_ixa, void, NULL, tcp_t *, tcp, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3863 |
int32_t, TCPS_SYN_RCVD); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
3864 |
|
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3865 |
/* Fuse when both sides are in ESTABLISHED state */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3866 |
if (tcp->tcp_loopback && do_tcp_fusion) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3867 |
tcp_fuse(tcp, iphdr, tcpha); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3868 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3869 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3870 |
/* This code follows 4.4BSD-Lite2 mostly. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3871 |
if (bytes_acked < 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3872 |
goto est; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3873 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3874 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3875 |
* If TCP is ECN capable and the congestion experience bit is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3876 |
* set, reduce tcp_cwnd and tcp_ssthresh. But this should only be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3877 |
* done once per window (or more loosely, per RTT). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3878 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3879 |
if (tcp->tcp_cwr && SEQ_GT(seg_ack, tcp->tcp_cwr_snd_max)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3880 |
tcp->tcp_cwr = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3881 |
if (tcp->tcp_ecn_ok && (flags & TH_ECE)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3882 |
if (!tcp->tcp_cwr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3883 |
npkt = ((tcp->tcp_snxt - tcp->tcp_suna) >> 1) / mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3884 |
tcp->tcp_cwnd_ssthresh = MAX(npkt, 2) * mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3885 |
tcp->tcp_cwnd = npkt * mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3886 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3887 |
* If the cwnd is 0, use the timer to clock out |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3888 |
* new segments. This is required by the ECN spec. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3889 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3890 |
if (npkt == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3891 |
TCP_TIMER_RESTART(tcp, tcp->tcp_rto); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3892 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3893 |
* This makes sure that when the ACK comes |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3894 |
* back, we will increase tcp_cwnd by 1 MSS. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3895 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3896 |
tcp->tcp_cwnd_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3897 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3898 |
tcp->tcp_cwr = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3899 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3900 |
* This marks the end of the current window of in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3901 |
* flight data. That is why we don't use |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3902 |
* tcp_suna + tcp_swnd. Only data in flight can |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3903 |
* provide ECN info. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3904 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3905 |
tcp->tcp_cwr_snd_max = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3906 |
tcp->tcp_ecn_cwr_sent = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3907 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3908 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3909 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3910 |
mp1 = tcp->tcp_xmit_head; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3911 |
if (bytes_acked == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3912 |
if (!ofo_seg && seg_len == 0 && new_swnd == tcp->tcp_swnd) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3913 |
int dupack_cnt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3914 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3915 |
TCPS_BUMP_MIB(tcps, tcpInDupAck); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3916 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3917 |
* Fast retransmit. When we have seen exactly three |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3918 |
* identical ACKs while we have unacked data |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3919 |
* outstanding we take it as a hint that our peer |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3920 |
* dropped something. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3921 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3922 |
* If TCP is retransmitting, don't do fast retransmit. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3923 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3924 |
if (mp1 && tcp->tcp_suna != tcp->tcp_snxt && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3925 |
! tcp->tcp_rexmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3926 |
/* Do Limited Transmit */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3927 |
if ((dupack_cnt = ++tcp->tcp_dupack_cnt) < |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3928 |
tcps->tcps_dupack_fast_retransmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3929 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3930 |
* RFC 3042 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3931 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3932 |
* What we need to do is temporarily |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3933 |
* increase tcp_cwnd so that new |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3934 |
* data can be sent if it is allowed |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3935 |
* by the receive window (tcp_rwnd). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3936 |
* tcp_wput_data() will take care of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3937 |
* the rest. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3938 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3939 |
* If the connection is SACK capable, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3940 |
* only do limited xmit when there |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3941 |
* is SACK info. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3942 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3943 |
* Note how tcp_cwnd is incremented. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3944 |
* The first dup ACK will increase |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3945 |
* it by 1 MSS. The second dup ACK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3946 |
* will increase it by 2 MSS. This |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3947 |
* means that only 1 new segment will |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3948 |
* be sent for each dup ACK. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3949 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3950 |
if (tcp->tcp_unsent > 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3951 |
(!tcp->tcp_snd_sack_ok || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3952 |
(tcp->tcp_snd_sack_ok && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3953 |
tcp->tcp_notsack_list != NULL))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3954 |
tcp->tcp_cwnd += mss << |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3955 |
(tcp->tcp_dupack_cnt - 1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3956 |
flags |= TH_LIMIT_XMIT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3957 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3958 |
} else if (dupack_cnt == |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3959 |
tcps->tcps_dupack_fast_retransmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3960 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3961 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3962 |
* If we have reduced tcp_ssthresh |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3963 |
* because of ECN, do not reduce it again |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3964 |
* unless it is already one window of data |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3965 |
* away. After one window of data, tcp_cwr |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3966 |
* should then be cleared. Note that |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3967 |
* for non ECN capable connection, tcp_cwr |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3968 |
* should always be false. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3969 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3970 |
* Adjust cwnd since the duplicate |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3971 |
* ack indicates that a packet was |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3972 |
* dropped (due to congestion.) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3973 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3974 |
if (!tcp->tcp_cwr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3975 |
npkt = ((tcp->tcp_snxt - |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3976 |
tcp->tcp_suna) >> 1) / mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3977 |
tcp->tcp_cwnd_ssthresh = MAX(npkt, 2) * |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3978 |
mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3979 |
tcp->tcp_cwnd = (npkt + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3980 |
tcp->tcp_dupack_cnt) * mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3981 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3982 |
if (tcp->tcp_ecn_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3983 |
tcp->tcp_cwr = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3984 |
tcp->tcp_cwr_snd_max = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3985 |
tcp->tcp_ecn_cwr_sent = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3986 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3987 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3988 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3989 |
* We do Hoe's algorithm. Refer to her |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3990 |
* paper "Improving the Start-up Behavior |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3991 |
* of a Congestion Control Scheme for TCP," |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3992 |
* appeared in SIGCOMM'96. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3993 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3994 |
* Save highest seq no we have sent so far. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3995 |
* Be careful about the invisible FIN byte. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3996 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3997 |
if ((tcp->tcp_valid_bits & TCP_FSS_VALID) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3998 |
(tcp->tcp_unsent == 0)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
3999 |
tcp->tcp_rexmit_max = tcp->tcp_fss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4000 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4001 |
tcp->tcp_rexmit_max = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4002 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4003 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4004 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4005 |
* Do not allow bursty traffic during. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4006 |
* fast recovery. Refer to Fall and Floyd's |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4007 |
* paper "Simulation-based Comparisons of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4008 |
* Tahoe, Reno and SACK TCP" (in CCR?) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4009 |
* This is a best current practise. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4010 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4011 |
tcp->tcp_snd_burst = TCP_CWND_SS; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4012 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4013 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4014 |
* For SACK: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4015 |
* Calculate tcp_pipe, which is the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4016 |
* estimated number of bytes in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4017 |
* network. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4018 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4019 |
* tcp_fack is the highest sack'ed seq num |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4020 |
* TCP has received. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4021 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4022 |
* tcp_pipe is explained in the above quoted |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4023 |
* Fall and Floyd's paper. tcp_fack is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4024 |
* explained in Mathis and Mahdavi's |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4025 |
* "Forward Acknowledgment: Refining TCP |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4026 |
* Congestion Control" in SIGCOMM '96. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4027 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4028 |
if (tcp->tcp_snd_sack_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4029 |
if (tcp->tcp_notsack_list != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4030 |
tcp->tcp_pipe = tcp->tcp_snxt - |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4031 |
tcp->tcp_fack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4032 |
tcp->tcp_sack_snxt = seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4033 |
flags |= TH_NEED_SACK_REXMIT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4034 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4035 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4036 |
* Always initialize tcp_pipe |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4037 |
* even though we don't have |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4038 |
* any SACK info. If later |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4039 |
* we get SACK info and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4040 |
* tcp_pipe is not initialized, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4041 |
* funny things will happen. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4042 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4043 |
tcp->tcp_pipe = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4044 |
tcp->tcp_cwnd_ssthresh; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4045 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4046 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4047 |
flags |= TH_REXMIT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4048 |
} /* tcp_snd_sack_ok */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4049 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4050 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4051 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4052 |
* Here we perform congestion |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4053 |
* avoidance, but NOT slow start. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4054 |
* This is known as the Fast |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4055 |
* Recovery Algorithm. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4056 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4057 |
if (tcp->tcp_snd_sack_ok && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4058 |
tcp->tcp_notsack_list != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4059 |
flags |= TH_NEED_SACK_REXMIT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4060 |
tcp->tcp_pipe -= mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4061 |
if (tcp->tcp_pipe < 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4062 |
tcp->tcp_pipe = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4063 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4064 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4065 |
* We know that one more packet has |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4066 |
* left the pipe thus we can update |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4067 |
* cwnd. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4068 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4069 |
cwnd = tcp->tcp_cwnd + mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4070 |
if (cwnd > tcp->tcp_cwnd_max) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4071 |
cwnd = tcp->tcp_cwnd_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4072 |
tcp->tcp_cwnd = cwnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4073 |
if (tcp->tcp_unsent > 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4074 |
flags |= TH_XMIT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4075 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4076 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4077 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4078 |
} else if (tcp->tcp_zero_win_probe) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4079 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4080 |
* If the window has opened, need to arrange |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4081 |
* to send additional data. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4082 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4083 |
if (new_swnd != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4084 |
/* tcp_suna != tcp_snxt */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4085 |
/* Packet contains a window update */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4086 |
TCPS_BUMP_MIB(tcps, tcpInWinUpdate); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4087 |
tcp->tcp_zero_win_probe = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4088 |
tcp->tcp_timer_backoff = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4089 |
tcp->tcp_ms_we_have_waited = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4090 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4091 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4092 |
* Transmit starting with tcp_suna since |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4093 |
* the one byte probe is not ack'ed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4094 |
* If TCP has sent more than one identical |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4095 |
* probe, tcp_rexmit will be set. That means |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4096 |
* tcp_ss_rexmit() will send out the one |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4097 |
* byte along with new data. Otherwise, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4098 |
* fake the retransmission. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4099 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4100 |
flags |= TH_XMIT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4101 |
if (!tcp->tcp_rexmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4102 |
tcp->tcp_rexmit = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4103 |
tcp->tcp_dupack_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4104 |
tcp->tcp_rexmit_nxt = tcp->tcp_suna; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4105 |
tcp->tcp_rexmit_max = tcp->tcp_suna + 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4106 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4107 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4108 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4109 |
goto swnd_update; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4110 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4111 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4112 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4113 |
* Check for "acceptability" of ACK value per RFC 793, pages 72 - 73. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4114 |
* If the ACK value acks something that we have not yet sent, it might |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4115 |
* be an old duplicate segment. Send an ACK to re-synchronize the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4116 |
* other side. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4117 |
* Note: reset in response to unacceptable ACK in SYN_RECEIVE |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4118 |
* state is handled above, so we can always just drop the segment and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4119 |
* send an ACK here. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4120 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4121 |
* In the case where the peer shrinks the window, we see the new window |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4122 |
* update, but all the data sent previously is queued up by the peer. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4123 |
* To account for this, in tcp_process_shrunk_swnd(), the sequence |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4124 |
* number, which was already sent, and within window, is recorded. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4125 |
* tcp_snxt is then updated. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4126 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4127 |
* If the window has previously shrunk, and an ACK for data not yet |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4128 |
* sent, according to tcp_snxt is recieved, it may still be valid. If |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4129 |
* the ACK is for data within the window at the time the window was |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4130 |
* shrunk, then the ACK is acceptable. In this case tcp_snxt is set to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4131 |
* the sequence number ACK'ed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4132 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4133 |
* If the ACK covers all the data sent at the time the window was |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4134 |
* shrunk, we can now set tcp_is_wnd_shrnk to B_FALSE. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4135 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4136 |
* Should we send ACKs in response to ACK only segments? |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4137 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4138 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4139 |
if (SEQ_GT(seg_ack, tcp->tcp_snxt)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4140 |
if ((tcp->tcp_is_wnd_shrnk) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4141 |
(SEQ_LEQ(seg_ack, tcp->tcp_snxt_shrunk))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4142 |
uint32_t data_acked_ahead_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4143 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4144 |
data_acked_ahead_snxt = seg_ack - tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4145 |
tcp_update_xmit_tail(tcp, seg_ack); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4146 |
tcp->tcp_unsent -= data_acked_ahead_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4147 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4148 |
TCPS_BUMP_MIB(tcps, tcpInAckUnsent); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4149 |
/* drop the received segment */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4150 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4151 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4152 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4153 |
* Send back an ACK. If tcp_drop_ack_unsent_cnt is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4154 |
* greater than 0, check if the number of such |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4155 |
* bogus ACks is greater than that count. If yes, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4156 |
* don't send back any ACK. This prevents TCP from |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4157 |
* getting into an ACK storm if somehow an attacker |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4158 |
* successfully spoofs an acceptable segment to our |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4159 |
* peer. If this continues (count > 2 X threshold), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4160 |
* we should abort this connection. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4161 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4162 |
if (tcp_drop_ack_unsent_cnt > 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4163 |
++tcp->tcp_in_ack_unsent > |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4164 |
tcp_drop_ack_unsent_cnt) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4165 |
TCP_STAT(tcps, tcp_in_ack_unsent_drop); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4166 |
if (tcp->tcp_in_ack_unsent > 2 * |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4167 |
tcp_drop_ack_unsent_cnt) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4168 |
(void) tcp_clean_death(tcp, EPROTO); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4169 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4170 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4171 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4172 |
mp = tcp_ack_mp(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4173 |
if (mp != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4174 |
BUMP_LOCAL(tcp->tcp_obsegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4175 |
TCPS_BUMP_MIB(tcps, tcpOutAck); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4176 |
tcp_send_data(tcp, mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4177 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4178 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4179 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4180 |
} else if (tcp->tcp_is_wnd_shrnk && SEQ_GEQ(seg_ack, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4181 |
tcp->tcp_snxt_shrunk)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4182 |
tcp->tcp_is_wnd_shrnk = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4183 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4184 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4185 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4186 |
* TCP gets a new ACK, update the notsack'ed list to delete those |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4187 |
* blocks that are covered by this ACK. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4188 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4189 |
if (tcp->tcp_snd_sack_ok && tcp->tcp_notsack_list != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4190 |
tcp_notsack_remove(&(tcp->tcp_notsack_list), seg_ack, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4191 |
&(tcp->tcp_num_notsack_blk), &(tcp->tcp_cnt_notsack_list)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4192 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4193 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4194 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4195 |
* If we got an ACK after fast retransmit, check to see |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4196 |
* if it is a partial ACK. If it is not and the congestion |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4197 |
* window was inflated to account for the other side's |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4198 |
* cached packets, retract it. If it is, do Hoe's algorithm. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4199 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4200 |
if (tcp->tcp_dupack_cnt >= tcps->tcps_dupack_fast_retransmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4201 |
ASSERT(tcp->tcp_rexmit == B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4202 |
if (SEQ_GEQ(seg_ack, tcp->tcp_rexmit_max)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4203 |
tcp->tcp_dupack_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4204 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4205 |
* Restore the orig tcp_cwnd_ssthresh after |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4206 |
* fast retransmit phase. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4207 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4208 |
if (tcp->tcp_cwnd > tcp->tcp_cwnd_ssthresh) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4209 |
tcp->tcp_cwnd = tcp->tcp_cwnd_ssthresh; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4210 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4211 |
tcp->tcp_rexmit_max = seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4212 |
tcp->tcp_cwnd_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4213 |
tcp->tcp_snd_burst = tcp->tcp_localnet ? |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4214 |
TCP_CWND_INFINITE : TCP_CWND_NORMAL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4215 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4216 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4217 |
* Remove all notsack info to avoid confusion with |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4218 |
* the next fast retrasnmit/recovery phase. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4219 |
*/ |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
4220 |
if (tcp->tcp_snd_sack_ok) { |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4221 |
TCP_NOTSACK_REMOVE_ALL(tcp->tcp_notsack_list, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4222 |
tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4223 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4224 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4225 |
if (tcp->tcp_snd_sack_ok && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4226 |
tcp->tcp_notsack_list != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4227 |
flags |= TH_NEED_SACK_REXMIT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4228 |
tcp->tcp_pipe -= mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4229 |
if (tcp->tcp_pipe < 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4230 |
tcp->tcp_pipe = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4231 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4232 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4233 |
* Hoe's algorithm: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4234 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4235 |
* Retransmit the unack'ed segment and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4236 |
* restart fast recovery. Note that we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4237 |
* need to scale back tcp_cwnd to the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4238 |
* original value when we started fast |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4239 |
* recovery. This is to prevent overly |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4240 |
* aggressive behaviour in sending new |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4241 |
* segments. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4242 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4243 |
tcp->tcp_cwnd = tcp->tcp_cwnd_ssthresh + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4244 |
tcps->tcps_dupack_fast_retransmit * mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4245 |
tcp->tcp_cwnd_cnt = tcp->tcp_cwnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4246 |
flags |= TH_REXMIT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4247 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4248 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4249 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4250 |
tcp->tcp_dupack_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4251 |
if (tcp->tcp_rexmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4252 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4253 |
* TCP is retranmitting. If the ACK ack's all |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4254 |
* outstanding data, update tcp_rexmit_max and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4255 |
* tcp_rexmit_nxt. Otherwise, update tcp_rexmit_nxt |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4256 |
* to the correct value. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4257 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4258 |
* Note that SEQ_LEQ() is used. This is to avoid |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4259 |
* unnecessary fast retransmit caused by dup ACKs |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4260 |
* received when TCP does slow start retransmission |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4261 |
* after a time out. During this phase, TCP may |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4262 |
* send out segments which are already received. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4263 |
* This causes dup ACKs to be sent back. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4264 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4265 |
if (SEQ_LEQ(seg_ack, tcp->tcp_rexmit_max)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4266 |
if (SEQ_GT(seg_ack, tcp->tcp_rexmit_nxt)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4267 |
tcp->tcp_rexmit_nxt = seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4268 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4269 |
if (seg_ack != tcp->tcp_rexmit_max) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4270 |
flags |= TH_XMIT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4271 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4272 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4273 |
tcp->tcp_rexmit = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4274 |
tcp->tcp_rexmit_nxt = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4275 |
tcp->tcp_snd_burst = tcp->tcp_localnet ? |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4276 |
TCP_CWND_INFINITE : TCP_CWND_NORMAL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4277 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4278 |
tcp->tcp_ms_we_have_waited = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4279 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4280 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4281 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4282 |
TCPS_BUMP_MIB(tcps, tcpInAckSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4283 |
TCPS_UPDATE_MIB(tcps, tcpInAckBytes, bytes_acked); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4284 |
tcp->tcp_suna = seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4285 |
if (tcp->tcp_zero_win_probe != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4286 |
tcp->tcp_zero_win_probe = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4287 |
tcp->tcp_timer_backoff = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4288 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4289 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4290 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4291 |
* If tcp_xmit_head is NULL, then it must be the FIN being ack'ed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4292 |
* Note that it cannot be the SYN being ack'ed. The code flow |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4293 |
* will not reach here. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4294 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4295 |
if (mp1 == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4296 |
goto fin_acked; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4297 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4298 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4299 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4300 |
* Update the congestion window. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4301 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4302 |
* If TCP is not ECN capable or TCP is ECN capable but the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4303 |
* congestion experience bit is not set, increase the tcp_cwnd as |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4304 |
* usual. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4305 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4306 |
if (!tcp->tcp_ecn_ok || !(flags & TH_ECE)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4307 |
cwnd = tcp->tcp_cwnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4308 |
add = mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4309 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4310 |
if (cwnd >= tcp->tcp_cwnd_ssthresh) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4311 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4312 |
* This is to prevent an increase of less than 1 MSS of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4313 |
* tcp_cwnd. With partial increase, tcp_wput_data() |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4314 |
* may send out tinygrams in order to preserve mblk |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4315 |
* boundaries. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4316 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4317 |
* By initializing tcp_cwnd_cnt to new tcp_cwnd and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4318 |
* decrementing it by 1 MSS for every ACKs, tcp_cwnd is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4319 |
* increased by 1 MSS for every RTTs. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4320 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4321 |
if (tcp->tcp_cwnd_cnt <= 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4322 |
tcp->tcp_cwnd_cnt = cwnd + add; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4323 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4324 |
tcp->tcp_cwnd_cnt -= add; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4325 |
add = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4326 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4327 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4328 |
tcp->tcp_cwnd = MIN(cwnd + add, tcp->tcp_cwnd_max); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4329 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4330 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4331 |
/* See if the latest urgent data has been acknowledged */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4332 |
if ((tcp->tcp_valid_bits & TCP_URG_VALID) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4333 |
SEQ_GT(seg_ack, tcp->tcp_urg)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4334 |
tcp->tcp_valid_bits &= ~TCP_URG_VALID; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4335 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4336 |
/* Can we update the RTT estimates? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4337 |
if (tcp->tcp_snd_ts_ok) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4338 |
/* Ignore zero timestamp echo-reply. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4339 |
if (tcpopt.tcp_opt_ts_ecr != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4340 |
tcp_set_rto(tcp, (int32_t)LBOLT_FASTPATH - |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4341 |
(int32_t)tcpopt.tcp_opt_ts_ecr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4342 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4343 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4344 |
/* If needed, restart the timer. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4345 |
if (tcp->tcp_set_timer == 1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4346 |
TCP_TIMER_RESTART(tcp, tcp->tcp_rto); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4347 |
tcp->tcp_set_timer = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4348 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4349 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4350 |
* Update tcp_csuna in case the other side stops sending |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4351 |
* us timestamps. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4352 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4353 |
tcp->tcp_csuna = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4354 |
} else if (SEQ_GT(seg_ack, tcp->tcp_csuna)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4355 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4356 |
* An ACK sequence we haven't seen before, so get the RTT |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4357 |
* and update the RTO. But first check if the timestamp is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4358 |
* valid to use. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4359 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4360 |
if ((mp1->b_next != NULL) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4361 |
SEQ_GT(seg_ack, (uint32_t)(uintptr_t)(mp1->b_next))) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4362 |
tcp_set_rto(tcp, (int32_t)LBOLT_FASTPATH - |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4363 |
(int32_t)(intptr_t)mp1->b_prev); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4364 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4365 |
TCPS_BUMP_MIB(tcps, tcpRttNoUpdate); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4366 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4367 |
/* Remeber the last sequence to be ACKed */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4368 |
tcp->tcp_csuna = seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4369 |
if (tcp->tcp_set_timer == 1) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4370 |
TCP_TIMER_RESTART(tcp, tcp->tcp_rto); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4371 |
tcp->tcp_set_timer = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4372 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4373 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4374 |
TCPS_BUMP_MIB(tcps, tcpRttNoUpdate); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4375 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4376 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4377 |
/* Eat acknowledged bytes off the xmit queue. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4378 |
for (;;) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4379 |
mblk_t *mp2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4380 |
uchar_t *wptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4381 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4382 |
wptr = mp1->b_wptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4383 |
ASSERT((uintptr_t)(wptr - mp1->b_rptr) <= (uintptr_t)INT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4384 |
bytes_acked -= (int)(wptr - mp1->b_rptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4385 |
if (bytes_acked < 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4386 |
mp1->b_rptr = wptr + bytes_acked; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4387 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4388 |
* Set a new timestamp if all the bytes timed by the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4389 |
* old timestamp have been ack'ed. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4390 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4391 |
if (SEQ_GT(seg_ack, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4392 |
(uint32_t)(uintptr_t)(mp1->b_next))) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4393 |
mp1->b_prev = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4394 |
(mblk_t *)(uintptr_t)LBOLT_FASTPATH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4395 |
mp1->b_next = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4396 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4397 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4398 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4399 |
mp1->b_next = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4400 |
mp1->b_prev = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4401 |
mp2 = mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4402 |
mp1 = mp1->b_cont; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4403 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4404 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4405 |
* This notification is required for some zero-copy |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4406 |
* clients to maintain a copy semantic. After the data |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4407 |
* is ack'ed, client is safe to modify or reuse the buffer. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4408 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4409 |
if (tcp->tcp_snd_zcopy_aware && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4410 |
(mp2->b_datap->db_struioflag & STRUIO_ZCNOTIFY)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4411 |
tcp_zcopy_notify(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4412 |
freeb(mp2); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4413 |
if (bytes_acked == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4414 |
if (mp1 == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4415 |
/* Everything is ack'ed, clear the tail. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4416 |
tcp->tcp_xmit_tail = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4417 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4418 |
* Cancel the timer unless we are still |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4419 |
* waiting for an ACK for the FIN packet. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4420 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4421 |
if (tcp->tcp_timer_tid != 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4422 |
tcp->tcp_snxt == tcp->tcp_suna) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4423 |
(void) TCP_TIMER_CANCEL(tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4424 |
tcp->tcp_timer_tid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4425 |
tcp->tcp_timer_tid = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4426 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4427 |
goto pre_swnd_update; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4428 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4429 |
if (mp2 != tcp->tcp_xmit_tail) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4430 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4431 |
tcp->tcp_xmit_tail = mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4432 |
ASSERT((uintptr_t)(mp1->b_wptr - mp1->b_rptr) <= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4433 |
(uintptr_t)INT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4434 |
tcp->tcp_xmit_tail_unsent = (int)(mp1->b_wptr - |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4435 |
mp1->b_rptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4436 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4437 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4438 |
if (mp1 == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4439 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4440 |
* More was acked but there is nothing more |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4441 |
* outstanding. This means that the FIN was |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4442 |
* just acked or that we're talking to a clown. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4443 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4444 |
fin_acked: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4445 |
ASSERT(tcp->tcp_fin_sent); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4446 |
tcp->tcp_xmit_tail = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4447 |
if (tcp->tcp_fin_sent) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4448 |
/* FIN was acked - making progress */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4449 |
if (!tcp->tcp_fin_acked) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4450 |
tcp->tcp_ip_forward_progress = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4451 |
tcp->tcp_fin_acked = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4452 |
if (tcp->tcp_linger_tid != 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4453 |
TCP_TIMER_CANCEL(tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4454 |
tcp->tcp_linger_tid) >= 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4455 |
tcp_stop_lingering(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4456 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4457 |
mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4458 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4459 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4460 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4461 |
* We should never get here because |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4462 |
* we have already checked that the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4463 |
* number of bytes ack'ed should be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4464 |
* smaller than or equal to what we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4465 |
* have sent so far (it is the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4466 |
* acceptability check of the ACK). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4467 |
* We can only get here if the send |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4468 |
* queue is corrupted. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4469 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4470 |
* Terminate the connection and |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4471 |
* panic the system. It is better |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4472 |
* for us to panic instead of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4473 |
* continuing to avoid other disaster. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4474 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4475 |
tcp_xmit_ctl(NULL, tcp, tcp->tcp_snxt, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4476 |
tcp->tcp_rnxt, TH_RST|TH_ACK); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4477 |
panic("Memory corruption " |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4478 |
"detected for connection %s.", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4479 |
tcp_display(tcp, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4480 |
DISP_ADDR_AND_PORT)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4481 |
/*NOTREACHED*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4482 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4483 |
goto pre_swnd_update; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4484 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4485 |
ASSERT(mp2 != tcp->tcp_xmit_tail); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4486 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4487 |
if (tcp->tcp_unsent) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4488 |
flags |= TH_XMIT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4489 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4490 |
pre_swnd_update: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4491 |
tcp->tcp_xmit_head = mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4492 |
swnd_update: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4493 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4494 |
* The following check is different from most other implementations. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4495 |
* For bi-directional transfer, when segments are dropped, the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4496 |
* "normal" check will not accept a window update in those |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4497 |
* retransmitted segemnts. Failing to do that, TCP may send out |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4498 |
* segments which are outside receiver's window. As TCP accepts |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4499 |
* the ack in those retransmitted segments, if the window update in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4500 |
* the same segment is not accepted, TCP will incorrectly calculates |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4501 |
* that it can send more segments. This can create a deadlock |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4502 |
* with the receiver if its window becomes zero. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4503 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4504 |
if (SEQ_LT(tcp->tcp_swl2, seg_ack) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4505 |
SEQ_LT(tcp->tcp_swl1, seg_seq) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4506 |
(tcp->tcp_swl1 == seg_seq && new_swnd > tcp->tcp_swnd)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4507 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4508 |
* The criteria for update is: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4509 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4510 |
* 1. the segment acknowledges some data. Or |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4511 |
* 2. the segment is new, i.e. it has a higher seq num. Or |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4512 |
* 3. the segment is not old and the advertised window is |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4513 |
* larger than the previous advertised window. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4514 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4515 |
if (tcp->tcp_unsent && new_swnd > tcp->tcp_swnd) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4516 |
flags |= TH_XMIT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4517 |
tcp->tcp_swnd = new_swnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4518 |
if (new_swnd > tcp->tcp_max_swnd) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4519 |
tcp->tcp_max_swnd = new_swnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4520 |
tcp->tcp_swl1 = seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4521 |
tcp->tcp_swl2 = seg_ack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4522 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4523 |
est: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4524 |
if (tcp->tcp_state > TCPS_ESTABLISHED) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4525 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4526 |
switch (tcp->tcp_state) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4527 |
case TCPS_FIN_WAIT_1: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4528 |
if (tcp->tcp_fin_acked) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4529 |
tcp->tcp_state = TCPS_FIN_WAIT_2; |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4530 |
DTRACE_TCP6(state__change, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4531 |
ip_xmit_attr_t *, connp->conn_ixa, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4532 |
void, NULL, tcp_t *, tcp, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4533 |
int32_t, TCPS_FIN_WAIT_1); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4534 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4535 |
* We implement the non-standard BSD/SunOS |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4536 |
* FIN_WAIT_2 flushing algorithm. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4537 |
* If there is no user attached to this |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4538 |
* TCP endpoint, then this TCP struct |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4539 |
* could hang around forever in FIN_WAIT_2 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4540 |
* state if the peer forgets to send us |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4541 |
* a FIN. To prevent this, we wait only |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4542 |
* 2*MSL (a convenient time value) for |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4543 |
* the FIN to arrive. If it doesn't show up, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4544 |
* we flush the TCP endpoint. This algorithm, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4545 |
* though a violation of RFC-793, has worked |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4546 |
* for over 10 years in BSD systems. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4547 |
* Note: SunOS 4.x waits 675 seconds before |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4548 |
* flushing the FIN_WAIT_2 connection. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4549 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4550 |
TCP_TIMER_RESTART(tcp, |
12544
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12507
diff
changeset
|
4551 |
tcp->tcp_fin_wait_2_flush_interval); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4552 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4553 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4554 |
case TCPS_FIN_WAIT_2: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4555 |
break; /* Shutdown hook? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4556 |
case TCPS_LAST_ACK: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4557 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4558 |
if (tcp->tcp_fin_acked) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4559 |
(void) tcp_clean_death(tcp, 0); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4560 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4561 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4562 |
goto xmit_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4563 |
case TCPS_CLOSING: |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4564 |
if (tcp->tcp_fin_acked) { |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4565 |
SET_TIME_WAIT(tcps, tcp, connp); |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4566 |
DTRACE_TCP6(state__change, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4567 |
ip_xmit_attr_t *, connp->conn_ixa, void, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4568 |
NULL, tcp_t *, tcp, void, NULL, int32_t, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4569 |
TCPS_CLOSING); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4570 |
} |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4571 |
/*FALLTHRU*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4572 |
case TCPS_CLOSE_WAIT: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4573 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4574 |
goto xmit_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4575 |
default: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4576 |
ASSERT(tcp->tcp_state != TCPS_TIME_WAIT); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4577 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4578 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4579 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4580 |
if (flags & TH_FIN) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4581 |
/* Make sure we ack the fin */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4582 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4583 |
if (!tcp->tcp_fin_rcvd) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4584 |
tcp->tcp_fin_rcvd = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4585 |
tcp->tcp_rnxt++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4586 |
tcpha = tcp->tcp_tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4587 |
tcpha->tha_ack = htonl(tcp->tcp_rnxt); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4588 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4589 |
/* |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4590 |
* Generate the ordrel_ind at the end unless the |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4591 |
* conn is detached or it is a STREAMS based eager. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4592 |
* In the eager case we defer the notification until |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4593 |
* tcp_accept_finish has run. |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4594 |
*/ |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4595 |
if (!TCP_IS_DETACHED(tcp) && (IPCL_IS_NONSTR(connp) || |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4596 |
(tcp->tcp_listener == NULL && |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4597 |
!tcp->tcp_hard_binding))) |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4598 |
flags |= TH_ORDREL_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4599 |
switch (tcp->tcp_state) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4600 |
case TCPS_SYN_RCVD: |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4601 |
tcp->tcp_state = TCPS_CLOSE_WAIT; |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4602 |
DTRACE_TCP6(state__change, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4603 |
ip_xmit_attr_t *, connp->conn_ixa, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4604 |
void, NULL, tcp_t *, tcp, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4605 |
int32_t, TCPS_SYN_RCVD); |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4606 |
/* Keepalive? */ |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4607 |
break; |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4608 |
case TCPS_ESTABLISHED: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4609 |
tcp->tcp_state = TCPS_CLOSE_WAIT; |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4610 |
DTRACE_TCP6(state__change, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4611 |
ip_xmit_attr_t *, connp->conn_ixa, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4612 |
void, NULL, tcp_t *, tcp, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4613 |
int32_t, TCPS_ESTABLISHED); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4614 |
/* Keepalive? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4615 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4616 |
case TCPS_FIN_WAIT_1: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4617 |
if (!tcp->tcp_fin_acked) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4618 |
tcp->tcp_state = TCPS_CLOSING; |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4619 |
DTRACE_TCP6(state__change, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4620 |
ip_xmit_attr_t *, connp->conn_ixa, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4621 |
void, NULL, tcp_t *, tcp, void, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4622 |
NULL, int32_t, TCPS_FIN_WAIT_1); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4623 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4624 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4625 |
/* FALLTHRU */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4626 |
case TCPS_FIN_WAIT_2: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4627 |
SET_TIME_WAIT(tcps, tcp, connp); |
12507
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4628 |
DTRACE_TCP6(state__change, void, NULL, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4629 |
ip_xmit_attr_t *, connp->conn_ixa, void, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4630 |
NULL, tcp_t *, tcp, void, NULL, int32_t, |
501806a754d2
PSARC 2010/106 DTrace TCP and UDP providers
Alan Maguire <Alan.Maguire@Sun.COM>
parents:
12438
diff
changeset
|
4631 |
TCPS_FIN_WAIT_2); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4632 |
if (seg_len) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4633 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4634 |
* implies data piggybacked on FIN. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4635 |
* break to handle data. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4636 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4637 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4638 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4639 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4640 |
goto ack_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4641 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4642 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4643 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4644 |
if (mp == NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4645 |
goto xmit_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4646 |
if (seg_len == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4647 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4648 |
goto xmit_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4649 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4650 |
if (mp->b_rptr == mp->b_wptr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4651 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4652 |
* The header has been consumed, so we remove the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4653 |
* zero-length mblk here. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4654 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4655 |
mp1 = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4656 |
mp = mp->b_cont; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4657 |
freeb(mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4658 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4659 |
update_ack: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4660 |
tcpha = tcp->tcp_tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4661 |
tcp->tcp_rack_cnt++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4662 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4663 |
uint32_t cur_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4664 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4665 |
cur_max = tcp->tcp_rack_cur_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4666 |
if (tcp->tcp_rack_cnt >= cur_max) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4667 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4668 |
* We have more unacked data than we should - send |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4669 |
* an ACK now. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4670 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4671 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4672 |
cur_max++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4673 |
if (cur_max > tcp->tcp_rack_abs_max) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4674 |
tcp->tcp_rack_cur_max = tcp->tcp_rack_abs_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4675 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4676 |
tcp->tcp_rack_cur_max = cur_max; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4677 |
} else if (TCP_IS_DETACHED(tcp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4678 |
/* We don't have an ACK timer for detached TCP. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4679 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4680 |
} else if (seg_len < mss) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4681 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4682 |
* If we get a segment that is less than an mss, and we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4683 |
* already have unacknowledged data, and the amount |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4684 |
* unacknowledged is not a multiple of mss, then we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4685 |
* better generate an ACK now. Otherwise, this may be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4686 |
* the tail piece of a transaction, and we would rather |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4687 |
* wait for the response. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4688 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4689 |
uint32_t udif; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4690 |
ASSERT((uintptr_t)(tcp->tcp_rnxt - tcp->tcp_rack) <= |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4691 |
(uintptr_t)INT_MAX); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4692 |
udif = (int)(tcp->tcp_rnxt - tcp->tcp_rack); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4693 |
if (udif && (udif % mss)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4694 |
flags |= TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4695 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4696 |
flags |= TH_ACK_TIMER_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4697 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4698 |
/* Start delayed ack timer */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4699 |
flags |= TH_ACK_TIMER_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4700 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4701 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4702 |
tcp->tcp_rnxt += seg_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4703 |
tcpha->tha_ack = htonl(tcp->tcp_rnxt); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4704 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4705 |
if (mp == NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4706 |
goto xmit_check; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4707 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4708 |
/* Update SACK list */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4709 |
if (tcp->tcp_snd_sack_ok && tcp->tcp_num_sack_blk > 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4710 |
tcp_sack_remove(tcp->tcp_sack_list, tcp->tcp_rnxt, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4711 |
&(tcp->tcp_num_sack_blk)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4712 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4713 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4714 |
if (tcp->tcp_urp_mp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4715 |
tcp->tcp_urp_mp->b_cont = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4716 |
mp = tcp->tcp_urp_mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4717 |
tcp->tcp_urp_mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4718 |
/* Ready for a new signal. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4719 |
tcp->tcp_urp_last_valid = B_FALSE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4720 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4721 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4722 |
"tcp_rput: sending exdata_ind %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4723 |
tcp_display(tcp, NULL, DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4724 |
#endif /* DEBUG */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4725 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4726 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4727 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4728 |
* Check for ancillary data changes compared to last segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4729 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4730 |
if (connp->conn_recv_ancillary.crb_all != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4731 |
mp = tcp_input_add_ancillary(tcp, mp, &ipp, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4732 |
if (mp == NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4733 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4734 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4735 |
|
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4736 |
if (IPCL_IS_NONSTR(connp)) { |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4737 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4738 |
* Non-STREAMS socket |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4739 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4740 |
boolean_t push = flags & (TH_PUSH|TH_FIN); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4741 |
int error; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4742 |
|
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
4743 |
if ((*sockupcalls->su_recv)(connp->conn_upper_handle, |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4744 |
mp, seg_len, 0, &error, &push) <= 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4745 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4746 |
* We should never be in middle of a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4747 |
* fallback, the squeue guarantees that. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4748 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4749 |
ASSERT(error != EOPNOTSUPP); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4750 |
if (error == ENOSPC) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4751 |
tcp->tcp_rwnd -= seg_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4752 |
} else if (push) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4753 |
/* PUSH bit set and sockfs is not flow controlled */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4754 |
flags |= tcp_rwnd_reopen(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4755 |
} |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4756 |
} else if (tcp->tcp_listener != NULL || tcp->tcp_hard_binding) { |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4757 |
/* |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4758 |
* Side queue inbound data until the accept happens. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4759 |
* tcp_accept/tcp_rput drains this when the accept happens. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4760 |
* M_DATA is queued on b_cont. Otherwise (T_OPTDATA_IND or |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4761 |
* T_EXDATA_IND) it is queued on b_next. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4762 |
* XXX Make urgent data use this. Requires: |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4763 |
* Removing tcp_listener check for TH_URG |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4764 |
* Making M_PCPROTO and MARK messages skip the eager case |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4765 |
*/ |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4766 |
|
12644
4f9a0cd40c5f
6939100 convert KSSL into a socket filter
Anders Persson <Anders.Persson@Sun.COM>
parents:
12643
diff
changeset
|
4767 |
tcp_rcv_enqueue(tcp, mp, seg_len, ira->ira_cred); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4768 |
} else { |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4769 |
/* Active STREAMS socket */ |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4770 |
if (mp->b_datap->db_type != M_DATA || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4771 |
(flags & TH_MARKNEXT_NEEDED)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4772 |
if (tcp->tcp_rcv_list != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4773 |
flags |= tcp_rcv_drain(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4774 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4775 |
ASSERT(tcp->tcp_rcv_list == NULL || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4776 |
tcp->tcp_fused_sigurg); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4777 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4778 |
if (flags & TH_MARKNEXT_NEEDED) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4779 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4780 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4781 |
"tcp_rput: sending MSGMARKNEXT %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4782 |
tcp_display(tcp, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4783 |
DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4784 |
#endif /* DEBUG */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4785 |
mp->b_flag |= MSGMARKNEXT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4786 |
flags &= ~TH_MARKNEXT_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4787 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4788 |
|
12644
4f9a0cd40c5f
6939100 convert KSSL into a socket filter
Anders Persson <Anders.Persson@Sun.COM>
parents:
12643
diff
changeset
|
4789 |
if (is_system_labeled()) |
4f9a0cd40c5f
6939100 convert KSSL into a socket filter
Anders Persson <Anders.Persson@Sun.COM>
parents:
12643
diff
changeset
|
4790 |
tcp_setcred_data(mp, ira); |
4f9a0cd40c5f
6939100 convert KSSL into a socket filter
Anders Persson <Anders.Persson@Sun.COM>
parents:
12643
diff
changeset
|
4791 |
|
4f9a0cd40c5f
6939100 convert KSSL into a socket filter
Anders Persson <Anders.Persson@Sun.COM>
parents:
12643
diff
changeset
|
4792 |
putnext(connp->conn_rq, mp); |
4f9a0cd40c5f
6939100 convert KSSL into a socket filter
Anders Persson <Anders.Persson@Sun.COM>
parents:
12643
diff
changeset
|
4793 |
if (!canputnext(connp->conn_rq)) |
4f9a0cd40c5f
6939100 convert KSSL into a socket filter
Anders Persson <Anders.Persson@Sun.COM>
parents:
12643
diff
changeset
|
4794 |
tcp->tcp_rwnd -= seg_len; |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4795 |
} else if ((flags & (TH_PUSH|TH_FIN)) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4796 |
tcp->tcp_rcv_cnt + seg_len >= connp->conn_rcvbuf >> 3) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4797 |
if (tcp->tcp_rcv_list != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4798 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4799 |
* Enqueue the new segment first and then |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4800 |
* call tcp_rcv_drain() to send all data |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4801 |
* up. The other way to do this is to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4802 |
* send all queued data up and then call |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4803 |
* putnext() to send the new segment up. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4804 |
* This way can remove the else part later |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4805 |
* on. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4806 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4807 |
* We don't do this to avoid one more call to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4808 |
* canputnext() as tcp_rcv_drain() needs to |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4809 |
* call canputnext(). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4810 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4811 |
tcp_rcv_enqueue(tcp, mp, seg_len, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4812 |
ira->ira_cred); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4813 |
flags |= tcp_rcv_drain(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4814 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4815 |
if (is_system_labeled()) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4816 |
tcp_setcred_data(mp, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4817 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4818 |
putnext(connp->conn_rq, mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4819 |
if (!canputnext(connp->conn_rq)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4820 |
tcp->tcp_rwnd -= seg_len; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4821 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4822 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4823 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4824 |
* Enqueue all packets when processing an mblk |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4825 |
* from the co queue and also enqueue normal packets. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4826 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4827 |
tcp_rcv_enqueue(tcp, mp, seg_len, ira->ira_cred); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4828 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4829 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4830 |
* Make sure the timer is running if we have data waiting |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4831 |
* for a push bit. This provides resiliency against |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4832 |
* implementations that do not correctly generate push bits. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4833 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4834 |
if (tcp->tcp_rcv_list != NULL && tcp->tcp_push_tid == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4835 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4836 |
* The connection may be closed at this point, so don't |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4837 |
* do anything for a detached tcp. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4838 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4839 |
if (!TCP_IS_DETACHED(tcp)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4840 |
tcp->tcp_push_tid = TCP_TIMER(tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4841 |
tcp_push_timer, |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
4842 |
tcps->tcps_push_timer_interval); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4843 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4844 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4845 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4846 |
xmit_check: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4847 |
/* Is there anything left to do? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4848 |
ASSERT(!(flags & TH_MARKNEXT_NEEDED)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4849 |
if ((flags & (TH_REXMIT_NEEDED|TH_XMIT_NEEDED|TH_ACK_NEEDED| |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4850 |
TH_NEED_SACK_REXMIT|TH_LIMIT_XMIT|TH_ACK_TIMER_NEEDED| |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4851 |
TH_ORDREL_NEEDED|TH_SEND_URP_MARK)) == 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4852 |
goto done; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4853 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4854 |
/* Any transmit work to do and a non-zero window? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4855 |
if ((flags & (TH_REXMIT_NEEDED|TH_XMIT_NEEDED|TH_NEED_SACK_REXMIT| |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4856 |
TH_LIMIT_XMIT)) && tcp->tcp_swnd != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4857 |
if (flags & TH_REXMIT_NEEDED) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4858 |
uint32_t snd_size = tcp->tcp_snxt - tcp->tcp_suna; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4859 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4860 |
TCPS_BUMP_MIB(tcps, tcpOutFastRetrans); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4861 |
if (snd_size > mss) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4862 |
snd_size = mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4863 |
if (snd_size > tcp->tcp_swnd) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4864 |
snd_size = tcp->tcp_swnd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4865 |
mp1 = tcp_xmit_mp(tcp, tcp->tcp_xmit_head, snd_size, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4866 |
NULL, NULL, tcp->tcp_suna, B_TRUE, &snd_size, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4867 |
B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4868 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4869 |
if (mp1 != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4870 |
tcp->tcp_xmit_head->b_prev = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4871 |
(mblk_t *)LBOLT_FASTPATH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4872 |
tcp->tcp_csuna = tcp->tcp_snxt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4873 |
TCPS_BUMP_MIB(tcps, tcpRetransSegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4874 |
TCPS_UPDATE_MIB(tcps, tcpRetransBytes, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4875 |
snd_size); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4876 |
tcp_send_data(tcp, mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4877 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4878 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4879 |
if (flags & TH_NEED_SACK_REXMIT) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4880 |
tcp_sack_rexmit(tcp, &flags); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4881 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4882 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4883 |
* For TH_LIMIT_XMIT, tcp_wput_data() is called to send |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4884 |
* out new segment. Note that tcp_rexmit should not be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4885 |
* set, otherwise TH_LIMIT_XMIT should not be set. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4886 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4887 |
if (flags & (TH_XMIT_NEEDED|TH_LIMIT_XMIT)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4888 |
if (!tcp->tcp_rexmit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4889 |
tcp_wput_data(tcp, NULL, B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4890 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4891 |
tcp_ss_rexmit(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4892 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4893 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4894 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4895 |
* Adjust tcp_cwnd back to normal value after sending |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4896 |
* new data segments. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4897 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4898 |
if (flags & TH_LIMIT_XMIT) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4899 |
tcp->tcp_cwnd -= mss << (tcp->tcp_dupack_cnt - 1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4900 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4901 |
* This will restart the timer. Restarting the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4902 |
* timer is used to avoid a timeout before the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4903 |
* limited transmitted segment's ACK gets back. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4904 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4905 |
if (tcp->tcp_xmit_head != NULL) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4906 |
tcp->tcp_xmit_head->b_prev = |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4907 |
(mblk_t *)LBOLT_FASTPATH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4908 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4909 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4910 |
/* Anything more to do? */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4911 |
if ((flags & (TH_ACK_NEEDED|TH_ACK_TIMER_NEEDED| |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4912 |
TH_ORDREL_NEEDED|TH_SEND_URP_MARK)) == 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4913 |
goto done; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4914 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4915 |
ack_check: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4916 |
if (flags & TH_SEND_URP_MARK) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4917 |
ASSERT(tcp->tcp_urp_mark_mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4918 |
ASSERT(!IPCL_IS_NONSTR(connp)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4919 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4920 |
* Send up any queued data and then send the mark message |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4921 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4922 |
if (tcp->tcp_rcv_list != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4923 |
flags |= tcp_rcv_drain(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4924 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4925 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4926 |
ASSERT(tcp->tcp_rcv_list == NULL || tcp->tcp_fused_sigurg); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4927 |
mp1 = tcp->tcp_urp_mark_mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4928 |
tcp->tcp_urp_mark_mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4929 |
if (is_system_labeled()) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4930 |
tcp_setcred_data(mp1, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4931 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4932 |
putnext(connp->conn_rq, mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4933 |
#ifdef DEBUG |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4934 |
(void) strlog(TCP_MOD_ID, 0, 1, SL_TRACE, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4935 |
"tcp_rput: sending zero-length %s %s", |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4936 |
((mp1->b_flag & MSGMARKNEXT) ? "MSGMARKNEXT" : |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4937 |
"MSGNOTMARKNEXT"), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4938 |
tcp_display(tcp, NULL, DISP_PORT_ONLY)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4939 |
#endif /* DEBUG */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4940 |
flags &= ~TH_SEND_URP_MARK; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4941 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4942 |
if (flags & TH_ACK_NEEDED) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4943 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4944 |
* Time to send an ack for some reason. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4945 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4946 |
mp1 = tcp_ack_mp(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4947 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4948 |
if (mp1 != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4949 |
tcp_send_data(tcp, mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4950 |
BUMP_LOCAL(tcp->tcp_obsegs); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4951 |
TCPS_BUMP_MIB(tcps, tcpOutAck); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4952 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4953 |
if (tcp->tcp_ack_tid != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4954 |
(void) TCP_TIMER_CANCEL(tcp, tcp->tcp_ack_tid); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4955 |
tcp->tcp_ack_tid = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4956 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4957 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4958 |
if (flags & TH_ACK_TIMER_NEEDED) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4959 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4960 |
* Arrange for deferred ACK or push wait timeout. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4961 |
* Start timer if it is not already running. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4962 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4963 |
if (tcp->tcp_ack_tid == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4964 |
tcp->tcp_ack_tid = TCP_TIMER(tcp, tcp_ack_timer, |
12056
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
4965 |
tcp->tcp_localnet ? |
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
4966 |
tcps->tcps_local_dack_interval : |
4811a59c20b7
6935348 tcp_sack_info should always be there
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
11754
diff
changeset
|
4967 |
tcps->tcps_deferred_ack_interval); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4968 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4969 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4970 |
if (flags & TH_ORDREL_NEEDED) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4971 |
/* |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4972 |
* Notify upper layer about an orderly release. If this is |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4973 |
* a non-STREAMS socket, then just make an upcall. For STREAMS |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4974 |
* we send up an ordrel_ind, unless this is an eager, in which |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4975 |
* case the ordrel will be sent when tcp_accept_finish runs. |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4976 |
* Note that for non-STREAMS we make an upcall even if it is an |
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4977 |
* eager, because we have an upper handle to send it to. |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4978 |
*/ |
12643
044ff822d212
PSARC/2009/590 Socket Filter Framework
Anders Persson <Anders.Persson@Sun.COM>
parents:
12544
diff
changeset
|
4979 |
ASSERT(IPCL_IS_NONSTR(connp) || tcp->tcp_listener == NULL); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4980 |
ASSERT(!tcp->tcp_detached); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4981 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4982 |
if (IPCL_IS_NONSTR(connp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4983 |
ASSERT(tcp->tcp_ordrel_mp == NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4984 |
tcp->tcp_ordrel_done = B_TRUE; |
13494
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
4985 |
(*sockupcalls->su_opctl)(connp->conn_upper_handle, |
9dc2083cc403
1631 kernel panic in tcp_input_data
Dan McDonald <danmcd@nexenta.com>
parents:
13074
diff
changeset
|
4986 |
SOCK_OPCTL_SHUT_RECV, 0); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4987 |
goto done; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4988 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4989 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4990 |
if (tcp->tcp_rcv_list != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4991 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4992 |
* Push any mblk(s) enqueued from co processing. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4993 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4994 |
flags |= tcp_rcv_drain(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4995 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4996 |
ASSERT(tcp->tcp_rcv_list == NULL || tcp->tcp_fused_sigurg); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4997 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4998 |
mp1 = tcp->tcp_ordrel_mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
4999 |
tcp->tcp_ordrel_mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5000 |
tcp->tcp_ordrel_done = B_TRUE; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5001 |
putnext(connp->conn_rq, mp1); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5002 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5003 |
done: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5004 |
ASSERT(!(flags & TH_MARKNEXT_NEEDED)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5005 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5006 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5007 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5008 |
* Attach ancillary data to a received TCP segments for the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5009 |
* ancillary pieces requested by the application that are |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5010 |
* different than they were in the previous data segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5011 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5012 |
* Save the "current" values once memory allocation is ok so that |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5013 |
* when memory allocation fails we can just wait for the next data segment. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5014 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5015 |
static mblk_t * |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5016 |
tcp_input_add_ancillary(tcp_t *tcp, mblk_t *mp, ip_pkt_t *ipp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5017 |
ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5018 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5019 |
struct T_optdata_ind *todi; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5020 |
int optlen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5021 |
uchar_t *optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5022 |
struct T_opthdr *toh; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5023 |
crb_t addflag; /* Which pieces to add */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5024 |
mblk_t *mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5025 |
conn_t *connp = tcp->tcp_connp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5026 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5027 |
optlen = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5028 |
addflag.crb_all = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5029 |
/* If app asked for pktinfo and the index has changed ... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5030 |
if (connp->conn_recv_ancillary.crb_ip_recvpktinfo && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5031 |
ira->ira_ruifindex != tcp->tcp_recvifindex) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5032 |
optlen += sizeof (struct T_opthdr) + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5033 |
sizeof (struct in6_pktinfo); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5034 |
addflag.crb_ip_recvpktinfo = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5035 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5036 |
/* If app asked for hoplimit and it has changed ... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5037 |
if (connp->conn_recv_ancillary.crb_ipv6_recvhoplimit && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5038 |
ipp->ipp_hoplimit != tcp->tcp_recvhops) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5039 |
optlen += sizeof (struct T_opthdr) + sizeof (uint_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5040 |
addflag.crb_ipv6_recvhoplimit = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5041 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5042 |
/* If app asked for tclass and it has changed ... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5043 |
if (connp->conn_recv_ancillary.crb_ipv6_recvtclass && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5044 |
ipp->ipp_tclass != tcp->tcp_recvtclass) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5045 |
optlen += sizeof (struct T_opthdr) + sizeof (uint_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5046 |
addflag.crb_ipv6_recvtclass = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5047 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5048 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5049 |
* If app asked for hopbyhop headers and it has changed ... |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5050 |
* For security labels, note that (1) security labels can't change on |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5051 |
* a connected socket at all, (2) we're connected to at most one peer, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5052 |
* (3) if anything changes, then it must be some other extra option. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5053 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5054 |
if (connp->conn_recv_ancillary.crb_ipv6_recvhopopts && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5055 |
ip_cmpbuf(tcp->tcp_hopopts, tcp->tcp_hopoptslen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5056 |
(ipp->ipp_fields & IPPF_HOPOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5057 |
ipp->ipp_hopopts, ipp->ipp_hopoptslen)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5058 |
optlen += sizeof (struct T_opthdr) + ipp->ipp_hopoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5059 |
addflag.crb_ipv6_recvhopopts = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5060 |
if (!ip_allocbuf((void **)&tcp->tcp_hopopts, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5061 |
&tcp->tcp_hopoptslen, (ipp->ipp_fields & IPPF_HOPOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5062 |
ipp->ipp_hopopts, ipp->ipp_hopoptslen)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5063 |
return (mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5064 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5065 |
/* If app asked for dst headers before routing headers ... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5066 |
if (connp->conn_recv_ancillary.crb_ipv6_recvrthdrdstopts && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5067 |
ip_cmpbuf(tcp->tcp_rthdrdstopts, tcp->tcp_rthdrdstoptslen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5068 |
(ipp->ipp_fields & IPPF_RTHDRDSTOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5069 |
ipp->ipp_rthdrdstopts, ipp->ipp_rthdrdstoptslen)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5070 |
optlen += sizeof (struct T_opthdr) + |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5071 |
ipp->ipp_rthdrdstoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5072 |
addflag.crb_ipv6_recvrthdrdstopts = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5073 |
if (!ip_allocbuf((void **)&tcp->tcp_rthdrdstopts, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5074 |
&tcp->tcp_rthdrdstoptslen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5075 |
(ipp->ipp_fields & IPPF_RTHDRDSTOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5076 |
ipp->ipp_rthdrdstopts, ipp->ipp_rthdrdstoptslen)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5077 |
return (mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5078 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5079 |
/* If app asked for routing headers and it has changed ... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5080 |
if (connp->conn_recv_ancillary.crb_ipv6_recvrthdr && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5081 |
ip_cmpbuf(tcp->tcp_rthdr, tcp->tcp_rthdrlen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5082 |
(ipp->ipp_fields & IPPF_RTHDR), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5083 |
ipp->ipp_rthdr, ipp->ipp_rthdrlen)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5084 |
optlen += sizeof (struct T_opthdr) + ipp->ipp_rthdrlen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5085 |
addflag.crb_ipv6_recvrthdr = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5086 |
if (!ip_allocbuf((void **)&tcp->tcp_rthdr, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5087 |
&tcp->tcp_rthdrlen, (ipp->ipp_fields & IPPF_RTHDR), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5088 |
ipp->ipp_rthdr, ipp->ipp_rthdrlen)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5089 |
return (mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5090 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5091 |
/* If app asked for dest headers and it has changed ... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5092 |
if ((connp->conn_recv_ancillary.crb_ipv6_recvdstopts || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5093 |
connp->conn_recv_ancillary.crb_old_ipv6_recvdstopts) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5094 |
ip_cmpbuf(tcp->tcp_dstopts, tcp->tcp_dstoptslen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5095 |
(ipp->ipp_fields & IPPF_DSTOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5096 |
ipp->ipp_dstopts, ipp->ipp_dstoptslen)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5097 |
optlen += sizeof (struct T_opthdr) + ipp->ipp_dstoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5098 |
addflag.crb_ipv6_recvdstopts = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5099 |
if (!ip_allocbuf((void **)&tcp->tcp_dstopts, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5100 |
&tcp->tcp_dstoptslen, (ipp->ipp_fields & IPPF_DSTOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5101 |
ipp->ipp_dstopts, ipp->ipp_dstoptslen)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5102 |
return (mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5103 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5104 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5105 |
if (optlen == 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5106 |
/* Nothing to add */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5107 |
return (mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5108 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5109 |
mp1 = allocb(sizeof (struct T_optdata_ind) + optlen, BPRI_MED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5110 |
if (mp1 == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5111 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5112 |
* Defer sending ancillary data until the next TCP segment |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5113 |
* arrives. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5114 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5115 |
return (mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5116 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5117 |
mp1->b_cont = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5118 |
mp = mp1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5119 |
mp->b_wptr += sizeof (*todi) + optlen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5120 |
mp->b_datap->db_type = M_PROTO; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5121 |
todi = (struct T_optdata_ind *)mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5122 |
todi->PRIM_type = T_OPTDATA_IND; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5123 |
todi->DATA_flag = 1; /* MORE data */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5124 |
todi->OPT_length = optlen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5125 |
todi->OPT_offset = sizeof (*todi); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5126 |
optptr = (uchar_t *)&todi[1]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5127 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5128 |
* If app asked for pktinfo and the index has changed ... |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5129 |
* Note that the local address never changes for the connection. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5130 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5131 |
if (addflag.crb_ip_recvpktinfo) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5132 |
struct in6_pktinfo *pkti; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5133 |
uint_t ifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5134 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5135 |
ifindex = ira->ira_ruifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5136 |
toh = (struct T_opthdr *)optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5137 |
toh->level = IPPROTO_IPV6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5138 |
toh->name = IPV6_PKTINFO; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5139 |
toh->len = sizeof (*toh) + sizeof (*pkti); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5140 |
toh->status = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5141 |
optptr += sizeof (*toh); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5142 |
pkti = (struct in6_pktinfo *)optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5143 |
pkti->ipi6_addr = connp->conn_laddr_v6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5144 |
pkti->ipi6_ifindex = ifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5145 |
optptr += sizeof (*pkti); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5146 |
ASSERT(OK_32PTR(optptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5147 |
/* Save as "last" value */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5148 |
tcp->tcp_recvifindex = ifindex; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5149 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5150 |
/* If app asked for hoplimit and it has changed ... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5151 |
if (addflag.crb_ipv6_recvhoplimit) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5152 |
toh = (struct T_opthdr *)optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5153 |
toh->level = IPPROTO_IPV6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5154 |
toh->name = IPV6_HOPLIMIT; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5155 |
toh->len = sizeof (*toh) + sizeof (uint_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5156 |
toh->status = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5157 |
optptr += sizeof (*toh); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5158 |
*(uint_t *)optptr = ipp->ipp_hoplimit; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5159 |
optptr += sizeof (uint_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5160 |
ASSERT(OK_32PTR(optptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5161 |
/* Save as "last" value */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5162 |
tcp->tcp_recvhops = ipp->ipp_hoplimit; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5163 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5164 |
/* If app asked for tclass and it has changed ... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5165 |
if (addflag.crb_ipv6_recvtclass) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5166 |
toh = (struct T_opthdr *)optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5167 |
toh->level = IPPROTO_IPV6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5168 |
toh->name = IPV6_TCLASS; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5169 |
toh->len = sizeof (*toh) + sizeof (uint_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5170 |
toh->status = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5171 |
optptr += sizeof (*toh); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5172 |
*(uint_t *)optptr = ipp->ipp_tclass; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5173 |
optptr += sizeof (uint_t); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5174 |
ASSERT(OK_32PTR(optptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5175 |
/* Save as "last" value */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5176 |
tcp->tcp_recvtclass = ipp->ipp_tclass; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5177 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5178 |
if (addflag.crb_ipv6_recvhopopts) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5179 |
toh = (struct T_opthdr *)optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5180 |
toh->level = IPPROTO_IPV6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5181 |
toh->name = IPV6_HOPOPTS; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5182 |
toh->len = sizeof (*toh) + ipp->ipp_hopoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5183 |
toh->status = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5184 |
optptr += sizeof (*toh); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5185 |
bcopy((uchar_t *)ipp->ipp_hopopts, optptr, ipp->ipp_hopoptslen); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5186 |
optptr += ipp->ipp_hopoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5187 |
ASSERT(OK_32PTR(optptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5188 |
/* Save as last value */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5189 |
ip_savebuf((void **)&tcp->tcp_hopopts, &tcp->tcp_hopoptslen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5190 |
(ipp->ipp_fields & IPPF_HOPOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5191 |
ipp->ipp_hopopts, ipp->ipp_hopoptslen); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5192 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5193 |
if (addflag.crb_ipv6_recvrthdrdstopts) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5194 |
toh = (struct T_opthdr *)optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5195 |
toh->level = IPPROTO_IPV6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5196 |
toh->name = IPV6_RTHDRDSTOPTS; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5197 |
toh->len = sizeof (*toh) + ipp->ipp_rthdrdstoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5198 |
toh->status = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5199 |
optptr += sizeof (*toh); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5200 |
bcopy(ipp->ipp_rthdrdstopts, optptr, ipp->ipp_rthdrdstoptslen); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5201 |
optptr += ipp->ipp_rthdrdstoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5202 |
ASSERT(OK_32PTR(optptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5203 |
/* Save as last value */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5204 |
ip_savebuf((void **)&tcp->tcp_rthdrdstopts, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5205 |
&tcp->tcp_rthdrdstoptslen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5206 |
(ipp->ipp_fields & IPPF_RTHDRDSTOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5207 |
ipp->ipp_rthdrdstopts, ipp->ipp_rthdrdstoptslen); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5208 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5209 |
if (addflag.crb_ipv6_recvrthdr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5210 |
toh = (struct T_opthdr *)optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5211 |
toh->level = IPPROTO_IPV6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5212 |
toh->name = IPV6_RTHDR; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5213 |
toh->len = sizeof (*toh) + ipp->ipp_rthdrlen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5214 |
toh->status = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5215 |
optptr += sizeof (*toh); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5216 |
bcopy(ipp->ipp_rthdr, optptr, ipp->ipp_rthdrlen); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5217 |
optptr += ipp->ipp_rthdrlen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5218 |
ASSERT(OK_32PTR(optptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5219 |
/* Save as last value */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5220 |
ip_savebuf((void **)&tcp->tcp_rthdr, &tcp->tcp_rthdrlen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5221 |
(ipp->ipp_fields & IPPF_RTHDR), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5222 |
ipp->ipp_rthdr, ipp->ipp_rthdrlen); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5223 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5224 |
if (addflag.crb_ipv6_recvdstopts) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5225 |
toh = (struct T_opthdr *)optptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5226 |
toh->level = IPPROTO_IPV6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5227 |
toh->name = IPV6_DSTOPTS; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5228 |
toh->len = sizeof (*toh) + ipp->ipp_dstoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5229 |
toh->status = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5230 |
optptr += sizeof (*toh); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5231 |
bcopy(ipp->ipp_dstopts, optptr, ipp->ipp_dstoptslen); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5232 |
optptr += ipp->ipp_dstoptslen; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5233 |
ASSERT(OK_32PTR(optptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5234 |
/* Save as last value */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5235 |
ip_savebuf((void **)&tcp->tcp_dstopts, &tcp->tcp_dstoptslen, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5236 |
(ipp->ipp_fields & IPPF_DSTOPTS), |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5237 |
ipp->ipp_dstopts, ipp->ipp_dstoptslen); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5238 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5239 |
ASSERT(optptr == mp->b_wptr); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5240 |
return (mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5241 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5242 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5243 |
/* The minimum of smoothed mean deviation in RTO calculation. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5244 |
#define TCP_SD_MIN 400 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5245 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5246 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5247 |
* Set RTO for this connection. The formula is from Jacobson and Karels' |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5248 |
* "Congestion Avoidance and Control" in SIGCOMM '88. The variable names |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5249 |
* are the same as those in Appendix A.2 of that paper. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5250 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5251 |
* m = new measurement |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5252 |
* sa = smoothed RTT average (8 * average estimates). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5253 |
* sv = smoothed mean deviation (mdev) of RTT (4 * deviation estimates). |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5254 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5255 |
static void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5256 |
tcp_set_rto(tcp_t *tcp, clock_t rtt) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5257 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5258 |
long m = TICK_TO_MSEC(rtt); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5259 |
clock_t sa = tcp->tcp_rtt_sa; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5260 |
clock_t sv = tcp->tcp_rtt_sd; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5261 |
clock_t rto; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5262 |
tcp_stack_t *tcps = tcp->tcp_tcps; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5263 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5264 |
TCPS_BUMP_MIB(tcps, tcpRttUpdate); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5265 |
tcp->tcp_rtt_update++; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5266 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5267 |
/* tcp_rtt_sa is not 0 means this is a new sample. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5268 |
if (sa != 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5269 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5270 |
* Update average estimator: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5271 |
* new rtt = 7/8 old rtt + 1/8 Error |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5272 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5273 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5274 |
/* m is now Error in estimate. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5275 |
m -= sa >> 3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5276 |
if ((sa += m) <= 0) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5277 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5278 |
* Don't allow the smoothed average to be negative. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5279 |
* We use 0 to denote reinitialization of the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5280 |
* variables. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5281 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5282 |
sa = 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5283 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5284 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5285 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5286 |
* Update deviation estimator: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5287 |
* new mdev = 3/4 old mdev + 1/4 (abs(Error) - old mdev) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5288 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5289 |
if (m < 0) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5290 |
m = -m; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5291 |
m -= sv >> 2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5292 |
sv += m; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5293 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5294 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5295 |
* This follows BSD's implementation. So the reinitialized |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5296 |
* RTO is 3 * m. We cannot go less than 2 because if the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5297 |
* link is bandwidth dominated, doubling the window size |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5298 |
* during slow start means doubling the RTT. We want to be |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5299 |
* more conservative when we reinitialize our estimates. 3 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5300 |
* is just a convenient number. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5301 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5302 |
sa = m << 3; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5303 |
sv = m << 1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5304 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5305 |
if (sv < TCP_SD_MIN) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5306 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5307 |
* We do not know that if sa captures the delay ACK |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5308 |
* effect as in a long train of segments, a receiver |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5309 |
* does not delay its ACKs. So set the minimum of sv |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5310 |
* to be TCP_SD_MIN, which is default to 400 ms, twice |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5311 |
* of BSD DATO. That means the minimum of mean |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5312 |
* deviation is 100 ms. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5313 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5314 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5315 |
sv = TCP_SD_MIN; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5316 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5317 |
tcp->tcp_rtt_sa = sa; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5318 |
tcp->tcp_rtt_sd = sv; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5319 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5320 |
* RTO = average estimates (sa / 8) + 4 * deviation estimates (sv) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5321 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5322 |
* Add tcp_rexmit_interval extra in case of extreme environment |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5323 |
* where the algorithm fails to work. The default value of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5324 |
* tcp_rexmit_interval_extra should be 0. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5325 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5326 |
* As we use a finer grained clock than BSD and update |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5327 |
* RTO for every ACKs, add in another .25 of RTT to the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5328 |
* deviation of RTO to accomodate burstiness of 1/4 of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5329 |
* window size. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5330 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5331 |
rto = (sa >> 3) + sv + tcps->tcps_rexmit_interval_extra + (sa >> 5); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5332 |
|
12544
88a11088cbce
PSARC 2010/151 new socket options for TCP timers
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
12507
diff
changeset
|
5333 |
TCP_SET_RTO(tcp, rto); |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5334 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5335 |
/* Now, we can reset tcp_timer_backoff to use the new RTO... */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5336 |
tcp->tcp_timer_backoff = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5337 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5338 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5339 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5340 |
* On a labeled system we have some protocols above TCP, such as RPC, which |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5341 |
* appear to assume that every mblk in a chain has a db_credp. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5342 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5343 |
static void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5344 |
tcp_setcred_data(mblk_t *mp, ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5345 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5346 |
ASSERT(is_system_labeled()); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5347 |
ASSERT(ira->ira_cred != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5348 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5349 |
while (mp != NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5350 |
mblk_setcred(mp, ira->ira_cred, NOPID); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5351 |
mp = mp->b_cont; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5352 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5353 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5354 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5355 |
uint_t |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5356 |
tcp_rwnd_reopen(tcp_t *tcp) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5357 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5358 |
uint_t ret = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5359 |
uint_t thwin; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5360 |
conn_t *connp = tcp->tcp_connp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5361 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5362 |
/* Learn the latest rwnd information that we sent to the other side. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5363 |
thwin = ((uint_t)ntohs(tcp->tcp_tcpha->tha_win)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5364 |
<< tcp->tcp_rcv_ws; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5365 |
/* This is peer's calculated send window (our receive window). */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5366 |
thwin -= tcp->tcp_rnxt - tcp->tcp_rack; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5367 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5368 |
* Increase the receive window to max. But we need to do receiver |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5369 |
* SWS avoidance. This means that we need to check the increase of |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5370 |
* of receive window is at least 1 MSS. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5371 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5372 |
if (connp->conn_rcvbuf - thwin >= tcp->tcp_mss) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5373 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5374 |
* If the window that the other side knows is less than max |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5375 |
* deferred acks segments, send an update immediately. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5376 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5377 |
if (thwin < tcp->tcp_rack_cur_max * tcp->tcp_mss) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5378 |
TCPS_BUMP_MIB(tcp->tcp_tcps, tcpOutWinUpdate); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5379 |
ret = TH_ACK_NEEDED; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5380 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5381 |
tcp->tcp_rwnd = connp->conn_rcvbuf; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5382 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5383 |
return (ret); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5384 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5385 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5386 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5387 |
* Handle a packet that has been reclassified by TCP. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5388 |
* This function drops the ref on connp that the caller had. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5389 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5390 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5391 |
tcp_reinput(conn_t *connp, mblk_t *mp, ip_recv_attr_t *ira, ip_stack_t *ipst) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5392 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5393 |
ipsec_stack_t *ipss = ipst->ips_netstack->netstack_ipsec; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5394 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5395 |
if (connp->conn_incoming_ifindex != 0 && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5396 |
connp->conn_incoming_ifindex != ira->ira_ruifindex) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5397 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5398 |
CONN_DEC_REF(connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5399 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5400 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5401 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5402 |
if (CONN_INBOUND_POLICY_PRESENT_V6(connp, ipss) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5403 |
(ira->ira_flags & IRAF_IPSEC_SECURE)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5404 |
ip6_t *ip6h; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5405 |
ipha_t *ipha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5406 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5407 |
if (ira->ira_flags & IRAF_IS_IPV4) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5408 |
ipha = (ipha_t *)mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5409 |
ip6h = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5410 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5411 |
ipha = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5412 |
ip6h = (ip6_t *)mp->b_rptr; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5413 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5414 |
mp = ipsec_check_inbound_policy(mp, connp, ipha, ip6h, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5415 |
if (mp == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5416 |
BUMP_MIB(&ipst->ips_ip_mib, ipIfStatsInDiscards); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5417 |
/* Note that mp is NULL */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5418 |
ip_drop_input("ipIfStatsInDiscards", mp, NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5419 |
CONN_DEC_REF(connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5420 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5421 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5422 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5423 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5424 |
if (IPCL_IS_TCP(connp)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5425 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5426 |
* do not drain, certain use cases can blow |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5427 |
* the stack |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5428 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5429 |
SQUEUE_ENTER_ONE(connp->conn_sqp, mp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5430 |
connp->conn_recv, connp, ira, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5431 |
SQ_NODRAIN, SQTAG_IP_TCP_INPUT); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5432 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5433 |
/* Not TCP; must be SOCK_RAW, IPPROTO_TCP */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5434 |
(connp->conn_recv)(connp, mp, NULL, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5435 |
ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5436 |
CONN_DEC_REF(connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5437 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5438 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5439 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5440 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5441 |
/* ARGSUSED */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5442 |
static void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5443 |
tcp_rsrv_input(void *arg, mblk_t *mp, void *arg2, ip_recv_attr_t *dummy) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5444 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5445 |
conn_t *connp = (conn_t *)arg; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5446 |
tcp_t *tcp = connp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5447 |
queue_t *q = connp->conn_rq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5448 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5449 |
ASSERT(!IPCL_IS_NONSTR(connp)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5450 |
mutex_enter(&tcp->tcp_rsrv_mp_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5451 |
tcp->tcp_rsrv_mp = mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5452 |
mutex_exit(&tcp->tcp_rsrv_mp_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5453 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5454 |
if (TCP_IS_DETACHED(tcp) || q == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5455 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5456 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5457 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5458 |
if (tcp->tcp_fused) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5459 |
tcp_fuse_backenable(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5460 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5461 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5462 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5463 |
if (canputnext(q)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5464 |
/* Not flow-controlled, open rwnd */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5465 |
tcp->tcp_rwnd = connp->conn_rcvbuf; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5466 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5467 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5468 |
* Send back a window update immediately if TCP is above |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5469 |
* ESTABLISHED state and the increase of the rcv window |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5470 |
* that the other side knows is at least 1 MSS after flow |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5471 |
* control is lifted. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5472 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5473 |
if (tcp->tcp_state >= TCPS_ESTABLISHED && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5474 |
tcp_rwnd_reopen(tcp) == TH_ACK_NEEDED) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5475 |
tcp_xmit_ctl(NULL, tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5476 |
(tcp->tcp_swnd == 0) ? tcp->tcp_suna : |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5477 |
tcp->tcp_snxt, tcp->tcp_rnxt, TH_ACK); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5478 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5479 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5480 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5481 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5482 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5483 |
* The read side service routine is called mostly when we get back-enabled as a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5484 |
* result of flow control relief. Since we don't actually queue anything in |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5485 |
* TCP, we have no data to send out of here. What we do is clear the receive |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5486 |
* window, and send out a window update. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5487 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5488 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5489 |
tcp_rsrv(queue_t *q) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5490 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5491 |
conn_t *connp = Q_TO_CONN(q); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5492 |
tcp_t *tcp = connp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5493 |
mblk_t *mp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5494 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5495 |
/* No code does a putq on the read side */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5496 |
ASSERT(q->q_first == NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5497 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5498 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5499 |
* If tcp->tcp_rsrv_mp == NULL, it means that tcp_rsrv() has already |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5500 |
* been run. So just return. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5501 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5502 |
mutex_enter(&tcp->tcp_rsrv_mp_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5503 |
if ((mp = tcp->tcp_rsrv_mp) == NULL) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5504 |
mutex_exit(&tcp->tcp_rsrv_mp_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5505 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5506 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5507 |
tcp->tcp_rsrv_mp = NULL; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5508 |
mutex_exit(&tcp->tcp_rsrv_mp_lock); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5509 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5510 |
CONN_INC_REF(connp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5511 |
SQUEUE_ENTER_ONE(connp->conn_sqp, mp, tcp_rsrv_input, connp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5512 |
NULL, SQ_PROCESS, SQTAG_TCP_RSRV); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5513 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5514 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5515 |
/* At minimum we need 8 bytes in the TCP header for the lookup */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5516 |
#define ICMP_MIN_TCP_HDR 8 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5517 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5518 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5519 |
* tcp_icmp_input is called as conn_recvicmp to process ICMP error messages |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5520 |
* passed up by IP. The message is always received on the correct tcp_t. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5521 |
* Assumes that IP has pulled up everything up to and including the ICMP header. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5522 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5523 |
/* ARGSUSED2 */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5524 |
void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5525 |
tcp_icmp_input(void *arg1, mblk_t *mp, void *arg2, ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5526 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5527 |
conn_t *connp = (conn_t *)arg1; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5528 |
icmph_t *icmph; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5529 |
ipha_t *ipha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5530 |
int iph_hdr_length; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5531 |
tcpha_t *tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5532 |
uint32_t seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5533 |
tcp_t *tcp = connp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5534 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5535 |
/* Assume IP provides aligned packets */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5536 |
ASSERT(OK_32PTR(mp->b_rptr)); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5537 |
ASSERT((MBLKL(mp) >= sizeof (ipha_t))); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5538 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5539 |
/* |
13496
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5540 |
* It's possible we have a closed, but not yet destroyed, TCP |
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5541 |
* connection. Several fields (e.g. conn_ixa->ixa_ire) are invalid |
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5542 |
* in the closed state, so don't take any chances and drop the packet. |
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5543 |
*/ |
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5544 |
if (tcp->tcp_state == TCPS_CLOSED) { |
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5545 |
freemsg(mp); |
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5546 |
return; |
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5547 |
} |
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5548 |
|
732144cfe2ef
1695 tcp_icmp_input sends packets with a closed connection
Robert Mustacchi <rm@joyent.com>
parents:
13494
diff
changeset
|
5549 |
/* |
11754
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5550 |
* Verify IP version. Anything other than IPv4 or IPv6 packet is sent |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5551 |
* upstream. ICMPv6 is handled in tcp_icmp_error_ipv6. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5552 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5553 |
if (!(ira->ira_flags & IRAF_IS_IPV4)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5554 |
tcp_icmp_error_ipv6(tcp, mp, ira); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5555 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5556 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5557 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5558 |
/* Skip past the outer IP and ICMP headers */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5559 |
iph_hdr_length = ira->ira_ip_hdr_length; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5560 |
icmph = (icmph_t *)&mp->b_rptr[iph_hdr_length]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5561 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5562 |
* If we don't have the correct outer IP header length |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5563 |
* or if we don't have a complete inner IP header |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5564 |
* drop it. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5565 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5566 |
if (iph_hdr_length < sizeof (ipha_t) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5567 |
(ipha_t *)&icmph[1] + 1 > (ipha_t *)mp->b_wptr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5568 |
noticmpv4: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5569 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5570 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5571 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5572 |
ipha = (ipha_t *)&icmph[1]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5573 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5574 |
/* Skip past the inner IP and find the ULP header */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5575 |
iph_hdr_length = IPH_HDR_LENGTH(ipha); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5576 |
tcpha = (tcpha_t *)((char *)ipha + iph_hdr_length); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5577 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5578 |
* If we don't have the correct inner IP header length or if the ULP |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5579 |
* is not IPPROTO_TCP or if we don't have at least ICMP_MIN_TCP_HDR |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5580 |
* bytes of TCP header, drop it. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5581 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5582 |
if (iph_hdr_length < sizeof (ipha_t) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5583 |
ipha->ipha_protocol != IPPROTO_TCP || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5584 |
(uchar_t *)tcpha + ICMP_MIN_TCP_HDR > mp->b_wptr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5585 |
goto noticmpv4; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5586 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5587 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5588 |
seg_seq = ntohl(tcpha->tha_seq); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5589 |
switch (icmph->icmph_type) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5590 |
case ICMP_DEST_UNREACHABLE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5591 |
switch (icmph->icmph_code) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5592 |
case ICMP_FRAGMENTATION_NEEDED: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5593 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5594 |
* Update Path MTU, then try to send something out. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5595 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5596 |
tcp_update_pmtu(tcp, B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5597 |
tcp_rexmit_after_error(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5598 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5599 |
case ICMP_PORT_UNREACHABLE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5600 |
case ICMP_PROTOCOL_UNREACHABLE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5601 |
switch (tcp->tcp_state) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5602 |
case TCPS_SYN_SENT: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5603 |
case TCPS_SYN_RCVD: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5604 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5605 |
* ICMP can snipe away incipient |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5606 |
* TCP connections as long as |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5607 |
* seq number is same as initial |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5608 |
* send seq number. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5609 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5610 |
if (seg_seq == tcp->tcp_iss) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5611 |
(void) tcp_clean_death(tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5612 |
ECONNREFUSED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5613 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5614 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5615 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5616 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5617 |
case ICMP_HOST_UNREACHABLE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5618 |
case ICMP_NET_UNREACHABLE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5619 |
/* Record the error in case we finally time out. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5620 |
if (icmph->icmph_code == ICMP_HOST_UNREACHABLE) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5621 |
tcp->tcp_client_errno = EHOSTUNREACH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5622 |
else |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5623 |
tcp->tcp_client_errno = ENETUNREACH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5624 |
if (tcp->tcp_state == TCPS_SYN_RCVD) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5625 |
if (tcp->tcp_listener != NULL && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5626 |
tcp->tcp_listener->tcp_syn_defense) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5627 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5628 |
* Ditch the half-open connection if we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5629 |
* suspect a SYN attack is under way. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5630 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5631 |
(void) tcp_clean_death(tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5632 |
tcp->tcp_client_errno); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5633 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5634 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5635 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5636 |
default: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5637 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5638 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5639 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5640 |
case ICMP_SOURCE_QUENCH: { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5641 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5642 |
* use a global boolean to control |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5643 |
* whether TCP should respond to ICMP_SOURCE_QUENCH. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5644 |
* The default is false. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5645 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5646 |
if (tcp_icmp_source_quench) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5647 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5648 |
* Reduce the sending rate as if we got a |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5649 |
* retransmit timeout |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5650 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5651 |
uint32_t npkt; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5652 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5653 |
npkt = ((tcp->tcp_snxt - tcp->tcp_suna) >> 1) / |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5654 |
tcp->tcp_mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5655 |
tcp->tcp_cwnd_ssthresh = MAX(npkt, 2) * tcp->tcp_mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5656 |
tcp->tcp_cwnd = tcp->tcp_mss; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5657 |
tcp->tcp_cwnd_cnt = 0; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5658 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5659 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5660 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5661 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5662 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5663 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5664 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5665 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5666 |
* tcp_icmp_error_ipv6 is called from tcp_icmp_input to process ICMPv6 |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5667 |
* error messages passed up by IP. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5668 |
* Assumes that IP has pulled up all the extension headers as well |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5669 |
* as the ICMPv6 header. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5670 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5671 |
static void |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5672 |
tcp_icmp_error_ipv6(tcp_t *tcp, mblk_t *mp, ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5673 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5674 |
icmp6_t *icmp6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5675 |
ip6_t *ip6h; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5676 |
uint16_t iph_hdr_length = ira->ira_ip_hdr_length; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5677 |
tcpha_t *tcpha; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5678 |
uint8_t *nexthdrp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5679 |
uint32_t seg_seq; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5680 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5681 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5682 |
* Verify that we have a complete IP header. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5683 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5684 |
ASSERT((MBLKL(mp) >= sizeof (ip6_t))); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5685 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5686 |
icmp6 = (icmp6_t *)&mp->b_rptr[iph_hdr_length]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5687 |
ip6h = (ip6_t *)&icmp6[1]; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5688 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5689 |
* Verify if we have a complete ICMP and inner IP header. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5690 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5691 |
if ((uchar_t *)&ip6h[1] > mp->b_wptr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5692 |
noticmpv6: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5693 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5694 |
return; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5695 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5696 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5697 |
if (!ip_hdr_length_nexthdr_v6(mp, ip6h, &iph_hdr_length, &nexthdrp)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5698 |
goto noticmpv6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5699 |
tcpha = (tcpha_t *)((char *)ip6h + iph_hdr_length); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5700 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5701 |
* Validate inner header. If the ULP is not IPPROTO_TCP or if we don't |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5702 |
* have at least ICMP_MIN_TCP_HDR bytes of TCP header drop the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5703 |
* packet. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5704 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5705 |
if ((*nexthdrp != IPPROTO_TCP) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5706 |
((uchar_t *)tcpha + ICMP_MIN_TCP_HDR) > mp->b_wptr) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5707 |
goto noticmpv6; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5708 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5709 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5710 |
seg_seq = ntohl(tcpha->tha_seq); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5711 |
switch (icmp6->icmp6_type) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5712 |
case ICMP6_PACKET_TOO_BIG: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5713 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5714 |
* Update Path MTU, then try to send something out. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5715 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5716 |
tcp_update_pmtu(tcp, B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5717 |
tcp_rexmit_after_error(tcp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5718 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5719 |
case ICMP6_DST_UNREACH: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5720 |
switch (icmp6->icmp6_code) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5721 |
case ICMP6_DST_UNREACH_NOPORT: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5722 |
if (((tcp->tcp_state == TCPS_SYN_SENT) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5723 |
(tcp->tcp_state == TCPS_SYN_RCVD)) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5724 |
(seg_seq == tcp->tcp_iss)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5725 |
(void) tcp_clean_death(tcp, ECONNREFUSED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5726 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5727 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5728 |
case ICMP6_DST_UNREACH_ADMIN: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5729 |
case ICMP6_DST_UNREACH_NOROUTE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5730 |
case ICMP6_DST_UNREACH_BEYONDSCOPE: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5731 |
case ICMP6_DST_UNREACH_ADDR: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5732 |
/* Record the error in case we finally time out. */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5733 |
tcp->tcp_client_errno = EHOSTUNREACH; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5734 |
if (((tcp->tcp_state == TCPS_SYN_SENT) || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5735 |
(tcp->tcp_state == TCPS_SYN_RCVD)) && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5736 |
(seg_seq == tcp->tcp_iss)) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5737 |
if (tcp->tcp_listener != NULL && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5738 |
tcp->tcp_listener->tcp_syn_defense) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5739 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5740 |
* Ditch the half-open connection if we |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5741 |
* suspect a SYN attack is under way. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5742 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5743 |
(void) tcp_clean_death(tcp, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5744 |
tcp->tcp_client_errno); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5745 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5746 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5747 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5748 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5749 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5750 |
default: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5751 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5752 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5753 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5754 |
case ICMP6_PARAM_PROB: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5755 |
/* If this corresponds to an ICMP_PROTOCOL_UNREACHABLE */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5756 |
if (icmp6->icmp6_code == ICMP6_PARAMPROB_NEXTHEADER && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5757 |
(uchar_t *)ip6h + icmp6->icmp6_pptr == |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5758 |
(uchar_t *)nexthdrp) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5759 |
if (tcp->tcp_state == TCPS_SYN_SENT || |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5760 |
tcp->tcp_state == TCPS_SYN_RCVD) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5761 |
(void) tcp_clean_death(tcp, ECONNREFUSED); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5762 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5763 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5764 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5765 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5766 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5767 |
case ICMP6_TIME_EXCEEDED: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5768 |
default: |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5769 |
break; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5770 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5771 |
freemsg(mp); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5772 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5773 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5774 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5775 |
* CALLED OUTSIDE OF SQUEUE! It can not follow any pointers that tcp might |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5776 |
* change. But it can refer to fields like tcp_suna and tcp_snxt. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5777 |
* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5778 |
* Function tcp_verifyicmp is called as conn_verifyicmp to verify the ICMP |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5779 |
* error messages received by IP. The message is always received on the correct |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5780 |
* tcp_t. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5781 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5782 |
/* ARGSUSED */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5783 |
boolean_t |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5784 |
tcp_verifyicmp(conn_t *connp, void *arg2, icmph_t *icmph, icmp6_t *icmp6, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5785 |
ip_recv_attr_t *ira) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5786 |
{ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5787 |
tcpha_t *tcpha = (tcpha_t *)arg2; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5788 |
uint32_t seq = ntohl(tcpha->tha_seq); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5789 |
tcp_t *tcp = connp->conn_tcp; |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5790 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5791 |
/* |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5792 |
* TCP sequence number contained in payload of the ICMP error message |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5793 |
* should be within the range SND.UNA <= SEG.SEQ < SND.NXT. Otherwise, |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5794 |
* the message is either a stale ICMP error, or an attack from the |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5795 |
* network. Fail the verification. |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5796 |
*/ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5797 |
if (SEQ_LT(seq, tcp->tcp_suna) || SEQ_GEQ(seq, tcp->tcp_snxt)) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5798 |
return (B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5799 |
|
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5800 |
/* For "too big" we also check the ignore flag */ |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5801 |
if (ira->ira_flags & IRAF_IS_IPV4) { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5802 |
ASSERT(icmph != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5803 |
if (icmph->icmph_type == ICMP_DEST_UNREACHABLE && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5804 |
icmph->icmph_code == ICMP_FRAGMENTATION_NEEDED && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5805 |
tcp->tcp_tcps->tcps_ignore_path_mtu) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5806 |
return (B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5807 |
} else { |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5808 |
ASSERT(icmp6 != NULL); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5809 |
if (icmp6->icmp6_type == ICMP6_PACKET_TOO_BIG && |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5810 |
tcp->tcp_tcps->tcps_ignore_path_mtu) |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5811 |
return (B_FALSE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5812 |
} |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5813 |
return (B_TRUE); |
251da8f4caaa
PSARC 2010/042 increase max TCP_INIT_CWND
Kacheong Poon <Kacheong.Poon@Sun.COM>
parents:
diff
changeset
|
5814 |
} |