This is analogous to ofoperation_has_out_port,
operating on a group rather than a port.

This is in preparation for adding out_group support to flow monitors
which is in turn in preparation for supporting OpenFlow1.4 flow monitors.

Signed-off-by: Simon Horman <ho...@verge.net.au>

---
v2
* No change
---
 ofproto/ofproto-provider.h |  2 ++
 ofproto/ofproto.c          | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index aa5adf9..13233d2 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -471,6 +471,8 @@ void ofoperation_complete(struct ofoperation *, enum 
ofperr);
 
 bool ofoperation_has_out_port(const struct ofoperation *, ofp_port_t out_port)
     OVS_REQUIRES(ofproto_mutex);
+bool ofoperation_has_out_group(const struct ofoperation *, uint32_t out_group)
+    OVS_REQUIRES(ofproto_mutex);
 
 /* A group within a "struct ofproto".
  *
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 8d37980..7ec3d33 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2710,6 +2710,30 @@ ofoperation_has_out_port(const struct ofoperation *op, 
ofp_port_t out_port)
     OVS_NOT_REACHED();
 }
 
+/* Returns true if a rule related to 'op' has an OpenFlow OFPAT_OUTPUT or
+ * OFPAT_ENQUEUE action that outputs to 'out_group'. */
+bool
+ofoperation_has_out_group(const struct ofoperation *op, uint32_t out_group)
+    OVS_REQUIRES(ofproto_mutex)
+{
+    if (ofproto_rule_has_out_group(op->rule, out_group)) {
+        return true;
+    }
+
+    switch (op->type) {
+    case OFOPERATION_ADD:
+    case OFOPERATION_DELETE:
+        return false;
+
+    case OFOPERATION_MODIFY:
+    case OFOPERATION_REPLACE:
+        return ofpacts_output_to_group(op->actions->ofpacts,
+                                       op->actions->ofpacts_len, out_group);
+    }
+
+    OVS_NOT_REACHED();
+}
+
 static void
 rule_execute_destroy(struct rule_execute *e)
 {
-- 
2.0.0.rc2

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to