diff options
Diffstat (limited to 'net/ipv4/tcp_yeah.h')
-rw-r--r-- | net/ipv4/tcp_yeah.h | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/net/ipv4/tcp_yeah.h b/net/ipv4/tcp_yeah.h index 33ad5385c188..ed3b7198f23c 100644 --- a/net/ipv4/tcp_yeah.h +++ b/net/ipv4/tcp_yeah.h | |||
@@ -5,134 +5,3 @@ | |||
5 | #include <asm/div64.h> | 5 | #include <asm/div64.h> |
6 | 6 | ||
7 | #include <net/tcp.h> | 7 | #include <net/tcp.h> |
8 | |||
9 | /* Vegas variables */ | ||
10 | struct vegas { | ||
11 | u32 beg_snd_nxt; /* right edge during last RTT */ | ||
12 | u32 beg_snd_una; /* left edge during last RTT */ | ||
13 | u32 beg_snd_cwnd; /* saves the size of the cwnd */ | ||
14 | u8 doing_vegas_now;/* if true, do vegas for this RTT */ | ||
15 | u16 cntRTT; /* # of RTTs measured within last RTT */ | ||
16 | u32 minRTT; /* min of RTTs measured within last RTT (in usec) */ | ||
17 | u32 baseRTT; /* the min of all Vegas RTT measurements seen (in usec) */ | ||
18 | }; | ||
19 | |||
20 | /* There are several situations when we must "re-start" Vegas: | ||
21 | * | ||
22 | * o when a connection is established | ||
23 | * o after an RTO | ||
24 | * o after fast recovery | ||
25 | * o when we send a packet and there is no outstanding | ||
26 | * unacknowledged data (restarting an idle connection) | ||
27 | * | ||
28 | * In these circumstances we cannot do a Vegas calculation at the | ||
29 | * end of the first RTT, because any calculation we do is using | ||
30 | * stale info -- both the saved cwnd and congestion feedback are | ||
31 | * stale. | ||
32 | * | ||
33 | * Instead we must wait until the completion of an RTT during | ||
34 | * which we actually receive ACKs. | ||
35 | */ | ||
36 | static inline void vegas_enable(struct sock *sk) | ||
37 | { | ||
38 | const struct tcp_sock *tp = tcp_sk(sk); | ||
39 | struct vegas *vegas = inet_csk_ca(sk); | ||
40 | |||
41 | /* Begin taking Vegas samples next time we send something. */ | ||
42 | vegas->doing_vegas_now = 1; | ||
43 | |||
44 | /* Set the beginning of the next send window. */ | ||
45 | vegas->beg_snd_nxt = tp->snd_nxt; | ||
46 | |||
47 | vegas->cntRTT = 0; | ||
48 | vegas->minRTT = 0x7fffffff; | ||
49 | } | ||
50 | |||
51 | /* Stop taking Vegas samples for now. */ | ||
52 | static inline void vegas_disable(struct sock *sk) | ||
53 | { | ||
54 | struct vegas *vegas = inet_csk_ca(sk); | ||
55 | |||
56 | vegas->doing_vegas_now = 0; | ||
57 | } | ||
58 | |||
59 | static void tcp_vegas_init(struct sock *sk) | ||
60 | { | ||
61 | struct vegas *vegas = inet_csk_ca(sk); | ||
62 | |||
63 | vegas->baseRTT = 0x7fffffff; | ||
64 | vegas_enable(sk); | ||
65 | } | ||
66 | |||
67 | static void tcp_vegas_state(struct sock *sk, u8 ca_state) | ||
68 | { | ||
69 | |||
70 | if (ca_state == TCP_CA_Open) | ||
71 | vegas_enable(sk); | ||
72 | else | ||
73 | vegas_disable(sk); | ||
74 | } | ||
75 | |||
76 | /* Do RTT sampling needed for Vegas. | ||
77 | * Basically we: | ||
78 | * o min-filter RTT samples from within an RTT to get the current | ||
79 | * propagation delay + queuing delay (we are min-filtering to try to | ||
80 | * avoid the effects of delayed ACKs) | ||
81 | * o min-filter RTT samples from a much longer window (forever for now) | ||
82 | * to find the propagation delay (baseRTT) | ||
83 | */ | ||
84 | static void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) | ||
85 | { | ||
86 | struct vegas *vegas = inet_csk_ca(sk); | ||
87 | u32 vrtt; | ||
88 | |||
89 | /* Never allow zero rtt or baseRTT */ | ||
90 | vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1; | ||
91 | |||
92 | /* Filter to find propagation delay: */ | ||
93 | if (vrtt < vegas->baseRTT) | ||
94 | vegas->baseRTT = vrtt; | ||
95 | |||
96 | /* Find the min RTT during the last RTT to find | ||
97 | * the current prop. delay + queuing delay: | ||
98 | */ | ||
99 | vegas->minRTT = min(vegas->minRTT, vrtt); | ||
100 | vegas->cntRTT++; | ||
101 | } | ||
102 | |||
103 | /* | ||
104 | * If the connection is idle and we are restarting, | ||
105 | * then we don't want to do any Vegas calculations | ||
106 | * until we get fresh RTT samples. So when we | ||
107 | * restart, we reset our Vegas state to a clean | ||
108 | * slate. After we get acks for this flight of | ||
109 | * packets, _then_ we can make Vegas calculations | ||
110 | * again. | ||
111 | */ | ||
112 | static void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event) | ||
113 | { | ||
114 | if (event == CA_EVENT_CWND_RESTART || | ||
115 | event == CA_EVENT_TX_START) | ||
116 | tcp_vegas_init(sk); | ||
117 | } | ||
118 | |||
119 | /* Extract info for Tcp socket info provided via netlink. */ | ||
120 | static void tcp_vegas_get_info(struct sock *sk, u32 ext, | ||
121 | struct sk_buff *skb) | ||
122 | { | ||
123 | const struct vegas *ca = inet_csk_ca(sk); | ||
124 | if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { | ||
125 | struct tcpvegas_info *info; | ||
126 | |||
127 | info = RTA_DATA(__RTA_PUT(skb, INET_DIAG_VEGASINFO, | ||
128 | sizeof(*info))); | ||
129 | |||
130 | info->tcpv_enabled = ca->doing_vegas_now; | ||
131 | info->tcpv_rttcnt = ca->cntRTT; | ||
132 | info->tcpv_rtt = ca->baseRTT; | ||
133 | info->tcpv_minrtt = ca->minRTT; | ||
134 | rtattr_failure: ; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | |||