An upcoming commit will introduce the first use.
---
lib/classifier.c | 10 ++++++++++
lib/classifier.h | 1 +
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/lib/classifier.c b/lib/classifier.c
index 2a5ea89..a1c2b83 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -386,6 +386,16 @@ cls_rule_equal(const struct cls_rule *a, const struct
cls_rule *b)
&& flow_equal(&a->flow, &b->flow));
}
+/* Returns a hash value for the flow, wildcards, and priority in 'rule',
+ * starting from 'basis'. */
+uint32_t
+cls_rule_hash(const struct cls_rule *rule, uint32_t basis)
+{
+ uint32_t h0 = flow_hash(&rule->flow, basis);
+ uint32_t h1 = flow_wildcards_hash(&rule->wc, h0);
+ return hash_int(rule->priority, h1);
+}
+
static void
format_ip_netmask(struct ds *s, const char *name, ovs_be32 ip,
ovs_be32 netmask)
diff --git a/lib/classifier.h b/lib/classifier.h
index 08e2c0d..3b17cf3 100644
--- a/lib/classifier.h
+++ b/lib/classifier.h
@@ -112,6 +112,7 @@ bool cls_rule_set_ipv6_dst_masked(struct cls_rule *, const
struct in6_addr *,
void cls_rule_set_nd_target(struct cls_rule *, const struct in6_addr);
bool cls_rule_equal(const struct cls_rule *, const struct cls_rule *);
+uint32_t cls_rule_hash(const struct cls_rule *, uint32_t basis);
void cls_rule_format(const struct cls_rule *, struct ds *);
char *cls_rule_to_string(const struct cls_rule *);
--
1.7.4.4
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev