From patchwork Tue Mar 15 04:53:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Jero X-Patchwork-Id: 86853 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 616A6B6FEF for ; Tue, 15 Mar 2011 15:53:29 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752782Ab1COExW (ORCPT ); Tue, 15 Mar 2011 00:53:22 -0400 Received: from bay0-omc2-s20.bay0.hotmail.com ([65.54.190.95]:48133 "EHLO bay0-omc2-s20.bay0.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752195Ab1COExV (ORCPT ); Tue, 15 Mar 2011 00:53:21 -0400 Received: from BL2PRD0103HT008.prod.exchangelabs.com ([65.54.190.125]) by bay0-omc2-s20.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 14 Mar 2011 21:53:21 -0700 Received: from [64.247.126.36] (64.247.126.36) by pod51000.outlook.com (10.6.4.55) with Microsoft SMTP Server (TLS) id 14.0.650.71; Tue, 15 Mar 2011 04:53:20 +0000 Subject: Re: dccp test-tree [RFC] [Patch 2/2] dccp: CCID2 check ack ratio when reducing cwnd From: Samuel Jero To: Gerrit Renker CC: , In-Reply-To: <20110311113042.GB4876@gerrit.erg.abdn.ac.uk> References: <20110228112511.GE3620@gerrit.erg.abdn.ac.uk> <1299559831.7569.41.camel@jero-laptop> <20110311113042.GB4876@gerrit.erg.abdn.ac.uk> Date: Tue, 15 Mar 2011 00:53:17 -0400 Message-ID: <1300164797.20638.65.camel@jero-laptop> MIME-Version: 1.0 X-Mailer: Evolution 2.30.3 X-MS-Exchange-Transport-Rules-Loop: 0 X-OriginalArrivalTime: 15 Mar 2011 04:53:21.0403 (UTC) FILETIME=[E89D74B0:01CBE2CC] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch causes CCID2 to check the ack ratio after reducing the congestion window. If the ack ratio is greater than the congestion window, it is reduced. This prevents timeouts caused by an ack ratio larger than the congestion window. In this situation, we choose to set the ack ratio to half the congestion window (or one if that's zero) so that if we loose one ack we don't trigger a timeout. --- Signed-off-by: Samuel Jero diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 1475ba3..b7f7dbd 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c @@ -118,4 +118,22 @@ static void ccid2_change_l_seq_window(struct sock *sk, u64 val) dccp_feat_signal_nn_change(sk, DCCPF_SEQUENCE_WINDOW, val); } + +static void ccid2_check_l_ack_ratio(struct sock *sk) +{ + struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); + + /* + * After a loss, idle period, application limited period, or RTO we + * need tocheck that the ack ratio is still less than the congestion + * window. Otherwise, we will send an entire congestion window of + * packets and got no response because we haven't sent ack ratio + * packets yet. + * If the ack ratio does need to be reduced, we reduce it to half of + * the congestion window (or 1 if that's zero) instead of to the + * congestion window. This prevents problems if one ack is lost. + */ + if (dccp_feat_get_nn_next_val(sk, DCCPF_ACK_RATIO) > hc->tx_cwnd) + ccid2_change_l_ack_ratio(sk, hc->tx_cwnd/2 ? : 1U); +} static void ccid2_hc_tx_rto_expire(unsigned long data) @@ -203,6 +214,8 @@ static void ccid2_cwnd_application_limited(struct sock *sk, const u32 now) } hc->tx_cwnd_used = 0; hc->tx_cwnd_stamp = now; + + ccid2_check_l_ack_ratio(sk); } /* This borrows the code of tcp_cwnd_restart() */ @@ -221,6 +234,8 @@ static void ccid2_cwnd_restart(struct sock *sk, const u32 now) hc->tx_cwnd_stamp = now; hc->tx_cwnd_used = 0; + + ccid2_check_l_ack_ratio(sk); } static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len) @@ -490,9 +505,7 @@ static void ccid2_congestion_event(struct sock *sk, struct ccid2_seq *seqp) hc->tx_cwnd = hc->tx_cwnd / 2 ? : 1U; hc->tx_ssthresh = max(hc->tx_cwnd, 2U); - /* Avoid spurious timeouts resulting from Ack Ratio > cwnd */ - if (dccp_sk(sk)->dccps_l_ack_ratio > hc->tx_cwnd) - ccid2_change_l_ack_ratio(sk, hc->tx_cwnd); + ccid2_check_l_ack_ratio(sk); } static int ccid2_hc_tx_parse_options(struct sock *sk, u8 packet_type,