From: Damian Lukowski <damian@tvk.rwth-aachen.de>
To: Netdev <netdev@vger.kernel.org>
Subject: [PATCH 1/2] RTO connection timeout: coding style fixes and comments
Date: Tue, 01 Sep 2009 22:24:00 +0200 [thread overview]
Message-ID: <4A9D82E0.1050200@tvk.rwth-aachen.de> (raw)
This patch affects the retransmits_timed_out() function.
Changes:
1) Variables have more meaningful names
2) retransmits_timed_out() has an introductionary comment.
3) Small coding style changes.
Signed-off-by: Damian Lukowski <damian@tvk.rwth-aachen.de>
---
include/net/tcp.h | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e531949..df50bc4 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1252,22 +1252,27 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
+/* This function calculates a "timeout" which is equivalent to the timeout of a
+ * TCP connection after "boundary" unsucessful, exponentially backed-off
+ * retransmissions with an initial RTO of TCP_RTO_MIN.
+ */
static inline bool retransmits_timed_out(const struct sock *sk,
unsigned int boundary)
{
- int limit, K;
+ unsigned int timeout, linear_backoff_thresh;
+
if (!inet_csk(sk)->icsk_retransmits)
return false;
- K = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
+ linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
- if (boundary <= K)
- limit = ((2 << boundary) - 1) * TCP_RTO_MIN;
+ if (boundary <= linear_backoff_thresh)
+ timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
else
- limit = ((2 << K) - 1) * TCP_RTO_MIN +
- (boundary - K) * TCP_RTO_MAX;
+ timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
+ (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
- return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= limit;
+ return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
}
static inline struct sk_buff *tcp_send_head(struct sock *sk)
--
1.6.3.3
reply other threads:[~2009-09-01 20:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4A9D82E0.1050200@tvk.rwth-aachen.de \
--to=damian@tvk.rwth-aachen.de \
--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