Global replace of Nicira Networks.
[sliver-openvswitch.git] / include / openvswitch / tunnel.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
3  *
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.
10  *
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  * ----------------------------------------------------------------------
38  */
39
40 #ifndef OPENVSWITCH_TUNNEL_H
41 #define OPENVSWITCH_TUNNEL_H 1
42
43 #include <linux/types.h>
44 #include <linux/openvswitch.h>
45
46 /* OVS_VPORT_ATTR_OPTIONS attributes for tunnels.
47  *
48  * OVS_TUNNEL_ATTR_FLAGS and OVS_TUNNEL_ATTR_DST_IPV4 are required.  All other
49  * attributes are optional.
50  */
51 enum {
52         OVS_TUNNEL_ATTR_UNSPEC,
53         OVS_TUNNEL_ATTR_FLAGS,    /* 32-bit TNL_F_*. */
54         OVS_TUNNEL_ATTR_DST_IPV4, /* IPv4 destination address. */
55         OVS_TUNNEL_ATTR_SRC_IPV4, /* IPv4 source address. */
56         OVS_TUNNEL_ATTR_OUT_KEY,  /* __be64 key to use on output. */
57         OVS_TUNNEL_ATTR_IN_KEY,   /* __be64 key to match on input. */
58         OVS_TUNNEL_ATTR_TOS,      /* 8-bit TOS value. */
59         OVS_TUNNEL_ATTR_TTL,      /* 8-bit TTL value. */
60         __OVS_TUNNEL_ATTR_MAX
61 };
62
63 #define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1)
64
65 #define TNL_F_CSUM              (1 << 0) /* Checksum packets. */
66 #define TNL_F_TOS_INHERIT       (1 << 1) /* Inherit ToS from inner packet. */
67 #define TNL_F_TTL_INHERIT       (1 << 2) /* Inherit TTL from inner packet. */
68 #define TNL_F_DF_INHERIT        (1 << 3) /* Inherit DF bit from inner packet. */
69 #define TNL_F_DF_DEFAULT        (1 << 4) /* Set DF bit if inherit off or
70                                           * not IP. */
71 #define TNL_F_PMTUD             (1 << 5) /* Enable path MTU discovery. */
72 #define TNL_F_HDR_CACHE         (1 << 6) /* Enable tunnel header caching. */
73 #define TNL_F_IPSEC             (1 << 7) /* Traffic is IPsec encrypted. */
74
75 #endif /* openvswitch/tunnel.h */