sliver-openvswitch.git
10 years agonetdev-bsd: Fix tx/rx stats for type=tap netdev
YAMAMOTO Takashi [Wed, 5 Feb 2014 10:08:10 +0000 (19:08 +0900)]
netdev-bsd: Fix tx/rx stats for type=tap netdev

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoAdd IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.
Arun Sharma [Fri, 7 Feb 2014 00:04:05 +0000 (16:04 -0800)]
Add IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.

Does not add IPv6 support for in-band control.

Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Nandan Nivgune <nandan.nivgune@calsoftinc.com>
Signed-off-by: Abhijit Bhopatkar <abhijit.bhopatkar@calsoftinc.com>
Signed-off-by: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix kernel style issues.
Jesse Gross [Wed, 5 Feb 2014 05:58:03 +0000 (21:58 -0800)]
datapath: Fix kernel style issues.

Suggested-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Tue, 4 Feb 2014 23:02:44 +0000 (00:02 +0100)]
Merge branch 'mainstream'

10 years agoofproto-dpif.at: Avoid races by sleeping
YAMAMOTO Takashi [Fri, 24 Jan 2014 01:31:14 +0000 (10:31 +0900)]
ofproto-dpif.at: Avoid races by sleeping

And add a comment.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodaemon.at: Fix stderr races
YAMAMOTO Takashi [Fri, 24 Jan 2014 01:31:13 +0000 (10:31 +0900)]
daemon.at: Fix stderr races

When spawning ovsdb-server in background, redirect stderr to /dev/null.
Otherwise, the banner output (eg. "ovsdb-server (Open vSwitch) 2.1.90")
can mess stderr of the following commands and make these tests fail.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif.at: Workaround races in megaflow tests
YAMAMOTO Takashi [Fri, 24 Jan 2014 01:31:12 +0000 (10:31 +0900)]
ofproto-dpif.at: Workaround races in megaflow tests

Avoid races in megaflow tests by sprinkling "sleep 1".

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofprot-dpif.at: Fix races
YAMAMOTO Takashi [Fri, 24 Jan 2014 01:31:11 +0000 (10:31 +0900)]
ofprot-dpif.at: Fix races

Fix races in "ofproto-dpif - controller" test.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agopackets: Fix userland implementation of set-field ipv6 addresses
YAMAMOTO Takashi [Fri, 24 Jan 2014 06:50:41 +0000 (15:50 +0900)]
packets: Fix userland implementation of set-field ipv6 addresses

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoEnhance userspace support for MPLS, for up to 3 labels.
Ben Pfaff [Tue, 4 Feb 2014 18:32:35 +0000 (10:32 -0800)]
Enhance userspace support for MPLS, for up to 3 labels.

This commit makes the userspace support for MPLS more complete.  Now
up to 3 labels are supported.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Co-authored-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Simon Horman <horms@verge.net.au>
10 years agodaemon-windows: Add users for windows services.
Gurucharan Shetty [Fri, 17 Jan 2014 18:43:03 +0000 (10:43 -0800)]
daemon-windows: Add users for windows services.

Start with ovs-vswitchd and ovsdb-server.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agodaemon-windows: Ability to handle windows service calls.
Gurucharan Shetty [Fri, 17 Jan 2014 00:16:24 +0000 (16:16 -0800)]
daemon-windows: Ability to handle windows service calls.

The following code does not add any users yet.

The visioned workflow that this piece of code should work with is:
* Create a windows service through a startup script with
a tool like 'sc'
ex:  sc create ovsdb-server binpath=
 "C:\openvswitch\usr\sbin\ovsdb-server.exe -vconsole:off
-vsyslog:off -vfile:info --remote=ptcp:6632:127.0.0.1 --log-file
--service-monitor --service"

* Start the service from the startup script.
ex: sc start ovsdb-server

* Terminate the service during shutdown process.
ex: sc stop ovsdb-server

* Abrupt termination will restart the service.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Make a log message more detailed.
Ben Pfaff [Tue, 4 Feb 2014 16:07:45 +0000 (08:07 -0800)]
dpif-netdev: Make a log message more detailed.

This would have helped me track down a bug I was hunting just now.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agodatapath: flow_netlink: Use pr_fmt to OVS_NLERR
Joe Perches [Tue, 4 Feb 2014 01:27:41 +0000 (17:27 -0800)]
datapath: flow_netlink: Use pr_fmt to OVS_NLERR

Add "openvswitch: " prefix to OVS_NLERR output
to match the other OVS_NLERR output of datapath.c

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Use net_ratelimit in OVS_NLERR
Joe Perches [Tue, 4 Feb 2014 01:26:52 +0000 (17:26 -0800)]
datapath: Use net_ratelimit in OVS_NLERR

Each use of pr_<level>_once has a per-site flag.

Some of the OVS_NLERR messages look as if seeing them
multiple times could be useful, so use net_ratelimit()
instead of pr_info_once.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoAUTHORS: Add Ken Ajiro.
Ben Pfaff [Tue, 4 Feb 2014 01:15:03 +0000 (17:15 -0800)]
AUTHORS: Add Ken Ajiro.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vsctl: Update will be discarded when multiple ovs-vsctl are executed
Ken Ajiro [Tue, 28 Jan 2014 01:20:43 +0000 (01:20 +0000)]
ovs-vsctl: Update will be discarded when multiple ovs-vsctl are executed

