datapath: Hash and compare only the part of sw_flow_key actually used.
authorAndrew Evans <aevans@nicira.com>
Wed, 18 May 2011 18:30:07 +0000 (11:30 -0700)
committerAndrew Evans <aevans@nicira.com>
Wed, 18 May 2011 18:30:07 +0000 (11:30 -0700)
commit76abe283baa043bae84163873b0c7c498bfb260a
tree58fee6ca32534584c988caba03e0041b8a916c6e
parentf9c71a155bb27a981865407d5a3d78ecd9ca24af
datapath: Hash and compare only the part of sw_flow_key actually used.

Currently the whole flow key struct is hashed on every packet received from the
network or userspace. The whole struct is also compared byte-for-byte when
doing flow table lookups. This consumes a fair percentage of CPU time, and most
of the time part of the structure is unused (e.g. the IPv6 fields when handling
IPv4 traffic; the IPv4 fields when handling Ethernet frames).

This commit reorders the fields in the flow key struct to put the least
commonly used elements at the end and changes the hash and comparison functions
to look only at the part that contains data.

Signed-off-by: Andrew Evans <aevans@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
datapath/actions.c
datapath/datapath.c
datapath/flow.c
datapath/flow.h
datapath/table.c
datapath/table.h
datapath/tunnel.c