PERFORCE change 195086 for review

Catalin Nicutar cnicutar at FreeBSD.org
Tue Jun 21 07:25:30 UTC 2011


http://p4web.freebsd.org/@@195086?ac=10

Change 195086 by cnicutar at cnicutar_cronos on 2011/06/21 07:24:52

	Cleanup style (broken in previous changelist)

Affected files ...

.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_output.c#3 edit
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_usrreq.c#3 edit

Differences ...

==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_output.c#3 (text+ko) ====

@@ -1375,21 +1375,6 @@
 			bcopy((u_char *)&to->to_mss, optp, sizeof(to->to_mss));
 			optp += sizeof(to->to_mss);
 			break;
-		case TOF_UTO:
-			while (optlen % 4) {
-				optlen += TCPOLEN_NOP;
-				*optp++ = TCPOPT_NOP;
-			}
-			if (TCP_MAXOLEN - optlen < TCPOLEN_UTO)
-				continue;
-			optlen += TCPOLEN_UTO;
-			*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);
-			break;
 		case TOF_SCALE:
 			while (!optlen || optlen % 2 != 1) {
 				optlen += TCPOLEN_NOP;
@@ -1478,6 +1463,21 @@
 			TCPSTAT_INC(tcps_sack_send_blocks);
 			break;
 			}
+		case TOF_UTO:
+			while (optlen % 4) {
+				optlen += TCPOLEN_NOP;
+				*optp++ = TCPOPT_NOP;
+			}
+			if (TCP_MAXOLEN - optlen < TCPOLEN_UTO)
+				continue;
+			optlen += TCPOLEN_UTO;
+			*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);
+			break;
 		default:
 			panic("%s: unknown TCP option type", __func__);
 			break;

==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_usrreq.c#3 (text+ko) ====

@@ -1305,22 +1305,26 @@
 
 			INP_WLOCK_RECHECK(inp);
 			if (optval == 0) {
-				/* disable sending the option */
+				/* 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
-				 */
+			} else if (optval >= V_uto_min_timeout &&
+			    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;
-				tp->snd_uto = optval;
-			}
-			else {
+			} else
 				error = EINVAL;
-			}
+
 			INP_WUNLOCK(inp);
 			break;
 
@@ -1332,13 +1336,11 @@
 				return (error);
 
 			INP_WLOCK_RECHECK(inp);
-			if (optval <= 0) {
-				/* this connection will disregard suggestions */
+			if (optval <= 0)
+				/* This connection will ignore suggestions. */
 				tp->t_flags &= ~TF_RCV_UTO;
-			}
-			else {
+			else
 				tp->t_flags |= TF_RCV_UTO;
-			}
 			INP_WUNLOCK(inp);
 			break;
 


More information about the p4-projects mailing list