Thread (9 messages) flat view 9 messages, 2 authors, 2017-10-15

Re: [RFC PATCH v2 2/5] tcp: implemented pacing_expired

From: Eric Dumazet <hidden>
Date: 2017-10-15 17:30:51

On Sat, 2017-10-14 at 13:47 +0200, Natale Patriciello wrote:
quoted hunk ↗ jump to hunk
Inform the congestion control that the pacing timer, previously set,
has expired. The commit does not consider situations in which another
kind of timer has expired (e.g., a tail loss probe, a retransmission
timer...)

Signed-off-by: Natale Patriciello <redacted>
---
 include/net/tcp.h     | 2 ++
 net/ipv4/tcp_output.c | 6 ++++++
 2 files changed, 8 insertions(+)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 42c7aa96c4cf..e817f0669d0e 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1017,6 +1017,8 @@ struct tcp_congestion_ops {
 			   union tcp_cc_info *info);
 	/* get the expiration time for the pacing timer (optional) */
 	u64 (*get_pacing_time)(struct sock *sk);
+	/* the pacing timer is expired (optional) */
+	void (*pacing_timer_expired)(struct sock *sk);
 
 	char 		name[TCP_CA_NAME_MAX];
 	struct module 	*owner;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index ec5977156c26..25b4cf0802f2 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2241,6 +2241,7 @@ void tcp_chrono_stop(struct sock *sk, const enum tcp_chrono type)
 static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
 			   int push_one, gfp_t gfp)
 {
+	const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops;
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct sk_buff *skb;
 	unsigned int tso_segs, sent_pkts;
@@ -2263,6 +2264,11 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
 
 	max_segs = tcp_tso_segs(sk, mss_now);
 	tcp_mstamp_refresh(tp);
+
+	if (!tcp_pacing_timer_check(sk) &&
+	    ca_ops && ca_ops->pacing_timer_expired)
+		ca_ops->pacing_timer_expired(sk);
+
 
1) We do not want hrtimer_active() being called for each
tcp_write_xmit() ... :/

2) ca_ops can not be NULL.


->
       if (ca_ops->pacing_timer_expired && !tcp_pacing_timer_check(sk))
               ca_ops->pacing_timer_expired(sk);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help