diff options
author | cperciva <cperciva@FreeBSD.org> | 2011-07-05 18:43:54 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2011-07-05 18:43:54 +0000 |
commit | 7329900ba0be8322fcfb13ca0708c2a7d2398b4c (patch) | |
tree | 39a1e1c4e1a46f04e7138db7054a161dd4d17005 /sys | |
parent | 52539f62b4594a26512f2452204d41d1b277552d (diff) | |
download | FreeBSD-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.c | 8 |
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 || |