From owner-freebsd-net Sun Mar 5 10:33:29 2000 Delivered-To: freebsd-net@freebsd.org Received: from quercus.ifn.fr (mailhost.ifn.fr [62.161.215.67]) by hub.freebsd.org (Postfix) with ESMTP id E8A1B37BA6D for ; Sun, 5 Mar 2000 10:33:24 -0800 (PST) (envelope-from rguyom@mail.dotcom.fr) Received: from pingoo.ifn.fr ([192.9.200.33]) by quercus.ifn.fr with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2232.9) id FLZQQKGY; Sun, 5 Mar 2000 19:33:22 +0100 Received: (from rguyom@localhost) by pingoo.ifn.fr (8.9.3/8.9.3) id TAA24417; Sun, 5 Mar 2000 19:33:18 +0100 Date: Sun, 5 Mar 2000 19:33:17 +0100 From: =?iso-8859-1?Q?R=E9mi_Guyomarch?= To: freebsd-net@FreeBSD.ORG Cc: Jonathan Lemon , jayanth Subject: Re: TCP performance problems, Linux faster than FreeBSD ? Message-ID: <20000305193317.B22005@pingoo.ifn.fr> References: <20000303165052.C23732@pingoo.ifn.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0.1i In-Reply-To: <20000303165052.C23732@pingoo.ifn.fr>; from rguyom@mail.dotcom.fr on Fri, Mar 03, 2000 at 04:50:52PM +0100 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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