Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Mar 2000 19:33:17 +0100
From:      =?iso-8859-1?Q?R=E9mi_Guyomarch?= <rguyom@mail.dotcom.fr>
To:        freebsd-net@FreeBSD.ORG
Cc:        Jonathan Lemon <jlemon@flugsvamp.com>, jayanth <jayanth@yahoo-inc.com>
Subject:   Re: TCP performance problems, Linux faster than FreeBSD ?
Message-ID:  <20000305193317.B22005@pingoo.ifn.fr>
In-Reply-To: <20000303165052.C23732@pingoo.ifn.fr>; from rguyom@mail.dotcom.fr on Fri, Mar 03, 2000 at 04:50:52PM %2B0100
References:  <20000303165052.C23732@pingoo.ifn.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 03, 2000 at 04:50:52PM +0100, Rémi Guyomarch wrote:
> 
> I have a problem with FreeBSD 3.4-STABLE. When I'm downloading from some
> sites I see a large number of duplicate packets comming in. If I download the
> same file(s) with a Linux 2.2.14 box, I don't see those duplicate packets.
> Well, a lot less I mean.

Ok, I think I've found something. I finally got the real difference
between the delayed acks implementation in Linux and *BSD stacks.

Linux sends an ack when the last non-acked packet is 200ms old, or if
there's two or more packets non-acked.
*BSD stacks just put a reference to delayed acks packets in a list, queue
or something, and read this list every 200 ms.

So, Linux use the time of the last non-acked packet as a starting
point for the 200ms timer, but *BSD stacks use a fixed 'clock'.
This is completely different !

I put an ugly hack in sys/netinet/tcp_timer.c to try to fix the
problem. And now I'm getting **way** less duplicate packets.

It's not very clear to me why sending fewer acks eliminates the
duplicate packet problem.  Maybe my 64k leased line isn't really
full-duplex (it's physically made of two wires, so it can't be really
full-duplex anyway). So sending an ack while a packet is received
cause some problems and some of my acks are lost in the process.


As I said, this patch is really ugly, this is just a proof that there
is a problem in the implementation of delayed acks in *BSD. Well, at
least I think so :-)

What do you think ?


(with this pactch, the kernel reads the delayed-ack list every 400ms
instead of 200)

void
tcp_fasttimo()
{
        register struct inpcb *inp;
        register struct tcpcb *tp;
        int s;
+       static char delay_delack = 1;

        if (tcp_delack_enabled) {
                s = splnet();
+               if( delay_delack )
+                       delay_delack = 0;
+               else {
                        for (inp = tcb.lh_first; inp != NULL; inp = inp->inp_list.le_next) {
                                if ((tp = (struct tcpcb *)inp->inp_ppcb) &&
                                    (tp->t_flags & TF_DELACK)) {
                                        tp->t_flags &= ~TF_DELACK;
                                        tp->t_flags |= TF_ACKNOW;
                                        tcpstat.tcps_delack++;
                                        (void) tcp_output(tp);
                                }
+                       delay_delack = 1;
+                       }
                }
                splx(s);
        }
}



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000305193317.B22005>