Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+5 -15
-6
include/net/sctp/structs.h
··· 950 950 /* Source address. */ 951 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 953 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 960 954 * the destination address every heartbeat interval. 961 955 */
-2
net/sctp/output.c
··· 557 557 struct timer_list *timer; 558 558 unsigned long timeout; 559 559 560 - tp->last_time_used = jiffies; 561 - 562 560 /* Restart the AUTOCLOSE timer when sending data. */ 563 561 if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) { 564 562 timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE];
+3 -2
net/sctp/sm_statefuns.c
··· 996 996 sctp_sf_heartbeat(ep, asoc, type, arg, 997 997 commands)) 998 998 return SCTP_DISPOSITION_NOMEM; 999 + 999 1000 /* Set transport error counter and association error counter 1000 1001 * when sending heartbeat. 1001 1002 */ 1002 - sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_IDLE, 1003 - SCTP_TRANSPORT(transport)); 1004 1003 sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT, 1005 1004 SCTP_TRANSPORT(transport)); 1006 1005 } 1006 + sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_IDLE, 1007 + SCTP_TRANSPORT(transport)); 1007 1008 sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE, 1008 1009 SCTP_TRANSPORT(transport)); 1009 1010
+2 -5
net/sctp/transport.c
··· 83 83 peer->fast_recovery = 0; 84 84 85 85 peer->last_time_heard = jiffies; 86 - peer->last_time_used = jiffies; 87 86 peer->last_time_ecne_reduced = jiffies; 88 87 89 88 peer->init_sent_count = 0; ··· 564 565 * to be done every RTO interval, we do it every hearbeat 565 566 * interval. 566 567 */ 567 - if (time_after(jiffies, transport->last_time_used + 568 - transport->rto)) 569 - transport->cwnd = max(transport->cwnd/2, 570 - 4*transport->asoc->pathmtu); 568 + transport->cwnd = max(transport->cwnd/2, 569 + 4*transport->asoc->pathmtu); 571 570 break; 572 571 } 573 572