[ovs-discuss] [ACLv2 01/19] ofproto: Add ofproto_delete_flows_wildcarded function.
Jesse Gross
jesse at nicira.com
Sat Aug 15 02:13:09 UTC 2009
This functions deletes groups of flows if they match a particular
wildcard. This is needed to efficiently clean out old flow entries
that were locally added.
---
ofproto/ofproto.c | 18 ++++++++++++++++++
ofproto/ofproto.h | 2 ++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 55eb2c2..38960ee 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1008,6 +1008,24 @@ ofproto_delete_flow(struct ofproto *ofproto, const flow_t *flow,
}
static void
+delete_wild_cb(struct cls_rule *rule, void *ofproto_)
+{
+ struct ofproto *ofproto = ofproto_;
+ rule_remove(ofproto, rule_from_cls_rule(rule));
+}
+
+void
+ofproto_delete_flows_wildcarded(struct ofproto *ofproto, const flow_t *flow,
+ uint32_t wildcards)
+{
+ struct cls_rule cls_rule;
+
+ cls_rule_from_flow(&cls_rule, flow, wildcards, 0);
+ classifier_for_each_match(&ofproto->cls, &cls_rule, CLS_INC_ALL,
+ delete_wild_cb, ofproto);
+}
+
+static void
destroy_rule(struct cls_rule *rule_, void *ofproto_)
{
struct rule *rule = rule_from_cls_rule(rule_);
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index f4c1b40..88ae701 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -91,6 +91,8 @@ void ofproto_add_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
int idle_timeout);
void ofproto_delete_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
unsigned int priority);
+void ofproto_delete_flows_wildcarded(struct ofproto *, const flow_t *,
+ uint32_t wildcards);
void ofproto_flush_flows(struct ofproto *);
/* Hooks for ovs-vswitchd. */
--
1.6.0.4
More information about the discuss
mailing list