From owner-freebsd-net@FreeBSD.ORG Wed Jun 2 23:01:55 2010 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 593541065673 for ; Wed, 2 Jun 2010 23:01:55 +0000 (UTC) (envelope-from gnn@freebsd.org) Received: from vps.hungerhost.com (vps.hungerhost.com [216.38.53.176]) by mx1.freebsd.org (Postfix) with ESMTP id 328488FC17 for ; Wed, 2 Jun 2010 23:01:55 +0000 (UTC) Received: from smtp.hudson-trading.com ([209.249.190.9] helo=gnnmac.hudson-trading.com) by vps.hungerhost.com with esmtpa (Exim 4.69) (envelope-from ) id 1OJw7n-0004gR-5t for net@freebsd.org; Wed, 02 Jun 2010 18:09:23 -0400 From: George Neville-Neil Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Wed, 2 Jun 2010 18:09:22 -0400 Message-Id: <0BC7AD09-B627-4F6A-AD93-B7E794A78CA2@freebsd.org> To: net@freebsd.org Mime-Version: 1.0 (Apple Message framework v1078) X-Mailer: Apple Mail (2.1078) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - freebsd.org X-Source: X-Source-Args: X-Source-Dir: Cc: Subject: A slight change to tcpip_fillheaders... X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 23:01:55 -0000 Howdy, A while back another src developer mentioned that he had gotten better = performance by changing tcpip_fillheaders() in the following way: Index: tcp_subr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- tcp_subr.c (revision 209083) +++ tcp_subr.c (working copy) @@ -392,28 +392,19 @@ struct ip *ip; =20 ip =3D (struct ip *)ip_ptr; + bzero(ip, sizeof(*ip)); ip->ip_v =3D IPVERSION; ip->ip_hl =3D 5; ip->ip_tos =3D inp->inp_ip_tos; - ip->ip_len =3D 0; - ip->ip_id =3D 0; - ip->ip_off =3D 0; ip->ip_ttl =3D inp->inp_ip_ttl; - ip->ip_sum =3D 0; ip->ip_p =3D IPPROTO_TCP; ip->ip_src =3D inp->inp_laddr; ip->ip_dst =3D inp->inp_faddr; } + bzero(th, sizeof(*th)); th->th_sport =3D inp->inp_lport; th->th_dport =3D inp->inp_fport; - th->th_seq =3D 0; - th->th_ack =3D 0; - th->th_x2 =3D 0; th->th_off =3D 5; - th->th_flags =3D 0; - th->th_win =3D 0; - th->th_urp =3D 0; - th->th_sum =3D 0; /* in_pseudo() is called later = for ipv4 */ } =20 /* I have tried this change with NetPIPE (NPtcp -b 100000) on a pair of = machines using Intel igb devices and found that it provides no improvement, but I am wondering if other people want = to try this and see if it improves throughput at all. I was testing this on a Nehalem = class machine, not sure if it might help on other architectures. Best, George