From patchwork Tue Sep 14 09:37:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kuznetsov X-Patchwork-Id: 64685 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 14EDAB6F14 for ; Tue, 14 Sep 2010 19:38:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752174Ab0INJiU (ORCPT ); Tue, 14 Sep 2010 05:38:20 -0400 Received: from minus.inr.ac.ru ([194.67.69.97]:53871 "HELO ms2.inr.ac.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S1751696Ab0INJiT (ORCPT ); Tue, 14 Sep 2010 05:38:19 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ms2.inr.ac.ru; b=c9c7j8ClKj8fupr9le3R6EdaUnBjyLpCVx7xf8JFWCQSaB8nkAc1pof0lpsP3ZMcATKhWVwOt/nIZewpIfOR0SO9yXN71Jkd20lFbL6PnWVcd0wlA5D0P3hXBLE2CPnBolBGLvJIzYUp5NVDE59/cNguKqBh0VyMtojIApyugV8=; Received: (from kuznet@localhost) envelope-from=kuznet by ms2.inr.ac.ru (8.6.13/ANK) id NAA27670; Tue, 14 Sep 2010 13:37:58 +0400 Date: Tue, 14 Sep 2010 13:37:58 +0400 From: Alexey Kuznetsov To: David Miller Cc: ilpo.jarvinen@helsinki.fi, eric.dumazet@gmail.com, leandroal@gmail.com, netdev@vger.kernel.org Subject: Re: TCP packet size and delivery packet decisions Message-ID: <20100914093758.GA24348@ms2.inr.ac.ru> References: <20100907.201843.179933180.davem@davemloft.net> <20100908121450.GA11412@ms2.inr.ac.ru> <20100912.182308.71115181.davem@davemloft.net> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100912.182308.71115181.davem@davemloft.net> User-Agent: Mutt/1.5.6i Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hello! > Therefore, how about the following? This will work. There is one trap though. If pktsize > max_window, packets never will be transmitted in normal path, only from probe timer, which will be very slow. If we do not want to mess with tcp_write_xmit(), it is still possible to relax the bound to tp->max_window. (BTW, this even does not contradict to RFC, only Fs = 1 for tiny windows). This should work: --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/net/tcp.h b/include/net/tcp.h index 34f5cc2..8cf8cdb 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -501,8 +501,22 @@ extern unsigned int tcp_current_mss(struct sock *sk); /* Bound MSS / TSO packet size with the half of the window */ static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) { - if (tp->max_window && pktsize > (tp->max_window >> 1)) - return max(tp->max_window >> 1, 68U - tp->tcp_header_len); + int cutoff; + + /* When peer uses tiny windows, there is no use in packetizing + * to sub-MSS pieces for the sake of SWS or making sure there + * are enough packets in the pipe for fast recovery. + * + * On the other hand, for extremely large MSS devices, handling + * smaller than MSS windows in this way does make sense. + */ + if (tp->max_window >= 512) + cutoff = (tp->max_window >> 1); + else + cutoff = tp->max_window; + + if (cutoff && pktsize > cutoff) + return max(cutoff, 68U - tp->tcp_header_len); else return pktsize; }