Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jul 2011 18:43:54 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r223797 - head/sys/netinet
Message-ID:  <201107051843.p65IhsKk080969@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cperciva
Date: Tue Jul  5 18:43:54 2011
New Revision: 223797
URL: http://svn.freebsd.org/changeset/base/223797

Log:
  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

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==============================================================================
--- head/sys/netinet/tcp_lro.c	Tue Jul  5 18:42:10 2011	(r223796)
+++ head/sys/netinet/tcp_lro.c	Tue Jul  5 18:43:54 2011	(r223797)
@@ -277,6 +277,14 @@ tcp_lro_rx(struct lro_ctrl *cntl, struct
 		    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 ||



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107051843.p65IhsKk080969>