[ovs-dev] [PATCH 1/9] include/openflow: Move union ofp_action away from headers.

Jarno Rajahalme jrajahalme at nicira.com
Wed Oct 16 23:16:03 UTC 2013


union ofp_action cannot remain in the OF 1.0 header as it is expanded
to include actions from later versions.  Also, it is not part of the
protocol interface and will be easier to update where it is actually
used.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
 include/openflow/openflow-1.0.h |   13 -------------
 lib/ofp-actions.c               |   13 +++++++++++++
 lib/ofp-util.h                  |    1 +
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/include/openflow/openflow-1.0.h b/include/openflow/openflow-1.0.h
index ef0a3ce..34d97c4 100644
--- a/include/openflow/openflow-1.0.h
+++ b/include/openflow/openflow-1.0.h
@@ -201,19 +201,6 @@ struct ofp10_action_enqueue {
 };
 OFP_ASSERT(sizeof(struct ofp10_action_enqueue) == 16);
 
-union ofp_action {
-    ovs_be16 type;
-    struct ofp_action_header header;
-    struct ofp_action_vendor_header vendor;
-    struct ofp10_action_output output10;
-    struct ofp_action_vlan_vid vlan_vid;
-    struct ofp_action_vlan_pcp vlan_pcp;
-    struct ofp_action_nw_addr nw_addr;
-    struct ofp_action_nw_tos nw_tos;
-    struct ofp_action_tp_port tp_port;
-};
-OFP_ASSERT(sizeof(union ofp_action) == 8);
-
 /* Send packet (controller -> datapath). */
 struct ofp10_packet_out {
     ovs_be32 buffer_id;           /* ID assigned by datapath or UINT32_MAX. */
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 06f9f6b..73a3291 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -35,6 +35,19 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
 
 /* Converting OpenFlow 1.0 to ofpacts. */
 
+union ofp_action {
+    ovs_be16 type;
+    struct ofp_action_header header;
+    struct ofp_action_vendor_header vendor;
+    struct ofp10_action_output output10;
+    struct ofp_action_vlan_vid vlan_vid;
+    struct ofp_action_vlan_pcp vlan_pcp;
+    struct ofp_action_nw_addr nw_addr;
+    struct ofp_action_nw_tos nw_tos;
+    struct ofp_action_tp_port tp_port;
+};
+OFP_ASSERT(sizeof(union ofp_action) == 8);
+
 static enum ofperr
 output_from_openflow10(const struct ofp10_action_output *oao,
                        struct ofpbuf *out)
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index d5f34d7..937423e 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -30,6 +30,7 @@
 #include "type-props.h"
 
 struct ofpbuf;
+union ofp_action;
 
 /* Port numbers. */
 enum ofperr ofputil_port_from_ofp11(ovs_be32 ofp11_port,
-- 
1.7.10.4




More information about the dev mailing list