struct cls_rule *
classifier_lookup(const struct classifier *cls, const flow_t *flow)
{
- struct cls_rule *best = NULL;
- if (!hmap_is_empty(&cls->exact_table)) {
- best = search_exact_table(cls, flow_hash(flow, 0), flow);
+ struct cls_rule *rule = classifier_lookup_exact(cls, flow);
+ if (!rule) {
+ rule = classifier_lookup_wild(cls, flow);
}
- if (!best && cls->n_rules > hmap_count(&cls->exact_table)) {
+ return rule;
+}
+
+struct cls_rule *
+classifier_lookup_exact(const struct classifier *cls, const flow_t *flow)
+{
+ return (!hmap_is_empty(&cls->exact_table)
+ ? search_exact_table(cls, flow_hash(flow, 0), flow)
+ : NULL);
+}
+
+struct cls_rule *
+classifier_lookup_wild(const struct classifier *cls, const flow_t *flow)
+{
+ struct cls_rule *best = NULL;
+ if (cls->n_rules > hmap_count(&cls->exact_table)) {
struct cls_rule target;
int i;
struct cls_rule *classifier_insert(struct classifier *, struct cls_rule *);
void classifier_remove(struct classifier *, struct cls_rule *);
struct cls_rule *classifier_lookup(const struct classifier *, const flow_t *);
+struct cls_rule *classifier_lookup_wild(const struct classifier *,
+ const flow_t *);
+struct cls_rule *classifier_lookup_exact(const struct classifier *,
+ const flow_t *);
typedef void cls_cb_func(struct cls_rule *, void *aux);
void classifier_for_each(const struct classifier *, cls_cb_func *, void *aux);
return;
}
- super = rule_from_cls_rule(classifier_lookup(&p->cls, &sub->cr.flow));
+ super = rule_from_cls_rule(classifier_lookup_wild(&p->cls, &sub->cr.flow));
if (super != sub->super) {
if (!super) {
struct odp_flow odp_flow;