2 * Copyright (c) 2008, 2009, 2010 Nicira Networks
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef OPENFLOW_NICIRA_EXT_H
18 #define OPENFLOW_NICIRA_EXT_H 1
20 #include "openflow/openflow.h"
22 #define NICIRA_OUI_STR "002320"
24 /* The following vendor extensions, proposed by Nicira Networks, are not yet
25 * ready for standardization (and may never be), so they are not included in
28 #define NX_VENDOR_ID 0x00002320
31 /* Switch status request. The request body is an ASCII string that
32 * specifies a prefix of the key names to include in the output; if it is
33 * the null string, then all key-value pairs are included. */
36 /* Switch status reply. The reply body is an ASCII string of key-value
37 * pairs in the form "key=value\n". */
41 NXT_ACT_SET_CONFIG__OBSOLETE,
42 NXT_ACT_GET_CONFIG__OBSOLETE,
43 NXT_COMMAND_REQUEST__OBSOLETE,
44 NXT_COMMAND_REPLY__OBSOLETE,
45 NXT_FLOW_END_CONFIG__OBSOLETE,
46 NXT_FLOW_END__OBSOLETE,
49 /* Use the high 32 bits of the cookie field as the tunnel ID in the flow
51 NXT_TUN_ID_FROM_COOKIE,
53 /* Controller role support. The request body is struct nx_role_request.
54 * The reply echos the request. */
59 struct nicira_header {
60 struct ofp_header header;
61 uint32_t vendor; /* NX_VENDOR_ID. */
62 uint32_t subtype; /* One of NXT_* above. */
64 OFP_ASSERT(sizeof(struct nicira_header) == 16);
66 struct nxt_tun_id_cookie {
67 struct ofp_header header;
68 uint32_t vendor; /* NX_VENDOR_ID. */
69 uint32_t subtype; /* NXT_TUN_ID_FROM_COOKIE */
70 uint8_t set; /* Nonzero to enable, zero to disable. */
73 OFP_ASSERT(sizeof(struct nxt_tun_id_cookie) == 24);
75 /* Configures the "role" of the sending controller. The default role is:
77 * - Other (NX_ROLE_OTHER), which allows the controller access to all
80 * The other possible roles are a related pair:
82 * - Master (NX_ROLE_MASTER) is equivalent to Other, except that there may
83 * be at most one Master controller at a time: when a controller
84 * configures itself as Master, any existing Master is demoted to the
87 * - Slave (NX_ROLE_SLAVE) allows the controller read-only access to
88 * OpenFlow features. In particular attempts to modify the flow table
89 * will be rejected with an OFPBRC_EPERM error.
91 * Slave controllers also do not receive asynchronous messages
92 * (OFPT_PACKET_IN, OFPT_FLOW_REMOVED, OFPT_PORT_STATUS).
94 struct nx_role_request {
95 struct nicira_header nxh;
96 uint32_t role; /* One of NX_ROLE_*. */
100 NX_ROLE_OTHER, /* Default role, full access. */
101 NX_ROLE_MASTER, /* Full access, at most one. */
102 NX_ROLE_SLAVE /* Read-only access. */
105 enum nx_action_subtype {
106 NXAST_SNAT__OBSOLETE, /* No longer used. */
108 /* Searches the flow table again, using a flow that is slightly modified
109 * from the original lookup:
111 * - The 'in_port' member of struct nx_action_resubmit is used as the
114 * - If NXAST_RESUBMIT is preceded by actions that affect the flow
115 * (e.g. OFPAT_SET_VLAN_VID), then the flow is updated with the new
118 * Following the lookup, the original in_port is restored.
120 * If the modified flow matched in the flow table, then the corresponding
121 * actions are executed. Afterward, actions following NXAST_RESUBMIT in
122 * the original set of actions, if any, are executed; any changes made to
123 * the packet (e.g. changes to VLAN) by secondary actions persist when
124 * those actions are executed, although the original in_port is restored.
126 * NXAST_RESUBMIT may be used any number of times within a set of actions.
128 * NXAST_RESUBMIT may nest to an implementation-defined depth. Beyond this
129 * implementation-defined depth, further NXAST_RESUBMIT actions are simply
130 * ignored. (Open vSwitch 1.0.1 and earlier did not support recursion.)
134 /* Set encapsulating tunnel ID. */
137 /* Stops processing further actions, if the packet being processed is an
138 * Ethernet+IPv4 ARP packet for which the source Ethernet address inside
139 * the ARP packet differs from the source Ethernet address in the Ethernet
142 * This is useful because OpenFlow does not provide a way to match on the
143 * Ethernet addresses inside ARP packets, so there is no other way to drop
144 * spoofed ARPs other than sending every ARP packet to a controller. */
145 NXAST_DROP_SPOOFED_ARP,
147 /* Set the queue that should be used when packets are output. This
148 * is similar to the OpenFlow OFPAT_ENQUEUE action, but does not
149 * take the output port as an argument. This allows the queue
150 * to be defined before the port is known. */
153 /* Restore the queue to the value it was before any NXAST_SET_QUEUE
154 * actions were used. */
158 /* Action structure for NXAST_RESUBMIT. */
159 struct nx_action_resubmit {
160 uint16_t type; /* OFPAT_VENDOR. */
161 uint16_t len; /* Length is 16. */
162 uint32_t vendor; /* NX_VENDOR_ID. */
163 uint16_t subtype; /* NXAST_RESUBMIT. */
164 uint16_t in_port; /* New in_port for checking flow table. */
167 OFP_ASSERT(sizeof(struct nx_action_resubmit) == 16);
169 /* Action structure for NXAST_SET_TUNNEL. */
170 struct nx_action_set_tunnel {
171 uint16_t type; /* OFPAT_VENDOR. */
172 uint16_t len; /* Length is 16. */
173 uint32_t vendor; /* NX_VENDOR_ID. */
174 uint16_t subtype; /* NXAST_SET_TUNNEL. */
176 uint32_t tun_id; /* Tunnel ID. */
178 OFP_ASSERT(sizeof(struct nx_action_set_tunnel) == 16);
180 /* Action structure for NXAST_SET_QUEUE. */
181 struct nx_action_set_queue {
182 uint16_t type; /* OFPAT_VENDOR. */
183 uint16_t len; /* Length is 16. */
184 uint32_t vendor; /* NX_VENDOR_ID. */
185 uint16_t subtype; /* NXAST_SET_QUEUE. */
187 uint32_t queue_id; /* Where to enqueue packets. */
189 OFP_ASSERT(sizeof(struct nx_action_set_queue) == 16);
191 /* Header for Nicira-defined actions. */
192 struct nx_action_header {
193 uint16_t type; /* OFPAT_VENDOR. */
194 uint16_t len; /* Length is 16. */
195 uint32_t vendor; /* NX_VENDOR_ID. */
196 uint16_t subtype; /* NXAST_*. */
199 OFP_ASSERT(sizeof(struct nx_action_header) == 16);
201 /* Wildcard for tunnel ID. */
202 #define NXFW_TUN_ID (1 << 25)
204 #define NXFW_ALL NXFW_TUN_ID
205 #define OVSFW_ALL (OFPFW_ALL | NXFW_ALL)
207 #endif /* openflow/nicira-ext.h */