Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
* [Cake] an experiment with an alternate hasher
@ 2017-03-26 16:00 Dave Taht
  2017-03-26 16:16 ` Jonathan Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Taht @ 2017-03-26 16:00 UTC (permalink / raw)
  To: Cake List

I am trying to see if I can get an adaquate avalanche distribution using
a hash of popcount(src),(popcount(dst),srcport,dstport, protocol, seed.

popcount is, regrettably, an sse4.2-only instruction, and this version
 of the assembly routine can actually popcount up to 8 ipv6 addresses
in a row, but you typically just pass it 2. I had a great deal of fun
writing this tho I haven't got around to actually seeing how good a
resulting hash would be!

The ipv4 version does both src and dst with a single popcnt.

The startup cost to further hash this is pretty insane - 30 cycles in
http://burtleburtle.net/bob/hash/spooky.html. Xor? CRC?

00000000004005a0 <popcount2asm>:
  4005a0:       31 c0                   xor    %eax,%eax
  4005a2:       89 f1                   mov    %esi,%ecx

00000000004005a4 <poploop7>:
  4005a4:       48 c1 e0 08             shl    $0x8,%rax
  4005a8:       f3 4c 0f b8 07          popcnt (%rdi),%r8
  4005ad:       48 83 c7 10             add    $0x10,%rdi
  4005b1:       4c 09 c0                or     %r8,%rax
  4005b4:       f3 4c 0f b8 47 f8       popcnt -0x8(%rdi),%r8
  4005ba:       4c 01 c0                add    %r8,%rax
  4005bd:       e2 e5                   loop   4005a4 <poploop7>
  4005bf:       c3                      retq


-- 
Dave Täht
Let's go make home routers and wifi faster! With better software!
http://blog.cerowrt.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-26 16:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-26 16:00 [Cake] an experiment with an alternate hasher Dave Taht
2017-03-26 16:16 ` Jonathan Morton
2017-03-26 16:37   ` Dave Taht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox