Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
openvswitch.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2011 Nicira Networks.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of version 2 of the GNU General Public
6  * License as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16  * 02110-1301, USA
17  */
18 
19 #ifndef _LINUX_OPENVSWITCH_H
20 #define _LINUX_OPENVSWITCH_H 1
21 
22 #include <linux/types.h>
23 
33 struct ovs_header {
35 };
36 
37 /* Datapaths. */
38 
39 #define OVS_DATAPATH_FAMILY "ovs_datapath"
40 #define OVS_DATAPATH_MCGROUP "ovs_datapath"
41 #define OVS_DATAPATH_VERSION 0x1
42 
49 };
50 
70  OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
71  OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
72  OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
74 };
75 
76 #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
77 
78 struct ovs_dp_stats {
79  __u64 n_hit; /* Number of flow table matches. */
80  __u64 n_missed; /* Number of flow table misses. */
81  __u64 n_lost; /* Number of misses not sent to userspace. */
82  __u64 n_flows; /* Number of flows present */
83 };
84 
86  __u64 rx_packets; /* total packets received */
87  __u64 tx_packets; /* total packets transmitted */
88  __u64 rx_bytes; /* total bytes received */
89  __u64 tx_bytes; /* total bytes transmitted */
90  __u64 rx_errors; /* bad packets received */
91  __u64 tx_errors; /* packet transmit problems */
92  __u64 rx_dropped; /* no space in linux buffers */
93  __u64 tx_dropped; /* no space available in linux */
94 };
95 
96 /* Fixed logical ports. */
97 #define OVSP_LOCAL ((__u16)0)
98 
99 /* Packet transfer. */
100 
101 #define OVS_PACKET_FAMILY "ovs_packet"
102 #define OVS_PACKET_VERSION 0x1
103 
106 
107  /* Kernel-to-user notifications. */
108  OVS_PACKET_CMD_MISS, /* Flow table miss. */
109  OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
110 
111  /* Userspace commands. */
112  OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
113 };
114 
137  OVS_PACKET_ATTR_PACKET, /* Packet data. */
138  OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
139  OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
140  OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */
142 };
143 
144 #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
145 
146 /* Virtual ports. */
147 
148 #define OVS_VPORT_FAMILY "ovs_vport"
149 #define OVS_VPORT_MCGROUP "ovs_vport"
150 #define OVS_VPORT_VERSION 0x1
151 
158 };
159 
162  OVS_VPORT_TYPE_NETDEV, /* network device */
163  OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
165 };
166 
167 #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
168 
200  OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
201  OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
202  OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
203  OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
204  OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */
205  OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
207 };
208 
209 #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
210 
211 /* Flows. */
212 
213 #define OVS_FLOW_FAMILY "ovs_flow"
214 #define OVS_FLOW_MCGROUP "ovs_flow"
215 #define OVS_FLOW_VERSION 0x1
216 
223 };
224 
226  __u64 n_packets; /* Number of matched packets. */
227  __u64 n_bytes; /* Number of matched bytes. */
228 };
229 
232  OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */
233  OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */
234  OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */
235  OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
236  OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */
237  OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
238  OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
239  OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
240  OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
241  OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
242  OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
243  OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
244  OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
245  OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
247 };
248 
249 #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
250 
265 };
266 
267 #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
268 
272 };
273 
274 struct ovs_key_ipv4 {
280  __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
281 };
282 
283 struct ovs_key_ipv6 {
286  __be32 ipv6_label; /* 20-bits in least-significant bits. */
290  __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
291 };
292 
293 struct ovs_key_tcp {
296 };
297 
298 struct ovs_key_udp {
301 };
302 
303 struct ovs_key_icmp {
306 };
307 
311 };
312 
313 struct ovs_key_arp {
319 };
320 
321 struct ovs_key_nd {
325 };
326 
355  OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
356  OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
357  OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
358  OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
359  OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
360  OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
362 };
363 
364 #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
365 
380  OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */
381  OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
383 };
384 
385 #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1)
386 
396  OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
397  OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */
399 };
400 
401 #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
402 
415  __be16 vlan_tpid; /* 802.1Q TPID. */
416  __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
417 };
418 
441  OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */
442  OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */
443  OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */
444  OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
445  OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
446  OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
448 };
449 
450 #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
451 
452 #endif /* _LINUX_OPENVSWITCH_H */