static enum ofperr modify_flows__(struct ofproto *, struct ofputil_flow_mod *,
const struct rule_collection *,
const struct flow_mod_requester *);
-static void delete_flow__(struct rule *, enum ofp_flow_removed_reason,
- const struct flow_mod_requester *)
+static void delete_flows__(const struct rule_collection *,
+ enum ofp_flow_removed_reason,
+ const struct flow_mod_requester *)
OVS_REQUIRES(ofproto_mutex);
static enum ofperr send_buffered_packet(struct ofconn *, uint32_t buffer_id,
ofproto_rule_delete__(struct rule *rule, uint8_t reason)
OVS_REQUIRES(ofproto_mutex)
{
- struct ofproto *ofproto = rule->ofproto;
+ struct rule_collection rules;
- delete_flow__(rule, reason, NULL);
- ofmonitor_flush(ofproto->connmgr);
+ rules.rules = rules.stub;
+ rules.n = 1;
+ rules.stub[0] = rule;
+ delete_flows__(&rules, reason, NULL);
}
/* Deletes 'rule' from 'ofproto'.
\f
/* OFPFC_DELETE implementation. */
+/* Deletes the rules listed in 'rules'. */
static void
-delete_flow__(struct rule *rule, enum ofp_flow_removed_reason reason,
- const struct flow_mod_requester *req)
- OVS_REQUIRES(ofproto_mutex)
-{
- struct ofproto *ofproto = rule->ofproto;
-
- ofproto_rule_send_removed(rule, reason);
-
- ofmonitor_report(ofproto->connmgr, rule, NXFME_DELETED, reason,
- req ? req->ofconn : NULL, req ? req->xid : 0);
- oftable_remove_rule(rule);
- ofproto->ofproto_class->rule_delete(rule);
-}
-
-/* Deletes the rules listed in 'rules'.
- *
- * Returns 0 on success, otherwise an OpenFlow error code. */
-static enum ofperr
-delete_flows__(struct ofproto *ofproto,
- const struct rule_collection *rules,
+delete_flows__(const struct rule_collection *rules,
enum ofp_flow_removed_reason reason,
const struct flow_mod_requester *req)
OVS_REQUIRES(ofproto_mutex)
{
- size_t i;
+ if (rules->n) {
+ struct ofproto *ofproto = rules->rules[0]->ofproto;
+ size_t i;
- for (i = 0; i < rules->n; i++) {
- delete_flow__(rules->rules[i], reason, req);
- }
- ofmonitor_flush(ofproto->connmgr);
+ for (i = 0; i < rules->n; i++) {
+ struct rule *rule = rules->rules[i];
- return 0;
+ ofproto_rule_send_removed(rule, reason);
+
+ ofmonitor_report(ofproto->connmgr, rule, NXFME_DELETED, reason,
+ req ? req->ofconn : NULL, req ? req->xid : 0);
+ oftable_remove_rule(rule);
+ ofproto->ofproto_class->rule_delete(rule);
+ }
+ ofmonitor_flush(ofproto->connmgr);
+ }
}
/* Implements OFPFC_DELETE. */
rule_criteria_destroy(&criteria);
if (!error && rules.n > 0) {
- error = delete_flows__(ofproto, &rules, fm->delete_reason, req);
+ delete_flows__(&rules, fm->delete_reason, req);
}
rule_collection_destroy(&rules);
rule_criteria_destroy(&criteria);
if (!error && rules.n > 0) {
- error = delete_flows__(ofproto, &rules, fm->delete_reason, req);
+ delete_flows__(&rules, fm->delete_reason, req);
}
rule_collection_destroy(&rules);
}
}
if (rules.n > 0) {
- delete_flows__(ofproto, &rules, OFPRR_METER_DELETE, NULL);
+ delete_flows__(&rules, OFPRR_METER_DELETE, NULL);
}
/* Delete the meters. */