[ovs-dev] [PATCH net-next] net: ovs: use CRC32 accelerated flow hash if available

Jesse Gross jesse at nicira.com
Tue Dec 10 19:28:08 UTC 2013


On Tue, Dec 10, 2013 at 1:52 AM, Francesco Fusco <ffusco at redhat.com> wrote:
> Currently OVS uses jhash2() for calculating flow hashes in its
> internal flow_hash() function. The performance of the flow_hash()
> function is critical, as the input data can be hundreds of bytes
> long.
>
> One possible direction to achieve higher performance consists
> of replacing jhash2() with an architecture specific hash
> function pretty much like the Intel folks have proposed in
> DPDK. DPDK provides a very fast hash function that leverages
> the 32bit crc32l instruction part of the Intel SSE4.2
> instruction set.
>
> OVS is largely deployed in x86_64 based datacenters.
> Therefore, we argue that the performance critical fast path
> of OVS should exploit underlying CPU features in order to reduce
> the per packet processing costs.
>
> We adapted and integrated Intel's hashing function from DPDK in
> order to be used with OVS internally. Our patch greatly reduces
> the hash footprint from ~200 cycles of jhash2() to around ~90
> cycles in case of ovs_flow_hash_crc() (measured with rdtsc over
> maximum length flow keys on an i7 Intel CPU).
>
> Additionally, we wrote a microbenchmark to stress the flow table
> performance. The benchmark inserts random flows into the flow
> hash and then performs lookups. Our hash deployed on a CRC32
> capable CPU reduces the lookup for 1000 flows, 100 masks from
> ~10,100us to ~6,700us, for example.
>
> Signed-off-by: Francesco Fusco <ffusco at redhat.com>
> Signed-off-by: Daniel Borkmann <dborkman at redhat.com>
> Signed-off-by: Thomas Graf <tgraf at redhat.com>

I think this is definitely a good optimization to do given that so
much of the work that OVS does is hashing. However, isn't there a
library where there would be a more appropriate place to put this?



More information about the dev mailing list