dpif-netlink: add GENEVE creation support
[cascardo/ovs.git] / lib / netdev-vport-private.h
1 /*
2  * Copyright (c) 2010, 2011, 2013, 2015 Nicira, Inc.
3  *
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:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef NETDEV_VPORT_PRIVATE_H
18 #define NETDEV_VPORT_PRAVITE_H 1
19
20 #include <stdbool.h>
21 #include <stddef.h>
22 #include "compiler.h"
23 #include "netdev.h"
24 #include "netdev-provider.h"
25 #include "ovs-thread.h"
26
27 struct netdev_vport {
28     struct netdev up;
29
30     /* Protects all members below. */
31     struct ovs_mutex mutex;
32
33     struct eth_addr etheraddr;
34     struct netdev_stats stats;
35
36     /* Tunnels. */
37     struct netdev_tunnel_config tnl_cfg;
38     char egress_iface[IFNAMSIZ];
39     bool carrier_status;
40
41     /* Patch Ports. */
42     char *peer;
43 };
44
45 int netdev_vport_construct(struct netdev *);
46
47 static bool
48 is_vport_class(const struct netdev_class *class)
49 {
50     return class->construct == netdev_vport_construct;
51 }
52
53 static inline struct netdev_vport *
54 netdev_vport_cast(const struct netdev *netdev)
55 {
56     ovs_assert(is_vport_class(netdev_get_class(netdev)));
57     return CONTAINER_OF(netdev, struct netdev_vport, up);
58 }
59
60 #endif