/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#ifndef OPENFLOW_OPENFLOW10_H
#define OPENFLOW_OPENFLOW10_H 1
-#include "openflow/openflow-common.h"
+#include <openflow/openflow-common.h>
/* Port number(s) meaning
* --------------- --------------------------------------
* 0x0000 not assigned a meaning by OpenFlow 1.0
* 0x0001...0xfeff "physical" ports
- * 0xff00...0xfff7 "reserved" but not assigned a meaning by OpenFlow 1.0
- * 0xfff8...0xffff "reserved" OFPP_* ports with assigned meanings
+ * 0xff00...0xfff6 "reserved" but not assigned a meaning by OpenFlow 1.x
+ * 0xfff7...0xffff "reserved" OFPP_* ports with assigned meanings
*/
-enum ofp_port {
- /* Ranges. */
- OFPP_MAX = 0xff00, /* Maximum number of physical switch ports. */
- OFPP_FIRST_RESV = 0xfff8, /* First assigned reserved port number. */
- OFPP_LAST_RESV = 0xffff, /* Last assigned reserved port number. */
-
- /* Reserved output "ports". */
- OFPP_IN_PORT = 0xfff8, /* Send the packet out the input port. This
- virtual port must be explicitly used
- in order to send back out of the input
- port. */
- OFPP_TABLE = 0xfff9, /* Perform actions in flow table.
- NB: This can only be the destination
- port for packet-out messages. */
- OFPP_NORMAL = 0xfffa, /* Process with normal L2/L3 switching. */
- OFPP_FLOOD = 0xfffb, /* All physical ports except input port and
- those disabled by STP. */
- OFPP_ALL = 0xfffc, /* All physical ports except input port. */
- OFPP_CONTROLLER = 0xfffd, /* Send to controller. */
- OFPP_LOCAL = 0xfffe, /* Local openflow "port". */
- OFPP_NONE = 0xffff /* Not associated with a physical port. */
-};
+
+/* Ranges. */
+#define OFPP_MAX OFP_PORT_C(0xff00) /* Max # of switch ports. */
+#define OFPP_FIRST_RESV OFP_PORT_C(0xfff7) /* First assigned reserved port. */
+#define OFPP_LAST_RESV OFP_PORT_C(0xffff) /* Last assigned reserved port. */
+
+/* Reserved output "ports". */
+#define OFPP_UNSET OFP_PORT_C(0xfff7) /* For OXM_OF_ACTSET_OUTPUT only. */
+#define OFPP_IN_PORT OFP_PORT_C(0xfff8) /* Where the packet came in. */
+#define OFPP_TABLE OFP_PORT_C(0xfff9) /* Perform actions in flow table. */
+#define OFPP_NORMAL OFP_PORT_C(0xfffa) /* Process with normal L2/L3. */
+#define OFPP_FLOOD OFP_PORT_C(0xfffb) /* All ports except input port and
+ * ports disabled by STP. */
+#define OFPP_ALL OFP_PORT_C(0xfffc) /* All ports except input port. */
+#define OFPP_CONTROLLER OFP_PORT_C(0xfffd) /* Send to controller. */
+#define OFPP_LOCAL OFP_PORT_C(0xfffe) /* Local openflow "port". */
+#define OFPP_NONE OFP_PORT_C(0xffff) /* Not associated with any port. */
/* OpenFlow 1.0 specific capabilities supported by the datapath (struct
* ofp_switch_features, member capabilities). */
/* Description of a physical port */
struct ofp10_phy_port {
ovs_be16 port_no;
- uint8_t hw_addr[OFP_ETH_ALEN];
+ struct eth_addr hw_addr;
char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */
ovs_be32 config; /* Bitmap of OFPPC_* and OFPPC10_* flags. */
/* Modify behavior of the physical port */
struct ofp10_port_mod {
ovs_be16 port_no;
- uint8_t hw_addr[OFP_ETH_ALEN]; /* The hardware address is not
- configurable. This is used to
- sanity-check the request, so it must
- be the same as returned in an
- ofp10_phy_port struct. */
+ struct eth_addr hw_addr; /* The hardware address is not configurable. This
+ is used to sanity-check the request, so it must
+ be the same as returned in an ofp10_phy_port
+ struct. */
ovs_be32 config; /* Bitmap of OFPPC_* flags. */
ovs_be32 mask; /* Bitmap of OFPPC_* flags to be changed. */
};
OFP_ASSERT(sizeof(struct ofp10_port_mod) == 24);
+struct ofp10_packet_queue {
+ ovs_be32 queue_id; /* id for the specific queue. */
+ ovs_be16 len; /* Length in bytes of this queue desc. */
+ uint8_t pad[2]; /* 64-bit alignment. */
+ /* Followed by any number of queue properties expressed using
+ * ofp_queue_prop_header, to fill out a total of 'len' bytes. */
+};
+OFP_ASSERT(sizeof(struct ofp10_packet_queue) == 8);
+
+/* Queue properties for OF1.0 to OF1.3.
+ *
+ * OF1.4+ use the same numbers but rename them and change the property formats
+ * in incompatible ways, so there's not much benefit to sharing the names. */
+enum ofp10_queue_properties {
+ /* Introduced in OF1.0. */
+ OFPQT10_MIN_RATE = 1, /* Minimum datarate guaranteed. */
+
+ /* Introduced in OF1.1. */
+ OFPQT11_MAX_RATE = 2, /* Maximum guaranteed rate. */
+ OFPQT11_EXPERIMENTER = 0xffff, /* Experimenter defined property. */
+};
+
+/* Description for a queue in OpenFlow 1.0 to 1.3.
+ *
+ * OF1.4+ also use a TLV format but an incompatible one. */
+struct ofp10_queue_prop_header {
+ ovs_be16 property; /* One of OFPQT*. */
+ ovs_be16 len; /* Length of property, including this header. */
+ uint8_t pad[4]; /* 64-bit alignemnt. */
+};
+OFP_ASSERT(sizeof(struct ofp10_queue_prop_header) == 8);
+
+/* Min-Rate and Max-Rate queue property description (OFPQT10_MIN and
+ * OFPQT11_MAX).
+ *
+ * OF1.4+ use similar TLVs but they are incompatible due to different padding.
+ */
+struct ofp10_queue_prop_rate {
+ struct ofp10_queue_prop_header prop_header;
+ ovs_be16 rate; /* In 1/10 of a percent; >1000 -> disabled. */
+ uint8_t pad[6]; /* 64-bit alignment */
+};
+OFP_ASSERT(sizeof(struct ofp10_queue_prop_rate) == 16);
+
/* Query for port queue configuration. */
struct ofp10_queue_get_config_request {
ovs_be16 port; /* Port to be queried. Should refer
};
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);
-
-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. */
struct ofp10_match {
ovs_be32 wildcards; /* Wildcard fields. */
ovs_be16 in_port; /* Input switch port. */
- uint8_t dl_src[OFP_ETH_ALEN]; /* Ethernet source address. */
- uint8_t dl_dst[OFP_ETH_ALEN]; /* Ethernet destination address. */
+ struct eth_addr dl_src; /* Ethernet source address. */
+ struct eth_addr dl_dst; /* Ethernet destination address. */
ovs_be16 dl_vlan; /* Input VLAN. */
uint8_t dl_vlan_pcp; /* Input VLAN priority. */
uint8_t pad1[1]; /* Align to 64-bits. */
OFP_ASSERT(sizeof(struct ofp10_match) == 40);
enum ofp10_flow_mod_flags {
- OFPFF10_EMERG = 1 << 2 /* Ramark this is for emergency. */
+ OFPFF10_EMERG = 1 << 2 /* Part of "emergency flow cache". */
};
/* Flow setup and teardown (controller -> datapath). */
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);
};
OFP_ASSERT(sizeof(struct ofp10_flow_removed) == 80);
-/* Statistics request or reply message. */
-struct ofp10_stats_msg {
- struct ofp_header header;
- ovs_be16 type; /* One of the OFPST_* constants. */
- ovs_be16 flags; /* Requests: always 0.
- * Replies: 0 or OFPSF_REPLY_MORE. */
-};
-OFP_ASSERT(sizeof(struct ofp10_stats_msg) == 12);
-
/* Stats request of type OFPST_AGGREGATE or OFPST_FLOW. */
struct ofp10_flow_stats_request {
struct ofp10_match match; /* Fields to match. */
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);
};
OFP_ASSERT(sizeof(struct ofp10_queue_stats) == 32);
-/* Vendor extension stats message. */
-struct ofp10_vendor_stats_msg {
- struct ofp10_stats_msg osm; /* Type OFPST_VENDOR. */
- ovs_be32 vendor; /* Vendor ID:
- * - MSB 0: low-order bytes are IEEE OUI.
- * - MSB != 0: defined by OpenFlow
- * consortium. */
- /* Followed by vendor-defined arbitrary additional data. */
-};
-OFP_ASSERT(sizeof(struct ofp10_vendor_stats_msg) == 16);
-
#endif /* openflow/openflow-1.0.h */