From fbb2ea0b5bebaae691ce6ac4b3a2eed65c775d9b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 14 Oct 2010 10:30:07 -0700 Subject: [PATCH] classifier: Remove classifier_insert_exact(). 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 38a5e2bc..70fee954 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 cd1bc8a2..5bdf1b7d 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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; } diff --git a/tests/test-classifier.c b/tests/test-classifier.c index fe7155bb..d8c0e102 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); -- 2.30.2