]>
Commit | Line | Data |
---|---|---|
064af421 | 1 | /* |
856081f6 | 2 | * Copyright (c) 2009, 2010, 2011 Nicira Networks. |
064af421 | 3 | * |
a14bc59f BP |
4 | * This file is offered under your choice of two licenses: Apache 2.0 or GNU |
5 | * GPL 2.0 or later. The permission statements for each of these licenses is | |
6 | * given below. You may license your modifications to this file under either | |
7 | * of these licenses or both. If you wish to license your modifications under | |
8 | * only one of these licenses, delete the permission text for the other | |
9 | * license. | |
064af421 | 10 | * |
a14bc59f BP |
11 | * ---------------------------------------------------------------------- |
12 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
13 | * you may not use this file except in compliance with the License. | |
14 | * You may obtain a copy of the License at: | |
15 | * | |
16 | * http://www.apache.org/licenses/LICENSE-2.0 | |
17 | * | |
18 | * Unless required by applicable law or agreed to in writing, software | |
19 | * distributed under the License is distributed on an "AS IS" BASIS, | |
20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
21 | * See the License for the specific language governing permissions and | |
22 | * limitations under the License. | |
23 | * ---------------------------------------------------------------------- | |
24 | * This program is free software; you can redistribute it and/or modify | |
25 | * it under the terms of the GNU General Public License as published by | |
26 | * the Free Software Foundation; either version 2 of the License, or | |
27 | * (at your option) any later version. | |
28 | * | |
29 | * This program is distributed in the hope that it will be useful, | |
30 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
32 | * GNU General Public License for more details. | |
33 | * | |
34 | * You should have received a copy of the GNU General Public License along | |
35 | * with this program; if not, write to the Free Software Foundation, Inc., | |
36 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
37 | * ---------------------------------------------------------------------- | |
064af421 BP |
38 | */ |
39 | ||
064af421 BP |
40 | #ifndef OPENVSWITCH_DATAPATH_PROTOCOL_H |
41 | #define OPENVSWITCH_DATAPATH_PROTOCOL_H 1 | |
42 | ||
43 | #ifdef __KERNEL__ | |
44 | #include <linux/types.h> | |
b90fa799 BP |
45 | #define ovs_be16 __be16 |
46 | #define ovs_be32 __be32 | |
47 | #define ovs_be64 __be64 | |
064af421 | 48 | #else |
fba47339 | 49 | #include "openvswitch/types.h" |
064af421 | 50 | #endif |
aaff4b55 | 51 | \f |
254f2dc8 | 52 | /* datapaths. */ |
aaff4b55 | 53 | |
df2c07f4 JP |
54 | #define OVS_DATAPATH_FAMILY "ovs_datapath" |
55 | #define OVS_DATAPATH_MCGROUP "ovs_datapath" | |
56 | ||
57 | enum ovs_datapath_cmd { | |
58 | OVS_DP_CMD_UNSPEC, | |
59 | OVS_DP_CMD_NEW, | |
60 | OVS_DP_CMD_DEL, | |
61 | OVS_DP_CMD_GET, | |
62 | OVS_DP_CMD_SET | |
aaff4b55 | 63 | }; |
064af421 | 64 | |
982b8810 | 65 | /** |
df2c07f4 | 66 | * struct ovs_header - header for OVS Generic Netlink messages. |
254f2dc8 BP |
67 | * @dp_ifindex: ifindex of local port for datapath (0 to make a request not |
68 | * specific to a datapath). | |
982b8810 | 69 | * |
df2c07f4 JP |
70 | * Attributes following the header are specific to a particular OVS Generic |
71 | * Netlink family, but all of the OVS families use this header. | |
982b8810 | 72 | */ |
df2c07f4 | 73 | struct ovs_header { |
254f2dc8 | 74 | int dp_ifindex; |
982b8810 BP |
75 | }; |
76 | \f | |
d6569377 | 77 | /** |
df2c07f4 JP |
78 | * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. |
79 | * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local | |
254f2dc8 | 80 | * port". This is the name of the network device whose dp_ifindex is given in |
df2c07f4 JP |
81 | * the &struct ovs_header. Always present in notifications. Required in |
82 | * %OVS_DP_NEW requests. May be used as an alternative to specifying | |
254f2dc8 | 83 | * dp_ifindex in other requests (with a dp_ifindex of 0). |
b063d9f0 JG |
84 | * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially |
85 | * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on | |
86 | * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should | |
87 | * not be sent. | |
df2c07f4 | 88 | * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the |
aaff4b55 | 89 | * datapath. Always present in notifications. |
df2c07f4 JP |
90 | * @OVS_DP_ATTR_IPV4_FRAGS: One of %OVS_DP_FRAG_*. Always present in |
91 | * notifications. May be included in %OVS_DP_NEW or %OVS_DP_SET requests to | |
aaff4b55 | 92 | * change the fragment handling policy. |
d6569377 | 93 | * |
df2c07f4 JP |
94 | * These attributes follow the &struct ovs_header within the Generic Netlink |
95 | * payload for %OVS_DP_* commands. | |
d6569377 | 96 | */ |
df2c07f4 JP |
97 | enum ovs_datapath_attr { |
98 | OVS_DP_ATTR_UNSPEC, | |
99 | OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ | |
b063d9f0 | 100 | OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ |
df2c07f4 JP |
101 | OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ |
102 | OVS_DP_ATTR_IPV4_FRAGS, /* 32-bit enum ovs_frag_handling */ | |
df2c07f4 | 103 | __OVS_DP_ATTR_MAX |
d6569377 BP |
104 | }; |
105 | ||
df2c07f4 | 106 | #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) |
d6569377 | 107 | |
aaff4b55 | 108 | /** |
df2c07f4 JP |
109 | * enum ovs_frag_handling - policy for handling received IPv4 fragments. |
110 | * @OVS_DP_FRAG_ZERO: Treat IP fragments as IP protocol 0 and transport ports | |
aaff4b55 | 111 | * zero. |
df2c07f4 | 112 | * @OVS_DP_FRAG_DROP: Drop IP fragments. Do not pass them through the flow |
aaff4b55 BP |
113 | * table or up to userspace. |
114 | */ | |
df2c07f4 JP |
115 | enum ovs_frag_handling { |
116 | OVS_DP_FRAG_UNSPEC, | |
117 | OVS_DP_FRAG_ZERO, /* Treat IP fragments as transport port 0. */ | |
118 | OVS_DP_FRAG_DROP /* Drop IP fragments. */ | |
d6569377 | 119 | }; |
72b06300 | 120 | |
df2c07f4 | 121 | struct ovs_dp_stats { |
b90fa799 BP |
122 | uint64_t n_frags; /* Number of dropped IP fragments. */ |
123 | uint64_t n_hit; /* Number of flow table matches. */ | |
124 | uint64_t n_missed; /* Number of flow table misses. */ | |
125 | uint64_t n_lost; /* Number of misses not sent to userspace. */ | |
f180c2e2 | 126 | uint64_t n_flows; /* Number of flows present */ |
064af421 BP |
127 | }; |
128 | ||
f613a0d7 PS |
129 | struct ovs_vport_stats { |
130 | uint64_t rx_packets; /* total packets received */ | |
131 | uint64_t tx_packets; /* total packets transmitted */ | |
132 | uint64_t rx_bytes; /* total bytes received */ | |
133 | uint64_t tx_bytes; /* total bytes transmitted */ | |
134 | uint64_t rx_errors; /* bad packets received */ | |
135 | uint64_t tx_errors; /* packet transmit problems */ | |
136 | uint64_t rx_dropped; /* no space in linux buffers */ | |
cca208bb | 137 | uint64_t tx_dropped; /* no space available in linux */ |
f613a0d7 PS |
138 | }; |
139 | ||
064af421 | 140 | /* Logical ports. */ |
df2c07f4 | 141 | #define OVSP_LOCAL ((uint16_t)0) |
982b8810 | 142 | \f |
df2c07f4 | 143 | #define OVS_PACKET_FAMILY "ovs_packet" |
064af421 | 144 | |
df2c07f4 JP |
145 | enum ovs_packet_cmd { |
146 | OVS_PACKET_CMD_UNSPEC, | |
064af421 | 147 | |
982b8810 | 148 | /* Kernel-to-user notifications. */ |
df2c07f4 JP |
149 | OVS_PACKET_CMD_MISS, /* Flow table miss. */ |
150 | OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ | |
982b8810 BP |
151 | |
152 | /* User commands. */ | |
df2c07f4 | 153 | OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ |
982b8810 BP |
154 | }; |
155 | ||
156 | /** | |
df2c07f4 JP |
157 | * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. |
158 | * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire | |
982b8810 | 159 | * packet as received, from the start of the Ethernet header onward. For |
df2c07f4 JP |
160 | * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by |
161 | * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is | |
7aec165d | 162 | * the flow key extracted from the packet as originally received. |
df2c07f4 JP |
163 | * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key |
164 | * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows | |
982b8810 BP |
165 | * userspace to adapt its flow setup strategy by comparing its notion of the |
166 | * flow key against the kernel's. | |
6ff686f2 PS |
167 | * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used |
168 | * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. | |
df2c07f4 | 169 | * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION |
98403001 BP |
170 | * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an |
171 | * %OVS_USERSPACE_ATTR_USERDATA attribute. | |
982b8810 | 172 | * |
df2c07f4 JP |
173 | * These attributes follow the &struct ovs_header within the Generic Netlink |
174 | * payload for %OVS_PACKET_* commands. | |
982b8810 | 175 | */ |
df2c07f4 JP |
176 | enum ovs_packet_attr { |
177 | OVS_PACKET_ATTR_UNSPEC, | |
178 | OVS_PACKET_ATTR_PACKET, /* Packet data. */ | |
179 | OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ | |
6ff686f2 | 180 | OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ |
df2c07f4 | 181 | OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */ |
df2c07f4 | 182 | __OVS_PACKET_ATTR_MAX |
72b06300 BP |
183 | }; |
184 | ||
df2c07f4 | 185 | #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) |
982b8810 | 186 | \f |
df2c07f4 JP |
187 | enum ovs_vport_type { |
188 | OVS_VPORT_TYPE_UNSPEC, | |
189 | OVS_VPORT_TYPE_NETDEV, /* network device */ | |
190 | OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ | |
191 | OVS_VPORT_TYPE_PATCH, /* virtual tunnel connecting two vports */ | |
192 | OVS_VPORT_TYPE_GRE, /* GRE tunnel */ | |
193 | OVS_VPORT_TYPE_CAPWAP, /* CAPWAP tunnel */ | |
194 | __OVS_VPORT_TYPE_MAX | |
c283069c BP |
195 | }; |
196 | ||
df2c07f4 | 197 | #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) |
f0fef760 | 198 | \f |
df2c07f4 JP |
199 | #define OVS_VPORT_FAMILY "ovs_vport" |
200 | #define OVS_VPORT_MCGROUP "ovs_vport" | |
201 | ||
202 | enum ovs_vport_cmd { | |
203 | OVS_VPORT_CMD_UNSPEC, | |
204 | OVS_VPORT_CMD_NEW, | |
205 | OVS_VPORT_CMD_DEL, | |
206 | OVS_VPORT_CMD_GET, | |
207 | OVS_VPORT_CMD_SET | |
f0fef760 | 208 | }; |
c283069c | 209 | |
b0ec0f27 | 210 | /** |
df2c07f4 JP |
211 | * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. |
212 | * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. | |
213 | * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type | |
f0fef760 | 214 | * of vport. |
df2c07f4 | 215 | * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device |
f0fef760 BP |
216 | * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes |
217 | * plus a null terminator. | |
b063d9f0 JG |
218 | * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that |
219 | * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on | |
220 | * this port. A value of zero indicates that upcalls should not be sent. | |
f613a0d7 | 221 | * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for |
f0fef760 | 222 | * packets sent or received through the vport. |
df2c07f4 | 223 | * @OVS_VPORT_ATTR_ADDRESS: A 6-byte Ethernet address for the vport. |
f0fef760 | 224 | * |
df2c07f4 JP |
225 | * These attributes follow the &struct ovs_header within the Generic Netlink |
226 | * payload for %OVS_VPORT_* commands. | |
b0ec0f27 | 227 | * |
df2c07f4 JP |
228 | * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and |
229 | * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is | |
f0fef760 | 230 | * optional; if not specified a free port number is automatically selected. |
df2c07f4 | 231 | * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type |
9b020780 PS |
232 | * of vport. %OVS_VPORT_ATTR_STATS and %OVS_VPORT_ATTR_ADDRESS are optional, |
233 | * and other attributes are ignored. | |
f0fef760 | 234 | * |
df2c07f4 | 235 | * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to |
f0fef760 | 236 | * look up the vport to operate on; otherwise dp_idx from the &struct |
df2c07f4 | 237 | * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. |
b0ec0f27 | 238 | */ |
df2c07f4 JP |
239 | enum ovs_vport_attr { |
240 | OVS_VPORT_ATTR_UNSPEC, | |
241 | OVS_VPORT_ATTR_PORT_NO, /* port number within datapath */ | |
242 | OVS_VPORT_ATTR_TYPE, /* 32-bit OVS_VPORT_TYPE_* constant. */ | |
243 | OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ | |
b063d9f0 | 244 | OVS_VPORT_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ |
f613a0d7 | 245 | OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ |
df2c07f4 | 246 | OVS_VPORT_ATTR_ADDRESS, /* hardware address */ |
df2c07f4 | 247 | OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ |
df2c07f4 | 248 | __OVS_VPORT_ATTR_MAX |
064af421 BP |
249 | }; |
250 | ||
df2c07f4 | 251 | #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) |
c19e6535 | 252 | |
df2c07f4 | 253 | /* OVS_VPORT_ATTR_OPTIONS attributes for patch vports. */ |
c19e6535 | 254 | enum { |
df2c07f4 JP |
255 | OVS_PATCH_ATTR_UNSPEC, |
256 | OVS_PATCH_ATTR_PEER, /* name of peer vport, as a string */ | |
257 | __OVS_PATCH_ATTR_MAX | |
c19e6535 BP |
258 | }; |
259 | ||
df2c07f4 | 260 | #define OVS_PATCH_ATTR_MAX (__OVS_PATCH_ATTR_MAX - 1) |
37a1300c BP |
261 | \f |
262 | /* Flows. */ | |
263 | ||
df2c07f4 JP |
264 | #define OVS_FLOW_FAMILY "ovs_flow" |
265 | #define OVS_FLOW_MCGROUP "ovs_flow" | |
37a1300c | 266 | |
df2c07f4 JP |
267 | enum ovs_flow_cmd { |
268 | OVS_FLOW_CMD_UNSPEC, | |
269 | OVS_FLOW_CMD_NEW, | |
270 | OVS_FLOW_CMD_DEL, | |
271 | OVS_FLOW_CMD_GET, | |
272 | OVS_FLOW_CMD_SET | |
37a1300c | 273 | }; |
c19e6535 | 274 | |
df2c07f4 | 275 | struct ovs_flow_stats { |
b90fa799 BP |
276 | uint64_t n_packets; /* Number of matched packets. */ |
277 | uint64_t n_bytes; /* Number of matched bytes. */ | |
064af421 BP |
278 | }; |
279 | ||
df2c07f4 JP |
280 | enum ovs_key_type { |
281 | OVS_KEY_ATTR_UNSPEC, | |
282 | OVS_KEY_ATTR_TUN_ID, /* 64-bit tunnel ID */ | |
283 | OVS_KEY_ATTR_IN_PORT, /* 32-bit OVS dp port number */ | |
284 | OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ | |
285 | OVS_KEY_ATTR_8021Q, /* struct ovs_key_8021q */ | |
286 | OVS_KEY_ATTR_ETHERTYPE, /* 16-bit Ethernet type */ | |
287 | OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ | |
288 | OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ | |
289 | OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ | |
290 | OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ | |
291 | OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ | |
292 | OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ | |
293 | OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ | |
294 | OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ | |
295 | __OVS_KEY_ATTR_MAX | |
36956a7d BP |
296 | }; |
297 | ||
df2c07f4 | 298 | #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) |
36956a7d | 299 | |
df2c07f4 | 300 | struct ovs_key_ethernet { |
36956a7d BP |
301 | uint8_t eth_src[6]; |
302 | uint8_t eth_dst[6]; | |
303 | }; | |
304 | ||
df2c07f4 | 305 | struct ovs_key_8021q { |
36956a7d BP |
306 | ovs_be16 q_tpid; |
307 | ovs_be16 q_tci; | |
308 | }; | |
309 | ||
df2c07f4 | 310 | struct ovs_key_ipv4 { |
36956a7d BP |
311 | ovs_be32 ipv4_src; |
312 | ovs_be32 ipv4_dst; | |
313 | uint8_t ipv4_proto; | |
314 | uint8_t ipv4_tos; | |
315 | }; | |
316 | ||
df2c07f4 | 317 | struct ovs_key_ipv6 { |
d31f1109 JP |
318 | ovs_be32 ipv6_src[4]; |
319 | ovs_be32 ipv6_dst[4]; | |
320 | uint8_t ipv6_proto; | |
321 | uint8_t ipv6_tos; | |
322 | }; | |
323 | ||
df2c07f4 | 324 | struct ovs_key_tcp { |
36956a7d BP |
325 | ovs_be16 tcp_src; |
326 | ovs_be16 tcp_dst; | |
327 | }; | |
328 | ||
df2c07f4 | 329 | struct ovs_key_udp { |
36956a7d BP |
330 | ovs_be16 udp_src; |
331 | ovs_be16 udp_dst; | |
332 | }; | |
333 | ||
df2c07f4 | 334 | struct ovs_key_icmp { |
36956a7d BP |
335 | uint8_t icmp_type; |
336 | uint8_t icmp_code; | |
337 | }; | |
338 | ||
df2c07f4 | 339 | struct ovs_key_icmpv6 { |
d31f1109 JP |
340 | uint8_t icmpv6_type; |
341 | uint8_t icmpv6_code; | |
342 | }; | |
343 | ||
df2c07f4 | 344 | struct ovs_key_arp { |
36956a7d BP |
345 | ovs_be32 arp_sip; |
346 | ovs_be32 arp_tip; | |
347 | ovs_be16 arp_op; | |
bad68a99 JP |
348 | uint8_t arp_sha[6]; |
349 | uint8_t arp_tha[6]; | |
064af421 BP |
350 | }; |
351 | ||
df2c07f4 | 352 | struct ovs_key_nd { |
685a51a5 JP |
353 | uint32_t nd_target[4]; |
354 | uint8_t nd_sll[6]; | |
355 | uint8_t nd_tll[6]; | |
356 | }; | |
357 | ||
d6569377 | 358 | /** |
df2c07f4 JP |
359 | * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. |
360 | * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow | |
37a1300c BP |
361 | * key. Always present in notifications. Required for all requests (except |
362 | * dumps). | |
df2c07f4 | 363 | * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying |
67145b4d | 364 | * the actions to take for packets that match the key. Always present in |
df2c07f4 | 365 | * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional |
df2c07f4 | 366 | * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this |
37a1300c BP |
367 | * flow. Present in notifications if the stats would be nonzero. Ignored in |
368 | * requests. | |
df2c07f4 | 369 | * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the |
37a1300c BP |
370 | * TCP flags seen on packets in this flow. Only present in notifications for |
371 | * TCP flows, and only if it would be nonzero. Ignored in requests. | |
df2c07f4 | 372 | * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on |
37a1300c BP |
373 | * the system monotonic clock, at which a packet was last processed for this |
374 | * flow. Only present in notifications if a packet has been processed for this | |
375 | * flow. Ignored in requests. | |
df2c07f4 | 376 | * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the |
37a1300c BP |
377 | * last-used time, accumulated TCP flags, and statistics for this flow. |
378 | * Otherwise ignored in requests. Never present in notifications. | |
d6569377 | 379 | * |
df2c07f4 JP |
380 | * These attributes follow the &struct ovs_header within the Generic Netlink |
381 | * payload for %OVS_FLOW_* commands. | |
d6569377 | 382 | */ |
df2c07f4 JP |
383 | enum ovs_flow_attr { |
384 | OVS_FLOW_ATTR_UNSPEC, | |
385 | OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ | |
386 | OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | |
387 | OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ | |
388 | OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ | |
389 | OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ | |
390 | OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ | |
391 | __OVS_FLOW_ATTR_MAX | |
064af421 BP |
392 | }; |
393 | ||
df2c07f4 | 394 | #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) |
064af421 | 395 | |
6ff686f2 | 396 | /** |
98403001 | 397 | * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. |
6ff686f2 PS |
398 | * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with |
399 | * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of | |
400 | * %UINT32_MAX samples all packets and intermediate values sample intermediate | |
401 | * fractions of packets. | |
402 | * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. | |
403 | * Actions are passed as nested attributes. | |
98403001 BP |
404 | * |
405 | * Executes the specified actions with the given probability on a per-packet | |
406 | * basis. | |
6ff686f2 PS |
407 | */ |
408 | enum ovs_sample_attr { | |
409 | OVS_SAMPLE_ATTR_UNSPEC, | |
410 | OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ | |
411 | OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | |
412 | __OVS_SAMPLE_ATTR_MAX, | |
413 | }; | |
414 | ||
415 | #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) | |
416 | ||
98403001 BP |
417 | /** |
418 | * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. | |
419 | * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION | |
420 | * message should be sent. Required. | |
421 | * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the | |
422 | * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA, | |
423 | */ | |
424 | enum ovs_userspace_attr { | |
425 | OVS_USERSPACE_ATTR_UNSPEC, | |
426 | OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ | |
427 | OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */ | |
428 | __OVS_USERSPACE_ATTR_MAX | |
429 | }; | |
430 | ||
431 | #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) | |
432 | ||
064af421 | 433 | /* Action types. */ |
df2c07f4 JP |
434 | enum ovs_action_type { |
435 | OVS_ACTION_ATTR_UNSPEC, | |
436 | OVS_ACTION_ATTR_OUTPUT, /* Output to switch port. */ | |
98403001 | 437 | OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ |
d9065a90 PS |
438 | OVS_ACTION_ATTR_PUSH_VLAN, /* Set the 802.1q TCI value. */ |
439 | OVS_ACTION_ATTR_POP_VLAN, /* Strip the 802.1q header. */ | |
df2c07f4 JP |
440 | OVS_ACTION_ATTR_SET_DL_SRC, /* Ethernet source address. */ |
441 | OVS_ACTION_ATTR_SET_DL_DST, /* Ethernet destination address. */ | |
442 | OVS_ACTION_ATTR_SET_NW_SRC, /* IPv4 source address. */ | |
443 | OVS_ACTION_ATTR_SET_NW_DST, /* IPv4 destination address. */ | |
444 | OVS_ACTION_ATTR_SET_NW_TOS, /* IP ToS/DSCP field (6 bits). */ | |
445 | OVS_ACTION_ATTR_SET_TP_SRC, /* TCP/UDP source port. */ | |
446 | OVS_ACTION_ATTR_SET_TP_DST, /* TCP/UDP destination port. */ | |
447 | OVS_ACTION_ATTR_SET_TUNNEL, /* Set the encapsulating tunnel ID. */ | |
448 | OVS_ACTION_ATTR_SET_PRIORITY, /* Set skb->priority. */ | |
449 | OVS_ACTION_ATTR_POP_PRIORITY, /* Restore original skb->priority. */ | |
98403001 | 450 | OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ |
df2c07f4 | 451 | __OVS_ACTION_ATTR_MAX |
064af421 BP |
452 | }; |
453 | ||
df2c07f4 | 454 | #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) |
064af421 | 455 | |
b90fa799 | 456 | #endif /* openvswitch/datapath-protocol.h */ |