union ofp_action *actions;
};
+static void rule_free(struct rule *);
static void rule_destroy(struct rule *);
static struct rule *rule_from_cls_rule(const struct cls_rule *);
static void rule_make_actions(struct ofproto *,
* out a netflow message? */
}
}
+
+static void
+destroy_rule(struct cls_rule *rule_, void *ofproto_)
+{
+ struct rule *rule = rule_from_cls_rule(rule_);
+ struct ofproto *ofproto = ofproto_;
+
+ classifier_remove(&ofproto->cls, &rule->cr);
+ rule_free(rule);
+}
+
+void
+ofproto_flush_flows(struct ofproto *ofproto)
+{
+ classifier_for_each(&ofproto->cls, CLS_INC_ALL, destroy_rule, ofproto);
+ dpif_flow_flush(&ofproto->dpif);
+}
\f
static void
reinit_ports(struct ofproto *p)
return cls_rule ? CONTAINER_OF(cls_rule, struct rule, cr) : NULL;
}
+static void
+rule_free(struct rule *rule)
+{
+ free(rule->actions);
+ free(rule);
+}
+
static void
rule_destroy(struct rule *rule)
{
} else if (rule->super != UNKNOWN_SUPER) {
list_remove(&rule->list);
}
- free(rule->actions);
- free(rule);
+ rule_free(rule);
}
static bool
const union ofp_action *, size_t n_actions);
void ofproto_delete_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
uint16_t priority);
+void ofproto_flush_flows(struct ofproto *);
/* Hooks for vswitchd. */
struct ofhooks {