PERFORCE change 126992 for review

Kip Macy kmacy at FreeBSD.org
Sat Sep 29 15:28:07 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126992

Change 126992 by kmacy at 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)


More information about the p4-projects mailing list