2 * Copyright (c) 2014 VMware, Inc.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __OVS_DP_INTERFACE_EXT_H_
18 #define __OVS_DP_INTERFACE_EXT_H_ 1
20 /* Windows kernel datapath extensions to the standard datapath interface. */
22 /* Version number of the datapath interface extensions. */
23 #define OVS_DATAPATH_EXT_VERSION 1
25 /* Name of the device. */
26 #define OVS_DEVICE_NAME_NT L"\\Device\\OpenvSwitchDevice"
27 #define OVS_DEVICE_NAME_DOS L"\\DosDevices\\OpenvSwitchDevice"
28 #define OVS_DEVICE_NAME_USER TEXT("\\\\.\\OpenvSwitchDevice")
30 #define OVS_IOCTL_DEVICE_TYPE 45000
32 /* We used Direct I/O (zero copy) for the buffers. */
33 #define OVS_IOCTL_START 0x100
34 #define OVS_IOCTL_READ \
35 CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x0, METHOD_OUT_DIRECT,\
37 #define OVS_IOCTL_READ_EVENT \
38 CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x1, METHOD_OUT_DIRECT, \
40 #define OVS_IOCTL_READ_PACKET \
41 CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x2, METHOD_OUT_DIRECT, \
43 #define OVS_IOCTL_WRITE \
44 CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x3, METHOD_IN_DIRECT,\
46 #define OVS_IOCTL_TRANSACT \
47 CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x4, METHOD_OUT_DIRECT,\
51 * On platforms that support netlink natively, the operating system assigns a
52 * dynamic value to a netlink family when it is registered. In the absense of
53 * such mechanism, defined hard-coded values that are known both to userspace
56 #define OVS_WIN_NL_INVALID_FAMILY_ID 0
57 #define OVS_WIN_NL_CTRL_FAMILY_ID (NLMSG_MIN_TYPE + 1)
58 #define OVS_WIN_NL_DATAPATH_FAMILY_ID (NLMSG_MIN_TYPE + 2)
59 #define OVS_WIN_NL_PACKET_FAMILY_ID (NLMSG_MIN_TYPE + 3)
60 #define OVS_WIN_NL_VPORT_FAMILY_ID (NLMSG_MIN_TYPE + 4)
61 #define OVS_WIN_NL_FLOW_FAMILY_ID (NLMSG_MIN_TYPE + 5)
62 #define OVS_WIN_NL_NETDEV_FAMILY_ID (NLMSG_MIN_TYPE + 6)
64 #define OVS_WIN_NL_INVALID_MCGRP_ID 0
65 #define OVS_WIN_NL_MCGRP_START_ID 100
66 #define OVS_WIN_NL_VPORT_MCGRP_ID (OVS_WIN_NL_MCGRP_START_ID + 1)
69 * Define a family of netlink command specific to Windows. This is part of the
72 #define OVS_WIN_CONTROL_FAMILY "ovs_win_control"
73 #define OVS_WIN_CONTROL_MCGROUP "ovs_win_control"
74 #define OVS_WIN_CONTROL_VERSION 1
76 /* Commands available under the OVS_WIN_CONTROL_FAMILY. */
77 enum ovs_win_control_cmd {
78 OVS_CTRL_CMD_WIN_GET_PID,
79 OVS_CTRL_CMD_WIN_PEND_REQ,
80 OVS_CTRL_CMD_MC_SUBSCRIBE_REQ,
82 /* This command is logically belong to the Vport family */
83 OVS_CTRL_CMD_EVENT_NOTIFY,
84 OVS_CTRL_CMD_READ_NOTIFY
87 /* NL Attributes for joining/unjoining an MC group */
88 enum ovs_nl_mcast_attr {
89 OVS_NL_ATTR_MCAST_GRP, /* (UINT32) Join an MC group */
90 OVS_NL_ATTR_MCAST_JOIN, /* (UINT8) 1/0 - Join/Unjoin */
91 __OVS_NL_ATTR_CTRL_MAX
93 #define OVS_WIN_CONTROL_ATTR_MAX (__OVS_NL_ATTR_CTRL_MAX - 1)
96 * Netdev family of commands specific to Windows.
98 #define OVS_WIN_NETDEV_FAMILY "ovs_win_netdev"
99 #define OVS_WIN_NETDEV_MCGROUP "ovs_win_netdev"
100 #define OVS_WIN_NETDEV_VERSION 1
102 enum ovs_win_netdev_cmd {
103 OVS_WIN_NETDEV_CMD_UNSPEC,
104 OVS_WIN_NETDEV_CMD_GET, /* information about the netdev. */
107 #define OVS_WIN_NETDEV_ATTR_MAX (__OVS_WIN_NETDEV_ATTR_MAX - 1)
110 * For every vport on the datapath, there is a corresponding netdev. General
111 * network device attributes of a vport that are not specific to OVS, such as
112 * MTU are represented using a netdev. For convenience, some of the vport
113 * attributes are also included as netdev attributes.
115 * enum ovs_win_netdev_attr - attributes for %OVS_WIN_NETDEV_* commands.
116 * @OVS_WIN_NETDEV_ATTR_PORT_NO: 32-bit port number of the vport within the
118 * @OVS_WIN_NETDEV_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing
120 * @OVS_WIN_NETDEV_ATTR_NAME: Name of vport. Maximum length %IFNAMSIZ-1 bytes
121 * plus a null terminator.
122 * @OVS_WIN_NETDEV_ATTR_MAC_ADDR: MAC address of the vport. %ETH_ADDR_LEN bytes
124 * @OVS_WIN_NETDEV_ATTR_MTU : 32-bit MTU of the vport.
125 * @OVS_WIN_NETDEV_ATTR_IF_FLAGS: 32-bit %OVS_WIN_NETDEV_IFF_* interface flags
128 * These attributes follow the &struct ovs_header within the Generic Netlink
129 * payload for %OVS_WIN_NETDEV_* commands.
131 * For all requests, if %OVS_WIN_NETDEV_ATTR_NAME is specified then it is used
132 * to look up the netdev to operate on; dp_idx from the &struct
133 * ovs_header is not relevant for the look up.
135 enum ovs_win_netdev_attr {
136 OVS_WIN_NETDEV_ATTR_UNSPEC,
137 OVS_WIN_NETDEV_ATTR_PORT_NO, /* u32 port number within datapath. */
138 OVS_WIN_NETDEV_ATTR_TYPE, /* u32 OVS_NETDEV_TYPE_* constant. */
139 OVS_WIN_NETDEV_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long. */
140 OVS_WIN_NETDEV_ATTR_MAC_ADDR, /* MAC address of the vport. */
141 OVS_WIN_NETDEV_ATTR_MTU, /* MTU of the vport. */
142 OVS_WIN_NETDEV_ATTR_IF_FLAGS, /* Interface flags o the vport. */
143 __OVS_WIN_NETDEV_ATTR_MAX
146 #define OVS_WIN_NETDEV_IFF_UP (1 << 0)
147 #define OVS_WIN_NETDEV_IFF_PROMISC (1 << 1)
149 #define OVS_WIN_NETDEV_ATTR_MAX (__OVS_WIN_NETDEV_ATTR_MAX - 1)
151 typedef struct ovs_dp_stats OVS_DP_STATS;
152 typedef enum ovs_vport_type OVS_VPORT_TYPE;
154 #endif /* __OVS_DP_INTERFACE_EXT_H_ */