PERFORCE change 195382 for review
Catalin Nicutar
cnicutar at FreeBSD.org
Sun Jun 26 19:29:18 UTC 2011
http://p4web.freebsd.org/@@195382?ac=10
Change 195382 by cnicutar at cnicutar_cronos on 2011/06/26 19:28:18
Change syncache so that rcv_uto and snd_uto options are inherited
from a listening socket.
Affected files ...
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_syncache.c#3 edit
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_syncache.h#3 edit
Differences ...
==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_syncache.c#3 (text+ko) ====
@@ -810,6 +810,14 @@
#endif
if (sc->sc_flags & SCF_SACK)
tp->t_flags |= TF_SACK_PERMIT;
+ if (sc->sc_flags & SCF_SND_UTO) {
+ tp->t_flags |= TF_SND_UTO;
+ tp->snd_uto = sc->sc_snd_uto;
+ }
+ if (sc->sc_flags & SCF_RCV_UTO) {
+ tp->t_flags |= TF_RCV_UTO;
+ tp->rcv_uto = sc->sc_rcv_uto;
+ }
}
if (sc->sc_flags & SCF_ECN)
@@ -1022,6 +1030,14 @@
struct syncache scs;
struct ucred *cred;
+ /*
+ * The client may have sent us an UTO suggestion; even if it hasn't,
+ * we need to inherit the current disposition (i.e. will the resulting
+ * socket accept suggestions?).
+ */
+ uint8_t rcv_uto_tf = 0;
+ uint64_t rcv_uto = 0;
+
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
INP_WLOCK_ASSERT(inp); /* listen socket */
KASSERT((th->th_flags & (TH_RST|TH_ACK|TH_SYN)) == TH_SYN,
@@ -1048,10 +1064,17 @@
/* Set User Timeout to send in SYN-ACK. */
if (tp->t_flags & TF_SND_UTO) {
+ /* Also inherited after connection is established. */
to->to_uto = tp->snd_uto;
to->to_flags |= TOF_UTO;
}
+ if (tp->t_flags & TF_RCV_UTO) {
+ /* Remember received timeout to pass on. */
+ rcv_uto_tf = 1;
+ rcv_uto = tp->rcv_uto;
+ }
+
/* By the time we drop the lock these should no longer be used. */
so = NULL;
tp = NULL;
@@ -1112,6 +1135,7 @@
sc->sc_tsreflect = to->to_tsval;
else
sc->sc_flags &= ~SCF_TIMESTAMP;
+
#ifdef MAC
/*
* Since we have already unconditionally allocated label
@@ -1257,8 +1281,14 @@
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_uto = to->to_uto;
- sc->sc_flags |= SCF_UTO;
+ sc->sc_snd_uto = to->to_uto;
+ sc->sc_flags |= SCF_SND_UTO;
+ }
+
+ /* Inherit received UTO. */
+ if (rcv_uto_tf) {
+ sc->sc_rcv_uto = rcv_uto;
+ sc->sc_flags |= SCF_RCV_UTO;
}
if (V_tcp_syncookies) {
@@ -1422,8 +1452,8 @@
}
if (sc->sc_flags & SCF_SACK)
to.to_flags |= TOF_SACKPERM;
- if (sc->sc_flags & SCF_UTO) {
- to.to_uto = sc->sc_uto;
+ if (sc->sc_flags & SCF_SND_UTO) {
+ to.to_uto = sc->sc_snd_uto;
to.to_flags |= TOF_UTO;
}
#ifdef TCP_SIGNATURE
==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_syncache.h#3 (text+ko) ====
@@ -74,7 +74,8 @@
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_uto; /* user timeout to send */
+ u_int32_t sc_snd_uto; /* user timeout to send */
+ u_int32_t sc_rcv_uto; /* user timeout received */
u_int16_t sc_flags;
#ifndef TCP_OFFLOAD_DISABLE
struct toe_usrreqs *sc_tu; /* TOE operations */
@@ -95,7 +96,8 @@
#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 */
+#define SCF_SND_UTO 0x200 /* send UTO */
+#define SCF_RCV_UTO 0x400 /* receive UTO suggestions */
#define SYNCOOKIE_SECRET_SIZE 8 /* dwords */
#define SYNCOOKIE_LIFETIME 16 /* seconds */
More information about the p4-projects
mailing list