From 3da5017f333a977a26f5020455a93d26e777f329 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sun, 11 Jun 2006 23:01:02 -0700 Subject: [PATCH] --- yaml --- r: 27571 b: refs/heads/master c: f61e29018a30c738e1298e1b13be956aa17ee17b h: refs/heads/master i: 27569: 2be5c6bd355abb7eea1c42ae8527c80319c6f4ea 27567: 8cc3544335780a48d39776492d5511eadb27644b v: v3 --- [refs] | 2 +- trunk/net/ipv4/tcp_westwood.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index eab013308847..1c255d35e8ce 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bdeb04c6d9a957ae2a51c3033414467b82b2a736 +refs/heads/master: f61e29018a30c738e1298e1b13be956aa17ee17b diff --git a/trunk/net/ipv4/tcp_westwood.c b/trunk/net/ipv4/tcp_westwood.c index 29eb258b6d82..62a96b71b0dd 100644 --- a/trunk/net/ipv4/tcp_westwood.c +++ b/trunk/net/ipv4/tcp_westwood.c @@ -22,6 +22,7 @@ struct westwood { u32 accounted; u32 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) 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; } /* @@ -91,6 +93,15 @@ static void westwood_update_window(struct sock *sk) struct westwood *w = inet_csk_ca(sk); 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. * 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) { struct tcp_sock *tp = tcp_sk(sk); struct westwood *w = inet_csk_ca(sk); - + switch(event) { case CA_EVENT_FAST_ACK: westwood_fast_bw(sk);