From: Chunbo Luo <chunbo.luo@windriver.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
linux-kernel@vger.kernel.org, chunbo.luo@windiriver.com
Subject: [PATCH] sctp: fix the check for path failure detection
Date: Fri, 21 Aug 2009 07:04:35 +0000 [thread overview]
Message-ID: <1250838275-7444-1-git-send-email-chunbo.luo@windriver.com> (raw)
The transport is marked DOWN immediately after sending the max+1 HB,
which is equal to not sending the max+1 HB at all. We should wait
a next period and make sure the last HB is not acknowledged.
Signed-off-by: Chunbo Luo <chunbo.luo@windriver.com>
---
include/net/sctp/command.h | 1 +
net/sctp/sm_sideeffect.c | 39 ++++++++++++++++++++++++++++-----------
net/sctp/sm_statefuns.c | 16 ++++++++++++++--
3 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 3b96680..256effd 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -77,6 +77,7 @@ typedef enum {
SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */
SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */
SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */
+ SCTP_CMD_PATH_FAILURE_DETECTION,/* Path failure detection. */
SCTP_CMD_TRANSPORT_HB_SENT, /* Reset the status of a transport. */
SCTP_CMD_TRANSPORT_IDLE, /* Do manipulations on idle transport */
SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 86426aa..db299c6 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -432,7 +432,25 @@ sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES] = {
* mark the destination transport address as inactive, and a
* notification SHOULD be sent to the upper layer.
*
+ * transport error counter is incremented in sctp_do_8_2_transport_strike
*/
+static void sctp_cmd_path_failure_detection(struct sctp_association *asoc,
+ struct sctp_transport *transport)
+{
+ if (transport->error_count > transport->pathmaxrxt) {
+ SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p",
+ " transport IP: port:%d failed.\n",
+ asoc,
+ (&transport->ipaddr),
+ ntohs(transport->ipaddr.v4.sin_port));
+ sctp_assoc_control_transport(asoc, transport,
+ SCTP_TRANSPORT_DOWN,
+ SCTP_FAILED_THRESHOLD);
+ }
+}
+
+
+ /* Mark a strike against a transport */
static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
struct sctp_transport *transport,
int is_hb)
@@ -446,17 +464,11 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
if (transport->state != SCTP_UNCONFIRMED)
asoc->overall_error_count++;
- if (transport->state != SCTP_INACTIVE &&
- (transport->error_count++ >= transport->pathmaxrxt)) {
- SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p",
- " transport IP: port:%d failed.\n",
- asoc,
- (&transport->ipaddr),
- ntohs(transport->ipaddr.v4.sin_port));
- sctp_assoc_control_transport(asoc, transport,
- SCTP_TRANSPORT_DOWN,
- SCTP_FAILED_THRESHOLD);
- }
+ /* The check for transport's error counter exceeding the threshold
+ * is done in the state function.
+ */
+ if (transport->state != SCTP_INACTIVE)
+ transport->error_count++;
/* E2) For the destination address for which the timer
* expires, set RTO <- RTO * 2 ("back off the timer"). The
@@ -1464,6 +1476,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
0);
break;
+ case SCTP_CMD_PATH_FAILURE_DETECTION:
+ t = cmd->obj.transport;
+ sctp_cmd_path_failure_detection(asoc, t);
+ break;
+
case SCTP_CMD_TRANSPORT_IDLE:
t = cmd->obj.transport;
sctp_transport_lower_cwnd(t, SCTP_LOWER_CWND_INACTIVE);
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 7288192..f4c05fd 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -981,6 +981,9 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
*/
if (transport->param_flags & SPP_HB_ENABLE) {
+ /* Do the path failure detection before send beat */
+ sctp_add_cmd_sf(commands, SCTP_CMD_PATH_FAILURE_DETECTION,
+ SCTP_TRANSPORT(transport));
if (SCTP_DISPOSITION_NOMEM =
sctp_sf_heartbeat(ep, asoc, type, arg,
commands))
@@ -5229,6 +5232,8 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const struct sctp_endpoint *ep,
*/
/* Do some failure management (Section 8.2). */
+ sctp_add_cmd_sf(commands, SCTP_CMD_PATH_FAILURE_DETECTION,
+ SCTP_TRANSPORT(transport));
sctp_add_cmd_sf(commands, SCTP_CMD_STRIKE, SCTP_TRANSPORT(transport));
/* NB: Rules E4 and F1 are implicit in R1. */
@@ -5436,9 +5441,13 @@ sctp_disposition_t sctp_sf_t2_timer_expire(const struct sctp_endpoint *ep,
* If we remove the transport an SHUTDOWN was last sent to, don't
* do failure management.
*/
- if (asoc->shutdown_last_sent_to)
+ if (asoc->shutdown_last_sent_to) {
+ sctp_add_cmd_sf(commands, SCTP_CMD_PATH_FAILURE_DETECTION,
+ SCTP_TRANSPORT(asoc->shutdown_last_sent_to));
+
sctp_add_cmd_sf(commands, SCTP_CMD_STRIKE,
SCTP_TRANSPORT(asoc->shutdown_last_sent_to));
+ }
/* Set the transport for the SHUTDOWN/ACK chunk and the timeout for
* the T2-shutdown timer.
@@ -5475,9 +5484,12 @@ sctp_disposition_t sctp_sf_t4_timer_expire(
* detection on the appropriate destination address as defined in
* RFC2960 [5] section 8.1 and 8.2.
*/
- if (transport)
+ if (transport) {
+ sctp_add_cmd_sf(commands, SCTP_CMD_PATH_FAILURE_DETECTION,
+ SCTP_TRANSPORT(transport));
sctp_add_cmd_sf(commands, SCTP_CMD_STRIKE,
SCTP_TRANSPORT(transport));
+ }
/* Reconfig T4 timer and transport. */
sctp_add_cmd_sf(commands, SCTP_CMD_SETUP_T4, SCTP_CHUNK(chunk));
--
1.6.0.3
next reply other threads:[~2009-08-21 7:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-21 7:04 Chunbo Luo [this message]
2009-08-21 21:47 ` [PATCH] sctp: fix the check for path failure detection Vlad Yasevich
2009-08-24 2:15 ` Luo Chunbo
2009-08-24 7:54 ` Wei Yongjun
2009-08-24 9:35 ` Luo Chunbo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1250838275-7444-1-git-send-email-chunbo.luo@windriver.com \
--to=chunbo.luo@windriver.com \
--cc=chunbo.luo@windiriver.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).