Skip to content

Commit

Permalink
ofproto: Break out monitor deletion code
Browse files Browse the repository at this point in the history
Break out monitor deletion code into a new function
flow_monitor_delete which is paramatised over the id of
the monitor to delete.

This is in preparation for supporting OpenFlow1.4 flow monitor requests
with delete and modify commands.

Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
horms authored and blp committed Jun 24, 2014
1 parent df1a9a4 commit 7b90068
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions ofproto/ofproto.c
Original file line number Diff line number Diff line change
Expand Up @@ -4827,6 +4827,24 @@ ofmonitor_collect_resume_rules(struct ofmonitor *m,
ofproto_collect_ofmonitor_refresh_rules(m, seqno, rules);
}

static enum ofperr
flow_monitor_delete(struct ofconn *ofconn, uint32_t id)
OVS_REQUIRES(ofproto_mutex)
{
struct ofmonitor *m;
enum ofperr error;

m = ofmonitor_lookup(ofconn, id);
if (m) {
ofmonitor_destroy(m);
error = 0;
} else {
error = OFPERR_OFPMOFC_UNKNOWN_MONITOR;
}

return error;
}

static enum ofperr
handle_flow_monitor_request(struct ofconn *ofconn, const struct ofp_header *oh)
OVS_EXCLUDED(ofproto_mutex)
Expand Down Expand Up @@ -4907,20 +4925,13 @@ static enum ofperr
handle_flow_monitor_cancel(struct ofconn *ofconn, const struct ofp_header *oh)
OVS_EXCLUDED(ofproto_mutex)
{
struct ofmonitor *m;
enum ofperr error;
uint32_t id;

id = ofputil_decode_flow_monitor_cancel(oh);

ovs_mutex_lock(&ofproto_mutex);
m = ofmonitor_lookup(ofconn, id);
if (m) {
ofmonitor_destroy(m);
error = 0;
} else {
error = OFPERR_OFPMOFC_UNKNOWN_MONITOR;
}
error = flow_monitor_delete(ofconn, id);
ovs_mutex_unlock(&ofproto_mutex);

return error;
Expand Down

0 comments on commit 7b90068

Please sign in to comment.