PERFORCE change 194756 for review
Catalin Nicutar
cnicutar at FreeBSD.org
Tue Jun 14 17:25:21 UTC 2011
http://p4web.freebsd.org/@@194756?ac=10
Change 194756 by cnicutar at cnicutar_cronos on 2011/06/14 17:24:19
Add the TCP_SNDUTO_TIMEOUT and TCP_RCVUTO_TIMEOUT user-settable
options.
Affected files ...
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp.h#3 edit
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_usrreq.c#2 edit
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_var.h#2 edit
Differences ...
==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp.h#3 (text+ko) ====
@@ -96,6 +96,8 @@
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */
#define TCPOLEN_SIGNATURE 18
+#define TCPOPT_UTO 28
+#define TCPOLEN_UTO 4
/* Miscellaneous constants */
#define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */
@@ -151,14 +153,16 @@
/*
* User-settable options (used with setsockopt).
*/
-#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
+#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
#if __BSD_VISIBLE
-#define TCP_MAXSEG 0x02 /* set maximum segment size */
-#define TCP_NOPUSH 0x04 /* don't push last block of write */
-#define TCP_NOOPT 0x08 /* don't use TCP options */
-#define TCP_MD5SIG 0x10 /* use MD5 digests (RFC2385) */
-#define TCP_INFO 0x20 /* retrieve tcp_info structure */
-#define TCP_CONGESTION 0x40 /* get/set congestion control algorithm */
+#define TCP_MAXSEG 0x02 /* set maximum segment size */
+#define TCP_NOPUSH 0x04 /* don't push last block of write */
+#define TCP_NOOPT 0x08 /* don't use TCP options */
+#define TCP_MD5SIG 0x10 /* use MD5 digests (RFC2385) */
+#define TCP_INFO 0x20 /* retrieve tcp_info structure */
+#define TCP_CONGESTION 0x40 /* get/set congestion control algorithm */
+#define TCP_SNDUTO_TIMEOUT 0x80 /* get/set sent UTO value */
+#define TCP_RCVUTO_TIMEOUT 0x100 /* accept UTO suggestion */
#define TCP_CA_NAME_MAX 16 /* max congestion control name length */
==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_usrreq.c#2 (text+ko) ====
@@ -1296,6 +1296,52 @@
INP_WUNLOCK(inp);
break;
#endif /* TCP_SIGNATURE */
+ case TCP_SNDUTO_TIMEOUT:
+ INP_WUNLOCK(inp);
+ error = sooptcopyin(sopt, &optval, sizeof optval,
+ sizeof optval);
+ if (error)
+ return (error);
+
+ INP_WLOCK_RECHECK(inp);
+ if (optval == 0) {
+ /* disable sending the option */
+ tp->t_flags &= ~TF_SND_UTO;
+ tp->snd_uto = 0;
+ }
+ else if (optval >= V_uto_min_timeout &&
+ optval <= V_uto_max_timeout) {
+ /* acceptable timeout */
+ /*
+ * TODO set granularity
+ */
+ tp->t_flags |= TF_SND_UTO;
+ tp->snd_uto = optval;
+ }
+ else {
+ error = EINVAL;
+ }
+ INP_WUNLOCK(inp);
+ break;
+
+ case TCP_RCVUTO_TIMEOUT:
+ INP_WUNLOCK(inp);
+ error = sooptcopyin(sopt, &optval, sizeof optval,
+ sizeof optval);
+ if (error)
+ return (error);
+
+ INP_WLOCK_RECHECK(inp);
+ if (optval <= 0) {
+ /* this connection will disregard suggestions */
+ tp->t_flags &= ~TF_RCV_UTO;
+ }
+ else {
+ tp->t_flags |= TF_RCV_UTO;
+ }
+ INP_WUNLOCK(inp);
+ break;
+
case TCP_NODELAY:
case TCP_NOOPT:
INP_WUNLOCK(inp);
@@ -1381,6 +1427,16 @@
break;
#endif
+ case TCP_SNDUTO_TIMEOUT:
+ optval = tp->snd_uto;
+ INP_WUNLOCK(inp);
+ error = sooptcopyout(sopt, &optval, sizeof optval);
+ break;
+ case TCP_RCVUTO_TIMEOUT:
+ optval = tp->rcv_uto;
+ INP_WUNLOCK(inp);
+ error = sooptcopyout(sopt, &optval, sizeof optval);
+ break;
case TCP_NODELAY:
optval = tp->t_flags & TF_NODELAY;
INP_WUNLOCK(inp);
==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_var.h#2 (text+ko) ====
@@ -198,8 +198,11 @@
int t_sndzerowin; /* zero-window updates sent */
+ uint32_t snd_uto; /* sent timeout */
+ uint32_t rcv_uto; /* received suggestion from peer */
+
void *t_pspare2[6]; /* 2 CC / 4 TBD */
- uint64_t _pad[10]; /* 7 UTO, 3 TBD (1-2 CC/RTT?) */
+ uint64_t _pad[9]; /* 6 UTO, 3 TBD (1-2 CC/RTT?) */
uint64_t t_sndrexmitpack;/* retransmit packets sent */
uint64_t t_rcvoopack; /* out-of-order packets received */
@@ -234,6 +237,8 @@
#define TF_ECN_PERMIT 0x4000000 /* connection ECN-ready */
#define TF_ECN_SND_CWR 0x8000000 /* ECN CWR in queue */
#define TF_ECN_SND_ECE 0x10000000 /* ECN ECE in queue */
+#define TF_SND_UTO 0x20000000 /* send UTO option */
+#define TF_RCV_UTO 0x40000000 /* accept UTO suggestions */
#define IN_FASTRECOVERY(tp) (tp->t_flags & TF_FASTRECOVERY)
#define ENTER_FASTRECOVERY(tp) tp->t_flags |= TF_FASTRECOVERY
@@ -276,7 +281,8 @@
#define TOF_TS 0x0010 /* timestamp */
#define TOF_SIGNATURE 0x0040 /* TCP-MD5 signature option (RFC2385) */
#define TOF_SACK 0x0080 /* Peer sent SACK option */
-#define TOF_MAXOPT 0x0100
+#define TOF_UTO 0x0100 /* user timeout option */
+#define TOF_MAXOPT 0x0200
u_int32_t to_tsval; /* new timestamp */
u_int32_t to_tsecr; /* reflected timestamp */
u_char *to_sacks; /* pointer to the first SACK blocks */
@@ -284,6 +290,7 @@
u_int16_t to_mss; /* maximum segment size */
u_int8_t to_wscale; /* window scaling */
u_int8_t to_nsacks; /* number of SACK blocks */
+ u_int16_t to_uto; /* sent user timeout */
};
/*
@@ -568,6 +575,11 @@
VNET_DECLARE(int, path_mtu_discovery);
VNET_DECLARE(int, ss_fltsz);
VNET_DECLARE(int, ss_fltsz_local);
+VNET_DECLARE(int, uto_min_timeout);
+VNET_DECLARE(int, uto_max_timeout);
+VNET_DECLARE(int, uto_def_timeout);
+
+
#define V_tcb VNET(tcb)
#define V_tcbinfo VNET(tcbinfo)
#define V_tcpstat VNET(tcpstat)
@@ -579,6 +591,9 @@
#define V_path_mtu_discovery VNET(path_mtu_discovery)
#define V_ss_fltsz VNET(ss_fltsz)
#define V_ss_fltsz_local VNET(ss_fltsz_local)
+#define V_uto_min_timeout VNET(uto_min_timeout)
+#define V_uto_max_timeout VNET(uto_max_timeout)
+#define V_uto_def_timeout VNET(uto_def_timeout)
VNET_DECLARE(int, tcp_do_sack); /* SACK enabled/disabled */
VNET_DECLARE(int, tcp_sc_rst_sock_fail); /* RST on sock alloc failure */
More information about the p4-projects
mailing list