When two ovs-vsctl update map type column at same time, one ovs-vsctl's
update will be discarded although all ovs-vsctl succeeded. This patch
fixes this issue.

Signed-off-by: Ken Ajiro <ajiro@mxw.nes.nec.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: remove useless includes
Daniele Di Proietto [Fri, 24 Jan 2014 18:00:06 +0000 (19:00 +0100)]
dpif-linux: remove useless includes

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agom4: remove useless include from netlink check
Daniele Di Proietto [Fri, 24 Jan 2014 18:00:05 +0000 (19:00 +0100)]
m4: remove useless include from netlink check

linux/types.h is already included from linux/netlink.h (in every
linux version). This will ease FreeBSD porting

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Remove unused fitnessp pararameter from xlate_receive
Simon Horman [Wed, 29 Jan 2014 06:13:19 +0000 (15:13 +0900)]
ofproto-dpif-xlate: Remove unused fitnessp pararameter from xlate_receive

Some functions pass a non-NULL value as this parameter
but none of those function uses the value xlate_receive()
returns there. So simply remove the parameter all together.

Also remove the now unused key_fitness field of struct flow_miss.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Added (unsigned long long) cast in printf
Daniele Di Proietto [Thu, 23 Jan 2014 22:26:42 +0000 (23:26 +0100)]
datapath: Added (unsigned long long) cast in printf

This is necessary, since u64 is not unsigned long long
in all architectures: u64 could be also uint64_t.

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: avoid cast-qual warning in vport_priv
Daniele Di Proietto [Thu, 23 Jan 2014 22:26:05 +0000 (23:26 +0100)]
datapath: avoid cast-qual warning in vport_priv

This function must cast a const value to a non const value.
By adding an uintptr_t cast the warning is suppressed.
To avoid the cast (proper solution) several function signatures
must be changed.

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: avoid warnings in vport_from_priv
Daniele Di Proietto [Thu, 23 Jan 2014 22:25:37 +0000 (23:25 +0100)]
datapath: avoid warnings in vport_from_priv

This change, firstly, avoids declaring the formal parameter const,
since it is treated as non const. (to avoid -Wcast-qual)
Secondly, it cast the pointer from void* to u8*, since it is used
in arithmetic (to avoid -Wpointer-arith)

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapth: Suppress error messages on megaflow updates
Andy Zhou [Fri, 31 Jan 2014 23:47:58 +0000 (15:47 -0800)]
datapth: Suppress error messages on megaflow updates

With subfacets, we'd expect megaflow updates message to carry
the original micro flow. If not, EINVAL is returned and kernel
logs an error message.  Now that the user space subfacet layer is
removed, it is expected that flow updates can arrive with a
micro flow other than the original. Change the return code to
EEXIST and remove the kernel error log message.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agosocket-util: Remove unused functions.
Ben Pfaff [Tue, 10 Dec 2013 01:28:32 +0000 (17:28 -0800)]
socket-util: Remove unused functions.

A Windows porter mentioned to me that these functions caused special
trouble in the Windows port.  However, they are no longer used, so we
might as well remove them.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoconfigure: Identify OpenSSL libraries in Windows.
Gurucharan Shetty [Thu, 30 Jan 2014 16:55:43 +0000 (08:55 -0800)]
configure: Identify OpenSSL libraries in Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix ovs_flow_free() ovs-lock assert.
Pravin B Shelar [Tue, 28 Jan 2014 02:18:33 +0000 (18:18 -0800)]
datapath: Fix ovs_flow_free() ovs-lock assert.

ovs_flow_free() is not called under ovs-lock during packet
execute path (ovs_packet_cmd_execute()). Since packet execute
does not touch flow->mask, there is no need to take that
lock either. So move assert in case where flow->mask is checked.

Found by code inspection.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agocccl: Handle library paths for one shot compilation.
Gurucharan Shetty [Thu, 30 Jan 2014 00:08:49 +0000 (16:08 -0800)]
cccl: Handle library paths for one shot compilation.

When one wishes to compile and link a program with an
external library in one shot, additional
option "-link" is expected after all the other options. For example,

$ cl -I/c/OpenSSL-Win32/include 3.c -link -LIBPATH:"C:/OpenSSL-Win32/lib"

This is needed in an upcoming commit to compile conftest.c in autoconf.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoBUILD.Windows: Add documentation to handle the libtool change.
Gurucharan Shetty [Wed, 29 Jan 2014 23:34:03 +0000 (15:34 -0800)]
BUILD.Windows: Add documentation to handle the libtool change.

With the recent change to libtool, the default behavior is to use
MinGW's 'ld'. Set the LD variable to direct it to Visual Studio's
linker.

The wordings for the documentation is copied from INSTALL.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoBUILD.Windows: Clarify on the correct linker.
Gurucharan Shetty [Wed, 29 Jan 2014 23:28:42 +0000 (15:28 -0800)]
BUILD.Windows: Clarify on the correct linker.

This has tripped a couple of people.

The workaround in cccl does not actually work. So get rid of it and
clarify in documentation.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agobridge: Set ofport column in every database transaction.
Ben Pfaff [Fri, 31 Jan 2014 00:57:16 +0000 (16:57 -0800)]
bridge: Set ofport column in every database transaction.

