From owner-p4-projects@FreeBSD.ORG Sun Jun 26 20:25:16 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E82F51065673; Sun, 26 Jun 2011 20:25:15 +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 AAF541065670 for ; Sun, 26 Jun 2011 20:25:15 +0000 (UTC) (envelope-from cnicutar@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 7EE158FC19 for ; Sun, 26 Jun 2011 20:25:15 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p5QKPF1m039381 for ; Sun, 26 Jun 2011 20:25:15 GMT (envelope-from cnicutar@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p5QKPF4e039378 for perforce@freebsd.org; Sun, 26 Jun 2011 20:25:15 GMT (envelope-from cnicutar@freebsd.org) Date: Sun, 26 Jun 2011 20:25:15 GMT Message-Id: <201106262025.p5QKPF4e039378@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to cnicutar@freebsd.org using -f From: Catalin Nicutar To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 195384 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2011 20:25:16 -0000 http://p4web.freebsd.org/@@195384?ac=10 Change 195384 by cnicutar@cnicutar_cronos on 2011/06/26 20:25:08 Change granularity handling for TCP UTO. Changing the fields in tcpcb will prove uncomfortable later. It's best to let tcp_addoptions handle it when sending the actual segment. Affected files ... .. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_output.c#4 edit .. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_usrreq.c#4 edit .. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_var.h#4 edit Differences ... ==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_output.c#4 (text+ko) ==== @@ -1474,9 +1474,27 @@ *optp++ = TCPOPT_UTO; *optp++ = TCPOLEN_UTO; - to->to_uto = htons(to->to_uto); - bcopy((u_char *)&to->to_uto, optp, sizeof(to->to_uto)); - optp += sizeof(to->to_uto); + if (to->to_uto > 3600) { + /* + * If the timeout is larger than 3600 + * we'll specify minutes. + * XXX-CN 3600 is arbitrary. + */ + to->to_uto /= 60; + to->to_uto |= 0x8000; + } + + /* + * XXX-CN to_uto is 32b because the user is allowed + * to specify more than 16b of seconds (dividing the + * value by 60 will make it fit). + */ + { + uint16_t uto = to->to_uto; + uto = htons(uto); + bcopy((u_char *)&uto, optp, sizeof(uto)); + optp += sizeof(uto); + } break; default: panic("%s: unknown TCP option type", __func__); ==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_usrreq.c#4 (text+ko) ==== @@ -1312,15 +1312,6 @@ optval <= V_uto_max_timeout) { /* The timeout is acceptable. */ tp->snd_uto = optval; - if (tp->snd_uto > 3600) { - /* - * If the timeout is larger than 3600 - * we'll specify minutes. - * XXX-CN 3600 is arbitrary. - */ - tp->snd_uto /= 60; - tp->snd_uto |= 0x8000; - } tp->t_flags |= TF_SND_UTO; } else error = EINVAL; ==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_var.h#4 (text+ko) ==== @@ -291,7 +291,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 */ + u_int32_t to_uto; /* sent user timeout */ }; /*