A slight change to tcpip_fillheaders...
George Neville-Neil
gnn at freebsd.org
Wed Jun 2 23:01:55 UTC 2010
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
===================================================================
--- tcp_subr.c (revision 209083)
+++ tcp_subr.c (working copy)
@@ -392,28 +392,19 @@
struct ip *ip;
ip = (struct ip *)ip_ptr;
+ bzero(ip, sizeof(*ip));
ip->ip_v = IPVERSION;
ip->ip_hl = 5;
ip->ip_tos = inp->inp_ip_tos;
- ip->ip_len = 0;
- ip->ip_id = 0;
- ip->ip_off = 0;
ip->ip_ttl = inp->inp_ip_ttl;
- ip->ip_sum = 0;
ip->ip_p = IPPROTO_TCP;
ip->ip_src = inp->inp_laddr;
ip->ip_dst = inp->inp_faddr;
}
+ bzero(th, sizeof(*th));
th->th_sport = inp->inp_lport;
th->th_dport = inp->inp_fport;
- th->th_seq = 0;
- th->th_ack = 0;
- th->th_x2 = 0;
th->th_off = 5;
- th->th_flags = 0;
- th->th_win = 0;
- th->th_urp = 0;
- th->th_sum = 0; /* in_pseudo() is called later for ipv4 */
}
/*
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
More information about the freebsd-net
mailing list