flow: Add struct flowmap.
authorJarno Rajahalme <jrajahalme@nicira.com>
Tue, 25 Aug 2015 20:55:03 +0000 (13:55 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Wed, 26 Aug 2015 22:37:22 +0000 (15:37 -0700)
commit5fcff47b0b56b91e2a7096b2f015426a43d73ed9
treee2e1f9fca6c9ce55e454419d000675604ba98203
parentfa2fdbf8d0c1da808230ad904e94199eafddd926
flow: Add struct flowmap.

Struct miniflow is now sometimes used just as a map.  Define a new
struct flowmap for that purpose.  The flowmap is defined as an array of
maps, and it is automatically sized according to the size of struct
flow, so it will be easier to maintain in the future.

It would have been tempting to use the existing struct bitmap for this
purpose. The main reason this is not feasible at the moment is that
some flowmap algorithms are simpler when it can be assumed that no
struct flow member requires more bits than can fit to a single map
unit. The tunnel member already requires more than 32 bits, so the map
unit needs to be 64 bits wide.

Performance critical algorithms enumerate the flowmap array units
explicitly, as it is easier for the compiler to optimize, compared to
the normal iterator.  Without this optimization a classifier lookup
without wildcard masks would be about 25% slower.

With this more general (and maintainable) algorithm the classifier
lookups are about 5% slower, when the struct flow actually becomes big
enough to require a second map.  This negates the performance gained
in the "Pre-compute stage masks" patch earlier in the series.

Requested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/classifier-private.h
lib/classifier.c
lib/dpif-netdev.c
lib/flow.c
lib/flow.h
lib/match.c
tests/test-classifier.c