diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2009-11-23 15:53:58 -0500 |
---|---|---|
committer | Vlad Yasevich <vladislav.yasevich@hp.com> | 2009-11-23 15:53:58 -0500 |
commit | 245cba7e55929dc2b10b7d915bfba0168eeeed17 (patch) | |
tree | 768264e6c1666552ba30cf7849ef4a5c1549a6e5 | |
parent | a242b41dedfe0fd51ab1c906daa703c09b196744 (diff) |
sctp: Remove useless last_time_used variable
The transport last_time_used variable is rather useless.
It was only used when determining if CWND needs to be updated
due to idle transport. However, idle transport detection was
based on a Heartbeat timer and last_time_used was not incremented
when sending Heartbeats. As a result the check for cwnd reduction
was always true. We can get rid of the variable and just base
our cwnd manipulation on the HB timer (like the code comment sais).
We also have to call into the cwnd manipulation function regardless
of whether HBs are enabled or not. That way we will detect idle
transports if the user has disabled Heartbeats.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
-rw-r--r-- | include/net/sctp/structs.h | 6 | ||||
-rw-r--r-- | net/sctp/output.c | 2 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 5 | ||||
-rw-r--r-- | net/sctp/transport.c | 7 |
4 files changed, 5 insertions, 15 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 90876b657775..ac794a6823eb 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -950,12 +950,6 @@ struct sctp_transport { | |||
950 | /* Source address. */ | 950 | /* Source address. */ |
951 | union sctp_addr saddr; | 951 | union sctp_addr saddr; |
952 | 952 | ||
953 | /* When was the last time(in jiffies) that a data packet was sent on | ||
954 | * this transport? This is used to adjust the cwnd when the transport | ||
955 | * becomes inactive. | ||
956 | */ | ||
957 | unsigned long last_time_used; | ||
958 | |||
959 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to | 953 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to |
960 | * the destination address every heartbeat interval. | 954 | * the destination address every heartbeat interval. |
961 | */ | 955 | */ |
diff --git a/net/sctp/output.c b/net/sctp/output.c index 5cbda8f1ddfd..9e8e0ea844be 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -557,8 +557,6 @@ int sctp_packet_transmit(struct sctp_packet *packet) | |||
557 | struct timer_list *timer; | 557 | struct timer_list *timer; |
558 | unsigned long timeout; | 558 | unsigned long timeout; |
559 | 559 | ||
560 | tp->last_time_used = jiffies; | ||
561 | |||
562 | /* Restart the AUTOCLOSE timer when sending data. */ | 560 | /* Restart the AUTOCLOSE timer when sending data. */ |
563 | if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) { | 561 | if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) { |
564 | timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE]; | 562 | timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE]; |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 16a603527df2..1ef9de9bbae9 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -996,14 +996,15 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep, | |||
996 | sctp_sf_heartbeat(ep, asoc, type, arg, | 996 | sctp_sf_heartbeat(ep, asoc, type, arg, |
997 | commands)) | 997 | commands)) |
998 | return SCTP_DISPOSITION_NOMEM; | 998 | return SCTP_DISPOSITION_NOMEM; |
999 | |||
999 | /* Set transport error counter and association error counter | 1000 | /* Set transport error counter and association error counter |
1000 | * when sending heartbeat. | 1001 | * when sending heartbeat. |
1001 | */ | 1002 | */ |
1002 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_IDLE, | ||
1003 | SCTP_TRANSPORT(transport)); | ||
1004 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT, | 1003 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT, |
1005 | SCTP_TRANSPORT(transport)); | 1004 | SCTP_TRANSPORT(transport)); |
1006 | } | 1005 | } |
1006 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_IDLE, | ||
1007 | SCTP_TRANSPORT(transport)); | ||
1007 | sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE, | 1008 | sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE, |
1008 | SCTP_TRANSPORT(transport)); | 1009 | SCTP_TRANSPORT(transport)); |
1009 | 1010 | ||
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 3b141bb32faf..2df29cbdaf5a 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -83,7 +83,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
83 | peer->fast_recovery = 0; | 83 | peer->fast_recovery = 0; |
84 | 84 | ||
85 | peer->last_time_heard = jiffies; | 85 | peer->last_time_heard = jiffies; |
86 | peer->last_time_used = jiffies; | ||
87 | peer->last_time_ecne_reduced = jiffies; | 86 | peer->last_time_ecne_reduced = jiffies; |
88 | 87 | ||
89 | peer->init_sent_count = 0; | 88 | peer->init_sent_count = 0; |
@@ -565,10 +564,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, | |||
565 | * to be done every RTO interval, we do it every hearbeat | 564 | * to be done every RTO interval, we do it every hearbeat |
566 | * interval. | 565 | * interval. |
567 | */ | 566 | */ |
568 | if (time_after(jiffies, transport->last_time_used + | 567 | transport->cwnd = max(transport->cwnd/2, |
569 | transport->rto)) | 568 | 4*transport->asoc->pathmtu); |
570 | transport->cwnd = max(transport->cwnd/2, | ||
571 | 4*transport->asoc->pathmtu); | ||
572 | break; | 569 | break; |
573 | } | 570 | } |
574 | 571 | ||