classifier: Lockless and robust classifier iteration.
authorJarno Rajahalme <jrajahalme@nicira.com>
Thu, 13 Nov 2014 19:54:31 +0000 (11:54 -0800)
committerJarno Rajahalme <jrajahalme@nicira.com>
Fri, 14 Nov 2014 23:55:44 +0000 (15:55 -0800)
commitde4ad4a21569fa63912be87c1b2e858d888dc1b0
tree2da5fe6b86685ccf3c695b28ebdb910c9b7707a5
parentf47eef15b78a642659e019412125d6c2775acb84
classifier: Lockless and robust classifier iteration.

Previously, accurate iteration required writers to be excluded during
iteration.  This patch adds an rculist to struct cls_subtable, and a
corresponding list node to struct cls_rule, which makes iteration more
straightforward, and allows the iterators to remain ignorant of the
internals of the cls_match.  This new list allows iteration of rules
in the classifier by traversing the RCU-friendly subtables vector, and
the rculist of rules in each subtable.

Classifier modifications may be performed concurrently, but whether or
not the concurrent iterator sees those changes depends on the timing
of change.  More specifically, an concurrent iterator:

- May or may not see a rule that is being inserted or removed.
- Will see either the new or the old version of a rule that is replaced.
- Will see all the other rules (that are not being modified).

Finally, The subtable's rculist also allows to make
classifier_rule_overlaps() lockless, which this patch also does.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/classifier-private.h
lib/classifier.c
lib/classifier.h
lib/flow.c
lib/ovs-router.c
lib/pvector.h
ofproto/ofproto-dpif.c
ofproto/ofproto.c
tests/test-classifier.c
utilities/ovs-ofctl.c