Skip to content

Commit 4929c94

Browse files
Deepti Raghavandavem330
authored andcommitted
tcp: expose both send and receive intervals for rate sample
Congestion control algorithms, which access the rate sample through the tcp_cong_control function, only have access to the maximum of the send and receive interval, for cases where the acknowledgment rate may be inaccurate due to ACK compression or decimation. Algorithms may want to use send rates and receive rates as separate signals. Signed-off-by: Deepti Raghavan <deeptir@mit.edu> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e0479b6 commit 4929c94

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

include/net/tcp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,8 @@ struct rate_sample {
954954
u32 prior_delivered; /* tp->delivered at "prior_mstamp" */
955955
s32 delivered; /* number of packets delivered over interval */
956956
long interval_us; /* time for tp->delivered to incr "delivered" */
957+
u32 snd_interval_us; /* snd interval for delivered packets */
958+
u32 rcv_interval_us; /* rcv interval for delivered packets */
957959
long rtt_us; /* RTT of last (S)ACKed packet (or -1) */
958960
int losses; /* number of packets marked lost upon ACK */
959961
u32 acked_sacked; /* number of packets newly (S)ACKed upon ACK */

net/ipv4/tcp_rate.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost,
146146
rs->prior_mstamp); /* ack phase */
147147
rs->interval_us = max(snd_us, ack_us);
148148

149+
/* Record both segment send and ack receive intervals */
150+
rs->snd_interval_us = snd_us;
151+
rs->rcv_interval_us = ack_us;
152+
149153
/* Normally we expect interval_us >= min-rtt.
150154
* Note that rate may still be over-estimated when a spuriously
151155
* retransmistted skb was first (s)acked because "interval_us"

0 commit comments

Comments
 (0)