datapath: optimize flow compare and mask functions
authorAndy Zhou <azhou@nicira.com>
Tue, 27 Aug 2013 18:21:26 +0000 (11:21 -0700)
committerJesse Gross <jesse@nicira.com>
Tue, 27 Aug 2013 19:53:12 +0000 (12:53 -0700)
commitc2dd5e999fc8e172be3a167c71e587bb50da7d97
tree1ba8a03ae04799f28af23d8a1955d1cdbccba25b
parent78cef7fdf84169a4031696f7bc00aa11ca5c1392
datapath: optimize flow compare and mask functions

Make sure the sw_flow_key structure and valid mask boundaries are always
machine word aligned. Optimize the flow compare and mask operations
using machine word size operations. This patch improves throughput on
average by 15% when CPU is the bottleneck of forwarding packets.

This patch is inspired by ideas and code from a patch submitted by Peter
Klausler titled "replace memcmp() with specialized comparator".
However, The original patch only optimizes for architectures
support unaligned machine word access. This patch optimizes for all
architectures.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/flow.c
datapath/flow.h