[ovs-dev] [PATCH v5 2/6] classifier: Pre-compute stage masks.

Ben Pfaff blp at nicira.com
Wed Aug 26 16:06:56 UTC 2015

On Fri, Aug 21, 2015 at 03:25:19PM -0700, Jarno Rajahalme wrote:
> This makes stage mask computation happen only when a subtable is
> inserted and allows simplification of the main lookup function.
> Classifier benchmark shows that this speeds up the classification
> (with wildcards) about 5%.
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>

In miniflow_equal_maps(), if we believe that tnl_map is usually 0, then
it would be profitable to test pkt_map first to allow short-circuiting
to bail out earlier, e.g.:

    static inline bool
    miniflow_equal_maps(const struct miniflow *a, const struct miniflow *b)
        return a->pkt_map == b->pkt_map && a->tnl_map == b->tnl_map;

Of course that's a super-micro-optimization.

Acked-by: Ben Pfaff <blp at nicira.com>

More information about the dev mailing list