Index: ipv4/tcp_westwood.c =================================================================== --- ipv4.orig/tcp_westwood.c 2006-06-06 18:08:03.000000000 +0200 +++ ipv4/tcp_westwood.c 2006-06-06 18:09:44.000000000 +0200 @@ -22,6 +22,7 @@ u32 accounted; u32 rtt; u32 rtt_min; /* minimum observed RTT */ + u16 first_ack; /* flag which infers that this is the first ack */ }; @@ -52,6 +53,7 @@ w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT; w->rtt_win_sx = tcp_time_stamp; w->snd_una = tcp_sk(sk)->snd_una; + w->first_ack = 1; } /* @@ -184,6 +186,15 @@ { struct tcp_sock *tp = tcp_sk(sk); struct westwood *w = inet_csk_ca(sk); + + /* Initialise w->snd_una with the first acked sequence number in oder + * to fix mismatch between tp->snd_una and w->snd_una for the first + * bandwidth sample + */ + if(w->first_ack && (event == CA_EVENT_FAST_ACK||event == CA_EVENT_SLOW_ACK)) { + w->snd_una = tp->snd_una; + w->first_ack = 0; + } switch(event) { case CA_EVENT_FAST_ACK: