svn commit: r193215 - projects/pnet/sys/netinet

Robert Watson rwatson at FreeBSD.org
Mon Jun 1 09:43:59 UTC 2009


Author: rwatson
Date: Mon Jun  1 09:43:58 2009
New Revision: 193215
URL: http://svn.freebsd.org/changeset/base/193215

Log:
  When cheaply calculating flow identifiers for packets coming in from
  network device drivers without hardware flow calculation, or for loopback
  traffic, use a different cheap hash that puts all interesting entropy
  into the bottom 8 bits of the flow ID, which works well with our default
  flow ID -> CPU mapping.

Modified:
  projects/pnet/sys/netinet/ip_input.c

Modified: projects/pnet/sys/netinet/ip_input.c
==============================================================================
--- projects/pnet/sys/netinet/ip_input.c	Mon Jun  1 09:32:12 2009	(r193214)
+++ projects/pnet/sys/netinet/ip_input.c	Mon Jun  1 09:43:58 2009	(r193215)
@@ -442,7 +442,10 @@ ip_input_m2flow(struct mbuf *m, uintptr_
 		goto bad;
 	}
 	m->m_flags |= M_FLOWID;
-	m->m_pkthdr.flowid = ip->ip_src.s_addr ^ ip->ip_dst.s_addr;
+	m->m_pkthdr.flowid = ((ip->ip_src.s_addr & 0xff000000) >> 24) ^
+	    ((ip->ip_src.s_addr & 0xff0000) >> 16) ^
+	    ((ip->ip_src.s_addr & 0xff00) >> 8) ^
+	    (ip->ip_src.s_addr & 0xff) ^ ip->ip_p;
 	return (m);
 
 bad:


More information about the svn-src-projects mailing list