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,
54 struct nicira_header {
55 struct ofp_header header;
56 uint32_t vendor; /* NX_VENDOR_ID. */
57 uint32_t subtype; /* One of NXT_* above. */
59 OFP_ASSERT(sizeof(struct nicira_header) == 16);
61 struct nxt_tun_id_cookie {
62 struct ofp_header header;
63 uint32_t vendor; /* NX_VENDOR_ID. */
64 uint32_t subtype; /* NXT_TUN_ID_FROM_COOKIE */
65 uint8_t set; /* Nonzero to enable, zero to disable. */
68 OFP_ASSERT(sizeof(struct nxt_tun_id_cookie) == 24);
70 enum nx_action_subtype {
71 NXAST_SNAT__OBSOLETE, /* No longer used. */
73 /* Searches the flow table again, using a flow that is slightly modified
74 * from the original lookup:
76 * - The 'in_port' member of struct nx_action_resubmit is used as the
79 * - If NXAST_RESUBMIT is preceded by actions that affect the flow
80 * (e.g. OFPAT_SET_VLAN_VID), then the flow is updated with the new
83 * Following the lookup, the original in_port is restored.
85 * If the modified flow matched in the flow table, then the corresponding
86 * actions are executed, except that NXAST_RESUBMIT actions found in the
87 * secondary set of actions are ignored. Afterward, actions following
88 * NXAST_RESUBMIT in the original set of actions, if any, are executed; any
89 * changes made to the packet (e.g. changes to VLAN) by secondary actions
90 * persist when those actions are executed, although the original in_port
93 * NXAST_RESUBMIT may be used any number of times within a set of actions.
97 NXAST_SET_TUNNEL /* Set encapsulating tunnel ID. */
100 /* Action structure for NXAST_RESUBMIT. */
101 struct nx_action_resubmit {
102 uint16_t type; /* OFPAT_VENDOR. */
103 uint16_t len; /* Length is 16. */
104 uint32_t vendor; /* NX_VENDOR_ID. */
105 uint16_t subtype; /* NXAST_RESUBMIT. */
106 uint16_t in_port; /* New in_port for checking flow table. */
109 OFP_ASSERT(sizeof(struct nx_action_resubmit) == 16);
111 /* Action structure for NXAST_SET_TUNNEL. */
112 struct nx_action_set_tunnel {
113 uint16_t type; /* OFPAT_VENDOR. */
114 uint16_t len; /* Length is 16. */
115 uint32_t vendor; /* NX_VENDOR_ID. */
116 uint16_t subtype; /* NXAST_SET_TUNNEL. */
118 uint32_t tun_id; /* Tunnel ID. */
120 OFP_ASSERT(sizeof(struct nx_action_set_tunnel) == 16);
122 /* Header for Nicira-defined actions. */
123 struct nx_action_header {
124 uint16_t type; /* OFPAT_VENDOR. */
125 uint16_t len; /* Length is 16. */
126 uint32_t vendor; /* NX_VENDOR_ID. */
127 uint16_t subtype; /* NXAST_*. */
130 OFP_ASSERT(sizeof(struct nx_action_header) == 16);
132 /* Wildcard for tunnel ID. */
133 #define NXFW_TUN_ID (1 << 25)
135 #define NXFW_ALL NXFW_TUN_ID
136 #define OVSFW_ALL (OFPFW_ALL | NXFW_ALL)
138 #endif /* openflow/nicira-ext.h */