From patchwork Tue Aug 25 09:07:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chunbo.luo@windriver.com X-Patchwork-Id: 32027 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 9E806B7B3E for ; Tue, 25 Aug 2009 19:09:44 +1000 (EST) Received: by ozlabs.org (Postfix) id 8DF8ADDD0C; Tue, 25 Aug 2009 19:09:44 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 28B2BDDD0B for ; Tue, 25 Aug 2009 19:09:44 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754419AbZHYJIt (ORCPT ); Tue, 25 Aug 2009 05:08:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753181AbZHYJIs (ORCPT ); Tue, 25 Aug 2009 05:08:48 -0400 Received: from mail.windriver.com ([147.11.1.11]:51229 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbZHYJIr (ORCPT ); Tue, 25 Aug 2009 05:08:47 -0400 Received: from localhost.localdomain (pek-lpgbuild6.wrs.com [128.224.153.36]) by mail.windriver.com (8.14.3/8.14.3) with ESMTP id n7P984Lm029014; Tue, 25 Aug 2009 02:08:05 -0700 (PDT) From: Chunbo Luo To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org, linux-kernel@vger.kernel.org, chunbo.luo@windriver.com, yjwei@cn.fujitsu.com Subject: [PATCH v3] sctp: fix the check for path failure detection Date: Tue, 25 Aug 2009 17:07:59 +0800 Message-Id: <1251191279-1764-1-git-send-email-chunbo.luo@windriver.com> X-Mailer: git-send-email 1.6.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The transport error count should be incremented when the the T3-rtx timer expires or an outstanding HB is not acknowledged. In order to avoid sending out an extra HB before marking the transport DOWN, the path failure detection should be done before sending out HB. Signed-off-by: Chunbo Luo Signed-off-by: Wei Yongjun --- net/sctp/sm_sideeffect.c | 3 ++- net/sctp/sm_statefuns.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 86426aa..fb723dd 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c @@ -447,7 +447,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc, asoc->overall_error_count++; if (transport->state != SCTP_INACTIVE && - (transport->error_count++ >= transport->pathmaxrxt)) { + (transport->error_count >= transport->pathmaxrxt)) { SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p", " transport IP: port:%d failed.\n", asoc, @@ -468,6 +468,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc, * that indicates that we have an outstanding HB. */ if (!is_hb || transport->hb_sent) { + transport->error_count++; transport->last_rto = transport->rto; transport->rto = min((transport->rto * 2), transport->asoc->rto_max); } diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 7288192..7f77099 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -981,10 +981,6 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep, */ if (transport->param_flags & SPP_HB_ENABLE) { - if (SCTP_DISPOSITION_NOMEM == - sctp_sf_heartbeat(ep, asoc, type, arg, - commands)) - return SCTP_DISPOSITION_NOMEM; /* Set transport error counter and association error counter * when sending heartbeat. */ @@ -992,6 +988,10 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep, SCTP_TRANSPORT(transport)); sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT, SCTP_TRANSPORT(transport)); + if (SCTP_DISPOSITION_NOMEM == + sctp_sf_heartbeat(ep, asoc, type, arg, + commands)) + return SCTP_DISPOSITION_NOMEM; } sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE, SCTP_TRANSPORT(transport));