[ovs-dev] [nxm 13/42] classifier: Remove classifier_insert_exact().
Ben Pfaff
blp at nicira.com
Thu Oct 28 17:27:44 UTC 2010
This function doesn't provide any extra useful functionality. It is
amenable to a slightly optimized implementation in the current classifier,
but not in the one that will soon replace it, so get rid of it.
---
lib/classifier.c | 12 ------------
ofproto/ofproto.c | 6 +++++-
tests/test-classifier.c | 6 +-----
3 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/lib/classifier.c b/lib/classifier.c
index 38a5e2b..70fee95 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -184,18 +184,6 @@ classifier_insert(struct classifier *cls, struct cls_rule *rule)
return old;
}
-/* Inserts 'rule' into 'cls'. Transfers ownership of 'rule' to 'cls'.
- *
- * 'rule' must be an exact-match rule (rule->wc.wildcards must be 0) and 'cls'
- * must not contain any rule with an identical key. */
-void
-classifier_insert_exact(struct classifier *cls, struct cls_rule *rule)
-{
- hmap_insert(&cls->exact_table, &rule->node.hmap,
- flow_hash(&rule->flow, 0));
- cls->n_rules++;
-}
-
/* Removes 'rule' from 'cls'. It is caller's responsibility to free 'rule', if
* this is desirable. */
void
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 1245d0e..59396bf 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2066,7 +2066,11 @@ rule_create_subrule(struct ofproto *ofproto, struct rule *rule,
COVERAGE_INC(ofproto_subrule_create);
cls_rule_from_flow(flow, 0, (rule->cr.priority <= UINT16_MAX ? UINT16_MAX
: rule->cr.priority), &subrule->cr);
- classifier_insert_exact(&ofproto->cls, &subrule->cr);
+
+ if (classifier_insert(&ofproto->cls, &subrule->cr)) {
+ /* Can't happen, */
+ NOT_REACHED();
+ }
return subrule;
}
diff --git a/tests/test-classifier.c b/tests/test-classifier.c
index 73229c2..270f613 100644
--- a/tests/test-classifier.c
+++ b/tests/test-classifier.c
@@ -516,11 +516,7 @@ test_single_rule(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
tcls_init(&tcls);
tcls_rule = tcls_insert(&tcls, rule);
- if (wc_fields) {
- assert(!classifier_insert(&cls, &rule->cls_rule));
- } else {
- classifier_insert_exact(&cls, &rule->cls_rule);
- }
+ assert(!classifier_insert(&cls, &rule->cls_rule));
check_tables(&cls, 1, 1, 1);
compare_classifiers(&cls, &tcls);
--
1.7.1
More information about the dev
mailing list