struct cls_rule *
classifier_find_rule_exactly(const struct classifier *cls,
- const struct flow *target, uint32_t wildcards,
- unsigned int priority)
+ const struct cls_rule *target)
{
struct cls_bucket *bucket;
int table_idx;
uint32_t hash;
- if (!wildcards) {
- /* Ignores 'priority'. */
- return search_exact_table(cls, flow_hash(target, 0), target);
+ if (!target->wc.wildcards) {
+ /* Ignores 'target->priority'. */
+ return search_exact_table(cls, flow_hash(&target->flow, 0),
+ &target->flow);
}
- assert(wildcards == (wildcards & OVSFW_ALL));
- table_idx = table_idx_from_wildcards(wildcards);
- hash = hash_fields(target, table_idx);
+ assert(target->wc.wildcards == (target->wc.wildcards & OVSFW_ALL));
+ table_idx = table_idx_from_wildcards(target->wc.wildcards);
+ hash = hash_fields(&target->flow, table_idx);
HMAP_FOR_EACH_WITH_HASH (bucket, hmap_node, hash,
&cls->tables[table_idx]) {
- if (equal_fields(&bucket->fixed, target, table_idx)) {
+ if (equal_fields(&bucket->fixed, &target->flow, table_idx)) {
struct cls_rule *pos;
LIST_FOR_EACH (pos, node.list, &bucket->rules) {
- if (pos->priority < priority) {
+ if (pos->priority < target->priority) {
return NULL;
- } else if (pos->priority == priority &&
- pos->wc.wildcards == wildcards &&
- flow_equal(target, &pos->flow)) {
+ } else if (pos->priority == target->priority &&
+ pos->wc.wildcards == target->wc.wildcards &&
+ flow_equal(&target->flow, &pos->flow)) {
return pos;
}
}
const struct cls_rule *,
int include, cls_cb_func *, void *aux);
struct cls_rule *classifier_find_rule_exactly(const struct classifier *,
- const struct flow *target,
- uint32_t wildcards,
- unsigned int priority);
+ const struct cls_rule *);
#define CLASSIFIER_FOR_EACH_EXACT_RULE(RULE, MEMBER, CLS) \
HMAP_FOR_EACH (RULE, MEMBER.node.hmap, &(CLS)->exact_table)
ofproto_delete_flow(struct ofproto *ofproto, const struct flow *flow,
uint32_t wildcards, unsigned int priority)
{
+ struct cls_rule target;
struct rule *rule;
+ cls_rule_from_flow(flow, wildcards, priority, &target);
rule = rule_from_cls_rule(classifier_find_rule_exactly(&ofproto->cls,
- flow, wildcards,
- priority));
+ &target));
if (rule) {
rule_remove(ofproto, rule);
}
static struct rule *
find_flow_strict(struct ofproto *p, const struct ofp_flow_mod *ofm)
{
- uint32_t wildcards;
- struct flow flow;
+ struct cls_rule target;
- flow_from_match(&ofm->match, p->tun_id_from_cookie, ofm->cookie,
- &flow, &wildcards);
- return rule_from_cls_rule(classifier_find_rule_exactly(
- &p->cls, &flow, wildcards,
- ntohs(ofm->priority)));
+ cls_rule_from_match(&ofm->match, ntohs(ofm->priority),
+ p->tun_id_from_cookie, ofm->cookie, &target);
+ return rule_from_cls_rule(classifier_find_rule_exactly(&p->cls, &target));
}
static int
for (i = 0; i < n_flows; i++) {
struct odp_flow *f = &flows[i];
+ struct cls_rule target;
struct rule *rule;
struct flow flow;
odp_flow_key_to_flow(&f->key, &flow);
+ cls_rule_from_flow(&flow, 0, UINT16_MAX, &target);
- rule = rule_from_cls_rule(
- classifier_find_rule_exactly(&p->cls, &flow, 0, UINT16_MAX));
+ rule = rule_from_cls_rule(classifier_find_rule_exactly(&p->cls,
+ &target));
if (rule && rule->installed) {
update_time(p, rule, &f->stats);