[ovs-dev] [PATCH 13/32] ofproto: Break out monitor deletion code
Simon Horman
horms at verge.net.au
Mon Jun 9 03:54:09 UTC 2014
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 <horms at verge.net.au>
---
ofproto/ofproto.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index d5cc996..4d4fad4 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4916,6 +4916,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)
{
@@ -4988,20 +5006,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
More information about the dev
mailing list