classifier: Remove classifier_insert_exact().
authorBen Pfaff <blp@nicira.com>
Thu, 14 Oct 2010 17:30:07 +0000 (10:30 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 29 Oct 2010 16:53:51 +0000 (09:53 -0700)
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
ofproto/ofproto.c
tests/test-classifier.c

index 38a5e2b..70fee95 100644 (file)
@@ -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
index cd1bc8a..5bdf1b7 100644 (file)
@@ -2064,7 +2064,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;
 }
index fe7155b..d8c0e10 100644 (file)
@@ -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);