Database transactions can occasionally fail due to concurrent changes in
the database.  When that happens, the next transaction should repeat the
changes that ovs-vswitchd tried to make the first time (adjusted for the
changes to the database).

The code to report the OpenFlow port number in use didn't do that.  It set
the ofport field once when it created the port and never set it again, even
if the transaction to set it failed.  This commit fixes the problem.

Bug #23047.
Reported-by: Suganya Ramachandran <suganyar@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoofproto-dpif-upcall: Hardcode max_idle to 1500ms.
Ethan Jackson [Tue, 28 Jan 2014 00:40:27 +0000 (16:40 -0800)]
ofproto-dpif-upcall: Hardcode max_idle to 1500ms.

Before this patch, OVS tried to guess an optimal max idle time for
datapath flows based on the number of datapath flows relative to the
limit.  This caused instability because the limit was based on the
dump duration which was affected by the max idle time.  This patch
chooses instead to hardcode the max idle time to 1.5s except in
extreme case where the datapath flow limit is exceeded.  1.5s was
chosen to ensure pings occurring at once per second stay cached in the
datapath.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoupcall: Avoid divide-by-zero calculating flow limit
Joe Stringer [Tue, 28 Jan 2014 21:04:35 +0000 (13:04 -0800)]
upcall: Avoid divide-by-zero calculating flow limit

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoutil: A generic function to convert error to string for windows.
Gurucharan Shetty [Thu, 16 Jan 2014 21:49:38 +0000 (13:49 -0800)]
util: A generic function to convert error to string for windows.

More users will be added in an upcoming commit.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agogetopt_long: Copy over the implementation from netbsd.
Gurucharan Shetty [Mon, 27 Jan 2014 16:52:57 +0000 (08:52 -0800)]
getopt_long: Copy over the implementation from netbsd.

Windows does not have a getopt_long function. This commit
copies over the getopt_long implementation from netbsd with
some minor modifications and is used only on Windows platform.

Modifications on top of the version in NetBSD repo.
* Remove header files not available in Visual Studio.
* Remove some unwanted #defines.
* Add Open vSwitch specific header files like config.h, vlog.h, util.h
* Add the following #define's
define __UNCONST(a)    ((void *)(unsigned long)(const void *)(a))
define _DIAGASSERT(q) ovs_assert(q)
define warnx VLOG_WARN
* Add extern declaration in getopt.h for optarg, optind.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-dev.py: Only build the Linux datapath with GCC.
Ethan Jackson [Wed, 22 Jan 2014 19:06:23 +0000 (11:06 -0800)]
ovs-dev.py: Only build the Linux datapath with GCC.

In practice, Linux kernel modules are only built with GCC, so it
doesn't make much sense to spend time compiling them with clang.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agodaemon: Cleanup some functions.
Gurucharan Shetty [Fri, 10 Jan 2014 16:33:15 +0000 (08:33 -0800)]
daemon: Cleanup some functions.

Some functions are unused and some functions can be
declared as static.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosyslog: Provide stub functions for openlog and syslog.
Gurucharan Shetty [Mon, 6 Jan 2014 21:54:21 +0000 (13:54 -0800)]
syslog: Provide stub functions for openlog and syslog.

One option to implement openlog and syslog functionality in Windows
is to use windows event logger. But it looks like it involves changing
registry settings and in general looks complicated.

For the time being, do nothing for syslog. All the information needed for
debugging will be present through the 'file' option anyways.

We can start OVS daemons on Windows with "-vfile:info -vsyslog:off".

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosyslog: Add LOG_LOCALX definitions.
Gurucharan Shetty [Mon, 6 Jan 2014 21:12:21 +0000 (13:12 -0800)]
syslog: Add LOG_LOCALX definitions.

LOG_LOCAL0 is used in lib/vlog.c.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Handle negative number of threads.
Gurucharan Shetty [Wed, 22 Jan 2014 21:26:33 +0000 (13:26 -0800)]
ofproto: Handle negative number of threads.

As of now, setting other_config:n-handler-threads to a negative
value causes ovs-vswitchd to crash.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev-dummy: Add support for active stream
Andy Zhou [Wed, 18 Dec 2013 21:55:25 +0000 (13:55 -0800)]
netdev-dummy: Add support for active stream

The dummy ports thus far only support passive connections. It can
listen for multiple incoming connection requests but not make active
connections. This patch adds support of active stream, so that a
dummy port can be configured with either passive or active connections.

The net result is that dummy ports can now connect to each other,
without being patch ports. This feature will be useful in adding test
cases of future commits.

Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agonetlink: Rename 'dump->seq' to 'dump->nl_seq'
Joe Stringer [Tue, 21 Jan 2014 19:29:26 +0000 (11:29 -0800)]
netlink: Rename 'dump->seq' to 'dump->nl_seq'

An upcoming patch will introduce another, completely unrelated seq to
'struct nl_dump'. Giving this one a better name should reduce confusion.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: use const in some local vars and casts
Daniele Di Proietto [Thu, 23 Jan 2014 16:19:29 +0000 (17:19 +0100)]
datapath: use const in some local vars and casts

