1 How to Build the Kernel module & userspace daemons for Windows
2 ==============================================================
4 Autoconf, Automake and Visual C++:
5 ---------------------------------
6 Open vSwitch on Linux uses autoconf and automake for generating Makefiles.
7 It will be useful to maintain the same build system while compiling on Windows
8 too. One approach is to compile Open vSwitch in a MinGW environment that
9 contains autoconf and automake utilities and then use Visual C++ as a compiler
12 The following explains the steps in some detail.
14 * Install Mingw on a Windows machine by following the instructions at:
15 http://www.mingw.org/wiki/Getting_Started
17 This should install mingw at C:\Mingw and msys at C:\Mingw\msys.
18 Add "C:\MinGW\bin" and "C:\Mingw\msys\1.0\bin" to PATH environment variable
21 You can either use the MinGW installer or the command line utility 'mingw-get'
22 to install both the base packages and additional packages like automake and
23 autoconf(version 2.68).
25 Also make sure that /mingw mount point exists. If its not, please add/create
26 the following entry in /etc/fstab - 'C:/MinGW /mingw'.
28 * Install the latest Python 2.x from python.org and verify that its path is
29 part of Windows' PATH environment variable.
31 * You will need at least Visual Studio 2013 to compile userspace binaries. In
32 addition to that, if you want to compile the kernel module you will also need to
33 install Windows Driver Kit (WDK) 8.1 Update.
35 It is important to get the Visual Studio related environment variables and to
36 have the $PATH inside the bash to point to the proper compiler and linker. One
37 easy way to achieve this is to get into the "Developer Command prompt for visual
38 studio" and through it enter into the bash shell available from msys.
40 If after the above step, a 'which link' inside MSYS's bash says,
41 "/bin/link.exe", rename /bin/link.exe to something else so that the
42 Visual studio's linker is used.
44 * For pthread support, install the library, dll and includes of pthreads-win32
46 ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release to a
47 directory (e.g.: C:/pthread).
49 * Get the Open vSwitch sources from either cloning the repo using git
50 or from a distribution tar ball.
52 * If you pulled the sources directly from an Open vSwitch Git tree,
53 run boot.sh in the top source directory:
57 * In the top source directory, configure the package by running the
58 configure script. You should provide some configure options to choose
59 the right compiler, linker, libraries, Open vSwitch component installation
60 directories, etc. For example,
62 % ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32" \
63 --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
64 --sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread"
66 By default, the above enables compiler optimization for fast code.
67 For default compiler optimization, pass the "--with-debug" configure
70 * Run make for the ported executables in the top source directory, e.g.:
74 * To run all the unit tests:
78 OpenSSL, Open vSwitch and Visual C++
79 ------------------------------------
80 To get SSL support for Open vSwitch on Windows, do the following:
82 * Install OpenSSL for Windows as suggested at
83 http://www.openssl.org/related/binaries.html.
84 The link as of this writing suggests to download it from
85 http://slproweb.com/products/Win32OpenSSL.html
87 Note down the directory where OpenSSL is installed (e.g.: C:/OpenSSL-Win32).
89 * While configuring the package, specify the OpenSSL directory path.
92 % ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32" \
93 --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
94 --sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread" \
95 --enable-ssl --with-openssl="C:/OpenSSL-Win32"
97 * Run make for the ported executables.
99 Building the Kernel datapath module
100 -----------------------------------
101 * We directly use the Visual Studio 2013 IDE to compile the kernel datapath.
102 You can open the extensions.sln file in the IDE and build the solution.
104 * The kernel datapath can be compiled from command line as well. The top
105 level 'make' will invoke building the kernel datapath, if the
106 '--with-vstudioddk' argument is specified while configuring the package.
109 % ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32" \
110 --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
111 --sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread" \
112 --enable-ssl --with-openssl="C:/OpenSSL-Win32" \
113 --with-vstudioddk="<WDK to use>"
115 Possible values for "<WDK to use>" are:
116 "Win8.1 Debug", "Win8.1 Release", "Win8 Debug" and "Win8 Release".
118 Installing the Kernel module
119 ----------------------------
120 Once you have built the solution, you can copy the following files to the
121 target Hyper-V machines.
123 ./datapath-windows/x64/Win8.1Debug/package/ovsext.inf
124 ./datapath-windows/x64/Win8.1Debug/package/OVSExt.sys
125 ./datapath-windows/x64/Win8.1Debug/package/ovsext.cat
126 ./datapath-windows/misc/install.cmd
127 ./datapath-windows/misc/uninstall.cmd
129 The above path assumes that the kernel module has been built using Windows
130 DDK 8.1 in Debug mode. Change the path appropriately, if a different WDK
133 Steps to install the module
134 ---------------------------
136 01> Run ./uninstall.cmd to remove the old extension.
137 02> Run ./install.cmd to insert the new one. For this to work you will have to
138 turn on TESTSIGNING boot option or 'Disable Driver Signature Enforcement'
140 03> In the Virtual Switch Manager configuration you should now see "VMWare OVS
141 Extension" under 'Virtual Switch Extensions'. Click the check box to enable the
144 Steps to run the user processes & configure VXLAN ports
145 -------------------------------------------------------
147 01> Create the conf db file.
148 ovsdb\ovsdb-tool.exe create conf.db .\vswitchd\vswitch.ovsschema
151 ovsdb\ovsdb-server.exe -v --remote=ptcp:6632:127.0.0.1 conf.db
153 03> Create integration bridge & pif bridge
154 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-br br-int
155 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-br br-pif
158 utilities\ovs-dpctl.exe show
160 * Sample output shows up like this. Currently it is not possible to figure out
161 * the mapping between VIF and VM from the output.
163 $ utilities\ovs-dpctl.exe show
164 2014-06-27T01:55:32Z|00001|socket_util|ERR|4789:0.0.0.0:
165 socket: Either the application has not called WSAStartup, or WSAStartup failed.
166 <<< Ignore this error, it is harmless.
168 lookups: hit:0 missed:0 lost:0
170 masks: hit:0 total:0 hit/pkt:0.00
171 port 16777216: internal <<< VTEP created by AllowManagementOS
173 port 16777225: external.1 <<< Physical NIC
174 port 16777288: vmNICEmu.1000048 <<< VIF #1
175 port 16777289: vmNICSyn.1000049 <<< VIF #2
178 05> Add the physical NIC and the internal port to br-pif
179 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-port br-pif <port name>
182 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-port br-pif external.1
183 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-port br-pif internal
185 06> Add the VIFs to br-int
186 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-port br-int <port name>
189 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-port br-int vmNICEmu.1000048
190 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-port br-int vmNICSyn.1000049
192 07> Verify the status
193 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 show
196 $ utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 show
197 4cd86499-74df-48bd-a64d-8d115b12a9f2
202 Interface "external.1"
210 Port "vmNICEmu.1000048"
211 Interface "vmNICEmu.1000048"
212 Port "vmNICSyn.1000049"
213 Interface "vmNICSyn.1000049"
217 vswitchd\ovs-vswitchd.exe -v tcp:127.0.0.1:6632
219 10> You can figure out the port name to MAC address mapping now. (optional)
220 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 list interface
222 //********** VXLAN PORT CONFIGURATION (Supports Multiple ports) ************//
223 (Remove all patch ports added to create VLAN networks.)
224 11> Add the vxlan port between 172.168.201.101 <-> 172.168.201.102
225 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-port br-int vxlan-1
226 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-1 type=vxlan
227 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-1 options:local_ip=172.168.201.101
228 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-1 options:remote_ip=172.168.201.102
229 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-1 options:in_key=flow
230 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-1 options:out_key=flow
232 12> Add the vxlan port between 172.168.201.101 <-> 172.168.201.105
233 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 add-port br-int vxlan-2
234 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-2 type=vxlan
235 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-2 options:local_ip=172.168.201.102
236 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-2 options:remote_ip=172.168.201.105
237 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-2 options:in_key=flow
238 utilities\ovs-vsctl.exe --db=tcp:127.0.0.1:6632 set Interface vxlan-2 options:out_key=flow
241 //********** VLAN CONFIGURATION (Using patch ports) ************//
242 (Remove all VXLAN ports from the configuration.)
243 13> Add a patch port from br-int to br-pif
244 utilities/ovs-vsctl.exe -- add-port br-int patch-to-pif
245 utilities/ovs-vsctl.exe -- set interface patch-to-pif type=patch options:peer=patch-to-int
247 14> Add a patch port from br-pif to br-int
248 utilities/ovs-vsctl.exe -- add-port br-pif patch-to-int
249 utilities/ovs-vsctl.exe -- set interface patch-to-int type=patch options:peer=patch-to-pif
251 15> Re-Add the VIF ports with the VLAN tag
252 utilities\ovs-vsctl.exe add-port br-int vmNICEmu.1000048 tag=900
253 utilities\ovs-vsctl.exe add-port br-int vmNICSyn.1000049 tag=900
259 * We require that you don't disable the "Allow management operating system to
260 share this network adapter" under 'Virtual Switch Properties' > 'Connection
261 type: External network', in the HyperV virtual network switch configuration.
264 While there is some support for checksum/segmentation offloads in software,
265 this is still a work in progress. Till the support is complete we recommend
266 disabling TX/RX offloads for both the VM's as well as the HyperV.
268 Windows autobuild service
269 -------------------------
271 AppVeyor (appveyor.com) provides a free Windows autobuild service for
272 opensource projects. Open vSwitch has integration with AppVeyor for
273 continuous build. A developer can build test his changes for Windows by
274 logging into appveyor.com using a github account, creating a new project
275 by linking it to his development repository in github and triggering
281 * Investigate the working of sFlow on Windows and re-enable the unit tests.
283 * Investigate and add the feature to provide QOS.
285 * Sign the driver & create an MSI for installing the different OpenvSwitch
286 components on windows.