summaryrefslogtreecommitdiff
path: root/include/openflow/openflow-1.0.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2014-08-11 12:50:36 -0700
committerBen Pfaff <blp@nicira.com>2014-08-11 12:57:17 -0700
commitc2d936a44fa612e88c743c6e7b367a9813093202 (patch)
tree4d95eb5499b40791c87bf8e6aa1003cf06ef4a43 /include/openflow/openflow-1.0.h
parent8f2cded496c13307eff2d8bd0f01dee389cf6166 (diff)
downloadopenvswitch-c2d936a44fa612e88c743c6e7b367a9813093202.tar.gz
ofp-actions: Centralize all OpenFlow action code for maintainability.
Until now, knowledge about OpenFlow has been somewhat scattered around the tree. Some of it is in ofp-actions, some of it is in ofp-util, some in separate files for individual actions, and most of the wire format declarations are in include/openflow. This commit centralizes all of that in ofp-actions. Encoding and decoding OpenFlow actions was previously broken up by OpenFlow version. This was OK with only OpenFlow 1.0 and 1.1, but each additional version added a new wrapper around the existing ones, which started to become hard to understand. This commit merges all of the processing for the different versions, to the extent that they are similar, making the version differences clearer. Previously, ofp-actions contained OpenFlow encoding and decoding, plus ofpact formatting, but OpenFlow parsing was separated into ofp-parse, which seems an odd division. This commit moves the parsing code into ofp-actions with the rest of the code. Before this commit, the four main bits of code associated with a particular ofpact--OpenFlow encoding and decoding, ofpact formatting and parsing--were all found far away from each other. This often made it hard to see what was going on for a particular ofpact, since you had to search around to many different pieces of code. This commit reorganizes so that all of the code for a given ofpact is in a single place. As a code refactoring, this commit has little visible behavioral change. The update to ofproto-dpif.at illustrates one minor bug fix as a side effect: a flow that was added with the action "dec_ttl" (a standard OpenFlow action) was previously formatted as "dec_ttl(0)" (using a Nicira extension to specifically direct packets bounced to the controller because of too-low TTL), but after this commit it is correctly formatted as "dec_ttl". The other visible effect is to drop support for the Nicira extension dec_ttl action in OpenFlow 1.1 and later in favor of the equivalent standard action. It seems unlikely that anyone was really using the Nicira extension in OF1.1 or later. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Diffstat (limited to 'include/openflow/openflow-1.0.h')
-rw-r--r--include/openflow/openflow-1.0.h50
1 files changed, 5 insertions, 45 deletions
diff --git a/include/openflow/openflow-1.0.h b/include/openflow/openflow-1.0.h
index 002c75d46..c67edd97c 100644
--- a/include/openflow/openflow-1.0.h
+++ b/include/openflow/openflow-1.0.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -170,46 +170,6 @@ struct ofp10_packet_in {
};
OFP_ASSERT(sizeof(struct ofp10_packet_in) == 12);
-enum ofp10_action_type {
- OFPAT10_OUTPUT, /* Output to switch port. */
- OFPAT10_SET_VLAN_VID, /* Set the 802.1q VLAN id. */
- OFPAT10_SET_VLAN_PCP, /* Set the 802.1q priority. */
- OFPAT10_STRIP_VLAN, /* Strip the 802.1q header. */
- OFPAT10_SET_DL_SRC, /* Ethernet source address. */
- OFPAT10_SET_DL_DST, /* Ethernet destination address. */
- OFPAT10_SET_NW_SRC, /* IP source address. */
- OFPAT10_SET_NW_DST, /* IP destination address. */
- OFPAT10_SET_NW_TOS, /* IP ToS (DSCP field, 6 bits). */
- OFPAT10_SET_TP_SRC, /* TCP/UDP source port. */
- OFPAT10_SET_TP_DST, /* TCP/UDP destination port. */
- OFPAT10_ENQUEUE, /* Output to queue. */
- OFPAT10_VENDOR = 0xffff
-};
-
-/* Action structure for OFPAT10_OUTPUT, which sends packets out 'port'.
- * When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max
- * number of bytes to send. A 'max_len' of zero means no bytes of the
- * packet should be sent. */
-struct ofp10_action_output {
- ovs_be16 type; /* OFPAT10_OUTPUT. */
- ovs_be16 len; /* Length is 8. */
- ovs_be16 port; /* Output port. */
- ovs_be16 max_len; /* Max length to send to controller. */
-};
-OFP_ASSERT(sizeof(struct ofp10_action_output) == 8);
-
-/* OFPAT10_ENQUEUE action struct: send packets to given queue on port. */
-struct ofp10_action_enqueue {
- ovs_be16 type; /* OFPAT10_ENQUEUE. */
- ovs_be16 len; /* Len is 16. */
- ovs_be16 port; /* Port that queue belongs. Should
- refer to a valid physical port
- (i.e. < OFPP_MAX) or OFPP_IN_PORT. */
- uint8_t pad[6]; /* Pad for 64-bit alignment. */
- ovs_be32 queue_id; /* Where to enqueue the packets. */
-};
-OFP_ASSERT(sizeof(struct ofp10_action_enqueue) == 16);
-
/* Send packet (controller -> datapath). */
struct ofp10_packet_out {
ovs_be32 buffer_id; /* ID assigned by datapath or UINT32_MAX. */
@@ -311,9 +271,9 @@ struct ofp10_flow_mod {
output port. A value of OFPP_NONE
indicates no restriction. */
ovs_be16 flags; /* One of OFPFF_*. */
- struct ofp_action_header actions[0]; /* The action length is inferred
- from the length field in the
- header. */
+
+ /* Followed by OpenFlow actions whose length is inferred from the length
+ * field in the OpenFlow header. */
};
OFP_ASSERT(sizeof(struct ofp10_flow_mod) == 64);
@@ -374,7 +334,7 @@ struct ofp10_flow_stats {
ovs_32aligned_be64 cookie; /* Opaque controller-issued identifier. */
ovs_32aligned_be64 packet_count; /* Number of packets in flow. */
ovs_32aligned_be64 byte_count; /* Number of bytes in flow. */
- struct ofp_action_header actions[0]; /* Actions. */
+ /* Followed by OpenFlow actions whose length is inferred from 'length'. */
};
OFP_ASSERT(sizeof(struct ofp10_flow_stats) == 88);