Commit f61e2901 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[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: default avatarStephen Hemminger <shemminger@dxpl.pdx.osdl.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bdeb04c6
...@@ -22,6 +22,7 @@ struct westwood { ...@@ -22,6 +22,7 @@ struct westwood {
u32 accounted; u32 accounted;
u32 rtt; u32 rtt;
u32 rtt_min; /* minimum observed RTT */ u32 rtt_min; /* minimum observed RTT */
u8 first_ack; /* flag which infers that this is the first ack */
}; };
...@@ -52,6 +53,7 @@ static void tcp_westwood_init(struct sock *sk) ...@@ -52,6 +53,7 @@ static void tcp_westwood_init(struct sock *sk)
w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT; w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT;
w->rtt_win_sx = tcp_time_stamp; w->rtt_win_sx = tcp_time_stamp;
w->snd_una = tcp_sk(sk)->snd_una; w->snd_una = tcp_sk(sk)->snd_una;
w->first_ack = 1;
} }
/* /*
...@@ -91,6 +93,15 @@ static void westwood_update_window(struct sock *sk) ...@@ -91,6 +93,15 @@ static void westwood_update_window(struct sock *sk)
struct westwood *w = inet_csk_ca(sk); struct westwood *w = inet_csk_ca(sk);
s32 delta = tcp_time_stamp - w->rtt_win_sx; s32 delta = tcp_time_stamp - w->rtt_win_sx;
/* Initialise w->snd_una with the first acked sequence number in order
* to fix mismatch between tp->snd_una and w->snd_una for the first
* bandwidth sample
*/
if (w->first_ack) {
w->snd_una = tcp_sk(sk)->snd_una;
w->first_ack = 0;
}
/* /*
* See if a RTT-window has passed. * See if a RTT-window has passed.
* Be careful since if RTT is less than * Be careful since if RTT is less than
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment