aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@dxpl.pdx.osdl.net>2006-06-12 02:01:02 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-18 00:30:32 -0400
commitf61e29018a30c738e1298e1b13be956aa17ee17b (patch)
tree1ea51ae6fd477d9e3271d8eb8b2cec24f6fa39b2 /net/ipv4
parentbdeb04c6d9a957ae2a51c3033414467b82b2a736 (diff)
[TCP] Westwood: fix first sample
Need to update send sequence number tracking after first ack. Rework of patch from Luca De Cicco. Signed-off-by: Stephen Hemminger <shemminger@dxpl.pdx.osdl.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_westwood.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c
index 29eb258b6d82..62a96b71b0dd 100644
--- a/net/ipv4/tcp_westwood.c
+++ b/net/ipv4/tcp_westwood.c
@@ -22,6 +22,7 @@ struct westwood {
22 u32 accounted; 22 u32 accounted;
23 u32 rtt; 23 u32 rtt;
24 u32 rtt_min; /* minimum observed RTT */ 24 u32 rtt_min; /* minimum observed RTT */
25 u8 first_ack; /* flag which infers that this is the first ack */
25}; 26};
26 27
27 28
@@ -52,6 +53,7 @@ static void tcp_westwood_init(struct sock *sk)
52 w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT; 53 w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT;
53 w->rtt_win_sx = tcp_time_stamp; 54 w->rtt_win_sx = tcp_time_stamp;
54 w->snd_una = tcp_sk(sk)->snd_una; 55 w->snd_una = tcp_sk(sk)->snd_una;
56 w->first_ack = 1;
55} 57}
56 58
57/* 59/*
@@ -91,6 +93,15 @@ static void westwood_update_window(struct sock *sk)
91 struct westwood *w = inet_csk_ca(sk); 93 struct westwood *w = inet_csk_ca(sk);
92 s32 delta = tcp_time_stamp - w->rtt_win_sx; 94 s32 delta = tcp_time_stamp - w->rtt_win_sx;
93 95
96 /* Initialise w->snd_una with the first acked sequence number in order
97 * to fix mismatch between tp->snd_una and w->snd_una for the first
98 * bandwidth sample
99 */
100 if (w->first_ack) {
101 w->snd_una = tcp_sk(sk)->snd_una;
102 w->first_ack = 0;
103 }
104
94 /* 105 /*
95 * See if a RTT-window has passed. 106 * See if a RTT-window has passed.
96 * Be careful since if RTT is less than 107 * Be careful since if RTT is less than
@@ -180,7 +191,7 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event)
180{ 191{
181 struct tcp_sock *tp = tcp_sk(sk); 192 struct tcp_sock *tp = tcp_sk(sk);
182 struct westwood *w = inet_csk_ca(sk); 193 struct westwood *w = inet_csk_ca(sk);
183 194
184 switch(event) { 195 switch(event) {
185 case CA_EVENT_FAST_ACK: 196 case CA_EVENT_FAST_ACK:
186 westwood_fast_bw(sk); 197 westwood_fast_bw(sk);