aboutsummaryrefslogtreecommitdiff
path: root/lib/classifier.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-09-12 16:48:07 -0700
committerBen Pfaff <blp@nicira.com>2011-09-13 11:46:10 -0700
commit54a9cbc9637e3deba7e436aac398aaa9ba110892 (patch)
tree2d5c341559400e9f01e4034bcb921cb809cf6e3d /lib/classifier.h
parent9cdaaebe218dbd9d2126818725b0111a70a3df54 (diff)
ofproto-dpif: Optimize flow revalidation for MAC learning.
Without this commit, every NXAST_LEARN action that adds a flow causes every facet to be revalidated. With this commit, as long as the "Usage Advice" in the large comment on struct nx_action_learn in nicira-ext.h is followed, this no longer happens.
Diffstat (limited to 'lib/classifier.h')
-rw-r--r--lib/classifier.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/classifier.h b/lib/classifier.h
index 20b95909..db090225 100644
--- a/lib/classifier.h
+++ b/lib/classifier.h
@@ -50,6 +50,18 @@ struct cls_table {
int n_table_rules; /* Number of rules, including duplicates. */
};
+/* Returns true if 'table' is a "catch-all" table that will match every
+ * packet (if there is no higher-priority match). */
+static inline bool
+cls_table_is_catchall(const struct cls_table *table)
+{
+ /* A catch-all table can only have one rule, so use hmap_count() as a cheap
+ * check to rule out other kinds of match before doing the full check with
+ * flow_wildcards_is_catchall(). */
+ return (hmap_count(&table->rules) == 1
+ && flow_wildcards_is_catchall(&table->wc));
+}
+
/* A flow classification rule.
*
* Use one of the cls_rule_*() functions to initialize a cls_rule.