PERFORCE change 163774 for review
Fang Wang
fangwang at FreeBSD.org
Mon Jun 8 11:41:41 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=163774
Change 163774 by fangwang at fangwang_utobsd on 2009/06/08 11:40:57
Fix style.
Remove bitfields, use bit operations instead.
Affected files ...
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp.h#4 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_input.c#3 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_output.c#5 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_subr.c#3 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_syncache.c#3 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_syncache.h#3 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.h#3 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#8 edit
Differences ...
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp.h#4 (text+ko) ====
@@ -96,8 +96,8 @@
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */
#define TCPOLEN_SIGNATURE 18
-#define TCPOPT_UTO 28
-#define TCPOLEN_UTO 4
+#define TCPOPT_UTO 28
+#define TCPOLEN_UTO 4
/* Miscellaneous constants */
#define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */
@@ -152,7 +152,7 @@
#define TCP_MD5SIG 0x10 /* use MD5 digests (RFC2385) */
#define TCP_INFO 0x20 /* retrieve tcp_info structure */
#define TCP_CONGESTION 0x40 /* get/set congestion control algorithm */
-#define TCP_UTO 0x80 /* set tcp user timeout */
+#define TCP_UTO 0x80 /* set tcp user timeout */
#define TCP_CA_NAME_MAX 16 /* max congestion control name length */
@@ -161,7 +161,7 @@
#define TCPI_OPT_WSCALE 0x04
#define TCPI_OPT_ECN 0x08
#define TCPI_OPT_TOE 0x10
-#define TCPI_OPT_UTO 0x20
+#define TCPI_OPT_UTO 0x20
/*
* The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_input.c#3 (text+ko) ====
@@ -1226,6 +1226,10 @@
if ((tp->t_flags & TF_SACK_PERMIT) &&
(to.to_flags & TOF_SACKPERM) == 0)
tp->t_flags &= ~TF_SACK_PERMIT;
+ if (to.to_flags & TOF_UTO) {
+ tp->t_flags |= TF_RCVD_UTO;
+ tp->rcv_uto = to.to_uto;
+ }
}
/*
@@ -2944,15 +2948,13 @@
TCPSTAT_INC(tcps_sack_rcv_blocks);
break;
case TCPOPT_UTO:
- unsigned short uto_load;
if (optlen != TCPOLEN_UTO)
continue;
to->to_flags |= TOF_UTO;
bcopy((char *)cp + 2,
- (char *)&uto_load, sizeof(uto_load));
- uto_load = ntohs(uto_load);
- to->to_granularity = uto_load >> 15;
- to->to_uto = uto_load - ((unsigned short)to->to_granularity << 15));
+ (char *)&to->to_uto, sizeof(uto_load));
+ to->to_uto = ntohs(to->to_uto);
+ break;
default:
continue;
}
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_output.c#5 (text+ko) ====
@@ -1446,15 +1446,14 @@
}
case TOF_UTO:
{
- unsigned short uto_load = (unsigned short)to->to_granularity << 15;
- uto_load += to->to_uto;
if (TCP_MAXOLEN - optlen < TCPOLEN_UTO)
continue;
*optp++ = TCPOPT_UTO;
*optp++ = TCPOLEN_UTO;
optlen += TCPOLEN_UTO;
- bcopy((u_char *)&uto_load, optp, sizeof(uto_load));
- optp += sizeof(uto_load);
+ 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__);
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_subr.c#3 (text+ko) ====
@@ -745,9 +745,7 @@
* but we make it available if a UTO request received or set it through
* setsockopt system call.
*/
- tp->uto_impl = 0;
- tp->uto_changeable = 1;
- tp->uto_enable = 1;
+ tp->uto_flag = UTO_ENABLE | UTO_CHANGEABLE
/*
* IPv4 TTL initialization is necessary for an IPv6 socket as well,
* because the socket may be bound to an IPv6 wildcard address,
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_syncache.c#3 (text+ko) ====
@@ -774,7 +774,6 @@
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;
}
}
@@ -1215,7 +1214,6 @@
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;
}
@@ -1387,7 +1385,6 @@
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;
}
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_syncache.h#3 (text+ko) ====
@@ -69,8 +69,7 @@
u_int8_t sc_ip_tos; /* IPv4 TOS */
u_int8_t sc_requested_s_scale:4,
sc_requested_r_scale:4;
- u_int16_t sc_granularity:1, /* user timeout granularity */
- sc_uto:15; /* user timeout, UTO */
+ u_int16_t sc_uto; /* user timeout */
u_int16_t sc_flags;
#ifndef TCP_OFFLOAD_DISABLE
struct toe_usrreqs *sc_tu; /* TOE operations */
@@ -93,7 +92,7 @@
#define SCF_SIGNATURE 0x20 /* send MD5 digests */
#define SCF_SACK 0x80 /* send SACK option */
#define SCF_ECN 0x100 /* send ECN setup packet */
-#define SCF_UTO 0x200 /* send UTO option */
+#define SCF_UTO 0x200 /* send UTO option */
#define SYNCOOKIE_SECRET_SIZE 8 /* dwords */
#define SYNCOOKIE_LIFETIME 16 /* seconds */
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.h#3 (text+ko) ====
@@ -91,8 +91,8 @@
#define TCPTV_FINWAIT2_TIMEOUT (60*hz) /* FIN_WAIT_2 timeout if no receiver */
-#define TCPTV_UTOMIN (120*hz) /* min user timeout */
-#define TCPTV_UTOMAX (720*hz) /* max user timeout */
+#define TCPTV_UTOMIN (120*hz) /* min user timeout */
+#define TCPTV_UTOMAX (720*hz) /* max user timeout */
/*
* Minimum retransmit timer is 3 ticks, for algorithmic stability.
==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#8 (text+ko) ====
@@ -192,13 +192,12 @@
int t_bytes_acked; /* # bytes acked during current RTT */
/* user timeout variables (RFC 5482) */
- 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 */
- u_char uto_changeable:1; /* flag that controls whether USER_TIMEOUT may be changed based on rcv_uto */
- u_char uto_impl:1; /* flag that controls whether implement user timeout */
+ uint16_t rcv_uto; /* received user timeout */
+ uint16_t snd_uto; /* send user timeout */
+ uint8_t uto_flag;
+#define UTO_ENABLE 0x01
+#define UTO_CHANGEABLE 0x02
+#define UTO_IMPL 0x04
u_int t_impl_uto; /* implemented user timeout */
};
@@ -231,8 +230,8 @@
#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 */
-#define TF_NEEDUTO 0x40000000 /* send user timeout */
+#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)
#define ENTER_FASTRECOVERY(tp) tp->t_flags |= TF_FASTRECOVERY
@@ -275,7 +274,7 @@
#define TOF_TS 0x0010 /* timestamp */
#define TOF_SIGNATURE 0x0040 /* TCP-MD5 signature option (RFC2385) */
#define TOF_SACK 0x0080 /* Peer sent SACK option */
-#define TOF_UTO 0x0100 /* user timeout (RFC5482) */
+#define TOF_UTO 0x0100 /* user timeout (RFC5482) */
#define TOF_MAXOPT 0x0200
u_int32_t to_tsval; /* new timestamp */
u_int32_t to_tsecr; /* reflected timestamp */
@@ -284,8 +283,7 @@
u_int8_t to_nsacks; /* number of SACK blocks */
u_char *to_sacks; /* pointer to the first SACK blocks */
u_char *to_signature; /* pointer to the TCP-MD5 signature */
- u_int16_t to_granularity:1,/* user timeout granularity */
- to_uto:15; /* user timeout */
+ u_int16_t to_uto; /* user timeout */
};
/*
More information about the p4-projects
mailing list