In few functions, const formal parameters are assigned or cast to
non-const.
These changes suppress warnings if compiled with -Wcast-qual.

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix ovs_dp_cmd_msg_size()
Daniele Di Proietto [Thu, 23 Jan 2014 16:18:59 +0000 (17:18 +0100)]
datapath: Fix ovs_dp_cmd_msg_size()

commit c58cc9a460fd158e5250e59902e96ac677dc115f (datapath: Allow user space to
announce ability to accept unaligned Netlink messages) introduced
OVS_DP_ATTR_USER_FEATURES netlink attribute in datapath responses,
but the attribute size was not taken into account in ovs_dp_cmd_msg_size().

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodpif-linux: Fix flow_dump_next annotation.
Joe Stringer [Tue, 21 Jan 2014 19:29:24 +0000 (11:29 -0800)]
dpif-linux: Fix flow_dump_next annotation.

The 'dpif_' parameter of dpif_linux_flow_dump_next() was marked as
OVS_UNUSED, even though it's passed down to dpif_linux_flow_get__().

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/pcap-file: add 'ovs_' prefix to pcap functions
Luigi Rizzo [Thu, 23 Jan 2014 16:24:03 +0000 (17:24 +0100)]
lib/pcap-file: add 'ovs_' prefix to pcap functions

This is done to avoid collisions and confusions with libpcap symbols,
like pcap_read()

Signed-off-by: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/netdev-bsd: simplify multiple struct definitions
Daniele Di Proietto [Thu, 23 Jan 2014 16:19:56 +0000 (17:19 +0100)]
lib/netdev-bsd: simplify multiple struct definitions

Use a macro helper to initialize different netdev_*_class for bsd, like
in lib/netdev-linux.c
This helps adding other netdev types for bsd

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoMakefile: Use AM_V_GEN instead of echo.
Ethan Jackson [Wed, 22 Jan 2014 01:55:41 +0000 (17:55 -0800)]
Makefile: Use AM_V_GEN instead of echo.

The AM_V_GEN macro fits more cleanly with the automake silent rules
option.  When enabled it will print "GEN <filename>" instead of simply
echoing the command as before.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoconfigure: Enable silent rules.
Ethan Jackson [Wed, 22 Jan 2014 00:22:08 +0000 (16:22 -0800)]
configure: Enable silent rules.

Configure has an option which supports quieter compilation.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoovs-dev.py: Configure silently.
Ethan Jackson [Wed, 22 Jan 2014 00:35:35 +0000 (16:35 -0800)]
ovs-dev.py: Configure silently.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoovs-dev.py: Add compiler optimization options.
Ethan Jackson [Fri, 17 Jan 2014 00:20:17 +0000 (16:20 -0800)]
ovs-dev.py:  Add compiler optimization options.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoovs-dev.py: Add "-fno-omit-frame-pointer" compiler argument.
Ethan Jackson [Fri, 17 Jan 2014 00:21:43 +0000 (16:21 -0800)]
ovs-dev.py: Add "-fno-omit-frame-pointer" compiler argument.

This makes it easier for development tools including "perf", give
clean backtraces on x86-64 systems.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofp-parse: Fix GCC compiler warnings with -O3.
Ethan Jackson [Fri, 17 Jan 2014 00:26:37 +0000 (16:26 -0800)]
ofp-parse: Fix GCC compiler warnings with -O3.

When compiling with -O3, GCC can no longer tell that the following
warnings are not valid.  At any rate, they're easy enough to silence.

ofp-parse.c:764:45: error: 'ttl' may be used uninitialized in this
function

ofp-parse.c:752:17: error: 'ecn' may be used uninitialized in this
function

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoipsec: install iptables rules that set IPsec bit in skb mark
Ansis Atteka [Tue, 21 Jan 2014 01:16:39 +0000 (17:16 -0800)]
ipsec: install iptables rules that set IPsec bit in skb mark

Without these two iptables rules (one for UDP encapsulated IPsec and
another for direct IPsec), ovs-vswitchd would incorrectly conclude
that GRE packet belonged to a plain GRE tunnel instead of IPsec GRE
tunnel.

Reported-by: Aryan TaheriMonfared <aryan.taherimonfared@uis.no>
Reported-by: Daniel Hiltgen <daniel@netkine.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
10 years agoupcall: Cache the number of flows from the datapath.
Joe Stringer [Wed, 22 Jan 2014 06:50:49 +0000 (06:50 +0000)]
upcall: Cache the number of flows from the datapath.

Fetching the number of flows in the datapath has been causing
unnecessary contention on the kernel ovs_lock in recent TCP CRR tests.
This patch caches this number for up to 100ms in the userspace to reduce
such kernel calls.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Co-authored-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off--by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agobfd: Add bfd_src_ip and bfd_dst_ip.
Alex Wang [Tue, 21 Jan 2014 22:23:27 +0000 (14:23 -0800)]
bfd: Add bfd_src_ip and bfd_dst_ip.

This commit adds two new options, bfd_src_ip and bfd_dst_ip
respectively, which allows user to configure the source and
destination IP address of bfd control packet.  If the user
specified address cannot be parsed, the default address
will be used.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agovlog: Avoid deadlock in vlog_init__() corner case.
Ben Pfaff [Fri, 6 Dec 2013 00:59:13 +0000 (16:59 -0800)]
vlog: Avoid deadlock in vlog_init__() corner case.

Anything inside vlog_init__() that tried to log a message was going to
deadlock, since it would hit pthread_once() recursively and wait for the
previous call to complete.  Unfortunately, there was a VLOG_ERR call inside
vlog_init__(), only called in the corner case where the system's clock was
wrong.

This fixes the problem by rearranging code so that the logging isn't
inside the "once-only" region.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-util: Ignore out_group in flow_mods for commands other than delete.
Ben Pfaff [Fri, 6 Dec 2013 05:29:14 +0000 (21:29 -0800)]
ofp-util: Ignore out_group in flow_mods for commands other than delete.

OpenFlow 1.1 through 1.4 say that the out_group in a flow_mod, for commands
other than OFPFC_DELETE or OFPFC_DELETE_STRICT, should be ignored.  OVS
actually reported an error.  This fixes the problem.

Reported-by: chen zhang <3zhangchen9211@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoMerge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch
Giuseppe Lettieri [Tue, 21 Jan 2014 15:40:17 +0000 (16:40 +0100)]
Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch

Conflicts:
sliver-openvswitch.spec

10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Tue, 21 Jan 2014 15:37:36 +0000 (16:37 +0100)]
Merge branch 'mainstream'

Conflicts:
Makefile.am
lib/dpif-netdev.c

10 years agopoll-loop: Port to Windows.
Linda Sun [Fri, 10 Jan 2014 00:26:12 +0000 (16:26 -0800)]
poll-loop: Port to Windows.

Use WaitForMultipleObjects for polling on windows.  This works on all kinds
of objects, e.g. sockets, files, especially ioctl calls to the kernel.
poll_fd_wait_event() is used if events need to be passed to pollfds.  latch
is signaled with event, to be waited/polled by WaitForMultipleObjects() as
well.  Changed array of fds to hmap to check for duplicate fds.

Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix kernel panic on ovs_flow_free
Andy Zhou [Fri, 10 Jan 2014 23:57:04 +0000 (15:57 -0800)]
datapath: Fix kernel panic on ovs_flow_free

Both mega flow mask's reference counter and per flow table mask list
should only be accessed when holding ovs_mutex() lock. However
this is not true with ovs_flow_table_flush(). The patch fixes this bug.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-linux: Fix build break on RHEL 6.1.
Ben Pfaff [Fri, 17 Jan 2014 01:21:55 +0000 (17:21 -0800)]
netdev-linux: Fix build break on RHEL 6.1.

Commit 73c85181d (netdev-linux: Read packet auxdata to obtain vlan_tid)
added #include <linux/if_packet.h> to this file, to get the definition
of PACKET_AUXDATA and some other definitions, but on RHEL 6.1 this
provoked compiler errors:

In file included from /usr/include/linux/rtnetlink.h:5,
    from lib/netdev-linux.c:34:
/usr/include/linux/netlink.h:34: error: expected specifier-qualifier-list
    before 'sa_family_t'

Since the old #includes worked everywhere, and this file already defined
its own versions of most of the new macros that it needed, this commit just
reverts the old #includes and adds the one macro definition it didn't
already have.

