Date: Sat, 29 Sep 2007 22:28:06 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 126992 for review Message-ID: <200709292228.l8TMS6hV050096@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=126992 Change 126992 by kmacy@kmacy_home:ethng on 2007/09/29 22:27:17 use simple lfsr to provide more uniform txq assignment for udp sessions Affected files ... .. //depot/projects/ethng/src/sys/netinet/in_pcb.c#5 edit Differences ... ==== //depot/projects/ethng/src/sys/netinet/in_pcb.c#5 (text+ko) ==== @@ -158,6 +158,13 @@ &ipport_randomtime, 0, "Minimum time to keep sequental port " "allocation before switching to a random one"); + +static __inline int +calc_lfsr(int lfsr) +{ + return ((lfsr >> 1) ^ (-(signed int)(lfsr & 1) & 0xd0000001u)); /* taps 32 31 29 1 */ +} + /* * in_pcb.c: manage the Protocol Control Blocks. * @@ -185,7 +192,7 @@ bzero(inp, inp_zero_size); inp->inp_pcbinfo = pcbinfo; inp->inp_socket = so; - inp->inp_rss_hash = rss_hash++; + inp->inp_rss_hash = calc_lfsr(rss_hash++); #ifdef MAC error = mac_init_inpcb(inp, M_NOWAIT); if (error != 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709292228.l8TMS6hV050096>