summaryrefslogtreecommitdiff
path: root/datapath-windows/include
diff options
context:
space:
mode:
authorNithin Raju <nithin@vmware.com>2014-08-19 13:51:51 -0700
committerBen Pfaff <blp@nicira.com>2014-08-19 14:21:21 -0700
commit107331906b32c606eddd3e0fc42b42d0a3bc7372 (patch)
treebaf4034ab95d845dae22a6149c116fca1a166317 /datapath-windows/include
parentf7491dce43e51c1e9e000c16dae4f86154f28d8d (diff)
downloadopenvswitch-107331906b32c606eddd3e0fc42b42d0a3bc7372.tar.gz
Add extentions to the standard datapath interface
The datapath interface defined in odp-netlink.h needs some extensions that are platform dependent. Some examples are the name of the communication device on Windows and a set of commands that are specific to Windows. In this change we define a datapath-windows/include/OvsDpInterfaceExt.h to include any platform specific interface extensions. OvsDpInterfaceExt.h is in turn included in odp-netlink.h ONLY for _WIN32. This approach was chosen to avoid including OvsDpInterfaceExt.h directly although the latter approach is as good as the former. Also, we define three ioctls in OvsDpInterfaceExt.h: read: provides an output buffer (mimics a recv) write: provides an input buffer (mimics a send) transact: provides an input and optionally an output buffer. (mimics a send followed by recv) Signed-off-by: Nithin Raju <nithin@vmware.com> Co-Authored-by: Ben Pfaff <blp@nicira.com> Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Saurabh Shah <ssaurabh@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows/include')
-rw-r--r--datapath-windows/include/OvsDpInterfaceExt.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/datapath-windows/include/OvsDpInterfaceExt.h b/datapath-windows/include/OvsDpInterfaceExt.h
new file mode 100644
index 000000000..e79195249
--- /dev/null
+++ b/datapath-windows/include/OvsDpInterfaceExt.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __OVS_DP_INTERFACE_EXT_H_
+#define __OVS_DP_INTERFACE_EXT_H_ 1
+
+/* Windows kernel datapath extensions to the standard datapath interface. */
+
+/* Name of the device. */
+#define OVS_DEVICE_NAME_NT L"\\Device\\OpenvSwitchDevice"
+#define OVS_DEVICE_NAME_DOS L"\\DosDevices\\OpenvSwitchDevice"
+#define OVS_DEVICE_NAME_USER TEXT("\\\\.\\OpenvSwitchDevice")
+
+#define OVS_IOCTL_DEVICE_TYPE 45000
+
+/* We used Direct I/O (zero copy) for the buffers. */
+#define OVS_IOCTL_START 0x100
+#define OVS_IOCTL_READ \
+ CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x0, METHOD_OUT_DIRECT,\
+ FILE_READ_ACCESS)
+#define OVS_IOCTL_WRITE \
+ CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x1, METHOD_IN_DIRECT,\
+ FILE_READ_ACCESS)
+#define OVS_IOCTL_TRANSACT \
+ CTL_CODE (OVS_IOCTL_DEVICE_TYPE, OVS_IOCTL_START + 0x2, METHOD_OUT_DIRECT,\
+ FILE_WRITE_ACCESS)
+
+/*
+ * On platforms that support netlink natively, the operating system assigns a
+ * dynamic value to a netlink family when it is registered. In the absense of
+ * such mechanism, defined hard-coded values that are known both to userspace
+ * and kernel.
+ */
+#define OVS_WIN_NL_INVALID_FAMILY_ID 0
+#define OVS_WIN_NL_CTRL_FAMILY_ID 1
+#define OVS_WIN_NL_DATAPATH_FAMILY_ID 2
+#define OVS_WIN_NL_PACKET_FAMILY_ID 3
+#define OVS_WIN_NL_VPORT_FAMILY_ID 4
+#define OVS_WIN_NL_FLOW_FAMILY_ID 5
+
+/*
+ * Define a family of netlink command specific to Windows. This is part of the
+ * extensions.
+ */
+#define OVS_WIN_CONTROL_FAMILY "ovs_win_control"
+#define OVS_WIN_CONTROL_MCGROUP "ovs_win_control"
+#define OVS_WIN_CONTROL_VERSION 1
+#define OVS_WIN_CONTROL_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
+
+/* Commands available under the OVS_WIN_CONTROL_FAMILY. */
+enum ovs_win_control_cmd {
+ OVS_CTRL_CMD_WIN_GET_PID,
+};
+
+#endif /* __OVS_DP_INTERFACE_EXT_H_ */