sliver-openvswitch.git
11 years agomove Makefile in planetlab/exp-tool sliver-openvswitch-0.1-1
Thierry Parmentelat [Thu, 5 Jul 2012 23:46:49 +0000 (01:46 +0200)]
move Makefile in planetlab/exp-tool
this is intended to run on the experimenter's box

11 years agoturn off debugging - works now
Thierry Parmentelat [Thu, 5 Jul 2012 23:43:07 +0000 (01:43 +0200)]
turn off debugging - works now

11 years agodont package Makefile in the sliver
Thierry Parmentelat [Thu, 5 Jul 2012 23:42:46 +0000 (01:42 +0200)]
dont package Makefile in the sliver

11 years agotry to trim package of debugging stuff
Thierry Parmentelat [Tue, 3 Jul 2012 22:06:40 +0000 (00:06 +0200)]
try to trim package of debugging stuff

11 years agofirst draft for packaging openvswitch
Thierry Parmentelat [Tue, 3 Jul 2012 15:31:39 +0000 (17:31 +0200)]
first draft for packaging openvswitch

11 years agoimproved planetlab scripts
Giuseppe Lettieri [Tue, 26 Jun 2012 11:25:45 +0000 (13:25 +0200)]
improved planetlab scripts

11 years agoremoved warnings
Giuseppe Lettieri [Thu, 21 Jun 2012 12:35:02 +0000 (14:35 +0200)]
removed warnings

11 years agoupdate rx/tx stats
Giuseppe Lettieri [Thu, 21 Jun 2012 12:17:15 +0000 (14:17 +0200)]
update rx/tx stats

11 years agobetter change_seq
Giuseppe Lettieri [Thu, 21 Jun 2012 12:06:53 +0000 (14:06 +0200)]
better change_seq

11 years agoremoved useless mtu and carrier
Giuseppe Lettieri [Thu, 21 Jun 2012 10:58:59 +0000 (12:58 +0200)]
removed useless mtu and carrier

11 years agofix: several error handling issues in send/recv
Giuseppe Lettieri [Thu, 21 Jun 2012 10:50:09 +0000 (12:50 +0200)]
fix: several error handling issues in send/recv

