Add a reason parameter to delete_flow__() and delete_flows__() functions. Use OFPRR_EVICTION when add_flow() evicts an existing flow.
Signed-off-by: Jarno Rajahalme <jarno.rajaha...@nsn.com> --- ofproto/ofproto.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 5e6a252..66aa3c9 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -198,7 +198,8 @@ static bool rule_is_modifiable(const struct rule *); static enum ofperr add_flow(struct ofproto *, struct ofconn *, const struct ofputil_flow_mod *, const struct ofp_header *); -static void delete_flow__(struct rule *, struct ofopgroup *); +static void delete_flow__(struct rule *, struct ofopgroup *, + enum ofp_flow_removed_reason); static bool handle_openflow(struct ofconn *, const struct ofpbuf *); static enum ofperr handle_flow_mod__(struct ofproto *, struct ofconn *, const struct ofputil_flow_mod *, @@ -3338,7 +3339,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn, op->group->n_running--; ofoperation_destroy(rule->pending); } else if (evict) { - delete_flow__(evict, group); + delete_flow__(evict, group, OFPRR_EVICTION); } ofopgroup_submit(group); } @@ -3475,13 +3476,14 @@ modify_flow_strict(struct ofproto *ofproto, struct ofconn *ofconn, /* OFPFC_DELETE implementation. */ static void -delete_flow__(struct rule *rule, struct ofopgroup *group) +delete_flow__(struct rule *rule, struct ofopgroup *group, + enum ofp_flow_removed_reason reason) { struct ofproto *ofproto = rule->ofproto; - ofproto_rule_send_removed(rule, OFPRR_DELETE); + ofproto_rule_send_removed(rule, reason); - ofoperation_create(group, rule, OFOPERATION_DELETE, OFPRR_DELETE); + ofoperation_create(group, rule, OFOPERATION_DELETE, reason); oftable_remove_rule(rule); ofproto->ofproto_class->rule_destruct(rule); } @@ -3491,14 +3493,15 @@ delete_flow__(struct rule *rule, struct ofopgroup *group) * Returns 0 on success, otherwise an OpenFlow error code. */ static enum ofperr delete_flows__(struct ofproto *ofproto, struct ofconn *ofconn, - const struct ofp_header *request, struct list *rules) + const struct ofp_header *request, struct list *rules, + enum ofp_flow_removed_reason reason) { struct rule *rule, *next; struct ofopgroup *group; group = ofopgroup_create(ofproto, ofconn, request, UINT32_MAX); LIST_FOR_EACH_SAFE (rule, next, ofproto_node, rules) { - delete_flow__(rule, group); + delete_flow__(rule, group, reason); } ofopgroup_submit(group); @@ -3519,7 +3522,7 @@ delete_flows_loose(struct ofproto *ofproto, struct ofconn *ofconn, fm->out_port, &rules); return (error ? error : !list_is_empty(&rules) ? delete_flows__(ofproto, ofconn, request, - &rules) + &rules, OFPRR_DELETE) : 0); } @@ -3537,7 +3540,8 @@ delete_flow_strict(struct ofproto *ofproto, struct ofconn *ofconn, fm->out_port, &rules); return (error ? error : list_is_singleton(&rules) ? delete_flows__(ofproto, ofconn, - request, &rules) + request, &rules, + OFPRR_DELETE) : 0); } -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev