aboutsummaryrefslogtreecommitdiff
path: root/INSTALL.ODP.md
blob: 86cec1fb6ba54f4f6e58a0e7da29838653756081 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
                   Using Open vSwitch with ODP
                   ===========================


Open vSwitch can be used with the ODP project (http://www.opendataplane.org)
The switch will function entirely in userspace. This file serves as a guide for
building and installing Open vSwitch with ODP.

The ODP mode is considered experimental, it has not been thoroughly tested.

This version of Open vSwitch should be built manually with "configure" and
"make".


Building and Installing:
------------------------
Below are a set of steps to help you build OVS on top of ODP for linux-generic
using basic sockets. It should be possible to compile with ODP for other
platforms but it hasn't been tested yet.

ODP:
=============
Get the code:
    git clone http://git.linaro.org/git/lng/odp.git
    cd odp
    ./bootstrap.sh

it is recommended to disable building shared library because then launching
ovs with sudo becomes a real pain
    ./configure --enable-debug --enable-shared=no

to get debug symbols you can
    ./configure --enable-debug CFLAGS="-g -O0" --enable-shared=no

    make

optionally:
    make install

OVS:
=============
    ./boot.sh
    ./configure --with-odp=<ODP_DIR>

to specify a different ODP platform you can use:
    ./configure --with-odp=<ODP_DIR> --with-odp-platform=<platform>

if you installed ODP you can simply
    ./configure --with-odp=yes
    make

Refer to INSTALL.userspace for general requirements of building userspace OVS.

Alternatively go to https://wiki.linaro.org/LNG/Engineering/OVSDPDKOnUbuntu
which explains how to run OVS with DPDK. Similar steps should work with ODP.

OVS Debian package:
=============
You can pass the configure options via DATAPATH_CONFIGURE_OPTS:

DATAPATH_CONFIGURE_OPTS="--with-odp=<ODP_DIR>  --with-odp-platform=<platform>" \
fakeroot debian/rules binary

If you cross-compile, you need to specify "host" for configure,
DEB_HOST_GNU_TYPE for dh_strip, and probably a cross-compiled OpenSSL. The
latter needs to be told to configure, and dh_shlibdeps needs to find the
libraries. E.g.:

LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/arm-linux-gnueabihf/lib:<OpenSSL-DIR>' \
DEB_HOST_GNU_TYPE=arm-linux-gnueabihf \
DATAPATH_CONFIGURE_OPTS="--with-odp=<ODP_DIR>  --with-odp-platform=<platform> \
--host=arm-linux-gnueabihf --with-openssl=<OpenSSL-DIR>" fakeroot debian/rules \
binary

If you compile OpenSSL from upstream, probably you won't have the shlibs file,
you can create one in <OpenSSL-DIR>/DEBIAN/shlibs:

libcrypto 1.0.0 libcrypto1.0.0 (>= 1.0.1d)
libssl 1.0.0 libssl1.0.0 (>= 1.0.1d)

Another useful option is to set parallel compiling, and you can skip unit tests
as well if you are just experimenting with compile. See INSTALL.Debian for more:
DEB_BUILD_OPTIONS='parallel=8 nocheck' 

Using ODP with ovs-vswitchd:
----------------------------

Start ovsdb-server as discussed in INSTALL doc:
  Summary e.g.:
    First time only db creation (or clearing):
      mkdir -p /usr/local/etc/openvswitch
      mkdir -p /usr/local/var/run/openvswitch
      rm /usr/local/etc/openvswitch/conf.db
      cd $OVS_DIR
      ./ovsdb/ovsdb-tool create /usr/local/etc/openvswitch/conf.db \
        ./vswitchd/vswitch.ovsschema
    start ovsdb-server
      cd $OVS_DIR
      ./ovsdb/ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
          --remote=db:OpenOpen_vSwitch,manager_options \
          --private-key=db:Open_vSwitch,SSL,private_key \
          --certificate=dbitch,SSL,certificate \
          --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --pidfile --detach
    First time after db creation, initialize:
      cd $OVS_DIR
      ./utilities/ovs-vsctl --no-wait init

Start vswitchd:
ODP configuration arguments can be passed to vswitchd via `--odp`.
For the moment no arguments are available, but is recommended to pass --odp.

  e.g.
  export DB_SOCK=/usr/local/var/run/openvswitch/db.sock
  ./vswitchd/ovs-vswitch --odp -- unix:$DB_SOCK  --pidfile --detach

To use ovs-vswitchd with ODP, create a bridge with datapath_type
"netdev" in the configuration database.  For example:

    ovs-vsctl add-br br0
    ovs-vsctl set bridge br0 datapath_type=netdev

Now you can add ODP ports. OVS expect ODP port name to start with odp
followed by a colon and then the interface name.

    ovs-vsctl add-port br0 odp:eth0 -- set Interface odp:eth0 type=odp

Simple test
-----------
A simple test would be to add one ODP virtual port and one internal port.
To make sure that packets arrived on the the ODP virtual port don't come
through the Linux interface as well you need to remove the IP address from
the Linux interface. Also set the interface to promisc mode, in case packets
get rejected otherwise:

   ifconfig eth0 0 promisc

Bring up the bridge internal port and assign some ip (DHCP should work too
if present):

    ifconfig br0 up
    dhcp br0

Then run tests as usual, simple ping from another machine, iperf etc.
Packets should arrive at the physical interface, then at the ODP virtual
port then forwarded to the br0 internal port and then to the Linux stack.

You can also set up two ODP virtual ports and let the machine run like a
regular switch, without involving the Linux IP stack.

Testing using flows
-------------------
For testing you can setup flows from an ODP virtual port to another port,
an internal port for example. Using an internal port is preferred, because
no other packets will be involed, only what comes from the ODP port.

First run ovs-ofctl to get the port ids:
    ovs-ofctl show br0

To remove all flows:
    ovs-ofctl del-flows br0

Then add a flow to direct packets comming at the ODP port to an internal port.
    ovs-ofctl add-flow br0 in_port=1,action=output:LOCAL

Then you can use tcpdump / wireshark to sniff packets on the LOCAL port.
You might need to bring the virtual interface up:
    ifconfig br0 up

A simple test would be to use ping. In this case you should only see the
ICMP requests showing up at the LOCAL port. Also delete the flow and check that
packets are not forwarded anymore.