summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/tcp_syncache.c10
-rw-r--r--sys/netinet/tcp_usrreq.c9
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index b1b209d..84d3c10 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1014,9 +1014,15 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
if (to->to_flags & TOF_SCALE) {
int wscale = 0;
- /* Compute proper scaling value from buffer space */
+ /*
+ * Compute proper scaling value from buffer space.
+ * Leave enough room for the socket buffer to grow
+ * with auto sizing. This allows us to scale the
+ * receive buffer over a wide range while not losing
+ * any efficiency or fine granularity.
+ */
while (wscale < TCP_MAX_WINSHIFT &&
- (TCP_MAXWIN << wscale) < sb_hiwat)
+ (0x1 << wscale) < tcp_minmss)
wscale++;
sc->sc_requested_r_scale = wscale;
sc->sc_requested_s_scale = to->to_requested_s_scale;
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index fa522b4..3553661 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1131,9 +1131,14 @@ tcp_connect(tp, nam, td)
inp->inp_laddr = laddr;
in_pcbrehash(inp);
- /* Compute window scaling to request. */
+ /*
+ * Compute window scaling to request:
+ * Scale to fit into sweet spot. See tcp_syncache.c.
+ * XXX: This should move to tcp_output().
+ * XXX: This should be based on the actual MSS.
+ */
while (tp->request_r_scale < TCP_MAX_WINSHIFT &&
- (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat)
+ (0x1 << tp->request_r_scale) < tcp_minmss)
tp->request_r_scale++;
soisconnecting(so);
OpenPOWER on IntegriCloud