summaryrefslogtreecommitdiff
path: root/lib/classifier.c
diff options
context:
space:
mode:
authorJarno Rajahalme <jrajahalme@nicira.com>2015-06-11 15:53:43 -0700
committerJarno Rajahalme <jrajahalme@nicira.com>2015-06-11 15:53:43 -0700
commit39c9459355b6f010aa73ca80ad8d0e6893ef0a88 (patch)
treec6919ee142db73f19c2f807b6d1ab21fff5ed51a /lib/classifier.c
parent621b8064b7f8921576dcba1c4b292ba1f6644061 (diff)
downloadopenvswitch-39c9459355b6f010aa73ca80ad8d0e6893ef0a88.tar.gz
Use classifier versioning.
Each rule is now added or deleted in a specific tables version. Flow tables are versioned with a monotonically increasing 64-bit integer, where positive values are valid version numbers. Rule modifications are implemented as an insertion of a new rule and a deletion of the old rule, both taking place in the same tables version. Since concurrent lookups may use different versions, both the old and new rule must be available for lookups at the same time. The ofproto provider interface is changed to accomodate the above. As rule's actions need not be modified any more, we no longer need 'rule_premodify_actions', nor 'rule_modify_actions'. 'rule_insert' now takes a pointer to the old rule and adds a flag that tells whether the old stats should be forwarded to the new rule or not (this replaces the 'reset_counters' flag of the now removed 'rule_modify_actions'). Versioning all flow table changes has the side effect of making learned flows visible for future lookups only. I.e., the upcall that executes the learn action, will not see the newly learned action in it's classifier lookups. Only upcalls that start executing after the new flow was added will match on it. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/classifier.c')
-rw-r--r--lib/classifier.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/classifier.c b/lib/classifier.c
index 50bbbbf3f..5f92f0514 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -202,14 +202,24 @@ cls_rule_init_from_minimatch(struct cls_rule *rule,
minimatch_clone(CONST_CAST(struct minimatch *, &rule->match), match);
}
+/* Initializes 'dst' as a copy of 'src', but with 'version'.
+ *
+ * The caller must eventually destroy 'dst' with cls_rule_destroy(). */
+void
+cls_rule_clone_in_version(struct cls_rule *dst, const struct cls_rule *src,
+ long long version)
+{
+ cls_rule_init__(dst, src->priority, version);
+ minimatch_clone(CONST_CAST(struct minimatch *, &dst->match), &src->match);
+}
+
/* Initializes 'dst' as a copy of 'src'.
*
* The caller must eventually destroy 'dst' with cls_rule_destroy(). */
void
cls_rule_clone(struct cls_rule *dst, const struct cls_rule *src)
{
- cls_rule_init__(dst, src->priority, src->version);
- minimatch_clone(CONST_CAST(struct minimatch *, &dst->match), &src->match);
+ cls_rule_clone_in_version(dst, src, src->version);
}
/* Initializes 'dst' with the data in 'src', destroying 'src'.