Yuchung Cheng | 659a8ad | 2015-10-16 21:57:46 -0700 | [diff] [blame^] | 1 | #include <linux/tcp.h> |
| 2 | #include <net/tcp.h> |
| 3 | |
| 4 | /* Record the most recently (re)sent time among the (s)acked packets */ |
| 5 | void tcp_rack_advance(struct tcp_sock *tp, |
| 6 | const struct skb_mstamp *xmit_time, u8 sacked) |
| 7 | { |
| 8 | if (tp->rack.mstamp.v64 && |
| 9 | !skb_mstamp_after(xmit_time, &tp->rack.mstamp)) |
| 10 | return; |
| 11 | |
| 12 | if (sacked & TCPCB_RETRANS) { |
| 13 | struct skb_mstamp now; |
| 14 | |
| 15 | /* If the sacked packet was retransmitted, it's ambiguous |
| 16 | * whether the retransmission or the original (or the prior |
| 17 | * retransmission) was sacked. |
| 18 | * |
| 19 | * If the original is lost, there is no ambiguity. Otherwise |
| 20 | * we assume the original can be delayed up to aRTT + min_rtt. |
| 21 | * the aRTT term is bounded by the fast recovery or timeout, |
| 22 | * so it's at least one RTT (i.e., retransmission is at least |
| 23 | * an RTT later). |
| 24 | */ |
| 25 | skb_mstamp_get(&now); |
| 26 | if (skb_mstamp_us_delta(&now, xmit_time) < tcp_min_rtt(tp)) |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | tp->rack.mstamp = *xmit_time; |
| 31 | tp->rack.advanced = 1; |
| 32 | } |