diff options
author | Jarno Rajahalme <jrajahalme@nicira.com> | 2014-11-13 11:54:31 -0800 |
---|---|---|
committer | Jarno Rajahalme <jrajahalme@nicira.com> | 2014-11-14 15:55:44 -0800 |
commit | de4ad4a21569fa63912be87c1b2e858d888dc1b0 (patch) | |
tree | 2da5fe6b86685ccf3c695b28ebdb910c9b7707a5 /ofproto | |
parent | f47eef15b78a642659e019412125d6c2775acb84 (diff) | |
download | openvswitch-de4ad4a21569fa63912be87c1b2e858d888dc1b0.tar.gz |
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>
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif.c | 2 | ||||
-rw-r--r-- | ofproto/ofproto.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 5b2ae5df0..0dc1f85ae 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1403,7 +1403,7 @@ destruct(struct ofproto *ofproto_) hmap_remove(&all_ofproto_dpifs, &ofproto->all_ofproto_dpifs_node); OFPROTO_FOR_EACH_TABLE (table, &ofproto->up) { - CLS_FOR_EACH_SAFE (rule, up.cr, &table->cls) { + CLS_FOR_EACH (rule, up.cr, &table->cls) { ofproto_rule_delete(&ofproto->up, &rule->up); } } diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 95f290524..c35bc3a91 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1391,7 +1391,7 @@ ofproto_flush__(struct ofproto *ofproto) continue; } - CLS_FOR_EACH_SAFE (rule, cr, &table->cls) { + CLS_FOR_EACH (rule, cr, &table->cls) { ofproto_rule_delete__(rule, OFPRR_DELETE); } } |