(RHEL 6.1 isn't necessarily the only platform where this is a problem, but
it's the first one for which we noticed the problem.)

This switches the definition of sockaddr_ll used from the Linux one, which
uses __be16 for sll_protocol, to the glibc one, which uses plain "unsigned
short int".  This makes sparse complain (rightly), so this commit also
adds a sparse-specific header that uses ovs_be16 to prevent the warning.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovswitchd: Inherit parents mac address for fake bridges
Helmut Schaa [Fri, 6 Dec 2013 15:18:42 +0000 (16:18 +0100)]
vswitchd: Inherit parents mac address for fake bridges

When adding a physical port to the main bridge the mac address
of the bridge is updated. We can do the same for fake bridges by
copying the mac address of the parent bridge.

There exists only one fake bridge per vlan, hence it is safe
to copy the mac address of the parent bridge.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-linux: Read packet auxdata to obtain vlan_tid
Simon Horman [Wed, 15 Jan 2014 08:17:02 +0000 (17:17 +0900)]
netdev-linux: Read packet auxdata to obtain vlan_tid

If VLAN acceleration is used when the kernel receives a packet
then the outer-most VLAN tag will not be present in the packet
when it is received by netdev-linux. Rather, it will be present
in auxdata.

This patch uses recvmsg() instead of recv() to read auxdata for
each packet and if the vlan_tid is set then it is added to the packet.

Adding the vlan_tid makes use of headroom available
in the buffer parameter of rx_recv.

Signed-off-by: Simon Horman <horms@verge.net.au>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib: Add tpid parameter to eth_push_vlan()
Simon Horman [Wed, 15 Jan 2014 08:17:01 +0000 (17:17 +0900)]
lib: Add tpid parameter to eth_push_vlan()

This is in preparation for pushing vlan tags
using the TPID provided by the kernel via auxdata.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev_class: Pass a struct ofpbuf * to rx_recv()
Simon Horman [Wed, 15 Jan 2014 08:17:00 +0000 (17:17 +0900)]
netdev_class: Pass a struct ofpbuf * to rx_recv()

Update the netdev_class so that struct ofpbuf * is passed to rx_recv()
to provide both the data and size of the data to read a packet into.

On success, update struct ofpbuf size inside netdev_class rx_recv
implementation and return 0. This moves logic from the caller.
On error a positive error code is returned, whereas previously
a negative error code was returned. This is a more common convention.

This patch should not have any behavioural changes.

This patch is in preparation for the netdev-linux variant of rx_recv()
making use of headroom in the struct ofpbuf * parameter to push a VLAN tag
obtained from auxdata.

Signed-off-by: Simon Horman <horms@verge.net.au>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Fix path for distcleaning ovs-controller.8
Joe Stringer [Fri, 10 Jan 2014 21:45:47 +0000 (13:45 -0800)]
tests: Fix path for distcleaning ovs-controller.8

Fixes the following error on distcheck:-

ERROR: files left in build directory after distclean:
./tests/test-controller.8
make[1]: *** [distcleancheck] Error 1

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-monitor: Change global rwlock into mutex.
Ben Pfaff [Wed, 15 Jan 2014 20:37:04 +0000 (12:37 -0800)]
ofproto-dpif-monitor: Change global rwlock into mutex.

Nothing ever took monitor_rwlock's read lock, so it might as well be a
mutex.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Add more lock annotations.
Ben Pfaff [Wed, 15 Jan 2014 18:22:20 +0000 (10:22 -0800)]
ofproto-dpif: Add more lock annotations.

This annotation would have caught the bug fixed by commit 491a67a0005347130
(ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
CC: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agodatapath: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
Thomas Graf [Tue, 14 Jan 2014 09:27:02 +0000 (01:27 -0800)]
datapath: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed

While the zerocopy method is correctly omitted if user space
does not support unaligned Netlink messages. The attribute is
still not padded correctly as skb_zerocopy() will not ensure
padding and the attribute size is no longer pre calculated
though nla_reserve() which ensured padding previously.

This patch applies appropriate padding if a linear data copy
was performed in skb_zerocopy().

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.
YAMAMOTO Takashi [Wed, 15 Jan 2014 18:06:40 +0000 (10:06 -0800)]
ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.

Currently xlate_rwlock is recursively acquired.
(xlate_send_packet -> ofproto_dpif_execute_actions -> xlate_actions)
Due to writer-preference in rwlock implementations, this causes
deadlock if another thread tries to acquire the lock exclusively
behind us.

This change avoids the problem by making xlate_send_packet drop
the lock before calling ofproto_dpif_execute_actions.  This is the
simplest fix but opens a race window against port reconfigurations.
Given the way xlate_send_packet is currently used, the race does not
seem a big problem.  An alternative would be passing down the
"xlate_rwlock is held" info to ofproto_dpif_execute_actions.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Update a comment
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:23 +0000 (12:41 +0900)]
bridge: Update a comment

This looks like a leftover of commit 2a73b1d73d.
("bridge: Reconfigure in single pass.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Fix a whitespace error.
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:22 +0000 (12:41 +0900)]
ofproto-dpif-xlate: Fix a whitespace error.

No functional changes.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofat-rwlock: Don't forget to destroy a mutex
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:21 +0000 (12:41 +0900)]
fat-rwlock: Don't forget to destroy a mutex

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoclassifier: Use fat_rwlock instead of ovs_rwlock.
Ben Pfaff [Mon, 13 Jan 2014 19:21:12 +0000 (11:21 -0800)]
classifier: Use fat_rwlock instead of ovs_rwlock.

Jarno Rajahalme reported up to 40% performance gain on netperf TCP_CRR with
an earlier version of this patch in combination with a kernel NUMA patch,
together with a reduction in variance:
    http://openvswitch.org/pipermail/dev/2014-January/035867.html

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agofat-rwlock: New big but fast synchronization primitive.
Ben Pfaff [Mon, 13 Jan 2014 19:17:55 +0000 (11:17 -0800)]
fat-rwlock: New big but fast synchronization primitive.

This implements a reader-writer lock that uses a lot of memory (128 to 192
bytes per thread that takes the lock) but avoids cache line bouncing when
taking the read side.  Thus, a fat_rwlock is a good choice for rwlocks
taken frequently by readers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-thread: Add new support for thread-specific data.
Ben Pfaff [Tue, 14 Jan 2014 22:35:48 +0000 (14:35 -0800)]
ovs-thread: Add new support for thread-specific data.

A couple of times I've wanted to create a dynamic data structure that has
thread-specific data, but I've not been able to do that because
PTHREAD_KEYS_MAX is so low (POSIX says at least 128, glibc is only a little
bigger at 1024).  This commit introduces a new form of thread-specific data
that supports a large number of items.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoutil: Set program_name for windows correctly.
Gurucharan Shetty [Mon, 6 Jan 2014 16:47:57 +0000 (08:47 -0800)]
util: Set program_name for windows correctly.

Windows path uses backward slashes. Also, the executable name
has a .exe extension in it. While creating log files, we use
the program name to create log file names. It feels a little odd
to have log file names like ovsdb-server.exe.log etc. Using
_splitpath_s() is a way to have same log file names on both
windows and linux platforms.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agorhel: Enable DHCP support for internal ports.
Flavio Leitner [Tue, 14 Jan 2014 02:22:07 +0000 (00:22 -0200)]
rhel: Enable DHCP support for internal ports.

