PERFORCE change 163503 for review
Fang Wang
fangwang at FreeBSD.org
Thu Jun 4 17:43:13 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=163503
Change 163503 by fangwang at fangwang_utobsd on 2009/06/04 17:42:55
Add uto support in tcp_syncache.c.
Fix stupid mistake in tcp_addoptions, forget kind and length field in uto option.
Modify some uto relative variables in tcpcb.
Affected files ...
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_output.c#3 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_syncache.c#2 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#6 edit
Differences ...
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_output.c#3 (text+ko) ====
@@ -1325,6 +1325,10 @@
* At minimum we need 10 bytes (to generate 1 SACK block). If both
* TCP Timestamps (12 bytes) and TCP Signatures (18 bytes) are present,
* we only have 10 bytes for SACK options (40 - (12 + 18)).
+ *
+ * There is a new tcp option UTO (user timeout, defined in RFC 5482), the
+ * UTO option is a optional option. So we attach the UTO option only when
+ * there are enough free space in the TCP header.
*/
int
tcp_addoptions(struct tcpopt *to, u_char *optp)
@@ -1445,7 +1449,9 @@
unsigned short uto_load = (unsigned short)to->to_granularity;
uto_load += to->to_uto;
if (TCP_MAXOLEN - optlen < TCPOLEN_UTO)
- continue;
+ continue;
+ *optp++ = TCPOPT_UTO;
+ *optp++ = TCPOLEN_UTO;
optlen += TCPOLEN_UTO;
bcopy((u_char *)&uto_load, optp, sizeof(uto_load));
optp += sizeof(uto_load);
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_syncache.c#2 (text+ko) ====
@@ -772,6 +772,11 @@
#endif
if (sc->sc_flags & SCF_SACK)
tp->t_flags |= TF_SACK_PERMIT;
+ if (sc->sc_flags & SCF_UTO) {
+ tp->t_flags |= TF_RCVD_UTO;
+ tp->rcv_uto_granularity = sc->sc_granularity;
+ tp->rcv_uto = sc->sc_uto;
+ }
}
if (sc->sc_flags & SCF_ECN)
@@ -1209,6 +1214,11 @@
sc->sc_flags |= SCF_NOOPT;
if ((th->th_flags & (TH_ECE|TH_CWR)) && V_tcp_do_ecn)
sc->sc_flags |= SCF_ECN;
+ if (to->to_flags & TOF_UTO) {
+ sc->sc_granularity = to->to_granularity;
+ sc->sc_uto = to->to_uto;
+ sc->sc_flags |= SCF_UTO;
+ }
if (V_tcp_syncookies) {
syncookie_generate(sch, sc, &flowtmp);
@@ -1376,6 +1386,12 @@
if (sc->sc_flags & SCF_SIGNATURE)
to.to_flags |= TOF_SIGNATURE;
#endif
+ if (sc->sc_flags & SCF_UTO) {
+ to.to_granularity = sc->sc_granularity;
+ to.to_uto = sc->sc_uto;
+ to.to_flags |= TOF_UTO;
+ }
+
optlen = tcp_addoptions(&to, (u_char *)(th + 1));
/* Adjust headers by option size. */
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#6 (text+ko) ====
@@ -192,14 +192,14 @@
int t_bytes_acked; /* # bytes acked during current RTT */
/* user timeout variables (RFC 5482) */
- u_int t_rcvuto; /* received user timeout value */
- u_int t_snduto; /* send user timeout value */
- u_char rcv_uto_granularity:1; /* received user timeout granularity */
- u_char snd_uto_granularity:1; /* received user timeout granularity */
- u_char uto_enable:1; /* flag controls whether the UTO option is enabled for a connection */
- u_char uto_changeable:1; /* flag that controls whether USER_TIMEOUT may be changed based on t_rcvuto */
- u_char uto_impl:1; /* flag that controls whelther implement user timeout */
- u_int t_uto; /* implemented user timeout value */
+ u_int rcv_uto; /* received user timeout value, in seconds */
+ u_int snd_uto; /* send user timeout value, in seconds */
+ u_char rcv_uto_granularity:1; /* received user timeout granularity */
+ u_char snd_uto_granularity:1; /* received user timeout granularity */
+ u_char uto_enable:1; /* flag controls whether the UTO option is enabled for a connection */
+ u_char uto_changeable:1; /* flag that controls whether USER_TIMEOUT may be changed based on t_rcvuto */
+ u_char uto_impl:1; /* flag that controls whelther implement user timeout */
+ u_int t_impl_uto; /* implemented user timeout value (ticks) */
};
/*
@@ -231,7 +231,7 @@
#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_RCVD_UTO 0x20000000 /* a user timeout was received in SYN */
+#define TF_RCVD_UTO 0x20000000 /* a user timeout was received */
#define TF_NEEDUTO 0x40000000 /* send user timeout */
#define IN_FASTRECOVERY(tp) (tp->t_flags & TF_FASTRECOVERY)
More information about the p4-projects
mailing list