From: Neal Cardwell <ncardwell@google•com>
To: David Miller <davem@davemloft•net>
Cc: netdev@vger•kernel.org, Neal Cardwell <ncardwell@google•com>,
Yuchung Cheng <ycheng@google•com>,
Nandita Dukkipati <nanditad@google•com>
Subject: [PATCH net 1/3] tcp: introduce tcp_rto_delta_us() helper for xmit timer fix
Date: Mon, 31 Jul 2017 22:58:12 -0400 [thread overview]
Message-ID: <20170801025814.31206-2-ncardwell@google.com> (raw)
In-Reply-To: <20170801025814.31206-1-ncardwell@google.com>
Pure refactor. This helper will be required in the xmit timer fix
later in the patch series. (Because the TLP logic will want to make
this calculation.)
Fixes: 6ba8a3b19e76 ("tcp: Tail loss probe (TLP)")
Signed-off-by: Neal Cardwell <ncardwell@google•com>
Signed-off-by: Yuchung Cheng <ycheng@google•com>
Signed-off-by: Nandita Dukkipati <nanditad@google•com>
---
include/net/tcp.h | 10 ++++++++++
net/ipv4/tcp_input.c | 5 +----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 70483296157f..ada65e767b28 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1916,6 +1916,16 @@ extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
u64 xmit_time);
extern void tcp_rack_reo_timeout(struct sock *sk);
+/* At how many usecs into the future should the RTO fire? */
+static inline s64 tcp_rto_delta_us(const struct sock *sk)
+{
+ const struct sk_buff *skb = tcp_write_queue_head(sk);
+ u32 rto = inet_csk(sk)->icsk_rto;
+ u64 rto_time_stamp_us = skb->skb_mstamp + jiffies_to_usecs(rto);
+
+ return rto_time_stamp_us - tcp_sk(sk)->tcp_mstamp;
+}
+
/*
* Save and compile IPv4 options, return a pointer to it
*/
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2920e0cb09f8..345febf0a46e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3004,10 +3004,7 @@ void tcp_rearm_rto(struct sock *sk)
/* Offset the time elapsed after installing regular RTO */
if (icsk->icsk_pending == ICSK_TIME_REO_TIMEOUT ||
icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) {
- struct sk_buff *skb = tcp_write_queue_head(sk);
- u64 rto_time_stamp = skb->skb_mstamp +
- jiffies_to_usecs(rto);
- s64 delta_us = rto_time_stamp - tp->tcp_mstamp;
+ s64 delta_us = tcp_rto_delta_us(sk);
/* delta_us may not be positive if the socket is locked
* when the retrans timer fires and is rescheduled.
*/
--
2.14.0.rc0.400.g1c36432dff-goog
next prev parent reply other threads:[~2017-08-01 2:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 2:58 [PATCH net 0/3] tcp: fix xmit timer rearming to avoid stalls Neal Cardwell
2017-08-01 2:58 ` Neal Cardwell [this message]
2017-08-01 7:16 ` [PATCH net 1/3] tcp: introduce tcp_rto_delta_us() helper for xmit timer fix Eric Dumazet
2017-08-01 2:58 ` [PATCH net 2/3] tcp: enable xmit timer fix by having TLP use time when RTO should fire Neal Cardwell
2017-08-01 7:22 ` Eric Dumazet
2017-08-01 14:35 ` Neal Cardwell
2017-08-01 20:40 ` Eric Dumazet
2017-08-01 2:58 ` [PATCH net 3/3] tcp: fix xmit timer to only be reset if data ACKed/SACKed Neal Cardwell
2017-08-01 7:25 ` Eric Dumazet
2017-08-01 12:20 ` maowenan
2017-08-01 14:24 ` Neal Cardwell
2017-08-04 7:12 ` maowenan
2017-08-04 15:54 ` Neal Cardwell
2017-08-04 7:33 ` maowenan
2017-08-04 16:59 ` Neal Cardwell
2017-08-04 17:10 ` Willy Tarreau
2017-08-04 18:01 ` Neal Cardwell
2017-08-04 18:18 ` Willy Tarreau
2017-08-06 7:39 ` maowenan
2017-08-06 7:44 ` Willy Tarreau
2017-08-06 15:21 ` Neal Cardwell
2017-08-06 15:24 ` Neal Cardwell
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=20170801025814.31206-2-ncardwell@google.com \
--to=ncardwell@google$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=nanditad@google$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=ycheng@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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