dpif-linux: Implement the API functions to allow multiple handler threads read upcall.
[sliver-openvswitch.git] / lib / dpif-linux.h
1 /*
2  * Copyright (c) 2010, 2011 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 DPIF_LINUX_H
18 #define DPIF_LINUX_H 1
19
20 #include <stdbool.h>
21 #include <stddef.h>
22 #include <stdint.h>
23 #include <linux/openvswitch.h>
24
25 #include "flow.h"
26
27 struct ofpbuf;
28
29 struct dpif_linux_vport {
30     /* Generic Netlink header. */
31     uint8_t cmd;
32
33     /* ovs_vport header. */
34     int dp_ifindex;
35     odp_port_t port_no;                    /* ODPP_NONE if unknown. */
36     enum ovs_vport_type type;
37
38     /* Attributes.
39      *
40      * The 'stats' member points to 64-bit data that might only be aligned on
41      * 32-bit boundaries, so use get_unaligned_u64() to access its values.
42      */
43     const char *name;                      /* OVS_VPORT_ATTR_NAME. */
44     uint32_t n_upcall_pids;
45     const uint32_t *upcall_pids;           /* OVS_VPORT_ATTR_UPCALL_PID. */
46     const struct ovs_vport_stats *stats;   /* OVS_VPORT_ATTR_STATS. */
47     const struct nlattr *options;          /* OVS_VPORT_ATTR_OPTIONS. */
48     size_t options_len;
49 };
50
51 void dpif_linux_vport_init(struct dpif_linux_vport *);
52
53 int dpif_linux_vport_transact(const struct dpif_linux_vport *request,
54                               struct dpif_linux_vport *reply,
55                               struct ofpbuf **bufp);
56 int dpif_linux_vport_get(const char *name, struct dpif_linux_vport *reply,
57                          struct ofpbuf **bufp);
58
59 bool dpif_linux_is_internal_device(const char *name);
60
61 #endif /* dpif-linux.h */