]>
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 | ||
077257b8 BP |
40 | #ifndef _LINUX_OPENVSWITCH_H |
41 | #define _LINUX_OPENVSWITCH_H 1 | |
064af421 | 42 | |
064af421 | 43 | #include <linux/types.h> |
9ea0bccc | 44 | |
254f2dc8 | 45 | /* datapaths. */ |
aaff4b55 | 46 | |
df2c07f4 JP |
47 | #define OVS_DATAPATH_FAMILY "ovs_datapath" |
48 | #define OVS_DATAPATH_MCGROUP "ovs_datapath" | |
69685a88 | 49 | #define OVS_DATAPATH_VERSION 0x1 |
df2c07f4 JP |
50 | |
51 | enum ovs_datapath_cmd { | |
52 | OVS_DP_CMD_UNSPEC, | |
53 | OVS_DP_CMD_NEW, | |
54 | OVS_DP_CMD_DEL, | |
55 | OVS_DP_CMD_GET, | |
56 | OVS_DP_CMD_SET | |
aaff4b55 | 57 | }; |
064af421 | 58 | |
982b8810 | 59 | /** |
df2c07f4 | 60 | * struct ovs_header - header for OVS Generic Netlink messages. |
254f2dc8 BP |
61 | * @dp_ifindex: ifindex of local port for datapath (0 to make a request not |
62 | * specific to a datapath). | |
982b8810 | 63 | * |
df2c07f4 JP |
64 | * Attributes following the header are specific to a particular OVS Generic |
65 | * Netlink family, but all of the OVS families use this header. | |
982b8810 | 66 | */ |
df2c07f4 | 67 | struct ovs_header { |
254f2dc8 | 68 | int dp_ifindex; |
982b8810 BP |
69 | }; |
70 | \f | |
d6569377 | 71 | /** |
df2c07f4 JP |
72 | * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. |
73 | * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local | |
254f2dc8 | 74 | * port". This is the name of the network device whose dp_ifindex is given in |
df2c07f4 JP |
75 | * the &struct ovs_header. Always present in notifications. Required in |
76 | * %OVS_DP_NEW requests. May be used as an alternative to specifying | |
254f2dc8 | 77 | * dp_ifindex in other requests (with a dp_ifindex of 0). |
b063d9f0 JG |
78 | * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially |
79 | * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on | |
80 | * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should | |
81 | * not be sent. | |
df2c07f4 | 82 | * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the |
aaff4b55 | 83 | * datapath. Always present in notifications. |
d6569377 | 84 | * |
df2c07f4 JP |
85 | * These attributes follow the &struct ovs_header within the Generic Netlink |
86 | * payload for %OVS_DP_* commands. | |
d6569377 | 87 | */ |
df2c07f4 JP |
88 | enum ovs_datapath_attr { |
89 | OVS_DP_ATTR_UNSPEC, | |
90 | OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ | |
b063d9f0 | 91 | OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ |
df2c07f4 | 92 | OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ |
df2c07f4 | 93 | __OVS_DP_ATTR_MAX |
d6569377 BP |
94 | }; |
95 | ||
df2c07f4 | 96 | #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) |
d6569377 | 97 | |
df2c07f4 | 98 | struct ovs_dp_stats { |
9ea0bccc BP |
99 | __u64 n_hit; /* Number of flow table matches. */ |
100 | __u64 n_missed; /* Number of flow table misses. */ | |
101 | __u64 n_lost; /* Number of misses not sent to userspace. */ | |
102 | __u64 n_flows; /* Number of flows present */ | |
064af421 BP |
103 | }; |
104 | ||
f613a0d7 | 105 | struct ovs_vport_stats { |
9ea0bccc BP |
106 | __u64 rx_packets; /* total packets received */ |
107 | __u64 tx_packets; /* total packets transmitted */ | |
108 | __u64 rx_bytes; /* total bytes received */ | |
109 | __u64 tx_bytes; /* total bytes transmitted */ | |
110 | __u64 rx_errors; /* bad packets received */ | |
111 | __u64 tx_errors; /* packet transmit problems */ | |
112 | __u64 rx_dropped; /* no space in linux buffers */ | |
113 | __u64 tx_dropped; /* no space available in linux */ | |
f613a0d7 PS |
114 | }; |
115 | ||
064af421 | 116 | /* Logical ports. */ |
9ea0bccc | 117 | #define OVSP_LOCAL ((__u16)0) |
982b8810 | 118 | \f |
df2c07f4 | 119 | #define OVS_PACKET_FAMILY "ovs_packet" |
69685a88 | 120 | #define OVS_PACKET_VERSION 0x1 |
064af421 | 121 | |
df2c07f4 JP |
122 | enum ovs_packet_cmd { |
123 | OVS_PACKET_CMD_UNSPEC, | |
064af421 | 124 | |
982b8810 | 125 | /* Kernel-to-user notifications. */ |
df2c07f4 JP |
126 | OVS_PACKET_CMD_MISS, /* Flow table miss. */ |
127 | OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ | |
982b8810 BP |
128 | |
129 | /* User commands. */ | |
df2c07f4 | 130 | OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ |
982b8810 BP |
131 | }; |
132 | ||
133 | /** | |
df2c07f4 JP |
134 | * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. |
135 | * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire | |
982b8810 | 136 | * packet as received, from the start of the Ethernet header onward. For |
df2c07f4 JP |
137 | * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by |
138 | * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is | |
7aec165d | 139 | * the flow key extracted from the packet as originally received. |
df2c07f4 JP |
140 | * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key |
141 | * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows | |
982b8810 BP |
142 | * userspace to adapt its flow setup strategy by comparing its notion of the |
143 | * flow key against the kernel's. | |
6ff686f2 PS |
144 | * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used |
145 | * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. | |
df2c07f4 | 146 | * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION |
98403001 BP |
147 | * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an |
148 | * %OVS_USERSPACE_ATTR_USERDATA attribute. | |
982b8810 | 149 | * |
df2c07f4 JP |
150 | * These attributes follow the &struct ovs_header within the Generic Netlink |
151 | * payload for %OVS_PACKET_* commands. | |
982b8810 | 152 | */ |
df2c07f4 JP |
153 | enum ovs_packet_attr { |
154 | OVS_PACKET_ATTR_UNSPEC, | |
155 | OVS_PACKET_ATTR_PACKET, /* Packet data. */ | |
156 | OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ | |
6ff686f2 | 157 | OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ |
df2c07f4 | 158 | OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */ |
df2c07f4 | 159 | __OVS_PACKET_ATTR_MAX |
72b06300 BP |
160 | }; |
161 | ||
df2c07f4 | 162 | #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) |
982b8810 | 163 | \f |
df2c07f4 JP |
164 | enum ovs_vport_type { |
165 | OVS_VPORT_TYPE_UNSPEC, | |
166 | OVS_VPORT_TYPE_NETDEV, /* network device */ | |
167 | OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ | |
168 | OVS_VPORT_TYPE_PATCH, /* virtual tunnel connecting two vports */ | |
169 | OVS_VPORT_TYPE_GRE, /* GRE tunnel */ | |
170 | OVS_VPORT_TYPE_CAPWAP, /* CAPWAP tunnel */ | |
171 | __OVS_VPORT_TYPE_MAX | |
c283069c BP |
172 | }; |
173 | ||
df2c07f4 | 174 | #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) |
f0fef760 | 175 | \f |
df2c07f4 JP |
176 | #define OVS_VPORT_FAMILY "ovs_vport" |
177 | #define OVS_VPORT_MCGROUP "ovs_vport" | |
69685a88 | 178 | #define OVS_VPORT_VERSION 0x1 |
df2c07f4 JP |
179 | |
180 | enum ovs_vport_cmd { | |
181 | OVS_VPORT_CMD_UNSPEC, | |
182 | OVS_VPORT_CMD_NEW, | |
183 | OVS_VPORT_CMD_DEL, | |
184 | OVS_VPORT_CMD_GET, | |
185 | OVS_VPORT_CMD_SET | |
f0fef760 | 186 | }; |
c283069c | 187 | |
b0ec0f27 | 188 | /** |
df2c07f4 JP |
189 | * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. |
190 | * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. | |
191 | * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type | |
f0fef760 | 192 | * of vport. |
df2c07f4 | 193 | * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device |
f0fef760 BP |
194 | * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes |
195 | * plus a null terminator. | |
b063d9f0 JG |
196 | * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that |
197 | * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on | |
198 | * this port. A value of zero indicates that upcalls should not be sent. | |
f613a0d7 | 199 | * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for |
f0fef760 | 200 | * packets sent or received through the vport. |
df2c07f4 | 201 | * @OVS_VPORT_ATTR_ADDRESS: A 6-byte Ethernet address for the vport. |
f0fef760 | 202 | * |
df2c07f4 JP |
203 | * These attributes follow the &struct ovs_header within the Generic Netlink |
204 | * payload for %OVS_VPORT_* commands. | |
b0ec0f27 | 205 | * |
df2c07f4 JP |
206 | * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and |
207 | * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is | |
f0fef760 | 208 | * optional; if not specified a free port number is automatically selected. |
df2c07f4 | 209 | * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type |
9b020780 PS |
210 | * of vport. %OVS_VPORT_ATTR_STATS and %OVS_VPORT_ATTR_ADDRESS are optional, |
211 | * and other attributes are ignored. | |
f0fef760 | 212 | * |
df2c07f4 | 213 | * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to |
f0fef760 | 214 | * look up the vport to operate on; otherwise dp_idx from the &struct |
df2c07f4 | 215 | * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. |
b0ec0f27 | 216 | */ |
df2c07f4 JP |
217 | enum ovs_vport_attr { |
218 | OVS_VPORT_ATTR_UNSPEC, | |
219 | OVS_VPORT_ATTR_PORT_NO, /* port number within datapath */ | |
220 | OVS_VPORT_ATTR_TYPE, /* 32-bit OVS_VPORT_TYPE_* constant. */ | |
221 | OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ | |
b063d9f0 | 222 | OVS_VPORT_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ |
f613a0d7 | 223 | OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ |
df2c07f4 | 224 | OVS_VPORT_ATTR_ADDRESS, /* hardware address */ |
df2c07f4 | 225 | OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ |
df2c07f4 | 226 | __OVS_VPORT_ATTR_MAX |
064af421 BP |
227 | }; |
228 | ||
df2c07f4 | 229 | #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) |
c19e6535 | 230 | |
df2c07f4 | 231 | /* OVS_VPORT_ATTR_OPTIONS attributes for patch vports. */ |
c19e6535 | 232 | enum { |
df2c07f4 JP |
233 | OVS_PATCH_ATTR_UNSPEC, |
234 | OVS_PATCH_ATTR_PEER, /* name of peer vport, as a string */ | |
235 | __OVS_PATCH_ATTR_MAX | |
c19e6535 BP |
236 | }; |
237 | ||
df2c07f4 | 238 | #define OVS_PATCH_ATTR_MAX (__OVS_PATCH_ATTR_MAX - 1) |
37a1300c BP |
239 | \f |
240 | /* Flows. */ | |
241 | ||
df2c07f4 JP |
242 | #define OVS_FLOW_FAMILY "ovs_flow" |
243 | #define OVS_FLOW_MCGROUP "ovs_flow" | |
69685a88 | 244 | #define OVS_FLOW_VERSION 0x1 |
37a1300c | 245 | |
df2c07f4 JP |
246 | enum ovs_flow_cmd { |
247 | OVS_FLOW_CMD_UNSPEC, | |
248 | OVS_FLOW_CMD_NEW, | |
249 | OVS_FLOW_CMD_DEL, | |
250 | OVS_FLOW_CMD_GET, | |
251 | OVS_FLOW_CMD_SET | |
37a1300c | 252 | }; |
c19e6535 | 253 | |
df2c07f4 | 254 | struct ovs_flow_stats { |
9ea0bccc BP |
255 | __u64 n_packets; /* Number of matched packets. */ |
256 | __u64 n_bytes; /* Number of matched bytes. */ | |
064af421 BP |
257 | }; |
258 | ||
09ded0ad | 259 | enum ovs_key_attr { |
df2c07f4 JP |
260 | OVS_KEY_ATTR_UNSPEC, |
261 | OVS_KEY_ATTR_TUN_ID, /* 64-bit tunnel ID */ | |
262 | OVS_KEY_ATTR_IN_PORT, /* 32-bit OVS dp port number */ | |
263 | OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ | |
264 | OVS_KEY_ATTR_8021Q, /* struct ovs_key_8021q */ | |
265 | OVS_KEY_ATTR_ETHERTYPE, /* 16-bit Ethernet type */ | |
266 | OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ | |
267 | OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ | |
268 | OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ | |
269 | OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ | |
270 | OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ | |
271 | OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ | |
272 | OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ | |
273 | OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ | |
274 | __OVS_KEY_ATTR_MAX | |
36956a7d BP |
275 | }; |
276 | ||
df2c07f4 | 277 | #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) |
36956a7d | 278 | |
7257b535 BP |
279 | /** |
280 | * enum ovs_frag_type - IPv4 and IPv6 fragment type | |
281 | * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. | |
282 | * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. | |
283 | * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. | |
284 | * | |
285 | * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct | |
286 | * ovs_key_ipv6. | |
287 | */ | |
288 | enum ovs_frag_type { | |
289 | OVS_FRAG_TYPE_NONE, | |
290 | OVS_FRAG_TYPE_FIRST, | |
291 | OVS_FRAG_TYPE_LATER, | |
292 | __OVS_FRAG_TYPE_MAX | |
293 | }; | |
294 | ||
295 | #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) | |
296 | ||
df2c07f4 | 297 | struct ovs_key_ethernet { |
9ea0bccc BP |
298 | __u8 eth_src[6]; |
299 | __u8 eth_dst[6]; | |
36956a7d BP |
300 | }; |
301 | ||
df2c07f4 | 302 | struct ovs_key_8021q { |
9ea0bccc BP |
303 | __be16 q_tpid; |
304 | __be16 q_tci; | |
36956a7d BP |
305 | }; |
306 | ||
df2c07f4 | 307 | struct ovs_key_ipv4 { |
9ea0bccc BP |
308 | __be32 ipv4_src; |
309 | __be32 ipv4_dst; | |
310 | __u8 ipv4_proto; | |
311 | __u8 ipv4_tos; | |
7257b535 | 312 | __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ |
36956a7d BP |
313 | }; |
314 | ||
df2c07f4 | 315 | struct ovs_key_ipv6 { |
9ea0bccc BP |
316 | __be32 ipv6_src[4]; |
317 | __be32 ipv6_dst[4]; | |
318 | __u8 ipv6_proto; | |
319 | __u8 ipv6_tos; | |
7257b535 | 320 | __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ |
d31f1109 JP |
321 | }; |
322 | ||
df2c07f4 | 323 | struct ovs_key_tcp { |
9ea0bccc BP |
324 | __be16 tcp_src; |
325 | __be16 tcp_dst; | |
36956a7d BP |
326 | }; |
327 | ||
df2c07f4 | 328 | struct ovs_key_udp { |
9ea0bccc BP |
329 | __be16 udp_src; |
330 | __be16 udp_dst; | |
36956a7d BP |
331 | }; |
332 | ||
df2c07f4 | 333 | struct ovs_key_icmp { |
9ea0bccc BP |
334 | __u8 icmp_type; |
335 | __u8 icmp_code; | |
36956a7d BP |
336 | }; |
337 | ||
df2c07f4 | 338 | struct ovs_key_icmpv6 { |
9ea0bccc BP |
339 | __u8 icmpv6_type; |
340 | __u8 icmpv6_code; | |
d31f1109 JP |
341 | }; |
342 | ||
df2c07f4 | 343 | struct ovs_key_arp { |
9ea0bccc BP |
344 | __be32 arp_sip; |
345 | __be32 arp_tip; | |
346 | __be16 arp_op; | |
347 | __u8 arp_sha[6]; | |
348 | __u8 arp_tha[6]; | |
064af421 BP |
349 | }; |
350 | ||
df2c07f4 | 351 | struct ovs_key_nd { |
9ea0bccc BP |
352 | __u32 nd_target[4]; |
353 | __u8 nd_sll[6]; | |
354 | __u8 nd_tll[6]; | |
685a51a5 JP |
355 | }; |
356 | ||
d6569377 | 357 | /** |
df2c07f4 JP |
358 | * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. |
359 | * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow | |
37a1300c BP |
360 | * key. Always present in notifications. Required for all requests (except |
361 | * dumps). | |
df2c07f4 | 362 | * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying |
67145b4d | 363 | * the actions to take for packets that match the key. Always present in |
df2c07f4 | 364 | * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional |
df2c07f4 | 365 | * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this |
37a1300c BP |
366 | * flow. Present in notifications if the stats would be nonzero. Ignored in |
367 | * requests. | |
df2c07f4 | 368 | * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the |
37a1300c BP |
369 | * TCP flags seen on packets in this flow. Only present in notifications for |
370 | * TCP flows, and only if it would be nonzero. Ignored in requests. | |
df2c07f4 | 371 | * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on |
37a1300c BP |
372 | * the system monotonic clock, at which a packet was last processed for this |
373 | * flow. Only present in notifications if a packet has been processed for this | |
374 | * flow. Ignored in requests. | |
df2c07f4 | 375 | * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the |
37a1300c BP |
376 | * last-used time, accumulated TCP flags, and statistics for this flow. |
377 | * Otherwise ignored in requests. Never present in notifications. | |
d6569377 | 378 | * |
df2c07f4 JP |
379 | * These attributes follow the &struct ovs_header within the Generic Netlink |
380 | * payload for %OVS_FLOW_* commands. | |
d6569377 | 381 | */ |
df2c07f4 JP |
382 | enum ovs_flow_attr { |
383 | OVS_FLOW_ATTR_UNSPEC, | |
384 | OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ | |
385 | OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | |
386 | OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ | |
387 | OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ | |
388 | OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ | |
389 | OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ | |
390 | __OVS_FLOW_ATTR_MAX | |
064af421 BP |
391 | }; |
392 | ||
df2c07f4 | 393 | #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) |
064af421 | 394 | |
6ff686f2 | 395 | /** |
98403001 | 396 | * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. |
6ff686f2 PS |
397 | * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with |
398 | * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of | |
399 | * %UINT32_MAX samples all packets and intermediate values sample intermediate | |
400 | * fractions of packets. | |
401 | * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. | |
402 | * Actions are passed as nested attributes. | |
98403001 BP |
403 | * |
404 | * Executes the specified actions with the given probability on a per-packet | |
405 | * basis. | |
6ff686f2 PS |
406 | */ |
407 | enum ovs_sample_attr { | |
408 | OVS_SAMPLE_ATTR_UNSPEC, | |
409 | OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ | |
410 | OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | |
411 | __OVS_SAMPLE_ATTR_MAX, | |
412 | }; | |
413 | ||
414 | #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) | |
415 | ||
98403001 BP |
416 | /** |
417 | * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. | |
418 | * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION | |
419 | * message should be sent. Required. | |
420 | * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the | |
421 | * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA, | |
422 | */ | |
423 | enum ovs_userspace_attr { | |
424 | OVS_USERSPACE_ATTR_UNSPEC, | |
425 | OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ | |
426 | OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */ | |
427 | __OVS_USERSPACE_ATTR_MAX | |
428 | }; | |
429 | ||
430 | #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) | |
431 | ||
4edb9ae9 PS |
432 | /** |
433 | * enum ovs_action_attr - Action types. | |
434 | * | |
435 | * @OVS_ACTION_ATTR_OUTPUT: Output packet to port passed as NLA data. | |
436 | * @OVS_ACTION_ATTR_USERSPACE: Nested %OVS_USERSPACE_ATTR_ attributes specifying | |
437 | * PID. | |
438 | * @OVS_ACTION_ATTR_PUSH: Nested %OVS_KEY_ATTR_* attribute specifying header to | |
439 | * push to given packet. | |
440 | * E.g. Push vlan tag action would be NLA of %OVS_ACTION_ATTR_PUSH type with | |
441 | * nested attribute of type %OVS_KEY_ATTR_8021Q with struct ovs_key_8021q | |
442 | * as NLA data. | |
443 | * @OVS_ACTION_ATTR_POP: Pop header according to %OVS_KEY_ATTR_ sent as | |
444 | * attribute data. | |
445 | * @OVS_ACTION_ATTR_SET: Nested %OVS_KEY_ATTR_* attribute specifying the | |
446 | * field to set to given packet. | |
447 | * @OVS_ACTION_ATTR_SET_PRIORITY: A set skb->priority to 32-bit number passed | |
448 | * as NLA data. | |
449 | * @OVS_ACTION_ATTR_POP_PRIORITY: Restore skb->priority to original value. | |
450 | * @OVS_ACTION_ATTR_SAMPLE: Execute set of actions according to probability | |
451 | * %OVS_SAMPLE_ATTR_PROBABILITY. | |
452 | * | |
453 | * Only a single field can be set with a single %OVS_ACTION_ATTR_{SET,PUSH}. | |
454 | */ | |
455 | ||
09ded0ad | 456 | enum ovs_action_attr { |
df2c07f4 JP |
457 | OVS_ACTION_ATTR_UNSPEC, |
458 | OVS_ACTION_ATTR_OUTPUT, /* Output to switch port. */ | |
98403001 | 459 | OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ |
4edb9ae9 PS |
460 | OVS_ACTION_ATTR_PUSH, /* Push packet header. */ |
461 | OVS_ACTION_ATTR_POP, /* Pop packet header. */ | |
462 | OVS_ACTION_ATTR_SET, /* Set packet field(s). */ | |
df2c07f4 JP |
463 | OVS_ACTION_ATTR_SET_PRIORITY, /* Set skb->priority. */ |
464 | OVS_ACTION_ATTR_POP_PRIORITY, /* Restore original skb->priority. */ | |
98403001 | 465 | OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ |
df2c07f4 | 466 | __OVS_ACTION_ATTR_MAX |
064af421 BP |
467 | }; |
468 | ||
df2c07f4 | 469 | #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) |
064af421 | 470 | |
077257b8 | 471 | #endif /* _LINUX_OPENVSWITCH_H */ |