From owner-p4-projects@FreeBSD.ORG Thu Jun 4 17:43:13 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D641C106566C; Thu, 4 Jun 2009 17:43:12 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 958F2106564A for ; Thu, 4 Jun 2009 17:43:12 +0000 (UTC) (envelope-from fangwang@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 842218FC1A for ; Thu, 4 Jun 2009 17:43:12 +0000 (UTC) (envelope-from fangwang@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n54HhCUn015879 for ; Thu, 4 Jun 2009 17:43:12 GMT (envelope-from fangwang@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n54HhCnS015877 for perforce@freebsd.org; Thu, 4 Jun 2009 17:43:12 GMT (envelope-from fangwang@FreeBSD.org) Date: Thu, 4 Jun 2009 17:43:12 GMT Message-Id: <200906041743.n54HhCnS015877@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to fangwang@FreeBSD.org using -f From: Fang Wang To: Perforce Change Reviews Cc: Subject: PERFORCE change 163503 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jun 2009 17:43:13 -0000 http://perforce.freebsd.org/chv.cgi?CH=163503 Change 163503 by fangwang@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)