The current initscripts ifup-ovs brings up internal ports as
an ordinary ethernet device, so BOOTPROTO=dhcp|none does not
consider any OVS/bridge detail.

Since DHCP requires a port in the bridge to reach the server,
bring up the required port before in the same way it does for
OVS bridge.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoofproto-dpif: Un-wildcard nw_frag only for protocols that have fragments.
Ben Pfaff [Fri, 10 Jan 2014 23:17:43 +0000 (15:17 -0800)]
ofproto-dpif: Un-wildcard nw_frag only for protocols that have fragments.

The revalidator code in ofproto-dpif-upcall.c, in revalidate_ukey(),
deletes any datapath flow for which the kernel reports wildcarded bits
that userspace requires to be matched.  Until now, a couple of pieces of
code in ofproto-dpif always marked nw_frag (which tracks whether a packet
is an IPv4 or IPV6 fragment) as exact-match.  For non-IP protocols, this
wasn't meaningful, so adding such a flow to the datapath and then receiving
it back caused nw_frag to become wildcarded, so revalidate_ukey() always
deleted them.

This fixes the problem by only un-wildcarding nw_frag for protocols where
it is defined (IPv4 and IPv6).

Noticed while observing CFM traffic (which isn't IP based) over a tunnel.

Reported-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotunnel: Un-wildcard only flags that really exist in tnl_xlate_init().
Ben Pfaff [Fri, 10 Jan 2014 23:14:27 +0000 (15:14 -0800)]
tunnel: Un-wildcard only flags that really exist in tnl_xlate_init().

The revalidator code in ofproto-dpif-upcall.c, in revalidate_ukey(),
deletes any datapath flow for which the kernel reports wildcarded bits
that userspace requires to be matched.  Until now, tnl_xlate_init() marked
every bit in the tunnel flags as required to be matched.  Since most of
those bits don't actually have defined flags, adding such a flow to the
datapath and then receiving it back caused those bits to become wildcarded,
which meant that revalidate_ukey() always deleted them.

This fixes the problem by only un-wildcarding defined flags.

Reported-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Avoid unnecessarily installing datapath flows.
Ben Pfaff [Mon, 13 Jan 2014 23:33:27 +0000 (15:33 -0800)]
ofproto-dpif-upcall: Avoid unnecessarily installing datapath flows.

handle_upcalls() always installed a flow for every packet, as long as
the datapath didn't already have too many flows, but there are cases where
we don't want to do this:

    - If we get multiple packets in a single microflow all in one batch
      (perhaps due to GSO breaking up a large TCP packet for sending to
      userspace, or for another reason), then we only need to install the
      datapath flow once.

    - For a slow-pathed flow received via a slow-path action in the kernel,
      we know that the kernel flow is already there (because otherwise it
      would have been received as "no match" instead of an action), so
      there is no benefit to reinstalling it.

Noticed because a CFM slow-pathed flow was getting reinstalled every time
a CFM packet was received.

Reported-by: Guolin Yang <gyang@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetlink: Update comment for nl_dump_start().
Joe Stringer [Mon, 13 Jan 2014 21:50:22 +0000 (13:50 -0800)]
netlink: Update comment for nl_dump_start().

The function comment still referred to a 'msg' variable, which has been
renamed.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
[blp@nicira.com did further proofreading]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosFlow: clear the padding
Francesco Fusco [Thu, 19 Dec 2013 17:16:24 +0000 (18:16 +0100)]
sFlow: clear the padding

putString pads the string to the 4-byte boundary without
clearing the "padded" memory. This patch simply set the
padding to zero.

Signed-off-by: Francesco Fusco <ffusco@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdbmonitor: Remove.
Ben Pfaff [Fri, 10 Jan 2014 23:25:40 +0000 (15:25 -0800)]
ovsdbmonitor: Remove.

ovsdbmonitor was poorly maintained and not widely used.

Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Add more thread safety annotations.
Ben Pfaff [Fri, 10 Jan 2014 19:36:35 +0000 (11:36 -0800)]
ofproto: Add more thread safety annotations.

These would have found the problem fixed in commit c7be3f559349 (connmgr:
Fix attempt to take mutex recursively when exiting fail-open.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUpdate build requirements.
Ben Pfaff [Tue, 31 Dec 2013 22:23:34 +0000 (14:23 -0800)]
Update build requirements.

Libtool is now required as of commit 38b7a52b61 (openvswitch: Use libtool
and allow building shared libs).

It seems that a build requirement for Python slipped in a while back, for
generating ovs-vswitchd.conf.db.5, and no one complained, so we might as
well make it official.  (That will let us simplify some bits of the build,
too, since they won't have to be conditional on Python anymore, so I'm all
in favor of this change.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoconfigure: Make autoconf fail if libtool is not installed.
Ben Pfaff [Tue, 31 Dec 2013 22:20:01 +0000 (14:20 -0800)]
configure: Make autoconf fail if libtool is not installed.

Otherwise users get an error later like:
    ./configure: line 5093: syntax error near unexpected token
    `disable-shared' ./configure: line 5093: `LT_INIT(disable-shared)'
It's probably friendlier to make configuration fail earlier.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofedora package: fix systemd ordering and deps.
Flavio Leitner [Thu, 9 Jan 2014 03:04:33 +0000 (01:04 -0200)]
fedora package: fix systemd ordering and deps.

There is a chicken and egg issue where common OVS
configuration uses a controller which is only accessible
via the network. So starting OVS before network.target
would break those configurations.

However, the network doesn't come up after boot because
OVS isn't started until after the network scripts tries
to configure the ovs.

This is partially fixed by commits:
   commit: 602453000e28ec1076c0482ce13c284765a84409
   rhel: Automatically start openvswitch service before bringing an ovs interfa

   commit: 3214851c31538e8690e31f95702f8927a8c0838b
   rhel: Add OVSREQUIRES to automatically bring up OpenFlow interface dependencies

But still there is the dependency issue between network.target
and openvswitch which this patch fixes it.  It provides two systemd
service units. One to run at any time (openvswitch-nonetwork.service)
which runs 'ovs-ctl start' and the other one (openvswith.service) to
run after network.target which works as a frontend to the admin.

The openvswitch-nonetwork.service is used internally by the
'ifup-ovs/ifdown-ovs' scripts when adding or removing ports to
the bridge or when the openvswitch.service is enabled by the admin.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agobfd: Fix cpath_down set failure.
Alex Wang [Thu, 9 Jan 2014 02:51:43 +0000 (18:51 -0800)]
bfd: Fix cpath_down set failure.

Commit ccc09689 (bfd: Implement Bidirectional Forwarding Detection.)
set the bfd local diagnostic to "Concatenated Path Down" in response
to the set of cpath_down only when the current local diagnostic is
"None".  However, since the bfd local diagnostic is not reset when
the bfd state is restored from last erroneous state, the set of
cpath_down will not update the local diagnostic in that case.

This commit fixes the bug by always checking for local diagnostic
change when cpath_down is set or reset.

Bug #22625
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Use separate threads for forwarding.
Ben Pfaff [Sat, 28 Dec 2013 01:00:30 +0000 (17:00 -0800)]
dpif-netdev: Use separate threads for forwarding.

For now, we use exactly two threads.  Presumably at some point we will want
to make this configurable.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Make thread-safety much more granular.
Ben Pfaff [Wed, 8 Jan 2014 23:58:11 +0000 (15:58 -0800)]
dpif-netdev: Make thread-safety much more granular.

This will allow for parallelism in multithreaded forwarding in an upcoming
commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Introduce new mutex to protect queues.
Ben Pfaff [Fri, 27 Dec 2013 17:42:51 +0000 (09:42 -0800)]
dpif-netdev: Introduce new mutex to protect queues.

This is a first step in making thread safety more granular in dpif-netdev,
to allow for multithreaded forwarding.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Break actions out into new struct dp_netdev_actions.
Ben Pfaff [Wed, 8 Jan 2014 22:37:13 +0000 (14:37 -0800)]
dpif-netdev: Break actions out into new struct dp_netdev_actions.

This is analogous to the split between rule and rule_actions in
ofproto.  As there, it will allow retaining a reference to a rule's
actions, while processing them, without having to retain a reference
to the rule itself.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Take advantage of ovs_refcount for dp_netdev.
Ben Pfaff [Sat, 28 Dec 2013 03:41:10 +0000 (19:41 -0800)]
dpif-netdev: Take advantage of ovs_refcount for dp_netdev.

By making "destroyed" own a reference, we can treat dp_netdev's ref_cnt
like any other in Open vSwitch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: Introduce a new 'struct ovs_refcount'.
Ben Pfaff [Sat, 28 Dec 2013 03:39:24 +0000 (19:39 -0800)]
ovs-atomic: Introduce a new 'struct ovs_refcount'.

This is a thin wrapper around an atomic_uint.  It is useful anyhow because
each ovs_refcount_ref() or ovs_refcount_unref() call saves a few lines of
code.

This commit also changes all the potential direct users over to use the new
data structure.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: Add atomic_destroy() and use everywhere it is needed.
Ben Pfaff [Wed, 8 Jan 2014 18:42:12 +0000 (10:42 -0800)]
ovs-atomic: Add atomic_destroy() and use everywhere it is needed.

C11 is able to require that atomics don't need to be destroyed, but some
of the OVS implementations do.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: New functions atomic_flag_init(), atomic_flag_destroy().
Ben Pfaff [Thu, 9 Jan 2014 01:13:28 +0000 (17:13 -0800)]
ovs-atomic: New functions atomic_flag_init(), atomic_flag_destroy().

Standard C11 doesn't need these functions because it is able to require
implementations not to need them.  But we can't construct a portable
implementation that does not need them in every case, so this commit adds
them.

These functions are only needed for atomic_flag objects that are
dynamically allocated (because statically allocated objects can use
ATOMIC_FLAG_INIT).  So far there aren't any of those, but an upcoming
commit will introduce one.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Remove max_mtu tracking.
Ben Pfaff [Mon, 23 Dec 2013 23:46:22 +0000 (15:46 -0800)]
dpif-netdev: Remove max_mtu tracking.

Normally all the ports have the same mtu anyhow, so there is little
advantage in keeping track of the maximum mtu on a per-bridge basis.  In
upcoming commits, tracking mtu will require more locking and present
even less advantage (because the packet buffer will become per-thread, so
that reallocating once per thread becomes essentially a null cost).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>