Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jun 2010 18:09:22 -0400
From:      George Neville-Neil <gnn@freebsd.org>
To:        net@freebsd.org
Subject:   A slight change to tcpip_fillheaders...
Message-ID:  <0BC7AD09-B627-4F6A-AD93-B7E794A78CA2@freebsd.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0BC7AD09-B627-4F6A-AD93-B7E794A78CA2>