datapath: Always use generic stats for devices (vports)
[sliver-openvswitch.git] / lib / dpif-linux.h
1 /*
2  * Copyright (c) 2010, 2011 Nicira Networks.
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 DPIF_LINUX_H
18 #define DPIF_LINUX_H 1
19
20 #include <stdbool.h>
21 #include <stdint.h>
22 #include "openvswitch/datapath-protocol.h"
23
24 struct ofpbuf;
25
26 struct dpif_linux_vport {
27     /* Generic Netlink header. */
28     uint8_t cmd;
29
30     /* ovs_vport header. */
31     int dp_ifindex;
32     uint32_t port_no;                      /* UINT32_MAX if unknown. */
33     enum ovs_vport_type type;
34
35     /* Attributes. */
36     const char *name;                      /* OVS_VPORT_ATTR_NAME. */
37     const struct ovs_vport_stats *stats;   /* OVS_VPORT_ATTR_STATS. */
38     const uint8_t *address;                /* OVS_VPORT_ATTR_ADDRESS. */
39     const struct nlattr *options;          /* OVS_VPORT_ATTR_OPTIONS. */
40     size_t options_len;
41     int ifindex;                           /* OVS_VPORT_ATTR_IFINDEX. */
42 };
43
44 void dpif_linux_vport_init(struct dpif_linux_vport *);
45
46 int dpif_linux_vport_transact(const struct dpif_linux_vport *request,
47                               struct dpif_linux_vport *reply,
48                               struct ofpbuf **bufp);
49 int dpif_linux_vport_get(const char *name, struct dpif_linux_vport *reply,
50                          struct ofpbuf **bufp);
51
52 bool dpif_linux_is_internal_device(const char *name);
53
54 int dpif_linux_vport_send(int dp_ifindex, uint32_t port_no,
55                           const void *data, size_t size);
56
57 #endif /* dpif-linux.h */