History log of /openbsd/sys/net/toeplitz.h (Results 1 – 11 of 11)
Revision Date Author Comments
# 2c85293c 17-May-2023 dlg <dlg@openbsd.org>

fix stoeplitz_hash_h32.

discussed with and ok tb@


# 04cdc2f2 27-Dec-2022 patrick <patrick@openbsd.org>

Fix array bounds mismatch with clang 15

New warning -Warray-parameter is a bit overzealous.
ok millert@ tb@


# ef810411 22-Dec-2022 dlg <dlg@openbsd.org>

provide stoeplitz_n32()


# a9e44c50 24-Feb-2021 dlg <dlg@openbsd.org>

add support for hashing 64 and 32 bit numbers in host byte order.


# b2f8ed19 24-Feb-2021 dlg <dlg@openbsd.org>

white space tweak, no functional change


# 760e1386 24-Feb-2021 dlg <dlg@openbsd.org>

fix stoeplitz_n16 and stoeplitz_h16


# 02f127eb 21-Feb-2021 deraadt <deraadt@openbsd.org>

how about sticking to standard C.


# e6a31789 21-Feb-2021 dlg <dlg@openbsd.org>

add stoeplitz_eaddr, for getting a hash value from an ethernet address.


# 3a046e31 19-Jun-2020 dlg <dlg@openbsd.org>

let stoeplitz_to_key take a void * argument instead of uint8_t *.

ix(4) wants an array of uint32_ts to push into 32bit registers.


# 427e9edc 18-Jun-2020 tb <tb@openbsd.org>

Introduce stoeplitz_hash_n32() and use it to simplify the hash_ip*
functions further.

ok dlg


# de20b17a 16-Jun-2020 dlg <dlg@openbsd.org>

Add a symmetric toeplitz implementation, with integration for nics.

This is another bit of the puzzle for supporting multiple rx rings
and receive side scaling (RSS) on nics. It borrows heavily from

Add a symmetric toeplitz implementation, with integration for nics.

This is another bit of the puzzle for supporting multiple rx rings
and receive side scaling (RSS) on nics. It borrows heavily from
DragonflyBSD, but I've made some tweaks on the way.

The interesting bits that dfly came up with was a way to use Toeplitz
hashing so the kernel AND network interfaces hash packets so packets
in both directions onto the same bucket. The other interesting thing
is that the optimised the hash calculation by building a cache of
all the intermediate results possible for each input byte. Their
hash calculation is simply xoring these intermediate reults together.

So this diff adds an API for the kernel to use for calculating a
hash for ip addresses and ports, and adds a function for network
drivers to call that gives them a key to use with RSS. If all drivers
use the same key, then the same flows should be steered to the same
place when they enter the network stack regardless of which hardware
they came in on.

The changes I made relative to dfly are around reducing the size
of the caches. DragonflyBSD builds a cache of 32bit values, but
because of how the Toeplitz key is constructed, the 32bits are made
up of a repeated 16bit pattern. We can just store the 16 bits and
reconstruct the 32 bits if we want. Both us and dragonfly only
use 15 or 16 bits of the result anyway, so 32bits is unecessary.

Secondly, the dfly implementation keeps a cache of values for the
high and low bytes of input, but the values in the two caches are
almost the same. You can byteswap the values in one of the byte
caches to get the values for the other, but you can also just
byteswap values at runtime to get the same value, which is what
this implementation does. The result of both these changes is that
the byte cache is a quarter of the size of the one in dragonflybsd.

tb@ has had a close look at this and found a bunch of other
optimisations that can be implemented, and because he's a
wizard^Wmathematician he has proofs (and also did tests).

ok tb@ jmatthew@

show more ...