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 ||
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to