[ovs-dev] [cleanups 13/13] classifier: Remove classifier_for_each(), classifier_for_each_match().
Ethan Jackson
ethan at nicira.com
Mon Nov 15 14:56:44 PST 2010
Looks Good.
I think that's all the patches.
Ethan
On Fri, Oct 29, 2010 at 4:38 PM, Ben Pfaff <blp at nicira.com> wrote:
> These functions no longer have any users.
> ---
> lib/classifier.c | 105 +-----------------------------------------------------
> lib/classifier.h | 6 ---
> 2 files changed, 1 insertions(+), 110 deletions(-)
>
> diff --git a/lib/classifier.c b/lib/classifier.c
> index 1f4eebc..e1a4ed6 100644
> --- a/lib/classifier.c
> +++ b/lib/classifier.c
> @@ -410,7 +410,7 @@ classifier_remove(struct classifier *cls, struct cls_rule *rule)
> hmap_replace(&table->rules, &rule->hmap_node, &next->hmap_node);
> }
>
> - if (--table->n_table_rules == 0 && !table->n_refs) {
> + if (--table->n_table_rules == 0) {
> classifier_destroy_table(cls, table);
> }
>
> @@ -493,109 +493,6 @@ classifier_rule_overlaps(const struct classifier *cls,
>
> return false;
> }
> -
> -/* Searches 'cls' for rules that exactly match 'target' or are more specific
> - * than 'target'. That is, a given 'rule' matches 'target' if, for every
> - * field:
> - *
> - * - 'target' and 'rule' specify the same (non-wildcarded) value for the
> - * field, or
> - *
> - * - 'target' wildcards the field,
> - *
> - * but not if:
> - *
> - * - 'target' and 'rule' specify different values for the field, or
> - *
> - * - 'target' specifies a value for the field but 'rule' wildcards it.
> - *
> - * Equivalently, the truth table for whether a field matches is:
> - *
> - * rule
> - *
> - * wildcard exact
> - * +---------+---------+
> - * t wild | yes | yes |
> - * a card | | |
> - * r +---------+---------+
> - * g exact | no |if values|
> - * e | |are equal|
> - * t +---------+---------+
> - *
> - * This is the matching rule used by OpenFlow 1.0 non-strict OFPT_FLOW_MOD
> - * commands and by OpenFlow 1.0 aggregate and flow stats.
> - *
> - * Ignores target->priority.
> - *
> - * 'callback' is allowed to delete the rule that is passed as its argument, but
> - * it must not delete (or move) any other rules in 'cls' that have the same
> - * wildcards as the argument rule. */
> -void
> -classifier_for_each_match(const struct classifier *cls_,
> - const struct cls_rule *target,
> - cls_cb_func *callback, void *aux)
> -{
> - struct classifier *cls = (struct classifier *) cls_;
> - struct cls_table *table, *next_table;
> -
> - for (table = classifier_first_table(cls); table; table = next_table) {
> - if (!flow_wildcards_has_extra(&table->wc, &target->wc)) {
> - /* We have eliminated the "no" case in the truth table above. Two
> - * of the three remaining cases are trivial. We only need to check
> - * the fourth case, where both 'rule' and 'target' require an exact
> - * match. */
> - struct cls_rule *head, *next_head;
> -
> - table->n_refs++;
> - HMAP_FOR_EACH_SAFE (head, next_head, hmap_node, &table->rules) {
> - if (flow_equal_except(&head->flow, &target->flow,
> - &target->wc)) {
> - struct cls_rule *rule, *next_rule;
> -
> - FOR_EACH_RULE_IN_LIST_SAFE (rule, next_rule, head) {
> - callback(rule, aux);
> - }
> - }
> - }
> - next_table = classifier_next_table(cls, table);
> - if (!--table->n_refs && !table->n_table_rules) {
> - classifier_destroy_table(cls, table);
> - }
> - } else {
> - next_table = classifier_next_table(cls, table);
> - }
> - }
> -}
> -
> -/* 'callback' is allowed to delete the rule that is passed as its argument, but
> - * it must not delete (or move) any other rules in 'cls' that have the same
> - * wildcards as the argument rule. */
> -void
> -classifier_for_each(const struct classifier *cls_,
> - void (*callback)(struct cls_rule *, void *aux),
> - void *aux)
> -{
> - struct classifier *cls = (struct classifier *) cls_;
> - struct cls_table *table, *next_table;
> -
> - for (table = classifier_first_table(cls); table; table = next_table) {
> - struct cls_rule *head, *next_head;
> -
> - table->n_refs++;
> - HMAP_FOR_EACH_SAFE (head, next_head, hmap_node, &table->rules) {
> - struct cls_rule *rule, *next_rule;
> -
> - FOR_EACH_RULE_IN_LIST_SAFE (rule, next_rule, head) {
> - callback(rule, aux);
> - }
> - }
> - next_table = classifier_next_table(cls, table);
> - if (!--table->n_refs && !table->n_table_rules) {
> - hmap_remove(&cls->tables, &table->hmap_node);
> - free(table);
> - }
> - }
> -}
>
> /* Iteration. */
>
> diff --git a/lib/classifier.h b/lib/classifier.h
> index ed64095..3b2760f 100644
> --- a/lib/classifier.h
> +++ b/lib/classifier.h
> @@ -44,7 +44,6 @@ struct cls_table {
> struct hmap rules; /* Contains "struct cls_rule"s. */
> struct flow_wildcards wc; /* Wildcards for fields. */
> int n_table_rules; /* Number of rules, including duplicates. */
> - int n_refs; /* Reference count used during iteration. */
> };
>
> /* A flow classification rule.
> @@ -112,11 +111,6 @@ bool classifier_rule_overlaps(const struct classifier *,
>
> typedef void cls_cb_func(struct cls_rule *, void *aux);
>
> -void classifier_for_each(const struct classifier *,
> - cls_cb_func *, void *aux);
> -void classifier_for_each_match(const struct classifier *,
> - const struct cls_rule *,
> - cls_cb_func *, void *aux);
> struct cls_rule *classifier_find_rule_exactly(const struct classifier *,
> const struct cls_rule *);
>
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>
More information about the dev
mailing list