diff mbox series

[net-next,2/3] tcp: make tcp_send_loss_probe() boolean

Message ID 20191022231051.30770-3-xiyou.wangcong@gmail.com
State Deferred
Delegated to: David Miller
Headers show
Series tcp: decouple TLP timer from RTO timer | expand

Commit Message

Cong Wang Oct. 22, 2019, 11:10 p.m. UTC
Let tcp_send_loss_probe() return whether a TLP has been
sent or not. This is needed by the folllowing patch.

Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 include/net/tcp.h     | 2 +-
 net/ipv4/tcp_output.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/net/tcp.h b/include/net/tcp.h
index ab4eb5eb5d07..0ee5400e751c 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -581,7 +581,7 @@  void tcp_push_one(struct sock *, unsigned int mss_now);
 void __tcp_send_ack(struct sock *sk, u32 rcv_nxt);
 void tcp_send_ack(struct sock *sk);
 void tcp_send_delayed_ack(struct sock *sk);
-void tcp_send_loss_probe(struct sock *sk);
+bool tcp_send_loss_probe(struct sock *sk);
 bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto);
 void tcp_skb_collapse_tstamp(struct sk_buff *skb,
 			     const struct sk_buff *next_skb);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 0488607c5cd3..9822820edca4 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2539,12 +2539,13 @@  static bool skb_still_in_host_queue(const struct sock *sk,
 /* When probe timeout (PTO) fires, try send a new segment if possible, else
  * retransmit the last segment.
  */
-void tcp_send_loss_probe(struct sock *sk)
+bool tcp_send_loss_probe(struct sock *sk)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct sk_buff *skb;
 	int pcount;
 	int mss = tcp_current_mss(sk);
+	bool sent = false;
 
 	skb = tcp_send_head(sk);
 	if (skb && tcp_snd_wnd_test(tp, skb, mss)) {
@@ -2560,7 +2561,7 @@  void tcp_send_loss_probe(struct sock *sk)
 			  "invalid inflight: %u state %u cwnd %u mss %d\n",
 			  tp->packets_out, sk->sk_state, tp->snd_cwnd, mss);
 		inet_csk(sk)->icsk_pending = 0;
-		return;
+		return false;
 	}
 
 	/* At most one outstanding TLP retransmission. */
@@ -2592,11 +2593,13 @@  void tcp_send_loss_probe(struct sock *sk)
 	tp->tlp_high_seq = tp->snd_nxt;
 
 probe_sent:
+	sent = true;
 	NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSPROBES);
 	/* Reset s.t. tcp_rearm_rto will restart timer from now */
 	inet_csk(sk)->icsk_pending = 0;
 rearm_timer:
 	tcp_rearm_rto(sk);
+	return sent;
 }
 
 /* Push out any pending frames which were held back due to