From owner-svn-src-all@FreeBSD.ORG Tue Jul 5 18:43:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1A41106566C; Tue, 5 Jul 2011 18:43:54 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2ACB8FC08; Tue, 5 Jul 2011 18:43:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p65Ihs19080971; Tue, 5 Jul 2011 18:43:54 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p65IhsKk080969; Tue, 5 Jul 2011 18:43:54 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201107051843.p65IhsKk080969@svn.freebsd.org> From: Colin Percival Date: Tue, 5 Jul 2011 18:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223797 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2011 18:43:55 -0000 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 ||