- confusingly, send has to return positive error values
  on errori (netdev-linux's send seems to be confused as well)
- added rate limit for warnings
- fixed wrong paramether order in warn messages
- added check for EMSGSIZE error in send

11 years agoadded drain method to netdev-tunnel's
Giuseppe Lettieri [Thu, 21 Jun 2012 10:35:44 +0000 (12:35 +0200)]
added drain method to netdev-tunnel's

11 years agonetdev-tunnel's are now always listening
Giuseppe Lettieri [Thu, 21 Jun 2012 10:16:19 +0000 (12:16 +0200)]
netdev-tunnel's are now always listening

11 years agobetter set_config for netdev-tunnel's
Giuseppe Lettieri [Thu, 21 Jun 2012 10:12:42 +0000 (12:12 +0200)]
better set_config for netdev-tunnel's

11 years agoprovide get_config for netdev-tunnel's
Giuseppe Lettieri [Thu, 21 Jun 2012 09:59:50 +0000 (11:59 +0200)]
provide get_config for netdev-tunnel's

11 years agobug fix (wrong paramether id)
Giuseppe Lettieri [Tue, 12 Jun 2012 15:41:13 +0000 (17:41 +0200)]
bug fix (wrong paramether id)

11 years agoplanetlab scripts and utilities
Giuseppe Lettieri [Tue, 15 May 2012 13:31:22 +0000 (15:31 +0200)]
planetlab scripts and utilities

11 years agoproper destruction of netdev datapaths
Giuseppe Lettieri [Wed, 9 May 2012 10:17:15 +0000 (12:17 +0200)]
proper destruction of netdev datapaths

Bridges with datapath_type=netdev do not destroy the datapath when
deleted. In particular, the tap device implementing the internal
interface is not close()d, and therefore the tap persists until
ovs-vswitchd exit()s.

This behaviour appears to be caused by the missing callback
for 'enumerate' in the dpif-netdev class. Without this callback
'bridge_reconfigure' fails to realize that there are datapaths with no
bridge, and thus cannot destroy them. Providing an 'enumerate' callback
fixes this.

11 years agotap_pl: proper destruction of tap_pl
Giuseppe Lettieri [Mon, 7 May 2012 15:53:52 +0000 (17:53 +0200)]
tap_pl: proper destruction of tap_pl

11 years agotap_pl: fix typo
Giuseppe Lettieri [Mon, 7 May 2012 15:21:13 +0000 (17:21 +0200)]
tap_pl: fix typo

11 years agotap_pl: allocation of a tap using vsys
Giuseppe Lettieri [Mon, 7 May 2012 14:26:40 +0000 (16:26 +0200)]
tap_pl: allocation of a tap using vsys

Planetlab tap interfaces are allocated by a vsys script (fd_tuntap).  The
script chooses the name of the interface and sends the corresponding fd
to user context through a Unix domain socket. The allocated tap interface
is not persistent. Moreover, the tap interface is not visibile in user
context until an IP address is assigned to it (by using vsys/vif_up).

The create_bridge script first creates a Planetlab tap with an IP
address, then creates a bridge with the same name of the tap.

12 years agotap_pl: fixed behaviour in send
Giuseppe Lettieri [Tue, 1 May 2012 10:25:59 +0000 (10:25 +0000)]
tap_pl: fixed behaviour in send

Open vSwitch checks for type "tap" sometimes by string comparison of
the class name and sometimes by equality of class pointers.
I missed one of the latter.

12 years agotap_pl: added stub for update_flags
Giuseppe Lettieri [Tue, 1 May 2012 10:19:03 +0000 (10:19 +0000)]
tap_pl: added stub for update_flags

PlanetLab prohibit modification of flags (UP, PROMISC, ...) on tap
devices and Open vSwitch is not very happy with this. Added a stub
for now.

12 years agotap_pl: fixed spurious send
Giuseppe Lettieri [Tue, 1 May 2012 09:58:25 +0000 (09:58 +0000)]
tap_pl: fixed spurious send

12 years agotap_pl: fixed wrong class type in creation
Giuseppe Lettieri [Tue, 1 May 2012 09:49:35 +0000 (09:49 +0000)]
tap_pl: fixed wrong class type in creation

12 years agonetdev-tunnel: put remote_port into the DB
Giuseppe Lettieri [Tue, 1 May 2012 06:40:33 +0000 (08:40 +0200)]
netdev-tunnel: put remote_port into the DB

We put the remote_port for each tunnel into the DB, so that it shows in
the output of 'ovs-vsctl show' and persists across local restarts.
Accordingly, a tunnel is now created thusly (we show only one side):

ovs-vsctl add-port br0 tun0 -- set interface tun0 type=tunnel
ovs-appctl netdev-tunnel/get-port tun0

Then, when the remote port is known:

ovs-vsctl set interface tun0 options:remote_ip=... \
options:remote_port=...

(The remote_ip and the remote_port can also be set independently)

12 years agosupport for tap interfaces on PlanetLab
Giuseppe Lettieri [Mon, 30 Apr 2012 18:43:23 +0000 (20:43 +0200)]
support for tap interfaces on PlanetLab

 - Add new interface type "tap_pl", which is created using PlanetLab
   VSYS and is otherwise (almost) equivalent to "tap".
 - Add new datatype_path "planetlab", which uses "tap_pl" for the
   internal interface and is otherwise equivalent to "netdev".

12 years agoallow easier addition of planetlab datapath_type
Giuseppe Lettieri [Sun, 29 Apr 2012 14:16:57 +0000 (16:16 +0200)]
allow easier addition of planetlab datapath_type

A bit of refactoring so that we can then add the new "planetlab"
datapath_type, which will differ from the "netdev" datapath_type only in
the type of the "internal" port of the bridge.

12 years agoHonor Unix rule of silence
Giuseppe Lettieri [Sun, 29 Apr 2012 13:08:33 +0000 (15:08 +0200)]
Honor Unix rule of silence

12 years agoSimple minded ethernet-over-UDP tunnels
Giuseppe Lettieri [Sun, 29 Apr 2012 12:59:17 +0000 (14:59 +0200)]
Simple minded ethernet-over-UDP tunnels

We provide very simple point-to-point UDP tunnels which openvswitch can
use as network interfaces. The implementation uses a pair of connected
UDP sockets for each tunnel. Each ethernet frame is sent as a single
UDP datagram.

Example usage:
The following commands create a tunnel between hosts 10.0.0.1 and
10.0.0.2 (port and bridge names are arbitrary).

 - On host 10.0.0.1:
ovs-vsctl add-br br0
ovs-vsctl add-port br0 tun0 -- set interface tun0 type=tunnel \
options:remote_ip=10.0.0.2
ovs-appctl netdev-tunnel/get-lport tun0
<(1) the command replies with the local port number>

 - On host 10.0.0.2:
ovs-vsctl add-br br1
ovs-vsctl add-port br0 tun0 -- set interface tun1 type=tunnel \
options:remote_ip=10.0.0.1
ovs-appctl netdev-tunnel/get-lport tun0
<(2) the command replies with the local port number>
ovs-appctl netdev-tunnel/set-rport tun0 <the port obtained in (1)>

 - Back on host 10.0.0.1:
ovs-appctl netdev-tunnel/set-rport tun0 <the port obtained in (2)>

12 years agoxenserver: Update Open vSwitch post upgrade instructions.
Gurucharan Shetty [Thu, 26 Apr 2012 17:57:47 +0000 (10:57 -0700)]
xenserver: Update Open vSwitch post upgrade instructions.

Currently, when we upgrade the userspace rpm for XenServer,
we print a message asking users to reboot the hypervisor.
This is not needed. The reboot of hypervisor is needed when
we upgrade the rpm containing the kernel module.  This
reboot can sometimes be avoided by running a
"service openvswitch force-reload-kmod".

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agometa-flow: Correctly set destination MAC in mf_set_flow_value().
Ben Pfaff [Fri, 27 Apr 2012 15:45:10 +0000 (08:45 -0700)]
meta-flow: Correctly set destination MAC in mf_set_flow_value().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agorconn: Simplify rconn_send() semantics.
Ethan Jackson [Thu, 26 Apr 2012 04:12:18 +0000 (21:12 -0700)]
rconn: Simplify rconn_send() semantics.

Before this patch, rconn_send() would delete 'b' on success, and
not on error.  This is confusing and error-prone.  This patch
causes rconn_send() to always delete 'b'.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agonicira-ext: Support masking of nd_target field
Ansis Atteka [Wed, 25 Apr 2012 22:48:40 +0000 (15:48 -0700)]
nicira-ext: Support masking of nd_target field

This commit adds support to specify a mask in CIDR format for
the nd_target field.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
12 years agocoverage: Make ovs-appctl command more useful and less alarming.
Ben Pfaff [Fri, 20 Apr 2012 21:09:30 +0000 (14:09 -0700)]
coverage: Make ovs-appctl command more useful and less alarming.

I've had a few complaints that ovs-vswitchd logs its coverage counters
at WARN level, but this is mainly wrong: ovs-vswitchd only logs coverage
counters at WARN level when the "coverage/log" command is used through
ovs-appctl.  This was even documented.

The reason to log at such a high level was to make it fairly certain that
these messages specifically requested by the admin would not be filtered
out before making it to the log.  But it's even better if the admin just
gets the coverage counters as a reply to the ovs-appctl command.  So that
is what this commit does.

This commit also improves the documentation of the ovs-appctl command.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agocoverage: Rate-limit logging coverage information.
Ben Pfaff [Fri, 20 Apr 2012 20:51:13 +0000 (13:51 -0700)]
coverage: Rate-limit logging coverage information.

I'd always assumed that the exponentially weighted moving average code in
timeval was enough rate-limiting, but I actually encountered a pathological
case some time ago that forced this coverage information to print once a
second or so, which seems too often.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotimeval: Rate-limit logging rusage information.
Ben Pfaff [Fri, 20 Apr 2012 20:43:54 +0000 (13:43 -0700)]
timeval: Rate-limit logging rusage information.

I'd always assumed that the exponentially weighted moving average code
here was sufficient rate-limiting, but I actually encountered a
pathological case some time ago that forced this rusage information to
print once a second or so, which seems too often.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agocfm: Log fault status changes more informatively.
Ben Pfaff [Fri, 20 Apr 2012 21:52:16 +0000 (14:52 -0700)]
cfm: Log fault status changes more informatively.

Until now, fault status changes just log the new status.  This means that
the administrator has to find two consecutive status change messages to
see what actually changed.

This commit changes the log message format to prefix new faults with '+'
and faults that disappeared with '-'.  Existing faults that are still
present are not prefixed.

This also simplifies the code a little by making ds_put_cfm_fault()
put spaces before fault names instead of after.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agojson: Correct position tracking in JSON parser implementations.
Ben Pfaff [Thu, 26 Apr 2012 16:48:28 +0000 (09:48 -0700)]
json: Correct position tracking in JSON parser implementations.

When json_lex_input() returns false, the parser does not consume the byte
passed in.  That byte will get processed again in the next iteration of
the json_parser_feed() loop.  Therefore, until now, this code has
double-counted bytes that cause a false return from json_lex_input().

This fixes the problem.  Every input byte is now counted only once.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agojsonrpc: Keep jsonrpc_recv() from taking over the CPU.
Ben Pfaff [Tue, 24 Apr 2012 17:57:41 +0000 (10:57 -0700)]
jsonrpc: Keep jsonrpc_recv() from taking over the CPU.

jsonrpc_recv() could take an unbounded amount of CPU time as long as data
kept arriving, preventing other work from taking place.  This limits the
amount of work to processing at most 25 kB of received data and then
yielding to the caller.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoFix memory leaks.
Ben Pfaff [Mon, 23 Apr 2012 20:22:10 +0000 (13:22 -0700)]
Fix memory leaks.

Found by valgrind.

Reported-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAdd OXM data to mf_fields
Simon Horman [Wed, 25 Apr 2012 01:18:30 +0000 (10:18 +0900)]
Add OXM data to mf_fields

Add oxm_name and oxm_header elements to struct mf_field
and populate those entries for fields that are present
in both NXM and the OXM basic class.

This implementation was suggested by Ben Pfaff.

This does not address any possible differences in the NXM and
OXM basic class fields, for instance different maskability.
That may be addressed later as needed.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAdd OXM_OF_* definitions
Simon Horman [Wed, 25 Apr 2012 01:18:29 +0000 (10:18 +0900)]
Add OXM_OF_* definitions

These oxm_type definitions values will may be used
when parsing serialising OXM TLVs.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoCorrect OFPXMC12_{OPENFLOW_BASIC,EXPERIMENTER} definitions
Simon Horman [Wed, 25 Apr 2012 01:18:28 +0000 (10:18 +0900)]
Correct OFPXMC12_{OPENFLOW_BASIC,EXPERIMENTER} definitions

This corrects errors that appear to have been included
by me in the original version.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Clean up iface_create().
Ben Pfaff [Tue, 24 Apr 2012 23:53:01 +0000 (16:53 -0700)]
vswitchd: Clean up iface_create().

iface_create() did its work in an order that meant it had to do a lot more
cleanup on error paths than is otherwise needed.  This commit reorders the
work to avoid this extra cleanup.

bridge_ofproto_port_del() is no longer used after the refactoring so this
commit deletes it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Make reconfiguration update port configuration again.
Ben Pfaff [Tue, 24 Apr 2012 23:47:27 +0000 (16:47 -0700)]
vswitchd: Make reconfiguration update port configuration again.

Commit bae7208e91a0 (bridge: Refactor bridge_reconfigure().) introduced
a regression in bridge reconfiguration.  Previously, reconfiguration would
update the configuration of each bridge port, so that if the controller
(or the admin) changed a port's options, then that change would propagate
to the datapath.  Following that commit, that no longer happened.

This commit restores that feature.

Bug #10972.
Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Make iface_create() return an indication of success.
Ben Pfaff [Tue, 24 Apr 2012 23:39:50 +0000 (16:39 -0700)]
vswitchd: Make iface_create() return an indication of success.

This is the minimal change that gets the job done.  There are much nicer
ways to do this, but I'll leave that refactoring for later in the series.

The return value will have its first user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Factor code to configure netdevs out of iface_create().
Ben Pfaff [Tue, 24 Apr 2012 23:28:18 +0000 (16:28 -0700)]
vswitchd: Factor code to configure netdevs out of iface_create().

An upcoming patch will need the same code in another function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Refactor iface_refresh_type() into iface_get_type().
Ben Pfaff [Tue, 24 Apr 2012 22:59:42 +0000 (15:59 -0700)]
vswitchd: Refactor iface_refresh_type() into iface_get_type().

The calculation that this function does will need to be used in a
context where no "struct iface" is available in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Drop 'need_refresh' member from struct iface.
Ben Pfaff [Tue, 24 Apr 2012 22:43:11 +0000 (15:43 -0700)]
vswitchd: Drop 'need_refresh' member from struct iface.

It's no longer useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Push ofproto_port declaration down to inner blocks.
Ben Pfaff [Tue, 24 Apr 2012 21:56:53 +0000 (14:56 -0700)]
vswitchd: Push ofproto_port declaration down to inner blocks.

Just a tiny code cleanup.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agobridge: Ignore null interfaces as required.
Ethan Jackson [Mon, 23 Apr 2012 16:25:07 +0000 (09:25 -0700)]
bridge: Ignore null interfaces as required.

This issue has been around for quite some time.  It doesn't really
cause problems beyond some spurious warnings.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agovswitchd: Report actual port number, not -1, in "added interface" message.
Ben Pfaff [Tue, 24 Apr 2012 17:44:54 +0000 (10:44 -0700)]
vswitchd: Report actual port number, not -1, in "added interface" message.

CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitch.xml: Document Interface external-ids:iface-status.
Ben Pfaff [Tue, 24 Apr 2012 17:07:49 +0000 (10:07 -0700)]
vswitch.xml: Document Interface external-ids:iface-status.

This has been implemented for a long time but we forgot to document it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agobridge: Refactor bridge_reconfigure().
Ethan Jackson [Sat, 21 Apr 2012 02:11:35 +0000 (19:11 -0700)]
bridge: Refactor bridge_reconfigure().

The existing bridge_reconfigure() implementation is suboptimal.
When adding lots of new ports, on every pass through the run loop
it allocates a bunch of "struct iface"s and "struct port"s, only to
destroy them when out of time.  Additionally, when there are errors
adding or deleting ports, it can fail to converge.  Instead it will
attempt and fail to add the same set of ports forever.

This patch rewrites bridge_reconfigure() using a new strategy.
Whenever the database changes, some initial bookkeeping is done,
and a list of future work is compiled.  The bridge begins whittling
down this list, and stops processing database changes until
finished.

Bug #10902.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agovswitchd: Remove unused 'tag' from 'struct iface'.
Ethan Jackson [Fri, 20 Apr 2012 19:57:29 +0000 (12:57 -0700)]
vswitchd: Remove unused 'tag' from 'struct iface'.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoDESIGN: Describe principles of in-band control.
Ben Pfaff [Mon, 23 Apr 2012 21:15:32 +0000 (14:15 -0700)]
DESIGN: Describe principles of in-band control.

These principles are drawn from an email I sent to the openflow-spec list
long ago.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Generalize 'sed' calls in MAC learning test to more than one digit.
Ben Pfaff [Mon, 23 Apr 2012 17:07:29 +0000 (10:07 -0700)]
tests: Generalize 'sed' calls in MAC learning test to more than one digit.

With "check-valgrind" the test can take more than 10 seconds to run, so
replacing only a single trailing digit with ? ends up with 1? which causes
the test to fail.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Avoid daemon race between pidfile creation and parent notification.
Ben Pfaff [Mon, 23 Apr 2012 17:05:50 +0000 (10:05 -0700)]
tests: Avoid daemon race between pidfile creation and parent notification.

This was causing "check-valgrind" to sometimes fail in this test.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Fix use-after-free error when ports disappear.
Ben Pfaff [Mon, 23 Apr 2012 16:16:18 +0000 (09:16 -0700)]
ofproto: Fix use-after-free error when ports disappear.

update_port() can delete the port for which it is called, if the underlying
network device has been destroyed, so HMAP_FOR_EACH is unsafe in
ofproto_run().

Less obviously, update_port() can delete unrelated ports.  For example,
suppose that initially device A is port 1 and device B is port 2.  If
update_port("A") runs just after this, then it will ofport_remove() both
ports, then ofport_install() A as the new port 2.

So this commit first assembles a list of ports to update, then updates them
in a separate loop.

Without this commit, running "ovs-dpctl del-dp" while ovs-vswitchd is
running consistently causes a crash for me within a few seconds.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Make "cfm_health" column ephemeral.
Ben Pfaff [Fri, 20 Apr 2012 18:12:46 +0000 (11:12 -0700)]
vswitchd: Make "cfm_health" column ephemeral.

There's no need to log this to the on-disk database.

Spotted while examining "ovsdb-tool show-log" output.

Reported-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Make "cfm_fault_status" column ephemeral.
Ben Pfaff [Fri, 20 Apr 2012 18:03:14 +0000 (11:03 -0700)]
vswitchd: Make "cfm_fault_status" column ephemeral.

There's no need to log this to the on-disk database.

Spotted while examining "ovsdb-tool show-log" output.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoautomake: ofp-errors.[c|inc] are actually inside srcdir
Ansis Atteka [Thu, 19 Apr 2012 19:54:16 +0000 (12:54 -0700)]
automake: ofp-errors.[c|inc] are actually inside srcdir

This patch fixes a build error when OVS is built inside
"./_debian" directory.

To reproduce this issue run "fakeroot debian/rules binary"
or "debuild binary" inside the git root directory.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
12 years agodocumantation: Trivial fix for kvm option error.
Yasuhito Takamiya [Fri, 20 Apr 2012 14:38:04 +0000 (07:38 -0700)]
documantation: Trivial fix for kvm option error.

Signed-off-by: Yasuhito Takamiya <yasuhito@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-vsctl: Speed up port management operations with many ports.
Ben Pfaff [Tue, 17 Apr 2012 23:56:21 +0000 (16:56 -0700)]
ovs-vsctl: Speed up port management operations with many ports.

This makes a sequence of 10,000 "add-port" operations on a single ovs-vsctl
command line about 4X faster.  It makes a sequence of 10,000 "del-port"
operations on a single command line over 2X faster.

It works by not repopulating the cache of relationships between bridges,
ports, and interfaces after most operations, instead updating them
incrementally in-place.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-vsctl: Remove 'ctrl', 'n_ctrl' from struct vsctl_bridge.
Ben Pfaff [Tue, 17 Apr 2012 20:56:38 +0000 (13:56 -0700)]
ovs-vsctl: Remove 'ctrl', 'n_ctrl' from struct vsctl_bridge.

Only the controller commands used these members and they didn't even help
those commands very much.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-vsctl: Remove 'fail_mode' member from struct vsctl_bridge.
Ben Pfaff [Thu, 19 Apr 2012 21:27:40 +0000 (14:27 -0700)]
ovs-vsctl: Remove 'fail_mode' member from struct vsctl_bridge.

It's only used in cmd_get_fail_mode(), which can easily look it up for
itself, so there's no benefit to storing it in every vsctl_bridge record.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-vsctl: Merge struct vsctl_info into struct vsctl_context.
Ben Pfaff [Wed, 18 Apr 2012 00:07:00 +0000 (17:07 -0700)]
ovs-vsctl: Merge struct vsctl_info into struct vsctl_context.

To speed up management operations with many ports, we need to preserve the
cache of bridges, ports, and interfaces from one operation to the next.
One necessary step is to push the "struct vsctl_info" that did the caching
up from the individual functions that need it into a more global structure.
This commit does that, merging it into struct vsctl_context.

This commit also modifies do_vsctl(), the top-level control code in
ovs-vsctl, to keep this part of the vsctl_context unchanged from running
one command to the next.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-vsctl: Verify VLAN bridge controllers in cmd_get_controller().
Ben Pfaff [Tue, 17 Apr 2012 20:50:53 +0000 (13:50 -0700)]
ovs-vsctl: Verify VLAN bridge controllers in cmd_get_controller().

A VLAN bridge uses its parent's controllers, so checking the controller
should verify the parent's set of controllers.

The change to verify_controllers() isn't necessary; it just deletes
the check for a null 'bridge' because verify_controllers() can no
longer be called with a null 'bridge'.

This fixes a bug, but it is unlikely to ever have caused a real problem for
users.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-vsctl: Verify correct record in cmd_get_fail_mode() for VLAN bridges.
Ben Pfaff [Tue, 17 Apr 2012 20:44:51 +0000 (13:44 -0700)]
ovs-vsctl: Verify correct record in cmd_get_fail_mode() for VLAN bridges.

A VLAN bridge uses its parent's fail-mode, so checking the fail-mode should
verify the parent's bridge record.

This fixes a bug, but it is unlikely to ever have caused a real problem for
users.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Use ETH_ALEN instead of VLAN_ETH_ALEN
Simon Horman [Thu, 19 Apr 2012 07:38:39 +0000 (16:38 +0900)]
datapath: Use ETH_ALEN instead of VLAN_ETH_ALEN

VLAN_ETH_ALEN will be removed in version 3.5 of the Linux kernel.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Include linux/completion.h
Simon Horman [Thu, 19 Apr 2012 07:38:20 +0000 (16:38 +0900)]
datapath: Include linux/completion.h

This is needed for compilation against Linux 2.6.19

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agoofproto-dpif: Avoid extra flow copy in xlate_actions() for unneeded warnings.
Ben Pfaff [Mon, 16 Apr 2012 22:54:37 +0000 (15:54 -0700)]
ofproto-dpif: Avoid extra flow copy in xlate_actions() for unneeded warnings.

The copy of the extra flow copy here was showing up in profiles.  We only
need this copy if we end up doing a "trace" to warn the user.  Most runs
won't ever do that, so don't start making copies until we actually hit
such a case.

This has a small behavioral change in that we'll only get a warning on the
*second* time we hit the resubmit recursion limit, not on the first.  I
doubt that's really a problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Avoid extra flow copy in xlate_actions() if no mirrors.
Ben Pfaff [Mon, 16 Apr 2012 22:43:15 +0000 (15:43 -0700)]
ofproto-dpif: Avoid extra flow copy in xlate_actions() if no mirrors.

This was showing up on profiles.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Avoid calling get_ofp_port() twice in xlate_normal().
Ben Pfaff [Mon, 16 Apr 2012 22:22:52 +0000 (15:22 -0700)]
ofproto-dpif: Avoid calling get_ofp_port() twice in xlate_normal().

This was showing up in profiles.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Implement "flow setup governor" to speed up many short flows.
Ben Pfaff [Thu, 19 Apr 2012 00:11:10 +0000 (17:11 -0700)]
ofproto-dpif: Implement "flow setup governor" to speed up many short flows.

The cost of creating and initializing facets and subfacets and installing,
tracking, and uninstalling kernel flows is significant.  When most flows
have only one or a few packets, this overhead is higher than the cost of
handling each packet individually.  This commit introduces heuristics that
cheaply count (approximately) the number of packets seen in a flow and
skips most of this expensive bookkeeping until the packet count exceeds a
threshold (currently 5 packets).

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Avoid malloc() in common case for "execute" operations.
Ben Pfaff [Wed, 18 Apr 2012 23:54:10 +0000 (16:54 -0700)]
ofproto-dpif: Avoid malloc() in common case for "execute" operations.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Make it easier to credit statistics for resubmits.
Ben Pfaff [Fri, 13 Apr 2012 21:09:10 +0000 (14:09 -0700)]
ofproto-dpif: Make it easier to credit statistics for resubmits.

Until now, crediting statistics to OpenFlow rules due to "resubmit" actions
has required setting up a "resubmit hook" with a callback function and
auxiliary data.  This commit makes it easier to do, by adding a member to
struct action_xlate_ctx that specifies statistics to credit to each
resubmitted rule.

This commit includes one small behavioral change as an optimization.
Previously, rule_execute() translated the rule twice: once to get the ODP
actions, then a second time after executing the ODP actions to credit
statistics to the rules.  After this commit, rule_execute() translates the
rule only once, crediting statistics as a side effect.  The difference only
becomes visible when executing the actions fails: previously the statistics
would not be incremented, after this commit they will be.  It is very
unusual for executing actions to fail (generally this indicates a bug) so
I'm not concerned about it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoclassifier: Optimize search of "catchall" table.
Ben Pfaff [Mon, 9 Apr 2012 22:49:22 +0000 (15:49 -0700)]
classifier: Optimize search of "catchall" table.

Most flow tables have some kind of "catchall" rule that matches every
packet.  For this table, the cost of copying, zeroing, and hashing the
input flow is significant.  This patch avoids these costs.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agomac-learning: Speed up mac_table_hash().
Ben Pfaff [Mon, 9 Apr 2012 21:33:56 +0000 (14:33 -0700)]
mac-learning: Speed up mac_table_hash().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agohash: Speed up hash_bytes().
Ben Pfaff [Mon, 9 Apr 2012 21:33:33 +0000 (14:33 -0700)]
hash: Speed up hash_bytes().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Avoid malloc() of "struct flow_miss".
Ben Pfaff [Sat, 7 Apr 2012 00:11:18 +0000 (17:11 -0700)]
ofproto-dpif: Avoid malloc() of "struct flow_miss".

In addition to avoid malloc() for struct flow_miss, this commit avoids
copying "struct flow" around, which is a significant benefit because
struct flow is currently 144 bytes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodpif: Make caller of dpif_recv() provide buffer space.
Ben Pfaff [Fri, 6 Apr 2012 23:23:28 +0000 (16:23 -0700)]
dpif: Make caller of dpif_recv() provide buffer space.

This improves performance under heavy flow setup loads.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Avoid malloc() in common case for allocating subfacets.
Ben Pfaff [Fri, 6 Apr 2012 22:30:21 +0000 (15:30 -0700)]
ofproto-dpif: Avoid malloc() in common case for allocating subfacets.

Usually a facet has exactly one subfacet that has the same lifetime as
the facet.  Allocating both the facet and its subfacet in a single memory
block improves performance.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Move definition of "struct subfacet" earlier.
Ben Pfaff [Fri, 6 Apr 2012 22:27:31 +0000 (15:27 -0700)]
ofproto-dpif: Move definition of "struct subfacet" earlier.

The next commit will add an instance of struct subfacet as a member of
struct facet, so struct subfacet must be declared first.

This commit moves around code without otherwise changing it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetlink-socket: Make caller provide message receive buffers.
Ben Pfaff [Mon, 9 Apr 2012 22:35:29 +0000 (15:35 -0700)]
netlink-socket: Make caller provide message receive buffers.

Typically an nl_sock client can stack-allocate the buffer for receiving
a Netlink message, which provides a performance boost.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetlink-socket: Remove unnecessary #include.
Ben Pfaff [Fri, 6 Apr 2012 22:13:37 +0000 (15:13 -0700)]
netlink-socket: Remove unnecessary #include.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetlink: Postpone choosing sequence numbers until send time.
Ben Pfaff [Mon, 16 Apr 2012 23:01:01 +0000 (16:01 -0700)]
netlink: Postpone choosing sequence numbers until send time.

Choosing sequence numbers at time of creating a packet means that
nl_sock_transact_multiple() has to search for the sequence number
of a reply, because the sequence numbers of the requests aren't
necessarily sequential.  This commit makes it possible to avoid
the search, by deferring choice of sequence numbers until the
time that we send the packets.  It doesn't actually modify
nl_sock_transact_multiple(), which will happen in a later commit.

Previously, I was concerned about a theoretical race condition
described in a comment in the old versino of this code:

    This implementation uses sequence numbers that are unique
    process-wide, to avoid a hypothetical race: send request, close
    socket, open new socket that reuses the old socket's PID value,
    send request on new socket, receive reply from kernel to old
    socket but with same PID and sequence number.  (This race could be
    avoided other ways, e.g. by preventing PIDs from being quickly
    reused).

However, I no longer believe that this can be a real problem,
because Netlink operates synchronously.  The reply to a request
will always arrive before the socket can be closed and a new
socket opened with the old socket's PID.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Avoid computing flow hash multiple times.
Ben Pfaff [Wed, 18 Apr 2012 16:17:33 +0000 (09:17 -0700)]
ofproto-dpif: Avoid computing flow hash multiple times.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodpif-linux: Avoid malloc() in dpif_linux_operate().
Ben Pfaff [Thu, 5 Apr 2012 23:49:22 +0000 (16:49 -0700)]
dpif-linux: Avoid malloc() in dpif_linux_operate().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Avoid malloc() in common cases for xlate_actions().
Ben Pfaff [Mon, 16 Apr 2012 20:52:09 +0000 (13:52 -0700)]
ofproto-dpif: Avoid malloc() in common cases for xlate_actions().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofpbuf: New functions ofpbuf_use_stub() and ofpbuf_get_uninit_pointer().
Ben Pfaff [Wed, 18 Apr 2012 04:55:27 +0000 (21:55 -0700)]
ofpbuf: New functions ofpbuf_use_stub() and ofpbuf_get_uninit_pointer().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Don't do an extra flow translation when removing facets.
Ben Pfaff [Thu, 5 Apr 2012 20:43:24 +0000 (13:43 -0700)]
ofproto-dpif: Don't do an extra flow translation when removing facets.

When we remove a facet, it seems superfluous to translate the flow
once more just to update the MAC learning table, since we know that
it was done within a second or so anyway (e.g. when the flow stats
were last updated).

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetlink-socket: Avoid forcing a reply for final message in a transaction.
Ben Pfaff [Thu, 5 Apr 2012 19:58:42 +0000 (12:58 -0700)]
netlink-socket: Avoid forcing a reply for final message in a transaction.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodpif: Include TCP flags in "ovs-dpctl dump-flows" output.
Ben Pfaff [Thu, 5 Apr 2012 17:24:56 +0000 (10:24 -0700)]
dpif: Include TCP flags in "ovs-dpctl dump-flows" output.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Batch flow uninstallations due to expiration.
Ben Pfaff [Wed, 18 Apr 2012 04:52:10 +0000 (21:52 -0700)]
ofproto-dpif: Batch flow uninstallations due to expiration.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Drop unneeded _SAFE from iteration in handle_flow_miss().
Ben Pfaff [Mon, 16 Apr 2012 21:07:56 +0000 (14:07 -0700)]
ofproto-dpif: Drop unneeded _SAFE from iteration in handle_flow_miss().

The loop never frees the packet that it operates on, so _SAFE is not
needed.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Keep subfacet "used" times more up-to-date.
Ben Pfaff [Fri, 13 Apr 2012 21:15:15 +0000 (14:15 -0700)]
ofproto-dpif: Keep subfacet "used" times more up-to-date.

handle_flow_miss() didn't update subfacet "used" times for packets
processed by userspace.  This commit fixes the problem.

Found by inspection.  I didn't verify the bug in testing.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-test: Enhancements to the ovs-test tool
Ansis Atteka [Fri, 30 Mar 2012 02:03:08 +0000 (19:03 -0700)]
ovs-test: Enhancements to the ovs-test tool

-Implemented support for ovs-test client, so that it could automatically
spawn an ovs-test server process from itself. This reduces the number of
commands the user have to type to get tests running.
-Automated creation of OVS bridges and ports (for VLAN and GRE tests), so that
user would not need to invoke ovs-vsctl manually to switch from direct, 802.1Q
and GRE tests.
-Fixed some pylint reported warnings.
-Fixed ethtool invocation so that we always try to query the physical interface
to get the driver name and version.
-and some others enhancements.

The new usage:
Node1:ovs-test -s 15531
Node2:ovs-test -c 127.0.0.1,1.1.1.1 192.168.122.151,1.1.1.2 -d -l 125 -t gre

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
12 years agolacp: Remove heartbeat mode.
Ethan Jackson [Mon, 16 Apr 2012 22:01:09 +0000 (15:01 -0700)]
lacp: Remove heartbeat mode.

The LACP heartbeat mode was used to monitor interfaces for
connectivity.  It turns out that LACP is inferior to CFM for this
purpose.  For the sake of simplicity this patch removes the
feature.

Signed-off-by: Ethan Jackson <ethan@nicira.com>