summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2011-07-05 18:43:54 +0000
committercperciva <cperciva@FreeBSD.org>2011-07-05 18:43:54 +0000
commit7329900ba0be8322fcfb13ca0708c2a7d2398b4c (patch)
tree39a1e1c4e1a46f04e7138db7054a161dd4d17005 /sys
parent52539f62b4594a26512f2452204d41d1b277552d (diff)
downloadFreeBSD-src-7329900ba0be8322fcfb13ca0708c2a7d2398b4c.zip
FreeBSD-src-7329900ba0be8322fcfb13ca0708c2a7d2398b4c.tar.gz
Don't allow lro->len to exceed 65535, as this will result in overflow
when len is inserted back into the synthetic IP packet and cause a multiple of 2^16 bytes of TCP "packet loss". This improves Linux->FreeBSD netperf bandwidth by a factor of 300 in testing on Amazon EC2. Reviewed by: jfv MFC after: 2 weeks
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_lro.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index 27384c5..6569eda 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -277,6 +277,14 @@ tcp_lro_rx(struct lro_ctrl *cntl, struct mbuf *m_head, uint32_t csum)
lro->dest_port == tcp->th_dport &&
lro->source_ip == ip->ip_src.s_addr &&
lro->dest_ip == ip->ip_dst.s_addr) {
+ /* Flush now if appending will result in overflow. */
+ if (lro->len > (65535 - tcp_data_len)) {
+ SLIST_REMOVE(&cntl->lro_active, lro,
+ lro_entry, next);
+ tcp_lro_flush(cntl, lro);
+ break;
+ }
+
/* Try to append it */
if (__predict_false(seq != lro->next_seq ||
OpenPOWER on IntegriCloud