PERFORCE change 195423 for review

Catalin Nicutar cnicutar at FreeBSD.org
Mon Jun 27 15:10:55 UTC 2011


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

Change 195423 by cnicutar at cnicutar_cronos on 2011/06/27 15:10:25

	Replace magic values used for UTO granularity with defines.

Affected files ...

.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_input.c#4 edit
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_output.c#5 edit
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_var.h#6 edit

Differences ...

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

@@ -1092,8 +1092,8 @@
 
 		if (to.to_flags & TOF_UTO) {
 			if (tp->t_flags & TF_RCV_UTO) {
-				tp->rcv_uto = (to.to_uto & 0x8000) ?
-				    (to.to_uto & 0x7FFF) * 60 : to.to_uto;
+				tp->rcv_uto = (to.to_uto & UTO_MINS) ?
+				    (to.to_uto & ~(UTO_MINS)) * 60 : to.to_uto;
 				/* silently make it fit between min-max */
 				tp->rcv_uto = min(V_uto_max_timeout,
 				    max(V_uto_min_timeout, tp->rcv_uto));
@@ -1291,8 +1291,8 @@
 	/* Processing received UTO. */
 	if ((to.to_flags & TOF_UTO) && (tp->t_flags & TF_RCV_UTO)) {
 		/* convert to seconds if granularity is set */
-		tp->rcv_uto = (to.to_uto & 0x8000) ?
-		    (to.to_uto & 0x7FFF) * 60 : to.to_uto;
+		tp->rcv_uto = (to.to_uto & UTO_MINS) ?
+		    (to.to_uto & ~(UTO_MINS)) * 60 : to.to_uto;
 		tp->rcv_uto = min(V_uto_max_timeout,
 		    max(V_uto_min_timeout, tp->rcv_uto));
 	}

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

@@ -1474,14 +1474,14 @@
 			*optp++ = TCPOPT_UTO;
 			*optp++ = TCPOLEN_UTO;
 
-			if (to->to_uto > 3600) {
+			if (to->to_uto > UTO_MINS_TH) {
 				/*
 			 	* If the timeout is larger than 3600
 				* we'll specify minutes.
 				* XXX-CN 3600 is arbitrary.
 			 	*/
 				to->to_uto /= 60;
-				to->to_uto |= 0x8000;
+				to->to_uto |= UTO_MINS;
 			}
 			
 			/*

==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_var.h#6 (text+ko) ====

@@ -300,6 +300,12 @@
  */
 #define	TO_SYN		0x01		/* parse SYN-only options */
 
+/*
+ * Flags for TCP UTO
+ */
+#define UTO_MINS	0x8000		/* highest bit set means "minutes" */
+#define UTO_MINS_TH	3600		/* send minutes if >= one hour */
+
 struct hc_metrics_lite {	/* must stay in sync with hc_metrics */
 	u_long	rmx_mtu;	/* MTU for this path */
 	u_long	rmx_ssthresh;	/* outbound gateway buffer limit */


More information about the p4-projects mailing list