aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/tcp.h14
-rw-r--r--net/ipv4/tcp_input.c13
2 files changed, 14 insertions, 13 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5c472f255b77..572a77bb6907 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -341,6 +341,7 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
341extern int tcp_child_process(struct sock *parent, 341extern int tcp_child_process(struct sock *parent,
342 struct sock *child, 342 struct sock *child,
343 struct sk_buff *skb); 343 struct sk_buff *skb);
344extern int tcp_use_frto(const struct sock *sk);
344extern void tcp_enter_frto(struct sock *sk); 345extern void tcp_enter_frto(struct sock *sk);
345extern void tcp_enter_loss(struct sock *sk, int how); 346extern void tcp_enter_loss(struct sock *sk, int how);
346extern void tcp_clear_retrans(struct tcp_sock *tp); 347extern void tcp_clear_retrans(struct tcp_sock *tp);
@@ -1033,19 +1034,6 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1033 1034
1034#define TCP_CHECK_TIMER(sk) do { } while (0) 1035#define TCP_CHECK_TIMER(sk) do { } while (0)
1035 1036
1036static inline int tcp_use_frto(const struct sock *sk)
1037{
1038 const struct tcp_sock *tp = tcp_sk(sk);
1039
1040 /* F-RTO must be activated in sysctl and there must be some
1041 * unsent new data, and the advertised window should allow
1042 * sending it.
1043 */
1044 return (sysctl_tcp_frto && sk->sk_send_head &&
1045 !after(TCP_SKB_CB(sk->sk_send_head)->end_seq,
1046 tp->snd_una + tp->snd_wnd));
1047}
1048
1049static inline void tcp_mib_init(void) 1037static inline void tcp_mib_init(void)
1050{ 1038{
1051 /* See RFC 2012 */ 1039 /* See RFC 2012 */
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index c5be3d0465f5..fe96e176d85a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1236,6 +1236,19 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1236 return flag; 1236 return flag;
1237} 1237}
1238 1238
1239int tcp_use_frto(const struct sock *sk)
1240{
1241 const struct tcp_sock *tp = tcp_sk(sk);
1242
1243 /* F-RTO must be activated in sysctl and there must be some
1244 * unsent new data, and the advertised window should allow
1245 * sending it.
1246 */
1247 return (sysctl_tcp_frto && sk->sk_send_head &&
1248 !after(TCP_SKB_CB(sk->sk_send_head)->end_seq,
1249 tp->snd_una + tp->snd_wnd));
1250}
1251
1239/* RTO occurred, but do not yet enter loss state. Instead, transmit two new 1252/* RTO occurred, but do not yet enter loss state. Instead, transmit two new
1240 * segments to see from the next ACKs whether any data was really missing. 1253 * segments to see from the next ACKs whether any data was really missing.
1241 * If the RTO was spurious, new ACKs should arrive. 1254 * If the RTO was spurious, new ACKs should arrive.