1 .\" Copyright (c) 2012-2013 Luigi Rizzo, Universita` di Pisa
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" This document is derived in part from the enet man page (enet.4)
26 .\" distributed with 4.3BSD Unix.
28 .\" $FreeBSD: head/share/man/man4/vale.4 228017 2011-11-27 06:55:57Z gjb $
35 .Nd a very fast Virtual Local Ethernet using the netmap API
42 module that implements multiple Virtual switches that can
43 be used to interconnect netmap clients, including traffic
44 sources and sinks, packet forwarders, userspace firewalls,
48 is implemented completely in software, and is extremely fast.
49 On a modern machine it can move almost 20 Million packets per
50 second (Mpps) per core with small frames, and about 70 Gbit/s
51 with 1500 byte frames.
55 dynamically creates switches and ports as client connect
65 is the prefix indicating a VALE switch rather than a standard interface,
67 indicates a specific switch (the colon is a separator),
70 indicates a port within the switch.
71 Bridge and ports names are arbitrary strings, the only
72 constraint being that the full name must fit within 16
76 ports can be physical network interfaces that support
79 by specifying the interface name for
85 for details of the naming rule.
87 Physical interfaces are attached using
97 The corresponding host stack can also be attached to the bridge, specifying
101 To detach the interface from the bridge,
102 .Pa NETMAP_BDG_DETACH
103 is used instead of NETMAP_BDG_ATTACH.
104 The host stack is also detached from the bridge at the same
105 time if it has been attached.
107 Physical interfaces are treated as system configuration;
108 they are kept being attached even after the configuring process dies,
109 and detached by any process.
111 Once a physical interface is attached, this interface is no longer
112 available to be directly accessed by netmap clients (user processes) or to be
113 attached by another bridge.
114 On the other hand, when any netmap client holds the physical interface,
115 this interface cannot be attached to a bridge.
118 subcommand in nr_cmd of
120 is used to obtain bridge and port
121 information. There are two modes of how it works;
124 starting from non '\\0' is provided,
127 indicates the position of
129 This position is represented by an index of the bridge and the port, and
134 fields, respectively. If the named interface does not exist,
141 starting from '\\0' is provided,
143 returning indicates the
144 first existing interface on and after the position specified in
148 If the caller specified a port index greater than the highest
149 index of the ports, it is recognized as port index 0 of the
159 if the given position is higher than that of
160 any existing interface.
161 On successful return of
163 the interface name is also stored in
171 Below is an example of printing all the existing ports walking through
174 .Bd -literal -compact
176 int fd = open("/dev/netmap", O_RDWR);
178 bzero(&nmr, sizeof(nmr));
179 nmr.nr_version = NETMAP_API;
180 nmr.nr_cmd = NETMAP_BDG_LIST;
181 nmr.nr_arg1 = nmr.nr_arg2 = 0; /* start from bridge:0 port:0 */
182 for (; !ioctl(fd, NIOCGINFO, &nmr); nmr.nr_arg2++) {
183 D("bridge:%d port:%d %s", nmr.nr_arg1, nmr.nr_arg2,
185 nmr.nr_name[0] = '\\0';
191 for details on the API.
194 currently supports up to 8 switches, 254 ports per switch,
195 1024 buffers per port. These hard limits will be
196 changed to sysctl variables in future releases.
198 Attaching the host stack to the bridge imposes significant performance
199 degradation when many packets are forwarded to the host stack by either
200 unicast or broadcast.
201 This is because every single packet going to the host stack causes mbuf
202 allocation in the same thread context as one forwarding packets.
206 uses the following sysctl variables to control operation:
208 .It dev.netmap.bridge
209 The maximum number of packets processed internally
211 Defaults to 1024, use lower values to trade latency
214 .It dev.netmap.verbose
215 Set to non-zero values to enable in-kernel diagnostics.
219 Create one switch, with a traffic generator connected to one
220 port, and a netmap-enabled tcpdump instance on another port:
221 .Bd -literal -offset indent
222 tcpdump -ni vale-a:1 &
223 pkt-gen -i vale-a:0 -f tx &
227 each connected to two qemu machines on different ports.
228 .Bd -literal -offset indent
229 qemu -net nic -net netmap,ifname=vale-1:a ... &
230 qemu -net nic -net netmap,ifname=vale-1:b ... &
231 qemu -net nic -net netmap,ifname=vale-2:c ... &
232 qemu -net nic -net netmap,ifname=vale-2:d ... &
237 .Xr http://info.iet.unipi.it/~luigi/vale/
239 Luigi Rizzo, Giuseppe Lettieri: VALE, a switched ethernet for virtual machines,
240 June 2012, http://info.iet.unipi.it/~luigi/vale/
245 switch has been designed and implemented in 2012 by
248 .An Giuseppe Lettieri
249 at the Universita` di Pisa.
252 has been funded by the European Commission within FP7 Projects
253 CHANGE (257422) and OPENLAB (287581).