From patchwork Tue Feb 18 05:56:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xufeng Zhang X-Patchwork-Id: 321279 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 D739F2C00D2 for ; Tue, 18 Feb 2014 16:46:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753496AbaBRFqY (ORCPT ); Tue, 18 Feb 2014 00:46:24 -0500 Received: from mail.windriver.com ([147.11.1.11]:52113 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751054AbaBRFqV (ORCPT ); Tue, 18 Feb 2014 00:46:21 -0500 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail.windriver.com (8.14.5/8.14.5) with ESMTP id s1I5k6fP015742 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 17 Feb 2014 21:46:06 -0800 (PST) Received: from localhost.localdomain (128.224.163.210) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.2.347.0; Mon, 17 Feb 2014 21:46:05 -0800 From: Xufeng Zhang To: , , CC: , , , Subject: [PATCH RFC] sctp: Update HEARTBEAT timer immediately after user changed HB.interval Date: Tue, 18 Feb 2014 13:56:50 +0800 Message-ID: <1392703010-6128-1-git-send-email-xufeng.zhang@windriver.com> X-Mailer: git-send-email 1.7.0.2 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For an established association, if user has updated the HB.interval parameter by setsockopt(), this new heartbeat interval will not take effect until: - the expiry of the heartbeat timer and new hearbeat is sent. - DATA chunk has been sent and the transport resets the timer. This could not meet the requirement of the user who need to get HEARTBEAT sent at the specified time. Thus, we need to update the heartbeat timer immediately after user has changed HB.interval. Signed-off-by: Xufeng Zhang Acked-by: Neil Horman --- net/sctp/socket.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 9e91d6e..699ae1e 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -2344,6 +2344,11 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, if (trans) { trans->hbinterval = msecs_to_jiffies(params->spp_hbinterval); + + /* Update the heartbeat timer immediately. */ + if (!mod_timer(&trans->hb_timer, + sctp_transport_timeout(trans))) + sctp_transport_hold(trans); } else if (asoc) { asoc->hbinterval = msecs_to_jiffies(params->spp_hbinterval);