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 <ho...@verge.net.au> --- v2 * No change --- ofproto/ofproto.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 80046cc..3153e71 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -4829,6 +4829,24 @@ ofmonitor_collect_resume_rules(struct ofmonitor *m, } 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) { @@ -4901,20 +4919,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; -- 2.0.0.rc2 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev