-/* Copyright (c) 2008, 2011, 2012 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2011, 2012, 2013, 2014 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
#ifndef OPENFLOW_11_H
#define OPENFLOW_11_H 1
-#include "openflow/openflow-common.h"
+#include <openflow/openflow-common.h>
/* OpenFlow 1.1 uses 32-bit port numbers. Open vSwitch, for now, uses OpenFlow
* 1.0 port numbers internally. We map them to OpenFlow 1.0 as follows:
* an OpenFlow 1.0 reserved port number to or from, respectively, the
* corresponding OpenFlow 1.1 reserved port number.
*/
-#define OFPP11_MAX 0xffffff00
-#define OFPP11_OFFSET (OFPP11_MAX - OFPP_MAX)
+#define OFPP11_MAX OFP11_PORT_C(0xffffff00)
+#define OFPP11_OFFSET 0xffff0000 /* OFPP11_MAX - OFPP_MAX */
/* Reserved wildcard port used only for flow mod (delete) and flow stats
* requests. Selects all flows regardless of output port
struct ofp11_port {
ovs_be32 port_no;
uint8_t pad[4];
- uint8_t hw_addr[OFP_ETH_ALEN];
+ struct eth_addr hw_addr;
uint8_t pad2[2]; /* Align to 64 bits. */
char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */
struct ofp11_port_mod {
ovs_be32 port_no;
uint8_t pad[4];
- 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
- ofp11_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 ofp11_port
+ struct. */
uint8_t pad2[2]; /* Pad to 64 bits. */
ovs_be32 config; /* Bitmap of OFPPC_* flags. */
ovs_be32 mask; /* Bitmap of OFPPC_* flags to be changed. */
/* Group setup and teardown (controller -> datapath). */
struct ofp11_group_mod {
- ovs_be16 command; /* One of OFPGC_*. */
- uint8_t type; /* One of OFPGT_*. */
+ ovs_be16 command; /* One of OFPGC11_*. */
+ uint8_t type; /* One of OFPGT11_*. */
uint8_t pad; /* Pad to 64 bits. */
ovs_be32 group_id; /* Group identifier. */
/* struct ofp11_bucket buckets[0]; The bucket length is inferred from the
OFPC11_GROUP_STATS = 1 << 3, /* Group statistics. */
};
-enum ofp11_action_type {
- OFPAT11_OUTPUT, /* Output to switch port. */
- OFPAT11_SET_VLAN_VID, /* Set the 802.1q VLAN id. */
- OFPAT11_SET_VLAN_PCP, /* Set the 802.1q priority. */
- OFPAT11_SET_DL_SRC, /* Ethernet source address. */
- OFPAT11_SET_DL_DST, /* Ethernet destination address. */
- OFPAT11_SET_NW_SRC, /* IP source address. */
- OFPAT11_SET_NW_DST, /* IP destination address. */
- OFPAT11_SET_NW_TOS, /* IP ToS (DSCP field, 6 bits). */
- OFPAT11_SET_NW_ECN, /* IP ECN (2 bits). */
- OFPAT11_SET_TP_SRC, /* TCP/UDP/SCTP source port. */
- OFPAT11_SET_TP_DST, /* TCP/UDP/SCTP destination port. */
- OFPAT11_COPY_TTL_OUT, /* Copy TTL "outwards" -- from next-to-outermost
- to outermost */
- OFPAT11_COPY_TTL_IN, /* Copy TTL "inwards" -- from outermost to
- next-to-outermost */
- OFPAT11_SET_MPLS_LABEL, /* MPLS label */
- OFPAT11_SET_MPLS_TC, /* MPLS TC */
- OFPAT11_SET_MPLS_TTL, /* MPLS TTL */
- OFPAT11_DEC_MPLS_TTL, /* Decrement MPLS TTL */
-
- OFPAT11_PUSH_VLAN, /* Push a new VLAN tag */
- OFPAT11_POP_VLAN, /* Pop the outer VLAN tag */
- OFPAT11_PUSH_MPLS, /* Push a new MPLS tag */
- OFPAT11_POP_MPLS, /* Pop the outer MPLS tag */
- OFPAT11_SET_QUEUE, /* Set queue id when outputting to a port */
- OFPAT11_GROUP, /* Apply group. */
- OFPAT11_SET_NW_TTL, /* IP TTL. */
- OFPAT11_DEC_NW_TTL, /* Decrement IP TTL. */
- OFPAT11_EXPERIMENTER = 0xffff
-};
-
#define OFPMT11_STANDARD_LENGTH 88
struct ofp11_match_header {
struct ofp11_match_header omh;
ovs_be32 in_port; /* Input switch port. */
ovs_be32 wildcards; /* Wildcard fields. */
- uint8_t dl_src[OFP_ETH_ALEN]; /* Ethernet source address. */
- uint8_t dl_src_mask[OFP_ETH_ALEN]; /* Ethernet source address mask. */
- uint8_t dl_dst[OFP_ETH_ALEN]; /* Ethernet destination address. */
- uint8_t dl_dst_mask[OFP_ETH_ALEN]; /* Ethernet destination address mask. */
+ struct eth_addr dl_src; /* Ethernet source address. */
+ struct eth_addr dl_src_mask; /* Ethernet source address mask. */
+ struct eth_addr dl_dst; /* Ethernet destination address. */
+ struct eth_addr dl_dst_mask; /* Ethernet destination address mask. */
ovs_be16 dl_vlan; /* Input VLAN id. */
uint8_t dl_vlan_pcp; /* Input VLAN priority. */
uint8_t pad1[1]; /* Align to 32-bits */
OFPIT11_EXPERIMENTER = 0xFFFF /* Experimenter instruction */
};
-#define OFPIT11_ALL (OFPIT11_GOTO_TABLE | OFPIT11_WRITE_METADATA | \
- OFPIT11_WRITE_ACTIONS | OFPIT11_APPLY_ACTIONS | \
- OFPIT11_CLEAR_ACTIONS)
-
#define OFP11_INSTRUCTION_ALIGN 8
/* Generic ofp_instruction structure. */
};
OFP_ASSERT(sizeof(struct ofp11_instruction_experimenter) == 8);
-/* Action structure for OFPAT_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 ofp11_action_output {
- ovs_be16 type; /* OFPAT11_OUTPUT. */
- ovs_be16 len; /* Length is 16. */
- ovs_be32 port; /* Output port. */
- ovs_be16 max_len; /* Max length to send to controller. */
- uint8_t pad[6]; /* Pad to 64 bits. */
-};
-OFP_ASSERT(sizeof(struct ofp11_action_output) == 16);
-
-/* Action structure for OFPAT_GROUP. */
-struct ofp11_action_group {
- ovs_be16 type; /* OFPAT11_GROUP. */
- ovs_be16 len; /* Length is 8. */
- ovs_be32 group_id; /* Group identifier. */
-};
-OFP_ASSERT(sizeof(struct ofp11_action_group) == 8);
-
-/* OFPAT_SET_QUEUE action struct: send packets to given queue on port. */
-struct ofp11_action_set_queue {
- ovs_be16 type; /* OFPAT11_SET_QUEUE. */
- ovs_be16 len; /* Len is 8. */
- ovs_be32 queue_id; /* Queue id for the packets. */
-};
-OFP_ASSERT(sizeof(struct ofp11_action_set_queue) == 8);
-
-/* Action structure for OFPAT11_SET_MPLS_LABEL. */
-struct ofp11_action_mpls_label {
- ovs_be16 type; /* OFPAT11_SET_MPLS_LABEL. */
- ovs_be16 len; /* Length is 8. */
- ovs_be32 mpls_label; /* MPLS label */
-};
-OFP_ASSERT(sizeof(struct ofp11_action_mpls_label) == 8);
-
-/* Action structure for OFPAT11_SET_MPLS_TC. */
-struct ofp11_action_mpls_tc {
- ovs_be16 type; /* OFPAT11_SET_MPLS_TC. */
- ovs_be16 len; /* Length is 8. */
- uint8_t mpls_tc; /* MPLS TC */
- uint8_t pad[3];
-};
-OFP_ASSERT(sizeof(struct ofp11_action_mpls_tc) == 8);
-
-/* Action structure for OFPAT11_SET_MPLS_TTL. */
-struct ofp11_action_mpls_ttl {
- ovs_be16 type; /* OFPAT11_SET_MPLS_TTL. */
- ovs_be16 len; /* Length is 8. */
- uint8_t mpls_ttl; /* MPLS TTL */
- uint8_t pad[3];
-};
-OFP_ASSERT(sizeof(struct ofp11_action_mpls_ttl) == 8);
-
-/* Action structure for OFPAT11_SET_NW_ECN. */
-struct ofp11_action_nw_ecn {
- ovs_be16 type; /* OFPAT11_SET_TW_SRC/DST. */
- ovs_be16 len; /* Length is 8. */
- uint8_t nw_ecn; /* IP ECN (2 bits). */
- uint8_t pad[3];
-};
-OFP_ASSERT(sizeof(struct ofp11_action_nw_ecn) == 8);
-
-/* Action structure for OFPAT11_SET_NW_TTL. */
-struct ofp11_action_nw_ttl {
- ovs_be16 type; /* OFPAT11_SET_NW_TTL. */
- ovs_be16 len; /* Length is 8. */
- uint8_t nw_ttl; /* IP TTL */
- uint8_t pad[3];
-};
-OFP_ASSERT(sizeof(struct ofp11_action_nw_ttl) == 8);
-
-/* Action structure for OFPAT11_PUSH_VLAN/MPLS. */
-struct ofp11_action_push {
- ovs_be16 type; /* OFPAT11_PUSH_VLAN/MPLS. */
- ovs_be16 len; /* Length is 8. */
- ovs_be16 ethertype; /* Ethertype */
- uint8_t pad[2];
-};
-OFP_ASSERT(sizeof(struct ofp11_action_push) == 8);
-
-/* Action structure for OFPAT11_POP_MPLS. */
-struct ofp11_action_pop_mpls {
- ovs_be16 type; /* OFPAT11_POP_MPLS. */
- ovs_be16 len; /* Length is 8. */
- ovs_be16 ethertype; /* Ethertype */
- uint8_t pad[2];
-};
-OFP_ASSERT(sizeof(struct ofp11_action_pop_mpls) == 8);
-
/* Configure/Modify behavior of a flow table */
struct ofp11_table_mod {
uint8_t table_id; /* ID of the table, 0xFF indicates all tables */
};
OFP_ASSERT(sizeof(struct ofp11_table_mod) == 8);
-/* Flags to indicate behavior of the flow table for unmatched packets.
- These flags are used in ofp_table_stats messages to describe the current
- configuration and in ofp_table_mod messages to configure table behavior. */
-enum ofp11_table_config {
- OFPTC11_TABLE_MISS_CONTROLLER = 0, /* Send to controller. */
- OFPTC11_TABLE_MISS_CONTINUE = 1 << 0, /* Continue to the next table in the
- pipeline (OpenFlow 1.0
- behavior). */
- OFPTC11_TABLE_MISS_DROP = 1 << 1, /* Drop the packet. */
- OFPTC11_TABLE_MISS_MASK = 3
-};
-
/* Flow setup and teardown (controller -> datapath). */
struct ofp11_flow_mod {
ovs_be64 cookie; /* Opaque controller-issued identifier. */
indicates no restriction. */
ovs_be32 out_group; /* For OFPFC_DELETE* commands, require
matching entries to include this as an
- output group. A value of OFPG11_ANY
+ output group. A value of OFPG_ANY
indicates no restriction. */
ovs_be16 flags; /* One of OFPFF_*. */
- uint8_t pad[2];
+ ovs_be16 importance; /* Eviction precedence (OF1.4+). */
/* Followed by an ofp11_match structure. */
/* Followed by an instruction set. */
};
OFPGT11_FF /* Fast failover group. */
};
-/* Group numbering. Groups can use any number up to OFPG_MAX. */
-enum ofp11_group {
- /* Last usable group number. */
- OFPG11_MAX = 0xffffff00,
-
- /* Fake groups. */
- OFPG11_ALL = 0xfffffffc, /* Represents all groups for group delete
- commands. */
- OFPG11_ANY = 0xffffffff /* Wildcard group used only for flow stats
- requests. Selects all flows regardless
- of group (including flows with no
- group). */
-};
-
/* Bucket for use in groups. */
struct ofp11_bucket {
ovs_be16 len; /* Length the bucket in bytes, including
};
OFP_ASSERT(sizeof(struct ofp11_stats_msg) == 16);
-/* Vendor extension stats message. */
-struct ofp11_vendor_stats_msg {
- struct ofp11_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 ofp11_vendor_stats_msg) == 20);
-
/* Stats request of type OFPST_FLOW. */
struct ofp11_flow_stats_request {
uint8_t table_id; /* ID of table to read (from ofp_table_stats),
as an output port. A value of OFPP_ANY
indicates no restriction. */
ovs_be32 out_group; /* Require matching entries to include this
- as an output group. A value of OFPG11_ANY
+ as an output group. A value of OFPG_ANY
indicates no restriction. */
uint8_t pad2[4]; /* Align to 64 bits. */
ovs_be64 cookie; /* Require matching entries to contain this
ovs_be16 idle_timeout; /* Number of seconds idle before expiration. */
ovs_be16 hard_timeout; /* Number of seconds before expiration. */
ovs_be16 flags; /* OF 1.3: Set of OFPFF*. */
- uint8_t pad2[4]; /* Align to 64-bits. */
+ ovs_be16 importance; /* Eviction precedence (OF1.4+). */
+ uint8_t pad2[2]; /* Align to 64-bits. */
ovs_be64 cookie; /* Opaque controller-issued identifier. */
ovs_be64 packet_count; /* Number of packets in flow. */
ovs_be64 byte_count; /* Number of bytes in flow. */
- /* Open Flow version specific match */
+ /* OpenFlow version specific match */
/* struct ofp11_instruction instructions[0]; Instruction set. */
};
OFP_ASSERT(sizeof(struct ofp11_flow_stats) == 48);
};
OFP_ASSERT(sizeof(struct ofp11_group_stats_request) == 8);
+/* Used in group stats replies. */
+struct ofp11_bucket_counter {
+ ovs_be64 packet_count; /* Number of packets processed by bucket. */
+ ovs_be64 byte_count; /* Number of bytes processed by bucket. */
+};
+OFP_ASSERT(sizeof(struct ofp11_bucket_counter) == 16);
+
/* Body of reply to OFPST11_GROUP request */
struct ofp11_group_stats {
ovs_be16 length; /* Length of this entry. */
uint8_t pad2[4]; /* Align to 64 bits. */
ovs_be64 packet_count; /* Number of packets processed by group. */
ovs_be64 byte_count; /* Number of bytes processed by group. */
- /* struct ofp11_bucket_counter bucket_stats[0]; */
-
+ /* struct ofp11_bucket_counter bucket_stats[]; */
};
OFP_ASSERT(sizeof(struct ofp11_group_stats) == 32);
-/* Used in group stats replies. */
-struct ofp11_bucket_counter {
- ovs_be64 packet_count; /* Number of packets processed by bucket. */
- ovs_be64 byte_count; /* Number of bytes processed by bucket. */
-};
-OFP_ASSERT(sizeof(struct ofp11_bucket_counter) == 16);
-
/* Body of reply to OFPST11_GROUP_DESC request. */
struct ofp11_group_desc_stats {
ovs_be16 length; /* Length of this entry. */
- uint8_t type; /* One of OFPGT_*. */
+ uint8_t type; /* One of OFPGT11_*. */
uint8_t pad; /* Pad to 64 bits. */
ovs_be32 group_id; /* Group identifier. */
/* struct ofp11_bucket buckets[0]; */
ovs_be16 total_len; /* Full length of frame. */
uint8_t reason; /* Reason packet is being sent (one of OFPR_*) */
uint8_t table_id; /* ID of the table that was looked up */
- /* uint8_t data[0]; Ethernet frame, halfway through 32-bit word,
- so the IP header is 32-bit aligned. The
- amount of data is inferred from the length
- field in the header. Because of padding,
- offsetof(struct ofp_packet_in, data) ==
- sizeof(struct ofp_packet_in) - 2. */
+ /* Followed by Ethernet frame. */
};
OFP_ASSERT(sizeof(struct ofp11_packet_in) == 16);