Commit 245cba7e authored by Vlad Yasevich's avatar Vlad Yasevich

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: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
parent a242b41d
...@@ -950,12 +950,6 @@ struct sctp_transport { ...@@ -950,12 +950,6 @@ struct sctp_transport {
/* Source address. */ /* Source address. */
union sctp_addr saddr; union sctp_addr saddr;
/* When was the last time(in jiffies) that a data packet was sent on
* this transport? This is used to adjust the cwnd when the transport
* becomes inactive.
*/
unsigned long last_time_used;
/* Heartbeat interval: The endpoint sends out a Heartbeat chunk to /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
* the destination address every heartbeat interval. * the destination address every heartbeat interval.
*/ */
......
...@@ -557,8 +557,6 @@ int sctp_packet_transmit(struct sctp_packet *packet) ...@@ -557,8 +557,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
struct timer_list *timer; struct timer_list *timer;
unsigned long timeout; unsigned long timeout;
tp->last_time_used = jiffies;
/* Restart the AUTOCLOSE timer when sending data. */ /* Restart the AUTOCLOSE timer when sending data. */
if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) { if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) {
timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE]; timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE];
......
...@@ -996,14 +996,15 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep, ...@@ -996,14 +996,15 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
sctp_sf_heartbeat(ep, asoc, type, arg, sctp_sf_heartbeat(ep, asoc, type, arg,
commands)) commands))
return SCTP_DISPOSITION_NOMEM; return SCTP_DISPOSITION_NOMEM;
/* Set transport error counter and association error counter /* Set transport error counter and association error counter
* when sending heartbeat. * when sending heartbeat.
*/ */
sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_IDLE,
SCTP_TRANSPORT(transport));
sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT, sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT,
SCTP_TRANSPORT(transport)); SCTP_TRANSPORT(transport));
} }
sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_IDLE,
SCTP_TRANSPORT(transport));
sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE, sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE,
SCTP_TRANSPORT(transport)); SCTP_TRANSPORT(transport));
......
...@@ -83,7 +83,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, ...@@ -83,7 +83,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
peer->fast_recovery = 0; peer->fast_recovery = 0;
peer->last_time_heard = jiffies; peer->last_time_heard = jiffies;
peer->last_time_used = jiffies;
peer->last_time_ecne_reduced = jiffies; peer->last_time_ecne_reduced = jiffies;
peer->init_sent_count = 0; peer->init_sent_count = 0;
...@@ -565,10 +564,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, ...@@ -565,10 +564,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
* to be done every RTO interval, we do it every hearbeat * to be done every RTO interval, we do it every hearbeat
* interval. * interval.
*/ */
if (time_after(jiffies, transport->last_time_used + transport->cwnd = max(transport->cwnd/2,
transport->rto)) 4*transport->asoc->pathmtu);
transport->cwnd = max(transport->cwnd/2,
4*transport->asoc->pathmtu);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment