openflow build environment setup

This commit is contained in:
2025-11-11 16:45:43 +08:00
parent be0a7ad9b3
commit 50ecb9a23f
2767 changed files with 62766 additions and 649828 deletions

View File

@ -0,0 +1,73 @@
/*
* Copyright(c) 2016 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OPENFLOW_INTEL_EXT_H
#define OPENFLOW_INTEL_EXT_H
/* This file presents Intel vendor extension. It is not anyhow
* standardized, so all those definitions are not part of
* official openflow headers (openflow.h). Nevertheless below
* features introduces real value so it could be suitable for
* standardization */
/* Intel extended statistics type */
enum intel_port_stats_subtype {
INTEL_PORT_STATS_RFC2819 = 1,
};
#define INTEL_PORT_STATS_RFC2819_SIZE 184
/* Struct implements custom property type based on
* 'ofp_prop_experimenter'. */
struct intel_port_stats_rfc2819 {
ovs_be16 type; /* OFPPSPT14_EXPERIMENTER. */
ovs_be16 length; /* Length in bytes of this property excluding
* trailing padding. */
ovs_be32 experimenter; /* INTEL_VENDOR_ID. */
ovs_be32 exp_type; /* INTEL_PORT_STATS_*. */
uint8_t pad[4];
ovs_be64 rx_1_to_64_packets;
ovs_be64 rx_65_to_127_packets;
ovs_be64 rx_128_to_255_packets;
ovs_be64 rx_256_to_511_packets;
ovs_be64 rx_512_to_1023_packets;
ovs_be64 rx_1024_to_1522_packets;
ovs_be64 rx_1523_to_max_packets;
ovs_be64 tx_1_to_64_packets;
ovs_be64 tx_65_to_127_packets;
ovs_be64 tx_128_to_255_packets;
ovs_be64 tx_256_to_511_packets;
ovs_be64 tx_512_to_1023_packets;
ovs_be64 tx_1024_to_1522_packets;
ovs_be64 tx_1523_to_max_packets;
ovs_be64 tx_multicast_packets;
ovs_be64 rx_broadcast_packets;
ovs_be64 tx_broadcast_packets;
ovs_be64 rx_undersized_errors;
ovs_be64 rx_oversize_errors;
ovs_be64 rx_fragmented_errors;
ovs_be64 rx_jabber_errors;
};
OFP_ASSERT(sizeof (struct intel_port_stats_rfc2819) ==
INTEL_PORT_STATS_RFC2819_SIZE);
#endif /* openflow/intel-ext.h */

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2014 Netronome.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OPENFLOW_NETRONOME_EXT_H
#define OPENFLOW_NETRONOME_EXT_H 1
#include "openflow/openflow.h"
#include "openvswitch/types.h"
/* The following vendor extension, proposed by Netronome, is not yet
* standardized, so they are not included in openflow.h. It may
* be suitable for standardization */
/* Netronome enhanced select group */
enum ntr_group_mod_subtype {
NTRT_SELECTION_METHOD = 1,
};
#define NTR_MAX_SELECTION_METHOD_LEN 16
struct ntr_group_prop_selection_method {
ovs_be16 type; /* OFPGPT15_EXPERIMENTER. */
ovs_be16 length; /* Length in bytes of this property
* excluding trailing padding. */
ovs_be32 experimenter; /* NTR_VENDOR_ID. */
ovs_be32 exp_type; /* NTRT_SELECTION_METHOD. */
ovs_be32 pad;
char selection_method[NTR_MAX_SELECTION_METHOD_LEN];
/* Null-terminated */
ovs_be64 selection_method_param; /* Non-Field parameter for
* bucket selection. */
/* Followed by:
* - Exactly (length - 40) (possibly 0) bytes containing OXM TLVs, then
* - Exactly ((length + 7)/8*8 - length) (between 0 and 7) bytes of
* all-zero bytes
* In summary, ntr_group_prop_selection_method is padded as needed,
* to make its overall size a multiple of 8, to preserve alignment
* in structures using it.
*/
/* uint8_t field_array[0]; */ /* Zero or more fields encoded as
* OXM TLVs where the has_mask bit must
* be zero and the value it specifies is
* a mask to apply to packet fields and
* then input them to the selection
* method of a select group. */
/* uint8_t pad2[0]; */
};
OFP_ASSERT(sizeof(struct ntr_group_prop_selection_method) == 40);
#endif /* openflow/netronome-ext.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,438 @@
/*
* 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.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* OpenFlow: protocol between controller and datapath. */
#ifndef OPENFLOW_OPENFLOW10_H
#define OPENFLOW_OPENFLOW10_H 1
#include <openflow/openflow-common.h>
/* Port number(s) meaning
* --------------- --------------------------------------
* 0x0000 not assigned a meaning by OpenFlow 1.0
* 0x0001...0xfeff "physical" ports
* 0xff00...0xfff6 "reserved" but not assigned a meaning by OpenFlow 1.x
* 0xfff7...0xffff "reserved" OFPP_* ports with assigned meanings
*/
/* 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). */
enum ofp10_capabilities {
OFPC10_STP = 1 << 3, /* 802.1d spanning tree. */
OFPC10_RESERVED = 1 << 4, /* Reserved, must not be set. */
};
/* OpenFlow 1.0 specific flags to indicate behavior of the physical port.
* These flags are used in ofp10_phy_port to describe the current
* configuration. They are used in the ofp10_port_mod message to configure the
* port's behavior.
*/
enum ofp10_port_config {
OFPPC10_NO_STP = 1 << 1, /* Disable 802.1D spanning tree on port. */
OFPPC10_NO_RECV_STP = 1 << 3, /* Drop received 802.1D STP packets. */
OFPPC10_NO_FLOOD = 1 << 4, /* Do not include port when flooding. */
#define OFPPC10_ALL (OFPPC_PORT_DOWN | OFPPC10_NO_STP | OFPPC_NO_RECV | \
OFPPC10_NO_RECV_STP | OFPPC10_NO_FLOOD | OFPPC_NO_FWD | \
OFPPC_NO_PACKET_IN)
};
/* OpenFlow 1.0 specific current state of the physical port. These are not
* configurable from the controller.
*/
enum ofp10_port_state {
/* The OFPPS10_STP_* bits have no effect on switch operation. The
* controller must adjust OFPPC_NO_RECV, OFPPC_NO_FWD, and
* OFPPC_NO_PACKET_IN appropriately to fully implement an 802.1D spanning
* tree. */
OFPPS10_STP_LISTEN = 0 << 8, /* Not learning or relaying frames. */
OFPPS10_STP_LEARN = 1 << 8, /* Learning but not relaying frames. */
OFPPS10_STP_FORWARD = 2 << 8, /* Learning and relaying frames. */
OFPPS10_STP_BLOCK = 3 << 8, /* Not part of spanning tree. */
OFPPS10_STP_MASK = 3 << 8 /* Bit mask for OFPPS10_STP_* values. */
#define OFPPS10_ALL (OFPPS_LINK_DOWN | OFPPS10_STP_MASK)
};
/* OpenFlow 1.0 specific features of physical ports available in a datapath. */
enum ofp10_port_features {
OFPPF10_COPPER = 1 << 7, /* Copper medium. */
OFPPF10_FIBER = 1 << 8, /* Fiber medium. */
OFPPF10_AUTONEG = 1 << 9, /* Auto-negotiation. */
OFPPF10_PAUSE = 1 << 10, /* Pause. */
OFPPF10_PAUSE_ASYM = 1 << 11 /* Asymmetric pause. */
};
/* Description of a physical port */
struct ofp10_phy_port {
ovs_be16 port_no;
struct eth_addr hw_addr;
char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */
ovs_be32 config; /* Bitmap of OFPPC_* and OFPPC10_* flags. */
ovs_be32 state; /* Bitmap of OFPPS_* and OFPPS10_* flags. */
/* Bitmaps of OFPPF_* and OFPPF10_* that describe features. All bits
* zeroed if unsupported or unavailable. */
ovs_be32 curr; /* Current features. */
ovs_be32 advertised; /* Features being advertised by the port. */
ovs_be32 supported; /* Features supported by the port. */
ovs_be32 peer; /* Features advertised by peer. */
};
OFP_ASSERT(sizeof(struct ofp10_phy_port) == 48);
/* Modify behavior of the physical port */
struct ofp10_port_mod {
ovs_be16 port_no;
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. */
ovs_be32 advertise; /* Bitmap of "ofp_port_features"s. Zero all
bits to prevent any action taking place. */
uint8_t pad[4]; /* Pad to 64-bits. */
};
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
to a valid physical port (i.e. < OFPP_MAX) */
uint8_t pad[2];
/* 32-bit alignment. */
};
OFP_ASSERT(sizeof(struct ofp10_queue_get_config_request) == 4);
/* Queue configuration for a given port. */
struct ofp10_queue_get_config_reply {
ovs_be16 port;
uint8_t pad[6];
/* struct ofp10_packet_queue queues[0]; List of configured queues. */
};
OFP_ASSERT(sizeof(struct ofp10_queue_get_config_reply) == 8);
/* Packet received on port (datapath -> controller). */
struct ofp10_packet_in {
ovs_be32 buffer_id; /* ID assigned by datapath. */
ovs_be16 total_len; /* Full length of frame. */
ovs_be16 in_port; /* Port on which frame was received. */
uint8_t reason; /* Reason packet is being sent (one of OFPR_*) */
uint8_t pad;
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. */
};
OFP_ASSERT(sizeof(struct ofp10_packet_in) == 12);
/* Send packet (controller -> datapath). */
struct ofp10_packet_out {
ovs_be32 buffer_id; /* ID assigned by datapath or UINT32_MAX. */
ovs_be16 in_port; /* Packet's input port (OFPP_NONE if none). */
ovs_be16 actions_len; /* Size of action array in bytes. */
/* Followed by:
* - Exactly 'actions_len' bytes (possibly 0 bytes, and always a multiple
* of 8) containing actions.
* - If 'buffer_id' == UINT32_MAX, packet data to fill out the remainder
* of the message length.
*/
};
OFP_ASSERT(sizeof(struct ofp10_packet_out) == 8);
/* Flow wildcards. */
enum ofp10_flow_wildcards {
OFPFW10_IN_PORT = 1 << 0, /* Switch input port. */
OFPFW10_DL_VLAN = 1 << 1, /* VLAN vid. */
OFPFW10_DL_SRC = 1 << 2, /* Ethernet source address. */
OFPFW10_DL_DST = 1 << 3, /* Ethernet destination address. */
OFPFW10_DL_TYPE = 1 << 4, /* Ethernet frame type. */
OFPFW10_NW_PROTO = 1 << 5, /* IP protocol. */
OFPFW10_TP_SRC = 1 << 6, /* TCP/UDP source port. */
OFPFW10_TP_DST = 1 << 7, /* TCP/UDP destination port. */
/* IP source address wildcard bit count. 0 is exact match, 1 ignores the
* LSB, 2 ignores the 2 least-significant bits, ..., 32 and higher wildcard
* the entire field. This is the *opposite* of the usual convention where
* e.g. /24 indicates that 8 bits (not 24 bits) are wildcarded. */
OFPFW10_NW_SRC_SHIFT = 8,
OFPFW10_NW_SRC_BITS = 6,
OFPFW10_NW_SRC_MASK = (((1 << OFPFW10_NW_SRC_BITS) - 1)
<< OFPFW10_NW_SRC_SHIFT),
OFPFW10_NW_SRC_ALL = 32 << OFPFW10_NW_SRC_SHIFT,
/* IP destination address wildcard bit count. Same format as source. */
OFPFW10_NW_DST_SHIFT = 14,
OFPFW10_NW_DST_BITS = 6,
OFPFW10_NW_DST_MASK = (((1 << OFPFW10_NW_DST_BITS) - 1)
<< OFPFW10_NW_DST_SHIFT),
OFPFW10_NW_DST_ALL = 32 << OFPFW10_NW_DST_SHIFT,
OFPFW10_DL_VLAN_PCP = 1 << 20, /* VLAN priority. */
OFPFW10_NW_TOS = 1 << 21, /* IP ToS (DSCP field, 6 bits). */
/* Wildcard all fields. */
OFPFW10_ALL = ((1 << 22) - 1)
};
/* The wildcards for ICMP type and code fields use the transport source
* and destination port fields, respectively. */
#define OFPFW10_ICMP_TYPE OFPFW10_TP_SRC
#define OFPFW10_ICMP_CODE OFPFW10_TP_DST
/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
* special conditions. All ones indicates that 802.1Q header is not present.
*/
#define OFP10_VLAN_NONE 0xffff
/* Fields to match against flows */
struct ofp10_match {
ovs_be32 wildcards; /* Wildcard fields. */
ovs_be16 in_port; /* Input switch port. */
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. */
ovs_be16 dl_type; /* Ethernet frame type. */
uint8_t nw_tos; /* IP ToS (DSCP field, 6 bits). */
uint8_t nw_proto; /* IP protocol or lower 8 bits of
ARP opcode. */
uint8_t pad2[2]; /* Align to 64-bits. */
ovs_be32 nw_src; /* IP source address. */
ovs_be32 nw_dst; /* IP destination address. */
ovs_be16 tp_src; /* TCP/UDP source port. */
ovs_be16 tp_dst; /* TCP/UDP destination port. */
};
OFP_ASSERT(sizeof(struct ofp10_match) == 40);
enum ofp10_flow_mod_flags {
OFPFF10_EMERG = 1 << 2 /* Part of "emergency flow cache". */
};
/* Flow setup and teardown (controller -> datapath). */
struct ofp10_flow_mod {
struct ofp10_match match; /* Fields to match */
ovs_be64 cookie; /* Opaque controller-issued identifier. */
/* Flow actions. */
ovs_be16 command; /* One of OFPFC_*. */
ovs_be16 idle_timeout; /* Idle time before discarding (seconds). */
ovs_be16 hard_timeout; /* Max time before discarding (seconds). */
ovs_be16 priority; /* Priority level of flow entry. */
ovs_be32 buffer_id; /* Buffered packet to apply to (or -1).
Not meaningful for OFPFC_DELETE*. */
ovs_be16 out_port; /* For OFPFC_DELETE* commands, require
matching entries to include this as an
output port. A value of OFPP_NONE
indicates no restriction. */
ovs_be16 flags; /* One of OFPFF_*. */
/* Followed by OpenFlow actions whose length is inferred from the length
* field in the OpenFlow header. */
};
OFP_ASSERT(sizeof(struct ofp10_flow_mod) == 64);
/* Flow removed (datapath -> controller). */
struct ofp10_flow_removed {
struct ofp10_match match; /* Description of fields. */
ovs_be64 cookie; /* Opaque controller-issued identifier. */
ovs_be16 priority; /* Priority level of flow entry. */
uint8_t reason; /* One of OFPRR_*. */
uint8_t pad[1]; /* Align to 32-bits. */
ovs_be32 duration_sec; /* Time flow was alive in seconds. */
ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond
duration_sec. */
ovs_be16 idle_timeout; /* Idle timeout from original flow mod. */
uint8_t pad2[2]; /* Align to 64-bits. */
ovs_be64 packet_count;
ovs_be64 byte_count;
};
OFP_ASSERT(sizeof(struct ofp10_flow_removed) == 80);
/* Stats request of type OFPST_AGGREGATE or OFPST_FLOW. */
struct ofp10_flow_stats_request {
struct ofp10_match match; /* Fields to match. */
uint8_t table_id; /* ID of table to read (from ofp_table_stats)
or 0xff for all tables. */
uint8_t pad; /* Align to 32 bits. */
ovs_be16 out_port; /* Require matching entries to include this
as an output port. A value of OFPP_NONE
indicates no restriction. */
};
OFP_ASSERT(sizeof(struct ofp10_flow_stats_request) == 44);
/* Body of reply to OFPST_FLOW request. */
struct ofp10_flow_stats {
ovs_be16 length; /* Length of this entry. */
uint8_t table_id; /* ID of table flow came from. */
uint8_t pad;
struct ofp10_match match; /* Description of fields. */
ovs_be32 duration_sec; /* Time flow has been alive in seconds. */
ovs_be32 duration_nsec; /* Time flow has been alive in nanoseconds
beyond duration_sec. */
ovs_be16 priority; /* Priority of the entry. Only meaningful
when this is not an exact-match entry. */
ovs_be16 idle_timeout; /* Number of seconds idle before expiration. */
ovs_be16 hard_timeout; /* Number of seconds before expiration. */
uint8_t pad2[6]; /* Align to 64 bits. */
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. */
/* Followed by OpenFlow actions whose length is inferred from 'length'. */
};
OFP_ASSERT(sizeof(struct ofp10_flow_stats) == 88);
/* Body of reply to OFPST_TABLE request. */
struct ofp10_table_stats {
uint8_t table_id; /* Identifier of table. Lower numbered tables
are consulted first. */
uint8_t pad[3]; /* Align to 32-bits. */
char name[OFP_MAX_TABLE_NAME_LEN];
ovs_be32 wildcards; /* Bitmap of OFPFW10_* wildcards that are
supported by the table. */
ovs_be32 max_entries; /* Max number of entries supported. */
ovs_be32 active_count; /* Number of active entries. */
ovs_32aligned_be64 lookup_count; /* # of packets looked up in table. */
ovs_32aligned_be64 matched_count; /* Number of packets that hit table. */
};
OFP_ASSERT(sizeof(struct ofp10_table_stats) == 64);
/* Stats request of type OFPST_PORT. */
struct ofp10_port_stats_request {
ovs_be16 port_no; /* OFPST_PORT message may request statistics
for a single port (specified with port_no)
or for all ports (port_no == OFPP_NONE). */
uint8_t pad[6];
};
OFP_ASSERT(sizeof(struct ofp10_port_stats_request) == 8);
/* Body of reply to OFPST_PORT request. If a counter is unsupported, set
* the field to all ones. */
struct ofp10_port_stats {
ovs_be16 port_no;
uint8_t pad[6]; /* Align to 64-bits. */
ovs_32aligned_be64 rx_packets; /* Number of received packets. */
ovs_32aligned_be64 tx_packets; /* Number of transmitted packets. */
ovs_32aligned_be64 rx_bytes; /* Number of received bytes. */
ovs_32aligned_be64 tx_bytes; /* Number of transmitted bytes. */
ovs_32aligned_be64 rx_dropped; /* Number of packets dropped by RX. */
ovs_32aligned_be64 tx_dropped; /* Number of packets dropped by TX. */
ovs_32aligned_be64 rx_errors; /* Number of receive errors. This is a
super-set of receive errors and should be
great than or equal to the sum of all
rx_*_err values. */
ovs_32aligned_be64 tx_errors; /* Number of transmit errors. This is a
super-set of transmit errors. */
ovs_32aligned_be64 rx_frame_err; /* Number of frame alignment errors. */
ovs_32aligned_be64 rx_over_err; /* Number of packets with RX overrun. */
ovs_32aligned_be64 rx_crc_err; /* Number of CRC errors. */
ovs_32aligned_be64 collisions; /* Number of collisions. */
};
OFP_ASSERT(sizeof(struct ofp10_port_stats) == 104);
/* All ones is used to indicate all queues in a port (for stats retrieval). */
#define OFPQ_ALL 0xffffffff
/* Body for stats request of type OFPST_QUEUE. */
struct ofp10_queue_stats_request {
ovs_be16 port_no; /* All ports if OFPP_ALL. */
uint8_t pad[2]; /* Align to 32-bits. */
ovs_be32 queue_id; /* All queues if OFPQ_ALL. */
};
OFP_ASSERT(sizeof(struct ofp10_queue_stats_request) == 8);
/* Body for stats reply of type OFPST_QUEUE consists of an array of this
* structure type. */
struct ofp10_queue_stats {
ovs_be16 port_no;
uint8_t pad[2]; /* Align to 32-bits. */
ovs_be32 queue_id; /* Queue id. */
ovs_32aligned_be64 tx_bytes; /* Number of transmitted bytes. */
ovs_32aligned_be64 tx_packets; /* Number of transmitted packets. */
ovs_32aligned_be64 tx_errors; /* # of packets dropped due to overrun. */
};
OFP_ASSERT(sizeof(struct ofp10_queue_stats) == 32);
#endif /* openflow/openflow-1.0.h */

View File

@ -0,0 +1,606 @@
/* Copyright (c) 2008, 2011, 2012, 2013, 2014, 2016 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
* (Software) available for public use and benefit with the expectation
* that others will use, modify and enhance the Software and contribute
* those enhancements back to the community. However, since we would
* like to make the Software available for broadest use, with as few
* restrictions as possible permission is hereby granted, free of
* charge, to any person obtaining a copy of this Software to deal in
* the Software under the copyrights without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* The name and trademarks of copyright holder(s) may NOT be used in
* advertising or publicity pertaining to the Software or any
* derivatives without specific, written prior permission.
*/
/*
* Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* OpenFlow: protocol between controller and datapath. */
#ifndef OPENFLOW_11_H
#define OPENFLOW_11_H 1
#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:
*
* OF1.1 <=> OF1.0
* ----------------------- ---------------
* 0x00000000...0x0000feff <=> 0x0000...0xfeff "physical" ports
* 0x0000ff00...0xfffffeff <=> not supported
* 0xffffff00...0xffffffff <=> 0xff00...0xffff "reserved" OFPP_* ports
*
* OFPP11_OFFSET is the value that must be added or subtracted to convert
* an OpenFlow 1.0 reserved port number to or from, respectively, the
* corresponding OpenFlow 1.1 reserved port number.
*/
#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
* (including flows with no output port)
*
* Define it via OFPP_NONE (0xFFFF) so that OFPP_ANY is still an enum ofp_port
*/
#define OFPP_ANY OFPP_NONE
/* OpenFlow 1.1 port config flags are just the common flags. */
#define OFPPC11_ALL \
(OFPPC_PORT_DOWN | OFPPC_NO_RECV | OFPPC_NO_FWD | OFPPC_NO_PACKET_IN)
/* OpenFlow 1.1 specific current state of the physical port. These are not
* configurable from the controller.
*/
enum ofp11_port_state {
OFPPS11_BLOCKED = 1 << 1, /* Port is blocked */
OFPPS11_LIVE = 1 << 2, /* Live for Fast Failover Group. */
#define OFPPS11_ALL (OFPPS_LINK_DOWN | OFPPS11_BLOCKED | OFPPS11_LIVE)
};
/* OpenFlow 1.1 specific features of ports available in a datapath. */
enum ofp11_port_features {
OFPPF11_40GB_FD = 1 << 7, /* 40 Gb full-duplex rate support. */
OFPPF11_100GB_FD = 1 << 8, /* 100 Gb full-duplex rate support. */
OFPPF11_1TB_FD = 1 << 9, /* 1 Tb full-duplex rate support. */
OFPPF11_OTHER = 1 << 10, /* Other rate, not in the list. */
OFPPF11_COPPER = 1 << 11, /* Copper medium. */
OFPPF11_FIBER = 1 << 12, /* Fiber medium. */
OFPPF11_AUTONEG = 1 << 13, /* Auto-negotiation. */
OFPPF11_PAUSE = 1 << 14, /* Pause. */
OFPPF11_PAUSE_ASYM = 1 << 15 /* Asymmetric pause. */
#define OFPPF11_ALL ((1 << 16) - 1)
};
/* Description of a port */
struct ofp11_port {
ovs_be32 port_no;
uint8_t pad[4];
struct eth_addr hw_addr;
uint8_t pad2[2]; /* Align to 64 bits. */
char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */
ovs_be32 config; /* Bitmap of OFPPC_* flags. */
ovs_be32 state; /* Bitmap of OFPPS_* and OFPPS11_* flags. */
/* Bitmaps of OFPPF_* and OFPPF11_* that describe features. All bits
* zeroed if unsupported or unavailable. */
ovs_be32 curr; /* Current features. */
ovs_be32 advertised; /* Features being advertised by the port. */
ovs_be32 supported; /* Features supported by the port. */
ovs_be32 peer; /* Features advertised by peer. */
ovs_be32 curr_speed; /* Current port bitrate in kbps. */
ovs_be32 max_speed; /* Max port bitrate in kbps */
};
OFP_ASSERT(sizeof(struct ofp11_port) == 64);
/* Modify behavior of the physical port */
struct ofp11_port_mod {
ovs_be32 port_no;
uint8_t pad[4];
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. */
ovs_be32 advertise; /* Bitmap of OFPPF_* and OFPPF11_*. Zero all bits
to prevent any action taking place. */
uint8_t pad3[4]; /* Pad to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp11_port_mod) == 32);
/* Group setup and teardown (controller -> datapath). */
struct ofp11_group_mod {
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
length field in the header. */
};
OFP_ASSERT(sizeof(struct ofp11_group_mod) == 8);
/* Query for port queue configuration. */
struct ofp11_queue_get_config_request {
ovs_be32 port;
/* Port to be queried. Should refer
to a valid physical port (i.e. < OFPP_MAX) */
uint8_t pad[4];
};
OFP_ASSERT(sizeof(struct ofp11_queue_get_config_request) == 8);
/* Group commands */
enum ofp11_group_mod_command {
OFPGC11_ADD, /* New group. */
OFPGC11_MODIFY, /* Modify all matching groups. */
OFPGC11_DELETE, /* Delete all matching groups. */
OFPGC11_ADD_OR_MOD = 0x8000, /* Create new or modify existing group. */
};
/* OpenFlow 1.1 specific capabilities supported by the datapath (struct
* ofp_switch_features, member capabilities). */
enum ofp11_capabilities {
OFPC11_GROUP_STATS = 1 << 3, /* Group statistics. */
};
#define OFPMT11_STANDARD_LENGTH 88
struct ofp11_match_header {
ovs_be16 type; /* One of OFPMT_* */
ovs_be16 length; /* Length of match */
};
OFP_ASSERT(sizeof(struct ofp11_match_header) == 4);
/* Fields to match against flows */
struct ofp11_match {
struct ofp11_match_header omh;
ovs_be32 in_port; /* Input switch port. */
ovs_be32 wildcards; /* Wildcard fields. */
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 */
ovs_be16 dl_type; /* Ethernet frame type. */
uint8_t nw_tos; /* IP ToS (actually DSCP field, 6 bits). */
uint8_t nw_proto; /* IP protocol or lower 8 bits of ARP opcode. */
ovs_be32 nw_src; /* IP source address. */
ovs_be32 nw_src_mask; /* IP source address mask. */
ovs_be32 nw_dst; /* IP destination address. */
ovs_be32 nw_dst_mask; /* IP destination address mask. */
ovs_be16 tp_src; /* TCP/UDP/SCTP source port. */
ovs_be16 tp_dst; /* TCP/UDP/SCTP destination port. */
ovs_be32 mpls_label; /* MPLS label. */
uint8_t mpls_tc; /* MPLS TC. */
uint8_t pad2[3]; /* Align to 64-bits */
ovs_be64 metadata; /* Metadata passed between tables. */
ovs_be64 metadata_mask; /* Mask for metadata. */
};
OFP_ASSERT(sizeof(struct ofp11_match) == OFPMT11_STANDARD_LENGTH);
/* Flow wildcards. */
enum ofp11_flow_wildcards {
OFPFW11_IN_PORT = 1 << 0, /* Switch input port. */
OFPFW11_DL_VLAN = 1 << 1, /* VLAN id. */
OFPFW11_DL_VLAN_PCP = 1 << 2, /* VLAN priority. */
OFPFW11_DL_TYPE = 1 << 3, /* Ethernet frame type. */
OFPFW11_NW_TOS = 1 << 4, /* IP ToS (DSCP field, 6 bits). */
OFPFW11_NW_PROTO = 1 << 5, /* IP protocol. */
OFPFW11_TP_SRC = 1 << 6, /* TCP/UDP/SCTP source port. */
OFPFW11_TP_DST = 1 << 7, /* TCP/UDP/SCTP destination port. */
OFPFW11_MPLS_LABEL = 1 << 8, /* MPLS label. */
OFPFW11_MPLS_TC = 1 << 9, /* MPLS TC. */
/* Wildcard all fields. */
OFPFW11_ALL = ((1 << 10) - 1)
};
/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
* special conditions.
*/
enum ofp11_vlan_id {
OFPVID11_ANY = 0xfffe, /* Indicate that a VLAN id is set but don't care
about it's value. Note: only valid when
specifying the VLAN id in a match */
OFPVID11_NONE = 0xffff, /* No VLAN id was set. */
};
enum ofp11_instruction_type {
OFPIT11_GOTO_TABLE = 1, /* Setup the next table in the lookup
pipeline */
OFPIT11_WRITE_METADATA = 2, /* Setup the metadata field for use later
in pipeline */
OFPIT11_WRITE_ACTIONS = 3, /* Write the action(s) onto the datapath
action set */
OFPIT11_APPLY_ACTIONS = 4, /* Applies the action(s) immediately */
OFPIT11_CLEAR_ACTIONS = 5, /* Clears all actions from the datapath
action set */
OFPIT11_EXPERIMENTER = 0xFFFF /* Experimenter instruction */
};
#define OFP11_INSTRUCTION_ALIGN 8
/* Generic ofp_instruction structure. */
struct ofp11_instruction {
ovs_be16 type; /* Instruction type */
ovs_be16 len; /* Length of this struct in bytes. */
uint8_t pad[4]; /* Align to 64-bits */
};
OFP_ASSERT(sizeof(struct ofp11_instruction) == 8);
/* Instruction structure for OFPIT_GOTO_TABLE */
struct ofp11_instruction_goto_table {
ovs_be16 type; /* OFPIT_GOTO_TABLE */
ovs_be16 len; /* Length of this struct in bytes. */
uint8_t table_id; /* Set next table in the lookup pipeline */
uint8_t pad[3]; /* Pad to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp11_instruction_goto_table) == 8);
/* Instruction structure for OFPIT_WRITE_METADATA */
struct ofp11_instruction_write_metadata {
ovs_be16 type; /* OFPIT_WRITE_METADATA */
ovs_be16 len; /* Length of this struct in bytes. */
uint8_t pad[4]; /* Align to 64-bits */
ovs_be64 metadata; /* Metadata value to write */
ovs_be64 metadata_mask; /* Metadata write bitmask */
};
OFP_ASSERT(sizeof(struct ofp11_instruction_write_metadata) == 24);
/* Instruction structure for OFPIT_WRITE/APPLY/CLEAR_ACTIONS */
struct ofp11_instruction_actions {
ovs_be16 type; /* One of OFPIT_*_ACTIONS */
ovs_be16 len; /* Length of this struct in bytes. */
uint8_t pad[4]; /* Align to 64-bits */
/* struct ofp_action_header actions[0]; Actions associated with
OFPIT_WRITE_ACTIONS and
OFPIT_APPLY_ACTIONS */
};
OFP_ASSERT(sizeof(struct ofp11_instruction_actions) == 8);
/* Instruction structure for experimental instructions */
struct ofp11_instruction_experimenter {
ovs_be16 type; /* OFPIT11_EXPERIMENTER */
ovs_be16 len; /* Length of this struct in bytes */
ovs_be32 experimenter; /* Experimenter ID which takes the same form
as in struct ofp_vendor_header. */
/* Experimenter-defined arbitrary additional data. */
};
OFP_ASSERT(sizeof(struct ofp11_instruction_experimenter) == 8);
/* Configure/Modify behavior of a flow table */
struct ofp11_table_mod {
uint8_t table_id; /* ID of the table, 0xFF indicates all tables */
uint8_t pad[3]; /* Pad to 32 bits */
ovs_be32 config; /* Bitmap of OFPTC_* flags */
};
OFP_ASSERT(sizeof(struct ofp11_table_mod) == 8);
/* Flow setup and teardown (controller -> datapath). */
struct ofp11_flow_mod {
ovs_be64 cookie; /* Opaque controller-issued identifier. */
ovs_be64 cookie_mask; /* Mask used to restrict the cookie bits
that must match when the command is
OFPFC_MODIFY* or OFPFC_DELETE*. A value
of 0 indicates no restriction. */
/* Flow actions. */
uint8_t table_id; /* ID of the table to put the flow in */
uint8_t command; /* One of OFPFC_*. */
ovs_be16 idle_timeout; /* Idle time before discarding (seconds). */
ovs_be16 hard_timeout; /* Max time before discarding (seconds). */
ovs_be16 priority; /* Priority level of flow entry. */
ovs_be32 buffer_id; /* Buffered packet to apply to (or -1).
Not meaningful for OFPFC_DELETE*. */
ovs_be32 out_port; /* For OFPFC_DELETE* commands, require
matching entries to include this as an
output port. A value of OFPP_ANY
indicates no restriction. */
ovs_be32 out_group; /* For OFPFC_DELETE* commands, require
matching entries to include this as an
output group. A value of OFPG_ANY
indicates no restriction. */
ovs_be16 flags; /* One of OFPFF_*. */
ovs_be16 importance; /* Eviction precedence (OF1.4+). */
/* Followed by an ofp11_match structure. */
/* Followed by an instruction set. */
};
OFP_ASSERT(sizeof(struct ofp11_flow_mod) == 40);
/* Group types. Values in the range [128, 255] are reserved for experimental
* use. */
enum ofp11_group_type {
OFPGT11_ALL, /* All (multicast/broadcast) group. */
OFPGT11_SELECT, /* Select group. */
OFPGT11_INDIRECT, /* Indirect group. */
OFPGT11_FF /* Fast failover group. */
};
/* Bucket for use in groups. */
struct ofp11_bucket {
ovs_be16 len; /* Length the bucket in bytes, including
this header and any padding to make it
64-bit aligned. */
ovs_be16 weight; /* Relative weight of bucket. Only
defined for select groups. */
ovs_be32 watch_port; /* Port whose state affects whether this
bucket is live. Only required for fast
failover groups. */
ovs_be32 watch_group; /* Group whose state affects whether this
bucket is live. Only required for fast
failover groups. */
uint8_t pad[4];
/* struct ofp_action_header actions[0]; The action length is inferred
from the length field in the
header. */
};
OFP_ASSERT(sizeof(struct ofp11_bucket) == 16);
/* Queue configuration for a given port. */
struct ofp11_queue_get_config_reply {
ovs_be32 port;
uint8_t pad[4];
/* struct ofp_packet_queue queues[0]; List of configured queues. */
};
OFP_ASSERT(sizeof(struct ofp11_queue_get_config_reply) == 8);
/* Stats request of type OFPST_FLOW. */
struct ofp11_flow_stats_request {
uint8_t table_id; /* ID of table to read (from ofp_table_stats),
0xff for all tables. */
uint8_t pad[3]; /* Align to 64 bits. */
ovs_be32 out_port; /* Require matching entries to include this
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 OFPG_ANY
indicates no restriction. */
uint8_t pad2[4]; /* Align to 64 bits. */
ovs_be64 cookie; /* Require matching entries to contain this
cookie value */
ovs_be64 cookie_mask; /* Mask used to restrict the cookie bits that
must match. A value of 0 indicates
no restriction. */
/* Followed by an ofp11_match structure. */
};
OFP_ASSERT(sizeof(struct ofp11_flow_stats_request) == 32);
/* Body of reply to OFPST_FLOW request. */
struct ofp11_flow_stats {
ovs_be16 length; /* Length of this entry. */
uint8_t table_id; /* ID of table flow came from. */
uint8_t pad;
ovs_be32 duration_sec; /* Time flow has been alive in seconds. */
ovs_be32 duration_nsec; /* Time flow has been alive in nanoseconds beyond
duration_sec. */
ovs_be16 priority; /* Priority of the entry. Only meaningful
when this is not an exact-match entry. */
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*. */
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. */
/* OpenFlow version specific match */
/* struct ofp11_instruction instructions[0]; Instruction set. */
};
OFP_ASSERT(sizeof(struct ofp11_flow_stats) == 48);
/* Body for ofp_stats_request of type OFPST_AGGREGATE. */
/* Identical to ofp11_flow_stats_request */
/* Flow match fields. */
enum ofp11_flow_match_fields {
OFPFMF11_IN_PORT = 1 << 0, /* Switch input port. */
OFPFMF11_DL_VLAN = 1 << 1, /* VLAN id. */
OFPFMF11_DL_VLAN_PCP = 1 << 2, /* VLAN priority. */
OFPFMF11_DL_TYPE = 1 << 3, /* Ethernet frame type. */
OFPFMF11_NW_TOS = 1 << 4, /* IP ToS (DSCP field, 6 bits). */
OFPFMF11_NW_PROTO = 1 << 5, /* IP protocol. */
OFPFMF11_TP_SRC = 1 << 6, /* TCP/UDP/SCTP source port. */
OFPFMF11_TP_DST = 1 << 7, /* TCP/UDP/SCTP destination port. */
OFPFMF11_MPLS_LABEL = 1 << 8, /* MPLS label. */
OFPFMF11_MPLS_TC = 1 << 9, /* MPLS TC. */
OFPFMF11_TYPE = 1 << 10, /* Match type. */
OFPFMF11_DL_SRC = 1 << 11, /* Ethernet source address. */
OFPFMF11_DL_DST = 1 << 12, /* Ethernet destination address. */
OFPFMF11_NW_SRC = 1 << 13, /* IP source address. */
OFPFMF11_NW_DST = 1 << 14, /* IP destination address. */
OFPFMF11_METADATA = 1 << 15, /* Metadata passed between tables. */
};
/* Body of reply to OFPST_TABLE request. */
struct ofp11_table_stats {
uint8_t table_id; /* Identifier of table. Lower numbered tables
are consulted first. */
uint8_t pad[7]; /* Align to 64-bits. */
char name[OFP_MAX_TABLE_NAME_LEN];
ovs_be32 wildcards; /* Bitmap of OFPFMF_* wildcards that are
supported by the table. */
ovs_be32 match; /* Bitmap of OFPFMF_* that indicate the fields
the table can match on. */
ovs_be32 instructions; /* Bitmap of OFPIT_* values supported. */
ovs_be32 write_actions; /* Bitmap of OFPAT_* that are supported
by the table with OFPIT_WRITE_ACTIONS. */
ovs_be32 apply_actions; /* Bitmap of OFPAT_* that are supported
by the table with OFPIT_APPLY_ACTIONS. */
ovs_be32 config; /* Bitmap of OFPTC_* values */
ovs_be32 max_entries; /* Max number of entries supported. */
ovs_be32 active_count; /* Number of active entries. */
ovs_be64 lookup_count; /* Number of packets looked up in table. */
ovs_be64 matched_count; /* Number of packets that hit table. */
};
OFP_ASSERT(sizeof(struct ofp11_table_stats) == 88);
/* Body for ofp_stats_request of type OFPST_PORT. */
struct ofp11_port_stats_request {
ovs_be32 port_no; /* OFPST_PORT message must request statistics
* either for a single port (specified in
* port_no) or for all ports (if port_no ==
* OFPP_ANY). */
uint8_t pad[4];
};
OFP_ASSERT(sizeof(struct ofp11_port_stats_request) == 8);
/* Body of reply to OFPST_PORT request. If a counter is unsupported, set
* the field to all ones. */
struct ofp11_port_stats {
ovs_be32 port_no;
uint8_t pad[4]; /* Align to 64-bits. */
ovs_be64 rx_packets; /* Number of received packets. */
ovs_be64 tx_packets; /* Number of transmitted packets. */
ovs_be64 rx_bytes; /* Number of received bytes. */
ovs_be64 tx_bytes; /* Number of transmitted bytes. */
ovs_be64 rx_dropped; /* Number of packets dropped by RX. */
ovs_be64 tx_dropped; /* Number of packets dropped by TX. */
ovs_be64 rx_errors; /* Number of receive errors. This is a
super-set of receive errors and should be
great than or equal to the sum of all
rx_*_err values. */
ovs_be64 tx_errors; /* Number of transmit errors. This is a
super-set of transmit errors. */
ovs_be64 rx_frame_err; /* Number of frame alignment errors. */
ovs_be64 rx_over_err; /* Number of packets with RX overrun. */
ovs_be64 rx_crc_err; /* Number of CRC errors. */
ovs_be64 collisions; /* Number of collisions. */
};
OFP_ASSERT(sizeof(struct ofp11_port_stats) == 104);
struct ofp11_queue_stats_request {
ovs_be32 port_no; /* All ports if OFPP_ANY. */
ovs_be32 queue_id; /* All queues if OFPQ_ALL. */
};
OFP_ASSERT(sizeof(struct ofp11_queue_stats_request) == 8);
struct ofp11_queue_stats {
ovs_be32 port_no;
ovs_be32 queue_id; /* Queue id. */
ovs_be64 tx_bytes; /* Number of transmitted bytes. */
ovs_be64 tx_packets; /* Number of transmitted packets. */
ovs_be64 tx_errors; /* # of packets dropped due to overrun. */
};
OFP_ASSERT(sizeof(struct ofp11_queue_stats) == 32);
struct ofp11_group_stats_request {
ovs_be32 group_id; /* All groups if OFPG_ALL. */
uint8_t pad[4]; /* Align to 64 bits. */
};
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 pad[2]; /* Align to 64 bits. */
ovs_be32 group_id; /* Group identifier. */
ovs_be32 ref_count; /* Number of flows or groups that
directly forward to this group. */
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[]; */
};
OFP_ASSERT(sizeof(struct ofp11_group_stats) == 32);
/* 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 OFPGT11_*. */
uint8_t pad; /* Pad to 64 bits. */
ovs_be32 group_id; /* Group identifier. */
/* struct ofp11_bucket buckets[0]; */
};
OFP_ASSERT(sizeof(struct ofp11_group_desc_stats) == 8);
/* Send packet (controller -> datapath). */
struct ofp11_packet_out {
ovs_be32 buffer_id; /* ID assigned by datapath (-1 if none). */
ovs_be32 in_port; /* Packet's input port or OFPP_CONTROLLER. */
ovs_be16 actions_len; /* Size of action array in bytes. */
uint8_t pad[6];
/* struct ofp_action_header actions[0]; Action list. */
/* uint8_t data[0]; */ /* Packet data. The length is inferred
from the length field in the header.
(Only meaningful if buffer_id == -1.) */
};
OFP_ASSERT(sizeof(struct ofp11_packet_out) == 16);
/* Packet received on port (datapath -> controller). */
struct ofp11_packet_in {
ovs_be32 buffer_id; /* ID assigned by datapath. */
ovs_be32 in_port; /* Port on which frame was received. */
ovs_be32 in_phy_port; /* Physical Port on which frame was received. */
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 */
/* Followed by Ethernet frame. */
};
OFP_ASSERT(sizeof(struct ofp11_packet_in) == 16);
/* Flow removed (datapath -> controller). */
struct ofp11_flow_removed {
ovs_be64 cookie; /* Opaque controller-issued identifier. */
ovs_be16 priority; /* Priority level of flow entry. */
uint8_t reason; /* One of OFPRR_*. */
uint8_t table_id; /* ID of the table */
ovs_be32 duration_sec; /* Time flow was alive in seconds. */
ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond
duration_sec. */
ovs_be16 idle_timeout; /* Idle timeout from original flow mod. */
uint8_t pad2[2]; /* Align to 64-bits. */
ovs_be64 packet_count;
ovs_be64 byte_count;
/* Followed by an ofp11_match structure. */
};
OFP_ASSERT(sizeof(struct ofp11_flow_removed) == 40);
#endif /* openflow/openflow-1.1.h */

View File

@ -0,0 +1,229 @@
/* 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
* (Software) available for public use and benefit with the expectation
* that others will use, modify and enhance the Software and contribute
* those enhancements back to the community. However, since we would
* like to make the Software available for broadest use, with as few
* restrictions as possible permission is hereby granted, free of
* charge, to any person obtaining a copy of this Software to deal in
* the Software under the copyrights without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* The name and trademarks of copyright holder(s) may NOT be used in
* advertising or publicity pertaining to the Software or any
* derivatives without specific, written prior permission.
*/
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
* Copyright (c) 2012 Horms Solutions Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* OpenFlow: protocol between controller and datapath. */
#ifndef OPENFLOW_12_H
#define OPENFLOW_12_H 1
#include <openflow/openflow-1.1.h>
/* Error type for experimenter error messages. */
#define OFPET12_EXPERIMENTER 0xffff
/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
* special conditions.
*/
enum ofp12_vlan_id {
OFPVID12_PRESENT = 0x1000, /* Bit that indicate that a VLAN id is set */
OFPVID12_NONE = 0x0000, /* No VLAN id was set. */
};
/* Bit definitions for IPv6 Extension Header pseudo-field. */
enum ofp12_ipv6exthdr_flags {
OFPIEH12_NONEXT = 1 << 0, /* "No next header" encountered. */
OFPIEH12_ESP = 1 << 1, /* Encrypted Sec Payload header present. */
OFPIEH12_AUTH = 1 << 2, /* Authentication header present. */
OFPIEH12_DEST = 1 << 3, /* 1 or 2 dest headers present. */
OFPIEH12_FRAG = 1 << 4, /* Fragment header present. */
OFPIEH12_ROUTER = 1 << 5, /* Router header present. */
OFPIEH12_HOP = 1 << 6, /* Hop-by-hop header present. */
OFPIEH12_UNREP = 1 << 7, /* Unexpected repeats encountered. */
OFPIEH12_UNSEQ = 1 << 8 /* Unexpected sequencing encountered. */
};
/* Header for OXM experimenter match fields. */
struct ofp12_oxm_experimenter_header {
ovs_be32 oxm_header; /* oxm_class = OFPXMC_EXPERIMENTER */
ovs_be32 experimenter; /* Experimenter ID which takes the same
form as in struct ofp11_experimenter_header. */
};
OFP_ASSERT(sizeof(struct ofp12_oxm_experimenter_header) == 8);
enum ofp12_controller_max_len {
OFPCML12_MAX = 0xffe5, /* maximum max_len value which can be used
* to request a specific byte length. */
OFPCML12_NO_BUFFER = 0xffff /* indicates that no buffering should be
* applied and the whole packet is to be
* sent to the controller. */
};
/* OpenFlow 1.2 specific flags
* (struct ofp12_flow_mod, member flags). */
enum ofp12_flow_mod_flags {
OFPFF12_RESET_COUNTS = 1 << 2 /* Reset flow packet and byte counts. */
};
/* OpenFlow 1.2 specific capabilities
* (struct ofp_switch_features, member capabilities). */
enum ofp12_capabilities {
OFPC12_PORT_BLOCKED = 1 << 8 /* Switch will block looping ports. */
};
/* Full description for a queue. */
struct ofp12_packet_queue {
ovs_be32 queue_id; /* id for the specific queue. */
ovs_be32 port; /* Port this queue is attached to. */
ovs_be16 len; /* Length in bytes of this queue desc. */
uint8_t pad[6]; /* 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 ofp12_packet_queue) == 16);
/* Body of reply to OFPST_TABLE request. */
struct ofp12_table_stats {
uint8_t table_id; /* Identifier of table. Lower numbered tables
are consulted first. */
uint8_t pad[7]; /* Align to 64-bits. */
char name[OFP_MAX_TABLE_NAME_LEN];
ovs_be64 match; /* Bitmap of (1 << OFPXMT_*) that indicate the
fields the table can match on. */
ovs_be64 wildcards; /* Bitmap of (1 << OFPXMT_*) wildcards that are
supported by the table. */
ovs_be32 write_actions; /* Bitmap of OFPAT_* that are supported
by the table with OFPIT_WRITE_ACTIONS. */
ovs_be32 apply_actions; /* Bitmap of OFPAT_* that are supported
by the table with OFPIT_APPLY_ACTIONS. */
ovs_be64 write_setfields;/* Bitmap of (1 << OFPXMT_*) header fields that
can be set with OFPIT_WRITE_ACTIONS. */
ovs_be64 apply_setfields;/* Bitmap of (1 << OFPXMT_*) header fields that
can be set with OFPIT_APPLY_ACTIONS. */
ovs_be64 metadata_match; /* Bits of metadata table can match. */
ovs_be64 metadata_write; /* Bits of metadata table can write. */
ovs_be32 instructions; /* Bitmap of OFPIT_* values supported. */
ovs_be32 config; /* Bitmap of OFPTC_* values */
ovs_be32 max_entries; /* Max number of entries supported. */
ovs_be32 active_count; /* Number of active entries. */
ovs_be64 lookup_count; /* Number of packets looked up in table. */
ovs_be64 matched_count; /* Number of packets that hit table. */
};
OFP_ASSERT(sizeof(struct ofp12_table_stats) == 128);
/* Number of types of groups supported by ofp12_group_features_stats. */
#define OFPGT12_N_TYPES 4
/* Body of reply to OFPST12_GROUP_FEATURES request. Group features. */
struct ofp12_group_features_stats {
ovs_be32 types; /* Bitmap of OFPGT11_* values supported. */
ovs_be32 capabilities; /* Bitmap of OFPGFC12_* capability supported. */
/* Each element in the following arrays corresponds to the group type with
* the same number, e.g. max_groups[0] is the maximum number of OFPGT11_ALL
* groups, actions[2] is the actions supported by OFPGT11_INDIRECT
* groups. */
ovs_be32 max_groups[OFPGT12_N_TYPES]; /* Max number of groups. */
ovs_be32 actions[OFPGT12_N_TYPES]; /* Bitmaps of supported OFPAT_*. */
};
OFP_ASSERT(sizeof(struct ofp12_group_features_stats) == 40);
/* Group configuration flags */
enum ofp12_group_capabilities {
OFPGFC12_SELECT_WEIGHT = 1 << 0, /* Support weight for select groups */
OFPGFC12_SELECT_LIVENESS = 1 << 1, /* Support liveness for select groups */
OFPGFC12_CHAINING = 1 << 2, /* Support chaining groups */
OFPGFC12_CHAINING_CHECKS = 1 << 3, /* Check chaining for loops and delete */
};
/* Role request and reply message. */
struct ofp12_role_request {
ovs_be32 role; /* One of OFPCR12_ROLE_*. */
uint8_t pad[4]; /* Align to 64 bits. */
ovs_be64 generation_id; /* Master Election Generation Id */
};
OFP_ASSERT(sizeof(struct ofp12_role_request) == 16);
/* Controller roles. */
enum ofp12_controller_role {
OFPCR12_ROLE_NOCHANGE, /* Don't change current role. */
OFPCR12_ROLE_EQUAL, /* Default role, full access. */
OFPCR12_ROLE_MASTER, /* Full access, at most one master. */
OFPCR12_ROLE_SLAVE, /* Read-only access. */
};
/* Packet received on port (datapath -> controller). */
struct ofp12_packet_in {
ovs_be32 buffer_id; /* ID assigned by datapath. */
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 */
/* Followed by:
* - Match
* - Exactly 2 all-zero padding bytes, then
* - An Ethernet frame whose length is inferred from header.length.
* The padding bytes preceding the Ethernet frame ensure that the IP
* header (if any) following the Ethernet header is 32-bit aligned.
*/
/* struct ofp12_match match; */
/* uint8_t pad[2]; Align to 64 bit + 16 bit */
/* uint8_t data[0]; Ethernet frame */
};
OFP_ASSERT(sizeof(struct ofp12_packet_in) == 8);
/* Flow removed (datapath -> controller). */
struct ofp12_flow_removed {
ovs_be64 cookie; /* Opaque controller-issued identifier. */
ovs_be16 priority; /* Priority level of flow entry. */
uint8_t reason; /* One of OFPRR_*. */
uint8_t table_id; /* ID of the table */
ovs_be32 duration_sec; /* Time flow was alive in seconds. */
ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond
duration_sec. */
ovs_be16 idle_timeout; /* Idle timeout from original flow mod. */
ovs_be16 hard_timeout; /* Hard timeout from original flow mod. */
ovs_be64 packet_count;
ovs_be64 byte_count;
/* struct ofp12_match match; Description of fields. Variable size. */
};
OFP_ASSERT(sizeof(struct ofp12_flow_removed) == 40);
#endif /* openflow/openflow-1.2.h */

View File

@ -0,0 +1,355 @@
/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
* Junior University
* Copyright (c) 2011, 2012 Open Networking Foundation
*
* We are making the OpenFlow specification and associated documentation
* (Software) available for public use and benefit with the expectation
* that others will use, modify and enhance the Software and contribute
* those enhancements back to the community. However, since we would
* like to make the Software available for broadest use, with as few
* restrictions as possible permission is hereby granted, free of
* charge, to any person obtaining a copy of this Software to deal in
* the Software under the copyrights without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* The name and trademarks of copyright holder(s) may NOT be used in
* advertising or publicity pertaining to the Software or any
* derivatives without specific, written prior permission.
*/
/* OpenFlow: protocol between controller and datapath. */
#ifndef OPENFLOW_13_H
#define OPENFLOW_13_H 1
#include <openflow/openflow-1.2.h>
/*
* OpenFlow 1.3 modifies the syntax of the following message types:
*
* OFPT_FEATURES_REPLY = 6 (opf13_switch_features)
* - new field: auxiliary_id
* - removed: ofp_ports at the end
*
* OFPT_PACKET_IN = 10 (appends an ovs_be64 to ofp12_packet_in)
*
* OpenFlow 1.3 adds following new message types:
*
* * Asynchronous message configuration. *
* OFPT13_GET_ASYNC_REQUEST = 26 (void)
* OFPT13_GET_ASYNC_REPLY = 27 (ofp13_async_config)
* OFPT13_SET_ASYNC = 28 (ofp13_async_config)
*
* * Meters and rate limiters configuration messages. *
* OFPT13_METER_MOD = 29 (ofp13_meter_mod)
*
* OpenFlow 1.3 modifies the syntax of the following statistics message types
* (now called multipart message types):
*
* OFPMP13_FLOW_REPLY = 1 (struct ofp13_flow_stats[])
* OFPMP13_TABLE_REPLY = 3 (struct ofp13_table_stats[])
* OFPMP13_PORT_REPLY = 4 (struct ofp13_port_stats[])
* OFPMP13_QUEUE_REPLY = 5, (struct ofp13_queue_stats[])
* OFPMP13_GROUP_REPLY = 6, (struct ofp13_group_stats[])
*
* OpenFlow 1.3 adds the following multipart message types
*
* Meter statistics:
* OFPMP13_METER_REQUEST = 9, (struct ofp13_meter_multipart_request)
* OFPMP13_METER_REPLY = 9, (struct ofp13_meter_stats[])
*
* Meter configuration:
* OFPMP13_METER_CONFIG_REQUEST = 10, (struct ofp13_meter_multipart_request)
* OFPMP13_METER_CONFIG_REPLY = 10, (struct ofp13_meter_config[])
*
* Meter features:
* OFPMP13_METER_FEATURES_REQUEST = 11 (void)
* OFPMP13_METER_FEATURES_REPLY = 11 (struct ofp13_meter_features)
*
* Table features:
* OFPMP13_TABLE_FEATURES_REQUEST = 12, (struct ofp13_table_features[])
* OFPMP13_TABLE_FEATURES_REPLY = 12, (struct ofp13_table_features[])
*
*/
enum ofp13_instruction_type {
OFPIT13_METER = 6 /* Apply meter (rate limiter) */
};
/* Instruction structure for OFPIT_METER */
struct ofp13_instruction_meter {
ovs_be16 type; /* OFPIT13_METER */
ovs_be16 len; /* Length is 8. */
ovs_be32 meter_id; /* Meter instance. */
};
OFP_ASSERT(sizeof(struct ofp13_instruction_meter) == 8);
/* enum ofp_config_flags value OFPC_INVALID_TTL_TO_CONTROLLER
* is deprecated in OpenFlow 1.3 */
/* Flags to configure the table. Reserved for future use. */
enum ofp13_table_config {
OFPTC13_DEPRECATED_MASK = 3 /* Deprecated bits */
};
/* OpenFlow 1.3 specific flags for flow_mod messages. */
enum ofp13_flow_mod_flags {
OFPFF13_NO_PKT_COUNTS = 1 << 3, /* Don't keep track of packet count. */
OFPFF13_NO_BYT_COUNTS = 1 << 4 /* Don't keep track of byte count. */
};
/* Common header for all meter bands */
struct ofp13_meter_band_header {
ovs_be16 type; /* One of OFPMBT_*. */
ovs_be16 len; /* Length in bytes of this band. */
ovs_be32 rate; /* Rate for this band. */
ovs_be32 burst_size; /* Size of bursts. */
};
OFP_ASSERT(sizeof(struct ofp13_meter_band_header) == 12);
/* Meter configuration. OFPT_METER_MOD. */
struct ofp13_meter_mod {
ovs_be16 command; /* One of OFPMC_*. */
ovs_be16 flags; /* Set of OFPMF_*. */
ovs_be32 meter_id; /* Meter instance. */
/* struct ofp13_meter_band_header bands[0]; The bands length is inferred
from the length field in the
header. */
};
OFP_ASSERT(sizeof(struct ofp13_meter_mod) == 8);
/* Meter numbering. Flow meters can use any number up to OFPM_MAX. */
enum ofp13_meter {
/* Last usable meter. */
OFPM13_MAX = 0xffff0000,
/* Virtual meters. */
OFPM13_SLOWPATH = 0xfffffffd, /* Meter for slow datapath. */
OFPM13_CONTROLLER = 0xfffffffe, /* Meter for controller connection. */
OFPM13_ALL = 0xffffffff, /* Represents all meters for stat requests
commands. */
};
/* Meter commands */
enum ofp13_meter_mod_command {
OFPMC13_ADD, /* New meter. */
OFPMC13_MODIFY, /* Modify specified meter. */
OFPMC13_DELETE /* Delete specified meter. */
};
/* Meter configuration flags */
enum ofp13_meter_flags {
OFPMF13_KBPS = 1 << 0, /* Rate value in kb/s (kilo-bit per second). */
OFPMF13_PKTPS = 1 << 1, /* Rate value in packet/sec. */
OFPMF13_BURST = 1 << 2, /* Do burst size. */
OFPMF13_STATS = 1 << 3 /* Collect statistics. */
};
/* Meter band types */
enum ofp13_meter_band_type {
OFPMBT13_DROP = 1, /* Drop packet. */
OFPMBT13_DSCP_REMARK = 2, /* Remark DSCP in the IP header. */
OFPMBT13_EXPERIMENTER = 0xFFFF /* Experimenter meter band. */
};
/* OFPMBT_DROP band - drop packets */
struct ofp13_meter_band_drop {
ovs_be16 type; /* OFPMBT_DROP. */
ovs_be16 len; /* Length in bytes of this band. */
ovs_be32 rate; /* Rate for dropping packets. */
ovs_be32 burst_size; /* Size of bursts. */
uint8_t pad[4];
};
OFP_ASSERT(sizeof(struct ofp13_meter_band_drop) == 16);
/* OFPMBT_DSCP_REMARK band - Remark DSCP in the IP header */
struct ofp13_meter_band_dscp_remark {
ovs_be16 type; /* OFPMBT_DSCP_REMARK. */
ovs_be16 len; /* Length in bytes of this band. */
ovs_be32 rate; /* Rate for remarking packets. */
ovs_be32 burst_size; /* Size of bursts. */
uint8_t prec_level; /* Number of drop precedence level to add. */
uint8_t pad[3];
};
OFP_ASSERT(sizeof(struct ofp13_meter_band_dscp_remark) == 16);
/* OFPMBT_EXPERIMENTER band - Write actions in action set */
struct ofp13_meter_band_experimenter {
ovs_be16 type; /* OFPMBT_EXPERIMENTER. */
ovs_be16 len; /* Length in bytes of this band. */
ovs_be32 rate; /* Rate for dropping packets. */
ovs_be32 burst_size; /* Size of bursts. */
ovs_be32 experimenter; /* Experimenter ID which takes the same form as
in struct ofp_experimenter_header. */
};
OFP_ASSERT(sizeof(struct ofp13_meter_band_experimenter) == 16);
/* OF 1.3 adds MORE flag also for requests */
enum ofp13_multipart_request_flags {
OFPMPF13_REQ_MORE = 1 << 0 /* More requests to follow. */
};
/* OF 1.3 splits table features off the ofp_table_stats */
/* Body of reply to OFPMP13_TABLE request. */
struct ofp13_table_stats {
uint8_t table_id; /* Identifier of table. Lower numbered tables are
consulted first. */
uint8_t pad[3]; /* Align to 32-bits. */
ovs_be32 active_count; /* Number of active entries. */
ovs_be64 lookup_count; /* Number of packets looked up in table. */
ovs_be64 matched_count; /* Number of packets that hit table. */
};
OFP_ASSERT(sizeof(struct ofp13_table_stats) == 24);
/* Body for ofp_multipart_request of type OFPMP_TABLE_FEATURES./
* Body of reply to OFPMP_TABLE_FEATURES request. */
struct ofp13_table_features {
ovs_be16 length; /* Length is padded to 64 bits. */
uint8_t table_id; /* Identifier of table. Lower numbered tables
are consulted first. */
uint8_t pad[5]; /* Align to 64-bits. */
char name[OFP_MAX_TABLE_NAME_LEN];
ovs_be64 metadata_match; /* Bits of metadata table can match. */
ovs_be64 metadata_write; /* Bits of metadata table can write. */
/* In OF1.3 this field was named 'config' and it was useless because OF1.3
* did not define any OFPTC_* bits.
*
* OF1.4 renamed this field to 'capabilities' and added OFPTC14_EVICTION
* and OFPTC14_VACANCY_EVENTS. */
ovs_be32 capabilities; /* Bitmap of OFPTC_* values */
ovs_be32 max_entries; /* Max number of entries supported. */
/* Table Feature Property list */
/* struct ofp13_table_feature_prop_header properties[0]; */
};
OFP_ASSERT(sizeof(struct ofp13_table_features) == 64);
/* Table Feature property types.
* Low order bit cleared indicates a property for a regular Flow Entry.
* Low order bit set indicates a property for the Table-Miss Flow Entry. */
enum ofp13_table_feature_prop_type {
OFPTFPT13_INSTRUCTIONS = 0, /* Instructions property. */
OFPTFPT13_INSTRUCTIONS_MISS = 1, /* Instructions for table-miss. */
OFPTFPT13_NEXT_TABLES = 2, /* Next Table property. */
OFPTFPT13_NEXT_TABLES_MISS = 3, /* Next Table for table-miss. */
OFPTFPT13_WRITE_ACTIONS = 4, /* Write Actions property. */
OFPTFPT13_WRITE_ACTIONS_MISS = 5, /* Write Actions for table-miss. */
OFPTFPT13_APPLY_ACTIONS = 6, /* Apply Actions property. */
OFPTFPT13_APPLY_ACTIONS_MISS = 7, /* Apply Actions for table-miss. */
OFPTFPT13_MATCH = 8, /* Match property. */
OFPTFPT13_WILDCARDS = 10, /* Wildcards property. */
OFPTFPT13_WRITE_SETFIELD = 12, /* Write Set-Field property. */
OFPTFPT13_WRITE_SETFIELD_MISS = 13, /* Write Set-Field for table-miss. */
OFPTFPT13_APPLY_SETFIELD = 14, /* Apply Set-Field property. */
OFPTFPT13_APPLY_SETFIELD_MISS = 15, /* Apply Set-Field for table-miss. */
OFPTFPT13_EXPERIMENTER = 0xFFFE, /* Experimenter property. */
OFPTFPT13_EXPERIMENTER_MISS = 0xFFFF, /* Experimenter for table-miss. */
};
/* Body of reply to OFPMP13_PORT request. If a counter is unsupported, set
* the field to all ones. */
struct ofp13_port_stats {
struct ofp11_port_stats ps;
ovs_be32 duration_sec; /* Time port has been alive in seconds. */
ovs_be32 duration_nsec; /* Time port has been alive in nanoseconds
beyond duration_sec. */
};
OFP_ASSERT(sizeof(struct ofp13_port_stats) == 112);
/* Body of reply to OFPMP13_QUEUE request */
struct ofp13_queue_stats {
struct ofp11_queue_stats qs;
ovs_be32 duration_sec; /* Time queue has been alive in seconds. */
ovs_be32 duration_nsec; /* Time queue has been alive in nanoseconds
beyond duration_sec. */
};
OFP_ASSERT(sizeof(struct ofp13_queue_stats) == 40);
/* Body of reply to OFPMP13_GROUP request */
struct ofp13_group_stats {
struct ofp11_group_stats gs;
ovs_be32 duration_sec; /* Time group has been alive in seconds. */
ovs_be32 duration_nsec; /* Time group has been alive in nanoseconds
beyond duration_sec. */
/* struct ofp11_bucket_counter bucket_stats[]; */
};
OFP_ASSERT(sizeof(struct ofp13_group_stats) == 40);
/* Body of OFPMP13_METER and OFPMP13_METER_CONFIG requests. */
struct ofp13_meter_multipart_request {
ovs_be32 meter_id; /* Meter instance, or OFPM_ALL. */
uint8_t pad[4]; /* Align to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp13_meter_multipart_request) == 8);
/* Statistics for each meter band */
struct ofp13_meter_band_stats {
ovs_be64 packet_band_count; /* Number of packets in band. */
ovs_be64 byte_band_count; /* Number of bytes in band. */
};
OFP_ASSERT(sizeof(struct ofp13_meter_band_stats) == 16);
/* Body of reply to OFPMP13_METER request. Meter statistics. */
struct ofp13_meter_stats {
ovs_be32 meter_id; /* Meter instance. */
ovs_be16 len; /* Length in bytes of this stats. */
uint8_t pad[6];
ovs_be32 flow_count; /* Number of flows bound to meter. */
ovs_be64 packet_in_count; /* Number of packets in input. */
ovs_be64 byte_in_count; /* Number of bytes in input. */
ovs_be32 duration_sec; /* Time meter has been alive in seconds. */
ovs_be32 duration_nsec; /* Time meter has been alive in nanoseconds
beyond duration_sec. */
struct ofp13_meter_band_stats band_stats[0]; /* The band_stats length is
inferred from the length field. */
};
OFP_ASSERT(sizeof(struct ofp13_meter_stats) == 40);
/* Body of reply to OFPMP13_METER_CONFIG request. Meter configuration. */
struct ofp13_meter_config {
ovs_be16 length; /* Length of this entry. */
ovs_be16 flags; /* Set of OFPMC_* that apply. */
ovs_be32 meter_id; /* Meter instance. */
/* struct ofp13_meter_band_header bands[0]; The bands length is inferred
from the length field. */
};
OFP_ASSERT(sizeof(struct ofp13_meter_config) == 8);
/* Body of reply to OFPMP13_METER_FEATURES request. Meter features. */
struct ofp13_meter_features {
ovs_be32 max_meter; /* Maximum number of meters. */
ovs_be32 band_types; /* Bitmaps of OFPMBT13_* values supported. */
ovs_be32 capabilities; /* Bitmaps of "ofp13_meter_flags". */
uint8_t max_bands; /* Maximum bands per meters */
uint8_t max_color; /* Maximum color value */
uint8_t pad[2];
};
OFP_ASSERT(sizeof(struct ofp13_meter_features) == 16);
/* Asynchronous message configuration. */
/* The body of this is the same as nx_async_config */
/* OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC. */
struct ofp13_async_config {
ovs_be32 packet_in_mask[2]; /* Bitmasks of OFPR_* values. */
ovs_be32 port_status_mask[2]; /* Bitmasks of OFPPR_* values. */
ovs_be32 flow_removed_mask[2];/* Bitmasks of OFPRR_* values. */
};
OFP_ASSERT(sizeof(struct ofp13_async_config) == 24);
#endif /* openflow/openflow-1.3.h */

View File

@ -0,0 +1,384 @@
/* Copyright (c) 2008, 2014 The Board of Trustees of The Leland Stanford
* Junior University
* Copyright (c) 2011, 2012 Open Networking Foundation
*
* We are making the OpenFlow specification and associated documentation
* (Software) available for public use and benefit with the expectation
* that others will use, modify and enhance the Software and contribute
* those enhancements back to the community. However, since we would
* like to make the Software available for broadest use, with as few
* restrictions as possible permission is hereby granted, free of
* charge, to any person obtaining a copy of this Software to deal in
* the Software under the copyrights without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* The name and trademarks of copyright holder(s) may NOT be used in
* advertising or publicity pertaining to the Software or any
* derivatives without specific, written prior permission.
*/
/* OpenFlow: protocol between controller and datapath. */
#ifndef OPENFLOW_14_H
#define OPENFLOW_14_H 1
#include <openflow/openflow-1.3.h>
/* OpenFlow 1.4.1+ specific capabilities
* (struct ofp_switch_features, member capabilities). */
enum ofp14_capabilities {
OFPC14_BUNDLES = 1 << 9, /* Switch supports bundles. */
OFPC14_FLOW_MONITORING = 1 << 10, /* Switch supports flow monitoring. */
};
/* ## ---------- ## */
/* ## ofp14_port ## */
/* ## ---------- ## */
/* Port description property types. */
enum ofp_port_desc_prop_type {
OFPPDPT14_ETHERNET = 0, /* Ethernet property. */
OFPPDPT14_OPTICAL = 1, /* Optical property. */
OFPPDPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
};
/* Ethernet port description property. */
struct ofp14_port_desc_prop_ethernet {
ovs_be16 type; /* OFPPDPT14_ETHERNET. */
ovs_be16 length; /* Length in bytes of this property. */
uint8_t pad[4]; /* Align to 64 bits. */
/* Bitmaps of OFPPF_* that describe features. All bits zeroed if
* unsupported or unavailable. */
ovs_be32 curr; /* Current features. */
ovs_be32 advertised; /* Features being advertised by the port. */
ovs_be32 supported; /* Features supported by the port. */
ovs_be32 peer; /* Features advertised by peer. */
ovs_be32 curr_speed; /* Current port bitrate in kbps. */
ovs_be32 max_speed; /* Max port bitrate in kbps */
};
OFP_ASSERT(sizeof(struct ofp14_port_desc_prop_ethernet) == 32);
struct ofp14_port {
ovs_be32 port_no;
ovs_be16 length;
uint8_t pad[2];
struct eth_addr hw_addr;
uint8_t pad2[2]; /* Align to 64 bits. */
char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */
ovs_be32 config; /* Bitmap of OFPPC_* flags. */
ovs_be32 state; /* Bitmap of OFPPS_* flags. */
/* Followed by 0 or more OFPPDPT14_* properties. */
};
OFP_ASSERT(sizeof(struct ofp14_port) == 40);
/* ## -------------- ## */
/* ## ofp14_port_mod ## */
/* ## -------------- ## */
enum ofp14_port_mod_prop_type {
OFPPMPT14_ETHERNET = 0, /* Ethernet property. */
OFPPMPT14_OPTICAL = 1, /* Optical property. */
OFPPMPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
};
struct ofp14_port_mod {
ovs_be32 port_no;
uint8_t pad[4];
struct eth_addr hw_addr;
uint8_t pad2[2];
ovs_be32 config; /* Bitmap of OFPPC_* flags. */
ovs_be32 mask; /* Bitmap of OFPPC_* flags to be changed. */
/* Followed by 0 or more OFPPMPT14_* properties. */
};
OFP_ASSERT(sizeof(struct ofp14_port_mod) == 24);
/* ## --------------- ## */
/* ## ofp14_table_mod ## */
/* ## --------------- ## */
enum ofp14_table_mod_prop_type {
OFPTMPT14_EVICTION = 0x2, /* Eviction property. */
OFPTMPT14_VACANCY = 0x3, /* Vacancy property. */
OFPTMPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
};
enum ofp14_table_mod_prop_eviction_flag {
OFPTMPEF14_OTHER = 1 << 0, /* Using other factors. */
OFPTMPEF14_IMPORTANCE = 1 << 1, /* Using flow entry importance. */
OFPTMPEF14_LIFETIME = 1 << 2, /* Using flow entry lifetime. */
};
/* What changed about the table */
enum ofp14_table_reason {
OFPTR_VACANCY_DOWN = 3, /* Vacancy down threshold event. */
OFPTR_VACANCY_UP = 4, /* Vacancy up threshold event. */
#define OFPTR_BITS ((1u << OFPTR_VACANCY_DOWN) | (1u << OFPTR_VACANCY_UP))
};
struct ofp14_table_mod_prop_vacancy {
ovs_be16 type; /* OFPTMPT14_VACANCY. */
ovs_be16 length; /* Length in bytes of this property. */
uint8_t vacancy_down; /* Vacancy threshold when space decreases (%). */
uint8_t vacancy_up; /* Vacancy threshold when space increases (%). */
uint8_t vacancy; /* Current vacancy (%) - only in ofp14_table_desc. */
uint8_t pad[1]; /* Align to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp14_table_mod_prop_vacancy) == 8);
struct ofp14_table_mod {
uint8_t table_id; /* ID of the table, OFPTT_ALL indicates all tables */
uint8_t pad[3]; /* Pad to 32 bits */
ovs_be32 config; /* Bitmap of OFPTC_* flags */
/* Followed by 0 or more OFPTMPT14_* properties. */
};
OFP_ASSERT(sizeof(struct ofp14_table_mod) == 8);
/* Body of reply to OFPMP_TABLE_DESC request. */
struct ofp14_table_desc {
ovs_be16 length; /* Length is padded to 64 bits. */
uint8_t table_id; /* Identifier of table. Lower numbered tables
are consulted first. */
uint8_t pad[1]; /* Align to 32-bits. */
ovs_be32 config; /* Bitmap of OFPTC_* values. */
/* Followed by 0 or more OFPTMPT14_* properties. */
};
OFP_ASSERT(sizeof(struct ofp14_table_desc) == 8);
/* A table config has changed in the datapath */
struct ofp14_table_status {
uint8_t reason; /* One of OFPTR_*. */
uint8_t pad[7]; /* Pad to 64 bits */
/* Followed by struct ofp14_table_desc */
};
OFP_ASSERT(sizeof(struct ofp14_table_status) == 8);
/* ## ---------------- ## */
/* ## ofp14_port_stats ## */
/* ## ---------------- ## */
enum ofp14_port_stats_prop_type {
OFPPSPT14_ETHERNET = 0, /* Ethernet property. */
OFPPSPT14_OPTICAL = 1, /* Optical property. */
OFPPSPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
};
struct ofp14_port_stats_prop_ethernet {
ovs_be16 type; /* OFPPSPT14_ETHERNET. */
ovs_be16 length; /* Length in bytes of this property. */
uint8_t pad[4]; /* Align to 64 bits. */
ovs_be64 rx_frame_err; /* Number of frame alignment errors. */
ovs_be64 rx_over_err; /* Number of packets with RX overrun. */
ovs_be64 rx_crc_err; /* Number of CRC errors. */
ovs_be64 collisions; /* Number of collisions. */
};
OFP_ASSERT(sizeof(struct ofp14_port_stats_prop_ethernet) == 40);
struct ofp14_port_stats {
ovs_be16 length; /* Length of this entry. */
uint8_t pad[2]; /* Align to 64 bits. */
ovs_be32 port_no;
ovs_be32 duration_sec; /* Time port has been alive in seconds. */
ovs_be32 duration_nsec; /* Time port has been alive in nanoseconds beyond
duration_sec. */
ovs_be64 rx_packets; /* Number of received packets. */
ovs_be64 tx_packets; /* Number of transmitted packets. */
ovs_be64 rx_bytes; /* Number of received bytes. */
ovs_be64 tx_bytes; /* Number of transmitted bytes. */
ovs_be64 rx_dropped; /* Number of packets dropped by RX. */
ovs_be64 tx_dropped; /* Number of packets dropped by TX. */
ovs_be64 rx_errors; /* Number of receive errors. This is a super-set
of more specific receive errors and should be
greater than or equal to the sum of all
rx_*_err values in properties. */
ovs_be64 tx_errors; /* Number of transmit errors. This is a super-set
of more specific transmit errors and should be
greater than or equal to the sum of all
tx_*_err values (none currently defined.) */
/* Followed by 0 or more OFPPSPT14_* properties. */
};
OFP_ASSERT(sizeof(struct ofp14_port_stats) == 80);
/* ## ----------------- ## */
/* ## ofp14_queue_stats ## */
/* ## ----------------- ## */
struct ofp14_queue_stats {
ovs_be16 length; /* Length of this entry. */
uint8_t pad[6]; /* Align to 64 bits. */
struct ofp13_queue_stats qs;
/* Followed by 0 or more properties (none yet defined). */
};
OFP_ASSERT(sizeof(struct ofp14_queue_stats) == 48);
/* ## ---------------- ## */
/* ## ofp14_queue_desc ## */
/* ## ---------------- ## */
struct ofp14_queue_desc_request {
ovs_be32 port; /* All ports if OFPP_ANY. */
ovs_be32 queue; /* All queues if OFPQ_ALL. */
};
OFP_ASSERT(sizeof(struct ofp14_queue_desc_request) == 8);
/* Body of reply to OFPMP_QUEUE_DESC request. */
struct ofp14_queue_desc {
ovs_be32 port_no; /* Port this queue is attached to. */
ovs_be32 queue_id; /* ID for the specific queue. */
ovs_be16 len; /* Length in bytes of this queue desc. */
uint8_t pad[6]; /* 64-bit alignment. */
};
OFP_ASSERT(sizeof(struct ofp14_queue_desc) == 16);
enum ofp14_queue_desc_prop_type {
OFPQDPT14_MIN_RATE = 1,
OFPQDPT14_MAX_RATE = 2,
OFPQDPT14_EXPERIMENTER = 0xffff
};
/* ## -------------- ## */
/* ## Miscellaneous. ## */
/* ## -------------- ## */
/* Request forward reason */
enum ofp14_requestforward_reason {
OFPRFR_GROUP_MOD = 0, /* Forward group mod requests. */
OFPRFR_METER_MOD = 1, /* Forward meter mod requests. */
OFPRFR_N_REASONS /* Denotes number of reasons. */
};
/* Role status event message. */
struct ofp14_role_status {
ovs_be32 role; /* One of OFPCR_ROLE_*. */
uint8_t reason; /* One of OFPCRR_*. */
uint8_t pad[3]; /* Align to 64 bits. */
ovs_be64 generation_id; /* Master Election Generation Id */
/* Followed by a list of struct ofp14_role_prop_header */
};
OFP_ASSERT(sizeof(struct ofp14_role_status) == 16);
/* What changed about the controller role */
enum ofp14_controller_role_reason {
OFPCRR_MASTER_REQUEST = 0, /* Another controller asked to be master. */
OFPCRR_CONFIG = 1, /* Configuration changed on the switch. */
OFPCRR_EXPERIMENTER = 2, /* Experimenter data changed. */
OFPCRR_N_REASONS /* Denotes number of reasons. */
};
/* Role property types.
*/
enum ofp14_role_prop_type {
OFPRPT_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
};
/* Group/Meter request forwarding. */
struct ofp14_requestforward {
struct ofp_header request; /* Request being forwarded. */
};
OFP_ASSERT(sizeof(struct ofp14_requestforward) == 8);
/* Bundle control message types */
enum ofp14_bundle_ctrl_type {
OFPBCT_OPEN_REQUEST = 0,
OFPBCT_OPEN_REPLY = 1,
OFPBCT_CLOSE_REQUEST = 2,
OFPBCT_CLOSE_REPLY = 3,
OFPBCT_COMMIT_REQUEST = 4,
OFPBCT_COMMIT_REPLY = 5,
OFPBCT_DISCARD_REQUEST = 6,
OFPBCT_DISCARD_REPLY = 7,
};
/* Bundle configuration flags. */
enum ofp14_bundle_flags {
OFPBF_ATOMIC = 1 << 0, /* Execute atomically. */
OFPBF_ORDERED = 1 << 1, /* Execute in specified order. */
};
/* Message structure for OFPT_BUNDLE_CONTROL and OFPT_BUNDLE_ADD_MESSAGE. */
struct ofp14_bundle_ctrl_msg {
ovs_be32 bundle_id; /* Identify the bundle. */
ovs_be16 type; /* OFPT_BUNDLE_CONTROL: one of OFPBCT_*.
* OFPT_BUNDLE_ADD_MESSAGE: not used. */
ovs_be16 flags; /* Bitmap of OFPBF_* flags. */
/* Followed by:
* - For OFPT_BUNDLE_ADD_MESSAGE only, an encapsulated OpenFlow message,
* beginning with an ofp_header whose xid is identical to this message's
* outer xid.
* - For OFPT_BUNDLE_ADD_MESSAGE only, and only if at least one property is
* present, 0 to 7 bytes of padding to align on a 64-bit boundary.
* - Zero or more properties (see struct ofp14_bundle_prop_header). */
};
OFP_ASSERT(sizeof(struct ofp14_bundle_ctrl_msg) == 8);
/* Body for ofp14_multipart_request of type OFPMP_FLOW_MONITOR.
*
* The OFPMP_FLOW_MONITOR request's body consists of an array of zero or more
* instances of this structure. The request arranges to monitor the flows
* that match the specified criteria, which are interpreted in the same way as
* for OFPMP_FLOW.
*
* 'id' identifies a particular monitor for the purpose of allowing it to be
* canceled later with OFPFMC_DELETE. 'id' must be unique among
* existing monitors that have not already been canceled.
*/
struct ofp14_flow_monitor_request {
ovs_be32 monitor_id; /* Controller-assigned ID for this monitor. */
ovs_be32 out_port; /* Required output port, if not OFPP_ANY. */
ovs_be32 out_group; /* Required output port, if not OFPG_ANY. */
ovs_be16 flags; /* OFPMF14_*. */
uint8_t table_id; /* One table's ID or OFPTT_ALL (all tables). */
uint8_t command; /* One of OFPFMC14_*. */
/* Followed by an ofp11_match structure. */
};
OFP_ASSERT(sizeof(struct ofp14_flow_monitor_request) == 16);
/* Flow monitor commands */
enum ofp14_flow_monitor_command {
OFPFMC14_ADD = 0, /* New flow monitor. */
OFPFMC14_MODIFY = 1, /* Modify existing flow monitor. */
OFPFMC14_DELETE = 2, /* Delete/cancel existing flow monitor. */
};
/* 'flags' bits in struct of_flow_monitor_request. */
enum ofp14_flow_monitor_flags {
/* When to send updates. */
/* Common to NX and OpenFlow 1.4 */
OFPFMF14_INITIAL = 1 << 0, /* Initially matching flows. */
OFPFMF14_ADD = 1 << 1, /* New matching flows as they are added. */
OFPFMF14_REMOVED = 1 << 2, /* Old matching flows as they are removed. */
OFPFMF14_MODIFY = 1 << 3, /* Matching flows as they are changed. */
/* What to include in updates. */
/* Common to NX and OpenFlow 1.4 */
OFPFMF14_INSTRUCTIONS = 1 << 4, /* If set, instructions are included. */
OFPFMF14_NO_ABBREV = 1 << 5, /* If set, include own changes in full. */
/* OpenFlow 1.4 */
OFPFMF14_ONLY_OWN = 1 << 6, /* If set, don't include other controllers.
*/
};
#endif /* openflow/openflow-1.4.h */

View File

@ -0,0 +1,153 @@
/* Copyright (c) 2008, 2014 The Board of Trustees of The Leland Stanford
* Junior University
* Copyright (c) 2011, 2014 Open Networking Foundation
*
* We are making the OpenFlow specification and associated documentation
* (Software) available for public use and benefit with the expectation
* that others will use, modify and enhance the Software and contribute
* those enhancements back to the community. However, since we would
* like to make the Software available for broadest use, with as few
* restrictions as possible permission is hereby granted, free of
* charge, to any person obtaining a copy of this Software to deal in
* the Software under the copyrights without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* The name and trademarks of copyright holder(s) may NOT be used in
* advertising or publicity pertaining to the Software or any
* derivatives without specific, written prior permission.
*/
/* OpenFlow: protocol between controller and datapath. */
#ifndef OPENFLOW_15_H
#define OPENFLOW_15_H 1
#include <openflow/openflow-common.h>
/* Body for ofp15_multipart_request of type OFPMP_PORT_DESC. */
struct ofp15_port_desc_request {
ovs_be32 port_no; /* All ports if OFPP_ANY. */
uint8_t pad[4]; /* Align to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp15_port_desc_request) == 8);
/* Group commands */
enum ofp15_group_mod_command {
/* Present since OpenFlow 1.1 - 1.4 */
OFPGC15_ADD = 0, /* New group. */
OFPGC15_MODIFY = 1, /* Modify all matching groups. */
OFPGC15_DELETE = 2, /* Delete all matching groups. */
/* New in OpenFlow 1.5 */
OFPGC15_INSERT_BUCKET = 3,/* Insert action buckets to the already available
list of action buckets in a matching group */
/* OFPGCXX_YYY = 4, */ /* Reserved for future use. */
OFPGC15_REMOVE_BUCKET = 5,/* Remove all action buckets or any specific
action bucket from matching group */
OFPGC15_ADD_OR_MOD = 0x8000, /* Create new or modify existing group. */
};
/* Group bucket property types. */
enum ofp15_group_bucket_prop_type {
OFPGBPT15_WEIGHT = 0, /* Select groups only. */
OFPGBPT15_WATCH_PORT = 1, /* Fast failover groups only. */
OFPGBPT15_WATCH_GROUP = 2, /* Fast failover groups only. */
OFPGBPT15_EXPERIMENTER = 0xFFFF, /* Experimenter defined. */
};
/* Bucket for use in groups. */
struct ofp15_bucket {
ovs_be16 len; /* Length the bucket in bytes, including
this header and any padding to make it
64-bit aligned. */
ovs_be16 action_array_len; /* Length of all actions in bytes. */
ovs_be32 bucket_id; /* Bucket Id used to identify bucket*/
/* Followed by exactly len - 8 bytes of group bucket properties. */
/* Followed by:
* - Exactly 'action_array_len' bytes containing an array of
* struct ofp_action_*.
* - Zero or more bytes of group bucket properties to fill out the
* overall length in header.length. */
};
OFP_ASSERT(sizeof(struct ofp15_bucket) == 8);
/* Bucket Id can be any value between 0 and OFPG_BUCKET_MAX */
enum ofp15_group_bucket {
OFPG15_BUCKET_MAX = 0xffffff00, /* Last usable bucket ID */
OFPG15_BUCKET_FIRST = 0xfffffffd, /* First bucket ID in the list of action
buckets of a group. This is applicable
for OFPGC15_INSERT_BUCKET and
OFPGC15_REMOVE_BUCKET commands */
OFPG15_BUCKET_LAST = 0xfffffffe, /* Last bucket ID in the list of action
buckets of a group. This is applicable
for OFPGC15_INSERT_BUCKET and
OFPGC15_REMOVE_BUCKET commands */
OFPG15_BUCKET_ALL = 0xffffffff /* All action buckets in a group,
This is applicable for
only OFPGC15_REMOVE_BUCKET command */
};
/* Group property types. */
enum ofp_group_prop_type {
OFPGPT15_EXPERIMENTER = 0xFFFF, /* Experimenter defined. */
};
/* Group setup and teardown (controller -> datapath). */
struct ofp15_group_mod {
ovs_be16 command; /* One of OFPGC15_*. */
uint8_t type; /* One of OFPGT11_*. */
uint8_t pad; /* Pad to 64 bits. */
ovs_be32 group_id; /* Group identifier. */
ovs_be16 bucket_array_len; /* Length of action buckets data. */
uint8_t pad1[2]; /* Pad to 64 bits. */
ovs_be32 command_bucket_id; /* Bucket Id used as part of
* OFPGC15_INSERT_BUCKET and
* OFPGC15_REMOVE_BUCKET commands
* execution.*/
/* Followed by:
* - Exactly 'bucket_array_len' bytes containing an array of
* struct ofp15_bucket.
* - Zero or more bytes of group properties to fill out the overall
* length in header.length. */
};
OFP_ASSERT(sizeof(struct ofp15_group_mod) == 16);
/* Body for ofp15_multipart_request of type OFPMP_GROUP_DESC. */
struct ofp15_group_desc_request {
ovs_be32 group_id; /* All groups if OFPG_ALL. */
uint8_t pad[4]; /* Align to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp15_group_desc_request) == 8);
/* Body of reply to OFPMP_GROUP_DESC request. */
struct ofp15_group_desc_stats {
ovs_be16 length; /* Length of this entry. */
uint8_t type; /* One of OFPGT11_*. */
uint8_t pad; /* Pad to 64 bits. */
ovs_be32 group_id; /* Group identifier. */
ovs_be16 bucket_list_len; /* Length of action buckets data. */
uint8_t pad2[6]; /* Pad to 64 bits. */
/* Followed by:
* - Exactly 'bucket_list_len' bytes containing an array of
* struct ofp_bucket.
* - Zero or more bytes of group properties to fill out the overall
* length in header.length. */
};
OFP_ASSERT(sizeof(struct ofp15_group_desc_stats) == 16);
#endif /* openflow/openflow-1.5.h */

View File

@ -0,0 +1,457 @@
/* Copyright (c) 2008, 2011, 2012, 2013, 2014, 2016 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
* (Software) available for public use and benefit with the expectation
* that others will use, modify and enhance the Software and contribute
* those enhancements back to the community. However, since we would
* like to make the Software available for broadest use, with as few
* restrictions as possible permission is hereby granted, free of
* charge, to any person obtaining a copy of this Software to deal in
* the Software under the copyrights without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* The name and trademarks of copyright holder(s) may NOT be used in
* advertising or publicity pertaining to the Software or any
* derivatives without specific, written prior permission.
*/
/*
* Copyright (c) 2008-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.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OPENFLOW_COMMON_H
#define OPENFLOW_COMMON_H 1
#include <openvswitch/types.h>
#ifdef SWIG
#define OFP_ASSERT(EXPR) /* SWIG can't handle OFP_ASSERT. */
#elif !defined(__cplusplus)
/* Build-time assertion for use in a declaration context. */
#define OFP_ASSERT(EXPR) \
extern int (*build_assert(void))[ sizeof(struct { \
unsigned int build_assert_failed : (EXPR) ? 1 : -1; })]
#else /* __cplusplus */
#include <boost/static_assert.hpp>
#define OFP_ASSERT BOOST_STATIC_ASSERT
#endif /* __cplusplus */
/* Version number:
* Non-experimental versions released: 0x01 0x02
* Experimental versions released: 0x81 -- 0x99
*/
/* The most significant bit being set in the version field indicates an
* experimental OpenFlow version.
*/
enum ofp_version {
OFP10_VERSION = 0x01,
OFP11_VERSION = 0x02,
OFP12_VERSION = 0x03,
OFP13_VERSION = 0x04,
OFP14_VERSION = 0x05,
OFP15_VERSION = 0x06,
OFP16_VERSION = 0x07
};
/* Vendor (aka experimenter) IDs.
*
* These are used in various places in OpenFlow to identify an extension
* defined by some vendor, as opposed to a standardized part of the core
* OpenFlow protocol.
*
* Vendor IDs whose top 8 bits are 0 hold an Ethernet OUI in their low 24 bits.
* The Open Networking Foundation assigns vendor IDs whose top 8 bits are
* nonzero.
*
* A few vendor IDs are special:
*
* - OF_VENDOR_ID is not a real vendor ID and does not appear in the
* OpenFlow protocol itself. It can occasionally be useful within Open
* vSwitch to identify a standardized part of OpenFlow.
*
* - ONF_VENDOR_ID is being used within the ONF "extensibility" working
* group to identify extensions being proposed for standardization.
*
* The list is sorted numerically.
*/
#define OF_VENDOR_ID 0
#define HPL_VENDOR_ID 0x000004EA /* HP Labs. */
#define NTR_VENDOR_ID 0x0000154d /* Netronome. */
#define NTR_COMPAT_VENDOR_ID 0x00001540 /* Incorrect value used in v2.4. */
#define NX_VENDOR_ID 0x00002320 /* Nicira. */
#define ONF_VENDOR_ID 0x4f4e4600 /* Open Networking Foundation. */
#define INTEL_VENDOR_ID 0x0000AA01 /* Intel */
#define OFP_MAX_TABLE_NAME_LEN 32
#define OFP_MAX_PORT_NAME_LEN 16
#define OFP_OLD_PORT 6633
#define OFP_PORT 6653
#define OFP_DEFAULT_MISS_SEND_LEN 128
/* Values below this cutoff are 802.3 packets and the two bytes
* following MAC addresses are used as a frame length. Otherwise, the
* two bytes are used as the Ethernet type.
*/
#define OFP_DL_TYPE_ETH2_CUTOFF 0x0600
/* Value of dl_type to indicate that the frame does not include an
* Ethernet type.
*/
#define OFP_DL_TYPE_NOT_ETH_TYPE 0x05ff
/* Value used in "idle_timeout" and "hard_timeout" to indicate that the entry
* is permanent. */
#define OFP_FLOW_PERMANENT 0
/* By default, choose a priority in the middle. */
#define OFP_DEFAULT_PRIORITY 0x8000
/* Header on all OpenFlow packets. */
struct ofp_header {
uint8_t version; /* An OpenFlow version number, e.g. OFP10_VERSION. */
uint8_t type; /* One of the OFPT_ constants. */
ovs_be16 length; /* Length including this ofp_header. */
ovs_be32 xid; /* Transaction id associated with this packet.
Replies use the same id as was in the request
to facilitate pairing. */
};
OFP_ASSERT(sizeof(struct ofp_header) == 8);
/* OFPT_ERROR: Error message (datapath -> controller). */
struct ofp_error_msg {
ovs_be16 type;
ovs_be16 code;
uint8_t data[0]; /* Variable-length data. Interpreted based
on the type and code. */
};
OFP_ASSERT(sizeof(struct ofp_error_msg) == 4);
enum ofp_config_flags {
/* Handling of IP fragments. */
OFPC_FRAG_NORMAL = 0, /* No special handling for fragments. */
OFPC_FRAG_DROP = 1, /* Drop fragments. */
OFPC_FRAG_REASM = 2, /* Reassemble (only if OFPC_IP_REASM set). */
OFPC_FRAG_NX_MATCH = 3, /* Make first fragments available for matching. */
OFPC_FRAG_MASK = 3,
/* OFPC_INVALID_TTL_TO_CONTROLLER is deprecated in OpenFlow 1.3 */
/* TTL processing - applicable for IP and MPLS packets. */
OFPC_INVALID_TTL_TO_CONTROLLER = 1 << 2, /* Send packets with invalid TTL
to the controller. */
};
/* Switch configuration. */
struct ofp_switch_config {
ovs_be16 flags; /* OFPC_* flags. */
ovs_be16 miss_send_len; /* Max bytes of new flow that datapath should
send to the controller. */
};
OFP_ASSERT(sizeof(struct ofp_switch_config) == 4);
/* Common flags to indicate behavior of the physical port. These flags are
* used in ofp_port to describe the current configuration. They are used in
* the ofp_port_mod message to configure the port's behavior.
*/
enum ofp_port_config {
OFPPC_PORT_DOWN = 1 << 0, /* Port is administratively down. */
OFPPC_NO_RECV = 1 << 2, /* Drop all packets received by port. */
OFPPC_NO_FWD = 1 << 5, /* Drop packets forwarded to port. */
OFPPC_NO_PACKET_IN = 1 << 6 /* Do not send packet-in msgs for port. */
};
/* Common current state of the physical port. These are not configurable from
* the controller.
*/
enum ofp_port_state {
OFPPS_LINK_DOWN = 1 << 0, /* No physical link present. */
};
/* Common features of physical ports available in a datapath. */
enum ofp_port_features {
OFPPF_10MB_HD = 1 << 0, /* 10 Mb half-duplex rate support. */
OFPPF_10MB_FD = 1 << 1, /* 10 Mb full-duplex rate support. */
OFPPF_100MB_HD = 1 << 2, /* 100 Mb half-duplex rate support. */
OFPPF_100MB_FD = 1 << 3, /* 100 Mb full-duplex rate support. */
OFPPF_1GB_HD = 1 << 4, /* 1 Gb half-duplex rate support. */
OFPPF_1GB_FD = 1 << 5, /* 1 Gb full-duplex rate support. */
OFPPF_10GB_FD = 1 << 6, /* 10 Gb full-duplex rate support. */
};
/* Generic OpenFlow property header, as used by various messages in OF1.3+, and
* especially in OF1.4.
*
* The OpenFlow specs prefer to define a new structure with a specialized name
* each time this property structure comes up: struct
* ofp_port_desc_prop_header, struct ofp_controller_status_prop_header, struct
* ofp_table_mod_prop_header, and more. They're all the same, so it's easier
* to unify them.
*/
struct ofp_prop_header {
ovs_be16 type;
ovs_be16 len;
/* Followed by:
* - 'len - 4' bytes of payload.
* - PAD_SIZE(len, 8) bytes of zeros. */
};
OFP_ASSERT(sizeof(struct ofp_prop_header) == 4);
/* Generic OpenFlow experimenter property header.
*
* Again the OpenFlow specs define this over and over again and it's easier to
* unify them. */
struct ofp_prop_experimenter {
ovs_be16 type; /* Generally 0xffff (in one case 0xfffe). */
ovs_be16 len; /* Length in bytes of this property. */
ovs_be32 experimenter; /* Experimenter ID which takes the same form as
* in struct ofp_experimenter_header. */
ovs_be32 exp_type; /* Experimenter defined. */
/* Followed by:
* - 'len - 12' bytes of payload.
* - PAD_SIZE(len, 8) bytes of zeros. */
};
OFP_ASSERT(sizeof(struct ofp_prop_experimenter) == 12);
/* Switch features. */
struct ofp_switch_features {
ovs_be64 datapath_id; /* Datapath unique ID. The lower 48-bits are for
a MAC address, while the upper 16-bits are
implementer-defined. */
ovs_be32 n_buffers; /* Max packets buffered at once. */
uint8_t n_tables; /* Number of tables supported by datapath. */
uint8_t auxiliary_id; /* OF 1.3: Identify auxiliary connections */
uint8_t pad[2]; /* Align to 64-bits. */
/* Features. */
ovs_be32 capabilities; /* OFPC_*, OFPC10_*, OFPC11_*, OFPC12_*. */
ovs_be32 actions; /* Bitmap of supported "ofp_action_type"s.
* DEPRECATED in OpenFlow 1.1 */
/* Followed by an array of struct ofp10_phy_port or struct ofp11_port
* structures. The number is inferred from header.length.
* REMOVED in OpenFlow 1.3 */
};
OFP_ASSERT(sizeof(struct ofp_switch_features) == 24);
/* Common capabilities supported by the datapath (struct ofp_switch_features,
* member capabilities). */
enum ofp_capabilities {
OFPC_FLOW_STATS = 1 << 0, /* Flow statistics. */
OFPC_TABLE_STATS = 1 << 1, /* Table statistics. */
OFPC_PORT_STATS = 1 << 2, /* Port statistics. */
OFPC_IP_REASM = 1 << 5, /* Can reassemble IP fragments. */
OFPC_QUEUE_STATS = 1 << 6, /* Queue statistics. */
OFPC_ARP_MATCH_IP = 1 << 7 /* Match IP addresses in ARP
pkts. */
};
/* Why is this packet being sent to the controller? */
enum ofp_packet_in_reason {
/* Standard reasons. */
OFPR_NO_MATCH, /* No matching flow. */
OFPR_ACTION, /* Action explicitly output to controller. */
OFPR_INVALID_TTL, /* Packet has invalid TTL. */
OFPR_ACTION_SET, /* Output to controller in action set */
OFPR_GROUP, /* Output to controller in group bucket */
OFPR_PACKET_OUT, /* Output to controller in packet-out */
#define OFPR10_BITS \
((1u << OFPR_NO_MATCH) | (1u << OFPR_ACTION) | (1u << OFPR_INVALID_TTL))
#define OFPR14_BITS \
(OFPR10_BITS | \
(1u << OFPR_ACTION_SET) | (1u << OFPR_GROUP) | (1u << OFPR_PACKET_OUT))
/* Nonstandard reason--not exposed via OpenFlow. */
OFPR_EXPLICIT_MISS,
OFPR_IMPLICIT_MISS,
OFPR_N_REASONS
};
enum ofp_flow_mod_command {
OFPFC_ADD, /* New flow. */
OFPFC_MODIFY, /* Modify all matching flows. */
OFPFC_MODIFY_STRICT, /* Modify entry strictly matching wildcards */
OFPFC_DELETE, /* Delete all matching flows. */
OFPFC_DELETE_STRICT /* Strictly match wildcards and priority. */
};
enum ofp_flow_mod_flags {
OFPFF_SEND_FLOW_REM = 1 << 0, /* Send flow removed message when flow
* expires or is deleted. */
OFPFF_CHECK_OVERLAP = 1 << 1, /* Check for overlapping entries first. */
};
/* Why was this flow removed? */
enum ofp_flow_removed_reason {
OFPRR_IDLE_TIMEOUT, /* Flow idle time exceeded idle_timeout. */
OFPRR_HARD_TIMEOUT, /* Time exceeded hard_timeout. */
OFPRR_DELETE, /* Evicted by a DELETE flow mod. */
OFPRR_GROUP_DELETE, /* Group was removed. */
OFPRR_METER_DELETE, /* Meter was removed. */
OFPRR_EVICTION, /* Switch eviction to free resources. */
#define OFPRR10_BITS \
((1u << OFPRR_IDLE_TIMEOUT) | \
(1u << OFPRR_HARD_TIMEOUT) | \
(1u << OFPRR_DELETE))
#define OFPRR14_BITS \
(OFPRR10_BITS | \
(1u << OFPRR_GROUP_DELETE) | \
(1u << OFPRR_METER_DELETE) | \
(1u << OFPRR_EVICTION))
OVS_OFPRR_NONE /* OVS internal_use only, keep last!. */
};
/* What changed about the physical port */
enum ofp_port_reason {
OFPPR_ADD, /* The port was added. */
OFPPR_DELETE, /* The port was removed. */
OFPPR_MODIFY, /* Some attribute of the port has changed. */
#define OFPPR_BITS ((1u << OFPPR_ADD) | \
(1u << OFPPR_DELETE) | \
(1u << OFPPR_MODIFY))
OFPPR_N_REASONS /* Denotes number of reasons. */
};
/* A physical port has changed in the datapath */
struct ofp_port_status {
uint8_t reason; /* One of OFPPR_*. */
uint8_t pad[7]; /* Align to 64-bits. */
/* Followed by struct ofp10_phy_port, struct ofp11_port, or struct
* ofp14_port. */
};
OFP_ASSERT(sizeof(struct ofp_port_status) == 8);
enum ofp_stats_reply_flags {
OFPSF_REPLY_MORE = 1 << 0 /* More replies to follow. */
};
#define DESC_STR_LEN 256
#define SERIAL_NUM_LEN 32
/* Body of reply to OFPST_DESC request. Each entry is a NULL-terminated ASCII
* string. */
struct ofp_desc_stats {
char mfr_desc[DESC_STR_LEN]; /* Manufacturer description. */
char hw_desc[DESC_STR_LEN]; /* Hardware description. */
char sw_desc[DESC_STR_LEN]; /* Software description. */
char serial_num[SERIAL_NUM_LEN]; /* Serial number. */
char dp_desc[DESC_STR_LEN]; /* Human readable description of
the datapath. */
};
OFP_ASSERT(sizeof(struct ofp_desc_stats) == 1056);
/* Reply to OFPST_AGGREGATE request. */
struct ofp_aggregate_stats_reply {
ovs_32aligned_be64 packet_count; /* Number of packets in flows. */
ovs_32aligned_be64 byte_count; /* Number of bytes in flows. */
ovs_be32 flow_count; /* Number of flows. */
uint8_t pad[4]; /* Align to 64 bits. */
};
OFP_ASSERT(sizeof(struct ofp_aggregate_stats_reply) == 24);
/* The match type indicates the match structure (set of fields that compose the
* match) in use. The match type is placed in the type field at the beginning
* of all match structures. The "OpenFlow Extensible Match" type corresponds
* to OXM TLV format described below and must be supported by all OpenFlow
* switches. Extensions that define other match types may be published on the
* ONF wiki. Support for extensions is optional.
*/
enum ofp_match_type {
OFPMT_STANDARD = 0, /* The match fields defined in the ofp11_match
structure apply */
OFPMT_OXM = 1, /* OpenFlow Extensible Match */
};
/* Group numbering. Groups can use any number up to OFPG_MAX. */
enum ofp_group {
/* Last usable group number. */
OFPG_MAX = 0xffffff00,
/* Fake groups. */
OFPG_ALL = 0xfffffffc, /* All groups, for group delete commands. */
OFPG_ANY = 0xffffffff /* Wildcard, for flow stats requests. */
};
/* Group configuration flags */
enum ofp_group_capabilities {
OFPGFC_SELECT_WEIGHT = 1 << 0, /* Support weight for select groups */
OFPGFC_SELECT_LIVENESS = 1 << 1, /* Support liveness for select groups */
OFPGFC_CHAINING = 1 << 2, /* Support chaining groups */
OFPGFC_CHAINING_CHECKS = 1 << 3, /* Check chaining for loops and delete */
};
enum ofp_hello_elem_type {
OFPHET_VERSIONBITMAP = 1, /* Bitmap of version supported. */
};
/* Common header for all Hello Elements */
struct ofp_hello_elem_header {
ovs_be16 type; /* One of OFPHET_*. */
ovs_be16 length; /* Length in bytes of this element. */
};
OFP_ASSERT(sizeof(struct ofp_hello_elem_header) == 4);
/* Table numbering. Tables can use any number up to OFPT_MAX. */
enum ofp_table {
/* Last usable table number. */
OFPTT_MAX = 0xfe,
/* Fake tables. */
OFPTT_ALL = 0xff /* Wildcard table used for table config,
flow stats and flow deletes. */
};
enum ofp_table_config {
/* OpenFlow 1.1 and 1.2 defined this field as shown.
* OpenFlow 1.3 and later mark this field as deprecated, but have not
* reused it for any new purpose. */
OFPTC11_TABLE_MISS_CONTROLLER = 0 << 0, /* Send to controller. */
OFPTC11_TABLE_MISS_CONTINUE = 1 << 0, /* Go to next table, like OF1.0. */
OFPTC11_TABLE_MISS_DROP = 2 << 0, /* Drop the packet. */
OFPTC11_TABLE_MISS_MASK = 3 << 0,
/* OpenFlow 1.4. */
OFPTC14_EVICTION = 1 << 2, /* Allow table to evict flows. */
OFPTC14_VACANCY_EVENTS = 1 << 3, /* Enable vacancy events. */
};
#endif /* openflow/openflow-common.h */

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OPENFLOW_OPENFLOW_H
#define OPENFLOW_OPENFLOW_H 1
#include <openflow/openflow-1.0.h>
#include <openflow/openflow-1.1.h>
#include <openflow/openflow-1.2.h>
#include <openflow/openflow-1.3.h>
#include <openflow/openflow-1.4.h>
#include <openflow/openflow-1.5.h>
#endif /* openflow/openflow.h */